Progamming issue: how do i get acces to the actual values of k-epsilon?
Hi,
after some struggling with the setup of OpenFOAM simulations, I have now started to write my own models. My first difficulties arose when i wanted to get access to the desired variables. What I actualy mean is lets take for example the density or the specific heat capacity which can be called using "twoPhaseProperties.variableName". Now I would like to have access to the actual values of for instance k-epsilon variables, but I would like to understand how do I generally find out where certain variables are computed and how to access them? Greetings Sabin |
Hello Sabin,
could you tell me which solver and which version you're using? In your solver (interFoam.C) which might be for example rasInterFoam (older version) or now interFoam (actual version) you will find a line turbulence->correct(); which will actually call the turbulence model. the object turbulence is assigned in the createFields.H file in 00095 // Construct incompressible turbulence model 00096 autoPtr<incompressible::turbulenceModel> turbulence 00097 ( 00098 incompressible::turbulenceModel::New(U, phi, twoPhaseProperties) 00099 ); There you can see where it comes from. It is an incompressible turbulenceModel, so you have to search in src/turbulenceModel/incompressible/turbulenceModel or src/turbulenceModel/RAS/incompressible/RASModel, depending on the version you're using. . There you will find the files turbulenceModel.C turbulenceModel.H and newTurbulenceModel.C respectively RASModel.C RASModel.H and newRASModel.C Here you will find the reading from your turbulence dictionary and the setting of the turbulence model. From now on it depends which model you are using. If you give me more information I can try to help you figuring it out. Best Kathrin |
Morning Kathrin,
thanks for the answer Sorry that I forgot to mention which solver I am using (it's interFoam from OF 1.6) . By looking into this http://foam.sourceforge.net/doc/Doxygen/html/incompressible_2turbulenceModel_2turbulenceModel_8 H_source.html I would understand that if I need the turbulence kinetic energy (k) I should be able to call it by volScalarField turbKinEnergy = turbulence.k(); , because the turbulence kinetic energy is defined in the file turbulenceModel.H as: virtual tmp<volScalarField>k() const = 0; But it's not working.. During the compilation I get the error ‘class Foam::autoPtr<Foam::incompressible::turbulenceMode l>’ has no member named ‘k’ Do you have an idea how I can access this variable? Greetings Sabin |
Quote:
('turbulence' with parentheses). |
Thanks r08n and Kathrin for helping me out, within such a short time.
|
Could you please explain wht this works?
Quote:
Thanks a lot, Xinyu |
Dear Foamers,
I recently encountered the same problem regarding the access to the turbulence kinetic energy! By follwing the advice of this thread Quote:
Quote:
Quote:
Regards Marco |
Marco,
This is because you can't define a initialize a parameter in the constructor in the manner you are attempting. Code:
const volScalarField& turbKinEnergy = turbulence().k(), Code:
const volScalarField& turbKinEnergy, |
1 Attachment(s)
Hi Daniel,
First I thanks you for your reply! I am dealing with another problem! I implement a homogenoeus multiphase problem using pimple loop! I add a new transport scalar equation with variable density and I want to update my density after tha computing of the scalar quantity! Here is the code : Quote:
Moreover, what about the rhoPhi variable? Here is the whole solver! Thanks Regards Marco |
All times are GMT -4. The time now is 02:52. |