basicThermo: Cache thermal conductivity kappa rather than thermal diffusivity alpha

Now that Cp and Cv are cached it is more convenient and consistent and slightly
more efficient to cache thermal conductivity kappa rather than thermal
diffusivity alpha which is not a fundamental property, the appropriate form
depending on the energy solved for.  kappa is converted into the appropriate
thermal diffusivity for the energy form solved for by dividing by the
corresponding cached heat capacity when required, which is efficient.
This commit is contained in:
Henry Weller
2022-01-10 20:19:00 +00:00
parent 1ae5288274
commit cc96abda03
39 changed files with 217 additions and 284 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -185,7 +185,11 @@ alphatPhaseJayatillekeWallFunctionFvPatchScalarField::calcAlphat
const tmp<scalarField> tnuw = turbModel.nu(patchi); const tmp<scalarField> tnuw = turbModel.nu(patchi);
const scalarField& nuw = tnuw(); const scalarField& nuw = tnuw();
const tmp<scalarField> talphaw = phase.thermo().alpha(patchi); const tmp<scalarField> talphaw
(
phase.thermo().kappa().boundaryField()[patchi]
/phase.thermo().Cp().boundaryField()[patchi]
);
const scalarField& alphaw = talphaw(); const scalarField& alphaw = talphaw();
const tmp<volScalarField> tk = turbModel.k(); const tmp<volScalarField> tk = turbModel.k();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -356,7 +356,12 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
const rhoThermo& lThermo = liquid.thermo(); const rhoThermo& lThermo = liquid.thermo();
const scalarField& alphaw = lThermo.alpha(patchi); const tmp<scalarField> talphaw
(
lThermo.kappa().boundaryField()[patchi]
/lThermo.Cp().boundaryField()[patchi]
);
const scalarField& alphaw = talphaw();
const tmp<volScalarField> tk = turbModel.k(); const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk(); const volScalarField& k = tk();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -280,7 +280,7 @@ template<class BasePhaseModel>
Foam::tmp<Foam::scalarField> Foam::tmp<Foam::scalarField>
Foam::StationaryPhaseModel<BasePhaseModel>::kappaEff(const label patchi) const Foam::StationaryPhaseModel<BasePhaseModel>::kappaEff(const label patchi) const
{ {
return this->thermo().kappa(patchi); return this->thermo().kappa().boundaryField()[patchi];
} }
@ -318,7 +318,7 @@ Foam::StationaryPhaseModel<BasePhaseModel>::divq(volScalarField& he) const
return -fvm::laplacian return -fvm::laplacian
( (
fvc::interpolate(alpha)*fvc::interpolate(this->thermo().alpha()), fvc::interpolate(alpha)*fvc::interpolate(this->thermo().alphahe()),
he he
); );
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -399,7 +399,13 @@ Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::THE
} }
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::Cp() const const Foam::volScalarField& Foam::solidDisplacementThermo::Cp() const
{
return Cp_;
}
const Foam::volScalarField& Foam::solidDisplacementThermo::Cv() const
{ {
return Cp_; return Cp_;
} }
@ -415,12 +421,6 @@ Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::Cp
} }
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::Cv() const
{
return Cp_;
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::Cv Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::Cv
( (
const scalarField& T, const scalarField& T,
@ -447,21 +447,12 @@ Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::Cpv
} }
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::kappa() const const Foam::volScalarField& Foam::solidDisplacementThermo::kappa() const
{ {
return kappa_; return kappa_;
} }
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::kappa
(
const label patchi
) const
{
return kappa_.boundaryField()[patchi];
}
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::alphahe() const Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::alphahe() const
{ {
NotImplemented; NotImplemented;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -168,10 +168,16 @@ public:
virtual const volScalarField& he() const; virtual const volScalarField& he() const;
//- Heat capacity at constant pressure [J/kg/K] //- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const; virtual const volScalarField& Cp() const;
//- Heat capacity at constant volume [J/kg/K] //- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const; virtual const volScalarField& Cv() const;
// Access to transport state variables
//- Thermal diffusivity for temperature of mixture [W/m/K]
virtual const volScalarField& kappa() const;
// Fields derived from thermodynamic state variables // Fields derived from thermodynamic state variables
@ -302,12 +308,6 @@ public:
// Fields derived from transport state variables // Fields derived from transport state variables
//- Thermal diffusivity for temperature of mixture [W/m/K]
virtual tmp<volScalarField> kappa() const;
//- Thermal diffusivity for temperature of mixture for patch [W/m/K]
virtual tmp<scalarField> kappa(const label patchi) const;
//- Thermal diffusivity for energy of mixture [kg/m/s] //- Thermal diffusivity for energy of mixture [kg/m/s]
virtual tmp<volScalarField> alphahe() const; virtual tmp<volScalarField> alphahe() const;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -171,7 +171,11 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
const tmp<scalarField> tnuw = turbModel.nu(patchi); const tmp<scalarField> tnuw = turbModel.nu(patchi);
const scalarField& nuw = tnuw(); const scalarField& nuw = tnuw();
const tmp<scalarField> talphaw = ttm.thermo().alpha(patchi); const tmp<scalarField> talphaw
(
ttm.thermo().kappa().boundaryField()[patchi]
/ttm.thermo().Cp().boundaryField()[patchi]
);
const scalarField& alphaw = talphaw(); const scalarField& alphaw = talphaw();
scalarField& alphatw = *this; scalarField& alphatw = *this;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -142,7 +142,7 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::transferData
const fvPatchScalarField& hep = thermo.he().boundaryField()[patchi]; const fvPatchScalarField& hep = thermo.he().boundaryField()[patchi];
qDot = thermo.alpha().boundaryField()[patchi]*hep.snGrad(); qDot = thermo.alphahe(patchi)*hep.snGrad();
} }
else else
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -99,7 +99,7 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
const fluidThermo& thermo = const fluidThermo& thermo =
mesh.lookupObject<fluidThermo>(fluidThermoName); mesh.lookupObject<fluidThermo>(fluidThermoName);
return thermo.kappa(patchi); return thermo.kappa().boundaryField()[patchi];
} }
} }
else if (mesh.foundObject<solidThermo>(physicalProperties::typeName)) else if (mesh.foundObject<solidThermo>(physicalProperties::typeName))
@ -116,7 +116,7 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
} }
else else
{ {
return thermo.kappa(patchi); return thermo.kappa().boundaryField()[patchi];
} }
} }
else else

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -130,7 +130,7 @@ Fourier<BasicThermophysicalTransportModel>::divq(volScalarField& he) const
// Return heat flux source as an implicit energy correction // Return heat flux source as an implicit energy correction
// to the temperature gradient flux // to the temperature gradient flux
return return
-correction(fvm::laplacian(this->alpha()*thermo.alpha(), he)) -correction(fvm::laplacian(this->alpha()*thermo.alphahe(), he))
-fvc::laplacian(this->alpha()*thermo.kappa(), thermo.T()); -fvc::laplacian(this->alpha()*thermo.kappa(), thermo.T());
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -161,7 +161,7 @@ public:
// of mixture for patch [W/m/K] // of mixture for patch [W/m/K]
virtual tmp<scalarField> kappaEff(const label patchi) const virtual tmp<scalarField> kappaEff(const label patchi) const
{ {
return this->thermo().kappa(patchi); return this->thermo().kappa().boundaryField()[patchi];
} }
//- Effective thermal turbulent diffusivity of mixture [kg/m/s] //- Effective thermal turbulent diffusivity of mixture [kg/m/s]

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -98,7 +98,7 @@ unityLewisFourier<BasicThermophysicalTransportModel>::q() const
"q", "q",
this->momentumTransport().alphaRhoPhi().group() this->momentumTransport().alphaRhoPhi().group()
), ),
-fvc::interpolate(this->alpha()*this->thermo().alpha()) -fvc::interpolate(this->alpha()*this->thermo().alphahe())
*fvc::snGrad(this->thermo().he()) *fvc::snGrad(this->thermo().he())
); );
} }
@ -109,7 +109,7 @@ tmp<fvScalarMatrix>
unityLewisFourier<BasicThermophysicalTransportModel>:: unityLewisFourier<BasicThermophysicalTransportModel>::
divq(volScalarField& he) const divq(volScalarField& he) const
{ {
return -fvm::laplacian(this->alpha()*this->thermo().alpha(), he); return -fvm::laplacian(this->alpha()*this->thermo().alphahe(), he);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -113,7 +113,7 @@ public:
return volScalarField::New return volScalarField::New
( (
"DEff", "DEff",
this->thermo().alpha() this->thermo().kappa()/this->thermo().Cp()
); );
} }
@ -125,7 +125,9 @@ public:
const label patchi const label patchi
) const ) const
{ {
return this->thermo().alpha(patchi); return
this->thermo().kappa().boundaryField()[patchi]
/this->thermo().Cp().boundaryField()[patchi];
} }
//- Return the heat flux [W/m^2] //- Return the heat flux [W/m^2]

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -185,7 +185,7 @@ public:
return volScalarField::New return volScalarField::New
( (
"DEff", "DEff",
this->thermo().alpha() + alphat() this->thermo().kappa()/this->thermo().Cp() + alphat()
); );
} }
@ -197,7 +197,10 @@ public:
const label patchi const label patchi
) const ) const
{ {
return this->thermo().alpha(patchi) + alphat(patchi); return
this->thermo().kappa().boundaryField()[patchi]
/this->thermo().Cp().boundaryField()[patchi]
+ alphat(patchi);
} }
//- Return the heat flux [W/m^2] //- Return the heat flux [W/m^2]

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -166,8 +166,13 @@ void alphatFilmWallFunctionFvPatchScalarField::updateCoeffs()
const volScalarField& k = tk(); const volScalarField& k = tk();
const tmp<scalarField> tnuw = turbModel.nu(patchi); const tmp<scalarField> tnuw = turbModel.nu(patchi);
const scalarField& nuw = tnuw(); const scalarField& nuw = tnuw();
const tmp<scalarField> talpha = ttm.thermo().alpha(patchi);
const scalarField& alphaw = talpha(); const tmp<scalarField> talphaw
(
ttm.thermo().kappa().boundaryField()[patchi]
/ttm.thermo().Cp().boundaryField()[patchi]
);
const scalarField& alphaw = talphaw();
const scalar Cmu25 = pow(Cmu_, 0.25); const scalar Cmu25 = pow(Cmu_, 0.25);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -83,7 +83,7 @@ void thermalBaffle::solveEnergy()
volScalarField& Q = tQ.ref(); volScalarField& Q = tQ.ref();
volScalarField rho("rho", thermo_->rho()); volScalarField rho("rho", thermo_->rho());
volScalarField alpha("alpha", thermo_->alpha()); volScalarField alphahe(thermo_->alphahe());
// If region is one-dimension variable thickness // If region is one-dimension variable thickness
@ -106,7 +106,7 @@ void thermalBaffle::solveEnergy()
rho[cellId] *= delta_.value()/thickness_[localFacei]; rho[cellId] *= delta_.value()/thickness_[localFacei];
alpha[cellId] *= delta_.value()/thickness_[localFacei]; alphahe[cellId] *= delta_.value()/thickness_[localFacei];
} }
} }
} }
@ -117,8 +117,8 @@ void thermalBaffle::solveEnergy()
fvScalarMatrix hEqn fvScalarMatrix hEqn
( (
fvm::ddt(rho, h_) fvm::ddt(rho, he_)
- fvm::laplacian(alpha, h_) - fvm::laplacian(alphahe, he_)
== ==
Q Q
); );
@ -127,7 +127,7 @@ void thermalBaffle::solveEnergy()
{ {
surfaceScalarField phiMesh surfaceScalarField phiMesh
( (
fvc::interpolate(rho*h_)*regionMesh().phi() fvc::interpolate(rho*he_)*regionMesh().phi()
); );
hEqn -= fvc::div(phiMesh); hEqn -= fvc::div(phiMesh);
@ -155,7 +155,7 @@ thermalBaffle::thermalBaffle
thermalBaffleModel(modelType, mesh, dict), thermalBaffleModel(modelType, mesh, dict),
nNonOrthCorr_(solution().lookup<label>("nNonOrthCorr")), nNonOrthCorr_(solution().lookup<label>("nNonOrthCorr")),
thermo_(solidThermo::New(regionMesh())), thermo_(solidThermo::New(regionMesh())),
h_(thermo_->he()), he_(thermo_->he()),
Qs_ Qs_
( (
IOobject IOobject
@ -205,7 +205,7 @@ thermalBaffle::thermalBaffle
thermalBaffleModel(modelType, mesh), thermalBaffleModel(modelType, mesh),
nNonOrthCorr_(solution().lookup<label>("nNonOrthCorr")), nNonOrthCorr_(solution().lookup<label>("nNonOrthCorr")),
thermo_(solidThermo::New(regionMesh())), thermo_(solidThermo::New(regionMesh())),
h_(thermo_->he()), he_(thermo_->he()),
Qs_ Qs_
( (
IOobject IOobject
@ -328,14 +328,14 @@ void thermalBaffle::info()
forAll(coupledPatches, i) forAll(coupledPatches, i)
{ {
const label patchi = coupledPatches[i]; const label patchi = coupledPatches[i];
const fvPatchScalarField& ph = h_.boundaryField()[patchi]; const fvPatchScalarField& phe = he_.boundaryField()[patchi];
const word patchName = regionMesh().boundary()[patchi].name(); const word patchName = regionMesh().boundary()[patchi].name();
Info<< indent << "Q : " << patchName << indent << Info<< indent << "Q : " << patchName << indent <<
gSum gSum
( (
mag(regionMesh().Sf().boundaryField()[patchi]) mag(regionMesh().Sf().boundaryField()[patchi])
* ph.snGrad() *phe.snGrad()
* thermo_->alpha().boundaryField()[patchi] *thermo_->alphahe(patchi)
) << endl; ) << endl;
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -80,7 +80,7 @@ protected:
autoPtr<solidThermo> thermo_; autoPtr<solidThermo> thermo_;
//- Enthalpy/internal energy //- Enthalpy/internal energy
volScalarField& h_; volScalarField& he_;
// Source term fields // Source term fields

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -302,18 +302,18 @@ Foam::basicThermo::implementation::implementation
mesh mesh
), ),
alpha_ kappa_
( (
IOobject IOobject
( (
phasePropertyName("thermo:alpha", phaseName), phasePropertyName("thermo:kappa", phaseName),
mesh.time().timeName(), mesh.time().timeName(),
mesh, mesh,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh, mesh,
dimensionedScalar(dimensionSet(1, -1, -1, 0, 0), Zero) dimensionedScalar(dimEnergy/dimTime/dimLength/dimTemperature, Zero)
), ),
dpdt_(lookupOrDefault<Switch>("dpdt", true)) dpdt_(lookupOrDefault<Switch>("dpdt", true))
@ -395,18 +395,9 @@ Foam::volScalarField& Foam::basicThermo::implementation::T()
} }
const Foam::volScalarField& Foam::basicThermo::implementation::alpha() const const Foam::volScalarField& Foam::basicThermo::implementation::kappa() const
{ {
return alpha_; return kappa_;
}
const Foam::scalarField& Foam::basicThermo::implementation::alpha
(
const label patchi
) const
{
return alpha_.boundaryField()[patchi];
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -113,11 +113,11 @@ protected:
// Protected Member Functions // Protected Member Functions
//- Return the enthalpy/internal energy field boundary types //- Enthalpy/internal energy field boundary types
// by interrogating the temperature field boundary types // by interrogating the temperature field boundary types
wordList heBoundaryTypes(); wordList heBoundaryTypes();
//- Return the enthalpy/internal energy field boundary base types //- Enthalpy/internal energy field boundary base types
// by interrogating the temperature field boundary types // by interrogating the temperature field boundary types
wordList heBoundaryBaseTypes(); wordList heBoundaryBaseTypes();
@ -147,7 +147,7 @@ public:
// Static Member Functions // Static Member Functions
//- Return the name of a property for a given phase //- Name of a property for a given phase
static word phasePropertyName(const word& name, const word& phaseName) static word phasePropertyName(const word& name, const word& phaseName)
{ {
return IOobject::groupName(name, phaseName); return IOobject::groupName(name, phaseName);
@ -194,16 +194,16 @@ public:
// Member Functions // Member Functions
//- Return the dictionary //- Properties dictionary
virtual const IOdictionary& properties() const = 0; virtual const IOdictionary& properties() const = 0;
//- Access the dictionary //- Non-const access the properties dictionary
virtual IOdictionary& properties() = 0; virtual IOdictionary& properties() = 0;
//- Return the phase name //- Phase name
virtual const word& phaseName() const = 0; virtual const word& phaseName() const = 0;
//- Return the name of a property for a given phase //- Name of a property for a given phase
word phasePropertyName(const word& name) const word phasePropertyName(const word& name) const
{ {
return phasePropertyName(name, phaseName()); return phasePropertyName(name, phaseName());
@ -229,7 +229,7 @@ public:
//- Update properties //- Update properties
virtual void correct() = 0; virtual void correct() = 0;
//- Return the name of the thermo physics //- Name of the thermo physics
virtual word thermoName() const = 0; virtual word thermoName() const = 0;
//- Return true if the equation of state is incompressible //- Return true if the equation of state is incompressible
@ -362,10 +362,16 @@ public:
) const = 0; ) const = 0;
//- Heat capacity at constant pressure [J/kg/K] //- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const = 0; virtual const volScalarField& Cp() const = 0;
//- Heat capacity at constant volume [J/kg/K] //- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const = 0; virtual const volScalarField& Cv() const = 0;
// Access to transport state variables
//- Thermal conductivity of mixture [W/m/K]
virtual const volScalarField& kappa() const = 0;
// Fields derived from thermodynamic state variables // Fields derived from thermodynamic state variables
@ -402,28 +408,12 @@ public:
) const = 0; ) const = 0;
// Access to transport state variables
//- Thermal diffusivity for enthalpy of mixture [kg/m/s]
virtual const volScalarField& alpha() const = 0;
//- Thermal diffusivity for enthalpy of mixture for patch [kg/m/s]
virtual const scalarField& alpha(const label patchi) const = 0;
// Fields derived from transport state variables // Fields derived from transport state variables
//- Thermal diffusivity for temperature of mixture [W/m/K] //- Thermal diffusivity of energy of mixture [kg/m/s]
virtual tmp<volScalarField> kappa() const = 0;
//- Thermal diffusivity for temperature of mixture
// for patch [W/m/K]
virtual tmp<scalarField> kappa(const label patchi) const = 0;
//- Thermal diffusivity for energy of mixture [kg/m/s]
virtual tmp<volScalarField> alphahe() const = 0; virtual tmp<volScalarField> alphahe() const = 0;
//- Thermal diffusivity for energy of mixture for patch [kg/m/s] //- Thermal diffusivity of energy of mixture for patch [kg/m/s]
virtual tmp<scalarField> alphahe(const label patchi) const = 0; virtual tmp<scalarField> alphahe(const label patchi) const = 0;
}; };
@ -450,8 +440,8 @@ protected:
//- Temperature [K] //- Temperature [K]
volScalarField T_; volScalarField T_;
//- Laminar thermal diffusivity [kg/m/s] //- Thermal conductivity [W/m/K]
volScalarField alpha_; volScalarField kappa_;
//- Should the dpdt term be included in the enthalpy equation //- Should the dpdt term be included in the enthalpy equation
@ -482,19 +472,19 @@ public:
// Member Functions // Member Functions
//- Return the dictionary //- Properties dictionary
virtual const IOdictionary& properties() const virtual const IOdictionary& properties() const
{ {
return *this; return *this;
} }
//- Access the dictionary //- Non-const access the properties dictionary
virtual IOdictionary& properties() virtual IOdictionary& properties()
{ {
return *this; return *this;
} }
//- Phase-name //- Phase name
virtual const word& phaseName() const virtual const word& phaseName() const
{ {
return phaseName_; return phaseName_;
@ -519,12 +509,8 @@ public:
// Access to transport state variables // Access to transport state variables
//- Return the thermal diffusivity for enthalpy of mixture [kg/m/s] //- Thermal conductivity of mixture [W/m/K]
virtual const volScalarField& alpha() const; virtual const volScalarField& kappa() const;
//- Return the thermal diffusivity for enthalpy of mixture for
// patch [kg/m/s]
virtual const scalarField& alpha(const label patchi) const;
//- Read thermophysical properties dictionary //- Read thermophysical properties dictionary

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -148,29 +148,30 @@ public:
// Fields derived from transport state variables // Fields derived from transport state variables
//- Effective thermal turbulent diffusivity for temperature //- Effective thermal turbulent conductivity of mixture
// of mixture [W/m/K] // for patch [W/m/K]
virtual tmp<volScalarField> kappaEff virtual tmp<volScalarField> kappaEff
( (
const volScalarField& const volScalarField&
) const = 0; ) const = 0;
//- Effective thermal turbulent diffusivity for temperature //- Effective thermal turbulent conductivity of mixture
// of mixture for patch [W/m/K] // for patch [W/m/K]
virtual tmp<scalarField> kappaEff virtual tmp<scalarField> kappaEff
( (
const scalarField& alphat, const scalarField& alphat,
const label patchi const label patchi
) const = 0; ) const = 0;
//- Effective thermal turbulent diffusivity of mixture [kg/m/s] //- Effective turbulent thermal diffusivity of energy
// of mixture [kg/m/s]
virtual tmp<volScalarField> alphaEff virtual tmp<volScalarField> alphaEff
( (
const volScalarField& alphat const volScalarField& alphat
) const = 0; ) const = 0;
//- Effective thermal turbulent diffusivity of mixture //- Effective turbulent thermal diffusivity of energy
// for patch [kg/m/s] // of mixture for patch [kg/m/s]
virtual tmp<scalarField> alphaEff virtual tmp<scalarField> alphaEff
( (
const scalarField& alphat, const scalarField& alphat,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -670,44 +670,17 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::W
} }
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::kappa() const
{
return volScalarField::New("kappa", Cp_*this->alpha_);
}
template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::kappa
(
const label patchi
) const
{
return
Cp
(
this->T_.boundaryField()[patchi],
patchi
)*this->alpha_.boundaryField()[patchi];
}
template<class BasicThermo, class MixtureType> template<class BasicThermo, class MixtureType>
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::heThermo<BasicThermo, MixtureType>::alphahe() const Foam::heThermo<BasicThermo, MixtureType>::alphahe() const
{ {
if (MixtureType::thermoType::enthalpy()) if (MixtureType::thermoType::enthalpy())
{ {
return volScalarField::New("alphahe", this->alpha_); return volScalarField::New("alphahe", this->kappa_/Cp_);
} }
else else
{ {
return volScalarField::New return volScalarField::New("alphahe", this->kappa_/Cv_);
(
"alphahe",
this->gamma()*this->alpha_
);
} }
} }
@ -718,16 +691,11 @@ Foam::heThermo<BasicThermo, MixtureType>::alphahe(const label patchi) const
{ {
if (MixtureType::thermoType::enthalpy()) if (MixtureType::thermoType::enthalpy())
{ {
return this->alpha_.boundaryField()[patchi]; return this->kappa_.boundaryField()[patchi]/Cp_.boundaryField()[patchi];
} }
else else
{ {
return return this->kappa_.boundaryField()[patchi]/Cv_.boundaryField()[patchi];
this->gamma
(
this->T_.boundaryField()[patchi],
patchi
)*this->alpha_.boundaryField()[patchi];
} }
} }
@ -739,7 +707,7 @@ Foam::heThermo<BasicThermo, MixtureType>::kappaEff
const volScalarField& alphat const volScalarField& alphat
) const ) const
{ {
return volScalarField::New("kappaEff", Cp_*(this->alpha_ + alphat)); return volScalarField::New("kappaEff", this->kappa_ + Cp_*alphat);
} }
@ -752,12 +720,8 @@ Foam::heThermo<BasicThermo, MixtureType>::kappaEff
) const ) const
{ {
return return
Cp this->kappa_.boundaryField()[patchi]
( + Cp(this->T_.boundaryField()[patchi], patchi)*alphat;
this->T_.boundaryField()[patchi],
patchi
)
*(this->alpha_.boundaryField()[patchi] + alphat);
} }
@ -770,14 +734,14 @@ Foam::heThermo<BasicThermo, MixtureType>::alphaEff
{ {
if (MixtureType::thermoType::enthalpy()) if (MixtureType::thermoType::enthalpy())
{ {
return volScalarField::New("alphaEff", this->alpha_ + alphat); return volScalarField::New("alphaEff", this->kappa_/Cp_ + alphat);
} }
else else
{ {
return volScalarField::New return volScalarField::New
( (
"alphaEff", "alphaEff",
this->gamma()*(this->alpha_ + alphat) (this->kappa_ + Cp_*alphat)/Cv_
); );
} }
} }
@ -793,16 +757,17 @@ Foam::heThermo<BasicThermo, MixtureType>::alphaEff
{ {
if (MixtureType::thermoType::enthalpy()) if (MixtureType::thermoType::enthalpy())
{ {
return (this->alpha_.boundaryField()[patchi] + alphat); return
this->kappa_.boundaryField()[patchi]/Cp_.boundaryField()[patchi]
+ alphat;
} }
else else
{ {
return return
this->gamma (
( this->kappa_.boundaryField()[patchi]
this->T_.boundaryField()[patchi], + Cp_.boundaryField()[patchi]*alphat
patchi )/Cv_.boundaryField()[patchi];
)*(this->alpha_.boundaryField()[patchi] + alphat);
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -198,13 +198,13 @@ public:
} }
//- Heat capacity at constant pressure [J/kg/K] //- Heat capacity at constant pressure [J/kg/K]
virtual tmp<volScalarField> Cp() const virtual const volScalarField& Cp() const
{ {
return Cp_; return Cp_;
} }
//- Heat capacity at constant volume [J/kg/K] //- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const virtual const volScalarField& Cv() const
{ {
return Cv_; return Cv_;
} }
@ -354,41 +354,35 @@ public:
// Fields derived from transport state variables // Fields derived from transport state variables
//- Thermal diffusivity for temperature of mixture [W/m/K] //- Thermal diffusivity of energy of mixture [kg/m/s]
virtual tmp<volScalarField> kappa() const;
//- Thermal diffusivity for temperature of mixture for patch [W/m/K]
virtual tmp<scalarField> kappa(const label patchi) const;
//- Thermal diffusivity for energy of mixture [kg/m/s]
virtual tmp<volScalarField> alphahe() const; virtual tmp<volScalarField> alphahe() const;
//- Thermal diffusivity for energy of mixture for patch [kg/m/s] //- Thermal diffusivity of energy of mixture for patch [kg/m/s]
virtual tmp<scalarField> alphahe(const label patchi) const; virtual tmp<scalarField> alphahe(const label patchi) const;
//- Effective thermal turbulent diffusivity for temperature //- Effective thermal turbulent conductivity of mixture [W/m/K]
// of mixture [W/m/K]
virtual tmp<volScalarField> kappaEff virtual tmp<volScalarField> kappaEff
( (
const volScalarField& const volScalarField&
) const; ) const;
//- Effective thermal turbulent diffusivity for temperature //- Effective thermal turbulent conductivity of mixture
// of mixture for patch [W/m/K] // for patch [W/m/K]
virtual tmp<scalarField> kappaEff virtual tmp<scalarField> kappaEff
( (
const scalarField& alphat, const scalarField& alphat,
const label patchi const label patchi
) const; ) const;
//- Effective thermal turbulent diffusivity of mixture [kg/m/s] //- Effective turbulent thermal diffusivity of energy
// of mixture [kg/m/s]
virtual tmp<volScalarField> alphaEff virtual tmp<volScalarField> alphaEff
( (
const volScalarField& alphat const volScalarField& alphat
) const; ) const;
//- Effective thermal turbulent diffusivity of mixture //- Effective turbulent thermal diffusivity of energy
// for patch [kg/m/s] // of mixture for patch [kg/m/s]
virtual tmp<scalarField> alphaEff virtual tmp<scalarField> alphaEff
( (
const scalarField& alphat, const scalarField& alphat,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,7 +38,7 @@ void Foam::hePsiThermo<BasicPsiThermo, MixtureType>::calculate()
scalarField& CvCells = this->Cv_.primitiveFieldRef(); scalarField& CvCells = this->Cv_.primitiveFieldRef();
scalarField& psiCells = this->psi_.primitiveFieldRef(); scalarField& psiCells = this->psi_.primitiveFieldRef();
scalarField& muCells = this->mu_.primitiveFieldRef(); scalarField& muCells = this->mu_.primitiveFieldRef();
scalarField& alphaCells = this->alpha_.primitiveFieldRef(); scalarField& kappaCells = this->kappa_.primitiveFieldRef();
forAll(TCells, celli) forAll(TCells, celli)
{ {
@ -60,9 +60,8 @@ void Foam::hePsiThermo<BasicPsiThermo, MixtureType>::calculate()
psiCells[celli] = thermoMixture.psi(pCells[celli], TCells[celli]); psiCells[celli] = thermoMixture.psi(pCells[celli], TCells[celli]);
muCells[celli] = transportMixture.mu(pCells[celli], TCells[celli]); muCells[celli] = transportMixture.mu(pCells[celli], TCells[celli]);
alphaCells[celli] = kappaCells[celli] =
transportMixture.kappa(pCells[celli], TCells[celli]) transportMixture.kappa(pCells[celli], TCells[celli]);
/CpCells[celli];
} }
volScalarField::Boundary& pBf = volScalarField::Boundary& pBf =
@ -86,8 +85,8 @@ void Foam::hePsiThermo<BasicPsiThermo, MixtureType>::calculate()
volScalarField::Boundary& muBf = volScalarField::Boundary& muBf =
this->mu_.boundaryFieldRef(); this->mu_.boundaryFieldRef();
volScalarField::Boundary& alphaBf = volScalarField::Boundary& kappaBf =
this->alpha_.boundaryFieldRef(); this->kappa_.boundaryFieldRef();
forAll(this->T_.boundaryField(), patchi) forAll(this->T_.boundaryField(), patchi)
{ {
@ -98,7 +97,7 @@ void Foam::hePsiThermo<BasicPsiThermo, MixtureType>::calculate()
fvPatchScalarField& ppsi = psiBf[patchi]; fvPatchScalarField& ppsi = psiBf[patchi];
fvPatchScalarField& phe = heBf[patchi]; fvPatchScalarField& phe = heBf[patchi];
fvPatchScalarField& pmu = muBf[patchi]; fvPatchScalarField& pmu = muBf[patchi];
fvPatchScalarField& palpha = alphaBf[patchi]; fvPatchScalarField& pkappa = kappaBf[patchi];
if (pT.fixesValue()) if (pT.fixesValue())
{ {
@ -119,9 +118,7 @@ void Foam::hePsiThermo<BasicPsiThermo, MixtureType>::calculate()
ppsi[facei] = thermoMixture.psi(pp[facei], pT[facei]); ppsi[facei] = thermoMixture.psi(pp[facei], pT[facei]);
pmu[facei] = transportMixture.mu(pp[facei], pT[facei]); pmu[facei] = transportMixture.mu(pp[facei], pT[facei]);
palpha[facei] = pkappa[facei] = transportMixture.kappa(pp[facei], pT[facei]);
transportMixture.kappa(pp[facei], pT[facei])
/pCp[facei];
} }
} }
else else
@ -143,9 +140,7 @@ void Foam::hePsiThermo<BasicPsiThermo, MixtureType>::calculate()
ppsi[facei] = thermoMixture.psi(pp[facei], pT[facei]); ppsi[facei] = thermoMixture.psi(pp[facei], pT[facei]);
pmu[facei] = transportMixture.mu(pp[facei], pT[facei]); pmu[facei] = transportMixture.mu(pp[facei], pT[facei]);
palpha[facei] = pkappa[facei] = transportMixture.kappa(pp[facei], pT[facei]);
transportMixture.kappa(pp[facei], pT[facei])
/pCp[facei];
} }
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -39,7 +39,7 @@ void Foam::heRhoThermo<BasicRhoThermo, MixtureType>::calculate()
scalarField& psiCells = this->psi_.primitiveFieldRef(); scalarField& psiCells = this->psi_.primitiveFieldRef();
scalarField& rhoCells = this->rho_.primitiveFieldRef(); scalarField& rhoCells = this->rho_.primitiveFieldRef();
scalarField& muCells = this->mu_.primitiveFieldRef(); scalarField& muCells = this->mu_.primitiveFieldRef();
scalarField& alphaCells = this->alpha_.primitiveFieldRef(); scalarField& kappaCells = this->kappa_.primitiveFieldRef();
forAll(TCells, celli) forAll(TCells, celli)
{ {
@ -62,9 +62,8 @@ void Foam::heRhoThermo<BasicRhoThermo, MixtureType>::calculate()
rhoCells[celli] = thermoMixture.rho(pCells[celli], TCells[celli]); rhoCells[celli] = thermoMixture.rho(pCells[celli], TCells[celli]);
muCells[celli] = transportMixture.mu(pCells[celli], TCells[celli]); muCells[celli] = transportMixture.mu(pCells[celli], TCells[celli]);
alphaCells[celli] = kappaCells[celli] =
transportMixture.kappa(pCells[celli], TCells[celli]) transportMixture.kappa(pCells[celli], TCells[celli]);
/thermoMixture.Cp(pCells[celli], TCells[celli]);
} }
volScalarField::Boundary& pBf = volScalarField::Boundary& pBf =
@ -91,8 +90,8 @@ void Foam::heRhoThermo<BasicRhoThermo, MixtureType>::calculate()
volScalarField::Boundary& muBf = volScalarField::Boundary& muBf =
this->mu_.boundaryFieldRef(); this->mu_.boundaryFieldRef();
volScalarField::Boundary& alphaBf = volScalarField::Boundary& kappaBf =
this->alpha_.boundaryFieldRef(); this->kappa_.boundaryFieldRef();
forAll(this->T_.boundaryField(), patchi) forAll(this->T_.boundaryField(), patchi)
{ {
@ -104,7 +103,7 @@ void Foam::heRhoThermo<BasicRhoThermo, MixtureType>::calculate()
fvPatchScalarField& prho = rhoBf[patchi]; fvPatchScalarField& prho = rhoBf[patchi];
fvPatchScalarField& phe = heBf[patchi]; fvPatchScalarField& phe = heBf[patchi];
fvPatchScalarField& pmu = muBf[patchi]; fvPatchScalarField& pmu = muBf[patchi];
fvPatchScalarField& palpha = alphaBf[patchi]; fvPatchScalarField& pkappa = kappaBf[patchi];
if (pT.fixesValue()) if (pT.fixesValue())
{ {
@ -126,9 +125,7 @@ void Foam::heRhoThermo<BasicRhoThermo, MixtureType>::calculate()
prho[facei] = thermoMixture.rho(pp[facei], pT[facei]); prho[facei] = thermoMixture.rho(pp[facei], pT[facei]);
pmu[facei] = transportMixture.mu(pp[facei], pT[facei]); pmu[facei] = transportMixture.mu(pp[facei], pT[facei]);
palpha[facei] = pkappa[facei] = transportMixture.kappa(pp[facei], pT[facei]);
transportMixture.kappa(pp[facei], pT[facei])
/thermoMixture.Cp(pp[facei], pT[facei]);
} }
} }
else else
@ -151,9 +148,7 @@ void Foam::heRhoThermo<BasicRhoThermo, MixtureType>::calculate()
prho[facei] = thermoMixture.rho(pp[facei], pT[facei]); prho[facei] = thermoMixture.rho(pp[facei], pT[facei]);
pmu[facei] = transportMixture.mu(pp[facei], pT[facei]); pmu[facei] = transportMixture.mu(pp[facei], pT[facei]);
palpha[facei] = pkappa[facei] = transportMixture.kappa(pp[facei], pT[facei]);
transportMixture.kappa(pp[facei], pT[facei])
/thermoMixture.Cp(pp[facei], pT[facei]);
} }
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -256,7 +256,7 @@ public:
// with inheritance of virtual functions in heThermo // with inheritance of virtual functions in heThermo
//- Heat capacity at constant pressure for patch [J/kg/K] //- Heat capacity at constant pressure for patch [J/kg/K]
virtual tmp<volScalarField> Cp() const = 0; virtual const volScalarField& Cp() const = 0;
//- Heat capacity at constant pressure for patch [J/kg/K] //- Heat capacity at constant pressure for patch [J/kg/K]
virtual tmp<scalarField> Cp virtual tmp<scalarField> Cp
@ -266,7 +266,7 @@ public:
) const = 0; ) const = 0;
//- Heat capacity at constant volume [J/kg/K] //- Heat capacity at constant volume [J/kg/K]
virtual tmp<volScalarField> Cv() const = 0; virtual const volScalarField& Cv() const = 0;
//- Heat capacity at constant volume for patch [J/kg/K] //- Heat capacity at constant volume for patch [J/kg/K]
virtual tmp<scalarField> Cv virtual tmp<scalarField> Cv
@ -274,12 +274,6 @@ public:
const scalarField& T, const scalarField& T,
const label patchi const label patchi
) const = 0; ) const = 0;
//- Thermal diffusivity for temperature of mixture [W/m/K]
virtual tmp<volScalarField> kappa() const = 0;
//- Thermal diffusivity for temperature of mixture for patch [W/m/K]
virtual tmp<scalarField> kappa(const label patchi) const = 0;
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,7 +42,7 @@ void Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::calculate()
scalarField& CvCells = this->Cv_.primitiveFieldRef(); scalarField& CvCells = this->Cv_.primitiveFieldRef();
scalarField& psiCells = this->psi_.primitiveFieldRef(); scalarField& psiCells = this->psi_.primitiveFieldRef();
scalarField& muCells = this->mu_.primitiveFieldRef(); scalarField& muCells = this->mu_.primitiveFieldRef();
scalarField& alphaCells = this->alpha_.primitiveFieldRef(); scalarField& kappaCells = this->kappa_.primitiveFieldRef();
forAll(TCells, celli) forAll(TCells, celli)
{ {
@ -64,9 +64,8 @@ void Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::calculate()
psiCells[celli] = thermoMixture.psi(pCells[celli], TCells[celli]); psiCells[celli] = thermoMixture.psi(pCells[celli], TCells[celli]);
muCells[celli] = transportMixture.mu(pCells[celli], TCells[celli]); muCells[celli] = transportMixture.mu(pCells[celli], TCells[celli]);
alphaCells[celli] = kappaCells[celli] =
transportMixture.kappa(pCells[celli], TCells[celli]) transportMixture.kappa(pCells[celli], TCells[celli]);
/CpCells[celli];
TuCells[celli] = this->cellReactants(celli).THE TuCells[celli] = this->cellReactants(celli).THE
( (
@ -103,8 +102,8 @@ void Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::calculate()
volScalarField::Boundary& muBf = volScalarField::Boundary& muBf =
this->mu_.boundaryFieldRef(); this->mu_.boundaryFieldRef();
volScalarField::Boundary& alphaBf = volScalarField::Boundary& kappaBf =
this->alpha_.boundaryFieldRef(); this->kappa_.boundaryFieldRef();
forAll(this->T_.boundaryField(), patchi) forAll(this->T_.boundaryField(), patchi)
{ {
@ -117,7 +116,7 @@ void Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::calculate()
fvPatchScalarField& phe = heBf[patchi]; fvPatchScalarField& phe = heBf[patchi];
fvPatchScalarField& pheu = heuBf[patchi]; fvPatchScalarField& pheu = heuBf[patchi];
fvPatchScalarField& pmu = muBf[patchi]; fvPatchScalarField& pmu = muBf[patchi];
fvPatchScalarField& palpha = alphaBf[patchi]; fvPatchScalarField& pkappa = kappaBf[patchi];
if (pT.fixesValue()) if (pT.fixesValue())
{ {
@ -137,9 +136,7 @@ void Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::calculate()
pCv[facei] = thermoMixture.Cv(pp[facei], pT[facei]); pCv[facei] = thermoMixture.Cv(pp[facei], pT[facei]);
ppsi[facei] = thermoMixture.psi(pp[facei], pT[facei]); ppsi[facei] = thermoMixture.psi(pp[facei], pT[facei]);
pmu[facei] = transportMixture.mu(pp[facei], pT[facei]); pmu[facei] = transportMixture.mu(pp[facei], pT[facei]);
palpha[facei] = pkappa[facei] = transportMixture.kappa(pp[facei], pT[facei]);
transportMixture.kappa(pp[facei], pT[facei])
/pCp[facei];
} }
} }
else else
@ -160,9 +157,7 @@ void Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::calculate()
pCv[facei] = thermoMixture.Cv(pp[facei], pT[facei]); pCv[facei] = thermoMixture.Cv(pp[facei], pT[facei]);
ppsi[facei] = thermoMixture.psi(pp[facei], pT[facei]); ppsi[facei] = thermoMixture.psi(pp[facei], pT[facei]);
pmu[facei] = transportMixture.mu(pp[facei], pT[facei]); pmu[facei] = transportMixture.mu(pp[facei], pT[facei]);
palpha[facei] = pkappa[facei] = transportMixture.kappa(pp[facei], pT[facei]);
transportMixture.kappa(pp[facei], pT[facei])
/pCp[facei];
pTu[facei] = pTu[facei] =
this->patchFaceReactants(patchi, facei) this->patchFaceReactants(patchi, facei)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -40,7 +40,7 @@ void Foam::heSolidThermo<BasicSolidThermo, MixtureType>::calculate()
scalarField& CpCells = this->Cp_.primitiveFieldRef(); scalarField& CpCells = this->Cp_.primitiveFieldRef();
scalarField& CvCells = this->Cv_.primitiveFieldRef(); scalarField& CvCells = this->Cv_.primitiveFieldRef();
scalarField& rhoCells = this->rho_.primitiveFieldRef(); scalarField& rhoCells = this->rho_.primitiveFieldRef();
scalarField& alphaCells = this->alpha_.primitiveFieldRef(); scalarField& kappaCells = this->kappa_.primitiveFieldRef();
forAll(TCells, celli) forAll(TCells, celli)
{ {
@ -61,9 +61,8 @@ void Foam::heSolidThermo<BasicSolidThermo, MixtureType>::calculate()
CvCells[celli] = thermoMixture.Cv(pCells[celli], TCells[celli]); CvCells[celli] = thermoMixture.Cv(pCells[celli], TCells[celli]);
rhoCells[celli] = thermoMixture.rho(pCells[celli], TCells[celli]); rhoCells[celli] = thermoMixture.rho(pCells[celli], TCells[celli]);
alphaCells[celli] = kappaCells[celli] =
transportMixture.kappa(pCells[celli], TCells[celli]) transportMixture.kappa(pCells[celli], TCells[celli]);
/thermoMixture.Cv(pCells[celli], TCells[celli]);
} }
@ -84,8 +83,8 @@ void Foam::heSolidThermo<BasicSolidThermo, MixtureType>::calculate()
volScalarField::Boundary& rhoBf = volScalarField::Boundary& rhoBf =
this->rho_.boundaryFieldRef(); this->rho_.boundaryFieldRef();
volScalarField::Boundary& alphaBf = volScalarField::Boundary& kappaBf =
this->alpha_.boundaryFieldRef(); this->kappa_.boundaryFieldRef();
forAll(this->T_.boundaryField(), patchi) forAll(this->T_.boundaryField(), patchi)
{ {
@ -95,7 +94,7 @@ void Foam::heSolidThermo<BasicSolidThermo, MixtureType>::calculate()
fvPatchScalarField& pCp = CpBf[patchi]; fvPatchScalarField& pCp = CpBf[patchi];
fvPatchScalarField& pCv = CvBf[patchi]; fvPatchScalarField& pCv = CvBf[patchi];
fvPatchScalarField& prho = rhoBf[patchi]; fvPatchScalarField& prho = rhoBf[patchi];
fvPatchScalarField& palpha = alphaBf[patchi]; fvPatchScalarField& pkappa = kappaBf[patchi];
if (pT.fixesValue()) if (pT.fixesValue())
{ {
@ -115,9 +114,7 @@ void Foam::heSolidThermo<BasicSolidThermo, MixtureType>::calculate()
pCp[facei] = thermoMixture.Cp(pp[facei], pT[facei]); pCp[facei] = thermoMixture.Cp(pp[facei], pT[facei]);
pCv[facei] = thermoMixture.Cv(pp[facei], pT[facei]); pCv[facei] = thermoMixture.Cv(pp[facei], pT[facei]);
palpha[facei] = pkappa[facei] = transportMixture.kappa(pp[facei], pT[facei]);
transportMixture.kappa(pp[facei], pT[facei])
/thermoMixture.Cv(pp[facei], pT[facei]);
} }
} }
else else
@ -138,14 +135,12 @@ void Foam::heSolidThermo<BasicSolidThermo, MixtureType>::calculate()
pCp[facei] = thermoMixture.Cp(pp[facei], pT[facei]); pCp[facei] = thermoMixture.Cp(pp[facei], pT[facei]);
pCv[facei] = thermoMixture.Cv(pp[facei], pT[facei]); pCv[facei] = thermoMixture.Cv(pp[facei], pT[facei]);
palpha[facei] = pkappa[facei] = transportMixture.kappa(pp[facei], pT[facei]);
transportMixture.kappa(pp[facei], pT[facei])
/thermoMixture.Cv(pp[facei], pT[facei]);
} }
} }
} }
this->alpha_.correctBoundaryConditions(); this->kappa_.correctBoundaryConditions();
} }
@ -359,7 +354,15 @@ Foam::heSolidThermo<BasicSolidThermo, MixtureType>::divq
- ( - (
isotropic() isotropic()
? fvc::laplacian(this->kappa(), this->T_) ? fvc::laplacian(this->kappa(), this->T_)
+ correction(fvm::laplacian(this->alpha(), e)) + correction
(
fvm::laplacian
(
this->kappa()/this->Cv(),
e,
"laplacian(alphae,e)"
)
)
: fvc::laplacian(KappaLocal(), this->T_) : fvc::laplacian(KappaLocal(), this->T_)
+ correction + correction
( (
@ -367,7 +370,7 @@ Foam::heSolidThermo<BasicSolidThermo, MixtureType>::divq
( (
KappaLocal()/this->Cv(), KappaLocal()/this->Cv(),
e, e,
"laplacian(" + this->alpha().name() + ",e)" "laplacian(alphae,e)"
) )
) )
); );

