[Gmsh] Saving msh in several parts defined by lists of physical

Michel Cassagnes michelcassagnes11 at gmail.com
Sun Apr 5 14:53:38 CEST 2020


Hello Christophe,

Thank you for your quick answer! It works fine.

In the meantime I made the same as your proposition with the API :

1. when all the geometry is described, I mesh it
2. For each list of physicals that I want to save, *I impose always the
same tag* and I give names to the physical groups that I want to save
according to some rules  :
            ps = gmsh.model.addPhysicalGroup(2, n, physTag)
            gmsh.model.setPhysicalName(2, ps, c)
3. I save the mesh
4. I remove all physical groups (gmsh.model.removePhysicalGroups())
5. Return to 2. as often as needed.

Best regards,

Michel Cassagnes

Le dim. 5 avr. 2020 à 08:42, Christophe Geuzaine <cgeuzaine at uliege.be> a
écrit :

>
> > On 5 Apr 2020, at 00:32, Michel Cassagnes <michelcassagnes11 at gmail.com>
> wrote:
> >
> > Dear all,
> >
> > It seems that the option does not exist yet but maybe it has something
> to do with partitioning. Here is my question :
> >
> > I would like to save mesh (in med format) in several parts that are
> defined by lists of physicals. Some physicals may belong to more than one
> part.
> >
> > What I do for now :
> > 1 - I prepare a text file that describes a geometry from a cad software
> (list of entities, each entity being described by a list of point
> coordinates, its type and its cad layer)
> > 2 - another text file describes the different parts of the geometry, by
> sets of layer names. Some physicals may belong to several parts.
> > 3 - then I make geo files from 1 and 2, each geo file contains all
> geometry but only physicals which are to be saved as mesh.
> > 4 - Gmsh mesh each geo.files (so I repeat exactly the same meshing for
> each geo file) then I  save only mesh entities with physical tag in med
> format
> >
> > What I would like to do: Instead of meshing all geo files as in point 3
> above:- mesh in only one time the geo file, containing all geometry
> > - then save the mesh in several steps, giving at each step a list of
> physicals that are to be saved.
> >
>
> Hello Michel,
>
> You can exploit the fact that by default, when physical groups are
> defined, Gmsh only saves the entities that belong to physical groups. So
> you can just mesh once, define your physical groups in turn, and save each
> time. Here's an example:
>
> ---
> SetFactory("OpenCASCADE");
> Box(1) = {0,0,0, 0.1,1,1};
> Box(2) = {0.1,0,0, 0.3,1,1};
> Box(3) = {0.4,0,0, 0.6,1,1};
> BooleanFragments{ Volume{1,2,3}; Delete; }{}
>
> Mesh 3;
>
> Physical Volume("Left", 1) = {1};
> Save "m1.med";
> Delete Physicals;
>
> Physical Volume("Middle", 2) = {2};
> Save "m2.med";
> Delete Physicals;
>
> Physical Volume("Right", 3) = {3};
> Save "m3.med";
> ---
>
> Cheers,
>
> Christophe
>
>
>
>
>
> > Exemple :
> > geo file  :
> > surfaces : "s1", "s2", "s3"
> > points : "p1", "p2"
> >
> > meshes to save :
> > first med file :
> >     - meshed surfaces : "s1", "s2"
> >     - points : "p1"
> > second med file :
> >     - meshed surfaces : "s2", "s3"
> >     - points : "p2"
> >
> > I hope it is clear !
> >
> > Best regards,
> >
> > Michel Cassagnes
> >
> >
> > _______________________________________________
> > 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
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20200405/8c014fb6/attachment.html>


More information about the gmsh mailing list