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

Modify turbulence kEpsilon for incompressible multiphase

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree3Likes
  • 2 Post By franciscofelis
  • 1 Post By Fanfei

Reply
 
LinkBack Thread Tools Display Modes
Old   March 27, 2014, 11:50
Default Modify turbulence kEpsilon for incompressible multiphase
  #1
New Member
 
Francisco FELIS
Join Date: Oct 2013
Location: Montpellier, France
Posts: 6
Rep Power: 4
franciscofelis is on a distinguished road
Hello to everyone.

I'm trying to build a modify version of the incompressible kEpsilon turbulence introducing a variable density formulation for the transport equations to describe a two phase mean flow (air+water).

I'am using the twoLiquidMixingFoam as a base and I have created my personalized k-epsilon model from the incompressible part. My idea is to change the ddt(k) with ddt(rho, k) and add other source terms also as a function of "rho".

I'm rather new to this, but until now every problem that I have encountered I have managed to solve it by reading, reading and reading... until now:

I couldn't find a way to inherit the volScalarField rho and surfaceScalarField rhoPhi to the kEpsilon class.

Is there any efficient way to do that? Here is what I want:

To go from this:

Code:
        fvm::ddt(k_)
      + fvm::div(phi_, k_)
      - fvm::laplacian(DkEff(), k_)
     ==
        G
      - fvm::Sp(epsilon_/k_, k_)
To this:

Code:
        fvm::ddt(rho_, k_)
      + fvm::div(rhoPhi_, k_)
      - fvm::laplacian(rho_*DkEff(), k_)
     ==
        rho*G
      - fvm::Sp(rho*epsilon_/k_, k_)
And for that, to my understanding, rho and rhoPhi must be inherited from turbulencemodel->RASModel->mykEpsilon.

I would really appreciate your help!

- Francisco
franciscofelis is offline   Reply With Quote

Old   March 31, 2014, 12:02
Default
  #2
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: Amherst, MA USA - San Diego, CA USA
Posts: 320
Rep Power: 10
kmooney is on a distinguished road
Hi Francisco,

A few things:
1. When you mention inheriting a field, what you probably want to do is use a object registry lookup. Its an extremely powerful and easy thing that makes OpenFOAM super cool. If you wanted to pull in the density field, as long as its declared as a regIOobject, you can do this:

Code:
volScalarField& rho = mesh().lookupObject<volScalarField>("rho")
Basically, as long as you can get a reference to the mesh class, you can load up pretty much any field which is registered.

2. Compressible turbulence models already assume a non uniform density so that might be a better place to start then the incompressible turbulence classes.

3. This whole conversation might be moot because foam 2.3 has a multiphase kEp model .

http://www.openfoam.org/version2.3.0/multiphase.php

Cheers!
Kyle
kmooney is offline   Reply With Quote

Old   April 1, 2014, 06:10
Default
  #3
New Member
 
Francisco FELIS
Join Date: Oct 2013
Location: Montpellier, France
Posts: 6
Rep Power: 4
franciscofelis is on a distinguished road
Hello Kyle,

Thanks for your answer. Effectively I looked also into the incompressible side of the Turbulence model constructor, however, It seemed more simple to add "rho" than modify the thermophysical part to work along the Multiphase transport one.

I've started also to look into the 2.3 version and the new universal turbulence models for multiphase, however I don't feel myself so "strong" in OpenFOAM for using it yet...

For now, I've tried the Mesh lookup method that you mentioned and it didn't work. Here is the output:

Code:
rhokEpsilon.C:144:33: error: ‘mesh’ was not declared in this scope
     volScalarField& rho_ = mesh().lookupObject<volScalarField>("rho");
To my understanding, the way that the turbulence model is constructed, he doesn't know that there is any mesh, a part from the constructors, any other variable that works beneath the "turbulence model" has to be inherited or read directly from an IO file, like k for instance:

