CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   Generating 3-D axisymmetric mesh using extrudeMesh (https://www.cfd-online.com/Forums/openfoam-meshing/105553-generating-3-d-axisymmetric-mesh-using-extrudemesh.html)

martyn88 August 2, 2012 09:13

Generating 3-D axisymmetric mesh using extrudeMesh
 
Hi guys,

I am modelling an axisymmetric jet and would like to use extrudeMesh to convert a 2-D mesh into 3-D. I created a 2-D mesh in Fluent then used fluentMeshToFoam to convert it. I would now like to revolve this 2-D mesh 45 degrees about a symmetry axis, effectively making a 1/8th section.
The problem is I can't get extrudeMesh to work. It comes up with the following message:

--> FOAM FATAL IO ERROR:
cannot open file

file: /home/hugh/OpenFOAM/hugh-2.1.0/3d/jet_3d_extrude/system/extrudeMeshDict at line 0.

From function regIOobject::readStream()
in file db/regIOobject/regIOobjectRead.C at line 87.

I have looked at other threads and they say to run extrudeMesh from a separate directory to that which your 2-D mesh is stored and then call the 2-D directory in your extrudeMeshDict. I have done this but it still doesn't work. Could someone please help me!

Thanks

Hugh

Nucleophobe August 3, 2012 11:19

It looks like it can't find or open your extrudeMeshDict at all. What directory are you executing extrudeMesh from?

If your extrudeMeshDict is located at:
/home/hugh/OpenFOAM/hugh-2.1.0/3d/jet_3d_extrude/system/extrudeMeshDict

then you should be able to run extrudeMesh from
/home/hugh/OpenFOAM/hugh-2.1.0/3d/jet_3d_extrude/

Otherwise you might have file ownership properties. Maybe try
chmod 700 extrudeMeshDict

Sud09463 July 22, 2016 01:41

hello,
i also wanna to generate 3D axisymmetry mesh using extrudeMesh utility but it is showing error. i am able to generate 2D wedge shape but cann't 3d axisymmetry. This is the error message:

--> FOAM FATAL ERROR:
wedge front plane aligns with a coordinate plane.
The wedge plane should make a small angle (~2.5deg) with the coordinate plane
and the the pair of wedge planes should be symmetric about the coordinate plane.
Normal of wedge plane is (5.93255206084e-34 1 -6.12323399574e-17) , implied coordinate plane direction is (0 1 -0)

From function virtual void Foam::wedgePolyPatch::calcGeometry(Foam::PstreamBu ffers&)
in file meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C at line 109.

My exrudeMeshdict file is:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.4.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object extrudeProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

constructFrom patch;
sourceCase "$FOAM_CASE";

sourcePatches (front);
exposedPatchName back;

extrudeModel wedge;

sectorCoeffs
{
axisPt (0 0 0);
axis (1 0 0);
angle 180;
}

flipNormals false;
mergeFaces true;

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

blockMeshdict file:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.4.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

backgroundMesh
{
length 25;
rA 0.5; // radius of inlet patch
rB 4; // outer radius
lengthCells 250;
rAcells 10;
rBcells 50;
}

convertToMeters 1;

vertices
(
( 0 0 -1)
($:backgroundMesh.length 0 -1)
( 0 $:backgroundMesh.rA -1)
($:backgroundMesh.length $:backgroundMesh.rA -1)
( 0 $:backgroundMesh.rB -1)
($:backgroundMesh.length $:backgroundMesh.rB -1)

( 0 0 0)
($:backgroundMesh.length 0 0)
( 0 $:backgroundMesh.rA 0)
($:backgroundMesh.length $:backgroundMesh.rA 0)
( 0 $:backgroundMesh.rB 0)
($:backgroundMesh.length $:backgroundMesh.rB 0)
);

blocks
(
hex (0 1 3 2 6 7 9 8)
($:backgroundMesh.lengthCells $:backgroundMesh.rAcells 1)
simpleGrading (1 1 1)

hex (2 3 5 4 8 9 11 10)
($:backgroundMesh.lengthCells $:backgroundMesh.rBcells 1)
simpleGrading (1 1 1)
);

edges
(
);

boundary
(
inlet
{
type patch;
faces
(
(0 6 8 2)
);
}

front
{
type symmetry;
faces
(
(6 7 9 8)
(8 9 11 10)
);
}

back
{
type symmetry;
faces
(
(0 1 3 2)
(2 3 5 4)
);
}

atmosphere
{
type patch;
faces
(
(2 8 10 4)
(4 5 11 10)
(5 3 9 11)
(3 1 7 9)
);
}

);

mergePatchPairs
(
);

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

RomainBou July 23, 2016 06:20

1 Attachment(s)
hi Sud,
The "wedge" functionnality only works for a wedge angle of 5 degrees.
Is your geometry respecting that?

Here is a blockmeshDict that works correctly and produces an axisymmetric simple rectangle :

Code:

convertToMeters 0.001;

vertices
(
    (20 0  0)
    (65 0  0)
    (64.9901001852  1.1344064184  0)
    (19.9969539031  0.3490481287  0)

    (20  0  40)
    (65  0  40)
    (64.9901001852  1.1344064184  40)
    (19.9969539031  0.3490481287  40)
);

edges
(
    line    0 1
    line    3 2
    line    7 6
    line    4 5

    arc 0 3 (19.9992384613 0.17453071 0)
    arc 1 2 (64.9975249992 0.5672248074 0)
    arc 5 6 (64.9975249992 0.5672248074 40)
    arc 4 7 (19.9992384613 0.17453071 40)

    line    0 4
    line    1 5
    line    2 6
    line    3 7
);

blocks
(
    hex (0 1 2 3 4 5 6 7)
    (18 1 18)
    simpleGrading
    (
        (                  //X dir
            (0.2 0.3 4)
            (0.6 0.4 1)
            (0.2 0.3 0.25)
        )
        1                  //Ydir
        (                  //Z dir
            (0.2 0.3 4)
            (0.6 0.4 1)
            (0.2 0.3 0.25)
        )
    )
);

boundary
(
    inlet
    {
        type            cyclic;
        neighbourPatch  outlet;
        faces          ((0 1 5 4));
    }
    outlet
    {
        type            cyclic;
        neighbourPatch  inlet;
        faces          ((3 7 6 2));
    }
    bottom
    {
        type    wall;
        faces  ((0 3 2 1));
    }
    top
    {
        type    patch;  //(or wall)
        faces  ((4 5 6 7));
    }
    ext_wall
    {
        type    wall;
        faces  ((0 4 7 3));
    }
    inner_wall
    {
        type    wall;
        faces  ((6 5 1 2));
    }
);

I also made a LibreOffice Calc spreadsheet to calculate the coordinates that you need to put in the blockmeshDict wich is attached to this post. So it calculates the rotation of 5 degrees of your primary rectangle (with an axis of symmetry being to the left of the left edge pf the rectangle).

vigneshTG August 15, 2016 11:51

Negative face area and Max Skewness error
 
Hello All,

I tried creating a 3D mesh by revolving the 2D mesh generated using blockMesh. For this, i followed the steps listed here.

I modified the blockMesh in plateHole tutorial which is given below
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.2.2                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices
(
    (0.5 0 0)
    (1 0 0)
    (2 0 0)
    (2 0.707107 0)
    (0.707107 0.707107 0)
    (0.353553 0.353553 0)
    (2 2 0)
    (0.707107 2 0)
    (0 2 0)
    (0 1 0)
    (0 0.5 0)
    (0.5 0 0.5)
    (1 0 0.5)
    (2 0 0.5)
    (2 0.707107 0.5)
    (0.707107 0.707107 0.5)
    (0.353553 0.353553 0.5)
    (2 2 0.5)
    (0.707107 2 0.5)
    (0 2 0.5)
    (0 1 0.5)
    (0 0.5 0.5)
);

blocks
(
    hex (5 4 9 10 16 15 20 21) (10 10 1) simpleGrading (1 1 1)
    hex (0 1 4 5 11 12 15 16) (10 10 1) simpleGrading (1 1 1)
    hex (1 2 3 4 12 13 14 15) (20 10 1) simpleGrading (1 1 1)
    hex (4 3 6 7 15 14 17 18) (20 20 1) simpleGrading (1 1 1)
    hex (9 4 7 8 20 15 18 19) (10 20 1) simpleGrading (1 1 1)
);

edges
(
    arc 0 5 (0.469846 0.17101 0)
    arc 5 10 (0.17101 0.469846 0)
    arc 1 4 (0.939693 0.34202 0)
    arc 4 9 (0.34202 0.939693 0)
    arc 11 16 (0.469846 0.17101 0.5)
    arc 16 21 (0.17101 0.469846 0.5)
    arc 12 15 (0.939693 0.34202 0.5)
    arc 15 20 (0.34202 0.939693 0.5)
);

boundary
(

/*  left
    {
        type symmetryPlane;
        faces
        (
            (8 9 20 19)
            (9 10 21 20)
        );
    }*/

    right
    {
        type patch;
        faces
        (
            (2 3 14 13)
            (3 6 17 14)
            (8 9 20 19)
            (9 10 21 20)
        );
    }

    up
    {
        type patch;
        faces
        (
            (7 8 19 18)
            (6 7 18 17)
            (0 1 12 11)
            (1 2 13 12)
        );
    }
    hole
    {
        type patch;
        faces
        (
            (10 5 16 21)
            (5 0 11 16)
        );
    }
    front
    {
        type patch;
        faces
        (
            (10 9 4 5)
            (5 4 1 0)
            (1 4 3 2)
            (4 7 6 3)
            (4 9 8 7)
        );
    }

    back
    {
        type patch;
        faces
        (
            (21 16 15 20)
            (16 11 12 15)
            (12 13 14 15)
            (15 14 17 18)
            (15 18 19 20)
        );
    }

);

mergePatchPairs
(
);

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

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.2.2                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      extrudeMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// What to extrude:
//      patch  : from patch of another case ('sourceCase')
//      mesh    : as above but with original case included
//      surface : from externally read surface

//constructFrom mesh;
constructFrom patch;
//constructFrom surface;

// If construct from patch/mesh:
sourceCase ".";
sourcePatches (front);
// If construct from patch: patch to use for back (can be same as sourcePatch)
exposedPatchName    back;

// Flip surface normals before usage. Valid only for extrude from surface or
// patch.
flipNormals false;

//- Wedge extrusion. If nLayers is 1 assumes symmetry around plane.
extrudeModel        wedge;


nLayers            180;

expansionRatio      1.0;    //0.9;

wedgeCoeffs
{
  axisPt      (0 0.1 0);

  axis        (0 1 0);

  angle      360;
}

// Do front and back need to be merged? Usually only makes sense for 360
// degree wedges.
mergeFaces false;

// Merge small edges. Fraction of bounding box.
mergeTol 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

After executing commands blockMesh, extrudeMesh and stitchMesh. when i check the mesh, i got he following errors

Code:


Mesh stats
    points:          192780
    faces:            552600
    internal faces:  527400
    cells:            180000
    faces per cell:  6
    boundary patches: 3
    point zones:      0
    face zones:      1
    cell zones:      0

Overall number of cells of each type:
    hexahedra:    180000
    prisms:        0
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:    0

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces...
    Patch              Faces    Points  Surface topology                 
    right              10800    11160    ok (non-closed singly connected) 
    up                  10800    11160    ok (non-closed singly connected) 
    hole                3600    3780    ok (non-closed singly connected) 

Checking geometry...
    Overall domain bounding box (-2 0 -2) (2 2 2)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (-2.70183e-18 -6.87951e-16 1.08897e-18) OK.
    Max cell openness = 2.25422e-15 OK.
    Max aspect ratio = 63.3828 OK.
***Zero or negative face area detected.  Minimum area: 0
  <<Writing 5400 zero area faces to set zeroAreaFaces

    Min volume = 1.4814e-06. Max volume = 0.000306143.  Total volume = 24.8663.  Cell volumes OK.
    Mesh non-orthogonality Max: 41.2605 average: 8.22311
    Non-orthogonality check OK.
    Face pyramids OK.
***Max skewness = 937.604, 5400 highly skew faces detected which may impair the quality of the results
  <<Writing 5400 skew faces to set skewFaces

    Coupled point location match (average 0) OK.

Failed 2 mesh checks.

End

I would very much appreciate if someone could point me out what i am doing wrong ?

Tobi August 22, 2016 09:22

Hi,

In extrude mesh there is an option "mergeFace" ... You have false. Change it to true.

By the way, if you want to make a 360 extrusion, ou do not need to use stitch Mesh

vigneshTG August 22, 2016 10:41

1 Attachment(s)
Hi Tobi,

Thanks for responding,

I tried with mergeMesh set to true also before and also now. I get this error

Code:

***Zero or negative face area detected.  Minimum area: 0
  <<Writing 9480 zero area faces to set zeroAreaFaces

After running extrudeMesh,i delete the patches front, back and defaultFaces or else i get errors when i try to run checkMesh.

I am attaching the setup in case if you want to have a look !!

Tobi August 23, 2016 04:36

Hi,

I checked your geometry but I do not get the point.


  • The mesh you have is not a rotational - symmetric mesh
  • The mesh quality is not optimal
  • For me it seems that you do not use extrudeMesh in the right way
Can you please add a picture of the geometry you want to have finally?

vigneshTG August 23, 2016 04:58

Hi Tobi,

Thanks for taking time to look into the mesh !!

I wanted to create a sphere inside a cylinder. I followed the steps listed in this link.
It says, that we need a 2d mesh one cell thick with both front and back faces labelled as separate patches.

Yes the mesh is not optimal :D ... i am working on it now :)

