GSoC2020, FEM: extend examples

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: GSoC2020, FEM: extend examples

Post by uwestoehr »

HoWil wrote: Mon Aug 01, 2022 10:50 am You used "Surface heat flux in W/m^2" in your model. We need a entry for body heat source with "W/kg" (lets call it energy per mass or density related heat flux *)) to get the correct result (as in the turorial) :!:
You are confusing me. I did nothing else than taking your file. This generates a case.sif as I also get with Elmer directly, the difference is that you use 10000 and the Elmer tutorial uses 0.01.
Since all entries in the case.sif use base SI units, the specification of the heat source means W/kg. I don't see from where you get the info it would be W/m².

As wrote, the reason why Elmer delivers another result with the same case.sif with its mesh and the FreeCAD mesh is that we input the mesh scaled to Elmer.

Now in master your file delivers the correct result when one input "0.01" as it should. I mean the aim is that you can collaborate with other Elmer users, or use Elmer later directly.

See my next post for clarification.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: GSoC2020, FEM: extend examples

Post by uwestoehr »

Let me summarize the workflow FreeCAD - Elmer:

boundary conditions:
- FreeCAD's mesh is based on mm and the SI base unit is m
- Elmer is designed to use consistently base SI units.

Here is the workflow and what we did in FreeCAD 0.19, 0.20 and what we have to do now:
Elmer-Workflows.jpg
Elmer-Workflows.jpg (250.07 KiB) Viewed 1350 times
(hereby "non-SI" means not in the SI base units: s, A, kg, m cd, mol, K)

EDIT: The 0.20 workflow is correct. it is just a bug that the heat source does not take Elmer Solver's scale option into account.

