Get Started Elmer
Get Started Elmer
Rich Bayless
August 2, 2022
Get Started with Elmer on Windows
There is one chapter that discusses installing the Elmer Virtual Machine in Windows. There is another
chapter discussing installing Elmer in Linux, which may be useful to new users of Elmer in Linux.
Latest documentations and program versions of Elmer are available (or links are provided) at http:
//www.csc.fi/elmer.
Copyright information
This document is licensed under the Creative Commons Attribution-NonCommerical 3.0 License. To view
a copy of this license, visit http://creativecommons.org/licenses/by-nc/3.0/.
Initially this document, Get Started with Elmer, has been written by Rich Bayless. External contributions
are welcome.
2
Contents
Table of Contents 3
1 Get Started with Elmer on Windows 5
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Windows – Download 6
2.1 Download Elmer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Download Elmer Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3 Download Paraview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3 Windows – Install 10
3.1 Install Elmer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2 Install Paraview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5 Introduction to Paraview 19
6 Introduction to ElmerVTK 21
3
10 Elmerfem Wiki 76
10.1 Main . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
10.2 Frequently Asked Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
10.3 Parallel Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
10.4 Using the SaveLine solver for parallel computations . . . . . . . . . . . . . . . . . . . . . . 79
10.5 Making Animations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
10.6 MATC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
10.7 ParaView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
10.8 Crystal growth and phase change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
10.9 Lubrication and squeezed films . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
10.10Pulling, drawing and extrusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
10.11Electromigration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
10.12Wood Modelling with Elmer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12 Linux 100
Chapter 1
1.1 Introduction
Getting started using Elmer should be a smooth and easy process. Beginners at all levels may have issues
with getting started and that can be a barrier to the use of Elmer. This chapter is meant to provide help to
beginners, to make it easy to start using Elmer and ElmerGUI.
A typical use case would be for someone with a particular application in mind that wants to find out
whether Elmer is a suitable choice. Being able to quickly download and run an Elmer tutorial should make
the experience easy enough so the user gets an answer in a short amount of time.
Windows – Download
This chapter will discuss installing Elmer in Windows. Windows 10 is used for these instructions. The steps
should also work with earlier versions of Windows, as long as they are 64 bits.
https://www.nic.funet.fi/pub/sci/physics/elmer/
Once on that page, there are several folders to notice, such as ‘bin’, ‘doc’, ‘slides’, and ‘tests’, as shown
in Figure 2.1. To download Elmer, click on ‘bin’ and then ‘windows’, and the list of Elmer installers will
appear, as shown in Figure 2.2.
There are four main categories to select from, such as ‘gui-mpi’, ‘gui-nompi’, ‘nogui-mpi’, and ‘nogui-
nompi’. There also some labelled with ‘rel9.0’, which are builds of the most recent official release and
should be considered as the stable builds. The other files not labelled with ‘rel9.0’, are the nightly builds and
are the most recent builds. The nightly builds are actually quite stable, so feel free to start with the nightly
build.
For the first time installing Elmer in Windows, it is recommended to select ‘gui-mpi’, and ‘rel9.0’. The
files with .exe extension are an installer for Windows, which is what is recommended. So out of the entire
list, we want to download this file:
ElmerFEM-gui-mpi-Windows-AMD64-rel9.0.exe
Conveniently, this is the first file in the directory listing. If you decide to start with the nightly build, then
download this file:
ElmerFEM-gui-mpi-Windows-AMD64.exe
which is the third entry in the directory listing. If you can’t decide, download both files and you can try
them out separately.
https://www.nic.funet.fi/pub/sci/physics/elmer/
Note the two files ending in *.zip and *.tar.gz contain compressed copies of eleven out of fourteen of the
documentation files. Downloading the *.zip file should be sufficient for most Windows users to get started
with Elmer. Feel free to download all documents and all *.zip files in this directory.
Start with the ‘GetStarted’ manual, which is this document. Then look at these three documents, ‘Elmer-
Tutorials’ for the ElmerGUI tutorials, ‘ElmerGUI Manual’ for instructions about ElmerGUI, and ‘Elmer-
SolverManual’, which describes each solver in detail.
Finally, be sure to download ‘tutorials-GUI-files.zip’, because this zipped folder contains working ex-
amples of ElmerGUI projects, one for each tutorial.
https://www.paraview.org/download/
Select one of the top items, in particular a file ending in .exe, so you will download a Windows installer
version. You should now have a file like this:
ParaView-5.9.0-RC3-Windows-Python3.8-msvc2017-64bit.exe
On the Paraview download page, there are several other files, such as ‘getting started’, ‘tutorial’, that
would be very useful to download. This would be a good opportunity to download the instructions for
Paraview.
Windows – Install
Double click on the Elmer installer .exe file. The installation process should look like figures 3.1 through
figures 3.9 on the following pages.
Figure 3.1: Elmer installation, click on the More info button, then Run anyway
You may get a blue screen while beginning the installation. The first blue screen has a small button,
‘More info’, that you must click on to get the second blue screen, where you will click on ‘Run anyway’.
From there just take the default actions up until you reach ‘Install Options’, where you have a chance to
select adding the path to Elmer. Be sure to click on ‘Add Elmer...’, either for all users or for current user.
If you aren’t sure, pick ‘for current user’. Also put a check into the check box for ‘Create Elmer Desktop
Icon’. From here, take the defaults and it should properly install Elmer.
Figure 3.3: Select Install Option: Add Elmer to the system PATH for current user
If this is the first time installation of Elmer, be sure to select all four components. If upgrading or
reinstalling, then you can uncheck the box for ‘MS MPI’, no need to reinstall MPI.
Figure 3.6: Agree to the license and take the default directory
If you see the below Figure 3.8 during the installation process, don’t worry, just go ahead and click on
the OK button. This message appears if you have previously installed Microsoft MPI, and as the notice box
says, there is already a version of MPI installed. This will happen every time you install a newer version of
Elmer with MPI, regardless of whether you uninstall Elmer first, or if you just install a newer version on top
of an old version. The Elmer uninstaller doesn’t uninstall Microsoft MPI, so if you want to uninstall MPI,
you will have to go find the right instructions from Microsoft.
After the installation process has finished, you should see an icon on the desktop for ElmerGUI. Go
ahead and double click on the icon to start ElmerGUI. Please refer to the ElmerGUI manual for instructions
on using ElmerGUI, and try out the first tutorial.
Since Paraview hasn’t been installed yet, after loading the first tutorial if you click on the ‘Run’, then on
‘Start Paraview’, nothing much will happen. If you hover the cursor over the flag after clicking on it, you
will see in the lower left of the window the message ‘Unable to start Paraview’. In the meantime, to start
ElmerVTK click on the top menu bar icon ‘Run’, then click on ‘Start ElmerVTK’.
The installer will not add Paraview to the system path, we will have to perform that step ourselves.
As part of the operation of the Elmer installer, the path to Elmer will be created. Let’s verify that the path
to Elmer exists. Open the window then select ‘path’ and click ‘edit’, as shown in figure 4.2. Notice Elmer is
at the bottom of the list, since it was the most recently installed program.
One way to find out what is the exact path to your installation of Paraview is as follows. Open File
Explorer and select your system drive, such as C:, then open Program Files and then open the folder for
Paraview. Next open the bin folder and you will see an entry for Paraview.exe, this is the location that you
want to enter into the path, as shown in figure 4.3.
Copy the path to the bin folder into the new path environment variable. Tip: you can actually copy and
paste the path from File Explorer into the new environment path variable, as shown in figure 4.4.
Not completely necessary, but just suggested, you may want to move the path to Elmer up to the top of
the list, as shown in figure 4.5.
Finally, move the entry for the path to Paraview up to just under the path to Elmer, as shown in figure 4.5.
Click ‘ok’ to save your edits, then exit settings.
Introduction to Paraview
If you have loaded a valid Elmer .vtu file, upon opening Paraview you will see a blank grey screen, and many
small icons, as shown in Figure 5.1.
On the left side of the screen, as shown in Figure 5.2, near the middle is a light green button ‘Apply’.
Click on that button and the geometry will appear.
Figure 5.2: Left side click Apply, right side geometry appears
Next, look on the left side below the window showing the variables, as shown in Figure 5.3, for a box
labelled ‘Coloring’. Click in that box for a drop down selection, pick ‘potential’, then click ‘Apply’. The
potential will appear superimposed on the geometry, along with a color bar with the range of the potential.
That is a very basic introduction to Paraview. For more information, refer to the Paraview website.
Introduction to ElmerVTK
ElmerGUI is equipped with ElmerVTK, a graphical post processor. While ElmerVTK is not as powerful as
Paraview, ElmerVTK is simpler to use. After a successful ElmerSolver run, start ElmerVTK by clicking on
‘Run’ on the top menu bar, then click on ‘Start ElmerVTK’, as shown in Figure 6.1.
The ElmerVTK window will open, displaying the geometry, as shown in Figure 6.2. Click on the menu
bar for the ‘Isocontours’ menu. In two places, variable and color, click for the drop down menu and select
‘potential’.
The isocontours of potential will show, superimposed on the geometry, as shown in Figure 6.3. The
number of isocontours look a little sparse, so open up the Isocontours menu again, and this time change
number of ‘Contours’ from 10 to 50. That looks better.
Next, let’s add a color bar, as shown in Figure 6.3, so we can see the range of values shown on the plot.
We used a 2D example, so the choice of Isocontours made sense. If we had used a 3D example, like the
first heat tutorial, then Isosurfaces would make more sense.
As promised, ElmerVTK is fairly simple to use, and will make some pretty nice graphics in a short
amount of time.
Windows includes the command prompt window and also Powershell, which is a more recent version.
For our purposes, either one is sufficient, and these notes will apply to both.
First, one can open a command window by clicking on the Start button, and then just start typing ‘com-
mand’, and select the bar for ‘Command Prompt’. Likewise, click on the start button and start typing
‘powershell’, and select the bar for ‘PowerShell’. From here on to make things simpler, we will only use
‘Command Prompt’ for these examples.
The Command Prompt window will open, and the default directory (C:/Users/...>) will be shown with
a blinking cursor. Since the default directory is almost never the directory you want, there must be a better
method of opening a command prompt window.
Windows includes File Explorer, which most people use all the time to navigate directories and files
within Windows. One way to open File Explorer is to click on the start button, and start typing ‘file ex-
plorer’ and select the bar for ‘File Explorer’. You may already have shortcuts to open File Explorer on your
desktop or on the taskbar, so use whatever method you prefer to open File Explorer.
Let’s assume that you have already created C:/Elmer/PassiveElements, by copying one of the
tutorials. Open File Explorer and navigate to the PassiveElements folder. You will see the folder with the
directory contents on the right, and there will be a bar near the top containing: This PC > Local Disk
(C:) > Elmer > PassiveElements.
Click in the bar with the mouse, and the contents will change to: C:/Elmer/PassiveElements,
and will be highlighted in blue.
While the content is highlighted blue, type ‘cmd’ and press enter.
A command prompt window will open up, and will be located in the PassiveElements folder.
One can use the same method to open a Powershell window. While the content is highlighted blue, type
‘powershell’ and press enter.
A Powershell window will open up, and will be located in the PassiveElements folder.
The command prompt accepts many commands, such as type ‘dir’, press enter, and a directory listing
will appear with the files inside the current folder. Changing directories is done with the ‘cd’ command.
Type ‘cd ..’ to change to the parent directory, and type ‘cd PassiveElements’ to change back to the sub
folder. If you use the File Explorer and cmd approach to open your command prompt windows, you won’t
need to use ‘cd’ much.
elmergrid 1 2 mesh
pause
elmersolver
pause
This assumes you have a valid elmergrid geometry input file named mesh.grd, an elmer sif file named
case.sif, and a file named ELMERSOLVER_STARTINFO in the same folder as the batch file. In File
Explorer, double click on the file run.bat and a command window will open and Elmergrid will execute,
followed by a pause. Press any key, and elmersolver will execute, followed by a pause. You have run an
Elmer case inside a command window, but without having to actually open a command window or type any
commands in the window. If you are running the same example over and over, and making changes to the
sif file each time, then using a batch file will save some time.
http://www.elmerfem.org/forum/
There are quite a few example cases contributed by users, and are described nicely in the sub-forum,
‘Contributed Cases’.
https://www.youtube.com/user/elmerfem/videos
Running Elmer solutions in parallel is not difficult, whether run from a command prompt or from within
ElmerGUI. As always, make sure you have a project that runs to completion in serial, with a single processor,
then you can convert to a parallel run.
Let’s rename two of the three folders, so we can keep track of our work. Add a suffix of ‘serial’ and of
‘parallel’, as shown in Figure 8.2. Don’t rename the folder ending in ‘- Copy’, we’ll need it later on.
Open the folder FlowStepGUI-serial containing the Flow Step tutorial, there will be 6 files as
shown in Figure 8.3.
Start ElmerGUI and Load Project from the folder FlowStepGUI-serial. Once the project has
loaded, click on Run, Parallel Settings, you should see the settings window as shown in Figure 8.4. Verify
that the box Use parallel solver IS NOT checked. Click on the Accept button at the bottom of
the window.
Click on the right green arrow to ‘Generate and save sif, save project, then run the solver’. The solver
log window and the convergence history window should pop up and the solver will finish in 4 or 5 seconds.
Refer to Figure 8.5.
Take a look at the folder FlowStepGUI-serial, now there will be 9 or 10 files, as shown in Fig-
ure 8.6. The file ‘case.sif’ was generated by ElmerGUI and the file ‘case_t0001.vtu’ is the Paraview results
file.
To activate parallel solutions, check the check box for Use parallel solver. To change back to
serial solution, uncheck this box. Second, adjust the Number of processes to match the number of
physical processors in your system.
Third, enter the name of the executable for MPI. For Windows, the Elmer Installer will install Microsoft
MPI the first time the installer is run, and the name of the executable is mpiexec. The Microsoft MPI
installer will add C:\Program Files\Microsoft MPI\Bin\mpiexec.exe to the system Path,
so you should not need to add the directory path to the executable, so just enter mpiexec.
When using Linux (such as in the Elmer Virtual Machine), the MPI executable is named mpirun, so
one would add mpirun into the Executable box.
Fourth, enter the following into the Arguments box: -n %n ElmerSolver_mpi.exe. The ‘-n’
indicates that the number of processes will be next, followed by ‘%n’ which is a variable placeholder equal
to the number of processes selected in the second step above.
Fifth, enter the following into the Divide box: ElmerGrid 2 2 %msh -partdual -metiskway
%n. This command calls ElmerGrid with formats 2 and 2, meaning input an Elmer mesh.* and output an
Elmer mesh.*. The %msh is a variable placeholder equal to the Mesh name. The commands -partdual and
-metiskway are commands used by ElmerGrid when calling Metis to perform the partitioning of the mesh.
Finally, the %n is a variable placeholder equal to the number of processes selected in the second step above.
The Merge box is not needed because Paraview takes care of merging the resulting .vtu files when
displaying the results.
Click on the Accept button at the bottom to save your settings and close the window.
The key error message is ‘WARNING:: LoadMesh: Requested mesh > ./. < in partition 4 does not
exist!’. Remove the spaces from the directory name, and the errors will go away. The problem is that the
call to ElmerGrid uses the path to the folder, up to the first space. If you look at the example folders, you
will see there are now four folders, and the fourth folder will contain the partitioned mesh files.
http://www.nic.funet.fi/pub/sci/physics/elmer/slides/
The original wiki page described how to create a mesh that contains multiple bodies with Salome MECA
2009 and how to import it in Elmer. There is a video on Youtube from 2015 based on the elmerfem wiki:
https://www.youtube.com/watch?v=xfMLtywHSr4
This section in Get Started with Elmer has been rewritten in 2021 with new graphics using Salome 9.7.0 and
Elmer 9.0.
https://www.salome-platform.org/
and follow the instructions to install Salome. The Salome website has lot’s of information, such as user
tutorials at:
https://www.salome-platform.org/user-section/salome-tutorials/salome-tutorial
The tutorials will be very helpful for first time users of Salome. The first tutorial shows the basics of
creating geometry, partitioning, and meshing. After installing and starting Salome, follow these instructions.
Note that we assume you know the basics of Salome, and so we will give high level instructions.
In this example we deal with a simple case, with three boxes. We create two boxes which are intersecting
each other, using New Entity -> Primitives -> Box, as shown in Figure 9.2.
Create Box_1 using the default size at the origin, and increase Dx to 300, as shown in Figure 9.3.
Create Box_2 using the default size at the origin, and increase Dy to 300, as shown in Figure 9.4.
Cut Box_2 using Box_1 as the tool, which will create the third box, as shown in Figure 9.6. Of course,
you could as well define three separate boxes that share their respective surfaces geometrically. In this
example, let’s stick with the two intersecting boxes.
We now have three boxes, named Box_1, Box_2, and Cut_1, as shown in Figure 9.7. Note the small
icon shown just above the little tool tip ‘Global Panning’, which expanded the object to fill the view port.
Also, note that we can check the shape of each box using the visibility icon, the little eye just to the left of
the entity in the geometry tree.
Next, let’s cut again to make another small box, this time using Box_2 to cut Box_1, as shown in
Figure 9.8. It may seem that some of the boxes disappear after performing the cut, but they are just invisible,
so use the eye icon to make them reappear.
For the last step, select the Operation, Boolean, Common, menu item, as shown in Figure 9.9.
We have successfully created three solid objects. The objects share common nodes at the edges of each
object and the volumes of each object do not overlap.
We have one more step before we can start meshing the geometry. We need to be able to select bodies
within the partition, so we must use the menu selection New Entity -> Explode, as shown in Figure 9.14.
Expanding Partition_1 in the geometry tree shows three solids are now available, as shown in Figure 9.16.
Next, make sure that Partition_1 is highlighted in the tree, then select Mesh -> Create Mesh menu option,
as shown in Figure 9.18.
Change Max size to 20 and Min size to 10, as shown in Figure 9.21. Netgen will use these parameters to
decide on element sizes. Notice that Netgen is also capable of generating second order elements (in 2D and
3D) and quad dominated elements (in 2D only), just by checking the appropriate boxes in this window.
When using an Elmer solver for elasticity, use of second order elements is recommended. When using
an Elmer solver for Navier-Stokes flow, some experts recommend using second order elements.
As a side note, you can create a first mesh using first order elements, and then create a second mesh
using second order elements, and export each mesh into two separate UNV files. Then use the UNV files to
compare the effect of first order versus second order elements in Elmer.
The final mesh results summary will then be displayed, as shown in Figure 9.24.
The computed mesh will be as shown in Figure 9.25. Notice that under Mesh_1, there is an entry for
‘Groups of Volumes’, but doesn’t show anything for Faces.
Accept the default settings and Apply and Close, as shown in Figure 9.27.
We now have Groups of Faces under the mesh tree, as shown in Figure 9.28.
Save the file, with an appropriate name, in an appropriate directory, as shown in Figure 9.30. Salome
will automatically add the ‘unv’ file extension to the file name.
We now have a UNV file containing all the information needed by Elmer to import the example Salome
CAD model as three bodies with sixteen boundaries and with a refined tetrahedral mesh.
Here is a short version of the steps to be taken in Salome to create multiple bodies for export to Elmer.
» Create your 3D solid bodies. They should not overlap their volumes and they should share common
nodes.
» Highlight the solid bodies and then ‘Operations -> Partition’. Be sure to select Resulting Type as
‘solid’.
» Highlight the Partition, and then ‘New Entity -> Explode’. Be sure to select Sub-shapes Type as ‘solid’.
» Select the Partition and then ‘Mesh -> Create Mesh’. In the Algorithm box, select ‘NETGEN 1D-2D-
3D’. In the Hypothesis box, select ‘NETGEN 3D Parameters’. Change Max and/or Min sizes as needed, and
select second order as needed.
» Highlight the Mesh and then ‘Mesh -> Face groups separated by sharp edges’, and accept the default
settings.
» Highlight the Mesh and then ‘File -> Export -> UNV file’, and save the UNV file with an appropriate
name and directory.
For non-GUI users of Elmer, use ElmerGrid in a command prompt or terminal window to convert the
UNV file into Elmer mesh format with this command:
ElmerGUI can read the UNV file directly, and ElmerGUI will then call ElmerGrid in the background to
perform the conversion to Elmer mesh format. This section shows step by step how to read and use the UNV
file in ElmerGUI.
As a side note, non-GUI users of Elmer may find it useful to use ElmerGUI to perform the conversion
from UNV to Elmer mesh format. ElmerGUI can group boundary faces together, thereby reducing the
number of boundary faces into manageable groups. When ElmerGUI saves the mesh to Elmer mesh format,
the reduced number of boundary groups will be written to the files.
ElmerGUI will read the file and based on the file extension, ElmerGUI will automatically call ElmerGrid
to perform the conversion, as shown in Figure 9.32.
Examine the model parameters by selecting Model -> Summary from the menu, which will open a
window to display the various dimensions of the mesh and model, as shown in Figure 9.33.
Having a model with sixteen boundaries can be useful, but sometimes we only need a couple of the
boundaries. ElmerGUI can group faces together, which will reduce the number of boundaries, making it
easier to manage working with the boundaries.
Use the mouse and double click on a face to select that face, followed by holding down the ctrl key and
double clicking on two more faces, so three faces are highlighted, as shown in Figure 9.34.
The three faces will be united into one face, so the list of boundaries will decrease from 16 down to 14
boundaries.
Double click on the new unified face, and select View -> Hide/show selected, as shown in Figure 9.36.
The selected face will be hidden from view, to reveal the interior boundary faces, as shown in Figure 9.37.
This was a brief introduction to importing UNV files into Elmer and ElmerGUI.
Gmsh works well to generate Elmer meshes, and like most three dimensional programs, Gmsh has a
learning curve. This tutorial is meant to show a complete beginner how to get started with Gmsh, and how
to use Gmsh to create meshes for Elmer.
The 3D example we will use for this section will follow the example used for the section titled: ‘ Multiple
bodies from Salome to Elmer’, where we used two boxes to create three separate volumes, along with 16
separate boundaries. The three separate volumes will then be meshed, ready to load into ElmerGUI, for use
with ElmerSolver.
The first step should be to select File -> New, as shown in Figure 9.39.
Pick your own desired file name and directory and click on Save, as shown in Figure 9.40.
Gmsh will give you the option to select your Cad Factory, either OpenCASCADE or Built-in, as shown
in Figure 9.41, please click on OpenCASCADE.
You now have a new file with your desired filename and directory, loaded and active in Gmsh, as shown
in Figure 9.42. Notice the bottom bar, which shows ‘Done reading’ with the path to our new file.
Gmsh writes actions to the .geo file as the actions are performed. The bottom bar says ‘Done reading’,
because Gmsh reads the .geo file after writing the .geo file. Let’s open the directory containing the .geo file,
as shown in Figure 9.43.
Open the .geo file using your favorite text editor, as shown in Figure 9.44. As you can see, Gmsh has
written two lines into the .geo file, and shows our selection of OpenCASCADE for the CAD Factory. We will
perform this same action, opening the .geo file using a text editor, at several points in this tutorial, because it
is helpful in understanding the actions performed by Gmsh.
The pop up window titled ‘Elementary Entity Context’, will open, as shown in Figure 9.46. Notice
that moving the mouse around the viewport will cause the red box to move as well. Also notice the text
instructions in the viewport, in particular, notice ‘e’ to add box and ‘q’ to quit. Either pressing the ‘e’ key or
clicking on ‘Add’, will add a box to the geo file.
We want to force the location of the box to be at the origin. Click on the three check boxes next to
‘Freeze’, which will freeze the x, y, and z locations from moving with the mouse motion. Enter 0 into the X,
Y, and Z entry boxes, as shown in Figure 9.47. You can see that the lower left corner of the red box is now
located at the origin.
Let’s set the size of the box to be DX = 300, DY = 200, and DZ = 200, by typing the numbers into the
entry boxes, followed by clicking on ‘Add’, as shown in Figure 9.48. Elmer uses SI units, (actually Elmer is
unit-less, but in practical terms think of SI units as the active units in Elmer) so when running ElmerSolver
these dimensions will be in meters. You can scale the dimensions in Elmer, look up ‘Coordinate Scaling’,
which will allow one to easily convert from millimetres to meters.
Let’s open up our .geo file in our text editor, to see what Gmsh has done so far, as shown in Figure 9.49.
You will see that we have successfully added a box, located at the origin, and with our dimensions.
Notice that the pop up window stayed open after clicking on ‘Add’, waiting for us to either enter more
boxes or to press ‘q’ to close the pop up window. Let’s add a second box at the origin, with dimensions of
DX = 200, DY = 300, and DZ = 200, and then click on ‘Add’, as shown in Figure 9.50.
Let’s open up our .geo file in our text editor, and we see that a second box has been added, as shown in
Figure 9.51.
If we collapse the Elementary Entities menu, as shown in Figure 9.53, we will notice the menu item
‘Remove last script command’. Click on that menu item, and check the geo file, you will see the third box
is now gone.
We now have two boxes that are overlapping, and we need to turn them into three separate volumes. In
order to work on volumes, we need to be able to select the volumes, but we only see points and line segments
in the viewport. With the mouse over the viewport, double left click (LMB) and the viewport menu will pop
up. Select ‘Geometry visibility’ and click on ‘Volumes’, as shown in Figure 9.55. You can see two yellow
spheres, one for each of the two boxes, in the viewport, ready to be selected.
9.3.5 Fragments
Expand ‘Elementary entities’ under ‘Geometry’, and then expand ‘Boolean’. Click on ‘Fragments’, and
another pop up window will open, as shown in Figure 9.56. Be sure to have both options checked, ‘Delete
object’ and ‘Delete tool’.
We need to select both an object and a tool, in this example, one box will be the object and the other box
will be the tool. In this case, it doesn’t matter which is which. The ‘Fragment’ command will then use the
object and the tool to create volumes as if three commands were performed with ‘Intersection’ and ‘Union’
on the object and the tool. Click on one of the yellow spheres, which will select the object, then press the
key ‘e’ to end the first selection, as shown in Figure 9.57.
Next click on the second yellow sphere, then press the ‘e’ key to end the second selection. Since the
second time we pressed the ‘e’ key ended the selection of both object and tool, Gmsh then performed the
‘Fragment’ command, as shown in Figure 9.58. We now have three smaller separate volumes, and the first
two boxes have been deleted. Finish up by pressing the ‘q’ key, to close the pop up window.
If you don’t get the steps right the first time, no problem, just go ahead and ‘Remove last script command’
and try again.
Figure 9.58: Press ‘e’ the second time, then press ‘q’
Let’s take a look at the geo file, and we see two boxes and a BooleanFragments command, as shown in
Figure 9.59.
Remember we started by saying we need to end up with three volumes and 16 boundaries? If we mesh
the current geo file, we will end up with three volumes and 18 boundaries. Each of the three volumes has six
sides, with will give us 3 x 6 = 18 boundaries. There will be two boundaries between each of the adjoining
cubes, and Gmsh will create individual meshes for each volume, leading to a ‘non-conforming’ mesh. Elmer
will treat each of the three volumes as being separate, such that a heat equation solution won’t conduct across
the two adjoining faces. This issue has appeared in the Elmer Forum many times, so it’s not at all unusual.
Fortunately, Gmsh has a simple solution, just click on ‘Coherence’ under the ‘Elementary entities’ menu.
Now take another look at the geo file, as shown in Figure 9.60. The ‘Coherence’ command must appear
somewhere in the geo file, not necessarily at the end. This command tells Gmsh to create a mesh using all
three volumes, and merges the adjoining boundaries to create a conforming mesh. Meshing and exporting
the geo file at this point will create our desired result, three volumes and 16 boundaries.
9.3.7 Meshing
Collapse the ‘Geometry’ menu and expand the ‘Mesh’ menu, as shown in Figure 9.61.
Click on ‘Tools -> Statistics’ in the top bar, to open a pop up window with statistics about our model,
as shown in Figure 9.62. Keep the Statistics window open as we perform the meshing, this will help us to
see the effect of each action. Note there are three tabs in the Statistics window, take a look at each, and then
keep the ‘Mesh’ tab open.
Click on ‘3D’ in the Mesh menu, and Gmsh will generate the mesh, as shown in Figure 9.63. In the
Statistics window, click on ‘Update’, to see the effect of the meshing operation.
Click on ‘Refine by splitting’, and Gmsh will perform refinement of the mesh, as shown in Figure 9.64.
In the Statistics window, click on ‘Update’, to see the effect of the refinement operation.
If you want to clear the mesh and start over, just click on ‘1D’, which effectively removes the mesh.
This time, click on ‘Set order 2’, you will see the progress note at the bottom of the window stating ‘Done
meshing order 2’. Update the statistics and you will see that the number of nodes has increased, as shown in
Figure 9.65.
9.3.8 Exporting
We are ready to export the mesh, click on ‘File -> Export’, as shown in Figure 9.66.
Pick your desired filename and path, type ‘.msh’ as a suffix to the filename, and click on ‘Save’, as shown
in Figure 9.67.
A pop up window will ask you to choose a Format, select ‘Version 2 ASCII’, as shown in Figure 9.68.
Also be sure to check the box to ‘Save all elements’. Later on, if desired, come back here and try the
other format options. For this particular example, both Version 2 ASCII and Version 4 ASCII load okay in
ElmerGUI. The other options won’t load properly in ElmerGUI.
The mesh will be saved into our desired filename, go ahead and open the mesh file with a text editor, as
shown in Figure 9.69. Notice the first section defines the ‘MeshFormat’, and the version is shown as ‘2.2’.
Navigate to our directory and select the exported Gmsh file ‘getstart1.msh’, as shown in Figure 9.71.
The exported mesh will load and display, as shown in Figure 9.72. Behind the scenes, ElmerGUI uses
ElmerGrid to convert the Gmsh mesh into an Elmer format mesh. Expand the ‘Body’ and ‘Boundary’ entries
under the Geometry tree, and we see we have 3 bodies and 16 boundaries, which is our desired outcome.
Click on ‘Model -> Summary’, and we see that we have 2814 nodes, which matches the number of nodes
we saw in Gmsh Statistics.
We can stop now, as long as we are happy with the mesh as displayed by ElmerGUI.
ElmerGUI will allow us to enter the ‘-merge’ command to be sent to ElmerGrid. Click on ‘Mesh ->
Configure’, as shown in Figure 9.73.
Near the top of the pop up window, click on the radio button next to ‘elmergrid’ and append in the
‘elmergrid String’ box the command ‘-merge 1.0e-5’, as shown in Figure 9.74. Finish by clicking on ‘Apply’.
To activate ElmerGrid with the new command string, click on ‘Mesh -> Remesh’, as shown in Fig-
ure 9.75.
Click on ‘Model -> Summary’, and compare the number of nodes before and after merging and remesh-
ing. If the number of nodes decreases, then you know there were some coincident nodes in your mesh.
Elmerfem Wiki
The Elmer Wiki used to exist at http://www.elmerfem.org/elmerwiki. Some of the pages from
the wiki have been copied from Wayback Machine into this chapter. Note that pages discussing Compilation
are not included, they are a little out of date. The original authors are not known.
10.1 Main
10.1.1 Elmer Wiki
Elmer Wiki is intended to serve as a platform for the exchange of ideas and solutions for Elmer FEM users.
While the main source of information is still at http:///www.csc.fi/elmer these pages provide a media for the
user community to share their work. If you’re interested in contributing to Elmer Wiki, create an account
and have a look at the MediaWiki HandBook to get started.
Q: I edit the .sif file manually but modifications are erased by ElmerGUI
Q: How can I import my .sif file into ElmerGUI?
A: The state of ElmerGUI is defined by the project file which is used to generate the sif file. Therefore
the modifications in the .sif file are not communicated to the ElmerGUI and a .sif file cannot be used as a
starting point for ElmerGUI work.
Q: I try to set a "keyword" value in the .sif file but ElmerSolver gives an error "Unknown specifier" for
property name:"keyword". What’s wrong?
A: The list of known keywords is defined in the SOLVER.KEYWORDS file. The list can never be com-
plete since the code is all the time developing and the user may also invent new variable names. If the type of
the keyword is not known, the user must provide it from one of the following: Logical, Integer, Real, String
and File. Also Equals defines the type implicitly to be of type Real.
A: There are auxiliary solvers SaveLine and SaveScalars that may be used to generate appropriate data
in ASCII format. See the Models manual or search the discussion forum for more information.
Q: I want to use Paraview (or other VTK based visualization software). How should I proceed?
A: You can utilize the ResultOutputSolve with vtu (or vtk) output format. See Models manual for details.
Q: There have been quite few official releases of Elmer. Has the development stopped?
A: No. Elmer is actively developed and each major commit is run against a large number of tests cases.
Therefore we consider the trunk version to be stable and recommend it as starting point for any compilation.
However, we plan to give more regularly official releases in the future.
Q: I would like to contribute but I can’t program, is there anything I could do?
A: Yes. Often in the development defining what equations to solve, setting up appropriate test cases and
creating the computational mesh is easily 80% of the work load. If you can help in these aspects then the
actual coding work will be much more attractive to the developers. Also sharing your simulation work will
benefit the project by attracting new users.
The image was obtained from GnuPlot, with the three different colours representing the data output from
three of the four partition domains. The fourth did not contribute data to the extracted line.
Solver 5
Exec Solver = String "after timestep"
Equation = String "ResultOutput"
Procedure = File "ResultOutputSolve" "ResultOutputSolver"
Output File Name = String "case"
Output Format = String "vtu"
End
Then open the file case*.vtu in ParaView and perform the visualization as explained in the documentation
of ParaView. You may also use other tools based on VTK library (i.e. ViSit)
10.6 MATC
10.6.1 Introduction
Elmer uses MATC to evaluate mathematical expressions in the Solver Input Files. Also ElmerPost includes
MATC. MATC was written by Juha Ruokolainen. You can find the official manual at:
http://www.nic.funet.fi/pub/sci/physics/elmer/doc/MATCManual.pdf
() (parentheses)
’ ’ (SPACE as a separator for vector components)
^ (power)
*/
+-
min(3*4 2) = min(12 6) = 6
while
min((3*4) 2) = min(12 2) = 2
this can lead to strange behaviour of boundary conditions if the parentheses are forgotten.
Under Unix/Linux (and Windows) this should be part of your $PATH and entering ‘matc’ on the command
line should suffice, as shown in Figure 10.3.
To quit using command line MATC, type quit, or just close the command prompt window.
10.7 ParaView
10.7.1 Introduction
ParaView is a parallel visualization software developed by Kitware, Inc. and based on the Visualization
ToolKit (VTK). You can download it freely at:
http://www.paraview.org/paraview/resources/software.html
It is supported by Elmer using the old .vtk and the newer .vtu or .pvtu formats.
import glob
files = glob.glob(’*.pvtu’)
files.sort()
print """</Collection>
</VTKFile>"""
PhaseChange: Eulerian
PhaseChange2: Lagrangian and steady state
PhaseChange3: Lagrangian and transient
If you have any work you would like to share on this aspect of Elmer, please feel free to contribute.
If you have any work you would like to share on this aspect of Elmer, please feel free to contribute.
If you have any work you would like to share on this aspect of Elmer, please feel free to contribute.
10.11 Electromigration
This section has been transferred from Wayback Machine downloads, and uses screen shots to capture some
of the equations and variable names accurately. The original working sif file and geo file are stored in the
‘tutorials-GUI-files’ folder and currently do not have a working ElmerGUI project.
10.11.1 Introduction
Until 2010, only expensive FEA suites like COMSOL, or specialized consultants, could do electrochemistry
simulations. Full treatment of this topic requires coupled solutions of the Navier-Stokes equations with
diffusion and electromigration (Advection Diffusion model) for convective mass transfer. With the addition
of electromigration, Elmer now has this capability.
10.11.2 Formulation
The Advection Diffusion equation is given in the Elmer Models Manual (using bold instead of arrows for
vectors):
Mi = Di zi e/kT (10.3)
where zi is the ion charge for species i, e the electron charge, k Boltzmann’s constant, and T the absolute
temperature.
10.11.3 Implementation
A new addition to the AdvectionDiffusion module implements this Nernst-Planck electromigration term.
The implementation is based on the similarity between the electromigration flux and the convection flux
vCi , it adds the Nernst-Planck ion drift velocity to create an "effective velocity":
The downside of this implementation is that because neither convection nor electromigration is in the
variational form, flux boundary conditions ignore them, so it is tricky to set boundary conditions properly.
Then again, this is generally true for electrochemical reactions... More on that another time.
This patch introduces only one new parameter or material property: the ion charge zi , the others are
already in the AdvectionDiffusion module or Elmer’s universal constants. If ion charge is zero, then this
term vanishes. Ion charge is now in the material properties section of the advection-diffusion GUI XML file,
and to the solver keywords.
Warning: this code does not create a velocity array, so one must use Navier-Stokes when modelling
electromigration. If one runs with non-zero ion charge to induce electromigration but without Navier-Stokes,
ElmerSolver fails with a segmentation fault.
10.11.4 Example
[DISCLAIMER: This example is for purposes of illustration and mathematical consistency verification only.
Material properties and results may differ from reality by orders of magnitude. Use at your own risk.]
The following example describes electroplating a small hemisphere with copper. This problem has an
axisymmetric geometry with a cylindrical container of aqueous copper sulfate (CuSO4) 0.01 meter in radius
and 0.01 meter deep, with the 0.005 meter radius hemisphere to be plated pointing downward into the center
of the container (along the axis of symmetry). Only the aqueous solution has a mesh, which is densest near
the hemisphere in order to resolve the diffusion/electromigration boundary layer there. To generate the mesh,
run Gmsh and import the geometry from the file ‘simple.geo.
Also, the example should have a better cathode boundary condition than zero concentration, full Butler-
Volmer isn’t necessary but at least a linearisation would be nice. As it is, ionic conductivity is zero at
the boundary, and there is only diffusive flux due to the concentration gradient, but this does not enter the
StatCurrent calculations.
In view of this, it might be best for AdvectionDiffusion to export the actual ion current density (vector
field), including electromigration and diffusion, for accurate coupling with StatCurrent and other modules.
XTwoodSim, strongly coupled hygrothermal modelling below fiber saturation point. Follow this link to learn
more about XTwoodSim.
https://savannah.nongnu.org/projects/xtwoodsim/
Click on the link below to download the Elmer project files from this repository, including a sif file, mesh
files, and Fortran source files:
https://git.savannah.nongnu.org/cgit/xtwoodsim.git
Related Projects, the following projects have been dealing/are being dealt with using Elmer.
Hygrothermal modeling of parquet at:
https://www.ihd-dresden.com/en/home/
http://www.nic.funet.fi/pub/sci/physics/elmer/bin/VirtualMachines
Open that link, and there will be a directory with a few entries, as shown in Figure 11.1. Download two
files, ‘Readme1st.txt’ and ‘CSC Ubuntu20 Elmer.ova’. The .ova file is about 4 GB, so don’t try this over
dial-up!
Create an appropriate folder, such as ‘Elmer/VirtualMachine’, and copy both files into that folder.
Select the .ova file in the ‘Elmer/VirtualMachine’ folder, as shown in Figure 11.3.
Click ‘Next’ at the bottom of the screen. The ‘Appliance settings’ screen, as shown in Figure 11.4, will
open.
Take the defaults for the settings. The only (optional) exception to the defaults will be the ‘Machine Base
Folder’, which you may or may not want to change, so you can locate the VM right where you want it. Also
verify that you have enough installed RAM to match the default RAM setting of 3 GB. When you are ready,
click on ‘Import’. Agree to the license agreement. Importing the virtual disk image will take about five to
ten minutes, depending on the speed of your hard drive, refer to Figure 11.5.
Once Virtual Box is done importing the appliance, as usual with Virtual Box take a snapshot and then
start the new virtual machine. It should notify you that updated software needs to be downloaded, as shown
in Figure 11.6.
Go ahead and update, when prompted, enter ‘elmerfem’ to authenticate. After updating is finished, it
will restart once. Shutdown and take another snapshot, now you have a fully updated Elmer Virtual Machine
that you can always restore if needed.
For example, when initially starting the freshly downloaded and updated Virtual Machine with Ubuntu,
and using an English keyboard laptop, entering the following in a terminal had a problem: ‘./buildelmer.sh’.
Pressing the key for the forward slash yielded a hyphen, and caused an error. Updating Region and
Language in Ubuntu fixed the issue.
Locate the settings icon, as shown in Figure 11.7, and double click to open Settings.
Scroll down the page and locate the entry for Region and Language, as shown in Figure 11.8, and
double click to open. You should see that the keyboard is set to Finnish.
Click on the plus sign to add a keyboard as an input source, as shown in Figure 11.9.
Go ahead and delete the old keyboard layout since you won’t need it any more, as shown in Figure 11.13.
That’s it, you are done and can close the settings window.
Linux
The Elmer website has instructions showing how to download binaries, including Linux binaries from
Launchpad. Here is a quick summary of the steps needed to install Elmer in Linux.
https://www.csc.fi/web/elmer/binaries
Notice the section about using Launchpad Ubuntu and Debian based systems, as shown in Figure 12.1:
Installing elmerfem-csc will install Elmer, then installing elmerfem-csc-eg will add ElmerGUI to Elmer.
/bin/ElmerGrid
/bin/ElmerSolver
/bin/ElmerGUI
Start ElmerGUI, run the first tutorial, and start Paraview from within ElmerGUI, by clicking on ‘Run’,
then ‘Start Paraview’.