CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Turbulent Prandtl Number (http://www.cfd-online.com/Forums/openfoam/92705-turbulent-prandtl-number.html)

morard September 22, 2011 10:27

Turbulent Prandtl Number
 
Hello to all,

I am trying to implement varying turbulent prandtl number in my simulation like it has been written in paper from Lilly ("A proposed modification of the Germano subgrid-scale closure method") - eq (17). As a basic, I want to use dynSmagorinsky model (OF 1.7.1). For that purpose I have to read temperature field, but I have some problems in doing that. Does anybody now how to read Temperature field into this model? I have tried to use something like:

volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

but this does not work. Does anybody has an idea?

Regards,
Dejan

nimasam September 22, 2011 11:16

it seems you write correctly
1)did you compile ur new modified solver?
2) did you add T into ur 0 directory?
3) whats the error?

morard September 22, 2011 11:54

Hi nima and thanks for replay,

I didn't compile it. What I did is: in the dynSmagorinsky.H I have added the following function:
virtual tmp<volScalarField> Temperature() const
{

volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);
return T;
}

Of course, this doesn't work. This was just try to see what will happen. I think virtual function to do this should be declared much earlier, probably in LESmode or turbulenceModel.

The second way I am trying to solve this is to change constructor in LESmodel and to use something like:
LESModelPrandtl
(
const word& type,
const volVectorField& U,
const volScalarField& T,
const surfaceScalarField& phi,
transportModel& lamTransportModel
);
note that const volScalarField& T, is the only difference from the original one. This also doesn't go and I think that turbulenceModel should be changed on this way. But, I do not want to play around with this. Anyway, now I would like to now is this approach is the right one. I think it is not necessary to post errors, since I had a lot.

If I had managed to change model on this way, than I would simply in the file createFields (of my solver) write the following:

autoPtr<incompressible::LESModel> sgsModel
(
incompressible::LESModel::New(U, T, phi, laminarTransport)
);

and that's it.

What do you think, is this good approach?

nimasam September 22, 2011 18:54

search for lookup object

Bernhard September 23, 2011 02:03

This approach is the most general one, but if you want to have T in only one of your own models, then I know that there is a much easier way, unfortunately, I don't have any syntax for you.

But, if you're using the dynSmagorinsky model of 1.7.1 I won't bother implementing this and just base the turbulent Prandtl number on the eddy viscosity. The reason is that the 1.7.1 dynSmagorinsky model is not the model by Lilly, since the Smagorinsky constant is averaged over the whole domain. As you're using this model, imho it does not make sence to use localized variables of the turbulent Prandtl number.

If you're interesting in an approach like Lilly's, please have a look at: http://www.cfd-online.com/Forums/ope...agorinsky.html

morard September 23, 2011 03:24

Quote:

Originally Posted by Bernhard (Post 325310)
This approach is the most general one, but if you want to have T in only one of your own models, then I know that there is a much easier way, unfortunately, I don't have any syntax for you.

But, if you're using the dynSmagorinsky model of 1.7.1 I won't bother implementing this and just base the turbulent Prandtl number on the eddy viscosity. The reason is that the 1.7.1 dynSmagorinsky model is not the model by Lilly, since the Smagorinsky constant is averaged over the whole domain. As you're using this model, imho it does not make sence to use localized variables of the turbulent Prandtl number.

If you're interesting in an approach like Lilly's, please have a look at: http://www.cfd-online.com/Forums/ope...agorinsky.html

Thanks Bernhard.

Yes, I want to have T just in one model. I have adjusted turbulenceModel, unfortunately I still have some errors so I haven't finished yet, but I think I can fix it and at the I'll have what I wanted. But, as you said, I believe that there must be a much easier way.

Actually I need just idea from Lilly and I wanted to implement it in dynSmagorinsky because it seemed not so complicated. After that I want to spread this to some other models which I use more often,

nimasam September 23, 2011 05:07

you can read T easily with this syntax :
const volScalarField& T =
db().lookupObject<volScalarField>("T");

morard September 23, 2011 10:08

Quote:

Originally Posted by nimasam (Post 325340)
you can read T easily with this syntax :
const volScalarField& T =
db().lookupObject<volScalarField>("T");

Thanks, I'll also try on that way.

morard September 29, 2011 09:53

Hi again,

I have implemented Prandtl number calculation in dynOnEqEddy model. As a basic I used paper from Lilly, but instead of calculating PrSgs locally, I use averaging as it is done in dynSmagorinsky. Model calculates PrSgs at each time step. Also I had to make some necessary changes in turbulenceModel, LESModel (in constructors and some functions). Nima and Bernhard, thanks again. Main changes in dynEqEddy are these:

void dynOneEqEddyPrandtl::updateSubGridScaleFields(cons t volSymmTensorField& D)
{
nuSgs_ = ck(D)*sqrt(k_)*delta();
nuSgs_.correctBoundaryConditions();
PrSgs_ = 2*c1(D).value()/c2(D).value();
}

and

dimensionedScalar dynOneEqEddyPrandtl::c1(const volSymmTensorField& D) const
{
volSymmTensorField LL = dev(-filter_(sqr(U())) + sqr(filter_(U())));

volSymmTensorField MM = sqr(delta())*(4*mag(filter_(D))*filter_(D) - filter_(mag(D)*(D)));

dimensionedScalar MMMM = average(magSqr(MM));

if (MMMM.value() > VSMALL)
{
return average(LL && MM)/MMMM;
}
else
{
return 1.0;
}
}

dimensionedScalar dynOneEqEddyPrandtl::c2(const volSymmTensorField& D) const
{
volVectorField PP = -filter_(T()*U()) + (filter_(T())*filter_(U()));

volVectorField RR = sqr(delta())*(4*mag(filter_(D))*fvc::grad(filter_( T())) - filter_(mag(D)*fvc::grad(T())));

dimensionedScalar RRRR = average(magSqr(RR));

if (RRRR.value() > VSMALL)
{
return average(PP & RR)/RRRR;
}
else
{
return 1.0;
}
}

Aerospace November 23, 2011 11:24

Hi!

I'm working with the buoyantBoussinesqSimpleFoam which employs Laminar and turbulent Prandtl numbers. I would like to know how accurate this approach is and how can I calculate the turbulent prandtl number for different fluids (air and CoO2), because in the literature only the laminar Prandtl number is provided.

Thanks a lot!!

Bernhard November 23, 2011 11:54

The turbulent Prandtl number is not really a property of the fluid, but more a property of the turbulence. Therefor it is (approximately) the same for all fluids (about 0.7 or something like that).


All times are GMT -4. The time now is 13:19.