Learning OpenFOAM ================= Estimated Page Count : 25 A simulation project in OpenFOAM is referred to as a case.

How to set up your fi rst OpenFOAM case, run a simulation and visualize the results. Structure of a case: Cavity flow example Mesh generation: BlockMeschDict Setting up a simulation: ControlDict Boundary conditions and fvschemes Visualization in Paraview Chapter 2: Structure of an OpenFOAM Case ---------------------------------------In the last chapter an introduction to Linux and installation options for OpenFO AM were provided, along with a simple test to ensure that OpenFOAM has been inst alled. This chapter will cover a very simple classic simulation of OpenFOAM, kno wn as a "case", how to generate a mesh, how to run the simulation, how to test b oundary conditions, and how to visualise the simulation with Paraview. Setup and Conducting A Tutorial In preparation for the next and subsequent chapters, create a project directory. A very common method is to create a OpenFOAM/user-version directory. OpenFOAM i n fact automates this process by simply typing: mkdir -p $FOAM_RUN Which can be checked with a directory listing: lev@racoon:~/OpenFOAM/lev-2.1.1$ ls -l ~/OpenFOAM/ total 4 drwxr-xr-x 3 lev lev 4096 2012-11-28 21:27 lev-2.1.1 The next step is to copy the tutorial examples from the installation to the proj ect directory. Again, OpenFOAM automates this process: cp -r $FOAM_TUTORIALS $FOAM_RUN Again, this can be checked with a directory listing: lev@racoon:~/OpenFOAM/lev-2.1.1$ ls -l run/tutorials total 72 -rwxr-xr-x 1 lev lev 490 2012-11-28 21:30 Allclean -rwxr-xr-x 1 lev lev 2846 2012-11-28 21:30 Allrun -rwxr-xr-x 1 lev lev 5756 2012-11-28 21:30 Alltest drwxr-xr-x 5 lev lev 4096 2012-11-28 21:30 basic drwxr-xr-x 8 lev lev 4096 2012-11-28 21:30 combustion drwxr-xr-x 10 lev lev 4096 2012-11-28 21:30 compressible drwxr-xr-x 4 lev lev 4096 2012-11-28 21:30 discreteMethods drwxr-xr-x 3 lev lev 4096 2012-11-28 21:30 DNS drwxr-xr-x 4 lev lev 4096 2012-11-28 21:30 electromagnetics drwxr-xr-x 3 lev lev 4096 2012-11-28 21:30 financial drwxr-xr-x 9 lev lev 4096 2012-11-28 21:30 heatTransfer drwxr-xr-x 17 lev lev 4096 2012-11-28 21:30 incompressible drwxr-xr-x 9 lev lev 4096 2012-11-28 21:30 lagrangian drwxr-xr-x 4 lev lev 4096 2012-11-28 21:30 mesh