The golden rule one is taught at the university is to calculate in base SI units, only change units when you have the final results. (Here a recent example were a users did not follow this and failed: https://forum.freecadweb.org/viewtopic. ... 22#p614222)
Therefore the approach of FC 0.19 was no success. We used several factors for input parameters but since Elmer is multiphysics it is a nightmare to assure the result will be correct SI so that we or the user can do something with it.

In FC 0.20 I changed it that we consistently create case.sif files using base SI units. This has the beauty that you can run your .sif file also directly with Elmer, you can send you .sif files to others or take .sif file from others.
To overcome the mm-mesh problem, we use ElmerGrid to scale the mesh. Elmer gets then everything in base-SI units. This worked fine (tested with flow simulations, voltages, mechanical). However now it turns out that input parameters that take the length unit from the mesh, will be recalculated by Elmer because of the scaling. This sucks, but we have to face this.

Of course the same case.sif files must deliver the same results in Elmer directly and with FreeCAD.
So we cannot scale the mesh. As result we get results that have base SI units only if the results do not depend on the mesh's length unit. For example voltage has a length unit in it, but this is not the one of the mesh. Results like displacements or stresses take the length unit from the mesh and therefore we have to recalculate them.
This is a bit annoying but the results that directly depend on the mesh's length unit are not that many.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: GSoC2020, FEM: extend examples

Post by uwestoehr »

@HoWil , I am currently documenting the solvers, see
https://wiki.freecadweb.org/FEM_SolverE ... erSettings
and I have 2 questions:

1. why do you set the "Bubbles" parameter by default to False and "Stabilize" to True? The Elmer docs say the opposite: https://www.nic.funet.fi/index/elmer/do ... Manual.pdf (page 185)

2. What does the property "priority" do? I don't see that it is written to the case.sif.

(For info: I also started to document the elasticity equation:
https://wiki.freecadweb.org/FEM_EquationElasticity)

-----------------

Another question: Why is the button to Edit the case.sif inactive. Was this a purpose decision or it was just not implemented?
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: GSoC2020, FEM: extend examples

Post by HoWil »

uwestoehr wrote: Mon Aug 01, 2022 2:12 pm You are confusing me. I did nothing else than taking your file.
you are right. I did test too much and mixed things up.
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: GSoC2020, FEM: extend examples

Post by HoWil »

uwestoehr wrote: Mon Aug 01, 2022 4:40 pm @HoWil , I am currently documenting the solvers, see
https://wiki.freecadweb.org/FEM_SolverE ... erSettings
and I have 2 questions:

1. why do you set the "Bubbles" parameter by default to False and "Stabilize" to True? The Elmer docs say the opposite: https://www.nic.funet.fi/index/elmer/do ... Manual.pdf (page 185)

2. What does the property "priority" do? I don't see that it is written to the case.sif.

(For info: I also started to document the elasticity equation:
https://wiki.freecadweb.org/FEM_EquationElasticity)

-----------------

Another question: Why is the button to Edit the case.sif inactive. Was this a purpose decision or it was just not implemented?
1. The docs state on page 92 "Bubbles in Global System Logical - This keyword should be given the value False, so that the additional bubble basis functions needed for the stability are eliminated via the static condensation."
On page 185 "Stabilize Logical - Either stabilization or bubbles are used to solve the convection problem. This flag enforces the stabilization on."
2. In Elmer GUI the Elmer-solvers can be prioritized in the Elmer-equation by by giving them a higher priority (http://www.elmerfem.org/forum/viewtopic ... ity#p23285). If I remember right this is related to the order of the number in the Elmer-equation section. This is needed because in FC one could not reorder elements and the last added element is not always to one which should have the lowest priority.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: GSoC2020, FEM: extend examples

Post by uwestoehr »

HoWil wrote: Mon Aug 01, 2022 6:46 pm 1. The docs state on page 92 "Bubbles in Global System Logical - This keyword should be given the value False,
note that this is the

Code: Select all

Bubbles in Global System
not

Code: Select all

Bubbles
Today a new manual was released. now what I refer to is on page 12.
The point is that "Bubbles" is specific to certain solvers. According to the docs, for these equations they should be set to true:
- Heat
- Helmholtz
- diffusion (equation not yet supported by FC)

So is it OK, when I change that for the Heat and Helmholtz equation?
HoWil wrote: Mon Aug 01, 2022 6:46 pm 2. In Elmer GUI the Elmer-solvers can be prioritized in the Elmer-equation by by giving them a higher priority (http://www.elmerfem.org/forum/viewtopic ... ity#p23285). If I remember right this is related to the order of the number in the Elmer-equation section. This is needed because in FC one could not reorder elements and the last added element is not always to one which should have the lowest priority.
Thanks. I will document this now.
What was by the way the reason that the heat equation got the highest priority of 20 by default while Elasticity and Electrostatics get by default priority 10 and Flux and Electricforce get 5?
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: GSoC2020, FEM: extend examples

Post by uwestoehr »

I made a lost of tests and despite the manual does not state the Stabilize setting for all equations, ElmerGUI does this.

Therefore I changed it now to this:
- Stabilize is kept as in FC 0.20 (always there)
- Stabilize is always True, except of Heat (the manual states it is by default False)
- Bubbles is only there for solvers where it is mentioned in the manual and also added by Elmer GUI.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: GSoC2020, FEM: extend examples

Post by uwestoehr »

uwestoehr wrote: Mon Aug 01, 2022 4:40 pm Another question: Why is the button to Edit the case.sif inactive. Was this a purpose decision or it was just not implemented?
Now it is possible to edit the case.sif file. This will also be available in FreeCAD 0.20.1.
(the implementation existed already but was apparently never finished despite the missing piece were few lines of code)
HoWil wrote: Sun Jul 31, 2022 8:51 pm ps.: May I do some advertising for the introduction of Elmer-fulltextinputs for boundary-faces which would maybe help here ;)
What do you mean with this? I can implement this but don't know yet what is meant.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: GSoC2020, FEM: extend examples

Post by uwestoehr »

uwestoehr wrote: Mon Aug 01, 2022 2:29 pm In FC 0.20 I changed it that we consistently create case.sif files using base SI units. This has the beauty that you can run your .sif file also directly with Elmer, you can send you .sif files to others or take .sif file from others.
To overcome the mm-mesh problem, we use ElmerGrid to scale the mesh. Elmer gets then everything in base-SI units. This worked fine (tested with flow simulations, voltages, mechanical). However now it turns out that input parameters that take the length unit from the mesh, will be recalculated by Elmer because of the scaling. This sucks, but we have to face this.
And this scaling is totally correct. The Elmer solver has exactly for our case the scaling option and we already used it in FC 0.19.
I changed it now only so that the scaling is written to the case.sif file like in FC 0.19, not done by ElmerGrid, hoping that then the solver is always aware of this.

There is simply a bug in Elmer that for the calculation of the mass for the heat source the scaling is ignored. I will report this to Elmer.
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: GSoC2020, FEM: extend examples

Post by HoWil »

uwestoehr wrote: Thu Aug 04, 2022 3:07 am
uwestoehr wrote: Mon Aug 01, 2022 4:40 pm Another question: Why is the button to Edit the case.sif inactive. Was this a purpose decision or it was just not implemented?
Now it is possible to edit the case.sif file. This will also be available in FreeCAD 0.20.1.
(the implementation existed already but was apparently never finished despite the missing piece were few lines of code)
HoWil wrote: Sun Jul 31, 2022 8:51 pm ps.: May I do some advertising for the introduction of Elmer-fulltextinputs for boundary-faces which would maybe help here ;)
What do you mean with this? I can implement this but don't know yet what is meant.
A/editing the sif: this was not finished because keeping track of changes is hard. If change the geometry/mesh than the simulation will (most probably) fail. For sure it is a one-way 'story'. Changes in the sif can't be read to FC.

B/freetextinput: this is to circumvent the above. It offers 'freetextinput' elements as in Elmer GUI where you can type in some free text for eg a boundary, body or equation. This can be added by the FC GUI elements and is exported as all the other FEM elements, so the generation of the .sif is still correct. Please see
https://forum.freecad.org/viewtopic.php ... fe#p422882

https://github.com/HoWilgh/FreeCAD/tree ... textinput2
BR
HoWil
Post Reply