Hands-On Training With OpenFOAM - Flow Around A 2-D Airfoil

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

Hands-On Training with OpenFOAM

Flow Around a 2-D Airfoil


Hrvoje Jasak
[email protected]

Faculty of Mechanical Engineering and Naval Architecture University of Zagreb, Croatia

Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012

Hands-On Training with OpenFOAM p. 1

Outline
Summary of Objectives: Basic Code and Case Structure Basic structure of the OpenFOAM case and CFD runs Tutorial Steps 1. Basic review of case organisation 2. Convert the mesh generated in Pointwise 3. constant/polyMesh/boundary: set wall patch type 4. Set material properties: viscosity; turbulence model 5. 0 directory: set initial and boundary conditions for ow elds 6. checkMesh: analysis of mesh quality 7. Flow solver: sonicFoam 8. Basic post-processing with FieldView 9. Utilities and data manipulation: Mach number, forceCoeffs function object 10. Further post-processing 11. Basic review of solver and discretisation parameters

Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012

Hands-On Training with OpenFOAM p. 2

Geometry and Flow Conditions


Case Setup Transient compressible turbulent ow simulation Material properties: air as ideal gas with constant properties (name, nMoles, molWeight, Cv, Hf, mu, 1/Pr) Inlet/far eld conditions: u = (242.43 0 0) m/s pinf = 85419 Pa = 2688.26 m2 /s3 T = 260 K

k = 220.4 m2 /s2

Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012

Hands-On Training with OpenFOAM p. 3

OpenFOAM Case Structure


<case>
Data Organisation and Management

system controlDict fvSchemes fvSolution constant . . . Properties polyMesh points faces owner neighbour boundary time directories

Unlike standard CFD practice, in OpenFOAM case is a directory: each self-contained piece of heavy-weight data stored in its own le Light-weight data is presented in dictionary form: keyword-value pairs in free format. It can be changed and re-read during the run: solution steering Mesh data split into components for efcient management of moving mesh cases Time directories contain solution and derived elds (one per le) Support for compressed I/O: more efcient I/O and less disk space

Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012

Hands-On Training with OpenFOAM p. 4

OpenFOAM Simulation: Data I/O


Data Input and Output Dictionary format: le header (IOobject) and keyword-value entry pairs
FoamFile { version format class object }

2.0; ascii; dictionary; transportProperties;

// Diffusivity DT DT [0 2 -1 0 0 0 0] 0.01;

Contents of dictionaries depends on their role Material properties and physical model constants Solution elds, initial and boundary conditions Discretisation settings, solver controls I/O parameters etc.

Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012

Hands-On Training with OpenFOAM p. 5

OpenFOAM Simulation: Controls


Basic Controls: controlDict Basic controls of run start, end and write frequency
startFrom startTime stopAt endTime deltaT writeControl writeInterval startTime; 0; endTime; 2500; 1; timeStep; 50; // runTime // clockTime // cpuTime // latestTime // firstTime

// writeNow // nextWrite

writeFormat ascii; // binary writePrecision 6; writeCompression uncompressed; // compressed timeFormat timePrecision general; 6; // fixed // scientific

runTimeModifiable yes;
Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012

Hands-On Training with OpenFOAM p. 6

OpenFOAM Simulation: Schemes


