Upload
aghajani
View
234
Download
0
Embed Size (px)
Citation preview
8/9/2019 In-Cylinder Flows With Openfoam
1/31
In-Cylinder Flows withOpenFOAM
Hrvoje Jasak
Wikki Ltd, United Kingdom
FSB, University of Zagreb, Croatia
18/Nov/2005
In-Cylinder Flows with OpenFOAM p.1/3
8/9/2019 In-Cylinder Flows With Openfoam
2/31
OutlineObjective
Present a novel way of handling softwareimplementation in numerical mechanics
Topics OpenFOAM: Object-oriented software for
Computational Continuum Mechanics (CCM)
A new approach to model representation
Mesh handling and discretisation support
In-cylinder flow (related) capabilitiesIn-Cylinder Flows with OpenFOAM p.2/3
8/9/2019 In-Cylinder Flows With Openfoam
3/31
BackgroundState 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 Quick and reliable model implementation Complex geometry, high-performance
computing, automatic meshing etc.In-Cylinder Flows with OpenFOAM p.3/3
8/9/2019 In-Cylinder Flows With Openfoam
4/31
In-Cylinder FlowsSimulation Challenges: Very Demanding!
Complex mathematical model Compressible (transonic) fluid flow
Turbulence, combustion, chemistry Lagrangian particles for spray Wall interaction and wall film
Complex geometry handling: moving mesh,topological changes (valve action)
Model-to-model interaction: complex couplingIn-Cylinder Flows with OpenFOAM p.4/3
8/9/2019 In-Cylinder Flows With Openfoam
5/31
Numerics for CCMHow to handle complex models in software?
Natural language of continuum mechanics:partial differential equations
kt
+ (uk) [(+ t)k] =
t1
2(u + uT
)2
o
ko k
Main object = operator, e.g. time derivative,
convection, diffusion, gradientIn-Cylinder Flows with OpenFOAM p.5/3
8/9/2019 In-Cylinder Flows With Openfoam
6/31
OpenFOAM: CCM in C++FOAM (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)
);
In-Cylinder Flows with OpenFOAM p.6/3
8/9/2019 In-Cylinder Flows With Openfoam
7/31
Object OrientationRecognise main objects from the numerical
modelling viewpoint Computational domain
Object Software representation C++ Class
Time Time steps (database) time
Tensor (List of) numbers + algebra vector, tensor
Mesh primitives Point, face, cell Point, face, cell
Space Computational mesh polyMesh
In-Cylinder Flows with OpenFOAM p.7/3
8/9/2019 In-Cylinder Flows With Openfoam
8/31
Object Orientation Field algebra
Object Software representation C++ Class
Field List of values Field
Boundary condition Values + condition patchField
Dimensions Dimension Set dimensionSetGeometric field Field + boundary conditions geometricField
Field algebra + / tr(),sin(),exp() . . . field operators
Matrix and solversObject Software representation C++ ClassLinear equation matrix Matrix coefficients lduMatrix
Solvers Iterative solvers lduMatrix::solver
In-Cylinder Flows with OpenFOAM p.8/3
8/9/2019 In-Cylinder Flows With Openfoam
9/31
Object Orientation Numerics
Object Software representation C++ ClassInterpolation Differencing schemes interpolation
Differentiation ddt, div, grad, curl fvc, fec
Discretisation ddt, d2dt2, div, laplacian fvm, fem, fam
Implemented Methods: Finite Volume, FiniteElement, Finite Area and Lagrangian tracking
Top-level organisationObject Software representation C++ Class
Model library Library turbulenceModel
Application main()
In-Cylinder Flows with OpenFOAM p.9/3
8/9/2019 In-Cylinder Flows With Openfoam
10/31
Model InteractionCommon 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{};
In-Cylinder Flows with OpenFOAM p.10/3
8/9/2019 In-Cylinder Flows With Openfoam
11/31
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 Convection differencing schemes
Gradient calculation Boundary conditions
Linear equation solvers
Physical modelling, e.g. evaporation model, etc.
In-Cylinder Flows with OpenFOAM p.11/3
8/9/2019 In-Cylinder Flows With Openfoam
12/31
Geometry HandlingComplex geometry, mesh motion and morphing
Complex geometry is a rule, not exception Polyhedral cell support
Cell is a polyhedron bounded by polygons Consistent handling of all cell types More freedom in mesh generation
Integrated mesh motion and topo changes
Automatic motion solver + topo morph engine
In-Cylinder Flows with OpenFOAM p.12/3
8/9/2019 In-Cylinder Flows With Openfoam
13/31
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!In-Cylinder Flows with OpenFOAM p.13/3
8/9/2019 In-Cylinder Flows With Openfoam
14/31
In-Cylinder FlowsChallenges in Simulating In-Cylinder Flows
Robust FVM solver, turbulence andcombustion, chemistry, gas properties etc.
Mesh handling: motion and topo changes Lagrangian particle tracking
Numerics to support wall film: Finite Area
Efficiency: massive parallelism with domaindecomposition
. . . and then lots and lots of models!In-Cylinder Flows with OpenFOAM p.14/3
8/9/2019 In-Cylinder Flows With Openfoam
15/31
Automatic Mesh MotionHandling Shape Change: Problem Specification
Initial valid mesh is available Time-varying boundary motion
Prescribed in advance: e.g. IC engines Part of the solution: surface tracking
Need to determine internal point motionbased on prescribed boundary motion
Mesh in motion must remain valid: face and
cell flip must be prevented by the algorithmIn-Cylinder Flows with OpenFOAM p.15/3
8/9/2019 In-Cylinder Flows With Openfoam
16/31
Automatic Mesh MotionSolution Technique
Point position will be provided by solving anequation given boundary motion conditions
Variants of the motion solver Cell-based methods fail: interpolation Spring analogy: unreliable
Vertex-based (FEM) with polyhedral cellsupport: mini-element technique
Choice of equation: Laplace or pseudo-solidIn-Cylinder Flows with OpenFOAM p.16/3
8/9/2019 In-Cylinder Flows With Openfoam
17/31
Automatic Mesh MotionImplementation: Polyhedral FEM Solver
Substantial code re-use Mesh support, vectors and tensors
Geometric fields and field algebra Linear matrix support and solvers
Additional implementation required Patch fields and matrix interaction FE calculus, e.g. gradient calculation
FE discretisation: making matricesIn-Cylinder Flows with OpenFOAM p.17/3
8/9/2019 In-Cylinder Flows With Openfoam
18/31
Automatic Mesh MotionAutomatic Mesh Motion
Easy to set up Improved robustness
Control over mesh qualityand spacing: diffusivity
Pseudo-solid approachbetter but more expen-sive: component coupledvs. segregated approach
In-Cylinder Flows with OpenFOAM p.18/3
http://./movies/deformingMesh.mpg8/9/2019 In-Cylinder Flows With Openfoam
19/31
Automatic Mesh Motion
rF
vF
vb = vF
y
x
y
x
aF
oSA
SB
o
Free
surface
Free surface tracking
2 phases = 2 meshes Mesh adjusted for
interface motion
In-Cylinder Flows with OpenFOAM p.19/3
http://./movies/2dBubble-clean-vectors.mpghttp://./movies/2dBubble-clean-pressure.mpghttp://./movies/2dBubble-clean-mesh.mpghttp://./movies/2dBubble-clean-pressure.mpghttp://./movies/2dBubble-clean-vectors.mpg8/9/2019 In-Cylinder Flows With Openfoam
20/31
Topological Changes
Supporting Topological Changes
1. Define primitive mesh operations:Add/modify/remove point/face/cell
2. Support primitive operations in mesh classes3. Describe mesh modifiers in terms of primitivemesh operations
4. Collect changes from mesh modifiers intotopo change request
5. Execute topo change, including field mapping!In-Cylinder Flows with OpenFOAM p.20/3
8/9/2019 In-Cylinder Flows With Openfoam
21/31
Topological Changes
Topology Engine
Topology engine = list of mesh modifiers Attach/detach boundary
Layer addition/removal Sliding interface
Each mesh modifier self-contained, including
triggering condition Flow solver presented with valid mesh and
mapped data + mesh motion info
In-Cylinder Flows with OpenFOAM p.21/3
8/9/2019 In-Cylinder Flows With Openfoam
22/31
Topological Changes
Topological Changes on Polyhedral Meshes
This is the current point of development Intersecting topo modifiers, parallelisation
and bugs (sliding), unified solver support
In-Cylinder Flows with OpenFOAM p.22/3
http://./movies/flowControlDevice.mpghttp://./movies/mixer2D-anim.mpghttp://./movies/movingConeTopologicalSmall-anim.mpg8/9/2019 In-Cylinder Flows With Openfoam
23/31
Lagrangian Particles
Class Hierarchy
Particle: a point recording its position andlocation in a mesh
Cloud: is-agroup of particles withaddition, removal and tracking capabilities
Spray Parcel = Particle is-awith
properties: diameter, population, temperature Spray tracking is-acloud of parcels
In-Cylinder Flows with OpenFOAM p.23/3
8/9/2019 In-Cylinder Flows With Openfoam
24/31
Lagrangian Particles
Diesel Spray Model
Spray tracking + sub-models: atomisation,breakup, collision, dispersion, drag,evaporation heat transfer, wall interaction
Each class of sub-models answers to genericinterface for its class
spray::evolve(): track + update modelsHierarchical implementation with code re-use:
object orientation + generic programmingIn-Cylinder Flows with OpenFOAM p.24/3
8/9/2019 In-Cylinder Flows With Openfoam
25/31
Diesel Combustion
Diesel 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 the cutting plane
Spray droplets coloured with temperature
In-Cylinder Flows with OpenFOAM p.25/3
8/9/2019 In-Cylinder Flows With Openfoam
26/31
Diesel Combustion
Diesel Combustion in Scania D-12 Engine
In-Cylinder Flows with OpenFOAM p.26/3
http://./movies/scaniaEng.mpg8/9/2019 In-Cylinder Flows With Openfoam
27/31
Lagrangian Particles
Hour-Glass: same tracking, different particles
In-Cylinder Flows with OpenFOAM p.27/3
http://./movies/hourLarge.mpg8/9/2019 In-Cylinder Flows With Openfoam
28/31
Wall Film Model
Finite Area Method (FAM)
Need to solve transport equations on acurved 2-D surface in 3-D
Polygonal mesh support: boundary of apolyhedral mesh
Discretisation almost identical to 3-D FVM
. . . but with corrections for surface curvature
Implementation effort identical to the FEM solver;
additional code re-use with 3-D FVMIn-Cylinder Flows with OpenFOAM p.28/3
8/9/2019 In-Cylinder Flows With Openfoam
29/31
Coupled Simulation
Free-Rising Air Bubble with Surfactants
Complex coupling problem:
FVM flow solver + FEM automatic mesh motion +
FAM for surfactant transportIn-Cylinder Flows with OpenFOAM p.29/3
http://./movies/3dBubble-surfactant-vectors-colored.mpg8/9/2019 In-Cylinder Flows With Openfoam
30/31
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 and Further Info
eljko Tukovic, University of Zagreb, Niklas Nordin, Scania and Chalmers Uni
For more info on OpenFOAM, please visit http://www.openfoam.org
Free OpenFOAM Workshop in Zagreb, Croatia 26-28/Jan/2006:
http://powerlab.fsb.hr/ped/kturbo/FsbOpenFOAMWorkshop/
In-Cylinder Flows with OpenFOAM p.30/3
8/9/2019 In-Cylinder Flows With Openfoam
31/31
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 parallelismIn-Cylinder Flows with OpenFOAM p.31/3