Following up on Tutorial 1 (https://forum.freecadweb.org/viewtopic.php?f=18&t=56590), I explored how to use FreeCAD to solve tutorials sequentially through the Elmer non-GUI tutorials found specifically here: http://www.nic.funet.fi/pub/sci/physics ... GUI.tar.gz
(https://www.csc.fi/web/elmer/documentation)
Looking at tutorials 2 and 3, I determined that there is not enough information in the tutorial document to simply recreate the cases. Specifically, no dimensions are given for the problem, which defeats the purpose of using FreeCAD for drawing and setting up the case, for example.
Also the Elmer implementation in FreeCAD is not yet sufficient to run all types of cases (given the capabilities of Elmer, it is EVIDENT, that the wonderful guys who implemented what already exists in FC did a great job, but the road is long )
Faced with these difficulties I browsed all the way to Tutorial 4, which seemed already closer to something I could tackle mostly through FreeCAD.
What and adventure!
The objectives of this thread:
1. To have some fun
2. To relentlessly test the capabilities of the Elmer implementation in FreeCAD
3. To find bugs and possible issues
4. To guide the people interested in developing the Elmer implementation further by showing where work may be needed
5. To popularize and showcase the great synergies of FreeCAD and the Elmer solver.
We are moving to
Tutorial 4: Induction heating of a graphite crucible
Let's go.
My observations through this tutorial actually dispelled some of my issues that made me skip tuto2 and tuto3. The tutorial-nongui document is not sufficient in itself. One needs to download the tutorial files, and observe them through the ElmerGUI, to see exactly how the case is defined geometrically. The attached sif file is also capital in understanding how the case is set up.
In this post, due to my lack of knowledge I ended up solving the following problems:
1. How to design 2D cases with multi-materials in FreeCAD.
2. How to make sure a multi-area mesh works.
3. How to translate an Elmer defined sif file (provided by the Elmer team) and apply it to the case made in FreeCAD.
In the following posts I will try further to create more of the case directly in FreeCAD (I think MagneticFlux + Heat equations can achieve it, but have not tried yet).
Challenge: re-creating the geometry in FreeCAD and understanding what is what It is easy to simply create sketches and use the Part: MakeFacefromWires
Followed by a boolean operation, warning, all boolean operations are not equal when considering an FEM case that has to be meshed!
Challenge: meshing in a coherent and controlled manner Challenge: setting up the case
Here the challenge was as much with the driver (me) than the car (Elmer in FreeCAD).
Driver: I have fought to understand how to setup the case, and I had not even realized it needs to be multi-physical (Flux & Heat)! I had forgotten to set the surrounding domain with Air.
Car: Material cards are simply not right, the user needs to add electrical conductivity as a user defined property for example. Not sure yet if the currently implemented equations in FreeCAD allow the setting up of the case (subject of further posting from me in this thread).
Searching text in the "writer.py" file for Elmer, "Body Force" is not written, so I'm pretty sure not everything can be setup just yet.
The automated sif writing in FreeCAD through "writer.py" is quite messy at the moment, many things are out of order or grouped in a way that is very different than what the Elmer team typically writes. It makes reviewing and modifying the case quite difficult.
Here below the sif file provided by the Elmer team:
Code: Select all
! Historical tutorial case
! Updated 3.8.2020 P.R.
Check Keywords Warn
Header
Mesh DB "." "crucible"
Include Path ""
Results Directory ""
End
Simulation
Coordinate System = "Axi Symmetric"
Simulation Type = Steady State
Steady State Max Iterations = 1
Max Output Level = 7
Output File = "crucible.result"
Post File = "crucible.vtu"
End
Constants
Permittivity Of Vacuum = 8.8542e-12
End
Body Force 1
Current Density = 2.5e5
End
Body Force 2
Joule Heat = Logical True
End
Body 1
Name = "Air"
Equation = 1
Material = 1
End
Body 2
Name = "Coil"
Equation = 1
Material = 1
Body Force = 1
End
Body 3
Name = "Insulation"
Equation = 1
Material = 2
Body Force = 2
End
Body 4
Name = "Graphite"
Equation = 1
Material = 3
Body Force = 2
End
Body 5
Name = "Powder"
Equation = 1
Material = 4
Body Force = 2
End
Equation 1
Name = "Vector Potential Equation"
Active Solvers(2) = 1 2
End
Solver 1
Equation = Potential Solver
Variable = Potential
Variable DOFs = 2
Angular Frequency = Real 50.0e3
Calculate Joule Heating = Logical True
! Calculate Magnetic Flux = Logical True
Desired Heating = Real 3.0e3
Procedure = "StatMagSolve" "StatMagSolver"
Linear System Solver = Iterative
Linear System Iterative Method = BiCGStab
Linear System Max Iterations = 300
Linear System Convergence Tolerance = 1.0e-10
Linear System Preconditioning = ILU1
Linear System ILUT Tolerance = 1.0e-03
Linear System Residual Output = 10
Nonlinear System Max Iterations = 1
Nonlinear System Convergence Tolerance = 1.0e-6
Nonlinear System Relaxation Factor = 1
Steady State Convergence Tolerance = 1.0e-6
End
Solver 2
Equation = Heat Equation
Procedure = "HeatSolve" "HeatSolver"
Variable = Temperature
Stabilize = True
Steady State Convergence Tolerance = 1.0e-5
Nonlinear System Convergence Tolerance = 1.0e-5
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-8
Linear System Preconditioning = ILU0
Linear System ILUT Tolerance = 1.0e-3
Linear System Abort Not Converged = False
Linear System Residual Output = 10
Linear System Precondition Recompute = 1
End
Material 1
Name = "Air"
Electric Conductivity = 0.0
Heat Conductivity = 1.0
Density = 1.0
End
Material 2
Name = "Insulation"
Electric Conductivity = 2.0E3
Heat Conductivity = 1.0
Density = 1.0
End
Material 3
Name = "Graphite"
Electric Conductivity = 2.0E4
Heat Conductivity = 1.0
Density = 1.0
End
Material 4
Name = "Powder"
Electric Conductivity = 1.0E4
Heat Conductivity = 1.0
Density = 1.0
End
Boundary Condition 1
Target Boundaries = 1
Potential 1 = Real 0.0
Potential 2 = Real 0.0
Temperature = 293
End
Solver 1 :: Reference Norm = 9.22429576E-06
Solver 2 :: Reference Norm = 2.93337866E+02
!End Of File
Code: Select all
Check Keywords Warn
Header
Mesh DB "."
End
Solver 1
Equation = Potential Solver
Variable = Potential
Variable DOFs = 2
Angular Frequency = Real 50.0e3
Calculate Joule Heating = Logical True
Calculate Magnetic Flux = Logical True
Desired Heating = Real 3.0e3
Procedure = "StatMagSolve" "StatMagSolver"
Linear System Solver = Iterative
Linear System Iterative Method = BiCGStab
Linear System Max Iterations = 300
Linear System Convergence Tolerance = 1.0e-10
Linear System Preconditioning = ILU1
Linear System ILUT Tolerance = 1.0e-03
Linear System Residual Output = 1
Nonlinear System Max Iterations = 1
Nonlinear System Convergence Tolerance = 1.0e-6
Nonlinear System Relaxation Factor = 1
Steady State Convergence Tolerance = 1.0e-6
End
Solver 2
Equation = Heat Equation
Procedure = "HeatSolve" "HeatSolver"
Variable = Temperature
Stabilize = True
Steady State Convergence Tolerance = 1.0e-5
Nonlinear System Convergence Tolerance = 1.0e-5
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-8
Linear System Preconditioning = ILU0
Linear System ILUT Tolerance = 1.0e-3
Linear System Abort Not Converged = False
Linear System Residual Output = 10
Linear System Precondition Recompute = 1
End
Simulation
BDF Order = Integer 1
Coordinate Mapping(3) = Integer 1 2 3
Coordinate Scaling = Real 0.001
Coordinate System = String "Axi Symmetric"
Output Intervals = Integer 1
Simulation Type = String "Steady state"
Steady State Max Iterations = Integer 1
Steady State Min Iterations = Integer 0
Timestepping Method = String "BDF"
Use Mesh Names = Logical True
End
Constants
Permittivity Of Vacuum = 8.8542e-12
End
Body Force 1
Current Density = 2.5e5
End
Body Force 2
Joule Heat = Logical True
End
Body 1
Equation = Integer 1
Material = Integer 1
Name = String "Face1"
Body Force = 2
End
Material 1
Name = "Graphite"
Electric Conductivity = 2.0E4
Heat Conductivity = 1.0
Density = 1.0
End
Equation 1
Active Solvers(2) = Integer 1 2
End
Solver 2
Coordinate Scaling Revert = Logical True
Equation = String "ResultOutput"
Exec Solver = String "After simulation"
Output File Name = File "case"
Procedure = File "ResultOutputSolve" "ResultOutputSolver"
Vtu Format = Logical True
End
Body 2
Equation = Integer 2
Material = Integer 2
Name = String "Face2"
Body Force = 2
End
Material 2
Name = "Insulation"
Electric Conductivity = 2.0E3
Heat Conductivity = 1.0
Density = 1.0
End
Equation 2
Active Solvers(2) = Integer 1 2
End
Body 3
Equation = Integer 3
Name = String "Face3"
Body Force = 1
Material = 5
End
Equation 3
Active Solvers(2) = Integer 1 2
End
Body 4
Equation = Integer 4
Material = Integer 3
Name = String "Face4"
Body Force = 2
End
Material 3
Name = "Powder"
Electric Conductivity = 1.0E4
Heat Conductivity = 1.0
Density = 1.0
End
Equation 4
Active Solvers(2) = Integer 1 2
End
Body 5
Equation = Integer 5
Name = String "Face5"
Material = 5
End
Material 5
Name = "Air"
Electric Conductivity = 0.0
Heat Conductivity = 1.0
Density = 1.0
End
Equation 5
Active Solvers(2) = Integer 1 2
End
Body 6
Equation = Integer 6
Name = String "Face6"
Material = 5
End
Equation 6
Active Solvers(2) = Integer 1 2
End
Boundary Condition 1
Name = String "Edge21"
Potential 1 = Real 0.0
Potential 2 = Real 0.0
Temperature = 293
End
Boundary Condition 2
Name = String "Edge22"
Potential 1 = Real 0.0
Potential 2 = Real 0.0
Temperature = 293
End
Boundary Condition 3
Name = String "Edge23"
Potential 1 = Real 0.0
Potential 2 = Real 0.0
Temperature = 293
End
The result: Anyway I need to spend more time on this particular case, to understand it better and see how far I can go in FreeCAD entirely.
If anything it proves that this workflow could work: use a case entirely setup by the Elmer team, create a similar case in FreeCAD (or modified) and translate the sif files for compatibility.
To me the biggest difficulty this time was: understanding what the Elmer team had in mind with this case. Untangling the wildly diverging sif file organization between typical Elmer sif files and FreeCAD automated sif file.
Hope you find it interesting!