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 27, 2020 8:47 am

bernd wrote:
Thu Feb 27, 2020 8:17 am
some patience
Sorry... :D
Simply wanted to finish it. THX in advance
HoWil
Posts: 1002
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer electrostatics FEM

Postby HoWil » Sun Mar 01, 2020 8:27 pm

Hi,
I today built the 'Tutorial 6 - Electrostatics' of the nonGUI examples (https://www.nic.funet.fi/index/elmer/do ... nonGUI.pdf, starting at page 28)
This tutorial additionally introduces the 'Electric Force' equation, in contrast to the Tutorial6 of the GUI example where only the capacitance was calculated. This is maybe of help or at least interesting for some other here.

Until now I did only set up the model and added the needed lines for the calculation of the force into the .sif file. The results are correct (as far as I can tell; keep the conversion between FC units mm and m in mind; hopefully we find a better solution for that).

I will write an equation for the force calculation hopefully within the next days.
The attached model was build by importing the original geometry/mesh using ElmerGrid to export to .vtk format. I had to delete/clear all mesh data to finally come under 1MB for uploading the file.
BR
HoWil

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


Solver 3
Equation = Electric Force
Procedure = "ElectricForce" "StatElecForce"
End

Solver 4
Exec Solver = After All
Equation = SaveScalars
Procedure = "SaveData" "SaveScalars"
Filename = "scalars.dat"
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 8.8542e-15
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 3 4
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
  Capacitance Body = Integer 1
  Name = String "Face1"
  Potential = Real 0.0
Calculate Electric Force = True
End

Boundary Condition 2
  Capacitance Body = Integer 2
  Name = String "Face8"
  Potential = Real 1000000000000.0
End

Boundary Condition 3
  Capacitance Body = Integer 2
  Name = String "Face9"
  Potential = Real 1000000000000.0
End

Boundary Condition 4
  Capacitance Body = Integer 2
  Name = String "Face10"
  Potential = Real 1000000000000.0
End

Boundary Condition 5
  Capacitance Body = Integer 2
  Name = String "Face11"
  Potential = Real 1000000000000.0
End

Attachments
Tutorial_nonGUI_6 - Electrostatics - StatElecSolve, ElectricForce.FCStd
(18.07 KiB) Downloaded 4 times
Screenshot from 2020-03-01 21-18-06.png
Screenshot from 2020-03-01 21-18-06.png (236.91 KiB) Viewed 418 times
HoWil
Posts: 1002
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer electrostatics FEM

Postby HoWil » Sat Mar 14, 2020 6:05 pm

bernd wrote:
Thu Feb 27, 2020 8:18 am
You might even need to remember me on this ... one again :oops:
Reminding..... :mrgreen:

Would like to sort all the electrostatic related changes out before the feature freeze of 0.19 happens.
@bernd to you know any timeline?
User avatar
bernd
Posts: 9828
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Elmer electrostatics FEM

Postby bernd » Sat Mar 14, 2020 7:29 pm

HoWil wrote:
Sat Mar 14, 2020 6:05 pm
Would like to sort all the electrostatic related changes out before the feature freeze of 0.19 happens.
@bernd to you know any timeline?
very good idea! In the regard of a time line. There is a lot refactoring still going on in Draft ATM. But IMHO the show stopper will be the list of werner in the regard of changes he would like to see in 0.19 in the regard of App::Link merge.
User avatar
bernd
Posts: 9828
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Elmer electrostatics FEM

Postby bernd » Sun Mar 15, 2020 10:09 pm

HoWil wrote:
Sat Mar 14, 2020 6:05 pm
bernd wrote:
Thu Feb 27, 2020 8:18 am
You might even need to remember me on this ... one again :oops:
Reminding..... :mrgreen:
Would you have a look at this? But it is not finished yet. The writer does not yet work.
https://github.com/berndhahnebach/FreeC ... rmittivity The idea is to add a object if one would like to change one of these values https://github.com/FreeCAD/FreeCAD/blob ... py#L35-L48 What do you think of this?

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

Re: Elmer electrostatics FEM

Postby HoWil » Mon Mar 16, 2020 5:21 pm

bernd wrote:
Sun Mar 15, 2020 10:09 pm
Would you have a look at this? But it is not finished yet. The writer does not yet work.
https://github.com/berndhahnebach/FreeC ... rmittivity The idea is to add a object if one would like to change one of these values https://github.com/FreeCAD/FreeCAD/blob ... py#L35-L48 What do you think of this?
Sounds good. Compiling.....
HoWil
Posts: 1002
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer electrostatics FEM

Postby HoWil » Mon Mar 16, 2020 8:05 pm

bernd wrote:
Sun Mar 15, 2020 10:09 pm
The writer does not yet work.
Its only related to some wrong units (you used the one of stefan_boltzmann() :D ). Please see https://github.com/berndhahnebach/FreeCAD_bhb/pull/67 for the changes in the following lines in writer.py to....
Line 203 (in setConstant):

Code: Select all

        theUnit = "s^4*A^2/(m*kg)"
Line 203 (in _handleConstants):

Code: Select all

            setConstant("PermittivityOfVacuum", "0 s^4*A^2/(m*kg)") 

The final problems here are:
  • that until now if one deletes a 'ConstantPermittivityOfVakuum' object the original units only get reset if FC is restartet.
  • A warning is thrown because the object is not registered in ...tasks.py?

    Code: Select all

    Warning: Ignored constraint ConstantPermittivityOfVakuum.
  • Value in the combo box is not exported it is always 0.
EDIT: typo
Last edited by HoWil on Tue Mar 17, 2020 1:09 pm, edited 1 time in total.
User avatar
bernd
Posts: 9828
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Elmer electrostatics FEM

Postby bernd » Tue Mar 17, 2020 6:26 am

merged into my permittivity dev repo. I will give it a try.
HoWil
Posts: 1002
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer electrostatics FEM

Postby HoWil » Thu Mar 19, 2020 2:47 pm

Hi Bernd,
I have a problem :?
I implemented the electrostatic force solver for elmer.
Please see: https://github.com/HoWilgh/FreeCAD/tree/femelmeresforce EDIT or the comparison with your master (including your permittivity-constant on my side: https://github.com/berndhahnebach/FreeC ... meresforce

Now I face the problem that after compilation I do not have an FEM-wb in FC anymore. Can you please point me in the right direction :arrow:
This is really a nasty one, no testing without a FEM-wb.
Thanks in advance,
HoWil
User avatar
bernd
Posts: 9828
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Elmer electrostatics FEM

Postby bernd » Fri Mar 20, 2020 5:48 am

try this ... https://github.com/berndhahnebach/FreeC ... rmittivity

you mixed electricforcesolver and electricforce.

Should it be named equation electricforcesolver or equation electricforce?

Since it is a equation object it may make the user feel unsecure if the equation is called solver but not a solver object?

We should decide to use either name of them and use this name overall.