Session 3. Numerical problem C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Institute for Polymers and Composites (i3N), University of Minho C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
CloudPYME Project El proyeto CloudPYME (id: 0682 CLOUDPYME2 1 E) est´ a cofi- nanciado por la Comisi´ on Europea a trav´ es de el Fondo Europeo de Desarrollo Regional (FEDER), dentro de la tercera convocatoria de proyectos del Programa Operativo de Cooperaci´ on Transfronteriza Espa˜ na-Portugal 2007-2013 (POCTEP). C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Problem description This tutorial will describe how to pre-process , run and post- process a case involving isothermal , incompressible flow in a two- dimensional square domain. The geometry is shown in Fig. 1 in which all the boundaries of the square are walls. The top wall moves on the x-direction at a speed of 1 m/s while the other 3 are station- ary. Figure 1: Geometry of the lid driven cavity C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Pre-processing Cases are setup in OpenFOAM by editing case files. A case being simulated involves data for mesh , fields , properties , control pa- rameters , etc. In OpenFOAM this data is stored in a set of files within a case directory. To access the cavity case, the user should change to the case directory: >> cd $FOAM RUN/cavity C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Mesh generation The cavity domain consists of a square of side length d = 0.1 m in the x-y plane. A uniform mesh of 20 by 20 cells will be used initially. The block structure is shown in Fig. 2. Figure 2: Block structure of the mesh for the cavity C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Mesh generation The mesh generator supplied with OpenFOAM , blockMesh , gen- erates meshes from a description specified in an input dictionary, blockMeshDict located in the constant/polyMesh directory for a given case. The blockMeshDict entries for this case, Fig. 3, are as follows: C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Mesh generation C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Mesh generation C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Mesh generation Figure 3: BlockMeshDict file for the cavity case C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Mesh generation The mesh is generated by running blockMesh on this blockMesh- Dict file. From within the case directory, this is done, simply by typing in the terminal: >> blockMesh > log blockMesh C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Mesh generation The file log blockMesh, Fig. 4, contains the information related to the generation of the mesh: C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Mesh generation Figure 4: blockMesh output C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Mesh generation To check if any error is obtained during the mesh generation we can type: >> checkMesh > log checkMesh C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Mesh generation The file log checkMesh, Fig. 5, contains the information related to the mesh statistics and topology : C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Mesh generation Figure 5: checkMesh output C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Boundary and initial conditions Once the mesh generation is complete, the user can look at initial fields set up for this case. The case is set up to start at time t = 0 s, so the initial field data is stored in a 0 sub-directory of the cavity directory. The 0 sub-directory contains 2 files, p and U , one for each of the pressure (p) and velocity (U) fields whose initial values and boundary conditions must be set. C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Boundary and initial conditions Let us examine file p, Fig. 6: Figure 6: Pressure initial conditions C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Boundary and initial conditions For those using the incompressible solvers ( icoFoam , simpleFoam , pisoFoam , pimpleFoam ), we need to remind that the pressure used by these solvers is the modified pressure or P = p /ρ . So do not forget to multiply the pressure by the density in order to get the physical pressure. C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Boundary and initial conditions Let us examine file U, Fig. 7: Figure 7: Velocity initial conditions C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Physical properties The physical properties for the case are stored in dictionaries whose names are given the suffix . . . Properties , located in the constant directory tree. For this case, the only property that must be speci- fied is the kinematic viscosity which is stored from the transport- Properties dictionary. C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Physical properties The keyword for kinematic viscosity is nu ( ν ). This case will be run with a Reynolds number of 10, where the Reynolds number is defined as: Re = d | U | ν Here d = 0 . 1 m, | U | = 1 m / s , so that for Re = 10, ν = 0 . 01 m 2 / s . The correct file entry, Fig. 8, for kinematic viscosity is thus specified below: Figure 8: Transport properties file C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Control Input data relating to the control of time and reading and writing of the solution data are read in from the controlDict dictionary. C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Control To achieve temporal accuracy and numerical stability when running icoFoam , a Courant number of less than 1 is required. The Courant number is defined for one cell as: Co = δ t | U | δ x Therefore to achieve a Courant number less than or equal to 1 throughout the domain the time step deltaT must be set to less than or equal to: δ t = Co δ x = 1 × 0 . 005 = 0 . 005 s | U | 1 C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Control For this case, the entries in the controlDict , Fig. 9, are shown below: Figure 9: Control dictionary file C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Discretisation and linear-solver settings The user specifies the choice of finite volume discretisation schemes in the fvSchemes dictionary in the system directory. The specifica- tion of the linear equation solvers and tolerances and other algorithm controls is made in the fvSolution dictionary, similarly in the system directory. C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Discretisation and linear-solver settings For this case, the entries in the fvSchemes , Fig. 10, are shown below: Figure 10: fvSchemes dictionary file C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Discretisation and linear-solver settings Other discretization schemes are available, Fig. 11: C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Discretisation and linear-solver settings Figure 11: fvSchemes options C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Discretisation and linear-solver settings For this case, the entries in the fvSolution , Fig. 12, are shown below: Figure 12: fvSolution dictionary file C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Discretisation and linear-solver settings Fig. 13 shows other options for the fvSolution file: Figure 13: fvSolution options C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Discretisation and linear-solver settings In a closed incompressible system such as the cavity, pressure is relative : it is the pressure range that matters not the absolute values. In cases such as this, the solver sets a reference level by pRefValue in cell pRefCell . In this example both are set to 0. Changing either of these values will change the absolute pressure field, but not, of course, the relative pressures or velocity field. C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Viewing the mesh Before the case is run it is a good idea to view the mesh to check for any errors. The mesh is viewed in paraFoam , the post-processing tool supplied with OpenFOAM . The paraFoam post-processing is started by typing in the terminal from within the case directory >> paraFoam or >> touch cavity.foam >> paraview cavity.foam C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Viewing the mesh Fig. 14 shows the mesh visualized in Paraview. Figure 14: Mesh C. Fernandes, L.L. Ferr´ as, J.M. N´ obrega Session 3. Numerical problem
Recommend
More recommend