diff --git a/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C index 6687c4a772..bb3532b43d 100644 --- a/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C @@ -253,11 +253,9 @@ baffleThickness() const nbrPatch.template lookupPatchField(TName_) ); - tmp tthickness - ( - new scalarField(nbrField.baffleThickness()) - ); - scalarField& thickness = tthickness.ref(); + auto tthickness = tmp::New(nbrField.baffleThickness()); + auto& thickness = tthickness.ref(); + mapDist.distribute(thickness); return tthickness; } @@ -284,8 +282,9 @@ tmp thermalBaffle1DFvPatchScalarField::qs() const nbrPatch.template lookupPatchField(TName_) ); - tmp tqs(new scalarField(nbrField.qs())); - scalarField& qs = tqs.ref(); + auto tqs = tmp::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 0c782f824c..d2066bec6d 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 mapCoeffs(nSubFaces, Zero); - - label subFaceI = 0; - forAll(*this, faceI) - { - - } - */ - return tmp>(new Field()); + return nullptr; } diff --git a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C index 0471bdd398..81b6f09f68 100644 --- a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C @@ -804,7 +804,7 @@ tmp> turbulentTemperatureRadCoupledMixedFvPatchScalarField::coeffs << "the assemble coupled option for energy. " << abort(FatalError); - return tmp>(new Field()); + return nullptr; } diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index e4bcf751c7..f012c7a914 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 78600ba69c..40eb9b0705 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.C +++ b/src/thermophysicalModels/basic/heThermo/heThermo.C @@ -218,25 +218,15 @@ Foam::tmp Foam::heThermo::he { const fvMesh& mesh = this->T_.mesh(); - tmp 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::heThermo::he const labelList& cells ) const { - tmp the(new scalarField(T.size())); - scalarField& he = the.ref(); + auto the = tmp::New(T.size()); + auto& he = the.ref(); forAll(T, celli) { @@ -294,8 +284,8 @@ Foam::tmp Foam::heThermo::he const label patchi ) const { - tmp the(new scalarField(T.size())); - scalarField& he = the.ref(); + auto the = tmp::New(T.size()); + auto& he = the.ref(); forAll(T, facei) { @@ -313,25 +303,15 @@ Foam::heThermo::hc() const { const fvMesh& mesh = this->T_.mesh(); - tmp 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::heThermo::Cp const label patchi ) const { - tmp tCp(new scalarField(T.size())); - scalarField& cp = tCp.ref(); + auto tCp = tmp::New(T.size()); + auto& cp = tCp.ref(); forAll(T, facei) { @@ -404,25 +384,14 @@ Foam::heThermo::Cp() const { const fvMesh& mesh = this->T_.mesh(); - tmp 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::Cv const label patchi ) const { - tmp tCv(new scalarField(T.size())); - scalarField& cv = tCv.ref(); + auto tCv = tmp::New(T.size()); + auto& cv = tCv.ref(); forAll(T, facei) { @@ -499,25 +468,14 @@ Foam::heThermo::Cv() const { const fvMesh& mesh = this->T_.mesh(); - tmp 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::heThermo::gamma const label patchi ) const { - tmp tgamma(new scalarField(T.size())); - scalarField& gamma = tgamma.ref(); + auto tgamma = tmp::New(T.size()); + auto& gamma = tgamma.ref(); forAll(T, facei) { @@ -568,25 +526,14 @@ Foam::heThermo::gamma() const { const fvMesh& mesh = this->T_.mesh(); - tmp 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::heThermo::Cpv const label patchi ) const { - tmp tCpv(new scalarField(T.size())); - scalarField& Cpv = tCpv.ref(); + auto tCpv = tmp::New(T.size()); + auto& Cpv = tCpv.ref(); forAll(T, facei) { @@ -643,25 +590,14 @@ Foam::heThermo::Cpv() const { const fvMesh& mesh = this->T_.mesh(); - tmp 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::heThermo::CpByCpv const label patchi ) const { - tmp tCpByCpv(new scalarField(T.size())); - scalarField& CpByCpv = tCpByCpv.ref(); + auto tCpByCpv = tmp::New(T.size()); + auto& CpByCpv = tCpByCpv.ref(); forAll(T, facei) { @@ -715,25 +651,14 @@ Foam::heThermo::CpByCpv() const { const fvMesh& mesh = this->T_.mesh(); - tmp 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::heThermo::THE const labelList& cells ) const { - tmp tT(new scalarField(h.size())); - scalarField& T = tT.ref(); + auto tT = tmp::New(h.size()); + auto& T = tT.ref(); forAll(h, celli) { @@ -799,8 +724,9 @@ Foam::tmp Foam::heThermo::THE ) const { - tmp tT(new scalarField(h.size())); - scalarField& T = tT.ref(); + auto tT = tmp::New(h.size()); + auto& T = tT.ref(); + forAll(h, facei) { T[facei] = this->patchFaceMixture @@ -821,25 +747,15 @@ Foam::tmp Foam::heThermo::W { const fvMesh& mesh = this->T_.mesh(); - tmp 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::heThermo::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 82e14feb19..871a795d68 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 9ce5a2bd59..074cccfde8 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 a306b2dadd..03e1160b6c 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 Foam::tmp Foam::StandardChemistryModel::tc() const { - tmp 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 trho(this->thermo().rho()); @@ -544,22 +533,12 @@ template Foam::tmp Foam::StandardChemistryModel::Qdot() const { - tmp 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::calculateRR scalar pf, cf, pr, cr; label lRef, rRef; - tmp 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 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 d17d028d9f..ddf47fb7f6 100644 --- a/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.C +++ b/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.C @@ -112,25 +112,14 @@ Foam::tmp Foam::laminarFlameSpeedModels::Gulders::Su0pTphi scalar phi ) const { - tmp 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::laminarFlameSpeedModels::Gulders::Su0pTphi const volScalarField& phi ) const { - tmp 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 f3478e80b3..be2d86de45 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 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 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 ac4df02529..3f248fe4cc 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 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 2f09891022..351a7b9c32 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::laminarFlameSpeedModels::constant::operator()() const { - return tmp + 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 16ec788656..c5d3d5ff61 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::radiation:: greyDiffusiveViewFactorFixedValueFvPatchScalarField::qro(label bandI) const { - tmp tqrt(new scalarField(qro_)); + auto tqrt = tmp::New(qro_); const viewFactor& radiation = db().lookupObject("radiationProperties"); diff --git a/src/thermophysicalModels/radiation/radiationModels/P1/P1.C b/src/thermophysicalModels/radiation/radiationModels/P1/P1.C index 4df1c317a5..fa7214960d 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::radiation::P1::Rp() const { - return tmp + 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 0195a01d69..753b7fc0cf 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& band ) const { - tmp 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::one) @@ -239,20 +230,11 @@ Foam::radiation::blackBodyEmission::EbDeltaLambdaT const Vector2D& band ) const { - tmp 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::one) diff --git a/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C b/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C index e7aabf242a..234489340e 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::radiation::fvDOM::Rp() const { // Construct using contribution from first frequency band - tmp 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::radiation::fvDOM::Rp() const Foam::tmp> Foam::radiation::fvDOM::Ru() const { - tmp> tRu + auto tRu = DimensionedField::New ( - new DimensionedField - ( - 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& 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 ec998448ed..ae93e29668 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::radiation::noRadiation::Rp() const { - return tmp::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::radiation::noRadiation::Rp() const Foam::tmp> Foam::radiation::noRadiation::Ru() const { - return tmp::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 4fd40720a2..b99907d232 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::radiation::opaqueSolid::Rp() const { - return tmp::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::radiation::opaqueSolid::Rp() const Foam::tmp> Foam::radiation::opaqueSolid::Ru() const { - return tmp::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 0980bc0b72..32fa503e54 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> patcha(patches.size()); forAll(patchr, patchi) { - patchr.set - ( - patchi, - new List(nBands) - ); - - patcha.set - ( - patchi, - new List(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 d415b9c030..7310b71551 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::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 ef13824206..503a7489ce 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::radiation::solarLoad::Rp() const { - return tmp::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 63c0aa70af..9a1e62068d 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::radiation::viewFactor::Rp() const { - return tmp::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::radiation::viewFactor::Rp() const Foam::tmp> Foam::radiation::viewFactor::Ru() const { - return tmp>::New + return DimensionedField::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 f9f78d2d2d..10870b6660 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::radiation::absorptionEmissionModel::aCont(const label bandI) const { - return tmp + 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::radiation::absorptionEmissionModel::aDisp(const label bandI) const { - return tmp + 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::radiation::absorptionEmissionModel::eCont(const label bandI) const { - return tmp + 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::radiation::absorptionEmissionModel::eDisp(const label bandI) const { - return tmp + 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::radiation::absorptionEmissionModel::ECont(const label bandI) const { - return tmp + 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::radiation::absorptionEmissionModel::EDisp(const label bandI) const { - return tmp + 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 c3f0af471a..5d3642c10e 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::radiation::constantAbsorptionEmission::aCont(const label bandI) const { - tmp 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::radiation::constantAbsorptionEmission::eCont(const label bandI) const { - tmp 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::radiation::constantAbsorptionEmission::ECont(const label bandI) const { - tmp 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 7aca57b922..b226234969 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 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::radiation::greyMeanAbsorptionEmission::ECont(const label bandI) const { - tmp 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("Qdot"); diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C index b4fc2fc425..310ea6f2f2 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 tXj(new scalarField(T.primitiveField().size(), Zero)); - scalarField& Xj = tXj.ref(); + auto tXj = tmp::New(T.primitiveField().size(), Zero); + auto& Xj = tXj.ref(); - tmp tRhoInv(new scalarField(T.primitiveField().size(), Zero)); - scalarField& rhoInv = tRhoInv.ref(); + auto tRhoInv = tmp::New(T.primitiveField().size(), Zero); + auto& rhoInv = tRhoInv.ref(); forAll(mixture_.Y(), specieI) { @@ -142,25 +142,15 @@ Foam::tmp Foam::radiation::greyMeanSolidAbsorptionEmission:: calc(const label propertyId) const { - tmp 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 c7c3199f47..deb4da3b47 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 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 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 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 8c02bb90bc..44a7171bb3 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 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 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 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 084cd0284f..3eb8adc9e5 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 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::radiation::wideBandAbsorptionEmission::ECont(const label bandi) const { - tmp 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("Qdot"); diff --git a/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationProperties.C b/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationProperties.C index e6201ee327..7092f15b49 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::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::New(); + return nullptr; } @@ -327,7 +327,7 @@ Foam::radiation::boundaryRadiationProperties::transmissivity << "Please add it" << exit(FatalError); - return tmp::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::New(); + return nullptr; } @@ -423,7 +423,7 @@ Foam::radiation::boundaryRadiationProperties::diffReflectivity << "Please add it" << exit(FatalError); - return tmp::New(); + return nullptr; } @@ -482,7 +482,7 @@ Foam::radiation::boundaryRadiationProperties::specReflectivity << "Please add it" << exit(FatalError); - return tmp::New(); + return nullptr; } diff --git a/src/thermophysicalModels/radiation/submodels/scatterModel/constantScatter/constantScatter.C b/src/thermophysicalModels/radiation/submodels/scatterModel/constantScatter/constantScatter.C index 666af9dc28..c14bdc79dc 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::radiation::constantScatter::sigmaEff() const { - return tmp + 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 cc7f40c745..8d9d1f09b6 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::radiation::noScatter::sigmaEff() const { - return tmp + 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 5b9d6ab769..188d7ee652 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::radiation::constantAbsorption::a scalarField* T ) const { - return tmp(new scalarField(pp_.size(), a_)); + return tmp::New(pp_.size(), a_); } @@ -93,7 +93,7 @@ Foam::tmp Foam::radiation::constantAbsorption::e scalarField* T ) const { - return tmp(new scalarField(pp_.size(), e_)); + return tmp::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 82f8f824e7..6971d9b423 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(new scalarField(pp_.size(), aCoeffs_[bandI])); + return tmp::New(pp_.size(), aCoeffs_[bandI]); } Foam::scalar Foam::radiation::multiBandAbsorption::a @@ -104,7 +104,7 @@ Foam::tmp Foam::radiation::multiBandAbsorption::e scalarField* T ) const { - return tmp(new scalarField(pp_.size(), eCoeffs_[bandI])); + return tmp::New(pp_.size(), eCoeffs_[bandI]); } diff --git a/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.C index 7a33d69695..f9f8bef58c 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 738cde1275..cf05a7c24b 100644 --- a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C +++ b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C @@ -253,7 +253,8 @@ Foam::heheuPsiThermo::heheuPsiThermo mesh.time().timeName(), mesh, IOobject::MUST_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh ), @@ -328,7 +329,8 @@ Foam::heheuPsiThermo::heheuPsiThermo mesh.time().timeName(), mesh, IOobject::MUST_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh ), @@ -429,8 +431,8 @@ Foam::heheuPsiThermo::heu const labelList& cells ) const { - tmp theu(new scalarField(Tu.size())); - scalarField& heu = theu.ref(); + auto theu = tmp::New(Tu.size()); + auto& heu = theu.ref(); forAll(Tu, celli) { @@ -450,8 +452,8 @@ Foam::heheuPsiThermo::heu const label patchi ) const { - tmp theu(new scalarField(Tu.size())); - scalarField& heu = theu.ref(); + auto theu = tmp::New(Tu.size()); + auto& heu = theu.ref(); forAll(Tu, facei) { @@ -467,24 +469,14 @@ template Foam::tmp Foam::heheuPsiThermo::Tb() const { - tmp 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 Foam::tmp Foam::heheuPsiThermo::psiu() const { - tmp 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 Foam::tmp Foam::heheuPsiThermo::psib() const { - tmp 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 Foam::tmp Foam::heheuPsiThermo::muu() const { - tmp 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 Foam::tmp Foam::heheuPsiThermo::mub() const { - tmp 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 cda0d2ec76..2901ab58e0 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::gasHs const label index ) const { - tmp 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 5029c4b0f4..742f0e99d4 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::pyrolysisChemistryModel:: RRg() const { - tmp tRRg + auto tRRg = DimensionedField::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 6441efddce..f16eb650bc 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 Foam::tmp Foam::solidChemistryModel::Qdot() const { - tmp 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 855b29fb62..8b4fd00028 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 inline Foam::tmp> Foam::solidChemistryModel::RRs() const { - tmp tRRs + auto tRRs = DimensionedField::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 inline Foam::tmp> Foam::solidChemistryModel::RRsHs() const { - tmp> tRRsHs + auto tRRsHs = DimensionedField::New ( - new DimensionedField - ( - 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& 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 e2b581d21d..def7f88fab 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::Kappa() const { const fvMesh& mesh = this->T_.mesh(); - tmp 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::Kappa { const scalarField& pp = this->p_.boundaryField()[patchi]; const scalarField& Tp = this->T_.boundaryField()[patchi]; - tmp tKappa(new vectorField(pp.size())); - vectorField& Kappap = tKappa.ref(); + auto tKappa = tmp::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 40c4162f94..f741963733 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 getRhoPhi ( - const dimensionedScalar rho1, - const dimensionedScalar rho2 + const dimensionedScalar& rho1, + const dimensionedScalar& rho2 ) const { - return tmp + 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 - ( - 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 5275ca3017..54df8f0053 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::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::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::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 d433938fc3..33e3d0fdc5 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::surfaceTensionModels::constant::sigma() const { - return tmp::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 488cd0e972..8fd8d54ce9 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::surfaceTensionModels::temperatureDependent::sigma() const { - auto tsigma = tmp::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 );