You are on page 1of 40

interPhaseChangeFoam

& PANS Turbulence Models

Abolfazl Asnaghi
Dec 2013

Cavitation
Flow Direction

F
Pressure

Liq : Liquid
B

E
Liq.

Vap
C

D
Liq-Vap

Vap: Vapor

Cavitation

Cavitation & OpenFoam


Available solvers in OF for multiphase simulations:
o cavitatingFoam

o multiphaseEulerFoam

o compressibleInterFoam

o multiphaseInterFoam

o compessibleTwoPhaseEulerFoam

o settlingFoam

o interFoam

o twoLiquidMixingFoam

o interPhaseChangeFoam

o twoPhaseEulerFoam

Find more information here:


http://www.openfoam.org/docs/user/standard-solvers.php

interPhaseChangeFoam Solver

Solver for 2 incompressible, isothermal immiscible


interPhaseChangeFoam

fluids with phase-change (e.g. cavitation). Uses a VOF


(volume of fluid) phase-fraction based interface
capturing approach

Added in OF2.2.2 (since after will be called OF)

interPhaseChangeDyFoam

Providing optional mesh motion and mesh topology


changes including adaptive re-meshing

interPhaseChangeFoam Solver
Since we simulate phase change between two incompressible flows, we can not use the
equation of state. Therefore, the transport equation of liquid (or vapor) volume fraction
has to be used, along with a source term to mimic phase change rate.

l u i
xi

Sl

Need to estimate Sl

Provided Phase Change Models by OF:


(use find iname to find their locations inside the solver)

o Kunz
o Merkle
o SchnerrSauer

interPhaseChangeFoam Structure
alphaEqn.H
alphaEqnSubCycle.H
createFields.H
interPhaseChangeFoam.C
pEqn.H
UEqn.H
phaseChangeTwoPhaseMixtures Folder
o Kunz Folder
Kunz.C
Kunz.H
o Merkle Folder
Merkle.C
Merkle.H
o phaseChangeTwoPhaseMixture Folder
phaseChangeTwoPhaseMixture.C
phaseChangeTwoPhaseMixture.H
newPhaseChangeTwoPhaseMixture.C
newPhaseChangeTwoPhaseMixture.H
o SchnerrSauer Folder
SchnerrSauer.C
SchnerrSauer.H
o Make Folder
files
options
o
o
o
o
o
o
o

interPhaseChangeFoam Structure
o alphaEqn.H

o alphaEqnSubCycle.H
o interPhaseChangeFoam.C
o pEqn.H
o UEqn.H
o phaseChangeTwoPhaseMixtures Folder
o phaseChangeTwoPhaseMixture Folder
phaseChangeTwoPhaseMixture.C

phaseChangeTwoPhaseMixture.H
o SchnerrSauer Folder
SchnerrSauer.C
SchnerrSauer.H

