CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to implement compressibility correction factor in k-epsilon model (http://www.cfd-online.com/Forums/openfoam-programming-development/108012-how-implement-compressibility-correction-factor-k-epsilon-model.html)

neeraj October 12, 2012 00:24

How to implement compressibility correction factor in k-epsilon model
 
Hi all,
I made a copy of existing kepsilon model and renamed as mykEpsilon and compiled successfully into OpenFOAM 2.1.1. Now i want to add compressibility correction factor Ym=2*epsilon*(M^2) ,where M=sqrt(k/(airvel^2)) in to the k equation.
For this i have to define a new dimensioned scalar constant "airvel" (velocity of sound= 350 m/s). can someone help me in doing this?
how should i define "airvel"?
where should i define its dimension?
etc..

K-equation is edited as follows:

// Turbulent kinetic energy equation

tmp<fvScalarMatrix> kEqn

(
fvm::ddt(k_)
+ fvm::div(phi_, k_)
- fvm::Sp(fvc::div(phi_), k_)
- fvm::laplacian(DkEff(), k_)
==
G
- fvm::Sp(epsilon_/k_, k_)
- fvm::Sp(2*epsilon_/airvel_, k_) //***added Ym compressibilty effect***//
);


I tried by adding these lines to mykEpsilon.C
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
airvel_
(
dimensioned<scalar>::lookupOrAddToDict
(
"airvel",
coeffDict_, //added by me //
117649
)
),

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //


and by adding these line to mykEpsilon.H class protected data
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensionedScalar airvel_;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //



Also added the dimensions into transportproperties in the pitzDaily/Constant
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;

nu nu [ 0 2 -1 0 0 0 0 ] 1e-05;

airvel_ airvel_ [ 0 2 -2 0 0 0 0 ] 117649;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //


But i am getting error as follows:::

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


Reading field p


Reading field U


Reading/calculating face flux field phi


Selecting incompressible transport model Newtonian

Selecting RAS turbulence model mykEpsilon
mykEpsilonCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
sigmaEps 1.3;
airvel 117649;
}

Defining my own kEpsilon model

No field sources present


SIMPLE: convergence criteria

field p tolerance 0.01
field U tolerance 0.001
field "(k|epsilon|omega)" tolerance 0.001


Starting time loop


Time = 1


DILUPBiCG: Solving for Ux, Initial residual = 1, Final residual = 0.0606635, No Iterations 1

DILUPBiCG: Solving for Uy, Initial residual = 1, Final residual = 0.0316293, No Iterations 1
DICPCG: Solving for p, Initial residual = 1, Final residual = 0.00922589, No Iterations 161
time step continuity errors : sum local = 0.58783, global = -0.001983, cumulative = -0.001983
DILUPBiCG: Solving for epsilon, Initial residual = 0.225166, Final residual = 0.0179849, No Iterations 1


--> FOAM FATAL ERROR:

incompatible dimensions for operation
[k[0 2 -3 0 0 0 0] ] - [k[0 4 -5 0 0 0 0] ]

From function checkMethod(const fvMatrix<Type>&, const fvMatrix<Type>&)

in file /home/opencfd/OpenFOAM/OpenFOAM-2.1.1/src/finiteVolume/lnInclude/fvMatrix.C at line 1316.

FOAM aborting


#0 Foam::error:
:printStack(Foam::Ostream&) in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::error::abort() in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 void Foam::checkMethod<double>(Foam::fvMatrix<double> const&, Foam::fvMatrix<double> const&, char const*) in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libincompressibleRASModels.so"
#3 at mykEpsilon.C:0
#4 Foam::incompressible::RASModels::mykEpsilon::corre ct() in "/home/http/OpenFOAM/http-2.1.1/platforms/linux64GccDPOpt/lib/libmyTurbulenceModels.so"
#5
in "/opt/openfoam211/platforms/linux64GccDPOpt/bin/simpleFoam"
#6 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#7
in "/opt/openfoam211/platforms/linux64GccDPOpt/bin/simpleFoam"
Aborted (core dumped)

Tobi October 12, 2012 15:46

Hi,

the solution is very simple :)
I fix that now and will upload the turbulence model.
You forgot just one line :)

Tobi

Tobi October 12, 2012 16:37

1 Attachment(s)
Hi,

I made your turbulence model and called it ccfkEpsilon like your headline.


ccfkEpsilon == compressibility correction factor k-Epsilon

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

How do implement it

1. Download the tar file
2. untar it into OpenFOAM-2.1.x/src/turbulenceModels/incompressible/RAS/
3. Switch into that directory
4. edit the Make/file file and insert the line

ccfkEpsilon/ccfkEpsilon.C

5. wmake libso
6. move into the tutorials/incompressible/simpleFoam/pitzDaily
7. change the constant/RASProperties and use the RASModel ccfkEpsilon
8. start simpleFoam

9. enjoy

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Code:

Selecting incompressible transport model Newtonian
Selecting RAS turbulence model ccfkEpsilon
ccfkEpsilonCoeffs
{
    Cmu            0.09;
    C1              1.44;
    C2              1.92;
    sigmaEps        1.3;
    airVel          117649;
}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

NOTICE
I dont know if the equation is correct or the value of "airVel". I just used the equation and constants mentioned in the first thread.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Eqn of k
Code:

tmp<fvScalarMatrix> kEqn
(
            fvm::ddt(k_)
          + fvm::div(phi_, k_)
          -  fvm::Sp(fvc::div(phi_), k_)
          -  fvm::laplacian(DkEff(), k_)
          ==
          G
          -  fvm::Sp(epsilon_/k_, k_)
          -  fvm::Sp(2*epsilon_/airVel_, k_)    //***added Ym compressibilty effect***//
);



ariVel is a constant of
117649 mē/sē.
You can change that value in the RASProperties file (if necessary).

Code:

RASModel        ccfkEpsilon;

turbulence      on;

printCoeffs    on;

ccfkEpsilonCoeffs
{
        airVel  1000;
}

Code:

Selecting incompressible transport model Newtonian
Selecting RAS turbulence model ccfkEpsilon
ccfkEpsilonCoeffs
{
    airVel          1000;
    Cmu            0.09;
    C1              1.44;
    C2              1.92;
    sigmaEps        1.3;
}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Regards Tobi


PS: Thanks for your email.

neeraj October 15, 2012 00:53

Thank you very much Tobias...!

PS: Check your mail...!


All times are GMT -4. The time now is 22:08.