[Gmsh] Create a 3D cube with each face having a physical surface

Sathyanarayan Rao sathyanarayan.rao at uclouvain.be
Thu Feb 8 22:13:32 CET 2018


Dear GMSH team,


I am trying to generate a cube with each face having a rectangular surface that will be later identified as a sensor.


1) In case I want to use rectangle command of opencascade is it possible to create rectangle other than in XY plane ?



```
SetFactory("OpenCASCADE");
Mesh.Algorithm3D = 4; // 3D mesh algorithm (1=Delaunay, 4=Frontal, 5=Frontal Delaunay, 6=Frontal Hex, 7=MMG3D, 9=R-tree)
R = 0.05;
w = R;
Box(1) = {-R,-R,-R, 2*R,2*R,2*R};
Rectangle(10) = {-R/2,-R/2,-R, R,R};
Rectangle(11) = {-R/2,-R/2,R, R,R};
```

 2)  When I manually create surfaces in each face of the cube, they come as separate regions in 3D mesh.

```
SetFactory("OpenCASCADE");
Mesh.Algorithm3D = 4; // 3D mesh algorithm (1=Delaunay, 4=Frontal, 5=Frontal Delaunay, 6=Frontal Hex, 7=MMG3D, 9=R-tree)
R = 0.05;
R1 = R;
w = R;
Box(1) = {-R,-R,-R, 2*R,2*R,2*R};
q = 0.005;

/* Right electrode */
RE = 300;

Point(RE+1) = { R1,  R1/2,  R1/2, q};
Point(RE+2) = { R1, -R1/2,  R1/2, q};
Point(RE+3) = { R1, -R1/2, -R1/2, q};
Point(RE+4) = { R1,  R1/2, -R1/2, q};
Line(RE+13) = {RE+4, RE+1};
Line(RE+14) = {RE+1, RE+2};
Line(RE+15) = {RE+2, RE+3};
Line(RE+16) = {RE+3, RE+4};
Line Loop(RE+7) = {RE+16, RE+13, RE+14, RE+15};
Plane Surface(7) = {RE+7};
Physical Surface(10000) = {7};

/* Left electrode */

RE = 400;

Point(RE+1) = { -R1,  R1/2,  R1/2, q};
Point(RE+2) = { -R1, -R1/2,  R1/2, q};
Point(RE+3) = { -R1, -R1/2, -R1/2, q};
Point(RE+4) = { -R1,  R1/2, -R1/2, q};
Line(RE+13) = {RE+4, RE+1};
Line(RE+14) = {RE+1, RE+2};
Line(RE+15) = {RE+2, RE+3};
Line(RE+16) = {RE+3, RE+4};
Line Loop(RE+7) = {RE+16, RE+13, RE+14, RE+15};
Plane Surface(8) = {RE+7};
Physical Surface(10001) = {8};


// create plate electrodes
/* back electrode */

RE = 500;

Point(RE+1) = {  R1/2,  -R1, R1/2, q};
Point(RE+2) = { -R1/2,   -R1, R1/2, q};
Point(RE+3) = {  -R1/2,   -R1,-R1/2, q};
Point(RE+4) = { R1/2,  -R1, -R1/2, q};
Line(RE+13) = {RE+4, RE+1};
Line(RE+14) = {RE+1, RE+2};
Line(RE+15) = {RE+2, RE+3};
Line(RE+16) = {RE+3, RE+4};
Line Loop(RE+7) = {RE+16, RE+13, RE+14, RE+15};
Plane Surface(9) = {RE+7};
Physical Surface(10002) = {9};


/* front electrode */

RE = 600;

Point(RE+1) = {  R1/2,  R1, R1/2, q};
Point(RE+2) = { -R1/2,  R1, R1/2, q};
Point(RE+3) = {  -R1/2,  R1,-R1/2, q};
Point(RE+4) = { R1/2, R1, -R1/2, q};
Line(RE+13) = {RE+4, RE+1};
Line(RE+14) = {RE+1, RE+2};
Line(RE+15) = {RE+2, RE+3};
Line(RE+16) = {RE+3, RE+4};
Line Loop(RE+7) = {RE+16, RE+13, RE+14, RE+15};
Plane Surface(10) = {RE+7};
Physical Surface(10003) = {10};

/* top electrode */

RE = 700;

Point(RE+1) = {  R1/2,R1/2,R1, q};
Point(RE+2) = { -R1/2,R1/2, R1,q};
Point(RE+3) = {  -R1/2, -R1/2,R1, q};
Point(RE+4) = { R1/2,  -R1/2,R1, q};
Line(RE+13) = {RE+4, RE+1};
Line(RE+14) = {RE+1, RE+2};
Line(RE+15) = {RE+2, RE+3};
Line(RE+16) = {RE+3, RE+4};
Line Loop(RE+7) = {RE+16, RE+13, RE+14, RE+15};
Plane Surface(11) = {RE+7};
Physical Surface(10004) = {11};


/* bottom electrode */

RE = 800;

Point(RE+1) = {  R1/2,R1/2,-R1, q};
Point(RE+2) = { -R1/2,R1/2, -R1,q};
Point(RE+3) = {  -R1/2, -R1/2,-R1, q};
Point(RE+4) = { R1/2,  -R1/2,-R1, q};
Line(RE+13) = {RE+4, RE+1};
Line(RE+14) = {RE+1, RE+2};
Line(RE+15) = {RE+2, RE+3};
Line(RE+16) = {RE+3, RE+4};
Line Loop(RE+7) = {RE+16, RE+13, RE+14, RE+15};
Plane Surface(12) = {RE+7};
Physical Surface(10005) = {12};

Surface{7,8,9,10,11,12} In Volume{1};
Physical Volume(100)  = {1};
```

Somehow the command "Surface{} In Volume" seems to not care for what I want.  Please let me know
how can I get a cube with each face having a rectangular surface with its own physical number.





________________________________
Best Regards,

Sathyanarayan Rao, PhD student
Earth and Life Institute/Environmental Sciences (ELI-e)
Université catholique de Louvain
c.037, Croix du Sud 2, Louvain-la-Neuve, Belgium
Phone: 010473827 ( intercom 73827)

________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20180208/679c00b5/attachment.html>


More information about the gmsh mailing list