[Gmsh] saving the mesh for a subdomain separately

Abiti Adili aadili1 at lsu.edu
Mon Nov 19 18:58:52 CET 2018


I   have created an unstructured tetrahedral mesh on a unit cube with a sphere in it by using graphical user interface.
I was able to  save the mesh for the whole cube as a msh file and  read it into Matlab using load_gmsh2 function.

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.

I have read in one posting that you can "turn off"   the mesh information for a desired subdomain but having troubles figuring out how.

I would greatly appreciate if someone could explain or give directions on what needs to be done for saving the msh file only for a desired subdomain. I have included the .geo file used to create the cube with the sphere in it below. Thank you very much in advance.

// Gmsh project created on Mon Oct 15 23:57:31 2018
//+
Point(1) = {0, 0, 0, 1.0};
//+
Point(2) = {1, 0, 0, 1.0};
//+
Point(3) = {0, 1, 0, 1.0};
//+
Point(4) = {0, 0, 1, 1.0};
//+
Point(5) = {0, 1, 1, 1.0};
//+
Point(6) = {1, 0, 1, 1.0};
//+
Point(7) = {1, 1, 0, 1.0};
//+
Point(8) = {1, 1, 1, 1.0};
//+
Line(1) = {5, 4};
//+
Line(2) = {4, 6};
//+
Line(3) = {6, 8};
//+
Line(4) = {8, 5};
//+
Line(5) = {4, 1};
//+
Line(6) = {1, 3};
//+
Line(7) = {3, 5};
//+
Line(8) = {3, 7};
//+
Line(9) = {7, 2};
//+
Line(10) = {2, 1};
//+
Line(11) = {8, 7};
//+
Line(12) = {2, 6};
//+
Curve Loop(1) = {1, 2, 3, 4};
//+
Plane Surface(1) = {1};
//+
Curve Loop(2) = {11, -8, 7, -4};
//+
Plane Surface(2) = {2};
//+
Curve Loop(3) = {6, 8, 9, 10};
//+
Plane Surface(3) = {3};
//+
Curve Loop(4) = {5, -10, 12, -2};
//+
Plane Surface(4) = {4};
//+
Curve Loop(5) = {11, 9, 12, 3};
//+
Plane Surface(5) = {5};
//+
Curve Loop(6) = {7, 1, 5, 6};
//+
Plane Surface(6) = {6};
//+
Surface Loop(1) = {5, 2, 3, 6, 1, 4};
//+
Volume(1) = {1};
Physical Volume(1) = {1};

//+
Point(9) = {0.5, 0.5, 0.5, 1.0};
//+
Point(10) = {0.7, 0.5, 0.5, 1.0};
//+
Point(11) = {0.3, 0.5, 0.5, 1.0};
//+
Point(12) = {0.5, 0.7, 0.5, 1.0};
//+
Point(13) = {0.5, 0.3, 0.5, 1.0};
//+
Point(14) = {0.5, 0.5, 0.7, 1.0};
//+
Point(15) = {0.5, 0.5, 0.3, 1.0};
//+
Circle(13) = {12, 9, 14};
//+
Circle(14) = {12, 9, 15};
//+
Circle(15) = {13, 9, 14};
//+
Circle(16) = {13, 9, 15};
//+
Circle(17) = {10, 9, 12};
//+
Circle(18) = {11, 9, 12};
//+
Circle(19) = {11, 9, 13};
//+
Circle(20) = {13, 9, 10};
//+
Circle(21) = {11, 9, 15};
//+
Circle(22) = {15, 9, 10};
//+
Circle(23) = {10, 9, 14};
//+
Circle(24) = {14, 9, 11};
//+
Curve Loop(7) = {13, -23, 17};
//+
Surface(7) = {7};
//+
Curve Loop(8) = {18, 13, 24};
//+
Surface(8) = {8};
//+
Curve Loop(9) = {18, 14, -21};
//+
Surface(9) = {9};
//+
Curve Loop(10) = {14, 22, 17};
//+
Surface(10) = {10};
//+
Curve Loop(11) = {16, -21, 19};
//+
Surface(11) = {11};
//+
Curve Loop(12) = {19, 15, 24};
//+
Surface(12) = {12};
//+
Curve Loop(13) = {15, -23, -20};
//+
Surface(13) = {13};
//+
Curve Loop(14) = {20, -22, -16};
//+
Surface(14) = {14};
//+
Surface Loop(2) = {13, 12, 11, 14, 10, 9, 8, 7};


Thank you again.


Adil


More information about the gmsh mailing list