Adaptive Meshing in 3D ?

Numerical methods and mathematical models of Elmer
Post Reply
rainer.ochs
Posts: 22
Joined: 19 Oct 2012, 01:24
Antispam: Yes

Adaptive Meshing in 3D ?

Post by rainer.ochs » 13 Nov 2012, 02:12

Hello
In the Elmer Solver Manual there is a section about adaptivity with a keyword "Adaptive Mesh Refinement".
I found a example in 2D, but does this also work in 3d?
viewtopic.php?f=18&t=2193&p=6549&hilit= ... ment#p6549

I am simulating magnetic fields in nonlinear iron cores where some thin parts are saturated. If the mesh is too coarse the results are bad and there are convergence problems from the BH nonlinearity.
So the mesh needs to be very fine in the thin parts, but a generally fine mesh results in very long calculations and exhausts memory.

The ideal solution seems to me to adapt the mesh according to the calculated field gradients, so I would get a fine mesh where it needs to be fine.
Is there a solution for that?

Regards
Rainer

raback
Site Admin
Posts: 3291
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Adaptive Meshing in 3D ?

Post by raback » 16 Nov 2012, 23:51

Hi

A challenge is that the adaptive meshing has not been implemented in parallel. This creates challenges for the communication and load balancing. So these features have for that reason not been that much developed lately. Also there is a lack of proper 3D mesh generator for which you could give the mesh density field and obtain the mesh. I know that netgen has been used to do this also in conjucntion with Elmer but I have not personally done that.

-Peter

rainer.ochs
Posts: 22
Joined: 19 Oct 2012, 01:24
Antispam: Yes

Re: Adaptive Meshing in 3D ?

Post by rainer.ochs » 17 Nov 2012, 00:18

Hi Peter,
thanks for the information.
Do I understand that correctly that the refinement of the mesh is not done by the solver - I do need an external Mesh generator to do this.
The keyword seemed to implicate that this is a function of the solver...
Gmsh has a functionality called Background Mesh that controls the meshing density - again there is a example in 2D - I will investigate to see if it also works in 3D. I will give it a try.
- If there is someone who has experience with that, some advice would be apreciated! -
I am working currently with a Salome meshing setup that is controlled from Sketchup, but Salome seems not to be supporting such features.
I have played a bit with a self written adaptive mesh splitting algorithm but the resulting meshes have too bad quality to be of great use.

Rainer

madstamm
Posts: 37
Joined: 07 Apr 2010, 09:56

Re: Adaptive Meshing in 3D ?

Post by madstamm » 18 Nov 2012, 01:24

This is an important topic for 3D electromagnetics. I ran into the exact same problems - i also use salome (only useful mesh generator for complex parts with multiple objects)

There is currently no solution i know to di adaptive meshing - but this could br the last step to make elmer a real alternative to do 3D E-M simulation...

Mike

rainer.ochs
Posts: 22
Joined: 19 Oct 2012, 01:24
Antispam: Yes

Re: Adaptive Meshing in 3D ?

Post by rainer.ochs » 21 Nov 2012, 00:09

I have investigated this subject now in more depth.
It seems that the only open source mesher that allows to control the mesh size by field parameters is gmsh. There is a badly documented feature called background mesh that allows to do this. This also works in 3D if the delauni algorithm is used - I wrote a small demo to test it.

It is very difficult however to generate models with multiple bodies in gmsh that have conformal interfaces. There is a function to import CAD data but with that it is impossible to create conformal interfaces - all interfaces then consist of two boundaries that are meshed seperately and differently.

The only way I have managed to get a conformal interfaces with gmsh is when all the faces and volumes are defined in gmsh's .geo file and the same interface surface is used in both volumes.
Manually this is only possible for very small and simple models but hardly for real working models.
This models then is correctly meshed and it is possible to control the mesh size with the background field.
In terms of a BREP solid however this represents an impossible geometric structure.

So the only practical way I can think of would be to write a generator for gmsh geometry out of a geometry that is defined by other means that conforms to all the requirements of gmsh.
One option to do this would be SketchUp - I once have written an exporter for IGES that does a fairly similar thing. At the moment however I have no idea how to handle the common interfaces there.

As long as there is not way to create the geometry in gmsh in a adequate fashion the only tool that really supports multiple bodies is Salome. As far as I can see this is at the moment the only option for problems that require multiple bodies.
Adaptive Meshing then is not possible.

annier
Posts: 1102
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Adaptive Meshing in 3D ?

Post by annier » 10 Aug 2018, 19:07

Hi all,
Recently , I tried to use adaptive meshing in 3D, with the mesh exported from Salome 8.5.0.
The following error was encountered during Elmer solver run:

Code: Select all

DefUtils::DefaultDirichletBCs: Setting Dirichlet boundary conditions
DefUtils::DefaultDirichletBCs: Dirichlet boundary conditions set
CRS_IncompleteLU: ILU(0) (Real), Starting Factorization:
CRS_IncompleteLU: ILU(0) (Real), NOF nonzeros:      4712
CRS_IncompleteLU: ILU(0) (Real), filling (%) :       100
CRS_IncompleteLU: ILU(0) (Real), Factorization ready at (s):     0.00
IterSolver: Calling real valued iterative solver
       1 0.9188E-10
       1 0.9188E-10
ComputeChange: NS (ITER=2) (NRM,RELC): (  461178.03     0.31298470E-09 ) :: heat equation
HeatSolve: iter:    2 Assembly: (s)    0.05    0.13
HeatSolve: iter:    2 Solve:    (s)    0.00    0.00
HeatSolve:  Result Norm   :    461178.03068690049
HeatSolve:  Relative Change :    3.1298470423374032E-010
RefineMesh: 
RefineMesh: ----------- M E S H   R E F I N E M E N T --------------
ERROR:: SplitMesh: Internal splitting implemented only for linear triangles.
I went to find at Adaptive.F90 and found that only the ElementCode = 303 , will allow mesh refinement.

Code: Select all

!   Determine the marked elements:
!   ------------------------------
    MarkedElements = 0

    DO i = 1,RefMesh % NumberOfBulkElements
       RefElement => RefMesh % Elements(i)

       IF ( RefElement % TYPE % ElementCode /= 303 ) THEN
          CALL Fatal( 'SplitMesh', 'Internal splitting implemented only for linear triangles.' )
       END IF
Since, 303 stands for linear triangle element, are the current capabilities of adaptive meshing still limited to 2D, or by some other things this can be extended to 3D as well? So, what is the ideal mesh algorithm/hypothesis format to be exported from Salome?

Yours Sincerely,
Anil Kunwar

Post Reply