From 14a471f937d7db5bc8c520e86fb8338fd0d20843 Mon Sep 17 00:00:00 2001
From: Mattijs Janssens <ext-mjanssens@esi-group.com>
Date: Mon, 21 Dec 2020 14:54:59 +0000
Subject: [PATCH] BUG: cyclicACMI: different construction order. See #1953.

This makes the initialisation order of dynamicMesh consistent
with plain ones using the virtual mechanism. It does not
solve the cyclicACMI construction order yet.
---
 .../meshes/primitiveMesh/primitiveMesh.H      |  4 ++
 .../meshes/primitiveMesh/primitiveMeshClear.C | 14 ++++++
 .../interfaceTrackingFvMesh.C                 | 14 +++++-
 .../interfaceTrackingFvMesh.H                 |  3 +-
 .../dynamicFvMesh/dynamicFvMesh.C             | 26 ++++++++--
 .../dynamicFvMesh/dynamicFvMesh.H             | 27 ++++++----
 .../dynamicFvMesh/dynamicFvMeshNew.C          | 31 +++++++++++-
 .../dynamicInkJetFvMesh/dynamicInkJetFvMesh.C | 10 +++-
 .../dynamicInkJetFvMesh/dynamicInkJetFvMesh.H |  3 +-
 .../dynamicMotionSolverFvMesh.C               | 36 +++++++++++--
 .../dynamicMotionSolverFvMesh.H               |  6 ++-
 .../dynamicMotionSolverFvMeshAMI.C            | 31 ++++++++++--
 .../dynamicMotionSolverFvMeshAMI.H            |  9 +++-
 .../dynamicMotionSolverListFvMesh.C           | 30 +++++++++--
 .../dynamicMotionSolverListFvMesh.H           | 10 +++-
 .../dynamicMultiMotionSolverFvMesh.C          | 32 ++++++++++--
 .../dynamicMultiMotionSolverFvMesh.H          | 11 +++-
 .../dynamicRefineFvMesh/dynamicRefineFvMesh.C | 34 ++++++++++---
 .../dynamicRefineFvMesh/dynamicRefineFvMesh.H |  9 +++-
 .../include/createDynamicFvMesh.H             |  5 +-
 src/dynamicFvMesh/staticFvMesh/staticFvMesh.C |  6 ++-
 src/dynamicFvMesh/staticFvMesh/staticFvMesh.H |  3 +-
 src/finiteVolume/fvMesh/fvMesh.C              | 11 ++--
 .../cyclicACMIPolyPatch/cyclicACMIPolyPatch.C | 41 ++++++++-------
 .../dynamicOversetFvMesh.C                    | 29 +++++++++--
 .../dynamicOversetFvMesh.H                    |  5 +-
 .../dynamicMotionSolverTopoFvMesh.C           | 33 ++++++++++--
 .../dynamicMotionSolverTopoFvMesh.H           | 11 +++-
 .../movingConeTopoFvMesh.C                    | 50 ++++++++++++++-----
 .../movingConeTopoFvMesh.H                    | 10 +++-
 .../rawTopoChangerFvMesh.C                    | 14 +++++-
 .../rawTopoChangerFvMesh.H                    |  7 ++-
 .../topoChangerFvMesh/topoChangerFvMesh.C     |  9 +++-
 .../topoChangerFvMesh/topoChangerFvMesh.H     |  3 +-
 34 files changed, 469 insertions(+), 108 deletions(-)

diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H
index 3ef4a22261a..ecbcbe277a5 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H
+++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H
@@ -899,6 +899,10 @@ public:
             //- Clear geometry
             void clearGeom();
 
+            //- Clear cell-based geometry only
+            //  Use with care! currently used by cyclicACMI
+            void clearCellGeom();
+
             //- Clear topological data
             void clearAddressing();
 
diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshClear.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshClear.C
index 2efd5cb8617..bf19ed1ffe4 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshClear.C
+++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshClear.C
@@ -140,6 +140,20 @@ void Foam::primitiveMesh::clearGeom()
 }
 
 
+void Foam::primitiveMesh::clearCellGeom()
+{
+    if (debug)
+    {
+        Pout<< "primitiveMesh::clearCellGeom() : "
+            << "clearing cell centres and volumes"
+            << endl;
+    }
+
+    deleteDemandDrivenData(cellCentresPtr_);
+    deleteDemandDrivenData(cellVolumesPtr_);
+}
+
+
 void Foam::primitiveMesh::clearAddressing()
 {
     if (debug)
diff --git a/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C b/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C
index 51d558a1fb9..a8b43d2b36b 100644
--- a/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C
+++ b/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C
@@ -60,6 +60,12 @@ namespace Foam
         interfaceTrackingFvMesh,
         IOobject
     );
+    addToRunTimeSelectionTable
+    (
+        dynamicFvMesh,
+        interfaceTrackingFvMesh,
+        doInit
+    );
 }
 
 
@@ -1553,9 +1559,13 @@ void Foam::interfaceTrackingFvMesh::correctContactLinePointNormals()
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::interfaceTrackingFvMesh::interfaceTrackingFvMesh(const IOobject& io)
+Foam::interfaceTrackingFvMesh::interfaceTrackingFvMesh
+(
+    const IOobject& io,
+    const bool doInit
+)
 :