User Input
o Initial time folder (usually zero folder)
U: velocity (m/s)
alpha1: liquid volume fraction (must be between zero & one
p_rgh = p-rho.g.h where p here is the thermodynamic pressure which comes

from intermolecular forces and you see it in the N.S. equations (pa)

User Input
o constant folder: transportProperties file
Select the phase change model

Define the saturation pressure


Define the surface tension

Define the phases properties


Remember for cavitation, the first phase is liquid

Define the phases change model properties


n: number of nuclei
dNuc: average diameter of nuclei
Cc: condensation rate coefficient
Cv: vaporization rate coefficient

Solver Flowchart
Reading maxCo, and maxDeltaT from controlDict
Calculates and outputs the mean and
maximum Courant Numbers
Calculates deltaT based on the
maximum Courant Number in the
flow, maximum allowed Courant
Number and maximum allowed deltaT
Calculates viscosity of mean flow
based on the each phase properties,
specified viscosity models for each
phase and alpha distribution. For
homogenous assumption:

(1 v )

(1 v )

In C file: #include "phaseChangeTwoPhaseMixture.H


And then in the above H file:
#include "incompressibleTwoPhaseMixture.H"

Solver Flowchart

Solves alpha1 transport equation, and


obtains new distribution

Correct the alpha boundary condition,


and also interface curvature.

PIMPLE loop to solve momentum, pressure


correction, and turbulence equations.

UEqn
Keeping this term (which is the
continuity equation, and in converged
solution is equal to zero ) would increase
the stability of the solution considerably

p
x

gx
x

g gx .

p
x

g gx .

p gx
x

This trick has simplified the boundary condition


implementation, and also increased the stability
when the gravity should be considered

pEqn
(just intrested parts)

Calling the source terms of pressure


correction equation, vDotP
C: stands for construction of liquid
V: stands for vaporization of liquid
Splitting the source terms in two terms
Sp as diagonal, and the other as Su

.U

cp

V vp . p pSat

V vp . p gh gh pSat

cp

V cp V vp . p rgh V cp V vp . pSat
* Look at the Jassak PhD thesis for further information about pressure correction equations

gh

alphaEqnSubCycle
rhoPhi is
set to zero

Calling nAlphaSubCycles and


nAlphaCorr from pimpleDic
in system/fvSolution file

cAlpha(): two phase interface compression


(relative velocity) coefficient, defined by
user at system/fvSolution:alpha Dictionary
Ref. Henrik PhD Thesis, Eq:3-58

alphaEqnSubCycle
Main time step used in other equations

rhoPhiSum is set equal to rhoPhi equal to zero

subCycle.H is added to main .C file which


itself contains subCycleTime.H

In subCycle.H, runTime.deltaT() has been changed to


deltaT/nAlphaSubCycle or equivalently totalDeltaT/nAlphaSubCycle

Maximum allowed time step for alpha equation is much lower than the one that we can use for
solving momentum or turbulence equations.
Therefore, we consider deltaT as the main time step for momentum or turbulence equations,
and use deltaT/nAlphaSubCycle as the time step for alpha equation.

alphaEqn

l u i
xi

lU

Ur U

vU

l v u r
xi

Sl

Importance of Turbulence Model


Twist11 HydroFoil -

k Omega SST

A.Asnaghi, 16th Numerical Towing Tank Symposium, 2013

PANS
PANS = Partially Averaged Navier Stokes
o The
of PANS (and
other scale
adaptive
that it
If allmain
of theadvantage
velocity disturbance
specturm
be solved
thatmethods)
would beisDNS:
switches
on resolution,
andofcan
converges tocost
DNS in the
very highdepending
precision but
huge amount
computational
limit. of all of the velocity disturbance specturm that would be
o resolution
If we use vaerage
o Where
use this
in its
work? computational cost
RANS:can
fairone
precision
with
acceptable
is an attractive
featuretosince
it means
that
oneofcould
have primarily
o InItPANS,
we are aiming
calculate
some
parts
unresolved
velocity
RANS for the
most parts of the computation domain and spend the
disturbance
specturm.
resources on the more importance
parts where he/she needs the structures
PANS
RANS
and more
detailed simulation.

DNS

PANS

Starting point: defining the mapping functions:


o Where u stands for unresolved
o Unresolved means those parts of fluctuation spectrum band that instead of solving
have been averaged
o This mapping functions have been proposed for k-epsilon model. However, they
can be extended to other RANS models, e.g. K-Omega

PANS
Transport Equations for standard k-Epsilon model
m k

u i


t

xi
k

xi

m u ik

x i

x i

Pk

x
i

C 1

k
x i

Pk

Pb C

Transport Equations for PANS k-Epsilon model


m k u

m u
t

m u ik u

xi

m u i u
xi


u

xi
ku


xi
u

ku

Pu

x
i

u
Pu u
u
*

C2
f k C 1

x
k
ku
i
u

Simulation Results
PANS Turbulence Model
Wet Flow

Flow Over a Square Cylinder

Primitive Results

Turbulence model

Cd

Cd Error (%)

Strouhal number St. Error (%)

kEpsilon

1.67

-20.5

0.1348

2.12

OEEVM (LES)

2.05

-2.4

0.1333

PANS

2.139

1.8

0.1293

-2.04

Reference Value (Exp.)

2.1

-----

0.132

-----

Flow Over a Square Cylinder


U = 0.54 m/s with 2% turbulence
Re = 22 000

Size of the square cylinder is 0.04 m wide and 0.392 m high.


Its situated in a tunnel with a width of 14D = 0.56 m

Thank you

Backup Slides

Turbulence Models
kEpsilon

Turbulence Models
kEpsilon

Turbulence Models
PANS
based on kEpsilon RANS Model

By defining the mapping functions:

Turbulence Models
PANS
based on kEpsilon RANS Model

General Governing Equations

m u i
t

m u i

xi

m u i u

v u i
x i

S ,

xi
u i
xi

1 D

Dt

u
u j
i

x
xi
j

g
m

i 1

i 1

m v v (1 v ) ,

m v v (1 v ) l

To simulate phase change rate, few models are available: Sauer, Kunz, Singhal, ...

PANS Implementation in OpenFoam


Create the initial files from original kEpsilon turbulence model
o Open a new terminal
o Load openfoam
o Copy kEpsilon turbulence model to your directory

o Rename the folder and its files (kEpsilon.C and kEpsilon.H) to kEpsilonPANS
o Replace all of the kEpsilon words with kEpsilonPANS in .C and .H files
o Go to Make folder, and then into the files
Replace kEpsilon with kEpsilonPANS, and also libkEpsilon with
libkEpsilonPANS
Debug the model (wmake libso)

PANS Implementation in kEpsilonPANS.C


In the Constructors part of kEpsilonPANS.C, and between definitions of
sigmaEps_ and k_, define the following parameters: fEpsilon, and fK
fEpsilon_
(
dimensioned<scalar>::lookupOrAddToDict
(
"fEpsilon",
coeffDict_,
1.0
)
),
fK_
(
dimensioned<scalar>::lookupOrAddToDict
(
"fK",
coeffDict_,
0.2
)
),

PANS Implementation in kEpsilonPANS.C


eBtween definitions of epsilon_ and nut_, define the fields of kU_ and
epsilonU_

kU_
(
IOobject
(
"kU",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateK("kU", mesh_)
),

epsilonU_
(
IOobject
(
"epsilonU",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateEpsilon("epsilonU", mesh_)
),

PANS Implementation in kEpsilonPANS.C


After printCoeffs() add the following command. So you can be sure during
simulation that an appropriate turbulence model has been called
Info << "Defining kEpsilonPANS model" << endl;

In the kEpsilonPANS::read () section add the following commands. They will


define where and in which dictionary OF should look for values of fEpsilon_
and fK_ parameters.
fEpsilon_.readIfPresent(coeffDict());
fK_.readIfPresent(coeffDict());

PANS Implementation in kEpsilonPANS.C


In the kEpsilonPANS::correct section, do the following

1- Add definitions of C2U parameters


const dimensionedScalar C2U = C1_ + (fK_/fEpsilon_) * (C2_ - C1_);

2- replace epsilon and k with epsilonU and kU in the section related to


creating equations
// Unresolved Turbulent kinetic energy equation
tmp<fvScalarMatrix> kUEqn
(
fvm::ddt(kU_)
+ fvm::div(phi_, kU_)
- fvm::laplacian(DkUEff(), kU_)
==
G
- fvm::Sp(epsilonU_*fK_/kU_, kU_)
);
kUEqn().relax();
solve(kUEqn);
bound(kU_, fK_ * kMin_);

PANS Implementation in kEpsilonPANS.C


// Update unresolved epsilon and G at the wall
epsilonU_.boundaryField().updateCoeffs();
// Unresolved Dissipation equation
tmp<fvScalarMatrix> epsUEqn
(
fvm::ddt(epsilonU_)
+ fvm::div(phi_, epsilonU_)
- fvm::laplacian(DepsilonUEff(), epsilonU_)
==
C1_*G*(epsilonU_)/(kU_)
+ fvm::Sp(C1_*(1-fK_)*(epsilonU_)/(kU_), epsilonU_)
- fvm::Sp(C2U*(epsilonU_)/(kU_), epsilonU_)
);
epsUEqn().relax();
epsUEqn().boundaryManipulate(epsilonU_.boundaryField());
solve(epsUEqn);
bound(epsilonU_, fEpsilon_ * epsilonMin_);

PANS Implementation in kEpsilonPANS.C


Calculate k, and epsilon based on the kU, and epsilon

// Calculation of Turbulent kinetic energy and Dissipation rate


k_ = kU_/fK_;
epsilon_ = (epsilonU_)/(fEpsilon_);
// Re-calculate viscosity
nut_ = Cmu_*sqr(kU_)/epsilonU_;

PANS Implementation in kEpsilonPANS.C


Calculate k, and epsilon based on the kU, and epsilon

// Calculation of Turbulent kinetic energy and Dissipation rate


k_ = kU_/fK_;
epsilon_ = (epsilonU_)/(fEpsilon_);
// Re-calculate viscosity
nut_ = Cmu_*sqr(kU_)/epsilonU_;

PANS Implementation in kEpsilonPANS.H


Add definition of fEpsilon, and fK to protected data:model coefficients
dimensionedScalar fEpsilon_;
dimensionedScalar fK_;

Add definition of kU, and epsilonU to protected data:Fields


volScalarField kU_;
volScalarField epsilonU_;

In the Member Function, add definition of kU and epsilonU fields

Define DkUEff, and DepsilonUEff

//- Return the unresolved turbulence kinetic energy


virtual tmp<volScalarField> kU() const
{
return kU_;
fields }
//- Return the unresolved turbulence kinetic energy
dissipation rate
virtual tmp<volScalarField> epsilonU() const
{
return epsilonU_;
}

PANS Implementation in kEpsilonPANS.H


Define DkUEff, and DepsilonUEff fields
//- Return the effective diffusivity for unresolved k
tmp<volScalarField> DkUEff() const
{
return tmp<volScalarField>
(
new volScalarField("DkUEff", nut_/(fK_*fK_/fEpsilon_) + nu())
);
}
//- Return the effective diffusivity for unresolved epsilon
tmp<volScalarField> DepsilonUEff() const
{
return tmp<volScalarField>
(
new volScalarField("DepsilonUEff",
nut_/(fK_*fK_*sigmaEps_/fEpsilon_) + nu())
);
}

You might also like