ThomasLong |
October 16, 2022 05:45 |
scalarTransport functionObjects--coefficients alphaD and alphaDt have no effects
Hi foamers!
I am trying to simulate passive scalar transport in water with OpenFOAM-V2206. I used scalarTransport function in controlDict. As for the diffusion coefficient, a specified constant coefficient D did have effects on the results though I didn't get a good result in this way. Then I noticed the desciption in scalarTransport.H and got these lines below:
Code:
Alternatively if a turbulence model is available a turbulent diffusivity may be constructed from the laminar and turbulent viscosities using the optional diffusivity coefficients alphaD and alphaDt (which default to 1):
D = alphaD*nu + alphaDt*nut
This message offered me another way to define the diffusion coefficient in flows with turbulence models. And I studied the source codes in scalarTransport.H and scalarTransport.C, then I got these codes:
Code:
Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
(
const volScalarField& s,
const surfaceScalarField& phi
) const
{
const word Dname("D" + s.name());
if (constantD_)
{
return tmp<volScalarField>::New
(
IOobject
(
Dname,
mesh_.time().timeName(),
mesh_.time(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar(Dname, phi.dimensions()/dimLength, D_)
);
}
if (nutName_ != "none")
{
const volScalarField& nutMean =
mesh_.lookupObject<volScalarField>(nutName_);
return tmp<volScalarField>::New(Dname, nutMean);
}
// Incompressible
{
const auto* turb =
findObject<incompressible::turbulenceModel>
(
turbulenceModel::propertiesName
);
if (turb)
{
return tmp<volScalarField>::New
(
Dname,
alphaD_ * turb->nu() + alphaDt_ * turb->nut()
);
}
}
// Compressible
{
const auto* turb =
findObject<compressible::turbulenceModel>
(
turbulenceModel::propertiesName
);
if (turb)
{
return tmp<volScalarField>::New
(
Dname,
alphaD_ * turb->mu() + alphaDt_ * turb->mut()
);
}
}
Code:
alphaD_ = dict.getOrDefault<scalar>("alphaD", 1);
alphaDt_ = dict.getOrDefault<scalar>("alphaDt", 1);
In my conprehension, without a specified constant D, the coefficients alphaD and alphaDt which represent the laminar diffusion coefficient and turbulent diffusion coefficient respectively will decide the diffusion coefficient according to compressibility of the fluids. Especially, the default value of the two coefficients are set to be 1.
From this way, I edited the scalarTransport function in my controlDict as follows:
Code:
sTransport
{
type scalarTransport;
libs (solverFunctionObjects);
enabled true;
writeControl writeTime;
writeInterval 1;
field s;
bounded01 false;
phase alpha.water;
rho rho;
p p_rgh;
nut nut;
nCorr 2;
alphaD 1;
alphaDt 1.42857;
write true;
resetOnStartUp false;
}
After one simulation, I changed the coefficient alphaDt into a relatively larger value. Then I found the results hardly changed this time!:eek::eek::confused::confused: I tried several simulations with different alphaD and alphaDt values and got the same results.
Did anybody have some experience on the simulation using these two coefficients? Or could anyone point out the errors in my defination of scalarTransport function? Thanks in advance!
|