Elmer integration as a solver

About the development of the FEM module/workbench.

Moderator: bernd

HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer integration as a solver

Post by HoWil »

There is some development of integrating Elmer into Salome going on which for sure we can benefit from.
It looks like that Rainer Jacob already wrote some code to nicely supply/extract all possible solver input setting out of the .edf (xml -files) files which are usually used by ElmerGUI.

The corresponding discussion can be found here...
http://elmerfem.org/forum/viewtopic.php ... a9f1756e5b

while the project can be found here
https://github.com/physici/ElmerSalomeM ... lmerSalome

BR,
HoWil
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Elmer integration as a solver

Post by bernd »

A bit offtopic. Is there an Elmer package for Debian Jessie available?
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer integration as a solver

Post by HoWil »

I personally use the the official Ubuntu ppa *) thats why I had to search with this results:

There is a relatively old version 7.0 in the experimental branch please see...
https://packages.debian.org/experimental/elmer
For just testing the solver it should be OK but you still have to compile the ElmerGUI if you want to use it too.

For sure there is also the possibility to compile all parts of Elmer see... http://www.elmerfem.org/elmerwiki/index ... stallation

*)
In the official ppa repo is the several days old, the latest version is 8.2-201611251631
https://launchpad.net/~elmer-csc-ubuntu ... er-csc-ppa
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Elmer integration as a solver

Post by bernd »

@HoWil:
I'm gone try to compile ElmerFEM. I do not know anything about the Elmer languarge to define everything. Would it be possible to make an Elmerfile of the FreeCAD 3D FEM Cantilver Example and post it here. It is easier to test a new FEM with an well know example.

Bernd
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer integration as a solver

Post by HoWil »

Hi Bernd,

Attached you find a .zip file with the complete data regarding a Calculix-Elmer comparison which is discussed subsequently.
If you have a running Elmer and want to recompute the Elmer-project just open it with 'File->Load Project', navigate into the folder called 'mesh_with_BC_from_FC-FEM' and press 'Open'.

A short step by step instruction how to rebuild the attached model in FreeCAD, Elmer and Paraview (using 0.17 from ppa and elmer from the official ppa) is given here:

Code: Select all

##########################################################################
In FreeCAD:

* Open the standard 3D-FEM example on the start page under 'Example projects' called 'Load an FEM 3D example analysis.
* Select the mesh object called 'Box_Mesh' and delete it. The original Mesh was created with the integrated Netgen-Mesher (and has be recomputed with GMSH).
* Selet the object called 'Cube' and use 'FEM->FEM mesh from shape with GMSH' to generate a new mesh object.
* Select the new mesh object called 'Box_Mesh' and export it via 'File->Export' as 'mesh_with_BC_from_FC-FEM.unv'.
* Execute ElmerGrid in the folder where the exported .unv file is located with 'ElmerGrid 8 2 mesh_with_BC_from_FC-FEM.unv -autoclean'. This transvers the mesh including the boundary conditions stored in the .unv file into several Elmer-mesh files in an identically named folder.


##########################################################################
In ElmerGUI:

* Open the transfered mesh with 'File->Load mesh' by simply navigating into the prior generated folder called as the .unv file. The Mesh is now visible. 
* In 'Model->Setup->Simulation->Free_text' insert 'Coordinate scaling = 1'.
* 'Model->Equation->Add' and select in the column 'Linear elasticity' 'Acitve->on' and 'Apply to body-> Body1'. Select 'Edit Solver Settings' for in the current tab and there insert in the 'Solver specific options' in the 'Free text input' the string:'Element=p:2'. Than press 'Apply'.
Select in the 'Result Output' column the 'Active' field. 
Select 'Edit Solver Settings' for in the current tab and there insert in the 'Solver specific options' in the select in the 'General' tab under 'Execute solver' the point 'After simulation'.
Press 'Apply' and 'OK'.

* 'Model->Material-Add' and select 'Apply to body-> Body1' and select the 'Material library' -> Select 'Steel (alloy -generic)'. Adopt 'Youngs modulus' to '210.0e9' and 'Poisson ratio' to '0.3'.
 
* Under 'Model->Boundary condition->Add' in column 'Linear elasticity' set 'Displacement 1' and 'Displacement 2' and 'Displacement 3' to 0. Set 'Name:' to 'BoundaryConditionFixed'. Press 'OK'

* Under 'Model->Boundary condition->Add' in column 'Linear elasticity' set 'Force 2' to 9000000. Set 'Name:' to 'BoundaryConditionForce'. Press 'OK'

* Set 'Model->Set boundary properties' and select left boundary with a double-click. Choose 'BoundaryConditionFixed' from pull down-menu. Click 'Add'.

* Set 'Model->Set boundary properties' and select left boundary with a double-click. Choose 'BoundaryConditionForce' from pull down-menu. Click 'Add'.

