Commit 7cbcc02d authored by Mark Olesen's avatar Mark Olesen
Browse files

turbulence models get thermal dissipation source term(s)

- thermalDissipation()
  corresponds to the energy lost due to viscous efffects and
  what exits the energy cascade via dissipation.

- thermalDissipationEff()
  corresponds to the energy lost due to effective viscous efffects.
  Everything that is lost from momentum. Thus essentially assumes
  turbulent equilibrium, but is what STAR-CD and Fluent seem to be using.
  Thus even if it's wrong, provide it anyhow.

- minor consistency update in comments
parent d4d31594
......@@ -76,6 +76,7 @@ LESModel::LESModel
)
),
turbulence_(true), // TODO: turbulence_(lookup("turbulence")),
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
coeffDict_(subDictPtr(type + "Coeffs")),
......@@ -180,6 +181,55 @@ autoPtr<LESModel> LESModel::New
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volScalarField> LESModel::thermalDissipation() const
{
tmp<volTensorField> tgradU = fvc::grad(this->U());
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"thermalDissipation",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
(
( this->mu()*dev(twoSymm(tgradU())) ) && tgradU()
) + this->rho() * this->epsilon()
)
);
}
tmp<volScalarField> LESModel::thermalDissipationEff() const
{
tmp<volTensorField> tgradU = fvc::grad(this->U());
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"thermalDissipationEff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
(
this->muEff()*dev(twoSymm(tgradU()))
- ((2.0/3.0)*I) * this->rho() * this->k()
) && tgradU()
)
);
}
void LESModel::correct(const tmp<volTensorField>&)
{
delta_().correct();
......
......@@ -33,13 +33,13 @@ Class
Foam::compressible::LESModel
Description
Class for all compressible flow LES SGS models.
Base class for all compressible flow LES SGS models.
This class defines the basic interface for a compressible flow SGS model,
and encapsulates data of value to all possible models. In particular
this includes references to all the dependent fields (rho, U, phi),
the physical viscosity mu, and the LESProperties dictionary,
which contains the model selection and model coefficients.
This class defines the basic interface for a compressible flow SGS
model, and encapsulates data of value to all possible models.
In particular this includes references to all the dependent fields
(rho, U, phi), the physical viscosity mu, and the LESProperties
dictionary, which contains the model selection and model coefficients.
SourceFiles
LESModel.C
......@@ -80,6 +80,7 @@ protected:
// Protected data
Switch turbulence_;
Switch printCoeffs_;
dictionary coeffDict_;
......@@ -292,6 +293,15 @@ public:
}
//- The source for the enthalpy equation resulting from
// viscous and turbulent dissipation
virtual tmp<volScalarField> thermalDissipation() const;
//- The source for the enthalpy equation resulting from
// the effective viscous dissipation
// (ie, when turbulent production and dissipation are in equilibrium)
virtual tmp<volScalarField> thermalDissipationEff() const;
//- Correct Eddy-Viscosity and related properties.
// This calls correct(const tmp<volTensorField>& gradU) by supplying
// gradU calculated locally.
......
......@@ -191,6 +191,55 @@ autoPtr<RASModel> RASModel::New
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volScalarField> RASModel::thermalDissipation() const
{
tmp<volTensorField> tgradU = fvc::grad(this->U());
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"thermalDissipation",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
(
( this->mu()*dev(twoSymm(tgradU())) ) && tgradU()
) + this->rho() * this->epsilon()
)
);
}
tmp<volScalarField> RASModel::thermalDissipationEff() const
{
tmp<volTensorField> tgradU = fvc::grad(this->U());
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"thermalDissipationEff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
(
this->muEff()*dev(twoSymm(tgradU()))
- ((2.0/3.0)*I) * this->rho() * this->k()
) && tgradU()
)
);
}
scalar RASModel::yPlusLam(const scalar kappa, const scalar E) const
{
scalar ypl = 11.0;
......
......@@ -345,6 +345,15 @@ public:
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const = 0;
//- The source for the enthalpy equation resulting from
// viscous and turbulent dissipation
virtual tmp<volScalarField> thermalDissipation() const;
//- The source for the enthalpy equation resulting from
// the effective viscous dissipation
// (ie, when turbulent production and dissipation are in equilibrium)
virtual tmp<volScalarField> thermalDissipationEff() const;
//- Return yPlus for the given patch
virtual tmp<scalarField> yPlus(const label patchI) const;
......
......@@ -177,6 +177,50 @@ tmp<fvVectorMatrix> laminar::divDevRhoReff(volVectorField& U) const
}
tmp<volScalarField> laminar::thermalDissipation() const
{
tmp<volTensorField> tgradU = fvc::grad(this->U());
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"thermalDissipation",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
( this->mu()*dev(twoSymm(tgradU())) ) && tgradU()
)
);
}
tmp<volScalarField> laminar::thermalDissipationEff() const
{
tmp<volTensorField> tgradU = fvc::grad(this->U());
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"thermalDissipationEff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
( this->mu()*dev(twoSymm(tgradU())) ) && tgradU()
)
);
}
bool laminar::read()
{
return RASModel::read();
......
......@@ -30,7 +30,6 @@ Description
SourceFiles
laminar.C
laminarCorrect.C
\*---------------------------------------------------------------------------*/
......@@ -82,42 +81,51 @@ public:
// Member Functions
//- Return the turbulence viscosity, i.e. 0 for laminar flow
tmp<volScalarField> mut() const;
virtual tmp<volScalarField> mut() const;
//- Return the effective viscosity, i.e. the laminar viscosity
tmp<volScalarField> muEff() const
virtual tmp<volScalarField> muEff() const
{
return tmp<volScalarField>(new volScalarField("muEff", mu()));
}
//- Return the effective turbulent thermal diffusivity,
// i.e. the laminar thermal diffusivity
tmp<volScalarField> alphaEff() const
virtual tmp<volScalarField> alphaEff() const
{
return tmp<volScalarField>(new volScalarField("alphaEff", alpha()));
}
//- Return the turbulence kinetic energy, i.e. 0 for laminar flow
tmp<volScalarField> k() const;
virtual tmp<volScalarField> k() const;
//- Return the turbulence kinetic energy dissipation rate,
// i.e. 0 for laminar flow
tmp<volScalarField> epsilon() const;
virtual tmp<volScalarField> epsilon() const;
//- Return the Reynolds stress tensor, i.e. 0 for laminar flow
tmp<volSymmTensorField> R() const;
virtual tmp<volSymmTensorField> R() const;
//- Return the effective stress tensor, i.e. the laminar stress
tmp<volSymmTensorField> devRhoReff() const;
virtual tmp<volSymmTensorField> devRhoReff() const;
//- Return the source term for the momentum equation
tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;
//- The source for the enthalpy equation resulting from
// viscous and turbulent dissipation
virtual tmp<volScalarField> thermalDissipation() const;
//- The source for the enthalpy equation resulting from
// the effective viscous dissipation
// (ie, when turbulent production and dissipation are in equilibrium)
virtual tmp<volScalarField> thermalDissipationEff() const;
//- Correct the laminar viscosity
void correct();
virtual void correct();
//- Read RASProperties dictionary
bool read();
virtual bool read();
};
......
......@@ -52,10 +52,10 @@ laminar::laminar
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermophysicalModel
)
:
turbulenceModel(rho, U, phi, thermoPhysicalModel)
turbulenceModel(rho, U, phi, thermophysicalModel)
{}
......@@ -66,10 +66,10 @@ autoPtr<laminar> laminar::New
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermophysicalModel
)
{
return autoPtr<laminar>(new laminar(rho, U, phi, thermoPhysicalModel));
return autoPtr<laminar>(new laminar(rho, U, phi, thermophysicalModel));
}
......@@ -96,18 +96,6 @@ tmp<volScalarField> laminar::mut() const
}
tmp<volScalarField> laminar::muEff() const
{
return tmp<volScalarField>(new volScalarField("muEff", mu()));
}
tmp<volScalarField> laminar::alphaEff() const
{
return tmp<volScalarField>(new volScalarField("alphaEff", alpha()));
}
tmp<volScalarField> laminar::k() const
{
return tmp<volScalarField>
......@@ -207,6 +195,50 @@ tmp<fvVectorMatrix> laminar::divDevRhoReff(volVectorField& U) const
}
tmp<volScalarField> laminar::thermalDissipation() const
{
tmp<volTensorField> tgradU = fvc::grad(this->U());
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"thermalDissipation",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
( this->mu()*dev(twoSymm(tgradU())) ) && tgradU()
)
);
}
tmp<volScalarField> laminar::thermalDissipationEff() const
{
tmp<volTensorField> tgradU = fvc::grad(this->U());
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"thermalDissipationEff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
( this->mu()*dev(twoSymm(tgradU())) ) && tgradU()
)
);
}
bool laminar::read()
{
return true;
......
......@@ -67,7 +67,7 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermophysicalModel
);
......@@ -79,7 +79,7 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermophysicalModel
);
......@@ -94,10 +94,17 @@ public:
virtual tmp<volScalarField> mut() const;
//- Return the effective viscosity, i.e. the laminar viscosity
virtual tmp<volScalarField> muEff() const;
//- Return the effective turbulent thermal diffusivity
virtual tmp<volScalarField> alphaEff() const;
virtual tmp<volScalarField> muEff() const
{
return tmp<volScalarField>(new volScalarField("muEff", mu()));
}
//- Return the effective turbulent thermal diffusivity,
// i.e. the laminar thermal diffusivity
virtual tmp<volScalarField> alphaEff() const
{
return tmp<volScalarField>(new volScalarField("alphaEff", alpha()));
}
//- Return the turbulence kinetic energy, i.e. 0 for laminar flow
virtual tmp<volScalarField> k() const;
......@@ -109,12 +116,21 @@ public:
//- Return the Reynolds stress tensor, i.e. 0 for laminar flow
virtual tmp<volSymmTensorField> R() const;
//- Return the effective stress tensor including the laminar stress
//- Return the effective stress tensor, i.e. the laminar stress
virtual tmp<volSymmTensorField> devRhoReff() const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;
//- The source for the enthalpy equation resulting from
// viscous and turbulent dissipation
virtual tmp<volScalarField> thermalDissipation() const;
//- The source for the enthalpy equation resulting from
// the effective viscous dissipation
// (ie, when turbulent production and dissipation are in equilibrium)
virtual tmp<volScalarField> thermalDissipationEff() const;
//- Correct the laminar viscosity
virtual void correct();
......
......@@ -117,12 +117,6 @@ autoPtr<turbulenceModel> turbulenceModel::New
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
turbulenceModel::~turbulenceModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void turbulenceModel::correct()
......
......@@ -65,7 +65,7 @@ namespace compressible
{
/*---------------------------------------------------------------------------*\
Class turbulenceModel Declaration
Class turbulenceModel Declaration
\*---------------------------------------------------------------------------*/
class turbulenceModel
......@@ -144,7 +144,8 @@ public:
//- Destructor
virtual ~turbulenceModel();
virtual ~turbulenceModel()
{}
// Member Functions
......@@ -209,6 +210,15 @@ public:
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const = 0;
//- The source for the enthalpy equation resulting from
// viscous and turbulent dissipation
virtual tmp<volScalarField> thermalDissipation() const = 0;
//- The source for the enthalpy equation resulting from
// the effective viscous dissipation
// (ie, when turbulent production and dissipation are in equilibrium)
virtual tmp<volScalarField> thermalDissipationEff() const = 0;
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct() = 0;
......
......@@ -125,8 +125,8 @@ autoPtr<LESModel> LESModel::New
{
FatalErrorIn
(
"LESModel::select(const volVectorField&, const "
"surfaceScalarField&, transportModel&)"
"LESModel::New(const volVectorField& U, const "
"surfaceScalarField& phi, transportModel&)"
) << "Unknown LESModel type " << modelName
<< endl << endl
<< "Valid LESModel types are :" << endl
......@@ -138,13 +138,56 @@ autoPtr<LESModel> LESModel::New
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volScalarField> LESModel::thermalDissipation() const
{
tmp<volTensorField> tgradU = fvc::grad(this->U());
LESModel::~LESModel()
{}
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"thermalDissipation",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
(
( this->nu()*dev(twoSymm(tgradU())) ) && tgradU()
) + this->epsilon()
)
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volScalarField> LESModel::thermalDissipationEff() const
{
tmp<volTensorField> tgradU = fvc::grad(this->U());
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"thermalDissipationEff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
(
this->nuEff()*dev(twoSymm(tgradU()))
- ((2.0/3.0)*I) * this->k()
) && tgradU()
)
);
}
void LESModel::correct(const tmp<volTensorField>&)
{
......
......@@ -35,10 +35,10 @@ Description
Base class for all incompressible flow LES SGS models.
This class defines the basic interface for an incompressible flow SGS
model, and encapsulates data of value to all possible models. In
particular this includes references to all the dependent fields (U,
phi), the physical viscosity nu, and the LESProperties
dictionary which contains the model selection and model coefficients.
model, and encapsulates data of value to all possible models.
In particular this includes references to all the dependent fields
(U, phi), the physical viscosity nu, and the LESProperties