Code:
k_
    (
        IOobject
        (
            "k",
            runTime_.timeName(),
            mesh_,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        autoCreateK("k", mesh_)
    ),
From the constructor inherited from RASModel and Incompressible Turbulence Model these are the only available:

Code:
rhokEpsilon::rhokEpsilon
(
    const volVectorField& U, // hoping to add rho somewhere here
    const surfaceScalarField& phi,
    transportModel& transport,
    const word& turbulenceModelName,
    const word& modelName
)
:
    RASModel(modelName, U, phi, transport, turbulenceModelName),

So, to my understanding, it seems a little more complicated... Do you have any other inside on a way to call rho into the KEpsilon class ?

Many thanks in advance.

--Francisco
franciscofelis is offline   Reply With Quote

Old   April 1, 2014, 07:07
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,419
Rep Power: 25
alexeym will become famous soon enoughalexeym will become famous soon enough
Hi,

as kEpsilon is a child of RASModel class, which in turn is a child of trubulenceModel class it has mesh_ property. So your call should be

Code:
const volScalarField& rho = mesh_.lookupObject<volScalarField>("rho");
or, if we forget about inheritance, you can use

Code:
const volScalarField& rho = U_.mesh().lookupObject<volScalarField>("rho");
maybe in final implementation you'll move this call into the constructor of derived kEpsilon model.
alexeym is offline   Reply With Quote

Old   April 1, 2014, 10:36
Default
  #5
New Member
 
Francisco FELIS
Join Date: Oct 2013
Location: Montpellier, France
Posts: 6
Rep Power: 4
franciscofelis is on a distinguished road
Hello Alexey,

Thanks, it works like a charm!

So, finally, what I've done was to change the transport model for k and epsilon to a variable density formulation, which I think is more real when the difference between rho1 and rho2 is important. Here is the final code:

1) change in the production term of k: Do you think that this form of the variable density boussinesq is good? (rho is added at the end into the equations)

Code:
volScalarField G
    (
        GName(), 
        (((2.0/3.0)*I)*k_ - 2.0*nut_*(symm(fvc::grad(U_))-(1.0/3.0)*I*(fvc::div(U_))))
        && fvc::grad(U_)
    );
2) Read rho and phiRho from the mesh:

Code:
    const volScalarField& rho_ = mesh_.lookupObject<volScalarField>("rho");
    const surfaceScalarField& rhoPhi_ = mesh_.lookupObject<surfaceScalarField>("rhoPhi");
3) Modify k and epsilon equations:

Code:
// Dissipation equation
    tmp<fvScalarMatrix> epsEqn
    (
        fvm::ddt(rho_, epsilon_)
      + fvm::div(rhoPhi_, epsilon_)
      - fvm::laplacian(rho_*DepsilonEff(), epsilon_)
     ==
        C1_*rho_*G*epsilon_/k_
      - fvm::Sp(C2_*rho_*epsilon_/k_, epsilon_)
    );

// Turbulent kinetic energy equation
    tmp<fvScalarMatrix> kEqn
    (
        fvm::ddt(rho_, k_)
      + fvm::div(rhoPhi_, k_)
      - fvm::laplacian(rho_*DkEff(), k_)
     ==
        rho_*G
      - fvm::Sp(rho_*epsilon_/k_, k_)
    );
All of this works inside a slight variation of the twoLiquidMixingFoam, which describes the dispersed phase (water droplets into air) into a single equation (alpha1). I hope that'll do the work...

Many thanks to everyone.

-- Francisco
SailorLiu and mo_na like this.
franciscofelis is offline   Reply With Quote

Old   November 23, 2015, 04:41
Default
  #6
Member
 
Fei Fan
Join Date: Jun 2013
Location: NanJing, China
Posts: 52
Rep Power: 5
Fanfei is on a distinguished road
Quote:
Originally Posted by franciscofelis View Post
Hello Alexey,

Thanks, it works like a charm!

So, finally, what I've done was to change the transport model for k and epsilon to a variable density formulation, which I think is more real when the difference between rho1 and rho2 is important. Here is the final code:

