[Gmsh] GRegion meshsize

walter steffe walter.steffe.it at gmail.com
Sun Sep 20 17:37:36 CEST 2020


In order to better support my application (see hierarchical-electromagnetics.com) I made the following small changes to gmsh sources (version 4.6.0):

1) File GRegion.h : Added a "double meshSize" field into the "GRegion:meshAttributes"

  class GRegion : public GEntity {
   ........
   struct {    ......
    double meshSize;
   } meshAttributes;
   ...
  }

  
2) File GRegion.cpp: added "meshAttributes.meshSize = MAX_LC;" into the function "void GRegion::resetMeshAttributes()"

 void GRegion::resetMeshAttributes()
 {
   ...
   meshAttributes.QuadTri = NO_QUADTRI;
   meshAttributes.meshSize = MAX_LC;
 }

3) File meshGRegionNetgen.cpp: changed following lines:

   line 320:
     --  Ng_GenerateVolumeMesh(ngmesh, CTX::instance()->mesh.lcMax);
     ++  Ng_GenerateVolumeMesh(ngmesh, std::min(gr->meshAttributes.meshSize, CTX::instance()->mesh.lcMax));
   line 345:
     --  Ng_OptimizeVolumeMesh(ngmesh, CTX::instance()->mesh.lcMax);
     ++  Ng_GenerateVolumeMesh(ngmesh, std::min(gr->meshAttributes.meshSize, CTX::instance()->mesh.lcMax));




I would like to ask, if possible, to accept these changes in the official gmsh sources.

The motivation is that, in an electromagnetic simulation, the mesh size need to be more refined in regions where the dielectric permittivity is high.
The mesh refinemnet applied on the boundary of these regions may not be sufficient because the mesh size of tetrahedrons which are distant from the boundary is
defined by the global lcMax.


Thanks
Walter







More information about the gmsh mailing list