From b5bc8c07f84d5c0d1de597846112e59599d99ab0 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Tue, 23 Jan 2024 10:30:43 +0100 Subject: [PATCH] ENH: use tmp field factory methods [7] (#2723) - thermophysicalModels, transportModels --- .../thermalBaffle1DFvPatchScalarField.C | 13 +- ...tureCoupledBaffleMixedFvPatchScalarField.C | 14 +- ...eratureRadCoupledMixedFvPatchScalarField.C | 2 +- .../basic/basicThermo/basicThermo.C | 30 ++- .../basic/heThermo/heThermo.C | 220 ++++++------------ .../basic/psiThermo/psiThermo.C | 22 +- .../basic/rhoThermo/rhoThermo.C | 47 ++-- .../StandardChemistryModel.C | 67 ++---- .../laminarFlameSpeed/Gulders/Gulders.C | 46 +--- .../laminarFlameSpeed/GuldersEGR/GuldersEGR.C | 46 +--- .../RaviPetersen/RaviPetersen.C | 33 +-- .../laminarFlameSpeed/constant/constant.C | 20 +- ...veViewFactorFixedValueFvPatchScalarField.C | 2 +- .../radiation/radiationModels/P1/P1.C | 31 +-- .../blackBodyEmission/blackBodyEmission.C | 36 +-- .../radiationModels/fvDOM/fvDOM/fvDOM.C | 70 +++--- .../radiationModels/noRadiation/noRadiation.C | 24 +- .../radiationModels/opaqueSolid/opaqueSolid.C | 25 +- .../solarLoad/faceReflecting/faceReflecting.C | 16 +- .../solarLoad/faceShading/faceShading.C | 15 +- .../radiationModels/solarLoad/solarLoad.C | 13 +- .../radiationModels/viewFactor/viewFactor.C | 26 +-- .../absorptionEmissionModel.C | 120 +++------- .../constantAbsorptionEmission.C | 66 ++---- .../greyMeanAbsorptionEmission.C | 43 +--- .../greyMeanSolidAbsorptionEmission.C | 33 +-- .../multiBandAbsorptionEmission.C | 63 ++--- .../multiBandZoneAbsorptionEmission.C | 61 ++--- .../wideBandAbsorptionEmission.C | 41 +--- .../boundaryRadiationProperties.C | 30 +-- .../constantScatter/constantScatter.C | 20 +- .../scatterModel/noScatter/noScatter.C | 20 +- .../constantAbsorption/constantAbsorption.C | 4 +- .../multiBandAbsorption/multiBandAbsorption.C | 4 +- .../basicMultiComponentMixture.C | 3 +- .../psiuReactionThermo/heheuPsiThermo.C | 122 +++------- .../pyrolysisChemistryModel.C | 25 +- .../pyrolysisChemistryModelI.H | 22 +- .../solidChemistryModel/solidChemistryModel.C | 24 +- .../solidChemistryModelI.H | 45 ++-- .../solidThermo/solidThermo/heSolidThermo.C | 27 +-- .../isoAdvection/isoAdvection.H | 22 +- .../incompressibleTwoPhaseMixture.C | 9 +- .../constant/constantSurfaceTension.C | 13 +- .../temperatureDependentSurfaceTension.C | 13 +- 45 files changed, 508 insertions(+), 1140 deletions(-) diff --git a/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C index 6687c4a7727..bb3532b43d3 100644 --- a/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C @@ -253,11 +253,9 @@ baffleThickness() const nbrPatch.template lookupPatchField<volScalarField>(TName_) ); - tmp<scalarField> tthickness - ( - new scalarField(nbrField.baffleThickness()) - ); - scalarField& thickness = tthickness.ref(); + auto tthickness = tmp<scalarField>::New(nbrField.baffleThickness()); + auto& thickness = tthickness.ref(); + mapDist.distribute(thickness); return tthickness; } @@ -284,8 +282,9 @@ tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>::qs() const nbrPatch.template lookupPatchField<volScalarField>(TName_) ); - tmp<scalarField> tqs(new scalarField(nbrField.qs())); - scalarField& qs = tqs.ref(); + auto tqs = tmp<scalarField>::New(nbrField.qs()); + auto& qs = tqs.ref(); + mapDist.distribute(qs); return tqs; } diff --git a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C index 0c782f824cf..d2066bec6d8 100644 --- a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C @@ -433,20 +433,8 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::coeffs << "which has more functionalities and it can handle " << "the assemble coupled option for energy. " << abort(FatalError); - /* - const label index(this->patch().index()); - const label nSubFaces(matrix.lduMesh().cellBoundMap()[mat][index].size()); - - Field<scalar> mapCoeffs(nSubFaces, Zero); - - label subFaceI = 0; - forAll(*this, faceI) - { - - } - */ - return tmp<Field<scalar>>(new Field<scalar>()); + return nullptr; } diff --git a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C index 0471bdd3987..81b6f09f685 100644 --- a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C @@ -804,7 +804,7 @@ tmp<Field<scalar>> turbulentTemperatureRadCoupledMixedFvPatchScalarField::coeffs << "the assemble coupled option for energy. " << abort(FatalError); - return tmp<Field<scalar>>(new Field<scalar>()); + return nullptr; } diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index e4bcf751c7c..f012c7a9141 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2021 OpenCFD Ltd. + Copyright (C) 2017-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -285,8 +285,9 @@ Foam::basicThermo::basicThermo phasePropertyName(dictName, phaseName), mesh.time().constant(), mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE + IOobject::READ_MODIFIED, + IOobject::NO_WRITE, + IOobject::REGISTER ) ), @@ -303,11 +304,12 @@ Foam::basicThermo::basicThermo ( IOobject ( - phasePropertyName("thermo:alpha"), + phaseScopedName("thermo", "alpha"), mesh.time().timeName(), mesh, IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimensionedScalar(dimensionSet(1, -1, -1, 0, 0), Zero) @@ -332,7 +334,8 @@ Foam::basicThermo::basicThermo mesh.time().constant(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), dict ), @@ -350,11 +353,12 @@ Foam::basicThermo::basicThermo ( IOobject ( - phasePropertyName("thermo:alpha"), + phaseScopedName("thermo", "alpha"), mesh.time().timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimensionedScalar(dimensionSet(1, -1, -1, 0, 0), Zero) @@ -378,8 +382,9 @@ Foam::basicThermo::basicThermo dictionaryName, mesh.time().constant(), mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE + IOobject::READ_MODIFIED, + IOobject::NO_WRITE, + IOobject::REGISTER ) ), @@ -396,11 +401,12 @@ Foam::basicThermo::basicThermo ( IOobject ( - phasePropertyName("thermo:alpha"), + phaseScopedName("thermo", "alpha"), mesh.time().timeName(), mesh, IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimensionedScalar(dimensionSet(1, -1, -1, 0, 0), Zero) diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.C b/src/thermophysicalModels/basic/heThermo/heThermo.C index 78600ba69c5..40eb9b0705a 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.C +++ b/src/thermophysicalModels/basic/heThermo/heThermo.C @@ -218,25 +218,15 @@ Foam::tmp<Foam::volScalarField> Foam::heThermo<BasicThermo, MixtureType>::he { const fvMesh& mesh = this->T_.mesh(); - tmp<volScalarField> the + auto the = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "he", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh, - he_.dimensions() - ) + "he", + IOobject::NO_REGISTER, + mesh, + he_.dimensions() ); + auto& he = the.ref(); - volScalarField& he = the.ref(); scalarField& heCells = he.primitiveFieldRef(); const scalarField& pCells = p; const scalarField& TCells = T; @@ -274,8 +264,8 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::he const labelList& cells ) const { - tmp<scalarField> the(new scalarField(T.size())); - scalarField& he = the.ref(); + auto the = tmp<scalarField>::New(T.size()); + auto& he = the.ref(); forAll(T, celli) { @@ -294,8 +284,8 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::he const label patchi ) const { - tmp<scalarField> the(new scalarField(T.size())); - scalarField& he = the.ref(); + auto the = tmp<scalarField>::New(T.size()); + auto& he = the.ref(); forAll(T, facei) { @@ -313,25 +303,15 @@ Foam::heThermo<BasicThermo, MixtureType>::hc() const { const fvMesh& mesh = this->T_.mesh(); - tmp<volScalarField> thc + auto thc = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "hc", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh, - he_.dimensions() - ) + "hc", + IOobject::NO_REGISTER, + mesh, + he_.dimensions() ); + auto& hcf = thc.ref(); - volScalarField& hcf = thc.ref(); scalarField& hcCells = hcf.primitiveFieldRef(); forAll(hcCells, celli) @@ -363,8 +343,8 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::Cp const label patchi ) const { - tmp<scalarField> tCp(new scalarField(T.size())); - scalarField& cp = tCp.ref(); + auto tCp = tmp<scalarField>::New(T.size()); + auto& cp = tCp.ref(); forAll(T, facei) { @@ -404,25 +384,14 @@ Foam::heThermo<BasicThermo, MixtureType>::Cp() const { const fvMesh& mesh = this->T_.mesh(); - tmp<volScalarField> tCp + auto tCp = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Cp", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh, - dimEnergy/dimMass/dimTemperature - ) + "Cp", + IOobject::NO_REGISTER, + mesh, + dimEnergy/dimMass/dimTemperature ); - - volScalarField& cp = tCp.ref(); + auto& cp = tCp.ref(); forAll(this->T_, celli) { @@ -458,8 +427,8 @@ Foam::heThermo<BasicThermo, MixtureType>::Cv const label patchi ) const { - tmp<scalarField> tCv(new scalarField(T.size())); - scalarField& cv = tCv.ref(); + auto tCv = tmp<scalarField>::New(T.size()); + auto& cv = tCv.ref(); forAll(T, facei) { @@ -499,25 +468,14 @@ Foam::heThermo<BasicThermo, MixtureType>::Cv() const { const fvMesh& mesh = this->T_.mesh(); - tmp<volScalarField> tCv + auto tCv = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Cv", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh, - dimEnergy/dimMass/dimTemperature - ) + "Cv", + IOobject::NO_REGISTER, + mesh, + dimEnergy/dimMass/dimTemperature ); - - volScalarField& cv = tCv.ref(); + auto& cv = tCv.ref(); forAll(this->T_, celli) { @@ -549,8 +507,8 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::gamma const label patchi ) const { - tmp<scalarField> tgamma(new scalarField(T.size())); - scalarField& gamma = tgamma.ref(); + auto tgamma = tmp<scalarField>::New(T.size()); + auto& gamma = tgamma.ref(); forAll(T, facei) { @@ -568,25 +526,14 @@ Foam::heThermo<BasicThermo, MixtureType>::gamma() const { const fvMesh& mesh = this->T_.mesh(); - tmp<volScalarField> tgamma + auto tgamma = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "gamma", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh, - dimless - ) + "gamma", + IOobject::NO_REGISTER, + mesh, + dimless ); - - volScalarField& gamma = tgamma.ref(); + auto& gamma = tgamma.ref(); forAll(this->T_, celli) { @@ -624,8 +571,8 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::Cpv const label patchi ) const { - tmp<scalarField> tCpv(new scalarField(T.size())); - scalarField& Cpv = tCpv.ref(); + auto tCpv = tmp<scalarField>::New(T.size()); + auto& Cpv = tCpv.ref(); forAll(T, facei) { @@ -643,25 +590,14 @@ Foam::heThermo<BasicThermo, MixtureType>::Cpv() const { const fvMesh& mesh = this->T_.mesh(); - tmp<volScalarField> tCpv + auto tCpv = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Cpv", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh, - dimEnergy/dimMass/dimTemperature - ) + "Cpv", + IOobject::NO_REGISTER, + mesh, + dimEnergy/dimMass/dimTemperature ); - - volScalarField& Cpv = tCpv.ref(); + auto& Cpv = tCpv.ref(); forAll(this->T_, celli) { @@ -696,8 +632,8 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::CpByCpv const label patchi ) const { - tmp<scalarField> tCpByCpv(new scalarField(T.size())); - scalarField& CpByCpv = tCpByCpv.ref(); + auto tCpByCpv = tmp<scalarField>::New(T.size()); + auto& CpByCpv = tCpByCpv.ref(); forAll(T, facei) { @@ -715,25 +651,14 @@ Foam::heThermo<BasicThermo, MixtureType>::CpByCpv() const { const fvMesh& mesh = this->T_.mesh(); - tmp<volScalarField> tCpByCpv + auto tCpByCpv = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "CpByCpv", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh, - dimless - ) + "CpByCpv", + IOobject::NO_REGISTER, + mesh, + dimless ); - - volScalarField& CpByCpv = tCpByCpv.ref(); + auto& CpByCpv = tCpByCpv.ref(); forAll(this->T_, celli) { @@ -776,8 +701,8 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::THE const labelList& cells ) const { - tmp<scalarField> tT(new scalarField(h.size())); - scalarField& T = tT.ref(); + auto tT = tmp<scalarField>::New(h.size()); + auto& T = tT.ref(); forAll(h, celli) { @@ -799,8 +724,9 @@ Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::THE ) const { - tmp<scalarField> tT(new scalarField(h.size())); - scalarField& T = tT.ref(); + auto tT = tmp<scalarField>::New(h.size()); + auto& T = tT.ref(); + forAll(h, facei) { T[facei] = this->patchFaceMixture @@ -821,25 +747,15 @@ Foam::tmp<Foam::volScalarField> Foam::heThermo<BasicThermo, MixtureType>::W { const fvMesh& mesh = this->T_.mesh(); - tmp<volScalarField> tW + auto tW = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "W", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh, - dimMass/dimMoles - ) + "W", + IOobject::NO_REGISTER, + mesh, + dimMass/dimMoles ); + auto& W = tW.ref(); - volScalarField& W = tW.ref(); scalarField& WCells = W.primitiveFieldRef(); forAll(WCells, celli) @@ -847,7 +763,7 @@ Foam::tmp<Foam::volScalarField> Foam::heThermo<BasicThermo, MixtureType>::W WCells[celli] = this->cellMixture(celli).W(); } - volScalarField::Boundary& WBf = W.boundaryFieldRef(); + auto& WBf = W.boundaryFieldRef(); forAll(WBf, patchi) { diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo.C b/src/thermophysicalModels/basic/psiThermo/psiThermo.C index 82e14feb19e..871a795d683 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,11 +48,12 @@ Foam::psiThermo::psiThermo(const fvMesh& mesh, const word& phaseName) ( IOobject ( - phasePropertyName("thermo:psi"), + phaseScopedName("thermo", "psi"), mesh.time().timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimensionSet(0, -2, 2, 0, 0) @@ -62,11 +63,12 @@ Foam::psiThermo::psiThermo(const fvMesh& mesh, const word& phaseName) ( IOobject ( - phasePropertyName("thermo:mu"), + phaseScopedName("thermo", "mu"), mesh.time().timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimensionSet(1, -1, -1, 0, 0) @@ -87,11 +89,12 @@ Foam::psiThermo::psiThermo ( IOobject ( - phasePropertyName("thermo:psi"), + phaseScopedName("thermo", "psi"), mesh.time().timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimensionSet(0, -2, 2, 0, 0) @@ -101,11 +104,12 @@ Foam::psiThermo::psiThermo ( IOobject ( - phasePropertyName("thermo:mu"), + phaseScopedName("thermo", "mu"), mesh.time().timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimensionSet(1, -1, -1, 0, 0) diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C index 9ce5a2bd59c..074cccfde8f 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -47,11 +47,12 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const word& phaseName) ( IOobject ( - phasePropertyName("thermo:rho"), + phaseScopedName("thermo", "rho"), mesh.time().timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimDensity @@ -61,11 +62,12 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const word& phaseName) ( IOobject ( - phasePropertyName("thermo:psi"), + phaseScopedName("thermo", "psi"), mesh.time().timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimensionSet(0, -2, 2, 0, 0) @@ -75,11 +77,12 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const word& phaseName) ( IOobject ( - phasePropertyName("thermo:mu"), + phaseScopedName("thermo", "mu"), mesh.time().timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimensionSet(1, -1, -1, 0, 0) @@ -99,11 +102,12 @@ Foam::rhoThermo::rhoThermo ( IOobject ( - phasePropertyName("thermo:rho"), + phaseScopedName("thermo", "rho"), mesh.time().timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimDensity @@ -113,11 +117,12 @@ Foam::rhoThermo::rhoThermo ( IOobject ( - phasePropertyName("thermo:psi"), + phaseScopedName("thermo", "psi"), mesh.time().timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimensionSet(0, -2, 2, 0, 0) @@ -127,11 +132,12 @@ Foam::rhoThermo::rhoThermo ( IOobject ( - phasePropertyName("thermo:mu"), + phaseScopedName("thermo", "mu"), mesh.time().timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimensionSet(1, -1, -1, 0, 0) @@ -151,11 +157,12 @@ Foam::rhoThermo::rhoThermo ( IOobject ( - phasePropertyName("thermo:rho"), + phaseScopedName("thermo", "rho"), mesh.time().timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimDensity @@ -165,11 +172,12 @@ Foam::rhoThermo::rhoThermo ( IOobject ( - phasePropertyName("thermo:psi"), + phaseScopedName("thermo", "psi"), mesh.time().timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimensionSet(0, -2, 2, 0, 0) @@ -179,11 +187,12 @@ Foam::rhoThermo::rhoThermo ( IOobject ( - phasePropertyName("thermo:mu"), + phaseScopedName("thermo", "mu"), mesh.time().timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), mesh, dimensionSet(1, -1, -1, 0, 0) diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C index a306b2dadd4..03e1160b6ce 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2020-2021,2023 OpenCFD Ltd. + Copyright (C) 2020-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -470,25 +470,14 @@ template<class ReactionThermo, class ThermoType> Foam::tmp<Foam::volScalarField> Foam::StandardChemistryModel<ReactionThermo, ThermoType>::tc() const { - tmp<volScalarField> ttc + auto ttc = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "tc", - this->time().timeName(), - this->mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - this->mesh(), - dimensionedScalar(word::null, dimTime, SMALL), - fvPatchFieldBase::extrapolatedCalculatedType() - ) + "tc", + IOobject::NO_REGISTER, + this->mesh(), + dimensionedScalar(word::null, dimTime, SMALL), + fvPatchFieldBase::extrapolatedCalculatedType() ); - scalarField& tc = ttc.ref(); tmp<volScalarField> trho(this->thermo().rho()); @@ -544,22 +533,12 @@ template<class ReactionThermo, class ThermoType> Foam::tmp<Foam::volScalarField> Foam::StandardChemistryModel<ReactionThermo, ThermoType>::Qdot() const { - tmp<volScalarField> tQdot + auto tQdot = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Qdot", - this->mesh_.time().timeName(), - this->mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - this->mesh_, - dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero) - ) + "Qdot", + IOobject::NO_REGISTER, + this->mesh_, + dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero) ); if (this->chemistry_) @@ -592,24 +571,14 @@ Foam::StandardChemistryModel<ReactionThermo, ThermoType>::calculateRR scalar pf, cf, pr, cr; label lRef, rRef; - tmp<volScalarField::Internal> tRR + auto tRR = volScalarField::Internal::New ( - new volScalarField::Internal - ( - IOobject - ( - "RR", - this->mesh().time().timeName(), - this->mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - this->mesh(), - dimensionedScalar(dimMass/dimVolume/dimTime, Zero) - ) + "RR", + IOobject::NO_REGISTER, + this->mesh(), + dimensionedScalar(dimMass/dimVolume/dimTime, Zero) ); - - volScalarField::Internal& RR = tRR.ref(); + auto& RR = tRR.ref(); tmp<volScalarField> trho(this->thermo().rho()); const scalarField& rho = trho(); diff --git a/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.C b/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.C index d17d028d9ff..ddf47fb7f6b 100644 --- a/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.C +++ b/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.C @@ -112,25 +112,14 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::Gulders::Su0pTphi scalar phi ) const { - tmp<volScalarField> tSu0 + auto tSu0 = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Su0", - p.time().timeName(), - p.db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - p.mesh(), - dimensionedScalar(dimVelocity, Zero) - ) + "Su0", + IOobject::NO_REGISTER, + p.mesh(), + dimensionedScalar(dimVelocity, Zero) ); - - volScalarField& Su0 = tSu0.ref(); + auto& Su0 = tSu0.ref(); forAll(Su0, celli) { @@ -165,25 +154,14 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::Gulders::Su0pTphi const volScalarField& phi ) const { - tmp<volScalarField> tSu0 + auto tSu0 = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Su0", - p.time().timeName(), - p.db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - p.mesh(), - dimensionedScalar(dimVelocity, Zero) - ) + "Su0", + IOobject::NO_REGISTER, + p.mesh(), + dimensionedScalar(dimVelocity, Zero) ); - - volScalarField& Su0 = tSu0.ref(); + auto& Su0 = tSu0.ref(); forAll(Su0, celli) { diff --git a/src/thermophysicalModels/laminarFlameSpeed/GuldersEGR/GuldersEGR.C b/src/thermophysicalModels/laminarFlameSpeed/GuldersEGR/GuldersEGR.C index f3478e80b32..be2d86de451 100644 --- a/src/thermophysicalModels/laminarFlameSpeed/GuldersEGR/GuldersEGR.C +++ b/src/thermophysicalModels/laminarFlameSpeed/GuldersEGR/GuldersEGR.C @@ -112,25 +112,14 @@ Foam::laminarFlameSpeedModels::GuldersEGR::Su0pTphi scalar phi ) const { - tmp<volScalarField> tSu0 + auto tSu0 = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Su0", - p.time().timeName(), - p.db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - p.mesh(), - dimensionedScalar(dimVelocity, Zero) - ) + "Su0", + IOobject::NO_REGISTER, + p.mesh(), + dimensionedScalar(dimVelocity, Zero) ); - - volScalarField& Su0 = tSu0.ref(); + auto& Su0 = tSu0.ref(); forAll(Su0, celli) { @@ -167,25 +156,14 @@ Foam::laminarFlameSpeedModels::GuldersEGR::Su0pTphi const volScalarField& egr ) const { - tmp<volScalarField> tSu0 + auto tSu0 = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Su0", - p.time().timeName(), - p.db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - p.mesh(), - dimensionedScalar(dimVelocity, Zero) - ) + "Su0", + IOobject::NO_REGISTER, + p.mesh(), + dimensionedScalar(dimVelocity, Zero) ); - - volScalarField& Su0 = tSu0.ref(); + auto& Su0 = tSu0.ref(); forAll(Su0, celli) { diff --git a/src/thermophysicalModels/laminarFlameSpeed/RaviPetersen/RaviPetersen.C b/src/thermophysicalModels/laminarFlameSpeed/RaviPetersen/RaviPetersen.C index ac4df025296..3f248fe4cc3 100644 --- a/src/thermophysicalModels/laminarFlameSpeed/RaviPetersen/RaviPetersen.C +++ b/src/thermophysicalModels/laminarFlameSpeed/RaviPetersen/RaviPetersen.C @@ -295,15 +295,7 @@ Foam::laminarFlameSpeedModels::RaviPetersen::operator()() const volScalarField EqR ( - IOobject - ( - "EqR", - p.time().timeName(), - p.db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + p.db().newIOobject("EqR"), p.mesh(), dimensionedScalar(dimless, Zero) ); @@ -323,25 +315,14 @@ Foam::laminarFlameSpeedModels::RaviPetersen::operator()() const EqR = equivalenceRatio_; } - tmp<volScalarField> tSu0 + auto tSu0 = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Su0", - p.time().timeName(), - p.db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - p.mesh(), - dimensionedScalar(dimVelocity, Zero) - ) + "Su0", + IOobject::NO_REGISTER, + p.mesh(), + dimensionedScalar(dimVelocity, Zero) ); - - volScalarField& Su0 = tSu0.ref(); + auto& Su0 = tSu0.ref(); forAll(Su0, celli) { diff --git a/src/thermophysicalModels/laminarFlameSpeed/constant/constant.C b/src/thermophysicalModels/laminarFlameSpeed/constant/constant.C index 2f098910220..351a7b9c32c 100644 --- a/src/thermophysicalModels/laminarFlameSpeed/constant/constant.C +++ b/src/thermophysicalModels/laminarFlameSpeed/constant/constant.C @@ -71,22 +71,12 @@ Foam::laminarFlameSpeedModels::constant::~constant() Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::constant::operator()() const { - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Su0", - psiuReactionThermo_.T().time().timeName(), - psiuReactionThermo_.T().db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - psiuReactionThermo_.T().mesh(), - Su_ - ) + "Su0", + IOobject::NO_REGISTER, + psiuReactionThermo_.T().mesh(), + Su_ ); } diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C index 16ec7886561..c5d3d5ff61c 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C @@ -158,7 +158,7 @@ updateCoeffs() Foam::tmp<Foam::scalarField> Foam::radiation:: greyDiffusiveViewFactorFixedValueFvPatchScalarField::qro(label bandI) const { - tmp<scalarField> tqrt(new scalarField(qro_)); + auto tqrt = tmp<scalarField>::New(qro_); const viewFactor& radiation = db().lookupObject<viewFactor>("radiationProperties"); diff --git a/src/thermophysicalModels/radiation/radiationModels/P1/P1.C b/src/thermophysicalModels/radiation/radiationModels/P1/P1.C index 4df1c317a5f..fa7214960d3 100644 --- a/src/thermophysicalModels/radiation/radiationModels/P1/P1.C +++ b/src/thermophysicalModels/radiation/radiationModels/P1/P1.C @@ -215,18 +215,13 @@ void Foam::radiation::P1::calculate() const dimensionedScalar a0("a0", a_.dimensions(), ROOTVSMALL); // Construct diffusion - const volScalarField gamma + const auto tgamma = volScalarField::New ( - IOobject - ( - "gammaRad", - G_.mesh().time().timeName(), - G_.mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "gammaRad", + IOobject::REGISTER, // used by boundary conditions 1.0/(3.0*a_ + sigmaEff + a0) ); + const auto& gamma = tgamma(); // Solve G transport equation solve @@ -254,21 +249,11 @@ void Foam::radiation::P1::calculate() Foam::tmp<Foam::volScalarField> Foam::radiation::P1::Rp() const { - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Rp", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - 4.0*absorptionEmission_->eCont()*physicoChemical::sigma - ) + "Rp", + IOobject::NO_REGISTER, + 4.0*absorptionEmission_->eCont()*physicoChemical::sigma ); } diff --git a/src/thermophysicalModels/radiation/radiationModels/fvDOM/blackBodyEmission/blackBodyEmission.C b/src/thermophysicalModels/radiation/radiationModels/fvDOM/blackBodyEmission/blackBodyEmission.C index 0195a01d691..753b7fc0cf9 100644 --- a/src/thermophysicalModels/radiation/radiationModels/fvDOM/blackBodyEmission/blackBodyEmission.C +++ b/src/thermophysicalModels/radiation/radiationModels/fvDOM/blackBodyEmission/blackBodyEmission.C @@ -201,21 +201,12 @@ Foam::radiation::blackBodyEmission::deltaLambdaT const Vector2D<scalar>& band ) const { - tmp<volScalarField> deltaLambdaT + auto deltaLambdaT = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "deltaLambdaT", - T.mesh().time().timeName(), - T.mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - T.mesh(), - dimensionedScalar("deltaLambdaT", dimless, 1.0) - ) + "deltaLambdaT", + IOobject::NO_REGISTER, + T.mesh(), + dimensionedScalar("deltaLambdaT", dimless, 1.0) ); if (band != Vector2D<scalar>::one) @@ -239,20 +230,11 @@ Foam::radiation::blackBodyEmission::EbDeltaLambdaT const Vector2D<scalar>& band ) const { - tmp<volScalarField> Eb + auto Eb = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Eb", - T.mesh().time().timeName(), - T.mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - physicoChemical::sigma*pow4(T) - ) + "Eb", + IOobject::NO_REGISTER, + physicoChemical::sigma*pow4(T) ); if (band != Vector2D<scalar>::one) diff --git a/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C b/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C index e7aabf242ad..234489340e1 100644 --- a/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C +++ b/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2018 OpenFOAM Foundation - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -356,7 +356,8 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T) mesh_.time().timeName(), mesh_, IOobject::NO_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh_, dimensionedScalar(dimMass/pow3(dimTime), Zero) @@ -369,7 +370,8 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T) mesh_.time().timeName(), mesh_, IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh_, dimensionedScalar(dimMass/pow3(dimTime), Zero) @@ -395,7 +397,8 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T) mesh_.time().timeName(), mesh_, IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh_, dimensionedScalar(dimMass/pow3(dimTime), Zero) @@ -462,7 +465,8 @@ Foam::radiation::fvDOM::fvDOM mesh_.time().timeName(), mesh_, IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh_, dimensionedScalar(dimMass/pow3(dimTime), Zero) @@ -475,7 +479,8 @@ Foam::radiation::fvDOM::fvDOM mesh_.time().timeName(), mesh_, IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh_, dimensionedScalar(dimMass/pow3(dimTime), Zero) @@ -501,7 +506,8 @@ Foam::radiation::fvDOM::fvDOM mesh_.time().timeName(), mesh_, IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh_, dimensionedScalar(dimMass/pow3(dimTime), Zero) @@ -645,29 +651,18 @@ void Foam::radiation::fvDOM::calculate() Foam::tmp<Foam::volScalarField> Foam::radiation::fvDOM::Rp() const { // Construct using contribution from first frequency band - tmp<volScalarField> tRp + auto tRp = volScalarField::New ( - new volScalarField + "Rp", + IOobject::NO_REGISTER, ( - IOobject - ( - "Rp", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - ( - 4 - *physicoChemical::sigma - *(aLambda_[0] - absorptionEmission_->aDisp(0)()) - *blackBody_.deltaLambdaT(T_, absorptionEmission_->bands(0)) - ) + 4 + * physicoChemical::sigma + * (aLambda_[0] - absorptionEmission_->aDisp(0)()) + * blackBody_.deltaLambdaT(T_, absorptionEmission_->bands(0)) ) ); - - volScalarField& Rp=tRp.ref(); + auto& Rp = tRp.ref(); // Add contributions over remaining frequency bands for (label j=1; j < nLambda_; j++) @@ -688,25 +683,14 @@ Foam::tmp<Foam::volScalarField> Foam::radiation::fvDOM::Rp() const Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>> Foam::radiation::fvDOM::Ru() const { - tmp<DimensionedField<scalar, volMesh>> tRu + auto tRu = DimensionedField<scalar, volMesh>::New ( - new DimensionedField<scalar, volMesh> - ( - IOobject - ( - "Ru", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh_, - dimensionedScalar(dimensionSet(1, -1, -3, 0, 0), Zero) - ) + "Ru", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(dimensionSet(1, -1, -3, 0, 0), Zero) ); - - DimensionedField<scalar, volMesh>& Ru=tRu.ref(); + auto& Ru = tRu.ref(); // Sum contributions over all frequency bands for (label j=0; j < nLambda_; j++) diff --git a/src/thermophysicalModels/radiation/radiationModels/noRadiation/noRadiation.C b/src/thermophysicalModels/radiation/radiationModels/noRadiation/noRadiation.C index ec998448ed7..ae93e29668e 100644 --- a/src/thermophysicalModels/radiation/radiationModels/noRadiation/noRadiation.C +++ b/src/thermophysicalModels/radiation/radiationModels/noRadiation/noRadiation.C @@ -82,16 +82,10 @@ void Foam::radiation::noRadiation::calculate() Foam::tmp<Foam::volScalarField> Foam::radiation::noRadiation::Rp() const { - return tmp<volScalarField>::New + return volScalarField::New ( - IOobject - ( - "Rp", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "Rp", + IOobject::NO_REGISTER, mesh_, dimensionedScalar ( @@ -104,16 +98,10 @@ Foam::tmp<Foam::volScalarField> Foam::radiation::noRadiation::Rp() const Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>> Foam::radiation::noRadiation::Ru() const { - return tmp<volScalarField::Internal>::New + return volScalarField::Internal::New ( - IOobject - ( - "Ru", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "Ru", + IOobject::NO_REGISTER, mesh_, dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) ); diff --git a/src/thermophysicalModels/radiation/radiationModels/opaqueSolid/opaqueSolid.C b/src/thermophysicalModels/radiation/radiationModels/opaqueSolid/opaqueSolid.C index 4fd40720a2c..b99907d232a 100644 --- a/src/thermophysicalModels/radiation/radiationModels/opaqueSolid/opaqueSolid.C +++ b/src/thermophysicalModels/radiation/radiationModels/opaqueSolid/opaqueSolid.C @@ -83,16 +83,10 @@ void Foam::radiation::opaqueSolid::calculate() Foam::tmp<Foam::volScalarField> Foam::radiation::opaqueSolid::Rp() const { - return tmp<volScalarField>::New + return volScalarField::New ( - IOobject - ( - "Rp", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "Rp", + IOobject::NO_REGISTER, mesh_, dimensionedScalar ( @@ -105,16 +99,10 @@ Foam::tmp<Foam::volScalarField> Foam::radiation::opaqueSolid::Rp() const Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>> Foam::radiation::opaqueSolid::Ru() const { - return tmp<volScalarField::Internal>::New + return volScalarField::Internal::New ( - IOobject - ( - "Ru", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "Ru", + IOobject::NO_REGISTER, mesh_, dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) ); @@ -126,4 +114,5 @@ Foam::label Foam::radiation::opaqueSolid::nBands() const return absorptionEmission_->nBands(); } + // ************************************************************************* // diff --git a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C index 0980bc0b724..32fa503e548 100644 --- a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C +++ b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceReflecting/faceReflecting.C @@ -58,7 +58,8 @@ void Foam::faceReflecting::initialise(const dictionary& coeffs) mesh_.time().timeName(), mesh_, IOobject::NO_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh_, dimensionedScalar(dimMass/pow3(dimTime), Zero) @@ -393,17 +394,8 @@ void Foam::faceReflecting::calculate() PtrList<List<scalarField>> patcha(patches.size()); forAll(patchr, patchi) { - patchr.set - ( - patchi, - new List<scalarField>(nBands) - ); - - patcha.set - ( - patchi, - new List<scalarField>(nBands) - ); + patchr.emplace_set(patchi, nBands); + patcha.emplace_set(patchi, nBands); } // Fill patchr diff --git a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C index d415b9c0303..7310b71551b 100644 --- a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C +++ b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C @@ -214,22 +214,15 @@ void Foam::faceShading::calculate() if (debug) { - auto thitFaces = tmp<surfaceScalarField>::New + auto thitFaces = surfaceScalarField::New ( - IOobject - ( - "hitFaces", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + "hitFaces", + IOobject::NO_REGISTER, mesh_, dimensionedScalar(dimless, Zero) ); + auto& hitFaces = thitFaces.ref(); - surfaceScalarField& hitFaces = thitFaces.ref(); surfaceScalarField::Boundary& hitFacesBf = hitFaces.boundaryFieldRef(); hitFacesBf = 0.0; diff --git a/src/thermophysicalModels/radiation/radiationModels/solarLoad/solarLoad.C b/src/thermophysicalModels/radiation/radiationModels/solarLoad/solarLoad.C index ef13824206f..503a7489ce9 100644 --- a/src/thermophysicalModels/radiation/radiationModels/solarLoad/solarLoad.C +++ b/src/thermophysicalModels/radiation/radiationModels/solarLoad/solarLoad.C @@ -911,17 +911,10 @@ void Foam::radiation::solarLoad::calculate() Foam::tmp<Foam::volScalarField> Foam::radiation::solarLoad::Rp() const { - return tmp<volScalarField>::New + return volScalarField::New ( - IOobject - ( - "Rp", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + "Rp", + IOobject::NO_REGISTER, mesh_, dimensionedScalar ( diff --git a/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C b/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C index 63c0aa70af0..9a1e62068d1 100644 --- a/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C +++ b/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C @@ -1133,17 +1133,10 @@ void Foam::radiation::viewFactor::calculate() Foam::tmp<Foam::volScalarField> Foam::radiation::viewFactor::Rp() const { - return tmp<volScalarField>::New + return volScalarField::New ( - IOobject - ( - "Rp", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + "Rp", + IOobject::NO_REGISTER, mesh_, dimensionedScalar ( @@ -1156,17 +1149,10 @@ Foam::tmp<Foam::volScalarField> Foam::radiation::viewFactor::Rp() const Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>> Foam::radiation::viewFactor::Ru() const { - return tmp<DimensionedField<scalar, volMesh>>::New + return DimensionedField<scalar, volMesh>::New ( - IOobject - ( - "Ru", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + "Ru", + IOobject::NO_REGISTER, mesh_, dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) ); diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/absorptionEmissionModel/absorptionEmissionModel.C b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/absorptionEmissionModel/absorptionEmissionModel.C index f9f78d2d2d4..10870b66603 100644 --- a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/absorptionEmissionModel/absorptionEmissionModel.C +++ b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/absorptionEmissionModel/absorptionEmissionModel.C @@ -69,22 +69,12 @@ Foam::radiation::absorptionEmissionModel::a(const label bandI) const Foam::tmp<Foam::volScalarField> Foam::radiation::absorptionEmissionModel::aCont(const label bandI) const { - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "aCont", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh_, - dimensionedScalar(dimless/dimLength, Zero) - ) + "aCont", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(dimless/dimLength, Zero) ); } @@ -92,22 +82,12 @@ Foam::radiation::absorptionEmissionModel::aCont(const label bandI) const Foam::tmp<Foam::volScalarField> Foam::radiation::absorptionEmissionModel::aDisp(const label bandI) const { - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "aDisp", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh_, - dimensionedScalar(dimless/dimLength, Zero) - ) + "aDisp", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(dimless/dimLength, Zero) ); } @@ -122,22 +102,12 @@ Foam::radiation::absorptionEmissionModel::e(const label bandI) const Foam::tmp<Foam::volScalarField> Foam::radiation::absorptionEmissionModel::eCont(const label bandI) const { - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "eCont", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh_, - dimensionedScalar(dimless/dimLength, Zero) - ) + "eCont", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(dimless/dimLength, Zero) ); } @@ -145,22 +115,12 @@ Foam::radiation::absorptionEmissionModel::eCont(const label bandI) const Foam::tmp<Foam::volScalarField> Foam::radiation::absorptionEmissionModel::eDisp(const label bandI) const { - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "eDisp", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh_, - dimensionedScalar(dimless/dimLength, Zero) - ) + "eDisp", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(dimless/dimLength, Zero) ); } @@ -175,22 +135,12 @@ Foam::radiation::absorptionEmissionModel::E(const label bandI) const Foam::tmp<Foam::volScalarField> Foam::radiation::absorptionEmissionModel::ECont(const label bandI) const { - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "ECont", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh_, - dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) - ) + "ECont", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) ); } @@ -198,22 +148,12 @@ Foam::radiation::absorptionEmissionModel::ECont(const label bandI) const Foam::tmp<Foam::volScalarField> Foam::radiation::absorptionEmissionModel::EDisp(const label bandI) const { - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "EDisp", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh_, - dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) - ) + "EDisp", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) ); } diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/constantAbsorptionEmission/constantAbsorptionEmission.C b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/constantAbsorptionEmission/constantAbsorptionEmission.C index c3f0af471af..5d3642c10e1 100644 --- a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/constantAbsorptionEmission/constantAbsorptionEmission.C +++ b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/constantAbsorptionEmission/constantAbsorptionEmission.C @@ -67,75 +67,39 @@ Foam::radiation::constantAbsorptionEmission::constantAbsorptionEmission Foam::tmp<Foam::volScalarField> Foam::radiation::constantAbsorptionEmission::aCont(const label bandI) const { - tmp<volScalarField> ta + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "a", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh_, - a_ - ) + "a", + IOobject::NO_REGISTER, + mesh_, + a_ ); - - return ta; } Foam::tmp<Foam::volScalarField> Foam::radiation::constantAbsorptionEmission::eCont(const label bandI) const { - tmp<volScalarField> te + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "e", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh_, - e_ - ) + "e", + IOobject::NO_REGISTER, + mesh_, + e_ ); - - return te; } Foam::tmp<Foam::volScalarField> Foam::radiation::constantAbsorptionEmission::ECont(const label bandI) const { - tmp<volScalarField> tE + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "E", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh_, - E_ - ) + "E", + IOobject::NO_REGISTER, + mesh_, + E_ ); - - return tE; } diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.C b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.C index 7aca57b9221..b2262349692 100644 --- a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.C +++ b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.C @@ -194,25 +194,15 @@ Foam::radiation::greyMeanAbsorptionEmission::aCont(const label bandI) const const volScalarField& p = thermo_.p(); - tmp<volScalarField> ta + auto ta = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "aCont" + name(bandI), - mesh().time().timeName(), - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh(), - dimensionedScalar(dimless/dimLength, Zero), - fvPatchFieldBase::extrapolatedCalculatedType() - ) + "aCont" + name(bandI), + IOobject::NO_REGISTER, + mesh(), + dimensionedScalar(dimless/dimLength, Zero), + fvPatchFieldBase::extrapolatedCalculatedType() ); - - scalarField& a = ta.ref().primitiveFieldRef(); + auto& a = ta.ref().primitiveFieldRef(); forAll(a, celli) { @@ -275,21 +265,12 @@ Foam::radiation::greyMeanAbsorptionEmission::eCont(const label bandI) const Foam::tmp<Foam::volScalarField> Foam::radiation::greyMeanAbsorptionEmission::ECont(const label bandI) const { - tmp<volScalarField> E + auto E = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "ECont" + name(bandI), - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) - ) + "ECont" + name(bandI), + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) ); const volScalarField* QdotPtr = mesh_.findObject<volScalarField>("Qdot"); diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C index b4fc2fc4253..310ea6f2f22 100644 --- a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C +++ b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C @@ -56,11 +56,11 @@ greyMeanSolidAbsorptionEmission::X(const word specie) const const volScalarField& T = thermo_.T(); const volScalarField& p = thermo_.p(); - tmp<scalarField> tXj(new scalarField(T.primitiveField().size(), Zero)); - scalarField& Xj = tXj.ref(); + auto tXj = tmp<scalarField>::New(T.primitiveField().size(), Zero); + auto& Xj = tXj.ref(); - tmp<scalarField> tRhoInv(new scalarField(T.primitiveField().size(), Zero)); - scalarField& rhoInv = tRhoInv.ref(); + auto tRhoInv = tmp<scalarField>::New(T.primitiveField().size(), Zero); + auto& rhoInv = tRhoInv.ref(); forAll(mixture_.Y(), specieI) { @@ -142,25 +142,15 @@ Foam::tmp<Foam::volScalarField> Foam::radiation::greyMeanSolidAbsorptionEmission:: calc(const label propertyId) const { - tmp<volScalarField> ta + auto ta = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "a", - mesh().time().timeName(), - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh(), - dimensionedScalar(dimless/dimLength, Zero), - fvPatchFieldBase::extrapolatedCalculatedType() - ) + "a", + IOobject::NO_REGISTER, + mesh(), + dimensionedScalar(dimless/dimLength, Zero), + fvPatchFieldBase::extrapolatedCalculatedType() ); - - scalarField& a = ta.ref().primitiveFieldRef(); + auto& a = ta.ref().primitiveFieldRef(); forAllConstIters(speciesNames_, iter) { @@ -194,4 +184,5 @@ Foam::radiation::greyMeanSolidAbsorptionEmission::aCont return calc(absorptivity); } + // ************************************************************************* // diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandAbsorptionEmission/multiBandAbsorptionEmission.C b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandAbsorptionEmission/multiBandAbsorptionEmission.C index c7c3199f47e..deb4da3b47d 100644 --- a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandAbsorptionEmission/multiBandAbsorptionEmission.C +++ b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandAbsorptionEmission/multiBandAbsorptionEmission.C @@ -81,24 +81,13 @@ Foam::radiation::multiBandAbsorptionEmission::aCont const label bandI ) const { - tmp<volScalarField> ta + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "a", - mesh().time().timeName(), - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh(), - dimensionedScalar("a", dimless/dimLength, absCoeffs_[bandI]) - ) + "a", + IOobject::NO_REGISTER, + mesh(), + dimensionedScalar("a", dimless/dimLength, absCoeffs_[bandI]) ); - - return ta; } @@ -108,24 +97,13 @@ Foam::radiation::multiBandAbsorptionEmission::eCont const label bandI ) const { - tmp<volScalarField> te + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "e", - mesh().time().timeName(), - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh(), - dimensionedScalar("e", dimless/dimLength, emiCoeffs_[bandI]) - ) + "e", + IOobject::NO_REGISTER, + mesh(), + dimensionedScalar("e", dimless/dimLength, emiCoeffs_[bandI]) ); - - return te; } @@ -135,24 +113,13 @@ Foam::radiation::multiBandAbsorptionEmission::ECont const label bandI ) const { - tmp<volScalarField> E + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "E", - mesh().time().timeName(), - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh(), - dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) - ) + "E", + IOobject::NO_REGISTER, + mesh(), + dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) ); - - return E; } diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandZoneAbsorptionEmission/multiBandZoneAbsorptionEmission.C b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandZoneAbsorptionEmission/multiBandZoneAbsorptionEmission.C index 8c02bb90bcf..44a7171bb3d 100644 --- a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandZoneAbsorptionEmission/multiBandZoneAbsorptionEmission.C +++ b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandZoneAbsorptionEmission/multiBandZoneAbsorptionEmission.C @@ -108,23 +108,13 @@ Foam::radiation::multiBandZoneAbsorptionEmission::aCont const label bandI ) const { - tmp<volScalarField> ta + auto ta = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "a", - mesh().time().timeName(), - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh(), - dimensionedScalar("a", dimless/dimLength, absCoeffs_[bandI]) - ) + "a", + IOobject::NO_REGISTER, + mesh(), + dimensionedScalar("a", dimless/dimLength, absCoeffs_[bandI]) ); - scalarField& a = ta.ref().primitiveFieldRef(); for (const label zonei : zoneIds_) @@ -150,23 +140,13 @@ Foam::radiation::multiBandZoneAbsorptionEmission::eCont const label bandI ) const { - tmp<volScalarField> te + auto te = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "e", - mesh().time().timeName(), - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh(), - dimensionedScalar("e", dimless/dimLength, emiCoeffs_[bandI]) - ) + "e", + IOobject::NO_REGISTER, + mesh(), + dimensionedScalar("e", dimless/dimLength, emiCoeffs_[bandI]) ); - scalarField& e = te.ref().primitiveFieldRef(); for (const label zonei : zoneIds_) @@ -192,24 +172,13 @@ Foam::radiation::multiBandZoneAbsorptionEmission::ECont const label bandI ) const { - tmp<volScalarField> E + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "E", - mesh().time().timeName(), - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh(), - dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) - ) + "E", + IOobject::NO_REGISTER, + mesh(), + dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) ); - - return E; } diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/wideBandAbsorptionEmission/wideBandAbsorptionEmission.C b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/wideBandAbsorptionEmission/wideBandAbsorptionEmission.C index 084cd0284fa..3eb8adc9e59 100644 --- a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/wideBandAbsorptionEmission/wideBandAbsorptionEmission.C +++ b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/wideBandAbsorptionEmission/wideBandAbsorptionEmission.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2018 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -206,23 +206,13 @@ Foam::radiation::wideBandAbsorptionEmission::aCont(const label bandi) const const volScalarField& T = thermo_.T(); const volScalarField& p = thermo_.p(); - tmp<volScalarField> ta + auto ta = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "a", - mesh().time().timeName(), - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh(), - dimensionedScalar(dimless/dimLength, Zero) - ) + "a", + IOobject::NO_REGISTER, + mesh(), + dimensionedScalar(dimless/dimLength, Zero) ); - scalarField& a = ta.ref().primitiveFieldRef(); forAll(a, celli) @@ -290,21 +280,12 @@ Foam::radiation::wideBandAbsorptionEmission::eCont(const label bandi) const Foam::tmp<Foam::volScalarField> Foam::radiation::wideBandAbsorptionEmission::ECont(const label bandi) const { - tmp<volScalarField> E + auto E = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "E", - mesh().time().timeName(), - mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh(), - dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) - ) + "E", + IOobject::NO_REGISTER, + mesh(), + dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) ); const volScalarField* QdotPtr = mesh().findObject<volScalarField>("Qdot"); diff --git a/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationProperties.C b/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationProperties.C index e6201ee327f..7092f15b49f 100644 --- a/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationProperties.C +++ b/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationProperties.C @@ -209,7 +209,7 @@ Foam::radiation::boundaryRadiationProperties::emissivity << "Please add it" << exit(FatalError); - return tmp<scalarField>::New(); + return nullptr; } @@ -262,13 +262,13 @@ Foam::radiation::boundaryRadiationProperties::absorptivity ); } - FatalErrorInFunction - << "Patch : " << mesh().boundaryMesh()[patchi].name() - << " is not found in the boundaryRadiationProperties. " - << "Please add it" - << exit(FatalError); + FatalErrorInFunction + << "Patch : " << mesh().boundaryMesh()[patchi].name() + << " is not found in the boundaryRadiationProperties. " + << "Please add it" + << exit(FatalError); - return tmp<scalarField>::New(); + return nullptr; } @@ -327,7 +327,7 @@ Foam::radiation::boundaryRadiationProperties::transmissivity << "Please add it" << exit(FatalError); - return tmp<scalarField>::New(); + return nullptr; } @@ -389,12 +389,12 @@ Foam::radiation::boundaryRadiationProperties::zoneTransmissivity } FatalErrorInFunction - << "Zone : " << mesh().faceZones()[zonei].name() - << " is not found in the boundaryRadiationProperties. " - << "Please add it" - << exit(FatalError); + << "Zone : " << mesh().faceZones()[zonei].name() + << " is not found in the boundaryRadiationProperties. " + << "Please add it" + << exit(FatalError); - return tmp<scalarField>::New(); + return nullptr; } @@ -423,7 +423,7 @@ Foam::radiation::boundaryRadiationProperties::diffReflectivity << "Please add it" << exit(FatalError); - return tmp<scalarField>::New(); + return nullptr; } @@ -482,7 +482,7 @@ Foam::radiation::boundaryRadiationProperties::specReflectivity << "Please add it" << exit(FatalError); - return tmp<scalarField>::New(); + return nullptr; } diff --git a/src/thermophysicalModels/radiation/submodels/scatterModel/constantScatter/constantScatter.C b/src/thermophysicalModels/radiation/submodels/scatterModel/constantScatter/constantScatter.C index 666af9dc28a..c14bdc79dc0 100644 --- a/src/thermophysicalModels/radiation/submodels/scatterModel/constantScatter/constantScatter.C +++ b/src/thermophysicalModels/radiation/submodels/scatterModel/constantScatter/constantScatter.C @@ -66,22 +66,12 @@ Foam::radiation::constantScatter::constantScatter Foam::tmp<Foam::volScalarField> Foam::radiation::constantScatter::sigmaEff() const { - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "sigma", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh_, - sigma_*(3.0 - C_) - ) + "sigma", + IOobject::NO_REGISTER, + mesh_, + sigma_*(3.0 - C_) ); } diff --git a/src/thermophysicalModels/radiation/submodels/scatterModel/noScatter/noScatter.C b/src/thermophysicalModels/radiation/submodels/scatterModel/noScatter/noScatter.C index cc7f40c745f..8d9d1f09b64 100644 --- a/src/thermophysicalModels/radiation/submodels/scatterModel/noScatter/noScatter.C +++ b/src/thermophysicalModels/radiation/submodels/scatterModel/noScatter/noScatter.C @@ -56,22 +56,12 @@ Foam::radiation::noScatter::noScatter Foam::tmp<Foam::volScalarField> Foam::radiation::noScatter::sigmaEff() const { - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "sigma", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh_, - dimensionedScalar(dimless/dimLength, Zero) - ) + "sigma", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(dimless/dimLength, Zero) ); } diff --git a/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/constantAbsorption/constantAbsorption.C b/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/constantAbsorption/constantAbsorption.C index 5b9d6ab769f..188d7ee6525 100644 --- a/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/constantAbsorption/constantAbsorption.C +++ b/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/constantAbsorption/constantAbsorption.C @@ -70,7 +70,7 @@ Foam::tmp<Foam::scalarField> Foam::radiation::constantAbsorption::a scalarField* T ) const { - return tmp<scalarField>(new scalarField(pp_.size(), a_)); + return tmp<scalarField>::New(pp_.size(), a_); } @@ -93,7 +93,7 @@ Foam::tmp<Foam::scalarField> Foam::radiation::constantAbsorption::e scalarField* T ) const { - return tmp<scalarField>(new scalarField(pp_.size(), e_)); + return tmp<scalarField>::New(pp_.size(), e_); } diff --git a/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/multiBandAbsorption/multiBandAbsorption.C b/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/multiBandAbsorption/multiBandAbsorption.C index 82f8f824e7a..6971d9b4234 100644 --- a/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/multiBandAbsorption/multiBandAbsorption.C +++ b/src/thermophysicalModels/radiation/submodels/wallAbsorptionEmissionModel/multiBandAbsorption/multiBandAbsorption.C @@ -82,7 +82,7 @@ Foam::radiation::multiBandAbsorption::a scalarField* T ) const { - return tmp<scalarField>(new scalarField(pp_.size(), aCoeffs_[bandI])); + return tmp<scalarField>::New(pp_.size(), aCoeffs_[bandI]); } Foam::scalar Foam::radiation::multiBandAbsorption::a @@ -104,7 +104,7 @@ Foam::tmp<Foam::scalarField> Foam::radiation::multiBandAbsorption::e scalarField* T ) const { - return tmp<scalarField>(new scalarField(pp_.size(), eCoeffs_[bandI])); + return tmp<scalarField>::New(pp_.size(), eCoeffs_[bandI]); } diff --git a/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.C index 7a33d69695d..f9f8bef58cd 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.C @@ -98,7 +98,8 @@ Foam::basicMultiComponentMixture::basicMultiComponentMixture mesh.time().timeName(), mesh, IOobject::MUST_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::NO_REGISTER ); IOobject constantIO diff --git a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C index 738cde1275e..cf05a7c24bc 100644 --- a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C +++ b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C @@ -253,7 +253,8 @@ Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::heheuPsiThermo mesh.time().timeName(), mesh, IOobject::MUST_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh ), @@ -328,7 +329,8 @@ Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::heheuPsiThermo mesh.time().timeName(), mesh, IOobject::MUST_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh ), @@ -429,8 +431,8 @@ Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::heu const labelList& cells ) const { - tmp<scalarField> theu(new scalarField(Tu.size())); - scalarField& heu = theu.ref(); + auto theu = tmp<scalarField>::New(Tu.size()); + auto& heu = theu.ref(); forAll(Tu, celli) { @@ -450,8 +452,8 @@ Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::heu const label patchi ) const { - tmp<scalarField> theu(new scalarField(Tu.size())); - scalarField& heu = theu.ref(); + auto theu = tmp<scalarField>::New(Tu.size()); + auto& heu = theu.ref(); forAll(Tu, facei) { @@ -467,24 +469,14 @@ template<class BasicPsiThermo, class MixtureType> Foam::tmp<Foam::volScalarField> Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::Tb() const { - tmp<volScalarField> tTb + auto tTb = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Tb", - this->T_.time().timeName(), - this->T_.db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - this->T_ - ) + "Tb", + IOobject::NO_REGISTER, + this->T_ ); + auto& Tb_ = tTb.ref(); - volScalarField& Tb_ = tTb.ref(); scalarField& TbCells = Tb_.primitiveFieldRef(); const scalarField& pCells = this->p_; const scalarField& TCells = this->T_; @@ -526,25 +518,15 @@ template<class BasicPsiThermo, class MixtureType> Foam::tmp<Foam::volScalarField> Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::psiu() const { - tmp<volScalarField> tpsiu + auto tpsiu = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "psiu", - this->psi_.time().timeName(), - this->psi_.db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - this->psi_.mesh(), - this->psi_.dimensions() - ) + "psiu", + IOobject::NO_REGISTER, + this->psi_.mesh(), + this->psi_.dimensions() ); + auto& psiu = tpsiu.ref(); - volScalarField& psiu = tpsiu.ref(); scalarField& psiuCells = psiu.primitiveFieldRef(); const scalarField& TuCells = this->Tu_; const scalarField& pCells = this->p_; @@ -580,25 +562,15 @@ template<class BasicPsiThermo, class MixtureType> Foam::tmp<Foam::volScalarField> Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::psib() const { - tmp<volScalarField> tpsib + auto tpsib = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "psib", - this->psi_.time().timeName(), - this->psi_.db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - this->psi_.mesh(), - this->psi_.dimensions() - ) + "psib", + IOobject::NO_REGISTER, + this->psi_.mesh(), + this->psi_.dimensions() ); + auto& psib = tpsib.ref(); - volScalarField& psib = tpsib.ref(); scalarField& psibCells = psib.primitiveFieldRef(); const volScalarField Tb_(Tb()); const scalarField& TbCells = Tb_; @@ -635,25 +607,15 @@ template<class BasicPsiThermo, class MixtureType> Foam::tmp<Foam::volScalarField> Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::muu() const { - tmp<volScalarField> tmuu + auto tmuu = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "muu", - this->T_.time().timeName(), - this->T_.db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - this->T_.mesh(), - dimensionSet(1, -1, -1, 0, 0) - ) + "muu", + IOobject::NO_REGISTER, + this->T_.mesh(), + dimensionSet(1, -1, -1, 0, 0) ); + auto& muu_ = tmuu.ref(); - volScalarField& muu_ = tmuu.ref(); scalarField& muuCells = muu_.primitiveFieldRef(); const scalarField& pCells = this->p_; const scalarField& TuCells = this->Tu_; @@ -693,25 +655,15 @@ template<class BasicPsiThermo, class MixtureType> Foam::tmp<Foam::volScalarField> Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::mub() const { - tmp<volScalarField> tmub + auto tmub = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "mub", - this->T_.time().timeName(), - this->T_.db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - this->T_.mesh(), - dimensionSet(1, -1, -1, 0, 0) - ) + "mub", + IOobject::NO_REGISTER, + this->T_.mesh(), + dimensionSet(1, -1, -1, 0, 0) ); + auto& mub_ = tmub.ref(); - volScalarField& mub_ = tmub.ref(); scalarField& mubCells = mub_.primitiveFieldRef(); const volScalarField Tb_(Tb()); const scalarField& pCells = this->p_; diff --git a/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.C b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.C index cda0d2ec763..2901ab58e07 100644 --- a/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.C +++ b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -621,25 +621,14 @@ Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::gasHs const label index ) const { - tmp<volScalarField> tHs + auto tHs = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Hs_" + pyrolisisGases_[index], - this->mesh_.time().timeName(), - this->mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - this->mesh_, - dimensionedScalar(dimEnergy/dimMass, Zero) - ) + "Hs_" + pyrolisisGases_[index], + IOobject::NO_REGISTER, + this->mesh_, + dimensionedScalar(dimEnergy/dimMass, Zero) ); - - volScalarField::Internal& gasHs = tHs.ref(); + auto& gasHs = tHs.ref(); const GasThermo& mixture = gasThermo_[index]; diff --git a/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModelI.H b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModelI.H index 5029c4b0f4d..742f0e99d4b 100644 --- a/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModelI.H +++ b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModelI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -81,26 +82,17 @@ inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>> Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>:: RRg() const { - tmp<volScalarField::Internal> tRRg + auto tRRg = DimensionedField<scalar, volMesh>::New ( - new volScalarField::Internal - ( - IOobject - ( - "RRg", - this->time().timeName(), - this->mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - this->mesh(), - dimensionedScalar(dimMass/dimVolume/dimTime, Zero) - ) + "RRg", + IOobject::NO_REGISTER, + this->mesh(), + dimensionedScalar(dimMass/dimVolume/dimTime, Zero) ); + auto& RRg = tRRg.ref(); if (this->chemistry_) { - volScalarField::Internal& RRg = tRRg.ref(); for (label i=0; i < nGases_; i++) { RRg += RRg_[i]; diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.C b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.C index 6441efddce2..f16eb650bce 100644 --- a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.C +++ b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -116,28 +117,17 @@ template<class CompType, class SolidThermo> Foam::tmp<Foam::volScalarField> Foam::solidChemistryModel<CompType, SolidThermo>::Qdot() const { - tmp<volScalarField> tQdot + auto tQdot = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Qdot", - this->mesh_.time().timeName(), - this->mesh_, - IOobject::NO_READ, - IOobject::AUTO_WRITE, - IOobject::NO_REGISTER - ), - this->mesh_, - dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero) - ) + "Qdot", + IOobject::NO_REGISTER, + this->mesh_, + dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero) ); + scalarField& Qdot = tQdot.ref(); if (this->chemistry_) { - scalarField& Qdot = tQdot.ref(); - forAll(Ys_, i) { forAll(Qdot, celli) diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelI.H b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelI.H index 855b29fb62d..8b4fd000288 100644 --- a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelI.H +++ b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2016 OpenCFD Ltd. + Copyright (C) 2016-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -70,26 +70,17 @@ template<class CompType, class SolidThermo> inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>> Foam::solidChemistryModel<CompType, SolidThermo>::RRs() const { - tmp<volScalarField::Internal> tRRs + auto tRRs = DimensionedField<scalar, volMesh>::New ( - new volScalarField::Internal - ( - IOobject - ( - "RRs", - this->time().timeName(), - this->mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - this->mesh(), - dimensionedScalar(dimMass/dimVolume/dimTime, Zero) - ) + "RRs", + IOobject::NO_REGISTER, + this->mesh(), + dimensionedScalar(dimMass/dimVolume/dimTime, Zero) ); + auto& RRs = tRRs.ref(); if (this->chemistry_) { - volScalarField::Internal& RRs = tRRs.ref(); for (label i=0; i < nSolids_; i++) { RRs += RRs_[i]; @@ -103,27 +94,17 @@ template<class CompType, class SolidThermo> inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>> Foam::solidChemistryModel<CompType, SolidThermo>::RRsHs() const { - tmp<DimensionedField<scalar, volMesh>> tRRsHs + auto tRRsHs = DimensionedField<scalar, volMesh>::New ( - new DimensionedField<scalar, volMesh> - ( - IOobject - ( - "RRsHs", - this->time().timeName(), - this->mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - this->mesh(), - dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero) - ) + "RRsHs", + IOobject::NO_REGISTER, + this->mesh(), + dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero) ); + auto& RRs = tRRsHs.ref(); if (this->chemistry_) { - DimensionedField<scalar, volMesh>& RRs = tRRsHs.ref(); - const volScalarField& T = this->solidThermo().T(); const volScalarField& p = this->solidThermo().p(); diff --git a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C index e2b581d21d7..def7f88fab0 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -219,24 +219,15 @@ Foam::heSolidThermo<BasicSolidThermo, MixtureType>::Kappa() const { const fvMesh& mesh = this->T_.mesh(); - tmp<volVectorField> tKappa + auto tKappa = volVectorField::New ( - new volVectorField - ( - IOobject - ( - "Kappa", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimEnergy/dimTime/dimLength/dimTemperature - ) + "Kappa", + IOobject::NO_REGISTER, + mesh, + dimEnergy/dimTime/dimLength/dimTemperature ); + auto& Kappa = tKappa.ref(); - volVectorField& Kappa = tKappa.ref(); vectorField& KappaCells = Kappa.primitiveFieldRef(); const scalarField& TCells = this->T_; const scalarField& pCells = this->p_; @@ -286,9 +277,9 @@ Foam::heSolidThermo<BasicSolidThermo, MixtureType>::Kappa { const scalarField& pp = this->p_.boundaryField()[patchi]; const scalarField& Tp = this->T_.boundaryField()[patchi]; - tmp<vectorField> tKappa(new vectorField(pp.size())); - vectorField& Kappap = tKappa.ref(); + auto tKappa = tmp<vectorField>::New(pp.size()); + auto& Kappap = tKappa.ref(); forAll(Tp, facei) { diff --git a/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.H b/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.H index 40c4162f946..f741963733d 100644 --- a/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.H +++ b/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.H @@ -355,15 +355,15 @@ public: //- Return mass flux tmp<surfaceScalarField> getRhoPhi ( - const dimensionedScalar rho1, - const dimensionedScalar rho2 + const dimensionedScalar& rho1, + const dimensionedScalar& rho2 ) const { - return tmp<surfaceScalarField> + return surfaceScalarField::New ( - new surfaceScalarField + "rhoPhi", + IOobject::NO_REGISTER, ( - "rhoPhi", (rho1 - rho2)*dVf_/mesh_.time().deltaT() + rho2*phi_ ) ); @@ -376,14 +376,14 @@ public: const volScalarField& rho2 ) { - return tmp<surfaceScalarField> - ( - new surfaceScalarField + return surfaceScalarField::New ( "rhoPhi", - fvc::interpolate(rho1 - rho2)*alphaPhi_ - + fvc::interpolate(rho2)*phi_ - ) + IOobject::NO_REGISTER, + ( + fvc::interpolate(rho1 - rho2)*alphaPhi_ + + fvc::interpolate(rho2)*phi_ + ) ); } diff --git a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C index 5275ca30172..54df8f0053e 100644 --- a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C +++ b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C @@ -130,9 +130,10 @@ Foam::incompressibleTwoPhaseMixture::mu() const clamp(alpha1_, zero_one{}) ); - return tmp<volScalarField>::New + return volScalarField::New ( "mu", + IOobject::NO_REGISTER, limitedAlpha1*rho1_*nuModel1_->nu() + (scalar(1) - limitedAlpha1)*rho2_*nuModel2_->nu() ); @@ -155,9 +156,10 @@ Foam::incompressibleTwoPhaseMixture::muf() const clamp(fvc::interpolate(alpha1_), zero_one{}) ); - return tmp<surfaceScalarField>::New + return surfaceScalarField::New ( "muf", + IOobject::NO_REGISTER, alpha1f*rho1_*fvc::interpolate(nuModel1_->nu()) + (scalar(1) - alpha1f)*rho2_*fvc::interpolate(nuModel2_->nu()) ); @@ -172,9 +174,10 @@ Foam::incompressibleTwoPhaseMixture::nuf() const clamp(fvc::interpolate(alpha1_), zero_one{}) ); - return tmp<surfaceScalarField>::New + return surfaceScalarField::New ( "nuf", + IOobject::NO_REGISTER, ( alpha1f*rho1_*fvc::interpolate(nuModel1_->nu()) + (scalar(1) - alpha1f)*rho2_*fvc::interpolate(nuModel2_->nu()) diff --git a/src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.C b/src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.C index d433938fc3e..33e3d0fdc56 100644 --- a/src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.C +++ b/src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.C @@ -65,17 +65,10 @@ Foam::surfaceTensionModels::constant::~constant() Foam::tmp<Foam::volScalarField> Foam::surfaceTensionModels::constant::sigma() const { - return tmp<volScalarField>::New + return volScalarField::New ( - IOobject - ( - "sigma", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + "sigma", + IOobject::NO_REGISTER, mesh_, sigma_ ); diff --git a/src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.C b/src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.C index 488cd0e9729..8fd8d54ce93 100644 --- a/src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.C +++ b/src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.C @@ -72,17 +72,10 @@ Foam::surfaceTensionModels::temperatureDependent::~temperatureDependent() Foam::tmp<Foam::volScalarField> Foam::surfaceTensionModels::temperatureDependent::sigma() const { - auto tsigma = tmp<volScalarField>::New + auto tsigma = volScalarField::New ( - IOobject - ( - "sigma", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + "sigma", + IOobject::NO_REGISTER, mesh_, dimSigma ); -- GitLab