Tobi August 23, 2016 05:12

And why you are not using snappyHexMesh?

http://www.holzmann-cfd.de/index.php...sphere-meshing

Tobi August 23, 2016 05:55

2 Attachment(s)
I tied your method with FOAM 4.x (case is attached). The problem with that one:
Code:

***Zero or negative face area detected.  Minimum area: 0
comes from the center-line. As you can see in the tutorial on the wiki, there is nowhere a real centerline. Thats why it is working in that case but not in yours. Here I would prefer to use sHM.

Summary

You did everything correct but the centerline makes problems.

vigneshTG August 23, 2016 05:59

Quote:

Originally Posted by Tobi (Post 615108)
I tied your method with FOAM 4.x (case is attached). The problem with that one:
Code:

***Zero or negative face area detected.  Minimum area: 0
comes from the center-line. As you can see in the tutorial on the wiki, there is nowhere a real centerline. Thats why it is working in that case but not in yours. Here I would prefer to use sHM.

Summary

You did everything correct but the centerline makes problems.


Hi Tobi,

Thanks once again. Initially i thought using SHM for this case might result in polyhedral cells close to the sphere !! But i will try the tutorials you have it in your website.

aeroeng91 November 27, 2016 17:46

Hi Vignesh,

This may be too late, but for future reference: after extrudeMesh, you can run collapseEdges to fix the cell faces on the centerline -- it collapses the hex cells into the appropriate shape.

