Implementation of a Complete Wall Function for the Standard k- - - PowerPoint PPT Presentation

implementation of a complete wall function for the
SMART_READER_LITE
LIVE PREVIEW

Implementation of a Complete Wall Function for the Standard k- - - PowerPoint PPT Presentation

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test Implementation of a Complete Wall Function for the Standard k- Turbulence Model in OpenFOAM 4.0 Shengnan Liu Offshore Technology,


slide-1
SLIDE 1

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Implementation of a Complete Wall Function for the Standard k-ǫ Turbulence Model in OpenFOAM 4.0

Shengnan Liu

Offshore Technology, Department of Mechanical and Structural Engineering and Materials Science University of Stavanger, Stavanger, Norway

2016-12-05

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 1 / 35

slide-2
SLIDE 2

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Contents

Introduction on Near-wall Physics Wall Function Implementation for Standard k − ǫ Model in OpenFOAM 4.0 New Wall Function Implementation for Standard k − ǫ Model in OpenFOAM 4.0 Test Cases (Verification)

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 2 / 35

slide-3
SLIDE 3

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

1 Introduction on Near-wall Physics

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 3 / 35

slide-4
SLIDE 4

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Influence of the wall

Wall effects are common seen in practical flows such as channel flow, pipe flow and flow around all kinds of structures. Some effects of the wall are shown here. Low Reynolds number - the turbulence Reynolds number Rel = k2/(ǫv) decreases as the wall is approached. High shear rate - the highest mean shear rate ∂ < U >/∂y occurs at the wall. The velocity changes from the no-slip condition at the wall to its stream value. Wall blocking - the impermeability condition V=0 (at y=0) is considered and it affects the boundary layer flow.

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 4 / 35

slide-5
SLIDE 5

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Near Wall Treatment

In numerical simulation, two ways can be chosen for wall treatment.

http://www.bakker.org/dartmouth06/engs150/10rans.pdf

DNS resolves eddies in all

  • scales. It required very

fine mesh in the near-wall region so that it can be integrated. RANS and LES involve the model to simplify the

  • simulation. They

introduce the wall function to give first layer cell information.

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 5 / 35

slide-6
SLIDE 6

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Wall Function Profile

Wall functions for different layers y+ = (u∗y)/ν; u+ = u/u∗,

http://www.computationalfluiddynamics.com.au/tag/wall-functions/

Linear viscous sub-layer (y+ < 5)- Dominated by viscous shear Buffer layer (5 < y+ < 30) - Mix of viscous layer and inertial layer Log-law layer (30 < y+ < 100) - Both viscous and turbulent effects are important

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 6 / 35

slide-7
SLIDE 7

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Viscous Layer (y+ < 5)

The fluid very close to the wall is dominated by viscous shear in absence of the turbulent shear stress effects. In this region u+ = y+, νT = fµCµk2/ǫ (Jones and Launder (1972) ), fµ = 1 − exp(−0.0002y+ − 0.00065y+2) (Rodi and Mansour (1993) ), the following equation set is used in the viscous near wall region:                      y+ = u∗y/ν u+ = u/u∗ u+ = y+ k = u∗2/

ǫ = C3/4

µ

k3/2/κy νT = fµCµk2/ǫ (1)

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 7 / 35

slide-8
SLIDE 8

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Buffer Layer (5 < y+ < 30)

The intersection of viscous and log-law wall funnction is at y+ = 11. That is, y+ < 11 linear approximation is more accurate and after y+ > 11 the logarithmic approximation works better. Considering both the linear and logarithmic approximation by a weighting factor ω = (y+ − 5)/25 (Ong et al., (2009)).The equation set is:                            y+ = u∗y/ν u+ = u/u∗ u+ = 1 (

κω ln(Ey+)) + ( 1−ω y+ )

k = u∗2/

ǫ = C3/4

µ

k3/2/κy νT = fµCµk2/ǫ (2)

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 8 / 35

slide-9
SLIDE 9

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Log-law Layer (30 < y+ < 100)

In this region viscous and turbulent effects are both important. The relationship between y+ and u+ is logarithmic, the equation set to be used in the log-law region is:                          y+ = u∗y/ν u+ = u/u∗ u+ = 1 κln(Ey+) k = u∗2/

