a suite of boundary conditions for the simulation of ...€¦ · openfoam implementation boundary...

38
- ε ? ? ?

Upload: others

Post on 14-Jun-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

6th OpenFOAM WorkshopPenn State, State College, USA

A suite of boundary conditions for the simulation ofatmospheric �ows using a modi�ed RANS/k− ε closure

J. Sumner?, C. Masson?

?École de technologie supérieure

June 14th 2011

1 / 38

Page 2: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

IntroductionWind farm power performance

2 / 38

Page 3: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

IntroductionWind farm power performance

3 / 38

Page 4: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

IntroductionO�shore wind farms

4 / 38

Page 5: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Objective

Derive and implement a general k− ε surface layer model valid for bothstable and neutral thermal strati�cation

5 / 38

Page 6: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Similarity theoryPotential temperature pro�les

0 0.2 0.4 0.6 0.8 1 1.20

20

40

60

80

∆Θ [◦C]

z[m

]Neutral

Stable

Figure: Comparison neutral and stable surface layer6 / 38

Page 7: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Similarity theoryVelocity pro�les

5 6 7 8 9 10 11 120

20

40

60

80

`m = κz`m = κz/φm

U [m/s]

z[m

]Neutral

Stable

Figure: Comparison neutral and stable surface layer7 / 38

Page 8: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Model developmentImposing a new length scale

The turbulent length scale is determined by the ε equation

d

dz

(νt

σε

dz

)+Pε −Cε2

ε2

k= 0

How to modify ε equation for desired mixing length and turbulenceproperties?

8 / 38

Page 9: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Model developmentThe Apsley & Castro model

Recast the ε equation as

Pε =

[Cε1 + (Cε2−Cε1)

`m`max

]Πkε

k

When `m << `max ,

Pε → Cε1Πkε

k

When `m ≈ `max ,

Pε −Cε2ε2

k→ 0

9 / 38

Page 10: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Model developmentThe Apsley & Castro model

Recast the ε equation as

Pε =

[Cε1 + (Cε2−Cε1)

`m`max

]Πkε

k

When `m << `max ,

Pε → Cε1Πkε

k

When `m ≈ `max ,

Pε −Cε2ε2

k→ 0

10 / 38

Page 11: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Model developmentThe Apsley & Castro model

Recast the ε equation as

Pε =

[Cε1 + (Cε2−Cε1)

`m`max

]Πkε

k

When `m << `max ,

Pε → Cε1Πkε

k

When `m ≈ `max ,

Pε −Cε2ε2

k→ 0

11 / 38

Page 12: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Similarity theoryAnalytical pro�les

Considering an arbitrary desired `m:

U(z) = u∗

∫ z

z0

1

`mdz ′

∆Θ(z) = σθ θ∗

∫ z

z0

1

`mdz ′

Turbulence properties:

k(z) =u2∗√Cµ

ε(z) =u3∗`ε

12 / 38

Page 13: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Model developmentA revised Apsley & Castro model

Assuming equilibrium and writing correction as F

d

dz

(νt

σε

dz

)+F · (Cε2−Cε1)

ε2

k= 0

Substituting νt = u∗`m, ε = u3∗/`ε and k = u2?/√Cµ and solving for F

F =1

κ2

[d`mdz

d`ε

dz+ `m

d2`ε

dz2−2

`m`ε

(d`ε

dz

)2]

13 / 38

Page 14: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Model developmentA revised Apsley & Castro model

Assuming equilibrium and writing correction as F

d

dz

(νt

σε

dz

)+F · (Cε2−Cε1)

ε2

k= 0

Substituting νt = u∗`m, ε = u3∗/`ε and k = u2?/√Cµ and solving for F

F =1

κ2

[d`mdz

d`ε

dz+ `m

d2`ε

dz2−2

`m`ε

(d`ε

dz

)2]

14 / 38

Page 15: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Model developmentSpeci�c form

Taking the mixing length as

`m =κz

1+ κz/`max

and relating the length scales with a simpli�ed TKE budget equation

1

=1

`m− 1

κL

yields

F =−(1+R ′f

)2( `m`max

+1

)(1− `m

`max

)3

where `m = u30/Pk and R ′f ≡−Gk/Πk

15 / 38

Page 16: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Model developmentA caveat

Turbulent viscosity

νt = u?`ε 6= u?`m

For analytical pro�les be solutions,

νt = Cµ

k2

ε

`m`ε

= Cµ

k2

ε(1−Rf )

Note: (1−Rf ) is exactly equal to the ratio of length scales for the simpli�ed TKEbudget equation

16 / 38

Page 17: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Model developmentTurbulence transport equations

1D k− ε model

d

dz

(νtdk

dz

)+ Πk − ε = 0

d

dz

(νt

σε

dz

)+Pε −Cε2

ε2

k= 0

where

Πk = Pk +Gk

Pk ≡−u′w ′dU

dz= νt