the best location to store these is is under the ' run' directory. The file specifies coordinates of the block vertices. each case is given a name.1. and then the boundarie s.1. a dictionary class. to take advantage of the alias. Furthermore. To bein with the the file structure that constitutes an OpenFOAM case is elab orated. the original tutorials directory can be reached by simply running the alias 'tut' (i. specifically blockMeshDict. which specifcally notes that it is a C++ file. This allows greater ease of manipu lating specific components of the case.1. but applying a empty boundary on one di mension it can simulate two. and a blockMeshDict. Unsurprisingly. lev@racoon:/var/log/cups$ run lev@racoon:~/OpenFOAM/lev-2. version 2. which has been given the name 'cavity'. For example. . including reuse. The initial case being tested here is an isothermal and incompressible flow in a two-dimensional area.1. blockMesh. which is typically the name o f the directory in which the case files are kept. The files are sensibly described. then the blocks from the vertices. followed by core information for the file (e.. not the copy moved intot the user's home directory).1.. whic h will take data from an input file. However we will go into greater detail her e.1/run/tutorials/incompressible/icoFoam/cavity/cons tant/polyMesh$ less blockMeshDict The blockMeshDict file begins with a banner. lev@racoon:/opt$ cd $FOAM_RUN/tutorials/incompressible/icoFoam/cavity lev@racoon:~/OpenFOAM/lev-2.1/run/tutorials/incompressible/icoFoam/cavity/cons tant/polyMesh$ ls blockMeshDict boundary lev@racoon:~/OpenFOAM/lev-2. This can be viewed by changing directory to the tutorial and the relevant subdirectory and outputting the file. moving to the 'run' directory is achieved by a simple execution of that alias.g. well k nown from the OpenFOAM documentation.e.1/run$ lev@racoon:~/OpenFOAM/lev-2. ascii format. Whilst cas es could be located anywhere.1/run$ cd /var/log/cups lev@racoon:/var/log/cups$ tut lev@racoon:/opt/openfoam211/tutorials$ The particular case that is initially studied is a "Cavity flow example". OpenFOAM provides a mesh generator.1.drwxr-xr-x 18 lev lev 4096 2012-11-28 21:30 multiphase drwxr-xr-x 3 lev lev 4096 2012-11-28 21:30 resources drwxr-xr-x 4 lev lev 4096 2012-11-28 21:30 stressAnalysis With the environment variable set. A notable (and popular) featur e of OpenFOAM is that the relevant data files are stored in as a collection of i ndividual files.1/run/tutorials/incompressible/icoFoam/cavity$ ls 0 constant system lev@racoon:~/OpenFOAM/lev-2. which is locate d in the constant/polyMesh directory for each given case.0.1/run/tutorials/incompressible/icoFoam/cavity$ cd constant/polyMesh lev@racoon:~/OpenFOAM/lev-2. providing some idea of what the data is actually used for. rather than one single file. OpenFOAM actually operates and solves in three-dimension.

The edge connecting vertices 1 and 5 is curved to remind the reader that curved edges can be specified in block Mesh.x2. 1. The principle behind blockMesh is to decompose the domain geometry into a set of 1 or more three dimensional. supplied with Ope nFOAM. The blockMesh utility creates parametric meshes with grading and curved e dges. one at each corner of a hex ahedron. hexahedral blocks. 3 define the plane x3 = 0 \relax \special {t4ht=. generate s the mesh and writes out the mesh data to points and faces. blockMesh reads this dictionary. The mesh is ostensibly specified as a number of cel ls in each direction of the block. arcs or splines. cells and boundary files in the same directory. vertices 5. vertices 0. An example block is shown in Figure 5. 2.5: A single block Keyword Description Example/selection .3. as described in section 5. The local coordinate system is defined by the order in which the vertices are pr esented in the block definition according to: the axis origin is the first entry in the block definition.6 and 7 are similarly found by moving in the x3 \relax \special { t4ht= direction from vertices 1. \relax \special {t4ht= Figure 5. the arc from a point on the Ox \relax \special {t4ht= axis to a point on the Oy \relax \special {t4ht= axis is in a clockwise sense. sufficient information for blockMesh to gener ate the mesh data. Each block has a local coordinate system (x1.5.3 Mesh generation with the blockMesh utility This section describes the mesh generation utility.5 with each vertex numbered according to the list. the x2 \relax \special {t4ht= direction is described by moving from vertex 1 to vertex 2. The vertices are written in a list so that each vertex can be accessed using its label.2 and 3 respectively. Edges of the blocks can be stra ight lines. The mesh is generated from a dictionary file named blockMeshDict located in the constant/polyMesh directory of a case. vertex 4 is found by moving from vertex 0 in the x3 \relax \special {t4ht= d irection.x3) \relax \special {t4ht= that must be right-handed. remembering that OpenFOAM always uses the C++ convention that t he first element of the list has label ‘0’. It is possible to generate blocks with less than 8 vertices by collapsing one or more pairs of vertices on top of each other. A right-handed set of axes is defined such that to an obse rver looking down the Oz \relax \special {t4ht= axis. with O \relax \special {t4 ht= nearest them. the x1 \relax \special {t4ht= direction is described by moving from vertex 0 to vertex 1. Each block of the geometry is defined by 8 vertices. blockMesh. vertex 0 in our example.3.

5. e.1 The vertices The vertices of the blocks of the mesh are given next as a standard list named v ertices. convertToMeters Keywords used in blockMeshDict. 5.0 1. for our example block in Figure 5. Th e convertToMeters keyword specifies a scaling factor by which all vertex coordin ates in the mesh description are multiplied.convertToMeters Scaling factor for the vertex coordinates 0.1 Writing a blockMeshDict file The blockMeshDict file is a dictionary using keywords described in Table 5. For example.e.5) block Ordered list of vertex labels and mesh size hex (0 1 2 3 4 5 6 7) (10 10 1) simpleGrading (1.3.g.1.001 scales to mm vertices List of vertex coordinates (0 0 0) edges Used to describe arc or spline edges arc 1 4 (0.3.342 -0. means that all coordinates are multiplied by 0. the vertices are: vertices ( .939 0. the values quoted in th e blockMeshDict file are in mm \relax \special {t4ht=.0 1. i.3.0) patches List of patches symmetryPlane base ( (0 1 2 3) ) mergePatchPairs List of patches to be merged see section 5.4. 5.2 Table 5.

The lis t is optional.1.3) 1.0. Each entry for a curved edge begins with a keyword specifying the type of curve from those listed in Table 5. interpolation points must be specified through which the ed ge passes.1 0 1.3 The blocks The block definitions are contained in a list named blocks.0. For simpleSpline.1 0. and requires no interpolation points. Note that there is n o need to use the line edge but it is included for completeness.1 1 0 ) 0.5. Keyword selection arc Circular arc simpleSpline Spline polyLine Set of polySpline Set of line Straight line Description Single curve lines splines — Additional entries interpolation point List of interpolation points List of interpolation points List of interpolation points Table 5. which the circul ar arc will intersect.1 ( 0 (-0.1) 0. The keyword is then followed by the labels of the 2 vertices that the edge conne cts.3.1 ( 1.1.3. Then the blocks are defined as follows: blocks ( hex (0 1 2 3 4 5 6 7) (10 10 10) simpleGrading (1 2 3) // vertex numbers // numbers of cells in each direction // cell expansion ratios . 5. 0 0 1 1 -0. polyLine and polySpline. For our example block in Figure 5.1.1) 0. it may be omitted.0 0. a vector giving the number of cells required in each direct ion.5) \relax \special {t4ht=: edges ( arc 1 5 (1.2 The edges Each edge joining 2 vertex points is assumed to be straight by default.3 ( 1.5: Edge types available in the blockMeshDict dictionary.3.2) 1.0.1) // // // // // // // // vertex vertex vertex vertex vertex vertex vertex vertex number number number number number number number number 0 1 2 3 4 5 6 7 5. Following that.1) 1 ) 1. a single interpolation point is required. Each block definitio n is a compound entry consisting of a list of vertex labels whose order is descr ibed in section 5. if the geometry contains no curved edges.5) ). a list of inte rpolation points is required. The line edge is directly equivalent to the option executed by default. However any edge may be specified to be curved by entries in a list named edges. For a arc. the type and list of cell expansion ratio in each direction.5 we specify an arc edge connecting vertices 1 and 5 as follo ws through the interpolation point (1.( 0 ( 1 ( 1.4 ( 0 ).

Ope nFOAM-2.2.6: Mesh grading along a block edge 5. Number of cells The second entry gives the number of cells in each of the x1 \relax \special {t4ht= x2 \relax \special {t4ht= and x3 \relax \special {t4ht= directions for t hat block.6. although we recommend something that conve niently identifies the patch. something like edgeGrading (1 1 1 1 2 2 2 2 3 3 3 3) This means the ratio of cell widths along edges 0-3 is 1.1.g.). in specified directions. the name is used as an identifier for setting boundary cond itions in the field data files. The boundary is brok en into patches (regions). \relax \special {t4ht= Figure 5. The ratio is that of the width of the end cell δe \relax \special {t4 ht= along one edge of a block to the width of the start cell δs \relax \special {t 4ht= along that edge. There follows a list of vertex numbers. The definition of each block is as follows: Vertex numbering The first entry is the shape identifier of the block.2.g. The patch information is the n contained in sub-dictionary with: type: the patch type. which is the choice of the user.inlet.g.5 with the arrows repre senting the direction ‘from first cell…to last cell’ e.4 The boundary The boundary of the mesh is given in a list named boundary. x2 \relax \special {t4ht= and x3 \relax \special {t4ht= dire ctions respectively with only 3 expansion ratios. as defined in the . the name is used as an identifier for s etting boundary conditions in the field data files. simpleGrading (1 2 3) edgeGrading The full cell expansion description gives a ratio for each edge of the b lock. Each of the following keywords spe cify one of two types of grading specification available in blockMesh. as shown in Figure 5. although we recommend something that conveniently identifies t he patch.1/cellModels file.3. simpleGrading The simple description specifies uniform expansions in the local x1 \rel ax \special {t4ht=. e. The expansion ratio enables the mesh to be graded. as listed in Table 5. or refined. Cell expansion ratios The third entry gives the cell expansion ratios for each direction in the bl ock.1. numbered according to the scheme shown in Figure 5. faces: a list of block faces that make up the patch and whose name is the ch oice of the user. either a generic patch on which some boundary conditio ns are applied or a particular geometric condition. along edges 47 is 2 and along 8-11 is 3 and is directly equivalent to the simpleGrading examp le given above.1 and d escribed in section 5. e.g. blockMesh collects faces from any boundary patch that is omitted from the bounda . e. The shape is always hex since the blocks are always hexahedra. where each patch in the list has its name as the keyw ord.inlet. ordered in the manner descri bed on page 351.

). if it has an inlet on the left fac e. the user must specify the name of t he related cyclic patch through the neighbourPatch keyword. Th is means that for a 2 dimensional geometry. faces ( (0 1 5 (0 3 2 (3 7 6 (4 5 6 ). neighbourPatch right. knowing that they will be collected into an empty patch as required. Each block face is defined by a list of 4 vertex numbers. Returning to the example block in Figure 5. faces ( (0 4 7 3). the face must be traversed in a clockwise direction to define the other vertices. When specifying a cyclic patch in blockMesh. looking from inside the block and startin g with any vertex. a pair of cyclic patches might be specified as follows: left { type cyclic. } walls { type wall. faces ((0 4 7 3)). For example. // patch type for patch 1 faces ( (1 2 6 5) ). the user has the option to omit bloc k faces lying in the 2D plane.ry list and assigns them to a default patch named defaultFaces of type empty. an output on the right face and the four other faces are walls then the patch es could be defined as follows: boundary ( inlet { type patch. } right { . } 4) 1) 2) 7) ). The order in which the vertices are given must be such that.5. } // keyword // patch name // patch type for patch 0 // block face in this patch // end of 0th patch definition outlet // patch name { type patch.

blockMesh then identifies tha t the faces do not form an external boundary and combines each collocated pair i nto a single internal faces that connects cells from the two blocks. Therefore in a case. then the patch itself will contain n o faces and is removed. if all the faces of a patch are merged. \relax \special {t4ht= Figure 5. face merging.7: Merging overlapping patches The consequence is that the original geometry of the slave patch will not necess arily be completely preserved during merging. In such circumstances.type cyclic. neighbourPatch left. requires that the block patches to be merged are first defined in the patches list. if patches overlap as shown in Figure 5. faces ((1 5 6 2)).2 Multiple blocks A mesh can be created using more than 1 block. the location of any vertex of a slave face might be adjusted by blockMesh to eliminate any face edge that is shorter than a minimum tolerance. each face that does not merge rem ains as an external face of the original patch. the only additional issu e is the connection between blocks. to create a new set of internal faces connecting the two blocks. the faces of the slave patch are projected onto the master patch where there is some separation between slave and master patch. } 5. the mesh i s created as has been described in the preceeding text. say. The rules for merging are as follows: the faces of the master patch remain as originally defined.7. face merging a group of faces from a patch from one block are connected to another group of faces from a patch from another block. the two patches that form the connecti on should simply be ignored from the patches list. To connect two blocks with face matching. on which boundary conditions mus t then be applied.3. it would be wise to the . with all vertice s in their original location. in which there are two distinct possibilitie s: face matching the set of faces that comprise a patch from one block are formed from the sa me set of vertices as a set of faces patch that comprise a patch from another bl ock. Each pair of patches whose faces are to be me rged must then be included in an optional list named mergePatchPairs. where a cylindrical block is being connected to a larger block. The format of mergePatchPairs is: mergePatchPairs ( ( <masterPatch> <slavePatch> ) // merge patch pair 0 ( <masterPatch> <slavePatch> ) // merge patch pair 1 … ) The pairs of patches are interpreted such that the first patch becomes the maste r and the second becomes the slave. The alternative.

5. both should be declared as a master patch. From with in the case directory. out of the 2D plane. This is simply done by exchanging the ver tex number 7 by 4 and 6 by 5 respectively so that the block numbering would beco me: hex (0 1 2 3 4 5 5 4) \relax \special {t4ht= Figure 5.3.3. i . the following can be executed at the command line t o run blockMesh for a case in the <case> directory: blockMesh -case <case> The blockMeshDict file must exist in subdirectory constant/polyMesh.8: Creating a wedge shaped block with 6 vertices The same applies to the patches with the main consideration that the block face containing the collapsed vertices. should be similar to the width/height of cells in the 2 D plane. 5. Let us say we wished to create a wedge shaped block by co llapsing vertex 7 onto 4 and 6 onto 5.2. simply by typing in the terminal: . it is inadvisable to merge a patch twice. include it twice in mergePatc hPairs. previously (4 5 6 7) now becomes (4 5 5 4).3. The patch should b e specified as empty in the blockMeshDict and the boundary condition for any fie lds should consequently be empty also. T he process is best illustrated by using a simplified version of our example bloc k shown in Figure 5. i.assign the master patch to the cylinder.2. where a patch to be merged shares a common edge with another patch to be mer ged. The most common example of col lapsing vertices is when creating a 6-sided wedge shaped block for 2-dimensional axi-symmetric cases that use the wedge patch type described in section 5.e. There are some additional recommendations to ensure successful me rge procedures: in 2 dimensional geometries. as the user can see in a boundary file for such a case. so that its cylindrical shape is correc tly preserved. T his is a block face of zero area which creates a patch with no faces in the poly Mesh.8.3 Creating blocks with fewer than 8 vertices It is possible to collapse one or more pair(s) of vertices onto each other in or der to create a block with fewer than 8 vertices.4 Running blockMesh As described in section 3. the size of the cells in the third dimension.e. this is done. The mesh is generated by running blockMesh on this blockMeshDict file.

as in many other CFD packages. vi. e. such as emacs. etc. The case directory is given a suitably descriptive name. A case being simulated involves data for mesh. cd $FOAM_RUN/tutorials/incompressible/icoFoam/cavity (From ch4) The tutorial cases that accompany the OpenFOAM distribution provide useful examp les of the case directory structures. The block structure is shown in Figure 2. fields. Users can view tutorial examples at their leisure while reading this chapter. Any mistakes in the blockMeshDict file are picked up by blockMesh and the resulting error me ssage directs the user to the line in the file where the problem occurred. E diting files is possible in OpenFOAM because the I/O uses a dictionary format wi th keywords that convey sufficient meaning to be understood by even the least ex perienced users. In preparati on of editing case files and running the first cavity case. As described in section 4.blockMesh The running status of blockMesh is reported in the terminal window. kate. reached quickly by executing the tut alias at the command line . There should be no error messages at this stage. g. in OpenFOAM this data is stored in a se t of files within a case directory rather than in a single case file. Users should select an xedito r of choice with which to do this. the first example case for this tutorial is simply named cavity. The tutorials are located in the $FOAM_TUT ORIALS directory. The cavity domain consists of a square of side length d = 0.1. gedit. properties. the user should chan ge to the case directory cd $FOAM_RUN/tutorials/incompressible/icoFoam/cavity . Cases are setup in OpenFOAM by editing case files. control param eters.2.1 m \relax \special {t4ht= in the x \relax \special {t4ht=-y \relax \special {t4ht= plane. etc. nedit. A uniform mesh of 20 by 20 cells will be used initially.

------------------------------------------------------------------[lev@trifid ~]$ [lev@trifid ~]$ [lev@trifid ~]$ icoFoam -help Usage: icoFoam [OPTIONS] options: -case <dir> specify alternate case directory.OpenFOAM. it is recommended that the user copy the tutorials directory into their local run directory.1.1. For example. a ll the icoFoam cases are stored within a subdirectory incompressible/icoFoam.1/OpenFOAM-2.1.The tutorial cases describe the use of the blockMesh pre-processing tool. Those user s with access to third-party post-processing tools supported in OpenFOAM have an option: either they can follow the tutorials using paraFoam. They can be easily copied by typing: [lev@trifid ~]$ module load openfoam You now need to source the $foamDotFile.1.1/etc/bashrc You now need to source the $foamDotFile.1) FOAM_INST_DIR /usr/local/openfoam/2.1. default is the cwd -noFunctionObjects do not execute functionObjects -parallel run in parallel -roots <(dir1 .. [lev@trifid ~]$ . wh ere incompressible indicates the type of flow. or refer to the de scription of the use of the third-party product in chapter 6 when post-processin g is required.org) Build: 2. The tutorials are organised into a set of directories according to the type of flow and then subdirectories according to solver. Copies of all tutorials are available from the tutorials directory of the OpenFO AM installation.1. dirN)> slave root directories for distributed running -srcDoc display source code in browser -doc display application documentation in browser -help print the usage Using: OpenFOAM-2. Either type '.1. $foamDotFile [lev@trifid ~]$ openfoam -bash: openfoam: command not found [lev@trifid ~]$ module display openfoam ------------------------------------------------------------------/usr/local/Modules/modulefiles/openfoam/2.1: module-whatis setenv setenv The OpenFOAM fluid dynamics simulator. $foamDotFile' in your terminal. (v2. or add 'source $foamDotFile' to your script. or add 'source $foamDotFile' to your script. $foamDotFile' in your terminal.1 (see www.1-221db2718bbb . If the user wishes to run a range of example cases. case s etup and running OpenFOAM solvers and post-processing using paraFoam. Either type '.1 foamDotFile /usr/local/openfoam/2.

1. fileModificationChecking : Monitoring run-time modified files using timeStampMas ter allowSystemOperations : Disallowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Creating block mesh from "/nfs/user2/lev/OpenFOAM/lev-2. Creating Creating Creating Creating polyMesh from blockMesh patches cells points with scale 0.1 [lev@trifid ~]$ cp -r $FOAM_TUTORIALS $FOAM_RUN [lev@trifid ~]$ cd $FOAM_RUN/tutorials/incompressible/icoFoam/cavity [lev@trifid cavity]$ [lev@trifid cavity]$ blockMesh /*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1/run/tutorials/incompressible/icoFoam/ cavity nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).[lev@trifid ~]$ mkdir -p $FOAM_RUN [lev@trifid ~]$ ls -l ~/OpenFOAM/ total 0 drwxr-xr-x 3 lev vpac 22 Sep 25 09:15 FOAM_RUN drwxr-xr-x 3 lev vpac 16 Dec 18 10:18 lev- Exec : blockMesh Date : Dec 18 2012 Time : 10:26:56 Host : "trifid" PID : 9910 Case : /nfs/user2/lev/OpenFOAM/lev-2.1 | | \\ / A nd | Web: www.1.1/run/tutorials/incompressible/icoFoam/cavi ty/constant/polyMesh/blockMeshDict" Creating curved edges Creating topology blocks Creating topology patches Creating block mesh topology Check topology Basic statistics Number of Number of Number of Number of Checking patch -> Creating block offsets Creating merge list .org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.1 internal faces : 0 boundary faces : 6 defined boundary faces : 6 undefined boundary faces : 0 block consistency Writing polyMesh .1.OpenFOAM.

cfd-online.com/Forums/openfoam/78167-parafoam-does-not-show-results-c avity-tutorial.openfoam.org/docs/user/index. and ut ilities.html http://www.openfoam.---------------Mesh Information ---------------boundingBox: (0 nPoints: 882 nCells: 400 nFaces: 1640 nInternalFaces: ---------------Patches ---------------patch 0 (start: patch 1 (start: patch 2 (start: End 0 0) (0. One of the strengths of OpenFOAM is that new solvers and utilities can be created by its users. t hat are each designed to solve a specific problem in continuum mechanics.org/download/ubuntu. . known as applications.1 0.html Chapter 1 Introduction ---------------------OpenFOAM is first and foremost a C++ library. but watch directories! http://www.01) 760 760 size: 20) name: movingWall 780 size: 60) name: fixedWalls 840 size: 800) name: frontAndBack From: The OpenFOAM User's Guide =============================== http://www.php NOTE: This does work. used primarily to create executabl es.com/Forums/blogs/wyldckat/232-list-threads-usefu l-building-openfoam-other-third-party-tools. The applications fall into two categories: solvers. that are designed to perform tasks that involve data manipulation.php See also: http://www.cfd-online.1 0.

$ $ $ $ module load openfoam/1.g. run and post-process a case invo lving isothermal.g. This data is stor ed in a set of files within a case directory rather than in a single case file. The mesh generator supplied with OpenFOAM.. 2. The case is set up to start at time t = 0. incompressible flow in a two-dimensional square domain. blockMeshDict located in the constan t/polyMesh directory for a given case. e.Chapter 2 Tutorials ------------------Copies of all tutorials are available from the tutorials directory of the OpenFO AM installation. simply by typing in the terminal: $ blockMesh $ ls constant/polyMesh/ blockMeshDict boundary s faces neighbour owner point boundary and blockMashDict have become executable. 2. etc. the user can look at this initial fields s et up for this case.1/tutorials/ .1 # Because I'm on a cluster mkdir -p ~/OpenFOAM/FOAM_RUN cd ~/OpenFOAM/FOAM_RUN cp -r /usr/local/openfoam/1. $ less constant/polyMesh/blockMeshDict The mesh is generated by running blockMesh on this blockMeshDict file. p and U. blockMesh. OpenFOAM solves the case in 3 dimensio ns by default but can be instructed to solve in 2 dimensions by specifying a ‘spec ial’ empty boundary condition on boundaries normal to the (3rd) dimension for whic h no solution is required. From with in the case directory. control parameters. Let us examine f ile p: . generates meshes from a de scription specified in an input dictionary. one for each of the pressure p and velocity U f ields whose initial values and boundary conditions must be set. Once the mesh generation is complete. the first example case for this tutorial is simply named cavity. In preparation of editing case f iles and running the first cavity case. e. this is done. properties. A case being simulated involv es data for mesh.7.1 Pre-processing Cases are setup in OpenFOAM by editing case files. The case directory is given a suitably descriptive name. fields. The 0 sub-dire ctory contains 2 files.7. so the initial f ield data is stored in a 0 sub-directory of the cavity directory.1 Lid-driven cavity flow -------------------------This tutorial will describe how to pre-process. The tutorials are organised into a set of directories according to the type of flow and then subdirectories according to solver. the user should change to the case direc tory $ cd $FOAM_RUN/tutorials/incompressible/icoFoam/cavity OpenFOAM always operates in a 3 dimensional Cartesian coordinate system and all geometries are generated in 3 dimensions.1.

With a time step of 0. similarly in the system directory. The user is free to view these dictionaries but we do not need to discuss all their entries at this stage excep t for pRefCell and pRefValue in the PISO sub-dictionary of the fvSolution dictio nary. I n the icoFoam solver. 0. here we select the timeStep option which specifies that results are written every nth time step where the value n is specified under th e writeInterval keyword. it is located in the system directory. on ea ch occasion that it writes a set of data. The user should view this f ile.$ less 0/p $ less 0/U The physical properties for the case are stored in dictionaries whose names are given the suffix …Properties. e.5 s.0 $ paraFoam Typical Structure of a Chapter Objectives Revision of Physics and Numerics associated with the Example How to do it in OpenFOAM . 0. the only property that must be specified is the kinematic viscosity which is stored from the transportProperties dictionary. $less system/controlDict The writeControl keyword presents several options for setting the time at which the results are written. it writes out the results for each field. 0.1. The paraFoam post-processing is started by typing in the terminal from withi n the case directory. $ less constant/transportProperties Input data relating to the control of time and reading and writing of the soluti on data are read in from the controlDict dictionary.4. OpenFOAM creates a new directory named after the current time. The mesh is viewed in paraFoam.1 s.1. located in the Dictionaries directory tree.2. into th e time directories. $ less system/fvSchemes $ less system/fvSolution Before the case is run it is a good idea to view the mesh to check for any error s. this assumes Paraview has been loaded $ module load paraview/3. The user specifies the choice of finite volume discretisation schemes in the fvS chemes dictionary in the system directory. we therefore need to output resu lts at every 20th time time step and so we set writeInterval to 20. For an i coFoam case. as discussed in full in section 4.…. But of course.005 s. The specification of the linear equat ion solvers and tolerances and other algorithm controls is made in the fvSolutio n dictionary. U and p. as a case control file. Let us decide that we wish to write our results at time s 0.g. The user can check tha t the kinematic viscosity is set correctly by opening the transportProperties di ctionary to view/edit its entries. the post-processing tool supplied with OpenFO AM.

set up boundary conditions and choose the correct solver for this case. Chapter 1: Get Familiar with Linux and OpenFOAM Estimated Page Count : 25 You become familiar with the Linux environment. Structure of a case: Cavity flow example Mesh generation: BlockMeschDict Setting up a simulation: ControlDict Boundary conditions and fvschemes Visualization in Paraview Chapter 3: Your First Case: Heat Transfer .Convection Estimated Page Count : 20 Follow the steps to import a geometry from any CAD program and generate OpenFOAM mesh. You learn to modify and compile an OpenFOAM solver.Conduction Estimated Page Count : 25 You create a geometry using blockMeshDict.Post Processing the results Comments and Summary Preface Estimated Page Count : 5 Open Source philosophy and the spirit of Linux community. run a simulation and visualize the results. etc). And choose a solver to couple fluid and solid regions. Guide to install OpenFOAM the si mplest way and the common installation and project directories. Modelling such turbulent fl . Basic Linux commands useful for OpenFOAM Text editors (kwrite. Fourier equation of heat transfer 3D conduction example with/without source terms Boundary Conditions: FunkySetFields Post Processing: Temperature distribution plots Chapter 4 Solver Modification: Laminar Flow over cylinder Estimated Page Count : 25 Equations that describe the fluid flow and their implementation in OpenFOAM are discussed. And what to expect in the book. • • • • Navier-Stokes Equations icoFoam solver Laminar Vortex shedding Post Processing: Boundary Layers Chapter 5: Mesh Manipulation: Heat Transfer . What is CFD? OpenFOAM development and usage. How to set up your fi rst OpenFOAM case. kate. • • • Example: Electronic Cooling or Heat Exchanger SnappyHexMesh MultiRegionFoam Chapter 6: Turbulence Modelling: External Aerodynamics Estimated Page Count : 25 Simulating flow around a body has wide applications. Installation of OpenFOAM Chapter 2: Structure of an OpenFOAM Case Estimated Page Count : 25 A simulation project in OpenFOAM is referred to as a case.

• • Example of breaking of dram and rain droplet. Running simulations in Parallel are explained with example. like Internal Combustion Engines and rotating machinery. Defining the mesh motion in OpenFOAM is covered in this chapter.vespalabs. • • • • Example: Ahmed Body LES/RANS methods for solution of Navier-Stokes Equations Turbulence Models in OpenFOAM Wall Functions in OpenFOAM Chapter 7: Running in Parallel: Multiphase Flows Estimated Page Count : 25 Two phase flows are of interest in environmental engineering and in chemical ind ustries.org/Projects/Vespa_CFD%2F%2F3D_Model/OpenFOAM_Vespa_Tutoria l .ows with LES/RANS is studied through example.vespalabs. Parallel run (MPI. • • Moving Mesh Combustion simulation in IC Engines Chapter 9: Lagrangian Particle Tracking Estimated Page Count : 25 Lagrangian particle tracking is used generally to model the dispersion of pollut ants in fluids and to understand the various occurring transport phenomena. decompose par. • • • Lagrangian Solver Von Karman Street Vortex Post processing: Foam to VTK Total Estimated Page Count = 220 Vespa Examples http://www. The problem sizes are often large and needs to be solved in multiple co res.org/Projects/Vespa_CFD%2F%2F3D_Model http://www. etc) Chapter 8: Dynamic Mesh : Combustion Estimated Page Count : 20 Many practical problems involve Moving Meshes. Thi s chapter discusses how to setup an injection model.

Sign up to vote on this title
UsefulNot useful