Difference between revisions of "Main ContribExamples/AxiSymmetric"

From OpenFOAMWiki
(Mesh description:)
(Writing blockMeshDict)
Line 9: Line 9:
 
== Writing blockMeshDict ==
 
== Writing blockMeshDict ==
 
=== How to get points 1,4,5,2 ?===
 
=== How to get points 1,4,5,2 ?===
The wedge has angle ''a''=5 deg. To calculate the points we need half of ''a'' expressed in radians.
+
The wedge has angle \alpha=5 deg. To calculate the points we need half of \alpha expressed in radians.
 
Let Python to do the job:
 
Let Python to do the job:
 
<Python>
 
<Python>
rafal@tux ~/Desktop/axi/constant/polyMesh $ python
+
$ python
 +
 
 
Python 2.4.4 (#1, May 30 2008, 12:21:58)
 
Python 2.4.4 (#1, May 30 2008, 12:21:58)
 
[GCC 4.1.2 (Gentoo 4.1.2 p1.1)] on linux2
 
[GCC 4.1.2 (Gentoo 4.1.2 p1.1)] on linux2
 
Type "help", "copyright", "credits" or "license" for more information.
 
Type "help", "copyright", "credits" or "license" for more information.
 
>>> import math
 
>>> import math
>>> 0.19*math.sin(math.pi*2.5/180)
+
>>> 0.19/2.0*math.cos(math.pi*2.5/180)
0.0082876835994138403
+
0.094909581050276498
>>> 0.19*math.cos(math.pi*2.5/180)
+
>>> 0.19/2.0*math.sin(math.pi*2.5/180)
0.189819162100553
+
0.0041438417997069201
 
>>>
 
>>>
 
</Python>
 
</Python>
  
First value (0.008288) corresponds to z and second (0.1898) to x.
+
First value (0.0949) corresponds to x and second (0.00414) to y.
  
Point 1 is (0.1898 0 -0.008288)
+
Point 1 is (0.0949 0.00414 0)
  
Point 4 is (0.1898 0 0.008288)
+
Point 4 is (0.0949 -0.00414 0)  
  
Point 2 is (0.1898 1.1 -0.008288)
+
Point 2 is (0.0949 0.00414 1.1)  
  
Point 5 is (0.1898 1.1 0.008288)
+
Point 5 is (0.0949 -0.00414 1.1)
  
 
=== blockMeshDict ===
 
=== blockMeshDict ===
Line 58: Line 59:
 
(
 
(
 
(0 0 0)
 
(0 0 0)
(0.1898 0 -0.008288)
+
(0.0949 0.00414 0)
(0.1898 1.1 -0.008288)
+
(0.0949 0.00414 1.1)  
(0 1.1 0)
+
(0 0 1.1)
(0.1898 0 0.008288)
+
(0.0949 -0.00414 0)  
(0.1898 1.1 0.008288)
+
(0.0949 -0.00414 1.1)
 
);
 
);
 
  
 
blocks
 
blocks
Line 109: Line 109:
  
 
=== Run a blockMesh ===
 
=== Run a blockMesh ===
<bash>
+
<bash>  
mkdir axiWiki/constant/polyMesh
+
mkdir -p ax/constant/polyMesh
 
touch axiWiki/constant/polyMesh/blockMeshDict
 
touch axiWiki/constant/polyMesh/blockMeshDict
 
emacs axiWiki/constant/polyMesh/blockMeshDict
 
emacs axiWiki/constant/polyMesh/blockMeshDict
 
</bash>
 
</bash>
Write the blockMeshDict from section above and save changes.
+
Copy/paste the blockMeshDict from section above and save changes.
 +
 
 +
 
  
Now you have to write controlDict otherwise you will get the message:
+
Now you have to write controlDict otherwise you will get an error:
 
<bash>
 
<bash>
 
--> FOAM FATAL IO ERROR : cannot open file
 
--> FOAM FATAL IO ERROR : cannot open file
  
file: /home/rafal/Desktop/axiWiki/system/controlDict at line 0.
+
file: /home/rafal/OpenFOAM/rafal-1.4.1/trunk/run/axiWiki/system/controlDict at line 0.
  
 
     From function regIOobject::readStream(const word&)
 
     From function regIOobject::readStream(const word&)
Line 127: Line 129:
 
FOAM exiting
 
FOAM exiting
 
</bash>
 
</bash>
Lets still it from standard tutorial file for potentialFoam case cylinder. It is not so important at this stage.
+
Lets steal it from standard tutorial file for simpleFoam
 +
case pitzDaily. It is not so important at this stage.
 
<bash>
 
<bash>
 
mkdir axiWiki/system
 
mkdir axiWiki/system
cat $FOAM_RUN/tutorials/potentialFoam/cylinder/system/controlDict > axiWiki/system/controlDict
+
cat $FOAM_RUN/tutorials/simpleFoam/pitzDaily/system/controlDict > axiWiki/system/controlDict
 
</bash>
 
</bash>
 
Now you can run blockMesh.
 
Now you can run blockMesh.
 
<bash>
 
<bash>
blockMesh . axiWiki
+
/*---------------------------------------------------------------------------*\
 +
| =========                |                                                |
 +
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
 +
|  \\    /  O peration    | Version:  1.4.1                                |
 +
|  \\  /    A nd          | Web:      http://www.openfoam.org              |
 +
|    \\/    M anipulation  |                                                |
 +
\*---------------------------------------------------------------------------*/
  
 
Exec  : blockMesh . axiWiki
 
Exec  : blockMesh . axiWiki
 
Date  : Jun 18 2008
 
Date  : Jun 18 2008
Time  : 10:59:36
+
Time  : 12:29:41
 
Host  : tux
 
Host  : tux
PID    : 7578
+
PID    : 8790
Root  : /home/rafal/Desktop
+
Root  : /home/rafal/OpenFOAM/rafal-1.4.1/trunk/run
 
Case  : axiWiki
 
Case  : axiWiki
 
Nprocs : 1
 
Nprocs : 1
Line 163: Line 172:
 
     From function cellModel::mag(const labelList&, const pointField&)
 
     From function cellModel::mag(const labelList&, const pointField&)
 
     in file meshes/meshShapes/cellModel/cellModel.C at line 134
 
     in file meshes/meshShapes/cellModel/cellModel.C at line 134
     zero or negative pyramid volume: -0.00057679 for face 1
+
     zero or negative pyramid volume: -0.000144058 for face 1
 
--> FOAM Warning :
 
--> FOAM Warning :
 
     From function cellModel::mag(const labelList&, const pointField&)
 
     From function cellModel::mag(const labelList&, const pointField&)
 
     in file meshes/meshShapes/cellModel/cellModel.C at line 134
 
     in file meshes/meshShapes/cellModel/cellModel.C at line 134
     zero or negative pyramid volume: -0.000288395 for face 2
+
     zero or negative pyramid volume: -7.20291e-05 for face 2
 
--> FOAM Warning :
 
--> FOAM Warning :
 
     From function cellModel::mag(const labelList&, const pointField&)
 
     From function cellModel::mag(const labelList&, const pointField&)
 
     in file meshes/meshShapes/cellModel/cellModel.C at line 134
 
     in file meshes/meshShapes/cellModel/cellModel.C at line 134
     zero or negative pyramid volume: -0.000288395 for face 3
+
     zero or negative pyramid volume: -7.20291e-05 for face 3
 
--> FOAM Warning :
 
--> FOAM Warning :
 
     From function cellModel::mag(const labelList&, const pointField&)
 
     From function cellModel::mag(const labelList&, const pointField&)
 
     in file meshes/meshShapes/cellModel/cellModel.C at line 134
 
     in file meshes/meshShapes/cellModel/cellModel.C at line 134
     zero or negative pyramid volume: -0.000288395 for face 4
+
     zero or negative pyramid volume: -7.20291e-05 for face 4
 
--> FOAM Warning :
 
--> FOAM Warning :
 
     From function cellModel::mag(const labelList&, const pointField&)
 
     From function cellModel::mag(const labelList&, const pointField&)
 
     in file meshes/meshShapes/cellModel/cellModel.C at line 134
 
     in file meshes/meshShapes/cellModel/cellModel.C at line 134
     zero or negative pyramid volume: -0.000288395 for face 5
+
     zero or negative pyramid volume: -7.20291e-05 for face 5
 
--> FOAM Warning :
 
--> FOAM Warning :
 
     From function blockMesh::createTopology(IOdictionary& meshDescription)
 
     From function blockMesh::createTopology(IOdictionary& meshDescription)
Line 222: Line 231:
 
emacs axiWiki/constant/polyMesh/boundary
 
emacs axiWiki/constant/polyMesh/boundary
 
</bash>
 
</bash>
and change number of fields from 6 to 5 and delete the bit from the file
+
and change number of boundary fields from 6 to 5 and delete the bit below from the file
 
<cpp>
 
<cpp>
 
axis
 
axis

Revision as of 11:33, 18 June 2008

1 Aim

Create an axisymetric mesh with blockMesh and setup the case for simpleFoam.

2 Mesh description:

The simulation domain is a cylindrical pipe with diameter 0.19 m and length 1.1 m. To reduce computational effort, mesh is created as 2D axi-symmetrical. The density of the mesh is 300 cells in axial and 19 in radial direction. Schematically the drawing of the mesh is shown on the picture. "X","Y","Z" - coordinates, 0-5 points in blockMesh description.

AxiSymetricMeshDrawingSchematicBlockMeshPoints.v.1.0.svg

3 Writing blockMeshDict

3.1 How to get points 1,4,5,2 ?

The wedge has angle \alpha=5 deg. To calculate the points we need half of \alpha expressed in radians. Let Python to do the job:

 
$ python
 
Python 2.4.4 (#1, May 30 2008, 12:21:58)
[GCC 4.1.2 (Gentoo 4.1.2 p1.1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> 0.19/2.0*math.cos(math.pi*2.5/180)
0.094909581050276498
>>> 0.19/2.0*math.sin(math.pi*2.5/180)
0.0041438417997069201
>>>

First value (0.0949) corresponds to x and second (0.00414) to y.

Point 1 is (0.0949 0.00414 0)

Point 4 is (0.0949 -0.00414 0)

Point 2 is (0.0949 0.00414 1.1)

Point 5 is (0.0949 -0.00414 1.1)

3.2 blockMeshDict

 
FoamFile
{
    version         2.0;
    format          ascii;
 
    root            "";
    case            "";
    instance        "";
    local           "";
 
    class           dictionary;
    object          blockMeshDict;
}
 
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
convertToMeters 1;
 
vertices
(
(0 0 0)
(0.0949 0.00414 0)
(0.0949 0.00414 1.1) 
(0 0 1.1)
(0.0949 -0.00414 0) 
(0.0949 -0.00414 1.1)
);
 
blocks
(
hex (0 1 4 0 3 2 5 3) (19  1 300) simpleGrading (1 1 1)
);
 
edges
(
);
 
patches
(
 wedge front
 (
 (0 1 2 3)
 )
 wedge back
 (
 (0 3 5 4)
 )
 wall tankWall
 (
 (1 4 5 2)
 )
 patch inlet
 (
 (0 4 1 0)
 )
 patch outlet
 (
 (3 2 5 3)
 )
 empty axis
 (
 (0 3 3 0)
 )
);
 
mergePatchPairs
(
);

3.3 Run a blockMesh

 
mkdir -p ax/constant/polyMesh
touch axiWiki/constant/polyMesh/blockMeshDict
emacs axiWiki/constant/polyMesh/blockMeshDict

Copy/paste the blockMeshDict from section above and save changes.


Now you have to write controlDict otherwise you will get an error:

 
--> FOAM FATAL IO ERROR : cannot open file
 
file: /home/rafal/OpenFOAM/rafal-1.4.1/trunk/run/axiWiki/system/controlDict at line 0.
 
    From function regIOobject::readStream(const word&)
    in file db/regIOobject/regIOobjectRead.C at line 66.
 
FOAM exiting

Lets steal it from standard tutorial file for simpleFoam case pitzDaily. It is not so important at this stage.

 
mkdir axiWiki/system
cat $FOAM_RUN/tutorials/simpleFoam/pitzDaily/system/controlDict > axiWiki/system/controlDict

Now you can run blockMesh.

 
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  1.4.1                                 |
|   \\  /    A nd           | Web:      http://www.openfoam.org               |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
 
Exec   : blockMesh . axiWiki
Date   : Jun 18 2008
Time   : 12:29:41
Host   : tux
PID    : 8790
Root   : /home/rafal/OpenFOAM/rafal-1.4.1/trunk/run
Case   : axiWiki
Nprocs : 1
Create time
 
 
Reading block mesh description dictionary
 
Creating block mesh
 
Creating blockCorners
 
Creating curved edges
 
Creating blocks
 
Creating patches
 
Creating block mesh topology
--> FOAM Warning :
    From function cellModel::mag(const labelList&, const pointField&)
    in file meshes/meshShapes/cellModel/cellModel.C at line 134
    zero or negative pyramid volume: -0.000144058 for face 1
--> FOAM Warning :
    From function cellModel::mag(const labelList&, const pointField&)
    in file meshes/meshShapes/cellModel/cellModel.C at line 134
    zero or negative pyramid volume: -7.20291e-05 for face 2
--> FOAM Warning :
    From function cellModel::mag(const labelList&, const pointField&)
    in file meshes/meshShapes/cellModel/cellModel.C at line 134
    zero or negative pyramid volume: -7.20291e-05 for face 3
--> FOAM Warning :
    From function cellModel::mag(const labelList&, const pointField&)
    in file meshes/meshShapes/cellModel/cellModel.C at line 134
    zero or negative pyramid volume: -7.20291e-05 for face 4
--> FOAM Warning :
    From function cellModel::mag(const labelList&, const pointField&)
    in file meshes/meshShapes/cellModel/cellModel.C at line 134
    zero or negative pyramid volume: -7.20291e-05 for face 5
--> FOAM Warning :
    From function blockMesh::createTopology(IOdictionary& meshDescription)
    in file createTopology.C at line 391
    negative volume block : 0, probably defined inside-out
 
Default patch type set to empty
 
Check block mesh topology
 
        Basic statistics
                Number of internal faces : 0
                Number of boundary faces : 6
                Number of defined boundary faces : 6
                Number of undefined boundary faces : 0
 
        Checking patch -> block consistency
 
Creating block offsets
 
Creating merge list .
 
Creating points
 
Creating cells
 
Creating patches
 
Creating mesh from block mesh
 
Default patch type set to empty
 
Creating merge patch pairs
 
 
Writing polyMesh
 
end

Now you have to remove some things by hand to finish with mesh.

 
emacs axiWiki/constant/polyMesh/boundary

and change number of boundary fields from 6 to 5 and delete the bit below from the file

 
axis
{
    type empty;
    nFaces 0;
    startFace 22819;
}

4 Lets see the mesh

To see the mesh in paraFoam we need fvSchemes in system directory. Lets still it from the same case like above.

 
cp $FOAM_RUN/tutorials/potentialFoam/cylinder/system/fvSchemes axiWiki/system/

Now we should be able to see the mesh in paraFoam

 
paraFoam . axiWiki

5 Disclaimer:

On this page appeared as a 20 minutes work. It can therefore contain some mistakes. This is probably not a proper way to do the axisymetric mesh, but the one that worked for me. If you have any comments, feel free to modify the case.

--Rafalzietara 12:24, 18 June 2008 (CEST)