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 =
ttm.momentumTransport();
const scalarField alphaEffw(ttm.alphaEff(patchi));
const tmp<scalarField> tnuw = turbModel.nu(patchi);
const scalarField& nuw = tnuw();
const scalarField& rhow = turbModel.rho().boundaryField()[patchi];
const vectorField& Uc = turbModel.U();
const vectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField& Tw = ttm.thermo().T().boundaryField()[patchi];
const scalarField Cpw(ttm.thermo().Cp(Tw, patchi));
const scalarField Cpw(ttm.thermo().Cp().boundaryField()[patchi]);
const scalarField kappaw(Cpw*alphaEffw);
const scalarField Pr(rhow*nuw*Cpw/kappaw);
const scalarField kappaEffw(ttm.kappaEff(patchi));
const scalarField Pr(rhow*nuw*Cpw/kappaEffw);
scalarField& htc = *this;
forAll(htc, facei)
@ -130,11 +127,11 @@ void convectiveHeatTransferFvPatchScalarField::updateCoeffs()
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
{
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()
);
const basicThermo& thermo = ttm.thermo();
const fvPatchScalarField& hep = thermo.he().boundaryField()[patchi];
qDot = ttm.alphaEff(patchi)*hep.snGrad();
// patch temperature [K]
const scalarField Tp(*this);
qDot = ttm.kappaEff(patchi)*snGrad();
// near wall cell temperature [K]
const scalarField Tc(patchInternalField());

View File

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

View File

@ -170,7 +170,7 @@ public:
return volScalarField::New
(
"alphaEff",
this->thermo().alphahe()
this->thermo().kappa()/this->thermo().Cpv()
);
}
@ -178,7 +178,9 @@ public:
// for patch [kg/m/s]
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

View File

@ -98,7 +98,10 @@ unityLewisFourier<BasicThermophysicalTransportModel>::q() const
"q",
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())
);
}
@ -109,7 +112,16 @@ tmp<fvScalarMatrix>
unityLewisFourier<BasicThermophysicalTransportModel>::
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]
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
virtual void correct();

View File

@ -157,10 +157,6 @@ public:
//- Effective thermal turbulent diffusivity of mixture [kg/m/s]
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
virtual void correct();

View File

@ -154,14 +154,17 @@ public:
//- Effective thermal turbulent diffusivity of mixture [kg/m/s]
virtual tmp<volScalarField> alphaEff() const
{
return this->thermo().alphahe() + alphat();
return this->thermo().kappa()/this->thermo().Cpv() + alphat();
}
//- Effective thermal turbulent diffusivity of mixture
// for patch [kg/m/s]
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

View File

@ -162,14 +162,17 @@ public:
//- Effective thermal turbulent diffusivity of mixture [kg/m/s]
virtual tmp<volScalarField> alphaEff() const
{
return this->thermo().alphahe() + alphat();
return this->thermo().kappa()/this->thermo().Cpv() + alphat();
}
//- Effective thermal turbulent diffusivity of mixture
// for patch [kg/m/s]
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

View File

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

View File

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

View File

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

View File

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

View File

@ -297,17 +297,14 @@ void thermalBaffle::info()
forAll(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
<<
gSum
(
mag(regionMesh().Sf().boundaryField()[patchi])
*phe.snGrad()
*thermo_->alphahe(patchi)
)
Info<< indent << "Q : " << regionMesh().boundary()[patchi].name()
<< indent
<< gSum
(
regionMesh().magSf().boundaryField()[patchi]
*thermophysicalTransport_->q()().boundaryField()[patchi]
)
<< endl;
}
}

View File

@ -370,6 +370,9 @@ public:
//- Heat capacity at constant volume [J/kg/K]
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
@ -400,24 +403,12 @@ public:
const label patchi
) 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]
virtual tmp<scalarField> Cpv
(
const scalarField& T,
const label patchi
) 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 * * * * * * * * * * * * * //
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>
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>
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>
bool Foam::heThermo<BasicThermo, MixtureType>::read()
{

View File

@ -209,6 +209,9 @@ public:
return Cv_;
}
//- Heat capacity at constant pressure/volume [J/kg/K]
virtual const volScalarField& Cpv() const;
// Fields derived from thermodynamic state variables
@ -342,9 +345,6 @@ public:
const label patchi
) const;
//- Heat capacity at constant pressure/volume [J/kg/K]
virtual tmp<volScalarField> Cpv() const;
//- Molecular weight [kg/kmol]
virtual tmp<volScalarField> W() const;
@ -352,15 +352,6 @@ public:
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
virtual bool read();
};

View File

@ -170,6 +170,12 @@ Foam::constSolidThermo::~constSolidThermo()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::volScalarField& Foam::constSolidThermo::Cpv() const
{
return Cv_;
}
Foam::volScalarField& Foam::constSolidThermo::he()
{
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
(
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
{
NotImplemented;

View File

@ -179,6 +179,9 @@ public:
//- Heat capacity at constant volume [J/kg/K]
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
@ -295,9 +298,6 @@ public:
const label patchi
) 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]
virtual tmp<scalarField> Cpv
(
@ -305,15 +305,6 @@ public:
const label patchi
) 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
virtual bool isotropic() const
{