-    dynamicMotionSolverFvMesh(io),
+    dynamicMotionSolverFvMesh(io, doInit),
     aMeshPtr_(new faMesh(*this)),
     fsPatchIndex_(-1),
     fixedFreeSurfacePatches_
diff --git a/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.H b/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.H
index 45bf37cf601..784ecff18a8 100644
--- a/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.H
+++ b/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.H
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2019 Zeljko Tukovic, FSB Zagreb.
+    Copyright (C) 2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -250,7 +251,7 @@ public:
     // Constructors
 
         //- Construct from IOobject
-        interfaceTrackingFvMesh(const IOobject& io);
+        interfaceTrackingFvMesh(const IOobject& io, const bool doInit=true);
 
         //- Construct from components without boundary.
         //  Boundary is added using addFvPatches() member function
diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C
index d72616b9ae4..fbca1942374 100644
--- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C
+++ b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2012 OpenFOAM Foundation
-    Copyright (C) 2018-2019 OpenCFD Ltd.
+    Copyright (C) 2018-2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -34,6 +34,7 @@ namespace Foam
 {
     defineTypeNameAndDebug(dynamicFvMesh, 0);
     defineRunTimeSelectionTable(dynamicFvMesh, IOobject);
+    defineRunTimeSelectionTable(dynamicFvMesh, doInit);
 }
 
 
@@ -74,12 +75,29 @@ void Foam::dynamicFvMesh::readDict()
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::dynamicFvMesh::dynamicFvMesh(const IOobject& io)
+Foam::dynamicFvMesh::dynamicFvMesh(const IOobject& io, const bool doInit)
 :
-    fvMesh(io),
-    timeControl_(io.time(), "update")
+    fvMesh(io, doInit),
+    timeControl_(io.time(), "update")   // assume has no side effects
 {
+    if (doInit)
+    {
+        init(false);    // do not initialise lower levels
+    }
+}
+
+
+bool Foam::dynamicFvMesh::init(const bool doInit)
+{
+    if (doInit)
+    {
+        fvMesh::init(doInit);
+    }
+
     readDict();
+
+    // Assume something changed
+    return true;
 }
 
 
diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H
index c59bdbd23ca..8622bb0ecb9 100644
--- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H
+++ b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2018-2019 OpenCFD Ltd.
+    Copyright (C) 2018-2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -100,11 +100,23 @@ public:
             (io)
         );
 
+        declareRunTimeSelectionTable
+        (
+            autoPtr,
+            dynamicFvMesh,
+            doInit,
+            (
+                const IOobject& io,
+                const bool doInit
+            ),
+            (io, doInit)
+        );
+
 
     // Constructors
 
         //- Construct from an IOobject
-        explicit dynamicFvMesh(const IOobject& io); //, const bool doInit=true);
+        explicit dynamicFvMesh(const IOobject& io, const bool doInit=true);
 
         //- Construct from components without boundary.
         //  Boundary is added using addFvPatches() member function
@@ -139,11 +151,7 @@ public:
         //- Select, construct and return the dynamicFvMesh
         //  If the constant/dynamicMeshDict does not exist
         //  a staticFvMesh is returned
-        static autoPtr<dynamicFvMesh> New
-        (
-            const IOobject& io  //,
-            //const bool doInit=true
-        );
+        static autoPtr<dynamicFvMesh> New(const IOobject& io);
 
 
         //- Select, construct and return the dynamicFvMesh
@@ -152,8 +160,7 @@ public:
         static autoPtr<dynamicFvMesh> New
         (
             const argList& args,
-            const Time& runTime //,
-            //const bool doInit=true
+            const Time& runTime
         );
 
 
@@ -164,7 +171,7 @@ public:
     // Member Functions
 
         //- Initialise all non-demand-driven data
-        //virtual bool init(const bool doInit);
+        virtual bool init(const bool doInit);
 
         //- Is mesh dynamic
         virtual bool dynamic() const
diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C
index c1c8e7409dc..482ff63e4c0 100644
--- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C
+++ b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2019 OpenCFD Ltd.
+    Copyright (C) 2019-2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -72,6 +72,24 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
                 << exit(FatalError);
         }
 
+        auto doInitCstrIter = doInitConstructorTablePtr_->cfind(modelType);
+
+        if (doInitCstrIter.found())
+        {
+            DebugInfo
+                << "Constructing dynamicFvMesh with explicit initialisation"
+                << endl;
+
+            // Two-step constructor
+            // 1. Construct mesh, do not initialise
+            autoPtr<dynamicFvMesh> meshPtr(doInitCstrIter()(io, false));
+
+            // 2. Initialise parents and itself
+            meshPtr().init(true);
+
+            return meshPtr;
+        }
+
         auto cstrIter = IOobjectConstructorTablePtr_->cfind(modelType);
 
         if (!cstrIter.found())
@@ -88,7 +106,16 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
         return autoPtr<dynamicFvMesh>(cstrIter()(io));
     }
 
-    return autoPtr<dynamicFvMesh>(new staticFvMesh(io));
+    DebugInfo
+        << "Constructing staticFvMesh with explicit initialisation" << endl;
+
+    // 1. Construct mesh, do not initialise
+    autoPtr<dynamicFvMesh> meshPtr(new staticFvMesh(io, false));
+
+    // 2. Initialise parents and itself
+    meshPtr().init(true);
+
+    return meshPtr;
 }
 
 
