diff --git a/src/fileFormats/ensight/file/ensightCase.C b/src/fileFormats/ensight/file/ensightCase.C
index 8eb5b324a384f663fc5c32f1e479440e2bd0adc1..310c3bda734a69dd0b178b9600f6fdcb241bba56 100644
--- a/src/fileFormats/ensight/file/ensightCase.C
+++ b/src/fileFormats/ensight/file/ensightCase.C
@@ -103,14 +103,13 @@ Foam::label Foam::ensightCase::checkTimeset(const labelHashSet& lookup) const
     }
     else if (tsTimes.size() == timesUsed_.size())
     {
-        forAllConstIter(Map<scalar>, timesUsed_, iter)
+        forAllConstIters(timesUsed_, iter)
         {
             tsTimes.erase(iter.key());
         }
 
         // OR
-        // tsTimes -= timesUsed_.toc();
-        // tsTimes -= timesUsed_;
+        // tsTimes.unsetMany(timesUsed_.toc());
 
         if (tsTimes.empty())
         {
@@ -489,17 +488,27 @@ void Foam::ensightCase::write() const
     const bool staticGeom = (geomTimes_.size() == 1 && geomTimes_.found(-1));
     label tsGeom = staticGeom ? 0 : checkTimeset(geomTimes_);
 
+    // geometry index, when mesh is not moving but stored under data/XXX/
+    label meshIndex = -1;
+
     // cloud timeset
     label tsCloud = checkTimeset(cloudTimes_);
 
-    // increment time-sets to the correct indices
+    // Increment time-sets to the correct indices
     if (tsGeom < 0)
     {
-        tsGeom = 2;             // next available timeset
+        tsGeom = 2; // Next available timeset
+
+        // Saved under data/XXX/geometry, but not actually moving
+        if (geomTimes_.size() == 1)
+        {
+            tsGeom = 0;
+            meshIndex = *(geomTimes_.begin());
+        }
     }
     if (tsCloud < 0)
     {
-        tsCloud = tsGeom + 1;   // next available timeset
+        tsCloud = 1 + std::max(1, tsGeom);  // Next available timeset
     }
 
     writeHeader();
@@ -521,27 +530,34 @@ void Foam::ensightCase::write() const
 
     if (staticGeom)
     {
-        // steady
+        // Steady
         *os_
             << setw(16)  << "model:"
             << geometryName
             << nl;
     }
+    else if (meshIndex >= 0)
+    {
+        // Not really moving, but stored under data/XXXX/geometry
+        *os_
+            << setw(16)  << "model:"
+            << (dataDirName/padded(meshIndex)/geometryName).c_str()
+            << nl;
+    }
     else if (!geomTimes_.empty())
     {
-        // moving
+        // Moving
         *os_
             << word::printf("model: %-9d", tsGeom) // width 16 (no quotes)
             << (dataMask/geometryName).c_str()
             << nl;
     }
 
-    // clouds and cloud variables
-    const wordList cloudNames = cloudVars_.sortedToc();
-    forAll(cloudNames, cloudNo)
-    {
-        const word& cloudName = cloudNames[cloudNo];
+    // Clouds and cloud variables
+    const wordList cloudNames(cloudVars_.sortedToc());
 
+    for (const word& cloudName : cloudNames)
+    {
         const fileName masked =
         (
             separateCloud()
@@ -568,11 +584,11 @@ void Foam::ensightCase::write() const
     }
 
 
-    // field variables (always use timeset 1)
-    const wordList varNames = variables_.sortedToc();
-    forAll(varNames, vari)
+    // Field variables (always use timeset 1)
+    const wordList varNames(variables_.sortedToc());
+
+    for (const word& varName : varNames)
     {
-        const word&   varName = varNames[vari];
         const string& ensType = variables_[varName];
 
         *os_
@@ -588,13 +604,14 @@ void Foam::ensightCase::write() const
     }
 
 
-    // clouds and cloud variables (using cloud timeset)
+    // Clouds and cloud variables (using cloud timeset)
     // Write
     // as -> "data/********/lagrangian/<cloudName>/positions"
     // or -> "lagrangian/<cloudName>/********/positions"
-    forAll(cloudNames, cloudNo)
+
+    label cloudNo = 0;
+    for (const word& cloudName : cloudNames)
     {
-        const word& cloudName = cloudNames[cloudNo];
         const fileName masked =
         (
             separateCloud()
@@ -603,11 +620,9 @@ void Foam::ensightCase::write() const
         );
 
         const HashTable<string>& vars = cloudVars_[cloudName];
-        const wordList tocVars = vars.sortedToc();
 
-        forAll(tocVars, vari)
+        for (const word& varName : vars.sortedToc())
         {
-            const word&   varName = tocVars[vari];
             const string& ensType = vars[varName];
 
             // prefix variables with 'c' (cloud) and cloud index
@@ -619,6 +634,8 @@ void Foam::ensightCase::write() const
                 << (masked/varName).c_str()
                 << nl;
         }
+
+        ++cloudNo;
     }
 
 
@@ -665,7 +682,7 @@ Foam::ensightCase::newGeometry
 
     if (Pstream::master())
     {
-        // set the path of the ensight file
+        // Set the path of the ensight file
         fileName path;
 
         if (moving)
@@ -701,10 +718,10 @@ Foam::ensightCase::newCloud
     {
         output = createCloudFile(cloudName, "positions");
 
-        // tag binary format (just like geometry files)
+        // Tag binary format (just like geometry files)
         output().writeBinaryHeader();
 
-        // description
+        // Description
         output().write(cloud::prefix/cloudName);
         output().newline();
 
diff --git a/src/fileFormats/ensight/file/ensightCase.H b/src/fileFormats/ensight/file/ensightCase.H
index b96184d8124858220ac8f14f6bf555fa24e91ec0..d8da24bf0450bddd2d70fc40c4fa6bba28faa085 100644
--- a/src/fileFormats/ensight/file/ensightCase.H
+++ b/src/fileFormats/ensight/file/ensightCase.H
@@ -148,13 +148,13 @@ private:
         ) const;
 
 
-        //- Note geometry being used
+        //- Note the geometry being used
         void noteGeometry(const bool moving) const;
 
-        //- Note cloud being used
+        //- Note the cloud being used
         void noteCloud(const word& cloudName) const;
 
-        //- Note cloud/variable being used
+        //- Note the cloud/variable being used
         void noteCloud
         (
             const word& cloudName,
@@ -162,7 +162,7 @@ private:
             const char* ensightType
         ) const;
 
-        //- Note field variable being used
+        //- Note the field variable being used
         void noteVariable
         (
             const word& varName,
@@ -172,7 +172,7 @@ private:
 
         //- Open stream for new data file (on master), using the current index.
         //  File is without initial description lines.
-        autoPtr<ensightFile> createDataFile(const word&) const;
+        autoPtr<ensightFile> createDataFile(const word& name) const;
 
         //- Open stream for new cloud file (on master).
         //  File is without initial description lines.
@@ -211,7 +211,6 @@ public:
         );
 
 
-
     //- Destructor
     ~ensightCase();
 
@@ -223,7 +222,7 @@ public:
         //- Reference to the case options
         inline const ensightCase::options& option() const;
 
-        //- Ascii/Binary file output
+        //- The output file format (ascii/binary)
         inline IOstream::streamFormat format() const;
 
         //- The nominal path to the case file
@@ -256,12 +255,12 @@ public:
 
         //- Set current index and time for time-set 1.
         //  Create corresponding sub-directory
-        //  Do not mix between nextTime and setTime in an application.
+        //  \note do not mix between nextTime and setTime in an application.
         void setTime(const scalar t, const label index);
 
         //- Set current index and time for time-set 1.
         //  Create corresponding sub-directory
-        //  Do not mix between nextTime and setTime in an application.
+        //  \note do not mix between nextTime and setTime in an application.
         void setTime(const instant& t, const label index);
 
 
@@ -305,7 +304,7 @@ public:
         inline Ostream& operator()() const;
 
         //- Print some general information.
-        Ostream& printInfo(Ostream&) const;
+        Ostream& printInfo(Ostream& os) const;
 };
 
 
diff --git a/src/fileFormats/ensight/file/ensightCaseOptions.C b/src/fileFormats/ensight/file/ensightCaseOptions.C
index 7449185551e7e5d15ccf998cb54252c9e7ff55dc..848d7ce0771543a4c9346874e9b2002dda12dddf 100644
--- a/src/fileFormats/ensight/file/ensightCaseOptions.C
+++ b/src/fileFormats/ensight/file/ensightCaseOptions.C
@@ -90,7 +90,6 @@ void Foam::ensightCase::options::width(const label n)
 }
 
 
-
 bool Foam::ensightCase::options::overwrite() const
 {
     return overwrite_;
diff --git a/src/fileFormats/ensight/file/ensightCaseTemplates.C b/src/fileFormats/ensight/file/ensightCaseTemplates.C
index 48d7c03ec37e28de08a134aefded863721cd9869..e0bdf408415249571267f2b2a3af18dc55bd5192 100644
--- a/src/fileFormats/ensight/file/ensightCaseTemplates.C
+++ b/src/fileFormats/ensight/file/ensightCaseTemplates.C
@@ -26,8 +26,7 @@ License
 #include "cloud.H"
 #include "ensightPTraits.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class Type>
 Foam::autoPtr<Foam::ensightFile>
@@ -54,7 +53,7 @@ Foam::ensightCase::newData
         );
         output().newline();
 
-        // note variable for later use
+        // note field variable for later use
         noteVariable(varName, ensightPTraits<Type>::typeName);
     }
 
diff --git a/src/fileFormats/ensight/file/ensightFile.C b/src/fileFormats/ensight/file/ensightFile.C
index b106c6ecf4cbc22b7b6577929ef7a45bbfd9fab2..b60b8db10c4bf51f02262ffb7ddba62f5ec0f483 100644
--- a/src/fileFormats/ensight/file/ensightFile.C
+++ b/src/fileFormats/ensight/file/ensightFile.C
@@ -335,15 +335,15 @@ void Foam::ensightFile::writeList
     const UList<scalar>& field
 )
 {
-    forAll(field, i)
+    for (const scalar& val : field)
     {
-        if (std::isnan(field[i]))
+        if (std::isnan(val))
         {
             writeUndef();
         }
         else
         {
-            write(field[i]);
+            write(val);
         }
 
         newline();
@@ -359,15 +359,15 @@ void Foam::ensightFile::writeList
 {
     if (notNull(idList))
     {
-        forAll(idList, i)
+        for (const label idx : idList)
         {
-            if (idList[i] >= field.size() || std::isnan(field[idList[i]]))
+            if (idx >= field.size() || std::isnan(field[idx]))
             {
                 writeUndef();
             }
             else
             {
-                write(field[idList[i]]);
+                write(field[idx]);
             }
 
             newline();
@@ -375,7 +375,7 @@ void Foam::ensightFile::writeList
     }
     else
     {
-        // no idList => perNode
+        // No idList => perNode
         writeList(field);
     }
 }
diff --git a/src/functionObjects/utilities/ensightWrite/ensightWrite.C b/src/functionObjects/utilities/ensightWrite/ensightWrite.C
index 3d65005a701becd332d411541740ca911aee38d4..d04fe1e9a01a7280446a4913ada7e8479e5712b9 100644
--- a/src/functionObjects/utilities/ensightWrite/ensightWrite.C
+++ b/src/functionObjects/utilities/ensightWrite/ensightWrite.C
@@ -187,39 +187,37 @@ bool Foam::functionObjects::ensightWrite::write()
         );
     }
 
+    if (consecutive_)
+    {
+        ensCase().nextTime(t.value());
+    }
+    else
+    {
+        ensCase().setTime(t.value(), t.timeIndex());
+    }
+
+    bool writeGeom = false;
     if (!ensMesh_.valid())
     {
+        writeGeom = true;
         ensMesh_.reset(new ensightMesh(mesh_, writeOpts_));
-
-        if (ensMesh_().needsUpdate())
-        {
-            ensMesh_().correct();
-        }
-
-        // assume static geometry - need to fix later
-        autoPtr<ensightGeoFile> os = ensCase_().newGeometry(false);
-        ensMesh_().write(os);
     }
-    else if (ensMesh_().needsUpdate())
+    if (ensMesh_().needsUpdate())
     {
-        // appears to have moved
+        writeGeom = true;
         ensMesh_().correct();
+    }
 
+    if (writeGeom)
+    {
+        // Treat all geometry as moving, since we do not know a priori
+        // if the simulation has mesh motion later on.
         autoPtr<ensightGeoFile> os = ensCase_().newGeometry(true);
         ensMesh_().write(os);
     }
 
     Log << type() << " " << name() << " write: (";
 
-    if (consecutive_)
-    {
-        ensCase().nextTime(t.value());
-    }
-    else
-    {
-        ensCase().setTime(t.value(), t.timeIndex());
-    }
-
     wordHashSet candidates(subsetStrings(selectFields_, mesh_.names()));
     DynamicList<word> missing(selectFields_.size());
     DynamicList<word> ignored(selectFields_.size());
diff --git a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/controlDict b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/controlDict
index 940a829522eec3e5ab2b66a58d038dffd89f2377..25210380e6a7350a7b8e3717bd8219ed63d6a418 100644
--- a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/controlDict
+++ b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/controlDict
@@ -57,6 +57,8 @@ functions
         libs           ("libsixDoFRigidBodyState.so");
         angleFormat    degrees;
     }
+
+    #include "ensightWrite"
 }
 
 // ************************************************************************* //
diff --git a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/ensightWrite b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/ensightWrite
new file mode 100644
index 0000000000000000000000000000000000000000..302957f59e462856f04e9e6912de6416e482ed24
--- /dev/null
+++ b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/ensightWrite
@@ -0,0 +1,20 @@
+// -*- C++ -*-
+
+ensightWrite
+{
+    type        ensightWrite;
+    libs        ("libutilityFunctionObjects.so");
+    log         true;
+
+    fields      (U p);
+
+    format      ascii;
+
+    overwrite   true;
+
+    writeControl writeTime;
+
+    consecutive false;
+}
+
+// ************************************************************************* //