Numerics Improvements and Validation Results: FOAM

Numerics Improvements and Validation
Results: FOAM-Extend
Update on Work-in-Progress
Hrvoje Jasak
Wikki Ltd. United Kingdom
Faculty of Mechanical Engineering and Naval Architecture, Uni Zagreb, Croatia
1st French OpenFOAM User Group Meeting, Rouen
18 May 2016
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 1
Outline
Objective
• Give an update on ongoing technical developments
• Share some news from the neighbourhood
Topics
• Major numerics clean-up in upcoming foam-extend-4.0 release
• Features and performance update for the coupled p-U solver
• Interface jump conditions in free surface flows: embedded interface model
• Decomposition method for free surface flow: relaxation zones and SWENSE
• Harmonic balance for turbomachinery simulations
• Report from NUMAP Spring 2016
• Summary
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 2
Clean-Up of Numerics in FOAM
Numerics Clean-Up in the New Release: foam-extend
• Complaints about inconsistent numerics at Oct/2015 ESI User Group Meeting
◦ Dependence of the solution on time-step size and relaxation factor
◦ Noisy pressure trace in simulations with rotating interfaces (turbomachinery)
• Removed ddtPhiCorr and resolved the problem in top-level code
◦ Clear code: easy to understand
◦ More efficient in matrix assembly
◦ Fully consistent on moving and topologically changing meshes
• Basic numerics improvements: “I have fixed icoFoam and simpleFoam”
• Transient dynamic mesh simulations with topo changes: clean force/pressure
trace!
• Compressible flow solver improvements: “Henrik has fixed sonicFoam” (and
also coupled compressible rhoPUCoupledFoam)
◦ Consistent reduction to incompressible flow formulation in absence of ρ(p)
compressibility
◦ Significant improvement in stability and robustness (!)
• Coupled p-U solver performance and better coupled implicit turbulence models
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 3
Clean-Up of Numerics in FOAM
Numerics Clean-Up in the New Release: Transient Solver
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 4
Clean-Up of Numerics in FOAM
Numerics Clean-Up in the New Release: Time-Step Dependence
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 5
Performance of the Coupled p-U Solver
Performance Improvements of the Coupled p-U Solver: Speed and Robustness
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 6
Performance of the Coupled p-U Solver
Performance Improvements of the Coupled p-U Solver: Speed and Robustness
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 7
Performance of the Coupled p-U Solver
Performance Improvements and Extensions in the Coupled p-U Solver
• Improvements in performance for the coupled solver: consistency, numerics
• Extension to compressible flows, MRF and porous media (implicit!)
• Major performance jump: block-coupled AMG with additive correction
(Hutchinson 1988)
• Block-coupled k − ǫ and k − ω SST turbulence models
◦ Turbulence equations solved in a single block-coupled system
◦ Analysis of source terms to establish favourable cross-equation coupling
◦ Implemented in Diploma Thesis assignment: Robert Keser, Uni Zagreb
• Example: steady (MRF) and transient centrifugal pump
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 8
Performance of the Coupled p-U Solver
Performance Improvements and Extensions in the Coupled p-U Solver
Comparison between MRFcoupled and MRFsegregated
initial residuals
Comparison between MRFcoupled and MRFsegregated turbulence
Ux_0 (coupled)
Uy_0 (coupled)
Uz_0 (coupled)
p_0 (coupled)
Ux_0 (segregated)
Uy_0 (segregated)
Uz_0 (segregated)
p_0 (segregated)
0.01
0.0001
100
200
300
400
0.1
0.01
0.001
1e-05
0
500
Iterations
100
200
100
1e+05
Head (segregated)
Head (coupled)
60000
50000
40000
-40
30000
-60
20000
-80
10000
100
200
300
400
500
Power (segregated)
Power (coupled)
0
0
Iterations
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Efficiency (segregated)
Efficiency (coupled)
120
Efficiency [%]
70000
Power [W]
80000
40
-20
140
90000
60
0
500
OtaBm1 pump efficiency
OtaBm1 pump power
20
400
Comparison between MRFcoupled and MRFsegregated
Comparison between MRFcoupled and MRFsegregated
OtaBm1 pump head
80
300
Iterations
Comparison between MRFcoupled and MRFsegregated
Head [m]
k_0 (segregated)
omega_0 (segregated)
k_0 (coupled)
omega_0 (coupled)
0.0001
0
-100
0
initial residuals
1
Initial Residuals
Initial Residuals
1
100
80
60
40
20
100
200
300
Iterations
400
500
0
0
100
200
300
400
500
Iterations
Numerics Improvements and Validation Results: FOAM-Extend – p. 9
Consistency Efficiency Improvements
Various Efficiency and Accuracy Improvements
• Updated gradient caching infrastructure: steady and transient simulations
• Major efficiency upgrade for large GGI interfaces in parallel execution
◦ Fully parallel search and cutting (load balance on all processors)
◦ Optimised data exchange
◦ Example: large mixer simulation: 30 M cells, 155 k GGI faces, 56 cores
Comms
blocking
non-blocking
Old GGI
New GGI
581.03 s
176.30 s
628.52 s
154.76 s
• Implemented a family of gradient limiters in a generic manner: Barth-Jespersen,
Venkatakrishnan, Michalak-Gooch, Wang
• In progress: performance improvements for the Immersed Boundary Method
• In progress: block-coupled boundary coefficients in the coupled solver
• Further development of coupled density-based high-speed solver dbnsFoam
• New FSI library: Željko Tuković
• Consistency: Input deck compatibility with OpenFOAM-3.0.x
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 10
Interface Jump Conditions
Naval Hydro Pack: Interface Jump Conditions for Free Surface Flows
• In free surface flows, a discrete surface discontinuity exists with a sharp change in
properties: ρ, ν: proper handling is needed for accurate free surface simulations
• Huang et.al. (2007) describe a ghost fluid single-phase formulation of interface
jump conditions in CFD-Ship Iowa
• Extended, modified and numerically improved treatment by Vukčević and Jasak
(2015) with 2-phase handling is implemented in the Naval Hydro pack
◦ Perfectly clean interface: no surface jets
◦ Pressure force evaluated exactly even for a smeared VOF interface
◦ Dramatically increased efficiency and accuracy of wave modelling
, α <0.5
dry cells
α =0.5
dry cell,
αN <0.5
N
β−
α =0.5
β+
xΓ
df
P
wet cell,
α P > 0. 5
, α >0.5
wet cells
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 11
Interface Jump Conditions
Interface Jump Conditions: Derivation
• Conditionally averaged momentum equation:
∂(ρu)
+ ∇•(ρuu) = ∇•σef f − ∇pd − (g•x∇ρ)
∂t
• Looking at the RHS of the equation, the gradient of dynamic pressure (∇pd ) is
balanced by the density gradient (∇ρ).
• The balance between pressure and density gradients happens in the
momentum equation...
• ...which in turn causes spurious air velocities because the pressure–density
coupling should not be resolved in the momentum equation using a segregated
solution algorithm
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 12
Interface Jump Conditions
Interface Jump Conditions: Derivation
• "Mixture formulation" of the momentum equation:
1
∂u
+ ∇•(uu) − ∇• (νe ∇u) = − ∇pd
∂t
ρ
• Dynamic pressure jump conditions at the interface:
[pd ] = −[ρ]g•x
1
∇pd = 0
ρ
• Interface jumps implemented directly in discretisation operators
• Interface jump condition can be used both with level set and VOF
• . . . and smearing of the surface in VOF no longer affects the pressure forces!
• Extension to viscous force jump can be performed but currently not used
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 13
Interface Jump Conditions
Interface Jump Conditions: Results
• Example: 2D ramp with free surface
• Relative error for water height at the outlet is −0.34% compared to analytical
solution
• Note sharp pd jump and α distribution
• The simulation with interFoam is not stable due to spurious air velocities
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 14
Interface Jump Conditions
Interface Jump Conditions: Results
• Example: KCS sinkage and trim (Tokyo 2015 Workshop)
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 15
Decomposition Models
Decomposition Models: Wave Relaxation Zones and SWENSE
• General second-order CFD methodology brings a relatively high discretisation
error: requirements on time-step and mesh size for realistic (irregular) wave
propagation are high
• Introduction of sea states into a CFD domain typically cannot be done well using
conventional boundary conditions: a better method is needed
• Relaxation Zone Approach
◦ Relaxation zones at edges of the domain are identified and the CFD solution
fields are implicitly blended with prescribed wave fields
◦ In the bulk of the domain, conventional CFD methodology is used
• Domain-Wide Decomposition Approach (SWENSE)
◦ Governing equations are decomposed into the incident and diffracted
(correction) component, which together make up the complete non-linear CFD
solution, equivalent to solving Navier-Stokes free surface flow equations
◦ Incident fields are obtained from (complex) potential theory models
◦ CFD methodology is used to solve for the correction component
• Both approaches have advantages, depending on the level of non-linearity in the
region of interest
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 16
SWENSE Solver
Decomposition Models: Wave Relaxation Zones and SWENSE
• Conventional VOF is not appropriate for SWENSE decomposition: the Naval
Hydro pack is using alternative interface capturing techniques
◦ Implicitly redistanced level set method
◦ Phase field method
• Modifications in implicit field blending and numerics
• Result: highly accurate low-cost simulations: approx. 10 times faster than
conventional CFD methodology; sea-keeping approx. 100 times faster
ψ(y) = −y
y
Ω2
φ(ψ) =tanh
ψ
α(ψ) =0.5(sgn(ψ) +1)
ǫ 2
air
Γ
∇
(0)
(−1)
( +1)
(0)
( +1) x,(ψ,φ,α)
water
Ω1
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 17
SWENSE Solver
Naval Hydro Pack: Tokyo 2015 Validation
• Detailed validation and verification (mesh uncertainty, periodic uncertainty)
◦ Steady resistance, KCS hull: Case 2.1
◦ Added resistance in head waves, 5 heights: Case 2.10
◦ Added resistance in oblique waves: 5 wave directions: Case 2.11
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 18
Harmonic Balance Solver
Harmonic Balance Method: Work-Flow
• Variables are developed into Fourier series in time with n-harmonics and
substituted into transport equation
• Transport equation with n sine and n cosine parts + mean part is obtained and
written as a set of 2n + 1 equations in frequency domain
• Equations are transformed back to time domain in order to be able to use
time-domain boundary conditions and time-domain non-linear flow solver
Harmonic Balance in FOAM-Extend
• Harmonic balance decomposition does not relate to a special physics model:
implement HB as a choice of “temporal discretisation” scheme
• Geometric aspects of harmonic balance can be tackled without change
• Currently, HB is implemented in a segregated mode: low memory, and explicit
inter-mode coupling terms. Analysis shows issues for HB without a dominant
mean flow component: working towards coupled implicit HB solver
• Author: Gregor Cvijetić, Uni Zagreb
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 19
Harmonic Balance Solver
Rapid Simulation of Non-Linear Periodic Flow: Harmonic Balance
• A variable is presented by a Fourier series, using first n harmonics and the mean:
replacing a transient simulation with a set of coupled steady-state problems
• Periodicity is independently developed in each computational point
• Non-linear interaction is captured without simplification
• Example: Harmonic Balance scalar equation set
∇•(uQtj ) − ∇•(γ∇Qtj ) = −
Pi =
n
X
k sin(kωi∆t),
2ω
2n + 1
2n
X
P(i−j) Qti
i=1
!
for i = {1,2n}.
k=1
• A transient equation is replaced by a set of n coupled quasi-steady coupled
equations of the same type
• Physical justification: if a functional form of temporal variation is known, the
function and its time derivative can be reproduced from a small number of data
points by fitting a prescribed harmonic function (spectral time accuracy!)
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 20
Harmonic Balance Solver
Harmonic Balance for Navier-Stokes Equations
• Harmonic balance momentum equation
∇•(utj utj ) − ∇•(γ∇utj ) = −
2ω
2n + 1
2n
X
i=1
P(i−j) uti
!
• Harmonic continuity equation
∇•utj = 0.
• Harmonic scalar transport
∇•(utj Qtj ) − ∇•(γ∇Qtj ) = −
2ω
2n + 1
2n
X
i=1
P(i−j) Qti
!
• Physical justification: each tj instance represents a “single-time-step” solution;
time derivative terms couple solution fields to each other
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 21
Harmonic Balance Solver
Harmonic Balance Solver: ERCOFTAC Centrifugal Pump
• Validation of harmonic balance in turbulent incompressible periodic flow
• HB simulations performed using 1 and 2 harmonics: rotor and stator blade count
• Results compared against full transient simulation: excellent agreement
◦ Integral properties: typical error of 2%
◦ Local solution features: pressure on surface in time
◦ Mode and nature of flow instability
• Results are significantly better than expected!
• Substantial reduction in simulation time:
◦ Intel Core i5-3570K, 3.4 GHz computer with 16 GB memory
◦ Transient run needs approx. 50 blade passages to become quasi-periodic
Simulation time
Iterations
Transient
HB, 1 h
HB, 2 h
5 hrs/rotation
600, dt = 5e-5 s
1 rotation = 0.03 s
52 mins
3000
78 mins
2400
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 22
Harmonic Balance Solver
0
0
-200
-200
-200
-400
-400
-400
-600
-800
Transient
HB, 1h
HB, 2h
-1000
-1200
-0.2
-0.15
Pressure, Pa
0
Pressure, Pa
Pressure, Pa
Harmonic Balance Solver: ERCOFTAC Centrifugal Pump
-600
-800
Transient
HB, 1h
HB, 2h
-1000
-0.1
-0.05
0
-1200
-0.15
-0.1
-600
-800
Transient
HB, 1h
HB, 2h
-1000
-0.05
0
0.05
-1200
-0.15
x-Axis
x-Axis
-0.1
-0.05
0
0.05
x-Axis
Transient solver
HB, 1 h
error, %
HB, 2 h
error, %
T
3
Efficiency
Head
Torque
89.72
81.48
0.0297
93.55
83.37
0.0305
4.26
2.32
2.65
90.07
83.04
0.0303
0.39
1.92
2.03
2T
3
Efficiency
Head
Torque
89.92
81.48
0.0296
92.07
83.45
0.0304
2.38
2.41
2.64
93.85
83.13
0.0303
4.36
2.02
2.28
t=T
Efficiency
Head
Torque
89.83
81.49
0.0297
89.63
83.09
0.0304
0.22
1.96
2.65
91.68
82.94
0.0303
2.07
1.77
2.28
t=
t=
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 23
Harmonic Balance Solver
Harmonic Balance Solver: Transient and Harmonic Balance ERCOFTAC Centrifugal
Pump
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 24
NUMAP Spring 2016
NUMAP Spring 2016
• NUMAP Spring just completed: report by Bernardas Jankauskas, Uni Exeter
• ESI/OpenCFD sponsoring the 2016 NUMAP Spring School: Thank You!
• NUMAP Summer 2016: 22/Aug – 2/Sep/2016 applications just closed
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 25
Upcoming Events
11th OpenFOAM Workshop
26–30/Jun/2016 Guimares, Portugal
http://www.openfoamworkshop.org
NUMAP-FOAM Summer School 2016
Zagreb Croatia, 22/Aug–2/Sep/2016
https://www.fsb.unizg.hr/?OpenFOAM Summer School 2016
User Day: Naval Hydrodynamics with
OpenFOAM and the Naval Hydro Pack
23 May 2016 London, England
http://www.wikki.co.uk/events/navalHydroEvent
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and Validation Results: FOAM-Extend – p. 26