Openfoam
Hrvoje Jasak
h.jasak@wikki.co.uk
Wikki Ltd, United Kingdom FSB, University of Zagreb, Croatia 18/Nov/2005
OpenFOAM:An Introduction – p.1/22
Outline
Objective: A high-level overview of OpenFOAM • Present a novel way of handling software implementation in numerical mechanics Topics • Requirements on modern CFD software • A new approach to model representation• Mesh handling and polyhedral support • Pre-implemented capabilities
OpenFOAM:An Introduction – p.2/22
Background
State of the Art • Numerical modelling part of product design ◦ Improvements in computer performance ◦ Improved physical modelling and numerics ◦ Sufficient validation and experience • Two-fold requirements ◦ Models for wide area of physics + coupling ◦ Complex geometry,high-performance computing, automatic meshing etc.
OpenFOAM:An Introduction – p.3/22
Background
Requirements on Software Design • Industrial Environment ◦ Integration into CAD-based process ◦ Complex geometry and automatic meshing ◦ Robust, fast and accurate solvers • Research Organisations ◦ Quick and reliable model implementation ◦ Experimentation with various model forms ◦ Separation betweenphysics and numerics
OpenFOAM:An Introduction – p.4/22
Numerics for CCM
How to handle complex models in software? • Natural language of continuum mechanics: partial differential equations ∂k + ∇•(uk) − ∇•[(ν + νt )∇k] = ∂t 2 ǫo 1 T (∇u + ∇u ) − k νt 2 ko • Main object = operator, e.g. time derivative, convection, diffusion, gradient
OpenFOAM:An Introduction – p.5/22
OpenFOAM: CCM inC++
OpenFOAM (Field Operation and Manipulation):
Represent equations in their natural language
solve ( fvm::ddt(k) + fvm::div(phi, k) - fvm::laplacian(nu() + nut, k) == nut*magSqr(symm(fvc::grad(U))) - fvm::Sp(epsilon/k, k) );
OpenFOAM:An Introduction – p.6/22
Object Orientation
Recognise main objects from the numerical modelling viewpoint • Computational domain
Object Time Tensor Meshprimitives Space Software representation Time steps (database) (List of) numbers + algebra Point, face, cell Computational mesh C++ Class time vector, tensor Point, face, cell polyMesh
OpenFOAM:An Introduction – p.7/22
Object Orientation
• Field algebra
Object Field Boundary condition Dimensions Geometric field Field algebra Software representation List of values Values + conditionDimension Set Field + boundary conditions + − ∗ / tr(), sin(), exp() . . . C++ Class Field patchField dimensionSet geometricField field operators
• Matrix and solvers
Object Linear equation matrix Solvers Software representation Matrix coefficients Iterative solvers C++ Class lduMatrix lduMatrix::solver
OpenFOAM:An Introduction – p.8/22
Object Orientation
• Numerics
Object InterpolationDifferentiation Discretisation Software representation Differencing schemes ddt, div, grad, curl ddt, d2dt2, div, laplacian C++ Class interpolation fvc, fec fvm, fem, fam
Implemented Methods: Finite Volume, Finite Element, Finite Area and Lagrangian tracking • Top-level organisation
Object Model library Application Software representation Library main() C++ Class turbulenceModel –
OpenFOAM:AnIntroduction – p.9/22
Model Interaction
Common Interface for Related Models
class turbulenceModel { virtual volTensorField R() const = 0; virtual fvVectorMatrix divR ( volVectorField& U ) const = 0; virtual void correct() = 0; }; class SpalartAllmaras : public turbulenceModel{};
OpenFOAM:An Introduction – p.10/22
FOAM: CCM in C++
Model-to-Model Interaction
fvVectorMatrix UEqn (fvm::ddt(rho, U) + fvm::div(phi, U) + turbulence->divR(U) == - fvc::grad(p) );
New components do not disturb existing code
OpenFOAM:An Introduction – p.11/22
Run-Time Selection
• Model-to-model interaction through common interfaces (virtual base classes) • New components do not disturb existing code • Run-time selection tables: dynamic binding • Used for every implementation: “user-coding”...
Regístrate para leer el documento completo.