Electrostatic FEM with parabolic interpolation.

Numerical methods and mathematical models of Elmer
Post Reply
Chris_Bo
Posts: 3
Joined: 18 Oct 2017, 12:29
Antispam: Yes

Electrostatic FEM with parabolic interpolation.

Post by Chris_Bo »

Hello,

i am new to the board and, searching for people who may help me with my task.

Basicly, i want to perform electrostatic FEM to get the capacitance matrix of the system under investigation. Usually, it's the capacitance between a finger an a sensor. The geometries are generated in 3rd party programs and the final mesh is created in Gmesh as .msh.
Then i use ElmerGrid to convert and load the .msh and use it in ElmerSover.
Meshes.PNG
(226.82 KiB) Not downloaded yet
Now, i want to avoid having to use a very detailed mesh, because it needs a lot of time to process. Instead, i want to higher order approximation of the electrostatic FEM to generate the potential distribution and capacitance matrix.

I have tried to add "Element = p:2" to the Solver, but i often run into convergence problems. The first iteration result is already "NaN". I have trouble to identify the issue. The simple example attached sometimes converges, but not in a reproducable manner. Most of the time it's "NaN" though. For more complex systems its always "NaN"

Are there additional things i need to take into account when using "Element=p:2"? Are my settings for "Linear System" and "Nonlinear Systems" senseful?

Here is a typical Solver log:

Code: Select all

ELMER SOLVER (v 8.2) STARTED AT: 2017/10/18 12:50:05
ParCommInit:  Initialize #PEs:            1
MAIN: 
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Webpage http://www.csc.fi/elmer, Email elmeradm@csc.fi
MAIN: Version: 8.2 (Rev: Release, Compiled: 2016-03-15)
MAIN: =============================================================
MAIN: 
MAIN: 
MAIN: -------------------------------------
MAIN: Reading Model: case.sif
Loading user function library: [StatElecSolve]...[StatElecSolver_Init0]
LoadMesh: Base mesh name: CurrentModel/.
LoadMesh: Scaling coordinates: 1.000E-03 1.000E-03 1.000E-03
PElementMaps::InitializeMappings: Initializing mappings for elements
LoadMesh: Elapsed time (CPU,REAL):     0.0750    0.0750 (s)
MAIN: -------------------------------------
Loading user function library: [StatElecSolve]...[StatElecSolver_Init]
Loading user function library: [StatElecSolve]...[StatElecSolver]
OptimizeBandwidth: ---------------------------------------------------------
OptimizeBandwidth: Computing matrix structure for: electrostatics...done.
OptimizeBandwidth: Half bandwidth without optimization: 12005
OptimizeBandwidth: 
OptimizeBandwidth: Bandwidth Optimization ...done.
OptimizeBandwidth: Half bandwidth after optimization: 2885
OptimizeBandwidth: ---------------------------------------------------------
MAIN: 
MAIN: -------------------------------------
MAIN:  Steady state iteration:            1
MAIN: -------------------------------------
MAIN: 
SingleSolver: Attempting to call solver
SingleSolver: Solver Equation string is: electrostatics
StatElecSolve: -------------------------------------
StatElecSolve: STATELEC SOLVER:
StatElecSolve: -------------------------------------
StatElecSolve: 
StatElecSolve: Electrostatic iteration: 1
StatElecSolve: Starting Assembly...
DefaultFinishBulkAssembly: Saving bulk values for: electrostatics
 Number of permutation BCs
 Capacitance body:           1 no         520
 Capacitance body:           2 no         337
DefUtils::DefaultDirichletBCs: Setting Dirichlet boundary conditions
DefUtils::DefaultDirichletBCs: Dirichlet boundary conditions set
StatElecSolve:  Assembly (s)          :  0.84699999999999998
CRS_IncompleteLU: ILU(1) (Real), Starting Factorization:
CRS_IncompleteLU: ILU(1) (Real), NOF nonzeros:    764468
CRS_IncompleteLU: ILU(1) (Real), filling (%) :       223
CRS_IncompleteLU: ILU(1) (Real), Factorization ready at (s):     0.09
       1        NaN
       2        NaN
       3        NaN
       4        NaN
       5        NaN
       6        NaN
       7        NaN
       8        NaN
       9        NaN
      10        NaN
      ...
     500        NaN
     501        NaN
ERROR:: IterSolve: Failed convergence tolerances.
ERROR:: ComputeChange: Norm of solution appears to be NaN
And here is my case.sif:

Code: Select all

Header
 CHECK KEYWORDS Warn
 Mesh DB "CurrentModel" "."
 Include Path ""
 Results Directory ""
End

Simulation
 Max Output Level = 5
 Coordinate System = Cartesian
 Coordinate Mapping(3) = 1 2 3
 Simulation Type = Steady state
 Steady State Max Iterations = 1
 Output Intervals = 1
 Timestepping Method = BDF
 BDF Order = 1
 Solver Input File = case.sif
 Post File = case.ep
 Coordinate Scaling = 0.001
