implementation of turbulent viscosity usin earsm -...

30
CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from EARSM for Two-Equation Turbulence Model Thejeshwar Sadananda Chalmers University of Technology December 8, 2015

Upload: hoanglien

Post on 26-Apr-2018

246 views

Category:

Documents


11 download

TRANSCRIPT

Page 1: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

CFD with OpenSource Software 2015

Implementation of Turbulent Viscosity from EARSM for Two-Equation Turbulence Model

Thejeshwar Sadananda

Chalmers University of Technology

December 8, 2015

Page 2: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Order of Presentation

• Motivation

• Algebraic Reynolds stress model

• Explicit Algebraic Reynold stress model

• Solution of simplified ARSM for 3D mean flows

• Axially rotating turbulent pipe flow case setup

• Implementation of turbulent viscosity using EARSM in OpenFOAM 2.4.X.

• Run and post-process using paraview and sample utility

• Learning during the implementation

• Conclusion and Future work

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 2

Page 3: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Motivation

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 3

• Standard two equation turbulence model are used in industrial flow computations

• It is roboust and takes less computational effort

• The Reynolds stress is computed based on the modellededdy viscosity

• Rotation part of the velocity gradient is not considered in computing the Reynolds stress

• Unable to accurately predict three dimensional flowfeatures

Page 4: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Algebraic Reynolds Stress Models

• ARSM is developed from the modelled Reynolds stress transport equation

• They have implicit relation between stress components and mean velocity gradient field

• ARSM includes the effect of rotational part of meanvelocity gradient tensor.

• The model considers the three dimensionality of the flow

• Need not model the production term

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 4

Page 5: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Explicit Algebraic Reynolds Stress Models

• Reynolds stress are explicitly related to the mean flow field

• It is numerically robust

• Negligible effect on the computational effort

• The Reynolds stress anisotropy term is expressed as

𝑎 = 𝛽1𝑺 + 𝛽2 𝑺2 −1

3𝐼𝐼𝑆𝑰 + 𝛽3 𝜴2 −

1

3𝐼𝐼Ω𝑰 + 𝛽4 𝑺𝜴 − 𝜴𝑺 +

𝛽5 𝑺2𝜴− 𝜴𝑺2 + 𝛽6 𝑺𝜴2 − 𝜴2𝑺 −2

3𝐼𝑉 𝑰 + 𝛽7 𝑺

2𝜴2 −

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 5

Page 6: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Solution of simplified ARSM for Three Dimensional

Mean Flow

𝛽1 = −𝑁 2𝑁2−7𝐼𝐼Ω

𝑄; 𝛽3 = −

12𝑁−1𝐼𝑉

𝑄; 𝛽4 = −

2 𝑁2−2𝐼𝐼Ω

𝑄;

𝛽6 = −6𝑁

𝑄; 𝛽9 =

6

𝑄; 𝜏 = 𝑚𝑎𝑥

𝑘

𝜀, 𝑐𝜏

𝜇

𝜌𝜀

𝑄 =5

6𝑁2 − 2𝐼𝐼Ω 2𝑁2 − 𝐼𝐼Ω ;

• Solution of Simplified ARSM two dimensional mean flow

𝑁 =

𝐶1′

3+ (𝑃1 + 𝑃2)

1 3+(𝑃1 − 𝑃2) 1 3

𝐶1′

3+ 2(𝑃1

2 − 𝑃2) 1 6cos

1

3cos−1

𝑃1

𝑃12− 𝑃2

, 𝑃2 ≥ 0

, 𝑃2< 0

𝑃1 =𝐶1

′2

27+

9

20𝐼𝐼𝑆 −

2

3𝐼𝐼𝛺 𝐶1

′; 𝑃2 = 𝑃12 −

𝐶1′2

9+

9

10𝐼𝐼𝑆 +

2

3𝐼𝐼𝛺

3

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 6

Page 7: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Case: Axially Rotating Turbulent Flow in a Pipe

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 8

• Boundaries• cyclicAMI patch type

• Mesh

• Boundary conditions• codedFixedValue

• turbulentIntensityKineticEnergyInlet

• kqRWallFunction

• turbulentMixingLengthFrequencyInlet

• omegaWallFunction

• k-ω Turbulence Model

• simpleFoam

side1

Side2

Wall

Inlet

Outlet

Page 8: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X.

𝜇𝑇 = −1

2𝛽1 + 𝐼𝐼Ω𝛽6 𝜌𝑘𝜏

cd $WM_PROJECT_DIR

• Copy the kOmega directory from src with the same directory structure