diff --git a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C b/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C
index cae8c5c2a02..90f4cd729c8 100644
--- a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C
+++ b/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
+    Copyright (C) 2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -36,14 +37,19 @@ namespace Foam
 {
     defineTypeNameAndDebug(dynamicInkJetFvMesh, 0);
     addToRunTimeSelectionTable(dynamicFvMesh, dynamicInkJetFvMesh, IOobject);
+    addToRunTimeSelectionTable(dynamicFvMesh, dynamicInkJetFvMesh, doInit);
 }
 
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::dynamicInkJetFvMesh::dynamicInkJetFvMesh(const IOobject& io)
+Foam::dynamicInkJetFvMesh::dynamicInkJetFvMesh
+(
+    const IOobject& io,
+    const bool doInit
+)
 :
-    dynamicFvMesh(io),
+    dynamicFvMesh(io, doInit),
     dynamicMeshCoeffs_
     (
         IOdictionary
diff --git a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.H b/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.H
index 530b8fc025a..fffc44a51ee 100644
--- a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.H
+++ b/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.H
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
+    Copyright (C) 2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -88,7 +89,7 @@ public:
     // Constructors
 
         //- Construct from IOobject
-        dynamicInkJetFvMesh(const IOobject& io);
+        dynamicInkJetFvMesh(const IOobject& io, const bool doInit=true);
 
 
     //- Destructor
diff --git a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C
index 5b7a90cddc8..2e4ea6752c7 100644
--- a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C
+++ b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2012 OpenFOAM Foundation
+    Copyright (C) 2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -41,16 +42,43 @@ namespace Foam
         dynamicMotionSolverFvMesh,
         IOobject
     );
+    addToRunTimeSelectionTable
+    (
+        dynamicFvMesh,
+        dynamicMotionSolverFvMesh,
+        doInit
+    );
 }
 
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::dynamicMotionSolverFvMesh::dynamicMotionSolverFvMesh(const IOobject& io)
+Foam::dynamicMotionSolverFvMesh::dynamicMotionSolverFvMesh
+(
+    const IOobject& io,
+    const bool doInit
+)
 :
-    dynamicFvMesh(io),
-    motionPtr_(motionSolver::New(*this))
-{}
+    dynamicFvMesh(io, doInit),
+    motionPtr_(nullptr)
+{
+    if (doInit)
+    {
+        init(false);    // do not initialise lower levels
+    }
+}
+
+
+bool Foam::dynamicMotionSolverFvMesh::init(const bool doInit)
+{
+    if (doInit)
+    {
+        dynamicFvMesh::init(doInit);
+    }
+
+    motionPtr_ = motionSolver::New(*this);
+    return true;
+}
 
 
 Foam::dynamicMotionSolverFvMesh::dynamicMotionSolverFvMesh
diff --git a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H
index 2192a010e7d..ba8e1aca127 100644
--- a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H
+++ b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
+    Copyright (C) 2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -77,7 +78,7 @@ public:
     // Constructors
 
         //- Construct from IOobject
-        dynamicMotionSolverFvMesh(const IOobject& io);
+        dynamicMotionSolverFvMesh(const IOobject& io, bool syncPar=true);
 
         //- Construct from components without boundary.
         //  Boundary is added using addFvPatches() member function
@@ -98,6 +99,9 @@ public:
 
     // Member Functions
 
+        //- Initialise all non-demand-driven data
+        virtual bool init(const bool doInit);
+
         //- Return the motionSolver
         const motionSolver& motion() const;
 
diff --git a/src/dynamicFvMesh/dynamicMotionSolverFvMeshAMI/dynamicMotionSolverFvMeshAMI.C b/src/dynamicFvMesh/dynamicMotionSolverFvMeshAMI/dynamicMotionSolverFvMeshAMI.C
index e431a39536d..a2debb0e24f 100644
--- a/src/dynamicFvMesh/dynamicMotionSolverFvMeshAMI/dynamicMotionSolverFvMeshAMI.C
+++ b/src/dynamicFvMesh/dynamicMotionSolverFvMeshAMI/dynamicMotionSolverFvMeshAMI.C
@@ -49,6 +49,12 @@ namespace Foam
         dynamicMotionSolverFvMeshAMI,
         IOobject
     );
+    addToRunTimeSelectionTable
+    (
+        dynamicFvMesh,
+        dynamicMotionSolverFvMeshAMI,
+        doInit
+    );
 }
 
 
@@ -56,12 +62,29 @@ namespace Foam
 
 Foam::dynamicMotionSolverFvMeshAMI::dynamicMotionSolverFvMeshAMI
 (
-    const IOobject& io
+    const IOobject& io,
+    const bool doInit
 )
 :
-    dynamicFvMesh(io),
-    motionPtr_(motionSolver::New(*this))
-{}
+    dynamicFvMesh(io, doInit)
+{
+    if (doInit)
+    {
+        init(false);    // do not initialise lower levels
+    }
+}
+
+
+bool Foam::dynamicMotionSolverFvMeshAMI::init(const bool doInit)
+{
+    if (doInit)
+    {
+        dynamicFvMesh::init(doInit);
+    }
+
+    motionPtr_ = motionSolver::New(*this);
+    return true;
+}
 
 
 Foam::dynamicMotionSolverFvMeshAMI::dynamicMotionSolverFvMeshAMI
