Elmer electrostatics FEM

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 electrostatics FEM

Post by HoWil »

bernd wrote: Fri Jun 26, 2020 6:40 am Would you give https://github.com/berndhahnebach/FreeC ... rmittivity a try. ...
  • If I run the the simulation I get a warning "Warning: Ignored constraint ConstantVacuumPermittivity." while the constant value is exported (see below the exported .sif).
  • The value in the Data-Tab of the Combo-View is given as with "s^4*A^2/(mm^3*kg)". We should switch here to m-based units to avoid confusions. Such values are usually given in ISO/meter-based units. We also use Volts for the potential. Nevertheless the input dialogue accepts the input of units to "F/m" or "s^4*A^2/(m^3*kg)" which is automatically changed to "s^4*A^2/(mm^3*kg)" :!: "F/m" would be good as standard unit (See also https://en.wikipedia.org/wiki/Vacuum_permittivity).
  • a value of 1 is exported as 0.9999999999999999 ... this is in my opinion a python-limitation !?
If you can change the two minor things above than the attached model is ready for the examples. Thank you very much!!!
Next stop ISO units :D .
Screenshot from 2020-06-28 08-57-16.png
Screenshot from 2020-06-28 08-57-16.png (339.79 KiB) Viewed 2060 times
Screenshot from 2020-06-28 09-15-54.png
Screenshot from 2020-06-28 09-15-54.png (357.83 KiB) Viewed 2060 times

Code: Select all

Check Keywords Warn

Header
  Mesh DB "."
End

Solver 1
  Bubbles = Logical False
  Calculate Capacitance Matrix = Logical True
  Calculate Electric Energy = Logical True
  Calculate Electric Field = Logical True
  Calculate Surface Charge = Logical False
  Displace mesh = Logical False
  Equation = String "Stat Elec Solver"
  Exec Solver = String "Always"
  Linear System Abort Not Converged = Logical False
  Linear System Convergence Tolerance = Real 1e-08
  Linear System Iterative Method = String "BiCGStab"
  Linear System Max Iterations = Integer 500
  Linear System Precondition Recompute = Integer 1
  Linear System Preconditioning = String "ILU0"
  Linear System Residual Output = Integer 1
  Linear System Solver = String "Iterative"
  Optimize Bandwidth = Logical True
  Procedure = File "StatElecSolve" "StatElecSolver"
  Stabilize = Logical True
  Steady State Convergence Tolerance = Real 1e-05
  Variable = String "Potential"
  Variable DOFs = Integer 1
End

Simulation 
  BDF Order = Integer 1
  Coordinate Mapping(3) = Integer 1 2 3
  Coordinate System = String "Cartesian 3D"
  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 = Real 0.9999999999999999
End

Body 1
  Equation = Integer 1
  Material = Integer 1
  Name = String "Solid1"
End

Material 1
  Relative Permittivity = Real 1.0
End

Equation 1
  Active Solvers(2) = Integer 1 2
End

Solver 2
  Equation = String "ResultOutput"
  Exec Solver = String "After simulation"
  Output File Name = File "case"
  Procedure = File "ResultOutputSolve" "ResultOutputSolver"
  Vtu Format = Logical True
End

Boundary Condition 1
  Electric Infinity BC = Logical True
  Name = String "Face1"
End

Boundary Condition 2
  Capacitance Body = Integer 1
  Name = String "Face2"
End

Boundary Condition 3
  Capacitance Body = Integer 2
  Name = String "Face3"
End

Just for documentation:

Code: Select all

>>> import quantities as pq
>>> epsilon_0 = 8.854e-12 *(pq.F/pq.m)
>>> epsilon_0_mm = epsilon_0.rescale( (pq.A**2 * pq.s**4 / (pq.kg * pq.mm**3)) )
>>> print("Permittivity of Vacuum in mm-base units  : "+str(epsilon_0_mm))
Permittivity of Vacuum in mm-base units  : 8.853999999999999e-21 s**4*A**2/(kg*mm**3)
>>> epsilon_0 = 1 *(pq.F/pq.m)
>>> epsilon_0_mm = epsilon_0.rescale( (pq.A**2 * pq.s**4 / (pq.kg * pq.mm**3)) )
>>> print("Permittivity of Vacuum in mm-base units  : "+str(epsilon_0_mm))
Permittivity of Vacuum in mm-base units  : 1e-09 s**4*A**2/(kg*mm**3)

Code: Select all

! If you get a mm-based capacitance C12 of 1.46980E-17 (F-mm-based) than the permittivity was not set right!
If C12 yields mm-based 1.66000E-06 (F-mm-based) than everything worked correctly.
```
import quantities as pq
C_mm = 1.66000E-06 * (pq.A**2 * pq.s**4 / (pq.kg * pq.mm**2))
print("Capacity in F : " + str(C_mm.rescale(pq.F)))
```
This gives an: Capacity in F : 1.66 F
Attachments
Tutorial_6 - Electrostatic equation – Capacitance of two balls_1p1_cleared mesh and results.FCStd
(20.75 KiB) Downloaded 70 times
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Elmer electrostatics FEM

Post by bernd »

I will have a look.

BTW how about the workflow per se?
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer electrostatics FEM

Post by HoWil »

bernd wrote: Sun Jun 28, 2020 8:33 am I will have a look.

BTW how about the workflow per se?
You mean inserting the element via "Model->Override constants" and changing the value via Data-Tab.... its good. Can not propose a better solution!
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Elmer electrostatics FEM

Post by bernd »

HoWil wrote: Sun Jun 28, 2020 8:56 am
bernd wrote: Sun Jun 28, 2020 8:33 am BTW how about the workflow per se?
You mean inserting the element via "Model->Override constants" and changing the value via Data-Tab.... its good. Can not propose a better solution!
Yes. Me neither, thus will go for it. Although I am not 100 happy with it.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Elmer electrostatics FEM

Post by bernd »

HoWil wrote: Sun Jun 28, 2020 7:23 am
  • If I run the the simulation I get a warning "Warning: Ignored constraint ConstantVacuumPermittivity." while the constant value is exported (see below the exported .sif).
really? Have you used latest branch? Not here. Would you print all output from report console?
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer electrostatics FEM

Post by HoWil »

bernd wrote: Mon Jun 29, 2020 12:32 pm
HoWil wrote: Sun Jun 28, 2020 7:23 am
  • If I run the the simulation I get a warning "Warning: Ignored constraint ConstantVacuumPermittivity." while the constant value is exported (see below the exported .sif).
really? Have you used latest branch? Not here. Would you print all output from report console?
This is for sure another git related issue :ugeek: .
Not sure if Git and I will ever be good friends ;) .
Will erase everything and start from scratch.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Elmer electrostatics FEM

