CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Axisymmetric Grid (https://www.cfd-online.com/Forums/openfoam/77466-axisymmetric-grid.html)

N. A. June 23, 2010 13:15

Axisymmetric Grid
 
Does any have a sample blockMeshDict to create mesh for a cylinder with an inlet pipe on side?

m.nichols19 June 24, 2010 10:37

blockMesh is a rather easy and - dare I say it - fun tool to use. Read the blockMesh guide (http://www.openfoam.com/docs/user/blockMesh.php) and dip your feet in the water. If that doesn't work out, repost and I'll see what I can do.

best regards and best of luck,
Matt

m.nichols19 June 24, 2010 17:31

The following is a cylinder mesh that I have been using to simulate flow through a pipe:

Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 0.02;

vertices       
(
    /*Inlet Square*/
    (0.4 0 0)
    (0 0.4 0)
    (-0.4 0 0)
    (0 -0.4 0)

    /*Inlet Inner Circle*/
    (0.8 0 0)
    (0 0.8 0)
    (-0.8 0 0)
    (0 -0.8 0)

    /*Inlet Outer Circle*/
    (1 0 0)
    (0 1 0)
    (-1 0 0)
    (0 -1 0)

    /*Outlet Square*/
    (0.4 0 10)
    (0 0.4 10)
    (-0.4 0 10)
    (0 -0.4 10)

    /*Outlet Inner Circle*/
    (0.8 0 10)
    (0 0.8 10)
    (-0.8 0 10)
    (0 -0.8 10)   

    /*Outlet Outer Circle*/
    (1 0 10)
    (0 1 10)
    (-1 0 10)
    (0 -1 10)
);

blocks         
(
    /*Square Block*/
    hex (0 1 2 3 12 13 14 15) (20 20 20) simpleGrading (1 1 1)

    /*Inner Circle Blocks*/
    hex (0 4 5 1 12 16 17 13) (20 20 20) simpleGrading (1 1 1)
    hex (1 5 6 2 13 17 18 14) (20 20 20) simpleGrading (1 1 1)
    hex (2 6 7 3 14 18 19 15) (20 20 20) simpleGrading (1 1 1)
    hex (3 7 4 0 15 19 16 12) (20 20 20) simpleGrading (1 1 1)

    /*Outer Circle Blocks*/
    hex (4 8 9 5 16 20 21 17) (6 20 20) simpleGrading (1 1 1)
    hex (5 9 10 6 17 21 22 18) (6 20 20) simpleGrading (1 1 1)
    hex (6 10 11 7 18 22 23 19) (6 20 20) simpleGrading (1 1 1)
    hex (7 11 8 4 19 23 20 16) (6 20 20) simpleGrading (1 1 1)
);

edges         
(
    /*Inlet Inner Circle*/
    arc 4 5 (0.565685425 0.565685425 0)
    arc 5 6 (-0.565685425 0.565685425 0)
    arc 6 7 (-0.565685425 -0.565685425 0)
    arc 7 4 (0.565685425 -0.565685425 0)

    /*Inlet Outer Circle*/
    arc 8 9 (0.707106781 0.707106781 0)
    arc 9 10 (-0.707106781 0.707106781 0)
    arc 10 11 (-0.707106781 -0.707106781 0)
    arc 11 8 (0.707106781 -0.707106781 0)

    /*Outlet Inner Circle*/
    arc 16 17 (0.565685425 0.565685425 10)
    arc 17 18 (-0.565685425 0.565685425 10)
    arc 18 19 (-0.565685425 -0.565685425 10)
    arc 19 16 (0.565685425 -0.565685425 10)

    /*Outlet Outer Circle*/
    arc 20 21 (0.707106781 0.707106781 10)
    arc 21 22 (-0.707106781 0.707106781 10)
    arc 22 23 (-0.707106781 -0.707106781 10)
    arc 23 20 (0.707106781 -0.707106781 10)
);

patches       
(
    patch inletInner
    (
        /*Inlet Square*/
        (0 1 2 3)

        /*Inlet Inner Circle*/
        (0 4 5 1)
        (1 5 6 2)
        (2 6 7 3)
        (3 7 4 0)
    )

    patch outletInner
    (
        /*Outlet Square*/
        (12 13 14 15)

        /*Outlet Inner Circle*/
        (12 16 17 13)
        (13 17 18 14)
        (14 18 19 15)
        (15 19 16 12)
    )

    wall inletOuter
    (
        /*Inlet Outer Circle*/
        (4 8 9 5)
        (5 9 10 6)
        (6 10 11 7)
        (7 11 8 4)
    )

    wall outletOuter
    (
        /*Outlet Outer Circle*/
        (16 20 21 17)
        (17 21 22 18)
        (18 22 23 19)
        (19 23 20 16)
    )

    wall tube1
    (
        (8 20 21 9)
    )

    wall tube2
    (
        (9 21 22 10)
    )

    wall tube3
    (
        (10 22 23 11)
    )

    wall tube4
    (
        (11 23 20 8)
    )
);

mergePatchPairs
(
);

// ************************************************************************* //

best regards,
Matt

N. A. June 29, 2010 00:35

HI matt,

thanks a ton. and as you said it is a very good tool. I was trying to modify your file to inlcude an annular inlet and merge all the outlet faces in 1 sinle outlet patch. But I do get error. Can you please help me and if possible let me know if I am missing something.

Thanks,
Na

File:
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.01;
vertices
(
/*Inlet Square*/
(0.5 0 0)
(0 0.5 0)
(-0.5 0 0)
(0 -0.5 0)
/*Inlet Inner Circle*/
(1.0 0 0)
(0 1.0 0)
(-1.0 0 0)
(0 -1.0 0)
/*Inlet Inner Annulus*/
(1.5 0 0)
(0 1.5 0)
(-1.5 0 0)
(0 -1.5 0)
/*Inlet Outer Circle*/
(10 0 0)
(0 10 0)
(-10 0 0)
(0 -10 0)
/*Outlet Square*/
(0.5 0 180)
(0 0.5 180)
(-0.5 0 180)
(0 -0.5 180)
/*Outlet Inner Circle*/
(1.0 0 180)
(0 1.0 180)
(-1.0 0 180)
(0 -1.0 180)
/*Outlet Inner Annulus*/
(1.5 0 180)
(0 1.5 180)
(-1.5 0 180)
(0 -1.5 180)
/*Outlet Outer Circle*/
(10 0 180)
(0 10 180)
(-10 0 180)
(0 -10 180)
);
blocks
(
/*Square Block*/
hex (0 1 2 3 16 17 18 19) (20 20 20) simpleGrading (1 1 1)
/*Inner Circle Blocks*/
hex (0 4 5 1 16 20 21 17) (20 20 20) simpleGrading (1 1 1)
hex (1 5 6 2 17 21 22 18) (20 20 20) simpleGrading (1 1 1)
hex (2 6 7 3 18 22 23 19) (20 20 20) simpleGrading (1 1 1)
hex (3 7 4 0 19 23 20 16) (20 20 20) simpleGrading (1 1 1)
/*Inner Annulus Blocks*/
hex (4 8 9 5 20 24 25 21) (10 10 10) simpleGrading (1 1 1)
hex (5 9 10 6 21 25 26 22) (10 10 10) simpleGrading (1 1 1)
hex (6 10 11 7 22 26 27 23) (10 10 10) simpleGrading (1 1 1)
hex (7 11 8 4 23 27 24 20) (10 10 10) simpleGrading (1 1 1)
/*Outer Circle Blocks*/
hex (8 12 13 9 24 28 29 25) (6 20 20) simpleGrading (1 1 1)
hex (9 13 14 10 25 29 30 26) (6 20 20) simpleGrading (1 1 1)
hex (10 14 15 11 26 30 31 27) (6 20 20) simpleGrading (1 1 1)
hex (11 15 12 8 27 31 28 24) (6 20 20) simpleGrading (1 1 1)
);
edges
(
/*Inlet Inner Circle*/
arc 4 5 (0.707106781 0.707106781 0)
arc 5 6 (-0.707106781 0.707106781 0)
arc 6 7 (-0.707106781 -0.707106781 0)
arc 7 4 (0.707106781 -0.707106781 0)
/*Inlet Annulus Circle*/
arc 8 9 (1.060660171 1.060660171 0)
arc 9 10 (-1.060660171 1.060660171 0)
arc 10 11 (-1.060660171 -1.060660171 0)
arc 11 8 (1.060660171 -1.060660171 0)
/*Inlet Outer Circle*/
arc 12 13 (7.071067811 7.071067811 0)
arc 13 14 (-7.071067811 7.071067811 0)
arc 14 15 (-7.071067811 -7.071067811 0)
arc 15 12 (7.071067811 -7.071067811 0)
/*Outlet Inner Circle*/
arc 20 21 (0.707106781 0.707106781 180)
arc 21 22 (-0.707106781 0.707106781 180)
arc 22 23 (-0.707106781 -0.707106781 180)
arc 23 20 (0.707106781 -0.707106781 180)
/*Outlet Annulus Circle*/
arc 24 25 (1.060660171 1.060660171 180)
arc 25 26 (-1.060660171 1.060660171 180)
arc 26 27 (-1.060660171 -1.060660171 180)
arc 27 24 (1.060660171 -1.060660171 180)
/*Outlet Outer Circle*/
arc 28 29 (7.071067811 7.071067811 180)
arc 29 30 (-7.071067811 7.071067811 180)
arc 30 31 (-7.071067811 -7.071067811 180)
arc 31 28 (7.071067811 -7.071067811 180)
);
patches
(
patch inletInner
(
/*Inlet Square*/
(0 1 2 3)
/*Inlet Inner Circle*/
(0 4 5 1)
(1 5 6 2)
(2 6 7 3)
(3 7 4 0)
)
patch outlet
(
/*Outlet Square*/
(16 17 18 19)
/*Outlet Inner Circle*/
(16 20 21 17)
(17 21 22 18)
(18 22 23 19)
(19 23 20 16)
/*Outlet Annulus Circle*/
(20 24 25 21)
(21 25 26 22)
(22 26 27 23)
(23 27 24 20)
/*Outlet outer Circle*/
(24 28 29 25)
(25 29 30 26)
(26 30 31 27)
(27 31 28 24)
)
patch inletAnnulus
(
/*Inlet Annulus Strip*/
(4 8 9 5)
(5 9 10 6)
(6 10 11 7)
(7 11 8 4)
)
wall inletOuter
(
/*Inlet Outer Circle*/
(8 12 13 9)
(9 13 14 10)
(10 14 15 11)
(11 15 12 8)
)
wall tube1
(
(12 28 29 13)
)
wall tube2
(
(13 29 30 14)
)
wall tube3
(
(14 30 31 15)
)
wall tube4
(
(15 31 28 12)
)
);
mergePatchPairs
(
);

Error I get is:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Creating block mesh from
"/mnt/raid/home/na/OpenFOAM/na-1.6/run/TestFoam/BYU/constant/polyMesh/blockMeshDict"

Creating blockCorners
Creating curved edges
Creating blocks
Creating patches
Creating block mesh topology
Default patch type set to empty
Check block mesh topology
Basic statistics
Number of internal faces : 24
Number of boundary faces : 30
Number of defined boundary faces : 30
Number of undefined boundary faces : 0
Checking patch -> block consistency
Creating block offsets
Creating merge list
Inconsistent number of faces between block pair 1 and 5#0 Foam::error::printStack(Foam::Ostream&) in "/home/na/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::error::exit(int) in "/home/na/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 Foam::Ostream& Foam::operator<< <Foam::error, int>(Foam::Ostream&, Foam::errorManipArg<Foam::error, int>) in "/home/na/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"
#3 Foam::blockMesh::createMergeList() in "/home/na/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"
#4 Foam::blockMesh::blockMesh(Foam::IOdictionary&) in "/home/na/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"
#5 main in "/home/na/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"
#6 __libc_start_main in "/lib/libc.so.6"
#7 _start in "/home/na/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"

From function blockMesh::createMergeList()
in file createMergeList.C at line 196.
FOAM aborting (FOAM_ABORT set)


Inconsistent number of faces between block pair 1 and 5#0 Foam::error::printStack(Foam::Ostream&) in "/home/na/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::error::exit(int) in "/home/na/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 Foam::Ostream& Foam::operator<< <Foam::error, int>(Foam::Ostream&, Foam::errorManipArg<Foam::error, int>) in "/home/na/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"
#3 Foam::blockMesh::createMergeList() in "/home/na/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"
#4 Foam::blockMesh::blockMesh(Foam::IOdictionary&) in "/home/na/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"
#5 main in "/home/na/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"
#6 __libc_start_main in "/lib/libc.so.6"
#7 _start in "/home/na/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"
#0 Foam::error::printStack(Foam::Ostream&) in "/home/na/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/na/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 Foam::error::exit(int) in "/home/na/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"
#3 Foam::Ostream& Foam::operator<< <Foam::error, int>(Foam::Ostream&, Foam::errorManipArg<Foam::error, int>) in "/home/na/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"
#4 Foam::blockMesh::createMergeList() in "/home/na/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"
#5 Foam::blockMesh::blockMesh(Foam::IOdictionary&) in "/home/na/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"
#6 main in "/home/na/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"
#7 __libc_start_main in "/lib/libc.so.6"
#8 _start in "/home/na/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"

From function blockMesh::createMergeList()
in file createMergeList.C at line 196.
FOAM aborting (FOAM_ABORT set)

herbert June 29, 2010 04:00

You are running into this error because your mesh in defined inconsistently. You have defined two different blocks sharing the face 4 5 21 20, the first one
Code:

hex (0 4 5 1 16 20 21 17) (20 20 20) simpleGrading (1 1 1)
with 20*20 cells and the second one
Code:

hex (4 8 9 5 20 24 25 21) (10 10 10) simpleGrading (1 1 1)
with 10*10 cells. The mesh resolution has to be equal on both sides.

Regards,
Stefan

N. A. July 2, 2010 10:39

Hi Stefan,

Thanks. After makingmesh resolution consistent on both sides, I am able to create the mesh. But maybe I am missing something in understanding that if I take a slice and look at the cross-section, then I do not see hex-mesh. It appears that the mesh is tets, even though I am specifying hex-mesh. I checked this by taking a slice along the axis of the cylinder. Even if you look at the domain with option "surface with edges" it shows the tet-mesh.

Can you recommend what is to be done to get a compelte hex mesh.

Thanks,
Nir

The corrected file is below:

--------------------------------
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.0 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.01;
vertices
(
/*Inlet Square*/
(0.25 0 0)
(0 0.25 0)
(-0.25 0 0)
(0 -0.25 0)
/*Inlet Inner Circle*/
(0.655 0 0)
(0 0.655 0)
(-0.655 0 0)
(0 -0.655 0)
/*Inlet Inner Annulus*/
(1.435 0 0)
(0 1.435 0)
(-1.435 0 0)
(0 -1.435 0)
/*Inlet Outer Circle*/
(4 0 0)
(0 4 0)
(-4 0 0)
(0 -4 0)
/*Outlet Square*/
(0.25 0 180)
(0 0.25 180)
(-0.25 0 180)
(0 -0.25 180)
/*Outlet Inner Circle*/
(0.655 0 180)
(0 0.655 180)
(-0.655 0 180)
(0 -0.655 180)
/*Outlet Inner Annulus*/
(1.435 0 180)
(0 1.435 180)
(-1.435 0 180)
(0 -1.435 180)
/*Outlet Outer Circle*/
(4 0 180)
(0 4 180)
(-4 0 180)
36,5 0%
(0 4 180)
(-4 0 180)
(0 -4 180)
);
blocks
(
/*Square Block*/
hex (0 1 2 3 16 17 18 19) (6 6 20) simpleGrading (1.1 1.1 1)
/*Inner Circle Blocks*/
hex (0 4 5 1 16 20 21 17) (6 6 20) simpleGrading (1.1 1.1 1)
hex (1 5 6 2 17 21 22 18) (6 6 20) simpleGrading (1.1 1.1 1)
hex (2 6 7 3 18 22 23 19) (6 6 20) simpleGrading (1.1 1.1 1)
hex (3 7 4 0 19 23 20 16) (6 6 20) simpleGrading (1.1 1.1 1)
/*Inner Annulus Blocks*/
hex (4 8 9 5 20 24 25 21) (6 6 20) simpleGrading (1.1 1.1 1)
hex (5 9 10 6 21 25 26 22) (6 6 20) simpleGrading (1.1 1.1 1)
hex (6 10 11 7 22 26 27 23) (6 6 20) simpleGrading (1.1 1.1 1)
hex (7 11 8 4 23 27 24 20) (6 6 20) simpleGrading (1.1 1.1 1)
/*Outer Circle Blocks*/
hex (8 12 13 9 24 28 29 25) (6 6 20) simpleGrading (1.1 1.1 1)
hex (9 13 14 10 25 29 30 26) (6 6 20) simpleGrading (1.1 1.1 1)
hex (10 14 15 11 26 30 31 27) (6 6 20) simpleGrading (1.1 1.1 1)
hex (11 15 12 8 27 31 28 24) (6 6 20) simpleGrading (1.1 1.1 1)
);
edges
(
/*Inlet Inner Circle*/
arc 4 5 (0.463154942 0.463154942 0)
arc 5 6 (-0.463154942 0.463154942 0)
arc 6 7 (-0.463154942 -0.463154942 0)
arc 7 4 (0.463154942 -0.463154942 0)
/*Inlet Annulus Circle*/
arc 8 9 (1.014698231 1.014698231 0)
arc 9 10 (-1.014698231 1.014698231 0)
arc 10 11 (-1.014698231 -1.014698231 0)
arc 11 8 (1.014698231 -1.014698231 0)
/*Inlet Outer Circle*/
arc 12 13 (2.828427124 2.828427124 0)
arc 13 14 (-2.828427124 2.828427124 0)
arc 14 15 (-2.828427124 -2.828427124 0)
arc 15 12 (2.828427124 -2.828427124 0)
/*Outlet Inner Circle*/
arc 20 21 (0.463154942 0.463154942 180)
arc 21 22 (-0.463154942 0.463154942 180)
arc 22 23 (-0.463154942 -0.463154942 180)
arc 23 20 (0.463154942 -0.463154942 180)
/*Outlet Annulus Circle*/
arc 24 25 (1.014698231 1.014698231 180)
arc 25 26 (-1.014698231 1.014698231 180)
arc 26 27 (-1.014698231 -1.014698231 180)
arc 27 24 (1.014698231 -1.014698231 180)
/*Outlet Outer Circle*/
arc 28 29 (2.828427124 2.828427124 180)
arc 29 30 (-2.828427124 2.828427124 180)
arc 30 31 (-2.828427124 -2.828427124 180)
65,5 43%
arc 29 30 (-2.828427124 2.828427124 180)
arc 30 31 (-2.828427124 -2.828427124 180)
arc 31 28 (2.828427124 -2.828427124 180)
);
patches
(
patch inletInner
(
/*Inlet Square*/
(0 1 2 3)
/*Inlet Inner Circle*/
(0 4 5 1)
(1 5 6 2)
(2 6 7 3)
(3 7 4 0)
)
patch outlet
(
/*Outlet Square*/
(16 17 18 19)
/*Outlet Inner Circle*/
(16 20 21 17)
(17 21 22 18)
(18 22 23 19)
(19 23 20 16)
/*Outlet Annulus Circle*/
(20 24 25 21)
(21 25 26 22)
(22 26 27 23)
(23 27 24 20)
/*Outlet outer Circle*/
(24 28 29 25)
(25 29 30 26)
(26 30 31 27)
(27 31 28 24)
)
patch inletAnnulus
(
/*Inlet Annulus Strip*/
(4 8 9 5)
(5 9 10 6)
(6 10 11 7)
(7 11 8 4)
)
wall inletOuter
(
/*Inlet Outer Circle*/
(8 12 13 9)
(9 13 14 10)
(10 14 15 11)
(11 15 12 8)
)
wall tube1
(
(12 28 29 13)
)
128,5 85%
(12 28 29 13)
)
wall tube2
(
(13 29 30 14)
)
wall tube3
(
(14 30 31 15)
)
wall tube4
(
(15 31 28 12)
)
);
mergePatchPairs
(
);


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