|
[Sponsors] |
GMSH extrude a boundary layer from an unstructured Mesh |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 14, 2017, 23:24 |
GMSH extrude a boundary layer from an unstructured Mesh
|
#1 |
Member
Hilbert
Join Date: Aug 2015
Location: Australia
Posts: 50
Rep Power: 11 |
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; } Code:
Layers{{number of cells per layer}, {relative thickness of the layer}} 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 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 |
|
June 22, 2017, 17:20 |
Decreasing cell heigh
|
#2 |
New Member
Malgorzata
Join Date: Jun 2017
Posts: 3
Rep Power: 9 |
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! |
|
July 7, 2017, 03:38 |
|
#3 |
Member
Hilbert
Join Date: Aug 2015
Location: Australia
Posts: 50
Rep Power: 11 |
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? |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error - Solar absorber - Solar Thermal Radiation | MichaelK | CFX | 12 | September 1, 2016 05:15 |
[ICEM] 3D Dynamic Mesh - Boundary layer mesh issues | nathanricks | ANSYS Meshing & Geometry | 0 | September 23, 2015 05:14 |
Wrong flow in ratating domain problem | Sanyo | CFX | 17 | August 15, 2015 06:20 |
[snappyHexMesh] Boundary layer in a pipe | Clementhuon | OpenFOAM Meshing & Mesh Conversion | 6 | March 12, 2012 12:41 |
[Gmsh] Import problem | ARC | OpenFOAM Meshing & Mesh Conversion | 0 | February 27, 2010 10:56 |