[Gmsh] saving the mesh for a subdomain separately

G. D. McBain gdmcbain at protonmail.com
Tue Nov 20 06:30:34 CET 2018

> If define the sphere to be physical surface instead of physical volume, do I lose the mesh over the sphere since it is no longer a physical volume?

That's right.  Define both the sphere as a Physical Surface and its interior as a Physical Volume.

> and more importantly, assume that
> 1.  the part of the mesh over sphere is sphere.msh.
> 2.  the part of the mesh over the complement of sphere in cube is sphere_complement.msh.
>     Now I can only generate box.msh and my biggest problem seems to remain to be able to extract sphere.msh and sphere_complement.msh from box.msh. The idea of splitting the input files seems to give separate mesh over subdomains, but I hope to be able extract them from box.msh so that all of them agree to each other.

Why can you only generate box.msh?

Sorry, I'm confused; I thought you wanted the subdomains meshed separately.

    "I need the portions of the mesh for the sphere as well as
    the one for outside the sphere separately read into Matlab
    for my problem."

If you don't mind having them all in the one MSH file, it's easy: just use a single GEO file. (Attached as "omnibus.geo".)

    Include "geometry.geo";

    Physical Volume("ball") = {1};
    Physical Volume("complement") = {2};

All the physical entities will end up meshed (consistently) in the one MSH file.  See attached omnibus.png.

Then there remains the problem of how to get MATLAB to recognize the separate subdomains (Physical Volumes).  I can't help you with that part, I'm afraid---no MATLAB here.  It should be easy enough though; I know how to do it in Python.  The subdomain information is all contained in the MSH file.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: omnibus.geo
Type: application/vnd.dynageo
Size: 93 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20181120/79dd9d24/attachment-0001.geo>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: omnibus.png
Type: image/png
Size: 122033 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20181120/79dd9d24/attachment-0001.png>

More information about the gmsh mailing list