View File

@ -42,7 +42,7 @@ solution
thermo:mu cell; thermo:mu cell;
T cell; T cell;
Cp cell; Cp cell;
kappa cell; thermo:kappa cell;
p cell; p cell;
} }

View File

@ -42,7 +42,7 @@ solution
thermo:mu cell; thermo:mu cell;
T cell; T cell;
Cp cell; Cp cell;
kappa cell; thermo:kappa cell;
p cell; p cell;
} }

View File

@ -42,7 +42,7 @@ solution
thermo:mu cell; thermo:mu cell;
T cell; T cell;
Cp cell; Cp cell;
kappa cell; thermo:kappa cell;
p cell; p cell;
} }

View File

@ -42,7 +42,7 @@ solution
thermo:mu cell; thermo:mu cell;
T cell; T cell;
Cp cell; Cp cell;
kappa cell; thermo:kappa cell;
p cell; p cell;
} }

View File

@ -42,7 +42,7 @@ solution
thermo:mu cell; thermo:mu cell;
T cell; T cell;
Cp cell; Cp cell;
kappa cell; thermo:kappa cell;
p cell; p cell;
} }

View File

@ -42,7 +42,7 @@ solution
thermo:mu cell; thermo:mu cell;
T cell; T cell;
Cp cell; Cp cell;
kappa cell; thermo:kappa cell;
p cell; p cell;
} }

