CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

How to implement compressibility correction factor in k-epsilon model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 12, 2012, 01:24
Question How to implement compressibility correction factor in k-epsilon model
  #1
New Member
 
neeraj's Avatar
 
OpenFoam
Join Date: Jul 2012
Posts: 24
Rep Power: 14
neeraj is on a distinguished road
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)
neeraj is offline   Reply With Quote

Old   October 12, 2012, 16:46
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

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

Tobi

Last edited by Tobi; October 12, 2012 at 17:40.
Tobi is offline   Reply With Quote

Old   October 12, 2012, 17:37
Default
  #3
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
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.
Attached Files
File Type: gz ccfkEpsilon.tar.gz (8.6 KB, 31 views)
Tobi is offline   Reply With Quote

Old   October 15, 2012, 01:53
Default
  #4
New Member
 
neeraj's Avatar
 
OpenFoam
Join Date: Jul 2012
Posts: 24
Rep Power: 14
neeraj is on a distinguished road
Thank you very much Tobias...!

PS: Check your mail...!
neeraj is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Turbulence Model Curvature Correction Jorg CFX 0 August 10, 2012 19:05
new compressibility model jml OpenFOAM 1 March 2, 2012 10:28
implement of Spalart-Allmaras model K S Chang Main CFD Forum 1 August 21, 2010 17:59
How to implement swirling phenomenon to model FAN OPticdesigner Main CFD Forum 3 January 9, 2006 08:16
FDS - how to implement your FORTRAN model???? ana Main CFD Forum 0 July 1, 2005 11:06


All times are GMT -4. The time now is 04:27.