diff --git a/src/dynamicFvMesh/dynamicMotionSolverFvMeshAMI/dynamicMotionSolverFvMeshAMI.H b/src/dynamicFvMesh/dynamicMotionSolverFvMeshAMI/dynamicMotionSolverFvMeshAMI.H
index e21f5623ed7..074805ad790 100644
--- a/src/dynamicFvMesh/dynamicMotionSolverFvMeshAMI/dynamicMotionSolverFvMeshAMI.H
+++ b/src/dynamicFvMesh/dynamicMotionSolverFvMeshAMI/dynamicMotionSolverFvMeshAMI.H
@@ -81,7 +81,11 @@ public:
     // Constructors
 
         //- Construct from IOobject
-        dynamicMotionSolverFvMeshAMI(const IOobject& io);
+        dynamicMotionSolverFvMeshAMI
+        (
+            const IOobject& io,
+            const bool doInit=true
+        );
 
         //- Construct from components without boundary.
         //  Boundary is added using addFvPatches() member function
@@ -102,6 +106,9 @@ public:
 
     // Member Functions
 
+        //- Initialise all non-demand-driven data
+        virtual bool init(const bool doInit);
+
         //- Return the motionSolver
         const motionSolver& motion() const;
 
diff --git a/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C
index f9b0c7ba67c..725b90e8454 100644
--- a/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C
+++ b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2016 OpenFOAM Foundation
-    Copyright (C) 2019 OpenCFD Ltd.
+    Copyright (C) 2019-2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -43,6 +43,12 @@ namespace Foam
         dynamicMotionSolverListFvMesh,
         IOobject
     );
+    addToRunTimeSelectionTable
+    (
+        dynamicFvMesh,
+        dynamicMotionSolverListFvMesh,
+        doInit
+    );
 }
 
 
@@ -50,12 +56,27 @@ namespace Foam
 
 Foam::dynamicMotionSolverListFvMesh::dynamicMotionSolverListFvMesh
 (
-    const IOobject& io
+    const IOobject& io,
+    const bool doInit
 )
 :
-    dynamicFvMesh(io),
+    dynamicFvMesh(io, doInit),
     motionSolvers_()
 {
+    if (doInit)
+    {
+        init(false);    // do not initialise lower levels
+    }
+}
+
+
+bool Foam::dynamicMotionSolverListFvMesh::init(const bool doInit)
+{
+    if (doInit)
+    {
+        dynamicFvMesh::init(doInit);
+    }
+
     IOobject ioDict
     (
         "dynamicMeshDict",
@@ -104,6 +125,9 @@ Foam::dynamicMotionSolverListFvMesh::dynamicMotionSolverListFvMesh
         motionSolvers_.setSize(1);
         motionSolvers_.set(i++, motionSolver::New(*this));
     }
+
+    // Assume something changed
+    return true;
 }
 
 
diff --git a/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.H b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.H
index e44f5132b17..edefc5dc16f 100644
--- a/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.H
+++ b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.H
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2016 OpenFOAM Foundation
+    Copyright (C) 2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -82,7 +83,11 @@ public:
     // Constructors
 
         //- Construct from IOobject
-        dynamicMotionSolverListFvMesh(const IOobject& io);
+        dynamicMotionSolverListFvMesh
+        (
+            const IOobject& io,
+            const bool doInit=true
+        );
 
 
     //- Destructor
@@ -91,6 +96,9 @@ public:
 
     // Member Functions
 
+        //- Initialise all non-demand-driven data
+        virtual bool init(const bool doInit);
+
         //- Dummy update function which does not change the mesh
         virtual bool update();
 };
diff --git a/src/dynamicFvMesh/dynamicMultiMotionSolverFvMesh/dynamicMultiMotionSolverFvMesh.C b/src/dynamicFvMesh/dynamicMultiMotionSolverFvMesh/dynamicMultiMotionSolverFvMesh.C
index 1cdaac56436..ae1916ab204 100644
--- a/src/dynamicFvMesh/dynamicMultiMotionSolverFvMesh/dynamicMultiMotionSolverFvMesh.C
+++ b/src/dynamicFvMesh/dynamicMultiMotionSolverFvMesh/dynamicMultiMotionSolverFvMesh.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2016 OpenCFD Ltd.
+    Copyright (C) 2016-2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -42,6 +42,12 @@ namespace Foam
         dynamicMultiMotionSolverFvMesh,
         IOobject
     );
+    addToRunTimeSelectionTable
+    (
+        dynamicFvMesh,
+        dynamicMultiMotionSolverFvMesh,
+        doInit
+    );
 }
 
 
@@ -49,17 +55,32 @@ namespace Foam
 
 Foam::dynamicMultiMotionSolverFvMesh::dynamicMultiMotionSolverFvMesh
 (
-    const IOobject& io
+    const IOobject& io,
+    const bool doInit
 )
 :
