ship resistance simulations with openfoam - openfoam workshop
TRANSCRIPT
Ship Resistance Simulations with OpenFOAM
Kevin Maki
University of MichiganAnn Arbor, MI USA
6th OpenFOAM Workshop13 - 16 June 2011
The Pennsylvania State UniversityState College, PA, USA
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 1 / 22
Introduction
simulate flow around ship moving steadily in calm waterhigh Reynolds number 106 model scale, 109 full scalelongest wave is 2πF 2Lin deep water the Kelvin angle is approximately 19 degseek primarily the force on the body, also position of body
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 2 / 22
Outline
1 Introduction
2 Governing EquationsVolume of FluidMomentum and Continuity Equations
3 NumericsinterFoam solver
4 Solution Settings
5 Wigley Hull Tutorial
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 3 / 22
Interface tracking versus interface capturing
OpenFOAM has both interfacecapturing and interfacetracking solversmost ship hydrodynamicssolvers use interfacecapturing, volume-of-fluid,level set, or a combination, tosolve ship hydrodynamicsproblems.Can a ship move (at model orfull scale) and not generate abreaking wave?
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 4 / 22
Volume of Fluiduse scalar indicator function to representthe phase of the fluid in each cell (was γin versions ≤ 1.5, is α in versions ≥ 1.6).
α = α(x, t) (1)µ(x, t) = µwaterα + µair(1− α) (2)ρ(x, t) = ρwaterα + ρair(1− α) (3)
The density and viscosity are materialproperties of the fluids.
DαDt
= 0 (4)
∂α
∂t+ u · ∇α = 0 (5)
∂α
∂t+∇ · uα = 0 (6)
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 5 / 22
Volume-of-fluid with compressionthe α function transitions from 1 to 0 over an infinitesimalthickness. This leads to difficulty in approximating the gradient ofα, and results in smearing of the interface.One remedy, is to use a modified governing equation. Themodification should return solutions of the original equation for thetime evolution of the interface, but help by keeping the interfacecrisp.
∂α
∂t+∇ · uα +∇ ·wα = 0
u is the physical velocity field, and w is an artificial velocity fieldthat is directed normal to and towards the interface.
∂α
∂t+∇ · uα +∇ ·w(α(1− α)) = 0
the user can specify the relative magnitude of the artificial velocity(using cAlpha)
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 6 / 22
Momentum, dynamic pressure
Full Reynolds-averaged momentum equations for the velocity Uand pressure P in a fluid with density ρ and dynamic viscosity µ
∂ρU∂t
+∇ · UU = −∇P + ρg +∇ ·[(µ+ µt )(∇U +∇U>)
]Express the pressure in terms of a hydrostatic component, andthe remainder or that due to dynamic or non-zero velocity p
P = ρg · x︸ ︷︷ ︸hydrostatic
+ p︸︷︷︸dynamic
Governing equation in terms of dynamic pressure
∂ρU∂t
+∇ · UU = −∇p − g · x∇ρ+∇ ·[(µ+ µt )(∇U +∇U>)
]
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 7 / 22
Momentum, viscous stress
See Henrik Rusche’s Thesis, pg 156
∇ ·[µeff(∇U +∇U>)
]= ∇ · (µeff∇U) +∇ · (µeff∇U>)
= ∇ · (µeff∇U) +∇U · ∇µeff + µeff∇(∇ · U)
= ∇ · (µeff∇U) +∇U · ∇µeff
Final form of the momentum equation:
∂ρU∂t
+∇ · UU = −∇p − g · x∇ρ+∇ · (µeff∇U) +∇U · ∇µeff
Note, ∇ρ is zero away from the interface, and VERY large alongthe interface.
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 8 / 22
Boundary conditions
Centerplane:symmetryPlaneTop
∂U/∂n = 0p = 0α = 0
Body
U = 0∂p/∂n = 0∂α/∂n = 0
Inlet
U = U∞∂p/∂n = 0
α =
{1 if z < 00 otherwise
Outlet
∂U/∂n = 0p = 0
∂α/∂n = 0
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 9 / 22
interFoamVOF for interface capturingPISO for pressure velocity couplingunknowns:p_rgh p dynamic pressurep P total pressure (P = p + ρg · x)alpha1 α volume fractionU U velocity vectorphi Sf · Uf velocity fluxrhoPhi Sf · ρf Uf mass fluxgh g · xP hydrostatic pressure over density at cell centerghf g · xf hydrostatic pressure over density at face center
P-30 Discretisation procedures
2.3 Discretisation of the solution domain
Discretisation of the solution domain is shown in Figure 2.1. The space domain is discretisedinto computational mesh on which the PDEs are subsequently discretised. Discretisationof time, if required, is simple: it is broken into a set of time steps ∆t that may changeduring a numerical simulation, perhaps depending on some condition calculated during thesimulation.
z
y
xSpace domain
t
Time domain
∆t
Figure 2.1: Discretisation of the solution domain
N
SfP
f
d
Figure 2.2: Parameters in finite volume discretisation
On a more detailed level, discretisation of space requires the subdivision of the domaininto a number of cells, or control volumes. The cells are contiguous, i.e. they do not overlapone another and completely fill the domain. A typical cell is shown in Figure 2.2. Dependentvariables and other properties are principally stored at the cell centroid P although they
Open∇FOAM-1.6
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 10 / 22
interFoam algorithm
1 solve transport equation for volume fraction2 generate linear systems for momentum components U,V ,W ,
using convection and viscous terms only3 (optional) solve for momentum components using old values of
pressure gradient and density gradient4 form the pressure Poisson equation, and solve (may loop over this
for non-orthogonal correction update)5 update velocity with pressure gradient6 update face flux with pressure contribution7 update turbulence quantities
PISO loop over steps 4-6.
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 11 / 22
Momentum prediction
Total momentum equation:
∂ρU∂t
+∇ · UU = −∇p − g · x∇ρ+∇ · (µeff∇U) +∇U · ∇µeff
in prediction, form linear systems using convection and viscous termsonly:
∂ρU∂t
+∇ · UU−∇ · (µeff∇U)−∇U · ∇µeff = 0
�
[A]U {U} = {bU}[A]V {V} = {bV}
[A]W {W} = {bW}
if you “solve” for momentum prediction:
{U} = [A]−1U · [{bU} − ∇p · i− g · x∇ρ · i]
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 12 / 22
Pressure correctionstart with semi-discrete momentum equation
[A]U {U} = [{bU} − ∇p · i− g · x∇ρ · i]look at equation for a single cell
aPUP +∑
aNUN = bP −∇p − g · x∇ρ
calculate the velocity without ∇ρ and ∇p
U?P = a−1
P (bP −∑
aNUN)
interpolation of gradients is bad! (Rhie-Chow). Face flux using starredvelocity
φ? = U?f · Sf
now the flux with the density gradient:
φ′ = φ? − g · xf∂ρ
∂na−1
P,f |Sf |
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 13 / 22
Pressure correction, cont.
use the continuity equation to find pressure that makes the velocitydiscretely divergence free.
∇ · U =∑
Uf · Sf =∑
φ = 0
φ′ will not satisfy continuity because it is a numerical approximation, andit does not contain the pressure gradient term. Return to the momentumequation for a single cell, and note the use of the starred velocity.
UP = U? − a−1P ∇p − a−1
P g · x∇ρinsert into continuity
∇ · a−1P ∇p =
∑φ′
after solving for p, then update the face flux and velocity
φ = φ? −∇ · a−1P,f∇pf
U = U? − g · xf −∇p
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 14 / 22
Time-step size
Courant number in simple terms:
Co = U∆t∆x
For arbitrary polyhedral finite volume:
Co =U · Sf
d · Sf∆t
d is the vector from pole center to neighbor centerif we solve implicit equations, what is an acceptable time step sizebased on the Courant number?
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 15 / 22
PISO-settingsmomentumPredictor: relatively small additional expense→recommendednCorrectors: this is to loop over pressure system, also known asPISO loops. For strict time accuracy, minimum of 2. Calm-waterresistance, 1 should do.nNonOrthogonalCorrectors: due to small time step, and use ofnCorrectors, this may be set to 0 in most cases. Perhaps for initialtime steps on bad grids a few may help.nAlphaCorr: loop over α equation. For time-dependent flows 1-2. Forsteady flow like calm-water resistance, 0.nAlphaSubCycles: this reduces the time-step size for the explicitintegration of the α transport equation. As you increase the time-stepsize for the total system of equations, and if you need time accuracy(maybe retain stability), increase the number of sub-cycles according.cAlpha: the compression term in the advection of α is scaled by thisparameter. Set to zero to deactivate compression. Set to 1 as a nominalvalue.
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 16 / 22
Discretization Settings
time: Euler, Courant number restriction leads to small time steps, firstorder accuracy is fine for calm-water resistance.gradient: lineardivergence: upwind to aid in convergence. vanLeer is second-orderaway from extrema. limitedLinearV may be less diffusive thanvanLeer
Laplacian: Gauss linear corrected. Second-order, with correctionfor non-orthogonal part.
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 17 / 22
Wigley Hull Experiments
Well used test data. Body fixed and free to sink and trim. SRI0.08 < F < 0.402× 106 < R < 1× 107
Item Symbol Value UnitLength L 4.0 mBeam B 0.4 mDraft T 0.25 mWetted Surface S 2.3796 m2
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 18 / 22
Wigley Hull Computations: Time Integration
144K cell coarse grid (Pointwise)
Results: Following simulations were run on different grids for different Froude numbers with the settings stated above.
M esh F r# = 0.15 F r# = 0.316 F r# = 0.4 Coarse X X X Medium X X F ine X X
Table 3: Summary of simulations run The total, pressure and frictional resistance coefficients obtained from these simulations can be given as follows: (Note: The results shown below belong to the finest grid the simulations were run on for that particular Froude number.)
!"#$ %&#$ '($)$*+,-$ '.$)$*+,-$ '/$)$*+,-$+0*1$ -02345+3$ -06-78$ +03+67$ -0-7-7$+0-*3$ 206745+3$ 8091*7$ *09186$ 70663-$+08$ *0++45+2$ 107118$ 708883$ 709*+9$
Table 4: Resistance coefficients results for computed values
The experimental values for resistance coefficients acquired by the University of Tokyo for the same model are
!"#$ %&#$ '($)$*+,-$ '.$)$*+,-$ '/$)$*+,-$+0*1$ -02345+3$ -0998$ :$ -01-8$+0-*3$ 206745+3$ 8091*$ :$ -0*+9$+08$ *0++45+2$ 10-97$ :$ 7066*$
Table 5: Resistance coefficients results for experimental values
As it can be seen from Table 4 and 5, the numerical approximations using the CFD solver are in agreement with the experimental results. Especially the Fine grid computations for Fr# = 0.316 caught 100% convergence with experimental value.
Figure 2: Comparison of Total Resistance Coefficient Results with Experimental Value for Fr# = 0.316 courtesy of Mert Türkol
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 19 / 22
Wigley Hull Computations: Convergence
courtesy of Ensign William Garland
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 20 / 22
Wigley Hull Computations: Full Scale400 m Ship
courtesy of Ensign William GarlandMaki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 21 / 22
Hull Force Library
control over quantity calculated and the write syntax
Fp =
∫S
pndS
Mp =
∫S
(xf − xo)× pndS
Fv =
∫S
¯̄τ · ndS
Mv =
∫S
(xf − xo)× ¯̄τ · ndS
column 1:time, 2-4: Fp, 5-7: Fp, 8-10: Mv , 11-13: Mv
Maki (UofM) Training Session: Ship Resistance 6th OpenFOAM Workshop 22 / 22