1) change in the production term of k: Do you think that this form of the variable density boussinesq is good? (rho is added at the end into the equations)

Code:
volScalarField G
    (
        GName(), 
        (((2.0/3.0)*I)*k_ - 2.0*nut_*(symm(fvc::grad(U_))-(1.0/3.0)*I*(fvc::div(U_))))
        && fvc::grad(U_)
    );
2) Read rho and phiRho from the mesh:

Code:
    const volScalarField& rho_ = mesh_.lookupObject<volScalarField>("rho");
    const surfaceScalarField& rhoPhi_ = mesh_.lookupObject<surfaceScalarField>("rhoPhi");
3) Modify k and epsilon equations:

Code:
// Dissipation equation
    tmp<fvScalarMatrix> epsEqn
    (
        fvm::ddt(rho_, epsilon_)
      + fvm::div(rhoPhi_, epsilon_)
      - fvm::laplacian(rho_*DepsilonEff(), epsilon_)
     ==
        C1_*rho_*G*epsilon_/k_
      - fvm::Sp(C2_*rho_*epsilon_/k_, epsilon_)
    );

// Turbulent kinetic energy equation
    tmp<fvScalarMatrix> kEqn
    (
        fvm::ddt(rho_, k_)
      + fvm::div(rhoPhi_, k_)
      - fvm::laplacian(rho_*DkEff(), k_)
     ==
        rho_*G
      - fvm::Sp(rho_*epsilon_/k_, k_)
    );
All of this works inside a slight variation of the twoLiquidMixingFoam, which describes the dispersed phase (water droplets into air) into a single equation (alpha1). I hope that'll do the work...

Many thanks to everyone.

-- Francisco
Hellow Francisco:
I add the
const volScalarField& rho_ = mesh_.lookupObject<volScalarField>("rho"); the process suggest that mesh_ is not defined, while i try to use
const volScalarField& rho_ = U.mesh().lookupObject<volScalarField>("rho");
I was tell the U is not defined. what's the matter with it?

Best regards
Fan Fei
Fanfei is offline   Reply With Quote

Old   November 23, 2015, 05:10
Default
  #7
New Member
 
Francisco FELIS
Join Date: Oct 2013
Location: Montpellier, France
Posts: 6
Rep Power: 4
franciscofelis is on a distinguished road
Hello Fan Fei,
My solver works with binary mixture, so it is a variable density solver for incompressible flows, hence the "rho" (of the mixture).
If you have a volScalarField "rho" somewhere in your case, it should be able to find it.
Best regards,
Francisco
franciscofelis is offline   Reply With Quote

Old   November 23, 2015, 05:18
Default
  #8
Member
 
Fei Fan
Join Date: Jun 2013
Location: NanJing, China
Posts: 52
Rep Power: 5
Fanfei is on a distinguished road
Quote:
Originally Posted by franciscofelis View Post
Hello Fan Fei,
My solver works with binary mixture, so it is a variable density solver for incompressible flows, hence the "rho" (of the mixture).
If you have a volScalarField "rho" somewhere in your case, it should be able to find it.
Best regards,
Francisco
Hi Francisco:
Thanks for you reply me so quick. I add the rho to incompressible Ke model with the the above method, when i compile, it always suggested me that, the mesh_ is not defined in this cope.

Best regards
Fan Fei
Fanfei is offline   Reply With Quote

Old   November 23, 2015, 21:46
Default
  #9
Member
 
Fei Fan
Join Date: Jun 2013
Location: NanJing, China
Posts: 52
Rep Power: 5
Fanfei is on a distinguished road
Quote:
Originally Posted by franciscofelis View Post
Hello Fan Fei,
My solver works with binary mixture, so it is a variable density solver for incompressible flows, hence the "rho" (of the mixture).
If you have a volScalarField "rho" somewhere in your case, it should be able to find it.
Best regards,
Francisco
Hi Francisco:
It's work now, yesterday i Put the on the wrong place, so it's always hint me the mesh_ is not define. Thanks.

