# [Gmsh] Using Bump with Extrude, layers in GMSH??

 Register Blogs Members List Search Today's Posts Mark Forums Read

 October 26, 2016, 06:08 Using Bump with Extrude, layers in GMSH?? #1 Senior Member   ArielJ Join Date: Aug 2015 Posts: 127 Rep Power: 10 Hi there, I have been building a basic wave tank in GMSH and used the extrude command to create the 3d volume. I now want to "bump" the vertical lines to coarsen the cells towards the top and bottom (towards +z and -z) and refine the mesh towards the centre of the z axis (where the free surface would be if the vertical mesh is divided evenly between fluid and air). Using, for example, this snippet of code (not an mwe but hopefully gives enough info): Code: ```Physical Volume("water") = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; // volume numbers Extrude{0,0,10} { Surface{11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; Layers{10}; Recombine: } Transfinite Line{Line connecting +z point of surfaces to -z point} = 10 Using Bump 5.00;``` Probably not surprising that this doesn't work... is there a way to include a bump expression in with layers? I was reading in the guide and didn't understand the explanation of layers enough to apply it. Any advice would be greatly appreciated, thank you in advance!

October 30, 2016, 13:06
#2
Senior Member

CFD
Join Date: Nov 2010
Location: United States
Posts: 243
Rep Power: 16
Quote:
 Originally Posted by arieljeds Hi there, I have been building a basic wave tank in GMSH and used the extrude command to create the 3d volume. I now want to "bump" the vertical lines to coarsen the cells towards the top and bottom (towards +z and -z) and refine the mesh towards the centre of the z axis (where the free surface would be if the vertical mesh is divided evenly between fluid and air). Using, for example, this snippet of code (not an mwe but hopefully gives enough info): Code: ```Physical Volume("water") = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; // volume numbers Extrude{0,0,10} { Surface{11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; Layers{10}; Recombine: } Transfinite Line{Line connecting +z point of surfaces to -z point} = 10 Using Bump 5.00;``` Probably not surprising that this doesn't work... is there a way to include a bump expression in with layers? I was reading in the guide and didn't understand the explanation of layers enough to apply it. Any advice would be greatly appreciated, thank you in advance!
The snipped code is not in the right order. This might do the trick

Example

Extrude {0, 0, 1} {
Surface{12, 14, 16};
Layers{1};
Recombine;
}
Transfinite Line {1, 2, 3, 4, 5, 6} = 10 Using Bump 0.4;
Transfinite Surface "*";
Recombine Surface "*";

Best,

 November 3, 2016, 07:00 #3 Senior Member   ArielJ Join Date: Aug 2015 Posts: 127 Rep Power: 10 Hi tareqkh, Thanks for your reply, somehow I missed this so sorry for the delay... Ok so I tried your suggestion but oddly it didn't seem to do anything at all? Here's the full .geo code: Code: ```// Gmsh project created on Wed Oct 26 18:11:53 2016 L = 50; Lx = 2.5*50; Ly = L; depth = -15; Nx = 100; Rx = 1.00; Ny = 40; Ry = 1.00; Point(1) = {-Lx, -Ly, depth, 1.0}; Point(2) = { Lx, -Ly, depth, 1.0}; Point(3) = { Lx, Ly, depth, 1.0}; Point(4) = {-Lx, Ly, depth, 1.0}; Line(1) = {1, 2}; Line(2) = {4, 3}; Line(3) = {1, 4}; Line(4) = {2, 3}; Transfinite Line {1} = Nx Using Progression Rx; Transfinite Line {2} = Nx Using Progression Rx; Transfinite Line {3} = Ny Using Progression Ry; Transfinite Line {4} = Ny Using Progression Ry; Line Loop(5) = {3, 2, -4, -1}; Plane Surface(6) = {5}; Transfinite Surface {6}; Recombine Surface{6}; Physical Volume("water") = {1}; Extrude {0, 0, 25} { Surface{6}; Layers{20}; Recombine; } Geometry.LineNumbers =1 ; Transfinite Line {13,14,22,18} = 10 Using Bump 0.4; Transfinite Surface "*"; Recombine Surface "*"; Physical Surface("inlet") = {15}; //inlet Physical Surface("outlet") = {23}; // outlet Physical Surface("topAndBottom") = {27, 19}; // topAndBottom Physical Surface("atmosphere") = {28}; // atmosphere Physical Surface("seaFloor") = {6}; // seaFloor``` It makes the mesh properly but then I can't see any "bump"?

 November 3, 2016, 09:27 #4 Senior Member     CFD Join Date: Nov 2010 Location: United States Posts: 243 Rep Power: 16 Try this; Code: ```L = 50; Lx = 2.5*50; Ly = L; depth = -15; Nx = 100; Rx = 1.00; Ny = 40; Ry = 1.00; Point(1) = {-Lx, -Ly, depth, 1.0}; Point(2) = { Lx, -Ly, depth, 1.0}; Point(3) = { Lx, Ly, depth, 1.0}; Point(4) = {-Lx, Ly, depth, 1.0}; Line(1) = {1, 2}; Line(2) = {4, 3}; Line(3) = {1, 4}; Line(4) = {2, 3}; Transfinite Line {1,2} = Nx Using Progression Rx; Transfinite Line {3,4} = Ny Using Progression Ry; Transfinite Line {3,4} = 10 Using Bump 0.4; Line Loop(5) = {3, 2, -4, -1}; Plane Surface(6) = {5}; Extrude {0, 0, 25} { Surface{6}; Layers{20}; Recombine; } Transfinite Surface "*"; Recombine Surface "*"; Physical Surface("inlet") = {15}; //inlet Physical Surface("outlet") = {23}; // outlet Physical Surface("topAndBottom") = {27, 19}; // topAndBottom Physical Surface("atmosphere") = {28}; // atmosphere Physical Surface("seaFloor") = {6}; // seaFloor Physical Volume("water") = {1};``` You can also send what are tying to do. Best,

