Basic Training
Basic Training
Hrvoje Jasak
[email protected]
Wikki Ltd, United Kingdom and FSB, University of Zagreb, Croatia 7-9th June 2007
Open FOAM
Open FOAM
Open FOAM
Object Orientation
Object-Oriented Software Analysis of numerical simulation software through object orientation: Recognise main objects from the numerical modelling viewpoint Objects consist of data they encapsulate and functions which operate on the data Example: Sparse Matrix Class Data members Sparse addressing pattern (CR format, arrow format) Diagonal coefcients, off-diagonal coefcients Operations on matrices or data members Matrix algebra operations: +, , , /, Matrix-vector product, transpose, triple product, under-relaxation Actual data layout and functionality is important only internally: efciency Example: Linear Equation Solver Operate on a system of linear equations Ax = b to obtain x It is irrelevant how the matrix was assembled or what shall be done with solution Ultimately, even the solver algorithm is not of interest: all we want is new x! Gauss-Seidel, AMG, direct solver: all answer to the same interface
Open FOAM
Object Orientation
Basic Components Scalars, vectors and tensors with algebra Computational mesh; mesh motion, adaptive renement, topological changes Fields (scalar, vector, tensor) and boundary conditions: Dirichlet, Neumann etc. Sparse matrix support with linear solver technology Discretisation Classes Implemented as interpolation, differentiation and discretisation operators All discretisation methods use identical basic components, e.g. common mesh and matrix support. Better testing and more compact software implementation Physical Modelling Libraries and Top-Level Solvers Libraries encapsulate interchangeable models with common interfaces New models provide functionality adhering to common interface Custom-written and optimised top-level solvers for class of physics Utilities Common functionality is needed for most simulation methods Example: problem setup, mesh manipulation, data analysis
Open FOAM
Tutorials
Running OpenFOAM 1. Laminar uid ow in a lid-driven cavity Pre-processing with FoamX Case structure and dictionary format Running OpenFOAM Basic post-processing Create a graded mesh, map a solution and repeat a simulation 2. Free surface ow: dam break problem Pre-processing using le editors and command line Multi-block mesh generation with blockMesh Setting non-uniform initial eld Post-processing: create an animation Running OpenFOAM on multiple processors
Open FOAM
Lid-Driven Cavity
Flow in a Lid-Driven Cavity: Case Setup
Ux = 1 m/s
d = 0.1 m y x
Open FOAM
Lid-Driven Cavity
Mesh Generation: blockMesh
3 7
2 6
y
0
x z
4
1 5
OpenFOAM Tutorials: Basic Session p.8/19
Open FOAM
Lid-Driven Cavity
Dimensions and Properties Domain size: 0.1 0.1 m Lid velocity 1 m/s Kinematic viscosity: 0.01 m2 /s Simulation Settings Start time = 0 End time = 0.5 s Time step: t = 0.005 s Sampling Lines (0.0500.0005) to (0.050.10.0005) (0.0500.0005) to (0.050.10.0005)
Open FOAM
Lid-Driven Cavity
Phases of Simulation Mesh generation Boundary conditions Discretisation control Running the simulation Graphical post-processing Velocity magnitude Sampling lines Mesh Renement Mesh generation Solution mapping Running the simulation Graphical post-processing
Open FOAM
Open FOAM
Open FOAM
Open FOAM
empty;
Open FOAM
<case>
system controlDict fvSchemes fvSolution constant . . . Properties polyMesh points cells faces boundary time directories
Open FOAM
0.292 m
1111 0000 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111 0000 1111
0.146 m
water column
0.584 m
0.048 m 0.024 m
OpenFOAM Tutorials: Basic Session p.16/19
Open FOAM
Open FOAM
Open FOAM
Open FOAM