(dU

dz

)2

Gk ≡ αgθ ′w ′ =−αgνt

σθ

dz

17 / 38

Page 18: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

OpenFOAM implementationkEpsilonLengthLimited

// Shear production

Gk_ = nut_*2*magSqr(symm(fvc::grad(U_)));

// Link to theta field

volScalarField& theta = const_cast<volScalarField&>

(db().lookupObject<volScalarField>("theta"));

// Buoyancy production

Gb_ = (alpha_*nut_/sigmaTheta_) * g_ & fvc::grad(theta);

// Total production

volScalarField G("RASModel::G", Gk_ + Gb_);

18 / 38

Page 19: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

OpenFOAM implementationkEpsilonLengthLimited

// Calculate velocity scale

u0_ = Foam::pow(Cmu_,0.25) * Foam::sqrt(k_);

// Calculate mixing length

lm_ = Foam::pow(u0_,3.0) / max(Gk_, epsilonSmall_);

// Update epsilon, G, Gk, Gb, and lm at the wall

epsilon_.boundaryField().updateCoeffs();

// Flux Richardson number

volScalarField Rf = min(1.0, -Gb_ / max(Gk_, epsilonSmall_));

volScalarField Rfprime = min(1.0, -Gb_ / max(G, epsilonSmall_));

// Weighting function

f_ = 1.0 - Foam::sqr(1.0+Rfprime) * (lm_/lMax_+1.0)

* Foam::pow((1.0-lm_/lMax_),3.0);

19 / 38

Page 20: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

OpenFOAM implementationkEpsilonLengthLimited

// Dissipation equation

tmp<fvScalarMatrix> epsEqn

(

fvm::ddt(epsilon_)

+ fvm::div(phi_, epsilon_)

- fvm::Sp(fvc::div(phi_), epsilon_)

- fvm::laplacian(DepsilonEff(), epsilon_)

==

(C1_ + (C2_ - C1_)*f_)*G*epsilon_/k_

- fvm::Sp(C2_*epsilon_/k_, epsilon_)

);

...

// Re-calculate viscosity

nut_ = Cmu_*sqr(k_)/epsilon_ * max(1.0 - Rf, 1e-10);

nut_.correctBoundaryConditions();

20 / 38

Page 21: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Boundary conditionsGeneralized Richards & Hoxey

Inlet

Outlet

τ =−ρu2?,w∂k

∂z= 0

Wall functionsdΘ

dz=−qw

cp

σθ

νt

Equilibrium pro�les

Zero

gradients

τ = ρu2?,sl∂k

∂z= 0

∂ε

∂z=−

u3?,sl

κz2

∂νt

∂z=

κu?,sl

(1+ κz`max

)2

dz=−qw

cp

σθ

νt

21 / 38

Page 22: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Boundary conditionsGeneralized Richards & Hoxey

Inlet

Outlet

τ =−ρu2?,w∂k

∂z= 0

Wall functionsdΘ

dz=−qw

cp

σθ

νt

Equilibrium pro�les

Zero

gradients

τ = ρu2?,sl∂k

∂z= 0

∂ε

∂z=−

u3?,sl

κz2

∂νt

∂z=

κu?,sl

(1+ κz`max

)2

dz=−qw

cp

σθ

νt

22 / 38

Page 23: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Boundary conditionsGeneralized Richards & Hoxey

Inlet

Outlet

τ =−ρu2?,w∂k

∂z= 0

Wall functionsdΘ

dz=−qw

cp

σθ

νt

Equilibrium pro�les

Zero

gradients

τ = ρu2?,sl∂k

∂z= 0

∂ε

∂z=−

u3?,sl

κz2

∂νt

∂z=

κu?,sl

