diff --git a/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C index 6687c4a772726d77ed97ee9d8b430b39e85e4051..bb3532b43d3a525176c833e9f6fd352414a6cf35 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 0c782f824cf8bbc1781b72bb8f008713d1ac668a..d2066bec6d8305de988dfbe273665061f3581121 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 0471bdd39876c09d996880fbcea7136bf2a6a663..81b6f09f6857e67600c27c55b10626cbbf1e8e85 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 e4bcf751c7c8ebccfd044f454bceddd344cc8ce7..f012c7a91416ef5aa99ed6e2eec0b846d7730192 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 78600ba69c587771b3cfeeeb4bceba0677df800d..40eb9b0705ac535531e0008c98d06e52d06ea2f4 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 82e14feb19ee449c23d5ae84c669ad6892c1752c..871a795d683a73ef9631d2e8dca93b5bf2fe52a7 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 9ce5a2bd59c8ccdbbb41f5e75b54e87a76e7204d..074cccfde8f83d418f8ad06a8e7b567fabc306b2 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 a306b2dadd4ab51143fde7293cc0ae9d97dd347b..03e1160b6cef7c20754cac2e5a8446de3a726211 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 d17d028d9ffdda4daa1d2e83dafd2cea625ce333..ddf47fb7f6ba8c9bab4fde946ae20909684cbb97 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 f3478e80b32e5109f30b8e70c62e2f14b0091bbd..be2d86de4518ed2171e4b3501f94a525be1644bc 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 ac4df025296e5e9f2594933068bedda172e13419..3f248fe4cc331fa8f003393a42ee57e6c4e6c3a8 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 2f0989102207220ff8e91b4998c140a505977834..351a7b9c32c22b3b2bd640ceaa255af9ce315f2a 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 16ec7886561c4613357623db7de0c40b37cdee04..c5d3d5ff61c5d34895d3a1264d0dfa2a8f3b6a32 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 4df1c317a5fdeaf1bfdaba78d103413564a06765..fa7214960d30f3815de0a4a011422785faf8aa0b 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 0195a01d69172888b127d1db15c442ab305cdef4..753b7fc0cf9224dbc7eac9a0f2f3147cf9a8c825 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 e7aabf242ad24af8c75daca944e26059b3b61232..234489340e1fd9ba6aeb5ace24ee5e16910eba15 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 ec998448ed76b8b4b04377697aefe2528fdde0cc..ae93e29668eb0a02c01afc6653d589bb7006f917 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 4fd40720a2c0863e9db68b69dc80f9d59dc40563..b99907d232ac1a540f7a31b90e9032ade81915f1 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 0980bc0b7249d01cd767e23da7dde3606b6ddb84..32fa503e548ca5469a3caa62b63391b94d846513 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 d415b9c03035db83e3f62ef2a5dd17a8521b870f..7310b71551b6866d49e9ff5d3c6a0b91963d9cd0 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 ef13824206f26b8fa92731a62f54d868400b9a95..503a7489ce98957cf9713fada175232d8b02ea49 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 63c0aa70af04e2bdfd8cc699db7491a5ea1035c0..9a1e62068d1439a86aff221854b6c9023115f8b3 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 f9f78d2d2d40bafe410b9bece8b32f7b2c9dbd7b..10870b666034f7cac73df97a7ad40e848a8bd2b6 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 c3f0af471af45e1dfbca85a1a9c7c3d96640c1cd..5d3642c10e17550d983b33474e83f3e60efaf67e 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 7aca57b9221db3ee3eb4e6ebc40d63d69aedd2ee..b226234969264b223f39e11e3008160a6af9a338 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 b4fc2fc425373d372ec62af733d5c2789de686dd..310ea6f2f2272233d19b99e3a4b24e7d31f53bc1 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 c7c3199f47ee2b6f8c8de19d6f2351254c172f3d..deb4da3b47d466ed803115cc870b67aa6acac3d8 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 8c02bb90bcf2c53812adc933fcd32db858ed1486..44a7171bb3d0bf6671362173aef1f97d1f517661 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 084cd0284fa3e695b39bb43ea51935d0f68a90b5..3eb8adc9e59a37b3f7aa7d593663998a9512e981 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 e6201ee327f4645eb9ff754b26b82441745b230c..7092f15b49ff477ed3ea53ed5356859dfec25328 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 666af9dc28a6c62fcafd4480f114d272b5bb3b49..c14bdc79dc0c43685ed54dca0189777263ae28bb 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 cc7f40c745f98e7a471b388da77dffdf8eb64a8a..8d9d1f09b649795615be1313c6fac5bb5d6ff364 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 5b9d6ab769f0826349d4b753a248e3c1d0413ee8..188d7ee65254489fa2897c7df334bd39b70902c7 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 82f8f824e7afeac9642d6248639318c5f9bc100f..6971d9b42341112b340b35e3f1054303b3b0e9e0 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 7a33d69695d89a1880e558406c896df831a76df4..f9f8bef58cdaf1a02bad442476d65728ef8731fb 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 738cde1275ec6db9cbeb9c610382a2c41a8674c6..cf05a7c24bc40955c52a290ebbb914492e5eb36c 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 cda0d2ec763d546f8d9b104fcca8d1c7693a48a3..2901ab58e07c457db2a7e713209287c3697c5d63 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 5029c4b0f4d7050bbf7539c195d33d51e43e879a..742f0e99d4bbe52166d1b66c68bc0b70c4bb838e 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 6441efddce2f57fb3c41a76ef9e9758f8ac6eefd..f16eb650bce2e0545671d23232ffb5446f3338e9 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 855b29fb62db2ddea8e8b0d2e139408d63e17ba0..8b4fd00028886957bb22b9beec589452b0422ef8 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 e2b581d21d7d8fb6f4021001b1d309e14cb9d3ec..def7f88fab03b9cd1d219b5a825f571beee5537a 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 40c4162f946c08496649b57211d1bc1422bc36f3..f741963733d1c45041ceec005c37120a36af14bb 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 5275ca30172280065250a4f93a5bc28486590a8d..54df8f0053e67a906bfe86e32c321c97dcb06605 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 d433938fc3e4101907eb6f75410597e00b6fdbe5..33e3d0fdc569714e082429ecbef177807f9f85e2 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 488cd0e97297e6eece0ee9bce2e4f34f378ed044..8fd8d54ce9304aa71a4b652488c455d1ec28fc1e 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 );