CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[blockMesh] About Simple Grading in blockMesh

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

Like Tree9Likes
  • 1 Post By ce73stargazer
  • 5 Post By Antimony
  • 2 Post By Tobermory
  • 1 Post By Zetison

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 10, 2016, 21:47
Default About Simple Grading in blockMesh
  #1
Member
 
Zhifang Hu
Join Date: Sep 2015
Location: Brisbane
Posts: 54
Rep Power: 10
ce73stargazer is on a distinguished road
I understand simple grading is the ratio between the size of the end cell and the size of initial cell.
How about the cell size in between, what kind of changes they follow to reach the final cell?
Like constant changes?
For instane, the first cell is size 10 and the last cell is size 5, the middle cells will have a size 10-dx*(N-1) ? where the dx is the constant changes between cells, N is the number of cells in that direction.

This is how i understand it, not sure if thats right.

I am writing a small code to output the cell ID by just inputting the x,y coordinates, however i realised that it only work fine for uniform distributed mesh, not the one with gradings. Hence i came out with this question. Any one have any suggestions? (Or if anyone has faster way to output cell ID (in paraview) and dont mind share with me)

Many Thanks.
pedroamaral likes this.
ce73stargazer is offline   Reply With Quote

Old   January 12, 2016, 05:45
Default
  #2
Senior Member
 
Join Date: Aug 2013
Posts: 407
Rep Power: 15
Antimony is on a distinguished road
Hi,

The expansion is geometric, not arithmetic.

Here is a useful tool that gives you an idea about the expansion from the start cell to the end cell:

https://openfoamwiki.net/index.php/S...ng_calculation
Antimony is offline   Reply With Quote

Old   May 7, 2020, 06:50
Default
  #3
New Member
 
Jon Vegard Venås
Join Date: Apr 2014
Posts: 16
Rep Power: 11
Zetison is on a distinguished road
What is the exact formula used here? With n being the number of cells, r=\frac{\delta_e}{\delta_s} being the expansion ratio, L the total length, and based on the distribution of the nodes
x_i = x_0 + L\left(\frac{i}{n}\right)^g\quad i=0,\dots,n
the following formula seems reasonable to me
\delta_s = \frac{L}{n^g}
\delta_e = L\left[1-\left(\frac{n-1}{n}\right)^g\right]
Alternatively, the formulas for a geometric expansion
x_i = x_0 + L\frac{g^i-1}{g^n-1}\quad i=0,\dots,n
\delta_s = L\frac{g-1}{g^n-1}
\delta_e = L\left[1-\frac{g^{n-1}-1}{g^n-1}\right]
but neither matches the program (or OpenFoam?). What is wrong here?

Last edited by Zetison; May 8, 2020 at 09:46.
Zetison is offline   Reply With Quote

Old   May 8, 2020, 08:47
Default
  #4
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 663
Rep Power: 13
Tobermory will become famous soon enough
Apologies, I did not try to debug your maths above, but for simplicity I will give you the correct expressions below in a simpler and more standard terminology.

For a set of n cells, with vertices x_i, where i varies from 0 to N, then the cell width is the gap between the vertices. If we define a constant stretching rate of \beta then:

\delta_i = (x_{i+1} - x_i) = \beta \delta_{i-1}

Armed with this, you can get to the following:

\delta_i = \beta^i \delta_0

now r = \delta_{n-1} / \delta_0, the ratio of the last to the first cell width, so:

r = \beta^{n-1}

The \delta_i's form a geometric progression, the sum of which is:

Sum_i = \delta_0 + \delta_1 + ... + \delta_i = \delta_0 (1 - \beta^i)/(1 - \beta)

So, the coord of vertex i is:

x_i = x_0 + Sum_i = x_0 + \delta_0 (1 - \beta^i)/(1 - \beta)

Finally, the cell centre is defined as

xc_i = x_i + 0.5 \delta_i

so you can then calculate the cell coords using xc_i. This is probably what you are outputing from OpenFOAM when you are doing the comparison.

Here's a worked example:
n = 5
beta = 1.3
r = 2.8561

i, x, dx, xc
0 0.000 0.100 0.050
1 0.100 0.130 0.165
2 0.230 0.169 0.315
3 0.399 0.220 0.509
4 0.619 0.286 0.762
5 0.904

Hope this helps - good luck!

(PS - can someone tell me how to format a table in a post, to get the spacing right?)
ruloz and GregNordin like this.
Tobermory is offline   Reply With Quote

Old   May 9, 2020, 06:37
Default
  #5
New Member
 
Jon Vegard Venås
Join Date: Apr 2014
Posts: 16
Rep Power: 11
Zetison is on a distinguished road
Thanks for your reply, your formula gets me very close. Given a length L=x_N-x_0, the width of the start cell \delta_0 and the end cell \delta_{N-1} one can compute the number of cells N using the equations

r = \beta^{n-1}=\frac{\delta_{n-1}}{\delta_0}
L = x_N-x_0
Solving yields
\beta = \frac{L-\delta_0}{L-\delta_{N-1}}
such that
N = 1+\frac{\ln\frac{\delta_{N-1}}{\delta_0}}{\ln\frac{L-\delta_0}{L-\delta_{N-1}}}
For L = 1, \delta_0 = 0.05, \delta_{N-1}=0.2 I then get
\beta = 1.1875 and \lfloor N\rceil = 9 (rounded from 9.066873951)


Comparing this to the "Scripts/blockMesh grading calculation"-tool we have
Code:
     
                         \beta               N
My computation           1.1875          9.066873951   
Calculator-tool          1.189207115     9.066872597
Ps. I do not think it is possible to create tables here considering the lacking response on this post making table in cfd-post with example
ashvinc9 likes this.
Zetison is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
SIMPLE algorithm in 3D cylindrical coordinates zouchu Main CFD Forum 1 January 20, 2014 18:02
Inconsistent Grading Caused by Simple Translation wildfire230 OpenFOAM Running, Solving & CFD 5 August 25, 2013 12:08
[ICEM] Subdomain meshing and simple Hexahedral Grading Mojtaba.a ANSYS Meshing & Geometry 0 April 22, 2013 14:28
[blockMesh] A simple problem about blockMesh sharonyue OpenFOAM Meshing & Mesh Conversion 2 September 30, 2012 21:34
Blockmesh cavity error message tonitoney OpenFOAM Installation 2 March 17, 2008 12:59


All times are GMT -4. The time now is 17:45.