Tobi February 1, 2017 18:12

Hi aeroeng,
Good to know ... Never used that tool.

Sent from my HTC One mini using CFD Online Forum mobile app

openfoammaofnepo June 21, 2017 08:31

Hello,

Just curiosity, with this method, i.e. rotating the 2D mesh slice to get the 3D cylindrical mesh, will we get the singular axis? Because in that axis in 2D mesh slide is always axis. Thanks.

openfoammaofnepo June 21, 2017 17:44

Hello All,

I tried the case in the following link, which is from OpenFOAM 2.3.x:

https://github.com/OpenFOAM/OpenFOAM...xisymmetricJet

In that case, the slab mesh is first generated, and then the command extrudeMesh can be used to generated a 5 degree wedge. In this case, the angle is 1 degree. If I change it to 180 or 360, I will not get the half cylinder or full cylinder. Is there any parameter that should be changed in extrudeMeshDict? Thanks!

aeroeng91 June 21, 2017 19:13

Quote:

Originally Posted by openfoammaofnepo (Post 654350)
Hello All,

I tried the case in the following link, which is from OpenFOAM 2.3.x:

https://github.com/OpenFOAM/OpenFOAM...xisymmetricJet

In that case, the slab mesh is first generated, and then the command extrudeMesh can be used to generated a 5 degree wedge. In this case, the angle is 1 degree. If I change it to 180 or 360, I will not get the half cylinder or full cylinder. Is there any parameter that should be changed in extrudeMeshDict? Thanks!

Hi openfoammaofnepo,

I'm not sure I follow your first post. As for your second post: if you want to generate a 3D mesh, you need to change the settings in the extrudeMeshDict:

https://github.com/OpenFOAM/OpenFOAM...xtrudeMeshDict

For extrudeModel, you should use sector. If you do a full 360 extrusion, consider using "mergeFaces true;". For a full 360 extrusion with mergeFaces true, as far as I remember, extrudeMesh automatically fixes the zero face areas that are generated if you have cells in the 2D mesh that lie on the axis of rotation. If not, you can use the collapseEdges utility, which will change the cell shape from hex to whatever shape results from collapsing zero-length edges and zero-area faces.

I hope this helps.

openfoammaofnepo June 21, 2017 19:42

Dear Marius-Corne,

Thank you for your suggestions. I solver this problems. I am running a test case - an axisymmetric jet flow, to see if there is any problem.

======update======
The results are reasonable, at least qualitatively. But Iam curious how OpenFOAM does the numerical discretization for the cells sharing the centerline axis?


All times are GMT -4. The time now is 07:40.