diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.C b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.C index ed72bbe540d463493fec677318f38eef8501cb75..b48af20fea7680bb4d1eb06a1d6eeac758149cee 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -93,24 +94,14 @@ Foam::PDRDragModels::basic::~basic() Foam::tmp<Foam::volSymmTensorField> Foam::PDRDragModels::basic::Dcu() const { - tmp<volSymmTensorField> tDragDcu + auto tDragDcu = volSymmTensorField::New ( - new volSymmTensorField - ( - IOobject - ( - "tDragDcu", - U_.mesh().time().constant(), - U_.mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - U_.mesh(), - dimensionedSymmTensor(dimMass/dimTime/dimVolume, Zero) - ) + "tDragDcu", + IOobject::NO_REGISTER, + U_.mesh(), + dimensionedSymmTensor(dimMass/dimTime/dimVolume, Zero) ); - - volSymmTensorField& DragDcu = tDragDcu.ref(); + auto& DragDcu = tDragDcu.ref(); if (on_) { @@ -127,24 +118,14 @@ Foam::tmp<Foam::volSymmTensorField> Foam::PDRDragModels::basic::Dcu() const Foam::tmp<Foam::volScalarField> Foam::PDRDragModels::basic::Gk() const { - tmp<volScalarField> tGk + auto tGk = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "tGk", - U_.mesh().time().constant(), - U_.mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - U_.mesh(), - dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) - ) + "tGk", + IOobject::NO_REGISTER, + U_.mesh(), + dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) ); - - volScalarField& Gk = tGk.ref(); + auto& Gk = tGk.ref(); if (on_) { diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.C b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.C index b80b72a4c7c44b91800cb0819ef3929a327363d6..04f977f208a0153c558aad647b281a41d4d316b2 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -93,23 +94,14 @@ Foam::tmp<Foam::volScalarField> Foam::XiEqModels::SCOPEXiEq::XiEq() const volScalarField K(0.157*upBySu/sqrt(Rl)); volScalarField Ma(MaModel.Ma()); - tmp<volScalarField> tXiEq + auto tXiEq = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "XiEq", - epsilon.time().timeName(), - epsilon.db(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - epsilon.mesh(), - dimensionedScalar(dimless, Zero) - ) + "XiEq", + IOobject::NO_REGISTER, + epsilon.mesh(), + dimensionedScalar(dimless, Zero) ); - volScalarField& xieq = tXiEq.ref(); + auto& xieq = tXiEq.ref(); forAll(xieq, celli) { diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.C b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.C index 084ffc1aef6112400bc92c14e3f0131495f07311..5d87437f6ca6ce84f9bf8ee13d6bba79373bce8d 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.C @@ -78,11 +78,10 @@ bool Foam::XiEqModel::read(const dictionary& XiEqProperties) void Foam::XiEqModel::writeFields() const { //***HGW It is not clear why B is written here - if (Su_.mesh().foundObject<volSymmTensorField>("B")) + const auto* B = Su_.mesh().cfindObject<volSymmTensorField>("B"); + if (B) { - const volSymmTensorField& B = - Su_.mesh().lookupObject<volSymmTensorField>("B"); - B.write(); + B->write(); } } @@ -98,39 +97,26 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const const volSymmTensorField& nsv = mesh.lookupObject<volSymmTensorField>("nsv"); - tmp<volScalarField> tN + auto tN = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "tN", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - mesh, - dimensionedScalar(Nv.dimensions(), Zero) - ) + "tN", + IOobject::NO_REGISTER, + mesh, + dimensionedScalar(Nv.dimensions(), Zero) ); - volScalarField& N = tN.ref(); + auto& N = tN.ref(); + N.primitiveFieldRef() = Nv.primitiveField()*pow(mesh.V(), 2.0/3.0); - volSymmTensorField ns + auto tns = volSymmTensorField::New ( - IOobject - ( - "tns", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "tns", + IOobject::NO_REGISTER, mesh, dimensionedSymmTensor(nsv.dimensions(), Zero) ); + auto& ns = tns.ref(); + ns.primitiveFieldRef() = nsv.primitiveField()*pow(mesh.V(), 2.0/3.0); const volVectorField Uhat diff --git a/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C b/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C index 6c9a7e1085310b57d4ffd048be9b83abde8e0f3e..805c2f59890ff0f8be4dbb2ecfcfb1e6325f6f89 100644 --- a/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C +++ b/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.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. @@ -255,24 +256,14 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::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 - ), - 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) { @@ -304,24 +295,14 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::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 - ), - 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) { @@ -358,24 +339,14 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Ma const volScalarField& phi ) const { - tmp<volScalarField> tMa + auto tMa = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Ma", - phi.time().timeName(), - phi.db(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - phi.mesh(), - dimensionedScalar(dimless, Zero) - ) + "Ma", + IOobject::NO_REGISTER, + phi.mesh(), + dimensionedScalar(dimless, Zero) ); - - volScalarField& ma = tMa.ref(); + auto& ma = tMa.ref(); forAll(ma, celli) { @@ -418,21 +389,12 @@ Foam::laminarFlameSpeedModels::SCOPE::Ma() const { const fvMesh& mesh = psiuReactionThermo_.p().mesh(); - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "Ma", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedScalar("Ma", dimless, Ma(equivalenceRatio_)) - ) + "Ma", + IOobject::NO_REGISTER, + mesh, + dimensionedScalar("Ma", dimless, Ma(equivalenceRatio_)) ); } } diff --git a/applications/solvers/multiphase/MPPICInterFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/MPPICInterFoam/alphaEqnSubCycle.H index 16269f7c4c9fe07f972266bc58028cc79c020fc4..392a953b6a8f74ebf248207b54595c64071de048 100644 --- a/applications/solvers/multiphase/MPPICInterFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/MPPICInterFoam/alphaEqnSubCycle.H @@ -3,12 +3,7 @@ if (nAlphaSubCycles > 1) dimensionedScalar totalDeltaT = runTime.deltaT(); surfaceScalarField rhoPhiSum ( - IOobject - ( - "rhoPhiSum", - runTime.timeName(), - mesh - ), + mesh.newIOobject("rhoPhiSum"), mesh, dimensionedScalar(rhoPhi.dimensions(), Zero) ); diff --git a/applications/solvers/multiphase/VoF/alphaEqnSubCycle.H b/applications/solvers/multiphase/VoF/alphaEqnSubCycle.H index c53d6e106b428d58df1799c11f8694c976c38439..9ca190cb6fc8a116aede702754a5169cb43f2dee 100644 --- a/applications/solvers/multiphase/VoF/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/VoF/alphaEqnSubCycle.H @@ -3,12 +3,7 @@ if (nAlphaSubCycles > 1) dimensionedScalar totalDeltaT = runTime.deltaT(); surfaceScalarField rhoPhiSum ( - IOobject - ( - "rhoPhiSum", - runTime.timeName(), - mesh - ), + mesh.newIOobject("rhoPhiSum"), mesh, dimensionedScalar(rhoPhi.dimensions(), Zero) ); diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleAlphaEqnSubCycle.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleAlphaEqnSubCycle.H index 51dd6ea56c2d265d633f5ca15075fcd61be230df..3f4c9779450580bded8afaf9ef93863beeb0f318 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleAlphaEqnSubCycle.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleAlphaEqnSubCycle.H @@ -4,26 +4,19 @@ if (nAlphaSubCycles > 1) { dimensionedScalar totalDeltaT = runTime.deltaT(); - talphaPhi1 = new surfaceScalarField + talphaPhi1.reset ( - IOobject + new surfaceScalarField ( - "alphaPhi1", - runTime.timeName(), - mesh - ), - mesh, - dimensionedScalar(alphaPhi10.dimensions(), Zero) + mesh.newIOobject("alphaPhi1"), + mesh, + dimensionedScalar(alphaPhi10.dimensions(), Zero) + ) ); surfaceScalarField rhoPhiSum ( - IOobject - ( - "rhoPhiSum", - runTime.timeName(), - mesh - ), + mesh.newIOobject("rhoPhiSum"), mesh, dimensionedScalar(rhoPhi.dimensions(), Zero) ); diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/compressibleAlphaEqnSubCycle.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/compressibleAlphaEqnSubCycle.H index 5fda0912c58c090016a887d6f67090a517c7b44e..45d4077f4c14569afad64f2d2cb54a4271531fab 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/compressibleAlphaEqnSubCycle.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/compressibleAlphaEqnSubCycle.H @@ -13,26 +13,19 @@ if (nAlphaSubCycles > 1) { dimensionedScalar totalDeltaT = runTime.deltaT(); - talphaPhi1 = new surfaceScalarField + talphaPhi1.reset ( - IOobject + new surfaceScalarField ( - "alphaPhi1", - runTime.timeName(), - mesh - ), - mesh, - dimensionedScalar(alphaPhi10.dimensions(), Zero) + mesh.newIOobject("alphaPhi1"), + mesh, + dimensionedScalar(alphaPhi10.dimensions(), Zero) + ) ); surfaceScalarField rhoPhiSum ( - IOobject - ( - "rhoPhiSum", - runTime.timeName(), - mesh - ), + mesh.newIOobject("rhoPhiSum"), mesh, dimensionedScalar(rhoPhi.dimensions(), Zero) ); diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C index 77d276973fd32bfd2c40bb27354cc811e8786e89..a190682c4a0eed64d999b9c4b8809ef55b4b66c8 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C @@ -99,7 +99,8 @@ Foam::multiphaseMixtureThermo::multiphaseMixtureThermo mesh_.time().timeName(), mesh_, IOobject::NO_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh_, dimensionedScalar(dimless, Zero) @@ -998,19 +999,12 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseMixtureThermo::K Foam::tmp<Foam::volScalarField> Foam::multiphaseMixtureThermo::nearInterface() const { - tmp<volScalarField> tnearInt + auto tnearInt = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "nearInterface", - mesh_.time().timeName(), - mesh_ - ), - mesh_, - dimensionedScalar(dimless, Zero) - ) + "nearInterface", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(dimless, Zero) ); for (const phaseModel& phase : phases_) diff --git a/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H index b38144700cc079bdfd9156771ad102d7d09a8bd6..ac51ae482edabe5d4b40ce54eb59e8331e579952 100644 --- a/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/driftFluxFoam/alphaEqnSubCycle.H @@ -18,12 +18,7 @@ dimensionedScalar totalDeltaT = runTime.deltaT(); surfaceScalarField alphaPhiSum ( - IOobject - ( - "alphaPhiSum", - runTime.timeName(), - mesh - ), + mesh.newIOobject("alphaPhiSum"), mesh, dimensionedScalar(phi.dimensions(), Zero) ); diff --git a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C index dc36b96e6a17e1e934c524d4c561eeda5bad5e08..e88b24f32d23db6793e569e82c62609fe3e616b1 100644 --- a/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C +++ b/applications/solvers/multiphase/driftFluxFoam/relativeVelocityModels/relativeVelocityModel/relativeVelocityModel.C @@ -158,13 +158,11 @@ Foam::tmp<Foam::volSymmTensorField> Foam::relativeVelocityModel::tauDm() const // Calculate the relative velocity of the continuous phase w.r.t the mean volVectorField Ucm(betad*Udm_/betac); - return tmp<volSymmTensorField> + return volSymmTensorField::New ( - new volSymmTensorField - ( - "tauDm", - betad*sqr(Udm_) + betac*sqr(Ucm) - ) + "tauDm", + IOobject::NO_REGISTER, + betad*sqr(Udm_) + betac*sqr(Ucm) ); } diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/laserDTRM.C b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/laserDTRM.C index 6524c571aed822a1413512bf7362f585fd3b7105..40c906b57e5a6e84eb9b937f9edebc34cb9c6954 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/laserDTRM.C +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/laserDTRM.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2022 OpenCFD Ltd. + Copyright (C) 2017-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -407,7 +407,8 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T) mesh_.time().timeName(), mesh_, IOobject::NO_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh_, dimensionedScalar(dimPower/dimVolume, Zero) @@ -504,7 +505,8 @@ Foam::radiation::laserDTRM::laserDTRM mesh_.time().timeName(), mesh_, IOobject::NO_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh_, dimensionedScalar(dimPower/pow3(dimLength), Zero) @@ -535,42 +537,23 @@ Foam::label Foam::radiation::laserDTRM::nBands() const void Foam::radiation::laserDTRM::calculate() { - tmp<volScalarField> treflectingCells + auto treflectingCells = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "reflectingCellsVol", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimensionedScalar("zero", dimless, -1) - ) + "reflectingCellsVol", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar("zero", dimless, -1) ); - volScalarField& reflectingCellsVol = treflectingCells.ref(); - + auto& reflectingCellsVol = treflectingCells.ref(); - tmp<volVectorField> tnHat + auto tnHat = volVectorField::New ( - new volVectorField - ( - IOobject - ( - "nHat", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimensionedVector(dimless, Zero) - ) + "nHat", + IOobject::NO_REGISTER, + mesh_, + dimensionedVector(dimless, Zero) ); - volVectorField& nHat = tnHat.ref(); + auto& nHat = tnHat.ref(); // Reset the field @@ -686,9 +669,9 @@ void Foam::radiation::laserDTRM::calculate() globalIndex::gatherInplaceOp(lines); - if (Pstream::master()) + if (UPstream::master()) { - OBJstream os(type() + ":particlePath.obj"); + OBJstream os(type() + "-particlePath.obj"); for (label pointi = 0; pointi < lines.size(); pointi += 2) { diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/localDensityAbsorptionEmission/localDensityAbsorptionEmission.C b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/localDensityAbsorptionEmission/localDensityAbsorptionEmission.C index 72e3d08d90eac7447e2eef1a7719e7d1b72505af..a2cabf5d86b962cb3d6406c8fb1dda67a8c7fa94 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/localDensityAbsorptionEmission/localDensityAbsorptionEmission.C +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/localDensityAbsorptionEmission/localDensityAbsorptionEmission.C @@ -88,25 +88,14 @@ Foam::radiation::localDensityAbsorptionEmission::localDensityAbsorptionEmission Foam::tmp<Foam::volScalarField> Foam::radiation::localDensityAbsorptionEmission::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, - IOobject::NO_REGISTER - ), - mesh_, - dimensionedScalar(inv(dimLength), Zero) - ) + "a", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(inv(dimLength), Zero) ); - - volScalarField& a = ta.ref(); + auto& a = ta.ref(); forAll(alphaNames_, i) { @@ -121,25 +110,14 @@ Foam::radiation::localDensityAbsorptionEmission::aCont(const label bandI) const Foam::tmp<Foam::volScalarField> Foam::radiation::localDensityAbsorptionEmission::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, - IOobject::NO_REGISTER - ), - mesh_, - dimensionedScalar(inv(dimLength), Zero) - ) + "e", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(inv(dimLength), Zero) ); - - volScalarField& e = te.ref(); + auto& e = te.ref(); forAll(alphaNames_, i) { @@ -154,22 +132,12 @@ Foam::radiation::localDensityAbsorptionEmission::eCont(const label bandI) const Foam::tmp<Foam::volScalarField> Foam::radiation::localDensityAbsorptionEmission::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, - IOobject::NO_REGISTER - ), - mesh_, - dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) - ) + "E", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) ); scalarField& E = tE.ref().primitiveFieldRef(); diff --git a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C index 8f1fb0f8837ecadf0c54e68d9b4d24b15c6f6a65..121d3a5027ba6d08d7ab8f26aa8d581db681db71 100644 --- a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C +++ b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C @@ -171,16 +171,8 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::TSource() const const volScalarField& T = mesh_.lookupObject<volScalarField>("T"); - tmp<fvScalarMatrix> tTSource - ( - new fvScalarMatrix - ( - T, - dimEnergy/dimTime - ) - ); - - fvScalarMatrix& TSource = tTSource.ref(); + auto tTSource = tmp<fvScalarMatrix>::New(T, dimEnergy/dimTime); + auto& TSource = tTSource.ref(); const twoPhaseMixtureEThermo& thermo = refCast<const twoPhaseMixtureEThermo> diff --git a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C index 0cf652dbf53a3ef9a678bc5c0c5362df9fd05816..f877106c19d4461e125b5a2ceef3296cad8f34e7 100644 --- a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C +++ b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C @@ -382,7 +382,7 @@ Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::kappaEff const volScalarField& kappat ) const { - tmp<Foam::volScalarField> kappaEff(kappa() + kappat); + tmp<volScalarField> kappaEff(kappa() + kappat); kappaEff.ref().rename("kappaEff"); return kappaEff; } diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnSubCycle.H index 117e593c69ea90d23489a08097e577addc0d7dd8..acbea8e9b9dd91df875b7584e8b8ea5abc959f6e 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnSubCycle.H @@ -3,12 +3,7 @@ if (nAlphaSubCycles > 1) dimensionedScalar totalDeltaT = runTime.deltaT(); surfaceScalarField rhoPhiSum ( - IOobject - ( - "rhoPhiSum", - runTime.timeName(), - mesh - ), + mesh.newIOobject("rhoPhiSum"), mesh, dimensionedScalar(rhoPhi.dimensions(), Zero) ); diff --git a/applications/solvers/multiphase/interIsoFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interIsoFoam/alphaEqnSubCycle.H index 65376d61fe44ce27dc9e5c9a01f4411ea1ea3e0c..3189654bf5cd2a5953f7efde2aaa77da6f765fd1 100644 --- a/applications/solvers/multiphase/interIsoFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interIsoFoam/alphaEqnSubCycle.H @@ -32,12 +32,7 @@ if (nAlphaSubCycles > 1) dimensionedScalar totalDeltaT = runTime.deltaT(); surfaceScalarField rhoPhiSum ( - IOobject - ( - "rhoPhiSum", - runTime.timeName(), - mesh - ), + mesh.newIOobject("rhoPhiSum"), mesh, dimensionedScalar(rhoPhi.dimensions(), Zero) ); diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H index f4643f1df431259d0cd963384c20908d380f544e..895767396947f7e89b06681243cacfe230c8a4ed 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H @@ -21,12 +21,7 @@ dimensionedScalar totalDeltaT = runTime.deltaT(); surfaceScalarField rhoPhiSum ( - IOobject - ( - "rhoPhiSum", - runTime.timeName(), - mesh - ), + mesh.newIOobject("rhoPhiSum"), mesh, dimensionedScalar(rhoPhi.dimensions(), Zero) ); diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H index 02ae8778b9f5e762b9e77f226f053a825010154e..8861561888185ea9ac042d63ff29d1846ecce1a0 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H @@ -50,7 +50,8 @@ runTime.timeName(), mesh, IOobject::NO_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh, dimensionedScalar(dimVelocity*dimArea, Zero) diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C index 9c6ff5d331497837df56fe988709f44588509190..67db0089ab7d855aceb1fa7e65ff0db50644b8b3 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C @@ -68,8 +68,9 @@ Foam::multiphaseMixture::multiphaseMixture "transportProperties", U.time().constant(), U.db(), - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE + IOobject::READ_MODIFIED, + IOobject::NO_WRITE, + IOobject::REGISTER ) ), @@ -85,9 +86,7 @@ Foam::multiphaseMixture::multiphaseMixture ( "rhoPhi", mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE + mesh_ ), mesh_, dimensionedScalar(dimMass/dimTime, Zero) @@ -101,7 +100,8 @@ Foam::multiphaseMixture::multiphaseMixture mesh_.time().timeName(), mesh_, IOobject::NO_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), mesh_, dimensionedScalar(dimless, Zero) @@ -257,19 +257,12 @@ Foam::multiphaseMixture::nuf() const Foam::tmp<Foam::surfaceScalarField> Foam::multiphaseMixture::surfaceTensionForce() const { - tmp<surfaceScalarField> tstf + auto tstf = surfaceScalarField::New ( - new surfaceScalarField - ( - IOobject - ( - "surfaceTensionForce", - mesh_.time().timeName(), - mesh_ - ), - mesh_, - dimensionedScalar(dimensionSet(1, -2, -2, 0, 0), Zero) - ) + "surfaceTensionForce", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(dimensionSet(1, -2, -2, 0, 0), Zero) ); surfaceScalarField& stf = tstf.ref(); @@ -324,12 +317,7 @@ void Foam::multiphaseMixture::solve() { surfaceScalarField rhoPhiSum ( - IOobject - ( - "rhoPhiSum", - runTime.timeName(), - mesh_ - ), + mesh_.newIOobject("rhoPhiSum"), mesh_, dimensionedScalar(rhoPhi_.dimensions(), Zero) ); @@ -552,19 +540,12 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::K Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::nearInterface() const { - tmp<volScalarField> tnearInt + auto tnearInt = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "nearInterface", - mesh_.time().timeName(), - mesh_ - ), - mesh_, - dimensionedScalar(dimless, Zero) - ) + "nearInterface", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(dimless, Zero) ); for (const phase& ph : phases_) @@ -649,12 +630,7 @@ void Foam::multiphaseMixture::solveAlphas volScalarField sumAlpha ( - IOobject - ( - "sumAlpha", - mesh_.time().timeName(), - mesh_ - ), + mesh_.newIOobject("sumAlpha"), mesh_, dimensionedScalar(dimless, Zero) ); diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H index 0347512d2810cddb89684be89f503b3b66a9da22..5fb0d1604148c6bdf91b155c0e00496db37dca02 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H @@ -5,12 +5,7 @@ if (nAlphaSubCycles > 1) dimensionedScalar totalDeltaT = runTime.deltaT(); surfaceScalarField rhoPhiSum ( - IOobject - ( - "rhoPhiSum", - runTime.timeName(), - mesh - ), + mesh.newIOobject("rhoPhiSum"), mesh, dimensionedScalar(rhoPhi.dimensions(), Zero) ); diff --git a/applications/test/PatchTools/Test-PatchTools.C b/applications/test/PatchTools/Test-PatchTools.C index c7222340060b583322cafd80a7d8a1af217ef0c2..6adfedd36ded0ecd8fd63266c5df3dbac317e97d 100644 --- a/applications/test/PatchTools/Test-PatchTools.C +++ b/applications/test/PatchTools/Test-PatchTools.C @@ -67,8 +67,8 @@ using namespace Foam; // // (note:without calculating pointNormals // // to avoid them being stored) // -// tmp<pointField> textrudeN(new pointField(p.nPoints(), Zero)); -// pointField& extrudeN = textrudeN(); +// auto textrudeN = tmp<pointField>::New(p.nPoints(), Zero); +// auto& extrudeN = textrudeN.ref(); // { // const faceList& localFaces = p.localFaces(); // const vectorField& faceAreas = mesh.faceAreas(); diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index decbb1aa5668d4e852a9e2e65a6796ac486e2a83..f558637ce545b3ee2c44c11f441c1705041be4b3 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -1088,8 +1088,8 @@ tmp<pointField> calcOffset { vectorField::subField fc = pp.faceCentres(); - tmp<pointField> toffsets(new pointField(fc.size())); - pointField& offsets = toffsets.ref(); + auto toffsets = tmp<pointField>::New(fc.size()); + auto& offsets = toffsets.ref(); forAll(fc, i) { diff --git a/applications/utilities/mesh/generation/foamyMesh/cellSizeAndAlignmentGrid/cellSizeAndAlignmentGrid.C b/applications/utilities/mesh/generation/foamyMesh/cellSizeAndAlignmentGrid/cellSizeAndAlignmentGrid.C index 6d96b054a29c1c3c039e09fa54a0f58aec539431..6b8c08a947b39454c6724efc6d6d3fe87af652f7 100644 --- a/applications/utilities/mesh/generation/foamyMesh/cellSizeAndAlignmentGrid/cellSizeAndAlignmentGrid.C +++ b/applications/utilities/mesh/generation/foamyMesh/cellSizeAndAlignmentGrid/cellSizeAndAlignmentGrid.C @@ -64,8 +64,8 @@ Foam::tmp<Foam::Field<Type>> filterFarPoints const Field<Type>& field ) { - tmp<Field<Type>> tNewField(new Field<Type>(field.size())); - Field<Type>& newField = tNewField.ref(); + auto tNewField = tmp<Field<Type>>::New(field.size()); + auto& newField = tNewField.ref(); label added = 0; label count = 0; diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMeshTools/DelaunayMeshToolsTemplates.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMeshTools/DelaunayMeshToolsTemplates.C index 70cae969d54504343283e8efddbbc10d2a3efb8a..5b0bbc3028245e090f7e5ed0bb628102e9e748eb 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMeshTools/DelaunayMeshToolsTemplates.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMeshTools/DelaunayMeshToolsTemplates.C @@ -268,8 +268,8 @@ Foam::tmp<Foam::pointField> Foam::DelaunayMeshTools::allPoints const Triangulation& t ) { - tmp<pointField> tpts(new pointField(t.vertexCount(), point::max)); - pointField& pts = tpts.ref(); + auto tpts = tmp<pointField>::New(t.vertexCount(), point::max); + auto& pts = tpts.ref(); for ( diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C index 3df705a82c2268d1fe14ed7290066ab7822a38ff..27ebc07801cfa99aa2c477ebc4b21416ffb12fce 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C @@ -258,8 +258,8 @@ Foam::label Foam::cellShapeControlMesh::removePoints() Foam::tmp<Foam::pointField> Foam::cellShapeControlMesh::cellCentres() const { - tmp<pointField> tcellCentres(new pointField(number_of_finite_cells())); - pointField& cellCentres = tcellCentres.ref(); + auto tcellCentres = tmp<pointField>::New(number_of_finite_cells()); + auto& cellCentres = tcellCentres.ref(); label count = 0; for diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.C index fa4748d1c79e4deeae2f3d606f664882416fca4a..8ad03d0b2fc9eb9606c967f27601b5197a1b30be 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.C @@ -36,8 +36,8 @@ Foam::tmp<Foam::Field<Type>> Foam::smoothAlignmentSolver::filterFarPoints const Field<Type>& field ) { - tmp<Field<Type>> tNewField(new Field<Type>(field.size())); - Field<Type>& newField = tNewField.ref(); + auto tNewField = tmp<Field<Type>>::New(field.size()); + auto& newField = tNewField.ref(); label added = 0; label count = 0; diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C index b17e8c7c26e5ceb83df883e8e4f3d92fc3ac0455..3ac559c82ad2a88beb5a5104340511c4bd333efd 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C @@ -310,8 +310,8 @@ tmp<scalarField> signedDistance const labelList& surfaces ) { - tmp<scalarField> tfld(new scalarField(points.size(), Foam::sqr(GREAT))); - scalarField& fld = tfld.ref(); + auto tfld = tmp<scalarField>::New(points.size(), Foam::sqr(GREAT)); + auto& fld = tfld.ref(); // Find nearest List<pointIndexHit> nearest; diff --git a/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C b/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C index 9b2a97bbedeb01af97a3afa1f22aef3286216ba4..bff76e88fd2bede2808c8938beb34991f9c96289 100644 --- a/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C +++ b/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C @@ -368,7 +368,7 @@ int main(int argc, char *argv[]) const auto dictFileName = args.get<fileName>(1); - autoPtr<IFstream> dictFile(new IFstream(dictFileName)); + auto dictFile = autoPtr<IFstream>::New(dictFileName); if (!dictFile().good()) { FatalErrorInFunction diff --git a/applications/utilities/surface/surfaceInflate/surfaceInflate.C b/applications/utilities/surface/surfaceInflate/surfaceInflate.C index 69adf9f171d5dea4bc3a9067197e9375a22273d3..3292780ef73fdc7a8d4132f602d821dcd639c9ad 100644 --- a/applications/utilities/surface/surfaceInflate/surfaceInflate.C +++ b/applications/utilities/surface/surfaceInflate/surfaceInflate.C @@ -360,8 +360,8 @@ tmp<scalarField> avg const scalarField& edgeWeights ) { - tmp<scalarField> tres(new scalarField(s.nPoints(), Zero)); - scalarField& res = tres.ref(); + auto tres = tmp<scalarField>::New(s.nPoints(), Zero); + auto& res = tres.ref(); scalarField sumWeight(s.nPoints(), Zero); diff --git a/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C b/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C index cde4e69ae59ebd074e20a8c875b170b3e44acd41..097c6d57fb756bf28b47ccc31f61909950237788 100644 --- a/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C +++ b/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C @@ -62,8 +62,8 @@ tmp<pointField> avg { const labelListList& pointEdges = s.pointEdges(); - tmp<pointField> tavg(new pointField(s.nPoints(), Zero)); - pointField& avg = tavg.ref(); + auto tavg = tmp<pointField>::New(s.nPoints(), Zero); + auto& avg = tavg.ref(); forAll(pointEdges, vertI) { diff --git a/tutorials/mesh/moveDynamicMesh/twistingColumn/constant/dynamicMeshDict b/tutorials/mesh/moveDynamicMesh/twistingColumn/constant/dynamicMeshDict index f5aa788d6b5172f2192800e72bbf2e636dc70f46..dd0504a986c280dd06f982e0b0fc741594e8aadc 100644 --- a/tutorials/mesh/moveDynamicMesh/twistingColumn/constant/dynamicMeshDict +++ b/tutorials/mesh/moveDynamicMesh/twistingColumn/constant/dynamicMeshDict @@ -33,8 +33,8 @@ localCode const pointField& points ) { - tmp<pointField> tnewPoints(new pointField(points)); - pointField& newPoints = tnewPoints.ref(); + auto tnewPoints = tmp<pointField>::New(points); + auto& newPoints = tnewPoints.ref(); const boundBox bb(points, true); const scalar zMin = bb.min()[vector::Z];