-    dynamicFvMesh(io)
+    dynamicFvMesh(io, doInit)
+{
+    if (doInit)
+    {
+        init(false);    // do not initialise lower levels
+    }
+}
+
+
+bool Foam::dynamicMultiMotionSolverFvMesh::init(const bool doInit)
 {
+    if (doInit)
+    {
+        dynamicFvMesh::init(doInit);
+    }
+
     IOdictionary dynDict
     (
         IOobject
         (
             "dynamicMeshDict",
-            io.time().constant(),
+            time().constant(),
             *this,
             IOobject::MUST_READ_IF_MODIFIED,
             IOobject::NO_WRITE,
@@ -139,6 +160,9 @@ Foam::dynamicMultiMotionSolverFvMesh::dynamicMultiMotionSolverFvMesh
     zoneIDs_.setSize(zonei);
     motionPtr_.setSize(zonei);
     pointIDs_.setSize(zonei);
+
+    // Assume changed ...
+    return true;
 }
 
 
diff --git a/src/dynamicFvMesh/dynamicMultiMotionSolverFvMesh/dynamicMultiMotionSolverFvMesh.H b/src/dynamicFvMesh/dynamicMultiMotionSolverFvMesh/dynamicMultiMotionSolverFvMesh.H
index 4efc26afbe8..7e3f82df33c 100644
--- a/src/dynamicFvMesh/dynamicMultiMotionSolverFvMesh/dynamicMultiMotionSolverFvMesh.H
+++ b/src/dynamicFvMesh/dynamicMultiMotionSolverFvMesh/dynamicMultiMotionSolverFvMesh.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2016 OpenCFD Ltd.
+    Copyright (C) 2016-2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -87,7 +87,11 @@ public:
     // Constructors
 
         //- Construct from IOobject
-        explicit dynamicMultiMotionSolverFvMesh(const IOobject& io);
+        explicit dynamicMultiMotionSolverFvMesh
+        (
+            const IOobject& io,
+            const bool doInit=true
+        );
 
 
     //- Destructor
@@ -96,6 +100,9 @@ public:
 
     // Member Functions
 
+        //- Initialise all non-demand-driven data
+        virtual bool init(const bool doInit);
+
         //- Update the mesh for both mesh motion and topology change
         virtual bool update();
 };
diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C
index b4a35aab64c..3db9be82a68 100644
--- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C
+++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C
@@ -44,6 +44,7 @@ namespace Foam
 {
     defineTypeNameAndDebug(dynamicRefineFvMesh, 0);
     addToRunTimeSelectionTable(dynamicFvMesh, dynamicRefineFvMesh, IOobject);
+    addToRunTimeSelectionTable(dynamicFvMesh, dynamicRefineFvMesh, doInit);
 }
 
 // * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
@@ -1014,14 +1015,33 @@ void Foam::dynamicRefineFvMesh::checkEightAnchorPoints
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::dynamicRefineFvMesh::dynamicRefineFvMesh(const IOobject& io)
+Foam::dynamicRefineFvMesh::dynamicRefineFvMesh
+(
+    const IOobject& io,
+    const bool doInit
+)
 :
-    dynamicFvMesh(io),
-    meshCutter_(*this),
-    protectedCell_(nCells()),
-    nRefinementIterations_(0),
-    dumpLevel_(false)
+    dynamicFvMesh(io, doInit),
+    meshCutter_(*this)
 {
+    if (doInit)
+    {
+        init(false);    // do not initialise lower levels
+    }
+}
+
+
+bool Foam::dynamicRefineFvMesh::init(const bool doInit)
+{
+    if (doInit)
+    {
+        dynamicFvMesh::init(doInit);
+    }
+
+    protectedCell_.setSize(nCells());
+    nRefinementIterations_ = 0;
+    dumpLevel_ = false;
+
     // Read static part of dictionary
     readDict();
 
@@ -1175,6 +1195,8 @@ Foam::dynamicRefineFvMesh::dynamicRefineFvMesh(const IOobject& io)
 
         protectedCells.write();
     }
+
+    return true;
 }
 
 
diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.H b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.H
index 795a541bd43..7025f7aaada 100644
--- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.H
+++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.H
@@ -228,7 +228,11 @@ public:
     // Constructors
 
         //- Construct from IOobject
-        explicit dynamicRefineFvMesh(const IOobject& io);
+        explicit dynamicRefineFvMesh
+        (
+            const IOobject& io,
+            const bool doInit=true
+        );
 
 
     //- Destructor
@@ -237,6 +241,9 @@ public:
 
     // Member Functions
 