Post by bernd »

HoWil wrote: Sun Jun 28, 2020 7:23 am
  • The value in the Data-Tab of the Combo-View is given as with "s^4*A^2/(mm^3*kg)". We should switch here to m-based units to avoid confusions. Such values are usually given in ISO/meter-based units. We also use Volts for the potential. Nevertheless the input dialogue accepts the input of units to "F/m" or "s^4*A^2/(m^3*kg)" which is automatically changed to "s^4*A^2/(mm^3*kg)" :!: "F/m" would be good as standard unit (See also https://en.wikipedia.org/wiki/Vacuum_permittivity).
AFAIK a task panel would be needed to explicit use a user defined unit.

HoWil wrote: Sun Jun 28, 2020 7:23 am [*] a value of 1 is exported as 0.9999999999999999 ... this is in my opinion a python-limitation !?
[/list]
noted this too, played a bit, but I do not want to change to much in Markus his constant implementation code as it may make problems with other constants. We may need to tackle this down later on.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Elmer electrostatics FEM

Post by bernd »

merged, https://github.com/FreeCAD/FreeCAD/comp ... b43aa5bfbf

we can solve the problems later on ...
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Elmer electrostatics FEM

Post by bernd »

HoWil wrote: Mon Jun 29, 2020 1:01 pm ping
Would it be possible to test the two Elmer electrostatic examples from new GSoC development? Since we do heavy testing it is best to post all about the electrostatic examples here in this topic. They can be easily set up by the new fem examples gui.

https://github.com/Sudhanshu-Dubey14/Fr ... emexamples


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

Re: Elmer electrostatics FEM

Post by HoWil »

bernd wrote: Tue Jul 14, 2020 3:55 pm
HoWil wrote: Mon Jun 29, 2020 1:01 pm ping
Would it be possible to test the two Elmer electrostatic examples from new GSoC development? Since we do heavy testing it is best to post all about the electrostatic examples here in this topic. They can be easily set up by the new fem examples gui.

https://github.com/Sudhanshu-Dubey14/Fr ... emexamples


cheers bernd
Nice to see it evolving.
Is it possible to merge it into 0.19? Currently I am not able to compile a lot and It would be much much easier to test it in dev-branch.
If it is not possible than it will take 2 to 3 days until I can test :o .
:D Thanks again for your work...
Post Reply