Difference between revisions of "Main ContribExamples/AxiSymmetric"

From OpenFOAMWiki
(New page: # Aim: Create an axisymetric mesh with blockMesh # Mesh description: I want to run a simulation on axisymetric mesh that has 0.19 m in diameter and 1.1 m in height. The density of the mesh...)
 
Line 1: Line 1:
# Aim:
+
== Aim ==
 
Create an axisymetric mesh with blockMesh
 
Create an axisymetric mesh with blockMesh
# Mesh description:
+
== Mesh description: ==
 
I want to run a simulation on axisymetric mesh that has 0.19 m in diameter and 1.1 m in height. The density of the mesh should be 300 cells in axial and 19 in radial direction. Schematically the drawing of the mesh
 
I want to run a simulation on axisymetric mesh that has 0.19 m in diameter and 1.1 m in height. The density of the mesh should be 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.
 
is shown on the picture. "X","Y","Z" - coordinates, 0-5 points in blockMesh description.
 +
 
[[Image:/home/rafal/Desktop/Schematic.svg]]
 
[[Image:/home/rafal/Desktop/Schematic.svg]]
# Writing blockMeshDict:
+
== Writing blockMeshDict ==
## How to get points 1,4,5,2 ?
+
=== How to get points 1,4,5,2 ?===
from Python:
+
The wedge has angle ''a''=5 deg. To calculate the points we need half of ''a'' expressed in radians.
 +
Let Python to do the job:
 
<Python>
 
<Python>
 
rafal@tux ~/Desktop/axi/constant/polyMesh $ python
 
rafal@tux ~/Desktop/axi/constant/polyMesh $ python
Line 19: Line 21:
 
0.189819162100553
 
0.189819162100553
 
>>>
 
>>>
<\Python>
+
</Python>
  
first value 0.008288 corresponds to z and second 0.1898 to x.
+
First value (0.008288) corresponds to z and second (0.1898) to x.
blockMeshDict will have form:
+
 
 +
Point 1 is (0.1898 0 -0.008288)
 +
 
 +
Point 4 is (0.1898 0 0.008288)
 +
 
 +
Point 2 is (0.1898 1.1 -0.008288)
 +
 
 +
Point 5 is (0.1898 1.1 0.008288)
 +
 
 +
=== blockMeshDict ===
  
 
<cpp>
 
<cpp>
convertToMeters 0.005;
+
FoamFile
 +
{
 +
    version        2.0;
 +
    format          ascii;
 +
 
 +
    root            "";
 +
    case            "";
 +
    instance        "";
 +
    local          "";
 +
 
 +
    class          dictionary;
 +
    object          blockMeshDict;
 +
}
 +
 
 +
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 +
 
 +
convertToMeters 1;
  
 
vertices
 
vertices
Line 78: Line 105:
 
(
 
(
 
);
 
);
<\cpp>
+
</cpp>
 +
 
 +
=== Run a blockMesh ===
 +
<bash>
 +
rafal@tux ~/Desktop $ mkdir axiWiki/constant/polyMesh
 +
rafal@tux ~/Desktop $ touch axiWiki/constant/polyMesh/blockMeshDict
 +
rafal@tux ~/Desktop $ emacs axiWiki/constant/polyMesh/blockMeshDict
 +
</bash>
 +
Write the blockMeshDict from section above and save changes.
 +
 
 +
Now you have to write controlDict otherwise you will get the message:
 +
<bash>
 +
--> FOAM FATAL IO ERROR : cannot open file
 +
 
 +
file: /home/rafal/Desktop/axiWiki/system/controlDict at line 0.
 +
 
 +
    From function regIOobject::readStream(const word&)
 +
    in file db/regIOobject/regIOobjectRead.C at line 66.
 +
 
 +
FOAM exiting
 +
</bash>
 +
Lets still it from standard tutorial file for potentialFoam case cylinder. It is not so important at this stage.
 +
<bash>
 +
mkdir axiWiki/system
 +
cat $FOAM_RUN/tutorials/potentialFoam/cylinder/system/controlDict > axiWiki/system/controlDict
 +
</bash>
 +
Now you can run blockMesh.
 +
<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
 +
Date  : Jun 18 2008
 +
Time  : 10:59:36
 +
Host  : tux
 +
PID    : 7578
 +
Root  : /home/rafal/Desktop
 +
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.00057679 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: -0.000288395 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: -0.000288395 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: -0.000288395 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: -0.000288395 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
 +
</bash>
 +
Now you have to remove some things by hand to finish with mesh.
 +
<bash>
 +
emacs axiWiki/constant/polyMesh/boundary
 +
</bash>
 +
and change number of fields from 6 to 5 and delete the bit from the file
 +
<cpp>
 +
axis
 +
{
 +
    type empty;
 +
    nFaces 0;
 +
    startFace 22819;
 +
}
 +
</cpp>
 +
 
  
 +
=== 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.
 +
<bash>
 +
cp $FOAM_RUN/tutorials/potentialFoam/cylinder/system/fvSchemes axiWiki/system/
 +
</bash>
 +
Now we should be able to see the mesh in paraFoam
 +
<bash>
 +
paraFoam . axiWiki
 +
</bash>
  
=== Disclaimer: ===
+
== Disclaimer: ==
 
On this page appeared as a 20 minutes work. It can therefore contain some mistakes.
 
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.
 
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.
  
Rafal Zietara
+
--[[User:Rafalzietara|Rafalzietara]] 12:24, 18 June 2008 (CEST)
--~~~~
+

Revision as of 10:24, 18 June 2008

1 Aim

Create an axisymetric mesh with blockMesh

2 Mesh description:

I want to run a simulation on axisymetric mesh that has 0.19 m in diameter and 1.1 m in height. The density of the mesh should be 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.

File:/home/rafal/Desktop/Schematic.svg

3 Writing blockMeshDict

3.1 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. Let Python to do the job:

 
rafal@tux ~/Desktop/axi/constant/polyMesh $ 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*math.sin(math.pi*2.5/180)
0.0082876835994138403
>>> 0.19*math.cos(math.pi*2.5/180)
0.189819162100553
>>>

First value (0.008288) corresponds to z and second (0.1898) to x.

Point 1 is (0.1898 0 -0.008288)

Point 4 is (0.1898 0 0.008288)

Point 2 is (0.1898 1.1 -0.008288)

Point 5 is (0.1898 1.1 0.008288)

3.2 blockMeshDict

 
FoamFile
{
    version         2.0;
    format          ascii;
 
    root            "";
    case            "";
    instance        "";
    local           "";
 
    class           dictionary;
    object          blockMeshDict;
}
 
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
convertToMeters 1;
 
vertices
(
(0 0 0)
(0.1898 0 -0.008288)
(0.1898 1.1 -0.008288)
(0 1.1 0)
(0.1898 0 0.008288)
(0.1898 1.1 0.008288)
);
 
 
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

 
rafal@tux ~/Desktop $ mkdir axiWiki/constant/polyMesh
rafal@tux ~/Desktop $ touch axiWiki/constant/polyMesh/blockMeshDict
rafal@tux ~/Desktop $ emacs axiWiki/constant/polyMesh/blockMeshDict

Write the blockMeshDict from section above and save changes.

Now you have to write controlDict otherwise you will get the message:

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

Lets still it from standard tutorial file for potentialFoam case cylinder. It is not so important at this stage.

 
mkdir axiWiki/system
cat $FOAM_RUN/tutorials/potentialFoam/cylinder/system/controlDict > axiWiki/system/controlDict

Now you can run blockMesh.

 
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
Date   : Jun 18 2008
Time   : 10:59:36
Host   : tux
PID    : 7578
Root   : /home/rafal/Desktop
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.00057679 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: -0.000288395 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: -0.000288395 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: -0.000288395 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: -0.000288395 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 fields from 6 to 5 and delete the bit from the file

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


3.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

4 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)