# [Gmsh] gmsh Digest, Vol 181, Issue 20

Sathyanarayan Rao sathyanarayan.rao at uclouvain.be
Sat Feb 10 11:38:45 CET 2018

```Hello Ruth,

Yes, changing the mesh size worked in my computer . Thank you very much. I have another small question, in case

I want to include both surface and volume in boolean fragments , it is possible , something like this

aa() = BooleanFragments{ Volume{1}; Delete; }{ Volume{2,3,4,5}; Surface{170,180,190,210,211,212}; Delete;};

I want to include both cylinders and a surfaces on each face. However , gmsh says surfaces 170-212 are Unknown.

Please let me know !

Full code below :

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

Cylinder(2) = {0, 0, -0.9*R1, 0, 0, 1.6*R1, 0.2*R, 2*Pi};   // inner cylinder
Cylinder(3) = {0, 0, -0.9*R1, 0, 0, 1.6*R1, 0.25*R, 2*Pi};   // inner cylinder
Cylinder(4) = {0, 0, -0.9*R1, 0, 0, 1.6*R1, 0.9*R, 2*Pi};   // inner cylinder
Cylinder(5) = {0, 0, -0.9*R1, 0, 0, 1.6*R1, 1*R, 2*Pi};    //outer cylinder

//----------------------------------------------------------------------------------

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(170) = {RE+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(180) = {RE+7};

// 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(190) = {RE+7};

/* 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(210) = {RE+7};

/* 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(211) = {RE+7};

/* 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(212) = {RE+7};

//---------------------------------------------------------------

aa() = BooleanFragments{ Volume{1}; Delete; }{ Volume{2,3,4,5}; Surface{170,180,190,210,211,212}; Delete;};
Physical Volume(600) = {aa(0)};
Physical Volume(601) = {aa(1)};
Physical Volume(602) = {aa(2)};
Physical Volume(603) = {aa(3)};
Physical Volume(604) = {aa(4)};
Mesh.CharacteristicLengthMax = 0.001;
Characteristic Length { PointsOf{ Volume{aa({0,2:4})}; } } = 0.001; // inside the box

________________________________
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)

________________________________

________________________________
From: Ruth Vazquez Sabariego <ruth.sabariego at kuleuven.be>
Sent: 10 February 2018 08:47:24
To: Sathyanarayan Rao
Cc: gmsh at onelab.info; gmsh at ace20.montefiore.ulg.ac.be
Subject: Re: [Gmsh] gmsh Digest, Vol 181, Issue 20

Hi,

What you’ve done works properly in my computer. You may adapt the size of the mesh a bit better by defining it per volume.
For instance:
Mesh.CharacteristicLengthMax = 0.001;
Characteristic Length { PointsOf{ Volume{aa({0,2:4})}; } } = 0.001; // inside the box

Ruth

—
Prof. Ruth V. Sabariego
KU Leuven
Dept. Electrical Engineering ESAT/Electa, EnergyVille
http://www.esat.kuleuven.be/electa
http://www.energyville.be

Free software: http://gmsh.info | http://getdp.info | http://onelab.info

On 9 Feb 2018, at 18:49, Sathyanarayan Rao <sathyanarayan.rao at uclouvain.be<mailto:sathyanarayan.rao at uclouvain.be>> wrote:

Hello Ruth Vazquez ,

Thank you very much. If I use the same procedure (boolean fragments) to enclose a concentric cylinders within
a cube, it results in 2D meshes. Can you please let me know what I am doing wrong here ?

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

Cylinder(2) = {0, 0, -0.9*R1, 0, 0, 1.6*R1, 0.2*R, 2*Pi};   // inner cylinder
Cylinder(3) = {0, 0, -0.9*R1, 0, 0, 1.6*R1, 0.25*R, 2*Pi};   // inner cylinder
Cylinder(4) = {0, 0, -0.9*R1, 0, 0, 1.6*R1, 0.9*R, 2*Pi};   // inner cylinder
Cylinder(5) = {0, 0, -0.9*R1, 0, 0, 1.6*R1, 1*R, 2*Pi};    //outer cylinder

aa() = BooleanFragments{ Volume{1}; Delete; }{ Volume{2,3,4,5}; Delete;};

Physical Volume(600) = {aa(0)};
Physical Volume(601) = {aa(1)};
Physical Volume(602) = {aa(2)};
Physical Volume(603) = {aa(3)};
Physical Volume(604) = {aa(4)};

Mesh.CharacteristicLengthMax = 0.001;

________________________________
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)

________________________________

________________________________
From: gmsh <gmsh-bounces at ace20.montefiore.ulg.ac.be<mailto:gmsh-bounces at ace20.montefiore.ulg.ac.be>> on behalf of gmsh-request at ace20.montefiore.ulg.ac.be<mailto:gmsh-request at ace20.montefiore.ulg.ac.be> <gmsh-request at ace20.montefiore.ulg.ac.be<mailto:gmsh-request at ace20.montefiore.ulg.ac.be>>
Sent: 09 February 2018 14:39:01
To: gmsh at onelab.info<mailto:gmsh at onelab.info>
Subject: gmsh Digest, Vol 181, Issue 20

Send gmsh mailing list submissions to
gmsh at onelab.info<mailto:gmsh at onelab.info>

To subscribe or unsubscribe via the World Wide Web, visit
http://onelab.info/mailman/listinfo/gmsh
or, via email, send a message with subject or body 'help' to
gmsh-request at onelab.info<mailto:gmsh-request at onelab.info>

You can reach the person managing the list at
gmsh-owner at onelab.info<mailto:gmsh-owner at onelab.info>

When replying, please edit your Subject line so it is more specific
than "Re: Contents of gmsh digest..."

Today's Topics:

1. Re: Create a 3D cube with each face having a physical surface
(Ruth Vazquez Sabariego)

----------------------------------------------------------------------

Message: 1
Date: Fri, 9 Feb 2018 13:34:20 +0000
From: Ruth Vazquez Sabariego <ruth.sabariego at kuleuven.be<mailto:ruth.sabariego at kuleuven.be>>
To: Sathyanarayan Rao <sathyanarayan.rao at uclouvain.be<mailto:sathyanarayan.rao at uclouvain.be>>
Cc: "gmsh at onelab.info<mailto:gmsh at onelab.info>" <gmsh at onelab.info<mailto:gmsh at onelab.info>>
Subject: Re: [Gmsh] Create a 3D cube with each face having a physical
surface
Message-ID: <00C42B21-C06B-4419-AED8-9752CD5A868B at kuleuven.be<mailto:00C42B21-C06B-4419-AED8-9752CD5A868B at kuleuven.be>>
Content-Type: text/plain; charset="utf-8"

Using your second option, you may use BooleanFragments.
Try at the end of your file:

// Surface{7,8,9,10,11,12} In Volume{1}; // Comment out this line
Physical Volume(100)  = {1};

aux() = BooleanFragments{ Volume{1}; Delete; }{ Surface{7:12}; Delete;};
Printf("", aux()); // For checking the numbers of the generated geometrical entities

// For visibility
Recursive Color Red{Volume{1};}
Recursive Color Yellow{Surface{7:12};}

With regard to your first option, you can only create rectangles in the XY plane, but you can translate and rotate to place them where you want.

HTH
Ruth

?
Prof. Ruth V. Sabariego
KU Leuven
Dept. Electrical Engineering ESAT/Electa, EnergyVille
http://www.esat.kuleuven.be/electa
http://www.energyville.be<http://www.energyville.be/>

Free software: http://gmsh.info<http://gmsh.info/> | http://getdp.info<http://getdp.info/> | http://onelab.info<http://onelab.info/>

On 8 Feb 2018, at 22:13, Sathyanarayan Rao <sathyanarayan.rao at uclouvain.be<mailto:sathyanarayan.rao at uclouvain.be><mailto:sathyanarayan.rao at uclouvain.be>> wrote:

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 ?

```
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.

```
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)

________________________________

_______________________________________________
gmsh mailing list
gmsh at onelab.info<mailto:gmsh at onelab.info><mailto:gmsh at onelab.info>
http://onelab.info/mailman/listinfo/gmsh

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20180209/e0eb17ae/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
gmsh mailing list
gmsh at onelab.info<mailto:gmsh at onelab.info>
http://onelab.info/mailman/listinfo/gmsh

------------------------------

End of gmsh Digest, Vol 181, Issue 20
*************************************
_______________________________________________
gmsh mailing list
gmsh at onelab.info<mailto:gmsh at onelab.info>
http://onelab.info/mailman/listinfo/gmsh

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20180210/3672eda9/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 29238 bytes
Desc: pastedImage.png
URL: <http://onelab.info/pipermail/gmsh/attachments/20180210/3672eda9/attachment-0001.png>
```