Skip to content

Instantly share code, notes, and snippets.

@dajuno
Created January 13, 2016 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dajuno/691fa18db83f7b36db5c to your computer and use it in GitHub Desktop.
Save dajuno/691fa18db83f7b36db5c to your computer and use it in GitHub Desktop.
GMSH simple example physical groups
L = 1;
dx1 = 0.1*L;
Point(1) = {-0.5*L, -0.5*L, -0.5*L, dx1};
Point(2) = { 0.5*L, -0.5*L, -0.5*L, dx1};
Point(3) = { 0.5*L, -0.5*L, 0.5*L, dx1};
Point(4) = {-0.5*L, -0.5*L, 0.5*L, dx1};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
ll = newl;
Line Loop(ll) = {1, 2, 3, 4};
sc = news;
Plane Surface(sc) = {ll};
ex = Extrude {0, 1*L, 0} { Surface{sc}; };
Printf("sc %g", sc); // base surface (front)
Printf("ex[0] %g", ex[0]); // extruded surface (back)
Printf("ex[1] %g", ex[1]); // volume
Printf("ex[2] %g", ex[2]); // bottom
Printf("ex[3] %g", ex[3]); // right
Printf("ex[4] %g", ex[4]); // top
Printf("ex[5] %g", ex[5]); // left
// number from 0 to N for FEniCS compatibility (?)
Physical Surface(0) = {sc}; // front
Physical Surface(1) = {ex[0]}; // back
Physical Surface(2) = {ex[2]}; // bottom
Physical Surface(3) = {ex[3]}; // right
Physical Surface(4) = {ex[4]}; // top
Physical Surface(5) = {ex[5]}; // left
Physical Volume(0) = {ex[1]};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment