basicThermo, heThermo: Simplified by removing alphahe

Now that kappa, Cp and Cv fields are cached and Cpv returns either the Cp or Cv
field reference depending on the energy solved and thermal transport is now
fundamentally based on temperature rather energy gradients it is no longer
necessary or useful to provide an abstract function returning alphahe.
This commit is contained in:
Henry Weller
2022-10-30 06:29:06 +00:00
parent 2835a5423b
commit 0661fbb433
19 changed files with 92 additions and 153 deletions

View File

@ -107,19 +107,16 @@ void convectiveHeatTransferFvPatchScalarField::updateCoeffs()
const compressibleMomentumTransportModel& turbModel = const compressibleMomentumTransportModel& turbModel =
ttm.momentumTransport(); ttm.momentumTransport();
const scalarField alphaEffw(ttm.alphaEff(patchi));
const tmp<scalarField> tnuw = turbModel.nu(patchi); const tmp<scalarField> tnuw = turbModel.nu(patchi);
const scalarField& nuw = tnuw(); const scalarField& nuw = tnuw();
const scalarField& rhow = turbModel.rho().boundaryField()[patchi]; const scalarField& rhow = turbModel.rho().boundaryField()[patchi];
const vectorField& Uc = turbModel.U(); const vectorField& Uc = turbModel.U();
const vectorField& Uw = turbModel.U().boundaryField()[patchi]; const vectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField& Tw = ttm.thermo().T().boundaryField()[patchi]; const scalarField Cpw(ttm.thermo().Cp().boundaryField()[patchi]);
const scalarField Cpw(ttm.thermo().Cp(Tw, patchi));
const scalarField kappaw(Cpw*alphaEffw); const scalarField kappaEffw(ttm.kappaEff(patchi));
const scalarField Pr(rhow*nuw*Cpw/kappaw); const scalarField Pr(rhow*nuw*Cpw/kappaEffw);
scalarField& htc = *this; scalarField& htc = *this;
forAll(htc, facei) forAll(htc, facei)
@ -130,11 +127,11 @@ void convectiveHeatTransferFvPatchScalarField::updateCoeffs()
if (Re < 5.0E+05) if (Re < 5.0E+05)
{ {
htc[facei] = 0.664*sqrt(Re)*cbrt(Pr[facei])*kappaw[facei]/L_; htc[facei] = 0.664*sqrt(Re)*cbrt(Pr[facei])*kappaEffw[facei]/L_;
} }
else else
{ {
htc[facei] = 0.037*pow(Re, 0.8)*cbrt(Pr[facei])*kappaw[facei]/L_; htc[facei] = 0.037*pow(Re, 0.8)*cbrt(Pr[facei])*kappaEffw[facei]/L_;
} }
} }

View File

@ -120,15 +120,11 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::transferData
internalField().group() internalField().group()
); );
const basicThermo& thermo = ttm.thermo();
const fvPatchScalarField& hep = thermo.he().boundaryField()[patchi];
qDot = ttm.alphaEff(patchi)*hep.snGrad();
// patch temperature [K] // patch temperature [K]
const scalarField Tp(*this); const scalarField Tp(*this);
qDot = ttm.kappaEff(patchi)*snGrad();
// near wall cell temperature [K] // near wall cell temperature [K]
const scalarField Tc(patchInternalField()); const scalarField Tc(patchInternalField());

View File

@ -157,7 +157,10 @@ void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::updateCoeffs()
const fvsPatchField<scalar>& phip = const fvsPatchField<scalar>& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
const scalarField alphap(ttm.alphaEff(patchi)); const scalarField alphap
(
ttm.kappaEff(patchi)/ttm.thermo().Cpv().boundaryField()[patchi]
);
refValue() = massFluxFraction_; refValue() = massFluxFraction_;
refGrad() = 0.0; refGrad() = 0.0;

View File

@ -170,7 +170,7 @@ public:
return volScalarField::New return volScalarField::New
( (
"alphaEff", "alphaEff",
this->thermo().alphahe() this->thermo().kappa()/this->thermo().Cpv()
); );
} }
@ -178,7 +178,9 @@ public:
// for patch [kg/m/s] // for patch [kg/m/s]
virtual tmp<scalarField> alphaEff(const label patchi) const virtual tmp<scalarField> alphaEff(const label patchi) const
{ {
return this->thermo().alphahe(patchi); return
this->thermo().kappa().boundaryField()[patchi]
/this->thermo().Cpv().boundaryField()[patchi];
} }
//- Effective mass diffusion coefficient //- Effective mass diffusion coefficient

View File

@ -98,7 +98,10 @@ unityLewisFourier<BasicThermophysicalTransportModel>::q() const
"q", "q",
this->momentumTransport().alphaRhoPhi().group() this->momentumTransport().alphaRhoPhi().group()
), ),
-fvc::interpolate(this->alpha()*this->thermo().alphahe()) -fvc::interpolate
(
this->alpha()*this->thermo().kappa()/this->thermo().Cpv()
)
*fvc::snGrad(this->thermo().he()) *fvc::snGrad(this->thermo().he())
); );
} }
@ -109,7 +112,16 @@ tmp<fvScalarMatrix>
unityLewisFourier<BasicThermophysicalTransportModel>:: unityLewisFourier<BasicThermophysicalTransportModel>::
divq(volScalarField& he) const divq(volScalarField& he) const
{ {
return -fvm::laplacian(this->alpha()*this->thermo().alphahe(), he); volScalarField alphahe
(
volScalarField::New
(
"alphahe",
this->thermo().kappa()/this->thermo().Cpv()
)
);
return -fvm::laplacian(this->alpha()*alphahe, he);
} }

View File

@ -157,10 +157,6 @@ public:
//- Effective thermal turbulent diffusivity of mixture [kg/m/s] //- Effective thermal turbulent diffusivity of mixture [kg/m/s]
virtual tmp<volScalarField> alphaEff() const = 0; virtual tmp<volScalarField> alphaEff() const = 0;
//- Effective thermal turbulent diffusivity of mixture
// for patch [kg/m/s]
virtual tmp<scalarField> alphaEff(const label patchi) const = 0;
//- Correct the LES transport //- Correct the LES transport
virtual void correct(); virtual void correct();

View File

@ -157,10 +157,6 @@ public:
//- Effective thermal turbulent diffusivity of mixture [kg/m/s] //- Effective thermal turbulent diffusivity of mixture [kg/m/s]
virtual tmp<volScalarField> alphaEff() const = 0; virtual tmp<volScalarField> alphaEff() const = 0;
//- Effective thermal turbulent diffusivity of mixture
// for patch [kg/m/s]
virtual tmp<scalarField> alphaEff(const label patchi) const = 0;
//- Correct the RAS transport //- Correct the RAS transport
virtual void correct(); virtual void correct();

View File

@ -154,14 +154,17 @@ public:
//- Effective thermal turbulent diffusivity of mixture [kg/m/s] //- Effective thermal turbulent diffusivity of mixture [kg/m/s]
virtual tmp<volScalarField> alphaEff() const virtual tmp<volScalarField> alphaEff() const
{ {
return this->thermo().alphahe() + alphat(); return this->thermo().kappa()/this->thermo().Cpv() + alphat();
} }
//- Effective thermal turbulent diffusivity of mixture //- Effective thermal turbulent diffusivity of mixture
// for patch [kg/m/s] // for patch [kg/m/s]
virtual tmp<scalarField> alphaEff(const label patchi) const virtual tmp<scalarField> alphaEff(const label patchi) const
{ {
return this->thermo().alphahe(patchi) + alphat(patchi); return
this->thermo().kappa().boundaryField()[patchi]
/this->thermo().Cpv().boundaryField()[patchi]
+ alphat(patchi);
} }
//- Effective mass diffusion coefficient //- Effective mass diffusion coefficient

View File

@ -162,14 +162,17 @@ public:
//- Effective thermal turbulent diffusivity of mixture [kg/m/s] //- Effective thermal turbulent diffusivity of mixture [kg/m/s]
virtual tmp<volScalarField> alphaEff() const virtual tmp<volScalarField> alphaEff() const
{ {
return this->thermo().alphahe() + alphat(); return this->thermo().kappa()/this->thermo().Cpv() + alphat();
} }
//- Effective thermal turbulent diffusivity of mixture //- Effective thermal turbulent diffusivity of mixture
// for patch [kg/m/s] // for patch [kg/m/s]
virtual tmp<scalarField> alphaEff(const label patchi) const virtual tmp<scalarField> alphaEff(const label patchi) const
{ {
return this->thermo().alphahe(patchi) + alphat(patchi); return
this->thermo().kappa().boundaryField()[patchi]
/this->thermo().Cpv().boundaryField()[patchi]
+ alphat(patchi);
} }
//- Effective mass diffusion coefficient //- Effective mass diffusion coefficient

View File

@ -57,7 +57,7 @@ const char* Foam::NamedEnum
"omega", "omega",
"nut", "nut",
"nuEff", "nuEff",
"alphaEff", "kappaEff",
"R", "R",
"devTau" "devTau"
}; };
@ -196,9 +196,9 @@ bool Foam::functionObjects::turbulenceFields::execute()
processField<scalar>(f, model.nuEff()); processField<scalar>(f, model.nuEff());
break; break;
} }
case compressibleField::alphaEff: case compressibleField::kappaEff:
{ {
processField<scalar>(f, ttm.alphaEff()); processField<scalar>(f, ttm.kappaEff());
break; break;
} }
case compressibleField::R: case compressibleField::R:

View File

@ -67,7 +67,7 @@ Usage
nuEff | effective turbulence viscosity (incompressible) nuEff | effective turbulence viscosity (incompressible)
nut | turbulence viscosity (compressible) nut | turbulence viscosity (compressible)
nuEff | effective turbulence viscosity (compressible) nuEff | effective turbulence viscosity (compressible)
alphaEff | effective turbulence thermal diffusivity (compressible) kappaEff | effective turbulence thermal diffusivity (compressible)
R | Reynolds stress tensor R | Reynolds stress tensor
devSigma | Deviatoric part of the effective Reynolds stress \ devSigma | Deviatoric part of the effective Reynolds stress \
(incompressible) (incompressible)
@ -115,7 +115,7 @@ public:
omega, omega,
nut, nut,
nuEff, nuEff,
alphaEff, kappaEff,
R, R,
devTau devTau
}; };

View File

@ -148,7 +148,11 @@ void Foam::fv::solidEquilibriumEnergySource::addSup
const word& fieldName const word& fieldName
) const ) const
{ {
const volScalarField alphahe(solidThermo().alphahe()); const volScalarField alphahe
(
"alphahe",
solidThermo().kappa()/solidThermo().Cpv()
);
const volScalarField& A = solidAlpha(); const volScalarField& A = solidAlpha();
const volScalarField B(1 - A); const volScalarField B(1 - A);
@ -172,7 +176,11 @@ void Foam::fv::solidEquilibriumEnergySource::addSup
const word& fieldName const word& fieldName
) const ) const
{ {
const volScalarField alphahe(alpha*solidThermo().alphahe()); const volScalarField alphahe
(
"alphahe",
solidThermo().kappa()/solidThermo().Cpv()
);
const volScalarField& A = solidAlpha(); const volScalarField& A = solidAlpha();
const volScalarField B(1 - A); const volScalarField B(1 - A);

View File

@ -503,7 +503,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::cacheFilmFields
filmModel.toPrimary(filmPatchi, TFilmPatch_); filmModel.toPrimary(filmPatchi, TFilmPatch_);
CpFilmPatch_ = CpFilmPatch_ =
thermalFilmModel.thermo().Cpv()().boundaryField()[filmPatchi]; thermalFilmModel.thermo().Cpv().boundaryField()[filmPatchi];
filmModel.toPrimary(filmPatchi, CpFilmPatch_); filmModel.toPrimary(filmPatchi, CpFilmPatch_);
} }

View File

@ -297,17 +297,14 @@ void thermalBaffle::info()
forAll(coupledPatches, i) forAll(coupledPatches, i)
{ {
const label patchi = coupledPatches[i]; const label patchi = coupledPatches[i];
const fvPatchScalarField& phe = thermo_->he().boundaryField()[patchi];
const word patchName = regionMesh().boundary()[patchi].name();
Info<< indent << "Q : " << patchName << indent Info<< indent << "Q : " << regionMesh().boundary()[patchi].name()
<< << indent
gSum << gSum
( (
mag(regionMesh().Sf().boundaryField()[patchi]) regionMesh().magSf().boundaryField()[patchi]
*phe.snGrad() *thermophysicalTransport_->q()().boundaryField()[patchi]
*thermo_->alphahe(patchi) )
)
<< endl; << endl;
} }
} }

View File

@ -370,6 +370,9 @@ public:
//- Heat capacity at constant volume [J/kg/K] //- Heat capacity at constant volume [J/kg/K]
virtual const volScalarField& Cv() const = 0; virtual const volScalarField& Cv() const = 0;
//- Heat capacity at constant pressure/volume [J/kg/K]
virtual const volScalarField& Cpv() const = 0;
// Access to transport state variables // Access to transport state variables
@ -400,24 +403,12 @@ public:
const label patchi const label patchi
) const = 0; ) const = 0;
//- Heat capacity at constant pressure/volume [J/kg/K]
virtual tmp<volScalarField> Cpv() const = 0;
//- Heat capacity at constant pressure/volume for patch [J/kg/K] //- Heat capacity at constant pressure/volume for patch [J/kg/K]
virtual tmp<scalarField> Cpv virtual tmp<scalarField> Cpv
( (
const scalarField& T, const scalarField& T,
const label patchi const label patchi
) const = 0; ) const = 0;
// Fields derived from transport state variables
//- Thermal diffusivity of energy of mixture [kg/m/s]
virtual tmp<volScalarField> alphahe() const = 0;
//- Thermal diffusivity of energy of mixture for patch [kg/m/s]
virtual tmp<scalarField> alphahe(const label patchi) const = 0;
}; };

View File

@ -265,6 +265,21 @@ Foam::heThermo<BasicThermo, MixtureType>::~heThermo()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicThermo, class MixtureType>
const Foam::volScalarField&
Foam::heThermo<BasicThermo, MixtureType>::Cpv() const
{
if (MixtureType::thermoType::enthalpy())
{
return Cp_;
}
else
{
return Cv_;
}
}
template<class BasicThermo, class MixtureType> template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::heThermo<BasicThermo, MixtureType>::he Foam::tmp<Foam::volScalarField> Foam::heThermo<BasicThermo, MixtureType>::he
( (
@ -563,21 +578,6 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::Cpv
} }
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::Cpv() const
{
if (MixtureType::thermoType::enthalpy())
{
return Cp_;
}
else
{
return Cv_;
}
}
template<class BasicThermo, class MixtureType> template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::heThermo<BasicThermo, MixtureType>::THE Foam::tmp<Foam::volScalarField> Foam::heThermo<BasicThermo, MixtureType>::THE
( (
@ -670,36 +670,6 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::W
} }
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::alphahe() const
{
if (MixtureType::thermoType::enthalpy())
{
return volScalarField::New("alphahe", this->kappa_/Cp_);
}
else
{
return volScalarField::New("alphahe", this->kappa_/Cv_);
}
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField>
Foam::heThermo<BasicThermo, MixtureType>::alphahe(const label patchi) const
{
if (MixtureType::thermoType::enthalpy())
{
return this->kappa_.boundaryField()[patchi]/Cp_.boundaryField()[patchi];
}
else
{
return this->kappa_.boundaryField()[patchi]/Cv_.boundaryField()[patchi];
}
}
template<class BasicThermo, class MixtureType> template<class BasicThermo, class MixtureType>
bool Foam::heThermo<BasicThermo, MixtureType>::read() bool Foam::heThermo<BasicThermo, MixtureType>::read()
{ {

View File

@ -209,6 +209,9 @@ public:
return Cv_; return Cv_;
} }
//- Heat capacity at constant pressure/volume [J/kg/K]
virtual const volScalarField& Cpv() const;
// Fields derived from thermodynamic state variables // Fields derived from thermodynamic state variables
@ -342,9 +345,6 @@ public:
const label patchi const label patchi
) const; ) const;
//- Heat capacity at constant pressure/volume [J/kg/K]
virtual tmp<volScalarField> Cpv() const;
//- Molecular weight [kg/kmol] //- Molecular weight [kg/kmol]
virtual tmp<volScalarField> W() const; virtual tmp<volScalarField> W() const;
@ -352,15 +352,6 @@ public:
virtual tmp<scalarField> W(const label patchi) const; virtual tmp<scalarField> W(const label patchi) const;
// Fields derived from transport state variables
//- Thermal diffusivity of energy of mixture [kg/m/s]
virtual tmp<volScalarField> alphahe() const;
//- Thermal diffusivity of energy of mixture for patch [kg/m/s]
virtual tmp<scalarField> alphahe(const label patchi) const;
//- Read thermophysical properties dictionary //- Read thermophysical properties dictionary
virtual bool read(); virtual bool read();
}; };

