# [snappyHexMesh] SHM, addLayers, complex topography - How to determine size of first cell at surface?

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

May 16, 2018, 05:18
SHM, addLayers, complex topography - How to determine size of first cell at surface?
#1
New Member

Join Date: Apr 2018
Location: Cologne
Posts: 4
Rep Power: 8
I simulate atmospheric boundary layer (ABL) flow over topography and built up my simulation on the OpenFoam Wiki validation case

http://openfoamwiki.net/index.php/File:3DBump.tar (which is really great!),

with k-epsilon, RANS model. It is a 3D model of flow over a smooth hill.

To simulate the law of the wall profile for the ABL flow, boundary conditions and wall functions from the atmBoundaryLayerClass are used.
The size of the first layer of cells on the ground is important for the correct use of them (for instance nutkAtmRoughWallFunction).
The mesh is generated with snappyHexMesh, n layers are added to the ground surface, 2 refinement zones around the hill (.jpg file below).

Is there a quick and easy way to determine the size of the first layer of cells on the ground?

I tried:
1.) Paraview, plot over line in z direction, export scene as csv file -> equidistant values for z - doesn't represent sizes of cells.

2.) Look at blockMeshDict, calculate spacing for normal mesh, look at snappyHexMeshDict divide spacing by 2 for each refinement level, multiply by finalLayerThickness 0.4, divide by (number layers * expansionRatio) -> neither fast, nor handy and maybe wrong. (snappyHexMeshDict file below)

My goal is to get the wall shear stress at the ground and the correct velocity profile over the entire domain (very close to the surface and with horizontal homogeneity at the beginning of the channel, prior to the hill).

Attached Images
 mesh_U.0020.jpg (122.0 KB, 124 views)
Attached Files
 snappyHexMeshDict.txt (11.7 KB, 15 views)

 May 22, 2018, 04:29 Determine spacing with Paraview #2 New Member   Join Date: Apr 2018 Location: Cologne Posts: 4 Rep Power: 8 I found a solution to determine the spacing in Paraview: 1.) "Select cells On" (with Icon above window) and select cells with mouse 2.) Apply "Extract Selection" filter 3.) Strg+Space to open search menu, type "ce" for "cell centers", enter 4.) File -> Save data This procedure writes the cell center values (of a selection of cells near the wall) into a .csv file that can be opened with Excel. I am still open for better solutions. finite_volume likes this.

 August 28, 2018, 09:55 Size of the first cell - very easy solution #3 New Member   Join Date: Apr 2018 Location: Cologne Posts: 4 Rep Power: 8 There is a very easy solution to this if you are working with simple geometries: Look into the blockMesh log-file! You can create a logfile by running: blockMesh > blockMesh.log The output of the blockMesh.log looks like: #other stuff Creating block mesh topology #more stuff Creating points with scale 1 Block 0 cell size : i : 0.01 .. 0.01 j : 0.02 .. 0.02 k : 0.00500204 .. 0.0302624 This part gives the cell sizes in x,y,z direction (=i,j,k). In this example I used grading in z direction. So, the smallest cell at the bottom has a size of 0.005m.

 September 18, 2018, 01:13 #4 New Member   Bence Somogyi Join Date: Mar 2009 Location: Mattighofen, Austria Posts: 11 Rep Power: 17 Hi Mucho! You can measure the sizes in paraview exactly: 1) Make a clip of the mesh to see the boundary layers 2) Create a Line source. You can put its end points exactly on vertices of the mesh using CTRL+1 (start point of the line) and CTRL+2 (end point). Click apply, and you can read the length of the line in the properties panel. Br, Bence Mucho likes this.

 October 8, 2018, 10:32 #5 Senior Member   Join Date: Nov 2010 Location: USA Posts: 1,232 Rep Power: 24 If you just need the number once, you can use the ruler or line source as sbence says. If you need something more powerful and general you can just use the wall distance utility to get a field with the wall distance as a scalar for each cell. Mucho likes this.

 Tags atmboundary, cell size, grid, snappyhexmesh, surface refinement