+        //- Initialise all non-demand-driven data
+        virtual bool init(const bool doInit);
+
         //- Direct access to the refinement engine
         const hexRef8& meshCutter() const
         {
diff --git a/src/dynamicFvMesh/include/createDynamicFvMesh.H b/src/dynamicFvMesh/include/createDynamicFvMesh.H
index d447d12dd6d..543bcbfe34f 100644
--- a/src/dynamicFvMesh/include/createDynamicFvMesh.H
+++ b/src/dynamicFvMesh/include/createDynamicFvMesh.H
@@ -1,9 +1,6 @@
 Info<< "Create mesh for time = "
     << runTime.timeName() << nl << endl;
 
-autoPtr<dynamicFvMesh> meshPtr(dynamicFvMesh::New(args, runTime));//, false));
+autoPtr<dynamicFvMesh> meshPtr(dynamicFvMesh::New(args, runTime));
 
 dynamicFvMesh& mesh = meshPtr();
-
-// initialise all (lower levels and current)
-mesh.init(true);
diff --git a/src/dynamicFvMesh/staticFvMesh/staticFvMesh.C b/src/dynamicFvMesh/staticFvMesh/staticFvMesh.C
index 7522a5bf25e..5dbffcf322c 100644
--- a/src/dynamicFvMesh/staticFvMesh/staticFvMesh.C
+++ b/src/dynamicFvMesh/staticFvMesh/staticFvMesh.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
+    Copyright (C) 2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -34,14 +35,15 @@ namespace Foam
 {
     defineTypeNameAndDebug(staticFvMesh, 0);
     addToRunTimeSelectionTable(dynamicFvMesh, staticFvMesh, IOobject);
+    addToRunTimeSelectionTable(dynamicFvMesh, staticFvMesh, doInit);
 }
 
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::staticFvMesh::staticFvMesh(const IOobject& io)
+Foam::staticFvMesh::staticFvMesh(const IOobject& io, const bool doInit)
 :
-    dynamicFvMesh(io)
+    dynamicFvMesh(io, doInit)
 {}
 
 
diff --git a/src/dynamicFvMesh/staticFvMesh/staticFvMesh.H b/src/dynamicFvMesh/staticFvMesh/staticFvMesh.H
index acbd62338f8..e182d24c34e 100644
--- a/src/dynamicFvMesh/staticFvMesh/staticFvMesh.H
+++ b/src/dynamicFvMesh/staticFvMesh/staticFvMesh.H
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
+    Copyright (C) 2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -70,7 +71,7 @@ public:
     // Constructors
 
         //- Construct from IOobject
-        staticFvMesh(const IOobject& io);
+        staticFvMesh(const IOobject& io, const bool doInit=true);
 
         //- Construct from components without boundary.
         //  Boundary is added using addFvPatches() member function
diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C
index d93a7e5c48f..7a8de07dd3f 100644
--- a/src/finiteVolume/fvMesh/fvMesh.C
+++ b/src/finiteVolume/fvMesh/fvMesh.C
@@ -278,10 +278,6 @@ bool Foam::fvMesh::init(const bool doInit)
 
         // Intialise my data
         polyMesh::init(doInit);
-
-        // All addressing needs to be updated
-        // deleteDemandDrivenData(lduPtr_);
-        clearAddressing(true);
     }
 
     // Check the existence of the cell volumes and read if present
@@ -345,7 +341,9 @@ bool Foam::fvMesh::init(const bool doInit)
 
         moving(true);
     }
-    return false;
+
+    // Assume something changed
+    return true;
 }
 
 
@@ -932,7 +930,8 @@ Foam::tmp<Foam::scalarField> Foam::fvMesh::movePoints(const pointField& p)
 
 void Foam::fvMesh::updateGeom()
 {
-    // Let surfaceInterpolation handle geometry calculation
+    // Let surfaceInterpolation handle geometry calculation. Note: this does
+    // lower levels updateGeom
     surfaceInterpolation::updateGeom();
 }
 
diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C
index f14f2758280..b7c63b02714 100644
--- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C
+++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C
@@ -288,24 +288,27 @@ void Foam::cyclicACMIPolyPatch::resetAMI(const UList<point>& points) const
     {
         DebugPout
             << "cyclicACMIPolyPatch::resetAMI : clearing cellCentres"
-            << " for " << name() << " and " << nonOverlapPatch.name()
-            << endl;
-
-        WarningInFunction
-           << "The mesh already has cellCentres calculated when"
-           << " resetting ACMI " << name() << "." << nl
-           << "This is a problem since ACMI adapts the face areas"
-           << " (to close cells) so this has" << nl
-           << "to be done before cell centre calculation." << nl
-           << "This can happen if e.g. the cyclicACMI is after"
-           << " any processor patches in the boundary." << endl;
-        const_cast<polyMesh&>(mesh).primitiveMesh::clearGeom();
+            << " for " << name() << " and " << nonOverlapPatch.name() << nl
+            << "The mesh already has cellCentres calculated when"
+            << " resetting ACMI " << name() << "." << nl
+            << "This is a problem since ACMI adapts the face areas"
+            << " (to close cells) so this has" << nl
+            << "to be done before cell centre calculation." << nl
+            << "This can happen if e.g. the cyclicACMI is after"
+            << " any processor patches in the boundary." << endl;
+
+        const_cast<polyMesh&>(mesh).primitiveMesh::clearCellGeom();
     }
 
-
-    // Trigger re-building of faceAreas
-    (void)mesh.faceAreas();
-
+    // At this point we want face geometry but not cell geometry since we want
+    // correct the face area on duplicate baffles before calculating the cell
+    // centres and volumes.
+    if (!mesh.hasFaceAreas())
+    {
+        FatalErrorInFunction
+            << "primitiveMesh must already have face geometry"
+            << abort(FatalError);
+    }
 
     // Calculate the AMI using partial face-area-weighted. This leaves
     // the weights as fractions of local areas (sum(weights) = 1 means
@@ -423,9 +426,13 @@ void Foam::cyclicACMIPolyPatch::initMovePoints
     DebugPout<< "cyclicACMIPolyPatch::initMovePoints : " << name() << endl;
 
     // Note: calculates transformation and triggers face centre calculation
-    // - Note: resetAMI called by cyclicAMIPolyPatch::initMovePoints
     cyclicAMIPolyPatch::initMovePoints(pBufs, p);
 
+    if (!createAMIFaces_ && canResetAMI())
+    {
+        resetAMI();
+    }
+
     scalePatchFaceAreas();
 }
 
diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C
index 89013e02d84..8d1df08a541 100644
--- a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C
+++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C
@@ -38,6 +38,7 @@ namespace Foam
 {
     defineTypeNameAndDebug(dynamicOversetFvMesh, 0);
     addToRunTimeSelectionTable(dynamicFvMesh, dynamicOversetFvMesh, IOobject);
+    addToRunTimeSelectionTable(dynamicFvMesh, dynamicOversetFvMesh, doInit);
 }
 
 
@@ -526,13 +527,35 @@ void Foam::dynamicOversetFvMesh::writeAgglomeration
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::dynamicOversetFvMesh::dynamicOversetFvMesh(const IOobject& io)
+Foam::dynamicOversetFvMesh::dynamicOversetFvMesh
+(
+    const IOobject& io,
+    const bool doInit
+)
 :
-    dynamicMotionSolverListFvMesh(io),
-    active_(false)
+    dynamicMotionSolverListFvMesh(io, doInit)
+{
+    if (doInit)
+    {
+        init(false);    // do not initialise lower levels
+    }
+}
+
+
+bool Foam::dynamicOversetFvMesh::init(const bool doInit)
 {
+    if (doInit)
+    {
+        dynamicMotionSolverListFvMesh::init(doInit);
+    }
+
+    active_ = false;
+
     // Load stencil (but do not update)
     (void)Stencil::New(*this, false);
+
+    // Assume something changed
+    return true;
 }
 
 
diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.H b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.H
index 2a528b5bb62..0e9e343b114 100644
--- a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.H
+++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.H
@@ -186,7 +186,7 @@ public:
     // Constructors
 
         //- Construct from IOobject
-        dynamicOversetFvMesh(const IOobject& io);
+        dynamicOversetFvMesh(const IOobject& io, const bool doInit=true);
 
 
     //- Destructor
@@ -344,6 +344,9 @@ public:
                 }
 
 
+        //- Initialise all non-demand-driven data
+        virtual bool init(const bool doInit);
+
         //- Update the mesh for both mesh motion and topology change
         virtual bool update();
 
diff --git a/src/topoChangerFvMesh/dynamicMotionSolverTopoFvMesh/dynamicMotionSolverTopoFvMesh.C b/src/topoChangerFvMesh/dynamicMotionSolverTopoFvMesh/dynamicMotionSolverTopoFvMesh.C
index 1dab5568ca3..46f5cd86d83 100644
--- a/src/topoChangerFvMesh/dynamicMotionSolverTopoFvMesh/dynamicMotionSolverTopoFvMesh.C
+++ b/src/topoChangerFvMesh/dynamicMotionSolverTopoFvMesh/dynamicMotionSolverTopoFvMesh.C
@@ -45,6 +45,12 @@ namespace Foam
         dynamicMotionSolverTopoFvMesh,
         IOobject
     );
+    addToRunTimeSelectionTable
+    (
+        dynamicFvMesh,
+        dynamicMotionSolverTopoFvMesh,
+        doInit
+    );
 }
 
 
@@ -52,12 +58,31 @@ namespace Foam
 
 Foam::dynamicMotionSolverTopoFvMesh::dynamicMotionSolverTopoFvMesh
 (
-    const IOobject& io
+    const IOobject& io,
+    const bool doInit
 )
 :
-    topoChangerFvMesh(io),
-    motionPtr_(motionSolver::New(*this))
-{}
+    topoChangerFvMesh(io, doInit)
+{
+    if (doInit)
+    {
+        init(false);    // do not initialise lower levels
+    }
+}
+
+
+bool Foam::dynamicMotionSolverTopoFvMesh::init(const bool doInit)
+{
+    if (doInit)
+    {
+        topoChangerFvMesh::init(doInit);
+    }
+
+    motionPtr_ = motionSolver::New(*this);
+
+    // Assume something changed
+    return true;
+}
 
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
diff --git a/src/topoChangerFvMesh/dynamicMotionSolverTopoFvMesh/dynamicMotionSolverTopoFvMesh.H b/src/topoChangerFvMesh/dynamicMotionSolverTopoFvMesh/dynamicMotionSolverTopoFvMesh.H
index ac2eb4c040b..76bfe46f442 100644
--- a/src/topoChangerFvMesh/dynamicMotionSolverTopoFvMesh/dynamicMotionSolverTopoFvMesh.H
+++ b/src/topoChangerFvMesh/dynamicMotionSolverTopoFvMesh/dynamicMotionSolverTopoFvMesh.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2016 OpenCFD Ltd
+    Copyright (C) 2016-2020 OpenCFD Ltd
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -85,7 +85,11 @@ public:
     // Constructors
 
         //- Construct from database
-        explicit dynamicMotionSolverTopoFvMesh(const IOobject& io);
+        explicit dynamicMotionSolverTopoFvMesh
+        (
+            const IOobject& io,
+            const bool doInit=true
+        );
 
 
     //- Destructor
@@ -94,6 +98,9 @@ public:
 
     // Member Functions
 
+        //- Initialise all non-demand-driven data
+        virtual bool init(const bool doInit);
+
         //- Update the mesh for both mesh motion and topology change
         virtual bool update();
 };
diff --git a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C b/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C
index 58014383c70..6bdc46baf51 100644
--- a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C
+++ b/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C
@@ -49,6 +49,12 @@ namespace Foam
         movingConeTopoFvMesh,
         IOobject
     );
+    addToRunTimeSelectionTable
+    (
+        topoChangerFvMesh,
+        movingConeTopoFvMesh,
+        doInit
+    );
 }
 
 
