Elmer electrostatics FEM

About the development of the FEM module/workbench.

Moderator: bernd

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

Re: Elmer electrostatics FEM

Postby HoWil » Thu Feb 20, 2020 5:54 pm

Yes, I need for sure some help with point 1. :D
HoWil
Posts: 1002
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer electrostatics FEM

Postby HoWil » Fri Feb 21, 2020 9:12 pm

bernd wrote: Hi Bernd
Is it possible that you just add my commit "Fix saving values for Infinity and Capacitance BCs" from https://github.com/HoWilgh/FreeCAD/tree ... Cs/src/Mod ??
I am a bit in a hurry and do not get the rebaseing to your master branch right.
User avatar
bernd
Posts: 9828
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Elmer electrostatics FEM

Postby bernd » Sat Feb 22, 2020 8:43 am

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

Re: Elmer electrostatics FEM

Postby HoWil » Mon Feb 24, 2020 8:16 pm

TadasK wrote:
Fri Dec 06, 2019 6:42 pm
Ping
Hi Ted,
in 0.19 you now find modified boundary conditions allowing for setting ininity-BC and the calculation of capacitance matrix. The user interface is rather simple and for sure needs some additional automated checks but all the necessary things are there. The only thing left to do is to change the "Vacuum Permittivity = 1.0". This was not implemented yet and I do not know if it is really necessary to change something like the permittivity of vacuum often.
Please see:
Tutorial_6 - Electrostatic equation – Capacitance of two balls_1p0.FCStd
model with removed mesh and results objects.
(24.84 KiB) Downloaded 5 times
Peek 2020-02-24 20-39.webm
starting point.
(697.74 KiB) Downloaded 9 times
Peek 2020-02-24 20-39_.webm
Showing the created geometry made in Part-WB.
(398.58 KiB) Downloaded 5 times
Peek 2020-02-24 20-40.webm
Settings for the mesh and meshing.
(505.3 KiB) Downloaded 5 times
Peek 2020-02-24 20-47.webm
Equation and boundary conditions.
(715.81 KiB) Downloaded 5 times
HoWil
Posts: 1002
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer electrostatics FEM

Postby HoWil » Mon Feb 24, 2020 8:35 pm

Peek 2020-02-24 20-48.webm
Material set-up and first run of the solver
(887.02 KiB) Downloaded 18 times
Peek 2020-02-24 21-30.webm
Changing the "Permittivity Of Vacuum = 1" (saving the .sif) and running the Solver again (no need for a rewrite!)
(768.09 KiB) Downloaded 6 times
User avatar
bernd
Posts: 9828
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Elmer electrostatics FEM

Postby bernd » Tue Feb 25, 2020 10:38 am

HoWil wrote:
Mon Feb 24, 2020 8:16 pm
The only thing left to do is to change the "Vacuum Permittivity = 1.0". This was not implemented yet and I do not know if it is really necessary to
what would be needed to do this by the elmer writer? I would like to add this example to official FreeCAD FEM examples as it is a know example (elmer) and it would be the first example in electic FEM. Since we use python to run the analysis I would not like to change the elmer input file after the writing process has finished. All should happen in elmer writer.

cheers bernd
HoWil
Posts: 1002
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer electrostatics FEM

Postby HoWil » Tue Feb 25, 2020 7:23 pm

bernd wrote:
Tue Feb 25, 2020 10:38 am
what would be needed to do this by the elmer writer?
I think it is not much. I tried to modify it myself but finally (after giving up :? ) decided that setting the 'Permittivity of Vacuum' to 1 is a really really special case and only used for this tutorial.
I added in 'electrostatic.py' (see https://github.com/FreeCAD/FreeCAD/blob ... ostatic.py)

Code: Select all

        obj.addProperty(
            "App::PropertyFloat", "PermittivityOfVacuum",
            "Electrostatic", "PermittivityOfVacuum")
but struggled with modifying 'writer.py' (https://github.com/FreeCAD/FreeCAD/blob ... /writer.py) in a way that the modified constant is read from the 'equation' and handed over to '_handleElectrostaticConstants' instead of simply writing the standard value as it is done now:

Code: Select all

def _handleElectrostaticConstants(self):
        self._constant(
            "Permittivity Of Vacuum",
            getConstant("PermittivityOfVacuum", "T^4*I^2/(L*M)"))
            

bernd wrote:
Tue Feb 25, 2020 10:38 am
I would like to add this example to official FreeCAD FEM examples as it is a know example (elmer) and it would be the first example in electic FEM.
This is also my goal. But we should add some additional improvements before:
  • The UI for 'ConstraintElectrostaticPotential' should be made a bit more intuitive. I struggled enabling/disabling the capacitanceBody_spinBox depending on capacitanceBodyBox (see the screenshot below and https://github.com/FreeCAD/FreeCAD/blob ... tential.ui) BTW: the spinbox and the capacitanceBodyBox could be oriented as for 'Potential'.
  • A check if the flag in the boundary condition is set when capacitance matrix is selected in es equation would be good... should be done in writer.py
Attachments
ConstraintElectrostaticPotential.png
ConstraintElectrostaticPotential.png (102.96 KiB) Viewed 234 times
HoWil
Posts: 1002
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer electrostatics FEM

Postby HoWil » Thu Feb 27, 2020 7:25 am

HoWil wrote:
Tue Feb 25, 2020 7:23 pm
but struggled with modifying 'writer.py' ...
bernd wrote:
Tue Feb 25, 2020 10:38 am
Ping
Can you please help me with all three things (permittivity, Ui and check/warnings)?
User avatar
bernd
Posts: 9828
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Elmer electrostatics FEM

Postby bernd » Thu Feb 27, 2020 8:17 am

HoWil wrote:
Tue Feb 25, 2020 7:23 pm
but struggled with modifying 'writer.py' ...
some patience I moved constants to an own module see git commit dbbab7ae and git commit 3d4013bf Next will be some small new object to be able to overwrite constants for the analysis the object is in. IMHO this is the way to go and not add the constants to the equation object.
User avatar
bernd
Posts: 9828
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Elmer electrostatics FEM

Postby bernd » Thu Feb 27, 2020 8:18 am

for the ui stuff I did not had the time to have a look at this. This will take a few days ... First the constants and the example. You might even need to remember me on this ... one again :oops: