1st French FOAM User Group Meeting, Rouen, 18/May/2016
Numerics Improvements and ValidationResults: 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
Numerics Improvements and Validation Results: FOAM-Extend – p. 1
1st French FOAM User Group Meeting, Rouen, 18/May/2016
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
Numerics Improvements and Validation Results: FOAM-Extend – p. 2
1st French FOAM User Group Meeting, Rouen, 18/May/2016
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/pressuretrace!
• Compressible flow solver improvements: “Henrik has fixed sonicFoam” (andalso 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
Numerics Improvements and Validation Results: FOAM-Extend – p. 3
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Clean-Up of Numerics in FOAM
Numerics Clean-Up in the New Release: Transient Solver
Numerics Improvements and Validation Results: FOAM-Extend – p. 4
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Clean-Up of Numerics in FOAM
Numerics Clean-Up in the New Release: Time-Step Dependence
Numerics Improvements and Validation Results: FOAM-Extend – p. 5
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Performance of the Coupled p-U Solver
Performance Improvements of the Coupled p-U Solver: Speed and Robustness
Numerics Improvements and Validation Results: FOAM-Extend – p. 6
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Performance of the Coupled p-U Solver
Performance Improvements of the Coupled p-U Solver: Speed and Robustness
Numerics Improvements and Validation Results: FOAM-Extend – p. 7
1st French FOAM User Group Meeting, Rouen, 18/May/2016
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
Numerics Improvements and Validation Results: FOAM-Extend – p. 8
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Performance of the Coupled p-U Solver
Performance Improvements and Extensions in the Coupled p-U Solver
0 100 200 300 400 500Iterations
0.0001
0.01
1
Initi
al R
esid
uals
Ux_0 (coupled)Uy_0 (coupled)Uz_0 (coupled)p_0 (coupled)Ux_0 (segregated)Uy_0 (segregated)Uz_0 (segregated)p_0 (segregated)
Comparison between MRFcoupled and MRFsegregated initial residuals
0 100 200 300 400 500Iterations
1e-05
0.0001
0.001
0.01
0.1
1
Initi
al R
esid
uals
k_0 (segregated)omega_0 (segregated)k_0 (coupled)omega_0 (coupled)
Comparison between MRFcoupled and MRFsegregated turbulenceinitial residuals
0 100 200 300 400 500Iterations
-100
-80
-60
-40
-20
0
20
40
60
80
100
Hea
d [m
]
Head (segregated)Head (coupled)
Comparison between MRFcoupled and MRFsegregatedOtaBm1 pump head
0 100 200 300 400 500Iterations
0
10000
20000
30000
40000
50000
60000
70000
80000
90000
1e+05
Pow
er [
W]
Power (segregated)Power (coupled)
Comparison between MRFcoupled and MRFsegregatedOtaBm1 pump power
0 100 200 300 400 500Iterations
0
20
40
60
80
100
120
140
Eff
icie
ncy
[%]
Efficiency (segregated)Efficiency (coupled)
Comparison between MRFcoupled and MRFsegregatedOtaBm1 pump efficiency
Numerics Improvements and Validation Results: FOAM-Extend – p. 9
1st French FOAM User Group Meeting, Rouen, 18/May/2016
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 581.03 s 628.52 sNew GGI 176.30 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 Tukovic
• Consistency : Input deck compatibility with OpenFOAM-3.0.x
Numerics Improvements and Validation Results: FOAM-Extend – p. 10
1st French FOAM User Group Meeting, Rouen, 18/May/2016
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 inproperties: ρ, ν: proper handling is needed for accurate free surface simulations
• Huang et.al. (2007) describe a ghost fluid single-phase formulation of interfacejump conditions in CFD-Ship Iowa
• Extended, modified and numerically improved treatment by Vukcevic 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
wet cells, α>0.5
N
dry cell, αN <0.5
P
wet cell, αP >0.5
α=0.5β−
β+
df
xΓ
Numerics Improvements and Validation Results: FOAM-Extend – p. 11
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Interface Jump Conditions
Interface Jump Conditions: Derivation
• Conditionally averaged momentum equation:
∂(ρu)
∂t+∇•(ρuu) = ∇•σeff −∇pd − (g•x∇ρ)
• Looking at the RHS of the equation, the gradient of dynamic pressure (∇pd) isbalanced by the density gradient (∇ρ).
• The balance between pressure and density gradients happens in themomentum equation...
• ...which in turn causes spurious air velocities because the pressure–densitycoupling should not be resolved in the momentum equation using a segregatedsolution algorithm
Numerics Improvements and Validation Results: FOAM-Extend – p. 12
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Interface Jump Conditions
Interface Jump Conditions: Derivation
• "Mixture formulation" of the momentum equation:
∂u
∂t+∇•(uu)−∇• (νe∇u) = −
1
ρ∇pd
• 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
Numerics Improvements and Validation Results: FOAM-Extend – p. 13
1st French FOAM User Group Meeting, Rouen, 18/May/2016
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 analyticalsolution
• Note sharp pd jump and α distribution
• The simulation with interFoam is not stable due to spurious air velocities
Numerics Improvements and Validation Results: FOAM-Extend – p. 14
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Interface Jump Conditions
Interface Jump Conditions: Results
• Example: KCS sinkage and trim (Tokyo 2015 Workshop)
Numerics Improvements and Validation Results: FOAM-Extend – p. 15
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Decomposition Models
Decomposition Models: Wave Relaxation Zones and SWENSE
• General second-order CFD methodology brings a relatively high discretisationerror: requirements on time-step and mesh size for realistic (irregular) wavepropagation are high
• Introduction of sea states into a CFD domain typically cannot be done well usingconventional 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 CFDsolution, 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 theregion of interest
Numerics Improvements and Validation Results: FOAM-Extend – p. 16
1st French FOAM User Group Meeting, Rouen, 18/May/2016
SWENSE Solver
Decomposition Models: Wave Relaxation Zones and SWENSE
• Conventional VOF is not appropriate for SWENSE decomposition: the NavalHydro 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 thanconventional CFD methodology; sea-keeping approx. 100 times faster
∇
Ω1
Ω2
water
air
Γ
x,(ψ,φ,α)
y ψ(y) =−y
(0)
φ(ψ) =tanh(
ψ
ǫ√2
)
( +1)(−1)
α(ψ) =0.5(sgn(ψ) +1)
(0) (+1)
Numerics Improvements and Validation Results: FOAM-Extend – p. 17
1st French FOAM User Group Meeting, Rouen, 18/May/2016
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
Numerics Improvements and Validation Results: FOAM-Extend – p. 18
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Harmonic Balance Solver
Harmonic Balance Method: Work-Flow
• Variables are developed into Fourier series in time with n-harmonics andsubstituted into transport equation
• Transport equation with n sine and n cosine parts + mean part is obtained andwritten as a set of 2n+ 1 equations in frequency domain
• Equations are transformed back to time domain in order to be able to usetime-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 explicitinter-mode coupling terms. Analysis shows issues for HB without a dominantmean flow component: working towards coupled implicit HB solver
• Author: Gregor Cvijetic, Uni Zagreb
Numerics Improvements and Validation Results: FOAM-Extend – p. 19
1st French FOAM User Group Meeting, Rouen, 18/May/2016
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) = −2ω
2n+ 1
(
2n∑
i=1
P(i−j)Qti
)
Pi =n∑
k=1
k sin(kωi∆t), for i = 1,2n.
• A transient equation is replaced by a set of n coupled quasi-steady coupledequations of the same type
• Physical justification: if a functional form of temporal variation is known, thefunction and its time derivative can be reproduced from a small number of datapoints by fitting a prescribed harmonic function (spectral time accuracy!)
Numerics Improvements and Validation Results: FOAM-Extend – p. 20
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Harmonic Balance Solver
Harmonic Balance for Navier-Stokes Equations
• Harmonic balance momentum equation
∇•(utjutj)−∇•(γ∇utj ) = −2ω
2n+ 1
(
2n∑
i=1
P(i−j)uti
)
• Harmonic continuity equation∇•utj = 0.
• Harmonic scalar transport
∇•(utj Qtj)−∇•(γ∇Qtj) = −2ω
2n+ 1
(
2n∑
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
Numerics Improvements and Validation Results: FOAM-Extend – p. 21
1st French FOAM User Group Meeting, Rouen, 18/May/2016
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
Transient HB, 1 h HB, 2 h
Simulation time 5 hrs/rotation 52 mins 78 mins
Iterations 600, dt = 5e-5 s 3000 24001 rotation = 0.03 s
Numerics Improvements and Validation Results: FOAM-Extend – p. 22
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Harmonic Balance Solver
Harmonic Balance Solver: ERCOFTAC Centrifugal Pump
-0.2 -0.15 -0.1 -0.05 0x-Axis
-1200
-1000
-800
-600
-400
-200
0
Pres
sure
, Pa
TransientHB, 1hHB, 2h
-0.15 -0.1 -0.05 0 0.05x-Axis
-1200
-1000
-800
-600
-400
-200
0
Pres
sure
, Pa
TransientHB, 1hHB, 2h
-0.15 -0.1 -0.05 0 0.05x-Axis
-1200
-1000
-800
-600
-400
-200
0
Pres
sure
, Pa
TransientHB, 1hHB, 2h
Transient solver HB, 1 h error, % HB, 2 h error, %
Efficiency 89.72 93.55 4.26 90.07 0.39t = T
3Head 81.48 83.37 2.32 83.04 1.92
Torque 0.0297 0.0305 2.65 0.0303 2.03
Efficiency 89.92 92.07 2.38 93.85 4.36t = 2T
3Head 81.48 83.45 2.41 83.13 2.02
Torque 0.0296 0.0304 2.64 0.0303 2.28
Efficiency 89.83 89.63 0.22 91.68 2.07t = T Head 81.49 83.09 1.96 82.94 1.77
Torque 0.0297 0.0304 2.65 0.0303 2.28
Numerics Improvements and Validation Results: FOAM-Extend – p. 23
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Harmonic Balance Solver
Harmonic Balance Solver: Transient and Harmonic Balance ERCOFTAC CentrifugalPump
Numerics Improvements and Validation Results: FOAM-Extend – p. 24
1st French FOAM User Group Meeting, Rouen, 18/May/2016
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
Numerics Improvements and Validation Results: FOAM-Extend – p. 25
1st French FOAM User Group Meeting, Rouen, 18/May/2016
Upcoming Events
11th OpenFOAM Workshop26–30/Jun/2016 Guimares, Portugal
http://www.openfoamworkshop.org
NUMAP-FOAM Summer School 2016Zagreb Croatia, 22/Aug–2/Sep/2016
https://www.fsb.unizg.hr/?OpenFOAM Summer School 2016
User Day: Naval Hydrodynamics withOpenFOAM and the Naval Hydro Pack
23 May 2016 London, Englandhttp://www.wikki.co.uk/events/navalHydroEvent
Numerics Improvements and Validation Results: FOAM-Extend – p. 26