End

Constants
 Gravity(4) = 0 -1 0 9.82
 Stefan Boltzmann = 5.67e-08
 Permittivity of Vacuum = 8.8542e-12
 Boltzmann Constant = 1.3807e-23
 Unit Charge = 1.602e-19
End

Body 1
 Target Bodies(1) = 1
 Name = "Body 1"
 Material = 2
 Equation = 1
End

Body 2
 Target Bodies(1) = 2
 Name = "Body 2"
 Material = 2
 Equation = 1
End

Body 3
 Target Bodies(1) = 3
 Name = "Body 3"
 Material = 1
 Equation = 1
End

Solver 1
 Equation = Electrostatics
 Variable = Potential
 Procedure = "StatElecSolve" "StatElecSolver"
 Element = p:2
 Capacitance Matrix Filename = capa.dat
 Calculate Capacitance Matrix = true
 Capacitance Bodies = 2
 Exec Solver = Always
 Stabilize = True
 Bubbles = False
 Lumped Mass Matrix = False
 Optimize Bandwidth = True
 Steady State Convergence Tolerance = 1.0e-5
 Nonlinear System Convergence Tolerance = 1.0e-7
 Nonlinear System Max Iterations = 20
 Nonlinear System Newton After Iterations = 3
 Nonlinear System Newton After Tolerance = 1.0e-3
 Nonlinear System Relaxation Factor = 1
 Linear System Solver = Iterative
 Linear System Iterative Method = BiCGStab
 Linear System Max Iterations = 500
 Linear System Convergence Tolerance = 1.0e-10
 Linear System Preconditioning = ILU1
 Linear System Abort Not Converged = False
 Linear System Residual Output = 1
 Linear System Precondition Recompute = 1
End

Equation 1
 Name = "Equation 1"
 Active Solvers (6) = 1 2 3 4 5 6
End

Material 1
 Name = "Air (room temperature)"
 Relative Permittivity = 1.00059
End

Material 2
 Name = "Copper (generic)"
 Relative Permittivity = 1
End

Boundary Condition 1
 Target Boundaries(1) = 1
 Name = "Sensor (Meshed)"
 Potential = 3.3
 Capacitance Body = 1
End

Boundary Condition 2
 Target Boundaries(1) = 2
 Name = "Finger (Meshed)"
 Potential = 0
 Capacitance Body = 2
End

Boundary Condition 3
 Target Boundaries(6) =  3 4 5 6 7 8
 Name = "Infinity"
 Electric Infinity BC = True
End
Attached you can also find the .msh used in this example.
CurrentModel.msh
(386.57 KiB) Downloaded 236 times
If there are other examples to learn from, please provide me a link. I wasn't lucky to find posts that would help me.

Thank you very much!
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Electrostatic FEM with parabolic interpolation.

Post by raback »

Hi

The capacitance matrix is automated so dont define Potential if you set Capacitance Boundary for some BC.

I guess the p:2 should work, if it doesn't you could as well ask for quadratic elements in Gmsh.

I hope you will be using somewhat denser mesh even with quadratic elements than shown here.

-Peter
Chris_Bo
Posts: 3
Joined: 18 Oct 2017, 12:29
Antispam: Yes

Re: Electrostatic FEM with parabolic interpolation.

Post by Chris_Bo »

raback wrote:Hi

The capacitance matrix is automated so dont define Potential if you set Capacitance Boundary for some BC.

I guess the p:2 should work, if it doesn't you could as well ask for quadratic elements in Gmsh.

I hope you will be using somewhat denser mesh even with quadratic elements than shown here.

-Peter
Hi Peter,
thank you very much for your reply and suggestions!

I removed the Potential definitions from boundary conditions, but unfortunately that didn't solve the convergence problems. I still get NaN's when running the simulation.

I will try to set quadratic elements in Gmesh instead of Elmer, that's a good suggestion.

However, if it should run with p:2 in Elmer, what may be the reason for those conversion problems i run into? Are my preconditioner settings correct, or do they not affect convergence? Are my tolerance settings for the Linear and Non-Linear System senseful?

Your help is very much appreciated! Thank you!
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Electrostatic FEM with parabolic interpolation.

Post by raback »

Hi

The settings should be fine. The Nans would seem to hint that there is undefined row such that ILU cannot be solved. If things go ok NaNs can still occure but only after lengthy divergence. Basically the preconditioners have everything to do with convergence... The choice of Krylov method may be less critical.

-Peter
Chris_Bo
Posts: 3
Joined: 18 Oct 2017, 12:29
Antispam: Yes

Re: Electrostatic FEM with parabolic interpolation.

Post by Chris_Bo »

Hi Peter,

thanks again for your input. I'll keep playing around with preconditioner settings.
Post Reply