CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   add a pssive scalar in turbulent flow (https://www.cfd-online.com/Forums/openfoam/103244-add-pssive-scalar-turbulent-flow.html)

zxj160 June 14, 2012 12:59

add a pssive scalar in turbulent flow
 
Dear foamers,

How to add a passive scalar transport equation in the turbulent flow (I use LES)? Is there any tutorials for this problem?

niaz June 14, 2012 15:14

you can do the same thing in your code

{
fvScalarMatrix hEqn
(
fvm::ddt(rho, h)
+ fvm::div(phi, h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
dpdt
- (fvc::ddt(rho, K) + fvc::div(phi, K))
);

hEqn.relax();
hEqn.solve();

thermo.correct();
}
define alphaEff() firstly then use it.

morard June 15, 2012 02:44

Hi,

for a passive scalar you just have to write transport equation for it:

volScalarField kappaEff
(
"kappaEff",
nu/Pr + sgsModel->nut()/Prt
);

fvScalarMatrix TEqn
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(kappaEff, T)
);

call this, for example, TEqn.H and include it into your solver:

#include "TEqn.H"


Here, Pr is your Prandtl number, or Schmidt number, or whatever you want, and
you have to add this to the readTransportProperties.H

dimensionedScalar Pr
(
transportProperties.lookup("Pr")
);

dimensionedScalar Prt
(
transportProperties.lookup("Prt")
);

There is also one very nice tutorial:

http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam

Regards,
Dejan

zxj160 June 15, 2012 08:03

sgsModel->nut()/Prt


Regards,
Dejan[/QUOTE]

Many thanks. And what does the 'sgsModel->nut()/Prt' mean? And also the turbulent-> alphaEff()?

morard June 15, 2012 09:26

'sgsModel->nut()/Prt' is turbulent diffusivity

sgsModel->nut() returns turbulent viscosity which is calculated inside your LES model

and

turbulent-> alphaEff() is effective diffusivity (turbulent + molecular).

You need turbulent diffusivity because you model turbulent scalar flux as a product
of turbulent diffusivity and a gradient of a filtered field.

zxj160 June 15, 2012 11:43

Many thanks. Make sense.

sdharmar October 31, 2012 00:37

Adding Temperature equation to PimpleFoam
 
Hi Dejan and Foamers,

I am trying to add Temperature equation to pisoFoam solver to do LES. I found two differnt ways of writing TEqn.H

kappat = turbulence->nut()/Prt;
kappat.correctBoundaryConditions();
volScalarField kappaEff("kappaEff", turbulence->nu()/Pr + kappat);
fvScalarMatrix TEqn
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(kappaEff, T)
);
TEqn.relax();
TEqn.solve();

and

{
volScalarField kappaEff
(
"kappaEff",
turbulence->nu()/Pr + turbulence->nut()/Prt
);
fvScalarMatrix TEqn
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(kappaEff, T)
);
TEqn.relax();
TEqn.solve();
}

Is there any difference between those two?
Where should I include the TEqn.H? Inside the PISO loop or after the corrector step?
I have seen some users in this forum have suggested to specify "kappaEff" in createFields.H file in the same way we do for T and p. In this case I think that we need to specify bounday conditions of kappaEff too.
Is this correct?
I am going to use Smagorinsky model for SGS modeling. I suppose that it is enough to specify U, p and T in the boundaries. It is so confusing to me that most of the tutorial cases specify nuSgs, nuTilda in the bounday.
What is the reason behind that?

Finally,

When we specify,
turbulence -> nut()/Prt

Does the solver know that nut=nuSgs for LES modeling?
Please help me.

Best regards,
Suranga.

morard October 31, 2012 03:59

Hi Suranga,

there is no difference between those two ways, but if you ask me, use the second one. And usually you don't need TEqn.relax(); but I suppose that you can keep it if you want.

Include it after the PISO loop.

You can specify kappaEff in createFields.H and give it option IOobject::AUTO_WRITE,
so that you can post process it after the simulation is completed. You don't have to specify boundary conditions, and my personal opinion is that it's not necessary since the boundary conditions for kappa should be the same as for nu.

You are right, you don't have to specify nuTilda. It is required for some RAS models, but I can't remember which one.

Yes, solver knows that. Just check these lines in LESModel.H

//- Return the turbulence viscosity
virtual tmp<volScalarField> nut() const
{
return nuSgs();
}

Regards,
Dejan

sdharmar October 31, 2012 12:35

1 Attachment(s)
Dejan,

Thank you very much for your help. I did a simulation of pitzdaily tutorial by using tempPisoFoam ( the solver that I made including temperature field) and got unacceptable results for the temperature field. I have attached all the files for my test case and my new solver files herewith. Could you please see whether I am doing right or wrong.

I am sorry that I can not attache other files in the forum. If you can give me your other email I can send them too.

Best regards,
Suranga.

sdharmar October 31, 2012 17:26

Hi Dejan and others,

I solved the trouble. I will post all the things I did in this thread later. Thank you very much for your help.

Best regards,

Suranga.

morard November 1, 2012 04:17

Hi Suranga,

it's nice to hear that you have solved the problem.

Best regards,
Dejan

sdharmar January 27, 2013 13:57

tempSimpleFoam.
 
Hi everyone,

I am really sorry for not replying you earlier than this. You can find how I did modified the simpleFoam solver to solve temperature equation in the following thread.

http://www.cfd-online.com/Forums/ope...tml#post404356.

Please don't hesitate to give your comments. Your comments are always welcome.

BR,
Suranga.

kakkapriyesh January 26, 2019 01:21

Quote:

Originally Posted by sdharmar (Post 389390)
Hi Dejan and Foamers,

I am trying to add Temperature equation to pisoFoam solver to do LES. I found two differnt ways of writing TEqn.H

kappat = turbulence->nut()/Prt;
kappat.correctBoundaryConditions();
volScalarField kappaEff("kappaEff", turbulence->nu()/Pr + kappat);
fvScalarMatrix TEqn
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(kappaEff, T)
);
TEqn.relax();
TEqn.solve();

and

{
volScalarField kappaEff
(
"kappaEff",
turbulence->nu()/Pr + turbulence->nut()/Prt
);
fvScalarMatrix TEqn
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(kappaEff, T)
);
TEqn.relax();
TEqn.solve();
}

Is there any difference between those two?
Where should I include the TEqn.H? Inside the PISO loop or after the corrector step?
I have seen some users in this forum have suggested to specify "kappaEff" in createFields.H file in the same way we do for T and p. In this case I think that we need to specify bounday conditions of kappaEff too.
Is this correct?
I am going to use Smagorinsky model for SGS modeling. I suppose that it is enough to specify U, p and T in the boundaries. It is so confusing to me that most of the tutorial cases specify nuSgs, nuTilda in the bounday.
What is the reason behind that?

Finally,

When we specify,
turbulence -> nut()/Prt

Does the solver know that nut=nuSgs for LES modeling?
Please help me.

Best regards,
Suranga.

hi, i guess this is similar to current buyoant Pimple Foam , my question is : If i am using LES along with it,will it filter TEqn? as LES does implicit filtering,and i want to use a test filter to implement variable prt in the code . any suggestion on how to do it?Thanks

rarnaunot January 28, 2020 12:11

Problems adding muEff either nuEff
 
Hi Foamers,

I'm trying to do the same thing but in twoPhaseEulerFoam and RAS turbulence model. Has anyone tried it?

Thanks in advance,


All times are GMT -4. The time now is 00:24.