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
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -185,7 +185,11 @@ alphatPhaseJayatillekeWallFunctionFvPatchScalarField::calcAlphat
const tmp<scalarField> tnuw = turbModel.nu(patchi);
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 tmp<volScalarField> tk = turbModel.k();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -356,7 +356,12 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
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 volScalarField& k = tk();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -280,7 +280,7 @@ template<class BasePhaseModel>
Foam::tmp<Foam::scalarField>
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
(
fvc::interpolate(alpha)*fvc::interpolate(this->thermo().alpha()),
fvc::interpolate(alpha)*fvc::interpolate(this->thermo().alphahe()),
he
);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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_;
}
@ -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
(
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_;
}
Foam::tmp<Foam::scalarField> Foam::solidDisplacementThermo::kappa
(
const label patchi
) const
{
return kappa_.boundaryField()[patchi];
}
Foam::tmp<Foam::volScalarField> Foam::solidDisplacementThermo::alphahe() const
{
NotImplemented;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -168,10 +168,16 @@ public:
virtual const volScalarField& he() const;
//- 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]
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
@ -302,12 +308,6 @@ public:
// 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]
virtual tmp<volScalarField> alphahe() const;