View File

@ -42,7 +42,7 @@ solution
thermo:mu cell; thermo:mu cell;
T cell; T cell;
Cp cell; Cp cell;
kappa cell; thermo:kappa cell;
p cell; p cell;
G cell; G cell;
} }

View File

@ -39,7 +39,7 @@ solution
thermo:mu cell; thermo:mu cell;
U cellPoint; U cellPoint;
Cp cell; Cp cell;
kappa cell; thermo:kappa cell;
p cell; p cell;
T cell; T cell;
G cell; G cell;

View File

@ -42,7 +42,7 @@ solution
thermo:mu cell; thermo:mu cell;
T cell; T cell;
Cp cell; Cp cell;
kappa cell; thermo:kappa cell;
p cell; p cell;
} }

View File

@ -45,7 +45,7 @@ solution
thermo:mu cell; thermo:mu cell;
T cell; T cell;
Cp cell; Cp cell;
kappa cell; thermo:kappa cell;
p cell; p cell;
} }

View File

@ -45,7 +45,7 @@ solution
thermo:mu cell; thermo:mu cell;
T cell; T cell;
Cp cell; Cp cell;
kappa cell; thermo:kappa cell;
p cell; p cell;
} }

View File

@ -32,7 +32,7 @@ gradSchemes
laplacianSchemes laplacianSchemes
{ {
default none; default none;
laplacian(alpha,e) Gauss linear uncorrected; laplacian(alphahe,e) Gauss linear uncorrected;
} }

View File

@ -42,7 +42,7 @@ solution
thermo:mu.air cell; thermo:mu.air cell;
T.air cell; T.air cell;
Cp.air cell; Cp.air cell;
kappa cell; thermo:kappa.air cell;
p cell; p cell;
} }