CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Native Meshers: blockMesh (
-   -   blockMesh with double grading. (

spwater December 6, 2009 17:18

blockMesh with double grading.
1 Attachment(s)
about edge grading , with blockMesh, currently I can only use simplegrading and cannot generate edge like this

. . . ....... . . .

So I modified it, now, using "-"to represent double grading,
e.g. simpleGrading (1 -2 1) in blockMeshDict,means the mesh in central is 2 times larger than those in side.

Hope it helpful

olesen December 7, 2009 03:35


Originally Posted by spwater (Post 238883)
So I modified it, now, using "-"to represent double grading,
e.g. simpleGrading (1 -2 1) in blockMeshDict,means the mesh in central is 2 times larger than those in side.

Did you really change all of the files to get this working?

spwater December 7, 2009 04:09


Originally Posted by olesen (Post 238915)
Did you really change all of the files to get this working?

No, just two file.


maksen March 12, 2010 05:51

Hi Pei,

good work!

i was searching the forum for something like that...

i modified the code according to your suggestions and be very happy with the result


Adrian April 14, 2010 08:15

Great tool! Thanks for sharing!

doubtsincfd June 23, 2011 22:08

I compiled the files using wmake in the /application/utilites...../blockMesh
But when I run blockMesh with negative value in the grading area (1 -2 1),
I am getting some error:

Creating blockCorners

Creating curved edges

Creating blocks
#0 Foam::error::printStack(Foam::Ostream&) in "/opt/OpenFOAM/OpenFOAM-1.7.1/lib/linuxGccDPOpt/"
#1 Foam::sigFpe::sigFpeHandler(int) in "/opt/OpenFOAM/OpenFOAM-1.7.1/lib/linuxGccDPOpt/"
#2 Uninterpreted:
#3 in "/lib/tls/i686/cmov/"
#4 pow in "/lib/tls/i686/cmov/"
in "/opt/OpenFOAM/OpenFOAM-1.7.1/applications/bin/linuxGccDPOpt/blockMesh"
in "/opt/OpenFOAM/OpenFOAM-1.7.1/applications/bin/linuxGccDPOpt/blockMesh"
in "/opt/OpenFOAM/OpenFOAM-1.7.1/applications/bin/linuxGccDPOpt/blockMesh"
in "/opt/OpenFOAM/OpenFOAM-1.7.1/applications/bin/linuxGccDPOpt/blockMesh"
in "/opt/OpenFOAM/OpenFOAM-1.7.1/applications/bin/linuxGccDPOpt/blockMesh"
in "/opt/OpenFOAM/OpenFOAM-1.7.1/applications/bin/linuxGccDPOpt/blockMesh"
in "/opt/OpenFOAM/OpenFOAM-1.7.1/applications/bin/linuxGccDPOpt/blockMesh"
#12 __libc_start_main in "/lib/tls/i686/cmov/"
in "/opt/OpenFOAM/OpenFOAM-1.7.1/applications/bin/linuxGccDPOpt/blockMesh"
Floating point exception

the "pow" function is not being recognized. I am using OF 1.7.
Thank you.

Bernhard June 24, 2011 02:24

1 Attachment(s)
There were some changes between 1.7.1 and the version that this utility was designed for. I attached a version that worked for me in 1.7.1, based on the blockMesh of 1.7.1 and some code snippets from the above posted files.

doubtsincfd June 24, 2011 13:03

Thanks for the updated code.But I am still getting the same error. Do I need to do anything other than running wmake in .../applications/utlilities/...../blockMesh ?

My OF is installed under root and I access through user login. But the bash file for user is sourced so I am reckoning this should not create any problem unless I am missing something.

doubtsincfd June 24, 2011 17:30

Got It. I was making a stupid mistake of typing blockMesh instead of blockMeshDoubleGrading. Thank you for the code! Its a very useful utility.

RygeltheXVI July 25, 2011 02:41

I also found it to be very useful and would suggest that something like it be made part of the standard distribution.

dancfd July 25, 2011 22:13

Hello all, I am having some difficulty compiling and running this application. I extracted Bernhard's archive into the $FOAM_USER_APPBIN directory, and ran "wmake libso" from that directory. The compilation ended with no errors and a satisfying "'' is up to date." However, I cannot find the executable file, and when I attempt to run "blockMeshDoubleGrading" I get an error ("blockMeshDoubleGrading: command not found"). I attempted the install on OF 1.7.0. Could someone please assist me with installing this application for use with OF 1.7.0 or above?

Thank you,


akidess July 26, 2011 04:04

Dan, using "wmake libso" you compile libraries, not executables. Use plain "wmake" and all should be well.

dancfd July 27, 2011 00:49

Hello akidess,

Thank you - I had a feeling it was something fundamental.



dancfd August 9, 2011 22:45

2 Attachment(s)
Hello all,

In case anyone is interested, I fixed up this great utility so that it now works with OF 2.0.1. I'm afraid it has become somewhat more complex in OF 2.0.1. With these instructions, it will get working.

First, the library:
1) Copy /src/mesh/blockMesh to $FOAM_USER_APPLIB;
2) Replace blockMesh/blockDescriptor/blockDescriptorEdges.C with the one from the "bin" tarball attached;
3) Replace blockMesh/curvedEdges/lineDivide.C with the one from the "bin" tarball attached;
4) Replace make/files with the one from the "bin" tarball attached
5) Rename the folder from "blockMesh" to "blockMeshDG"
6) Run "wmake libso"

Next, the application:
1) Extract the blockMeshDG_bin tarball to $FOAM_USER_APPBIN
2) run wmake

That should do it. Sorry for the long instructions for the library, the files were too big to include as a single zip.



RygeltheXVI November 1, 2011 04:46

Hail dancfd,

I'm not sure if it is just me but there is no $FOAM_USER_APPLIB in my openFoam 2.0.1 release, I think you mean $FOAM_USER_LIBBIN.
Or are we ment to make such a directory in the even that it does not exist?

Also in the blockMeshApp.dep you need to replace the instances of:
with something else...

Jesse Coombs

dancfd November 1, 2011 19:11

Hello RygeltheXVI,

You are correct, you need to create the $FOAM_USER_APPBIN directory to avoid changing the paths in the files in the "make" directories. As for the .dep file, that is generated by running "wmake" - no need to change anything there.



akidess November 14, 2011 04:37

Dan, did you include the modified version of lineDivide.C in the tarball or the original? I see no changes compared to the stock 2.0.x version.

dancfd November 16, 2011 21:32

1 Attachment(s)
Hello Anton,

I apologize, it seems that I did include the wrong file. I have attached the correct lineDivide.c file to this post.



akidess November 17, 2011 08:46

Hi Dan, thanks for the upload. For convenience, I have packaged the updated code in an online repository. Now anyone that wants to use the patched version can clone the code and compile it with two commands:


hg clone

Naturally credit goes to you, so I put your user name in the utility header. Send me a message if you'd like to make any changes.

- Anton

dancfd November 26, 2011 15:34

Hello Anton,

I am happy that the files are getting wider distribution in the hope that others may find it useful, however would you please add the name of the original author to the credits: Shui Pei. He developed it in the first place.



All times are GMT -4. The time now is 13:38.