@@ -238,9 +244,13 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers()
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(const IOobject& io)
+Foam::movingConeTopoFvMesh::movingConeTopoFvMesh
+(
+    const IOobject& io,
+    const bool doInit
+)
 :
-    topoChangerFvMesh(io),
+    topoChangerFvMesh(io, doInit),
     motionDict_
     (
         IOdictionary
@@ -255,17 +265,30 @@ Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(const IOobject& io)
                 false
             )
         ).optionalSubDict(typeName + "Coeffs")
-    ),
-    motionVelAmplitude_(motionDict_.get<vector>("motionVelAmplitude")),
-    motionVelPeriod_(motionDict_.get<scalar>("motionVelPeriod")),
-    curMotionVel_
-    (
-        motionVelAmplitude_*sin(time().value()*pi/motionVelPeriod_)
-    ),
-    leftEdge_(motionDict_.get<scalar>("leftEdge")),
-    curLeft_(motionDict_.get<scalar>("leftObstacleEdge")),
-    curRight_(motionDict_.get<scalar>("rightObstacleEdge"))
+    )
 {
+    if (doInit)
+    {
+        init(false);    // do not initialise lower levels
+    }
+}
+
+
+bool Foam::movingConeTopoFvMesh::init(const bool doInit)
+{
+    if (doInit)
+    {
+        topoChangerFvMesh::init(doInit);
+    }
+
+    motionVelAmplitude_ = motionDict_.get<vector>("motionVelAmplitude");
+    motionVelPeriod_ = motionDict_.get<scalar>("motionVelPeriod");
+    curMotionVel_ =
+        motionVelAmplitude_*sin(time().value()*pi/motionVelPeriod_);
+    leftEdge_ = motionDict_.get<scalar>("leftEdge");
+    curLeft_ = motionDict_.get<scalar>("leftObstacleEdge");
+    curRight_ = motionDict_.get<scalar>("rightObstacleEdge");
+
     Pout<< "Initial time:" << time().value()
         << " Initial curMotionVel_:" << curMotionVel_
         << endl;
@@ -294,6 +317,9 @@ Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(const IOobject& io)
         curLeft_,
         curRight_
     );
+
+    // Assume something changed
+    return true;
 }
 
 
diff --git a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.H b/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.H
index a67b252c34f..ea228dab0b3 100644
--- a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.H
+++ b/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.H
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
+    Copyright (C) 2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -113,7 +114,11 @@ public:
     // Constructors
 
         //- Construct from database
-        explicit movingConeTopoFvMesh(const IOobject& io);
+        explicit movingConeTopoFvMesh
+        (
+            const IOobject& io,
+            const bool doInit = true
+        );
 
 
     //- Destructor
@@ -122,6 +127,9 @@ public:
 
     // Member Functions
 
+        //- Initialise all non-demand-driven data
+        virtual bool init(const bool doInit);
+
         //- Update the mesh for both mesh motion and topology change
         virtual bool update();
 };
diff --git a/src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.C b/src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.C
index 6a19f964e23..9c2dae87361 100644
--- a/src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.C
+++ b/src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.C
@@ -43,15 +43,25 @@ namespace Foam
         rawTopoChangerFvMesh,
         IOobject
     );
+    addToRunTimeSelectionTable
+    (
+        topoChangerFvMesh,
+        rawTopoChangerFvMesh,
+        doInit
+    );
 }
 
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 // Construct from components
-Foam::rawTopoChangerFvMesh::rawTopoChangerFvMesh(const IOobject& io)
+Foam::rawTopoChangerFvMesh::rawTopoChangerFvMesh
+(
+    const IOobject& io,
+    const bool doInit
+)
 :
-    topoChangerFvMesh(io)
+    topoChangerFvMesh(io, doInit)
 {}
 
 
diff --git a/src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.H b/src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.H
index 0c77799d3c3..2cc7c9b526a 100644
--- a/src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.H
+++ b/src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.H
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
+    Copyright (C) 2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -87,7 +88,11 @@ public:
     // Constructors
 
         //- Construct from database
-        explicit rawTopoChangerFvMesh(const IOobject& io);
+        explicit rawTopoChangerFvMesh
+        (
+            const IOobject& io,
+            const bool doInit=true
+        );
 
     //- Destructor
     virtual ~rawTopoChangerFvMesh();
diff --git a/src/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.C b/src/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.C
index f21b2df088f..6d5fe619054 100644
--- a/src/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.C
+++ b/src/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2012 OpenFOAM Foundation
+    Copyright (C) 2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -38,9 +39,13 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::topoChangerFvMesh::topoChangerFvMesh(const IOobject& io)
+Foam::topoChangerFvMesh::topoChangerFvMesh
+(
+    const IOobject& io,
+    const bool doInit
+)
 :
-    dynamicFvMesh(io),
+    dynamicFvMesh(io, doInit),
     topoChanger_(*this)
 {}
 
diff --git a/src/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.H b/src/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.H
index 9faf31f7aba..4c19ee32ece 100644
--- a/src/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.H
+++ b/src/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.H
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
+    Copyright (C) 2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -79,7 +80,7 @@ public:
     // Constructors
 
         //- Construct from objectRegistry, and read/write options
-        explicit topoChangerFvMesh(const IOobject& io);
+        explicit topoChangerFvMesh(const IOobject& io, const bool doInit=true);
 
 
     //- Destructor
-- 
GitLab