November 5, 2016, 14:26
#5
Senior Member

Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
@ArielJ

You can just remove Layers and Recombine from Extrude command; determine new lines IDs using, for example, GUI and then make them Transfinite. There is an example

Code:
```Point(1) = {0, 0, 0};
Point(2) = {1, 0, 0};
Point(3) = {1, 1, 0};
Point(4) = {0, 1, 0};

Line(1) = {1, 2};
Line(2) = {4, 3};
Line(3) = {1, 4};
Line(4) = {2, 3};
Line Loop(5) = {3, 2, -4, -1};
Plane Surface(6) = {5};
Extrude {0, 0, 1} {
Surface{6};
}

Transfinite Line {1, 2, 3, 4} = 11;

// New lines due to extrusion in the new surface
Transfinite Line {8, 9, 10, 11} = 11;

// New vertical lines due to extrusion
Transfinite Line {13, 14, 18, 22} = 51 Using Bump 0.1;

Transfinite Surface "*";
Recombine Surface "*";```
Attached Images
 cavity.png (39.2 KB, 118 views)

March 1, 2017, 05:22
#6
Member

Jibran
Join Date: Oct 2012
Location: UK
Posts: 61
Blog Entries: 1
Rep Power: 14
Quote:
 Originally Posted by alexeym @ArielJ You can just remove Layers and Recombine from Extrude command; determine new lines IDs using, for example, GUI and then make them Transfinite. There is an example Code: ```Point(1) = {0, 0, 0}; Point(2) = {1, 0, 0}; Point(3) = {1, 1, 0}; Point(4) = {0, 1, 0}; Line(1) = {1, 2}; Line(2) = {4, 3}; Line(3) = {1, 4}; Line(4) = {2, 3}; Line Loop(5) = {3, 2, -4, -1}; Plane Surface(6) = {5}; Extrude {0, 0, 1} { Surface{6}; } Transfinite Line {1, 2, 3, 4} = 11; // New lines due to extrusion in the new surface Transfinite Line {8, 9, 10, 11} = 11; // New vertical lines due to extrusion Transfinite Line {13, 14, 18, 22} = 51 Using Bump 0.1; Transfinite Surface "*"; Recombine Surface "*";```
Hi Alexey.

This script seems to produce the desired result only on the surface (structured quadrilaterals). The domain is meshed using tetrahedrals. Can you please confirm this or am I missing something?
__________________
Jibran Haider
https://jibranhaider.com/

July 27, 2017, 22:20
#7
New Member

Flyer
Join Date: Apr 2017
Posts: 13
Rep Power: 9
Quote:
 Originally Posted by alexeym @ArielJ You can just remove Layers and Recombine from Extrude command; determine new lines IDs using, for example, GUI and then make them Transfinite. There is an example Code: ```Point(1) = {0, 0, 0}; Point(2) = {1, 0, 0}; Point(3) = {1, 1, 0}; Point(4) = {0, 1, 0}; Line(1) = {1, 2}; Line(2) = {4, 3}; Line(3) = {1, 4}; Line(4) = {2, 3}; Line Loop(5) = {3, 2, -4, -1}; Plane Surface(6) = {5}; Extrude {0, 0, 1} { Surface{6}; } Transfinite Line {1, 2, 3, 4} = 11; // New lines due to extrusion in the new surface Transfinite Line {8, 9, 10, 11} = 11; // New vertical lines due to extrusion Transfinite Line {13, 14, 18, 22} = 51 Using Bump 0.1; Transfinite Surface "*"; Recombine Surface "*";```
Hi Alexey,

I wonder how did you come with the number 0.1 for 51 nodes? Could you please give a little explanation?

Thank you,

June 14, 2018, 23:22
#8
Member

Hilbert
Join Date: Aug 2015
Location: Australia
Posts: 50
Rep Power: 10
Quote:
 Originally Posted by Jibran Hi Alexey. This script seems to produce the desired result only on the surface (structured quadrilaterals). The domain is meshed using tetrahedrals. Can you please confirm this or am I missing something?

Just a small message for anybody who finds this thread:
Adding Transfinite Volume "*"; to the script means that the volume is meshed correctly as well.

 Tags bump, extrude, gmsh, layers, transfinite surface