* 'File->Save'
* 'File->Save Project'
* 'Sif->Generate'
* 'Run->Start solver'
* After the computation has finished: 'Run->Start paraview'.

##########################################################################
In Paraview:

Select the 'Properties' window press 'Apply' and select in the subgroup for 'Coloring' 'displacement' instead of 'Solid Color'. 



The needed Elmer-Solver input file case.sif where all necessary definitions are listed looks like:

Code: Select all

Header
  CHECK KEYWORDS Warn
  Mesh DB "." "."
  Include Path ""
  Results Directory ""
End

Simulation
  Max Output Level = 5
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
  Simulation Type = Steady state
  Steady State Max Iterations = 1
  Output Intervals = 1
  Timestepping Method = BDF
  BDF Order = 1
  Solver Input File = case.sif
  Post File = case.vtu
Coordinate scaling = 0.001
End

Constants
  Gravity(4) = 0 -1 0 9.82
  Stefan Boltzmann = 5.67e-08
  Permittivity of Vacuum = 8.8542e-12
  Boltzmann Constant = 1.3807e-23
  Unit Charge = 1.602e-19
End

Body 1
  Target Bodies(1) = 1
  Name = "Body Property 1"
  Equation = 1
  Material = 1
End

Solver 2
  Equation = Linear elasticity
Element=p:2
  Variable = -dofs 3 Displacement
  Procedure = "StressSolve" "StressSolver"
  Exec Solver = Always
  Stabilize = True
  Bubbles = False
  Lumped Mass Matrix = False
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-5
  Nonlinear System Convergence Tolerance = 1.0e-7
  Nonlinear System Max Iterations = 20
  Nonlinear System Newton After Iterations = 3
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 1
  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = Diagonal
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 1
  Linear System Precondition Recompute = 1
End

Solver 1
  Equation = Result Output
  Output Format = Vtu
  Procedure = "ResultOutputSolve" "ResultOutputSolver"
  Output File Name = case
  Exec Solver = After Simulation
End

Equation 1
  Name = "Equation 1"
  Active Solvers(2) = 2 1
End

Material 1
  Name = "Steel (alloy - generic)"
  Heat expansion Coefficient = 12.0e-6
  Electric Conductivity = 1.367e6
  Heat Conductivity = 37.2
  Sound speed = 5100.0
  Heat Capacity = 976.0
  Mesh Poisson ratio = 0.285
  Density = 7850.0
  Poisson ratio = 0.3
  Youngs modulus = 210.0e9
End

Boundary Condition 1
  Target Boundaries(1) = 1 
  Name = "BoundaryConditionFixed"
  Displacement 3 = 0
  Displacement 2 = 0
  Displacement 1 = 0
End

Boundary Condition 2
  Target Boundaries(1) = 2 
  Name = "BoundaryConditionForce"
  Force 2 = 9000000
End
Note that boundary conditions can also be targeted by names from the .unv when simply accessing them by script and not using ElmerGUI.
Results from calculix in FreeCAD.
Results from calculix in FreeCAD.
Screenshot from 2016-11-29 20-50-52_FC_resized.png (158.67 KiB) Viewed 3088 times
Results from Elmer plotted in Paraview.
Results from Elmer plotted in Paraview.
Screenshot from 2016-11-29 20-51-11_Paraview_resized.png (137.4 KiB) Viewed 3088 times
Attachments
Comparison Calculix_Elmer.zip
(191.32 KiB) Downloaded 58 times
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer integration as a solver

Post by HoWil »

There is also a short presentation about the structure of .sif files... http://www.nic.funet.fi/pub/sci/physics ... 4April.pdf

In the case that one wants now to reuse the given mechanical simulation model but wants to switch the boundaries, you would have to do the following steps:
* generate a new mesh as .unv with the new faces grouped
* translate it with ElmerGrid and copy the Elmer-Mesh-files into the project folder
* Check if the defined 'Target Boundaries' do still match, see e.g. the prior boundary condition for boundary nr. 2:

Code: Select all

  Target Boundaries(1) = 2 
 
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Elmer integration as a solver

Post by bernd »

compiled the elmer solver and tried to run your example at the command line. Seams I'm missing something essential ...

http://www.elmerfem.org/forum/viewtopic ... 8dc710fcd6
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer integration as a solver

Post by HoWil »

How about just running ElmerSolver instead of its mpi counterpart?
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Elmer integration as a solver

Post by bernd »

HoWil wrote:How about just running ElmerSolver instead of its mpi counterpart?
I do not have a binary without mpi. Compiling without mpi fails. But this seams not to be the culprit.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Elmer integration as a solver

Post by bernd »

the elemer solver says the example file has no mesh ?!? see http://www.elmerfem.org/forum/viewtopic ... 124#p15920
Post Reply