cp -r --parents src/turbulenceModels/incompressible/RAS/kOmega $WM_PROJECT_USER_DIR

cd $WM_PROJECT_USER_DIR/src/turbulenceModels/incompressible/RAS

mv kOmega/ earsmImpkOmega

•Create a new Make directory and include the below lines in to Make/files

mkdir Make

vi Make/files

earsmImpkOmega/earsmImpkOmega.C

LIB = $(FOAM_USER_LIBBIN)/libMyIncompressibleRASModels

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 9

Page 9: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X. •Create a new file Make/options and include the below links in the OpenSOURCE directory

vi Make/options

EXE_INC = \

-I$(LIB_SRC)/turbulenceModels \

-I$(LIB_SRC)/transportModels \

-I$(LIB_SRC)/finiteVolume/lnInclude \

-I$(LIB_SRC)/meshTools/lnInclude \

-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/lnInclude \

-I$(LIB_SRC)/sampling/lnInclude

LIB_LIBS =

•Remove .dep file and rename the file name and the functions from kOmega to earsmImpkOmega

cd earsmImpkOmega; rm kOmega.dep

mv kOmega.C earsmImpkOmega.C; mv kOmega.H earsmImpkOmega.H

sed -i s/kOmega/earsmImpkOmega/g earsmImpkOmega.*

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 10

Page 10: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X.

• Add the data members in the declaration file earsmImpkOmega.H

vi earsmImpkOmega.H

// Model Coefficients

dimensionedScalar c1_;

dimensionedScalar C1_;

dimensionedScalar cTau_;

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 11

Page 11: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X.

•Add tau volScalarField before Reynolds stress tensor R() member function in the declaration file earsmImpkOmega.H//- Return the time scale

tmp<volScalarField> tau() const

{

return tmp<volScalarField>

(

new volScalarField

(

IOobject

(

"tau",

mesh_.time().timeName(),

mesh_

),

max(k_/epsilon(), cTau_*sqrt(nu()/epsilon()))

)

);

}

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 12

Page 12: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X. •Add invar2s volScalarField in the declaration file earsmImpkOmega.H

//- Return the invariant invar2stmp<volScalarField> invar2s() const{

return tmp<volScalarField>(

new volScalarField(

IOobject(

"invar2s",mesh_.time().timeName(),mesh_

),tr((tau()*(symm(fvc::grad(U_)))) & (tau()*symm(fvc::grad(U_))))

));

}

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 13

Page 13: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X. •Add invar2r volScalarField in the declaration file earsmImpkOmega.H

//- Return the invariant invar2rtmp<volScalarField> invar2r() const

{return tmp<volScalarField>(

new volScalarField(

IOobject(

"invar2r",mesh_.time().timeName(),mesh_

),tr((tau()*skew(fvc::grad(U_))) & (tau()*skew(fvc::grad(U_)))))

);}

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 14

Page 14: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X. •Add P1 volScalarField in the declaration file earsmImpkOmega.H

//- Return the coefficient P1tmp<volScalarField> P1() const

{return tmp<volScalarField>(

new volScalarField(

IOobject(

"P1",mesh_.time().timeName(),mesh_

),(sqr(C1_)/27 + (9/20)*invar2s() - (2/3)*invar2r())*C1_

));

}

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 15

Page 15: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X. •Add P2 volScalarField in the declaration file earsmImpkOmega.H

//- Return the coefficient P2tmp<volScalarField> P2() const

{return tmp<volScalarField>(

new volScalarField(

IOobject(

"P2",mesh_.time().timeName(),mesh_

),sqr(P1()) - pow((sqr(C1_)/9 + (9/10)*invar2s() + (2/3)*invar2r()),3)+SMALL)

);}

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 16

Page 16: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X. •Add N volScalarField in the declaration file earsmImpkOmega.H

//- Return the coefficient Ntmp<volScalarField> N() const

{return tmp<volScalarField>(

new volScalarField(

IOobject(

"N",mesh_.time().timeName(),mesh_

),C1_/3 + pow((P1() + sqrt(P2())),(1/3)) + pow((P1() - sqrt(P2())),(1/3))

));

}

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 17

Page 17: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X. •Add Q volScalarField in the declaration file earsmImpkOmega.H

//- Return the coefficient Qtmp<volScalarField> Q() const

{return tmp<volScalarField>(

new volScalarField(

IOobject(

"Q",mesh_.time().timeName(),mesh_

),(5/6)*(sqr(N()) - 2*invar2r())*(2*sqr(N()) - invar2r())+SMALL)

);}

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 18

Page 18: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X. •Add beta1 volScalarField in the declaration file earsmImpkOmega.H

