Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion PANS Turbulence Model Implementation Guglielmo Minelli Chalmers University of Technology Applied Mechanics Vehicle Aerodynamic Laboratory December 01, 2014 1 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion Intro Solving methods Turbulence models The implemented models The test case PANS k − ε implementation .C modification .H modification k − ε − ζ − f .C modification .H modification Wall functions Conclusion 2 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion Solving Methods • RANS, LES, DNS Figure : Energy cascade 3 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion Hybrid Methods • Zonal approaches, switch the solving equations during the simulation or inside the domain. • DES and PANS • DES is a hybrid LES/RANS approach. • Fixed zonal approach, the RANS zones are defined a priori (close to wall) • PANS is a hybrid DNS/RANS approach. • Varying zonal approach, the RANS equations are employed only where the grid can not effort a DNS resolution. 4 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion URANS k − ε closure equation system � ∂ k ∂ k ∂ k = P k − ε + ∂ �� ν + ν t � ∂ t + U j ∂ x j ∂ x j σ k ∂ x j � ∂ε ε 2 ∂ε ∂ε ε k + ∂ �� ν + ν t � ∂ t + U j = C 1 ε k ( P k ) − C 2 ε ∂ x j ∂ x j σ ε ∂ x j • C 1 ε = 1 . 44, C 2 ε = 1 . 92, σ ε = 1 . 3 and σ k = 1 • ν t is updated every time step as k 2 ν t = C µ ε ; C µ = 0 . 09 • The method can catch only large oscillation such as vortex shedding 5 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion PANS k − ε closure equation system � ν u ∂ k u ∂ k u = P u − ε u + ∂ ∂ k u � ∂ t + U j ∂ x j ∂ x j σ k u ∂ x j � ν u ε 2 ∂ε u ∂ε u ε u + ∂ ∂ε � P u − C ⋆ u ∂ t + U j = C 1 ε u 2 ε ∂ x j ∂ x j σ ε u ∂ x j k u k u k 2 u ν u = C µ ε u C ⋆ 2 ε = C 1 ε + f k ( C 2 ε − C 1 ε ) � 2 / 3 Λ = k 3 / 2 � ∆ 1 ∆ = (∆ x ∆ y ∆ z ) 1 / 3 f k = ; ε ; √ c µ Λ • f k , depends from the Taylor scale and the cell size. • f k can be also fixed. 6 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion PANS k − ε − ζ − f closure equation system � ν u ∂ k u ∂ k u = P u − ε u + ∂ ∂ k u � ∂ t + U j ∂ x j ∂ x j σ k u ∂ x j � ν u ε 2 ∂ε u ∂ε u ε u + ∂ ∂ε � P u − C ⋆ u ∂ t + U j = C 1 ε u 2 ε ∂ x j k u k u ∂ x j σ ε u ∂ x j � ν u � ∂ζ u ∂ζ u = f u − ζ u P u + ζ ε u (1 − f k ) + ∂ ∂ζ ∂ t + U j ∂ x j k u k u ∂ x j σ ζ u ∂ x j u ∇ 2 f u − fu = 1 � P u � � ζ u − 2 � L 2 c 1 + c 2 T u ε u 3 ν u = C µ ζ k 2 u ε u c 1 = 0 . 4; c 2 = 0 . 65 • Two more equation for the low Re approach • Viscosity depends on ζ 7 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion The test case Figure : Backstep test geometry dimension. • 2D geometry • U = 10 m / s ; ν = 1 × 10 − 5 • folder you can download and copy in your run: tutorial_backStep_PANS_fixed_fk 8 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion PANS k − ε implementation • mkdir src/turbulenceModels/incompressible/RAS/ in your own folder • Download kEpsilonPANS_fixedFK.gz and extract the model in your own folder. • cp -r kEpsilonPANS_fixedFK kEpsilonPANS_varFK • change the .C and .H file name inside the kEpsilonPANS_varFK folder just created with kEpsilonPANS_varFK.C and kEpsilonPANS_varFK.H • sed -i s/kEpsilonPANS_fixedFK/kEpsilonPANS_varFK/g kEpsilonPANS_varFK.* • Add the new .C file to the Make/files file. • Ready to modify the .C and .H files. 9 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion kEpsilonPANS varFK.C • We need to add the coefficient C µ = Cmi_ Cmi_ ( dimensioned<scalar>::lookupOrAddToDict ( "Cmi", coeffDict_, 0.22 ) ), 10 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion kEpsilonPANS varFK.C • We need to change the constant f k = fK_ and C ⋆ 2 ε = C2U to scalarField and add the cellVolume_ scalarField cellVolume_ ( IOobject ( "cellVolume", runTime_.timeName(), mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh_, dimensionedScalar("zero",dimVolume,0.0) ), fK_ ( IOobject ( "fK", runTime_.timeName(), mesh_, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh_ ), 11 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion kEpsilonPANS varFK.C C2U ( IOobject ( "C2U", runTime_.timeName(), mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh_, dimensionedScalar("zero",0.0) ), 12 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion kEpsilonPANS varFK.C • The inserted variables should be initialized before the calculation as { cellVolume_.internalField() = mesh_.V(); C2U = C1_ + (fK_/fEpsilon_)*(C2_-C1_); .... .... } • Delete the old definition of C2U • Sobstitute bound(kU\_, fK\_*kMin\_); with bound(kU\_, min(fK\_)*kMin\_); after the kU_ equation 13 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion kEpsilonPANS varFK.C • Remember to delete the line fK\_.readIfPresent(coeffDict()); • At the end of each time step the factor f k and C ⋆ 2 ε are recalculated as // Re calculation of fK and C2U for PANS fK is calculated cell by // cell and upper and lower limited to avoid unfisical solution for (int i=0; i<fK_.size(); i++) { fK_[i]=(1/sqrt(Cmi_.value()))*(pow(pow(cellVolume_[i],1.0/3.0)/ (pow(k_[i],3.0/2.0)/epsilon_[i]),2.0/3.0)); if (fK_[i]>1) //upper limited fK_[i]=1; if (fK_[i]<0.1) //lower limited fK_[i]=0.1; } C2U =C1_+ (fK_/fEpsilon_)*(C2_-C1_); 14 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion kEpsilonPANS varFK.H • We need to add the new foelds and coefficients in the .H file • Remember to delete the old declaration of f k // Model coefficients dimensionedScalar Cmi_; //new dimensionedScalar Cmu_; dimensionedScalar C1_; dimensionedScalar C2_; dimensionedScalar sigmaEps_; dimensionedScalar fEpsilon_; // Fields volScalarField cellVolume_; //new volScalarField fK_; //new volScalarField C2U; //new volScalarField k_; volScalarField epsilon_; volScalarField kU_; volScalarField epsilonU_; volScalarField nut_; 15 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion Case folder modification • Download and extract the case folder backstep • Add the file fK to the 0 folder • Change the RASProperties file to RASModel kEpsilonPANS_varFK; • Add the following to the controlDict file to average quantities functions { fieldAve { type fieldAverage; functionObjectLibs ("libfieldFunctionObjects.so"); enabled true; outputControl outputTime; cleanRestart False; timeStart 30; timeEnd 100; fields ( U { mean on; prime2Mean on; base time; } ); } 16 / 33 }
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion Case folder modification • Add the following to the controlDict file to read your library libs ("libmyIncompressibleRASModels.so"); • Start simulation creating a log file pimpleFoam > log& • Check the simulation with the gnuplot script ”Residual” typing gnuplot Residual • Change the RASProperties to compare different solvers RASModel kEpsilonPANS{\_}fixedFK; RASModel kEpsilon; 17 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion kEpsZitaF.C • Starting from the last implemented model we can implement the four equation model. • Change the value of C1 and C2 to 0.4 and 0.65 respectively • Insert three more constants after fEpsilon_ CL_ ( dimensioned<scalar>::lookupOrAddToDict ( "CL", coeffDict_, 0.36 ) ), 18 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion kEpsZitaF.C Cmi_ ( dimensione CTau_ ( dimensioned<scalar>::lookupOrAddToDict ( "CTau", coeffDict_, 6 ) ), Ceta_ ( dimensioned<scalar>::lookupOrAddToDict ( "Ceta", coeffDict_, 85 ) ), 19 / 33
Outline Intro Turbulence models The test case PANS k − ε implementation k − ε − ζ − f Conclusion kEpsZitaF.C • Ceps1_ is now a scalar field that change at each timestep CEps1_ ( IOobject ( "CEps1", runTime_.timeName(), mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh_, dimensionedScalar("zero",0.0) ), 20 / 33
Recommend
More recommend