PR 7100: FEM WB Elmer viscosity bug fix

About the development of the FEM module/workbench.

Moderator: bernd

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

Re: PR 7100: FEM WB Elmer viscosity bug fix

Post by uwestoehr »

mst31 wrote: Tue Jul 26, 2022 9:23 pm I made some investigation of this problem. I created more difficult model: taper tube with water, inside placed heat sink:
Many thanks! This looks promising.

At the moment I am still fighting to setup Elmer correctly, see
https://forum.freecadweb.org/viewtopic. ... 82#p614282

So in FreeCAD 0.20 we have bugs because some input parameters are scaled by Elmer. In FreeCAD master I changed it to the last workflow but the necessary transformations are not yet implemented.

Can I therefore please get your complete Elmer project? If you cannot make this public, please send me a private message via the forum with a link.
User avatar
uwestoehr
Veteran
Posts: 4400
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany

Re: PR 7100: FEM WB Elmer viscosity bug fix

Post by uwestoehr »

mst31 wrote: Wed Aug 03, 2022 10:53 am The pressure boundary condition in FC project is still dummy. Also I encountered with problems:
- In FC there is not initial pressure condition.
- I can not set 101001 Pa pressure - FC cuts off it to 101 kPa.
The first is what I mentioned in the forum thread. FC lacks this constraint and I will add it.
The second is new -> I will have a look.
mst31 wrote: Wed Aug 03, 2022 10:53 am And also. I had to decrease non-linear tolerance to 5E-07 in the second project, otherwise solve converges very slow. I suppose it's happening because pressure is constantly throughout sections of tube (due to pressure boundary condition).
I also had struggles. After spending a lot of time with Elmer, reading forums etc., I noted two tings:
- the default linear iterative solver method should be BicCStabl and at least polynomial degree 3. A higher degree needs more CPU load but often helps for convergence
- for the nonlinear solver, the Relaxation Factor matters. Setting it lower than 1 helps in all cases I investigated so far. This is also recommended by the Elmer manual. Here is also a good forum post:
https://forum.freecadweb.org/viewtopic. ... 35#p497135
User avatar
uwestoehr
Veteran
Posts: 4400
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany

Re: PR 7100: FEM WB Elmer viscosity bug fix

Post by uwestoehr »

uwestoehr wrote: Wed Aug 03, 2022 4:51 pm - the default linear iterative solver method should be BicCStabl and at least polynomial degree 3.
- for the nonlinear solver, the Relaxation Factor matters. Setting it lower than 1 helps in all cases I investigated so far.
I tried now your files and indeed with
- BicCStabl and polynomial degree 3
- relaxation factor 0.5

I get a quick convergence.

--------

For info: from now on (in FreeCAD master and in the upcoming 0.20.1) one can edit the case.sif directly in FreeCAD. This helps a lot to investigate since one can lat FreeCAD write the file, then change it then subsequently run this file in FreeCAD.
mst31
Posts: 16
Joined: Sun Apr 03, 2022 10:43 pm

Re: PR 7100: FEM WB Elmer viscosity bug fix

Post by mst31 »

Thank you for this information! So is really faster. I hope this will help me to create another model of natural convection.
User avatar
uwestoehr
Veteran
Posts: 4400
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany

Re: PR 7100: FEM WB Elmer viscosity bug fix

Post by uwestoehr »

@mst31, FreeCAD 0.20.1 is out:
https://github.com/FreeCAD/FreeCAD/releases/tag/0.20.1

It fixes many things in FEM. For example you will now see by highlighting what fluid boundaries are in the constraint. Therefore please upgrade.

The bad news is that I had to revert your patch because it introduced a regression_
there are 2 bodies, a fluid and a solid material. Solid 2 is bound to the fluid while the solid material is not bound to anything. In this case the solid material is automatically bound to the remaining body. Your patch broke the analysis for this case.

The good news is that I could fix it now properly (2 days after the release): git commit b716644e27

Therefore please use the latest patch collection:
https://forum.freecadweb.org/viewtopic.php?f=18&t=71058

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

For the convergence, for the nonlinear tolerance Elmer's default of 1e-7 is sensible, for the linear tolerance, also the default of 1e-10 is OK. For the linear method BICGstab is slightly faster than BICGstabl but BICGstabl is sometimes better to find a convergence.
The relaxation factor is THE most important parameter.
User avatar
uwestoehr
Veteran
Posts: 4400
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany

Re: PR 7100: FEM WB Elmer viscosity bug fix

Post by uwestoehr »

uwestoehr wrote: Fri Aug 12, 2022 4:18 am Here is a file where I made a flow + heat simulation in 2D and 3D:
https://github.com/donovaly/FreeCADInst ... -2D-3D.zip
Here is a better file where 3D works now properly:
https://github.com/donovaly/FreeCADInst ... -2D-3D.zip

However, when I use water instead of air, it still does not converge.
I miss to set the temperature of the streaming in fluid.Maybe this is the reason.

Also the pressure does not work properly. I will investigate further.

Important for you to move on is to get FreeCAD 0.20.1 and then these patches on top: https://forum.freecadweb.org/viewtopic.php?f=18&t=71058
mst31
Posts: 16
Joined: Sun Apr 03, 2022 10:43 pm

Re: PR 7100: FEM WB Elmer viscosity bug fix

Post by mst31 »

Thank you for work!
But I found mistake in your example: priority of heat equation above than flow equation so first heat equation calculated and then flow equation. But heat equation depends on velocity-field that calculated in flow equation. So temperature in your example is calculated for case without flow.
If I set priority of heat equation to 5 then it doesn't converge.
Then I modified some parameters:
- Set wall condition for circle object
- Set solid material for circle object
- Set computed type of convection for flow and heat equations
- Set Bubbles to false and Stabilize to true for heat eqation
Now it is seen temperature "tail":
temperature.png
temperature.png (59.09 KiB) Viewed 110 times
Link to modified file:
https://drive.google.com/file/d/19YCmuB ... sp=sharing
mst31
Posts: 16
Joined: Sun Apr 03, 2022 10:43 pm

Re: PR 7100: FEM WB Elmer viscosity bug fix

Post by mst31 »

And I updated my tube example:
https://github.com/mist90/FreeCAD-FEM-e ... y-3d.FCStd
Now it uses FC pressure condition. I increse inlet velocity so difference of pressure also increses and became appr. 0.8 atm.
Post Reply