ǫ = C3/4

µ

k3/2/κy νT = fµCµk2/ǫ (3)

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 9 / 35

slide-10
SLIDE 10

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

3 Wall Functions Implementation for Standard k − ǫ Turbulence Model in OpenFOAM 4.0

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 10 / 35

slide-11
SLIDE 11

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Overview on k − ǫ model

The k − ǫ belongs to the two-equation models(Launder and Spalding (1972); Rodi (1993)). ∂k ∂t + uj ∂k ∂xj = ∂ ∂xj (νT σk ∂k ∂xj ) + νT ( ∂ui ∂xj + ∂uj ∂xi ) ∂ui ∂xj − ǫ (4) ∂ǫ ∂t + uj ∂ǫ ∂xj = ∂ ∂xj (νT σǫ ∂ǫ ∂xj ) + C1 ǫ kνT ( ∂ui ∂xj + ∂uj ∂xi ) ∂ui ∂xj − C2 ǫ2 k (5) Model transport equations are solved for two turbulence quantities. Turbulent kinetic energy k, which determines the energy in the turbulence. Turbulent dissipation ǫ, which determines the rate of dissipation of the turbulent kinetic energy. The turbulent viscosity is specified as νT = Cµk2/ǫ and C1 = 1.44, C2 = 1.92, Cµ = 0.09, σk = 1.0, σǫ = 1.3.

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 11 / 35

slide-12
SLIDE 12

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

k − ǫ turbulence model code in OpenFOAM 4.0

The k − ǫ turbulence calculation process is: Calculate turbulent kinetic energy production term G by ”epsilon .boundaryFieldRef().updateCoeffs()” and correct the value of G at first layer mesh by updateCoeffs() function of ǫ. With the updated G, the ǫ equation is revised by ”epsEqn.ref().boundaryManipulate(epsilon .boundaryFieldRef());” . Solve ǫ equation and obtain the updated ǫ field. Solve k equation using the new ǫ, and k field is renewed. Calculate νT , and update the νT at wall by ”correctNut();”.

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 12 / 35

slide-13
SLIDE 13

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

k wall functions in OpenFOAM 4.0

kqRWallFunction is used for high Reynolds numbers and kLowReWallFunction can be used for both low Reynolds numbers and high Reynolds numbers.

Type name kqRWallFunction kLowReWallFunction∗ Available scope (first layer cell) Log-law region Viscous and log-law region Class Foam::kqRWallFunction- FvPatchField Foam::kLowReWall- FunctionFvPatchField Inherit from Foam::zeroGradient FvPatchField Foam::fixedValue FvPatchField Other references zeroGradient fixedValue Table: Available k wall functions in OpenFoam 4.0

* new k wall function is modified based on this Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 13 / 35

slide-14
SLIDE 14

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Code framework of kLowReWallFunction in OpenFOAM 4.0

