Current Development Work in
OpenFOAM
Hrvoje Jasak
[email protected], [email protected]
Wikki, United Kingdom and Germany
Faculty of Mechanical Engineering and Naval Architecture University of Zagreb, Croatia
Outline
Objective• Provide basic information about OpenFOAM software from User’s viewpoint ◦ What is it? How do I run it? What capabilities does it have?
• Present an overview of current and future developments Topics
1. OpenFOAM: Executive Overview 2. Running OpenFOAM
3. Points of interest: why consider OpenFOAM 4. Examples of capabilities
• Radial Basis Function in mesh motion and morphing • CFD in shape optimisation with RBF morphing
• Vehicle soiling: Lagrangian tracking, finite area and liquid film • Turbomachinery examples
• Dynamic remeshing with tetrahedral edge swapping • Overset grid in OpenFOAM
OpenFOAM: Executive Overview
What is OpenFOAM?• OpenFOAM is a free-to-use Open Source numerical simulation software with extensive CFD and multi-physics capabilities
• Free-to-use means using the software without paying for license and support, including massively parallel computers: free multi-1000-CPU CFD license! • Software under active development, capabilities mirror those of commercial CFD • Substantial installed user base in industry, academia and research labs
• Possibility of extension to non-traditional, complex or coupled physics:
Fluid-Structure Interaction, complex heat/mass transfer, internal combustion engines, nuclear
Main Components
• Discretisation: Polyhedral Finite Volume Method, second order in space and time • Lagrangian particle tracking, Finite Area Method (2-D FVM on curved surface) • Massive parallelism in domain decomposition mode
• Automatic mesh motion (FEM), support for topological changes • All components implemented in library form for easy re-use • Physics model implementation through equation mimicking
Implementing Continuum Models
Equation Mimicking• Natural language of continuum mechanics: partial differential equations • Example: turbulence kinetic energy equation
∂k ∂t + ∇•(uk) − ∇•[(ν + νt)∇k] = νt » 1 2(∇u + ∇u T) –2 − ǫo ko k
• Objective: represent differential 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) );
• Correspondence between the implementation and the original equation is clear • Library-based implementation of custom physical models with full freedom in
OpenFOAM: Executive Overview
Physical Modelling Capability Highlights• Basic: Laplace, potential flow, passive scalar/vector/tensor transport
• Incompressible and compressible flow: segregated pressure-based algorithms • Heat transfer: buoyancy-driven flows, conjugate heat transfer
• Multiphase: Euler-Euler, VOF free surface capturing and surface tracking • RANS for turbulent flows: 2-equation, RSTM; full LES capability
• Pre-mixed and Diesel combustion, spray and in-cylinder flows
Running OpenFOAM
Structure of OpenFOAM• OpenFOAM is assembled from components
◦ Foundation libraries, containing discretisation, mesh handling etc. in re-usable form. Functionality shared across many application
◦ Physical modelling libraries: thermo-physical models (liquids and gasses), viscosity models, turbulence models, chemical reactions interface
◦ Utilities: mesh import and manipulation, parallel processing, post processor hook-up (reader module) and data manipulation
◦ Customised, purpose-written and optimised executables for each physics segment. All are founded on common components
◦ Linkage for user extensions and on-the-fly data analysis OpenFOAM Executable
• Custom executable for specific physics segment: few 100s of lines of code • Easy to read, understand, modify or add further capability
• Existing code is used as a basis for own development: simulation environment • Low-level functions, eg. mesh handling, parallelisation, data I/O handled
Point of Interest
Why Consider OpenFOAM• Open architectures
◦ Access to complete source: no secret modelling tricks, no cutting corners ◦ Both community-based and professional support available
◦ Common platform for new R&D projects: shipping results of research into the hands of a customer with no delay
• Low-cost CFD
◦ No license cost, portable to any computing platform (IBM Blue Gene) ◦ Easily scriptable and embeddable: “automated CFD” and optimisation
◦ Efficient on massively parallel computers, portable to new comms protocols • Problem-independent numerics and discretisation
◦ Tackle non-standard continuum mechanics problem: looking beyond the capabilities of commercial CFD
• Efficient environment for complex physics problems
◦ Tackling difficult physics is made easier through equation mimicking ◦ Utility-level tools readily available: parallelism, moving mesh
◦ Track record in non-linear and strongly coupled problems
Examples of Simulation
Example of Capabilities of OpenFOAM Relevant to Your CFD Needs • This is only a part of the OpenFOAM capabilities!
• Chosen for relevance and illustration of the range of capabilities rather than exhaustive illustration of range of capabilities
• In some cases, simplified geometry is used
• Regularly, the work resulted in a new solver; in many cases, it is developed as an extension or combination of existing capabilities
Description of Simulation and Setup
• Physics and numerical method setup
• Standard or customised solver; details of mesh resolution and customisation • New capability and proposed development shall be marked
Radial Basis Function
Radial Basis Function Interpolation• RBF interpolation defines the interpolation directly from the sufficient smoothness criterion on the interpolation (positive weighting factors):
s(x) = Nb X j=1 γjφ(|x − xb,j|) +q(x) where
◦ x is the interpolant location
◦ xb is the set of Nb locations carrying the data
◦ φ(x) is the basis function, dependent on point distance
◦ q(x) is the (usually linear) polynomial function, depending on choice of basis function and γj, eg. q = b0 + b1x + b2y + b3z
• Consistency of interpolation is achieved by requiring that all polynomials of the order lower than q disappear at data points
Nb
X
j=1
Radial Basis Function
RBF Interpolation Procedure1. Establish locations of data-carrying points xb and their values
2. Assemble and solve the equation set for γ and β using a direct solver 3. Calculate values at desired locations by evaluating s(x)
Using RBF in a CFD Code Context
• Automatic mesh motion: mesh deformation based on a small number of control points located on moving boundaries
◦ PhD project by dr. Frank Bos, TU Delft ◦ Basic implementation of RBF in OpenFOAM
◦ Automatic selection of control points with coarsening + extinguishing function for far-field motion control: reduce number of control points
◦ RBF interpolation to calculate mesh motion (+ parallelisation) ◦ Implemented as an option in dynamic mesh motion
• RBF mesh morpher in geometric shape optimisation
◦ Morphing points control change of shape as data carriers
◦ Small number of degrees of freedom: ideal for parametrisation ◦ Mesh quality in deformation guaranteed by properties of RBF
Radial Basis Function
Radial Basis Function in Automatic Mesh Motion
• Mathematical tool which allows data interpolation from a small set of control points to space with smoothness criteria built into the derivation
• Used for mesh motion in cases of large deformation: no inverted faces or cells • Control points chosen on a moving surface, with “extinguishing function” used to
control far-field mesh motion
Radial Basis Function
RBF Mesh Morphing• RBF morphing object defines the parametrisation of geometry (space):
1. Control points in space, where the parametrised control motion is defined 2. Static points in space, whose motion is blocked
3. Range of motion at each control point: (d0,d1)
4. Set of scalar parameters δ for control points, defining current motion as d(δ) = d0 + δ(d1 − d0), where 0 ≤ δ ≤ 1
• For each set of δ parameters, mesh deformation is achieved by interpolating
motion of control points d over all vertices of the mesh: new deformed state of the geometry
• Mesh in motion remains valid since RBF satisfies smoothness criteria Using RBF in Optimisation
• Control points may be moved individually or share δ values: further reduction in dimension of parametrisation of space
• Mesh morphing state is defined in terms of δ parameters: to be controlled by the optimisation algorithm
Radial Basis Function
RBF Mesh Morphing: Cylinder and Sphere Examples
• Parametrisation uses a single parameter δ for this motion, with various number of control points
Shape Optimisation
Shape Optimisation Background• Specify a desired object of optimisation and use the parametrisation of geometry to explore the allowed solution space in order to find the minimum of the
optimisation objective
objective = f(shape) 1. Parametrisation of Geometry
• Computational geometry is complex and usually available as the computational mesh: a large amount of data
• Parametrisation tool: RBF mesh morphing, defining deformation at a small number of mesh-independent points in space
2. CFD Flow Solver is used to provide the flow solution on the current geometry, in preparation for objective evaluation
3. Evaluation of Objective: usually a derived property of the flow solution
4. Optimiser Algorithm: explores the solution space by providing sets of shape coordinates and receiving the value of objective. The search algorithm iteratively limits the space of solutions in search of a minimum value of objective
Shape Optimisation
Example: HVAC 90 deg Bend: Flow Uniformity at Outlet
• Flow solver: incompressible steady-turbulent flow, RANS k − ǫ model; coarse mesh: 40 000 cells; 87 evaluations of objective with CFD restart
• RBF morphing: 3 control points in motion, symmetry constraints; 34 in total • Objective: flow uniformity at outlet plane
iter = 0 pos = (0.9 0.1 0.1) v = 22.914 size = 0.69282 iter = 5 pos = (0.1 0.1 0.1) v = 23.0088 size = 0.584096
Finite Area Method
Finite Area Discretisation• Finite Area Method discretised equations on a curved surface in 3-D
• Surface is discretised using polygonal faces. Discretisation takes into account surface curvature. A level of smoothness is assumed in calculation of curvature terms
• Surface motion is allowed: decomposed into normal and tangential motion • Nomenclature for a surface element P and its neighbour N
nP N n e P N de e L j i e e’ m nf SP
Thin Liquid Film Model
Modelling Assumptions: 2-D Approximation of a Free Surface Flow • Isothermal incompressible laminar flow
• Boundary layer approximation:
◦ Tangential derivatives are negligible compared to normal
◦ Normal velocity component is negligible compared to tangential ◦ Pressure is constant across the film depth
• Similitude of the flow variables in the direction normal to the substrate ◦ Prescribed cubic velocity profile
n
S
wv
v
f sS
f sp
gv
gm
d,iDependent variables:
h
and
v
¯
σ
v
d,i¯
v
h
¯
v
=
1 h hR
0v
d
h
η
=
nh,
0
≤
n
≤
h
v
(
η
) =
v
f s•diag (
a
η
+
b
η
2+
c
η
3)
Thin Liquid Film Model
Validation: Droplet Spreading Under Surface Tension
• Liquid film equations governing the flow; self-similar velocity profile • Droplet spread driven by gravity and counteracted by surface tension
• Equation set possesses an (axi-symmetric) analytical solution: validation of implementation and numerics
0 5e-06 1e-05 1.5e-05 2e-05 2.5e-05 3e-05 3.5e-05 4e-05 0 0.0005 0.001 0.0015 0.002 h, m r, m t = 0.000 s t = 0.015 s Analytical solution
Implementation of Liquid Film Model Volume-Surface-Lagrangian Coupling • Full second order in space and time on curved moving surfaces
Coupling Wall Film with Spray
Volume-Surface-Lagrangian Coupling• Coupling a volumetric flow model with Lagrangian particles for a dispersed phase to a thin liquid film model on the solid wall Custom solver
• In terms of numerics, coupling of volumetric, surface and Lagrangian models is easy to handle: different modelling paradigms
• Main coupling challenge is to implement all components side-by-side and control their interaction: volumetric-to-particle-to-surface data exchange
Turbomachinery Features
General Grid Interface• Turbomachinery CFD requires additional features: implement in library form • General Grid Interface (GGI) and its derived forms
◦ Cyclic GGI
◦ Partial overlap GGI
◦ Mixing plane interface (under testing)
• Implementation and parallelisation is complete: currently running validation cases in collaboration with commercial clients and Turbomachinery Working Group
• Other turbo-related components in pipeline: harmonic balance solver solver • Library-level implementation allows re-use of GGI beyond turbomachinery
Tetrahedral Edge Swapping
Re-Meshing with Tetrahedral Edge Swapping• In cases where mesh motion involves topological change at the boundary or unpredictable mesh deformation, topological change machinery is impractical: cannot decide a-priori where to place topology modifiers
• Dynamic remeshing using tetrahedral edge swapping ◦ Motion is prescribed on external boundaries
◦ Tetrahedral cell quality examined continuously: bad cells trigger automatic remeshing without user interaction: answers to dynamicMesh interface
◦ Implemented by Sandeep Menon, UMass Amherst as a ready-to-use library • Example: viscoelastic droplet collision using free surface tracking
Overset Grid in OpenFOAM
foamedOver: Overset Grid Technology in OpenFOAM
• Work by David Boger, Penn State University using SUGGAR and DirtLib libraries developed by Ralph Noack, Penn State (must mention Eric Paterson!)
• Overset Grid Technology
◦ Multiple components meshed individually, with overlap ◦ Hole cutting algorithm to remove excess overlap cells
◦ Mesh-to-mesh interpolation with implicit updates built into patch field updates and linear solver out-of-core operations
• Body-fitted component meshes: preserving quality and near-wall resolution • Simple mesh motion and geometrical studies (replacing individual components) • Overset grid is physics-neutral! Currently testing for free surface flows
Robustness, Accuracy, Scaling
Robustness and Accuracy Improvements• Tetrahedral mesh solution improvement
◦ Historically, tet meshes are easier to generate, but “hex-based” CFD
methodology has produced poorer results, especially for boundary layers. Improvements took approx. 6 years in Star-CD and Fluent
◦ Pointwise mesh generator: unstructured complex geometry meshes with anisotropic tetrahedral mesh extrusion in boundary layers (with optional recombination of tetrahedra)
• With community effort, we got there in approx. 6 months: special discretisation Performance and Parallel Scaling Improvements
• Tuning of OpenFOAM for high-end parallel machines: collaboration with Intel • Scalable Software Workshop: National Science Foundation, USA
• OpenMP baseline by Sandeep Menon, UMass Amherst
◦ Basic wrapping and examples for use of OpenMP in the library
◦ Objective: provide multi-core support at linear solver, matrix and calculus and field operator level, in stages!
VulaSHAKA Project
VulaSHAKA Background and Project Road-Map: OpenFOAM/SALOME Integration • SALOME is an open source integration platform for numerical simulation
◦ Development coordinated and financed by EDF (France) ◦ Designed specifically to “host” numerical simulation software • OpenFOAM/SALOME Integration
◦ IFoam: Interactive FOAM, Python-based, explicit and implicit distributed process coupling and data translation
◦ GFoam: Stand-alone GUI, including IFoam engine
VulaSHAKA Project
VulaSHAKA Project SnapshotsNUMAP-FOAM 2010
NUMAP-FOAM Summer School, Generation 2010
• Third year of Summer School in action: Zagreb, 1-15 September 2010
The idea of the Summer School is to expand the physical modelling knowledge, numerics and programming skills of attendees using
OpenFOAM in their research through direct supervision and one-to-one work.
This is NOT an introductory OpenFOAM course: significant understanding of the project and software is a pre-requisite for application.
• Example projects: picked for my personal interest
◦ Darrin Stevens, CSIRO Australia: poly-dispersed multiphase flows
◦ Oliver Borm, TU Munich Germany: compressible flows in turbomachinery ◦ Chiara Mistrangelo, Karlsruhe Institute of Technology: MHD flows
◦ Bill Rosemurgy, Uni Michigan: hybrid naval hydrodynamics solver for rapid calm water resistance: potential flow + full RANS using VOF
◦ Peter Benovsky, Austrian Institute of Technology : combustion and chemistry in a direct fired generator
◦ Sunho Park, Seoul National University: 6-DOF of super-cavitating torpedoes ◦ Joris Mattheijssens, Royal Military Academy, Brussels: robotic ships
Summary
A Year in Life of OpenFOAM
• Very successful: improved capability, visibility and quality of the code
• This is a community-driven project with numerous contributors: Thank You All • Presence of OpenFOAM in the numerical simulation arena is changing the way
users are applying CFD simulations in industrial settings
• Academic sharing of results and joint research is easier and more productive Outlook
• Need to make OpenFOAM easier for entry-level users: several ongoing projects • Formalise and validate software capability: adding new features is as important as
making the best possible use of existing capability
• Expand the pool of expert developers: NUMAP-FOAM Summer School, Zagreb • Grow the community and user base: software lives only as long as it is used Something to Look Forward To
• OpenFOAM Workshop 2011: Penn State University, June 2011 • NUMAP-FOAM 2011: Zagreb, September 2011