object-oriented cfd: free surface flow solver€¦ · object-oriented cfd: free surface flow solver...

26
Object-Oriented CFD: Free Surface Flow Solver Hrvoje Jasak [email protected] Wikki Ltd. United Kingdom 7/Apr/2005 Object-Oriented CFD: Free Surface Flow Solver – p.1/26

Upload: others

Post on 25-Apr-2020

18 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Object-Oriented CFD:Free Surface Flow

SolverHrvoje Jasak

[email protected]

Wikki Ltd. United Kingdom

7/Apr/2005

Object-Oriented CFD: Free Surface Flow Solver – p.1/26

Page 2: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Outline

Objective

• Present a new way of handling ContinuumMechanics models in numerical software

Topics

• OpenFOAM: Object-oriented software forComputational Continuum Mechanics (CCM)

• A new approach to model representation

• Modelling free surface flows:surface capturing and surface tracking

Object-Oriented CFD: Free Surface Flow Solver – p.2/26

Page 3: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Background

State of the Art

• Numerical modelling is becoming a part ofproduct design◦ Improvements in computer performance◦ Improved physical modelling and numerics◦ Sufficient validation and experience

• Two-fold requirements◦ Ease of use and process integration◦ Quick and reliable model implementation

Object-Oriented CFD: Free Surface Flow Solver – p.3/26

Page 4: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Numerics for CCM

How to handle complex models in software?

• Natural language of continuum mechanics:partial differential equations

∂k

∂t+ ∇•(uk) −∇•[(ν + νt)∇k] =

νt

[

1

2(∇u + ∇u

T )

]2

−εo

ko

k

Object-Oriented CFD: Free Surface Flow Solver – p.4/26

Page 5: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

FOAM: 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)

);

Object-Oriented CFD: Free Surface Flow Solver – p.5/26

Page 6: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Object Orientation

Recognise main objects from the numericalmodelling viewpoint

• Computational domainObject 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

Object-Oriented CFD: Free Surface Flow Solver – p.6/26

Page 7: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Object Orientation

• Field algebraObject Software representation C++ Class

Field List of values Field

Boundary condition Values + condition patchField

Dimensions Dimension Set dimensionSet

Geometric field Field + boundary conditions geometricField

Field algebra + − ∗ / tr(), sin(), exp() . . . field operators

• Matrix and solversObject Software representation C++ Class

Linear equation matrix Matrix coefficients lduMatrix

Solvers Iterative solvers lduMatrix::solver

Object-Oriented CFD: Free Surface Flow Solver – p.7/26

Page 8: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Object Orientation

• NumericsObject Software representation C++ Class

Interpolation 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() –

Object-Oriented CFD: Free Surface Flow Solver – p.8/26

Page 9: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

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{};

Object-Oriented CFD: Free Surface Flow Solver – p.9/26

Page 10: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Run-Time Selection

• Model-to-model interaction through commoninterfaces (virtual base classes)

• New components do not disturb existing code

• Run-time selection tables: dynamic binding

• Used throughout the code: user-coding (?)◦ Convection differencing schemes

◦ Gradient calculation

◦ Boundary conditions

◦ Linear equation solvers

◦ Physical modelling, e.g. non-Newtonian viscosity laws

◦ etc.

Object-Oriented CFD: Free Surface Flow Solver – p.10/26

Page 11: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Geometry Handling

Complex geometry requirements

• Complex geometry is a rule, not exception

• Polyhedral cell support◦ Cell described as a polyhedron bounded

by polygons◦ Consistent handling of all cell types◦ More freedom in mesh generation

• Handling mesh motion and topologicalchanges

Object-Oriented CFD: Free Surface Flow Solver – p.11/26

Page 12: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Geometry Handling

Object-Oriented CFD: Free Surface Flow Solver – p.12/26

Page 13: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

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: Free Surface Flow Solver – p.13/26

Page 14: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Free Surface Flows

Examples of FOAM library in use

• Surface capturing method◦ Both (all) fluids treated as single continuum◦ Volume fraction γ indicates phases:

