Download - BAESystems_10Mar2005
-
8/2/2019 BAESystems_10Mar2005
1/29
Object-Oriented CFDSolver Design
Hrvoje Jasak
Wikki Ltd. United Kingdom
10/Mar2005
Object-Oriented CFD Solver Design p.1/2
-
8/2/2019 BAESystems_10Mar2005
2/29
OutlineObjective
Present new approach to software design inComputational Continuum Mechanics
Topics A new approach to model representation
Object-orientation in numerical simulationsoftware: code re-use and layered design
Examples of complex model implementation
Object-Oriented CFD Solver Design p.2/2
-
8/2/2019 BAESystems_10Mar2005
3/29
BackgroundState of the Art
Numerical modelling is becoming a part ofproduct design
Improved computing performance Improved modelling
Sufficient validation and experience
Two-fold requirements
Ease of use and process integration
Quick and reliable model implementation
Object-Oriented CFD Solver Design p.3/2
-
8/2/2019 BAESystems_10Mar2005
4/29
Software DesignPhysics-based approach
Traditional view of the problem
Well defined physics, studied in isolation
Clearly defined objective
Numerical software sometimes limitingdesign: e.g. Lockheed Martin F-117 Stealth
Typically handled by monolithic software with
well-defined capabilities
Object-Oriented CFD Solver Design p.4/2
-
8/2/2019 BAESystems_10Mar2005
5/29
Software DesignApplication-based approach
A collection of components involving variousphysics phenomena (beyond CFD)
Complex model-to-model interaction Complex simulation and optimisation
objectives, unexpected conclusions
Made-to-measure modelling
Requires more flexible software design:
can object orientation help?
Object-Oriented CFD Solver Design p.5/2
-
8/2/2019 BAESystems_10Mar2005
6/29
FOAM: CCM in C++FOAM: Field Operation and Manipulation
Natural language of continuum mechanics:partial differential equations
kt
+ (uk) [(+ t)k] =
t1
2(u + uT
)2
oko k
Object-Oriented CFD Solver Design p.6/2
-
8/2/2019 BAESystems_10Mar2005
7/29
FOAM: CCM in C++Objective: Represent equations in software in
the 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)
);
Object-Oriented CFD Solver Design p.7/2
-
8/2/2019 BAESystems_10Mar2005
8/29
FOAM: CCM in C++Object Software representation C++ Class
Space and time Mesh + time (database) polyMesh, timeTensor (List of) numbers + algebra vector, tensor
Field List of values Field
Boundary condition Values + condition patchField
Geometric fi eld Field + boundary conditions geometricField
Field algebra + / tr(),sin(),exp() . . . fi eld operators
Interpolation Differencing schemes interpolation
Differentiation ddt, div, grad, curl fvc, fec
Matrix Matrix coeffi cients lduMatrix
Discretisation ddt, d2dt2, div, laplacian fvm, fem, fam
Model library Library turbulenceModel
Application main()
Object-Oriented CFD Solver Design p.8/2
-
8/2/2019 BAESystems_10Mar2005
9/29
FOAM: CCM in C++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{};
Object-Oriented CFD Solver Design p.9/2
-
8/2/2019 BAESystems_10Mar2005
10/29
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
Object-Oriented CFD Solver Design p.10/2
-
8/2/2019 BAESystems_10Mar2005
11/29
Geometry HandlingComplex geometry requirements
Complex geometry is a rule, not exception
Polyhedral cell support
Cell described as a polyhedron boundedby polygons
Consistent handling of all cell types
More freedom in mesh generation
Recent developments: polyhedral FVM
provides equivalent accuracy at lower cost
Object-Oriented CFD Solver Design p.11/2
-
8/2/2019 BAESystems_10Mar2005
12/29
Geometry Handling
Object-Oriented CFD Solver Design p.12/2
-
8/2/2019 BAESystems_10Mar2005
13/29
Geometry HandlingTime-varying geometry cases
Automatic mesh motion
Topological mesh changes with poly support
Object-Oriented CFD Solver Design p.13/2
http://./movies/mixer2D-anim.mpghttp://./movies/movingConeTopologicalSmall-anim.mpg -
8/2/2019 BAESystems_10Mar2005
14/29
Speed of ExecutionHandling large-scale computations
Efficient numerics
Best discretisation practice for a givenproblem
Iterative solvers almost inevitable
Careful analysis of non-linearity and
inter-equation coupling Massive parallelism: domain decomposition
Object-Oriented CFD Solver Design p.14/2
-
8/2/2019 BAESystems_10Mar2005
15/29
Layered Development
Design encourages code re-use: shared tools
Code developed and tested in isolation
Vectors, tensors and field algebra
Mesh handling, refinement, topo changes
Discretisation, boundary conditions
Matrices and solver technology
Physics by segment Custom applications
Ultimate user-coding capabilities!
Object-Oriented CFD Solver Design p.15/2
-
8/2/2019 BAESystems_10Mar2005
16/29
Examples of ApplicationObjective: illustrate examples of FOAM library in
use Diesel Combustion: Scania D-12 Engine
Free surface flow modelling Capillary jets, LES + free surface
Surface tracking: rising bubble
Solid-fluid interaction: plastic pipeline failure
Object-Oriented CFD Solver Design p.16/2
-
8/2/2019 BAESystems_10Mar2005
17/29
Diesel CombustionDiesel Combustion in Scania D-12 Engine
1/8 sector with 75 % load and n-heptane fuel
RANS, k turbulence model, simplified
5-species chemistry and 1 reaction,Chalmers PaSR combustion model
Temperature on a cutting planes
Spray droplets coloured with temperature
Object-Oriented CFD Solver Design p.17/2
-
8/2/2019 BAESystems_10Mar2005
18/29
Diesel CombustionDiesel Combustion in Scania D-12 Engine
Object-Oriented CFD Solver Design p.18/2
http://./movies/scaniaEng.mpg -
8/2/2019 BAESystems_10Mar2005
19/29
Capillary Jet
Ink-jet printer nozzle, 20m diameter
Pulsating flow, umean = 20m/s
Tuning frequency (50kHz) and amplitude (5%)
Object-Oriented CFD Solver Design p.19/2
http://./movies/highFreq.mpghttp://./movies/midFreq.mpghttp://./movies/lowFreq.mpg -
8/2/2019 BAESystems_10Mar2005
20/29
Diesel Injector
LES of a Diesel Injector
d = 0.2mm, high velocity and surface tension
Mean injection velocity: 460m/s
Diesel fuel injected into air, 5.2MPa, 900K Turbulent and subsonic flow, no cavitation
1-equation LES model with no free surfacecorrection
Fully developed pipe flow inlet
Object-Oriented CFD Solver Design p.20/2
-
8/2/2019 BAESystems_10Mar2005
21/29
Diesel Injector
Mesh size: 1.2 to 8 million CVs, aggressive
local refinement, 50k time-steps 6s initiation time, 20s averaging time
Object-Oriented CFD Solver Design p.21/2
http://./movies/gammaIsoU.mpg -
8/2/2019 BAESystems_10Mar2005
22/29
Surface tracking
rF
vF
vb = vF
y
x
y
x
aF
oSASB
o
Free
surface
Free surface tracking
2 phases = 2 meshes
Mesh adjusted for
interface motion Coupled b.c.
Air-water system
2-D: rb = 0.75 mm
3-D: rb = 1 mm
Object-Oriented CFD Solver Design p.22/2
-
8/2/2019 BAESystems_10Mar2005
23/29
Surfactant Effect
Clean surface
Pollution by surfactant chemicals
Object-Oriented CFD Solver Design p.23/2
http://./movies/2dBubble-surfactant-vectors.mpghttp://./movies/2dBubble-surfactant-vectors.mpghttp://./movies/2dBubble-surfactant-vectors.mpghttp://./movies/2dBubble-clean-mesh.mpghttp://./movies/2dBubble-clean-pressure.mpghttp://./movies/2dBubble-clean-vectors.mpg -
8/2/2019 BAESystems_10Mar2005
24/29
3-D Rising Bubble
Complex coupling problem: FVM flow solver +
FEM mesh motion + FAM surfactantsObject-Oriented CFD Solver Design p.24/2
http://./movies/3dBubble-surfactant-vectors-colored.mpg -
8/2/2019 BAESystems_10Mar2005
25/29
Fluid-Solid Coupling
Pipeline failure: crack propagation and leakage
Object-Oriented CFD Solver Design p.25/2
http://./movies/pipe_solid_fluid640x384.mpg -
8/2/2019 BAESystems_10Mar2005
26/29
Fluid-Solid Coupling
Enlarged deformation of the pipe
Object-Oriented CFD Solver Design p.26/2
http://./movies/pipe_solid_only640x384.mpg -
8/2/2019 BAESystems_10Mar2005
27/29
Other Capabilities
FOAM contains other capabilities as well
RANS and LES turbulence modelling
Thermophysical and transport model libraries
A-posteriori error estimation Adaptive mesh refinement
Software used for algorithm and numerics re-search: excellent numerics and pre-implemented
models
Object-Oriented CFD Solver Design p.27/2
-
8/2/2019 BAESystems_10Mar2005
28/29
Summary
Object-oriented approach facilitates model
implementation: layered design + re-use Equation mimicking opens new CCM grounds
Extensive capabilities already implemented Open design for easy user customisation
Acknowledgements
Scania engine: Dr. Niklas Nordin, Chalmers University Sweden
Spray breakup: Eugene de Villiers, Imperial College
Cracking pipe: Dr. Vlado Tropa, prof. A Ivankovic, UC Dublin
Foam and OpenFOAM are released under GPL: http://www.openfoam.org
Object-Oriented CFD Solver Design p.28/2
-
8/2/2019 BAESystems_10Mar2005
29/29
FOAM: CCM in C++
Main characteristics
Wide area of applications: all of CCM!
Shared tools and code re-use
Versatility Unstructured meshes, automatic mesh
motion + topological changes
Finite Volume, Finite Element, Lagrangiantracking and Finite Area methods
Efficiency through massive parallelismObject-Oriented CFD Solver Design p.29/2