CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Special Topics > Mesh Generation & Pre-Processing

GMSH extrude a boundary layer from an unstructured Mesh

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 3 Post By Hillie

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 15, 2017, 00:24
Default GMSH extrude a boundary layer from an unstructured Mesh
  #1
Member
 
Hilbert
Join Date: Aug 2015
Location: Australia
Posts: 50
Rep Power: 11
Hillie is on a distinguished road
Hi all,

I was faced with the following problem: I have a nice unstructured mesh 2D mesh in GMSH, and I want to extrude this mesh with a certain growth ratio to a 3D mesh. The extrude command in GMSH lets you easily make an extrusion were all the layers are the same height, but making the layer vary in size was the problem.

I have spend most of my afternoon on the problem size I couldn't find any good solution online, and to make sure other don't have to I though I would share the solution I came up with.

A standard Extrusion will go like this:
Code:
surfaceVector[] = Extrude{0, 0, thickness}
        {
        Surface{surfacenumber}  ;
        Layer{number of layers};
        Recombine;
       }
With the Layers command you can vary this size of the layers in the following way:

Code:
Layers{{number of cells per layer}, {relative thickness of the layer}}
What I have done is to to create an x amount of 1 cell layers , where x is the amount of cells that you want in the extrusion. To do this I have created a little python script.

Code:
@author: hilbert
"""

import numpy as np

initial_mesh_height=1*10**-5  #initial mesh height

blh=0.004                 #required height
n=4.0;                   #amount of cells


#solve for the growth ratio r
rtry=np.linspace(0.5, 1.5, 1000)
error=(1-np.power(rtry,(n)))/(1-rtry)-blh/initial_mesh_height
r=rtry[np.argmin(np.abs(error))]

rtry=np.linspace(r-0.1, r+0.1, 1000000)
error=(1-np.power(rtry,(n)))/(1-rtry)-blh/initial_mesh_height
r=rtry[np.argmin(np.abs(error))]


blh=initial_mesh_height*(1-r**n)/(1-r)   #compute the extrusion height and see if it matches, i.e how good was our solution for r
#print blh

hts=[]   #the place to put cells
layer=[] #a placeholder for the amount of cells per layer , i.e 1
ht=0     #initialize layer height
for i in range(int(n)):
    h=initial_mesh_height*r**i
    ht+=h
    hts.append(ht/blh)
    layer.append(1)
    #print ht/blh

#print hts
#print layer
This is for a simple geometric expansion, i.e the initial cell grows with a growth ratio r each layer. In the script you pop in the initial cell height, the extrusion height and the amount of cells that you want.

the script then computes the growth ratio. Then pop the relative heights hts in the layer command.

As an example with the inputs as given it gives
layer=[1, 1, 1, 1]
hts=[0.10803802938634398, 0.28089887640449435, 0.55747623163353499, 1.0]

In you then give:
Layers{{1, 1, 1, 1}, {0.10803802938634398, 0.28089887640449435, 0.55747623163353499, 1.0}}

Hope it helps ,
Cheers
Hillie is offline   Reply With Quote

Old   June 22, 2017, 18:20
Default Decreasing cell heigh
  #2
New Member
 
Malgorzata
Join Date: Jun 2017
Posts: 3
Rep Power: 9
chomikzimon is on a distinguished road
Hi!

Thank you for your post. It is very helpful. Could you let me know if it is possible to have the boundary layers with extrusion but decreasing in height? Simply reversing the layer height in Gmsh does not seem to work.

Thank you for your time!
chomikzimon is offline   Reply With Quote

Old   July 7, 2017, 04:38
Default
  #3
Member
 
Hilbert
Join Date: Aug 2015
Location: Australia
Posts: 50
Rep Power: 11
Hillie is on a distinguished road
He,

With the extrude command you can't since the heights needs to be increasing:
, see http://gmsh.info/doc/texinfo/gmsh.html#index-extrude, section 6.3.2

Can't you use a symmetry condition to avoid having to simulate a full boundary layer?
Hillie is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error - Solar absorber - Solar Thermal Radiation MichaelK CFX 12 September 1, 2016 06:15
[ICEM] 3D Dynamic Mesh - Boundary layer mesh issues nathanricks ANSYS Meshing & Geometry 0 September 23, 2015 06:14
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 07:20
[snappyHexMesh] Boundary layer in a pipe Clementhuon OpenFOAM Meshing & Mesh Conversion 6 March 12, 2012 13:41
[Gmsh] Import problem ARC OpenFOAM Meshing & Mesh Conversion 0 February 27, 2010 11:56


All times are GMT -4. The time now is 03:11.