Basic Controls: fvSchemes Equation discretisation controls: per-term basis
ddtSchemes { default steadyState; } gradSchemes { default cellLimited leastSquares 1.0; // grad(p) Gauss linear; } divSchemes { default none; div(phi,U) Gauss linearUpwindV Gauss linear; div(phi,k) Gauss upwind; div(phi,omega) Gauss upwind; div((nuEff*dev(grad(U).T()))) Gauss linear; }

Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012

Hands-On Training with OpenFOAM p. 7

OpenFOAM Simulation: Schemes


Basic Controls: fvSchemes Equation discretisation controls, Contd
laplacianSchemes { default Gauss linear limited 0.5; } interpolationSchemes { default linear; interpolate(U) linear; } snGradSchemes { default limited 0.5; } fluxRequired { default no; p; }

Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012

Hands-On Training with OpenFOAM p. 8

OpenFOAM Simulation: Solution


Basic Controls: fvSolution Linear equation solver settings: per equation in top-level solver
solvers { p { solver preconditioner tolerance relTol PCG; DIC; 1e-8; 0.01;

} U {
solver preconditioner tolerance relTol PBiCG; DILU; 1e-07; 0;

} }
Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012 Hands-On Training with OpenFOAM p. 9

OpenFOAM Simulation: Solution


Basic Controls: fvSolution Global algorithmic settings and under-relaxation factors
PISO { momentumPredictor yes; nCorrectors 2; nNonOrthogonalCorrectors 0; nAlphaCorr 1; nAlphaSubCycles 2; cAlpha 1;

} relaxationFactors { p U k omega }

0.3; 0.7; 0.7; 0.7;

Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012

Hands-On Training with OpenFOAM p. 10

OpenFOAM Simulation: Mesh


Basic Controls: Structure of Mesh Files Mesh les at start of simulation located in constant/polyMesh directory points, faces: basic lists of primitive entries owner, neighbour: lists of face-to-cell addressing Note: OpenFOAM uses strongly ordered face lists for efciency
11M 37M 4.0M 14M 1.8K 2011-07-22 2011-07-22 2011-07-22 2011-07-22 2011-07-22 11:19 11:19 11:19 11:19 11:19 points faces owner neighbour boundary

Additional mesh les: sets and zones, mesh modiers, parallel mapping etc.
586 24K 868K 78K 4.0K 2011-03-14 2011-03-14 2011-03-14 2011-03-14 2011-03-14 09:43 09:43 09:43 09:43 09:43 pointZones faceZones cellZones meshModifiers sets/

Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012

Hands-On Training with OpenFOAM p. 11

OpenFOAM Simulation: Mesh


Basic Controls: Structure of Mesh Files Boundary denition: patch types and strong ordering
( Wing { type nFaces startFace wall; 154; 23579; <-- patch name <-- constrained patch type <-- number of faces <-- start face in face list

} FrontAndBack { type nFaces startFace } Inlet { type nFaces startFace ...

empty; 30712; 23733;

<-- constrained patch type

patch; 74; 54445;

<-- (free) patch type

Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012

Hands-On Training with OpenFOAM p. 12

OpenFOAM Simulation: Mesh


Basic Controls: Structure of Mesh Files Boundary denition: patch types
... Slip { type nFaces startFace patch; 148; 54519;

} leftPlane { type nFaces startFace }


)

symmetryPlane; 74; 54667;

Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012

Hands-On Training with OpenFOAM p. 13

OpenFOAM Simulation: Fields


Field: Initial and Boundary Conditions Denition of initial and boundary conditions, per-eld basis
dimensions internalField boundaryField { Body-4 { type value } Inlet-12 { type value } Slip-10 { type } ... [0 1 -1 0 0 0 0]; // [kg m s K mol A Cd] uniform (40 0 0);

fixedValue; uniform (0 0 0);

fixedValue; uniform (40 0 0);

slip;

Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012

Hands-On Training with OpenFOAM p. 14

OpenFOAM Simulation: Fields


Field: Initial and Boundary Conditions Denition of initial and boundary conditions, Contd Fields located in time directories: 0/p, 0/U Boundary conditions dened on a per-eld basis Note: consistency of boundary conditions related to the physics solver

Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012

Hands-On Training with OpenFOAM p. 15

OpenFOAM Simulation: Utilities


Basic Controls: Utility Controls Utility controls based under system. Example:
numberOfSubdomains 4; method metis;

globalFaceZones ( insideZone outsideZone ); simpleCoeffs { n delta }

(4 1 1); 0.0001;

metisCoeffs { processorWeights 4( 1 1 1 1 ); } roots ();

Cyprus Advanced HPC Workshop Winter 2012. Tracking: FH6190763 Feb/2012

Hands-On Training with OpenFOAM p. 16

You might also like