[Gmsh] saving the mesh for a subdomain separately

G. D. McBain gdmcbain at protonmail.com
Tue Nov 20 00:34:17 CET 2018

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
Le mardi, novembre 20, 2018 10:07 AM, Abiti Adili <aadili1 at lsu.edu> a écrit :

> Thank you very much for your time.

You're welcome.

> I am a quite a beginner in Gmsh and I am grateful for your kind reply. I would appreciate it if I could ask the following questions.

Do remember to 'reply all' so that the conversation remains on the list for all to see.

> (1) Does that mean I have to define a physical volume for the sphere as well?


> (2) I might not have understood what you meant and I am a little bit confused about the idea of including the whole .geo file into the scripts that define the subdomain.

"Include" is a keyword in the Gmsh GEO file syntax; see


The idea is to have something like the "sphere.geo" attached.  In full, it is:

Include "geometry.geo";
Physical Volume("sphere") = {1};

And then similarly for the box.

> If I assume the .geo file I included in my last email is geometry.geo and it creates cube with a sphere in it. Would it be possible for you to give a bit more elaboration on how the idea of splitting and syntax of inclusion achieve the mesh for my desired subdomain?

Sure.   See attached.  Actually I missed a couple of defects in the original GEO code:

* The Volume defined there is the whole box, and hasn't had the sphere subtracted.  It should read

Volume(1) = {1}; // the sphere
Volume(2) = {1, 2};  // outside the sphere

* Don't define any physical entities in the common geometry.geo file.

These are rectified in the attached geometry.geo.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sphere.geo
Type: application/vnd.dynageo
Size: 57 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20181119/98a4be5f/attachment-0003.geo>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: box.geo
Type: application/vnd.dynageo
Size: 54 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20181119/98a4be5f/attachment-0004.geo>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geometry.geo
Type: application/vnd.dynageo
Size: 1947 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20181119/98a4be5f/attachment-0005.geo>

More information about the gmsh mailing list