<div dir="ltr"><div dir="ltr"><div><br></div><div></div><div>
<div>Hello Christophe,</div><div><br></div><div>Thank you for your quick answer! It works fine.<br></div><div><br></div><div>In the meantime I made the same as your proposition with the API :<br></div><div><br></div><div></div><div>1. when all the geometry is described, I mesh it</div><div>2. For each list of physicals that I want to save, <u>I impose always the same tag</u> and I give names to the physical groups that I want to save according to some rules :</div><div> ps = gmsh.model.addPhysicalGroup(2, n, physTag)<br> gmsh.model.setPhysicalName(2, ps, c)</div><div>3. I save the mesh</div><div>4. I remove all physical groups (gmsh.model.removePhysicalGroups())</div><div>5. Return to 2. as often as needed.</div><div><br></div><div>Best regards,</div><div><br></div><div>Michel Cassagnes<br></div>
</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le dim. 5 avr. 2020 à 08:42, Christophe Geuzaine <<a href="mailto:cgeuzaine@uliege.be">cgeuzaine@uliege.be</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
> On 5 Apr 2020, at 00:32, Michel Cassagnes <<a href="mailto:michelcassagnes11@gmail.com" target="_blank">michelcassagnes11@gmail.com</a>> wrote:<br>
> <br>
> Dear all,<br>
> <br>
> It seems that the option does not exist yet but maybe it has something to do with partitioning. Here is my question :<br>
> <br>
> 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.<br>
> <br>
> What I do for now :<br>
> 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)<br>
> 2 - another text file describes the different parts of the geometry, by sets of layer names. Some physicals may belong to several parts.<br>
> 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.<br>
> 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 <br>
> <br>
> 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 <br>
> - then save the mesh in several steps, giving at each step a list of physicals that are to be saved.<br>
> <br>
<br>
Hello Michel,<br>
<br>
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:<br>
<br>
---<br>
SetFactory("OpenCASCADE");<br>
Box(1) = {0,0,0, 0.1,1,1};<br>
Box(2) = {0.1,0,0, 0.3,1,1};<br>
Box(3) = {0.4,0,0, 0.6,1,1};<br>
BooleanFragments{ Volume{1,2,3}; Delete; }{}<br>
<br>
Mesh 3;<br>
<br>
Physical Volume("Left", 1) = {1};<br>
Save "m1.med";<br>
Delete Physicals;<br>
<br>
Physical Volume("Middle", 2) = {2};<br>
Save "m2.med";<br>
Delete Physicals;<br>
<br>
Physical Volume("Right", 3) = {3};<br>
Save "m3.med";<br>
---<br>
<br>
Cheers,<br>
<br>
Christophe<br>
<br>
<br>
<br>
<br>
<br>
> Exemple :<br>
> geo file :<br>
> surfaces : "s1", "s2", "s3"<br>
> points : "p1", "p2"<br>
> <br>
> meshes to save :<br>
> first med file : <br>
> - meshed surfaces : "s1", "s2"<br>
> - points : "p1"<br>
> second med file :<br>
> - meshed surfaces : "s2", "s3"<br>
> - points : "p2"<br>
> <br>
> I hope it is clear !<br>
> <br>
> Best regards,<br>
> <br>
> Michel Cassagnes<br>
> <br>
> <br>
> _______________________________________________<br>
> gmsh mailing list<br>
> <a href="mailto:gmsh@onelab.info" target="_blank">gmsh@onelab.info</a><br>
> <a href="http://onelab.info/mailman/listinfo/gmsh" rel="noreferrer" target="_blank">http://onelab.info/mailman/listinfo/gmsh</a><br>
<br>
— <br>
Prof. Christophe Geuzaine<br>
University of Liege, Electrical Engineering and Computer Science <br>
<a href="http://www.montefiore.ulg.ac.be/~geuzaine" rel="noreferrer" target="_blank">http://www.montefiore.ulg.ac.be/~geuzaine</a><br>
<br>
<br>
<br>
</blockquote></div></div>