(1+ κz`max

)2

dz=−qw

cp

σθ

νt

23 / 38

Page 24: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Boundary conditionsWall functions

Local friction velocity

u?,w =κUP

ln(zP/z0) + κ(zP − z0)/`max

Turbulence properties

εP =

√Cµku?,w

Πk,P =u3?,w

∆z

∫ 2zP−z0

z0

(1

`m− 1

κL

)dz ′

= u3?,w

[1

2κ(zP − z0)ln

(2zp− z0

z0

)+

1

`max− 1

κL

]εP =

√Cµk

u2?,wΠk,P

24 / 38

Page 25: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

OpenFOAM implementationBoundary conditions

Version 1.6 provided derivedFvPatchFields for turbulence models

1 epsilonWallFunction

2 nutRoughWallFunction

Version 1.7 provided fixedShearStress and in�ow for U and ε

1 atmBoundaryLayerInletVelocity

2 atmBoundaryLayerInletEpsilon

What is needed:

1 Modi�ed ε and Gk wall functions

2 A wall function for proper shear stress for ABL

3 A way to cleanly handle a z0 distribution

4 E�cient IO between libraries

25 / 38

Page 26: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Regarding consistencyHandling distributed roughness

Two options:

1 Treat it like a wall function parameter2 Treat it as a separate �eld

Constructor...

zZeroField_ = new volScalarField

(

IOobject

(

"z0",

db().time().timeName(),

patch().boundaryMesh().mesh(),

IOobject::MUST_READ,

IOobject::AUTO_WRITE

),

patch().boundaryMesh().mesh()

);

z0_ = (*zZeroField_).boundaryField()[patch().index()];

...

26 / 38

Page 27: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Regarding consistencyModel parameters

Boundary conditions often require same information

1 Directives (#) and macro substitutions ($)2 IOdictionary (RASProperties and surfaceLayerProperties)

Bundle boundary conditions together with explicit links to dictionaries

Constructor...

:

epsilonWallFunctionFvPatchScalarField(p, iF),

z0_(p.size(), 0.0),

kappa_(0.40),

beta_(0),

L_(1e100),

lmax_(1e100)

{

readSurfaceLayerDict();

zZeroField_ = new volScalarField

...

27 / 38

Page 28: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Regarding consistencyModel parameters

surfaceLayer-

Properties

U inlet

ε inlet

Θ gradient

νt gradient

ε gradient

Shear stress

νt wallfunction

ε wallfunction

RASProperties

28 / 38

Page 29: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

OpenFOAM implementationbuoyantSimpleFoam1D

1 Drop pressure equation

simpleFoam...

//p.storePrevIter();

// Pressure-velocity SIMPLE corrector

{

#include "UEqn.H"

//#include "pEqn.H"

#include "thetaEqn.H"

}

// Update boundary conditions

U.correctBoundaryConditions();

theta.correctBoundaryConditions();

turbulence->correct();

...

29 / 38

Page 30: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

OpenFOAM implementationbuoyantSimpleFoam1D

2 Add potential temperature equation

d

dz

(νt

σθ

dz

)= 0

thetaEqn.H

fvScalarMatrix thetaEqn

(

- (1.0/sigmaTheta) * fvm::laplacian(turbulence->nut(), theta)

);

thetaEqn.relax();

30 / 38

Page 31: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

1D simulationsStable conditions: QW =−20 W/m2, u?,sl = 0.28 m/s, z0 = 0.3 m, `max = 8 m

0 5 10 15 20 2510−1

100

101

U/u?

z/`

max

Proposed model

Apsley and Castro

Analytical

Figure: Comparison of proposed model, Apsley & Castro and analytical solutions31 / 38

Page 32: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

1D simulationsStable conditions: QW =−20 W/m2, u?,sl = 0.28 m/s, z0 = 0.3 m, `max = 8 m

100 10110−1

100

101

Normalized TKE budget

z/`

max

Proposed - Gk

Proposed - ε

Proposed - Gb

Analytical - Gk

Analytical - ε

Analytical - Gb

Figure: Comparison of proposed model, Apsley & Castro and analytical solutions32 / 38

Page 33: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

1D simulationsNeutral length-limited conditions: QW = 0 W/m2, u?,sl = 0.65 m/s, z0 = 0.3 m,`max = 36 m

5 10 15 20 25 3010−1

100

101

U/u?

z/` m

ax

Proposed model

Apsley and Castro

Analytical

Figure: Comparison of proposed model, Apsley & Castro and analytical solutions33 / 38

Page 34: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

The Cε3 coe�cientCalibration

The proposed ε equation can be recast in the form proposed by Rodifor modeling strati�ed �ows:

Pε = Cε1(1+Cε3R′f )

Πkε

k

This yields

Cε3 =(Cε2−Cε1)

Cε1

[1− (1+R ′f )2

(`m`max

+1

)(1− `m

`max

)3]

1

R ′f

34 / 38

Page 35: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

The Cε3 coe�cientComparison

10−2 10−1 100 1010

2

4

6

8

10

z/L

Cε3C

ε1/

(Cε2−C

ε1)

Betts & Haroutunian (1983)

Rodi (1987)

Kitada (1987)

Burchard & Baumert (1995)

Apsley & Castro (1997)

Freedman & Jackson (2003)

Alinot & Masson (2005)

Sumner & Masson (2011)

Figure: Comparison of proposals for Cε335 / 38

Page 36: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

ConclusionsSummary

A slightly modi�ed k− ε model for neutral and stable, length-limitedsurface layer �ow

A corresponding suite of boundary conditions

A new Cε3 expression has been derived that ensures similarity theoryfor a stable atmosphere is a solution of the model equations

36 / 38

Page 37: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

ConclusionsFuture work

Extend to two and three-dimensional �ow cases

Prepare tutorial and libraries for release to extend project

37 / 38

Page 38: A suite of boundary conditions for the simulation of ...€¦ · OpenFOAM implementation Boundary conditions Version 1.6 provided derivedFvPatchFields for turbulence models 1 epsilonWallFunction

Thank youQuestions?

38 / 38