Best Redrads
Fan Fei
franciscofelis likes this.
Fanfei is offline   Reply With Quote

Old   December 4, 2015, 06:34
Default turbulence model implement
  #10
New Member
 
Aloha
Join Date: Sep 2015
Posts: 6
Rep Power: 3
app1e is on a distinguished road
Hi,Francisco

I tried to modify the k&epsilon equation exactly the same as you posted at #5.But i got a worse result compared to the simulation without implement.So i was wondering if you got the desired result after the implement.
Thank you in advance.

Aloha
app1e is offline   Reply With Quote

Old   December 4, 2015, 11:53
Default
  #11
New Member
 
Francisco FELIS
Join Date: Oct 2013
Location: Montpellier, France
Posts: 6
Rep Power: 4
franciscofelis is on a distinguished road
Hi Aloha,
I havn't yet arrived to a proper conclusion. I use this formulation only to be consistent with the Favre-Averaged RANS equations of my problem (turbulence in binary mixture).
Maybe next year... I hope.
Best Regards
Francisco
franciscofelis is offline   Reply With Quote

Old   December 5, 2015, 06:53
Default Thank you
  #12
New Member
 
Aloha
Join Date: Sep 2015
Posts: 6
Rep Power: 3
app1e is on a distinguished road
Hi,francisco
Thanks all the same
Best wishes
app1e is offline   Reply With Quote

Old   August 16, 2016, 22:52
Default
  #13
Member
 
Fei Fan
Join Date: Jun 2013
Location: NanJing, China
Posts: 52
Rep Power: 5
Fanfei is on a distinguished road
Quote:
Originally Posted by app1e View Post
Hi,Francisco

I tried to modify the k&epsilon equation exactly the same as you posted at #5.But i got a worse result compared to the simulation without implement.So i was wondering if you got the desired result after the implement.
Thank you in advance.

Aloha
hi Aloha:
Have you found the reseaons of your worse result. Nowadays, I am building a new template for multiphase turbulence model base on incompressible turbulence model and compressible turbulence model .Did you try to add the 'rho' Item from the laminar to RAS model. It looks like the wall funtion filed also need to add the the "rho" item.

Best regards
Fanfeisohu
Fanfei is offline   Reply With Quote

Old   August 30, 2016, 02:49
Default
  #14
New Member
 
Francisco FELIS
Join Date: Oct 2013
Location: Montpellier, France
Posts: 6
Rep Power: 4
franciscofelis is on a distinguished road
Hello,

Currently I'm using the same but in the RSM model. I couldn't say that the results are worst, but rather different, mostly because of the large density ratio of the mixture in my problem, so the results changes a lot by adding the variable density effects to the turbulence modelling. Nevertheless, compared to LDA measurements, it works pretty well.

I've done so by using the old of-2.2. I know that with the new generic turbulence template one shouldn't do it like I did... but I'm almost at the end of my thesis now, I won't change everything at the end...

Best regards.


Quote:
Originally Posted by Fanfei View Post
hi Aloha:
Have you found the reseaons of your worse result. Nowadays, I am building a new template for multiphase turbulence model base on incompressible turbulence model and compressible turbulence model .Did you try to add the 'rho' Item from the laminar to RAS model. It looks like the wall funtion filed also need to add the the "rho" item.

Best regards
Fanfeisohu
franciscofelis is offline   Reply With Quote

Reply

Tags
kepsilon, multiphase flow, turbulence models

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
multiphase turbulence nikhil r Main CFD Forum 0 October 5, 2013 01:36
Discussion: Reason of Turbulence!! Wen Long Main CFD Forum 3 May 15, 2009 09:52
Turbulence boundary values lego Main CFD Forum 0 October 24, 2002 13:47
Is turbulence disripable by chaos? Matthias Main CFD Forum 9 March 27, 2001 13:04
turbulence modeling questions llowen Main CFD Forum 3 September 11, 1998 04:24


All times are GMT -4. The time now is 07:54.