Elmer electrostatics FEM
Moderator: bernd
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
Re: Elmer electrostatics FEM
This is basically my fault... will check it out and compile!bernd wrote: ↑Thu May 21, 2020 3:00 pm git commit 10fdcf57b7
It seams I was to fast. I fixed the fix ...
Would you double check HoWil?
Re: Elmer electrostatics FEM
That's neat idea! It's probably not that different since E=CU^2/2 and F=dU/dx. One would need multiple computations to get something like a force matrix. With one simulation you can get forces acting on nodes and group of nodes i.e boundaries.HoWil wrote: ↑Thu May 21, 2020 10:33 am Why not using something similar to the calculation of the capacitance where I can specify different 'ports' and the capacitance is given between all different pairs of ports. I am sure the mathematics behind the calculation of the capacitance and the forces is completely different but It is much simpler for the user to specify a boundary and get the total force on this boundary without running a integration on the nodes of the boundary afterwards.
-Peter
Re: Elmer electrostatics FEM
Here a first simple benchmark model using electrostatics in FC. Its basically a cube with 2V on the top face and -1V on the bottom face. I try to calculate the capacitance and compute the potential distribution inside the model.
There is one interesting point which I saw during first tests with the model.
The values of the potential look like the are inverted and scaled to values between 0 and 1 if the calculation of the capacitance matrix is switched on. If it is switched off the values for the potential are correct and given in mm-based values of Volt. See Text-Document inside the model. The .sif files are except for the value of the Capacitance Matrix identical (see below).
The generated .sif file when the calculation for the capacitance matrix is switched on.
With the calculation for the capacitance matrix switched off the .sif file looks like:
EDIT: Am I right that it is not possible to calculate the capacitance and the force at the same time/simulation run?
Attached you find the FC file and the generated model including the .sif.
There is one interesting point which I saw during first tests with the model.
The values of the potential look like the are inverted and scaled to values between 0 and 1 if the calculation of the capacitance matrix is switched on. If it is switched off the values for the potential are correct and given in mm-based values of Volt. See Text-Document inside the model. The .sif files are except for the value of the Capacitance Matrix identical (see below).
The generated .sif file when the calculation for the capacitance matrix is switched on.
Code: Select all
Check Keywords Warn
Header
Mesh DB "."
End
Solver 1
Bubbles = Logical False
Calculate Capacitance Matrix = Logical True
Calculate Electric Energy = Logical False
Calculate Electric Field = Logical False
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-06
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-06
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 8.8542e-21
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
Capacitance Body = Integer 1
Name = String "Face6"
Potential = Real 2000000.0
End
Boundary Condition 2
Capacitance Body = Integer 2
Name = String "Face5"
Potential = Real -1000000.0
End
Code: Select all
Check Keywords Warn
Header
Mesh DB "."
End
Solver 1
Bubbles = Logical False
Calculate Capacitance Matrix = Logical False
Calculate Electric Energy = Logical False
Calculate Electric Field = Logical False
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-06
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-06
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 8.8542e-21
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
Capacitance Body = Integer 1
Name = String "Face6"
Potential = Real 2000000.0
End
Boundary Condition 2
Capacitance Body = Integer 2
Name = String "Face5"
Potential = Real -1000000.0
End
Peter, should the potential look this way when the calculation of the capacitance matrix is switched on?raback wrote: Ping
EDIT: Am I right that it is not possible to calculate the capacitance and the force at the same time/simulation run?
Attached you find the FC file and the generated model including the .sif.
- Attachments
-
- Elmer_simple_electrostatics_benchmark_models_cube-capacitor.FCStd
- (548.63 KiB) Downloaded 52 times
-
- SolverElmer.zip
- the generated Elmer model
- (208.94 KiB) Downloaded 44 times
Re: Elmer electrostatics FEM
Hi
Capacitance matrix involves a special kind of automated procedure. If you need to define N x N capacitance matrix the voltage is varied N times so that it is one in the i:th capacitor (i=1,2,...,N), and zero on others. Then when computing the induced charge for all combinations we have N x N charges from which the capacitance matrix may be solved from.
So yes, the capacitance matrix will visualize the last combination in the above process and basically it is automated for your.
Why use 0/1 potentials? The mere concept of capacitance assumes linear equations so we can use the potentials arbitrarily as far as they give enough information to define the capacitance. Choosing 0/1 seems convenient.
-Peter
Capacitance matrix involves a special kind of automated procedure. If you need to define N x N capacitance matrix the voltage is varied N times so that it is one in the i:th capacitor (i=1,2,...,N), and zero on others. Then when computing the induced charge for all combinations we have N x N charges from which the capacitance matrix may be solved from.
So yes, the capacitance matrix will visualize the last combination in the above process and basically it is automated for your.
Why use 0/1 potentials? The mere concept of capacitance assumes linear equations so we can use the potentials arbitrarily as far as they give enough information to define the capacitance. Choosing 0/1 seems convenient.
-Peter
Re: Elmer electrostatics FEM
If I select to calculate the capacitance matrix, than it is not possible to calculate also electric forces, right?raback wrote: ↑Mon May 25, 2020 10:54 am Hi
Capacitance matrix involves a special kind of automated procedure. If you need to define N x N capacitance matrix the voltage is varied N times so that it is one in the i:th capacitor (i=1,2,...,N), and zero on others. Then when computing the induced charge for all combinations we have N x N charges from which the capacitance matrix may be solved from.
So yes, the capacitance matrix will visualize the last combination in the above process and basically it is automated for your.
Why use 0/1 potentials? The mere concept of capacitance assumes linear equations so we can use the potentials arbitrarily as far as they give enough information to define the capacitance. Choosing 0/1 seems convenient.
-Peter
So, in the 'Tutorial 6 - Electrostatics' of the nonGUI examples (https://www.nic.funet.fi/index/elmer/do ... nonGUI.pdf, starting at page 28) the capacitance and the forces were not computed at one?
BTW: What exactly are the'Elmer MEMS units' mentioned on page 31. There was no scaling introduce in the 'Simulation' section. I ask this because I re-build this model with the current FC-Elmer-framework and use the provided mesh from the tutorial (5mm x 5mm x 7,5mm in size) and compute the electrostatic force and the capacitance matrix. The force is equal to the given one in the documentation but the capacitance is off by a factor of 1000. Do I have to scale the model to µm?
Please see the following documentation which can be found also in the attached FC-Elmer model:
Code: Select all
##### Analytical calculation of the capacitence in z-direction
C = epsilon_p * epsilon_r * A/d where A is the area of the parallel plate capacitor and d is the distance between the plates.
```
import quantities as pq
print("Analytical solution for parallel plate cacacitor in F: ")
A = (0.005*0.005) * pq.m**2 # alternative: A = (0.005*0.005 - 1.5e-3*1.5e-3) * pq.m**2
d = 0.001 * pq.m
C = (8.854e-12 *(pq.F/pq.m) * 1 * (A/d) )
print(str(C.rescale(pq.F)))
```
Results in:
```
Analytical solution for parallel plate cacacitor in F:
2.2134999999999999e-13 F
```
##### Values for the capacitance computed by Elmer
```
import quantities as pq
C_mm = 2.16291E-19 * (pq.A**2 * pq.s**4 / (pq.kg * pq.mm**2))
print("Capacity in F : " + str(C_mm.rescale(pq.F)))
```
Capacity in F : 2.16291e-13 F
The the analytical an simulation results match very well but do not match the values given in the documentation!!!
Code: Select all
##### Analytical calculation of the resulting Force in z-direction for the 5mm x 5mm x 7.5mm large model!!!
See also nonGUI Tutorial page 30 (F = 1/2 * epsilon_0 * epsilon_r * (A/d^2) * Potentialdifference^2)
```
import quantities as pq
print("Analytical solution for parallel plate cacacitor in N: ")
A = (0.005*0.005) * pq.m**2 # alternative: A = (0.005*0.005 - 1.5e-3*1.5e-3) * pq.m**2
d = 0.001 * pq.m
F = (1./2. * 8.854e-12 *(pq.F/pq.m) * 1 * (A/d**2) * ( ( (1e6 * pq.V )**2)))
print(F.rescale(pq.N))
```
Results in:
```
Analytical solution for parallel plate cacacitor in N:
110.67500000000001 N
```
##### Values for the resulting Force in z-direction computed by Elmer
```
import quantities as pq
force_es = 1.030748E+05*(pq.kg*pq.mm/pq.s**2)
print("electrostatic Force in N : "+str(force_es.rescale(pq.N)))
```
Results : electrostatic Force in N : 103.07480000000001 N
The results match very well!!!
Code: Select all
OS: Ubuntu 19.10 (ubuntu:GNOME/ubuntu-wayland)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Branch: unknown
Hash: 30dcafc590fb5051d8a7ed99dce21125ad5d6439
Python version: 3.7.5
Qt version: 5.12.4
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
- Attachments
-
- Screenshot from 2020-05-26 22-40-40.png (294.35 KiB) Viewed 1855 times
-
- Tutorial_nonGUI_6 - Electrostatics - StatElecSolve, ElectricForce_cleard_Mesh.FCStd
- (23.8 KiB) Downloaded 44 times
Last edited by HoWil on Sun Jul 26, 2020 9:15 am, edited 1 time in total.
Re: Elmer electrostatics FEM
You can forget about them. It is just a convenient choice of units in a project long ago. Unless you're working with very small sizes no need to use non-standard units.HoWil wrote: ↑Tue May 26, 2020 8:44 pm BTW: What exactly are the'Elmer MEMS units' mentioned on page 31. There was no scaling introduce in the 'Simulation' section. I ask this because I re-build this model with the current FC-Elmer-framework and use the provided mesh from the tutorial (5mm x 5mm x 7,5mm in size) and compute the electrostatic force and the capacitance matrix.
-Peter
Re: Elmer electrostatics FEM
Well, if you have just two different potentials there is not really a need to calculate capacitance matrix. I think you can get the capacitance from the electric energy automatically since E=CU^2/2. So in this case the "Capacitance matrix" machinery is an overkill since the size of the matrix is 1x1. You'll see that you get capacitance computed even without it.HoWil wrote: ↑Tue May 26, 2020 8:44 pm If I select to calculate the capacitance matrix, than it is not possible to calculate also electric forces, right?
So, in the 'Tutorial 6 - Electrostatics' of the nonGUI examples (https://www.nic.funet.fi/index/elmer/do ... nonGUI.pdf, starting at page 28) the capacitance and the forces were not computed at one?
-Peter
Re: Elmer electrostatics FEM
Here's a tip that will make your sif files simpler (if this is wanted).
In Simulation section you may set
Eliminating the need for the separate ResultOutputSolver. The end result will be exactly the same.
-Peter
In Simulation section you may set
Code: Select all
Post File = case.vtu
-Peter
Re: Elmer electrostatics FEM
But, I want to use this tutorial model as example for the new capabilities of FC-Elmer. Therefore, I need to show that the results are equal and correct
Nevertheless, I think I found the difference.... the tutorial mesh is calculated/assumed to be dimensionless. Therfore, Elmer calculates it as it would be 5m x 5m x 7,5m large. When the mesh is imported into FC Millimeter are used as standard length unit. So I calculated a model which is by a factor 1000 smaller. resulting in a smaller capacitance while the force keeps the same (larger faces ...).
Will adopt the model in the next days and share it here afterwards.