BasicThermo::Cp: volScalarField reference optimisations

Now that BasicThermo::Cp returns a volScalarField reference because Cp is cached
in BasicThermo code calling Cp can hold a reference rather than a copy for
efficiency.
This commit is contained in:
Henry Weller
2024-01-25 13:55:57 +00:00
parent 357662688d
commit 9886fea313
5 changed files with 10 additions and 19 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) 2017-2023 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2017-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -202,7 +202,7 @@ void Foam::fv::VoFSolidificationMelting::correct()
);
const volScalarField& TVoF = thermo.thermo1().T();
const volScalarField CpVoF(thermo.thermo1().Cp());
const volScalarField& CpVoF(thermo.thermo1().Cp());
const volScalarField& alphaVoF = thermo.alpha1();
const labelUList cells = set_.cells();

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-2023 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -227,11 +227,7 @@ struct alphatWallBoilingWallFunctionFvPatchScalarField::boilingLiquidProperties
Cpw(liquid.thermo().Cp().boundaryField()[patchi()]),
tnuw(liquid.fluidThermo().nu(patchi())),
nuw(tnuw()),
kappaByCp
(
liquid.thermo().kappa().boundaryField()[patchi()]
/liquid.thermo().Cp().boundaryField()[patchi()]
),
kappaByCp(liquid.thermo().kappa().boundaryField()[patchi()]/Cpw),
nutw
(
nutWallFunctionFvPatchScalarField::nutw

View File

@ -157,12 +157,8 @@ tmp<scalarField> alphatJayatillekeWallFunctionFvPatchScalarField::alphat
const tmp<scalarField> tnuw = turbModel.nu(patchi);
const scalarField& nuw = tnuw();
const tmp<scalarField> talphaw
(
ttm.thermo().kappa().boundaryField()[patchi]
/ttm.thermo().Cp().boundaryField()[patchi]
);
const scalarField& alphaw = talphaw();
const scalarField& Cpw(ttm.thermo().Cp().boundaryField()[patchi]);
const scalarField alphaw(ttm.thermo().kappa().boundaryField()[patchi]/Cpw);
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
@ -172,7 +168,6 @@ tmp<scalarField> alphatJayatillekeWallFunctionFvPatchScalarField::alphat
const scalarField magGradUw(mag(Uw.snGrad()));
const scalarField& rhow = turbModel.rho().boundaryField()[patchi];
const scalarField& Cpw(ttm.thermo().Cp().boundaryField()[patchi]);
const fvPatchScalarField& Tw = ttm.thermo().T().boundaryField()[patchi];
// Temperature gradient

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -101,7 +101,7 @@ void convectiveHeatTransferFvPatchScalarField::updateCoeffs()
const scalarField& rhow = turbModel.rho().boundaryField()[patchi];
const vectorField& Uc = turbModel.U();
const vectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField Cpw(ttm.thermo().Cp().boundaryField()[patchi]);
const scalarField& Cpw(ttm.thermo().Cp().boundaryField()[patchi]);
const scalarField kappaEffw(ttm.kappaEff(patchi));
const scalarField Pr(rhow*nuw*Cpw/kappaEffw);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -252,7 +252,7 @@ Foam::ThermoCloud<CloudType>::Sh(const volScalarField& hs) const
{
if (this->solution().semiImplicit("h"))
{
const volScalarField Cp(carrierThermo_.Cp());
const volScalarField& Cp(carrierThermo_.Cp());
const volScalarField::Internal
Vdt(this->mesh().V()*this->db().time().deltaT());