//- Return the coefficient beta1tmp<volScalarField> beta1() const

{return tmp<volScalarField>(

new volScalarField(

IOobject(

"beta1",mesh_.time().timeName(),mesh_

),-N()*(2*sqr(N())-7*invar2r())/Q())

);}

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 19

Page 19: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X. •Add beta6 volScalarField in the declaration file earsmImpkOmega.H

//- Return the coefficient beta6tmp<volScalarField> beta6() const

{return tmp<volScalarField>(

new volScalarField(

IOobject(

"beta6",mesh_.time().timeName(),mesh_

),-(6*N())/Q())

);}

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 20

Page 20: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X.

•Add the data members in the source file earsmImpkOmega.C before k_

vi earsmImpkOmega.C

c1_(

dimensioned<scalar>::lookupOrAddToDict(

"c1",coeffDict_,1.8

)),C1_(

dimensioned<scalar>::lookupOrAddToDict(

"C1",coeffDict_,1.8

)),

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 21

Page 21: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X.

•Add the data member in the source file earsmImpkOmega.C before k_

cTau_(

dimensioned<scalar>::lookupOrAddToDict(

"cTau",coeffDict_,6.0

)),

• Replace the effective turbulent viscosity at two locations in earsmImpkOmega.C

//nut_=k_/omega_;

nut_ = -(1/2)*k_*tau()*(beta1()+beta6()*invar2r());

wmake libso

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 22

Page 22: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X.

$FOAM_RUN

•copy the case from PingPong and extract it in your home directory

tar -xf testCaseEarsm.tar.gz

rm testCaseEarsm.tar.gz

cd testCaseEarsm

•Change the turbulence model in RASProperties dictionary to

RASModel earsmImpkOmega

• Include the dynamic library in controlDict file

"libMyIncompressibleRASModels.so" // under libs();

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 23

Page 23: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X. • Add the following to the controlDict to find the average and RMS velocity

functions

(

fieldAverage1

{

type fieldAverage;

functionObjectLibs ("libfieldFunctionObjects.so");

enabled true;

outputControl outputTime;

fields

(

U

{

mean on;

prime2Mean on; //RMS

base time;

}

);

}

);

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 24

Page 24: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X. •Copy and modify the sampleDict dictionary from the tutorials directory to sample the line

cp $FOAM_TUTORIALS/compressible/sonicFoam/laminar/shockTube/system/sampleDict ./system/.

//- sampleDict

interpolationScheme cellPoint;

setFormat xmgr;

sets

(

line

{

type face;

axis z;

start ( 0.5 0 0 );

end ( 0.5 0 0.05 );

nPoints 10;

}

);

fields (Ux Uy Uz U UMean UPrime2Mean);

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 25

Page 25: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Implementation of Turbulent Viscosity in OpenFOAM 2.4.X.

•Mesh the computational domain and run simpleFoam solver

blockMesh

simpleFoam

•Post-process the results using paraFoam and sample Utility

paraFoam

foamCalc components U

sample -case testCaseEarsm

xmgrace testCaseEarsm/postProcessing/sets/xx/line_U_Umean.agr //replace xx with time directory

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 26

Page 26: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Post-Processing using paraview

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 27

Figure: Velocity Contour(no convergence in the Solution)

Page 27: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Post-Processing using Sample Utility

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 28

Figure: Velocity Profile of the inlet and Mean velocity

Page 28: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Learning during the implementation

• The data members using IOobject class has to be placed in the source (.C) file in the same order of declaration in .H file.

• It is not possible to compute volScalarField if the computed value arisesto be a complex number or a negative number

• The dimension set of the functions used for computing volScalarFieldshould match

• When the conditional statements are used in theIOobject class, a temporary dimensioned scalar has to be introduced to accept the value.

• The truncation error can be rectified by adding a very small value to the computed volScalarField

• Implement the source code in small steps in an thereby easy to identify and debug errors

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 29

Page 29: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Conclusion andFuture Work

• Effective turbulent viscosity from EARSM is implementedfor two equation turbulence model

• Tested the rotating pipe flow case using the implementedmodel

Improvement

• Include the anisotropy term in the production and turbulent diffusion term to implement EARSM completely

• Use perturbed solution of three dimensional equation of N in computing anisotropy term.

2015-12-08 CFD WITH OPENSOURCE SOFTWARE, 2015 30

Page 30: Implementation of turbulent viscosity usin EARSM - …hani/kurser/OS_CFD_2015/ThejeshwarSadanand… · CFD with OpenSource Software 2015 Implementation of Turbulent Viscosity from

Thank You