interface reconstructed from γ distribution

• Surface tracking method◦ Separate mesh for each phase◦ Motion obtained from boundary conditions◦ Mesh adjusted for free surface motion

Object-Oriented CFD: Free Surface Flow Solver – p.14/26

Page 15: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Droplet Splash

Two-phase incompressible system

∂γ

∂t+ ∇•(uγ) = 0

∇•u = 0

∂ρu

∂t+ ∇•(ρuu) −∇•σ = −∇p + ρf + σκ∇γ

u = γu1 + (1 − γ)u2

µ, ρ = γρ1 + (1 − γ)ρ2

Object-Oriented CFD: Free Surface Flow Solver – p.15/26

Page 16: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Droplet Splash

Droplet impact into a wall film, 1.3 million cells

Object-Oriented CFD: Free Surface Flow Solver – p.16/26

Page 17: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Droplet Splash

Droplet impact into a wall film, cutting plane

Object-Oriented CFD: Free Surface Flow Solver – p.17/26

Page 18: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

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 surface

correction◦ Fully developed pipe flow inlet

Object-Oriented CFD: Free Surface Flow Solver – p.18/26

Page 19: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Diesel Injector

• Mesh size: 1.2 to 8 million CVs, aggressivelocal refinement, 50k time-steps

• 6µs initiation time, 20µs averaging time

Object-Oriented CFD: Free Surface Flow Solver – p.19/26

Page 20: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Surface Tracking

rF

vF

vb = −vF

y

x

y′

x′

aF

o′SA

SB

o

Free

surface

Free surface tracking

• 2 phases = 2 meshes

• Mesh adjusted forinterface motion

• Coupled b.c.

Air-water system

• 2-D: rb = 0.75 mm

• 3-D: rb = 1 mm

Object-Oriented CFD: Free Surface Flow Solver – p.20/26

Page 21: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Automatic Mesh Motion

Handling shape changes without topo changes

• Time-varying boundary motion◦ Prescribed in advance: e.g. IC engines◦ Part of the solution: surface tracking◦ Need to determine internal point motion

• Mesh in motion must remain valid: tet flip

• Vertex-based (FEM) Laplace equation withpolyhedral support: mini-element technique

Object-Oriented CFD: Free Surface Flow Solver – p.21/26

Page 22: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Surfactant Effect

Clean surface

Pollution by surfactant chemicals

Object-Oriented CFD: Free Surface Flow Solver – p.22/26

Page 23: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

3-D Rising Bubble

Complex coupling problem: FVM flow solver +

FEM mesh motion + FAM surfactant transportObject-Oriented CFD: Free Surface Flow Solver – p.23/26

Page 24: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Topological Changes

• Basic ops: add/modify/remove point/face/cell

• Morph engine = list of topo modifiers

• Topo modifier trigger + list of basic ops

Object-Oriented CFD: Free Surface Flow Solver – p.24/26

Page 25: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

Summary

• Object-oriented approach facilitates modelimplementation: layered design + re-use

• CCM: equation mimicking opens new grounds

• Extensive capabilities already present

• Implements surface tracking and surfacecapturing solver

Acknowledgements

• Surface tracking: Dr. Željko Tukovic, University of Zagreb, Croatia

• Spray breakup: Eugene de Villiers, Imperial College

• OpenFOAM (GPL): http://openfoamcfd.sourceforge.net, http://www.openfoam.org

Object-Oriented CFD: Free Surface Flow Solver – p.25/26

Page 26: Object-Oriented CFD: Free Surface Flow Solver€¦ · Object-Oriented CFD: Free Surface Flow Solver – p.21/26. Surfactant Effect Clean surface Pollution by surfactant chemicals

OpenFOAM: CCM in C++

Main characteristics

• Wide area of applications: all of CCM!

• Open design for easy user customisation

Versatility

• Unstructured meshes, automatic meshmotion + topological changes

• Finite Volume, Finite Element, Lagrangiantracking and Finite Area methods

• Efficiency through massive parallelism

Object-Oriented CFD: Free Surface Flow Solver – p.26/26