ThermophysicalTransportModels: Changed q() and j() to return surfaceScalarFields
such that div(q()) = divq(...) and div(j()) = divj(...) to unsure consistency between the reported heat (e.g. by the wallHeatFlux functionObject) and mass fluxes and those used in the energy and specie mass-fraction equations.
This commit is contained in:
@ -105,18 +105,18 @@ Fourier<TurbulenceThermophysicalTransportModel>::DEff
|
|||||||
|
|
||||||
|
|
||||||
template<class BasicThermophysicalTransportModel>
|
template<class BasicThermophysicalTransportModel>
|
||||||
tmp<volVectorField>Fourier<BasicThermophysicalTransportModel>::q() const
|
tmp<surfaceScalarField> Fourier<BasicThermophysicalTransportModel>::q() const
|
||||||
{
|
{
|
||||||
const thermoModel& thermo = this->thermo();
|
const thermoModel& thermo = this->thermo();
|
||||||
|
|
||||||
return volVectorField::New
|
return surfaceScalarField::New
|
||||||
(
|
(
|
||||||
IOobject::groupName
|
IOobject::groupName
|
||||||
(
|
(
|
||||||
"q",
|
"q",
|
||||||
this->momentumTransport().alphaRhoPhi().group()
|
this->momentumTransport().alphaRhoPhi().group()
|
||||||
),
|
),
|
||||||
-(this->alpha()*thermo.kappa())*fvc::grad(thermo.T())
|
-fvc::interpolate(this->alpha()*thermo.kappa())*fvc::snGrad(thermo.T())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ Fourier<BasicThermophysicalTransportModel>::divq(volScalarField& he) const
|
|||||||
|
|
||||||
|
|
||||||
template<class BasicThermophysicalTransportModel>
|
template<class BasicThermophysicalTransportModel>
|
||||||
tmp<volVectorField>Fourier<BasicThermophysicalTransportModel>::j
|
tmp<surfaceScalarField> Fourier<BasicThermophysicalTransportModel>::j
|
||||||
(
|
(
|
||||||
const volScalarField& Yi
|
const volScalarField& Yi
|
||||||
) const
|
) const
|
||||||
@ -147,7 +147,7 @@ tmp<volVectorField>Fourier<BasicThermophysicalTransportModel>::j
|
|||||||
" unityLewisFourier"
|
" unityLewisFourier"
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
return tmp<volVectorField>(nullptr);
|
return tmp<surfaceScalarField>(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -113,13 +113,13 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return the heat flux
|
//- Return the heat flux
|
||||||
virtual tmp<volVectorField> q() const;
|
virtual tmp<surfaceScalarField> q() const;
|
||||||
|
|
||||||
//- Return the source term for the energy equation
|
//- Return the source term for the energy equation
|
||||||
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
|
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
|
||||||
|
|
||||||
//- Return the specie flux for the given specie mass-fraction
|
//- Return the specie flux for the given specie mass-fraction
|
||||||
virtual tmp<volVectorField> j(const volScalarField& Yi) const;
|
virtual tmp<surfaceScalarField> j(const volScalarField& Yi) const;
|
||||||
|
|
||||||
//- Return the source term for the given specie mass-fraction equation
|
//- Return the source term for the given specie mass-fraction equation
|
||||||
virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const;
|
virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const;
|
||||||
|
|||||||
@ -25,6 +25,8 @@ License
|
|||||||
|
|
||||||
#include "unityLewisFourier.H"
|
#include "unityLewisFourier.H"
|
||||||
#include "fvmLaplacian.H"
|
#include "fvmLaplacian.H"
|
||||||
|
#include "fvcSnGrad.H"
|
||||||
|
#include "surfaceInterpolate.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -69,17 +71,18 @@ bool unityLewisFourier<BasicThermophysicalTransportModel>::read()
|
|||||||
|
|
||||||
|
|
||||||
template<class BasicThermophysicalTransportModel>
|
template<class BasicThermophysicalTransportModel>
|
||||||
tmp<volVectorField>
|
tmp<surfaceScalarField>
|
||||||
unityLewisFourier<BasicThermophysicalTransportModel>::q() const
|
unityLewisFourier<BasicThermophysicalTransportModel>::q() const
|
||||||
{
|
{
|
||||||
return volVectorField::New
|
return surfaceScalarField::New
|
||||||
(
|
(
|
||||||
IOobject::groupName
|
IOobject::groupName
|
||||||
(
|
(
|
||||||
"q",
|
"q",
|
||||||
this->momentumTransport().alphaRhoPhi().group()
|
this->momentumTransport().alphaRhoPhi().group()
|
||||||
),
|
),
|
||||||
-this->thermo().alpha()*this->alpha()*fvc::grad(this->thermo().he())
|
-fvc::interpolate(this->thermo().alpha()*this->alpha())
|
||||||
|
*fvc::snGrad(this->thermo().he())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,19 +97,20 @@ divq(volScalarField& he) const
|
|||||||
|
|
||||||
|
|
||||||
template<class BasicThermophysicalTransportModel>
|
template<class BasicThermophysicalTransportModel>
|
||||||
tmp<volVectorField>unityLewisFourier<BasicThermophysicalTransportModel>::j
|
tmp<surfaceScalarField>unityLewisFourier<BasicThermophysicalTransportModel>::j
|
||||||
(
|
(
|
||||||
const volScalarField& Yi
|
const volScalarField& Yi
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return volVectorField::New
|
return surfaceScalarField::New
|
||||||
(
|
(
|
||||||
IOobject::groupName
|
IOobject::groupName
|
||||||
(
|
(
|
||||||
"j(" + Yi.name() + ')',
|
"j(" + Yi.name() + ')',
|
||||||
this->momentumTransport().alphaRhoPhi().group()
|
this->momentumTransport().alphaRhoPhi().group()
|
||||||
),
|
),
|
||||||
-this->thermo().alpha()*this->alpha()*fvc::grad(Yi)
|
-fvc::interpolate(this->thermo().alpha()*this->alpha())
|
||||||
|
*fvc::snGrad(Yi)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -119,13 +119,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Return the heat flux
|
//- Return the heat flux
|
||||||
virtual tmp<volVectorField> q() const;
|
virtual tmp<surfaceScalarField> q() const;
|
||||||
|
|
||||||
//- Return the source term for the energy equation
|
//- Return the source term for the energy equation
|
||||||
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
|
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
|
||||||
|
|
||||||
//- Return the specie flux for the given specie mass-fraction
|
//- Return the specie flux for the given specie mass-fraction
|
||||||
virtual tmp<volVectorField> j(const volScalarField& Yi) const;
|
virtual tmp<surfaceScalarField> j(const volScalarField& Yi) const;
|
||||||
|
|
||||||
//- Return the source term for the given specie mass-fraction equation
|
//- Return the source term for the given specie mass-fraction equation
|
||||||
virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const;
|
virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const;
|
||||||
|
|||||||
@ -128,13 +128,13 @@ public:
|
|||||||
) const = 0;
|
) const = 0;
|
||||||
|
|
||||||
//- Return the heat flux
|
//- Return the heat flux
|
||||||
virtual tmp<volVectorField> q() const = 0;
|
virtual tmp<surfaceScalarField> q() const = 0;
|
||||||
|
|
||||||
//- Return the source term for the energy equation
|
//- Return the source term for the energy equation
|
||||||
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const = 0;
|
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const = 0;
|
||||||
|
|
||||||
//- Return the specie flux for the given specie mass-fraction
|
//- Return the specie flux for the given specie mass-fraction
|
||||||
virtual tmp<volVectorField> j(const volScalarField& Yi) const = 0;
|
virtual tmp<surfaceScalarField> j(const volScalarField& Yi) const = 0;
|
||||||
|
|
||||||
//- Return the source term for the given specie mass-fraction equation
|
//- Return the source term for the given specie mass-fraction equation
|
||||||
virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const = 0;
|
virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const = 0;
|
||||||
|
|||||||
@ -137,17 +137,18 @@ eddyDiffusivity<TurbulenceThermophysicalTransportModel>::DEff
|
|||||||
|
|
||||||
|
|
||||||
template<class TurbulenceThermophysicalTransportModel>
|
template<class TurbulenceThermophysicalTransportModel>
|
||||||
tmp<volVectorField>
|
tmp<surfaceScalarField>
|
||||||
eddyDiffusivity<TurbulenceThermophysicalTransportModel>::q() const
|
eddyDiffusivity<TurbulenceThermophysicalTransportModel>::q() const
|
||||||
{
|
{
|
||||||
return volVectorField::New
|
return surfaceScalarField::New
|
||||||
(
|
(
|
||||||
IOobject::groupName
|
IOobject::groupName
|
||||||
(
|
(
|
||||||
"q",
|
"q",
|
||||||
this->momentumTransport().alphaRhoPhi().group()
|
this->momentumTransport().alphaRhoPhi().group()
|
||||||
),
|
),
|
||||||
-(this->alpha()*this->kappaEff()*fvc::grad(this->thermo().T()))
|
-fvc::interpolate(this->alpha()*this->kappaEff())
|
||||||
|
*fvc::snGrad(this->thermo().T())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +169,7 @@ eddyDiffusivity<TurbulenceThermophysicalTransportModel>::divq
|
|||||||
|
|
||||||
|
|
||||||
template<class TurbulenceThermophysicalTransportModel>
|
template<class TurbulenceThermophysicalTransportModel>
|
||||||
tmp<volVectorField>
|
tmp<surfaceScalarField>
|
||||||
eddyDiffusivity<TurbulenceThermophysicalTransportModel>::j
|
eddyDiffusivity<TurbulenceThermophysicalTransportModel>::j
|
||||||
(
|
(
|
||||||
const volScalarField& Yi
|
const volScalarField& Yi
|
||||||
@ -180,7 +181,7 @@ eddyDiffusivity<TurbulenceThermophysicalTransportModel>::j
|
|||||||
" nonUnityLewisEddyDiffusivity or unityLewisEddyDiffusivity"
|
" nonUnityLewisEddyDiffusivity or unityLewisEddyDiffusivity"
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
return tmp<volVectorField>(nullptr);
|
return tmp<surfaceScalarField>(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -182,13 +182,13 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return the heat flux
|
//- Return the heat flux
|
||||||
virtual tmp<volVectorField> q() const;
|
virtual tmp<surfaceScalarField> q() const;
|
||||||
|
|
||||||
//- Return the source term for the energy equation
|
//- Return the source term for the energy equation
|
||||||
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
|
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
|
||||||
|
|
||||||
//- Return the specie flux for the given specie mass-fraction
|
//- Return the specie flux for the given specie mass-fraction
|
||||||
virtual tmp<volVectorField> j(const volScalarField& Yi) const;
|
virtual tmp<surfaceScalarField> j(const volScalarField& Yi) const;
|
||||||
|
|
||||||
//- Return the source term for the given specie mass-fraction equation
|
//- Return the source term for the given specie mass-fraction equation
|
||||||
virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const;
|
virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const;
|
||||||
|
|||||||
@ -91,19 +91,20 @@ nonUnityLewisEddyDiffusivity<TurbulenceThermophysicalTransportModel>::read()
|
|||||||
|
|
||||||
|
|
||||||
template<class TurbulenceThermophysicalTransportModel>
|
template<class TurbulenceThermophysicalTransportModel>
|
||||||
tmp<volVectorField>
|
tmp<surfaceScalarField>
|
||||||
nonUnityLewisEddyDiffusivity<TurbulenceThermophysicalTransportModel>::q() const
|
nonUnityLewisEddyDiffusivity<TurbulenceThermophysicalTransportModel>::q() const
|
||||||
{
|
{
|
||||||
tmp<volVectorField> tmpq
|
tmp<surfaceScalarField> tmpq
|
||||||
(
|
(
|
||||||
volVectorField::New
|
surfaceScalarField::New
|
||||||
(
|
(
|
||||||
IOobject::groupName
|
IOobject::groupName
|
||||||
(
|
(
|
||||||
"q",
|
"q",
|
||||||
this->momentumTransport().alphaRhoPhi().group()
|
this->momentumTransport().alphaRhoPhi().group()
|
||||||
),
|
),
|
||||||
-(this->alpha()*this->kappaEff()*fvc::grad(this->thermo().T()))
|
-fvc::interpolate(this->alpha()*this->kappaEff())
|
||||||
|
*fvc::snGrad(this->thermo().T())
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -115,9 +116,12 @@ nonUnityLewisEddyDiffusivity<TurbulenceThermophysicalTransportModel>::q() const
|
|||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
tmpq.ref() -=
|
tmpq.ref() -=
|
||||||
|
fvc::interpolate
|
||||||
|
(
|
||||||
this->alpha()*DEff(Y[i])
|
this->alpha()*DEff(Y[i])
|
||||||
*composition.HE(i, this->thermo().p(), this->thermo().T())
|
*composition.HE(i, this->thermo().p(), this->thermo().T())
|
||||||
*fvc::grad(Y[i]);
|
)
|
||||||
|
*fvc::snGrad(Y[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -144,7 +144,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Return the heat flux
|
//- Return the heat flux
|
||||||
virtual tmp<volVectorField> q() const;
|
virtual tmp<surfaceScalarField> q() const;
|
||||||
|
|
||||||
//- Return the source term for the energy equation
|
//- Return the source term for the energy equation
|
||||||
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
|
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
|
||||||
|
|||||||
@ -138,17 +138,18 @@ bool unityLewisEddyDiffusivity<TurbulenceThermophysicalTransportModel>::read()
|
|||||||
|
|
||||||
|
|
||||||
template<class TurbulenceThermophysicalTransportModel>
|
template<class TurbulenceThermophysicalTransportModel>
|
||||||
tmp<volVectorField>
|
tmp<surfaceScalarField>
|
||||||
unityLewisEddyDiffusivity<TurbulenceThermophysicalTransportModel>::q() const
|
unityLewisEddyDiffusivity<TurbulenceThermophysicalTransportModel>::q() const
|
||||||
{
|
{
|
||||||
return volVectorField::New
|
return surfaceScalarField::New
|
||||||
(
|
(
|
||||||
IOobject::groupName
|
IOobject::groupName
|
||||||
(
|
(
|
||||||
"q",
|
"q",
|
||||||
this->momentumTransport().alphaRhoPhi().group()
|
this->momentumTransport().alphaRhoPhi().group()
|
||||||
),
|
),
|
||||||
-this->alphaEff()*this->alpha()*fvc::grad(this->thermo().he())
|
-fvc::interpolate(this->alphaEff()*this->alpha())
|
||||||
|
*fvc::snGrad(this->thermo().he())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,20 +166,20 @@ unityLewisEddyDiffusivity<TurbulenceThermophysicalTransportModel>::divq
|
|||||||
|
|
||||||
|
|
||||||
template<class TurbulenceThermophysicalTransportModel>
|
template<class TurbulenceThermophysicalTransportModel>
|
||||||
tmp<volVectorField>
|
tmp<surfaceScalarField>
|
||||||
unityLewisEddyDiffusivity<TurbulenceThermophysicalTransportModel>::j
|
unityLewisEddyDiffusivity<TurbulenceThermophysicalTransportModel>::j
|
||||||
(
|
(
|
||||||
const volScalarField& Yi
|
const volScalarField& Yi
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return volVectorField::New
|
return surfaceScalarField::New
|
||||||
(
|
(
|
||||||
IOobject::groupName
|
IOobject::groupName
|
||||||
(
|
(
|
||||||
"j(" + Yi.name() + ')',
|
"j(" + Yi.name() + ')',
|
||||||
this->momentumTransport().alphaRhoPhi().group()
|
this->momentumTransport().alphaRhoPhi().group()
|
||||||
),
|
),
|
||||||
-this->DEff(Yi)*this->alpha()*fvc::grad(Yi)
|
-fvc::interpolate(this->DEff(Yi)*this->alpha())*fvc::snGrad(Yi)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -200,13 +200,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Return the heat flux
|
//- Return the heat flux
|
||||||
virtual tmp<volVectorField> q() const;
|
virtual tmp<surfaceScalarField> q() const;
|
||||||
|
|
||||||
//- Return the source term for the energy equation
|
//- Return the source term for the energy equation
|
||||||
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
|
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
|
||||||
|
|
||||||
//- Return the specie flux for the given specie mass-fraction
|
//- Return the specie flux for the given specie mass-fraction
|
||||||
virtual tmp<volVectorField> j(const volScalarField& Yi) const;
|
virtual tmp<surfaceScalarField> j(const volScalarField& Yi) const;
|
||||||
|
|
||||||
//- Return the source term for the given specie mass-fraction equation
|
//- Return the source term for the given specie mass-fraction equation
|
||||||
virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const;
|
virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const;
|
||||||
|
|||||||
@ -58,52 +58,6 @@ void Foam::functionObjects::wallHeatFlux::writeFileHeader(const label i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
|
||||||
Foam::functionObjects::wallHeatFlux::calcWallHeatFlux(const volVectorField& q)
|
|
||||||
{
|
|
||||||
tmp<volScalarField> twallHeatFlux
|
|
||||||
(
|
|
||||||
volScalarField::New
|
|
||||||
(
|
|
||||||
type(),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar(dimMass/pow3(dimTime), 0)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
volScalarField::Boundary& wallHeatFluxBf =
|
|
||||||
twallHeatFlux.ref().boundaryFieldRef();
|
|
||||||
|
|
||||||
const volVectorField::Boundary& qBf = q.boundaryField();
|
|
||||||
|
|
||||||
forAllConstIter(labelHashSet, patchSet_, iter)
|
|
||||||
{
|
|
||||||
const label patchi = iter.key();
|
|
||||||
|
|
||||||
const vectorField& Sfp = mesh_.Sf().boundaryField()[patchi];
|
|
||||||
const scalarField& magSfp = mesh_.magSf().boundaryField()[patchi];
|
|
||||||
|
|
||||||
wallHeatFluxBf[patchi] = (-Sfp/magSfp) & qBf[patchi];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (foundObject<volScalarField>("qr"))
|
|
||||||
{
|
|
||||||
const volScalarField& qr = lookupObject<volScalarField>("qr");
|
|
||||||
|
|
||||||
const volScalarField::Boundary& radHeatFluxBf = qr.boundaryField();
|
|
||||||
|
|
||||||
forAllConstIter(labelHashSet, patchSet_, iter)
|
|
||||||
{
|
|
||||||
const label patchi = iter.key();
|
|
||||||
|
|
||||||
wallHeatFluxBf[patchi] -= radHeatFluxBf[patchi];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return twallHeatFlux;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::functionObjects::wallHeatFlux::calcWallHeatFlux
|
Foam::functionObjects::wallHeatFlux::calcWallHeatFlux
|
||||||
(
|
(
|
||||||
|
|||||||
@ -108,9 +108,6 @@ protected:
|
|||||||
//- File header information
|
//- File header information
|
||||||
virtual void writeFileHeader(const label i);
|
virtual void writeFileHeader(const label i);
|
||||||
|
|
||||||
//- Calculate the heat-flux
|
|
||||||
tmp<volScalarField> calcWallHeatFlux(const volVectorField& q);
|
|
||||||
|
|
||||||
//- Calculate the heat-flux
|
//- Calculate the heat-flux
|
||||||
tmp<volScalarField> calcWallHeatFlux(const surfaceScalarField& q);
|
tmp<volScalarField> calcWallHeatFlux(const surfaceScalarField& q);
|
||||||
|
|
||||||
|
|||||||
@ -325,6 +325,9 @@ template<class BasicSolidThermo, class MixtureType>
|
|||||||
Foam::tmp<Foam::surfaceScalarField>
|
Foam::tmp<Foam::surfaceScalarField>
|
||||||
Foam::heSolidThermo<BasicSolidThermo, MixtureType>::q() const
|
Foam::heSolidThermo<BasicSolidThermo, MixtureType>::q() const
|
||||||
{
|
{
|
||||||
|
const fvMesh& mesh = this->T_.mesh();
|
||||||
|
mesh.setFluxRequired(this->T_.name());
|
||||||
|
|
||||||
return
|
return
|
||||||
- (
|
- (
|
||||||
isotropic()
|
isotropic()
|
||||||
|
|||||||
Reference in New Issue
Block a user