- **OpenFOAM Programming & Development**
(*http://www.cfd-online.com/Forums/openfoam-programming-development/*)

- - **Modify turbulence kEpsilon for incompressible multiphase**
(*http://www.cfd-online.com/Forums/openfoam-programming-development/132218-modify-turbulence-kepsilon-incompressible-multiphase.html*)

Modify turbulence kEpsilon for incompressible multiphaseHello 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_)` Code:
` fvm::ddt(rho_, k_)` rho and rhoPhi must be inherited from turbulencemodel->RASModel->mykEpsilon.I would really appreciate your help! - Francisco |

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")` 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 |

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` k for instance:Code:
`k_` RASModel and Incompressible Turbulence Model these are the only available:Code:
`rhokEpsilon::rhokEpsilon` 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 |

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");` Code:
`const volScalarField& rho = U_.mesh().lookupObject<volScalarField>("rho");` |

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` Code:
` const volScalarField& rho_ = mesh_.lookupObject<volScalarField>("rho");` Code:
`// Dissipation equation` 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 |

Quote:
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 |

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 |

Quote:
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 |

Quote:
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 |

turbulence model implementHi,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,
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 |

Thank youHi,francisco
Thanks all the same Best wishes |

All times are GMT -4. The time now is 21:51. |