[Gmsh] adaptive mesh background field
walter steffe
walter.steffe at alice.it
Thu Jul 4 02:50:43 CEST 2019
Hello Christophe, thanks for the replay.
To me it is not easy to understand the adapt_mesh.py example.
I already have a C code which generates the initial mesh using the C++
gmsh API. Now I would like to implement an iterative refinement based
on the energy density associated with the electromagnetic field
computed by my EM solver.
I am wondering if it is possible to address the problem in in following
way:
gm GModel *gm; //is the model already meshed.
//The mesh was already
exported with:
gm->writeMSH(meshFileName);
FieldManager *fields = gm->getFields();
int bkgid=getBackgroundField();
Field *bkgfield=get(bkgid);
int format=?; bkgfield->write(posFileName,format);
And then, in a second run:
-to read the initial mesh and size field.
-to modify (reduce) the size field taking into account of EM energy.
-To use the initial mesh and the refined size in order to control the
new meshing.
regards
Walter Steffè
On Wed, 2019-07-03 at 18:19 +0200, Christophe Geuzaine wrote:
> > On 2 Jul 2019, at 16:28, walter.steffe at alice.it wrote:
> >
> > Good morning,
> >
> > The tutorial t7.geo reports an example in which the mesh density
> > is defined in a view consisting of scalar triangles.
> > This kind data structure does not enforce the continuity of the
> > scalar field over adjacent triangles.
> > But if the mesh is isotropic and conformal its density should be a
> > continuous scalar field.
> > So, to me, it seems more natural (and more efficient) to define
> > the mesh density in a view (or a pos file) consisting of scalar
> > points.
> >
> > Would it be OK to use such kind of view as a background mesh ?
> >
>
> Not just as points, because we need to interpolate the field in
> between the points. But you could indeed use a post-processing view
> based on a standard mesh to avoid duplicating data at the nodes. Note
> that in Gmsh this means that you will need 2 models, as associating
> the background field data to the mesh of one model means that you
> would destroy it if you remesh that same model.
>
> Here is an example of doing just that (2 models: one for the bg mesh
> field, the other for the actual mesh) using the Gmsh API:
>
https://gitlab.onelab.info/gmsh/gmsh/blob/master/demos/api/adapt_mesh.py
>
> Christophe
>
>
> > Thanks
> > Walter Steffè
> >
> > _______________________________________________
> > gmsh mailing list
> > gmsh at onelab.info
> > http://onelab.info/mailman/listinfo/gmsh
>
> —
> Prof. Christophe Geuzaine
> University of Liege, Electrical Engineering and Computer Science
> http://www.montefiore.ulg.ac.be/~geuzaine
>
>
>
More information about the gmsh
mailing list