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:
Henry Weller
2020-09-25 19:37:01 +01:00
parent 77b31c7f3a
commit d3b2217949
14 changed files with 53 additions and 89 deletions

View File

@ -105,18 +105,18 @@ Fourier<TurbulenceThermophysicalTransportModel>::DEff
template<class BasicThermophysicalTransportModel>
tmp<volVectorField>Fourier<BasicThermophysicalTransportModel>::q() const
tmp<surfaceScalarField> Fourier<BasicThermophysicalTransportModel>::q() const
{
const thermoModel& thermo = this->thermo();
return volVectorField::New
return surfaceScalarField::New
(
IOobject::groupName
(
"q",
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>
tmp<volVectorField>Fourier<BasicThermophysicalTransportModel>::j
tmp<surfaceScalarField> Fourier<BasicThermophysicalTransportModel>::j
(
const volScalarField& Yi
) const
@ -147,7 +147,7 @@ tmp<volVectorField>Fourier<BasicThermophysicalTransportModel>::j
" unityLewisFourier"
<< exit(FatalError);
return tmp<volVectorField>(nullptr);
return tmp<surfaceScalarField>(nullptr);
}

View File

@ -113,13 +113,13 @@ public:
) const;
//- Return the heat flux
virtual tmp<volVectorField> q() const;
virtual tmp<surfaceScalarField> q() const;
//- Return the source term for the energy equation
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
//- 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
virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const;

View File

@ -25,6 +25,8 @@ License
#include "unityLewisFourier.H"
#include "fvmLaplacian.H"
#include "fvcSnGrad.H"
#include "surfaceInterpolate.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -69,17 +71,18 @@ bool unityLewisFourier<BasicThermophysicalTransportModel>::read()
template<class BasicThermophysicalTransportModel>
tmp<volVectorField>
tmp<surfaceScalarField>
unityLewisFourier<BasicThermophysicalTransportModel>::q() const
{
return volVectorField::New
return surfaceScalarField::New
(
IOobject::groupName
(
"q",
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>
tmp<volVectorField>unityLewisFourier<BasicThermophysicalTransportModel>::j
tmp<surfaceScalarField>unityLewisFourier<BasicThermophysicalTransportModel>::j
(
const volScalarField& Yi
) const
{
return volVectorField::New
return surfaceScalarField::New
(
IOobject::groupName
(
"j(" + Yi.name() + ')',
this->momentumTransport().alphaRhoPhi().group()
),
-this->thermo().alpha()*this->alpha()*fvc::grad(Yi)
-fvc::interpolate(this->thermo().alpha()*this->alpha())
*fvc::snGrad(Yi)
);
}

View File

@ -119,13 +119,13 @@ public:
}
//- Return the heat flux
virtual tmp<volVectorField> q() const;
virtual tmp<surfaceScalarField> q() const;
//- Return the source term for the energy equation
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
//- 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
virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const;

View File

@ -128,13 +128,13 @@ public:
) const = 0;
//- Return the heat flux
virtual tmp<volVectorField> q() const = 0;
virtual tmp<surfaceScalarField> q() const = 0;
//- Return the source term for the energy equation
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const = 0;
//- 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
virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const = 0;

View File

@ -137,17 +137,18 @@ eddyDiffusivity<TurbulenceThermophysicalTransportModel>::DEff
template<class TurbulenceThermophysicalTransportModel>
tmp<volVectorField>
tmp<surfaceScalarField>
eddyDiffusivity<TurbulenceThermophysicalTransportModel>::q() const
{
return volVectorField::New
return surfaceScalarField::New
(
IOobject::groupName
(
"q",
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>
tmp<volVectorField>
tmp<surfaceScalarField>
eddyDiffusivity<TurbulenceThermophysicalTransportModel>::j
(
const volScalarField& Yi
@ -180,7 +181,7 @@ eddyDiffusivity<TurbulenceThermophysicalTransportModel>::j
" nonUnityLewisEddyDiffusivity or unityLewisEddyDiffusivity"
<< exit(FatalError);
return tmp<volVectorField>(nullptr);
return tmp<surfaceScalarField>(nullptr);
}

View File

@ -182,13 +182,13 @@ public:
) const;
//- Return the heat flux
virtual tmp<volVectorField> q() const;
virtual tmp<surfaceScalarField> q() const;
//- Return the source term for the energy equation
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
//- 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
virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const;

View File

@ -91,19 +91,20 @@ nonUnityLewisEddyDiffusivity<TurbulenceThermophysicalTransportModel>::read()
template<class TurbulenceThermophysicalTransportModel>
tmp<volVectorField>
tmp<surfaceScalarField>
nonUnityLewisEddyDiffusivity<TurbulenceThermophysicalTransportModel>::q() const
{
tmp<volVectorField> tmpq
tmp<surfaceScalarField> tmpq
(
volVectorField::New
surfaceScalarField::New
(
IOobject::groupName
(
"q",
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)
{
tmpq.ref() -=
this->alpha()*DEff(Y[i])
*composition.HE(i, this->thermo().p(), this->thermo().T())
*fvc::grad(Y[i]);
fvc::interpolate
(
this->alpha()*DEff(Y[i])
*composition.HE(i, this->thermo().p(), this->thermo().T())
)
*fvc::snGrad(Y[i]);
}
}

View File

@ -144,7 +144,7 @@ public:
}
//- Return the heat flux
virtual tmp<volVectorField> q() const;
virtual tmp<surfaceScalarField> q() const;
//- Return the source term for the energy equation
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;

View File

@ -138,17 +138,18 @@ bool unityLewisEddyDiffusivity<TurbulenceThermophysicalTransportModel>::read()
template<class TurbulenceThermophysicalTransportModel>
tmp<volVectorField>
tmp<surfaceScalarField>
unityLewisEddyDiffusivity<TurbulenceThermophysicalTransportModel>::q() const
{
return volVectorField::New
return surfaceScalarField::New
(
IOobject::groupName
(
"q",
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>
tmp<volVectorField>
tmp<surfaceScalarField>
unityLewisEddyDiffusivity<TurbulenceThermophysicalTransportModel>::j
(
const volScalarField& Yi
) const
{
return volVectorField::New
return surfaceScalarField::New
(
IOobject::groupName
(
"j(" + Yi.name() + ')',
this->momentumTransport().alphaRhoPhi().group()
),
-this->DEff(Yi)*this->alpha()*fvc::grad(Yi)
-fvc::interpolate(this->DEff(Yi)*this->alpha())*fvc::snGrad(Yi)
);
}

View File

@ -200,13 +200,13 @@ public:
}
//- Return the heat flux
virtual tmp<volVectorField> q() const;
virtual tmp<surfaceScalarField> q() const;
//- Return the source term for the energy equation
virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
//- 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
virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const;

View File

@ -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::functionObjects::wallHeatFlux::calcWallHeatFlux
(

View File

@ -108,9 +108,6 @@ protected:
//- File header information
virtual void writeFileHeader(const label i);
//- Calculate the heat-flux
tmp<volScalarField> calcWallHeatFlux(const volVectorField& q);
//- Calculate the heat-flux
tmp<volScalarField> calcWallHeatFlux(const surfaceScalarField& q);

View File

@ -325,6 +325,9 @@ template<class BasicSolidThermo, class MixtureType>
Foam::tmp<Foam::surfaceScalarField>
Foam::heSolidThermo<BasicSolidThermo, MixtureType>::q() const
{
const fvMesh& mesh = this->T_.mesh();
mesh.setFluxRequired(this->T_.name());
return
- (
isotropic()