View File

@ -170,6 +170,12 @@ Foam::constSolidThermo::~constSolidThermo()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::volScalarField& Foam::constSolidThermo::Cpv() const
{
return Cv_;
}
Foam::volScalarField& Foam::constSolidThermo::he() Foam::volScalarField& Foam::constSolidThermo::he()
{ {
return e_; return e_;
@ -367,12 +373,6 @@ Foam::tmp<Foam::scalarField> Foam::constSolidThermo::Cv
} }
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::Cpv() const
{
return Cv_;
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::Cpv Foam::tmp<Foam::scalarField> Foam::constSolidThermo::Cpv
( (
const scalarField& T, const scalarField& T,
@ -383,23 +383,6 @@ Foam::tmp<Foam::scalarField> Foam::constSolidThermo::Cpv
} }
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::alphahe() const
{
NotImplemented;
return tmp<volScalarField>(nullptr);
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::alphahe
(
const label patchi
) const
{
NotImplemented;
return tmp<scalarField>(nullptr);
}
Foam::tmp<Foam::volVectorField> Foam::constSolidThermo::Kappa() const Foam::tmp<Foam::volVectorField> Foam::constSolidThermo::Kappa() const
{ {
NotImplemented; NotImplemented;

View File

@ -179,6 +179,9 @@ public:
//- Heat capacity at constant volume [J/kg/K] //- Heat capacity at constant volume [J/kg/K]
virtual const volScalarField& Cv() const; virtual const volScalarField& Cv() const;
//- Heat capacity at constant pressure/volume [J/kg/K]
virtual const volScalarField& Cpv() const;
// Fields derived from thermodynamic state variables // Fields derived from thermodynamic state variables
@ -295,9 +298,6 @@ public:
const label patchi const label patchi
) const; ) const;
//- Heat capacity at constant pressure/volume [J/kg/K]
virtual tmp<volScalarField> Cpv() const;
//- Heat capacity at constant pressure/volume for patch [J/kg/K] //- Heat capacity at constant pressure/volume for patch [J/kg/K]
virtual tmp<scalarField> Cpv virtual tmp<scalarField> Cpv
( (
@ -305,15 +305,6 @@ public:
const label patchi const label patchi
) const; ) const;
// Fields derived from transport state variables
//- Thermal diffusivity for energy of mixture [kg/m/s]
virtual tmp<volScalarField> alphahe() const;
//- Thermal diffusivity for energy of mixture for patch [kg/m/s]
virtual tmp<scalarField> alphahe(const label patchi) const;
//- Return true if thermal conductivity is isotropic //- Return true if thermal conductivity is isotropic
virtual bool isotropic() const virtual bool isotropic() const
{ {