0% found this document useful (0 votes)
128 views29 pages

Object-Oriented CFD Solver Design: Hrvoje Jasak

The document presents a new object-oriented approach to computational continuum mechanics (CCM) software design called FOAM. FOAM uses C++ to represent partial differential equations governing CCM in their natural language. This allows for flexible implementation of complex models through component-based design and code reuse. Examples demonstrate FOAM's capabilities for problems involving diesel combustion, free surface flows, and fluid-solid interaction.

Uploaded by

Jemene
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
128 views29 pages

Object-Oriented CFD Solver Design: Hrvoje Jasak

The document presents a new object-oriented approach to computational continuum mechanics (CCM) software design called FOAM. FOAM uses C++ to represent partial differential equations governing CCM in their natural language. This allows for flexible implementation of complex models through component-based design and code reuse. Examples demonstrate FOAM's capabilities for problems involving diesel combustion, free surface flows, and fluid-solid interaction.

Uploaded by

Jemene
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Object-Oriented CFD Solver Design

Hrvoje Jasak
[email protected]

Wikki Ltd. United Kingdom 10/Mar2005

Object-Oriented CFD Solver Design p.1/29

Outline
Objective Present new approach to software design in Computational Continuum Mechanics Topics A new approach to model representation Object-orientation in numerical simulation software: code re-use and layered design Examples of complex model implementation

Object-Oriented CFD Solver Design p.2/29

Background
State of the Art Numerical modelling is becoming a part of product design Improved computing performance Improved modelling Sufcient validation and experience Two-fold requirements Ease of use and process integration Quick and reliable model implementation

Object-Oriented CFD Solver Design p.3/29

Software Design
Physics-based approach Traditional view of the problem Well dened physics, studied in isolation Clearly dened objective Numerical software sometimes limiting design: e.g. Lockheed Martin F-117 Stealth Typically handled by monolithic software with well-dened capabilities

Object-Oriented CFD Solver Design p.4/29

Software Design
Application-based approach A collection of components involving various physics phenomena (beyond CFD) Complex model-to-model interaction Complex simulation and optimisation objectives, unexpected conclusions Made-to-measure modelling Requires more exible software design: can object orientation help?

Object-Oriented CFD Solver Design p.5/29

FOAM: CCM in C++


FOAM: Field Operation and Manipulation Natural language of continuum mechanics: partial differential equations k + t

(uk) t

[( + t ) k] =
2

1 ( u+ 2

u )

ko

Object-Oriented CFD Solver Design p.6/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/29

FOAM: CCM in C++


Object Space and time Tensor Field Boundary condition Geometric eld Field algebra Interpolation Differentiation Matrix Discretisation Model library Application Software representation Mesh + time (database) (List of) numbers + algebra List of values Values + condition Field + boundary conditions + / tr(), sin(), exp() . . . Differencing schemes ddt, div, grad, curl Matrix coefcients ddt, d2dt2, div, laplacian Library main() C++ Class polyMesh, time vector, tensor Field patchField geometricField eld operators interpolation fvc, fec lduMatrix fvm, fem, fam turbulenceModel

Object-Oriented CFD Solver Design p.8/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/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/29

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 Recent developments: polyhedral FVM provides equivalent accuracy at lower cost

Object-Oriented CFD Solver Design p.11/29

Geometry Handling

Object-Oriented CFD Solver Design p.12/29

Geometry Handling
Time-varying geometry cases Automatic mesh motion Topological mesh changes with poly support

Object-Oriented CFD Solver Design p.13/29

Speed of Execution
Handling large-scale computations Efcient numerics Best discretisation practice for a given problem Iterative solvers almost inevitable Careful analysis of non-linearity and inter-equation coupling Massive parallelism: domain decomposition

Object-Oriented CFD Solver Design p.14/29

Layered Development
Design encourages code re-use: shared tools Code developed and tested in isolation Vectors, tensors and eld algebra Mesh handling, renement, 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/29

Examples of Application
Objective: illustrate examples of FOAM library in use Diesel Combustion: Scania D-12 Engine Free surface ow modelling Capillary jets, LES + free surface Surface tracking: rising bubble Solid-uid interaction: plastic pipeline failure

Object-Oriented CFD Solver Design p.16/29

Diesel Combustion
Diesel Combustion in Scania D-12 Engine 1/8 sector with 75 % load and n-heptane fuel RANS, k turbulence model, simplied 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/29

Diesel Combustion
Diesel Combustion in Scania D-12 Engine

Object-Oriented CFD Solver Design p.18/29

Capillary Jet
Ink-jet printer nozzle, 20m diameter Pulsating ow, umean = 20m/s Tuning frequency (50kHz) and amplitude (5%)

Object-Oriented CFD Solver Design p.19/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 ow, no cavitation 1-equation LES model with no free surface correction Fully developed pipe ow inlet

Object-Oriented CFD Solver Design p.20/29

Diesel Injector
Mesh size: 1.2 to 8 million CVs, aggressive local renement, 50k time-steps 6s initiation time, 20s averaging time

Object-Oriented CFD Solver Design p.21/29

Surface tracking
vb = vF

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

vF SB SA

y o

aF x

rF y o x

Free surface

Object-Oriented CFD Solver Design p.22/29

Surfactant Effect
Clean surface

Pollution by surfactant chemicals

Object-Oriented CFD Solver Design p.23/29

3-D Rising Bubble

Complex coupling problem: FVM ow solver + FEM mesh motion + FAM surfactants

Object-Oriented CFD Solver Design p.24/29

Fluid-Solid Coupling
Pipeline failure: crack propagation and leakage

Object-Oriented CFD Solver Design p.25/29

Fluid-Solid Coupling
Enlarged deformation of the pipe

Object-Oriented CFD Solver Design p.26/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 renement Software used for algorithm and numerics research: excellent numerics and pre-implemented models

Object-Oriented CFD Solver Design p.27/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 Ivankovi c, UC Dublin Foam and OpenFOAM are released under GPL: http://www.openfoam.org

Object-Oriented CFD Solver Design p.28/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, Lagrangian tracking and Finite Area methods Efciency through massive parallelism

Object-Oriented CFD Solver Design p.29/29

You might also like