CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   turbulence->correct(), EXPERT NEEDED (http://www.cfd-online.com/Forums/openfoam-solving/108710-turbulence-correct-expert-needed.html)

beeo October 31, 2012 01:15

turbulence->correct(), EXPERT NEEDED
 
Dear all,

I want to simulate the turbulent, incompressible flow over a backward facing step with heat transfer.

Since the velocity field does not depend on the thermal field I want to compute it in a first step. In order to obtain the velocity field I am running the original simpleFoam solver which works fine so far.

In a second step, I want to compute the temperature field on the basis of the converged velocity field data since the temperature field depends on the velocity. So the results of my first computation serve as the initial folder of the second one plus the boundary condition for T.

In order to compute the thermal field I modified the original simpleFoam solver by adding the energy equation in combination with a special turbulence model for the turbulent scalar fluxes. While running it, UEqn and pEqn are commented out since I want to use the converged results of step 1 rather than recalculate these fields. Now my main concern:

The modified solver is running when "turbulence->correct()" is commented out. When active it crashes with a "sigFpe" error. Since my model for the turbulent scalar fluxes is a function of the Reynolds stresses and velocity gradients I am not sure wheter I need this part of the original simpleFoam solver or I can neglect it.

Does anyone know what "turbulence->correct()" is exactly doing?
Additionally, is my general procedure legitimate?
Overall, I am using the velocity data of step 1 and the temperature data of step 2 for post-processing.

Thanks for your answers!
Beeo

pascool October 31, 2012 11:55

Hi beeo,

I encountered the same problem and I couldn't find out how the tubulent->correct statement actually works and how it affects the solving of the temperature equation when I already have a converged velocity field. I don't know why it crashes for flows with separation, in particular.

Regards,

Pascal

mturcios777 October 31, 2012 12:30

turbulence->correct() updates the turbulence model based upon the now solved for U. What it does depends on whether you have a RANS or LES turbulence model enabled. Since you have already solved for the velocity field, you should not need to continue updating turbulence. The floating point error is likely from trying to update the turbulence model when nothing has happened. As long as mut and your Prandtl number are correct, you should be in business.

beeo October 31, 2012 14:13

1 Attachment(s)
Thanks Pascal and mturcios777 for your answers.

Quote:

Originally Posted by mturcios777 (Post 389505)
turbulence->correct() updates the turbulence model based upon the now solved for U. What it does depends on whether you have a RANS or LES turbulence model enabled. Since you have already solved for the velocity field, you should not need to continue updating turbulence. The floating point error is likely from trying to update the turbulence model when nothing has happened. As long as mut and your Prandtl number are correct, you should be in business.

In order to find out the influence of turbulence->correct() on the thermal field I did the following:

Simulation of a heated channel flow with constant heat flux at the lower and upper wall (RANS)
  1. calculate the velocity field (turbulence model: RSTM)
  2. calculate the thermal field based on 1. with two different approaches for the turbulent scalar fluxes
  • Fourier's Law (−ui θ = f(∂Θ/∂xi)) --> no dependence on the velocity field
  • Own model (−ui θ = f(ui uj , Sij , ∂P/ ∂xi, ...)) --> explicit dependence on velocity field
For each of the two models, computations are done with turbulence->correct() active and inactive respectively. All other parameters are the same.


While the results on the basis of Fourier's Law are identical and thus show no dependence on turbulence->correct(), the output of the own model behaves different.


Please see the attached picture which displays the problem exemplary for T_wall along x/H.

Ideas please!
Beeo

Attachment 16552

ozgur October 31, 2012 15:39

Dear beeo,

If you were using a LES model I would say that the member function "correct()" will update the turbulent kinetic energy (k) and eddy viscosity (nuSgs) values which are member variables of the object "turbulence". I haven't looked at the RAS model codes so far, but it may be similar in a RAS models also.

So if you are sure that you don't refer to the "turbulence" object in any other part of your code, i.e. by writing "turbulence -> something", such as "turbulence-> divDevReff(U)" or turbulence-> nut()", then only calling the "turbulence-> correct ()" should have no effect on your results at all (at least I guess this way)..

By the way, are you totally dismantling the available turbulence model references from simpleFoam, and writing your own turbulence model as a part of solver, i.e. not as an external class??

This may also be helpful: http://www.tfd.chalmers.se/~hani/kur...lenceModel.pdf

Ozgur

beeo November 1, 2012 13:43

Thanks Ozgur.

I had a look at the code of the turbulence model. The function turbulenceModel::correct() starts as follows:

Code:

void turbulenceModel::correct()
{
    RASModel::correct();

    if (!turbulence_)
    {
        return;
    }

    if (mesh_.changing())
    {
        yr_.correct();
    }

This part of the code is followed by (in words)
  • Update of epsilon and G at the wall
  • Dissipation equation
  • Wall correction
  • Reynolds stress equation
  • Re-calculation of turbulent viscosity
  • Correction of wall shear stresses
  • Calculation of near-wall velocity gradient
  • Calculation of near-wall shear-stress tensor
  • Reset of the shear components of the stress tensor

I do not completely understand the if-statements. Can someone explain the exact meaning of if (!turbulence_) and if (mesh_.changing())?

So if one of the two conditions is occuring during the computation of the TEqn, the turbulence->correct() statement is needed and I have to incorporate the entire function.

If none of the if-statements is true, I can neglect turbulence->correct() in combination with the TEqn.

Right?

mturcios777 December 17, 2012 18:52

Quote:

Originally Posted by beeo (Post 389720)
Thanks Ozgur.

[...]

I do not completely understand the if-statements. Can someone explain the exact meaning of if (!turbulence_) and if (mesh_.changing())?

So if one of the two conditions is occuring during the computation of the TEqn, the turbulence->correct() statement is needed and I have to incorporate the entire function.

If none of the if-statements is true, I can neglect turbulence->correct() in combination with the TEqn.

Right?

Might as well answer as I'm purging my subscriptions. turbulence_ is a member variable that is set by the turbulence keyword in RASProperties. If this is set to off, then there is no need to proceed further. The statement is the member access function to the private member of mesh_ that determined if the mesh is changing. If the mesh has changed, then we need to recalculate the yr.

santiagomarquezd December 22, 2012 10:41

Well, there is a simple way to do what you want, it is using the

buoyantBoussinesqSimpleFoam

solver, this solver is simpleFoam with buoyancy plus the energy equation. So that you have to use null thermal expansion coefficient (beta=0) to deactivate the buoyancy and set the other physical properties in order to use the energy equation. If you want to use RANS it is included, in the case of laminar you can use the laminar dummy model that avoids the use of the turbulent correction. In case you want LES you have to program a bit but it is easy.

All the info is here:

http://openfoamwiki.net/index.php/Bu...sinesqPisoFoam

Regards.


All times are GMT -4. The time now is 09:34.