Difference between revisions of "Main ContribExamples/AxiSymmetric"
Rafalzietara (Talk | contribs) (→blockMeshDict) |
Rafalzietara (Talk | contribs) (→Run a blockMesh) |
||
Line 118: | Line 118: | ||
− | Now you have to write controlDict otherwise you will get an error: | + | Now you have to write controlDict otherwise you will get an error when doing blockMesh: |
<bash> | <bash> | ||
--> FOAM FATAL IO ERROR : cannot open file | --> FOAM FATAL IO ERROR : cannot open file |
Revision as of 13:56, 18 June 2008
Contents
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.
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 4 1 0 3 5 2 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 when doing blockMesh:
--> 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 : 13:09:31 Host : tux PID : 8950 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 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 in paraFoam
To see the mesh in paraFoam we need fvSchemes and fvSolution in system directory. Lets steal it from the same case like above.
cat $FOAM_RUN/tutorials/simpleFoam/pitzDaily/system/fvSolution > axiWiki/system/fvSolution cat $FOAM_RUN/tutorials/simpleFoam/pitzDaily/system/fvSchemes > axiWiki/system/fvSchemes
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)