Escolar Documentos
Profissional Documentos
Cultura Documentos
OpenFOAM
Hrvoje Jasak
h.jasak@wikki.co.uk, hrvoje.jasak@fsb.hr
Objective
Present Design rationale and some capabilities of OpenFOAM software
Illustrate some recent work with complex and coupled simulation examples
Topics
Background: Numerical simulation in engineering
Software architecture and limitations
Object orientation is use: mimicking partial differential equations in code
Some Examples:
Parallelisation and parallel scaling
Radial Basis Function in mesh motion, morphing and shape optimisation
Fluid-Structure Interaction (FSI) solvers in a single software
Multi-phase compressible free surface flows
Linear solver performance: accelerated AMG solvers
Points of interest: using Open Source numerical simulation software in academia
and industry
2
k 1 o
+ (uk) [( + t )k] = t (u + uT ) k
t 2 ko
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 Software
Analysis of numerical simulation software through object orientation:
Recognise main objects from the numerical modelling viewpoint
Objects consist of data they encapsulate and functions which operate on the data
Example: Sparse Matrix Class
Data members
Sparse addressing pattern (CR format, arrow format)
Diagonal coefficient
Off-diagonal coefficients
Operations on matrices or data members
Matrix algebra: +, , , /, scalar multiplication
Matrix-vector product, transpose, triple product, under-relaxation
Example: Linear Solver
Operate on a system of linear equations [A][x] = [b] to obtain [x]
It is irrelevant how the matrix was assembled or what shall be done with solution
Ultimately, even the solver algorithm is not of interest: all we want is new x!
Gauss-Seidel, AMG, direct solver: all answer to the same interface
decomposition
Subdomain 3 Subdomain 4
72 CPU
144 CPU
2500 288 CPU
2000
Execution Time [s]
1500
1000
500
0
0 2e-07 4e-07 6e-07 8e-07
Simulation Time (Iteration) [s]
Intel Xeon Processor: X5650 B0; Frequency: 2.93 GHz # processors 2; # cores 6;
Cache (L1 KB/L2 MB/L3 MB): 32 KB / 256 KB / 12 MB; 6x4GB DDR3 1333 RDIMM QDR
InfiniBand 4x
Massively Parallel Scaling in CFD Solvers: Vestas, IBM Server, 12 000 Cores
Nb
X
s(x) = j (|x xb,j |) + q(x)
j=1
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 + b1 x + b2 y + b3 z
Consistency of interpolation is achieved by requiring that all polynomials of the
order lower than q disappear at data points
Nb
X
j p(xb,j ) = 0
j=1
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
v
Z Z
u dVu = nu u + u FT
u + u FT
u dSu
t
Vu Su
u = 2Eu + tr (Eu ) I
1h T T
i
Eu = u + (u) + u(u)
2
v
Z I I
u dVu nu (2 + )u dSu = nu q dSu
t
Vu Su Su
Flow-Induced Deformation
Traditional explicit coupling: Picard iterations. Pressure transferred from fluid to
structure and displacement from structure to fluid: profile and force conservation
Fluid: incompressible flow model
Stress analysis: linear response with large deformation
Automatic mesh motion deforms the fluid mesh
On solid side, mesh deformation is a part of the solution
Solid
(u) 2
+ (uu) = 2N N tr()I pI +
t 3
where
Z tt
2
N = t p = 31 tr() = 2 tr()I dt
t=0 3
Results courtesy of dr. A Karac, University of Zenica and prof. A. Ivankovic, UC Dublin
()
+ (u ) = 0
t
Momentum equation
(u)
+ (u u) = g
t
Phase compressibility: ideal gas law and constant speed of sound for liquid
p
G = = G p, G = = f (p)
RT p
L = 0 + L (p p0 ), L = const.
p
+ u = G + up u
t G t
1 2 2 1
+ (u ) u = (1 ) u
t 1 2 + (1 )2 1
1 2 2 1 p
+ (u p) pu + u = 0
1 2 + (1 )2 1 t
A = + (u ) u
t
2 1 p
Ap = (1 ) + (u p) pu
2 1 t
Ap = 0 not allowed for conservation!!!
1 2 2 1 p 1
App = + (u p) pu + p
1 2 + (1 )2 1 t aP
ICCG
CG-AAMG 2, V, SGS
CG-AAMG 4, V SGS
0.01 CG-AAMG 4, W, ILU
CG-SAMG, W, ILU
residual
0.0001
1e-06
1e-08
0 50 100 150 200
iteration
Preconditioned Linear Solvers: Parallel Execution Time Test, Fine Mesh 5m cells
Preconditioned Linear Solvers: Parallel Execution Time Test, Fine Mesh 5m cells
Coarsening strategy plays the dominant role for convergence rates of AMG
Aggressive coarsening with good smoother (AAMG 4, ILU) is very effective
Preconditioned AAMG with aggressive smoothing, ILU smoother and W-cycle
overall the best from the execution time point of view
Preconditioned CG-AAMG with aggressive coarsening and ILU smoother and
W-cycle the best combination from the parallel point of view
Hrvoje Jasak
First degree: mechanical engineering, University of Zagreb, Croatia
PhD, Imperial College London 1993-1996
Senior development engineer, CD-adapco, 1996-2000
Technical director, Nabla Ltd. 2000-2004
Solver architecture and CFD consultant, Ansys Fluent 2000-2008
Current Work
Director, Wikki: consultancy company based in the UK, Germany and Australia
Various software development and commercial support projects based on
OpenFOAM with consultants and large industrial partners
Professor, University of Zagreb, Croatia
Collaboration with several Universities and government research labs on wide
range of OpenFOAM activities, including naval hydrodynamics
Coordinating open source OpenFOAM development to allow contributions from the
public domain developers
OpenFOAM workshops, lectures and seminars, visiting professorships (currently
at TU Delft and TU Darmstadt)