Code Framework yPlusLam function is used to calculate the intersection of viscous layer and log-law layer updateCoeffs() is the main function of calculating k. kw = { (Ck/κln(y+) + Bk) ∗

  • Cµ ∗ kc,

y+ > yPlusLam 2400 ∗ Cf/C2

eps2 ∗

  • Cµ ∗ kc,

y+ < yPlusLam (6)

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 14 / 35

slide-15
SLIDE 15

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

ǫ wall functions in OpenFOAM 4.0

epsilonWallFunction is used for high Reynolds numbers and epsilonLowReWallFunction can be used for both low Reynolds numbers and high Reynolds numbers.

Type name epsilonWallFunction∗ epsilonLowReWallFunction Available scope (first layer cell) Log-law region Viscous and log-law region Class Foam::epsilonWallFunction- FvPatchField Foam::epsilonLowReWall- FunctionFvPatchField Formula ǫc = 1

N

N

f=i ( C3/4

ν

k3/2

c

κyi

) ǫc = 1

N

N

f=i ( C3/4

ν

k3/2

c

κyi

) ǫc = 1

N

N

f=i ( 2kcν y2

i )

Inherit from Foam::fixedInternalValue- FvPatchField Foam::epsilonWallFunction- FvPatchScalarField Table: Available epsilon wall functions in OpenFoam 4.0

* new epsilon wall function is modified based on this Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 15 / 35

slide-16
SLIDE 16

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Code framework of epsilonWallFunction in OpenFOAM 4.0

Code Framework setMaster function will set all the near wall cell as master(value is 1), if it is master cell, then wall function is used, else it will call turbulence internal function to calculate G and epsilon and then update the coefficient. If not, it will call turbulence internal function to calculate G and epsilon and then update the coefficient.

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 16 / 35

slide-17
SLIDE 17

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

nut wall functions in OpenFOAM 4.0

There are many νT wall functions in OpenFOAM 4.0 which are all based

  • n one virtual base class nutWallFunction.

Calculate from U k Type name nutUWallFunction nutURoughWallFunction nutUSpaldingWallFunction nutUTabWallFunction nutkWallFunction∗ nutkRoughWallFunction nutLowReWallFunction nutkAtmRoughFunction

Table: Available νT wall functions in OpenFoam 4.0

* new nut wall function is modified based on this Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 17 / 35

slide-18
SLIDE 18

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Code framework of nutkWallFunction in OpenFOAM 4.0

Code Framework The value of nut is calculated in calcNut(); νT = ν ∗ (

κy+ ln(Ey+) − 1)

Then nut will be return back to updateCoeffs().

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 18 / 35

slide-19
SLIDE 19

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

4 New Wall Functions Implementation for Standard k − ǫ Turbulence Model in OpenFOAM 4.0

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 19 / 35

slide-20
SLIDE 20

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Modifications to existing wall functions

The new implemented wall functions are built based on Ong et al. (2009) (i.e. Ong wall function), code are modified based on kLowReWallFunction, epsilonWallFunction and nutkWallFunction. Here list the basic process of modification. Change work directory to wall function directory. Copy the required wall function files in the same folder. Modify the .C and .H files. Compile the library.

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 20 / 35

slide-21
SLIDE 21

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Modifications to k wall function

Change the .H and .C files’ names to the new wall function names. Change all the key words from kLowReWallFunction to kOngWallFunction. Define two member functions to calculate u∗ in buffer layer and log-law region. Modify updateCoeffs(), set k to three section functions according to y+. Save files.

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 21 / 35

slide-22
SLIDE 22

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Equations used in calcUTau

f2(u∗) = Eyu∗ ν − exp(κu u∗ ) = 0 (y+ > 30) (7) The apply Newton iteration to f2, u∗

n+1 = u∗ n − f2(u∗ n)

f2′(u∗

n)

f2′(u∗

n) = Ey

ν + κu u∗2

n

exp(κu u∗

n

) (8)

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 22 / 35

slide-23
SLIDE 23

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Equations used in calcUTau2

f1(u∗) =κ(yu∗/ν − 5)yu∗/ν − (30 − yu∗/ν)ln(Eyu∗/ν) 25yu∗/νln(Eyu∗/ν) − u∗ u (5 <= y+ <= 30) (9) The apply Newton iteration to f1, u∗

n+1 = u∗ n − f1(u∗ n)

f1′(u∗

n)

f1′(u∗

n) = (2κyu∗ n/ν − 5κ + ln(Eyu∗ n/ν))y

ν − (30 − yu∗

n/ν)

25(yu∗

n/ν)u∗ nln(Eyu∗ n/ν)

(κ(5 − yu∗

n/ν)yu∗ n/ν + (30 − yu∗ n/ν)ln(Eyu∗ n/ν))(y + ln(Eyu∗ n/ν)y)

25ν(yu∗

n/νln(Eyu∗ n/ν))2

− 1 u (10)

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 23 / 35

slide-24
SLIDE 24

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Modifications to epsilon wall function

The ǫ expression in epsilonOngWallFunction is the same with which in

  • epsilonWallFunction. So the epsilonOngWallFunction is just a simple

wrapper of epsilonWallFunction. Change the .H and .C files’ names to the new wall function names. Change all the key words from epsilonWallFunction to epsilonOngWallFunction. Save files.

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 24 / 35

slide-25
SLIDE 25

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Modifications to nut wall function

The main modification to nut is the calculation equation of nut. Change the .H and .C files’ names to the new wall function names. Change all the key words from nutkWallFunction to nutOngWallFunction. Modify the main function calcNut(), change the nut expression to: νT = fµCµk2/ǫ fµ = 1 − exp(−0.0002y+ − 0.00065y+2) Save files.

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 25 / 35

slide-26
SLIDE 26

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Compile new wall functions

First change the working directory to turbulenceModels/Make: cd $FOAM_SRC/TurbulenceModels/turbulenceModels/Make Open the ”files” file, add the following statement inside under the ”wallFunctions = derivedFvPatchFields/wallFunctions” accordingly. $(nutWallFunctions)/nutOngWallFunction\ /nutOngWallFunctionFvPatchScalarField.C $(epsilonWallFunctions)/epsilonOngWallFunction\ /epsilonOngWallFunctionFvPatchScalarField.C $(kqRWallFunctions)/kOngWallFunction\ /kOngWallFunctionFvPatchScalarField.C Then change the last line ”LIB = $(FOAM LIBBIN)/libturbulenceModels” to ”LIB = $(FOAM USER LIBBIN)/ libturbulenceModels”

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 26 / 35

slide-27
SLIDE 27

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Compile new wall functions

Touch the change of wall functions: Compile the turbulence model by the following commands. cd $FOAM_SRC/TurbulenceModels wmake libso turbulenceModels/derivedFvPatchFields /wallFunctions/nutWallFunctions/nutOngWallFunction wmake libso turbulenceModels/derivedFvPatchFields\ /wallFunctions/kqRWallFunctions/kOngWallFunction wmake libso turbulenceModels/derivedFvPatchFields/wall\ Functions/epsilonWallFunctions/epsilonOngWallFunction ./Allwmake After compiling successfully, restart the terminal window and prepare for the case Test.

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 27 / 35

slide-28
SLIDE 28

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

5 Test Cases (Verification)

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 28 / 35

slide-29
SLIDE 29

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Test Case 1

The main improvement of Ong wall function is including the buffer layer

  • inside. Set first layer cell in the buffer layer.

Figure: Test case set up

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 29 / 35

slide-30
SLIDE 30

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Results of Case 1

Use simpleFoam for the simulation. Results are shown as follows.

Figure: Resluts of Case 1

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 30 / 35

slide-31
SLIDE 31

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Test Case 2

Set first layer cell in buffer layer. Set fully developed boundary layer flow (can be calculted according to the Ong wall function equations) on the inlet pathes, and compare the velocity profile of inlet and outlet.

Figure: Test case set up

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 31 / 35

slide-32
SLIDE 32

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Test Case 2

The nonuniform setting for U, k, ǫ and νT are required in 0’ folder. In addition, boundaryData folder is required in ’constant’ folder. The inlet velocity pofile calculated from Ong wall function is shown in Figure 4.

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 32 / 35

slide-33
SLIDE 33

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Test Case 2

The inlet setting for k, ǫ and νT are based on Ong et al., (2010) : k = max{C(

µ − 1/2)(1 − y/yf)2u∗2, 0.0001U 2 ∞}

ǫ = Cµ(3/4)ky3/2 l νT = Cµ k2 ǫ (11) where U∞ is the velocity of infinity. yf is the height of first layer cell. The expression of l is: l = min{ky(1 + 3.5y/yf)−1, Cµy} (12)

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 33 / 35

slide-34
SLIDE 34

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Test Case 2

The results show that the Ong wall functions keep the velocity profile

  • stable. The new wall function is developed successfully.

Figure: Inlet and outlet velocity profile

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 34 / 35

slide-35
SLIDE 35

Introduction on Near-wall Physics Wall Functions in OpenFOAM 4.0 New Wall Functions Implementation Case Test

Many Thanks to Prof. H˚ akan Nilsson, Prof. Muk Chen Ong and All of You! Questions?

Shengnan Liu New Wall Function Implementation in OpenFOAM 4.0 2016-12-05 35 / 35