From fff301052d0485161a300c9071adf81841c81a5f Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Sun, 8 Oct 2023 18:35:04 +0200
Subject: [PATCH] ENH: use tmp field factory methods [12] (#2723)

- applications
---
 .../PDRModels/dragModels/basic/basic.C        | 45 +++-------
 .../XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.C | 22 ++---
 .../XiModels/XiEqModels/XiEqModel/XiEqModel.C | 44 ++++------
 .../SCOPE/SCOPELaminarFlameSpeed.C            | 86 ++++++-------------
 .../MPPICInterFoam/alphaEqnSubCycle.H         |  7 +-
 .../solvers/multiphase/VoF/alphaEqnSubCycle.H |  7 +-
 .../compressibleAlphaEqnSubCycle.H            | 21 ++---
 .../compressibleAlphaEqnSubCycle.H            | 21 ++---
 .../multiphaseMixtureThermo.C                 | 20 ++---
 .../driftFluxFoam/alphaEqnSubCycle.H          |  7 +-
 .../relativeVelocityModel.C                   | 10 +--
 .../laserDTRM/laserDTRM.C                     | 55 ++++--------
 .../localDensityAbsorptionEmission.C          | 66 ++++----------
 .../constant/constant.C                       | 12 +--
 .../twoPhaseMixtureEThermo.C                  |  2 +-
 .../interMixingFoam/alphaEqnSubCycle.H        |  7 +-
 .../interIsoFoam/alphaEqnSubCycle.H           |  7 +-
 .../interPhaseChangeFoam/alphaEqnSubCycle.H   |  7 +-
 .../multiphase/multiphaseEulerFoam/pEqn.H     |  3 +-
 .../multiphaseMixture/multiphaseMixture.C     | 60 ++++---------
 .../twoLiquidMixingFoam/alphaEqnSubCycle.H    |  7 +-
 .../test/PatchTools/Test-PatchTools.C         |  4 +-
 .../extrudeToRegionMesh/extrudeToRegionMesh.C |  4 +-
 .../cellSizeAndAlignmentGrid.C                |  4 +-
 .../DelaunayMeshToolsTemplates.C              |  4 +-
 .../cellShapeControlMesh.C                    |  4 +-
 .../smoothAlignmentSolver.C                   |  4 +-
 .../foamyHexMeshBackgroundMesh.C              |  4 +-
 .../foamDictionary/foamDictionary.C           |  2 +-
 .../surface/surfaceInflate/surfaceInflate.C   |  4 +-
 .../surfaceLambdaMuSmooth.C                   |  4 +-
 .../twistingColumn/constant/dynamicMeshDict   |  4 +-
 32 files changed, 171 insertions(+), 387 deletions(-)

diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.C b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.C
index ed72bbe540d..b48af20fea7 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 b80b72a4c7c..04f977f208a 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 084ffc1aef6..5d87437f6ca 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 6c9a7e10853..805c2f59890 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 16269f7c4c9..392a953b6a8 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 c53d6e106b4..9ca190cb6fc 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 51dd6ea56c2..3f4c9779450 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 5fda0912c58..45d4077f4c1 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 77d276973fd..a190682c4a0 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 b38144700cc..ac51ae482ed 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 dc36b96e6a1..e88b24f32d2 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 6524c571aed..40c906b57e5 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 72e3d08d90e..a2cabf5d86b 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 8f1fb0f8837..121d3a5027b 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 0cf652dbf53..f877106c19d 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 117e593c69e..acbea8e9b9d 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 65376d61fe4..3189654bf5c 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 f4643f1df43..89576739694 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 02ae8778b9f..88615618881 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 9c6ff5d3314..67db0089ab7 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 0347512d281..5fb0d160414 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 c7222340060..6adfedd36de 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 decbb1aa566..f558637ce54 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 6d96b054a29..6b8c08a947b 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 70cae969d54..5b0bbc30282 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 3df705a82c2..27ebc07801c 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 fa4748d1c79..8ad03d0b2fc 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 b17e8c7c26e..3ac559c82ad 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 9b2a97bbede..bff76e88fd2 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 69adf9f171d..3292780ef73 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 cde4e69ae59..097c6d57fb7 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 f5aa788d6b5..dd0504a986c 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];
-- 
GitLab