diff --git a/Guides-a4/ProgrammersGuide.pdf b/Guides-a4/ProgrammersGuide.pdf
deleted file mode 100644
index ebd495d608b7234950bf6d1323bc4357be6f0731..0000000000000000000000000000000000000000
Binary files a/Guides-a4/ProgrammersGuide.pdf and /dev/null differ
diff --git a/Guides-a4/UserGuide.pdf b/Guides-a4/UserGuide.pdf
deleted file mode 100644
index 7524e9d8006e4921e1bacd33cac54a1fe8489e75..0000000000000000000000000000000000000000
Binary files a/Guides-a4/UserGuide.pdf and /dev/null differ
diff --git a/Guides-usletter/ProgrammersGuide.pdf b/Guides-usletter/ProgrammersGuide.pdf
deleted file mode 100644
index a97bc6d99d4e5c294e752e696ae9400856c54234..0000000000000000000000000000000000000000
Binary files a/Guides-usletter/ProgrammersGuide.pdf and /dev/null differ
diff --git a/Guides-usletter/UserGuide.pdf b/Guides-usletter/UserGuide.pdf
deleted file mode 100644
index 8960561f15d7ef68ca0a0e288705a2b111df3a84..0000000000000000000000000000000000000000
Binary files a/Guides-usletter/UserGuide.pdf and /dev/null differ
diff --git a/applications/solvers/DNS/dnsFoam/Allwmake b/applications/solvers/DNS/dnsFoam/Allwmake
new file mode 100755
index 0000000000000000000000000000000000000000..759041a131e01941d648a64d0f0c3e40fd28f2bb
--- /dev/null
+++ b/applications/solvers/DNS/dnsFoam/Allwmake
@@ -0,0 +1,14 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # run from this directory
+
+if [ -f "$FFTW_ARCH_PATH/include/fftw3.h" ] || \
+   [ "${FFTW_ARCH_PATH##*-}" = system -a -f "/usr/include/fftw3.h" ]
+then
+    wmake
+else
+    echo
+    echo "Skipping dnsFoam solver (no FFTW)"
+    echo
+fi
+
+#------------------------------------------------------------------------------
diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H
index cda60d98b2c1428cbe24552cdea5a1f11eeaee73..c778ef40a8f0daceb23680b56ff701038368c69e 100644
--- a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H
+++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H
@@ -41,7 +41,6 @@
         p_rghDDtEqn =
         (
             fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
-          + fvc::div(phiHbyA)
         ==
             fvOptions(psi, p_rgh, rho.name())
         );
@@ -52,6 +51,7 @@
         fvScalarMatrix p_rghEqn
         (
             p_rghDDtEqn()
+          + fvc::div(phiHbyA)
           - fvm::laplacian(rhorAUf, p_rgh)
         );
 
diff --git a/applications/solvers/lagrangian/simpleCoalParcelFoam/simpleCoalParcelFoam.C b/applications/solvers/lagrangian/simpleCoalParcelFoam/simpleCoalParcelFoam.C
index 5db8e7ede50284a3cbcb7b0462fa635e503499af..d9932d06dd5786f4fded77cca4d04e9e6858ffc8 100644
--- a/applications/solvers/lagrangian/simpleCoalParcelFoam/simpleCoalParcelFoam.C
+++ b/applications/solvers/lagrangian/simpleCoalParcelFoam/simpleCoalParcelFoam.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/solvers/multiphase/MPPICInterFoam/CompressibleTwoPhaseMixtureTurbulenceModels/CompressibleTwoPhaseMixtureTurbulenceModels.C b/applications/solvers/multiphase/MPPICInterFoam/CompressibleTwoPhaseMixtureTurbulenceModels/CompressibleTwoPhaseMixtureTurbulenceModels.C
index 6124bf25224fa7104786302d96205299e95fe1c8..193501ea4216fbcb6dfc3eb64e3745839570b7af 100644
--- a/applications/solvers/multiphase/MPPICInterFoam/CompressibleTwoPhaseMixtureTurbulenceModels/CompressibleTwoPhaseMixtureTurbulenceModels.C
+++ b/applications/solvers/multiphase/MPPICInterFoam/CompressibleTwoPhaseMixtureTurbulenceModels/CompressibleTwoPhaseMixtureTurbulenceModels.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/solvers/multiphase/MPPICInterFoam/MPPICInterFoam.C b/applications/solvers/multiphase/MPPICInterFoam/MPPICInterFoam.C
index 35797278d70e73e3b2487184802a7a8aa77b5395..07a6b062bbab721bdca4d328640ef94ec63a73c8 100644
--- a/applications/solvers/multiphase/MPPICInterFoam/MPPICInterFoam.C
+++ b/applications/solvers/multiphase/MPPICInterFoam/MPPICInterFoam.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/interCondensatingEvaporatingFoam.C b/applications/solvers/multiphase/interCondensingEvaporatingFoam/interCondensatingEvaporatingFoam.C
index b93539886685799a7cb8326817788c15304130e6..2fb0013224bb9f69041dc0dc831810fc45325ee2 100644
--- a/applications/solvers/multiphase/interCondensingEvaporatingFoam/interCondensatingEvaporatingFoam.C
+++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/interCondensatingEvaporatingFoam.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C
index 7543b9c856df38b97c7a10ef16cdc74c25874713..6d3f21c2fb9ebe360618ccc6c1867048ff3fdbdb 100644
--- a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C
+++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.H b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.H
index dd23e970248687f674cb5fa808e961d0695012fe..ba6780e91b0ab39ffe0dc1d3a75b7046aaf601dd 100644
--- a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.H
+++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/newtemperaturePhaseChangeTwoPhaseMixture.C b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/newtemperaturePhaseChangeTwoPhaseMixture.C
index 8dbb7c038ce2d779bf4d748c02f0d50e06ca2c83..88497f622236937ce39cbb83f446539f5a76aa15 100644
--- a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/newtemperaturePhaseChangeTwoPhaseMixture.C
+++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/newtemperaturePhaseChangeTwoPhaseMixture.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.C b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.C
index fe8923d3afde1c8e449148a5bdc8a79c1beee7eb..bc2cf7f2d15027e5b1e3a179e61dd1776816a283 100644
--- a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.C
+++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.H b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.H
index f829297ad88b9064ed306b1d051dca5436a7a09b..9d748fd7374273bcd899bb1d4668594903c09168 100644
--- a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.H
+++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C
index 6822e0bbc55a878eea4c6f608c19773f4e9d4122..4be68f4c269ca4f3ffb5df6b1fadcd2026efddab 100644
--- a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C
+++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.H b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.H
index ea2bec1b5d516159637dc1a6c7494c088ce4cc84..0d39b94b9e7cb46bd66b0d09e50e1af616480472 100644
--- a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.H
+++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C
index 19eb8ddca732e79cdaa8cbe4073f1c5b2667a680..a2c2b71fcf353b3fd91b841e00ad7d4be991fa98 100644
--- a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C
+++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.H b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.H
index 8616713b19f3014d0d918d98a6b6cbc471fc3605..cc61acf6749e4d6ae838ae21e7bb9b19e2cd2355 100644
--- a/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.H
+++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/test/NamedEnum/Make/files b/applications/test/NamedEnum/Make/files
index 755b72ba5e929e04c15dcd5f6258eb2ac88ab808..a1a70860418d9a1c8d10f2b78e1bf79ccb1fc721 100644
--- a/applications/test/NamedEnum/Make/files
+++ b/applications/test/NamedEnum/Make/files
@@ -1,3 +1,3 @@
-Test-namedEnum.C
+Test-NamedEnum.C
 
 EXE = $(FOAM_USER_APPBIN)/Test-NamedEnum
diff --git a/applications/test/NamedEnum/Test-NamedEnum.C b/applications/test/NamedEnum/Test-NamedEnum.C
new file mode 100644
index 0000000000000000000000000000000000000000..63386ed79ec7a192526d3703e3f7398bc8c792c9
--- /dev/null
+++ b/applications/test/NamedEnum/Test-NamedEnum.C
@@ -0,0 +1,114 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Description
+
+\*---------------------------------------------------------------------------*/
+
+#include "NamedEnum.H"
+#include "IOstreams.H"
+
+using namespace Foam;
+
+class namedEnumTest
+{
+public:
+
+    enum option
+    {
+        a,
+        b,
+        c,
+        d
+    };
+
+    static const Foam::NamedEnum<option, 4> namedEnum;
+};
+
+
+template<>
+const char* Foam::NamedEnum<namedEnumTest::option, 4>::names[] =
+{
+    "a",
+    "b",
+    "c",
+    "d"
+};
+
+const Foam::NamedEnum<namedEnumTest::option, 4> namedEnumTest::namedEnum;
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// Main program:
+
+int main(int argc, char *argv[])
+{
+    const List<namedEnumTest::option> options
+        = namedEnumTest::namedEnum.enums();
+
+    Info<< "enums: " << options << nl;
+
+    Info<< "loop over enums (as list):" << nl;
+    forAll(options, i)
+    {
+        const namedEnumTest::option& opt = options[i];
+
+        Info<< "option[" << opt
+            << "] = '" << namedEnumTest::namedEnum[opt] << "'" << nl;
+    }
+
+#if __cplusplus > 201100L
+    // C++11
+    Info<< "loop over enums (C++11 for range):" << nl;
+    for (auto const& opt : options)
+    {
+        Info<< "option[" << opt
+            << "] = '" << namedEnumTest::namedEnum[opt] << "'" << nl;
+    }
+#else
+    Info<< "loop over enums (via iterator):" << nl;
+    forAllConstIter(List<namedEnumTest::option>, options, iter)
+    {
+        const namedEnumTest::option& opt = *iter;
+
+        Info<< "option[" << opt
+            << "] = '" << namedEnumTest::namedEnum[opt] << "'" << nl;
+    }
+#endif
+
+    Info<< nl
+        << namedEnumTest::namedEnum["a"] << nl
+        << namedEnumTest::namedEnum[namedEnumTest::a] << nl;
+
+    Info<< "--- test read construction ---" << endl;
+
+    namedEnumTest::option dummy(namedEnumTest::namedEnum.read(Sin));
+    Info<< namedEnumTest::namedEnum[dummy] << endl;
+
+    Info<< "End\n" << endl;
+
+    return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/test/boundBox/Make/files b/applications/test/boundBox/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..ebb8e6fb12d4416c2fca751d9fdd512c9a8eaa4c
--- /dev/null
+++ b/applications/test/boundBox/Make/files
@@ -0,0 +1,3 @@
+Test-boundBox.C
+
+EXE = $(FOAM_USER_APPBIN)/Test-boundBox
diff --git a/applications/test/boundBox/Make/options b/applications/test/boundBox/Make/options
new file mode 100644
index 0000000000000000000000000000000000000000..d27c95d033dd5d7b1995c8ff8dc406e35ca1f586
--- /dev/null
+++ b/applications/test/boundBox/Make/options
@@ -0,0 +1,7 @@
+EXE_INC = \
+    -I$(LIB_SRC)/finiteVolume/lnInclude \
+    -I$(LIB_SRC)/meshTools/lnInclude
+
+EXE_LIBS = \
+    -lfiniteVolume \
+    -lmeshTools
diff --git a/applications/test/NamedEnum/Test-namedEnum.C b/applications/test/boundBox/Test-boundBox.C
similarity index 65%
rename from applications/test/NamedEnum/Test-namedEnum.C
rename to applications/test/boundBox/Test-boundBox.C
index 22f359693281abfe6019666822850a79e470d482..cb72b9ca87b32d2a285a135e3fc9424676e93cb6 100644
--- a/applications/test/NamedEnum/Test-namedEnum.C
+++ b/applications/test/boundBox/Test-boundBox.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -22,38 +22,28 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Description
+    Test bounding box behaviour
 
 \*---------------------------------------------------------------------------*/
 
-#include "NamedEnum.H"
-#include "IOstreams.H"
+#include "argList.H"
+#include "Time.H"
+#include "polyMesh.H"
+#include "boundBox.H"
+#include "treeBoundBox.H"
+#include "cellModeller.H"
 
 using namespace Foam;
 
-class namedEnumTest
+//- simple helper to create a cube
+boundBox cube(scalar start, scalar width)
 {
-public:
-
-    enum options
-    {
-        a,
-        b,
-        c
-    };
-
-    static const Foam::NamedEnum<options, 3> namedEnum;
-};
-
-
-template<>
-const char* Foam::NamedEnum<namedEnumTest::options, 3>::names[] =
-{
-    "a",
-    "b",
-    "c"
-};
-
-const Foam::NamedEnum<namedEnumTest::options, 3> namedEnumTest::namedEnum;
+    return boundBox
+    (
+        point(start, start, start),
+        point(start + width, start + width, start + width)
+    );
+}
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -61,13 +51,14 @@ const Foam::NamedEnum<namedEnumTest::options, 3> namedEnumTest::namedEnum;
 
 int main(int argc, char *argv[])
 {
-    Info<< namedEnumTest::namedEnum["a"] << endl;
-    Info<< namedEnumTest::namedEnum[namedEnumTest::a] << endl;
+    #include "setRootCase.H"
+    // #include "createTime.H"
+    // #include "createMesh.H"
 
-    namedEnumTest::options hmm(namedEnumTest::namedEnum.read(Sin));
-    Info<< namedEnumTest::namedEnum[hmm] << endl;
+    const cellModel& hex = *(cellModeller::lookup("hex"));
 
-    Info<< "End\n" << endl;
+    Info<<"boundBox faces: " << boundBox::faces << endl;
+    Info<<"hex faces: " << hex.modelFaces() << endl;
 
     return 0;
 }
diff --git a/applications/test/codeStream/codeStreamDict1 b/applications/test/codeStream/codeStreamDict1
index 8360f3ff4f7b3756b98eb921e46bb9c4951c091f..a552f5ec68d23acf9a1b7ed919a8550ac1db78e1 100644
--- a/applications/test/codeStream/codeStreamDict1
+++ b/applications/test/codeStream/codeStreamDict1
@@ -30,7 +30,8 @@ writeInterval   #codeStream
 
     codeOptions
     #{
-        -I$(LIB_SRC)/finiteVolume/lnInclude
+        -I$(LIB_SRC)/finiteVolume/lnInclude \
+        -I$(LIB_SRC)/meshTools/lnInclude
     #};
 
     localCode
diff --git a/applications/test/cstring/Make/files b/applications/test/cstring/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..eb7e33dc8bc8ccebb6c95b2cb39d023a011e2d23
--- /dev/null
+++ b/applications/test/cstring/Make/files
@@ -0,0 +1,3 @@
+Test-cstring.C
+
+EXE = $(FOAM_USER_APPBIN)/Test-cstring
diff --git a/applications/test/cstring/Make/options b/applications/test/cstring/Make/options
new file mode 100644
index 0000000000000000000000000000000000000000..6a9e9810b3d5ce6684bdaf03143933480ff45e42
--- /dev/null
+++ b/applications/test/cstring/Make/options
@@ -0,0 +1,2 @@
+/* EXE_INC = -I$(LIB_SRC)/cfdTools/include */
+/* EXE_LIBS = -lfiniteVolume */
diff --git a/applications/test/cstring/Test-cstring.C b/applications/test/cstring/Test-cstring.C
new file mode 100644
index 0000000000000000000000000000000000000000..fc4605cfa49656fd13d9d7f88ca9d1c3604ba9db
--- /dev/null
+++ b/applications/test/cstring/Test-cstring.C
@@ -0,0 +1,99 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Description
+    Test some string functionality
+
+\*---------------------------------------------------------------------------*/
+
+#include "CStringList.H"
+#include "DynamicList.H"
+#include "IOstreams.H"
+#include "fileNameList.H"
+#include "stringList.H"
+#include "wordList.H"
+
+using namespace Foam;
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+int print(int argc, char *argv[])
+{
+    Info<< "argc=" << argc << endl;
+    for (int i=0; i<argc; ++i)
+    {
+        Info<< "  argv[" << i << "] = \"" << argv[i] << "\"" << endl;
+    }
+    return argc;
+}
+
+int print(const CStringList& cstrLst)
+{
+    return print(cstrLst.size(), cstrLst.strings());
+}
+
+
+// Main program:
+
+int main(int argc, char *argv[])
+{
+    DynamicList<string> dynlst;
+    dynlst.reserve(16);
+
+    dynlst.append("string1 with content");
+    dynlst.append("string2 other content");
+    dynlst.append("string3 done");
+
+    {
+        CStringList inC(dynlst);
+
+        Info<< "input: " << dynlst << endl;
+        print(inC);
+    }
+
+    Info<<"command-line with " << CStringList::count(argv) << " items"<< endl;
+
+    print(argc, argv);
+    {
+        dynlst.clear();
+        for (int i=0; i<argc; ++i)
+        {
+            dynlst.append(argv[i]);
+        }
+
+        Info<< "input: " << dynlst << endl;
+        CStringList inC(dynlst);
+        inC.reset(dynlst);
+
+        print(inC);
+        Info<< "length: " << inC.length() << endl;
+        std::cout.write(inC.data(), inC.length());
+    }
+
+
+    Info<< "\nEnd\n" << endl;
+    return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/test/fileName/Test-fileName.C b/applications/test/fileName/Test-fileName.C
index fb876727437b864cec08ab614c911342171be02f..37ad0c90390500aee9d9344181672ed68c4aece4 100644
--- a/applications/test/fileName/Test-fileName.C
+++ b/applications/test/fileName/Test-fileName.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -34,6 +34,7 @@ Description
 #include "IOobject.H"
 #include "IOstreams.H"
 #include "OSspecific.H"
+#include "POSIX.H"
 
 using namespace Foam;
 
@@ -99,6 +100,98 @@ int main()
 
     }
 
+
+    // Test some copying and deletion
+    {
+        const fileName dirA("dirA");
+        const fileName lnA("lnA");
+        const fileName lnB("lnB");
+        const fileName dirB("dirB");
+
+        Foam::rmDir(dirA);
+        Foam::rm(lnA);
+        Foam::rm(lnB);
+        Foam::rmDir(dirB);
+
+
+        Info<< "Creating directory " << dirA << endl;
+        Foam::mkDir(dirA);
+
+
+        const int oldPosix = POSIX::debug;
+        POSIX::debug = 1;
+
+
+        // Create link and test it
+        Info<< "Creating softlink " << lnA << endl;
+        Foam::ln(dirA, lnA);
+
+        fileName::Type lnAType = lnA.type(false);
+
+        if (lnAType != fileName::LINK)
+        {
+            FatalErrorIn("Test-fileName") << "Type of softlink " << lnA
+                << " should be " << fileName::LINK
+                << " but is " << lnAType << exit(FatalError);
+        }
+
+        fileName::Type dirAType = lnA.type(true);
+
+        if (dirAType != fileName::DIRECTORY)
+        {
+            FatalErrorIn("Test-fileName") << "Type of what softlink " << lnA
+                << " points to should be " << fileName::DIRECTORY
+                << " but is " << dirAType << exit(FatalError);
+        }
+
+        // Copy link only
+        {
+            Info<< "Copying (non-follow) softlink " << lnA << " to " << lnB
+                << endl;
+
+            Foam::cp(lnA, lnB, false);
+            if (lnB.type(false) != fileName::LINK)
+            {
+                FatalErrorIn("Test-fileName") << "Type of softlink " << lnB
+                    << " should be " << fileName::LINK
+                    << " but is " << lnB.type(false) << exit(FatalError);
+            }
+            if (lnB.type(true) != fileName::DIRECTORY)
+            {
+                FatalErrorIn("Test-fileName") << "Type of softlink " << lnB
+                    << " should be " << fileName::DIRECTORY
+                    << " but is " << lnB.type(true) << exit(FatalError);
+            }
+
+            // Delete
+            Foam::rm(lnB);
+        }
+
+        // Copy contents of link
+        {
+            Info<< "Copying (contents of) softlink " << lnA << " to " << lnB
+                << endl;
+
+            Foam::cp(lnA, lnB, true);
+            if (lnB.type(false) != fileName::DIRECTORY)
+            {
+                FatalErrorIn("Test-fileName") << "Type of softlink " << lnB
+                    << " should be " << fileName::DIRECTORY
+                    << " but is " << lnB.type(false) << exit(FatalError);
+            }
+
+            // Delete
+            Foam::rm(lnB);
+        }
+
+        POSIX::debug = oldPosix;
+
+        Foam::rmDir(dirA);
+        Foam::rm(lnA);
+    }
+
+
+
     // test findEtcFile
     Info<< "\n\nfindEtcFile tests:" << nl
         << " controlDict => " << findEtcFile("controlDict") << nl
diff --git a/applications/test/fvc2D/Make/files b/applications/test/fvc2D/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..ffd2664354eb38ab896c9d266758aa1b612d0bb4
--- /dev/null
+++ b/applications/test/fvc2D/Make/files
@@ -0,0 +1,3 @@
+Test-fvc2D.C
+
+EXE = $(FOAM_USER_APPBIN)/Test-fvc2D
diff --git a/applications/test/fvc2D/Make/options b/applications/test/fvc2D/Make/options
new file mode 100644
index 0000000000000000000000000000000000000000..d27c95d033dd5d7b1995c8ff8dc406e35ca1f586
--- /dev/null
+++ b/applications/test/fvc2D/Make/options
@@ -0,0 +1,7 @@
+EXE_INC = \
+    -I$(LIB_SRC)/finiteVolume/lnInclude \
+    -I$(LIB_SRC)/meshTools/lnInclude
+
+EXE_LIBS = \
+    -lfiniteVolume \
+    -lmeshTools
diff --git a/applications/test/fvc2D/Test-fvc2D.C b/applications/test/fvc2D/Test-fvc2D.C
new file mode 100644
index 0000000000000000000000000000000000000000..c1fbdf5cf91f0d9be1866b6658c897fad7e21ab9
--- /dev/null
+++ b/applications/test/fvc2D/Test-fvc2D.C
@@ -0,0 +1,75 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Application
+    test
+
+Description
+    Finite volume method test code.
+
+\*---------------------------------------------------------------------------*/
+
+#include "fvCFD.H"
+#include "vector2D.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+namespace Foam
+{
+    typedef GeometricField<vector2D, fvPatchField, volMesh> volVector2DField;
+
+    defineTemplate2TypeNameAndDebug
+    (
+        volVector2DField::DimensionedInternalField,
+        0
+    );
+    defineTemplateTypeNameAndDebug(volVector2DField, 0);
+
+    typedef fvPatchField<vector2D> fvPatchVector2DField;
+    makeFvPatchField(fvPatchVector2DField)
+}
+
+int main(int argc, char *argv[])
+{
+    #include "setRootCase.H"
+
+    #include "createTime.H"
+    #include "createMesh.H"
+
+    GeometricField<vector2D, fvPatchField, volMesh> fld
+    (
+        IOobject
+        (
+            "U",
+            runTime.timeName(),
+            mesh,
+            IOobject::MUST_READ,
+            IOobject::AUTO_WRITE
+        ),
+        mesh
+    );
+
+    Info<< "end" << endl;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/doc/utilities.dox b/applications/utilities/doc/utilities.dox
new file mode 100644
index 0000000000000000000000000000000000000000..f9cbceeb993d99a5ed7da53a3a8ce18ef70a0835
--- /dev/null
+++ b/applications/utilities/doc/utilities.dox
@@ -0,0 +1,37 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it under
+    the terms of the GNU General Public License as published by the Free
+    Software Foundation, either version 3 of the License, or (at your option)
+    any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+    details.
+
+    You should have received a copy of the GNU General Public License along with
+    OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+\page pageUtilities Utilities
+
+\section secUtilities Overview
+The available utilities are grouped into the following categories:
+  - \ref grpMeshUtilities
+  - \ref grpMiscUtilities
+  - \ref grpPreProcessingUtilities
+  - \ref grpPostProcessingUtilities
+  - \ref grpThermoUtilities
+  - \ref grpSurfaceUtilities
+
+\*---------------------------------------------------------------------------*/
diff --git a/applications/utilities/doc/utilitiesDoc.H b/applications/utilities/doc/utilitiesDoc.H
new file mode 100644
index 0000000000000000000000000000000000000000..d953a47480d2d9562b73bf5dd6b08bfa1f16b616
--- /dev/null
+++ b/applications/utilities/doc/utilitiesDoc.H
@@ -0,0 +1,73 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it under
+    the terms of the GNU General Public License as published by the Free
+    Software Foundation, either version 3 of the License, or (at your option)
+    any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+    details.
+
+    You should have received a copy of the GNU General Public License along with
+    OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+\defgroup grpUtilities Utilities
+@{
+    This group contains utilities
+@}
+
+\defgroup grpMeshUtilities Mesh
+@{
+    \ingroup grpUtilities
+    This group contains meshing utilities
+@}
+
+\defgroup grpPreProcessingUtilities Pre-processing
+@{
+    \ingroup grpUtilities
+    This group contains pre-processing utilities
+@}
+
+\defgroup grpPostProcessingUtilities Post-processing
+@{
+    \ingroup grpUtilities
+    This group contains post-processing utilities
+@}
+
+\defgroup grpParallelUtilities Parallel
+@{
+    \ingroup grpUtilities
+    This group contains parallel utilities
+@}
+
+\defgroup grpSurfaceUtilities Surface
+@{
+    \ingroup grpUtilities
+    This group contains surface utilities
+@}
+
+\defgroup grpThermophysicalUtilities Thermophysical
+@{
+    \ingroup grpUtilities
+    This group contains thermophysical utilities
+@}
+
+\defgroup grpMiscUtilities Miscellaneous
+@{
+    \ingroup grpUtilities
+    This group contains miscellaneous utilities
+@}
+
+\*---------------------------------------------------------------------------*/
diff --git a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C
index e38319f481a6b75d904b01ee3b28398c16d8c68c..f936134e9a36820d7e22745f6ee3901b739d2a1f 100644
--- a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C
+++ b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C
@@ -24,6 +24,9 @@ License
 Application
     PDRMesh
 
+Group
+    grpMeshAdvancedUtilities
+
 Description
     Mesh and field preparation utility for PDR type simulations.
 
diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C
index b3099f4f28a7282f0b6aabbbbca7dca0801b6d07..7cbfa6d9cb35219ee08840ca8d52576aaf0fd57d 100644
--- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C
+++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C
@@ -24,6 +24,9 @@ License
 Application
     collapseEdges
 
+Group
+    grpMeshAdvancedUtilities
+
 Description
     Collapses short edges and combines edges that are in line.
 
diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C
index 9854ec2fef56f81c7fef70ee0865da593eec2d50..2666d4c9de9b2a1d37e52f32a62ebdbb22464a89 100644
--- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C
+++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C
@@ -24,6 +24,9 @@ License
 Application
     combinePatchFaces
 
+Group
+    grpMeshAdvancedUtilities
+
 Description
     Checks for multiple patch faces on same cell and combines them.
     Multiple patch faces can result from e.g. removal of refined
diff --git a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C
index 766cd6a6e5ec5d20b4fa6e0f710cb1671dd01c24..320a1f2d96e089164da6d8afbbab397fde0b39ea 100644
--- a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C
+++ b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C
@@ -24,6 +24,9 @@ License
 Application
     modifyMesh
 
+Group
+    grpMeshAdvancedUtilities
+
 Description
     Manipulates mesh elements.
 
diff --git a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C
index dc797fdcee3cb9185eeefa4a860ad4991bab959f..fcdd7ec8f1033e451fdf33ac2fde9fd4fdef5853 100644
--- a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C
+++ b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C
@@ -24,6 +24,9 @@ License
 Application
     refineHexMesh
 
+Group
+    grpMeshAdvancedUtilities
+
 Description
     Refines a hex mesh by 2x2x2 cell splitting.
 
diff --git a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C
index ba5b7f854826ff36b6a6f5d3e1b26cbe798409f6..754568cc4adefec37cef9a11b9ca6c8418f4d336 100644
--- a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C
+++ b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C
@@ -24,6 +24,9 @@ License
 Application
     refineWallLayer
 
+Group
+    grpMeshAdvancedUtilities
+
 Description
     Utility to refine cells next to patches.
 
diff --git a/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C b/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C
index a12adf8413db3a73d3014c23d154b77c6c7f6bd0..744fcf5c5a667ca1417efebeeea525b4bf151ef0 100644
--- a/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C
+++ b/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C
@@ -24,6 +24,9 @@ License
 Application
     refinementLevel
 
+Group
+    grpMeshAdvancedUtilities
+
 Description
     Tries to figure out what the refinement level is on refined cartesian
     meshes. Run BEFORE snapping.
diff --git a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C
index 64191b8bb0883c5e91bb1164cbcbc521f51c4e47..ca828866011356aea446f5532f12c59ac98d058a 100644
--- a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C
+++ b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C
@@ -24,6 +24,9 @@ License
 Application
     removeFaces
 
+Group
+    grpMeshAdvancedUtilities
+
 Description
     Utility to remove faces (combines cells on both sides).
 
diff --git a/applications/utilities/mesh/advanced/selectCells/selectCells.C b/applications/utilities/mesh/advanced/selectCells/selectCells.C
index c71929e500328d52efda742aaa6eeb8d87dd14ce..87b4398d287ae6dc9baba5a7c9cf1e8456192f21 100644
--- a/applications/utilities/mesh/advanced/selectCells/selectCells.C
+++ b/applications/utilities/mesh/advanced/selectCells/selectCells.C
@@ -24,6 +24,9 @@ License
 Application
     selectCells
 
+Group
+    grpMeshAdvancedUtilities
+
 Description
     Select cells in relation to surface.
 
diff --git a/applications/utilities/mesh/advanced/autoRefineMesh/Make/files b/applications/utilities/mesh/advanced/snappyRefineMesh/Make/files
similarity index 100%
rename from applications/utilities/mesh/advanced/autoRefineMesh/Make/files
rename to applications/utilities/mesh/advanced/snappyRefineMesh/Make/files
diff --git a/applications/utilities/mesh/advanced/autoRefineMesh/Make/options b/applications/utilities/mesh/advanced/snappyRefineMesh/Make/options
similarity index 100%
rename from applications/utilities/mesh/advanced/autoRefineMesh/Make/options
rename to applications/utilities/mesh/advanced/snappyRefineMesh/Make/options
diff --git a/applications/utilities/mesh/advanced/autoRefineMesh/snappyRefineMesh.C b/applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMesh.C
similarity index 99%
rename from applications/utilities/mesh/advanced/autoRefineMesh/snappyRefineMesh.C
rename to applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMesh.C
index abb29b1dea922e42c2d530eb323a0ff821632afa..4e4f7e026336ce596b4415218ec704bc01e3a99e 100644
--- a/applications/utilities/mesh/advanced/autoRefineMesh/snappyRefineMesh.C
+++ b/applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMesh.C
@@ -24,6 +24,9 @@ License
 Application
     snappyRefineMesh
 
+Group
+    grpMeshAdvancedUtilities
+
 Description
     Utility to refine cells near to a surface.
 
diff --git a/applications/utilities/mesh/advanced/autoRefineMesh/snappyRefineMeshDict b/applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMeshDict
similarity index 100%
rename from applications/utilities/mesh/advanced/autoRefineMesh/snappyRefineMeshDict
rename to applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMeshDict
diff --git a/applications/utilities/mesh/advanced/splitCells/splitCells.C b/applications/utilities/mesh/advanced/splitCells/splitCells.C
index 0e1eb5b1e50c9e16facfed97846d454d90bd0ad8..7e44c20d36e46865c864b46c24c6b47a06ba21bd 100644
--- a/applications/utilities/mesh/advanced/splitCells/splitCells.C
+++ b/applications/utilities/mesh/advanced/splitCells/splitCells.C
@@ -24,6 +24,9 @@ License
 Application
     splitCells
 
+Group
+    grpMeshAdvancedUtilities
+
 Description
     Utility to split cells with flat faces.
 
diff --git a/applications/utilities/mesh/conversion/Optional/Allwmake b/applications/utilities/mesh/conversion/Optional/Allwmake
index f84479c089b562dd6fb360331dc87275b91789b1..6d02ede6f45ca2624dd9a4496d67f5fd4a26dddb 100755
--- a/applications/utilities/mesh/conversion/Optional/Allwmake
+++ b/applications/utilities/mesh/conversion/Optional/Allwmake
@@ -8,15 +8,15 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
 # Get version info and arch-path
 . $WM_PROJECT_DIR/etc/config.sh/functions
-_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/libccmio)
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio)
 
 set -x
 
-# Build libccmio (.so)
-$WM_THIRD_PARTY_DIR/makeCCMIO
+# Build libccmio (.a|.so)
+$WM_THIRD_PARTY_DIR/makeCCMIO lib # libso
 
 if [ -e $CCMIO_ARCH_PATH/include/libccmio/ccmio.h \
-  -a -e $FOAM_EXT_LIBBIN/libccmio.so ]
+  -a \( -e $CCMIO_ARCH_PATH/lib/libccmio.a -o $FOAM_EXT_LIBBIN/libccmio.so \) ]
 then
     wmake ccm26ToFoam
 fi
diff --git a/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/Make/options b/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/Make/options
index 410b53c73c8da2c97a4d26487600902a945fd261..7e3235bf814c197b83ff82400e8149242d1d201e 100644
--- a/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/Make/options
+++ b/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/Make/options
@@ -6,4 +6,4 @@ EXE_INC = \
 EXE_LIBS = \
     -lfiniteVolume \
     -lmeshTools \
-    -L$(FOAM_EXT_LIBBIN) -lccmio
+    -L$(CCMIO_ARCH_PATH)/lib -L$(FOAM_EXT_LIBBIN) -lccmio
diff --git a/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C b/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C
index d97133244cb68c3f94113ce34cb8abd7d441ed56..c244c6379c3fa66af5eff0cf46f38473430ec1c0 100644
--- a/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C
+++ b/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C
@@ -21,6 +21,12 @@ License
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
+Application
+    ccm26ToFoam
+
+Group
+    grpMeshConversionUtilities
+
 Description
     Reads CCM files as written by Prostar/ccm using ccm 2.6 (not 2.4)
 
diff --git a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L
index 9a2129912795542ee273cf7519d988e293edc059..3f17812bb47eadd8c71a76f66b97990f28d9f22a 100644
--- a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L
+++ b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L
@@ -24,6 +24,9 @@ License
 Application
     ansysToFoam
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Converts an ANSYS input mesh file, exported from I-DEAS,
     to OpenFOAM format.
diff --git a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C
index c3d2fef0732a0170350d1c55a3310fc4be598379..af7f86f7b621879ba5d19139969d55f1ad5cfa82 100644
--- a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C
+++ b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C
@@ -24,6 +24,9 @@ License
 Application
     cfx4ToFoam
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Converts a CFX 4 mesh to OpenFOAM format.
 
diff --git a/applications/utilities/mesh/conversion/datToFoam/datToFoam.C b/applications/utilities/mesh/conversion/datToFoam/datToFoam.C
index 4ee10d1f1592905e845dde5708441640d1b46460..2b1956e51ffde2faaf55aacd1dd8ee5fdafd2199 100644
--- a/applications/utilities/mesh/conversion/datToFoam/datToFoam.C
+++ b/applications/utilities/mesh/conversion/datToFoam/datToFoam.C
@@ -24,6 +24,9 @@ License
 Application
     datToFoam
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Reads in a datToFoam mesh file and outputs a points file.  Used in
     conjunction with blockMesh.
diff --git a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L
index 1d28f046dc4e4e56a27c95983d98d9d9a7a9e804..3d1875d717287e4548d488dc03cc6c5210689204 100644
--- a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L
+++ b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L
@@ -24,6 +24,9 @@ License
 Application
     fluent3DMeshToFoam
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Converts a Fluent mesh to OpenFOAM format.
 
diff --git a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L
index 3300ba9778666021b4665d0c34706eb648bb6cc7..6cff0ce9621e1198b9619d73f7af3d1bab82d6b8 100644
--- a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L
+++ b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L
@@ -24,6 +24,9 @@ License
 Application
     fluentMeshToFoam
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Converts a Fluent mesh to OpenFOAM format
     including multiple region and region boundary handling.
diff --git a/applications/utilities/mesh/conversion/foamMeshToFluent/foamMeshToFluent.C b/applications/utilities/mesh/conversion/foamMeshToFluent/foamMeshToFluent.C
index 31ca1f9db40c9065cb3356b0bbc50c2f33dda44d..d532e27d5fea4adca126035059f257692e292061 100644
--- a/applications/utilities/mesh/conversion/foamMeshToFluent/foamMeshToFluent.C
+++ b/applications/utilities/mesh/conversion/foamMeshToFluent/foamMeshToFluent.C
@@ -24,6 +24,9 @@ License
 Application
     foamMeshToFluent
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Writes out the OpenFOAM mesh in Fluent mesh format.
 
diff --git a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C
index a345d300157d7df68dccab658299b95f00168d21..adc86dc4b53d55cbbad40235dddb9aca45c53bf5 100644
--- a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C
+++ b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C
@@ -24,6 +24,9 @@ License
 Application
     foamToStarMesh
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Reads an OpenFOAM mesh and writes a pro-STAR (v4) bnd/cel/vrt format.
 
diff --git a/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C b/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C
index 9654b33fc239cf99433bd11a0019b5fd46c9e5f5..16a6752cfb9b058609b8e72a9e05be9926d81400 100644
--- a/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C
+++ b/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C
@@ -24,6 +24,9 @@ License
 Application
     foamToSurface
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Reads an OpenFOAM mesh and writes the boundaries in a surface format.
 
diff --git a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L
index 6821af8fba136ccaedb679828d9df4adfa033fe5..c2dfdf43559e4c2c56d4160edd8ee18e534639bf 100644
--- a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L
+++ b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L
@@ -24,6 +24,9 @@ License
 Application
     gambitToFoam
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Converts a GAMBIT mesh to OpenFOAM format.
 
diff --git a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C
index 5de646c441850202b1b541dbacaa2545cf594ba3..9d466f64f2ff2c9d83301e4a7d9969a2ef58dc15 100644
--- a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C
+++ b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C
@@ -24,6 +24,9 @@ License
 Application
     gmshToFoam
 
+group
+    grpMeshConversionUtilities
+
 Description
     Reads .msh file as written by Gmsh.
 
diff --git a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C
index 7a94b27299716fe1a781ecdc7f32a13940d78785..8c14a5373d7a0627936a9ed2de2ac43ce20ff0f5 100644
--- a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C
+++ b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C
@@ -24,6 +24,9 @@ License
 Application
     ideasUnvToFoam
 
+Group
+    grpMeshConversionUtilities
+
 Description
     I-Deas unv format mesh conversion.
 
diff --git a/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C b/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C
index 99d522f741496f335dd6946da2f82a2a77b8f0e7..56653cc9217fd705008abf6f74c8820e36e99c0e 100644
--- a/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C
+++ b/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C
@@ -24,6 +24,9 @@ License
 Application
     kivaToFoam
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Converts a KIVA3v grid to OpenFOAM format.
 
diff --git a/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C b/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C
index a69f6047a593f48d4a0f550b2db303cd266ee609..81cc0322fc49f26cfd7749b910092a2bfebc6297 100644
--- a/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C
+++ b/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C
@@ -24,6 +24,9 @@ License
 Application
     mshToFoam
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Converts .msh file generated by the Adventure system.
 
diff --git a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C
index e00422072380f925fc0cba1c8fb2f23366e58d4f..93c4267f7729ab612d5207b172270e7b162f706f 100644
--- a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C
+++ b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C
@@ -24,6 +24,9 @@ License
 Application
     netgenNeutralToFoam
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Converts neutral file format as written by Netgen v4.4.
 
diff --git a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C
index 891af306e10ac1e93d1490357b9a7d8c55c4cfde..63ddfd1e69bdf03a97a0445d51c30ed26a677249 100644
--- a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C
+++ b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C
@@ -24,6 +24,9 @@ License
 Application
     plot3dToFoam
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Plot3d mesh (ascii/formatted format) converter.
 
diff --git a/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C b/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C
index 5bceed621fc2452cb53c4fc672395df3d8c01436..543b71cba3470662b09e3dcf0bede2baeb0e2fc2 100644
--- a/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C
+++ b/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C
@@ -24,6 +24,9 @@ License
 Application
     sammToFoam
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Converts a Star-CD (v3) SAMM mesh to OpenFOAM format.
 
diff --git a/applications/utilities/mesh/conversion/star3ToFoam/star3ToFoam.C b/applications/utilities/mesh/conversion/star3ToFoam/star3ToFoam.C
index 9668741305eebd18b3be63949a4f79a25703327e..4e6449b9fd055ed8d5112bfb68a8ce5266077a12 100644
--- a/applications/utilities/mesh/conversion/star3ToFoam/star3ToFoam.C
+++ b/applications/utilities/mesh/conversion/star3ToFoam/star3ToFoam.C
@@ -24,6 +24,9 @@ License
 Application
     star3ToFoam
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Converts a Star-CD (v3) pro-STAR mesh into OpenFOAM format.
 
diff --git a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C
index f8e1657e79115d077985736147b5574f910205ae..cefbf009d15ee75fa2c5d840c690d80dc01c5b4e 100644
--- a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C
+++ b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C
@@ -24,6 +24,9 @@ License
 Application
     star4ToFoam
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Converts a Star-CD (v4) pro-STAR mesh into OpenFOAM format.
 
diff --git a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C
index 46ea78e5993d65821aadd2a0e56446ca664fc01f..7eac6435832c13064845dbba9c6f1cc3fe8214cd 100644
--- a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C
+++ b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C
@@ -24,6 +24,9 @@ License
 Application
     tetgenToFoam
 
+Group
+    grpMeshConversionUtilities
+
 Description
     Converts .ele and .node and .face files, written by tetgen.
 
diff --git a/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C b/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C
index 4c6c7af788c7b6398ed43c4a44ac598eff32acf3..507d8575e7b8544fdd7aad00506005d6b97f2a35 100644
--- a/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C
+++ b/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C
@@ -21,6 +21,12 @@ License
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
+Application
+    vtkUnstructuredToFoam
+
+Group
+    grpMeshConversionUtilities
+
 Description
     Converts ascii .vtk (legacy format) file generated by vtk/paraview.
 
diff --git a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C
index 3b0a2269339a16d2e19b5662647e979902c03fde..98923ea6eec316f8307392de9b7f0443bb8902ee 100644
--- a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C
+++ b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C
@@ -24,6 +24,9 @@ License
 Application
     writeMeshObj
 
+Group
+    grpMeshConversionUtilities
+
 Description
     For mesh debugging: writes mesh as three separate OBJ files which can
     be viewed with e.g. javaview.
diff --git a/applications/utilities/mesh/doc/meshUtilitiesDoc.H b/applications/utilities/mesh/doc/meshUtilitiesDoc.H
new file mode 100644
index 0000000000000000000000000000000000000000..f0ff94b39c49067975970b32971533e90ecbf9f9
--- /dev/null
+++ b/applications/utilities/mesh/doc/meshUtilitiesDoc.H
@@ -0,0 +1,51 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it under
+    the terms of the GNU General Public License as published by the Free
+    Software Foundation, either version 3 of the License, or (at your option)
+    any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+    details.
+
+    You should have received a copy of the GNU General Public License along with
+    OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+\defgroup grpMeshGenerationUtilities Generation
+@{
+    \ingroup grpMeshUtilities
+    This group contains mesh generation utilities
+@}
+
+\defgroup grpMeshConversionUtilities Conversion
+@{
+    \ingroup grpMeshUtilities
+    This group contains mesh conversion utilities
+@}
+
+\defgroup grpMeshManipulationUtilities Manipulation
+@{
+    \ingroup grpMeshUtilities
+    This group contains mesh generation utilities
+@}
+
+\defgroup grpMeshAdvancedUtilities Advanced
+@{
+    \ingroup grpMeshUtilities
+    This group contains advanced mesh utilities
+@}
+
+\*---------------------------------------------------------------------------*/
+
diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C
index 0c92180830829a17c9e89f23d00bf13550c9ecca..3d0624f74564efdc38a102a7641d2342ef9ced05 100644
--- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C
+++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C
@@ -24,6 +24,9 @@ License
 Application
     blockMesh
 
+Group
+    grpMeshGenerationUtilities
+
 Description
     A multi-block mesh generator.
 
diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C
index 00ced168eb0968ceab62cc4b8c706cbfa2505b10..d52ed1b29f2c31c326bbcda49fc757151fc270b8 100644
--- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C
+++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C
@@ -24,6 +24,9 @@ License
 Application
     extrudeMesh
 
+Group
+    grpMeshGenerationUtilities
+
 Description
     Extrude mesh from existing patch (by default outwards facing normals;
     optional flips faces) or from patch read from file.
diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C
index 91aab57a1b879badf0dab293cee5da90cbcfb2d4..7f35de4b2286aad60553a3ad76590b76b5340ae9 100644
--- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C
+++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C
@@ -24,6 +24,9 @@ License
 Application
     extrudeToRegionMesh
 
+Group
+    grpMeshGenerationUtilities
+
 Description
     Extrude faceZones (internal or boundary faces) or faceSets (boundary faces
     only) into a separate mesh (as a different region).
diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C
index a6916b70763a7625dc76bc9798796973baba3da2..ef6cd069e982feb0ec2aa12195ba46a1bf81da17 100644
--- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C
+++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C
@@ -24,6 +24,9 @@ License
 Application
     extrude2DMesh
 
+Group
+    grpMeshGenerationUtilities
+
 Description
     Takes 2D mesh (all faces 2 points only, no front and back faces) and
     creates a 3D mesh by extruding with specified thickness.
diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMesh/foamyHexMesh.C b/applications/utilities/mesh/generation/foamyMesh/foamyHexMesh/foamyHexMesh.C
index fd8d6f1224a14d4e996bf2fab8b3bb20ec8ced7c..3588a9878f634f72758a6f2a98a4fe1565517a86 100644
--- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMesh/foamyHexMesh.C
+++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMesh/foamyHexMesh.C
@@ -24,6 +24,9 @@ License
 Application
     foamyHexMesh
 
+Group
+    grpMeshGenerationUtilities
+
 Description
     Conformal Voronoi automatic mesh generator
 
diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C
index 997726bba6b0a272d53442af9cee12f6469ffec5..f8d605464481064d7090837bb9b7f319c6b53f0c 100644
--- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C
+++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C
@@ -24,6 +24,9 @@ License
 Application
     foamyQuadMesh
 
+Group
+    grpMeshGenerationUtilities
+
 Description
     Conformal-Voronoi 2D extruding automatic mesher with grid or read
     initial points and point position relaxation with optional
diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
index b5187f1e94f1bb9de8882dc1630d89dc1caa8daf..fa856b6fc24183562aa058dcf47666f46a7593f2 100644
--- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
+++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
@@ -24,6 +24,9 @@ License
 Application
     snappyHexMesh
 
+Group
+    grpMeshGenerationUtilities
+
 Description
     Automatic split hex mesher. Refines and snaps to surface.
 
@@ -610,6 +613,7 @@ void writeMesh
 
 int main(int argc, char *argv[])
 {
+    #include "addRegionOption.H"
     #include "addOverwriteOption.H"
     Foam::argList::addBoolOption
     (
@@ -759,20 +763,29 @@ int main(int argc, char *argv[])
 //    }
 //    else
     {
-        Foam::Info
-            << "Create mesh for time = "
-            << runTime.timeName() << Foam::nl << Foam::endl;
+        word regionName;
+        if (args.optionReadIfPresent("region", regionName))
+        {
+            Info<< "Create mesh " << regionName << " for time = "
+                << runTime.timeName() << nl << endl;
+        }
+        else
+        {
+            regionName = fvMesh::defaultRegion;
+            Info<< "Create mesh for time = "
+                << runTime.timeName() << nl << endl;
+        }
 
         meshPtr.set
         (
             new fvMesh
             (
-                Foam::IOobject
+                IOobject
                 (
-                    Foam::fvMesh::defaultRegion,
+                    regionName,
                     runTime.timeName(),
                     runTime,
-                    Foam::IOobject::MUST_READ
+                    IOobject::MUST_READ
                 )
             )
         );
diff --git a/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C b/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C
index bf0dff94b0db9e799eb0ac0a7028a09ceae6ddd8..7dea889f8699c85509cbfd839090087314c16d34 100644
--- a/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C
+++ b/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C
@@ -24,6 +24,9 @@ License
 Application
     attachMesh
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Attach topologically detached mesh using prescribed mesh modifiers.
 
diff --git a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C
index f35f70b45b00e45a8685703a8535de85f583be7b..abd73d8445ccfebc3ebf90dedd61f32d07b86c96 100644
--- a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C
+++ b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C
@@ -24,6 +24,9 @@ License
 Application
     autoPatch
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Divides external faces into patches based on (user supplied) feature
     angle.
diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C
index 9a3ab3871e522fe8a86d09f3e78cacbb552fc619..c1a07e9fcae21b3dfbf509e0a5010d5c66bc5583 100644
--- a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C
+++ b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C
@@ -24,6 +24,9 @@ License
 Application
     checkMesh
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Checks validity of a mesh.
 
diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C
index d0d1439b852e10e34f5ffdb9c83016dbf00a3662..e5892bef4b8eb73fdb153ecc0f5b8a11e206efca 100644
--- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C
+++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C
@@ -24,6 +24,9 @@ License
 Application
     createBaffles
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Makes internal faces into boundary faces. Does not duplicate points, unlike
     mergeOrSplitBaffles.
diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C
index eb89288a30327a2f0b0e41f09960b00997fe4b9d..a97916281dc25a67f8dfa7c9452ebcf80a7525c1 100644
--- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C
+++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C
@@ -24,6 +24,9 @@ License
 Application
     createPatch
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Utility to create patches out of selected boundary faces. Faces come either
     from existing patches or from a faceSet.
diff --git a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C
index 58f74475064e7c4ffbfc0d87a616e204219fa0a8..181e80e12dca7a08984f4406169965175b8428fc 100644
--- a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C
+++ b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C
@@ -24,6 +24,9 @@ License
 Application
     deformedGeom
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Deforms a polyMesh using a displacement field U and a scaling factor
     supplied as an argument.
diff --git a/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.C b/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.C
index f10405674d86fd2fa5a97717dfa4acc62667a112..7e2fd95c58b1b2778d85d03025a90d7fb50cd0c8 100644
--- a/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.C
+++ b/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.C
@@ -24,6 +24,9 @@ License
 Application
     flattenMesh
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Flattens the front and back planes of a 2D cartesian mesh.
 
diff --git a/applications/utilities/mesh/manipulation/insideCells/insideCells.C b/applications/utilities/mesh/manipulation/insideCells/insideCells.C
index 31d1473294a9cc47e48ad59b3216d18e43911eb6..a751b6e7d0314f361bfd18f5484c3aeaff1746f2 100644
--- a/applications/utilities/mesh/manipulation/insideCells/insideCells.C
+++ b/applications/utilities/mesh/manipulation/insideCells/insideCells.C
@@ -24,6 +24,9 @@ License
 Application
     insideCells
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Picks up cells with cell centre 'inside' of surface.
     Requires surface to be closed and singly connected.
diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C b/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C
index 26c67575c7cb4f817fff123388ff79fefffb8ae8..cb80039e79cc7e340ca6985d14e95c03e3ff5a60 100644
--- a/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C
+++ b/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C
@@ -24,6 +24,9 @@ License
 Application
     mergeMeshes
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Merges two meshes.
 
diff --git a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C
index 6db0d3abc634a6969262c6d7e949569c73658985..5d52574886ed8551f27fb45c24f83663e0484e03 100644
--- a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C
+++ b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C
@@ -24,6 +24,9 @@ License
 Application
     mergeOrSplitBaffles
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Detects faces that share points (baffles). Either merge them or
     duplicate the points.
diff --git a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMesh.C b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMesh.C
index f7383289cb8bfa8fd58c89c8777abc33ba3a60d7..e06acc0205db7095f3fe6e42040d486716e4bea9 100644
--- a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMesh.C
+++ b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMesh.C
@@ -24,6 +24,9 @@ License
 Application
     mirrorMesh
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Mirrors a mesh around a given plane.
 
diff --git a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C
index 2fac9f25c06e80d3101d7eb52b80cf826ae0ad99..7fed198993520a36d484fd140be7e305ed7a533a 100644
--- a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C
+++ b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C
@@ -24,6 +24,9 @@ License
 Application
     moveDynamicMesh
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Mesh motion and topological mesh changes utility.
 
diff --git a/applications/utilities/mesh/manipulation/moveEngineMesh/moveEngineMesh.C b/applications/utilities/mesh/manipulation/moveEngineMesh/moveEngineMesh.C
index 54727b825af452c098b865bd9a447a86b2578b1a..9757be665548db91473b0ff619181a443a0b6071 100644
--- a/applications/utilities/mesh/manipulation/moveEngineMesh/moveEngineMesh.C
+++ b/applications/utilities/mesh/manipulation/moveEngineMesh/moveEngineMesh.C
@@ -24,6 +24,9 @@ License
 Application
     moveEngineMesh
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Solver for moving meshes for engine calculations.
 
diff --git a/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C b/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C
index f2ef2890538fa7efe9b806f456fc8504b3f6858a..0f4049ad7cb4752fc9361962f7cc4aefa5211c31 100644
--- a/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C
+++ b/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C
@@ -24,6 +24,9 @@ License
 Application
     moveMesh
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Solver for moving meshes.
 
diff --git a/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C b/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C
index e0da25a52625c5888b98515f31925d295bb9d91f..7b61f097cfa63a43de80d40131b56f2da9c77370 100644
--- a/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C
+++ b/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C
@@ -24,6 +24,9 @@ License
 Application
     objToVTK
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Read obj line (not surface!) file and convert into vtk.
 
diff --git a/applications/utilities/mesh/manipulation/orientFaceZone/orientFaceZone.C b/applications/utilities/mesh/manipulation/orientFaceZone/orientFaceZone.C
index 5595138322f86b443f56bac466c1fa64048b8e80..a13594496faa356519430bc3baa8bba2465272ee 100644
--- a/applications/utilities/mesh/manipulation/orientFaceZone/orientFaceZone.C
+++ b/applications/utilities/mesh/manipulation/orientFaceZone/orientFaceZone.C
@@ -24,6 +24,9 @@ License
 Application
     orientFaceZone
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Corrects orientation of faceZone.
 
diff --git a/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMeshApp.C b/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMeshApp.C
index f0c4c16d71b7b139f17417a70e077e02d90745a9..27209b979305a768a644d891ec970024fe26e67e 100644
--- a/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMeshApp.C
+++ b/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMeshApp.C
@@ -24,6 +24,9 @@ License
 Application
     polyDualMesh
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Calculates the dual of a polyMesh. Adheres to all the feature and patch
     edges.
diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C
index 4877c45319d18e93b1a0d038c6c58731d01b0b99..37cce07659b42426cb6b89a2bc4617e29e08350d 100644
--- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C
+++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C
@@ -24,6 +24,9 @@ License
 Application
     refineMesh
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Utility to refine cells in multiple directions.
 
diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
index 167afe59dd0e725c72709eb00e4fa33523e10fc7..a4fb8169b0c74f881c6907a82bac15c6a693abcf 100644
--- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
+++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
@@ -24,6 +24,9 @@ License
 Application
     renumberMesh
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Renumbers the cell list in order to reduce the bandwidth, reading and
     renumbering all fields from all the time directories.
diff --git a/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C b/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C
index fb49b074fa48d45a0eef26c94028e03ed2aef4af..00ebde5cd506747f8534b4afe62db9a77b3f924a 100644
--- a/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C
+++ b/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C
@@ -24,6 +24,9 @@ License
 Application
     rotateMesh
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Rotates the mesh and fields from the direction n1 to direction n2.
 
diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C
index 1cd3ad69586db3f0fc5d4b2e479d2c7247cd2cc8..4919e21d70617aeaabb1e6d5c334f2b3208a11c3 100644
--- a/applications/utilities/mesh/manipulation/setSet/setSet.C
+++ b/applications/utilities/mesh/manipulation/setSet/setSet.C
@@ -24,6 +24,9 @@ License
 Application
     setSet
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Manipulate a cell/face/point/ set or zone interactively.
 
diff --git a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C
index 8b23cfe5cd5a6e49711056c2c3c7e68b055d1a5c..d855e98ca14143022c5294a53858c43036867031 100644
--- a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C
+++ b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C
@@ -24,6 +24,9 @@ License
 Application
     setsToZones
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Add pointZones/faceZones/cellZones to the mesh from similar named
     pointSets/faceSets/cellSets.
diff --git a/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C b/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C
index 7ce51edf61269037543a8c398520ddb99bddd287..93efe4341f6e13fa9140e54de5f0d9d065fe0573 100644
--- a/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C
+++ b/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -24,6 +24,9 @@ License
 Application
     singleCellMesh
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Reads all fields and maps them to a mesh with all internal faces removed
     (singleCellFvMesh) which gets written to region "singleCell".
@@ -97,7 +100,7 @@ int main(int argc, char *argv[])
             IOobject
             (
                 singleCellName,
-                mesh.polyMesh::instance(),
+                mesh.pointsInstance(),
                 runTime,
                 IOobject::NO_READ,
                 IOobject::AUTO_WRITE
@@ -105,6 +108,8 @@ int main(int argc, char *argv[])
             mesh
         )
     );
+    scMesh().setInstance(mesh.pointsInstance());
+
     // For convenience create any fv* files
     if (!exists(scMesh().fvSolution::objectPath()))
     {
@@ -137,7 +142,7 @@ int main(int argc, char *argv[])
                     IOobject
                     (
                         singleCellName,
-                        mesh.polyMesh::instance(),
+                        mesh.pointsInstance(),
                         runTime,
                         IOobject::NO_READ,
                         IOobject::AUTO_WRITE
diff --git a/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C b/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C
index 5cac0dad7d9d9405487997f0bd2992f842f52ce0..09a3d25d59a613fa2e0ce004171afb56a441a2d4 100644
--- a/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C
+++ b/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C
@@ -24,6 +24,9 @@ License
 Application
     splitMesh
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Splits mesh by making internal faces external. Uses attachDetach.
 
diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
index 529153f812886292e1cd390eb318316c4283d40c..a5789e7ebdd348e973bd1218e2d4e2f793eea615 100644
--- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
+++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
@@ -24,6 +24,9 @@ License
 Application
     splitMeshRegions
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Splits mesh into multiple regions.
 
diff --git a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C
index 1902f1543d473fad84c31b22d06f4a04327f2abf..1718d725f982d59c7814a706cf97a7151ba28b78 100644
--- a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C
+++ b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C
@@ -24,6 +24,10 @@ License
 Application
     stitchMesh
 
+Group
+    grpMeshManipulationUtilities
+
+
 Description
     'Stitches' a mesh.
 
diff --git a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C
index c158b748421dea4b04c32b56be953eb491f49907..19489611c4bb96e9875b0e59be9534e82dfa8e27 100644
--- a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C
+++ b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C
@@ -24,6 +24,9 @@ License
 Application
     subsetMesh
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Selects a section of mesh based on a cellSet.
 
diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSet.C b/applications/utilities/mesh/manipulation/topoSet/topoSet.C
index 8f368f1b3f6f06e06ec58304fa29915d0247d0c3..d5e5358bf55450000ee441cc8cf621ffcc218c00 100644
--- a/applications/utilities/mesh/manipulation/topoSet/topoSet.C
+++ b/applications/utilities/mesh/manipulation/topoSet/topoSet.C
@@ -24,6 +24,9 @@ License
 Application
     topoSet
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Operates on cellSets/faceSets/pointSets through a dictionary.
 
diff --git a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C
index cfddb19c2eae539c5df1947a4e060d21a02b50b4..eb13245ec3632c409cc7c8b15074a6c959a53885 100644
--- a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C
+++ b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C
@@ -24,6 +24,9 @@ License
 Application
     transformPoints
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Transforms the mesh points in the polyMesh directory according to the
     translate, rotate and scale options.
diff --git a/applications/utilities/mesh/manipulation/zipUpMesh/zipUpMesh.C b/applications/utilities/mesh/manipulation/zipUpMesh/zipUpMesh.C
index f4df1dd062bb9c6f96b39b632ae7df372bd52a48..4dbc6a4a75940c8a64e41bab280203c465be4380 100644
--- a/applications/utilities/mesh/manipulation/zipUpMesh/zipUpMesh.C
+++ b/applications/utilities/mesh/manipulation/zipUpMesh/zipUpMesh.C
@@ -24,6 +24,9 @@ License
 Application
     zipUpMesh
 
+Group
+    grpMeshManipulationUtilities
+
 Description
     Reads in a mesh with hanging vertices and zips up the cells to guarantee
     that all polyhedral cells of valid shape are closed.
diff --git a/applications/utilities/miscellaneous/expandDictionary/expandDictionary.C b/applications/utilities/miscellaneous/expandDictionary/expandDictionary.C
index 1b8ecac86d086750eb52230ef5f97410d8d90ea9..cdbd3c76a96843ef10a0ebff6c576fbe7d5c420f 100644
--- a/applications/utilities/miscellaneous/expandDictionary/expandDictionary.C
+++ b/applications/utilities/miscellaneous/expandDictionary/expandDictionary.C
@@ -24,6 +24,9 @@ License
 Application
     expandDictionary
 
+Group
+    grpMiscUtilities
+
 Description
     Read the dictionary provided as an argument, expand the macros etc. and
     write the resulting dictionary to standard output.
diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/Allwmake b/applications/utilities/miscellaneous/foamDebugSwitches/Allwmake
new file mode 100755
index 0000000000000000000000000000000000000000..edc1f5f0dd9da826762286fbb5f8cebe1ba3abcb
--- /dev/null
+++ b/applications/utilities/miscellaneous/foamDebugSwitches/Allwmake
@@ -0,0 +1,11 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # run from this directory
+
+if [ -f "$FFTW_ARCH_PATH/include/fftw3.h" ] || \
+   [ "${FFTW_ARCH_PATH##*-}" = system -a -f "/usr/include/fftw3.h" ]
+then
+    export LINK_FLAGS="-lrandomProcesses"
+fi
+wmake
+
+#------------------------------------------------------------------------------
diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options
index 0a415b6bfbd4a1a947ba3cdf1719e1f978ffb34c..14779c373572b127ba8d2b9680177e7af53e915d 100644
--- a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options
+++ b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options
@@ -1,4 +1,5 @@
 EXE_LIBS = \
+    $(LINK_FLAGS) \
     -lsnappyHexMesh \
     -lbarotropicCompressibilityModel \
     -lsolidThermo \
@@ -41,7 +42,6 @@ EXE_LIBS = \
     -lOpenFOAM \
     -lpotential \
     -lradiationModels \
-    -lrandomProcesses \
     -lreactionThermophysicalModels \
     -lreconstruct \
     -lsampling \
diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C b/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C
index 1b5670fc83cd767d22cf7b4dec189333e8b11c3f..c9ad6ca0a92201e26ac5e1771fbd583a67a46e41 100644
--- a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C
+++ b/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C
@@ -24,6 +24,9 @@ License
 Application
     foamDebugSwitches
 
+Group
+    grpMiscUtilities
+
 Description
     Write out all library debug switches.
 
diff --git a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C
index 715af2481ad118eb67a0ecdcbd7988f380adb878..81971b85f5f5c3be18241d9efdbeb9db35ab87e3 100644
--- a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C
+++ b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C
@@ -24,6 +24,9 @@ License
 Application
     foamFormatConvert
 
+Group
+    grpMiscUtilities
+
 Description
     Converts all IOobjects associated with a case into the format specified
     in the controlDict.
diff --git a/applications/utilities/miscellaneous/foamHelp/foamHelp.C b/applications/utilities/miscellaneous/foamHelp/foamHelp.C
index 277b7a024ac63f0ea22bf05d8d271554099ff5c1..d4d145ee218bbcb1365e0e9bca3281a54c817e0c 100644
--- a/applications/utilities/miscellaneous/foamHelp/foamHelp.C
+++ b/applications/utilities/miscellaneous/foamHelp/foamHelp.C
@@ -24,6 +24,9 @@ License
 Application
     foamHelp
 
+Group
+    grpMiscUtilities
+
 Description
     Top level wrapper utility around foam help utilities
 
diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C
index 68ae82fa50aedbbb131b462144a03944db07fd09..a5b217e87ee3c13b3cf56fb6c6acdb99ed36b755 100644
--- a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C
+++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C
@@ -151,7 +151,7 @@ void Foam::helpType::displayDoc
         Info<< "Source file: " << classDirectory.c_str() << classFile << nl
             << endl;
 
-        system(docBrowser);
+        Foam::system(docBrowser);
     }
     else
     {
diff --git a/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C b/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C
index 74d9028c2bb8d9ff3c737fc34083aa92d77f2973..3b671c5b4cc3b825d2fc44338926acb860657533 100644
--- a/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C
+++ b/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -23,6 +23,11 @@ License
 
 Application
     foamInfoExec
+    To simplify parsing of the output, The normal banner information
+    is suppressed.
+
+Group
+    grpMiscUtilities
 
 Description
     Interrogates a case and prints information to stdout.
diff --git a/applications/utilities/miscellaneous/patchSummary/patchSummary.C b/applications/utilities/miscellaneous/patchSummary/patchSummary.C
index 074774676a9115cc23ef6d578f6009942c573c80..2dc5cbcacd32ffdc8a20123dd9a2e49443947c5b 100644
--- a/applications/utilities/miscellaneous/patchSummary/patchSummary.C
+++ b/applications/utilities/miscellaneous/patchSummary/patchSummary.C
@@ -24,6 +24,9 @@ License
 Application
     patchSummary
 
+Group
+    grpMiscUtilities
+
 Description
     Writes fields and boundary condition info for each patch at each requested
     time instance.
diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C
index 45c14b5d38a29c39859c5934847048814b23ef74..07d6c45513625310ef524ba214fd50d9be6db772 100644
--- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C
+++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -24,6 +24,9 @@ License
 Application
     decomposePar
 
+Group
+    grpParallelUtilities
+
 Description
     Automatically decomposes a mesh and fields of a case for parallel
     execution of OpenFOAM.
@@ -422,7 +425,8 @@ int main(int argc, char *argv[])
                         IOobject::AUTO_WRITE
                     ),
                     mesh,
-                    dimensionedScalar("cellDist", dimless, 0)
+                    dimensionedScalar("cellDist", dimless, -1),
+                    zeroGradientFvPatchScalarField::typeName
                 );
 
                 forAll(procIds, celli)
@@ -430,6 +434,7 @@ int main(int argc, char *argv[])
                    cellDist[celli] = procIds[celli];
                 }
 
+                cellDist.correctBoundaryConditions();
                 cellDist.write();
 
                 Info<< nl << "Wrote decomposition as volScalarField to "
diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C
index 47fc4aaccec8a7ca7d7fe42ac1a348942d622f1a..a561f05462920abaaed74b4116ea98b6de6a48e0 100644
--- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C
+++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C
@@ -24,6 +24,9 @@ License
 Application
     reconstructPar
 
+Group
+    grpParallelUtilities
+
 Description
     Reconstructs fields of a case that is decomposed for parallel
     execution of OpenFOAM.
diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C
index a4ccd17bb19c47e82ab06ee0aa58df35d4c325d4..182fb79f7f8f86bc08bf1b45699c8d038ab44110 100644
--- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C
+++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C
@@ -24,6 +24,9 @@ License
 Application
     reconstructParMesh
 
+Group
+    grpParallelUtilities
+
 Description
     Reconstructs a mesh using geometric information only.
 
diff --git a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C
index a02bf106a7ed7c4c0141418ba2170a1c9499a5e2..dfe03403472a56996de7bf866a5f1cf5289d28ef 100644
--- a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C
+++ b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C
@@ -24,6 +24,9 @@ License
 Application
     redistributePar
 
+Group
+    grpParallelUtilities
+
 Description
     Redistributes existing decomposed mesh and fields according to the current
     settings in the decomposeParDict file.
@@ -2579,7 +2582,7 @@ int main(int argc, char *argv[])
              || procStat == fvMesh::TOPO_PATCH_CHANGE
             )
             {
-                Info<< "   Detected topology change; reconstructing addressing"
+                Info<< "    Detected topology change; reconstructing addressing"
                     << nl << endl;
 
                 if (baseMeshPtr.valid())
diff --git a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C
index 8427f9b1b455959a5bfa317e5039afee4eb7f220..a1eb5461b6952aa19eec04f47c4c90740d91cb54 100644
--- a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C
+++ b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C
@@ -24,6 +24,9 @@ License
 Application
     foamDataToFluent
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Translates OpenFOAM data to Fluent format.
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files
index 44c513a079bdb9707167566ccc85a334e91d4078..421e8392b88501e3efa3ae9323578c59721d8012 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files
@@ -1,6 +1,5 @@
-itoa.C
 ensightMesh.C
-ensightParticlePositions.C
+ensightCloud.C
 foamToEnsight.C
 
 EXE = $(FOAM_APPBIN)/foamToEnsight
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options
index c818403451f07fe48e26f74f9685e135b019b16d..1424ecc5361b93a0e4bf21a950555405644d5ef2 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options
@@ -5,7 +5,8 @@ EXE_INC = \
     -I$(LIB_SRC)/dynamicMesh/lnInclude \
     -I$(LIB_SRC)/fileFormats/lnInclude \
     -I$(LIB_SRC)/sampling/lnInclude \
-    -I$(LIB_SRC)/lagrangian/basic/lnInclude
+    -I$(LIB_SRC)/lagrangian/basic/lnInclude \
+    -I$(LIB_SRC)/conversion/lnInclude
 
 EXE_LIBS = \
     -lfiniteVolume \
@@ -13,5 +14,5 @@ EXE_LIBS = \
     -lfileFormats \
     -lsampling \
     -lgenericPatchFields \
-    -llagrangian
-
+    -llagrangian \
+    -lconversion
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H
index 47a3540da701cc037457f3bbb4dc460f98e75148..50e78e781c8ef9a70ae7e8553d9d272a91793df4 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H
@@ -1,21 +1,33 @@
-// ignore special fields or fields that we don't handle
-//
-bool variableGood = true;
-for (label n1=0; n1<Times.size() && variableGood; ++n1)
+// ignore special fields (_0 fields),
+// ignore fields we don't handle,
+// ignore fields that are not available for all time-steps
+
+// hash by field-name in fieldsToUse
+if (!fieldsToUse.found(fieldName))
 {
-    // ignore _0 fields
-    if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0")
+    bool variableGood = false;
+
+    forAll(timeDirs, n1)
     {
-        variableGood = false;
-    }
-    else
-    {
-        variableGood = IOobject
+        variableGood =
         (
-            fieldName,
-            Times[n1].name(),
-            mesh,
-            IOobject::NO_READ
-        ).typeHeaderOk<volScalarField>(false);
+            fieldName.size() > 2 && fieldName(fieldName.size()-2, 2) == "_0"
+          ? false
+          : IOobject
+            (
+                fieldName,
+                timeDirs[n1].name(),
+                mesh,
+                IOobject::NO_READ
+            ).typeHeaderOk<volScalarField>(false)
+        );
+
+        if (variableGood)
+        {
+            break;
+        }
     }
+
+    reduce(variableGood, andOp<bool>());
+    fieldsToUse.set(fieldName, variableGood);
 }
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H
index d4027ad1c5abd9586064e78d14debc7cc259e0db..bda9220acbddf7feca356febe22a9724f7f27ce9 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H
@@ -1,27 +1,50 @@
 // check for "points" in any of the result directories
 
 bool meshMoving = false;
-if (Times.size() > 1)
+
+if (timeDirs.size() > 1 && Pstream::master())
 {
-    // We already loaded a mesh (usually from constant). See if any other
-    // points files
-    forAll(Times, timeI)
+    // We already loaded a mesh (usually from constant).
+    // See if any other "polyMesh/points" files exist too.
+
+    const fileName& baseDir = mesh.time().path();
+
+    Info<< "Search for moving mesh ... " << flush;
+    forAll(timeDirs, timeI)
     {
-        if (Times[timeI].name() != mesh.pointsInstance())
-        {
-            IOobject io
+        const word& timeName = timeDirs[timeI].name();
+
+        meshMoving =
+        (
+            timeName != mesh.pointsInstance()
+         && isDir(baseDir/timeName/polyMesh::meshSubDir)
+         && IOobject
             (
                 "points",
-                Times[timeI].name(),
+                timeName,
                 polyMesh::meshSubDir,
                 mesh,
-                IOobject::NO_READ
-            );
-            if (io.typeHeaderOk<pointIOField>(true))
-            {
-                meshMoving = true;
-                break;
-            }
+                IOobject::NO_READ,
+                IOobject::NO_WRITE,
+                false  // no register
+            ).typeHeaderOk<pointIOField>(true)
+        );
+
+        if (meshMoving)
+        {
+            break;
         }
     }
+
+    if (meshMoving)
+    {
+        Info<< "found." << nl
+            << "    Writing meshes for every timestep." << endl;
+    }
+    else
+    {
+        Info<< "none detected." << endl;
+    }
 }
+
+reduce(meshMoving, orOp<bool>());
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightAsciiStream.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightAsciiStream.H
index 68eb88e1589a1fc853c07765eeeed2f5cac76a55..ceccc987aeae269798cf88d87adbcb315f0455bf 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightAsciiStream.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightAsciiStream.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -52,17 +52,17 @@ class ensightAsciiStream
 {
     // Private data
 
-        //- Description of data_
+        //- Output file stream
         OFstream str_;
 
 
     // Private Member Functions
 
         //- Disallow default bitwise copy construct
-        ensightAsciiStream(const ensightAsciiStream&);
+        ensightAsciiStream(const ensightAsciiStream&) = delete;
 
         //- Disallow default bitwise assignment
-        void operator=(const ensightAsciiStream&);
+        void operator=(const ensightAsciiStream&) = delete;
 
 
 public:
@@ -70,14 +70,14 @@ public:
     // Constructors
 
         //- Construct from components
-        ensightAsciiStream(const fileName& f, const Time& runTime)
+        ensightAsciiStream(const fileName& f)
         :
             ensightStream(f),
             str_
             (
                 f,
-                runTime.writeFormat(),
-                runTime.writeVersion(),
+                IOstream::ASCII,
+                IOstream::currentVersion,
                 IOstream::UNCOMPRESSED
             )
         {
@@ -139,14 +139,6 @@ public:
                 << setw(10) << partI << nl;
         }
 
-    // Member Operators
-
-    // Friend Functions
-
-    // Friend Operators
-
-    // IOstream Operators
-
 };
 
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightBinaryStream.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightBinaryStream.H
index d3435677228246e3da0fcc4074c4cfaf0488bd9c..d1c3d6e3b37aa7f9b10da495ae7612798845a23c 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightBinaryStream.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightBinaryStream.H
@@ -51,17 +51,17 @@ class ensightBinaryStream
 {
     // Private data
 
-        //- Description of data_
+        //- Output file stream
         autoPtr<std::ofstream> str_;
 
 
     // Private Member Functions
 
         //- Disallow default bitwise copy construct
-        ensightBinaryStream(const ensightBinaryStream&);
+        ensightBinaryStream(const ensightBinaryStream&) = delete;
 
         //- Disallow default bitwise assignment
-        void operator=(const ensightBinaryStream&);
+        void operator=(const ensightBinaryStream&) = delete;
 
 
 public:
@@ -69,7 +69,7 @@ public:
     // Constructors
 
         //- Construct from components
-        ensightBinaryStream(const fileName& f, const Time&)
+        ensightBinaryStream(const fileName& f)
         :
             ensightStream(f),
             str_
@@ -90,11 +90,6 @@ public:
 
     // Member Functions
 
-        virtual bool ascii() const
-        {
-            return false;
-        }
-
         virtual void write(const char* val)
         {
             char buffer[80];
@@ -141,14 +136,6 @@ public:
             write(partI);
         }
 
-    // Member Operators
-
-    // Friend Functions
-
-    // Friend Operators
-
-    // IOstream Operators
-
 };
 
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCaseTail.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCaseTail.H
index 6ec8373fcf07b708d36a899f60a03f09ac01a793..5a18a953c70b0f634621a3d03c95a01bf3a1887b 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCaseTail.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCaseTail.H
@@ -1,5 +1,8 @@
 if (Pstream::master())
 {
+    ensightCaseFile.setf(ios_base::scientific, ios_base::floatfield);
+    ensightCaseFile.precision(5);
+
     ensightCaseFile << nl << "TIME" << nl
         << "time set:                      " << 1 << nl
         << "number of steps:               " << nTimeSteps << nl
@@ -8,20 +11,17 @@ if (Pstream::master())
 
     ensightCaseFile << "time values:" << nl;
 
-    ensightCaseFile.setf(ios_base::scientific, ios_base::floatfield);
-    ensightCaseFile.precision(5);
-
     label count = 0;
     scalar Tcorr = 0.0;
-    if (Times[0].value() < 0)
+    if (timeDirs[0].value() < 0)
     {
-        Tcorr = - Times[0].value();
+        Tcorr = -timeDirs[0].value();
         Info<< "Correcting time values. Adding " << Tcorr << endl;
     }
 
-    forAll(Times, n)
+    forAll(timeDirs, n)
     {
-        ensightCaseFile << setw(12) << Times[n].value() + Tcorr << " ";
+        ensightCaseFile << setw(12) << timeDirs[n].value() + Tcorr << " ";
 
         if (++count % 6 == 0)
         {
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloud.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloud.C
new file mode 100644
index 0000000000000000000000000000000000000000..08779ff0a8c4b7d7a34cfdf35a234b342c4b8503
--- /dev/null
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloud.C
@@ -0,0 +1,180 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "ensightCloud.H"
+#include "ensightFile.H"
+#include "fvMesh.H"
+#include "passiveParticle.H"
+#include "Cloud.H"
+#include "pointList.H"
+
+// * * * * * * * * * * * * * * * Global Functions  * * * * * * * * * * * * * //
+
+void Foam::ensightParticlePositions
+(
+    const fvMesh& mesh,
+    const fileName& dataDir,
+    const label timeIndex,
+    const word& cloudName,
+    const bool dataExists,
+    IOstream::streamFormat format
+)
+{
+    if (dataExists)
+    {
+        Info<< " positions";
+    }
+    else
+    {
+        Info<< " positions{0}";
+    }
+
+    // Total number of parcels on all processes
+    label nTotParcels = 0;
+    autoPtr<Cloud<passiveParticle>> cloudPtr;
+
+    if (dataExists)
+    {
+        cloudPtr.reset(new Cloud<passiveParticle>(mesh, cloudName, false));
+        nTotParcels = cloudPtr().size();
+    }
+    reduce(nTotParcels, sumOp<label>());
+
+    if (Pstream::master())
+    {
+        const fileName postFileName =
+            ensightFile::subDir(timeIndex)/cloud::prefix/cloudName/"positions";
+
+        // the ITER/lagrangian subdirectory must exist
+        mkDir(dataDir/postFileName.path());
+
+        ensightFile os(dataDir, postFileName, format);
+
+        // tag binary format (just like geometry files)
+        os.writeBinaryHeader();
+        os.write(postFileName); // description
+        os.newline();
+        os.write("particle coordinates");
+        os.newline();
+        os.write(nTotParcels, 8);   // unusual width
+        os.newline();
+
+        if (!nTotParcels)
+        {
+            return;  // DONE
+        }
+
+        if (format == IOstream::BINARY)
+        {
+            // binary write is Ensight6 - first ids, then positions
+
+            // 1-index
+            for (label parcelId = 0; parcelId < nTotParcels; ++parcelId)
+            {
+                os.write(parcelId+1);
+            }
+
+            // Master
+            forAllConstIter(Cloud<passiveParticle>, cloudPtr(), elmnt)
+            {
+                const point& p = elmnt().position();
+
+                os.write(p.x());
+                os.write(p.y());
+                os.write(p.z());
+            }
+
+            // Slaves
+            for (int slave=1; slave<Pstream::nProcs(); ++slave)
+            {
+                IPstream fromSlave(Pstream::scheduled, slave);
+                pointList points(fromSlave);
+
+                forAll(points, pti)
+                {
+                    const point& p = points[pti];
+
+                    os.write(p.x());
+                    os.write(p.y());
+                    os.write(p.z());
+                }
+            }
+        }
+        else
+        {
+            // ASCII id + position together
+
+            label parcelId = 0;
+            forAllConstIter(Cloud<passiveParticle>, cloudPtr(), elmnt)
+            {
+                const point& p = elmnt().position();
+
+                os.write(++parcelId, 8);    // unusual width
+                os.write(p.x());
+                os.write(p.y());
+                os.write(p.z());
+                os.newline();
+            }
+
+            // Slaves
+            for (int slave=1; slave<Pstream::nProcs(); ++slave)
+            {
+                IPstream fromSlave(Pstream::scheduled, slave);
+                pointList points(fromSlave);
+
+                forAll(points, pti)
+                {
+                    const point& p = points[pti];
+
+                    os.write(++parcelId, 8);    // unusual width
+                    os.write(p.x());
+                    os.write(p.y());
+                    os.write(p.z());
+                    os.newline();
+                }
+            }
+        }
+    }
+    else if (nTotParcels)
+    {
+        // SLAVE, and data exist
+        pointList points(cloudPtr().size());
+
+        label pti = 0;
+        forAllConstIter(Cloud<passiveParticle>, cloudPtr(), elmnt)
+        {
+            const point& p = elmnt().position();
+            points[pti++] = p;
+        }
+
+        {
+            OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
+            toMaster<< points;
+        }
+    }
+
+}
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudField.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloud.H
similarity index 71%
rename from applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudField.H
rename to applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloud.H
index 57016c3254eb886bb777b500e1df1b319a45a299..14661506622e2919f1140bc2f1b6ed588c61c73d 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudField.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloud.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -27,35 +27,62 @@ InApplication
 Description
 
 SourceFiles
-    ensightCloudField.C
+    ensightCloud.C
+    ensightCloudTemplates.C
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef ensightCloudField_H
-#define ensightCloudField_H
+#ifndef ensightCloud_H
+#define ensightCloud_H
 
+#include "ensightFile.H"
+#include "fvMesh.H"
 #include "Cloud.H"
 #include "IOobject.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+namespace Foam
+{
+
+void ensightParticlePositions
+(
+    const fvMesh& mesh,
+    const fileName& dataDir,
+    const label timeIndex,
+    const word& cloudName,
+    const bool dataExists,
+    const IOstream::streamFormat format
+);
+
+
 template<class Type>
 void ensightCloudField
 (
     const IOobject& fieldObject,
-    const fileName& postProcPath,
-    const word& prepend,
+    const fileName& dataDir,
     const label timeIndex,
-    const word& timeFile,
     const word& cloudName,
+    const label cloudNo,
     Ostream& ensightCaseFile,
-    const bool dataExists
+    const bool dataExists,
+    const IOstream::streamFormat format
 );
 
+
+template<class Type>
+void writeCloudField
+(
+    const IOField<Type>& field,
+    ensightFile& os
+);
+
+}
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 #ifdef NoRepository
-    #include "ensightCloudField.C"
+    #include "ensightCloudTemplates.C"
 #endif
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudField.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudField.C
deleted file mode 100644
index 337380de135d7d9ecaac7672923a75c1af435811..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudField.C
+++ /dev/null
@@ -1,129 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software: you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
-
-\*---------------------------------------------------------------------------*/
-
-#include "ensightCloudField.H"
-#include "Time.H"
-#include "IOField.H"
-#include "OFstream.H"
-#include "IOmanip.H"
-#include "ensightPTraits.H"
-
-using namespace Foam;
-
-// * * * * * * * * * * * * * * * Global Functions  * * * * * * * * * * * * * //
-
-template<class Type>
-void ensightCloudField
-(
-    const IOobject& fieldObject,
-    const fileName& postProcPath,
-    const word& prepend,
-    const label timeIndex,
-    const word& cloudName,
-    Ostream& ensightCaseFile,
-    const bool dataExists
-)
-{
-    if (dataExists)
-    {
-        Info<< "Converting cloud " << cloudName
-            << " field " << fieldObject.name() << endl;
-    }
-    else
-    {
-        Info<< "Creating empty cloud " << cloudName
-            << " field "  << fieldObject.name() << endl;
-    }
-
-    word timeFile = prepend + itoa(timeIndex);
-
-    const Time& runTime = fieldObject.time();
-
-    if (timeIndex == 0 && Pstream::master())
-    {
-        ensightCaseFile
-            << pTraits<Type>::typeName << " per measured node:      1       ";
-        ensightCaseFile.width(15);
-        ensightCaseFile.setf(ios_base::left);
-        ensightCaseFile
-            << ("c" + fieldObject.name()).c_str()
-            << (' ' + prepend + "****." + cloudName
-              + "." + fieldObject.name()).c_str()
-            << nl;
-    }
-
-    fileName ensightFileName
-    (
-        timeFile + "." + cloudName +"." + fieldObject.name()
-    );
-
-    OFstream ensightFile
-    (
-        postProcPath/ensightFileName,
-        runTime.writeFormat(),
-        runTime.writeVersion(),
-        runTime.writeCompression()
-    );
-
-    ensightFile<< pTraits<Type>::typeName << " values" << nl;
-
-    if (dataExists)
-    {
-        IOField<Type> vf(fieldObject);
-
-        ensightFile.setf(ios_base::scientific, ios_base::floatfield);
-        ensightFile.precision(5);
-
-        label count = 0;
-        forAll(vf, i)
-        {
-            Type v = vf[i];
-
-            if (mag(v) < 1.0e-90)
-            {
-                v = Zero;
-            }
-
-            for (direction i=0; i < pTraits<Type>::nComponents; ++i)
-            {
-                label cmpt = ensightPTraits<Type>::componentOrder[i];
-
-                ensightFile << setw(12) << component(v, cmpt);
-                if (++count % 6 == 0)
-                {
-                    ensightFile << nl;
-                }
-            }
-        }
-
-        if ((count % 6 != 0) || (count==0))
-        {
-            ensightFile << nl;
-        }
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudTemplates.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudTemplates.C
new file mode 100644
index 0000000000000000000000000000000000000000..ac2559f17cfbb66b78a53c52e2a405c6daee4b1e
--- /dev/null
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudTemplates.C
@@ -0,0 +1,192 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "ensightCloud.H"
+#include "ensightFile.H"
+#include "Time.H"
+#include "IOField.H"
+#include "OFstream.H"
+#include "IOmanip.H"
+#include "ensightPTraits.H"
+
+// * * * * * * * * * * * * * * * Global Functions  * * * * * * * * * * * * * //
+
+template<class Type>
+void Foam::writeCloudField
+(
+    const Foam::IOField<Type>& field,
+    Foam::ensightFile& os
+)
+{
+    if (returnReduce(field.size(), sumOp<label>()) > 0)
+    {
+        if (Pstream::master())
+        {
+            // 6 values per line
+            label count = 0;
+
+            // Master
+            forAll(field, i)
+            {
+                Type val = field[i];
+
+                if (mag(val) < 1e-90)
+                {
+                    val = Zero;
+                }
+
+                for (direction d=0; d < pTraits<Type>::nComponents; ++d)
+                {
+                    label cmpt = ensightPTraits<Type>::componentOrder[d];
+                    os.write(component(val, cmpt));
+
+                    if (++count % 6 == 0)
+                    {
+                        os.newline();
+                    }
+                }
+            }
+
+            // Slaves
+            for (int slave=1; slave<Pstream::nProcs(); ++slave)
+            {
+                IPstream fromSlave(Pstream::scheduled, slave);
+                Field<Type> slaveData(fromSlave);
+
+                forAll(slaveData, i)
+                {
+                    Type val = slaveData[i];
+
+                    if (mag(val) < 1e-90)
+                    {
+                        val = Zero;
+                    }
+
+                    for (direction d=0; d < pTraits<Type>::nComponents; ++d)
+                    {
+                        label cmpt = ensightPTraits<Type>::componentOrder[d];
+                        os.write(component(val, cmpt));
+
+                        if (++count % 6 == 0)
+                        {
+                            os.newline();
+                        }
+                    }
+                }
+            }
+
+            // add final newline if required
+            if (count % 6)
+            {
+                os.newline();
+            }
+        }
+        else
+        {
+            OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
+            toMaster<< field;
+        }
+    }
+}
+
+
+template<class Type>
+void Foam::ensightCloudField
+(
+    const Foam::IOobject& fieldObject,
+    const Foam::fileName& dataDir,
+    const Foam::label timeIndex,
+    const Foam::word& cloudName,
+    const Foam::label cloudNo,
+    Foam::Ostream& ensightCaseFile,
+    const bool dataExists,
+    Foam::IOstream::streamFormat format
+)
+{
+    const ensight::VarName varName(fieldObject.name());
+
+    if (dataExists)
+    {
+        Info<< ' ' << fieldObject.name();
+    }
+    else
+    {
+        Info<< ' ' << fieldObject.name() << "{0}"; // ie, empty field
+    }
+
+    ensightFile* filePtr(nullptr);
+    if (Pstream::master())
+    {
+        const fileName postFileName =
+            ensightFile::subDir(timeIndex)/cloud::prefix/cloudName/varName;
+
+        // the ITER/lagrangian subdirectory must exist
+        // the ITER/lagrangian subdirectory was already created
+        // when writing positions
+
+        mkDir(dataDir/postFileName.path());
+
+        if (timeIndex == 0)
+        {
+            const fileName dirName =
+                dataDir.name()/ensightFile::mask()/cloud::prefix/cloudName;
+
+            ensightCaseFile.setf(ios_base::left);
+
+            // prefix variables with 'c' (cloud)
+            ensightCaseFile
+                << ensightPTraits<Type>::typeName << " per "
+                << setw(20)
+                << "measured node:"
+                << " 1  "
+                << setw(15)
+                << ("c" + Foam::name(cloudNo) + varName).c_str() << ' '
+                << (dirName/varName).c_str()
+                << nl;
+        }
+
+        filePtr = new ensightFile(dataDir, postFileName, format);
+        // description
+        filePtr->write
+        (
+            string(postFileName + " <" + pTraits<Type>::typeName + ">")
+        );
+        filePtr->newline();
+    }
+
+    if (dataExists)
+    {
+        IOField<Type> field(fieldObject);
+        writeCloudField(field, *filePtr);
+    }
+
+    if (filePtr) // on master only
+    {
+        delete filePtr;
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C
index 11c3a9a7b6f6566a0c50351b8b36c137b5c2c5fd..a8ea3823f717df0a7e65b30a55007f8efcf35d2e 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C
@@ -23,12 +23,12 @@ License
 
 \*---------------------------------------------------------------------------*/
 
+#include "ensightFile.H"
 #include "ensightField.H"
 #include "fvMesh.H"
 #include "volFields.H"
 #include "OFstream.H"
 #include "IOmanip.H"
-#include "itoa.H"
 #include "volPointInterpolation.H"
 #include "ensightBinaryStream.H"
 #include "ensightAsciiStream.H"
@@ -81,7 +81,9 @@ volField
     // Construct volField (with zeroGradient) from dimensioned field
 
     IOobject io(df);
-    io.readOpt() = IOobject::NO_READ;
+    io.readOpt()  = IOobject::NO_READ;
+    io.writeOpt() = IOobject::NO_WRITE;
+    io.registerObject() = false;
 
     tmp<GeometricField<Type, fvPatchField, volMesh>> tvf
     (
@@ -89,16 +91,17 @@ volField
         (
             io,
             df.mesh(),
-            df.dimensions(),
-            zeroGradientFvPatchField<scalar>::typeName
+            dimensioned<Type>("0", df.dimensions(), Zero),
+            zeroGradientFvPatchField<Type>::typeName
         )
     );
     tvf.ref().internalField() = df;
     tvf.ref().correctBoundaryConditions();
-    const GeometricField<Type, fvPatchField, volMesh>& vf = tvf();
 
     if (meshSubsetter.hasSubMesh())
     {
+        const GeometricField<Type, fvPatchField, volMesh>& vf = tvf();
+
         tmp<GeometricField<Type, fvPatchField, volMesh>> tfld
         (
             meshSubsetter.interpolate(vf)
@@ -121,10 +124,8 @@ volField
 //    const IOobject& io,
 //    const fvMesh& mesh,
 //    const ensightMesh& eMesh,
-//    const fileName& postProcPath,
-//    const word& prepend,
+//    const fileName& dataDir,
 //    const label timeIndex,
-//    const bool binary,
 //    const bool nodeValues,
 //    Ostream& ensightCaseFile
 //)
@@ -134,10 +135,8 @@ volField
 //    (
 //        volField<typename Container::value_type>(meshSubsetter, fld),
 //        eMesh,
-//        postProcPath,
-//        prepend,
+//        dataDir,
 //        timeIndex,
-//        binary,
 //        nodeValues,
 //        ensightCaseFile
 //    );
@@ -175,26 +174,26 @@ void writeField
 (
     const char* key,
     const Field<Type>& vf,
-    ensightStream& ensightFile
+    ensightStream& os
 )
 {
     if (returnReduce(vf.size(), sumOp<label>()) > 0)
     {
         if (Pstream::master())
         {
-            ensightFile.write(key);
+            os.write(key);
 
             for (direction i=0; i < pTraits<Type>::nComponents; ++i)
             {
                 label cmpt = ensightPTraits<Type>::componentOrder[i];
 
-                ensightFile.write(vf.component(cmpt));
+                os.write(vf.component(cmpt));
 
                 for (int slave=1; slave<Pstream::nProcs(); slave++)
                 {
                     IPstream fromSlave(Pstream::scheduled, slave);
                     scalarField slaveData(fromSlave);
-                    ensightFile.write(slaveData);
+                    os.write(slaveData);
                 }
             }
         }
@@ -220,35 +219,35 @@ bool writePatchField
     const label ensightPatchI,
     const faceSets& boundaryFaceSet,
     const ensightMesh::nFacePrimitives& nfp,
-    ensightStream& ensightFile
+    ensightStream& os
 )
 {
     if (nfp.nTris || nfp.nQuads || nfp.nPolys)
     {
         if (Pstream::master())
         {
-            ensightFile.writePartHeader(ensightPatchI);
+            os.writePartHeader(ensightPatchI);
         }
 
         writeField
         (
             "tria3",
             Field<Type>(pf, boundaryFaceSet.tris),
-            ensightFile
+            os
         );
 
         writeField
         (
             "quad4",
             Field<Type>(pf, boundaryFaceSet.quads),
-            ensightFile
+            os
         );
 
         writeField
         (
             "nsided",
             Field<Type>(pf, boundaryFaceSet.polys),
-            ensightFile
+            os
         );
 
         return true;
@@ -267,15 +266,11 @@ void writePatchField
     const Field<Type>& pf,
     const word& patchName,
     const ensightMesh& eMesh,
-    const fileName& postProcPath,
-    const word& prepend,
+    const fileName& dataDir,
     const label timeIndex,
-    const bool binary,
     Ostream& ensightCaseFile
 )
 {
-    const Time& runTime = eMesh.mesh().time();
-
     const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
     const wordList& allPatchNames = eMesh.allPatchNames();
     const HashTable<ensightMesh::nFacePrimitives>&
@@ -295,54 +290,52 @@ void writePatchField
         ensightPatchI++;
     }
 
-
-    word pfName = patchName + '.' + fieldName;
-
-    word timeFile = prepend + itoa(timeIndex);
-
-    ensightStream* ensightFilePtr = NULL;
+    ensightStream* filePtr(nullptr);
     if (Pstream::master())
     {
+        // TODO: verify that these are indeed valid ensight variable names
+        const word varName = patchName + '.' + fieldName;
+        const fileName postFileName = ensightFile::subDir(timeIndex)/varName;
+
+        // the data/ITER subdirectory must exist
+        mkDir(dataDir/postFileName.path());
+
         if (timeIndex == 0)
         {
-            ensightCaseFile.setf(ios_base::left);
+            const fileName dirName = dataDir.name()/ensightFile::mask();
 
+            ensightCaseFile.setf(ios_base::left);
             ensightCaseFile
-                << ensightPTraits<Type>::typeName
-                << " per element:            1       "
-                << setw(15) << pfName
-                << (' ' + prepend + "****." + pfName).c_str()
+                << ensightPTraits<Type>::typeName << " per "
+                << setw(20)
+                << "element:"
+                << " 1  "
+                << setw(15)
+                << varName.c_str() << ' '
+                << (dirName/varName).c_str()
                 << nl;
         }
 
-        // set the filename of the ensight file
-        fileName ensightFileName(timeFile + "." + pfName);
-
-        if (binary)
+        if (eMesh.format() == IOstream::BINARY)
         {
-            ensightFilePtr = new ensightBinaryStream
+            filePtr = new ensightBinaryStream
             (
-                postProcPath/ensightFileName,
-                runTime
+                dataDir/postFileName
             );
         }
         else
         {
-            ensightFilePtr = new ensightAsciiStream
+            filePtr = new ensightAsciiStream
             (
-                postProcPath/ensightFileName,
-                runTime
+                dataDir/postFileName
             );
         }
-    }
-
-    ensightStream& ensightFile = *ensightFilePtr;
 
-    if (Pstream::master())
-    {
-        ensightFile.write(ensightPTraits<Type>::typeName);
+        filePtr->write(ensightPTraits<Type>::typeName);
     }
 
+    ensightStream& os = *filePtr;
+
     if (patchi >= 0)
     {
         writePatchField
@@ -352,7 +345,7 @@ void writePatchField
             ensightPatchI,
             boundaryFaceSets[patchi],
             nPatchPrims.find(patchName)(),
-            ensightFile
+            os
         );
     }
     else
@@ -366,13 +359,13 @@ void writePatchField
             ensightPatchI,
             nullFaceSets,
             nPatchPrims.find(patchName)(),
-            ensightFile
+            os
         );
     }
 
-    if (Pstream::master())
+    if (filePtr) // on master only
     {
-        delete ensightFilePtr;
+        delete filePtr;
     }
 }
 
@@ -382,19 +375,14 @@ void ensightField
 (
     const GeometricField<Type, fvPatchField, volMesh>& vf,
     const ensightMesh& eMesh,
-    const fileName& postProcPath,
-    const word& prepend,
+    const fileName& dataDir,
     const label timeIndex,
-    const bool binary,
     Ostream& ensightCaseFile
 )
 {
-    Info<< "Converting field " << vf.name() << endl;
-
-    word timeFile = prepend + itoa(timeIndex);
+    Info<< ' ' << vf.name();
 
     const fvMesh& mesh = eMesh.mesh();
-    const Time& runTime = mesh.time();
 
     const cellSets& meshCellSets = eMesh.meshCellSets();
     const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
@@ -414,91 +402,91 @@ void ensightField
     const labelList& hexes = meshCellSets.hexes;
     const labelList& polys = meshCellSets.polys;
 
-    ensightStream* ensightFilePtr = NULL;
+    ensightStream* filePtr(nullptr);
     if (Pstream::master())
     {
-        // set the filename of the ensight file
-        fileName ensightFileName(timeFile + "." + vf.name());
+        const ensight::VarName varName(vf.name());
+        const fileName postFileName = ensightFile::subDir(timeIndex)/varName;
 
-        if (binary)
+        // the data/ITER subdirectory must exist
+        mkDir(dataDir/postFileName.path());
+
+        if (timeIndex == 0)
         {
-            ensightFilePtr = new ensightBinaryStream
+            const fileName dirName = dataDir.name()/ensightFile::mask();
+
+            ensightCaseFile.setf(ios_base::left);
+            ensightCaseFile
+                << ensightPTraits<Type>::typeName
+                << " per element:     1  "
+                << setw(15)
+                << varName.c_str() << ' '
+                << (dirName/varName).c_str()
+                << nl;
+        }
+
+        if (eMesh.format() == IOstream::BINARY)
+        {
+            filePtr = new ensightBinaryStream
             (
-                postProcPath/ensightFileName,
-                runTime
+                dataDir/postFileName
             );
         }
         else
         {
-            ensightFilePtr = new ensightAsciiStream
+            filePtr = new ensightAsciiStream
             (
-                postProcPath/ensightFileName,
-                runTime
+                dataDir/postFileName
             );
         }
-    }
-
-    ensightStream& ensightFile = *ensightFilePtr;
 
-    if (Pstream::master())
-    {
-        if (timeIndex == 0)
-        {
-            ensightCaseFile.setf(ios_base::left);
-
-            ensightCaseFile
-                << ensightPTraits<Type>::typeName
-                << " per element:            1       "
-                << setw(15) << vf.name()
-                << (' ' + prepend + "****." + vf.name()).c_str()
-                << nl;
-        }
-
-        ensightFile.write(ensightPTraits<Type>::typeName);
+        filePtr->write(ensightPTraits<Type>::typeName);
     }
 
+    ensightStream& os = *filePtr;
+
     if (patchNames.empty())
     {
         eMesh.barrier();
 
         if (Pstream::master())
         {
-            ensightFile.writePartHeader(1);
+            os.writePartHeader(1);
         }
 
         writeField
         (
             "hexa8",
             map(vf, hexes, wedges),
-            ensightFile
+            os
         );
 
         writeField
         (
             "penta6",
             Field<Type>(vf, prisms),
-            ensightFile
+            os
         );
 
         writeField
         (
             "pyramid5",
             Field<Type>(vf, pyrs),
-            ensightFile
+            os
         );
 
         writeField
         (
             "tetra4",
             Field<Type>(vf, tets),
-            ensightFile
+            os
         );
 
         writeField
         (
             "nfaced",
             Field<Type>(vf, polys),
-            ensightFile
+            os
         );
     }
 
@@ -521,7 +509,7 @@ void ensightField
                     ensightPatchI,
                     boundaryFaceSets[patchi],
                     nPatchPrims.find(patchName)(),
-                    ensightFile
+                    os
                 )
             )
             {
@@ -546,8 +534,7 @@ void ensightField
 
             eMesh.barrier();
 
-            label zoneID = mesh.faceZones().findZoneID(faceZoneName);
-
+            const label zoneID = mesh.faceZones().findZoneID(faceZoneName);
             const faceZone& fz = mesh.faceZones()[zoneID];
 
             // Prepare data to write
@@ -595,7 +582,7 @@ void ensightField
                     ensightPatchI,
                     faceZoneFaceSets[zoneID],
                     nFaceZonePrims.find(faceZoneName)(),
-                    ensightFile
+                    os
                 )
             )
             {
@@ -603,9 +590,10 @@ void ensightField
             }
         }
     }
-    if (Pstream::master())
+
+    if (filePtr) // on master only
     {
-        delete ensightFilePtr;
+        delete filePtr;
     }
 }
 
@@ -615,80 +603,78 @@ void ensightPointField
 (
     const GeometricField<Type, pointPatchField, pointMesh>& pf,
     const ensightMesh& eMesh,
-    const fileName& postProcPath,
-    const word& prepend,
+    const fileName& dataDir,
     const label timeIndex,
-    const bool binary,
     Ostream& ensightCaseFile
 )
 {
-    Info<< "Converting field " << pf.name() << endl;
-
-    word timeFile = prepend + itoa(timeIndex);
+    Info<< ' ' << pf.name();
 
     const fvMesh& mesh = eMesh.mesh();
     const wordList& allPatchNames = eMesh.allPatchNames();
     const wordHashSet& patchNames = eMesh.patchNames();
     const wordHashSet& faceZoneNames = eMesh.faceZoneNames();
 
-
-    ensightStream* ensightFilePtr = NULL;
+    ensightStream* filePtr(nullptr);
     if (Pstream::master())
     {
-        // set the filename of the ensight file
-        fileName ensightFileName(timeFile + "." + pf.name());
+        const ensight::VarName varName(pf.name());
+        const fileName postFileName = ensightFile::subDir(timeIndex)/varName;
 
-        if (binary)
+        // the data/ITER subdirectory must exist
+        mkDir(dataDir/postFileName.path());
+
+        if (timeIndex == 0)
         {
-            ensightFilePtr = new ensightBinaryStream
+            const fileName dirName = dataDir.name()/ensightFile::mask();
+
+            ensightCaseFile.setf(ios_base::left);
+            ensightCaseFile
+                << ensightPTraits<Type>::typeName
+                << " per "
+                << setw(20)
+                << " node:"
+                << " 1  "
+                << setw(15)
+                << varName.c_str() << ' '
+                << (dirName/varName).c_str()
+                << nl;
+        }
+
+        if (eMesh.format() == IOstream::BINARY)
+        {
+            filePtr = new ensightBinaryStream
             (
-                postProcPath/ensightFileName,
-                mesh.time()
+                dataDir/postFileName
             );
         }
         else
         {
-            ensightFilePtr = new ensightAsciiStream
+            filePtr = new ensightAsciiStream
             (
-                postProcPath/ensightFileName,
-                mesh.time()
+                dataDir/postFileName
             );
         }
-    }
-
-    ensightStream& ensightFile = *ensightFilePtr;
-
-    if (Pstream::master())
-    {
-        if (timeIndex == 0)
-        {
-            ensightCaseFile.setf(ios_base::left);
-
-            ensightCaseFile
-                << ensightPTraits<Type>::typeName
-                << " per node:            1       "
-                << setw(15) << pf.name()
-                << (' ' + prepend + "****." + pf.name()).c_str()
-                << nl;
-        }
 
-        ensightFile.write(ensightPTraits<Type>::typeName);
+        filePtr->write(ensightPTraits<Type>::typeName);
     }
 
+    ensightStream& os = *filePtr;
+
     if (eMesh.patchNames().empty())
     {
         eMesh.barrier();
 
         if (Pstream::master())
         {
-            ensightFile.writePartHeader(1);
+            os.writePartHeader(1);
         }
 
         writeField
         (
             "coordinates",
             Field<Type>(pf.internalField(), eMesh.uniquePointMap()),
-            ensightFile
+            os
         );
     }
 
@@ -704,11 +690,8 @@ void ensightPointField
         if (patchNames.empty() || patchNames.found(patchName))
         {
             const fvPatch& p = mesh.boundary()[patchi];
-            if
-            (
-                returnReduce(p.size(), sumOp<label>())
-              > 0
-            )
+
+            if (returnReduce(p.size(), sumOp<label>()) > 0)
             {
                 // Renumber the patch points/faces into unique points
                 labelList pointToGlobal;
@@ -724,14 +707,14 @@ void ensightPointField
 
                 if (Pstream::master())
                 {
-                    ensightFile.writePartHeader(ensightPatchI);
+                    os.writePartHeader(ensightPatchI);
                 }
 
                 writeField
                 (
                     "coordinates",
                     Field<Type>(pf.internalField(), uniqueMeshPointLabels),
-                    ensightFile
+                    os
                 );
 
                 ensightPatchI++;
@@ -748,8 +731,7 @@ void ensightPointField
 
             eMesh.barrier();
 
-            label zoneID = mesh.faceZones().findZoneID(faceZoneName);
-
+            const label zoneID = mesh.faceZones().findZoneID(faceZoneName);
             const faceZone& fz = mesh.faceZones()[zoneID];
 
             if (returnReduce(fz().nPoints(), sumOp<label>()) > 0)
@@ -768,7 +750,7 @@ void ensightPointField
 
                 if (Pstream::master())
                 {
-                    ensightFile.writePartHeader(ensightPatchI);
+                    os.writePartHeader(ensightPatchI);
                 }
 
                 writeField
@@ -779,7 +761,7 @@ void ensightPointField
                         pf.internalField(),
                         uniqueMeshPointLabels
                     ),
-                    ensightFile
+                    os
                 );
 
                 ensightPatchI++;
@@ -787,9 +769,9 @@ void ensightPointField
         }
     }
 
-    if (Pstream::master())
+    if (filePtr) // on master only
     {
-        delete ensightFilePtr;
+        delete filePtr;
     }
 }
 
@@ -799,10 +781,8 @@ void ensightField
 (
     const GeometricField<Type, fvPatchField, volMesh>& vf,
     const ensightMesh& eMesh,
-    const fileName& postProcPath,
-    const word& prepend,
+    const fileName& dataDir,
     const label timeIndex,
-    const bool binary,
     const bool nodeValues,
     Ostream& ensightCaseFile
 )
@@ -819,10 +799,8 @@ void ensightField
         (
             pfld,
             eMesh,
-            postProcPath,
-            prepend,
+            dataDir,
             timeIndex,
-            binary,
             ensightCaseFile
         );
     }
@@ -832,10 +810,8 @@ void ensightField
         (
             vf,
             eMesh,
-            postProcPath,
-            prepend,
+            dataDir,
             timeIndex,
-            binary,
             ensightCaseFile
         );
     }
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.H
index 813fea468eb74cd9d07f52bcd6cc2429352de7f1..175ef1ac7da68d0bc6513db7f1232bb6ca19ac41 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -69,10 +69,8 @@ void ensightField
 (
     const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>& vf,
     const Foam::ensightMesh& eMesh,
-    const Foam::fileName& postProcPath,
-    const Foam::word& prepend,
+    const Foam::fileName& dataDir,
     const Foam::label timeIndex,
-    const bool binary,
     const bool nodeValues,
     Foam::Ostream& ensightCaseFile
 );
@@ -85,8 +83,7 @@ void writePatchField
     const Foam::Field<Type>& pf,
     const Foam::word& patchName,
     const Foam::ensightMesh& eMesh,
-    const Foam::fileName& postProcPath,
-    const Foam::word& prepend,
+    const Foam::fileName& dataDir,
     const Foam::label timeIndex,
     Foam::Ostream& ensightCaseFile
 );
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C
index da9f080aa018e459ec8332f18c9d92f6ae5c700a..1a06c2933bd92bcf92c166e46e95a9888b8ed191 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -32,16 +32,21 @@ License
 #include "processorPolyPatch.H"
 #include "cellModeller.H"
 #include "IOmanip.H"
-#include "itoa.H"
 #include "globalIndex.H"
 #include "mapDistribute.H"
 #include "stringListOps.H"
 
+#include "ensightFile.H"
 #include "ensightBinaryStream.H"
 #include "ensightAsciiStream.H"
 
 #include <fstream>
 
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+const char* Foam::ensightMesh::geometryName = "geometry";
+
+
 // * * * * * * * * * * * * * Private Functions * * * * * * * * * * * * * * //
 
 void Foam::ensightMesh::correct()
@@ -403,7 +408,7 @@ Foam::ensightMesh::ensightMesh
     const bool faceZones,
     const wordReList& faceZonePatterns,
 
-    const bool binary
+    const IOstream::streamFormat format
 )
 :
     mesh_(mesh),
@@ -412,7 +417,7 @@ Foam::ensightMesh::ensightMesh
     patchPatterns_(patchPatterns),
     faceZones_(faceZones),
     faceZonePatterns_(faceZonePatterns),
-    binary_(binary),
+    format_(format),
     meshCellSets_(mesh.nCells())
 {
     correct();
@@ -521,7 +526,7 @@ void Foam::ensightMesh::writePrims
     // Create a temp int array
     if (cellShapes.size())
     {
-        if (ensightGeometryFile.ascii())
+        if (format_ == IOstream::ASCII)
         {
             // Workaround for paraview issue : write one cell per line
 
@@ -1018,63 +1023,55 @@ void Foam::ensightMesh::writeAllPoints
 
 void Foam::ensightMesh::write
 (
-    const fileName& postProcPath,
-    const word& prepend,
+    const fileName& dataDir,
     const label timeIndex,
     const bool meshMoving,
     Ostream& ensightCaseFile
 ) const
 {
-    const Time& runTime = mesh_.time();
     const cellShapeList& cellShapes = mesh_.cellShapes();
 
-
-    word timeFile = prepend;
-
-    if (timeIndex == 0)
-    {
-        timeFile += "0000.";
-    }
-    else if (meshMoving)
+    ensightStream* filePtr(nullptr);
+    if (Pstream::master())
     {
-        timeFile += itoa(timeIndex) + '.';
-    }
+        // set the filename of the ensight file
+        fileName geoFileName = dataDir.path()/ensightMesh::geometryName;
 
-    // set the filename of the ensight file
-    fileName ensightGeometryFileName = timeFile + "mesh";
+        if (meshMoving)
+        {
+            geoFileName =
+                dataDir/ensightFile::subDir(timeIndex)/ensightMesh::geometryName;
 
-    ensightStream* ensightGeometryFilePtr = NULL;
-    if (Pstream::master())
-    {
-        if (binary_)
+            mkDir(geoFileName.path());
+        }
+
+        if (format_ == IOstream::BINARY)
         {
-            ensightGeometryFilePtr = new ensightBinaryStream
+            filePtr = new ensightBinaryStream
             (
-                postProcPath/ensightGeometryFileName,
-                runTime
+                geoFileName
             );
-            ensightGeometryFilePtr->write("C binary");
+            filePtr->write("C binary");
         }
         else
         {
-            ensightGeometryFilePtr = new ensightAsciiStream
+            filePtr = new ensightAsciiStream
             (
-                postProcPath/ensightGeometryFileName,
-                runTime
+                geoFileName
             );
         }
     }
 
-    ensightStream& ensightGeometryFile = *ensightGeometryFilePtr;
+    ensightStream& os = *filePtr;
 
     if (Pstream::master())
     {
         string desc = string("written by OpenFOAM-") + Foam::FOAMversion;
 
-        ensightGeometryFile.write("EnSight Geometry File");
-        ensightGeometryFile.write(desc.c_str());
-        ensightGeometryFile.write("node id assign");
-        ensightGeometryFile.write("element id assign");
+        os.write("EnSight Geometry File");
+        os.write(desc.c_str());
+        os.write("node id assign");
+        os.write("element id assign");
     }
 
     if (patchNames_.empty())
@@ -1089,7 +1086,7 @@ void Foam::ensightMesh::write
             "internalMesh",
             uniquePoints,
             nPoints,
-            ensightGeometryFile
+            os
         );
 
         writeAllPrims
@@ -1103,7 +1100,7 @@ void Foam::ensightMesh::write
                 meshCellSets_.wedges,
                 pointToGlobal_
             ),
-            ensightGeometryFile
+            os
         );
 
         writeAllPrims
@@ -1111,7 +1108,7 @@ void Foam::ensightMesh::write
             "penta6",
             meshCellSets_.nPrisms,
             map(cellShapes, meshCellSets_.prisms, pointToGlobal_),
-            ensightGeometryFile
+            os
         );
 
         writeAllPrims
@@ -1119,7 +1116,7 @@ void Foam::ensightMesh::write
             "pyramid5",
             meshCellSets_.nPyrs,
             map(cellShapes, meshCellSets_.pyrs, pointToGlobal_),
-            ensightGeometryFile
+            os
         );
 
         writeAllPrims
@@ -1127,13 +1124,13 @@ void Foam::ensightMesh::write
             "tetra4",
             meshCellSets_.nTets,
             map(cellShapes, meshCellSets_.tets, pointToGlobal_),
-            ensightGeometryFile
+            os
         );
 
         writeAllPolys
         (
             pointToGlobal_,
-            ensightGeometryFile
+            os
         );
     }
 
@@ -1182,7 +1179,7 @@ void Foam::ensightMesh::write
                     patchName,
                     uniquePoints,
                     globalPointsPtr().size(),
-                    ensightGeometryFile
+                    os
                 );
 
                 writeAllFacePrims
@@ -1191,7 +1188,7 @@ void Foam::ensightMesh::write
                     tris,
                     nfp.nTris,
                     patchFaces,
-                    ensightGeometryFile
+                    os
                 );
 
                 writeAllFacePrims
@@ -1200,7 +1197,7 @@ void Foam::ensightMesh::write
                     quads,
                     nfp.nQuads,
                     patchFaces,
-                    ensightGeometryFile
+                    os
                 );
 
                 writeAllNSided
@@ -1208,7 +1205,7 @@ void Foam::ensightMesh::write
                     polys,
                     nfp.nPolys,
                     patchFaces,
-                    ensightGeometryFile
+                    os
                 );
             }
         }
@@ -1287,7 +1284,7 @@ void Foam::ensightMesh::write
                 faceZoneName,
                 uniquePoints,
                 globalPointsPtr().size(),
-                ensightGeometryFile
+                os
             );
 
             writeAllFacePrims
@@ -1296,7 +1293,7 @@ void Foam::ensightMesh::write
                 tris,
                 nfp.nTris,
                 faceZoneMasterFaces,
-                ensightGeometryFile
+                os
             );
 
             writeAllFacePrims
@@ -1305,7 +1302,7 @@ void Foam::ensightMesh::write
                 quads,
                 nfp.nQuads,
                 faceZoneMasterFaces,
-                ensightGeometryFile
+                os
             );
 
             writeAllNSided
@@ -1313,14 +1310,14 @@ void Foam::ensightMesh::write
                 polys,
                 nfp.nPolys,
                 faceZoneMasterFaces,
-                ensightGeometryFile
+                os
             );
         }
     }
 
-    if (Pstream::master())
+    if (filePtr) // only on master
     {
-        delete ensightGeometryFilePtr;
+        delete filePtr;
     }
 }
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.H
index e1f7e8384b9b124ffbfe740c3a177ace95699f3b..321c9899691e82e4ad0a14278148e9a34144b2e9 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -63,6 +63,11 @@ class ensightStream;
 class ensightMesh
 {
 public:
+
+    //- The name for geometry files
+    static const char* geometryName;
+
+        //- Helper class for managing face primitives
         class nFacePrimitives
         {
         public:
@@ -97,8 +102,8 @@ private:
         const bool faceZones_;
         const wordReList faceZonePatterns_;
 
-        //- Set binary file output
-        const bool binary_;
+        //- Ascii/Binary file output
+        const IOstream::streamFormat format_;
 
         //- The ensight part id for the first patch
         label patchPartOffset_;
@@ -140,10 +145,10 @@ private:
     // Private Member Functions
 
         //- Disallow default bitwise copy construct
-        ensightMesh(const ensightMesh&);
+        ensightMesh(const ensightMesh&) = delete;
 
         //- Disallow default bitwise assignment
-        void operator=(const ensightMesh&);
+        void operator=(const ensightMesh&) = delete;
 
         void writePoints
         (
@@ -267,7 +272,7 @@ public:
             const wordReList& patchPatterns,
             const bool faceZones,
             const wordReList& faceZonePatterns,
-            const bool binary
+            const IOstream::streamFormat format = IOstream::BINARY
         );
 
 
@@ -284,6 +289,11 @@ public:
                 return mesh_;
             }
 
+            IOstream::streamFormat format() const
+            {
+                return format_;
+            }
+
             const cellSets& meshCellSets() const
             {
                 return meshCellSets_;
@@ -352,8 +362,6 @@ public:
             }
 
 
-
-
     // Other
 
         //- Update for new mesh
@@ -371,8 +379,7 @@ public:
 
         void write
         (
-            const fileName& postProcPath,
-            const word& prepend,
+            const fileName& ensightDir,
             const label timeIndex,
             const bool meshMoving,
             Ostream& ensightCaseFile
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightParticlePositions.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightParticlePositions.C
deleted file mode 100644
index d736b3fa930c79d949c0e0269b06cf774a026e7b..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightParticlePositions.C
+++ /dev/null
@@ -1,103 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software: you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
-
-\*---------------------------------------------------------------------------*/
-
-#include "ensightParticlePositions.H"
-#include "fvMesh.H"
-#include "passiveParticle.H"
-#include "Cloud.H"
-#include "OFstream.H"
-#include "IOmanip.H"
-#include "itoa.H"
-
-using namespace Foam;
-
-// * * * * * * * * * * * * * * * Global Functions  * * * * * * * * * * * * * //
-
-void ensightParticlePositions
-(
-    const fvMesh& mesh,
-    const fileName& postProcPath,
-    const word& timeFile,
-    const word& cloudName,
-    const bool dataExists
-)
-{
-    if (dataExists)
-    {
-        Info<< "Converting cloud " << cloudName << " positions" <<  endl;
-    }
-    else
-    {
-        Info<< "Creating empty cloud " << cloudName << " positions" << endl;
-    }
-
-    const Time& runTime = mesh.time();
-
-    fileName ensightFileName(timeFile + "." + cloudName);
-    OFstream ensightFile
-    (
-        postProcPath/ensightFileName,
-        runTime.writeFormat(),
-        runTime.writeVersion(),
-        runTime.writeCompression()
-    );
-
-    // Output header
-    ensightFile
-        << cloudName.c_str() << nl
-        << "particle coordinates" << nl;
-
-    if (dataExists)
-    {
-        Cloud<passiveParticle> parcels(mesh, cloudName, false);
-
-        // Set Format
-        ensightFile.setf(ios_base::scientific, ios_base::floatfield);
-        ensightFile.precision(5);
-
-        ensightFile<< setw(8) << parcels.size() << nl;
-
-        label nParcels = 0;
-
-        // Output positions
-        forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
-        {
-            const vector& p = elmnt().position();
-
-            ensightFile
-                << setw(8) << ++nParcels
-                << setw(12) << p.x() << setw(12) << p.y() << setw(12) << p.z()
-                << nl;
-        }
-    }
-    else
-    {
-        label nParcels = 0;
-        ensightFile<< setw(8) << nParcels << nl;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightStream.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightStream.H
index e7369778482c66972bfcb3b571091fc2af256c6d..89146e11023a703e3cfe8087864f2f1e7a215935 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightStream.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightStream.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -57,10 +57,10 @@ class ensightStream
     // Private Member Functions
 
         //- Disallow default bitwise copy construct
-        ensightStream(const ensightStream&);
+        ensightStream(const ensightStream&) = delete;
 
         //- Disallow default bitwise assignment
-        void operator=(const ensightStream&);
+        void operator=(const ensightStream&) = delete;
 
 
 public:
@@ -86,8 +86,6 @@ public:
             return name_;
         }
 
-        virtual bool ascii() const = 0;
-
         virtual void write(const char*) = 0;
 
         virtual void write(const int) = 0;
@@ -98,8 +96,6 @@ public:
 
         virtual void writePartHeader(const label) = 0;
 
-
-
 };
 
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/findCloudFields.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/findCloudFields.H
new file mode 100644
index 0000000000000000000000000000000000000000..0f228f723fe1b355c109ba7220a2f64b07df9f27
--- /dev/null
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/findCloudFields.H
@@ -0,0 +1,93 @@
+// check all time directories for the following:
+
+// The fields for each cloud:
+HashTable<HashTable<word>> cloudFields;
+
+// Identify if lagrangian data exist at any time step.
+if (timeDirs.size() && !noLagrangian)
+{
+    const fileName& baseDir = mesh.time().path();
+    const fileName& cloudPrefix = regionPrefix/cloud::prefix;
+
+    Info<< "Searching for lagrangian ... " << flush;
+
+    forAll(timeDirs, timeI)
+    {
+        const word& timeName = timeDirs[timeI].name();
+
+        // DO NOT USE -->>  runTime.setTime(timeDirs[timeI], timeI);  <<--
+        // It incurs a large overhead when done so frequently.
+
+        fileNameList cloudDirs = readDir
+        (
+            baseDir/timeName/cloudPrefix,
+            fileName::DIRECTORY
+        );
+
+        forAll(cloudDirs, cloudI)
+        {
+            const word& cloudName = cloudDirs[cloudI];
+
+            IOobjectList cloudObjs
+            (
+                mesh,
+                timeName,
+                cloudPrefix/cloudName
+            );
+
+            // clouds always require "positions"
+            if (cloudObjs.found("positions"))
+            {
+                HashTable<HashTable<word>>::iterator cloudIter =
+                    cloudFields.find(cloudName);
+
+                if (cloudIter == cloudFields.end())
+                {
+                    // A newly discovered cloud
+                    cloudFields.insert(cloudName, HashTable<word>());
+                    cloudIter = cloudFields.find(cloudName);
+                }
+
+                forAllConstIter(IOobjectList, cloudObjs, fieldIter)
+                {
+                    const IOobject obj = *fieldIter();
+
+                    // Add field and field type
+                    cloudIter().insert
+                    (
+                        obj.name(),
+                        obj.headerClassName()
+                    );
+                }
+            }
+        }
+    }
+
+    // prune out "positions" again since it gets treated specially
+    forAllIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
+    {
+        cloudIter().erase("positions");
+    }
+
+    if (cloudFields.empty())
+    {
+        Info<< "none detected." << endl;
+    }
+}
+
+
+// sorted list of cloud names
+const wordList cloudNames(cloudFields.sortedToc());
+
+if (cloudNames.size())
+{
+    // complete the echo information
+    Info<< "(";
+    forAll(cloudNames, cloudNo)
+    {
+        Info<< ' ' << cloudNames[cloudNo];
+    }
+    Info<< " ) " << endl;
+}
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C
index 25e9905ac57467aec4c9dfb87d04203751730ae1..07000c7f7546801353ee116fd70e8caa03475e7d 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -24,6 +24,9 @@ License
 Application
     foamToEnsight
 
+Group
+    grpPostProcessingUtilitie
+
 Description
     Translates OpenFOAM data to EnSight format.
 
@@ -31,24 +34,33 @@ Description
 
 Usage
     - foamToEnsight [OPTION] \n
-    Translates OpenFOAM data to Ensight format
+    Translates OpenFOAM data to EnSight format
 
     \param -ascii \n
     Write Ensight data in ASCII format instead of "C Binary"
 
-    \param -patches patchList \n
-    Specify particular patches to write.
-    Specifying an empty list suppresses writing the internalMesh.
+    \param -noZero \n
+    Exclude the often incomplete initial conditions.
+
+    \param -noLagrangian \n
+    Suppress writing lagrangian positions and fields.
 
     \param -noPatches \n
     Suppress writing any patches.
 
+    \param -patches patchList \n
+    Specify particular patches to write.
+    Specifying an empty list suppresses writing the internalMesh.
+
     \param -faceZones zoneList \n
     Specify faceZones to write, with wildcards
 
     \param -cellZone zoneName \n
     Specify single cellZone to write (not lagrangian)
 
+    \param -width \<n\>\n
+    Width of EnSight data subdir (default: 8)
+
 Note
     Parallel support for cloud data is not supported
     - writes to \a EnSight directory to avoid collisions with foamToEnsightParts
@@ -67,14 +79,12 @@ Note
 #include "scalarIOField.H"
 #include "tensorIOField.H"
 
+#include "ensightFile.H"
 #include "ensightMesh.H"
 #include "ensightField.H"
-
-#include "ensightParticlePositions.H"
-#include "ensightCloudField.H"
+#include "ensightCloud.H"
 
 #include "fvc.H"
-
 #include "cellSet.H"
 #include "fvMeshSubset.H"
 
@@ -119,6 +129,11 @@ int main(int argc, char *argv[])
         "write values in nodes"
     );
     argList::addBoolOption
+    (
+        "noLagrangian",
+        "suppress writing lagrangian positions and fields"
+    );
+    argList::addBoolOption
     (
         "noPatches",
         "suppress writing any patches"
@@ -148,32 +163,21 @@ int main(int argc, char *argv[])
         "word",
         "specify cellZone to write"
     );
+    argList::addOption
+    (
+        "name",
+        "subdir",
+        "define sub-directory name to use for ensight data "
+        "(default: 'EnSight')"
+    );
+    argList::addOption
+    (
+        "width",
+        "n",
+        "width of ensight data subdir"
+    );
 
-    #include "setRootCase.H"
-
-    // Check options
-    const bool binary = !args.optionFound("ascii");
-    const bool nodeValues = args.optionFound("nodeValues");
-
-    cpuTime timer;
-    memInfo mem;
-    Info<< "Initial memory "
-        << mem.update().size() << " kB" << endl;
-
-    #include "createTime.H"
-
-    instantList Times = timeSelector::select0(runTime, args);
-
-    #include "createNamedMesh.H"
-
-    // Mesh instance (region0 gets filtered out)
-    fileName regionPrefix = "";
-
-    if (regionName != polyMesh::defaultRegion)
-    {
-        regionPrefix = regionName;
-    }
-
+    // the volume field types that we handle
     const label nVolFieldTypes = 10;
     const word volFieldTypes[] =
     {
@@ -190,38 +194,90 @@ int main(int argc, char *argv[])
         volTensorField::DimensionedInternalField::typeName
     };
 
+    #include "setRootCase.H"
+
+    // default to binary output, unless otherwise specified
+    const IOstream::streamFormat format =
+    (
+        args.optionFound("ascii")
+      ? IOstream::ASCII
+      : IOstream::BINARY
+    );
+
+    const bool nodeValues = args.optionFound("nodeValues");
+
+    cpuTime timer;
+    memInfo mem;
+    Info<< "Initial memory "
+        << mem.update().size() << " kB" << endl;
+
+    #include "createTime.H"
+
+    instantList timeDirs = timeSelector::select0(runTime, args);
+
+    // adjust output width
+    if (args.optionFound("width"))
+    {
+        ensightFile::subDirWidth(args.optionRead<label>("width"));
+    }
+
+    // define sub-directory name to use for EnSight data
+    fileName ensightDir = "EnSight";
+    args.optionReadIfPresent("name", ensightDir);
+
     // Path to EnSight directory at case level only
     // - For parallel cases, data only written from master
-    fileName ensightDir = args.rootPath()/args.globalCaseName()/"EnSight";
+    if (!ensightDir.isAbsolute())
+    {
+        ensightDir = args.rootPath()/args.globalCaseName()/ensightDir;
+    }
+
+    const fileName dataDir  = ensightDir/"data";
+    const fileName dataMask = dataDir.name()/ensightFile::mask();
 
     if (Pstream::master())
     {
+        // EnSight and EnSight/data directories must exist
+        // - remove old data for a clean conversion of everything
         if (isDir(ensightDir))
         {
             rmDir(ensightDir);
         }
 
-        mkDir(ensightDir);
+        mkDir(dataDir);
+    }
+
+    #include "createNamedMesh.H"
+
+    // Mesh instance (region0 gets filtered out)
+    fileName regionPrefix;
+    if (regionName != polyMesh::defaultRegion)
+    {
+        regionPrefix = regionName;
     }
 
     // Start of case file header output
     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-    const word prepend = args.globalCaseName() + '.';
-
-    OFstream *ensightCaseFilePtr = NULL;
+    OFstream *ensightCaseFilePtr(nullptr);
     if (Pstream::master())
     {
-        fileName caseFileName = prepend + "case";
-        Info<< nl << "write case: " << caseFileName.c_str() << endl;
+        fileName caseFileName = args.globalCaseName() + ".case";
 
-        // the case file is always ASCII
+        Info<< "Converting " << timeDirs.size() << " time steps" << nl
+            << "Ensight case: " << caseFileName.c_str() << endl;
+
+        // The case file is always ASCII
         ensightCaseFilePtr = new OFstream
         (
             ensightDir/caseFileName,
             IOstream::ASCII
         );
 
+        ensightCaseFilePtr->setf(ios_base::left);
+        ensightCaseFilePtr->setf(ios_base::scientific, ios_base::floatfield);
+        ensightCaseFilePtr->precision(5);
+
         *ensightCaseFilePtr
             << "FORMAT" << nl
             << "type: ensight gold" << nl << nl;
@@ -250,6 +306,8 @@ int main(int argc, char *argv[])
         fieldPatterns = wordReList(args.optionLookup("fields")());
     }
 
+    const bool noLagrangian = args.optionFound("noLagrangian");
+
     word cellZoneName;
     const bool doCellZone = args.optionReadIfPresent("cellZone", cellZoneName);
 
@@ -277,133 +335,84 @@ int main(int argc, char *argv[])
         patchPatterns,
         selectedZones,
         zonePatterns,
-        binary
+        format
     );
 
     // Set Time to the last time before looking for the lagrangian objects
-    runTime.setTime(Times.last(), Times.size()-1);
+    runTime.setTime(timeDirs.last(), timeDirs.size()-1);
 
     IOobjectList objects(mesh, runTime.timeName());
 
     #include "checkMeshMoving.H"
+    #include "findCloudFields.H"
 
-    if (meshMoving)
-    {
-        Info<< "Detected a moving mesh (multiple polyMesh/points files)."
-            << " Writing meshes for every timestep." << endl;
-    }
-
-
-    wordHashSet allCloudNames;
     if (Pstream::master())
     {
-        word geomFileName = prepend + "0000";
+        // test the pre-check variable if there is a moving mesh
+        // time-set for geometries
+        // TODO: split off into separate time-set,
+        // but need to verify ensight spec
 
-        // test pre check variable if there is a moving mesh
         if (meshMoving)
         {
-            geomFileName = prepend + "****";
+            ensightCaseFile
+                << "GEOMETRY" << nl
+                << setw(16) << "model: 1"
+                << (dataMask/ensightMesh::geometryName).c_str() << nl;
         }
-
-        ensightCaseFile
-            << "GEOMETRY" << nl
-            << "model:        1     "
-            << (geomFileName + ".mesh").c_str() << nl;
-    }
-
-    // Identify if lagrangian data exists at each time, and add clouds
-    // to the 'allCloudNames' hash set
-    forAll(Times, timeI)
-    {
-        runTime.setTime(Times[timeI], timeI);
-
-        fileNameList cloudDirs = readDir
-        (
-            runTime.timePath()/regionPrefix/cloud::prefix,
-            fileName::DIRECTORY
-        );
-
-        forAll(cloudDirs, cloudI)
-        {
-            IOobjectList cloudObjs
-            (
-                mesh,
-                runTime.timeName(),
-                cloud::prefix/cloudDirs[cloudI]
-            );
-
-            IOobject* positionsPtr = cloudObjs.lookup(word("positions"));
-
-            if (positionsPtr)
-            {
-                allCloudNames.insert(cloudDirs[cloudI]);
-            }
-        }
-    }
-
-    HashTable<HashTable<word>> allCloudFields;
-    forAllConstIter(wordHashSet, allCloudNames, cloudIter)
-    {
-        // Add the name of the cloud(s) to the case file header
-        if (Pstream::master())
+        else
         {
             ensightCaseFile
-            <<  (
-                    "measured:     1     "
-                  + prepend
-                  + "****."
-                  + cloudIter.key()
-                ).c_str()
-            << nl;
+                << "GEOMETRY" << nl
+                << setw(16) << "model:"
+                << ensightMesh::geometryName << nl;
         }
 
-        // Create a new hash table for each cloud
-        allCloudFields.insert(cloudIter.key(), HashTable<word>());
-
-        // Identify the new cloud in the hash table
-        HashTable<HashTable<word>>::iterator newCloudIter =
-            allCloudFields.find(cloudIter.key());
 
-        // Loop over all times to build list of fields and field types
-        // for each cloud
-        forAll(Times, timeI)
+        // Add the name of the cloud(s) to the case file header
+        forAll(cloudNames, cloudNo)
         {
-            runTime.setTime(Times[timeI], timeI);
-
-            IOobjectList cloudObjs
-            (
-                mesh,
-                runTime.timeName(),
-                cloud::prefix/cloudIter.key()
-            );
-
-            forAllConstIter(IOobjectList, cloudObjs, fieldIter)
-            {
-                const IOobject obj = *fieldIter();
+            const word& cloudName = cloudNames[cloudNo];
 
-                if (obj.name() != "positions")
-                {
-                    // Add field and field type
-                    newCloudIter().insert
-                    (
-                        obj.name(),
-                        obj.headerClassName()
-                    );
-                }
-            }
+            ensightCaseFile
+                << setw(16) << "measured: 1"
+                << fileName
+                (
+                    dataMask/cloud::prefix/cloudName/"positions"
+                ).c_str() << nl;
         }
     }
 
+    Info<< "Startup in "
+        << timer.cpuTimeIncrement() << " s, "
+        << mem.update().size() << " kB" << nl << endl;
+
+    // ignore special fields (_0 fields),
+    // ignore fields we don't handle,
+    // ignore fields that are not available for all time-steps
+    HashTable<bool> fieldsToUse;
+
     label nTimeSteps = 0;
-    forAll(Times, timeIndex)
+    forAll(timeDirs, timeIndex)
     {
-        nTimeSteps++;
-        runTime.setTime(Times[timeIndex], timeIndex);
+        ++nTimeSteps;
+        runTime.setTime(timeDirs[timeIndex], timeIndex);
 
-        word timeName = itoa(timeIndex);
-        word timeFile = prepend + timeName;
+        Info<< "Time [" << timeIndex << "] = " << runTime.timeName() << nl;
 
-        Info<< "Translating time = " << runTime.timeName() << nl;
+        if (Pstream::master())
+        {
+            // the data/ITER subdirectory must exist
+            // Note that data/ITER is indeed a valid ensight::FileName
+            const fileName subDir = ensightFile::subDir(timeIndex);
+            mkDir(dataDir/subDir);
+
+            // place a timestamp in the directory for future reference
+            OFstream timeStamp(dataDir/subDir/"time");
+            timeStamp
+                << "#   timestep time" << nl
+                << subDir.c_str() << " " << runTime.timeName() << nl;
+        }
 
         polyMesh::readUpdateState meshState = mesh.readUpdate();
         if (timeIndex != 0 && meshSubsetter.hasSubMesh())
@@ -417,7 +426,6 @@ int main(int argc, char *argv[])
             meshSubsetter.setLargeCellSubset(c0, 0);
         }
 
-
         if (meshState != polyMesh::UNCHANGED)
         {
             eMesh.correct();
@@ -427,8 +435,7 @@ int main(int argc, char *argv[])
         {
             eMesh.write
             (
-                ensightDir,
-                prepend,
+                dataDir,
                 timeIndex,
                 meshMoving,
                 ensightCaseFile
@@ -447,8 +454,9 @@ int main(int argc, char *argv[])
 
         // Cell field data output
         // ~~~~~~~~~~~~~~~~~~~~~~
+        Info<< "Write volume field (";
 
-        for (label i=0; i<nVolFieldTypes; i++)
+        for (label i=0; i<nVolFieldTypes; ++i)
         {
             wordList fieldNames = objects.names(volFieldTypes[i]);
 
@@ -467,7 +475,7 @@ int main(int argc, char *argv[])
 
                 #include "checkData.H"
 
-                if (!variableGood)
+                if (!fieldsToUse[fieldName])
                 {
                     continue;
                 }
@@ -488,10 +496,8 @@ int main(int argc, char *argv[])
                     (
                         volField(meshSubsetter, vf),
                         eMesh,
-                        ensightDir,
-                        prepend,
+                        dataDir,
                         timeIndex,
-                        binary,
                         nodeValues,
                         ensightCaseFile
                     );
@@ -503,10 +509,8 @@ int main(int argc, char *argv[])
                     (
                         volField(meshSubsetter, vf),
                         eMesh,
-                        ensightDir,
-                        prepend,
+                        dataDir,
                         timeIndex,
-                        binary,
                         nodeValues,
                         ensightCaseFile
                     );
@@ -518,10 +522,8 @@ int main(int argc, char *argv[])
                     (
                         volField(meshSubsetter, vf),
                         eMesh,
-                        ensightDir,
-                        prepend,
+                        dataDir,
                         timeIndex,
-                        binary,
                         nodeValues,
                         ensightCaseFile
                     );
@@ -533,10 +535,8 @@ int main(int argc, char *argv[])
                     (
                         volField(meshSubsetter, vf),
                         eMesh,
-                        ensightDir,
-                        prepend,
+                        dataDir,
                         timeIndex,
-                        binary,
                         nodeValues,
                         ensightCaseFile
                     );
@@ -548,10 +548,8 @@ int main(int argc, char *argv[])
                     (
                         volField(meshSubsetter, vf),
                         eMesh,
-                        ensightDir,
-                        prepend,
+                        dataDir,
                         timeIndex,
-                        binary,
                         nodeValues,
                         ensightCaseFile
                     );
@@ -572,10 +570,8 @@ int main(int argc, char *argv[])
                     (
                         volField<scalar>(meshSubsetter, df),
                         eMesh,
-                        ensightDir,
-                        prepend,
+                        dataDir,
                         timeIndex,
-                        binary,
                         nodeValues,
                         ensightCaseFile
                     );
@@ -595,10 +591,8 @@ int main(int argc, char *argv[])
                     (
                         volField<vector>(meshSubsetter, df),
                         eMesh,
-                        ensightDir,
-                        prepend,
+                        dataDir,
                         timeIndex,
-                        binary,
                         nodeValues,
                         ensightCaseFile
                     );
@@ -618,10 +612,8 @@ int main(int argc, char *argv[])
                     (
                         volField<sphericalTensor>(meshSubsetter, df),
                         eMesh,
-                        ensightDir,
-                        prepend,
+                        dataDir,
                         timeIndex,
-                        binary,
                         nodeValues,
                         ensightCaseFile
                     );
@@ -641,10 +633,8 @@ int main(int argc, char *argv[])
                     (
                         volField<symmTensor>(meshSubsetter, df),
                         eMesh,
-                        ensightDir,
-                        prepend,
+                        dataDir,
                         timeIndex,
-                        binary,
                         nodeValues,
                         ensightCaseFile
                     );
@@ -664,24 +654,29 @@ int main(int argc, char *argv[])
                     (
                         volField<tensor>(meshSubsetter, df),
                         eMesh,
-                        ensightDir,
-                        prepend,
+                        dataDir,
                         timeIndex,
-                        binary,
                         nodeValues,
                         ensightCaseFile
                     );
                 }
+                else
+                {
+                    // Do not currently handle this type - blacklist for the future.
+                    fieldsToUse.set(fieldName, false);
+                }
             }
         }
+        Info<< " )" << nl;
 
 
         // Cloud field data output
         // ~~~~~~~~~~~~~~~~~~~~~~~
 
-        forAllConstIter(HashTable<HashTable<word>>, allCloudFields, cloudIter)
+        forAll(cloudNames, cloudNo)
         {
-            const word& cloudName = cloudIter.key();
+            const word& cloudName = cloudNames[cloudNo];
+            const HashTable<word>& theseCloudFields = cloudFields[cloudName];
 
             fileNameList currentCloudDirs = readDir
             (
@@ -689,17 +684,22 @@ int main(int argc, char *argv[])
                 fileName::DIRECTORY
             );
 
+            Info<< "Write " << cloudName << " (";
+
             bool cloudExists = inFileNameList(currentCloudDirs, cloudName);
+            reduce(cloudExists, orOp<bool>());
+
             ensightParticlePositions
             (
                 mesh,
-                ensightDir,
-                timeFile,
+                dataDir,
+                timeIndex,
                 cloudName,
-                cloudExists
+                cloudExists,
+                format
             );
 
-            forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
+            forAllConstIter(HashTable<word>, theseCloudFields, fieldIter)
             {
                 const word& fieldName = fieldIter.key();
                 const word& fieldType = fieldIter();
@@ -717,17 +717,20 @@ int main(int argc, char *argv[])
                 (
                     false
                 );
+                reduce(fieldExists, orOp<bool>());
+
                 if (fieldType == scalarIOField::typeName)
                 {
                     ensightCloudField<scalar>
                     (
                         fieldObject,
-                        ensightDir,
-                        prepend,
+                        dataDir,
                         timeIndex,
                         cloudName,
+                        cloudNo,
                         ensightCaseFile,
-                        fieldExists
+                        fieldExists,
+                        format
                     );
                 }
                 else if (fieldType == vectorIOField::typeName)
@@ -735,37 +738,34 @@ int main(int argc, char *argv[])
                     ensightCloudField<vector>
                     (
                         fieldObject,
-                        ensightDir,
-                        prepend,
+                        dataDir,
                         timeIndex,
                         cloudName,
+                        cloudNo,
                         ensightCaseFile,
-                        fieldExists
+                        fieldExists,
+                        format
                     );
                 }
-                else
-                {
-                    Info<< "Unable to convert field type " << fieldType
-                        << " for field " << fieldName << endl;
-                }
             }
+            Info<< " )" << nl;
         }
 
         Info<< "Wrote in "
             << timer.cpuTimeIncrement() << " s, "
-            << mem.update().size() << " kB" << endl;
+            << mem.update().size() << " kB" << nl << nl;
     }
 
     #include "ensightCaseTail.H"
 
-    if (Pstream::master())
+    if (ensightCaseFilePtr) // on master only
     {
         delete ensightCaseFilePtr;
     }
 
-    Info<< "\nEnd: "
+    Info<< "End: "
         << timer.elapsedCpuTime() << " s, "
-        << mem.update().peak() << " kB (peak)\n" << endl;
+        << mem.update().peak() << " kB (peak)" << nl << endl;
 
     return 0;
 }
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H
index d59f258d356a6103aa7200349290946a0d0a519e..15a4756949b36336a3f211896b70939341bf3a87 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H
@@ -2,18 +2,47 @@
 // - could restrict to the selected times
 
 bool hasMovingMesh = false;
-if (timeDirs.size() > 1)
+
+if (timeDirs.size() > 1 && Pstream::master())
 {
-    hasMovingMesh = true;
-    for (label i=0; i < timeDirs.size() && hasMovingMesh; ++i)
+    // We already loaded a mesh (usually from constant).
+    // See if any other "polyMesh/points" files exist too.
+
+    const fileName& baseDir = mesh.time().path();
+
+    Info<< "Search for moving mesh ... " << flush;
+    forAll(timeDirs, timeI)
     {
-        hasMovingMesh = IOobject
+        hasMovingMesh =
         (
-            "points",
-            timeDirs[i].name(),
-            polyMesh::meshSubDir,
-            mesh,
-            IOobject::NO_READ
-        ).typeHeaderOk<pointIOField>(true);
+            isDir(baseDir/timeDirs[timeI].name()/polyMesh::meshSubDir)
+         && IOobject
+            (
+                "points",
+                timeDirs[timeI].name(),
+                polyMesh::meshSubDir,
+                mesh,
+                IOobject::NO_READ,
+                IOobject::NO_WRITE,
+                false  // no register
+            ).typeHeaderOk<pointIOField>(true)
+        );
+
+        if (hasMovingMesh)
+        {
+            break;
+        }
+    }
+
+    if (hasMovingMesh)
+    {
+        Info<< "found." << nl
+            << "    Writing meshes for every timestep." << endl;
+    }
+    else
+    {
+        Info<< "none detected." << endl;
     }
 }
+
+reduce(hasMovingMesh, orOp<bool>());
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputCase.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputCase.H
index 83bae0f842363da1d144539f21bbd1ec73a473e1..b0c3af822bbffb892c76a7be0241f086bd4f219e 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputCase.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputCase.H
@@ -58,35 +58,36 @@ forAllConstIter(HashTable<word>, volumeFields, fieldIter)
 
     if (fieldType == volScalarField::typeName)
     {
-        ensightType = "scalar";
+        ensightType = ensightPTraits<scalar>::typeName;
     }
     else if (fieldType == volVectorField::typeName)
     {
-        ensightType = "vector";
+        ensightType = ensightPTraits<vector>::typeName;
     }
     else if (fieldType == volSphericalTensorField::typeName)
     {
-        ensightType = "tensor symm";
+        ensightType = ensightPTraits<sphericalTensor>::typeName;
     }
     else if (fieldType == volSymmTensorField::typeName)
     {
-        ensightType = "tensor symm";
+        ensightType = ensightPTraits<symmTensor>::typeName;
     }
     else if (fieldType == volTensorField::typeName)
     {
-        ensightType = "tensor asym";
+        ensightType = ensightPTraits<tensor>::typeName;
     }
-
-    if (ensightType.size())
+    else
     {
-        ensightCaseEntry
-        (
-            caseFile,
-            ensightType,
-            fieldName,
-            dataMask
-        );
+        continue;
     }
+
+    ensightCaseEntry
+    (
+        caseFile,
+        ensightType,
+        fieldName,
+        dataMask
+    );
 }
 
 
@@ -104,30 +105,31 @@ forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
 
         if (fieldType == scalarIOField::typeName)
         {
-            ensightType = "scalar";
+            ensightType = ensightPTraits<scalar>::typeName;
         }
         else if (fieldType == vectorIOField::typeName)
         {
-            ensightType = "vector";
+            ensightType = ensightPTraits<vector>::typeName;
         }
         else if (fieldType == tensorIOField::typeName)
         {
-            ensightType = "tensor";
+            ensightType = ensightPTraits<tensor>::typeName;
         }
-
-        if (ensightType.size())
+        else
         {
-            ensightCaseEntry
-            (
-                caseFile,
-                ensightType,
-                fieldName,
-                dataMask,
-                cloud::prefix/cloudName,
-                cloudNo,
-                2
-            );
+            continue;
         }
+
+        ensightCaseEntry
+        (
+            caseFile,
+            ensightType,
+            fieldName,
+            dataMask,
+            cloud::prefix/cloudName,
+            cloudNo,
+            2
+        );
     }
     cloudNo++;
 }
@@ -162,7 +164,7 @@ if (fieldTimesUsed.size())
     count = 0;
     forAll(fieldTimesUsed, i)
     {
-        const label& index = fieldTimesUsed[i];
+        const label index = fieldTimesUsed[i];
         caseFile
             << " " << setw(12) << timeIndices[index] + timeCorrection;
 
@@ -203,7 +205,7 @@ if (geometryTimesUsed.size())
     count = 0;
     forAll(geometryTimesUsed, i)
     {
-        const label& index = geometryTimesUsed[i];
+        const label index = geometryTimesUsed[i];
         caseFile
             << " " << setw(12) << timeIndices[index] + timeCorrection;
 
@@ -249,7 +251,7 @@ forAllConstIter(HashTable<DynamicList<label>>, cloudTimesUsed, cloudIter)
         count = 0;
         forAll(timesUsed, i)
         {
-            const label& index = timesUsed[i];
+            const label index = timesUsed[i];
             caseFile
                 << " " << setw(12) << timeIndices[index] + timeCorrection;
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C
index 2c92bee9cc43b47aa3c0c017ed378fa37d996d2e..148aa4014532744730f5f2c5e279c8f4609f3c51 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C
@@ -24,6 +24,7 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "ensightOutputFunctions.H"
+#include "ensightPTraits.H"
 
 #include "passiveParticle.H"
 #include "IOField.H"
@@ -171,11 +172,8 @@ void Foam::ensightLagrangianField
     // when writing positions
 
     ensightFile os(dataDir, postFileName, format);
-    os.write
-    (
-        // description
-        string(postFileName + " with " + pTraits<Type>::typeName + " values")
-    );
+    // description
+    os.write(string(postFileName + " <" + pTraits<Type>::typeName + ">"));
     os.newline();
 
     IOField<Type> field(fieldObject);
@@ -187,21 +185,20 @@ void Foam::ensightLagrangianField
     {
         Type val = field[i];
 
-        if (mag(val) < 1.0e-90)
+        if (mag(val) < 1e-90)
         {
             val = Zero;
         }
 
-        for (direction cmpt=0; cmpt < pTraits<Type>::nComponents; cmpt++)
+        for (direction d=0; d < pTraits<Type>::nComponents; ++d)
         {
-            os.write( component(val, cmpt) );
-        }
+            label cmpt = ensightPTraits<Type>::componentOrder[d];
+            os.write(component(val, cmpt));
 
-        count += pTraits<Type>::nComponents;
-
-        if (count % 6 == 0)
-        {
-            os.newline();
+            if (++count % 6 == 0)
+            {
+                os.newline();
+            }
         }
     }
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H
index 077490f1ecdaaa2116db06ced0bf4823aa0e4ec8..721ba05101adb48013b947fc89fb5fb52e2e4e2f 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H
@@ -8,7 +8,10 @@ HashTable<HashTable<word>> cloudFields;
 
 if (timeDirs.size())
 {
-    IOobjectList objs(mesh, timeDirs.last().name());
+    const fileName& cloudPrefix = regionPrefix/cloud::prefix;
+    const word& lastTimeName = timeDirs.last().name();
+
+    IOobjectList objs(mesh, lastTimeName);
 
     forAllConstIter(IOobjectList, objs, fieldIter)
     {
@@ -31,14 +34,17 @@ if (timeDirs.size())
     //
     // now check for lagrangian/<cloudName>
     //
-    fileNameList cloudDirs = readDir
-    (
-        runTime.path()
-      / timeDirs.last().name()
-      / regionPrefix
-      / cloud::prefix,
-        fileName::DIRECTORY
-    );
+    fileNameList cloudDirs;
+    if (!noLagrangian)
+    {
+        cloudDirs = readDir
+        (
+            runTime.path()
+          / lastTimeName
+          / cloudPrefix,
+            fileName::DIRECTORY
+        );
+    }
 
     forAll(cloudDirs, cloudI)
     {
@@ -54,8 +60,8 @@ if (timeDirs.size())
         IOobjectList objs
         (
             mesh,
-            timeDirs.last().name(),
-            cloud::prefix/cloudName
+            lastTimeName,
+            cloudPrefix/cloudName
         );
 
         bool hasPositions = false;
@@ -89,17 +95,27 @@ if (timeDirs.size())
     //
     for (label i=0; volumeFields.size() && i < timeDirs.size(); ++i)
     {
-        IOobjectList objs(mesh, timeDirs[i].name());
+        const word& timeName = timeDirs[i].name();
 
-        forAllIter(HashTable<word>, volumeFields, fieldIter)
-        {
-            const word& fieldName = fieldIter.key();
+        // Everything is potentially missing, unless we discover otherwise
+        wordHashSet missing(volumeFields);
 
-            if (!objs.found(fieldName))
-            {
-                volumeFields.erase(fieldIter);
-            }
+        // Avoid  -->>  IOobjectList objs(mesh, timeName);  <<--
+        // Too much overhead when done so frequently.
+
+        fileNameList contents = readDir
+        (
+            runTime.path()
+          / timeName,
+            fileName::FILE
+        );
+
+        forAll(contents, fileI)
+        {
+            missing.erase(contents[fileI].name());
         }
+
+        volumeFields.erase(missing);
     }
 }
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C
index ff67c2758d93162dd6fa780525f97f491617abb7..294410bb7b8a656448a36e8771fb744479ff2c49 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C
@@ -24,6 +24,9 @@ License
 Application
     foamToEnsightParts
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Translates OpenFOAM data to Ensight format.
     An Ensight part is created for each cellZone and patch.
@@ -41,6 +44,9 @@ Usage
     \param -noZero \n
     Exclude the often incomplete initial conditions.
 
+    \param -noLagrangian \n
+    Suppress writing lagrangian positions and fields.
+
     \param -index \<start\>\n
     Ignore the time index contained in the time file and use a
     simple indexing when creating the \c Ensight/data/######## files.
@@ -98,6 +104,11 @@ int main(int argc, char *argv[])
         "and use simple indexing when creating the files"
     );
     argList::addBoolOption
+    (
+        "noLagrangian",
+        "suppress writing lagrangian positions and fields"
+    );
+    argList::addBoolOption
     (
         "noMesh",
         "suppress writing the geometry. "
@@ -146,15 +157,17 @@ int main(int argc, char *argv[])
     instantList timeDirs = timeSelector::select0(runTime, args);
 
     // default to binary output, unless otherwise specified
-    IOstream::streamFormat format = IOstream::BINARY;
-    if (args.optionFound("ascii"))
-    {
-        format = IOstream::ASCII;
-    }
+    const IOstream::streamFormat format =
+    (
+        args.optionFound("ascii")
+      ? IOstream::ASCII
+      : IOstream::BINARY
+    );
 
     // control for renumbering iterations
     label indexingNumber = 0;
-    bool optIndex = args.optionReadIfPresent("index", indexingNumber);
+    const bool optIndex = args.optionReadIfPresent("index", indexingNumber);
+    const bool noLagrangian = args.optionFound("noLagrangian");
 
     // always write the geometry, unless the -noMesh option is specified
     bool optNoMesh = args.optionFound("noMesh");
@@ -201,6 +214,11 @@ int main(int argc, char *argv[])
         regionPrefix = regionName;
     }
 
+    if (Pstream::master())
+    {
+        Info<< "Converting " << timeDirs.size() << " time steps" << endl;
+    }
+
     // Construct the list of ensight parts for the entire mesh
     ensightParts partsList(mesh);
 
@@ -241,6 +259,9 @@ int main(int argc, char *argv[])
         cloudTimesUsed.insert(cloudIter.key(), DynamicList<label>());
     }
 
+    Info<< "Startup in "
+        << timer.cpuTimeIncrement() << " s, "
+        << mem.update().size() << " kB" << nl << endl;
 
     forAll(timeDirs, timeI)
     {
@@ -291,7 +312,7 @@ int main(int argc, char *argv[])
             }
         }
 
-        Info<< "write volume field (" << flush;
+        Info<< "Write volume field (" << flush;
 
         forAllConstIter(HashTable<word>, volumeFields, fieldIter)
         {
@@ -377,15 +398,9 @@ int main(int argc, char *argv[])
         forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
         {
             const word& cloudName = cloudIter.key();
+            const fileName& cloudPrefix = regionPrefix/cloud::prefix;
 
-            if
-            (
-                !isDir
-                (
-                    runTime.timePath()/regionPrefix/
-                    cloud::prefix/cloudName
-                )
-            )
+            if (!isDir(runTime.timePath()/cloudPrefix/cloudName))
             {
                 continue;
             }
@@ -394,28 +409,25 @@ int main(int argc, char *argv[])
             (
                 mesh,
                 runTime.timeName(),
-                cloud::prefix/cloudName
+                cloudPrefix/cloudName
             );
 
             // check that the positions field is present for this time
-            IOobject* positionPtr = cloudObjs.lookup(word("positions"));
-            if (positionPtr != NULL)
-            {
-                ensightParticlePositions
-                (
-                    mesh,
-                    dataDir,
-                    subDir,
-                    cloudName,
-                    format
-                );
-            }
-            else
+            if (!cloudObjs.found("positions"))
             {
                 continue;
             }
 
-            Info<< "write " << cloudName << " (" << flush;
+            Info<< "Write " << cloudName << " ( positions" << flush;
+
+            ensightParticlePositions
+            (
+                mesh,
+                dataDir,
+                subDir,
+                cloudName,
+                format
+            );
 
             forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
             {
@@ -427,7 +439,7 @@ int main(int argc, char *argv[])
                 if (!fieldObject)
                 {
                     Info<< "missing "
-                        << runTime.timeName()/cloud::prefix/cloudName
+                        << runTime.timeName()/cloudPrefix/cloudName
                         / fieldName
                         << endl;
                     continue;
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H
index 2b253640999bbe0beac0fb43644a12dd4d2918d3..9d8e93dcd145b3c37eca3ed4aa16b06646d3dce3 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H
@@ -39,5 +39,5 @@
     }
 
     timeIndices.insert(timeIndex, timeDirs[timeI].value());
-    Info<< "\nTime [" << timeIndex << "] = " << runTime.timeName() << nl;
+    Info<< nl << "Time [" << timeIndex << "] = " << runTime.timeName() << nl;
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.C b/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.C
index 9014f10ffd8eb0d13b12f6080ac6f779bb209dd0..7c74c7e20383be892a402c482a37fc5366e1ec5c 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.C
@@ -24,6 +24,9 @@ License
 Application
     foamToGMV
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Translates foam output to GMV readable files.
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C
index 3cf58fde370a52fe208bb09f695502536fe6982e..b834cca26a66f01df1d951bbee40c0a897601848 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C
@@ -24,6 +24,9 @@ License
 Application
     foamToTecplot360
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Tecplot binary file format writer.
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C b/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C
index 6e50d704717fb450f1872c89352f17e352d600e1..786a137a7dd6bd88d174c1b003f04e7c5316fade 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C
@@ -24,6 +24,9 @@ License
 Application
     foamToTetDualMesh
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Converts polyMesh results to tetDualMesh.
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/findClouds.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/findClouds.H
new file mode 100644
index 0000000000000000000000000000000000000000..5637f22498178629899f549496af145f5811f099
--- /dev/null
+++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/findClouds.H
@@ -0,0 +1,71 @@
+// check all time directories for the following:
+
+// Any cloud names:
+HashSet<fileName> allCloudDirs;
+
+if (timeDirs.size() && !noLagrangian)
+{
+    const fileName& baseDir = mesh.time().path();
+    const fileName& cloudPrefix = regionPrefix/cloud::prefix;
+
+    Info<< "Searching for lagrangian ... " << flush;
+
+    forAll(timeDirs, timeI)
+    {
+        const word& timeName = timeDirs[timeI].name();
+
+        // DO NOT USE -->>  runTime.setTime(timeDirs[timeI], timeI);  <<--
+        // It incurs a large overhead when done so frequently.
+
+        fileNameList cloudDirs = readDir
+        (
+            baseDir/timeName/cloudPrefix,
+            fileName::DIRECTORY
+        );
+
+        forAll(cloudDirs, cloudI)
+        {
+            const word& cloudName = cloudDirs[cloudI];
+
+            IOobjectList cloudObjs
+            (
+                mesh,
+                timeName,
+                cloudPrefix/cloudName
+            );
+
+            // clouds always require "positions"
+            if (cloudObjs.found("positions"))
+            {
+                if (allCloudDirs.insert(cloudName))
+                {
+                    Info<< "At time: " << timeName
+                        << " detected cloud directory : " << cloudName
+                        << endl;
+                }
+            }
+        }
+    }
+
+    if (allCloudDirs.empty())
+    {
+        Info<< "none detected." << endl;
+    }
+}
+
+// sorted list of cloud names
+const fileNameList cloudNames(allCloudDirs.sortedToc());
+
+if (cloudNames.size())
+{
+    // complete the echo information
+    Info<< "(";
+    forAll(cloudNames, cloudNo)
+    {
+        Info<< ' ' << cloudNames[cloudNo];
+    }
+    Info<< " ) " << endl;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
index fa46eeb5cebc85edf3bdcff1f9707aaa417e39be..da66613c0cc16a1ec3ae37a561b5b3c722c6aca8 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -24,6 +24,9 @@ License
 Application
     foamToVTK
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Legacy VTK file format writer.
 
@@ -68,6 +71,9 @@ Usage
     \param -noInternal \n
     Do not generate file for mesh, only for patches
 
+    \param -noLagrangian \n
+    Suppress writing lagrangian positions and fields.
+
     \param -noPointValues \n
     No pointFields
 
@@ -287,6 +293,12 @@ int main(int argc, char *argv[])
         "noInternal",
         "do not generate file for mesh, only for patches"
     );
+    argList::addBoolOption
+    (
+        "noLagrangian",
+        "suppress writing lagrangian positions and fields"
+    );
+
     argList::addBoolOption
     (
         "noPointValues",
@@ -333,6 +345,7 @@ int main(int argc, char *argv[])
     const bool doLinks         = !args.optionFound("noLinks");
     bool binary                = !args.optionFound("ascii");
     const bool useTimeName     = args.optionFound("useTimeName");
+    const bool noLagrangian    = args.optionFound("noLagrangian");
 
     // Decomposition of polyhedral cells into tets/pyramids cells
     vtkTopo::decomposePoly     = !args.optionFound("poly");
@@ -403,9 +416,9 @@ int main(int argc, char *argv[])
 
     // VTK/ directory in the case
     fileName fvPath(runTime.path()/"VTK");
-    // Directory of mesh (region0 gets filtered out)
-    fileName regionPrefix = "";
 
+    // Directory of mesh (region0 gets filtered out)
+    fileName regionPrefix;
     if (regionName != polyMesh::defaultRegion)
     {
         fvPath = fvPath/regionName;
@@ -443,43 +456,7 @@ int main(int argc, char *argv[])
         << timer.cpuTimeIncrement() << " s, "
         << mem.update().size() << " kB" << endl;
 
-
-    // Scan for all possible lagrangian clouds
-    HashSet<fileName> allCloudDirs;
-    forAll(timeDirs, timeI)
-    {
-        runTime.setTime(timeDirs[timeI], timeI);
-        fileNameList cloudDirs
-        (
-            readDir
-            (
-                runTime.timePath()/regionPrefix/cloud::prefix,
-                fileName::DIRECTORY
-            )
-        );
-        forAll(cloudDirs, i)
-        {
-            IOobjectList sprayObjs
-            (
-                mesh,
-                runTime.timeName(),
-                cloud::prefix/cloudDirs[i]
-            );
-
-            IOobject* positionsPtr = sprayObjs.lookup(word("positions"));
-
-            if (positionsPtr)
-            {
-                if (allCloudDirs.insert(cloudDirs[i]))
-                {
-                    Info<< "At time: " << runTime.timeName()
-                        << " detected cloud directory : " << cloudDirs[i]
-                        << endl;
-                }
-            }
-        }
-    }
-
+    #include "findClouds.H"
 
     forAll(timeDirs, timeI)
     {
@@ -487,7 +464,7 @@ int main(int argc, char *argv[])
 
         Info<< "Time: " << runTime.timeName() << endl;
 
-        word timeDesc =
+        const word timeDesc =
             useTimeName ? runTime.timeName() : Foam::name(runTime.timeIndex());
 
         // Check for new polyMesh/ and update mesh, fvMeshSubset and cell
@@ -659,7 +636,7 @@ int main(int argc, char *argv[])
               + dtf.size();
 
 
-        // Construct pointMesh only if nessecary since constructs edge
+        // Construct pointMesh only if necessary since constructs edge
         // addressing (expensive on polyhedral meshes)
         if (noPointValues)
         {
@@ -1146,9 +1123,9 @@ int main(int argc, char *argv[])
         //
         //---------------------------------------------------------------------
 
-        forAllConstIter(HashSet<fileName>, allCloudDirs, iter)
+        forAll(cloudNames, cloudNo)
         {
-            const fileName& cloudName = iter.key();
+            const fileName& cloudName = cloudNames[cloudNo];
 
             // Always create the cloud directory.
             mkDir(fvPath/cloud::prefix/cloudName);
@@ -1169,9 +1146,7 @@ int main(int argc, char *argv[])
                 cloud::prefix/cloudName
             );
 
-            IOobject* positionsPtr = sprayObjs.lookup(word("positions"));
-
-            if (positionsPtr)
+            if (sprayObjs.found("positions"))
             {
                 wordList labelNames(sprayObjs.names(labelIOField::typeName));
                 Info<< "        labels            :";
@@ -1306,7 +1281,7 @@ int main(int argc, char *argv[])
                       + "_"
                       + procFile.name()
                     );
-                    if (system(cmd.c_str()) == -1)
+                    if (Foam::system(cmd.c_str()) == -1)
                     {
                         WarningInFunction
                             << "Could not execute command " << cmd << endl;
diff --git a/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C b/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C
index 2b186d88bad3ed8bf8be72c3ed36ca491054ac61..5cceb026f451d1e064f21d782267f41c801552c3 100644
--- a/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C
+++ b/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C
@@ -24,6 +24,9 @@ License
 Application
     smapToFoam
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Translates a STAR-CD SMAP data file into OpenFOAM field format.
 
diff --git a/applications/utilities/postProcessing/foamCalc/foamCalcApp.C b/applications/utilities/postProcessing/foamCalc/foamCalcApp.C
index 0a24afc13181e787242f6979247a7ddd4d9c919e..ecdb57f1cf5af039606891d2b44671bffad9b055 100644
--- a/applications/utilities/postProcessing/foamCalc/foamCalcApp.C
+++ b/applications/utilities/postProcessing/foamCalc/foamCalcApp.C
@@ -24,6 +24,9 @@ License
 Application
     foamCalc
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Generic wrapper for calculating a quantity at each time.
 
diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake b/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake
index b34e11bf4b66bf5c601e174dd18c639ba4017328..9d0fcb58615a368ab594ca2539239d10117b5c40 100755
--- a/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake
+++ b/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake
@@ -47,7 +47,8 @@ case "$ParaView_VERSION" in
     if canBuildPlugin
     then
     (
-        # C++ compiler for CMake
+        # ensure CMake gets the correct C/C++ compilers
+        [ -n "$WM_CC" ]  && export CC="$WM_CC"
         [ -n "$WM_CXX" ] && export CXX="$WM_CXX"
 
         wmake $targetType vtkPV3Readers
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/Allwmake b/applications/utilities/postProcessing/graphics/PVReaders/Allwmake
index 76a3697c6cd841f7fce70e4f2cfa9c8cd9b879e9..d678a785ff20157c5c335d27bd0371aab552c081 100755
--- a/applications/utilities/postProcessing/graphics/PVReaders/Allwmake
+++ b/applications/utilities/postProcessing/graphics/PVReaders/Allwmake
@@ -47,7 +47,8 @@ case "$ParaView_VERSION" in
     if canBuildPlugin
     then
     (
-        # C++ compiler for CMake
+        # ensure CMake gets the correct C/C++ compilers
+        [ -n "$WM_CC" ]  && export CC="$WM_CC"
         [ -n "$WM_CXX" ] && export CXX="$WM_CXX"
 
         wmake $targetType vtkPVReaders
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/Allwmake b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/Allwmake
index 313fdd2410e505cc1169e735199ff4a6d9725ffd..6304c4545f985f39a5c69f4cc4884c13463db169 100755
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/Allwmake
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/Allwmake
@@ -8,7 +8,8 @@ targetType=libso
 # Source the wmake functions
 . $WM_DIR/scripts/wmakeFunctions
 
-# C++ compiler for CMake
+# ensure CMake gets the correct C/C++ compilers
+[ -n "$WM_CC" ]  && export CC="$WM_CC"
 [ -n "$WM_CXX" ] && export CXX="$WM_CXX"
 
 set -x
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/CMakeLists.txt
index fbaedcfb30a1122f68f888090b6ac8c66d513417..2761e18f4329a5212bcef25394d43c2dadcd6e71 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/CMakeLists.txt
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/CMakeLists.txt
@@ -47,11 +47,14 @@ QT4_WRAP_CPP(MOC_SRCS pqPVFoamReaderPanel.h)
 
 ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
   CLASS_NAME pqPVFoamReaderPanel
-  XML_NAME  PVFoamReader  # name of SourceProxy in *SM.xml
+  XML_NAME  PVFoamReader                # name of SourceProxy in *SM.xml
   XML_GROUP sources
 )
 
-IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
+# Separate GUI_RESOURCE_FILES deprecated with paraview 4.3
+# so check if version < 4.4
+
+IF(("${PARAVIEW_VERSION_MAJOR}" LESS 5) AND ("${PARAVIEW_VERSION_MINOR}" LESS 4))
     ADD_PARAVIEW_PLUGIN(
         PVFoamReader_SM "1.0"
         SERVER_MANAGER_XML PVFoamReader_SM.xml
@@ -61,7 +64,7 @@ IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
             ${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
         GUI_RESOURCE_FILES PVFoamReader.xml
     )
-ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
+ELSE()
     ADD_PARAVIEW_PLUGIN(
         PVFoamReader_SM "1.0"
         SERVER_MANAGER_XML PVFoamReader_SM.xml
@@ -70,7 +73,7 @@ ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
         GUI_SOURCES pqPVFoamReaderPanel.cxx
             ${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
     )
-ENDIF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
+ENDIF()
 
 TARGET_LINK_LIBRARIES(
     PVFoamReader_SM
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/PVFoamReader.xml b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/PVFoamReader.xml
index aef46449b349bae63421e3177a6287a041c24a40..5507293c67bd74b9dbe0363ce396797a3ea4fc6a 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/PVFoamReader.xml
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/PVFoamReader.xml
@@ -1,4 +1,5 @@
 <ParaViewReaders>
+  <!-- deprecated with paraview-4.3, use hints in *SM.xml -->
   <Reader name="PVFoamReader"
           extensions="OpenFOAM"
           file_description="OpenFOAM Reader">
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/Make/options b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/Make/options
index a78b301d97e675bbe65bedacec923e44d47735d4..a2bd6aa18d8d16b41bdec584a4a24697d389d0a1 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/Make/options
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/Make/options
@@ -1,18 +1,12 @@
-/* Note: enable vtkPolyhedron when available */
-
 EXE_INC = \
     -I$(LIB_SRC)/meshTools/lnInclude \
     -I$(LIB_SRC)/finiteVolume/lnInclude \
     -I$(LIB_SRC)/dynamicMesh/lnInclude \
     -I$(LIB_SRC)/lagrangian/basic/lnInclude \
-    -I../../vtkPVReaders/lnInclude \
-    -I../PVFoamReader \
     -I$(ParaView_INCLUDE_DIR) \
     -I$(ParaView_INCLUDE_DIR)/vtkkwiml \
-    $(shell \
-        test -f $(ParaView_INCLUDE_DIR)/vtkPolyhedron.h && \
-        echo "-DHAS_VTK_POLYHEDRON" || echo "-UHAS_VTK_POLYHEDRON" \
-    )
+    -I../../vtkPVReaders/lnInclude \
+    -I../PVFoamReader
 
 LIB_LIBS = \
     -lmeshTools \
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/vtkPVFoamMeshVolume.C b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/vtkPVFoamMeshVolume.C
index c4a52dbc98bc3fbd7dd9a2c13b84e3ff6bdda557..1d7b732339a403196540eb829c6f1a0190bf16d1 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/vtkPVFoamMeshVolume.C
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/vtkPVFoam/vtkPVFoamMeshVolume.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -275,7 +275,6 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
             // Polyhedral cell - use VTK_POLYHEDRON
             const labelList& cFaces = mesh.cells()[cellI];
 
-#ifdef HAS_VTK_POLYHEDRON
             vtkIdType nFaces = cFaces.size();
             vtkIdType nLabels = nFaces;
 
@@ -320,33 +319,6 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
             }
 
             vtkmesh->InsertNextCell(VTK_POLYHEDRON, nFaces, faceStream.data());
-#else
-            // this is a horrible substitute
-            // but avoids crashes when there is no vtkPolyhedron support
-
-            // establish unique node ids used
-            HashSet<vtkIdType, Hash<label>> hashUniqId(2*256);
-
-            forAll(cFaces, cFaceI)
-            {
-                const face& f = mesh.faces()[cFaces[cFaceI]];
-
-                forAll(f, fp)
-                {
-                    hashUniqId.insert(f[fp]);
-                }
-            }
-
-            // use face stream to store unique node ids:
-            faceStream = hashUniqId.sortedToc();
-
-            vtkmesh->InsertNextCell
-            (
-                VTK_CONVEX_POINT_SET,
-                vtkIdType(faceStream.size()),
-                faceStream.data()
-            );
-#endif
         }
         else
         {
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/Allwmake b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/Allwmake
index 76297f13a2865b421cfa64c5af324c6462b69286..29b4aa8c5b6441259f685053c738c7f3238fb786 100755
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/Allwmake
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/Allwmake
@@ -8,7 +8,8 @@ targetType=libso
 # Source the wmake functions
 . $WM_DIR/scripts/wmakeFunctions
 
-# C++ compiler for CMake
+# ensure CMake gets the correct C/C++ compilers
+[ -n "$WM_CC" ]  && export CC="$WM_CC"
 [ -n "$WM_CXX" ] && export CXX="$WM_CXX"
 
 set -x
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/CMakeLists.txt
index 2b28dafd1ae7b7388d20a1b4a93f8ada1566ea5d..78832c57599b4c350bea4daf02a65aea2cdbc559 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/CMakeLists.txt
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/CMakeLists.txt
@@ -46,13 +46,16 @@ QT4_WRAP_CPP(MOC_SRCS pqPVblockMeshReaderPanel.h)
 
 ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
   CLASS_NAME pqPVblockMeshReaderPanel
-  XML_NAME  PVblockMeshReader # name of SourceProxy in *SM.xml
+  XML_NAME  PVblockMeshReader           # name of SourceProxy in *SM.xml
   XML_GROUP sources
 )
 
-IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
-        ADD_PARAVIEW_PLUGIN(
-            PVblockMeshReader_SM "1.0"
+# Separate GUI_RESOURCE_FILES deprecated with paraview 4.3
+# so check if version < 4.4
+
+IF(("${PARAVIEW_VERSION_MAJOR}" LESS 5) AND ("${PARAVIEW_VERSION_MINOR}" LESS 4))
+    ADD_PARAVIEW_PLUGIN(
+        PVblockMeshReader_SM "1.0"
         SERVER_MANAGER_XML PVblockMeshReader_SM.xml
         SERVER_MANAGER_SOURCES  vtkPVblockMeshReader.cxx
         GUI_INTERFACES ${IFACES}
@@ -60,16 +63,16 @@ IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
             ${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
         GUI_RESOURCE_FILES PVblockMeshReader.xml
     )
-ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
-        ADD_PARAVIEW_PLUGIN(
-            PVblockMeshReader_SM "1.0"
+ELSE()
+    ADD_PARAVIEW_PLUGIN(
+        PVblockMeshReader_SM "1.0"
         SERVER_MANAGER_XML PVblockMeshReader_SM.xml
         SERVER_MANAGER_SOURCES  vtkPVblockMeshReader.cxx
         GUI_INTERFACES ${IFACES}
         GUI_SOURCES pqPVblockMeshReaderPanel.cxx
             ${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
     )
-ENDIF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
+ENDIF()
 
 # Build the client-side plugin
 
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader.xml b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader.xml
index 18413ee30078159f21ba6ecf801861b251f67f59..9354a13525226607a3785092249488fa1f5f2839 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader.xml
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader.xml
@@ -1,4 +1,5 @@
 <ParaViewReaders>
+  <!-- deprecated with paraview-4.3, use hints in *SM.xml -->
   <Reader name="PVblockMeshReader"
       extensions="blockMesh"
       file_description="OpenFOAM blockMesh reader">
diff --git a/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C b/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C
index d6dbcb41e45b6e070945e7e8b59bb09952c51ae4..3a570236a6a47148a7a630b827eb10833fd7a35b 100644
--- a/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C
+++ b/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C
@@ -24,6 +24,9 @@ License
 Application
     particleTracks
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Generates a VTK file of particle tracks for cases that were computed using
     a tracked-parcel-type cloud.
diff --git a/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.C b/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.C
index 11f6bd116e6bca451cff09b3b12426709afc92c4..c306ed14aee5ef75263a69e1e4b54d4b50e11dd9 100644
--- a/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.C
+++ b/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.C
@@ -24,6 +24,10 @@ License
 Application
     steadyParticleTracks
 
+Group
+    grpPostProcessingUtilitie
+
+
 Description
     Generates a VTK file of particle tracks for cases that were computed using
     a steady-state cloud
diff --git a/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C b/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C
index 5abf6253fe1166d608ef53ca47c5685ab2837120..c634412aa2428acf7c6250a2290378af56f14e69 100644
--- a/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C
+++ b/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C
@@ -24,6 +24,9 @@ License
 Application
     dsmcFieldsCalc
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculate intensive fields (U and T) from averaged extensive fields from a
     DSMC calculation.
diff --git a/applications/utilities/postProcessing/miscellaneous/engineCompRatio/engineCompRatio.C b/applications/utilities/postProcessing/miscellaneous/engineCompRatio/engineCompRatio.C
index 42904e4c68157c6e792e54fdbb33ff12568aecf8..f5d2261bc548eb7f957d88fab4b79ee3886e4296 100644
--- a/applications/utilities/postProcessing/miscellaneous/engineCompRatio/engineCompRatio.C
+++ b/applications/utilities/postProcessing/miscellaneous/engineCompRatio/engineCompRatio.C
@@ -24,6 +24,9 @@ License
 Application
     engineCompRatio
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculate the geometric compression ratio.
 
@@ -83,7 +86,7 @@ int main(int argc, char *argv[])
     Info<< "\nVmax = " << Vmax
         << ", Vmin = " << Vmin << nl
         << "Vmax/Vmin = " << Vmax/Vmin << endl;
-    
+
     Info<< "\nEnd\n" << endl;
 
     return 0;
diff --git a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C
index 2baabfa33139cdec69d79c687c69dc6a48a84587..b0c422cc65d867ec5cd7a503afe65c4a73fb17ba 100644
--- a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C
+++ b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C
@@ -24,6 +24,9 @@ License
 Application
     execFlowFunctionObjects
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Execute the set of functionObjects specified in the selected dictionary
     (which defaults to system/controlDict) for the selected set of times.
diff --git a/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C b/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C
index 88be47e53dfd9a44652a168ccfbdaa6df16c0ead..3e20143e1b396319e17e91d3f2950411eb64b90c 100644
--- a/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C
+++ b/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -24,8 +24,13 @@ License
 Application
     foamListTimes
 
+Group
+    grpPostProcessingUtilities
+
 Description
     List times using timeSelector.
+    To simplify parsing of the output, the normal banner information
+    is suppressed.
 
 Usage
 
diff --git a/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfPlot.C b/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfPlot.C
index ea9f4f03bb306fc31440b8b5c7baa5b320597855..57bcfa95108979db8f8a197999bc23e065e7812f 100644
--- a/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfPlot.C
+++ b/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfPlot.C
@@ -24,6 +24,9 @@ License
 Application
     pdfPlot
 
+Group
+    grpPostProcessingUtilitie
+
 Description
     Generates a graph of a probability distribution function.
 
diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C b/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C
index 93373ee6a973896dc474551c20a24b5a81ee49f3..7533203900ed0ef516c0d3e9f5bba117204af423 100644
--- a/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C
+++ b/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C
@@ -24,6 +24,9 @@ License
 Application
     postChannel
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Post-processes data from channel flow calculations.
 
diff --git a/applications/utilities/postProcessing/miscellaneous/ptot/ptot.C b/applications/utilities/postProcessing/miscellaneous/ptot/ptot.C
index 0f47e54d6af9ea87f4fcabf7604fd6e63fc682a1..59f8c66ea4e5b1c05b76f2404252cd8eb1bc61a8 100644
--- a/applications/utilities/postProcessing/miscellaneous/ptot/ptot.C
+++ b/applications/utilities/postProcessing/miscellaneous/ptot/ptot.C
@@ -24,6 +24,9 @@ License
 Application
     ptot
 
+Group
+    grpPostProcessingUtilities
+
 Description
     For each time: calculate the total pressure.
 
diff --git a/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C b/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C
index ea8fc4975dc544857a0bacb40a521bb1ca6deb98..37638d2c9fc748fccad6d9841cba8da7fb0e6cef 100644
--- a/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C
+++ b/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C
@@ -21,6 +21,12 @@ License
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
+Application
+    temporalInterpolate
+
+Group
+    grpPostProcessingUtilities
+
 Description
     Interpolate fields between time-steps e.g. for animation.
 
diff --git a/applications/utilities/postProcessing/miscellaneous/wdot/wdot.C b/applications/utilities/postProcessing/miscellaneous/wdot/wdot.C
index 873bb53a72ce1cdb2fe5710de453e94da21e0d12..121c88aea5dedb9269b5f16658ffbd3c0e9fcb81 100644
--- a/applications/utilities/postProcessing/miscellaneous/wdot/wdot.C
+++ b/applications/utilities/postProcessing/miscellaneous/wdot/wdot.C
@@ -24,6 +24,9 @@ License
 Application
     wdot
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and writes wdot for each time.
 
diff --git a/applications/utilities/postProcessing/miscellaneous/writeCellCentres/writeCellCentres.C b/applications/utilities/postProcessing/miscellaneous/writeCellCentres/writeCellCentres.C
index 002501533948974bd3b1a1942ef31f85dd986c20..fe1a749749c430f8ec023dfb9fc8a1ec07547ec6 100644
--- a/applications/utilities/postProcessing/miscellaneous/writeCellCentres/writeCellCentres.C
+++ b/applications/utilities/postProcessing/miscellaneous/writeCellCentres/writeCellCentres.C
@@ -21,6 +21,12 @@ License
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
+Application
+    writeCellCentres
+
+Group
+    grpPostProcessingUtilities
+
 Description
     Write the three components of the cell centres as volScalarFields so
     they can be used in postprocessing in thresholding.
diff --git a/applications/utilities/postProcessing/noise/Allwmake b/applications/utilities/postProcessing/noise/Allwmake
new file mode 100755
index 0000000000000000000000000000000000000000..84c6a2ac82197aa7cd4847a64dfaca1ec021e44a
--- /dev/null
+++ b/applications/utilities/postProcessing/noise/Allwmake
@@ -0,0 +1,14 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # run from this directory
+
+if [ -f "$FFTW_ARCH_PATH/include/fftw3.h" ] || \
+   [ "${FFTW_ARCH_PATH##*-}" = system -a -f "/usr/include/fftw3.h" ]
+then
+    wmake
+else
+    echo
+    echo "Skipping noise utility (no FFTW)"
+    echo
+fi
+
+#------------------------------------------------------------------------------
diff --git a/applications/utilities/postProcessing/noise/Make/options b/applications/utilities/postProcessing/noise/Make/options
index b29b939580748d59669a36947c8687210c2b4bc5..2fc476e7419aac049558489d7c1cf86e69f36933 100644
--- a/applications/utilities/postProcessing/noise/Make/options
+++ b/applications/utilities/postProcessing/noise/Make/options
@@ -1,6 +1,7 @@
 EXE_INC = \
     -I$(LIB_SRC)/randomProcesses/lnInclude \
-    -I$(LIB_SRC)/sampling/lnInclude
+    -I$(LIB_SRC)/sampling/lnInclude \
+    -I$(LIB_SRC)/surfMesh/lnInclude
 
 EXE_LIBS = \
     -lrandomProcesses \
diff --git a/applications/utilities/postProcessing/noise/noise.C b/applications/utilities/postProcessing/noise/noise.C
index 43597560f0d91822a07aa4a2ec6687175354d8c2..4f9b1948a6101dfd11e1983806517ee7c8156f8f 100644
--- a/applications/utilities/postProcessing/noise/noise.C
+++ b/applications/utilities/postProcessing/noise/noise.C
@@ -2,8 +2,8 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -24,158 +24,107 @@ License
 Application
     noise
 
+Group
+    grpPostProcessingUtilities
+
 Description
-    Utility to perform noise analysis of pressure data using the noiseFFT
-    library.
+    Utility to perform noise analysis of pressure data.
 
-    Control settings are read from the $FOAM_CASE/system/noiseDict dictionary,
-    or user-specified dictionary using the -dict option.  Pressure data is
-    read using a CSV reader:
+    The utility provides a light wrapper around the run-time selectable
+    noise model.  Current options include:
+    - point, and
+    - surface noise.
 
-    \heading Usage
+    \heading Example usage
 
     \verbatim
-    pRef        101325;
-    N           65536;
-    nw          100;
-    f1          25;
-    fU          10000;
-    graphFormat raw;
-
-    pressureData
+    noiseModel      surfaceNoise; // pointNoise
+
+    surfaceNoiseCoeffs
     {
-        fileName        "pressureData"
-        nHeaderLine         1;          // number of header lines
-        refColumn           0;          // reference column index
-        componentColumns    (1);        // component column indices
-        separator           " ";        // optional (defaults to ",")
-        mergeSeparators     no;         // merge multiple separators
-        outOfBounds         clamp;      // optional out-of-bounds handling
-        interpolationScheme linear;     // optional interpolation scheme
+        windowModel     Hanning;
+
+        HanningCoeffs
+        {
+            // Window overlap percentage
+            overlapPercent  50;
+            symmetric       yes;
+            extended        yes;
+
+            // Optional number of windows, default = all available
+            nWindow         5;
+        }
+
+
+        // Input file
+        inputFile   "postProcessing/faceSource1/surface/patch/patch.case";
+
+        // Surface reader
+        reader      ensight;
+
+        // Surface writer
+        writer      ensight;
+
+        // Collate times for ensight output - ensures geometry is only written once
+        writeOptions
+        {
+            ensight
+            {
+                collateTimes true;
+            }
+        }
+
+        // Number of samples in sampling window
+        // Must be a power of 2, default = 2^16 (=65536)
+        N               4096;
+
+        // Write interval for FFT data, default = 1
+        fftWriteInterval 100;
     }
     \endverbatim
 
-    where
-    \table
-        Property    | Description                   | Required  | Default value
-        pRef        | Reference pressure            | no        | 0
-        N           | Number of samples in sampling window | no | 65536
-        nw          | Number of sampling windows    | no        | 100
-        fl          | Lower frequency band          | no        | 25
-        fU          | Upper frequency band          | no        | 10000
-        graphFormat | Output graph format          | no        | raw
-    \endtable
-
-    Current graph outputs include:
-    - FFT of the pressure data
-    - narrow-band PFL (pressure-fluctuation level) spectrum
-    - one-third-octave-band PFL spectrum
-    - one-third-octave-band pressure spectrum
 
 SeeAlso
-    CSV.H
     noiseFFT.H
+    noiseModel.H
+    windowModel.H
 
 \*---------------------------------------------------------------------------*/
 
-
-#include "noiseFFT.H"
 #include "argList.H"
 #include "Time.H"
-#include "functionObjectFile.H"
-#include "CSV.H"
+#include "noiseModel.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 using namespace Foam;
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-Foam::scalar checkUniformTimeStep(const scalarField& t)
-{
-    // check that a uniform time step has been applied
-    scalar deltaT = -1.0;
-    if (t.size() > 1)
-    {
-        for (label i = 1; i < t.size(); i++)
-        {
-            scalar dT = t[i] - t[i-1];
-            if (deltaT < 0)
-            {
-                deltaT = dT;
-            }
-
-            if (mag(deltaT - dT) > SMALL)
-            {
-                FatalErrorInFunction
-                    << "Unable to process data with a variable time step"
-                    << exit(FatalError);
-            }
-        }
-    }
-    else
-    {
-        FatalErrorInFunction
-            << "Unable to create FFT with a single value"
-            << exit(FatalError);
-    }
-
-    return deltaT;
-}
-
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 int main(int argc, char *argv[])
 {
-    argList::noParallel();
     #include "addDictOption.H"
     #include "setRootCase.H"
     #include "createTime.H"
-    #include "createFields.H"
 
-    Info<< "Reading data file" << endl;
-    Function1Types::CSV<scalar> pData("pressure", dict, "Data");
-
-    // time history data
-    const scalarField t(pData.x());
-
-    // pressure data
-    const scalarField p(pData.y());
-
-    if (t.size() < N)
+    fileName dictName(runTime.system()/"noiseDict");
+    if (args.optionFound("dict"))
     {
-        FatalErrorInFunction
-            << "Block size N = " << N
-            << " is larger than number of data = " << t.size()
-            << exit(FatalError);
+        dictName = args["dict"];
     }
 
-    Info<< "    read " << t.size() << " values" << nl << endl;
-
-
-    Info<< "Creating noise FFT" << endl;
-    noiseFFT nfft(checkUniformTimeStep(t), p);
-
-    nfft -= pRef;
-
-    fileName baseFileName(pData.fName().lessExt());
-
-    graph Pf(nfft.RMSmeanPf(N, min(nfft.size()/N, nw)));
-    Info<< "    Creating graph for " << Pf.title() << endl;
-    Pf.write(baseFileName + graph::wordify(Pf.title()), graphFormat);
-
-    graph Lf(nfft.Lf(Pf));
-    Info<< "    Creating graph for " << Lf.title() << endl;
-    Lf.write(baseFileName + graph::wordify(Lf.title()), graphFormat);
-
-    graph Ldelta(nfft.Ldelta(Lf, f1, fU));
-    Info<< "    Creating graph for " << Ldelta.title() << endl;
-    Ldelta.write(baseFileName + graph::wordify(Ldelta.title()), graphFormat);
-
-    graph Pdelta(nfft.Pdelta(Pf, f1, fU));
-    Info<< "    Creating graph for " << Pdelta.title() << endl;
-    Pdelta.write(baseFileName + graph::wordify(Pdelta.title()), graphFormat);
+    IOdictionary dict
+    (
+        IOobject
+        (
+            dictName,
+            runTime,
+            IOobject::MUST_READ
+        )
+    );
+
+    autoPtr<noiseModel> model(noiseModel::New(dict));
+    model->calculate();
 
     Info<< nl << "End\n" << endl;
 
diff --git a/applications/utilities/postProcessing/noise/noiseDict b/applications/utilities/postProcessing/noise/noiseDict
new file mode 100644
index 0000000000000000000000000000000000000000..95eedffff161de4806787493d683e86dd43aee88
--- /dev/null
+++ b/applications/utilities/postProcessing/noise/noiseDict
@@ -0,0 +1,136 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      noiseDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+noiseModel      surfaceNoise;
+
+surfaceNoiseCoeffs
+{
+    windowModel     Hanning;
+
+    HanningCoeffs
+    {
+        // Window overlap percentage
+        overlapPercent  50;
+        symmetric       yes;
+        extended        yes;
+
+        // Optional number of windows, default = all available
+        // nWindow         1;
+    }
+
+/*
+    windowModel     uniform;
+
+    uniformCoeffs
+    {
+        // Window overlap percentage
+        overlapPercent  50;
+
+        value           1;
+
+        // Optional number of windows, default = all available
+        // nWindow         1;
+    }
+*/
+
+
+    // Input file
+    inputFile   "postProcessing/faceSource1/surface/patch_motorBike_rider-helmet%65/patch_motorBike_rider-helmet%65.case";
+
+    // Surface reader
+    reader      ensight;
+
+    // Surface writer
+    writer      ensight;
+
+    // Collate times for ensight output - ensures geometry is only written once
+    writeOptions
+    {
+        ensight
+        {
+            collateTimes true;
+        }
+    }
+
+    // Reference density (to convert from kinematic to static pressure)
+    rhoRef          1.205;
+
+    // Number of samples in sampling window
+    // Must be a power of 2, default = 2^16 (=65536)
+    N               4096; // 8192; // 4096;
+
+    // Lower frequency limit, default = 25Hz
+    //fl              25;
+
+    // Upper frequency limit, default = 10kHz
+    fu              15000;
+
+    // Start time, default = 0s
+    //startTime       0;
+
+    // Write interval for FFT data, default = 1
+//    fftWriteInterval 100;
+}
+
+pointNoiseCoeffs
+{
+    csvFileData
+    {
+        fileName        "pressureData";
+        nHeaderLine     1;
+        refColumn       0;
+        componentColumns (1);
+        separator       " ";
+        mergeSeparators yes;
+    }
+
+    HanningCoeffs
+    {
+        // Window overlap percentage
+        overlapPercent  50;
+        symmetric       yes;
+        extended        yes;
+
+        // Optional number of windows, default = all available
+        //nWindow         5;
+    }
+
+    // Graph format, default = raw
+    graphFormat     raw;
+
+    // Reference density (to convert from kinematic to static pressure)
+    rhoRef          1.2;
+
+    // Number of samples in sampling window
+    // Must be a power of 2, default = 2^16 (=65536)
+    N               4096;
+
+    // Lower frequency limit, default = 25Hz
+    //fl              25;
+
+    // Upper frequency limit, default = 10kHz
+    //fu              10000;
+
+    // Start time, default = 0s
+    //startTime       0;
+
+    // Write interval for FFT data, default = 1
+    fftWriteInterval 100;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C b/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C
index 53190221b7d21c61b640cd4adc910cd3069d85db..4830e2d54ea9f8240407ecb7f1937ed09a0a53f3 100644
--- a/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C
+++ b/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C
@@ -24,6 +24,9 @@ License
 Application
     patchAverage
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates the average of the specified field over the specified patch.
 
diff --git a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C
index e17f43cf29215b51afb8b988908e854e6fcfa54b..f1a26f65049b7b229e2f06406d1e4693bfe8827d 100644
--- a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C
+++ b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C
@@ -24,6 +24,9 @@ License
 Application
     patchIntegrate
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates the integral of the specified field over the specified patch.
 
diff --git a/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C b/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C
index daf48a3f681a1f2ddc65f13b1b0733b33128060a..40ce8dc0388f42e2b9e5f8b9c207efa9290782bc 100644
--- a/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C
+++ b/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C
@@ -24,6 +24,9 @@ License
 Application
     probeLocations
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Probe locations.
 
diff --git a/applications/utilities/postProcessing/sampling/sample/sample.C b/applications/utilities/postProcessing/sampling/sample/sample.C
index 59abc2e2f18ec888ad66ac078f9d29a90f250a0a..0f47b2bca8e696934f8080883bf80a9ac2ae12a4 100644
--- a/applications/utilities/postProcessing/sampling/sample/sample.C
+++ b/applications/utilities/postProcessing/sampling/sample/sample.C
@@ -24,6 +24,9 @@ License
 Application
     sample
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Sample field data with a choice of interpolation schemes, sampling options
     and write formats.
diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict
index 8e77428d6ac0d42bd551a0ab8751016704a53a45..541911cfc08ecae2d3f41ca682683a7eb8b73451 100644
--- a/applications/utilities/postProcessing/sampling/sample/sampleDict
+++ b/applications/utilities/postProcessing/sampling/sample/sampleDict
@@ -71,7 +71,7 @@ formatOptions
     {
         // ascii/binary format
         format  ascii;
-        //collateTimes true;  // write single file containing multiple timesteps
+        collateTimes true;    // write single file containing multiple timesteps
                               // (only for static surfaces)
     }
     vtk
diff --git a/applications/utilities/postProcessing/scalarField/pPrime2/pPrime2.C b/applications/utilities/postProcessing/scalarField/pPrime2/pPrime2.C
index 46b11f79f2bc8bd01b23b1e0b7c2c4cb7222ddeb..e24c4b8542cf09c4708bc940d44a5c18207849c1 100644
--- a/applications/utilities/postProcessing/scalarField/pPrime2/pPrime2.C
+++ b/applications/utilities/postProcessing/scalarField/pPrime2/pPrime2.C
@@ -24,6 +24,9 @@ License
 Application
     pPrime2
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and writes the scalar field of pPrime2 (sqr(p - pMean)) at
     each time
diff --git a/applications/utilities/postProcessing/turbulence/R/R.C b/applications/utilities/postProcessing/turbulence/R/R.C
index 2d7bab324c8067b36a383a13c4a186fce8ec5f16..d75ece47371b952e9550e0973cee4d8303f54738 100644
--- a/applications/utilities/postProcessing/turbulence/R/R.C
+++ b/applications/utilities/postProcessing/turbulence/R/R.C
@@ -24,6 +24,9 @@ License
 Application
     R
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and writes the Reynolds stress R for the current time step.
 
diff --git a/applications/utilities/postProcessing/turbulence/createTurbulenceFields/createTurbulenceFields.C b/applications/utilities/postProcessing/turbulence/createTurbulenceFields/createTurbulenceFields.C
index 06ceb70f49a44113ae57f8279460f9a391438583..64754db86865ac00e04315b9a2a03fc3a8f3452a 100644
--- a/applications/utilities/postProcessing/turbulence/createTurbulenceFields/createTurbulenceFields.C
+++ b/applications/utilities/postProcessing/turbulence/createTurbulenceFields/createTurbulenceFields.C
@@ -24,6 +24,9 @@ License
 Application
     createTurbulenceFields
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Creates a full set of turbulence fields.
 
diff --git a/applications/utilities/postProcessing/velocityField/Co/Co.C b/applications/utilities/postProcessing/velocityField/Co/Co.C
index 1e88dd92d3052d86079fc217bf8bbf4a57ac4a48..96e6a2107f56d4807875452044c5faf59c91e429 100644
--- a/applications/utilities/postProcessing/velocityField/Co/Co.C
+++ b/applications/utilities/postProcessing/velocityField/Co/Co.C
@@ -24,6 +24,9 @@ License
 Application
     Co
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and writes the Co number as a volScalarField obtained
     from field phi.
diff --git a/applications/utilities/postProcessing/velocityField/Lambda2/Lambda2.C b/applications/utilities/postProcessing/velocityField/Lambda2/Lambda2.C
index 3208b5beeb0641d8dd0b88be6c9b218d0637f58a..d545ae0b959df8d699cccebee73479bfa1e70fef 100644
--- a/applications/utilities/postProcessing/velocityField/Lambda2/Lambda2.C
+++ b/applications/utilities/postProcessing/velocityField/Lambda2/Lambda2.C
@@ -24,6 +24,9 @@ License
 Application
     Lambda2
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and writes the second largest eigenvalue of the sum of the
     square of the symmetrical and anti-symmetrical parts of the velocity
diff --git a/applications/utilities/postProcessing/velocityField/Mach/Mach.C b/applications/utilities/postProcessing/velocityField/Mach/Mach.C
index 9914a3a098476a805520617e84f2ab27d151fed9..9fdd797c9229a1f8b56ef4da6e76b9415c2f74bc 100644
--- a/applications/utilities/postProcessing/velocityField/Mach/Mach.C
+++ b/applications/utilities/postProcessing/velocityField/Mach/Mach.C
@@ -24,6 +24,9 @@ License
 Application
     Mach
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and optionally writes the local Mach number from the velocity
     field U at each time.
diff --git a/applications/utilities/postProcessing/velocityField/Pe/Pe.C b/applications/utilities/postProcessing/velocityField/Pe/Pe.C
index 69c4964429200f0a4c23f08e0174dc4ca43c92f1..79e9c5bdb2167dac584afa54194fb58258836850 100644
--- a/applications/utilities/postProcessing/velocityField/Pe/Pe.C
+++ b/applications/utilities/postProcessing/velocityField/Pe/Pe.C
@@ -24,6 +24,9 @@ License
 Application
     Pe
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates the Peclet number Pe from the flux phi and writes the maximum
     value, the surfaceScalarField Pef and volScalarField Pe.
diff --git a/applications/utilities/postProcessing/velocityField/Q/Q.C b/applications/utilities/postProcessing/velocityField/Q/Q.C
index b54a4ce399d108e1832d1f45efa0c3bac1b8a07a..04f1b7c2021e675a49cc921d34e83ade36744f97 100644
--- a/applications/utilities/postProcessing/velocityField/Q/Q.C
+++ b/applications/utilities/postProcessing/velocityField/Q/Q.C
@@ -24,6 +24,9 @@ License
 Application
     Q
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and writes the second invariant of the velocity gradient tensor.
 
diff --git a/applications/utilities/postProcessing/velocityField/enstrophy/enstrophy.C b/applications/utilities/postProcessing/velocityField/enstrophy/enstrophy.C
index ea681d69d98b1051d5eee424033fde0e5c93a8ca..971ea8d73fd7ac7c2580559260cdaa8cfed46b5a 100644
--- a/applications/utilities/postProcessing/velocityField/enstrophy/enstrophy.C
+++ b/applications/utilities/postProcessing/velocityField/enstrophy/enstrophy.C
@@ -24,6 +24,9 @@ License
 Application
     enstrophy
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and writes the enstrophy of the velocity field U.
 
diff --git a/applications/utilities/postProcessing/velocityField/flowType/flowType.C b/applications/utilities/postProcessing/velocityField/flowType/flowType.C
index 309393d19d9c9b7ea55f775aa99ddaf487870a91..d26668d52e9cbd39746bcf0ac3859f1ef0698bc6 100644
--- a/applications/utilities/postProcessing/velocityField/flowType/flowType.C
+++ b/applications/utilities/postProcessing/velocityField/flowType/flowType.C
@@ -24,6 +24,9 @@ License
 Application
     flowType
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and writes the flowType of velocity field U.
 
diff --git a/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C b/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C
index 120c197a91dde7c4a6627e941ead18ddb3ffa95b..341832e65565c13e44359496bdd8c077a4a65005 100644
--- a/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C
+++ b/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C
@@ -24,6 +24,9 @@ License
 Application
     streamFunction
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and writes the stream function of velocity field U at each
     time.
diff --git a/applications/utilities/postProcessing/velocityField/uprime/uprime.C b/applications/utilities/postProcessing/velocityField/uprime/uprime.C
index 8b1b9f15b05b4f4dc83ff3106fe67d21ffb1bdc0..2ec5c4442780b237c785e50235927b6ac0a46e74 100644
--- a/applications/utilities/postProcessing/velocityField/uprime/uprime.C
+++ b/applications/utilities/postProcessing/velocityField/uprime/uprime.C
@@ -24,6 +24,9 @@ License
 Application
     uprime
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and writes the scalar field of uprime (sqrt(2/3 k)).
 
diff --git a/applications/utilities/postProcessing/velocityField/vorticity/vorticity.C b/applications/utilities/postProcessing/velocityField/vorticity/vorticity.C
index 7662dff311d8632da0a2948325707ba58ccd793d..efc95a8bd3dc98bb011620cc9ca2f5adca04571a 100644
--- a/applications/utilities/postProcessing/velocityField/vorticity/vorticity.C
+++ b/applications/utilities/postProcessing/velocityField/vorticity/vorticity.C
@@ -24,6 +24,9 @@ License
 Application
     vorticity
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and writes the vorticity of velocity field U.
 
diff --git a/applications/utilities/postProcessing/wall/wallGradU/wallGradU.C b/applications/utilities/postProcessing/wall/wallGradU/wallGradU.C
index 650d075ea735054f7b87d0c544f954cc1f22b747..9d5b29f498ac30255eb6820220ef8aa1d581d965 100644
--- a/applications/utilities/postProcessing/wall/wallGradU/wallGradU.C
+++ b/applications/utilities/postProcessing/wall/wallGradU/wallGradU.C
@@ -24,6 +24,9 @@ License
 Application
     wallGradU
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and writes the gradient of U at the wall.
 
diff --git a/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C b/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C
index d1c37e70cc48ad7dec9a9c61bb026e97cf8cca1f..00a2211d2c4e6aeab2be63b25772ac7f08844ed0 100644
--- a/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C
+++ b/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C
@@ -24,6 +24,9 @@ License
 Application
     wallHeatFlux
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and writes the heat flux for all patches as the boundary field
     of a volScalarField and also prints the integrated flux for all wall
diff --git a/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C b/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C
index 6d8b48dff673c153a4faa61ef88402ff7ac00af0..025f3a5a27c608e9097d0ebcb609d66d80fae5a2 100644
--- a/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C
+++ b/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C
@@ -24,6 +24,9 @@ License
 Application
     wallShearStress
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and reports the turbulent wall shear stress for all patches,
     for the specified times.
diff --git a/applications/utilities/postProcessing/wall/yPlus/yPlus.C b/applications/utilities/postProcessing/wall/yPlus/yPlus.C
index 04d80ab6c020e24aa667644ea19594ae26120909..492cd57fd71209bade56fb62df0be566a01514da 100644
--- a/applications/utilities/postProcessing/wall/yPlus/yPlus.C
+++ b/applications/utilities/postProcessing/wall/yPlus/yPlus.C
@@ -24,6 +24,9 @@ License
 Application
     yPlus
 
+Group
+    grpPostProcessingUtilities
+
 Description
     Calculates and reports yPlus for the near-wall cells of all wall patches,
     for the specified times for laminar, LES and RAS.
diff --git a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C
index 7b597bd77713a1bbbaeeef01b6ab1ea2938744eb..3783227fa3855aa758aa8d0b0cab07b52f030857 100644
--- a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C
+++ b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C
@@ -24,6 +24,9 @@ License
 Application
     applyBoundaryLayer
 
+Group
+    grpPreProcessingUtilities
+
 Description
     Apply a simplified boundary-layer model to the velocity and
     turbulence fields based on the 1/7th power-law.
diff --git a/applications/utilities/preProcessing/boxTurb/Allwmake b/applications/utilities/preProcessing/boxTurb/Allwmake
new file mode 100755
index 0000000000000000000000000000000000000000..46d04eebf53d77b99725437e3b5094b842f992cc
--- /dev/null
+++ b/applications/utilities/preProcessing/boxTurb/Allwmake
@@ -0,0 +1,14 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # run from this directory
+
+if [ -f "$FFTW_ARCH_PATH/include/fftw3.h" ] || \
+   [ "${FFTW_ARCH_PATH##*-}" = system -a -f "/usr/include/fftw3.h" ]
+then
+    wmake
+else
+    echo
+    echo "Skipping boxTurb utility (no FFTW)"
+    echo
+fi
+
+#------------------------------------------------------------------------------
diff --git a/applications/utilities/preProcessing/boxTurb/boxTurb.C b/applications/utilities/preProcessing/boxTurb/boxTurb.C
index 4ed0356e1cc1976078d4d7c8c7a2931c1ff49322..56cfb42d320836bce4cdd4c4955f717e06ce4d7d 100644
--- a/applications/utilities/preProcessing/boxTurb/boxTurb.C
+++ b/applications/utilities/preProcessing/boxTurb/boxTurb.C
@@ -24,6 +24,9 @@ License
 Application
     boxTurb
 
+Group
+    grpPreProcessingUtilities
+
 Description
     Makes a box of turbulence which conforms to a given energy
     spectrum and is divergence free.
diff --git a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C
index adacf92248d8d592d02c17cb6f520d43b7daf1d4..30f0a480fc547f7407dd8c35ee75fba44546df65 100644
--- a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C
+++ b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C
@@ -24,6 +24,9 @@ License
 Application
     changeDictionary
 
+Group
+    grpPreProcessingUtilities
+
 Description
     Utility to change dictionary entries, e.g. can be used to change the patch
     type in the field and polyMesh/boundary files.
diff --git a/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometry.C b/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometry.C
index 6a8b78c6837494f75bb4a30a1a419f7fdb26c39b..bcb6fa78600845b20bc222500f33f694b322adb3 100644
--- a/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometry.C
+++ b/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometry.C
@@ -24,6 +24,9 @@ License
 Application
     createExternalCoupledPatchGeometry.
 
+Group
+    grpPreProcessingUtilities
+
 Description
     Application to generate the patch geometry (points and faces) for use
     with the externalCoupled functionObject.
diff --git a/applications/utilities/preProcessing/createZeroDirectory/createZeroDirectory.C b/applications/utilities/preProcessing/createZeroDirectory/createZeroDirectory.C
index e7da84054726bfd458ced8f6cb47bf022ed42df3..68ef4c3d69d7a6fe09fe9c9c2df87deb9311fb6c 100644
--- a/applications/utilities/preProcessing/createZeroDirectory/createZeroDirectory.C
+++ b/applications/utilities/preProcessing/createZeroDirectory/createZeroDirectory.C
@@ -24,6 +24,9 @@ License
 Application
     createZeroDirectory
 
+Group
+    grpPreProcessingUtilities
+
 Description
     Creates a zero directory with fields appropriate for the chosen solver and
     turbulence model. Operates on both single and multi-region cases.
diff --git a/applications/utilities/preProcessing/dsmcInitialise/dsmcInitialise.C b/applications/utilities/preProcessing/dsmcInitialise/dsmcInitialise.C
index e873f10d770480106f9ced2b7d0c556e1908c14e..f2a2574e9daadfe8c02e5389d911cf92e783c6f7 100644
--- a/applications/utilities/preProcessing/dsmcInitialise/dsmcInitialise.C
+++ b/applications/utilities/preProcessing/dsmcInitialise/dsmcInitialise.C
@@ -24,6 +24,9 @@ License
 Application
     dsmcInitialise
 
+Group
+    grpPreProcessingUtilities
+
 Description
     Initialise a case for dsmcFoam by reading the initialisation dictionary
     system/dsmcInitialise.
diff --git a/applications/utilities/preProcessing/engineSwirl/engineSwirl.C b/applications/utilities/preProcessing/engineSwirl/engineSwirl.C
index 4652cb2afd9c5f6a54b43dc10e32c757d688b592..f59d166d680e2ed1ab9e7d2a5c5ce41d00079b84 100644
--- a/applications/utilities/preProcessing/engineSwirl/engineSwirl.C
+++ b/applications/utilities/preProcessing/engineSwirl/engineSwirl.C
@@ -24,6 +24,9 @@ License
 Application
     engineSwirl
 
+Group
+    grpPreProcessingUtilities
+
 Description
     Generates a swirling flow for engine calulations.
 
diff --git a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C
index 163c9fa8c101fe133423d28135a5bc9b7f642798..808e9a7cf8f2e0bf19f155f75d55fb4bcc687ee8 100644
--- a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C
+++ b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C
@@ -24,6 +24,9 @@ License
 Application
     faceAgglomerate
 
+Group
+    grpPreProcessingUtilities
+
 Description
     Agglomerate boundary faces using the pairPatchAgglomeration algorithm.
 
diff --git a/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C b/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C
index 7f2746338c71a9a85abd0e5eb553f2c2d638833f..66e2f4f65155fbc2d36da30c37b11f560a323579 100644
--- a/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C
+++ b/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C
@@ -24,6 +24,9 @@ License
 Application
     foamUpgradeCyclics
 
+Group
+    grpPreProcessingUtilities
+
 Description
     Tool to upgrade mesh and fields for split cyclics.
 
diff --git a/applications/utilities/preProcessing/mapFields/mapFields.C b/applications/utilities/preProcessing/mapFields/mapFields.C
index 6e3f4ef06b9ae036e5426ec2fa4bb2d0482360c8..5eceb0c2b563f5b339ba2525d6a52ebcfb1d2da3 100644
--- a/applications/utilities/preProcessing/mapFields/mapFields.C
+++ b/applications/utilities/preProcessing/mapFields/mapFields.C
@@ -24,6 +24,9 @@ License
 Application
     mapFields
 
+Group
+    grpPreProcessingUtilities
+
 Description
     Maps volume fields from one mesh to another, reading and
     interpolating all fields present in the time directory of both cases.
diff --git a/applications/utilities/preProcessing/mapFields/mapFieldsDict b/applications/utilities/preProcessing/mapFields/mapFieldsDict
index 39e471e3817418aad8592e978e882ab631450345..8fcc91efd71695782428fb873a648913c2f71fc9 100644
--- a/applications/utilities/preProcessing/mapFields/mapFieldsDict
+++ b/applications/utilities/preProcessing/mapFields/mapFieldsDict
@@ -1,7 +1,7 @@
 /*--------------------------------*- C++ -*----------------------------------*\
 | =========                 |                                                 |
 | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  2.2.2                                 |
+|  \\    /   O peration     | Version:  plus                                  |
 |   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
 |    \\/     M anipulation  |                                                 |
 \*---------------------------------------------------------------------------*/
diff --git a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C
index fdfdaad1da2e1d5a22838f92e6140a2b6cb6b3be..2043644e20d6029ef5b417f908ec95e32c1f6118 100644
--- a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C
+++ b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C
@@ -24,6 +24,9 @@ License
 Application
     mapFieldsPar
 
+Group
+    grpPreProcessingUtilities
+
 Description
     Maps volume fields from one mesh to another, reading and
     interpolating all fields present in the time directory of both cases.
diff --git a/applications/utilities/preProcessing/mdInitialise/mdInitialise.C b/applications/utilities/preProcessing/mdInitialise/mdInitialise.C
index 7af246cb25d0c13aa74df732556b64fff8a51cc2..a3127cdc1f04f58edb10b6de551d7824cad941ec 100644
--- a/applications/utilities/preProcessing/mdInitialise/mdInitialise.C
+++ b/applications/utilities/preProcessing/mdInitialise/mdInitialise.C
@@ -21,6 +21,12 @@ License
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
+Application
+    mdInitialise
+
+Group
+    grpPreProcessingUtilities
+
 Description
     Initialises fields for a molecular dynamics (MD) simulation.
 
diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C
index 7d22cec68bba91da0ae33d9bfc9e131e5ef6de86..9517689240129445fb7778989ed5150e10cf50fd 100644
--- a/applications/utilities/preProcessing/setFields/setFields.C
+++ b/applications/utilities/preProcessing/setFields/setFields.C
@@ -21,6 +21,12 @@ License
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
+Application
+    setFields
+
+Group
+    grpPreProcessingUtilities
+
 Description
     Set values on a selected set of cells/patchfaces through a dictionary.
 
diff --git a/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C b/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C
index 02f0c5d9ad3f6d4dfe2ea546da74b24e109bedb6..a8e20b188f685c9792dc87afae597d1ac7e2a9e9 100644
--- a/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C
+++ b/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -24,6 +24,9 @@ License
 Application
     viewFactorsGen
 
+Group
+    grpPreProcessingUtilities
+
 Description
     View factors are calculated based on a face agglomeration array
     (finalAgglom generated by faceAgglomerate utility).
@@ -188,9 +191,15 @@ void writeRays
             str << "l " << vertI-1 << ' ' << vertI << nl;
         }
     }
-    string cmd("objToVTK " + fName + " " + fName.lessExt() + ".vtk");
-    Pout<< "cmd:" << cmd << endl;
-    system(cmd);
+    str.flush();
+
+    DynamicList<string> cmd(3);
+    cmd.append("objToVTK");
+    cmd.append(fName);
+    cmd.append(fName.lessExt() + ".vtk");
+
+    Pout<< "cmd: objToVTK " << fName.c_str() << endl;
+    Foam::system(cmd);
 }
 
 
diff --git a/applications/utilities/preProcessing/wallFunctionTable/wallFunctionTableApp.C b/applications/utilities/preProcessing/wallFunctionTable/wallFunctionTableApp.C
index eca14ca40c10b17e91c28670acb3918f1feb1ae8..6e2da726605363a85bac920f504c960729378570 100644
--- a/applications/utilities/preProcessing/wallFunctionTable/wallFunctionTableApp.C
+++ b/applications/utilities/preProcessing/wallFunctionTable/wallFunctionTableApp.C
@@ -24,6 +24,9 @@ License
 Application
     wallFunctionTable
 
+Group
+    grpPreProcessingUtilities
+
 Description
     Generates a table suitable for use by tabulated wall functions.
 
diff --git a/applications/utilities/surface/surfaceAdd/surfaceAdd.C b/applications/utilities/surface/surfaceAdd/surfaceAdd.C
index 9ac5bbbb94b0603573afa9c3d98b99f23d3e4645..5072534076fae288775aeb545723337defde4f35 100644
--- a/applications/utilities/surface/surfaceAdd/surfaceAdd.C
+++ b/applications/utilities/surface/surfaceAdd/surfaceAdd.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceAdd
 
+Group
+    grpSurfaceUtilities
+
 Description
     Add two surfaces. Does geometric merge on points. Does not check for
     overlapping/intersecting triangles.
diff --git a/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C b/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C
index f8c094c4bdf5c5acd213f9865391decbe58361ce..c24520790b18206ab01aa61b85624ab290f64522 100644
--- a/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C
+++ b/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceBooleanFeatures
 
+Group
+    grpSurfaceUtilities
+
 Description
     Generates the extendedFeatureEdgeMesh for the interface between a boolean
     operation on two surfaces.
diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C
index 16989e477150fc943b8823dc5f67121cf3d143c3..c45d088c0f697ed7dfdc266e44fc5add1ff4d937 100644
--- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C
+++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -24,6 +24,9 @@ License
 Application
     surfaceCheck
 
+Group
+    grpSurfaceUtilities
+
 Description
     Checks geometric and topological quality of a surface.
 
@@ -262,6 +265,63 @@ void writeParts
 }
 
 
+void syncEdges(const triSurface& p, labelHashSet& markedEdges)
+{
+    // See comment below about having duplicate edges
+
+    const edgeList& edges = p.edges();
+    HashSet<edge, Hash<edge>> edgeSet(2*markedEdges.size());
+
+    forAllConstIter(labelHashSet, markedEdges, iter)
+    {
+        edgeSet.insert(edges[iter.key()]);
+    }
+
+    forAll(edges, edgeI)
+    {
+        if (edgeSet.found(edges[edgeI]))
+        {
+            markedEdges.insert(edgeI);
+        }
+    }
+}
+
+
+void syncEdges(const triSurface& p, boolList& isMarkedEdge)
+{
+    // See comment below about having duplicate edges
+
+    const edgeList& edges = p.edges();
+
+    label n = 0;
+    forAll(isMarkedEdge, edgeI)
+    {
+        if (isMarkedEdge[edgeI])
+        {
+            n++;
+        }
+    }
+
+    HashSet<edge, Hash<edge>> edgeSet(2*n);
+
+    forAll(isMarkedEdge, edgeI)
+    {
+        if (isMarkedEdge[edgeI])
+        {
+            edgeSet.insert(edges[edgeI]);
+        }
+    }
+
+    forAll(edges, edgeI)
+    {
+        if (edgeSet.found(edges[edgeI]))
+        {
+            isMarkedEdge[edgeI] = true;
+        }
+    }
+}
+
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 int main(int argc, char *argv[])
@@ -692,6 +752,7 @@ int main(int argc, char *argv[])
                     borderEdge[edgeI] = true;
                 }
             }
+            syncEdges(surf, borderEdge);
         }
 
         labelList faceZone;
@@ -723,6 +784,17 @@ int main(int argc, char *argv[])
     labelHashSet borderEdge(surf.size()/1000);
     PatchTools::checkOrientation(surf, false, &borderEdge);
 
+    // Bit strange: if a triangle has two same vertices (illegal!) it will
+    // still have three distinct edges (two of which have the same vertices).
+    // In this case the faceEdges addressing is not symmetric, i.e. a
+    // neighbouring, valid, triangle will have correct addressing so 3 distinct
+    // edges so it will miss one of those two identical edges.
+    // - we don't want to fix this in PrimitivePatch since it is too specific
+    // - instead just make sure we mark all identical edges consistently
+    //   when we use them for marking.
+
+    syncEdges(surf, borderEdge);
+
     //
     // Colour all faces into zones using borderEdge
     //
diff --git a/applications/utilities/surface/surfaceClean/surfaceClean.C b/applications/utilities/surface/surfaceClean/surfaceClean.C
index eecdbb5155e49eaae492156cc893c964beea5627..6c55ce14d526870093e32c43d944379ac6c0e11a 100644
--- a/applications/utilities/surface/surfaceClean/surfaceClean.C
+++ b/applications/utilities/surface/surfaceClean/surfaceClean.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceClean
 
+Group
+    grpSurfaceUtilities
+
 Description
     Utility to clean surfaces.
 
diff --git a/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C b/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C
index fdbeca8e28b56b5d22c49e06416f52e91c83bf5b..24284ec5d4e1888a1b3765b6bb557e5aab3b9588 100644
--- a/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C
+++ b/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceCoarsen
 
+Group
+    grpSurfaceUtilities
+
 Description
     Surface coarsening using `bunnylod'
 
diff --git a/applications/utilities/surface/surfaceConvert/surfaceConvert.C b/applications/utilities/surface/surfaceConvert/surfaceConvert.C
index 1d79b08059bc2b547c29b30d89659171d7e0e134..c1f637c3e25bc265bd8e7c250a5fa32157ae7a35 100644
--- a/applications/utilities/surface/surfaceConvert/surfaceConvert.C
+++ b/applications/utilities/surface/surfaceConvert/surfaceConvert.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceConvert
 
+Group
+    grpSurfaceUtilities
+
 Description
     Converts from one surface mesh format to another.
 
diff --git a/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C b/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C
index 1263b7813a510f27a18c3d728399c6e3952a14cf..bf9f1040ca77de27dc39a9ca70af552e655d445d 100644
--- a/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C
+++ b/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceFeatureConvert
 
+Group
+    grpSurfaceUtilities
+
 Description
     Convert between edgeMesh formats.
 
diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C
index 5c81c5699c02f1288037a76f1335f923641131b8..9c9db1babfb4e9a10092706b1d03bfec069e7747 100644
--- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C
+++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceFeatureExtract
 
+Group
+    grpSurfaceUtilities
+
 Description
     Extracts and writes surface features to file. All but the basic feature
     extraction is WIP.
diff --git a/applications/utilities/surface/surfaceFind/surfaceFind.C b/applications/utilities/surface/surfaceFind/surfaceFind.C
index b002e13d315fee0fd0bfeb369cf35ec56c625810..279411cc7eca2bc6c5c4ee262997c71e5f2c680b 100644
--- a/applications/utilities/surface/surfaceFind/surfaceFind.C
+++ b/applications/utilities/surface/surfaceFind/surfaceFind.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceFind
 
+Group
+    grpSurfaceUtilities
+
 Description
     Finds nearest face and vertex.
 
diff --git a/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C b/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C
index b7c5ca03b2a3125727cda5f68b37781269df7d23..64c0f5f5fa61738cd5e8c0d473e4bc677e06ad45 100644
--- a/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C
+++ b/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceHookUp
 
+Group
+    grpSurfaceUtilities
+
 Description
     Find close open edges and stitches the surface along them
 
diff --git a/applications/utilities/surface/surfaceInertia/surfaceInertia.C b/applications/utilities/surface/surfaceInertia/surfaceInertia.C
index 3c832966976da7b9334ce638b736a6438d1d7b0c..e566d09ca2f9b5285d2137d5e308775b71241476 100644
--- a/applications/utilities/surface/surfaceInertia/surfaceInertia.C
+++ b/applications/utilities/surface/surfaceInertia/surfaceInertia.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceInertia
 
+Group
+    grpSurfaceUtilities
+
 Description
     Calculates the inertia tensor, principal axes and moments of a
     command line specified triSurface.
diff --git a/applications/utilities/surface/surfaceInflate/surfaceInflate.C b/applications/utilities/surface/surfaceInflate/surfaceInflate.C
index e30ff5fc551b8e8396a71be5446cdb1602d047ac..c8edf919628efabb54a55ac53486bf78cc2091ac 100644
--- a/applications/utilities/surface/surfaceInflate/surfaceInflate.C
+++ b/applications/utilities/surface/surfaceInflate/surfaceInflate.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceInflate
 
+Group
+    grpSurfaceUtilities
+
 Description
     Inflates surface. WIP. Checks for overlaps and locally lowers
     inflation distance
diff --git a/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C b/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C
index 0352ce0eef6ae76230a492a821ff3c4ffc6ae675..e7006475c78eed0f6320abc5a590172be70f3a52 100644
--- a/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C
+++ b/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceLambdaMuSmooth
 
+Group
+    grpSurfaceUtilities
+
 Description
     Smooths a surface using lambda/mu smoothing.
 
diff --git a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C
index e34cf579b3df9132dfd2e182d235779371477496..c35819d0085624f06d460ab3c29a5d6ac413e05d 100644
--- a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C
+++ b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceMeshConvert
 
+Group
+    grpSurfaceUtilities
+
 Description
     Converts between surface formats with optional scaling or
     transformations (rotate/translate) on a coordinateSystem.
diff --git a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C
index 12bd9f32e2222c82f7200361c536434b7a3f14cc..1debd6ddc560aaae571b953f23e48d7c2ca5dc6e 100644
--- a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C
+++ b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -24,6 +24,9 @@ License
 Application
     surfaceMeshConvertTesting
 
+Group
+    grpSurfaceUtilities
+
 Description
     Converts from one surface mesh format to another, but primarily
     used for testing functionality.
@@ -63,6 +66,9 @@ Note
 #include "MeshedSurfaces.H"
 #include "UnsortedMeshedSurfaces.H"
 
+#include "IStringStream.H"
+#include "OStringStream.H"
+
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -81,11 +87,37 @@ int main(int argc, char *argv[])
     argList::validArgs.append("outputFile");
 
     argList::addBoolOption("clean");
-    argList::addBoolOption("orient");
-    argList::addBoolOption("surfMesh");
-    argList::addBoolOption("triSurface");
-    argList::addBoolOption("unsorted");
-    argList::addBoolOption("triFace");
+    argList::addBoolOption
+    (
+        "orient",
+        "check surface orientation"
+    );
+    argList::addBoolOption
+    (
+        "surfMesh",
+        "test surfMesh output"
+    );
+    argList::addBoolOption
+    (
+        "triSurface",
+        "use triSurface for read/write"
+    );
+    argList::addBoolOption
+    (
+        "unsorted",
+        "use UnsortedMeshedSurface instead of MeshedSurface, "
+        "or unsorted output (with -triSurface option)"
+    );
+    argList::addBoolOption
+    (
+        "triFace",
+        "use triFace instead of face"
+    );
+    argList::addBoolOption
+    (
+        "stdout",
+        "ignore output filename and write to stdout"
+    );
 
     argList::addOption
     (
@@ -96,10 +128,11 @@ int main(int argc, char *argv[])
 
     #include "setRootCase.H"
 
+    const bool     optStdout = args.optionFound("stdout");
     const scalar scaleFactor = args.optionLookupOrDefault("scale", 0.0);
 
     const fileName importName = args[1];
-    const fileName exportName = args[2];
+    const fileName exportName = optStdout ? "-stdout" : args[2];
 
     if (importName == exportName)
     {
@@ -111,7 +144,11 @@ int main(int argc, char *argv[])
     if
     (
         !MeshedSurface<face>::canRead(importName, true)
-     || !MeshedSurface<face>::canWriteType(exportName.ext(), true)
+     ||
+        (
+            !optStdout
+         && !MeshedSurface<face>::canWriteType(exportName.ext(), true)
+        )
     )
     {
         return 1;
@@ -125,6 +162,23 @@ int main(int argc, char *argv[])
         surf.writeStats(Info);
         Info<< endl;
 
+        // check: output to ostream, construct from istream
+        {
+            OStringStream os;
+            os << surf;
+            IStringStream is(os.str());
+
+            // both work:
+            triSurface surf2(is);
+
+            // OR
+            // is.rewind();
+            // triSurface surf2;
+            // is >> surf2;
+
+            // surf2.read(is); // FAIL: private method
+        }
+
         if (args.optionFound("orient"))
         {
             Info<< "Checking surface orientation" << endl;
@@ -153,8 +207,15 @@ int main(int argc, char *argv[])
             Info<< endl;
         }
 
-        // write sorted by region
-        surf.write(exportName, true);
+        if (optStdout)
+        {
+            Info<< surf;
+        }
+        else
+        {
+            // normally write sorted (looks nicer)
+            surf.write(exportName, !args.optionFound("unsorted"));
+        }
     }
     else if (args.optionFound("unsorted"))
     {
@@ -164,6 +225,23 @@ int main(int argc, char *argv[])
         surf.writeStats(Info);
         Info<< endl;
 
+        // check: output to ostream, construct from istream
+        {
+            OStringStream os;
+            os << surf;
+            IStringStream is(os.str());
+
+            // both work:
+            UnsortedMeshedSurface<face> surf2(is);
+
+            // OR
+            // is.rewind();
+            // UnsortedMeshedSurface<face> surf2;
+            // is >> surf2;
+
+            // surf2.read(is);  // FAIL: private method
+        }
+
         if (args.optionFound("orient"))
         {
             Info<< "Checking surface orientation" << endl;
@@ -191,9 +269,16 @@ int main(int argc, char *argv[])
             surf.writeStats(Info);
             Info<< endl;
         }
-        surf.write(exportName);
+
+        if (optStdout)
+        {
+            Info<< surf;
+        }
+        else
+        {
+            surf.write(exportName);
+        }
     }
-#if 1
     else if (args.optionFound("triFace"))
     {
         MeshedSurface<triFace> surf(importName);
@@ -202,6 +287,23 @@ int main(int argc, char *argv[])
         surf.writeStats(Info);
         Info<< endl;
 
+        // check: output to ostream, construct from istream
+        {
+            OStringStream os;
+            os << surf;
+            IStringStream is(os.str());
+
+            // both work:
+            MeshedSurface<face> surf2(is);
+
+            // OR
+            // is.rewind();
+            // MeshedSurface<face> surf2;
+            // is >> surf2;
+
+            // surf2.read(is);  // FAIL: private method
+        }
+
         if (args.optionFound("orient"))
         {
             Info<< "Checking surface orientation" << endl;
@@ -229,9 +331,16 @@ int main(int argc, char *argv[])
             surf.writeStats(Info);
             Info<< endl;
         }
-        surf.write(exportName);
+
+        if (optStdout)
+        {
+            Info<< surf;
+        }
+        else
+        {
+            surf.write(exportName);
+        }
     }
-#endif
     else
     {
         MeshedSurface<face> surf(importName);
@@ -240,6 +349,23 @@ int main(int argc, char *argv[])
         surf.writeStats(Info);
         Info<< endl;
 
+        // check: output to ostream, construct from istream
+        {
+            OStringStream os;
+            os << surf;
+            IStringStream is(os.str());
+
+            // both work:
+            MeshedSurface<face> surf2(is);
+
+            // OR
+            // is.rewind();
+            // MeshedSurface<face> surf2;
+            // is >> surf2;
+
+            // surf2.read(is);  // FAIL: private method
+        }
+
         if (args.optionFound("orient"))
         {
             Info<< "Checking surface orientation" << endl;
@@ -255,7 +381,6 @@ int main(int argc, char *argv[])
             Info<< endl;
         }
 
-
         Info<< "writing " << exportName;
         if (scaleFactor <= 0)
         {
@@ -268,7 +393,15 @@ int main(int argc, char *argv[])
             surf.writeStats(Info);
             Info<< endl;
         }
-        surf.write(exportName);
+
+        if (optStdout)
+        {
+            Info<< surf;
+        }
+        else
+        {
+            surf.write(exportName);
+        }
 
         if (args.optionFound("surfMesh"))
         {
@@ -284,7 +417,6 @@ int main(int argc, char *argv[])
             Info<< "runTime.instance() = " << runTime.instance() << endl;
             Info<< "runTime.timeName() = " << runTime.timeName() << endl;
 
-
             Info<< "write MeshedSurface 'yetAnother' via proxy as surfMesh"
                 << endl;
             surf.write
@@ -309,14 +441,11 @@ int main(int argc, char *argv[])
             MeshedSurface<face> surfIn2(runTime, "foobar");
 
             Info<<"surfIn2 = " << surfIn2.size() << endl;
-
             Info<< "surfIn = " << surfIn.size() << endl;
 
-
             Info<< "writing surfMesh as obj = oldSurfIn.obj" << endl;
             surfIn.write("oldSurfIn.obj");
 
-
             Info<< "runTime.instance() = " << runTime.instance() << endl;
 
             surfMesh surfOut
diff --git a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C
index d9c98b3e7459ff6a41b56c59de904f0b7a6ee3db..11accd59cb5850d60716adb69322cb8891768796 100644
--- a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C
+++ b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceMeshExport
 
+Group
+    grpSurfaceUtilities
+
 Description
     Export from surfMesh to various third-party surface formats with
     optional scaling or transformations (rotate/translate) on a
diff --git a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C
index 708d5ab5baff716bb1cd4006965bacb545f42dc9..553439802667fed339fdc98a3ae64ad5b0ccbbec 100644
--- a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C
+++ b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceMeshImport
 
+Group
+    grpSurfaceUtilities
+
 Description
     Import from various third-party surface formats into surfMesh
     with optional scaling or transformations (rotate/translate)
diff --git a/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C b/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C
index 0129154b84c2b114ab9d3370af7a3cee6065fd78..0bc6fb59922ef89cbcae2bf8a8e126108887788e 100644
--- a/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C
+++ b/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -24,8 +24,13 @@ License
 Application
     surfaceMeshInfo
 
+Group
+    grpSurfaceUtilities
+
 Description
     Miscellaneous information about surface meshes.
+    To simplify parsing of the output, the normal banner information
+    is suppressed.
 
 Usage
     - surfaceMeshInfo surfaceFile [OPTION]
diff --git a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
index 580411eda6420d520de57f97db93b08434588732..2a42bd8ce0d1d263565539bf3e2a720ae93bb051 100644
--- a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
+++ b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceMeshTriangulate
 
+Group
+    grpSurfaceUtilities
+
 Description
     Extracts surface from a polyMesh. Depending on output surface format
     triangulates faces.
diff --git a/applications/utilities/surface/surfaceOrient/surfaceOrient.C b/applications/utilities/surface/surfaceOrient/surfaceOrient.C
index 29b60c791677faf28e357f19b408230fbda9179a..4dad7dd57019647cb595d9f859b064ed0ebcacf4 100644
--- a/applications/utilities/surface/surfaceOrient/surfaceOrient.C
+++ b/applications/utilities/surface/surfaceOrient/surfaceOrient.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceOrient
 
+Group
+    grpSurfaceUtilities
+
 Description
     Set normal consistent with respect to a user provided 'outside' point.
     If the -inside option is used the point is considered inside.
diff --git a/applications/utilities/surface/surfacePatch/surfacePatch.C b/applications/utilities/surface/surfacePatch/surfacePatch.C
index 3df36f6ec652ed3cb79d8a7ea3c3640d33fb50f4..474a820623bc3cedc5c15eda34f28a5ae79c4f37 100644
--- a/applications/utilities/surface/surfacePatch/surfacePatch.C
+++ b/applications/utilities/surface/surfacePatch/surfacePatch.C
@@ -24,6 +24,9 @@ License
 Application
     surfacePatch
 
+Group
+    grpSurfaceUtilities
+
 Description
     Patches (regionises) a surface using a user-selectable method.
 
diff --git a/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C b/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C
index 585072d7c02e8ece5a1debfe5121fe96bcd3a67d..830e861654cfbd3dc203b6a42aa6fd01f26ae728 100644
--- a/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C
+++ b/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C
@@ -24,6 +24,9 @@ License
 Application
     surfacePointMerge
 
+Group
+    grpSurfaceUtilities
+
 Description
     Merges points on surface if they are within absolute distance.
     Since absolute distance use with care!
diff --git a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C
index c94e56ac4cce86fc34f6e3662aa8098ca24db479..d6bb838e1bf70f266939372810bf21487a2f0867 100644
--- a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C
+++ b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceRedistributePar
 
+Group
+    grpSurfaceUtilities
+
 Description
     (Re)distribution of triSurface. Either takes an undecomposed surface
     or an already decomposed surface and redistributes it so that each
diff --git a/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.C b/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.C
index d5d1dccd20518c9e906f3b279366383807feb21c..2dbea9fce6dbbc908cdfddab3c70dd9c76c2b066 100644
--- a/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.C
+++ b/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceRefineRedGreen
 
+Group
+    grpSurfaceUtilities
+
 Description
     Refine by splitting all three edges of triangle ('red' refinement).
 
diff --git a/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C b/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C
index 2825822607c2620f0d7a4f54b544fca540b599e2..ae79b9573c01426288326e54c25c0e1d0d208803 100644
--- a/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C
+++ b/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceSplitByPatch
 
+Group
+    grpSurfaceUtilities
+
 Description
     Writes regions of triSurface to separate files.
 
diff --git a/applications/utilities/surface/surfaceSplitByTopology/surfaceSplitByTopology.C b/applications/utilities/surface/surfaceSplitByTopology/surfaceSplitByTopology.C
index c90dee56e939936575d0c27dcbf6c6c9bee0d7fc..d45ce8315420d9abff31b020c1d30a88bd3614b6 100644
--- a/applications/utilities/surface/surfaceSplitByTopology/surfaceSplitByTopology.C
+++ b/applications/utilities/surface/surfaceSplitByTopology/surfaceSplitByTopology.C
@@ -21,6 +21,12 @@ License
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
+Application
+    surfaceSplitByTopology
+
+Group
+    grpSurfaceUtilities
+
 Description
     Strips any baffle parts of a surface.
 
diff --git a/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C b/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C
index b490fe726ad53684821e53e6a6476fd042b34b23..b8a869ef76711a5bc4b8696bb38af22e6a46f5aa 100644
--- a/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C
+++ b/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceSplitNonManifolds
 
+Group
+    grpSurfaceUtilities
+
 Description
     Takes multiply connected surface and tries to split surface at
     multiply connected edges by duplicating points.
diff --git a/applications/utilities/surface/surfaceSubset/surfaceSubset.C b/applications/utilities/surface/surfaceSubset/surfaceSubset.C
index 0a77fde05f3c01ee523cc3d04d5eb495be6cd8d3..70932a615c61374a9a1e9f9768593d7c3ffddb0a 100644
--- a/applications/utilities/surface/surfaceSubset/surfaceSubset.C
+++ b/applications/utilities/surface/surfaceSubset/surfaceSubset.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceSubset
 
+Group
+    grpSurfaceUtilities
+
 Description
     A surface analysis tool which sub-sets the triSurface
     to choose only a part of interest. Based on subsetMesh.
diff --git a/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C b/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C
index bbcf96b96e3a57aca7b44364a4252a404e11a68b..f450b6d453f8375431309a09dd5c6124dd7b8f18 100644
--- a/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C
+++ b/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceToPatch
 
+Group
+    grpSurfaceUtilities
+
 Description
     Reads surface and applies surface regioning to a mesh. Uses boundaryMesh
     to do the hard work.
diff --git a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C
index 3dcc86b9a9e278f359a57de7a02761e10f7cb90a..2f1f7699caab6cf3000d9d9760bb9964505e8d5c 100644
--- a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C
+++ b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C
@@ -24,6 +24,9 @@ License
 Application
     surfaceTransformPoints
 
+Group
+    grpSurfaceUtilities
+
 Description
     Transform (scale/rotate) a surface.
     Like transformPoints but for surfaces.
diff --git a/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C b/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C
index 2e41a7870e38a0a561c8b03ea9bd9a3a0ba75614..7ed0fe3f46d99567238712bf9203e21ff2da2587 100644
--- a/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C
+++ b/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C
@@ -24,6 +24,9 @@ License
 Application
     adiabaticFlameT
 
+Group
+    grpThermophysicalUtilities
+
 Description
     Calculates the adiabatic flame temperature for a given fuel over a
     range of unburnt temperatures and equivalence ratios.
diff --git a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C
index e91f968a8724d421d3b1c3de981115eb54698b92..83bb9b1db5634e985f9db067d4e13d06cd55d232 100644
--- a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C
+++ b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C
@@ -24,6 +24,9 @@ License
 Application
     chemkinToFoam
 
+Group
+    grpSurfaceUtilities
+
 Description
     Converts CHEMKINIII thermodynamics and reaction data files into
     OpenFOAM format.
diff --git a/applications/utilities/thermophysical/equilibriumCO/equilibriumCO.C b/applications/utilities/thermophysical/equilibriumCO/equilibriumCO.C
index 9ecd074bb4cf85d35f9e642362722b4345e4e417..974b9c85493c87b66ceeffb080b54de94ec95dc1 100644
--- a/applications/utilities/thermophysical/equilibriumCO/equilibriumCO.C
+++ b/applications/utilities/thermophysical/equilibriumCO/equilibriumCO.C
@@ -24,6 +24,9 @@ License
 Application
     equilibriumCO
 
+Group
+    grpThermophysicalUtilities
+
 Description
     Calculates the equilibrium level of carbon monoxide.
 
diff --git a/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C b/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C
index fae3960ab6602b501700856e91f60333cb691144..0f2407223c8e0a2ab51ffa1d928f28f394a87485 100644
--- a/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C
+++ b/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C
@@ -24,6 +24,9 @@ License
 Application
     equilibriumFlameT
 
+Group
+    grpThermophysicalUtilities
+
 Description
     Calculates the equilibrium flame temperature for a given fuel and
     pressure for a range of unburnt gas temperatures and equivalence
diff --git a/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.C b/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.C
index c755532d65781541df32bcf0db10ae3e778a3a4b..227ddb1be8ffa18a3dcfd08b32ef2c6d61425841 100644
--- a/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.C
+++ b/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.C
@@ -24,6 +24,9 @@ License
 Application
     mixtureAdiabaticFlameT
 
+Group
+    grpThermophysicalUtilities
+
 Description
     Calculates the adiabatic flame temperature for a given mixture
     at a given temperature.
diff --git a/bin/engridFoam b/bin/engridFoam
deleted file mode 100755
index 42acafdb65e0b1779d2dfba2709e942bf0454ef3..0000000000000000000000000000000000000000
--- a/bin/engridFoam
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/sh
-#------------------------------------------------------------------------------
-# =========                 |
-# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-#  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-#    \\/     M anipulation  |
-#-------------------------------------------------------------------------------
-# License
-#     This file is part of OpenFOAM.
-#
-#     OpenFOAM is free software: you can redistribute it and/or modify it
-#     under the terms of the GNU General Public License as published by
-#     the Free Software Foundation, either version 3 of the License, or
-#     (at your option) any later version.
-#
-#     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-#     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-#     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-#     for more details.
-#
-#     You should have received a copy of the GNU General Public License
-#     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
-#
-# Script
-#     engridFoam
-#
-# Description
-#     start engrid using the paraview libraries from OpenFOAM
-#
-#------------------------------------------------------------------------------
-usage() {
-    exec 1>&2
-    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
-    cat<<USAGE
-
-Usage: ${0##*/} [OPTION]
-options:
-  -help
-
-* start engrid using the paraview-$ParaView_MAJOR libraries
-  passes through engrid options unmodified
-
-USAGE
-    exit 1
-}
-
-# report usage
-[ "$1" = "-h" -o "$1" = "-help" ] && usage
-
-bindir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/engrid
-libdir="$ParaView_DIR/lib/paraview-${ParaView_MAJOR:-unknown}"
-
-[ -x $bindir/engrid ] || usage "engrid executable not found in $bindir"
-[ -d $libdir ] || usage "paraview libraries not found"
-
-export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
-echo "starting $bindir/engrid $@"
-eval "exec $bindir/engrid $@ &"
-
-#------------------------------------------------------------------------------
diff --git a/bin/paraFoam b/bin/paraFoam
index 84b82ecdbf8d05e49cebb92ae13d35adc2077db4..2b31fd379815fa14b97debac613ec48f0d0cb1fd 100755
--- a/bin/paraFoam
+++ b/bin/paraFoam
@@ -4,7 +4,7 @@
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
 #   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-#    \\/     M anipulation  |
+#    \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 #-------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM.
@@ -40,17 +40,18 @@ usage() {
 Usage: ${0##*/} [OPTION] [PARAVIEW_OPTION]
 options:
   -block            use blockMesh reader  (uses .blockMesh extension)
-  -builtin          use VTK builtin OpenFOAM reader  (uses .foam extension)
   -case <dir>       specify alternative case directory, default is the cwd
   -region <name>    specify alternative mesh region
   -touch            only create the file  (eg, .blockMesh, .OpenFOAM, etc)
   -touchAll         create .blockMesh, .OpenFOAM files (and for all regions)
+  -vtk | -builtin   use VTK builtin OpenFOAM reader  (uses .foam extension)
   -help             print the usage
 
+Paraview options start with a double dashes.
 
-paraview options start with a double dashes
+* start paraview with the OpenFOAM libraries
 
-* start paraview $ParaView_VERSION with the OpenFOAM libraries
+  paraview=$(command -v paraview)
 
 USAGE
     exit 1
@@ -67,10 +68,9 @@ unset regionName optTouch
 # already 2010-07)
 export LC_ALL=C
 
-# Reader extension
+# Reader extension and plugin
 extension=OpenFOAM
-
-requirePV=1
+plugin=PVFoamReader
 
 # Parse options
 while [ "$#" -gt 0 ]
@@ -81,11 +81,12 @@ do
         ;;
     -block | -blockMesh)
         extension=blockMesh
+        plugin=PVblockMeshReader
         shift
         ;;
-    -builtin)
+    -builtin | -vtk)
         extension=foam
-        requirePV=0
+        unset plugin
         shift
         ;;
     -case)
@@ -100,12 +101,12 @@ do
         ;;
     -touch)
         optTouch=true
-        requirePV=0
+        unset plugin
         shift
         ;;
     -touchAll)
         optTouch=all
-        requirePV=0
+        unset plugin
         shift
         ;;
     --)
@@ -116,26 +117,34 @@ do
         break    # Stop here, treat this and balance as paraview options
         ;;
     *)
-        usage "unknown option/argument: '$*'"
+        usage "unknown option/argument: '$1'"
         ;;
     esac
 done
 
-# Check that reader module has been built
-if [ $requirePV -eq 1 -a ! -f $PV_PLUGIN_PATH/libPVFoamReader_SM.so ]
-then
-    cat<< BUILDREADER
-
-FATAL ERROR: ParaView reader module libraries do not exist
+# If a reader module is needed, check that it exists
+[ -z "$plugin" -o -f $PV_PLUGIN_PATH/lib${plugin}_SM.so ] || {
+    cat<< BUILDREADER 1>&2
 
+ERROR: ParaView reader module library ($plugin) does not exist
 Please build the reader module before continuing:
-cd \$FOAM_UTILITIES/postProcessing/graphics/PVReaders
-./Allwclean
-./Allwmake
+
+    cd \$FOAM_UTILITIES/postProcessing/graphics/PVReaders
+    ./Allwclean
+    ./Allwmake
 
 BUILDREADER
-    exit 1
-fi
+
+    # Fallback to native reader, if possible
+    if [ "$extension" = OpenFOAM ]
+    then
+        extension=foam
+        echo "Using the native VTK/OpenFOAM reader instead" 1>&2
+    else
+        exit 1
+    fi
+}
+
 
 # Check for --data=... argument
 hasDataArg()
@@ -165,7 +174,7 @@ if [ -n "$regionName" ]
 then
     if [ ! -d constant/$regionName ]
     then
-        echo "FATAL ERROR: Region $regionName does not exist"
+        echo "FATAL ERROR: Region $regionName does not exist" 1>&2
         exit 1
     else
         caseFile="$caseName{$regionName}.$extension"
@@ -179,10 +188,10 @@ all)
     if [ -f system/blockMeshDict -o -f constant/polyMesh/blockMeshDict ]
     then
         touch "$caseName.blockMesh"
-        echo "Created '$caseName.blockMesh'"
+        echo "Created '$caseName.blockMesh'" 1>&2
     fi
     touch "$caseName.$extension"
-    echo "Created '$caseName.$extension'"
+    echo "Created '$caseName.$extension'" 1>&2
     # Discover probable regions
     for region in constant/*
     do
@@ -190,14 +199,14 @@ all)
         then
             regionName=${region##*/}
             touch "$caseName{$regionName}.$extension"
-            echo "Created '$caseName{$regionName}.$extension'"
+            echo "Created '$caseName{$regionName}.$extension'" 1>&2
         fi
     done
     exit 0
     ;;
 true)
     touch "$caseFile"
-    echo "Created '$caseFile'"
+    echo "Created '$caseFile'" 1>&2
     exit 0
     ;;
 esac
@@ -222,14 +231,14 @@ else
     warn="WARN file does not exist:"
     case $extension in
         blockMesh)
-            blockMeshDictDir=system/blockMeshDict
+            blockMeshDict=system/blockMeshDict
             if [ -f constant/polyMesh/blockMeshDict ]
             then
-                blockMeshDictDir=constant/polyMesh/blockMeshDict
+                blockMeshDict=constant/polyMesh/blockMeshDict
             fi
             for check in \
                 system/controlDict \
-                    $blockMeshDictDir \
+                    $blockMeshDict \
                 ;
             do
                 [ -s "$parentDir/$check" ] || {
@@ -240,7 +249,7 @@ else
             done
             ;;
 
-        builtin | OpenFOAM)
+        OpenFOAM)
             for check in \
                 system/controlDict \
                     $fvControls/fvSchemes \
@@ -268,7 +277,7 @@ else
     [ -e $caseFile ] || {
         trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
         touch "$caseFile"
-        echo "Created temporary '$caseFile'"
+        echo "Created temporary '$caseFile'" 1>&2
     }
 
     # For now filter out any ld.so errors. Caused by non-system compiler?
diff --git a/bin/tools/RunFunctions b/bin/tools/RunFunctions
index 407800e791718f91d82157382a080c6162e29c59..2a330f6a382982b90f766a21f5436eb7ddfa23e0 100755
--- a/bin/tools/RunFunctions
+++ b/bin/tools/RunFunctions
@@ -41,7 +41,7 @@ isTest()
 
 getNumberOfProcessors()
 {
-    if [ -f $1 ]
+    if [ -f "$1" ]
     then
         expandDictionary $1 | sed -ne 's/^numberOfSubdomains\s*\(.*\);/\1/p'
     fi
@@ -54,7 +54,6 @@ getApplication()
 
 runApplication()
 {
-    LOG_NAME=
     APP_RUN=
     LOG_IGNORE=false
     LOG_APPEND=false
@@ -100,18 +99,18 @@ runApplication()
 
 runParallel()
 {
-    LOG_NAME=
     APP_RUN=
-    # Store any parsed additional arguments e.g. decomposeParDict
-    APP_PARARGS=
     LOG_IGNORE=false
     LOG_APPEND=false
     LOG_SUFFIX=
+
+    # Store any parsed additional arguments e.g. decomposeParDict
+    APP_PARARGS=
     # Check the default decomposeParDict if available
-    nProcs=$(getNumberOfProcessors "system/decomposeParDict")
+    nProcs=$(getNumberOfProcessors system/decomposeParDict)
 
     # Parse options and executable
-    while [ $# -gt 0 ] && [ -z "$APP_RUN" ] ; do
+    while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
         key="$1"
         case "$key" in
             -append|-a)
@@ -144,7 +143,7 @@ runParallel()
         shift
     done
 
-    if [ -f log.$SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
+    if [ -f log.$LOG_SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
     then
         echo "$APP_NAME already run on $PWD:" \
              "remove log file 'log.$LOG_SUFFIX' to re-run"
@@ -166,7 +165,7 @@ compileApplication()
 
 cloneCase()
 {
-    if [ -d $2 ]
+    if [ -d "$2" ]
     then
         echo "Case already cloned: remove case directory $2 to clone"
     else
@@ -175,9 +174,35 @@ cloneCase()
         cpfiles="0 system constant"
         for f in $cpfiles
         do
-            cp -r $1/$f $2
+            \cp -r $1/$f $2
         done
     fi
 }
 
+# Overwrite 0/ with the contents of 0.org/ if it exists.
+# The -processor option to do the processor directories instead
+#
+restore0Dir()
+{
+    if [ "$1" = "-processor" ]
+    then
+        echo "Restore 0/ from 0.org/ for processor directories"
+        [ -d 0.org ] || echo "    Warning: no 0.org/ found"
+
+        # do nonetheless
+        \ls -d processor* | xargs -I {} \rm -rf ./{}/0
+        \ls -d processor* | xargs -I {} \cp -r 0.org ./{}/0 > /dev/null 2>&1
+
+    else
+        echo "Restore 0/ from 0.org/"
+        if [ -d 0.org ]
+        then
+            \rm -rf 0
+            \cp -r 0.org 0 > /dev/null 2>&1
+        else
+            echo "    Warning: no 0.org/ found"
+        fi
+    fi
+}
+
 #------------------------------------------------------------------------------
diff --git a/doc/Doxygen/css/doxyMod.css b/doc/Doxygen/css/doxyMod.css
index 46ac2dfc5e4241e51e5230294d5864a4e2262aec..fbb968f594d09fd08af48e1686347e20f542bbc8 100644
--- a/doc/Doxygen/css/doxyMod.css
+++ b/doc/Doxygen/css/doxyMod.css
@@ -118,6 +118,8 @@ tr.memlist
 .OFPlainTable tr td {
     height: 20px;
     padding-left: 5px;
+}
+
 div.line,
 span.comment,
 span.keyword,
diff --git a/etc/bashrc b/etc/bashrc
index 83df1cbb9ede08410f7d2df0e1dae5afc67c4812..d608451300fb93a039b73f011a232d3b2cbd3cd3 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -180,6 +180,7 @@ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/ensight`
 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/gperftools`
 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/CGAL`
 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch`
+_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/FFTW`
 
 
 # Clean environment paths again. Only remove duplicates
diff --git a/etc/config.csh/CGAL b/etc/config.csh/CGAL
index 5371099a251cd595f4446c04eac57303564cc73c..2fd06120eb67550b22e6a5ad752a89238c22abc8 100644
--- a/etc/config.csh/CGAL
+++ b/etc/config.csh/CGAL
@@ -50,7 +50,7 @@
 #
 #------------------------------------------------------------------------------
 
-set boost_version=boost-system
+set boost_version=boost_1_61_0
 set cgal_version=CGAL-4.8
 
 setenv BOOST_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version
diff --git a/etc/config.csh/FFTW b/etc/config.csh/FFTW
new file mode 100644
index 0000000000000000000000000000000000000000..78d24e17b10babd88ffaa80f18a058c0dd157a8a
--- /dev/null
+++ b/etc/config.csh/FFTW
@@ -0,0 +1,71 @@
+#----------------------------------*-sh-*--------------------------------------
+# =========                 |
+# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+#  \\    /   O peration     |
+#   \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+#    \\/     M anipulation  |
+#------------------------------------------------------------------------------
+# License
+#     This file is part of OpenFOAM.
+#
+#     OpenFOAM is free software: you can redistribute it and/or modify it
+#     under the terms of the GNU General Public License as published by
+#     the Free Software Foundation, either version 3 of the License, or
+#     (at your option) any later version.
+#
+#     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+#     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+#     for more details.
+#
+#     You should have received a copy of the GNU General Public License
+#     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+#
+# File
+#     etc/config.sh/FFTW
+#
+# Description
+#     Setup file for FFTW include/libraries.
+#     Sourced from OpenFOAM-<VERSION>/etc/cshrc
+#
+#     If using system-wide installations, use the following settings:
+#
+#         fftw_version=fftw-system
+#
+#     If the system fftw is unusable (eg, too old) and you don't
+#     have or want a ThirdParty installation:
+#
+#         fftw_version=fftw-none
+#
+#     If using a central installation, but not located under ThirdParty:
+#         - specify fftw-system
+#         - provide full paths for FFTW_ARCH_PATH
+#
+# Note
+#     When building OpenFOAM, any changes made here MUST be made in the
+#     equivalent config.sh version too, since that is the one which will
+#     be used during the build process.
+#
+#------------------------------------------------------------------------------
+
+set fftw_version=fftw-3.3.4
+
+setenv FFTW_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$fftw_version
+
+#------------------------------------------------------------------------------
+if ($?FOAM_VERBOSE && $?prompt) then
+    echo "Using fftw ($fftw_version)  ->  $FFTW_ARCH_PATH"
+endif
+
+# If FFTW_ARCH_PATH does not end with '-system' or '-none',
+# it is either located within ThirdParty, or a central installation
+# outside of ThirdParty and must be added to the lib-path.
+
+set ending="${FFTW_ARCH_PATH:t}"
+if ( "$ending" != "fftw-none" && "$ending" != "fftw-system" ) then
+    _foamAddLib $FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
+endif
+
+unset fftw_version ending
+
+#------------------------------------------------------------------------------
diff --git a/etc/config.csh/compiler b/etc/config.csh/compiler
index 6c457e763a960b0bdbf7cc3d83be7d2714771b14..3e28c20b71ebe793ccecd994646a1e551afa510a 100644
--- a/etc/config.csh/compiler
+++ b/etc/config.csh/compiler
@@ -71,9 +71,6 @@ case ThirdParty:
         set gcc_version=gcc-6.1.0
         breaksw
     case Clang:
-        # Using clang - not gcc
-        setenv WM_CC 'clang'
-        setenv WM_CXX 'clang++'
         set clang_version=llvm-3.7.0
         # set clang_version=llvm-3.8.0
         breaksw
@@ -87,4 +84,13 @@ case ThirdParty:
     endsw
 endsw
 
+# common settings (system or ThirdParty)
+switch ("$WM_COMPILER")
+case Clang:
+    # Using clang - not gcc
+    setenv WM_CC 'clang'
+    setenv WM_CXX 'clang++'
+    breaksw
+endsw
+
 #------------------------------------------------------------------------------
diff --git a/etc/config.csh/settings b/etc/config.csh/settings
index ed6227d58dec0ecdc33b518663f1f2e6b572ca0b..892f28fa370bae870393c6ca00fad826642c9b22 100644
--- a/etc/config.csh/settings
+++ b/etc/config.csh/settings
@@ -208,7 +208,7 @@ unsetenv GMP_ARCH_PATH MPFR_ARCH_PATH
 # Location of compiler installation
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 if ( ! $?WM_COMPILER_TYPE ) then
-    set WM_COMPILER_TYPE=system
+    setenv WM_COMPILER_TYPE system
     echo "Warning in $WM_PROJECT_DIR/etc/config.csh/settings:"
     echo "    WM_COMPILER_TYPE not set, using '$WM_COMPILER_TYPE'"
 endif
@@ -253,26 +253,21 @@ case ThirdParty:
         # Add ThirdParty gmp/mpfr/mpc libraries to run-time environment
         if ( "${gmpDir:t}" != "gmp-system" ) then
             _foamAddLib $gmpDir/lib$WM_COMPILER_LIB_ARCH
+            setenv GMP_ARCH_PATH $gmpDir        # For ThirdParty CGAL
         endif
         if ( "${mpfrDir:t}" != "mpfr-system" ) then
             _foamAddLib $mpfrDir/lib$WM_COMPILER_LIB_ARCH
+            setenv MPFR_ARCH_PATH $mpfrDir      # For ThirdParty CGAL
         endif
         if ( "${mpcDir:t}" != "mpc-system" ) then
             _foamAddLib $mpcDir/lib$WM_COMPILER_LIB_ARCH
         endif
 
-        # Used by boost/CGAL:
-        setenv GMP_ARCH_PATH $gmpDir
-        setenv MPFR_ARCH_PATH $mpfrDir
-
         if ($?FOAM_VERBOSE && $?prompt) then
             echo "Using ThirdParty compiler"
             echo "    ${gccDir:t} (${gmpDir:t} ${mpfrDir:t} ${mpcDir:t})"
         endif
     endif
-    unset gcc_version gccDir
-    unset gmp_version gmpDir  mpfr_version mpfrDir  mpc_version mpcDir
-
     if ( $?clang_version ) then
         set clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version
 
@@ -295,6 +290,9 @@ case ThirdParty:
             echo "    ${clangDir:t}"
         endif
     endif
+
+    unset gcc_version gccDir
+    unset gmp_version gmpDir  mpfr_version mpfrDir  mpc_version mpcDir
     unset clang_version clangDir
     breaksw
 
@@ -308,6 +306,5 @@ endsw
 # Cleanup environment:
 # ~~~~~~~~~~~~~~~~~~~~
 #- keep _foamAddPath _foamAddLib _foamAddMan
-unsetenv WM_COMPILER_TYPE
 
 #------------------------------------------------------------------------------
diff --git a/etc/config.csh/unset b/etc/config.csh/unset
index c076d82e12e4fe4991950468ebccb9ad978219df..c9b59a7345702e1968d6b28773b385998cd19ba1 100644
--- a/etc/config.csh/unset
+++ b/etc/config.csh/unset
@@ -64,6 +64,7 @@ unsetenv WM_ARCH_OPTION
 unsetenv WM_CC
 unsetenv WM_CFLAGS
 unsetenv WM_COMPILER
+unsetenv WM_COMPILER_ARCH
 unsetenv WM_COMPILER_LIB_ARCH
 unsetenv WM_COMPILE_OPTION
 unsetenv WM_CXX
@@ -128,6 +129,16 @@ unsetenv ParaView_DIR
 unsetenv ParaView_INCLUDE_DIR
 unsetenv PV_PLUGIN_PATH
 
+#------------------------------------------------------------------------------
+# unset other ThirdParty environment variables
+
+unsetenv BOOST_ARCH_PATH
+unsetenv CCMIO_ARCH_PATH
+unsetenv CGAL_ARCH_PATH
+unsetenv FFTW_ARCH_PATH
+unsetenv GMP_ARCH_PATH
+unsetenv MPFR_ARCH_PATH
+unsetenv SCOTCH_ARCH_PATH
 
 #------------------------------------------------------------------------------
 # cleanup environment
diff --git a/etc/config.sh/CGAL b/etc/config.sh/CGAL
index afb178d709f1813ef172905e6bec59d1e5b66503..e23164d2c920402a636f6921a2500c5f89461434 100644
--- a/etc/config.sh/CGAL
+++ b/etc/config.sh/CGAL
@@ -49,7 +49,7 @@
 #         - the LD_LIBRARY_PATH is not adjusted.
 #------------------------------------------------------------------------------
 
-boost_version=boost-system
+boost_version=boost_1_61_0
 cgal_version=CGAL-4.8
 
 export BOOST_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version
diff --git a/etc/config.sh/FFTW b/etc/config.sh/FFTW
new file mode 100644
index 0000000000000000000000000000000000000000..f3cb4ea70ee775ef7e4da0f1800c00833e099f6a
--- /dev/null
+++ b/etc/config.sh/FFTW
@@ -0,0 +1,77 @@
+#----------------------------------*-sh-*--------------------------------------
+# =========                 |
+# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+#  \\    /   O peration     |
+#   \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+#    \\/     M anipulation  |
+#------------------------------------------------------------------------------
+# License
+#     This file is part of OpenFOAM.
+#
+#     OpenFOAM is free software: you can redistribute it and/or modify it
+#     under the terms of the GNU General Public License as published by
+#     the Free Software Foundation, either version 3 of the License, or
+#     (at your option) any later version.
+#
+#     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+#     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+#     for more details.
+#
+#     You should have received a copy of the GNU General Public License
+#     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+#
+# File
+#     etc/config.sh/FFTW
+#
+# Description
+#     Setup file for FFTW include/libraries.
+#     Sourced from OpenFOAM-<VERSION>/etc/bashrc
+#
+#     If using system-wide installations, use the following settings:
+#
+#         fftw_version=fftw-system
+#
+#     If the system fftw is unusable (eg, too old) and you don't
+#     have or want a ThirdParty installation:
+#
+#         fftw_version=fftw-none
+#
+#     If using a central installation, but not located under ThirdParty:
+#         - specify fftw-system
+#         - provide full paths for FFTW_ARCH_PATH
+#
+# Note
+#     When _foamAddLib is unset (eg, called from makeFFTW):
+#         - fftw_version variable is retained.
+#         - the LD_LIBRARY_PATH is not adjusted.
+#------------------------------------------------------------------------------
+
+fftw_version=fftw-3.3.4
+
+export FFTW_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$fftw_version
+
+#------------------------------------------------------------------------------
+if [ "$FOAM_VERBOSE" -a "$PS1" ]
+then
+    echo "Using fftw ($fftw_version)  ->  $FFTW_ARCH_PATH" 1>&2
+fi
+
+if type _foamAddLib > /dev/null 2>&1    # normal sourcing
+then
+
+    # If FFTW_ARCH_PATH does not end with '-system' or '-none',
+    # it is either located within ThirdParty, or a central installation
+    # outside of ThirdParty and must be added to the lib-path.
+
+    ending="${FFTW_ARCH_PATH##*-}"
+    if [ "$ending" != none -a "$ending" != system ]
+    then
+        _foamAddLib $FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
+    fi
+
+    unset fftw_version ending
+
+fi
+
+#------------------------------------------------------------------------------
diff --git a/etc/config.sh/libccmio b/etc/config.sh/ccmio
similarity index 98%
rename from etc/config.sh/libccmio
rename to etc/config.sh/ccmio
index 1ef420564042ea7555e4175a281bcf6d3fd5fb90..6bd6aa42aca28f02677428a2aadbde5bcbd51ce2 100644
--- a/etc/config.sh/libccmio
+++ b/etc/config.sh/ccmio
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     etc/config.sh/libccmio
+#     etc/config.sh/ccmio
 #
 # Description
 #     Setup file for libccmio include/libraries.
diff --git a/etc/config.sh/compiler b/etc/config.sh/compiler
index 876fe2b7fba9c3b90ad58b908d9983cb12a20385..0e577e1426920fda3f9c714d6bfd72dbe9964b7e 100644
--- a/etc/config.sh/compiler
+++ b/etc/config.sh/compiler
@@ -69,9 +69,6 @@ OpenFOAM | ThirdParty)
         gcc_version=gcc-6.1.0
         ;;
     Clang)
-        # Using clang - not gcc
-        export WM_CC='clang'
-        export WM_CXX='clang++'
         clang_version=llvm-3.7.0
         # clang_version=llvm-3.8.0
         ;;
@@ -84,7 +81,15 @@ OpenFOAM | ThirdParty)
         ;;
     esac
     ;;
+esac
 
+# common settings (system or ThirdParty)
+case "$WM_COMPILER" in
+Clang)
+    # Using clang - not gcc
+    export WM_CC='clang'
+    export WM_CXX='clang++'
+    ;;
 esac
 
 #------------------------------------------------------------------------------
diff --git a/etc/config.sh/functions b/etc/config.sh/functions
index dcec6549d474c5ac2eaeb6a943dd24c18162c8f0..026755edc4f3e16a695779dac3e0051e7e93ba35 100644
--- a/etc/config.sh/functions
+++ b/etc/config.sh/functions
@@ -116,7 +116,7 @@ else
     # Cleanup environment:
     # ~~~~~~~~~~~~~~~~~~~~
     unset WM_BASH_FUNCTIONS
-    unset _foamAddPath _foamAddLib _foamAddMan
-    unset _foamSource _foamEval
+    unset -f _foamAddPath _foamAddLib _foamAddMan
+    unset -f _foamSource _foamEval
 
 fi
diff --git a/etc/config.sh/settings b/etc/config.sh/settings
index 53cb221e0002f6d9739dbcbef1621cf2666f0513..6b0d6021381e786407c4a2615453b4b60b76db1b 100644
--- a/etc/config.sh/settings
+++ b/etc/config.sh/settings
@@ -246,28 +246,24 @@ OpenFOAM | ThirdParty)
         if [ "${gmpDir##*-}" != system ]
         then
             _foamAddLib $gmpDir/lib$WM_COMPILER_LIB_ARCH
+            export GMP_ARCH_PATH=$gmpDir        # For ThirdParty CGAL
         fi
         if [ "${mpfrDir##*-}" != system ]
         then
             _foamAddLib $mpfrDir/lib$WM_COMPILER_LIB_ARCH
+            export MPFR_ARCH_PATH=$mpfrDir      # For ThirdParty CGAL
         fi
         if [ "${mpcDir##*-}" != system ]
         then
             _foamAddLib $mpcDir/lib$WM_COMPILER_LIB_ARCH
         fi
 
-        # Used by boost/CGAL:
-        export GMP_ARCH_PATH=$gmpDir
-        export MPFR_ARCH_PATH=$mpfrDir
-
         if [ "$FOAM_VERBOSE" -a "$PS1" ]
         then
             echo "Using ThirdParty compiler"
             echo "    ${gccDir##*/}  (${gmpDir##*/}  $${mpfrDir##*/}  ${mpcDir##*/})"
         fi
     fi
-    unset gcc_version gccDir
-    unset gmp_version gmpDir  mpfr_version mpfrDir  mpc_version mpcDir
 
     if [ -n "$clang_version" ]
     then
@@ -293,6 +289,9 @@ OpenFOAM | ThirdParty)
             echo "    ${clangDir##*/}"
         fi
     fi
+
+    unset gcc_version gccDir
+    unset gmp_version gmpDir  mpfr_version mpfrDir  mpc_version mpcDir
     unset clang_version clangDir
     ;;
 *)
diff --git a/etc/config.sh/unset b/etc/config.sh/unset
index 7a8ee309a9250cb089e95fffce0639ec567d4d76..b9a4d16e03a45fc7ecb30f09b6de77a42b1d69af 100644
--- a/etc/config.sh/unset
+++ b/etc/config.sh/unset
@@ -51,6 +51,7 @@ unset WM_ARCH_OPTION
 unset WM_CC
 unset WM_CFLAGS
 unset WM_COMPILER
+unset WM_COMPILER_ARCH
 unset WM_COMPILER_LIB_ARCH
 unset WM_COMPILE_OPTION
 unset WM_CXX
@@ -115,6 +116,16 @@ unset ParaView_DIR
 unset ParaView_INCLUDE_DIR
 unset PV_PLUGIN_PATH
 
+#------------------------------------------------------------------------------
+# unset other ThirdParty environment variables
+
+unset BOOST_ARCH_PATH
+unset CCMIO_ARCH_PATH
+unset CGAL_ARCH_PATH
+unset FFTW_ARCH_PATH
+unset GMP_ARCH_PATH
+unset MPFR_ARCH_PATH
+unset SCOTCH_ARCH_PATH
 
 #------------------------------------------------------------------------------
 # cleanup environment
diff --git a/etc/cshrc b/etc/cshrc
index 30138fdb366f9a96c95937a263101f5b7a16702a..099662b296d71ca61c3826f8b2a16ce5226936ec 100644
--- a/etc/cshrc
+++ b/etc/cshrc
@@ -211,6 +211,7 @@ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/mpi`
 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/paraview`
 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/ensight`
 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/CGAL`
+_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/FFTW`
 
 
 # Clean environment paths again. Only remove duplicates
diff --git a/src/Allwmake b/src/Allwmake
index e07067fb6651de95cca646b2370beeb7267938be..93d82fcd91765d61d33628bfe281f3b50e8e72ca 100755
--- a/src/Allwmake
+++ b/src/Allwmake
@@ -48,7 +48,7 @@ wmake $targetType lagrangian/basic
 wmake $targetType lagrangian/distributionModels
 wmake $targetType genericPatchFields
 
-wmake $targetType conversion
+conversion/Allwmake $targetType $*
 wmake $targetType mesh/extrudeModel
 wmake $targetType dynamicMesh
 wmake $targetType dynamicFvMesh
@@ -58,10 +58,9 @@ wmake $targetType sampling
 
 # Compile scotchDecomp, metisDecomp etc.
 parallel/Allwmake $targetType $*
+randomProcesses/Allwmake $targetType $*
 
 wmake $targetType ODE
-wmake $targetType randomProcesses
-
 wmake $targetType fvMotionSolver
 
 transportModels/Allwmake $targetType $*
diff --git a/src/ODE/ODESolvers/Euler/Euler.H b/src/ODE/ODESolvers/Euler/Euler.H
index fecfc57fa03bc9c73a19c37c08bd22f8fa57804d..228bbdea6d9dd63fffe4cd5632e9a115db8380b9 100644
--- a/src/ODE/ODESolvers/Euler/Euler.H
+++ b/src/ODE/ODESolvers/Euler/Euler.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::Euler
 
+Group
+    grpODESolvers
+
 Description
     Euler ODE solver of order (0)1.
 
diff --git a/src/ODE/ODESolvers/EulerSI/EulerSI.H b/src/ODE/ODESolvers/EulerSI/EulerSI.H
index a6703cc20c7e61ed85f84da530e74aacc1981a19..c9776d97134281be1444d0e4824986062eb397bd 100644
--- a/src/ODE/ODESolvers/EulerSI/EulerSI.H
+++ b/src/ODE/ODESolvers/EulerSI/EulerSI.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::EulerSI
 
+Group
+    grpODESolvers
+
 Description
     Semi-implicit Euler ODE solver of order (0)1.
 
diff --git a/src/ODE/ODESolvers/ODESolver/ODESolver.H b/src/ODE/ODESolvers/ODESolver/ODESolver.H
index de4ef399f89cfee927dd7eec2496e96452f7e6f7..5d9cd4a70baad9e7485392950c3208a10bc3dbc7 100644
--- a/src/ODE/ODESolvers/ODESolver/ODESolver.H
+++ b/src/ODE/ODESolvers/ODESolver/ODESolver.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::ODESolver
 
+Group
+    grpODESolvers
+
 Description
     Abstract base-class for ODE system solvers
 
diff --git a/src/ODE/ODESolvers/RKCK45/RKCK45.H b/src/ODE/ODESolvers/RKCK45/RKCK45.H
index c376a5f423f491013f81dc7a60b202a3e17f9f22..3a315237d262f580c1dc16190d7cfbb9446d1dd1 100644
--- a/src/ODE/ODESolvers/RKCK45/RKCK45.H
+++ b/src/ODE/ODESolvers/RKCK45/RKCK45.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RKCK45
 
+Group
+    grpODESolvers
+
 Description
     4/5th Order Cash-Karp Runge-Kutta ODE solver.
 
diff --git a/src/ODE/ODESolvers/RKDP45/RKDP45.H b/src/ODE/ODESolvers/RKDP45/RKDP45.H
index b3f5c7bca4ae0a8d36396c31039c5e43a714bea2..f5f783592fbef16b8afd18adadf1fc27ae6df08f 100644
--- a/src/ODE/ODESolvers/RKDP45/RKDP45.H
+++ b/src/ODE/ODESolvers/RKDP45/RKDP45.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RKDP45
 
+Group
+    grpODESolvers
+
 Description
     4/5th Order Dormand–Prince Runge-Kutta ODE solver.
 
diff --git a/src/ODE/ODESolvers/RKF45/RKF45.H b/src/ODE/ODESolvers/RKF45/RKF45.H
index 5198d5553f214c847eea1a645f2fa3777d5833f4..735fe5e12eb86eba2fe75bf503fca2813306c6e7 100644
--- a/src/ODE/ODESolvers/RKF45/RKF45.H
+++ b/src/ODE/ODESolvers/RKF45/RKF45.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RKF45
 
+Group
+    grpODESolvers
+
 Description
     4/5th Order Runge-Kutta-Fehlberg ODE solver
 
diff --git a/src/ODE/ODESolvers/Rosenbrock12/Rosenbrock12.H b/src/ODE/ODESolvers/Rosenbrock12/Rosenbrock12.H
index b0bf1c79efffd9bb9cc437960d8e997f88c9ab1a..318091b6b85ba8bc42b530279ffbdeaaa96bfc26 100644
--- a/src/ODE/ODESolvers/Rosenbrock12/Rosenbrock12.H
+++ b/src/ODE/ODESolvers/Rosenbrock12/Rosenbrock12.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::Rosenbrock12
 
+Group
+    grpODESolvers
+
 Description
     L-stable embedded Rosenbrock ODE solver of order (1)2.
 
diff --git a/src/ODE/ODESolvers/Rosenbrock23/Rosenbrock23.H b/src/ODE/ODESolvers/Rosenbrock23/Rosenbrock23.H
index 38541a7c99c422143ecb478e4fddff41aee6b23a..ff97cf10c780233bcc651d0cdaddbf81c4cc2d6c 100644
--- a/src/ODE/ODESolvers/Rosenbrock23/Rosenbrock23.H
+++ b/src/ODE/ODESolvers/Rosenbrock23/Rosenbrock23.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::Rosenbrock23
 
+Group
+    grpODESolvers
+
 Description
     L-stable embedded Rosenbrock ODE solver of order (2)3.
 
diff --git a/src/ODE/ODESolvers/Rosenbrock34/Rosenbrock34.H b/src/ODE/ODESolvers/Rosenbrock34/Rosenbrock34.H
index 2af18e5d409d4b8d568897d452451b18d69804e8..9d57979a460836d24c953d61f8fbdfbca7532067 100644
--- a/src/ODE/ODESolvers/Rosenbrock34/Rosenbrock34.H
+++ b/src/ODE/ODESolvers/Rosenbrock34/Rosenbrock34.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::Rosenbrock34
 
+Group
+    grpODESolvers
+
 Description
     L-stable embedded Rosenbrock ODE solver of order (3)4.
 
diff --git a/src/ODE/ODESolvers/SIBS/SIBS.H b/src/ODE/ODESolvers/SIBS/SIBS.H
index 0ef0a1d40cd61783d49231085ba3aa82863d5ccb..83e5385c29574d9c3290b14e290f13ade7e60b6c 100644
--- a/src/ODE/ODESolvers/SIBS/SIBS.H
+++ b/src/ODE/ODESolvers/SIBS/SIBS.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::SIBS
 
+Group
+    grpODESolvers
+
 Description
     Foam::SIBS
 
diff --git a/src/ODE/ODESolvers/Trapezoid/Trapezoid.H b/src/ODE/ODESolvers/Trapezoid/Trapezoid.H
index 667b6ee2adc517fcb51d576df2e13527951432a3..1f1c5e667482dfa7d8595e3ba0f1e10da09e2de0 100644
--- a/src/ODE/ODESolvers/Trapezoid/Trapezoid.H
+++ b/src/ODE/ODESolvers/Trapezoid/Trapezoid.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::Trapezoid
 
+Group
+    grpODESolvers
+
 Description
     Trapezoidal ODE solver of order (1)2.
 
diff --git a/src/ODE/ODESolvers/adaptiveSolver/adaptiveSolver.H b/src/ODE/ODESolvers/adaptiveSolver/adaptiveSolver.H
index 0d7dcb035c2c312ceb3d383bc2fc8e24cd19ced9..141ec9bb7a6099bda155ba7cc7b86daf77c568f5 100644
--- a/src/ODE/ODESolvers/adaptiveSolver/adaptiveSolver.H
+++ b/src/ODE/ODESolvers/adaptiveSolver/adaptiveSolver.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::adaptiveSolver
 
+Group
+    grpODESolvers
+
 Description
 
 SourceFiles
diff --git a/src/ODE/ODESolvers/rodas23/rodas23.H b/src/ODE/ODESolvers/rodas23/rodas23.H
index 75f0262813b5d2d2aa3606c005a36ac6fb84b93a..60d6eda44662fbbbba251f3e938db5ed5d221031 100644
--- a/src/ODE/ODESolvers/rodas23/rodas23.H
+++ b/src/ODE/ODESolvers/rodas23/rodas23.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::rodas23
 
+Group
+    grpODESolvers
+
 Description
     L-stable, stiffly-accurate embedded Rosenbrock ODE solver of order (2)3.
 
diff --git a/src/ODE/ODESolvers/rodas34/rodas34.H b/src/ODE/ODESolvers/rodas34/rodas34.H
index 35cb468f6a4bfc70840c003dcd97cae51df94381..87051184db2c19e17cb88e0ae999d405e4fcf9f5 100644
--- a/src/ODE/ODESolvers/rodas34/rodas34.H
+++ b/src/ODE/ODESolvers/rodas34/rodas34.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::rodas34
 
+Group
+    grpODESolvers
+
 Description
     L-stable, stiffly-accurate embedded Rosenbrock ODE solver of order (3)4.
 
diff --git a/src/ODE/ODESolvers/seulex/seulex.H b/src/ODE/ODESolvers/seulex/seulex.H
index c3cd5401983bd100a4c6b967ffa41dc1ffa161e1..224ccc6f90641411dc4f9f9253a937b573c0fce5 100644
--- a/src/ODE/ODESolvers/seulex/seulex.H
+++ b/src/ODE/ODESolvers/seulex/seulex.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::seulex
 
+Group
+    grpODESolvers
+
 Description
     An extrapolation-algorithm, based on the linearly implicit Euler method
     with step size control and order selection.
diff --git a/src/ODE/doc/ODEDoc.H b/src/ODE/doc/ODEDoc.H
new file mode 100644
index 0000000000000000000000000000000000000000..bd293c58239c661a35dc1d26017b4d33d6c905bf
--- /dev/null
+++ b/src/ODE/doc/ODEDoc.H
@@ -0,0 +1,32 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it under
+    the terms of the GNU General Public License as published by the Free
+    Software Foundation, either version 3 of the License, or (at your option)
+    any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+    details.
+
+    You should have received a copy of the GNU General Public License along with
+    OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+\defgroup grpODESolvers Ordinary Differential Equation (ODE) solvers
+@{
+    \ingroup grpNumerics
+    This group contains ODE solvers
+@}
+
+\*---------------------------------------------------------------------------*/
diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C
index 0b9a541d94083d0aa63f2b5641b300ae5ef64762..a9d19eecce4583bd0531593073144bc3f1d3fdea 100644
--- a/src/OSspecific/POSIX/POSIX.C
+++ b/src/OSspecific/POSIX/POSIX.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -38,6 +38,8 @@ Description
 #include "timer.H"
 #include "IFstream.H"
 #include "DynamicList.H"
+#include "CStringList.H"
+#include "SubList.H"
 
 #include <fstream>
 #include <cstdlib>
@@ -49,6 +51,7 @@ Description
 #include <pwd.h>
 #include <errno.h>
 #include <sys/types.h>
+#include <sys/wait.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
 #include <netdb.h>
@@ -593,9 +596,9 @@ bool Foam::chMod(const fileName& name, const mode_t m)
 }
 
 
-mode_t Foam::mode(const fileName& name)
+mode_t Foam::mode(const fileName& name, const bool followLink)
 {
-    fileStat fileStatus(name);
+    fileStat fileStatus(name, followLink);
     if (fileStatus.isValid())
     {
         return fileStatus.status().st_mode;
@@ -607,14 +610,18 @@ mode_t Foam::mode(const fileName& name)
 }
 
 
-Foam::fileName::Type Foam::type(const fileName& name)
+Foam::fileName::Type Foam::type(const fileName& name, const bool followLink)
 {
-    mode_t m = mode(name);
+    mode_t m = mode(name, followLink);
 
     if (S_ISREG(m))
     {
         return fileName::FILE;
     }
+    else if (S_ISLNK(m))
+    {
+        return fileName::LINK;
+    }
     else if (S_ISDIR(m))
     {
         return fileName::DIRECTORY;
@@ -626,27 +633,39 @@ Foam::fileName::Type Foam::type(const fileName& name)
 }
 
 
-bool Foam::exists(const fileName& name, const bool checkGzip)
+bool Foam::exists
+(
+    const fileName& name,
+    const bool checkGzip,
+    const bool followLink
+)
 {
-    return mode(name) || isFile(name, checkGzip);
+    return mode(name, followLink) || isFile(name, checkGzip, followLink);
 }
 
 
-bool Foam::isDir(const fileName& name)
+bool Foam::isDir(const fileName& name, const bool followLink)
 {
-    return S_ISDIR(mode(name));
+    return S_ISDIR(mode(name, followLink));
 }
 
 
-bool Foam::isFile(const fileName& name, const bool checkGzip)
+bool Foam::isFile
+(
+    const fileName& name,
+    const bool checkGzip,
+    const bool followLink
+)
 {
-    return S_ISREG(mode(name)) || (checkGzip && S_ISREG(mode(name + ".gz")));
+    return
+        S_ISREG(mode(name, followLink))
+     || (checkGzip && S_ISREG(mode(name + ".gz", followLink)));
 }
 
 
-off_t Foam::fileSize(const fileName& name)
+off_t Foam::fileSize(const fileName& name, const bool followLink)
 {
-    fileStat fileStatus(name);
+    fileStat fileStatus(name, followLink);
     if (fileStatus.isValid())
     {
         return fileStatus.status().st_size;
@@ -658,9 +677,9 @@ off_t Foam::fileSize(const fileName& name)
 }
 
 
-time_t Foam::lastModified(const fileName& name)
+time_t Foam::lastModified(const fileName& name, const bool followLink)
 {
-    fileStat fileStatus(name);
+    fileStat fileStatus(name, followLink);
     if (fileStatus.isValid())
     {
         return fileStatus.status().st_mtime;
@@ -676,7 +695,8 @@ Foam::fileNameList Foam::readDir
 (
     const fileName& directory,
     const fileName::Type type,
-    const bool filtergz
+    const bool filtergz,
+    const bool followLink
 )
 {
     // Initial filename list size
@@ -717,10 +737,10 @@ Foam::fileNameList Foam::readDir
         {
             fileName fName(list->d_name);
 
-            // ignore files begining with ., i.e. '.', '..' and '.*'
+            // ignore files beginning with ., i.e. '.', '..' and '.*'
             if (fName.size() && fName[0] != '.')
             {
-                word fExt = fName.ext();
+                const word fExt = fName.ext();
 
                 if
                 (
@@ -736,7 +756,7 @@ Foam::fileNameList Foam::readDir
                     )
                 )
                 {
-                    if ((directory/fName).type() == type)
+                    if ((directory/fName).type(followLink) == type)
                     {
                         if (nEntries >= dirEntries.size())
                         {
@@ -766,7 +786,7 @@ Foam::fileNameList Foam::readDir
 }
 
 
-bool Foam::cp(const fileName& src, const fileName& dest)
+bool Foam::cp(const fileName& src, const fileName& dest, const bool followLink)
 {
     // Make sure source exists.
     if (!exists(src))
@@ -777,7 +797,8 @@ bool Foam::cp(const fileName& src, const fileName& dest)
     fileName destFile(dest);
 
     // Check type of source file.
-    if (src.type() == fileName::FILE)
+    const fileName::Type srcType = src.type(followLink);
+    if (srcType == fileName::FILE)
     {
         // If dest is a directory, create the destination file name.
         if (destFile.type() == fileName::DIRECTORY)
@@ -817,7 +838,23 @@ bool Foam::cp(const fileName& src, const fileName& dest)
             return false;
         }
     }
-    else if (src.type() == fileName::DIRECTORY)
+    else if (srcType == fileName::LINK)
+    {
+        // If dest is a directory, create the destination file name.
+        if (destFile.type() == fileName::DIRECTORY)
+        {
+            destFile = destFile/src.name();
+        }
+
+        // Make sure the destination directory exists.
+        if (!isDir(destFile.path()) && !mkDir(destFile.path()))
+        {
+            return false;
+        }
+
+        ln(src, destFile);
+    }
+    else if (srcType == fileName::DIRECTORY)
     {
         // If dest is a directory, create the destination file name.
         if (destFile.type() == fileName::DIRECTORY)
@@ -832,7 +869,7 @@ bool Foam::cp(const fileName& src, const fileName& dest)
         }
 
         // Copy files
-        fileNameList contents = readDir(src, fileName::FILE, false);
+        fileNameList contents = readDir(src, fileName::FILE, false, followLink);
         forAll(contents, i)
         {
             if (POSIX::debug)
@@ -843,11 +880,17 @@ bool Foam::cp(const fileName& src, const fileName& dest)
             }
 
             // File to file.
-            cp(src/contents[i], destFile/contents[i]);
+            cp(src/contents[i], destFile/contents[i], followLink);
         }
 
         // Copy sub directories.
-        fileNameList subdirs = readDir(src, fileName::DIRECTORY);
+        fileNameList subdirs = readDir
+        (
+            src,
+            fileName::DIRECTORY,
+            false,
+            followLink
+        );
         forAll(subdirs, i)
         {
             if (POSIX::debug)
@@ -858,9 +901,13 @@ bool Foam::cp(const fileName& src, const fileName& dest)
             }
 
             // Dir to Dir.
-            cp(src/subdirs[i], destFile);
+            cp(src/subdirs[i], destFile, followLink);
         }
     }
+    else
+    {
+        return false;
+    }
 
     return true;
 }
@@ -903,7 +950,7 @@ bool Foam::ln(const fileName& src, const fileName& dst)
 }
 
 
-bool Foam::mv(const fileName& src, const fileName& dst)
+bool Foam::mv(const fileName& src, const fileName& dst, const bool followLink)
 {
     if (POSIX::debug)
     {
@@ -914,7 +961,7 @@ bool Foam::mv(const fileName& src, const fileName& dst)
     if
     (
         dst.type() == fileName::DIRECTORY
-     && src.type() != fileName::DIRECTORY
+     && src.type(followLink) != fileName::DIRECTORY
     )
     {
         const fileName dstName(dst/src.name());
@@ -1016,7 +1063,7 @@ bool Foam::rmDir(const fileName& directory)
             {
                 fileName path = directory/fName;
 
-                if (path.type() == fileName::DIRECTORY)
+                if (path.type(false) == fileName::DIRECTORY)
                 {
                     if (!rmDir(path))
                     {
@@ -1166,9 +1213,153 @@ bool Foam::ping(const string& hostname, const label timeOut)
 }
 
 
+namespace Foam
+{
+//! \cond fileScope
+static int waitpid(const pid_t pid)
+{
+    // child status, return code from the exec etc.
+    int status = 0;
+
+    // in parent - blocking wait
+    // modest treatment of signals (in child)
+    // treat 'stopped' like exit (suspend/continue)
+    while (true)
+    {
+        pid_t wpid = ::waitpid(pid, &status, WUNTRACED);
+
+        if (wpid == -1)
+        {
+            FatalErrorInFunction
+                << "some error occurred in child"
+                << exit(FatalError);
+            break;
+        }
+
+        if (WIFEXITED(status))
+        {
+            // child exited, get its return status
+            return WEXITSTATUS(status);
+        }
+
+        if (WIFSIGNALED(status))
+        {
+            // child terminated by some signal
+            return WTERMSIG(status);
+        }
+
+        if (WIFSTOPPED(status))
+        {
+            // child stopped by some signal
+            return WSTOPSIG(status);
+        }
+
+        FatalErrorInFunction
+            << "programming error, status from waitpid() not handled: "
+            << status
+            << exit(FatalError);
+    }
+
+    return -1;  // should not happen
+}
+//! \endcond
+}
+
+
 int Foam::system(const std::string& command)
 {
-    return ::system(command.c_str());
+    if (command.empty())
+    {
+        // Treat an empty command as a successful no-op.
+        // From 'man sh' POSIX (man sh):
+        //   "If the command_string operand is an empty string,
+        //    sh shall exit with a zero exit status."
+        return 0;
+    }
+
+    pid_t child_pid = ::vfork();   // NB: vfork, not fork!
+    if (child_pid == -1)
+    {
+        FatalErrorInFunction
+            << "vfork() failed for system command " << command
+            << exit(FatalError);
+    }
+
+    if (child_pid == 0)
+    {
+        // in child
+
+        // execl uses the current environ
+        (void) ::execl
+        (
+            "/bin/sh",          // Path of the shell
+            "sh",               // Command-name (name for the shell)
+            "-c",               // Read commands from the command_string operand.
+            command.c_str(),    // Command string
+            reinterpret_cast<char *>(0)
+        );
+
+        // obviously failed, since exec should not return at all
+        FatalErrorInFunction
+            << "exec failed: " << command
+            << exit(FatalError);
+    }
+
+
+    // in parent - blocking wait
+    return waitpid(child_pid);
+}
+
+
+int Foam::system(const Foam::UList<Foam::string>& command)
+{
+    const int argc = command.size();
+
+    if (!argc)
+    {
+        // Treat an empty command as a successful no-op.
+        // For consistency with POSIX (man sh) behaviour for (sh -c command),
+        // which is what is mostly being replicated here.
+        return 0;
+    }
+
+    // NB: use vfork, not fork!
+    // vfork behaves more like a thread and avoids copy-on-write problems
+    // triggered by fork.
+    // The normal system() command has a fork buried in it that causes
+    // issues with infiniband and openmpi etc.
+    pid_t child_pid = ::vfork();
+    if (child_pid == -1)
+    {
+        FatalErrorInFunction
+            << "vfork() failed for system command " << command[0]
+            << exit(FatalError);
+    }
+
+    if (child_pid == 0)
+    {
+        // in child:
+        // Need command and arguments separately.
+        // args is a NULL-terminated list of c-strings
+
+        CStringList args(SubList<string>(command, 0));
+        if (argc > 1)
+        {
+            args.reset(SubList<string>(command, argc-1, 1));
+        }
+
+        // execvp uses the current environ
+        (void) ::execvp(command[0].c_str(), args.strings());
+
+        // obviously failed, since exec should not return at all
+        FatalErrorInFunction
+            << "exec(" << command[0] << ", ...) failed"
+            << exit(FatalError);
+    }
+
+
+    // in parent - blocking wait
+    return waitpid(child_pid);
 }
 
 
diff --git a/src/OSspecific/POSIX/fileStat.C b/src/OSspecific/POSIX/fileStat.C
index 9826983d642d8d09cc5035a35dee4c0ce9ec87bf..f40192f03bc4b4292641877e539dc03a4a50ce6b 100644
--- a/src/OSspecific/POSIX/fileStat.C
+++ b/src/OSspecific/POSIX/fileStat.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -29,6 +29,7 @@ License
 
 #include <signal.h>
 #include <unistd.h>
+#include <sys/sysmacros.h>
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
@@ -38,7 +39,12 @@ Foam::fileStat::fileStat()
 {}
 
 
-Foam::fileStat::fileStat(const fileName& fName, const unsigned int maxTime)
+Foam::fileStat::fileStat
+(
+    const fileName& fName,
+    const bool followLink,
+    const unsigned int maxTime
+)
 {
     // Work on volatile
     volatile bool locIsValid = false;
@@ -47,13 +53,13 @@ Foam::fileStat::fileStat(const fileName& fName, const unsigned int maxTime)
 
     if (!timedOut(myTimer))
     {
-        if (::stat(fName.c_str(), &status_) != 0)
+        if (followLink)
         {
-            locIsValid = false;
+            locIsValid = (::stat(fName.c_str(), &status_) == 0);
         }
         else
         {
-            locIsValid = true;
+            locIsValid = (::lstat(fName.c_str(), &status_) == 0);
         }
     }
 
diff --git a/src/OSspecific/POSIX/fileStat.H b/src/OSspecific/POSIX/fileStat.H
index fe16d20470b1ceb53795c39f8e44c0fc835c9992..634d0f59bd61dc8541135740bfc01a553da02389 100644
--- a/src/OSspecific/POSIX/fileStat.H
+++ b/src/OSspecific/POSIX/fileStat.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -25,7 +25,7 @@ Class
     Foam::fileStat
 
 Description
-    Wrapper for stat() system call.
+    Wrapper for stat() and lstat() system calls.
 
 Warning
     on Linux (an maybe on others) a stat() of an nfs mounted (remote)
@@ -79,8 +79,21 @@ public:
         //- Empty constructor
         fileStat();
 
-        //- Construct from components
-        fileStat(const fileName& fName, const unsigned int maxTime=0);
+        //- Construct from components.
+        // \param fName \n
+        // The file name or directory name to stat.
+        //
+        // \param followLink \n
+        // If it is a link, get the status of the source file/directory.
+        //
+        // \param maxTime \n
+        // The timeout value.
+        fileStat
+        (
+            const fileName& fName,
+            const bool followLink = true,
+            const unsigned int maxTime = 0
+        );
 
         //- Construct from Istream
         fileStat(Istream&);
@@ -96,7 +109,7 @@ public:
                 return status_;
             }
 
-            //- Did constructor fail
+            //- Was file-stat successful?
             bool isValid() const
             {
                 return isValid_;
diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C
index 2480f2dc75ff30b0b71d569791b4704a3b440e42..ada7d06b5bc5df1e0b255187576be016ddb0e175 100644
--- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C
+++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -2535,16 +2535,6 @@ Foam::labelBits Foam::indexedOctree<Type>::findNode
 
     const node& nod = nodes_[nodeI];
 
-    if (debug)
-    {
-        if (!nod.bb_.contains(sample))
-        {
-            FatalErrorInFunction
-                << "Cannot find " << sample << " in node " << nodeI
-                << abort(FatalError);
-        }
-    }
-
     direction octant = nod.bb_.subOctant(sample);
 
     labelBits index = nod.subNodes_[octant];
diff --git a/src/OpenFOAM/containers/NamedEnum/NamedEnum.C b/src/OpenFOAM/containers/NamedEnum/NamedEnum.C
index ba5bd4999dc79a4cf08033c0655beeea8657f5ac..99f723d987f70096c3962c70589d1938bf06dfb5 100644
--- a/src/OpenFOAM/containers/NamedEnum/NamedEnum.C
+++ b/src/OpenFOAM/containers/NamedEnum/NamedEnum.C
@@ -120,4 +120,23 @@ Foam::wordList Foam::NamedEnum<Enum, nEnum>::words()
 }
 
 
+template<class Enum, int nEnum>
+Foam::List<Enum> Foam::NamedEnum<Enum, nEnum>::enums()
+{
+    List<Enum> lst(nEnum);
+
+    label nElem = 0;
+    for (int enumI = 0; enumI < nEnum; ++enumI)
+    {
+        if (names[enumI] && names[enumI][0])
+        {
+            lst[nElem++] = Enum(enumI);
+        }
+    }
+
+    lst.setSize(nElem);
+    return lst;
+}
+
+
 // ************************************************************************* //
diff --git a/src/OpenFOAM/containers/NamedEnum/NamedEnum.H b/src/OpenFOAM/containers/NamedEnum/NamedEnum.H
index f4af06792cadd8a8aae25d79900ae4b7ef8b673b..6005f86a607b2ef9aa1df0bed2bd235f7a6b843d 100644
--- a/src/OpenFOAM/containers/NamedEnum/NamedEnum.H
+++ b/src/OpenFOAM/containers/NamedEnum/NamedEnum.H
@@ -45,6 +45,9 @@ SourceFiles
 namespace Foam
 {
 
+// Forward declaration
+template<class Enum, int> class NamedEnum;
+
 /*---------------------------------------------------------------------------*\
                           Class NamedEnum Declaration
 \*---------------------------------------------------------------------------*/
@@ -60,10 +63,10 @@ class NamedEnum
     // Private Member Functions
 
         //- Disallow default bitwise copy construct
-        NamedEnum(const NamedEnum&);
+        NamedEnum(const NamedEnum&) = delete;
 
         //- Disallow default bitwise assignment
-        void operator=(const NamedEnum&);
+        void operator=(const NamedEnum&) = delete;
 
 
 public:
@@ -95,6 +98,9 @@ public:
         //- The set of names as a list of words
         static wordList words();
 
+        //- List of enumerations
+        static List<Enum> enums();
+
 
     // Member Operators
 
diff --git a/src/OpenFOAM/db/Time/TimePaths.C b/src/OpenFOAM/db/Time/TimePaths.C
index 14d004e4d4671fc68fb602917a801862c5389140..ae5b5d182f9ba19f7107730c5429ac50ab7b92d5 100644
--- a/src/OpenFOAM/db/Time/TimePaths.C
+++ b/src/OpenFOAM/db/Time/TimePaths.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -26,6 +26,38 @@ License
 #include "TimePaths.H"
 #include "IOstreams.H"
 
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+bool Foam::TimePaths::detectProcessorCase()
+{
+    if (processorCase_)
+    {
+        return processorCase_;
+    }
+
+    // Look for "processor", but should really check for following digits too
+    const std::string::size_type sep = globalCaseName_.rfind('/');
+    const std::string::size_type pos = globalCaseName_.find
+    (
+        "processor",
+        (sep == string::npos ? 0 : sep)
+    );
+
+    if (pos == 0)
+    {
+        globalCaseName_ = ".";
+        processorCase_  = true;
+    }
+    else if (pos != string::npos && sep != string::npos && sep == pos-1)
+    {
+        globalCaseName_.resize(sep);
+        processorCase_  = true;
+    }
+
+    return processorCase_;
+}
+
+
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 Foam::TimePaths::TimePaths
@@ -38,29 +70,13 @@ Foam::TimePaths::TimePaths
 :
     processorCase_(false),
     rootPath_(rootPath),
+    globalCaseName_(caseName),
     case_(caseName),
     system_(systemName),
     constant_(constantName)
 {
     // Find out from case name whether a processor directory
-    std::string::size_type pos = caseName.find("processor");
-    if (pos != string::npos)
-    {
-        processorCase_ = true;
-
-        if (pos == 0)
-        {
-            globalCaseName_ = ".";
-        }
-        else
-        {
-            globalCaseName_ = caseName(pos-1);
-        }
-    }
-    else
-    {
-        globalCaseName_ = caseName;
-    }
+    detectProcessorCase();
 }
 
 
@@ -81,27 +97,10 @@ Foam::TimePaths::TimePaths
     system_(systemName),
     constant_(constantName)
 {
-    if (!processorCase)
-    {
-        // For convenience: find out from case name whether it is a
-        // processor directory and set processorCase flag so file searching
-        // goes up one level.
-        std::string::size_type pos = caseName.find("processor");
-
-        if (pos != string::npos)
-        {
-            processorCase_ = true;
-
-            if (pos == 0)
-            {
-                globalCaseName_ = ".";
-            }
-            else
-            {
-                globalCaseName_ = caseName(pos-1);
-            }
-        }
-    }
+    // For convenience: find out from case name whether it is a
+    // processor directory and set processorCase flag so file searching
+    // goes up one level.
+    detectProcessorCase();
 }
 
 
diff --git a/src/OpenFOAM/db/Time/TimePaths.H b/src/OpenFOAM/db/Time/TimePaths.H
index 88943ca61f2ea6faaf9b75348297abe5567c63a2..f7bbc25d2956b6f1a9f41ef5790061f8c2d27f7c 100644
--- a/src/OpenFOAM/db/Time/TimePaths.H
+++ b/src/OpenFOAM/db/Time/TimePaths.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2014 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -59,6 +59,12 @@ class TimePaths
         const word constant_;
 
 
+    // Private Member functions
+
+        //- Determine from case name whether it is a processor directory
+        bool detectProcessorCase();
+
+
 public:
 
     // Constructors
diff --git a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C
index 17aad06a00d094e328a856718d6c117649791f69..e2583450f31965c1176f4524144634a0cf3cf843 100644
--- a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C
+++ b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -30,6 +30,7 @@ License
 #include "dlLibraryTable.H"
 #include "PstreamReduceOps.H"
 #include "OSspecific.H"
+#include "Ostream.H"
 #include "regIOobject.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@@ -42,6 +43,45 @@ namespace Foam
 
 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
 
+namespace Foam
+{
+//! \cond fileScope
+static inline void writeEntryIfPresent
+(
+    Ostream& os,
+    const dictionary& dict,
+    const word& key
+)
+{
+    // non-recursive like dictionary::found, but no pattern-match either
+    const entry* ptr = dict.lookupEntryPtr(key, false, false);
+
+    if (ptr)
+    {
+        os.writeKeyword(key)
+            << token::HASH << token::BEGIN_BLOCK;
+
+        os.writeQuoted(string(ptr->stream()), false)
+            << token::HASH << token::END_BLOCK
+            << token::END_STATEMENT << nl;
+    }
+}
+//! \endcond
+}
+
+
+void Foam::codedBase::writeCodeDict(Ostream& os, const dictionary& dict)
+{
+    writeEntryIfPresent(os, dict, "codeInclude");
+    writeEntryIfPresent(os, dict, "localCode");
+    writeEntryIfPresent(os, dict, "code");
+    writeEntryIfPresent(os, dict, "codeOptions");
+    writeEntryIfPresent(os, dict, "codeLibs");
+}
+
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
 void* Foam::codedBase::loadLibrary
 (
     const fileName& libPath,
@@ -165,8 +205,6 @@ void Foam::codedBase::unloadLibrary
 }
 
 
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
-
 void Foam::codedBase::createLibrary
 (
     dynamicCode& dynCode,
diff --git a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H
index 8ac7114ce67c12b1c9b145de7b854efa5e48df50..1c03e71c092007813f588b5aa3b6b3251cb76602 100644
--- a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H
+++ b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -43,6 +43,7 @@ namespace Foam
 {
 
 // Forward declaration of classes
+class Ostream;
 class dynamicCode;
 class dynamicCodeContext;
 class dlLibraryTable;
@@ -83,14 +84,17 @@ class codedBase
         void createLibrary(dynamicCode&, const dynamicCodeContext&) const;
 
         //- Disallow default bitwise copy construct
-        codedBase(const codedBase&);
+        codedBase(const codedBase&) = delete;
 
         //- Disallow default bitwise assignment
-        void operator=(const codedBase&);
+        void operator=(const codedBase&) = delete;
 
 
 protected:
 
+        //- Write code-dictionary contents
+        static void writeCodeDict(Ostream&, const dictionary&);
+
         //- Update library as required
         void updateLibrary
         (
diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C
index 04932fceea3df03528217f4914fdb5a7e2f19021..19882241e3476f97abd621ffdd08de592bc9324a 100644
--- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C
+++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -493,10 +493,17 @@ bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const
 
 bool Foam::dynamicCode::wmakeLibso() const
 {
-    const Foam::string wmakeCmd("wmake -s libso " + this->codePath());
-    Info<< "Invoking " << wmakeCmd << endl;
+    DynamicList<string> cmd(4);
+    cmd.append("wmake");
+    cmd.append("-s");
+    cmd.append("libso");
+    cmd.append(this->codePath());
 
-    if (Foam::system(wmakeCmd))
+    // NOTE: could also resolve wmake command explicitly
+    //   cmd[0] = stringOps::expand("$WM_PROJECT_DIR/wmake/wmake");
+
+    Info<< "Invoking wmake libso " << this->codePath().c_str() << endl;
+    if (Foam::system(cmd))
     {
         return false;
     }
diff --git a/src/OpenFOAM/db/regIOobject/regIOobjectRead.C b/src/OpenFOAM/db/regIOobject/regIOobjectRead.C
index d9488544d57dc6605ea99a3880d33ec4393ef104..14a62e0024102815537f9619b33ed660a796fbcf 100644
--- a/src/OpenFOAM/db/regIOobject/regIOobjectRead.C
+++ b/src/OpenFOAM/db/regIOobject/regIOobjectRead.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2015 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2015-2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -115,7 +115,7 @@ bool Foam::regIOobject::read
         }
 
         // Send to my downstairs neighbours
-        forAll(myComm.below(), belowI)
+        forAllReverse(myComm.below(), belowI)
         {
             OPstream toBelow
             (
diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C
index f56a8cf1e708dfad82db96c510e10aa6b85ffb00..a840d794822bf3597cd7f29507a4e5b0afc5afdc 100644
--- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C
+++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -331,55 +331,7 @@ void Foam::codedFixedValuePointPatchField<Type>::write(Ostream& os) const
     os.writeKeyword("redirectType") << redirectType_
         << token::END_STATEMENT << nl;
 
-    if (dict_.found("codeInclude"))
-    {
-        os.writeKeyword("codeInclude")
-            << token::HASH << token::BEGIN_BLOCK;
-
-        os.writeQuoted(string(dict_["codeInclude"]), false)
-            << token::HASH << token::END_BLOCK
-            << token::END_STATEMENT << nl;
-    }
-
-    if (dict_.found("localCode"))
-    {
-        os.writeKeyword("localCode")
-            << token::HASH << token::BEGIN_BLOCK;
-
-        os.writeQuoted(string(dict_["localCode"]), false)
-            << token::HASH << token::END_BLOCK
-            << token::END_STATEMENT << nl;
-    }
-
-    if (dict_.found("code"))
-    {
-        os.writeKeyword("code")
-            << token::HASH << token::BEGIN_BLOCK;
-
-        os.writeQuoted(string(dict_["code"]), false)
-            << token::HASH << token::END_BLOCK
-            << token::END_STATEMENT << nl;
-    }
-
-    if (dict_.found("codeOptions"))
-    {
-        os.writeKeyword("codeOptions")
-            << token::HASH << token::BEGIN_BLOCK;
-
-        os.writeQuoted(string(dict_["codeOptions"]), false)
-            << token::HASH << token::END_BLOCK
-            << token::END_STATEMENT << nl;
-    }
-
-    if (dict_.found("codeLibs"))
-    {
-        os.writeKeyword("codeLibs")
-            << token::HASH << token::BEGIN_BLOCK;
-
-        os.writeQuoted(string(dict_["codeLibs"]), false)
-            << token::HASH << token::END_BLOCK
-            << token::END_STATEMENT << nl;
-    }
+    codedBase::writeCodeDict(os, dict_);
 }
 
 
diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C
index 5d391afaafe0d15044e096460cf4049e4639de53..8f489589b02f8370180af75c329f975dcdfad06c 100644
--- a/src/OpenFOAM/global/argList/argList.C
+++ b/src/OpenFOAM/global/argList/argList.C
@@ -1170,7 +1170,7 @@ void Foam::argList::displayDoc(bool source) const
 
         Info<< "Show documentation: " << docBrowser.c_str() << endl;
 
-        system(docBrowser);
+        Foam::system(docBrowser);
     }
     else
     {
diff --git a/src/OpenFOAM/global/profiling/profiling.C b/src/OpenFOAM/global/profiling/profiling.C
index e9c02687f7422bd9c6be1d931b00271ba9970902..647102285050efd93a02d7e877d8436ac7a26aeb 100644
--- a/src/OpenFOAM/global/profiling/profiling.C
+++ b/src/OpenFOAM/global/profiling/profiling.C
@@ -369,8 +369,10 @@ void Foam::profiling::Information::update(const scalar& elapsed)
 
 bool Foam::profiling::writeData(Ostream& os) const
 {
-    os  << indent << "profiling" << nl
-        << indent << token::BEGIN_LIST << incrIndent << nl;
+    os.beginBlock("profiling") << nl; // FUTURE: without nl
+
+    // Add extra new line between entries
+    label nTrigger = 0;
 
     // write on-stack items
     // newest is first on the stack, top-level is at the end
@@ -382,6 +384,10 @@ bool Foam::profiling::writeData(Ostream& os) const
             const Information *info = *iter;
             scalar elapsed = timers_[info->id()]->elapsedTime();
 
+            if (nTrigger++)
+            {
+                os << nl;
+            }
             info->write(os, true, elapsed, oldElapsed);
             oldElapsed = elapsed;
         }
@@ -406,13 +412,15 @@ bool Foam::profiling::writeData(Ostream& os) const
 
         forAllConstIter(LookupContainer, lookup, iter)
         {
+            if (nTrigger++)
+            {
+                os << nl;
+            }
             iter()->write(os);
         }
     }
 
-    os  << decrIndent
-        << indent << token::END_LIST << token::END_STATEMENT << nl;
-
+    os.endBlock() << nl; // FUTURE: without nl
 
     if (sysInfo_)
     {
@@ -528,8 +536,7 @@ Foam::Ostream& Foam::profiling::Information::write
 {
     // write in dictionary format
 
-    // os.beginBlock("_" + Foam::name(id_)) << nl;
-    os.beginBlock() << nl; // FUTURE: without nl
+    os.beginBlock("trigger" + Foam::name(id_)) << nl; // FUTURE: without nl
 
     // FUTURE: os.writeEntry(key, value);
 
diff --git a/src/OpenFOAM/include/OSspecific.H b/src/OpenFOAM/include/OSspecific.H
index d190f67045e2536e9b131f4a2e41ea292b310758..e974192cecce1ae09139b4eaa7703aaa6dd73b7b 100644
--- a/src/OpenFOAM/include/OSspecific.H
+++ b/src/OpenFOAM/include/OSspecific.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -37,6 +37,7 @@ SourceFiles
 #define OSspecific_H
 
 #include "fileNameList.H"
+#include "stringList.H"
 
 #include <sys/types.h>
 
@@ -132,44 +133,60 @@ bool mkDir(const fileName&, mode_t=0777);
 bool chMod(const fileName&, const mode_t);
 
 //- Return the file mode
-mode_t mode(const fileName&);
+mode_t mode(const fileName&, const bool followLink=true);
 
 //- Return the file type: DIRECTORY or FILE
-fileName::Type type(const fileName&);
+fileName::Type type(const fileName&, const bool followLink=true);
 
 //- Does the name exist (as DIRECTORY or FILE) in the file system?
 //  Optionally enable/disable check for gzip file.
-bool exists(const fileName&, const bool checkGzip=true);
+bool exists
+(
+    const fileName&,
+    const bool checkGzip=true,
+    const bool followLink=true
+);
 
 //- Does the name exist as a DIRECTORY in the file system?
-bool isDir(const fileName&);
+bool isDir(const fileName&, const bool followLink=true);
 
 //- Does the name exist as a FILE in the file system?
 //  Optionally enable/disable check for gzip file.
-bool isFile(const fileName&, const bool checkGzip=true);
+bool isFile
+(
+    const fileName&,
+    const bool checkGzip=true,
+    const bool followLink=true
+);
 
 //- Return size of file
-off_t fileSize(const fileName&);
+off_t fileSize(const fileName&, const bool followLink=true);
 
 //- Return time of last file modification
-time_t lastModified(const fileName&);
+time_t lastModified(const fileName&, const bool followLink=true);
 
 //- Read a directory and return the entries as a string list
 fileNameList readDir
 (
     const fileName&,
     const fileName::Type=fileName::FILE,
-    const bool filtergz=true
+    const bool filtergz=true,
+    const bool followLink=true
 );
 
 //- Copy, recursively if necessary, the source to the destination
-bool cp(const fileName& src, const fileName& dst);
+bool cp(const fileName& src, const fileName& dst, const bool followLink=true);
 
 //- Create a softlink. dst should not exist. Returns true if successful.
 bool ln(const fileName& src, const fileName& dst);
 
 //- Rename src to dst
-bool mv(const fileName& src, const fileName& dst);
+bool mv
+(
+    const fileName& src,
+    const fileName& dst,
+    const bool followLink=false
+);
 
 //- Rename to a corresponding backup file
 //  If the backup file already exists, attempt with "01" .. "99" suffix
@@ -193,9 +210,15 @@ bool ping(const string&, const label port, const label timeOut);
 //- Check if machine is up by pinging port 22 (ssh) and 222 (rsh)
 bool ping(const string&, const label timeOut=10);
 
-//- Execute the specified command
+//- Execute the specified command via the shell.
+//  Uses vfork/execl internally.
+//  Where possible, use the list version instead.
 int system(const std::string& command);
 
+//- Execute the specified command with arguments.
+//  Uses vfork/execvp internally
+int system(const UList<string>& command);
+
 //- Open a shared library. Return handle to library. Print error message
 //  if library cannot be loaded (check = true)
 void* dlOpen(const fileName& lib, const bool check = true);
diff --git a/src/OpenFOAM/memory/autoPtr/autoPtr.H b/src/OpenFOAM/memory/autoPtr/autoPtr.H
index 748975b5cf33ed6e4bec94a6d8342fdde77e2e52..a8802f23a92ad193948fd9b18f427a563439500c 100644
--- a/src/OpenFOAM/memory/autoPtr/autoPtr.H
+++ b/src/OpenFOAM/memory/autoPtr/autoPtr.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -104,6 +104,15 @@ public:
             inline void clear();
 
 
+        // Access
+
+            //- Return reference, without checking pointer validity.
+            inline T& refOrNull();
+
+            //- Return const reference, without checking pointer validity.
+            inline const T& refOrNull() const;
+
+
         // Member operators
 
             //- Return reference to the object data
diff --git a/src/OpenFOAM/memory/autoPtr/autoPtrI.H b/src/OpenFOAM/memory/autoPtr/autoPtrI.H
index ef199ca20c60ff4d2fde05e0f53af344091d38c1..7440bdce690c581572bc0a567e121be7c26defff 100644
--- a/src/OpenFOAM/memory/autoPtr/autoPtrI.H
+++ b/src/OpenFOAM/memory/autoPtr/autoPtrI.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -129,6 +129,20 @@ inline void Foam::autoPtr<T>::clear()
 }
 
 
+template<class T>
+inline T& Foam::autoPtr<T>::refOrNull()
+{
+    return *ptr_;
+}
+
+
+template<class T>
+inline const T& Foam::autoPtr<T>::refOrNull() const
+{
+    return *ptr_;
+}
+
+
 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
 
 template<class T>
diff --git a/src/OpenFOAM/meshes/boundBox/boundBox.C b/src/OpenFOAM/meshes/boundBox/boundBox.C
index 6c3ec8036f9d508779de97754872cb484fc941fa..a05ab018f6916338d7236cd5f62edca49c3458ba 100644
--- a/src/OpenFOAM/meshes/boundBox/boundBox.C
+++ b/src/OpenFOAM/meshes/boundBox/boundBox.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -24,6 +24,7 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "boundBox.H"
+#include "ListOps.H"
 #include "PstreamReduceOps.H"
 #include "tmp.H"
 
@@ -45,6 +46,27 @@ const Foam::boundBox Foam::boundBox::invertedBox
 );
 
 
+//! \cond ignoreDocumentation
+//- Skip documentation : local scope only
+const Foam::label facesArray[6][4] =
+{
+    // point and face order as per hex cellmodel
+    {0, 4, 7, 3}, // x-min
+    {1, 2, 6, 5}, // x-max
+    {0, 1, 5, 4}, // y-min
+    {3, 7, 6, 2}, // y-max
+    {0, 3, 2, 1}, // z-min
+    {4, 5, 6, 7}  // z-max
+};
+//! \endcond
+
+
+const Foam::faceList Foam::boundBox::faces
+(
+    initListList<face, label, 6, 4>(facesArray)
+);
+
+
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 void Foam::boundBox::calculate(const UList<point>& points, const bool doReduce)
@@ -164,49 +186,6 @@ Foam::tmp<Foam::pointField> Foam::boundBox::points() const
 }
 
 
-Foam::faceList Foam::boundBox::faces()
-{
-    faceList faces(6);
-
-    forAll(faces, fI)
-    {
-        faces[fI].setSize(4);
-    }
-
-    faces[0][0] = 0;
-    faces[0][1] = 1;
-    faces[0][2] = 2;
-    faces[0][3] = 3;
-
-    faces[1][0] = 2;
-    faces[1][1] = 6;
-    faces[1][2] = 7;
-    faces[1][3] = 3;
-
-    faces[2][0] = 0;
-    faces[2][1] = 4;
-    faces[2][2] = 5;
-    faces[2][3] = 1;
-
-    faces[3][0] = 4;
-    faces[3][1] = 7;
-    faces[3][2] = 6;
-    faces[3][3] = 5;
-
-    faces[4][0] = 3;
-    faces[4][1] = 7;
-    faces[4][2] = 4;
-    faces[4][3] = 0;
-
-    faces[5][0] = 1;
-    faces[5][1] = 5;
-    faces[5][2] = 6;
-    faces[5][3] = 2;
-
-    return faces;
-}
-
-
 void Foam::boundBox::inflate(const scalar s)
 {
     vector ext = vector::one*s*mag();
diff --git a/src/OpenFOAM/meshes/boundBox/boundBox.H b/src/OpenFOAM/meshes/boundBox/boundBox.H
index a340a90c0421f999463d3dc27d2951e351b7244f..0d4a457db02f5f641c00099b183aac1dad62b57f 100644
--- a/src/OpenFOAM/meshes/boundBox/boundBox.H
+++ b/src/OpenFOAM/meshes/boundBox/boundBox.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -79,6 +79,9 @@ public:
         //- A very large inverted boundBox: min/max == +/- VGREAT
         static const boundBox invertedBox;
 
+        //- Faces to point addressing, as per a 'hex' cell
+        static const faceList faces;
+
 
     // Constructors
 
@@ -158,12 +161,9 @@ public:
             //- Average length/height/width dimension
             inline scalar avgDim() const;
 
-            //- Return corner points in an order corresponding to a 'hex' cell
+            //- Corner points in an order corresponding to a 'hex' cell
             tmp<pointField> points() const;
 
-            //- Return faces with correct point order
-            static faceList faces();
-
 
         // Manipulate
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C
index adaec0eb8e4c40cd927b1fa57213ea59386c63f7..b8ada24283f8f6cdd4f1f95bc3c6d7273da4bb88 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -1130,6 +1130,21 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
     geometricD_ = Zero;
     solutionD_ = Zero;
 
+    // Reset cell tree - it gets built from mesh geometry so might have
+    // wrong boxes. It is correct as long as none of the cells leaves
+    // the boxes it is in which most likely is almost never the case except
+    // for tiny displacements. An alternative is to check the displacements
+    // to see if they are tiny - imagine a big windtunnel with a small rotating
+    // object. In this case the processors without the rotating object wouldn't
+    // have to clear any geometry. However your critical path still stays the
+    // same so no time would be gained (unless the decomposition gets weighted).
+    // Small benefit for lots of scope for problems so not done.
+    cellTreePtr_.clear();
+
+    // Note: tet-base decomposition does not get cleared. Ideally your face
+    // decomposition should not change during mesh motion ...
+
+
     meshObject::movePoints<polyMesh>(*this);
     meshObject::movePoints<pointMesh>(*this);
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.C
index 5432ece12f17da1bd769826dfc335f5e3ede871f..22a1e1b0f78eac1631b19d8594f39c8f513635cf 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.C
@@ -118,6 +118,12 @@ Foam::genericPolyPatch::~genericPolyPatch()
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+const Foam::word& Foam::genericPolyPatch::actualType() const
+{
+    return actualTypeName_;
+}
+
+
 void Foam::genericPolyPatch::write(Ostream& os) const
 {
     os.writeKeyword("type") << actualTypeName_ << token::END_STATEMENT << nl;
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H
index 6a22d8af6f504cf9ef1c0e4d61323112403a4702..ac412bcae005fdff9695aeb4f9a639fe572dab1f 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -25,8 +25,9 @@ Class
     Foam::genericPolyPatch
 
 Description
-    Substitute for unknown patches. Used for postprocessing when only
-    basic polyPatch info is needed.
+    Substitute for unknown patches.
+    Used for postprocessing when only basic polyPatch info is needed
+    or if the real patch type is unavailable.
 
 Note
     Storage is not optimal. It stores all face centres and cells on all
@@ -57,7 +58,7 @@ class genericPolyPatch
 {
     // Private data
 
-        word actualTypeName_;
+        const word actualTypeName_;
         dictionary dict_;
 
 public:
@@ -162,6 +163,9 @@ public:
 
     // Member functions
 
+        //- Return the actual type
+        const word& actualType() const;
+
         //- Write the polyPatch data as a dictionary
         virtual void write(Ostream&) const;
 };
diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H
index e01541b6ecfbe6026f25f832e8f4b4907605ec15..16e8c3c68c0019f1bdadb0568656e9f1cd2a6f7b 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H
+++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -216,9 +216,6 @@ private:
         //- Calculate unit point normals
         void calcPointNormals() const;
 
-        //- Calculate edge owner
-        void calcEdgeOwner() const;
-
 
         //- Face-edge-face walk while remaining on a patch point.
         //  Used to determine if surface multiply connected through point.
diff --git a/src/OpenFOAM/meshes/primitiveShapes/plane/plane.C b/src/OpenFOAM/meshes/primitiveShapes/plane/plane.C
index a6d05b7f7368157f076e3ed3140a97359c30be44..5f22c044316c5ffe0b49a88ae6a0a2a86eef229c 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/plane/plane.C
+++ b/src/OpenFOAM/meshes/primitiveShapes/plane/plane.C
@@ -129,23 +129,29 @@ Foam::plane::plane(const vector& normalVector)
 }
 
 
-Foam::plane::plane(const point& basePoint, const vector& normalVector)
+Foam::plane::plane
+(
+    const point& basePoint,
+    const vector& normalVector,
+    const bool normalise
+)
 :
     unitVector_(normalVector),
     basePoint_(basePoint)
 {
-    scalar magUnitVector(mag(unitVector_));
+    scalar magSqrUnitVector(magSqr(unitVector_));
 
-    if (magUnitVector > VSMALL)
-    {
-        unitVector_ /= magUnitVector;
-    }
-    else
+    if (magSqrUnitVector < VSMALL)
     {
         FatalErrorInFunction
             << "plane normal has zero length. basePoint:" << basePoint_
             << abort(FatalError);
     }
+
+    if (normalise)
+    {
+        unitVector_ /= Foam::sqrt(magSqrUnitVector);
+    }
 }
 
 
diff --git a/src/OpenFOAM/meshes/primitiveShapes/plane/plane.H b/src/OpenFOAM/meshes/primitiveShapes/plane/plane.H
index 44564fa92a8c649bbe8a1fe2d7449bc3e7918a49..6645fb1b95f5a95b0e1dc175aa33de4ec2146694 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/plane/plane.H
+++ b/src/OpenFOAM/meshes/primitiveShapes/plane/plane.H
@@ -131,7 +131,12 @@ public:
         plane(const vector& normalVector);
 
         //- Construct from normal vector and point in plane
-        plane(const point& basePoint, const vector& normalVector);
+        plane
+        (
+            const point& basePoint,
+            const vector& normalVector,
+            const bool normalise = true
+        );
 
         //- Construct from three points in plane
         plane(const point& point1, const point& point2, const point& point3);
diff --git a/src/OpenFOAM/primitives/Tensor/TensorI.H b/src/OpenFOAM/primitives/Tensor/TensorI.H
index a20ba8773e4dfccdcecbbf86dfd26be5774d9f5a..c8ecbc7ce664cc365059239e175bbd88d6300b82 100644
--- a/src/OpenFOAM/primitives/Tensor/TensorI.H
+++ b/src/OpenFOAM/primitives/Tensor/TensorI.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -314,6 +314,11 @@ inline Foam::Vector<Cmpt> Foam::Tensor<Cmpt>::vectorComponent
             return z();
             break;
     }
+
+    FatalErrorInFunction
+        << "Unhandled component " << cmpt << abort(FatalError);
+
+    return x();
 }
 
 
diff --git a/src/OpenFOAM/primitives/Tensor/tensor/tensor.C b/src/OpenFOAM/primitives/Tensor/tensor/tensor.C
index cadbef6a9b3a731e731de9ff51dbe07c43c5e55b..f84d2e53160f4fc76017aec269b147f0d434d3d5 100644
--- a/src/OpenFOAM/primitives/Tensor/tensor/tensor.C
+++ b/src/OpenFOAM/primitives/Tensor/tensor/tensor.C
@@ -70,24 +70,30 @@ const Foam::tensor Foam::tensor::I
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-Foam::vector Foam::eigenValues(const tensor& t)
+Foam::vector Foam::eigenValues(const tensor& T)
 {
     // The eigenvalues
     scalar i, ii, iii;
 
     // diagonal matrix
-    if
-    (
+    const scalar onDiagMagSum =
         (
-            mag(t.xy()) + mag(t.xz()) + mag(t.yx())
-            + mag(t.yz()) + mag(t.zx()) + mag(t.zy())
-        )
-        < SMALL
-    )
+            mag(T.xx()) + mag(T.yy()) + mag(T.zz())
+        );
+
+    const scalar offDiagMagSum =
+        (
+            mag(T.xy()) + mag(T.xz()) + mag(T.yx())
+          + mag(T.yz()) + mag(T.zx()) + mag(T.zy())
+        );
+
+    const scalar magSum = onDiagMagSum + offDiagMagSum;
+
+    if (offDiagMagSum < max(VSMALL, SMALL*magSum))
     {
-        i = t.xx();
-        ii = t.yy();
-        iii = t.zz();
+        i = T.xx();
+        ii = T.yy();
+        iii = T.zz();
     }
 
     // non-diagonal matrix
@@ -96,16 +102,16 @@ Foam::vector Foam::eigenValues(const tensor& t)
         // Coefficients of the characteristic polynmial
         // x^3 + a*x^2 + b*x + c = 0
         scalar a =
-           - t.xx() - t.yy() - t.zz();
+           - T.xx() - T.yy() - T.zz();
 
         scalar b =
-            t.xx()*t.yy() + t.xx()*t.zz() + t.yy()*t.zz()
-          - t.xy()*t.yx() - t.yz()*t.zy() - t.zx()*t.xz();
+            T.xx()*T.yy() + T.xx()*T.zz() + T.yy()*T.zz()
+          - T.xy()*T.yx() - T.yz()*T.zy() - T.zx()*T.xz();
 
         scalar c =
-          - t.xx()*t.yy()*t.zz()
-          - t.xy()*t.yz()*t.zx() - t.xz()*t.zy()*t.yx()
-          + t.xx()*t.yz()*t.zy() + t.yy()*t.zx()*t.xz() + t.zz()*t.xy()*t.yx();
+          - T.xx()*T.yy()*T.zz()
+          - T.xy()*T.yz()*T.zx() - T.xz()*T.zy()*T.yx()
+          + T.xx()*T.yz()*T.zy() + T.yy()*T.zx()*T.xz() + T.zz()*T.xy()*T.yx();
 
         // Auxillary variables
         scalar aBy3 = a/3;
@@ -117,13 +123,13 @@ Foam::vector Foam::eigenValues(const tensor& t)
         scalar QQ = Q*Q;
 
         // Three identical roots
-        if (mag(P) < SMALL && mag(Q) < SMALL)
+        if (mag(P) < SMALL*sqr(magSum) && mag(Q) < SMALL*pow3(magSum))
         {
             return vector(- aBy3, - aBy3, - aBy3);
         }
 
         // Two identical roots and one distinct root
-        else if (mag(PPP/QQ - 1) < SMALL)
+        else if (mag(PPP - QQ) < SMALL*pow6(magSum))
         {
             scalar sqrtP = sqrt(P);
             scalar signQ = sign(Q);
@@ -148,11 +154,11 @@ Foam::vector Foam::eigenValues(const tensor& t)
         // based on the above logic, PPP must be less than QQ
         else
         {
-            WarningInFunction
-                << "complex eigenvalues detected for tensor: " << t
+            WarningIn("eigenValues(const tensor&)")
+                << "complex eigenvalues detected for tensor: " << T
                 << endl;
 
-            if (mag(P) < SMALL)
+            if (mag(P) < SMALL*sqr(magSum))
             {
                 i = cbrt(QQ/2);
             }
@@ -188,21 +194,14 @@ Foam::vector Foam::eigenValues(const tensor& t)
 
 Foam::vector Foam::eigenVector
 (
-    const tensor& t,
-    const scalar lambda
+    const tensor& T,
+    const scalar lambda,
+    const vector& direction1,
+    const vector& direction2
 )
 {
-    // Constantly rotating direction ensures different eigenvectors are
-    // generated when called sequentially with a multiple eigenvalue
-    static vector direction(1,0,0);
-    vector oldDirection(direction);
-    scalar temp = direction[2];
-    direction[2] = direction[1];
-    direction[1] = direction[0];
-    direction[0] = temp;
-
     // Construct the linear system for this eigenvalue
-    tensor A(t - lambda*I);
+    tensor A(T - lambda*I);
 
     // Determinants of the 2x2 sub-matrices used to find the eigenvectors
     scalar sd0, sd1, sd2;
@@ -252,9 +251,9 @@ Foam::vector Foam::eigenVector
     }
 
     // Sub-determinants for a repeated eigenvalue
-    sd0 = A.yy()*direction.z() - A.yz()*direction.y();
-    sd1 = A.zz()*direction.x() - A.zx()*direction.z();
-    sd2 = A.xx()*direction.y() - A.xy()*direction.x();
+    sd0 = A.yy()*direction1.z() - A.yz()*direction1.y();
+    sd1 = A.zz()*direction1.x() - A.zx()*direction1.z();
+    sd2 = A.xx()*direction1.y() - A.xy()*direction1.x();
     magSd0 = mag(sd0);
     magSd1 = mag(sd1);
     magSd2 = mag(sd2);
@@ -265,8 +264,8 @@ Foam::vector Foam::eigenVector
         vector ev
         (
             1,
-            (A.yz()*direction.x() - direction.z()*A.yx())/sd0,
-            (direction.y()*A.yx() - A.yy()*direction.x())/sd0
+            (A.yz()*direction1.x() - direction1.z()*A.yx())/sd0,
+            (direction1.y()*A.yx() - A.yy()*direction1.x())/sd0
         );
 
         return ev/mag(ev);
@@ -275,9 +274,9 @@ Foam::vector Foam::eigenVector
     {
         vector ev
         (
-            (direction.z()*A.zy() - A.zz()*direction.y())/sd1,
+            (direction1.z()*A.zy() - A.zz()*direction1.y())/sd1,
             1,
-            (A.zx()*direction.y() - direction.x()*A.zy())/sd1
+            (A.zx()*direction1.y() - direction1.x()*A.zy())/sd1
         );
 
         return ev/mag(ev);
@@ -286,8 +285,8 @@ Foam::vector Foam::eigenVector
     {
         vector ev
         (
-            (A.xy()*direction.z() - direction.y()*A.xz())/sd2,
-            (direction.x()*A.xz() - A.xx()*direction.z())/sd2,
+            (A.xy()*direction1.z() - direction1.y()*A.xz())/sd2,
+            (direction1.x()*A.xz() - A.xx()*direction1.z())/sd2,
             1
         );
 
@@ -295,40 +294,57 @@ Foam::vector Foam::eigenVector
     }
 
     // Triple eigenvalue
-    return oldDirection;
+    return direction1^direction2;
 }
 
 
-Foam::tensor Foam::eigenVectors(const tensor& t)
+Foam::tensor Foam::eigenVectors(const tensor& T, const vector& lambdas)
 {
-    vector evals(eigenValues(t));
+    vector Ux(1, 0, 0), Uy(0, 1, 0), Uz(0, 0, 1);
 
-    tensor evs
-    (
-        eigenVector(t, evals.x()),
-        eigenVector(t, evals.y()),
-        eigenVector(t, evals.z())
-    );
+    Ux = eigenVector(T, lambdas.x(), Uy, Uz);
+    Uy = eigenVector(T, lambdas.y(), Uz, Ux);
+    Uz = eigenVector(T, lambdas.z(), Ux, Uy);
 
-    return evs;
+    return tensor(Ux, Uy, Uz);
 }
 
 
-Foam::vector Foam::eigenValues(const symmTensor& t)
+Foam::tensor Foam::eigenVectors(const tensor& T)
+{
+    const vector lambdas(eigenValues(T));
+
+    return eigenVectors(T, lambdas);
+}
+
+
+Foam::vector Foam::eigenValues(const symmTensor& T)
+{
+    return eigenValues(tensor(T));
+}
+
+
+Foam::vector Foam::eigenVector
+(
+    const symmTensor& T,
+    const scalar lambda,
+    const vector& direction1,
+    const vector& direction2
+)
 {
-    return eigenValues(tensor(t));
+    return eigenVector(tensor(T), lambda, direction1, direction2);
 }
 
 
-Foam::vector Foam::eigenVector(const symmTensor& t, const scalar lambda)
+Foam::tensor Foam::eigenVectors(const symmTensor& T, const vector& lambdas)
 {
-    return eigenVector(tensor(t), lambda);
+    return eigenVectors(tensor(T), lambdas);
 }
 
 
-Foam::tensor Foam::eigenVectors(const symmTensor& t)
+Foam::tensor Foam::eigenVectors(const symmTensor& T)
 {
-    return eigenVectors(tensor(t));
+    return eigenVectors(tensor(T));
 }
 
 
diff --git a/src/OpenFOAM/primitives/Tensor/tensor/tensor.H b/src/OpenFOAM/primitives/Tensor/tensor/tensor.H
index b92cc8e64a162da4c7ad57b4c4da22e8f4963784..94d724c9c0b581947a9d49a188f1c714851cb066 100644
--- a/src/OpenFOAM/primitives/Tensor/tensor/tensor.H
+++ b/src/OpenFOAM/primitives/Tensor/tensor/tensor.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2014 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -50,13 +50,27 @@ namespace Foam
 
 typedef Tensor<scalar> tensor;
 
-vector eigenValues(const tensor&);
-vector eigenVector(const tensor&, const scalar lambda);
-tensor eigenVectors(const tensor&);
-
-vector eigenValues(const symmTensor&);
-vector eigenVector(const symmTensor&, const scalar lambda);
-tensor eigenVectors(const symmTensor&);
+vector eigenValues(const tensor& T);
+vector eigenVector
+(
+    const tensor& T,
+    const scalar lambda,
+    const vector& direction1,
+    const vector& direction2
+);
+tensor eigenVectors(const tensor& T, const vector& lambdas);
+tensor eigenVectors(const tensor& T);
+
+vector eigenValues(const symmTensor& T);
+vector eigenVector
+(
+    const symmTensor& T,
+    const scalar lambda,
+    const vector& direction1,
+    const vector& direction2
+);
+tensor eigenVectors(const symmTensor& T, const vector& lambdas);
+tensor eigenVectors(const symmTensor& T);
 
 //- Data associated with tensor type are contiguous
 template<>
diff --git a/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.C b/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.C
index afba64df742694ebef5eb08c63a66458948ca3e6..e2fec45161300b9bafff6b1936cbd6ee11036210 100644
--- a/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.C
+++ b/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.C
@@ -66,18 +66,19 @@ Foam::cachedRandom::cachedRandom(const label seed, const label count)
         seed_ = seed;
     }
 
+    // Initialise samples
+    osRandomSeed(seed_);
+
     // Samples will be cached if count > 0
     if (count > 0)
     {
         samples_.setSize(count);
-        sampleI_ = 0;
-    }
+        forAll(samples_, i)
+        {
+            samples_[i] = osRandomDouble();
+        }
 
-    // Initialise samples
-    osRandomSeed(seed_);
-    forAll(samples_, i)
-    {
-        samples_[i] = osRandomDouble();
+        sampleI_ = 0;
     }
 }
 
@@ -90,23 +91,28 @@ Foam::cachedRandom::cachedRandom(const cachedRandom& cr, const bool reset)
     hasGaussSample_(cr.hasGaussSample_),
     gaussSample_(cr.gaussSample_)
 {
+    //if (sampleI_ == -1)
+    //{
+    //    WarningInFunction
+    //        << "Copy constructor called, but samples not being cached. "
+    //        << "This may lead to non-repeatable behaviour" << endl;
+    //
+    //}
+
     if (reset)
     {
         hasGaussSample_ = false;
         gaussSample_ = 0;
-    }
-    if (sampleI_ == -1)
-    {
-        WarningInFunction
-            << "Copy constructor called, but samples not being cached. "
-            << "This may lead to non-repeatable behaviour" << endl;
-
-        osRandomSeed(seed_);
-    }
 
-    if (reset && samples_.size())
-    {
-        sampleI_ = 0;
+        if (samples_.size())
+        {
+            sampleI_ = 0;
+        }
+        else
+        {
+            // Re-initialise the samples
+            osRandomSeed(seed_);
+        }
     }
 }
 
diff --git a/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.H b/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.H
index 539d8103b1a02dfa4e805b15589a3c05069b4b82..a42034284aa01642fda1e164f89aa53c818708e4 100644
--- a/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.H
+++ b/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -143,6 +143,10 @@ public:
                 template<class Type>
                 void randomise01(Type& value);
 
+                //- Shuffle the values in the list
+                template<class Type>
+                void shuffle(UList<Type>& values);
+
 
             // Global random numbers - consistent across all processors
 
@@ -224,7 +228,7 @@ label cachedRandom::globalPosition<label>(const label& start, const label& end);
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 #ifdef NoRepository
-    #include "cachedRandomTemplates.C"
+#   include "cachedRandomTemplates.C"
 #endif
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/primitives/random/cachedRandom/cachedRandomTemplates.C b/src/OpenFOAM/primitives/random/cachedRandom/cachedRandomTemplates.C
index 6684a64cca865f8aa902f60d5cefe35aaccf7779..66612e765b4a4c6f27c197c53751a8a6dc5439b0 100644
--- a/src/OpenFOAM/primitives/random/cachedRandom/cachedRandomTemplates.C
+++ b/src/OpenFOAM/primitives/random/cachedRandom/cachedRandomTemplates.C
@@ -75,6 +75,23 @@ void Foam::cachedRandom::randomise01(Type& value)
 }
 
 
+template<class Type>
+void Foam::cachedRandom::shuffle(UList<Type>& values)
+{
+    const label nSample = values.size();
+    label posI = nSample - 1;
+
+    for (label i = 1; i < nSample; i++)
+    {
+        label j = position<label>(0, posI);
+        Type t = values[j];
+        values[j] = values[posI];
+        values[posI] = t;
+        posI--;
+    }
+}
+
+
 template<class Type>
 Type Foam::cachedRandom::globalSample01()
 {
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.C b/src/OpenFOAM/primitives/strings/fileName/fileName.C
index becb5db393dafb6ae591721926d6614cc2048fc5..0dd888c737affb70f4d643f65194a26af20760bf 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileName.C
+++ b/src/OpenFOAM/primitives/strings/fileName/fileName.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -48,9 +48,9 @@ Foam::fileName::fileName(const wordList& lst)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-Foam::fileName::Type Foam::fileName::type() const
+Foam::fileName::Type Foam::fileName::type(const bool followLink) const
 {
-    return ::Foam::type(*this);
+    return ::Foam::type(*this, followLink);
 }
 
 
@@ -94,6 +94,7 @@ bool Foam::fileName::clean()
     (
         string::size_type src = nChar;
         src < maxLen;
+        /*nil*/
     )
     {
         char c = operator[](src++);
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.H b/src/OpenFOAM/primitives/strings/fileName/fileName.H
index 288da061b87715a3fd4c5d652ff571d3467fa5ce..e45844eaeb7385b1aa77b137bac32da70c9d2404 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileName.H
+++ b/src/OpenFOAM/primitives/strings/fileName/fileName.H
@@ -154,8 +154,9 @@ public:
 
         // Interrogation
 
-            //- Return the file type: FILE, DIRECTORY or UNDEFINED
-            Type type() const;
+            //- Return the file type: FILE, DIRECTORY, UNDEFINED or
+            //  LINK (only if followLink=false)
+            Type type(const bool followLink = true) const;
 
             //- Return true if file name is absolute
             bool isAbsolute() const;
diff --git a/src/OpenFOAM/primitives/strings/lists/CStringList.H b/src/OpenFOAM/primitives/strings/lists/CStringList.H
new file mode 100644
index 0000000000000000000000000000000000000000..c90ebcb337d0891b6cbabfebb0b6e8b1b1017685
--- /dev/null
+++ b/src/OpenFOAM/primitives/strings/lists/CStringList.H
@@ -0,0 +1,175 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::CStringList
+
+Description
+    An adapter for copying a list of C++ strings into a list of C-style
+    strings for passing to C code that expects argc/argv parameters.
+
+    In addition to providing a C-compatible list of C-strings,
+    the string lists are flattened into a single string of data that can be
+    also be passed en mass.
+
+    Example use:
+    \code
+        wordList myStrings;  ...
+        CStringList cstr(myStrings);
+
+        // pass as argc, argv:
+        someMain(cstr.size(), cstr.strings());
+
+        // access the raw characters:
+        os.write(cstr.data(), cstr.length());
+    \endcode
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef CStringList_H
+#define CStringList_H
+
+#include "fileNameList.H"
+#include "stringList.H"
+#include "wordList.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                         Class CStringList Declaration
+\*---------------------------------------------------------------------------*/
+
+class CStringList
+{
+    // Private data
+
+        //- Number of strings
+        int argc_;
+
+        //- Overall length of the raw content
+        //  Does not include the final nul-character
+        size_t len_;
+
+        //- List of strings, including trailing NULL pointer
+        char** argv_;
+
+        //- Flattened content with interspersed nul-characters
+        char* data_;
+
+
+    // Private Member Functions
+
+        //- Disallow default bitwise copy construct
+        CStringList(const CStringList&) = delete;
+
+        //- Disallow default bitwise assignment
+        void operator=(const CStringList&) = delete;
+
+
+public:
+
+    // Constructors
+
+        //- Construct empty, adding content later (via reset).
+        inline CStringList();
+
+
+        //- Construct from a list of strings
+        //  Copies the input characters.
+        template<class StringType>
+        CStringList(const UList<StringType>& input);
+
+
+    //- Destructor
+    inline ~CStringList();
+
+
+    // Public Members
+
+        //- Count the number of parameters until the first NULL pointer.
+        //  Return 0 if argv is NULL.
+        static inline int count(const char * const argv[]);
+
+
+    // Access
+
+        //- Return the number of C-strings (ie, argc)
+        inline int size() const;
+
+        //- Return the list of C-strings (ie, argv)
+        //  The position at argc is a NULL pointer
+        inline char** strings() const;
+
+
+        //- Overall length of the flattened character (data) content
+        inline size_t length() const;
+
+        //- The flattened character content, with interspersed nul-chars
+        inline char* data() const;
+
+
+    // Edit
+
+        //- Clear contents and free memory
+        inline void clear();
+
+        //- Copy the input list of strings.
+        template<class StringType>
+        void reset(const UList<StringType>& input);
+
+
+    // Other
+
+        //- Create a list from argc/argv parameters.
+        //  A null pointer for argv is permissible when argc is zero.
+        template<class StringType>
+        static List<StringType> asList(int argc, const char * const argv[]);
+
+        //- Create a list from a NULL-terminated list of argv parameters.
+        //  A null pointer for argv is permissible.
+        template<class StringType>
+        static inline List<StringType> asList(const char * const argv[]);
+
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "CStringListI.H"
+
+#ifdef NoRepository
+#   include "CStringListTemplates.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/strings/lists/CStringListI.H b/src/OpenFOAM/primitives/strings/lists/CStringListI.H
new file mode 100644
index 0000000000000000000000000000000000000000..d91a9de6460283fe0ba78b5839df5ac31c7be70a
--- /dev/null
+++ b/src/OpenFOAM/primitives/strings/lists/CStringListI.H
@@ -0,0 +1,106 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
+
+inline int Foam::CStringList::count(const char * const argv[])
+{
+    int nElem = 0;
+    if (argv)
+    {
+        while (argv[nElem])
+        {
+            ++nElem;
+        }
+    }
+
+    return nElem;
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+inline Foam::CStringList::CStringList()
+:
+    argc_(0),
+    len_(0),
+    argv_(0),
+    data_(0)
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+inline Foam::CStringList::~CStringList()
+{
+    clear();
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+inline void Foam::CStringList::clear()
+{
+    argc_ = 0;
+    len_  = 0;
+
+    if (data_)
+    {
+        delete[] data_;
+        data_ = 0;
+    }
+    if (argv_)
+    {
+        delete[] argv_;
+        argv_ = 0;
+    }
+}
+
+
+inline int Foam::CStringList::size() const
+{
+    return argc_;
+}
+
+
+inline size_t Foam::CStringList::length() const
+{
+    return len_;
+}
+
+
+inline char** Foam::CStringList::strings() const
+{
+    return argv_;
+}
+
+
+inline char* Foam::CStringList::data() const
+{
+    return data_;
+}
+
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/strings/lists/CStringListTemplates.C b/src/OpenFOAM/primitives/strings/lists/CStringListTemplates.C
new file mode 100644
index 0000000000000000000000000000000000000000..db0bb2e2ffe667860d85d6209d9291f466f3e0e4
--- /dev/null
+++ b/src/OpenFOAM/primitives/strings/lists/CStringListTemplates.C
@@ -0,0 +1,115 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+template<class StringType>
+Foam::CStringList::CStringList
+(
+    const UList<StringType>& input
+)
+:
+    argc_(0),
+    len_(0),
+    argv_(0),
+    data_(0)
+{
+    reset(input);
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+template<class StringType>
+void Foam::CStringList::reset
+(
+    const UList<StringType>& input
+)
+{
+    clear();
+
+    argc_ = input.size();
+    forAll(input, argI)
+    {
+        len_ += input[argI].size();
+        ++len_;  // nul terminator for C-strings
+    }
+
+    argv_ = new char*[argc_+1];
+    argv_[argc_] = NULL; // extra terminator
+
+    if (argc_ > 0)
+    {
+        // allocation includes final nul terminator,
+        // but overall count does not
+        data_ = new char[len_--];
+
+        char* ptr = data_;
+        forAll(input, argI)
+        {
+            argv_[argI] = ptr;
+
+            const std::string& str =
+                static_cast<const std::string&>(input[argI]);
+
+            for
+            (
+                std::string::const_iterator iter = str.begin();
+                iter != str.end();
+                ++iter
+            )
+            {
+                *(ptr++) = *iter;
+            }
+            *(ptr++) = '\0';
+        }
+    }
+}
+
+
+template<class StringType>
+Foam::List<StringType>
+Foam::CStringList::asList(int argc, const char * const argv[])
+{
+    List<StringType> lst(argc);
+
+    for (int i=0; i < argc; ++i)
+    {
+        lst[i] = argv[i];
+    }
+
+    return lst;
+}
+
+
+template<class StringType>
+Foam::List<StringType>
+Foam::CStringList::asList(const char * const argv[])
+{
+    return asList<StringType>(count(argv), argv);
+}
+
+
+// ************************************************************************* //
diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulenceBoundaryConditionsDoc.H b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulenceBoundaryConditionsDoc.H
index 1c294e35bf916d8437503c0d6e03a9d2f8541fda..29128860247ae56a73a9e49689951803c6da4beb 100644
--- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulenceBoundaryConditionsDoc.H
+++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulenceBoundaryConditionsDoc.H
@@ -23,13 +23,13 @@ License
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-\defgroup grpCmpTurbulenceBoundaryConditions Compressible Turbulence BCs
+\defgroup grpCmpTurbulenceBoundaryConditions Boundary conditions
 @{
     \ingroup grpCmpTurbulence
     This group contains compressible turbulence model boundary conditions
 @}
 
-\defgroup grpCmpWallFunctions Compressible turbulence wall functions
+\defgroup grpCmpWallFunctions Wall functions
 @{
     \ingroup grpCmpTurbulenceBoundaryConditions
     This group contains compressible turbulence model wall functions
diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/derivedFvPatchFields/turbulenceBoundaryConditionsDoc.H b/src/TurbulenceModels/incompressible/turbulentTransportModels/derivedFvPatchFields/turbulenceBoundaryConditionsDoc.H
index c65a7170c29497e4050006dbe3874807b572f70d..5b589b022162a026d4f7bc47c174e8b352851842 100644
--- a/src/TurbulenceModels/incompressible/turbulentTransportModels/derivedFvPatchFields/turbulenceBoundaryConditionsDoc.H
+++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/derivedFvPatchFields/turbulenceBoundaryConditionsDoc.H
@@ -23,13 +23,13 @@ License
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-\defgroup grpIcoTurbulenceBoundaryConditions Incompressible Turbulence BCs
+\defgroup grpIcoTurbulenceBoundaryConditions Boundary conditions
 @{
     \ingroup grpIcoTurbulence
     This group contains incompressible turbulence model boundary conditions
 @}
 
-\defgroup grpIcoWallFunctions Incompressible turbulence wall functions
+\defgroup grpIcoWallFunctions Wall functions
 @{
     \ingroup grpIcoTurbulenceBoundaryConditions
     This group contains incompressible turbulence model wall functions
diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyz/maxDeltaxyz.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyz/maxDeltaxyz.C
index d43f4c2578e0530099612889542782e05e1df01d..77c2d8f31089704a25606362acb8bb33d68784d8 100644
--- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyz/maxDeltaxyz.C
+++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyz/maxDeltaxyz.C
@@ -47,26 +47,31 @@ void Foam::LESModels::maxDeltaxyz::calcDelta()
     label nD = mesh.nGeometricD();
 
     const cellList& cells = mesh.cells();
+    const vectorField& cellC = mesh.cellCentres();
+    const vectorField& faceC = mesh.faceCentres();
+    const vectorField faceN(mesh.faceAreas()/mag(mesh.faceAreas()));
     scalarField hmax(cells.size());
 
-    forAll(cells,cellI)
+    forAll(cells, celli)
     {
         scalar deltaMaxTmp = 0.0;
-        const labelList& cFaces = mesh.cells()[cellI];
-        const point& centrevector = mesh.cellCentres()[cellI];
+        const labelList& cFaces = cells[celli];
+        const point& cc = cellC[celli];
 
-        forAll(cFaces, cFaceI)
+        forAll(cFaces, cFacei)
         {
-            label faceI = cFaces[cFaceI];
-            const point& facevector = mesh.faceCentres()[faceI];
-            scalar tmp = mag(facevector - centrevector);
+            label facei = cFaces[cFacei];
+            const point& fc = faceC[facei];
+            const vector& n = faceN[facei];
+
+            scalar tmp = magSqr(n*(n & (fc - cc)));
             if (tmp > deltaMaxTmp)
             {
                 deltaMaxTmp = tmp;
             }
         }
 
-        hmax[cellI] = deltaCoeff_*deltaMaxTmp;
+        hmax[celli] = deltaCoeff_*Foam::sqrt(deltaMaxTmp);
     }
 
     if (nD == 3)
@@ -76,7 +81,7 @@ void Foam::LESModels::maxDeltaxyz::calcDelta()
     else if (nD == 2)
     {
         WarningInFunction
-            << "Case is 2D, LES is not strictly applicable\n"
+            << "Case is 2D, LES is not strictly applicable" << nl
             << endl;
 
         delta_.internalField() = hmax;
diff --git a/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/RASBoundaryConditionsDoc.H b/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/RASBoundaryConditionsDoc.H
index aeea3263fb1443c7d9e42173fa58ecfe9413c1a8..3c7a006033d11a8909a0a1702e580417404f8dea 100644
--- a/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/RASBoundaryConditionsDoc.H
+++ b/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/RASBoundaryConditionsDoc.H
@@ -23,7 +23,7 @@ License
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-\defgroup grpRASBoundaryConditions RAS boundary conditions
+\defgroup grpRASBoundaryConditions Boundary conditions
 @{
     \ingroup grpRASTurbulence
     This group contains RAS turbulence model boundary conditions
diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/turbulenceBoundaryConditionsDoc.H b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/turbulenceBoundaryConditionsDoc.H
index 651e95c161a83679cdf9abdc2e5d65f8618d562a..82709888aec2211c146b919ccd4b919f1eabbbb5 100644
--- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/turbulenceBoundaryConditionsDoc.H
+++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/turbulenceBoundaryConditionsDoc.H
@@ -23,7 +23,7 @@ License
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-\defgroup grpTurbulenceBoundaryConditions Turbulence boundary conditions
+\defgroup grpTurbulenceBoundaryConditions Boundary conditions
 @{
     \ingroup grpTurbulence
     This group contains turbulence model boundary conditions
diff --git a/src/TurbulenceModels/turbulenceModels/doc/turbulenceModelDoc.H b/src/TurbulenceModels/turbulenceModels/doc/turbulenceModelDoc.H
index 91eab7254d848bea1b925767fc10f35956e86781..926d957680de34d21d3aa1339cbcae6490cc361e 100644
--- a/src/TurbulenceModels/turbulenceModels/doc/turbulenceModelDoc.H
+++ b/src/TurbulenceModels/turbulenceModels/doc/turbulenceModelDoc.H
@@ -23,7 +23,7 @@ License
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-\defgroup grpTurbulence Turbulence
+\defgroup grpTurbulence Turbulence models
 @{
     This group contains turbulence models.
 @}
diff --git a/src/combustionModels/FSD/FSD.H b/src/combustionModels/FSD/FSD.H
index c9b4b6fa7d5552873b2a3a23bbd3b7f6b92177d6..2d4e17b63725c8a3a684c92679834346aff689cf 100644
--- a/src/combustionModels/FSD/FSD.H
+++ b/src/combustionModels/FSD/FSD.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::combustionModels::FSD
 
+Group
+    grpCombustionModels
+
 Description
 
     Flame Surface Dennsity (FDS) combustion model.
diff --git a/src/combustionModels/PaSR/PaSR.H b/src/combustionModels/PaSR/PaSR.H
index 51614ab2e680a6c1f16b4fc9dc7811861d5e21e3..cbcb37bc835f81e8f39d7fa86771bae3ed58fd95 100644
--- a/src/combustionModels/PaSR/PaSR.H
+++ b/src/combustionModels/PaSR/PaSR.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::combustionModels::PaSR
 
+Group
+    grpCombustionModels
+
 Description
     Partially stirred reactor combustion model.  The model calculates a finite
     rate, based on both turbulence and chemistry time scales.  Depending on
diff --git a/src/combustionModels/combustionModel/combustionModel.H b/src/combustionModels/combustionModel/combustionModel.H
index badd4848294db278c4d07cfd8f7f01a5c882d010..b5d218cc0a186633fa9adb3cc1d9728223947386 100644
--- a/src/combustionModels/combustionModel/combustionModel.H
+++ b/src/combustionModels/combustionModel/combustionModel.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::combustionModel
 
+Group
+    grpCombustionModels
+
 Description
     Base class for combustion models
 
diff --git a/src/combustionModels/diffusion/diffusion.H b/src/combustionModels/diffusion/diffusion.H
index a3023ee32bd831a0a12bc74da18960640ee96518..59b6ecda4d24eef701436f84cff98c36e91e4e8f 100644
--- a/src/combustionModels/diffusion/diffusion.H
+++ b/src/combustionModels/diffusion/diffusion.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::combustionModels::diffusion
 
+Group
+    grpCombustionModels
+
 Description
     Simple diffusion-based combustion model based on the principle mixed is
     burnt. Additional parameter C is used to distribute the heat release rate
diff --git a/src/combustionModels/diffusionMulticomponent/diffusionMulticomponent.C b/src/combustionModels/diffusionMulticomponent/diffusionMulticomponent.C
index 3261bf1b516d8ddd17b7b2c26b83eb2ef8d51fe8..f1aa8eb574b3353c832f6f27008fa60e21bd6822 100644
--- a/src/combustionModels/diffusionMulticomponent/diffusionMulticomponent.C
+++ b/src/combustionModels/diffusionMulticomponent/diffusionMulticomponent.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/combustionModels/diffusionMulticomponent/diffusionMulticomponent.H b/src/combustionModels/diffusionMulticomponent/diffusionMulticomponent.H
index f7143d00ee4225769ea86c4161246ead694123f2..6d849cfe9bcfb04fe3b25cd7ddf2b3e1f65e0c77 100644
--- a/src/combustionModels/diffusionMulticomponent/diffusionMulticomponent.H
+++ b/src/combustionModels/diffusionMulticomponent/diffusionMulticomponent.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -24,6 +24,9 @@ License
 Class
     Foam::combustionModels::diffusionMulticomponent
 
+Group
+    grpCombustionModels
+
 Description
 
     Diffusion based turbulent combustion model for multicomponent species.
diff --git a/src/combustionModels/doc/combustionModelsDoc.H b/src/combustionModels/doc/combustionModelsDoc.H
new file mode 100644
index 0000000000000000000000000000000000000000..53c5e1debd8917dfc8fafb84759aea82dbbda2c6
--- /dev/null
+++ b/src/combustionModels/doc/combustionModelsDoc.H
@@ -0,0 +1,31 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+\defgroup grpCombustionModels Combustion models
+@{
+    This group contains combustion models.
+@}
+
+\*---------------------------------------------------------------------------*/
diff --git a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H
index 08dec407c0815317487903051ba1e4c6f4fac81a..16a89b9cee7c602f11833c3a958316c01d506cb1 100644
--- a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H
+++ b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::combustionModels::infinitelyFastChemistry
 
+Group
+    grpCombustionModels
+
 Description
     Simple infinitely fast chemistry combustion model based on the principle
     mixed is burnt. Additional parameter C is used to distribute the heat
diff --git a/src/combustionModels/laminar/laminar.H b/src/combustionModels/laminar/laminar.H
index 0caf5a80f09402d1af1d3ecfc203e8b386261717..a4589d4ac1b4598f28000c2d6f3b6e8b2cc470e6 100644
--- a/src/combustionModels/laminar/laminar.H
+++ b/src/combustionModels/laminar/laminar.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::combustionModels::laminar
 
+Group
+    grpCombustionModels
+
 Description
     Laminar combustion model.
 
diff --git a/src/combustionModels/noCombustion/noCombustion.H b/src/combustionModels/noCombustion/noCombustion.H
index 7e7a3b37818d874c934e49d4c6e454b7695f8b74..641970fd6ff0840bea6d0506e4e4e6b2e48c9229 100644
--- a/src/combustionModels/noCombustion/noCombustion.H
+++ b/src/combustionModels/noCombustion/noCombustion.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::combustionModels::noCombustion
 
+Group
+    grpCombustionModels
+
 Description
     Dummy combustion model for 'no combustion'
 
diff --git a/src/combustionModels/singleStepCombustion/singleStepCombustion.H b/src/combustionModels/singleStepCombustion/singleStepCombustion.H
index 404bfe1c137eb9b5afc0c9059ec8496586470e26..4a17add9f13a0f4cde35c48af247d07e92750838 100644
--- a/src/combustionModels/singleStepCombustion/singleStepCombustion.H
+++ b/src/combustionModels/singleStepCombustion/singleStepCombustion.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::combustionModels::singleStepCombustion
 
+Group
+    grpCombustionModels
+
 Description
     Base class for combustion models using singleStepReactingMixture.
 
diff --git a/src/conversion/Make/files b/src/conversion/Make/files
index 7c5a0aa91c070a5903667e22ed7a76f864bfee0e..b4a38476a1f36cf356a883a6a8d44a59a1cdacf9 100644
--- a/src/conversion/Make/files
+++ b/src/conversion/Make/files
@@ -1,5 +1,6 @@
 ensight/file/ensightFile.C
 ensight/file/ensightGeoFile.C
+ensight/readFile/ensightReadFile.C
 ensight/part/ensightPart.C
 ensight/part/ensightPartIO.C
 ensight/part/ensightPartCells.C
diff --git a/src/conversion/ensight/file/ensightFile.C b/src/conversion/ensight/file/ensightFile.C
index 46809d4ebe7b38b8a0291752ed450da4e5fe749a..05003b2a0029dc54cb5661ecfc6ee04c1e4dbc3a 100644
--- a/src/conversion/ensight/file/ensightFile.C
+++ b/src/conversion/ensight/file/ensightFile.C
@@ -182,7 +182,6 @@ Foam::Ostream& Foam::ensightFile::write(const char* value)
     }
 
     return *this;
-
 }
 
 
@@ -282,14 +281,15 @@ Foam::Ostream& Foam::ensightFile::writeKeyword(const keyType& key)
 {
     if (allowUndef_)
     {
-        write(string(key + " undef"));
+        write(string(static_cast<const string&>(key) + " undef"));
         newline();
         write(undefValue_);
         newline();
     }
     else
     {
-        write(key);
+        // ensure we get ensightFile::write(const string&)
+        write(static_cast<const string&>(key));
         newline();
     }
     return *this;
diff --git a/src/conversion/ensight/file/ensightFile.H b/src/conversion/ensight/file/ensightFile.H
index faf07bd265b8dada2eab87e35224433ee6a7694d..03cbdcd7032503bb33039ffc9d879ead298ab2d1 100644
--- a/src/conversion/ensight/file/ensightFile.H
+++ b/src/conversion/ensight/file/ensightFile.H
@@ -144,7 +144,7 @@ public:
         using Ostream::write;
 
         //- Binary write
-        virtual Ostream& write(const char* buf, std::streamsize count);
+        virtual Ostream& write(const char*, std::streamsize count);
 
         //- Write element keyword with trailing newline, optionally with undef
         virtual Ostream& writeKeyword(const keyType&);
@@ -156,19 +156,19 @@ public:
         Ostream& writeUndef();
 
         //- Write C-string as "%79s" or as binary (max 80 chars)
-        Ostream& write(const char* value);
+        Ostream& write(const char*);
 
         //- Write string as "%79s" or as binary (max 80 chars)
-        Ostream& write(const string& value);
+        Ostream& write(const string&);
 
         //- Write integer as "%10d" or as binary
-        Ostream& write(const label value);
+        Ostream& write(const label);
 
         //- Write integer with specified width or as binary
-        Ostream& write(const label value, const label fieldWidth);
+        Ostream& write(const label, const label fieldWidth);
 
         //- Write float as "%12.5e" or as binary
-        Ostream& write(const scalar value);
+        Ostream& write(const scalar);
 
         //- Add carriage return to ascii stream
         void newline();
diff --git a/src/conversion/ensight/file/ensightGeoFile.C b/src/conversion/ensight/file/ensightGeoFile.C
index 214a882a5e4e3fde081545659536836b39992518..0119087e70f9dd17f8c009991a02ed20eeb88d92 100644
--- a/src/conversion/ensight/file/ensightGeoFile.C
+++ b/src/conversion/ensight/file/ensightGeoFile.C
@@ -24,14 +24,26 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "ensightGeoFile.H"
+#include "foamVersion.H"
+
+// Macros to stringify macro contents.
+#define STRINGIFY(content)      #content
+#define STRING_QUOTE(input)     STRINGIFY(input)
+
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 void Foam::ensightGeoFile::initialize()
 {
+    #ifdef OPENFOAM_PLUS
+    string desc2("Written by OpenFOAM+ " STRING_QUOTE(OPENFOAM_PLUS));
+    #else
+    string desc2("Written by OpenFOAM-" + string(Foam::FOAMversion));
+    #endif
+
     writeBinaryHeader();
     write("Ensight Geometry File");  newline(); // description line 1
-    write("=====================");  newline(); // description line 2
+    write(desc2);                    newline(); // description line 2
     write("node id assign");         newline();
     write("element id assign");      newline();
 }
@@ -74,7 +86,8 @@ Foam::ensightGeoFile::~ensightGeoFile()
 
 Foam::Ostream& Foam::ensightGeoFile::writeKeyword(const keyType& key)
 {
-    write(key); newline();
+    // ensure we get ensightFile::write(const string&)
+    write(static_cast<const string&>(key)); newline();
 
     return *this;
 }
diff --git a/src/conversion/ensight/part/ensightPart.H b/src/conversion/ensight/part/ensightPart.H
index feb6d371baf023b37d50b5ee2f1c03e68586fd31..f48d626ae422c1abd2a41a142267c208c679fcae 100644
--- a/src/conversion/ensight/part/ensightPart.H
+++ b/src/conversion/ensight/part/ensightPart.H
@@ -303,27 +303,6 @@ public:
         //- Helper: write geometry given the pointField
         void writeGeometry(ensightGeoFile&, const pointField&) const;
 
-        //- Write scalar field
-        //  optionally write data per node
-        void writeScalarField
-        (
-            ensightFile&,
-            const List<scalar>& field,
-            const bool perNode = false
-        ) const;
-
-        //- Write vector field components
-        //  optionally write data per node
-        void writeVectorField
-        (
-            ensightFile&,
-            const List<scalar>& field0,
-            const List<scalar>& field1,
-            const List<scalar>& field2,
-            const bool perNode = false
-        ) const;
-
-
         //- Write generalized field components
         //  optionally write data per node
         template<class Type>
diff --git a/src/conversion/ensight/part/ensightPartIO.C b/src/conversion/ensight/part/ensightPartIO.C
index 1457ff46c3670b365f96909e2e6e9df0c509674e..4e21d6dd62b8bfbea7d8caeadab33267f3455632 100644
--- a/src/conversion/ensight/part/ensightPartIO.C
+++ b/src/conversion/ensight/part/ensightPartIO.C
@@ -213,78 +213,6 @@ void Foam::ensightPart::writeGeometry
 }
 
 
-void Foam::ensightPart::writeScalarField
-(
-    ensightFile& os,
-    const List<scalar>& field,
-    const bool perNode
-) const
-{
-    if (size() && field.size() && (os.allowUndef() || isFieldDefined(field)))
-    {
-        writeHeader(os);
-
-        if (perNode)
-        {
-            os.writeKeyword("coordinates");
-            writeFieldList(os, field, labelUList::null());
-        }
-        else
-        {
-            forAll(elementTypes(), elemI)
-            {
-                const labelUList& idList = elemLists_[elemI];
-
-                if (idList.size())
-                {
-                    os.writeKeyword(elementTypes()[elemI]);
-                    writeFieldList(os, field, idList);
-                }
-            }
-        }
-    }
-}
-
-
-void Foam::ensightPart::writeVectorField
-(
-    ensightFile& os,
-    const List<scalar>& field0,
-    const List<scalar>& field1,
-    const List<scalar>& field2,
-    const bool perNode
-) const
-{
-    if (size() && field0.size() && (os.allowUndef() || isFieldDefined(field0)))
-    {
-        writeHeader(os);
-
-        if (perNode)
-        {
-            os.writeKeyword("coordinates");
-            writeFieldList(os, field0, labelUList::null());
-            writeFieldList(os, field1, labelUList::null());
-            writeFieldList(os, field2, labelUList::null());
-        }
-        else
-        {
-            forAll(elementTypes(), elemI)
-            {
-                const labelUList& idList = elemLists_[elemI];
-
-                if (idList.size())
-                {
-                    os.writeKeyword(elementTypes()[elemI]);
-                    writeFieldList(os, field0, idList);
-                    writeFieldList(os, field1, idList);
-                    writeFieldList(os, field2, idList);
-                }
-            }
-        }
-    }
-}
-
-
 // * * * * * * * * * * * * * * * IOstream Operators  * * * * * * * * * * * * //
 
 Foam::Ostream& Foam::operator<<
diff --git a/src/conversion/ensight/part/ensightPartTemplates.C b/src/conversion/ensight/part/ensightPartTemplates.C
index 32be0caef8d65593ea71bf2108c9ea39d97b31c3..13186460402ed81739c7856b4af8120470fb3385 100644
--- a/src/conversion/ensight/part/ensightPartTemplates.C
+++ b/src/conversion/ensight/part/ensightPartTemplates.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -27,6 +27,7 @@ Description
 \*---------------------------------------------------------------------------*/
 
 #include "ensightPart.H"
+#include "ensightPTraits.H"
 
 // * * * * * * * * * * * * * * * Global Functions  * * * * * * * * * * * * * //
 
@@ -45,13 +46,9 @@ void Foam::ensightPart::writeField
         if (perNode)
         {
             os.writeKeyword("coordinates");
-            for
-            (
-                direction cmpt=0;
-                cmpt < pTraits<Type>::nComponents;
-                ++cmpt
-            )
+            for (direction d=0; d < pTraits<Type>::nComponents; ++d)
             {
+                label cmpt = ensightPTraits<Type>::componentOrder[d];
                 writeFieldList(os, field.component(cmpt), labelUList::null());
             }
         }
@@ -65,13 +62,9 @@ void Foam::ensightPart::writeField
                 {
                     os.writeKeyword(elementTypes()[elemI]);
 
-                    for
-                    (
-                        direction cmpt=0;
-                        cmpt < pTraits<Type>::nComponents;
-                        ++cmpt
-                    )
+                    for (direction d=0; d < pTraits<Type>::nComponents; ++d)
                     {
+                        label cmpt = ensightPTraits<Type>::componentOrder[d];
                         writeFieldList(os, field.component(cmpt), idList);
                     }
                 }
diff --git a/src/conversion/ensight/part/ensightParts.C b/src/conversion/ensight/part/ensightParts.C
index a7675bf4839c3fb428f3ec8b4532e06ac021a919..1ad472966422766be94551af78fb2360521398e7 100644
--- a/src/conversion/ensight/part/ensightParts.C
+++ b/src/conversion/ensight/part/ensightParts.C
@@ -225,59 +225,6 @@ void Foam::ensightParts::writeData(Ostream& os) const
 }
 
 
-void Foam::ensightParts::writeScalarField
-(
-    ensightFile& os,
-    const List<scalar>& field,
-    const bool useFaceData,
-    const bool perNode
-) const
-{
-    forAll(partsList_, partI)
-    {
-        if
-        (
-            useFaceData
-          ? partsList_[partI].isFaceData()
-          : partsList_[partI].isCellData()
-        )
-        {
-            partsList_[partI].writeScalarField(os, field, perNode);
-        }
-    }
-}
-
-
-void Foam::ensightParts::writeVectorField
-(
-    ensightFile& os,
-    const List<scalar>& field0,
-    const List<scalar>& field1,
-    const List<scalar>& field2,
-    const bool useFaceData,
-    const bool perNode
-) const
-{
-    forAll(partsList_, partI)
-    {
-        if
-        (
-            useFaceData
-          ? partsList_[partI].isFaceData()
-          : partsList_[partI].isCellData()
-        )
-        {
-            partsList_[partI].writeVectorField
-            (
-                os,
-                field0, field1, field2,
-                perNode
-            );
-        }
-    }
-}
-
-
 // * * * * * * * * * * * * * * * *  IOStream operators * * * * * * * * * * * //
 
 Foam::ensightGeoFile& Foam::operator<<
diff --git a/src/conversion/ensight/part/ensightParts.H b/src/conversion/ensight/part/ensightParts.H
index 68c18774bab8d528a8d2e055a243951c01753e47..76712b9447bf31542b831c36471628a0cbb68c8a 100644
--- a/src/conversion/ensight/part/ensightParts.H
+++ b/src/conversion/ensight/part/ensightParts.H
@@ -108,31 +108,6 @@ public:
         //- Write the lists
         void writeData(Ostream&) const;
 
-        //- Write (volume) scalar field
-        //  optionally write data for face parts
-        //  optionally write data per node
-        void writeScalarField
-        (
-            ensightFile&,
-            const List<scalar>& field,
-            const bool useFaceData = false,
-            const bool perNode = false
-        ) const;
-
-        //- Write (volume) vector field components
-        //  optionally write data for face parts
-        //  optionally write data per node
-        void writeVectorField
-        (
-            ensightFile&,
-            const List<scalar>& field0,
-            const List<scalar>& field1,
-            const List<scalar>& field2,
-            const bool useFaceData = false,
-            const bool perNode = false
-        ) const;
-
-
         //- Write generalized volume field components
         template<class Type>
         void writeField
diff --git a/src/conversion/ensight/readFile/ensightReadFile.C b/src/conversion/ensight/readFile/ensightReadFile.C
new file mode 100644
index 0000000000000000000000000000000000000000..f73d95199e541aeb42939407a3296de95a91cc7d
--- /dev/null
+++ b/src/conversion/ensight/readFile/ensightReadFile.C
@@ -0,0 +1,157 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "ensightReadFile.H"
+#include <sstream>
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::ensightReadFile::ensightReadFile
+(
+    const fileName& pathname,
+    IOstream::streamFormat format
+)
+:
+    IFstream(pathname, format)
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::ensightReadFile::~ensightReadFile()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+Foam::Istream& Foam::ensightReadFile::read
+(
+    char* buf,
+    std::streamsize count
+)
+{
+    stdStream().read(buf, count);
+    return *this;
+}
+
+
+Foam::Istream& Foam::ensightReadFile::read(string& value)
+{
+    if (format() == IOstream::BINARY)
+    {
+        char buf[80];
+
+        read(reinterpret_cast<char*>(buf), sizeof(buf));
+
+        string strBuf(value);
+
+        const size_t iEnd = strBuf.find('\0', 0);
+        if (iEnd == string::npos)
+        {
+            value = buf;
+        }
+        else
+        {
+            value = strBuf.substr(0, iEnd - 1);
+        }
+    }
+    else
+    {
+        value = "";
+        while (value.empty() && !eof())
+        {
+            getLine(value);
+        }
+    }
+
+    return *this;
+}
+
+
+Foam::Istream& Foam::ensightReadFile::read(label& value)
+{
+    int ivalue;
+
+    if (format() == IOstream::BINARY)
+    {
+        read
+        (
+            reinterpret_cast<char*>(&ivalue),
+            sizeof(ivalue)
+        );
+    }
+    else
+    {
+        stdStream() >> ivalue;
+    }
+
+    value = ivalue;
+    return *this;
+}
+
+
+Foam::Istream& Foam::ensightReadFile::read(scalar& value)
+{
+    float fvalue;
+
+    if (format() == IOstream::BINARY)
+    {
+        read
+        (
+            reinterpret_cast<char*>(&fvalue),
+            sizeof(fvalue)
+        );
+
+        value = fvalue;
+    }
+    else
+    {
+        stdStream() >> value;
+    }
+
+    return *this;
+}
+
+
+Foam::Istream& Foam::ensightReadFile::readKeyword(string& key)
+{
+    read(key);
+    return *this;
+}
+
+
+Foam::Istream& Foam::ensightReadFile::readBinaryHeader()
+{
+    if (format() == IOstream::BINARY)
+    {
+        string buffer;
+        read(buffer);
+    }
+
+    return *this;
+}
+
+
+// ************************************************************************* //
diff --git a/src/conversion/ensight/readFile/ensightReadFile.H b/src/conversion/ensight/readFile/ensightReadFile.H
new file mode 100644
index 0000000000000000000000000000000000000000..aa6723352bc1a3f1b5cd132410dc90073bfd1564
--- /dev/null
+++ b/src/conversion/ensight/readFile/ensightReadFile.H
@@ -0,0 +1,110 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::ensightReadFile
+
+Description
+    Ensight output with specialized read() for strings, integers and floats.
+    Correctly handles binary read as well.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef ensightReadFile_H
+#define ensightReadFile_H
+
+#include "IFstream.H"
+#include "IOstream.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                       Class ensightReadFile Declaration
+\*---------------------------------------------------------------------------*/
+
+class ensightReadFile
+:
+    public IFstream
+{
+    // Private Member Functions
+
+        //- Disallow default bitwise assignment
+        void operator=(const ensightReadFile&);
+
+        //- Disallow default copy constructor
+        ensightReadFile(const ensightReadFile&);
+
+
+public:
+
+    // Constructors
+
+        //- Construct from pathname
+        ensightReadFile
+        (
+            const fileName& pathname,
+            IOstream::streamFormat format=IOstream::BINARY
+        );
+
+
+    //- Destructor
+    ~ensightReadFile();
+
+
+    // Output
+
+        //- Inherit read from Istream
+        using Istream::read;
+
+        //- Binary read
+        virtual Istream& read(char* buf, std::streamsize count);
+
+        //- Read string as "%80s" or as binary
+        Istream& read(string& value);
+
+        //- Read integer as "%10d" or as binary
+        Istream& read(label& value);
+
+        //- Read float as "%12.5e" or as binary
+        Istream& read(scalar& value);
+
+        //- Read element keyword
+        virtual Istream& readKeyword(string& key);
+
+        //- Read "C Binary" for binary files (eg, geometry/measured)
+        Istream& readBinaryHeader();
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/dummyThirdParty/metisDecomp/metis.h b/src/dummyThirdParty/metisDecomp/metis.h
index 7b6ca31fc62f5f2b02b7dce8cde161b54549726d..b594fc09b1d322c48448d78c4d93eb1feeb1b711 100644
--- a/src/dummyThirdParty/metisDecomp/metis.h
+++ b/src/dummyThirdParty/metisDecomp/metis.h
@@ -1,5 +1,5 @@
 #ifndef METIS_H
-#define METIS_H 1
+#define METIS_H
 
 /* *** DUMMY VERSION of metis.h - this file should not be included if you have metis
  *     installed in the correct position in $WM_THIRD_PARTY_DIR - see
@@ -8,39 +8,52 @@
 
 #warning "Dummy metis.h - gets included since it cannot find metis installation."
 
-#define IDXTYPEWIDTH 32
+// Integer type: OpenFOAM uses WM_LABEL_SIZE, metis.h uses IDXTYPEWIDTH
+#if WM_LABEL_SIZE == 32
+  typedef int32_t idx_t;
 
-/*------------------------------------------------------------------------
-* Undefine the following #define in order to use short idxtype as the idxtype 
-*-------------------------------------------------------------------------*/
-#if IDXTYPEWIDTH == 32
+  #define IDXTYPEWIDTH 32
   #define SCNIDX  SCNd32
   #define PRIIDX  PRId32
+#elif WM_LABEL_SIZE == 64
+  typedef int64_t idx_t;
 
-  typedef int32_t idxtype;
-#elif IDXTYPEWIDTH == 64
+  #define IDXTYPEWIDTH 64
   #define SCNIDX  SCNd64
   #define PRIIDX  PRId64
-
-  typedef int64_t idxtype;
 #else
-  #error "Incorrect user-supplied value fo IDXTYPEWIDTH"
+  #error "Incorrect user-supplied value for WM_LABEL_SIZE  (metis IDXTYPEWIDTH)"
 #endif
 
 
-void METIS_WPartGraphRecursive(idxtype *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt,
-                   idxtype *adjwgt, idxtype *wgtflag, idxtype *numflag, idxtype *nparts, float *tpwgts, 
-                   idxtype *options, idxtype *edgecut, idxtype *part);
-void METIS_PartGraphRecursive(idxtype *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt,
-                   idxtype *adjwgt, idxtype *wgtflag, idxtype *numflag, idxtype *nparts, idxtype *options, 
-                   idxtype *edgecut, idxtype *part);
-void METIS_WPartGraphKway(idxtype *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, 
-                   idxtype *adjwgt, idxtype *wgtflag, idxtype *numflag, idxtype *nparts, float *tpwgts, 
-                   idxtype *options, idxtype *edgecut, idxtype *part); 
-void METIS_PartGraphKway(idxtype *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, 
-                   idxtype *adjwgt, idxtype *wgtflag, idxtype *numflag, idxtype *nparts, idxtype *options, 
-                   idxtype *edgecut, idxtype *part); 
+// Float type: OpenFOAM uses WM_SP, WM_DP, metis.h uses REALTYPEWIDTH
+#if defined(WM_SP)
+  typedef float real_t;
+  #define REALTYPEWIDTH 32
+#elif defined(WM_DP)
+  typedef double real_t;
+  #define REALTYPEWIDTH 64
+#else
+  #error "Incorrect user-supplied value for WM_SP / WM_DP  (metis REALTYPEWIDTH)"
+#endif
+
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+int            METIS_PartGraphRecursive(idx_t *nvtxs, idx_t *ncon, idx_t *xadj,
+                  idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt,
+                  idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options,
+                  idx_t *edgecut, idx_t *part);
+
+int            METIS_PartGraphKway(idx_t *nvtxs, idx_t *ncon, idx_t *xadj,
+                  idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt,
+                  idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options,
+                  idx_t *edgecut, idx_t *part);
+
+#ifdef __cplusplus
+}
+#endif
 
 
 #endif
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C
index 5136f38376253a5ec674b83a1f4403b330a63bf7..c64fa8fd3c8ab9c851b8da4440f4ffb9948c9d6e 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C
@@ -458,7 +458,7 @@ void Foam::edgeCollapser::faceCollapseAxisAndAspectRatio
             // normal, as it has the greatest value.  The minimum eigenvalue
             // is the dominant collapse axis for high aspect ratio faces.
 
-            collapseAxis = eigenVector(J, eVals.x());
+            collapseAxis = eigenVectors(J, eVals).x();
 
             // The inertia calculation describes the mass distribution as a
             // function of distance squared to the axis, so the square root of
diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files
index cb44ca9e26fe66ddf3f8ceb48407b5b8d7f08188..f2de327da3272c4c4caf5a615587b03e16ee87ed 100644
--- a/src/finiteVolume/Make/files
+++ b/src/finiteVolume/Make/files
@@ -184,6 +184,9 @@ $(derivedFvPatchFields)/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueF
 $(derivedFvPatchFields)/totalPressure/totalPressureFvPatchScalarField.C
 $(derivedFvPatchFields)/totalTemperature/totalTemperatureFvPatchScalarField.C
 $(derivedFvPatchFields)/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C
+$(derivedFvPatchFields)/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C
+$(derivedFvPatchFields)/turbulentDFSEMInlet/eddy/eddy.C
+$(derivedFvPatchFields)/turbulentDFSEMInlet/eddy/eddyIO.C
 $(derivedFvPatchFields)/turbulentInlet/turbulentInletFvPatchFields.C
 $(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C
 $(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C
index 5371eda4755cc5b03949db2b83ef0f7b82d1f64a..ad6ebca09f66a581d2926373b9d06bc7541187ef 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C
@@ -332,6 +332,20 @@ void Foam::activePressureForceBaffleVelocityFvPatchVectorField::updateCoeffs()
             areaFraction = 1 - openFraction_;
         }
 
+        if (patch().boundaryMesh().mesh().moving())
+        {
+            // All areas have been recalculated already so are consistent
+            // with the new points. Note we already only do this routine
+            // once per timestep. The alternative is to use the upToDate
+            // mechanism for regIOobject + polyMesh::upToDatePoints
+            initWallSf_ = patch().Sf();
+            initCyclicSf_ = patch().boundaryMesh()[cyclicPatchLabel_].Sf();
+            nbrCyclicSf_ =  refCast<const cyclicFvPatch>
+            (
+                patch().boundaryMesh()[cyclicPatchLabel_]
+            ).neighbFvPatch().Sf();
+        }
+
         // Update this wall patch
         vectorField::subField Sfw = patch().patch().faceAreas();
         vectorField newSfw((1 - areaFraction)*initWallSf_);
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C
index cfd6945420321bb39d23272b8c70e030414a8f4b..5771972313a2333218f602dd88049f36a80bdc10 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -329,55 +329,7 @@ void Foam::codedFixedValueFvPatchField<Type>::write(Ostream& os) const
     os.writeKeyword("redirectType") << redirectType_
         << token::END_STATEMENT << nl;
 
-    if (dict_.found("codeInclude"))
-    {
-        os.writeKeyword("codeInclude")
-            << token::HASH << token::BEGIN_BLOCK;
-
-        os.writeQuoted(string(dict_["codeInclude"]), false)
-            << token::HASH << token::END_BLOCK
-            << token::END_STATEMENT << nl;
-    }
-
-    if (dict_.found("localCode"))
-    {
-        os.writeKeyword("localCode")
-            << token::HASH << token::BEGIN_BLOCK;
-
-        os.writeQuoted(string(dict_["localCode"]), false)
-            << token::HASH << token::END_BLOCK
-            << token::END_STATEMENT << nl;
-    }
-
-    if (dict_.found("code"))
-    {
-        os.writeKeyword("code")
-            << token::HASH << token::BEGIN_BLOCK;
-
-        os.writeQuoted(string(dict_["code"]), false)
-            << token::HASH << token::END_BLOCK
-            << token::END_STATEMENT << nl;
-    }
-
-    if (dict_.found("codeOptions"))
-    {
-        os.writeKeyword("codeOptions")
-            << token::HASH << token::BEGIN_BLOCK;
-
-        os.writeQuoted(string(dict_["codeOptions"]), false)
-            << token::HASH << token::END_BLOCK
-            << token::END_STATEMENT << nl;
-    }
-
-    if (dict_.found("codeLibs"))
-    {
-        os.writeKeyword("codeLibs")
-            << token::HASH << token::BEGIN_BLOCK;
-
-        os.writeQuoted(string(dict_["codeLibs"]), false)
-            << token::HASH << token::END_BLOCK
-            << token::END_STATEMENT << nl;
-    }
+    codedBase::writeCodeDict(os, dict_);
 }
 
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C
index d1b53e144dbbc2c228cc8395d62b5dd0b9c6a23c..450aa8b9e623097315e488fd6dc2bed8b6668ec8 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -341,55 +341,7 @@ void Foam::codedMixedFvPatchField<Type>::write(Ostream& os) const
     os.writeKeyword("redirectType") << redirectType_
         << token::END_STATEMENT << nl;
 
-    if (dict_.found("codeInclude"))
-    {
-        os.writeKeyword("codeInclude")
-            << token::HASH << token::BEGIN_BLOCK;
-
-        os.writeQuoted(string(dict_["codeInclude"]), false)
-            << token::HASH << token::END_BLOCK
-            << token::END_STATEMENT << nl;
-    }
-
-    if (dict_.found("localCode"))
-    {
-        os.writeKeyword("localCode")
-            << token::HASH << token::BEGIN_BLOCK;
-
-        os.writeQuoted(string(dict_["localCode"]), false)
-            << token::HASH << token::END_BLOCK
-            << token::END_STATEMENT << nl;
-    }
-
-    if (dict_.found("code"))
-    {
-        os.writeKeyword("code")
-            << token::HASH << token::BEGIN_BLOCK;
-
-        os.writeQuoted(string(dict_["code"]), false)
-            << token::HASH << token::END_BLOCK
-            << token::END_STATEMENT << nl;
-    }
-
-    if (dict_.found("codeOptions"))
-    {
-        os.writeKeyword("codeOptions")
-            << token::HASH << token::BEGIN_BLOCK;
-
-        os.writeQuoted(string(dict_["codeOptions"]), false)
-            << token::HASH << token::END_BLOCK
-            << token::END_STATEMENT << nl;
-    }
-
-    if (dict_.found("codeLibs"))
-    {
-        os.writeKeyword("codeLibs")
-            << token::HASH << token::BEGIN_BLOCK;
-
-        os.writeQuoted(string(dict_["codeLibs"]), false)
-            << token::HASH << token::END_BLOCK
-            << token::END_STATEMENT << nl;
-    }
+    codedBase::writeCodeDict(os, dict_);
 }
 
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C
index 3f855d52fa7a1ccbf96f92254457daa8f586a9bd..24714aaf46ee9ca605ca68aa7e77675013500cdd 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C
@@ -48,7 +48,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
 :
     uniformJumpFvPatchField<Type>(p, iF),
     phiName_("phi"),
-    rhoName_("rho")
+    rhoName_("rho"),
+    uniformJump_(false)
 {}
 
 
@@ -62,7 +63,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
 :
     uniformJumpFvPatchField<Type>(p, iF, dict),
     phiName_(dict.lookupOrDefault<word>("phi", "phi")),
-    rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
+    rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
+    uniformJump_(dict.lookupOrDefault<bool>("uniformJump", "false"))
 {}
 
 
@@ -77,7 +79,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
 :
     uniformJumpFvPatchField<Type>(ptf, p, iF, mapper),
     phiName_(ptf.phiName_),
-    rhoName_(ptf.rhoName_)
+    rhoName_(ptf.rhoName_),
+    uniformJump_(ptf.uniformJump_)
 {}
 
 
@@ -89,7 +92,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
 :
     uniformJumpFvPatchField<Type>(ptf),
     phiName_(ptf.phiName_),
-    rhoName_(ptf.rhoName_)
+    rhoName_(ptf.rhoName_),
+    uniformJump_(ptf.uniformJump_)
 {}
 
 
@@ -102,7 +106,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
 :
     uniformJumpFvPatchField<Type>(ptf, iF),
     phiName_(ptf.phiName_),
-    rhoName_(ptf.rhoName_)
+    rhoName_(ptf.rhoName_),
+    uniformJump_(ptf.uniformJump_)
 {}
 
 
@@ -129,6 +134,10 @@ void Foam::fanFvPatchField<Type>::write(Ostream& os) const
     uniformJumpFvPatchField<Type>::write(os);
     this->template writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
     this->template writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
+    this->template writeEntryIfDifferent<bool>
+    (
+        os, "uniformJump", false, uniformJump_
+    );
 }
 
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H
index b1080e264f75f287bca778e4bdc301ae92d180f2..ccd25cc8c42d35d120665361c6552f45d0ee2b7c 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H
@@ -42,6 +42,8 @@ Description
         jumpTable    | jump data, e.g. \c csvFile | yes      |
         phi          | flux field name         | no          | phi
         rho          | density field name      | no          | none
+        uniformJump  | applies a uniform pressure based on the averaged
+                       velocity | no | false
     \endtable
 
     Example of the boundary condition specification:
@@ -53,10 +55,11 @@ Description
         jumpTable       csvFile;
         csvFileCoeffs
         {
-            hasHeaderLine   1;
+            nHeaderLine     1;
             refColumn       0;
             componentColumns 1(1);
             separator       ",";
+            mergeSeparators no;
             fileName        "$FOAM_CASE/constant/pressureVsU";
         }
         value           uniform 0;
@@ -67,7 +70,7 @@ Description
     the jump condition.
 
 Note
-     The underlying \c patchType should be set to \c cyclic
+    The underlying \c patchType should be set to \c cyclic
 
 SeeAlso
     Foam::Function1Types
@@ -109,6 +112,9 @@ class fanFvPatchField
         //  if neccessary
         word rhoName_;
 
+        //- Uniform pressure drop
+        bool uniformJump_;
+
 
     // Private Member Functions
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C
index a4f2809df8c2d7a6fdb0b82c9978f1703b3fc37b..fd0b61bdaae352c95e06a0f26e2e40a16ee5deca 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C
@@ -44,6 +44,11 @@ void Foam::fanFvPatchField<Foam::scalar>::calcFanJump()
             patch().patchField<surfaceScalarField, scalar>(phi);
 
         scalarField Un(max(phip/patch().magSf(), scalar(0)));
+        if (uniformJump_)
+        {
+            scalar area = gSum(patch().magSf());
+            Un = gSum(Un*patch().magSf())/area;
+        }
 
         if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
         {
@@ -67,7 +72,8 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField
 :
     uniformJumpFvPatchField<scalar>(p, iF),
     phiName_(dict.lookupOrDefault<word>("phi", "phi")),
-    rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
+    rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
+    uniformJump_(dict.lookupOrDefault<bool>("uniformJump", false))
 {
     if (this->cyclicPatch().owner())
     {
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddy.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddy.C
new file mode 100644
index 0000000000000000000000000000000000000000..b4a73f3b91f51a30870c4ec1ea8048b501bf1e83
--- /dev/null
+++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddy.C
@@ -0,0 +1,356 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015 OpenFOAM Foundation
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "eddy.H"
+#include "mathematicalConstants.H"
+
+using namespace Foam::constant;
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+Foam::label Foam::eddy::Gamma2Values[] = {1, 2, 3, 4, 5, 6, 7, 8};
+Foam::UList<Foam::label> Foam::eddy::Gamma2(&Gamma2Values[0], 8);
+int Foam::eddy::debug = 0;
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+bool Foam::eddy::setScales
+(
+    const scalar sigmaX,
+    const label gamma2,
+    const vector& e,
+    const vector& lambda,
+    vector& sigma,
+    vector& alpha
+) const
+{
+    // Static array of gamma^2 vs c2 coefficient
+    static const scalar gamma2VsC2[8] =
+        {2, 1.875, 1.737, 1.75, 0.91, 0.825, 0.806, 1.5};
+
+    scalar gamma = Foam::sqrt(scalar(gamma2));
+
+    // c2 coefficient retrieved from array
+    scalar c2 = gamma2VsC2[gamma2 - 1];
+
+    // Length scale in largest eigenvalue direction
+    label d1 = dir1_;
+    label d2 = (d1 + 1) % 3;
+    label d3 = (d1 + 2) % 3;
+
+    sigma[d1] = sigmaX;
+
+    // Note: sigma_average = 1/3*(sigma_x + sigma_y + sigma_z)
+    // Substituting for sigma_y = sigma_x/gamma and sigma_z = sigma_y
+    //sigma[d1] = 3*sigmaX/(1 + 2/gamma);
+    // Other length scales equal, as function of major axis length and gamma
+    sigma[d2] = sigma[d1]/gamma;
+    sigma[d3] = sigma[d2];
+
+    vector sigma2 = cmptMultiply(sigma, sigma);
+    scalar slos2 = cmptSum(cmptDivide(lambda, sigma2));
+
+    bool ok = true;
+
+    for (label beta = 0; beta < 3; ++beta)
+    {
+        scalar x = slos2 - 2*lambda[beta]/sigma2[beta];
+
+        if (x < 0)
+        {
+            alpha[beta] = 0;
+            ok = false;
+        }
+        else
+        {
+            alpha[beta] = e[beta]*sqrt(x/(2*c2));
+        }
+    }
+
+    if (debug > 1)
+    {
+        Pout<< "c2:" << c2
+            << ", gamma2:" << gamma2
+            << ", gamma:" << gamma
+            << ", lambda:" << lambda
+            << ", sigma2: " << sigma2
+            << ", slos2: " << slos2
+            << ", sigmaX:" << sigmaX
+            << ", sigma:" << sigma
+            << ", alpha:" << alpha
+            << endl;
+    }
+
+    return ok;
+}
+
+
+// * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * * * //
+
+Foam::eddy::eddy()
+:
+    patchFaceI_(-1),
+    position0_(vector::zero),
+    x_(0),
+    sigma_(vector::zero),
+    alpha_(vector::zero),
+    Rpg_(tensor::I),
+    c1_(-1),
+    dir1_(0)
+{}
+
+
+Foam::eddy::eddy
+(
+    const label patchFaceI,
+    const point& position0,
+    const scalar x,
+    const scalar sigmaX,
+    const symmTensor& R,
+    cachedRandom& rndGen
+)
+:
+    patchFaceI_(patchFaceI),
+    position0_(position0),
+    x_(x),
+    sigma_(vector::zero),
+    alpha_(vector::zero),
+    Rpg_(tensor::I),
+    c1_(-1),
+    dir1_(0)
+{
+    // Principal stresses - eigenvalues returned in ascending order
+    vector lambda = eigenValues(R);
+
+    // Eddy rotation from principal-to-global axes
+    // - given by the 3 eigenvectors of the Reynold stress tensor as rows in
+    //   the result tensor (transposed transformation tensor)
+    // - returned in ascending eigenvalue order
+    Rpg_ = eigenVectors(R, lambda).T();
+
+    if (debug)
+    {
+        // Global->Principal transform = Rgp = Rpg.T()
+        // Rgp & R & Rgp.T() should have eigenvalues on its diagonal and
+        // zeros for all other components
+        Pout<< "Rpg.T() & R & Rpg: " << (Rpg_.T() & R & Rpg_) << endl;
+    }
+
+    // Set the eddy orientation to position of max eigenvalue
+    // (direction of eddy major axis, sigma_x in reference)
+    dir1_ = 2;
+
+    // Random vector of 1's and -1's
+    const vector e(epsilon(rndGen));
+
+    // Set intensities and length scales
+    bool found = false;
+    forAll(Gamma2, i)
+    {
+        // Random length scale ratio, gamma = sigmax/sigmay = sigmax/sigmaz
+        // - using gamma^2 to ease lookup of c2 coefficient
+        label g2 = Gamma2[i];
+
+        if (setScales(sigmaX, g2, e, lambda, sigma_, alpha_))
+        {
+            found = true;
+            break;
+        }
+    }
+
+    // Normalisation coefficient (eq. 11)
+    // Note: sqrt(10*V)/sqrt(nEddy) applied outside when computing uDash
+    c1_ = cmptAv(sigma_)/cmptProduct(sigma_)*cmptMin(sigma_);
+
+    if (found)
+    {
+        // Shuffle the gamma^2 values
+        rndGen.shuffle(Gamma2);
+    }
+    else
+    {
+        if (debug)
+        {
+            // If not found typically means that the stress has a repeated
+            // eigenvalue/not covered by the selection of Gamma values, e.g.
+            // as seen by range of applicability on Lumley diagram
+            WarningInFunction
+                << "Unable to set eddy intensity for eddy: " << *this
+                << endl;
+        }
+
+        // Remove the influence of this eddy/indicate that its initialisation
+        // failed
+        patchFaceI_ = -1;
+    }
+}
+
+
+Foam::eddy::eddy(const eddy& e)
+:
+    patchFaceI_(e.patchFaceI_),
+    position0_(e.position0_),
+    x_(e.x_),
+    sigma_(e.sigma_),
+    alpha_(e.alpha_),
+    Rpg_(e.Rpg_),
+    c1_(e.c1_),
+    dir1_(e.dir1_)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+Foam::vector Foam::eddy::uDash(const point& xp, const vector& n) const
+{
+    // Relative position inside eddy (global system)
+    const vector r = cmptDivide(xp - position(n), sigma_);
+
+    if (mag(r) > 1)
+    {
+        return vector::zero;
+    }
+
+    // Relative position inside eddy (eddy principal system)
+    const vector rp = Rpg_.T() & r;
+
+    // Shape function (eddy principal system)
+    const vector q = cmptMultiply(sigma_, vector::one - cmptMultiply(rp, rp));
+
+    // Fluctuating velocity (eddy principal system) (eq. 8)
+    const vector uDashp = cmptMultiply(q, rp^alpha_);
+
+    // Convert into global system (eq. 10)
+    return c1_*(Rpg_ & uDashp);
+}
+
+
+void Foam::eddy::writeCentreOBJ
+(
+    const vector& n,
+    Ostream& os
+) const
+{
+    point p = position(n);
+    os  << "v " << p.x() << " " << p.y() << " " << p.z() << nl;
+}
+
+
+Foam::label Foam::eddy::writeSurfaceOBJ
+(
+    const label pointOffset,
+    const vector& n,
+    Ostream& os
+) const
+{
+    if (patchFaceI_ < 0)
+    {
+        // Invalid eddy
+        return 0;
+    }
+
+    static const label nFaceAxis = 20;
+    static const label nFaceTheta = 22;
+    static const label nEddyPoints = (nFaceAxis - 1)*nFaceTheta + 2;
+    static FixedList<point, nEddyPoints> x;
+
+    static scalar dTheta = mathematical::twoPi/nFaceTheta;
+    static scalar dPhi = mathematical::pi/scalar(nFaceAxis);
+
+    label pointI = pointOffset;
+
+    const vector& s = sigma_;
+
+    const vector axisDir = tensor::I.vectorComponent(dir1_);
+    const label dir2 = (dir1_ + 1) % 3;
+    const label dir3 = (dir1_ + 2) % 3;
+
+    // Calculate the point positions
+    x[0] = axisDir*s[dir1_];
+    x[nEddyPoints - 1] = - axisDir*s[dir1_];
+
+    label eddyPtI = 1;
+    for (label axisI = 1; axisI < nFaceAxis; axisI++)
+    {
+        scalar z = s[dir1_]*cos(axisI*dPhi);
+        scalar r = sqrt(sqr(s[dir2])*(1 - sqr(z)/sqr(s[dir1_])));
+
+        for (label thetaI = 0; thetaI < nFaceTheta; thetaI++)
+        {
+            scalar theta = thetaI*dTheta;
+            point& p = x[eddyPtI++];
+            p[dir1_] = z;
+            p[dir2] = r*sin(theta);
+            p[dir3] = r*cos(theta);
+        }
+    }
+
+    // Write points
+    forAll(x, i)
+    {
+        point p = position(n) + (Rpg_ & x[i]);
+        os  << "v " << p.x() << " " << p.y() << " " << p.z() << nl;
+    }
+
+    // Write the end cap tri faces
+    for (label faceI = 0; faceI < nFaceTheta; faceI++)
+    {
+        label p1 = pointI + 1;
+        label p2 = p1 + faceI + 1;
+        label p3 = p2 + 1;
+        if (faceI == nFaceTheta - 1) p3 -= nFaceTheta;
+        os  << "f " << p1 << " " << p2 << " " << p3 << nl;
+
+        label q1 = pointI + nEddyPoints;
+        label q2 = q1 - faceI - 1;
+        label q3 = q2 - 1;
+        if (faceI == nFaceTheta - 1) q3 += nFaceTheta;
+        os  << "f " << q1 << " " << q2 << " " << q3 << nl;
+    }
+
+    // Write quad faces
+    for (label axisI = 1; axisI < nFaceAxis - 1; axisI++)
+    {
+        for (label thetaI = 0; thetaI < nFaceTheta; thetaI++)
+        {
+            label p1 = pointI + 1 + (axisI - 1)*nFaceTheta + thetaI + 1;
+            label p2 = p1 + nFaceTheta;
+            label p3 = p2 + 1;
+            label p4 = p1 + 1;
+
+            if (thetaI == nFaceTheta - 1)
+            {
+                p3 -= nFaceTheta;
+                p4 -= nFaceTheta;
+            }
+            os  << "f " << p1 << " " << p2 << " " << p3 << " " << p4 << nl;
+        }
+    }
+
+    return nEddyPoints;
+}
+
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddy.H b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddy.H
new file mode 100644
index 0000000000000000000000000000000000000000..e2f6be14059ecb8ecf8587815da800793e64ebcc
--- /dev/null
+++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddy.H
@@ -0,0 +1,247 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015 OpenFOAM Foundation
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::eddy
+
+Description
+    Class to describe eddies for the turbulentDFSEMInletFvPatchVectorField
+    boundary condition.
+
+SourceFiles
+    eddy.C
+    eddyI.H
+    eddyIO.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef turbulentDFSEMInletFvPatchVectorField_eddy_H
+#define turbulentDFSEMInletFvPatchVectorField_eddy_H
+
+#include "vector.H"
+#include "point.H"
+#include "tensor.H"
+#include "cachedRandom.H"
+#include "coordinateSystem.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                            Class eddy Declaration
+\*---------------------------------------------------------------------------*/
+
+class eddy
+{
+    // Private data
+
+        static label Gamma2Values[8];
+        static UList<label> Gamma2;
+
+        //- Patch face index that spawned the eddy
+        label patchFaceI_;
+
+        //- Reference position
+        point position0_;
+
+        //- Distance from reference position in normal direction
+        scalar x_;
+
+        //- Length scales in 3-D space
+        vector sigma_;
+
+        //- Time-averaged intensity
+        vector alpha_;
+
+        //- Co-ordinate system transformation from local to global axes
+        //  X-direction aligned with max stress eigenvalue
+        tensor Rpg_;
+
+        //- Model coefficient c1
+        scalar c1_;
+
+        //- Index of streamwise direction
+        label dir1_;
+
+
+    // Private Member Functions
+
+        //- Set the eddy scales: length, intensity
+        bool setScales
+        (
+            const scalar sigmaX,
+            const label gamma2,
+            const vector& e,
+            const vector& lambda,
+            vector& sigma,
+            vector& alpha
+        ) const;
+
+        //- Return a number with zero mean and unit variance
+        inline scalar epsi(cachedRandom& rndGen) const;
+
+
+public:
+
+    // Constructors
+
+        //- Construct null
+        eddy();
+
+        //- Construct from Istream
+        eddy(Istream& is);
+
+        //- Construct from components
+        eddy
+        (
+            const label patchFaceI,     // patch face index
+            const point& position0,     // reference position
+            const scalar x,             // distance from reference position
+            const scalar sigmaX,        // length scale
+            const symmTensor& R,        // Stress tensor
+            cachedRandom& rndGen
+        );
+
+        //- Construct copy
+        eddy(const eddy& e);
+
+        static int debug;
+
+
+    // Public Member Functions
+
+        // Access
+
+            //- Return the patch face index that spawned the eddy
+            inline label patchFaceI() const;
+
+            //- Return the reference position
+            inline const point& position0() const;
+
+            //- Return the distance from the reference position
+            inline scalar x() const;
+
+            //- Return the lLength scales in 3-D space
+            inline const vector& sigma() const;
+
+            //- Return the time-averaged intensity
+            inline const vector& alpha() const;
+
+            //- Return the co-ordinate system transformation from local
+            //  principal to global axes
+            inline const tensor& Rpg() const;
+
+            //- Return the model coefficient c1
+            inline scalar c1() const;
+
+            //- Return the eddy position
+            inline point position(const vector& n) const;
+
+            //- Return the index of the streamwise direction
+            inline label dir1() const;
+
+            //- Return random vector of -1 and 1's
+            inline vector epsilon(cachedRandom& rndGen) const;
+
+
+        // Helper functions
+
+            //- Volume
+            inline scalar volume() const;
+
+            //- Move the eddy
+            inline void move(const scalar dx);
+
+            //- Eddy bounds
+            inline boundBox bounds(const bool global = true) const;
+
+
+        // Evaluate
+
+            //- Return the fluctuating velocity contribution at local point xp
+            vector uDash(const point& xp, const vector& n) const;
+
+
+        // Writing
+
+            //- Write the eddy centre in OBJ format
+            void writeCentreOBJ(const vector& n, Ostream& os) const;
+
+            //- Write the eddy surface in OBJ format
+            //  Returns the number of points used to describe the eddy surface
+            label writeSurfaceOBJ
+            (
+                const label pointOffset,
+                const vector& n,
+                Ostream& os
+            ) const;
+
+
+    // Member Operators
+
+        void operator=(const eddy& e);
+
+
+    // Friend Operators
+
+        friend bool operator==(const eddy& a, const eddy& b)
+        {
+            return
+                a.patchFaceI_ == b.patchFaceI_
+             && a.position0_ == b.position0_
+             && a.x_ == b.x_
+             && a.sigma_ == b.sigma_
+             && a.alpha_ == b.alpha_
+             && a.Rpg_ == b.Rpg_
+             && a.c1_ == b.c1_
+             && a.dir1_ == b.dir1_;
+        }
+
+        friend bool operator!=(const eddy& a, const eddy& b)
+        {
+            return !(a == b);
+        }
+
+
+    // IOstream Operators
+
+        friend Istream& operator>>(Istream& is, eddy& e);
+        friend Ostream& operator<<(Ostream& os, const eddy& e);
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "eddyI.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddyI.H b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddyI.H
new file mode 100644
index 0000000000000000000000000000000000000000..82c579fcc541a9d3a4917e1a0c121127a8a134e5
--- /dev/null
+++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddyI.H
@@ -0,0 +1,124 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015 OpenFOAM Foundation
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "mathematicalConstants.H"
+
+using namespace Foam::constant;
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+Foam::scalar Foam::eddy::epsi(cachedRandom& rndGen) const
+{
+    // Random number with zero mean and unit variance
+    return rndGen.sample01<scalar>() > 0.5 ? 1 : -1;
+}
+
+
+inline Foam::label Foam::eddy::patchFaceI() const
+{
+    return patchFaceI_;
+}
+
+
+inline const Foam::point& Foam::eddy::position0() const
+{
+    return position0_;
+}
+
+
+inline Foam::scalar Foam::eddy::x() const
+{
+    return x_;
+}
+
+
+inline const Foam::vector& Foam::eddy::sigma() const
+{
+    return sigma_;
+}
+
+
+inline const Foam::vector& Foam::eddy::alpha() const
+{
+    return alpha_;
+}
+
+
+inline const Foam::tensor& Foam::eddy::Rpg() const
+{
+    return Rpg_;
+}
+
+
+inline Foam::point Foam::eddy::position(const vector& n) const
+{
+    return position0_ + n*x_;
+}
+
+
+inline Foam::scalar Foam::eddy::c1() const
+{
+    return c1_;
+}
+
+
+Foam::vector Foam::eddy::epsilon(cachedRandom& rndGen) const
+{
+    return vector(epsi(rndGen), epsi(rndGen), epsi(rndGen));
+}
+
+
+inline Foam::scalar Foam::eddy::volume() const
+{
+    return mathematical::pi*4.0/3.0*cmptProduct(sigma_);
+}
+
+
+void Foam::eddy::move(const scalar dx)
+{
+    x_ += dx;
+}
+
+
+Foam::boundBox Foam::eddy::bounds(const bool global) const
+{
+    boundBox bb;
+
+    if (global)
+    {
+        bb.min() = Rpg_ & -sigma_;
+        bb.max() = Rpg_ & sigma_;
+    }
+    else
+    {
+        bb.min() = -sigma_;
+        bb.max() = sigma_;
+    }
+
+    return bb;
+}
+
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddyIO.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddyIO.C
new file mode 100644
index 0000000000000000000000000000000000000000..cb5a49bbaee378daa0300d136819a3f126dc2277
--- /dev/null
+++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddyIO.C
@@ -0,0 +1,117 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015 OpenFOAM Foundation
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "eddy.H"
+#include "IOstreams.H"
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::eddy::eddy(Istream& is)
+:
+    patchFaceI_(readLabel(is)),
+    position0_(is),
+    x_(readScalar(is)),
+    sigma_(is),
+    alpha_(is),
+    Rpg_(is),
+    c1_(readScalar(is)),
+    dir1_(readLabel(is))
+{
+    is.check("Foam::eddy::eddy(Foam::Istream&)");
+}
+
+
+// * * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * //
+
+void Foam::eddy::operator=(const eddy& e)
+{
+    patchFaceI_ = e.patchFaceI_;
+    position0_ = e.position0_;
+    x_ = e.x_;
+    sigma_ = e.sigma_;
+    alpha_ = e.alpha_;
+    Rpg_ = e.Rpg_;
+    c1_ = e.c1_;
+    dir1_ = e.dir1_;
+}
+
+
+// * * * * * * * * * * * * * * * IOstream Operators  * * * * * * * * * * * * //
+
+Foam::Istream& Foam::operator>>(Istream& is, eddy& e)
+{
+    is.check
+    (
+        "Foam::Istream& Foam::operator>>"
+        "(Foam::Istream&, Foam::eddy&)"
+    );
+
+    is  >> e.patchFaceI_
+        >> e.position0_
+        >> e.x_
+        >> e.sigma_
+        >> e.alpha_
+        >> e.Rpg_
+        >> e.c1_
+        >> e.dir1_;
+
+    is.check
+    (
+        "Foam::Istream& Foam::operator>>"
+        "(Foam::Istream&, Foam::eddy&)"
+    );
+
+    return is;
+}
+
+
+Foam::Ostream& Foam::operator<<(Ostream& os, const eddy& e)
+{
+    os.check
+    (
+        "Foam::Ostream& Foam::operator<<"
+        "(Foam::Ostream&, const Foam::eddy&)"
+    );
+
+    os  << e.patchFaceI_ << token::SPACE
+        << e.position0_ << token::SPACE
+        << e.x_ << token::SPACE
+        << e.sigma_ << token::SPACE
+        << e.alpha_ << token::SPACE
+        << e.Rpg_ << token::SPACE
+        << e.c1_ << token::SPACE
+        << e.dir1_;
+
+    os.check
+    (
+        "Foam::Ostream& Foam::operator<<"
+        "(Foam::Ostream&, const Foam::eddy&)"
+    );
+
+    return os;
+}
+
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C
new file mode 100644
index 0000000000000000000000000000000000000000..59646f3ad86541b048e3493c87505d13c8325588
--- /dev/null
+++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C
@@ -0,0 +1,1152 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015 OpenFOAM Foundation
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "turbulentDFSEMInletFvPatchVectorField.H"
+#include "volFields.H"
+#include "addToRunTimeSelectionTable.H"
+#include "fvPatchFieldMapper.H"
+#include "momentOfInertia.H"
+#include "cartesianCS.H"
+#include "OFstream.H"
+#include "globalIndex.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+Foam::label Foam::turbulentDFSEMInletFvPatchVectorField::seedIterMax_ = 1000;
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+void Foam::turbulentDFSEMInletFvPatchVectorField::writeEddyOBJ() const
+{
+    {
+        // Output the bounding box
+        OFstream os(db().time().path()/"eddyBox.obj");
+
+        const polyPatch& pp = this->patch().patch();
+        const labelList& boundaryPoints = pp.boundaryPoints();
+        const pointField& localPoints = pp.localPoints();
+
+        vector offset = patchNormal_*maxSigmaX_;
+        forAll(boundaryPoints, i)
+        {
+            point p = localPoints[boundaryPoints[i]];
+            p += offset;
+            os  << "v " << p.x() << " " << p.y() << " " << p.z() << nl;
+        }
+
+        forAll(boundaryPoints, i)
+        {
+            point p = localPoints[boundaryPoints[i]];
+            p -= offset;
+            os  << "v " << p.x() << " " << p.y() << " " << p.z() << nl;
+        }
+
+        // Draw lines between points
+        // Note: need to order to avoid crossing patch
+        //const label nPoint = boundaryPoints.size();
+        //
+        //forAll(boundaryPoints, i)
+        //{
+        //    label i1 = i;
+        //    label i2 = (i + 1) % nPoint;
+        //    os  << "l " << i1 << " " << i2 << nl;
+        //}
+        //
+        //forAll(boundaryPoints, i)
+        //{
+        //    label i1 = i + nPoint;
+        //    label i2 = ((i + 1) % nPoint) + nPoint;
+        //    os  << "l " << i1 << " " << i2 << nl;
+        //}
+    }
+
+    {
+        const Time& time = db().time();
+        OFstream os
+        (
+            time.path()/"eddies_" + Foam::name(time.timeIndex()) + ".obj"
+        );
+
+        label pointOffset = 0;
+        forAll(eddies_, eddyI)
+        {
+            const eddy& e = eddies_[eddyI];
+            pointOffset += e.writeSurfaceOBJ(pointOffset, patchNormal_, os);
+        }
+    }
+}
+
+
+void Foam::turbulentDFSEMInletFvPatchVectorField::writeLumleyCoeffs() const
+{
+    // Output list of xi vs eta
+
+    // Before interpolation/raw data
+    if (interpolateR_)
+    {
+        AverageIOField<symmTensor> Rexp
+        (
+            IOobject
+            (
+                "R",
+                this->db().time().caseConstant(),
+                "boundaryData"/patch().name()/"0",
+                this->db(),
+                IOobject::MUST_READ,
+                IOobject::AUTO_WRITE,
+                false
+            )
+        );
+
+        OFstream os(db().time().path()/"lumley_input.out");
+
+        os  << "# xi" << token::TAB << "eta" << endl;
+
+        forAll(Rexp, faceI)
+        {
+            // Normalised anisotropy tensor
+            symmTensor devR = dev(Rexp[faceI]/(tr(Rexp[faceI])));
+
+            // Second tensor invariant
+            scalar ii = min(0, invariantII(devR));
+
+            // Third tensor invariant
+            scalar iii = invariantIII(devR);
+
+            // xi, eta
+            // See Pope - characterization of Reynolds-stress anisotropy
+            scalar xi = cbrt(0.5*iii);
+            scalar eta = sqrt(-ii/3.0);
+            os  << xi << token::TAB << eta << token::TAB
+                << ii << token::TAB << iii << endl;
+        }
+    }
+
+    // After interpolation
+    {
+        OFstream os(db().time().path()/"lumley_interpolated.out");
+
+        os  << "# xi" << token::TAB << "eta" << endl;
+
+        forAll(R_, faceI)
+        {
+            // Normalised anisotropy tensor
+            symmTensor devR = dev(R_[faceI]/(tr(R_[faceI])));
+
+            // Second tensor invariant
+            scalar ii = min(0, invariantII(devR));
+
+            // Third tensor invariant
+            scalar iii = invariantIII(devR);
+
+            // xi, eta
+            // See Pope - characterization of Reynolds-stress anisotropy
+            scalar xi = cbrt(0.5*iii);
+            scalar eta = sqrt(-ii/3.0);
+            os  << xi << token::TAB << eta << token::TAB
+                << ii << token::TAB << iii << endl;
+        }
+    }
+}
+
+
+const Foam::pointToPointPlanarInterpolation&
+Foam::turbulentDFSEMInletFvPatchVectorField::patchMapper() const
+{
+    // Initialise interpolation (2D planar interpolation by triangulation)
+    if (mapperPtr_.empty())
+    {
+//        vectorGlobalIOField samplePoints
+        vectorIOField samplePoints
+        (
+            IOobject
+            (
+                "points",
+                this->db().time().caseConstant(),
+                "boundaryData"/this->patch().name(),
+                this->db(),
+                IOobject::MUST_READ,
+                IOobject::AUTO_WRITE,
+                false
+            )
+        );
+
+        const fileName samplePointsFile = samplePoints.filePath();
+
+        if (debug)
+        {
+            InfoInFunction
+                << " Read " << samplePoints.size() << " sample points from "
+                << samplePointsFile << endl;
+        }
+
+
+        // tbd: run-time selection
+        bool nearestOnly =
+        (
+           !mapMethod_.empty()
+         && mapMethod_ != "planarInterpolation"
+        );
+
+        // Allocate the interpolator
+        mapperPtr_.reset
+        (
+            new pointToPointPlanarInterpolation
+            (
+                samplePoints,
+                this->patch().patch().faceCentres(),
+                perturb_,
+                nearestOnly
+            )
+        );
+    }
+
+    return mapperPtr_();
+}
+
+
+void Foam::turbulentDFSEMInletFvPatchVectorField::initialisePatch()
+{
+    const vectorField nf(patch().nf());
+
+    // Patch normal points into domain
+    patchNormal_ = -gAverage(nf);
+
+    // Check that patch is planar
+    scalar error = max(magSqr(patchNormal_ + nf));
+
+    if (error > SMALL)
+    {
+        WarningInFunction
+            << "Patch " << patch().name() << " is not planar"
+            << endl;
+    }
+
+    patchNormal_ /= mag(patchNormal_) + ROOTVSMALL;
+
+
+    // Decompose the patch faces into triangles to enable point search
+
+    const polyPatch& patch = this->patch().patch();
+    const pointField& points = patch.points();
+
+    // Triangulate the patch faces and create addressing
+    DynamicList<label> triToFace(2*patch.size());
+    DynamicList<scalar> triMagSf(2*patch.size());
+    DynamicList<face> triFace(2*patch.size());
+    DynamicList<face> tris(5);
+
+    // Set zero value at the start of the tri area list
+    triMagSf.append(0.0);
+
+    forAll(patch, faceI)
+    {
+        const face& f = patch[faceI];
+
+        tris.clear();
+        f.triangles(points, tris);
+
+        forAll(tris, i)
+        {
+            triToFace.append(faceI);
+            triFace.append(tris[i]);
+            triMagSf.append(tris[i].mag(points));
+        }
+    }
+
+    forAll(sumTriMagSf_, i)
+    {
+        sumTriMagSf_[i] = 0.0;
+    }
+
+    sumTriMagSf_[Pstream::myProcNo() + 1] = sum(triMagSf);
+
+    Pstream::listCombineGather(sumTriMagSf_, maxEqOp<scalar>());
+    Pstream::listCombineScatter(sumTriMagSf_);
+
+    for (label i = 1; i < triMagSf.size(); i++)
+    {
+        triMagSf[i] += triMagSf[i-1];
+    }
+
+    // Transfer to persistent storage
+    triFace_.transfer(triFace);
+    triToFace_.transfer(triToFace);
+    triCumulativeMagSf_.transfer(triMagSf);
+
+    // Convert sumTriMagSf_ into cumulative sum of areas per proc
+    for (label i = 1; i < sumTriMagSf_.size(); i++)
+    {
+        sumTriMagSf_[i] += sumTriMagSf_[i-1];
+    }
+
+    // Global patch area (over all processors)
+    patchArea_ = sumTriMagSf_.last();
+
+    // Local patch bounds (this processor)
+    patchBounds_ = boundBox(patch.localPoints(), false);
+    patchBounds_.inflate(0.1);
+
+    // Determine if all eddies spawned from a single processor
+    singleProc_ = patch.size() == returnReduce(patch.size(), sumOp<label>());
+}
+
+
+void Foam::turbulentDFSEMInletFvPatchVectorField::initialiseEddyBox()
+{
+    const scalarField& magSf = patch().magSf();
+
+    //const scalarField cellDx(Foam::sqrt(magSf));
+    const scalarField cellDx(max(Foam::sqrt(magSf), 2/patch().deltaCoeffs()));
+
+    // Inialise eddy box extents
+    forAll(*this, faceI)
+    {
+        scalar& s = sigmax_[faceI];
+
+        // Length scale in x direction (based on eq. 14)
+        s = mag(L_[faceI]);
+        s = min(s, kappa_*delta_);
+
+        // Allow eddies to be smaller than the mesh scale as suggested by
+        // the reference?
+        // s = min(s, nCellPerEddy_*cellDx[faceI]);
+        s = max(s, nCellPerEddy_*cellDx[faceI]);
+    }
+
+    // Maximum extent across all processors
+    maxSigmaX_ = gMax(sigmax_);
+
+    // Eddy box volume
+    v0_ = 2*gSum(magSf)*maxSigmaX_;
+
+    if (debug)
+    {
+        Info<< "Patch: " << patch().patch().name() << " eddy box:" << nl
+            << "    volume    : " << v0_ << nl
+            << "    maxSigmaX : " << maxSigmaX_ << nl
+            << endl;
+    }
+}
+
+
+Foam::pointIndexHit Foam::turbulentDFSEMInletFvPatchVectorField::setNewPosition
+(
+    const bool global
+)
+{
+    // Initialise to miss
+    pointIndexHit pos(false, vector::max, -1);
+
+    const polyPatch& patch = this->patch().patch();
+    const pointField& points = patch.points();
+
+    if (global)
+    {
+        scalar areaFraction = rndGen_.globalPosition<scalar>(0, patchArea_);
+
+        // Determine which processor to use
+        label procI = 0;
+        forAllReverse(sumTriMagSf_, i)
+        {
+            if (areaFraction >= sumTriMagSf_[i])
+            {
+                procI = i;
+                break;
+            }
+        }
+
+        if (Pstream::myProcNo() == procI)
+        {
+            // Find corresponding decomposed face triangle
+            label triI = 0;
+            scalar offset = sumTriMagSf_[procI];
+            forAllReverse(triCumulativeMagSf_, i)
+            {
+                if (areaFraction > triCumulativeMagSf_[i] + offset)
+                {
+                    triI = i;
+                    break;
+                }
+            }
+
+            // Find random point in triangle
+            const face& tf = triFace_[triI];
+            const triPointRef tri(points[tf[0]], points[tf[1]], points[tf[2]]);
+
+            pos.setHit();
+            pos.setIndex(triToFace_[triI]);
+            pos.rawPoint() = tri.randomPoint(rndGen_);
+        }
+    }
+    else
+    {
+        // Find corresponding decomposed face triangle on local processor
+        label triI = 0;
+        scalar maxAreaLimit = triCumulativeMagSf_.last();
+        scalar areaFraction = rndGen_.position<scalar>(0, maxAreaLimit);
+
+        forAllReverse(triCumulativeMagSf_, i)
+        {
+            if (areaFraction > triCumulativeMagSf_[i])
+            {
+                triI = i;
+                break;
+            }
+        }
+
+        // Find random point in triangle
+        const face& tf = triFace_[triI];
+        const triPointRef tri(points[tf[0]], points[tf[1]], points[tf[2]]);
+
+        pos.setHit();
+        pos.setIndex(triToFace_[triI]);
+        pos.rawPoint() = tri.randomPoint(rndGen_);
+    }
+
+    return pos;
+}
+
+
+void Foam::turbulentDFSEMInletFvPatchVectorField::initialiseEddies()
+{
+    DynamicList<eddy> eddies(size());
+
+    // Initialise eddy properties
+    scalar sumVolEddy = 0;
+    scalar sumVolEddyAllProc = 0;
+
+    while (sumVolEddyAllProc/v0_ < d_)
+    {
+        bool search = true;
+        label iter = 0;
+
+        while (search && iter++ < seedIterMax_)
+        {
+            // Get new parallel consistent position
+            pointIndexHit pos(setNewPosition(true));
+            label faceI = pos.index();
+
+            // Note: only 1 processor will pick up this face
+            if (faceI != -1)
+            {
+                eddy e
+                (
+                    faceI,
+                    pos.hitPoint(),
+                    rndGen_.position<scalar>(-maxSigmaX_, maxSigmaX_),
+                    sigmax_[faceI],
+                    R_[faceI],
+                    rndGen_
+                );
+
+                // If eddy valid, patchFaceI is non-zero
+                if (e.patchFaceI() != -1)
+                {
+                    eddies.append(e);
+                    sumVolEddy += e.volume();
+                    search = false;
+                }
+            }
+            // else eddy on remote processor
+
+            reduce(search, andOp<bool>());
+        }
+
+
+        sumVolEddyAllProc = returnReduce(sumVolEddy, sumOp<scalar>());
+    }
+    eddies_.transfer(eddies);
+
+    nEddy_ = eddies_.size();
+
+    if (debug)
+    {
+        Pout<< "Patch:" << patch().patch().name();
+
+        if (Pstream::parRun())
+        {
+            Pout<< " processor:" << Pstream::myProcNo();
+        }
+
+        Pout<< " seeded:" << nEddy_ << " eddies" << endl;
+    }
+
+    reduce(nEddy_, sumOp<label>());
+
+    if (nEddy_ > 0)
+    {
+        Info<< "Turbulent DFSEM patch: " << patch().name()
+            << " seeded " << nEddy_ << " eddies with total volume "
+            << sumVolEddyAllProc
+            << endl;
+    }
+    else
+    {
+        WarningInFunction
+            << "Patch: " << patch().patch().name()
+            << " on field " << dimensionedInternalField().name()
+            << ": No eddies seeded - please check your set-up" << endl;
+    }
+}
+
+
+void Foam::turbulentDFSEMInletFvPatchVectorField::convectEddies
+(
+    const scalar deltaT
+)
+{
+    // Note: all operations applied to local processor only
+
+    label nRecycled = 0;
+
+    forAll(eddies_, eddyI)
+    {
+        eddy& e = eddies_[eddyI];
+        e.move(deltaT*(UMean_ & patchNormal_));
+
+        const scalar position0 = e.x();
+
+        // Check to see if eddy has exited downstream box plane
+        if (position0 > maxSigmaX_)
+        {
+            bool search = true;
+            label iter = 0;
+
+            while (search && iter++ < seedIterMax_)
+            {
+               // Spawn new eddy with new random properties (intensity etc)
+               pointIndexHit pos(setNewPosition(false));
+               label faceI = pos.index();
+
+               e = eddy
+                    (
+                        faceI,
+                        pos.hitPoint(),
+                        position0 - floor(position0/maxSigmaX_)*maxSigmaX_,
+                        sigmax_[faceI],
+                        R_[faceI],
+                        rndGen_
+                    );
+
+                if (e.patchFaceI() != -1)
+                {
+                    search = false;
+                }
+            }
+
+            nRecycled++;
+        }
+    }
+
+    reduce(nRecycled, sumOp<label>());
+
+    if (debug && nRecycled > 0)
+    {
+        Info<< "Patch: " << patch().patch().name() << " recycled "
+            << nRecycled << " eddies" << endl;
+    }
+}
+
+
+Foam::vector Foam::turbulentDFSEMInletFvPatchVectorField::uDashEddy
+(
+    const List<eddy>& eddies,
+    const point& patchFaceCf
+) const
+{
+    vector uDash(vector::zero);
+
+    forAll(eddies, k)
+    {
+        const eddy& e = eddies[k];
+        uDash += e.uDash(patchFaceCf, patchNormal_);
+    }
+
+    return uDash;
+}
+
+
+void Foam::turbulentDFSEMInletFvPatchVectorField::calcOverlappingProcEddies
+(
+    List<List<eddy> >& overlappingEddies
+) const
+{
+    int oldTag = UPstream::msgType();
+    UPstream::msgType() = oldTag + 1;
+
+    List<boundBox> patchBBs(Pstream::nProcs());
+    patchBBs[Pstream::myProcNo()] = patchBounds_;
+    Pstream::gatherList(patchBBs);
+    Pstream::scatterList(patchBBs);
+
+    // Per processor indices into all segments to send
+    List<DynamicList<label> > dynSendMap(Pstream::nProcs());
+
+    forAll(eddies_, i)
+    {
+        // Collect overlapping eddies
+        const eddy& e = eddies_[i];
+
+        // Eddy bounds
+        point x = e.position(patchNormal_);
+        boundBox ebb = e.bounds();
+        ebb.min() += x;
+        ebb.max() += x;
+
+        forAll(patchBBs, procI)
+        {
+            // Not including intersection with local patch
+            if (procI != Pstream::myProcNo())
+            {
+                if (ebb.overlaps(patchBBs[procI]))
+                {
+                    dynSendMap[procI].append(i);
+                }
+            }
+        }
+    }
+
+    labelListList sendMap(Pstream::nProcs());
+    forAll(sendMap, procI)
+    {
+        sendMap[procI].transfer(dynSendMap[procI]);
+    }
+
+    // Send the number of eddies for local processors to receive
+    labelListList sendSizes(Pstream::nProcs());
+    sendSizes[Pstream::myProcNo()].setSize(Pstream::nProcs());
+    forAll(sendMap, procI)
+    {
+        sendSizes[Pstream::myProcNo()][procI] = sendMap[procI].size();
+    }
+    Pstream::gatherList(sendSizes);
+    Pstream::scatterList(sendSizes);
+
+    // Determine order of receiving
+    labelListList constructMap(Pstream::nProcs());
+
+    // Local segment first
+    constructMap[Pstream::myProcNo()] = identity
+    (
+        sendMap[Pstream::myProcNo()].size()
+    );
+
+    label segmentI = constructMap[Pstream::myProcNo()].size();
+    forAll(constructMap, procI)
+    {
+        if (procI != Pstream::myProcNo())
+        {
+            // What I need to receive is what other processor is sending to me
+            label nRecv = sendSizes[procI][Pstream::myProcNo()];
+            constructMap[procI].setSize(nRecv);
+
+            for (label i = 0; i < nRecv; i++)
+            {
+                constructMap[procI][i] = segmentI++;
+            }
+        }
+    }
+
+    mapDistribute map(segmentI, sendMap.xfer(), constructMap.xfer());
+
+    PstreamBuffers pBufs(Pstream::nonBlocking);
+
+    for (label domain = 0; domain < Pstream::nProcs(); domain++)
+    {
+        const labelList& sendElems = map.subMap()[domain];
+
+        if (domain != Pstream::myProcNo() && sendElems.size())
+        {
+            List<eddy> subEddies(UIndirectList<eddy>(eddies_, sendElems));
+
+            UOPstream toDomain(domain, pBufs);
+
+            toDomain<< subEddies;
+        }
+    }
+
+    // Start receiving
+    pBufs.finishedSends();
+
+    // Consume
+    for (label domain = 0; domain < Pstream::nProcs(); domain++)
+    {
+        const labelList& recvElems = map.constructMap()[domain];
+
+        if (domain != Pstream::myProcNo() && recvElems.size())
+        {
+            UIPstream str(domain, pBufs);
+            {
+                str >> overlappingEddies[domain];
+            }
+        }
+    }
+
+    // Restore tag
+    UPstream::msgType() = oldTag;
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::turbulentDFSEMInletFvPatchVectorField::
+turbulentDFSEMInletFvPatchVectorField
+(
+    const fvPatch& p,
+    const DimensionedField<vector, volMesh>& iF
+)
+:
+    fixedValueFvPatchField<vector>(p, iF),
+    delta_(0),
+    d_(0),
+    kappa_(0),
+
+    perturb_(1e-5),
+    mapMethod_("planarInterpolation"),
+    mapperPtr_(NULL),
+    interpolateR_(false),
+    R_(),
+    interpolateL_(false),
+    L_(),
+    interpolateU_(false),
+    U_(),
+    UMean_(vector::zero),
+
+    patchArea_(-1),
+    triFace_(),
+    triToFace_(),
+    triCumulativeMagSf_(),
+    sumTriMagSf_(Pstream::nProcs() + 1, 0.0),
+
+    eddies_(0),
+    nCellPerEddy_(5),
+    patchNormal_(vector::zero),
+    v0_(0),
+    rndGen_(0, -1),
+    sigmax_(size(), 0),
+    maxSigmaX_(0),
+    nEddy_(0),
+    curTimeIndex_(-1),
+    patchBounds_(boundBox::invertedBox),
+    singleProc_(false),
+    writeEddies_(false)
+{}
+
+
+Foam::turbulentDFSEMInletFvPatchVectorField::
+turbulentDFSEMInletFvPatchVectorField
+(
+    const turbulentDFSEMInletFvPatchVectorField& ptf,
+    const fvPatch& p,
+    const DimensionedField<vector, volMesh>& iF,
+    const fvPatchFieldMapper& mapper
+)
+:
+    fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
+    delta_(ptf.delta_),
+    d_(ptf.d_),
+    kappa_(ptf.kappa_),
+
+    perturb_(ptf.perturb_),
+    mapMethod_(ptf.mapMethod_),
+    mapperPtr_(NULL),
+    interpolateR_(ptf.interpolateR_),
+    R_(ptf.R_, mapper),
+    interpolateL_(ptf.interpolateL_),
+    L_(ptf.L_, mapper),
+    interpolateU_(ptf.interpolateU_),
+    U_(ptf.U_, mapper),
+    UMean_(ptf.UMean_),
+
+    patchArea_(ptf.patchArea_),
+    triFace_(ptf.triFace_),
+    triToFace_(ptf.triToFace_),
+    triCumulativeMagSf_(ptf.triCumulativeMagSf_),
+    sumTriMagSf_(ptf.sumTriMagSf_),
+
+    eddies_(ptf.eddies_),
+    nCellPerEddy_(ptf.nCellPerEddy_),
+    patchNormal_(ptf.patchNormal_),
+    v0_(ptf.v0_),
+    rndGen_(ptf.rndGen_),
+    sigmax_(ptf.sigmax_, mapper),
+    maxSigmaX_(ptf.maxSigmaX_),
+    nEddy_(0),
+    curTimeIndex_(-1),
+    patchBounds_(ptf.patchBounds_),
+    singleProc_(ptf.singleProc_),
+    writeEddies_(ptf.writeEddies_)
+{}
+
+
+Foam::turbulentDFSEMInletFvPatchVectorField::
+turbulentDFSEMInletFvPatchVectorField
+(
+    const fvPatch& p,
+    const DimensionedField<vector, volMesh>& iF,
+    const dictionary& dict
+)
+:
+    fixedValueFvPatchField<vector>(p, iF, dict),
+    delta_(readScalar(dict.lookup("delta"))),
+    d_(dict.lookupOrDefault<scalar>("d", 1)),
+    kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
+
+    perturb_(dict.lookupOrDefault<scalar>("perturb", 1e-5)),
+    mapMethod_(dict.lookup("mapMethod")),
+    mapperPtr_(NULL),
+    interpolateR_(false),
+    R_(interpolateOrRead<symmTensor>("R", dict, interpolateR_)),
+    interpolateL_(false),
+    L_(interpolateOrRead<scalar>("L", dict, interpolateL_)),
+    interpolateU_(false),
+    U_(interpolateOrRead<vector>("U", dict, interpolateU_)),
+    UMean_(vector::zero),
+
+    patchArea_(-1),
+    triFace_(),
+    triToFace_(),
+    triCumulativeMagSf_(),
+    sumTriMagSf_(Pstream::nProcs() + 1, 0.0),
+
+    eddies_(),
+    nCellPerEddy_(dict.lookupOrDefault<label>("nCellPerEddy", 5)),
+    patchNormal_(vector::zero),
+    v0_(0),
+    rndGen_(0, -1),
+    sigmax_(size(), 0),
+    maxSigmaX_(0),
+    nEddy_(0),
+    curTimeIndex_(-1),
+    patchBounds_(boundBox::invertedBox),
+    singleProc_(false),
+    writeEddies_(dict.lookupOrDefault<bool>("writeEddies", false))
+{
+    eddy::debug = debug;
+
+    // Set UMean as patch area average value
+    UMean_ = gSum(U_*patch().magSf())/(gSum(patch().magSf()) + ROOTVSMALL);
+}
+
+
+Foam::turbulentDFSEMInletFvPatchVectorField::
+turbulentDFSEMInletFvPatchVectorField
+(
+    const turbulentDFSEMInletFvPatchVectorField& ptf
+)
+:
+    fixedValueFvPatchField<vector>(ptf),
+    delta_(ptf.delta_),
+    d_(ptf.d_),
+    kappa_(ptf.kappa_),
+
+    perturb_(ptf.perturb_),
+    mapMethod_(ptf.mapMethod_),
+    mapperPtr_(NULL),
+    interpolateR_(ptf.interpolateR_),
+    R_(ptf.R_),
+    interpolateL_(ptf.interpolateL_),
+    L_(ptf.L_),
+    interpolateU_(ptf.interpolateU_),
+    U_(ptf.U_),
+    UMean_(ptf.UMean_),
+
+    patchArea_(ptf.patchArea_),
+    triFace_(ptf.triFace_),
+    triToFace_(ptf.triToFace_),
+    triCumulativeMagSf_(ptf.triCumulativeMagSf_),
+    sumTriMagSf_(ptf.sumTriMagSf_),
+
+    eddies_(ptf.eddies_),
+    nCellPerEddy_(ptf.nCellPerEddy_),
+    patchNormal_(ptf.patchNormal_),
+    v0_(ptf.v0_),
+    rndGen_(ptf.rndGen_),
+    sigmax_(ptf.sigmax_),
+    maxSigmaX_(ptf.maxSigmaX_),
+    nEddy_(0),
+    curTimeIndex_(-1),
+    patchBounds_(ptf.patchBounds_),
+    singleProc_(ptf.singleProc_),
+    writeEddies_(ptf.writeEddies_)
+{}
+
+
+Foam::turbulentDFSEMInletFvPatchVectorField::
+turbulentDFSEMInletFvPatchVectorField
+(
+    const turbulentDFSEMInletFvPatchVectorField& ptf,
+    const DimensionedField<vector, volMesh>& iF
+)
+:
+    fixedValueFvPatchField<vector>(ptf, iF),
+    delta_(ptf.delta_),
+    d_(ptf.d_),
+    kappa_(ptf.kappa_),
+
+    perturb_(ptf.perturb_),
+    mapMethod_(ptf.mapMethod_),
+    mapperPtr_(NULL),
+    interpolateR_(ptf.interpolateR_),
+    R_(ptf.R_),
+    interpolateL_(ptf.interpolateL_),
+    L_(ptf.L_),
+    interpolateU_(ptf.interpolateU_),
+    U_(ptf.U_),
+    UMean_(ptf.UMean_),
+
+    patchArea_(ptf.patchArea_),
+    triFace_(ptf.triFace_),
+    triToFace_(ptf.triToFace_),
+    triCumulativeMagSf_(ptf.triCumulativeMagSf_),
+    sumTriMagSf_(ptf.sumTriMagSf_),
+
+    eddies_(ptf.eddies_),
+    nCellPerEddy_(ptf.nCellPerEddy_),
+    patchNormal_(ptf.patchNormal_),
+    v0_(ptf.v0_),
+    rndGen_(ptf.rndGen_),
+    sigmax_(ptf.sigmax_),
+    maxSigmaX_(ptf.maxSigmaX_),
+    nEddy_(0),
+    curTimeIndex_(-1),
+    patchBounds_(ptf.patchBounds_),
+    singleProc_(ptf.singleProc_),
+    writeEddies_(ptf.writeEddies_)
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::turbulentDFSEMInletFvPatchVectorField::~
+turbulentDFSEMInletFvPatchVectorField()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::turbulentDFSEMInletFvPatchVectorField::autoMap
+(
+    const fvPatchFieldMapper& m
+)
+{
+    fixedValueFvPatchField<vector>::autoMap(m);
+
+    // Clear interpolator
+    mapperPtr_.clear();
+    R_.autoMap(m);
+    L_.autoMap(m);
+    U_.autoMap(m);
+
+    sigmax_.autoMap(m);
+}
+
+
+void Foam::turbulentDFSEMInletFvPatchVectorField::rmap
+(
+    const fvPatchVectorField& ptf,
+    const labelList& addr
+)
+{
+    fixedValueFvPatchField<vector>::rmap(ptf, addr);
+
+    const turbulentDFSEMInletFvPatchVectorField& dfsemptf =
+        refCast<const turbulentDFSEMInletFvPatchVectorField>(ptf);
+
+    R_.rmap(dfsemptf.R_, addr);
+    L_.rmap(dfsemptf.L_, addr);
+    U_.rmap(dfsemptf.U_, addr);
+
+    // Clear interpolator
+    mapperPtr_.clear();
+
+    sigmax_.rmap(dfsemptf.sigmax_, addr);
+}
+
+
+void Foam::turbulentDFSEMInletFvPatchVectorField::updateCoeffs()
+{
+    if (updated())
+    {
+        return;
+    }
+
+    if (curTimeIndex_ == -1)
+    {
+        initialisePatch();
+
+        initialiseEddyBox();
+
+        initialiseEddies();
+    }
+
+
+    if (curTimeIndex_ != db().time().timeIndex())
+    {
+        if (debug)
+        {
+            label n = eddies_.size();
+            Info<< "Number of eddies: " << returnReduce(n, sumOp<label>())
+                << endl;
+        }
+
+        const scalar deltaT = db().time().deltaTValue();
+
+        // Move eddies using mean velocity
+        convectEddies(deltaT);
+
+        // Set velocity
+        vectorField& U = *this;
+        //U = UMean_;
+        U = U_;
+
+        const pointField& Cf = patch().Cf();
+
+        // Apply second part of normalisation coefficient
+        // Note: factor of 2 required to match reference stresses?
+        const scalar FACTOR = 2;
+        const scalar c = FACTOR*Foam::sqrt(10*v0_)/Foam::sqrt(scalar(nEddy_));
+
+        // In parallel, need to collect all eddies that will interact with
+        // local faces
+
+        if (singleProc_ || !Pstream::parRun())
+        {
+            forAll(U, faceI)
+            {
+                U[faceI] += c*uDashEddy(eddies_, Cf[faceI]);
+            }
+        }
+        else
+        {
+            // Process local eddy contributions
+            forAll(U, faceI)
+            {
+                U[faceI] += c*uDashEddy(eddies_, Cf[faceI]);
+            }
+
+            // Add contributions from overlapping eddies
+            List<List<eddy> > overlappingEddies(Pstream::nProcs());
+            calcOverlappingProcEddies(overlappingEddies);
+
+            forAll(overlappingEddies, procI)
+            {
+                const List<eddy>& eddies = overlappingEddies[procI];
+
+                if (eddies.size())
+                {
+                    //Pout<< "Applying " << eddies.size()
+                    //    << " eddies from processor " << procI << endl;
+
+                    forAll(U, faceI)
+                    {
+                        U[faceI] += c*uDashEddy(eddies, Cf[faceI]);
+                    }
+                }
+            }
+        }
+
+        // Re-scale to ensure correct flow rate
+        scalar fCorr =
+            gSum((UMean_ & patchNormal_)*patch().magSf())
+           /gSum(U & -patch().Sf());
+
+        U *= fCorr;
+
+        if (debug)
+        {
+            Info<< "Patch:" << patch().patch().name()
+                << " min/max(U):" << gMin(U) << ", " << gMax(U) << endl;
+        }
+
+        curTimeIndex_ = db().time().timeIndex();
+
+        if (writeEddies_)
+        {
+            writeEddyOBJ();
+        }
+
+        if (debug && db().time().outputTime())
+        {
+            writeLumleyCoeffs();
+        }
+    }
+
+    fixedValueFvPatchVectorField::updateCoeffs();
+}
+
+
+void Foam::turbulentDFSEMInletFvPatchVectorField::write(Ostream& os) const
+{
+    fvPatchField<vector>::write(os);
+    writeEntry("value", os);
+    os.writeKeyword("delta") << delta_ << token::END_STATEMENT << nl;
+    writeEntryIfDifferent(os, "d", 1.0, d_);
+    writeEntryIfDifferent(os, "kappa", 0.41, kappa_);
+    writeEntryIfDifferent(os, "perturb", 1e-5, perturb_);
+    writeEntryIfDifferent<label>(os, "nCellPerEddy", 5, nCellPerEddy_);
+    writeEntryIfDifferent(os, "writeEddies", false, writeEddies_);
+
+    if (!interpolateR_)
+    {
+        R_.writeEntry("R", os);
+    }
+
+    if (!interpolateL_)
+    {
+        L_.writeEntry("L", os);
+    }
+
+    if (!interpolateU_)
+    {
+        U_.writeEntry("U", os);
+    }
+
+    if
+    (
+       !mapMethod_.empty()
+     && mapMethod_ != "planarInterpolation"
+    )
+    {
+        os.writeKeyword("mapMethod") << mapMethod_
+            << token::END_STATEMENT << nl;
+    }
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+   makePatchTypeField
+   (
+       fvPatchVectorField,
+       turbulentDFSEMInletFvPatchVectorField
+   );
+}
+
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.H
new file mode 100644
index 0000000000000000000000000000000000000000..b1d0afe62aca9f6305894cb66cd8bab66a45f9c9
--- /dev/null
+++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.H
@@ -0,0 +1,376 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015 OpenFOAM Foundation
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::turbulentDFSEMInletFvPatchVectorField
+
+Group
+    grpInletBoundaryConditions
+
+Description
+    Velocity boundary condition including synthesised eddies for use with LES
+    and DES turbulent flows.
+
+    Reference:
+    \verbatim
+        Poletto, R., Craft, T., and Revell, A.,
+        "A New Divergence Free Synthetic Eddy Method for the Reproduction
+         of Inlet Flow Conditions for LES",
+        Flow Turbulence Combust (2013) 91:519-539
+    \endverbatim
+
+    Reynolds stress, velocity and turbulence length scale values can either
+    be sepcified directly, or mapped.  If mapping, the values should be
+    entered in the same form as the timeVaryingMappedFixedValue condition,
+    except that no interpolation in time is supported.  These should be
+    located in the directory:
+ 
+        \$FOAM_CASE/constant/boundaryData/<patchName>/points
+        \$FOAM_CASE/constant/boundaryData/<patchName>/0/\{R|U|L\}
+
+
+Usage
+    \table
+        Property  | Description         | Required         | Default value
+        value     | Restart value       | yes              |
+        delta     | Local limiting length scale  | yes     |
+        R         | Reynolds stress field | no             |
+        U         | Velocity field      | no               |
+        L         | Turbulence length scale field | no     |
+        d         | Eddy density(fill fraction) | no       | 1
+        kappa     | Von Karman constant | no               | 0.41
+        mapMethod | Method to map reference values | no | planarInterpolation
+        perturb   | Point perturbation for interpolation | no | 1e-5
+        writeEddies | Flag to write eddies as OBJ file | no | no
+    \endtable
+
+Note
+    - The \c delta value typically represents a channel half-height
+    - For R, U and L specification: if the entry is not user input, it is
+      assumed that the data will be mapped
+
+SeeAlso
+    timeVaryingMappedFixedValueFvPatchField
+
+SourceFiles
+    turbulentDFSEMInletFvPatchVectorField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef turbulentDFSEMInletFvPatchVectorField_H
+#define turbulentDFSEMInletFvPatchVectorField_H
+
+#include "fixedValueFvPatchFields.H"
+#include "cachedRandom.H"
+#include "eddy.H"
+#include "pointIndexHit.H"
+#include "instantList.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+class cartesianCS;
+class pointToPointPlanarInterpolation;
+
+/*---------------------------------------------------------------------------*\
+           Class turbulentDFSEMInletFvPatchVectorField Declaration
+\*---------------------------------------------------------------------------*/
+
+class turbulentDFSEMInletFvPatchVectorField
+:
+    public fixedValueFvPatchVectorField
+{
+    // Private data
+
+        //- Maximum number of attempts when seeding eddies
+        static label seedIterMax_;
+
+        //- Typical length scale, e.g. half channel height
+        const scalar delta_;
+
+        //- Ratio of sum of eddy volumes to eddy box volume; default = 1
+        const scalar d_;
+
+        //- Von Karman constant
+        const scalar kappa_;
+
+        //- Global numbering for faces
+        mutable autoPtr<globalIndex> globalFacesPtr_;
+
+
+        // Table reading for patch inlet flow properties
+
+            //- Fraction of perturbation (fraction of bounding box) to add
+            scalar perturb_;
+
+            //- Interpolation scheme to use
+            word mapMethod_;
+
+            //- 2D interpolation (for 'planarInterpolation' mapMethod)
+            mutable autoPtr<pointToPointPlanarInterpolation> mapperPtr_;
+
+            //- Flag to identify to interpolate the R field
+            bool interpolateR_;
+
+            //- Reynolds stress tensor
+            symmTensorField R_;
+
+            //- Flag to identify to interpolate the L field
+            bool interpolateL_;
+
+            //- Length scale
+            scalarField L_;
+
+            //- Flag to identify to interpolate the U field
+            bool interpolateU_;
+
+            //- Inlet velocity
+            vectorField U_;
+
+            //- Mean inlet velocity
+            vector UMean_;
+
+
+        // Patch information
+
+            //- Patch area - total across all processors
+            scalar patchArea_;
+
+            //- Decomposed patch faces as a list of triangles
+            faceList triFace_;
+
+            //- Addressing from per triangle to patch face
+            labelList triToFace_;
+
+            //- Cumulative triangle area per triangle face
+            scalarList triCumulativeMagSf_;
+
+            //- Cumulative area fractions per processor
+            scalarList sumTriMagSf_;
+
+
+        //- List of eddies
+        List<eddy> eddies_;
+
+        //- Minimum number of cells required to resolve an eddy
+        label nCellPerEddy_;
+
+        //- Patch normal into the domain
+        vector patchNormal_;
+
+        //- Eddy box volume
+        scalar v0_;
+
+        //- Random number generator
+        cachedRandom rndGen_;
+
+        //- Length scale per patch face
+        scalarField sigmax_;
+
+        //- Maximum length scale (across all processors)
+        scalar maxSigmaX_;
+
+        //- Global number of eddies
+        label nEddy_;
+
+        //- Current time index (used for updating)
+        label curTimeIndex_;
+
+        //- Patch bounds (local processor)
+        boundBox patchBounds_;
+
+        //- Single processor contains all eddies (flag)
+        bool singleProc_;
+
+        //- Flag to write the eddies to file
+        bool writeEddies_;
+
+
+    // Private Member Functions
+
+        //- Initialise info for patch point search
+        void initialisePatch();
+
+        //- Initialise the eddy box
+        void initialiseEddyBox();
+
+        //- Set a new eddy position
+        pointIndexHit setNewPosition(const bool global);
+
+        //- Initialise eddies
+        void initialiseEddies();
+
+        //- Convect the eddies
+        void convectEddies(const scalar deltaT);
+
+        //- Calculate the velocity fluctuation at a point
+        vector uDashEddy(const List<eddy>& eddies, const point& globalX) const;
+
+        //- Helper function to interpolate values from the boundary data or
+        //  read from dictionary
+        template<class Type>
+        tmp<Field<Type> > interpolateOrRead
+        (
+            const word& fieldName,
+            const dictionary& dict,
+            bool& interpolateField
+        ) const;
+
+        //- Helper function to interpolate values from the boundary data
+        template<class Type>
+        tmp<Field<Type> > interpolateBoundaryData
+        (
+            const word& fieldName
+        ) const;
+
+        //- Write Lumley coefficients to file
+        void writeLumleyCoeffs() const;
+
+        //- Write eddy info in OBJ format
+        void writeEddyOBJ() const;
+
+        //- Return a reference to the patch mapper object
+        const pointToPointPlanarInterpolation& patchMapper() const;
+
+        //- Return eddies from remote processors that interact with local
+        //  processor
+        void calcOverlappingProcEddies
+        (
+            List<List<eddy> >& overlappingEddies
+        ) const;
+
+
+public:
+
+   //- Runtime type information
+   TypeName("turbulentDFSEMInlet");
+
+
+   // Constructors
+
+        //- Construct from patch and internal field
+        turbulentDFSEMInletFvPatchVectorField
+        (
+            const fvPatch&,
+            const DimensionedField<vector, volMesh>&
+        );
+
+        //- Construct from patch, internal field and dictionary
+        turbulentDFSEMInletFvPatchVectorField
+        (
+            const fvPatch&,
+            const DimensionedField<vector, volMesh>&,
+            const dictionary&
+        );
+
+        //- Construct by mapping given turbulentDFSEMInletFvPatchVectorField
+        //  onto a new patch
+        turbulentDFSEMInletFvPatchVectorField
+        (
+            const turbulentDFSEMInletFvPatchVectorField&,
+            const fvPatch&,
+            const DimensionedField<vector, volMesh>&,
+            const fvPatchFieldMapper&
+        );
+
+        //- Construct as copy
+        turbulentDFSEMInletFvPatchVectorField
+        (
+            const turbulentDFSEMInletFvPatchVectorField&
+        );
+
+        //- Construct and return a clone
+        virtual tmp<fvPatchVectorField> clone() const
+        {
+            return tmp<fvPatchVectorField>
+            (
+                new turbulentDFSEMInletFvPatchVectorField(*this)
+            );
+        }
+
+        //- Construct as copy setting internal field reference
+        turbulentDFSEMInletFvPatchVectorField
+        (
+            const turbulentDFSEMInletFvPatchVectorField&,
+            const DimensionedField<vector, volMesh>&
+        );
+
+        //- Construct and return a clone setting internal field reference
+        virtual tmp<fvPatchVectorField> clone
+        (
+            const DimensionedField<vector, volMesh>& iF
+        ) const
+        {
+            return tmp<fvPatchVectorField>
+            (
+                new turbulentDFSEMInletFvPatchVectorField(*this, iF)
+            );
+        }
+
+    virtual ~turbulentDFSEMInletFvPatchVectorField();
+
+
+    // Member functions
+
+
+        // Mapping functions
+
+            //- Map (and resize as needed) from self given a mapping object
+            virtual void autoMap(const fvPatchFieldMapper& m);
+
+            //- Reverse map the given fvPatchField onto this fvPatchField
+            virtual void rmap
+            (
+                const fvPatchVectorField& ptf,
+                const labelList& addr
+            );
+
+
+        // Evaluation functions
+
+            //- Update the coefficients associated with the patch field
+            virtual void updateCoeffs();
+
+
+        //- Write
+        virtual void write(Ostream&) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+    #include "turbulentDFSEMInletFvPatchVectorFieldTemplates.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorFieldTemplates.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorFieldTemplates.C
new file mode 100644
index 0000000000000000000000000000000000000000..230e1c707fd49b69f767991de964b6137b368dd5
--- /dev/null
+++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorFieldTemplates.C
@@ -0,0 +1,95 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015 OpenFOAM Foundation
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "AverageIOField.H"
+#include "pointToPointPlanarInterpolation.H"
+#include "Time.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+template<class Type>
+Foam::tmp<Foam::Field<Type> >
+Foam::turbulentDFSEMInletFvPatchVectorField::interpolateOrRead
+(
+    const word& fieldName,
+    const dictionary& dict,
+    bool& interpolateField
+) const
+{
+    if (dict.found(fieldName))
+    {
+        tmp<Field<Type> > tFld
+        (
+            new Field<Type>
+            (
+                fieldName,
+                dict,
+                this->patch().size()
+            )
+        );
+
+        interpolateField = false;
+        return tFld;
+    }
+    else
+    {
+        interpolateField = true;
+        return interpolateBoundaryData<Type>(fieldName);
+    }
+}
+
+
+template<class Type>
+Foam::tmp<Foam::Field<Type> >
+Foam::turbulentDFSEMInletFvPatchVectorField::interpolateBoundaryData
+(
+    const word& fieldName
+) const
+{
+    const word& patchName = this->patch().name();
+
+    // Note: reading from the '0' directory only
+    IOobject io
+    (
+        fieldName,
+        this->db().time().caseConstant(),
+        "boundaryData"/patchName/"0",
+        this->db(),
+        IOobject::MUST_READ,
+        IOobject::AUTO_WRITE,
+        false
+    );
+
+    Info<< "Turbulent DFSEM patch " << this->patch().name()
+        << ": interpolating field " << fieldName
+        << " from " << io.path() << endl;
+
+    AverageIOField<Type> aFld(io);
+
+    return patchMapper().interpolate(aFld);
+}
+
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/doc/fvPatchFieldDoc.H b/src/finiteVolume/fields/fvPatchFields/doc/fvPatchFieldDoc.H
index 8b6889ea030a70f6603f2b44747a2e41343feb17..47684ecc4ffb90e6ace9407d3c1ceac4d6e6ea44 100644
--- a/src/finiteVolume/fields/fvPatchFields/doc/fvPatchFieldDoc.H
+++ b/src/finiteVolume/fields/fvPatchFields/doc/fvPatchFieldDoc.H
@@ -23,7 +23,7 @@ License
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-\defgroup grpBoundaryConditions Boundary Conditions
+\defgroup grpBoundaryConditions Boundary conditions
 @{
     This group contains OpenFOAM boundary condition types.  All conditions
     are derived from the base Foam::fvPatchField class.  Patch values are
@@ -38,38 +38,38 @@ License
     of the matrix solve, via a call to \<field\>.correctBoundaryConditions().
 @}
 
-\defgroup grpConstraintBoundaryConditions Constraint boundary Conditions
+\defgroup grpConstraintBoundaryConditions Constraint
 @{
     \ingroup grpBoundaryConditions
     This group contains constraint boundary condition types.  These conditions
     are mainly employed to reduced dimensioned cases.
 @}
 
-\defgroup grpInletBoundaryConditions Inlet boundary Conditions
+\defgroup grpInletBoundaryConditions Inlet
 @{
     \ingroup grpBoundaryConditions
     This group contains inlet boundary condition types
 @}
 
-\defgroup grpOutletBoundaryConditions Outlet boundary Conditions
+\defgroup grpOutletBoundaryConditions Outlet
 @{
     \ingroup grpBoundaryConditions
     This group contains outlet boundary condition types
 @}
 
-\defgroup grpGenericBoundaryConditions Generic boundary Conditions
+\defgroup grpGenericBoundaryConditions Generic
 @{
     \ingroup grpBoundaryConditions
     This group contains generic boundary condition types
 @}
 
-\defgroup grpCoupledBoundaryConditions Coupled boundary Conditions
+\defgroup grpCoupledBoundaryConditions Coupled
 @{
     \ingroup grpBoundaryConditions
     This group contains coupled boundary condition types
 @}
 
-\defgroup grpWallBoundaryConditions Wall boundary Conditions
+\defgroup grpWallBoundaryConditions Wall
 @{
     \ingroup grpBoundaryConditions
     This group contains wall boundary condition types
diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.C b/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.C
index 5da9b1486c8eff7c00a0a2f1a412c9c827422f71..904d317eda6cd0254f33316a038d31b70f96f789 100644
--- a/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.C
+++ b/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.C
@@ -40,6 +40,13 @@ namespace fv
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+template<class Type>
+const convectionScheme<Type>& boundedConvectionScheme<Type>::scheme() const
+{
+    return scheme_();
+}
+
+
 template<class Type>
 tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
 boundedConvectionScheme<Type>::interpolate
diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.H b/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.H
index 630e17090abd84c0c0096ecf03c70bc09ca6b407..0573ef4fc2b12fef27771fe8bfba1c785cb5a161 100644
--- a/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.H
+++ b/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.H
@@ -106,6 +106,8 @@ public:
 
     // Member Functions
 
+        const convectionScheme<Type>& scheme() const;
+
         tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> interpolate
         (
             const surfaceScalarField&,
diff --git a/src/finiteVolume/finiteVolume/fvc/fvcD2dt2.C b/src/finiteVolume/finiteVolume/fvc/fvcD2dt2.C
index 7468f4bae7727f024c6cb58a34e56664a2cb62c3..5df89502cc46a86e223cfa2a8e868e9a54775974 100644
--- a/src/finiteVolume/finiteVolume/fvc/fvcD2dt2.C
+++ b/src/finiteVolume/finiteVolume/fvc/fvcD2dt2.C
@@ -50,7 +50,7 @@ d2dt2
     (
         vf.mesh(),
         vf.mesh().ddtScheme("d2dt2(" + vf.name() + ')')
-    )().fvcD2dt2(vf);
+    ).ref().fvcD2dt2(vf);
 }
 
 
@@ -66,7 +66,7 @@ d2dt2
     (
         vf.mesh(),
         vf.mesh().ddtScheme("d2dt2(" + rho.name() + ',' + vf.name() + ')')
-    )().fvcD2dt2(rho, vf);
+    ).ref().fvcD2dt2(rho, vf);
 }
 
 
diff --git a/src/fvMotionSolver/doc/motionSolversDoc.H b/src/fvMotionSolver/doc/motionSolversDoc.H
new file mode 100644
index 0000000000000000000000000000000000000000..818a34eea981f7088441fce1559e379558c5c9e2
--- /dev/null
+++ b/src/fvMotionSolver/doc/motionSolversDoc.H
@@ -0,0 +1,37 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+\defgroup grpMeshMotion Mesh motion
+@{
+    This group contains Mesh motion models.
+@}
+
+\defgroup grpMeshMotionSolvers Solvers
+@{
+    \ingroup grpMeshMotion
+    This group contains Mesh motion solvers.
+@}
+
+\*---------------------------------------------------------------------------*/
diff --git a/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H
index e4b1ae96059c92f3509a69e80dc046911d6343f4..bed5a61674f0c9adbc55d3e14712bc12034dfe5c 100644
--- a/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H
+++ b/src/fvMotionSolver/fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::displacementComponentLaplacianFvMotionSolver
 
+Group
+    grpMeshMotionSolvers 
+
 Description
     Mesh motion solver for an fvMesh.  Based on solving the cell-centre
     Laplacian for the given component of the motion displacement.
diff --git a/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H
index bc7c746ea2d2e4d12aedba9b9aa83a6c4e86991d..d4075ff93b58196af391033453701aef9372fe2e 100644
--- a/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H
+++ b/src/fvMotionSolver/fvMotionSolvers/componentVelocity/componentLaplacian/velocityComponentLaplacianFvMotionSolver.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::velocityComponentLaplacianFvMotionSolver
 
+Group
+    grpMeshMotionSolvers 
+
 Description
     Mesh motion solver for an fvMesh.  Based on solving the cell-centre
     Laplacian for the given component of the motion velocity.
diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H
index 3a4779d9db8cd47fed214e9ff3b3a4068d461a5b..5e4c7b64c1fc98ab6cf022673d8e7fa760b765a0 100644
--- a/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H
+++ b/src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::displacementSBRStressFvMotionSolver
 
+Group
+    grpMeshMotionSolvers 
+
 Description
     Mesh motion solver for an fvMesh.  Based on solving the cell-centre
     solid-body rotation stress equations for the motion displacement.
diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H
index 374241734933c88058aa556859b9a403ea6f9350..2458d1d400c2affdce19c4b9a06d887b1b9c10a5 100644
--- a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H
+++ b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::displacementInterpolationMotionSolver
 
+Group
+    grpMeshMotionSolvers 
+
 Description
     Mesh motion solver for an fvMesh.
 
diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H
index 7ec7790985b2b3bf210e1cbc32626affce3c5087..1df49597a6b9fe9c230105a0e0114e0b1ed89887 100644
--- a/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H
+++ b/src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::displacementLaplacianFvMotionSolver
 
+Group
+    grpMeshMotionSolvers 
+
 Description
     Mesh motion solver for an fvMesh.  Based on solving the cell-centre
     Laplacian for the motion displacement.
diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H
index c876e560ef65e47fb6cdaa08fa3af1f7e94b26dc..be002c6056b650204b271a5531a7a9d5866b1960 100644
--- a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H
+++ b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::displacementLayeredMotionMotionSolver
 
+Group
+    grpMeshMotionSolvers 
+
 Description
     Mesh motion solver for an (multi-block) extruded fvMesh. Gets given the
     structure of the mesh blocks and boundary conditions on these blocks.
diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.H
index 719c699449196fef192c3362f29b9790d8500f68..77f83e5ad5463350d5dd9c668089f1d0e6de4415 100644
--- a/src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.H
+++ b/src/fvMotionSolver/fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::surfaceAlignedSBRStressFvMotionSolver
 
+Group
+    grpMeshMotionSolvers 
+
 Description
     Mesh motion solver for an fvMesh.  Based on solving the cell-centre
     solid-body rotation stress equations for the motion displacement.
diff --git a/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.H
index 479234dc22ddc81d6b58a91e2bd9c22adbd2a849..af213a96756a9f57d8fb7183435514533b5de42e 100644
--- a/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.H
+++ b/src/fvMotionSolver/fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::velocityLaplacianFvMotionSolver
 
+Group
+    grpMeshMotionSolvers 
+
 Description
     Mesh motion solver for an fvMesh.  Based on solving the cell-centre
     Laplacian for the motion velocity.
diff --git a/src/fvOptions/Make/files b/src/fvOptions/Make/files
index 6e74683868e4d575219757c8034002aaff62a8ce..205a7f8ef35c6cefe09e3ad6e59ae1ba9bcf4454 100644
--- a/src/fvOptions/Make/files
+++ b/src/fvOptions/Make/files
@@ -12,6 +12,7 @@ $(generalSources)/codedSource/codedSource.C
 $(generalSources)/semiImplicitSource/semiImplicitSource.C
 
 derivedSources=sources/derived
+$(derivedSources)/acousticDampingSource/acousticDampingSource.C
 $(derivedSources)/actuationDiskSource/actuationDiskSource.C
 $(derivedSources)/buoyancyForce/buoyancyForce.C
 $(derivedSources)/buoyancyForce/buoyancyForceIO.C
diff --git a/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.C b/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.C
new file mode 100644
index 0000000000000000000000000000000000000000..8b5cad4be5939e7925289b9abded8bce1b2ce7a9
--- /dev/null
+++ b/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.C
@@ -0,0 +1,220 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "acousticDampingSource.H"
+#include "fvMesh.H"
+#include "fvMatrices.H"
+#include "fvmSup.H"
+#include "addToRunTimeSelectionTable.H"
+#include "mathematicalConstants.H"
+#include "zeroGradientFvPatchFields.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace fv
+{
+    defineTypeNameAndDebug(acousticDampingSource, 0);
+    addToRunTimeSelectionTable
+    (
+        option,
+        acousticDampingSource,
+        dictionary
+    );
+}
+}
+
+
+// * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
+
+void Foam::fv::acousticDampingSource::setBlendingFactor()
+{
+    blendFactor_.internalField() = 1;
+
+    const vectorField& Cf = mesh_.C();
+
+    const scalar pi = constant::mathematical::pi;
+ 
+    forAll(cells_, i)
+    {
+        label celli = cells_[i];
+        scalar d = mag(Cf[celli] - x0_);
+
+        if (d < r1_)
+        {
+            blendFactor_[celli] = 0.0;
+        }
+        else if ((d >= r1_) && (d <= r2_))
+        {
+            blendFactor_[celli] = (1.0 - cos(pi*mag(d - r1_)/(r2_ - r1_)))/2.0;
+        }
+    }
+
+    blendFactor_.correctBoundaryConditions();
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::fv::acousticDampingSource::acousticDampingSource
+(
+    const word& name,
+    const word& modelType,
+    const dictionary& dict,
+    const fvMesh& mesh
+)
+:
+    cellSetOption(name, modelType, dict, mesh),
+    frequency_("frequency", dimless/dimTime, 0),
+    blendFactor_
+    (
+        volScalarField
+        (
+            IOobject
+            (
+                name_ + ":blend",
+                mesh_.time().timeName(),
+                mesh_,
+                IOobject::NO_READ,
+                IOobject::NO_WRITE
+            ),
+            mesh_,
+            dimensionedScalar("blend0", dimless, 1.0),
+            zeroGradientFvPatchField<vector>::typeName
+        )
+    ),
+    URefName_("unknown-URefName"),
+    x0_(Zero),
+    r1_(0),
+    r2_(0),
+    w_(20)
+{
+    read(dict);
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::fv::acousticDampingSource::addSup
+(
+    fvMatrix<vector>& eqn,
+    const label fieldI
+)
+{
+    const volVectorField& U = eqn.psi();
+    const volScalarField coeff(name_ + ":coeff", w_*frequency_*blendFactor_);
+    const volVectorField& URef(mesh().lookupObject<volVectorField>(URefName_));
+
+    fvMatrix<vector> dampingEqn
+    (
+        fvm::Sp(coeff, U) - coeff*URef
+    );
+    eqn -= dampingEqn;
+}
+
+
+void Foam::fv::acousticDampingSource::addSup
+(
+    const volScalarField& rho,
+    fvMatrix<vector>& eqn,
+    const label fieldI
+)
+{
+    const volVectorField& U = eqn.psi();
+    const volScalarField coeff(name_ + ":coeff", w_*frequency_*blendFactor_);
+    const volVectorField& URef(mesh().lookupObject<volVectorField>(URefName_));
+
+    fvMatrix<vector> dampingEqn
+    (
+        fvm::Sp(rho*coeff, U) - rho*coeff*URef
+    );
+    eqn -= dampingEqn;
+}
+
+
+void Foam::fv::acousticDampingSource::addSup
+(
+    const volScalarField& alpha,
+    const volScalarField& rho,
+    fvMatrix<vector>& eqn,
+    const label fieldI
+)
+{
+    const volVectorField& U = eqn.psi();
+    const volScalarField coeff(name_ + ":coeff", w_*frequency_*blendFactor_);
+    const volVectorField& URef(mesh().lookupObject<volVectorField>(URefName_));
+
+    fvMatrix<vector> dampingEqn
+    (
+        fvm::Sp(alpha*rho*coeff, U) - alpha*rho*coeff*URef
+    );
+    eqn -= dampingEqn;
+}
+
+
+bool Foam::fv::acousticDampingSource::read(const dictionary& dict)
+{
+    if (cellSetOption::read(dict))
+    {
+        if (coeffs_.found("UNames"))
+        {
+            coeffs_.lookup("UNames") >> fieldNames_;
+        }
+        else if (coeffs_.found("UName"))
+        {
+            word UName(coeffs_.lookup("UName"));
+            fieldNames_ = wordList(1, UName);
+        }
+        else
+        {
+            fieldNames_ = wordList(1, "U");
+        }
+
+        applied_.setSize(fieldNames_.size(), false);
+
+        coeffs_.lookup("frequency") >> frequency_.value();
+        coeffs_.lookup("URef") >> URefName_;
+        coeffs_.lookup("centre") >> x0_;
+        coeffs_.lookup("radius1") >> r1_;
+        coeffs_.lookup("radius2") >> r2_;
+
+        if (coeffs_.readIfPresent("w", w_))
+        {
+            Info<< name_ << ": Setting stencil width to " << w_ << endl;
+        }
+
+        setBlendingFactor();
+
+        return true;
+    }
+    else
+    {
+        return false;
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.H b/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.H
new file mode 100644
index 0000000000000000000000000000000000000000..02a283bf2de0c2de7eb368f37430ea90c90d5db8
--- /dev/null
+++ b/src/fvOptions/sources/derived/acousticDampingSource/acousticDampingSource.H
@@ -0,0 +1,184 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::fv::acousticDampingSource
+
+Group
+    grpFvOptionsSources
+
+Description
+    Acoustic damping source
+
+    \heading Source usage
+
+    Example usage:
+    \verbatim
+    acousticDampingSourceCoeffs
+    {
+    }
+    \endverbatim
+
+SourceFiles
+    acousticDampingSource.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef acousticDampingSource_H
+#define acousticDampingSource_H
+
+#include "cellSetOption.H"
+#include "volFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+class porosityModel;
+
+namespace fv
+{
+
+
+/*---------------------------------------------------------------------------*\
+                    Class acousticDampingSource Declaration
+\*---------------------------------------------------------------------------*/
+
+class acousticDampingSource
+:
+    public cellSetOption
+{
+
+protected:
+
+    // Protected data
+
+        //- Frequency [Hz]
+        dimensionedScalar frequency_;
+
+        //- Blending factor []
+        volScalarField blendFactor_;
+
+        //- Name of reference velocity field
+        word URefName_;
+
+        // Sphere centre location or damping
+        point x0_;
+
+        // Inner radius at which to start damping
+        scalar r1_;
+
+        // Outer radius beyond which damping is applied
+        scalar r2_;
+
+        //- Stencil width, default = 20
+        label w_;
+
+
+    // Protected Member Functions
+
+        //- Helper function to set the blending factor
+        void setBlendingFactor();
+
+
+private:
+
+    // Private Member Functions
+
+        //- Disallow default bitwise copy construct
+        acousticDampingSource(const acousticDampingSource&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const acousticDampingSource&) = delete;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("acousticDampingSource");
+
+
+    // Constructors
+
+        //- Construct from components
+        acousticDampingSource
+        (
+            const word& name,
+            const word& modelType,
+            const dictionary& dict,
+            const fvMesh& mesh
+        );
+
+
+    //- Destructor
+    virtual ~acousticDampingSource()
+    {}
+
+
+    // Member Functions
+
+        // Add explicit and implicit contributions
+
+            //- Add implicit contribution to momentum equation
+            virtual void addSup
+            (
+                fvMatrix<vector>& eqn,
+                const label fieldI
+            );
+
+            //- Add implicit contribution to compressible momentum equation
+            virtual void addSup
+            (
+                const volScalarField& rho,
+                fvMatrix<vector>& eqn,
+                const label fieldI
+            );
+
+            //- Add implicit contribution to phase momentum equation
+            virtual void addSup
+            (
+                const volScalarField& alpha,
+                const volScalarField& rho,
+                fvMatrix<vector>& eqn,
+                const label fieldI
+            );
+
+
+        // IO
+
+            //- Read dictionary
+            virtual bool read(const dictionary& dict);
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace fv
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C
index 374aa5eac6cd7bedc586b7653846a152b1d48153..52378876442ee0a465821868391f1287c0ba5d9f 100644
--- a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C
+++ b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C
@@ -764,6 +764,13 @@ Foam::genericFvPatchField<Type>::gradientBoundaryCoeffs() const
 }
 
 
+template<class Type>
+const Foam::word& Foam::genericFvPatchField<Type>::actualType() const
+{
+    return actualTypeName_;
+}
+
+
 template<class Type>
 void Foam::genericFvPatchField<Type>::write(Ostream& os) const
 {
diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H
index ec3be385b42172f4d6d0f63a48b1ad77890eec05..88091b90bbe277ca242405559d715af3a05edbd4 100644
--- a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H
+++ b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H
@@ -59,7 +59,7 @@ class genericFvPatchField
 {
     // Private data
 
-        word actualTypeName_;
+        const word actualTypeName_;
         dictionary dict_;
 
         HashPtrTable<scalarField> scalarFields_;
@@ -179,6 +179,9 @@ public:
             tmp<Field<Type>> gradientBoundaryCoeffs() const;
 
 
+        //- Return the actual type
+        const word& actualType() const;
+
         //- Write
         virtual void write(Ostream&) const;
 };
diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C
index 8f4970855f4fedd51c8f6d90fbac4d44a1757b50..c1d1dd42ecd017179bb1bfbf9f5261317f2a7f25 100644
--- a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C
+++ b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -557,6 +557,13 @@ void Foam::genericPointPatchField<Type>::rmap
 }
 
 
+template<class Type>
+const Foam::word& Foam::genericPointPatchField<Type>::actualType() const
+{
+    return actualTypeName_;
+}
+
+
 template<class Type>
 void Foam::genericPointPatchField<Type>::write(Ostream& os) const
 {
diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H
index e68ce631b13cc342766c0ae6b7fcadd1a8b046f7..33880fd72326aa58d7697785f4930a56c94bc92f 100644
--- a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H
+++ b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -55,7 +55,7 @@ class genericPointPatchField
 {
     // Private data
 
-        word actualTypeName_;
+        const word actualTypeName_;
         dictionary dict_;
 
         HashPtrTable<scalarField> scalarFields_;
@@ -151,6 +151,9 @@ public:
             );
 
 
+        //- Return the actual type
+        const word& actualType() const;
+
         //- Write
         virtual void write(Ostream&) const;
 };
diff --git a/src/lagrangian/basic/particle/particle.H b/src/lagrangian/basic/particle/particle.H
index ea0cc38a364133b7c8e4a689dcc9385085390a29..e4a6f6516a4c33ce9e5d37c7cd36e534ea3cc85c 100644
--- a/src/lagrangian/basic/particle/particle.H
+++ b/src/lagrangian/basic/particle/particle.H
@@ -322,7 +322,7 @@ public:
         //- String representation of property types
         DefinePropertyTypes
         (
-            "vector label label scalar label label label label"
+            "{vector label label scalar label label label label}"
         );
 
         //- Cumulative particle counter - used to provode unique ID
diff --git a/src/lagrangian/basic/particle/particleMacros.H b/src/lagrangian/basic/particle/particleMacros.H
index 8bb09dd1338c6ac983defc434fe4a6a17537f127..d54b9621163fcde624a169a0d9b980e07aed4cb1 100644
--- a/src/lagrangian/basic/particle/particleMacros.H
+++ b/src/lagrangian/basic/particle/particleMacros.H
@@ -66,6 +66,7 @@ namespace Foam
 
 
 //- Define a static 'propertyTypes' for the types of particle properties
+//  Brace brackets are used to delimit binary write groups
 // \sa AddToPropertyTypes
 #define DefinePropertyTypes(str)                                               \
                                                                                \
@@ -78,6 +79,7 @@ namespace Foam
 
 
 //- Add to existing static 'propertyTypes' for the types of particle properties
+//  Brace brackets are used to delimit binary write groups
 // \sa AddToPropertyTypes
 #define AddToPropertyTypes(ParcelType, str)                                    \
                                                                                \
diff --git a/src/lagrangian/intermediate/doc/lagrangianIntermediateDoc.H b/src/lagrangian/intermediate/doc/lagrangianIntermediateDoc.H
index 238d0a0a5bc0b43d0a31861bd38fba6d98432a97..a4b300bfeebe784a5b9e6999a613deeed441c575 100644
--- a/src/lagrangian/intermediate/doc/lagrangianIntermediateDoc.H
+++ b/src/lagrangian/intermediate/doc/lagrangianIntermediateDoc.H
@@ -23,7 +23,7 @@ License
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-\defgroup grpLagrangianIntermediate Lagrangian particle modelling
+\defgroup grpLagrangianIntermediate Lagrangian particle models
 @{
     This group contains Lagrangian modelling available in the 'intermediate' library
 @}
diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.H b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.H
index 0e43224e8f660c491100052f5d76472327beee58..338c3186d9af472d0ecfca8f01866d9b8aa6a7c4 100644
--- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.H
+++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.H
@@ -162,12 +162,11 @@ public:
         );
 
         //- String representation of property types
-        static string propertyTypes()
-        {
-            // TODO: collision information types
-            NotImplemented;
-            return string::null;
-        }
+        AddToPropertyTypes
+        (
+            ParcelType,
+            "{vector vector vector} *"
+        );
 
 
     // Constructors
diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H
index 2ec40a105f9d20c8184895ff872b81e341499cfd..fe3d1cbf997d01969cafe2381b620be0ccd0338c 100644
--- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H
+++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H
@@ -325,7 +325,7 @@ public:
         AddToPropertyTypes
         (
             ParcelType,
-            " label"
+            "{label"
           + " label"
           + " scalar"
           + " scalar"
@@ -334,7 +334,7 @@ public:
           + " scalar"
           + " scalar"
           + " scalar"
-          + " vector"
+          + " vector}"
         );
 
 
diff --git a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.H b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.H
index 7ebd84fee8b9258cc4f802601276b820ad52f5a8..22d48d5d0308bf699a1b5a51b67e0306ade7f087 100644
--- a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.H
+++ b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.H
@@ -184,7 +184,7 @@ public:
         AddToPropertyTypes
         (
             ParcelType,
-            " vector"
+            "{vector}"
         );
 
 
diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H
index f443f14b58df0a8c7bcbaf519c78ee83695f8e67..44245693838c8d3b103114dff7fc8dbe7a3e7cba 100644
--- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H
+++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H
@@ -272,9 +272,7 @@ public:
         AddToPropertyTypes
         (
             ParcelType,
-            " List<scalar>"
-          + " List<scalar>"
-          + " List<Scalar>"
+            " scalars scalars scalars"
         );
 
 
diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H
index 8223ce22305968085fede70029091e6978b3bb7a..fda45e5f2242fe6ac639cae1054ea94474aca68c 100644
--- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H
+++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H
@@ -226,8 +226,7 @@ public:
         AddToPropertyTypes
         (
             ParcelType,
-            " scalar"
-          + " List<scalar>"
+            "{scalar} scalars"
         );
 
 
diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H
index 9178fbcd120c6a5bf4bfed46c52587b6b1b57946..9e20ea8c0c3a77a985572ff6be7a5bef8af080bf 100644
--- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H
+++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H
@@ -282,8 +282,7 @@ public:
         AddToPropertyTypes
         (
             ParcelType,
-            " scalar"
-          + " scalar"
+            "{scalar scalar}"
         );
 
 
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Interface/InterfaceForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Interface/InterfaceForce.C
index 41ac099cddde73fb7b28637b2d57d9ae2569639a..74b85bce92619a6cf0ef4c4fecf8badf067daf87 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Interface/InterfaceForce.C
+++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Interface/InterfaceForce.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Interface/InterfaceForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Interface/InterfaceForce.H
index 4f61b2df63c6cd28501d95cf0c2037108fa9bee1..15810b1ed558689a117bec53576ab05c7e17fc4f 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Interface/InterfaceForce.H
+++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Interface/InterfaceForce.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H
index 76210b20c0b4476a1d51ae82dfd4e11dcda37b67..c62a9924ecc142bc32b75804b453ce9bda180abe 100644
--- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H
+++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H
@@ -201,7 +201,7 @@ public:
         AddToPropertyTypes
         (
             ParcelType,
-            " scalar"
+            "{scalar"
           + " vector"
           + " scalar"
           + " scalar"
@@ -213,7 +213,7 @@ public:
           + " scalar"
           + " scalar"
           + " scalar"
-          + " scalar"
+          + " scalar}"
         );
 
 
diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H
index 27c9f3b7798bdd7787b29da1797bc393ddf6f6d9..b4f46575764d085246448e4c7c7fb6d011d36f6d 100644
--- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H
+++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H
@@ -709,6 +709,8 @@ private:
                 const wordList& zonesInMesh,
 
                 labelList& cellToZone,
+                labelList& unnamedRegion1,
+                labelList& unnamedRegion2,
                 labelList& namedSurfaceIndex,
                 PackedBoolList& posOrientation
             ) const;
diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C
index e4ebecad7c72b87d9de40309367996b2f8358553..54c8ce1e421ea9350b06bbb9b1201bf6a6b9e5d3 100644
--- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C
+++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C
@@ -28,7 +28,6 @@ License
 #include "syncTools.H"
 #include "Time.H"
 #include "refinementSurfaces.H"
-#include "pointSet.H"
 #include "faceSet.H"
 #include "indirectPrimitivePatch.H"
 #include "polyTopoChange.H"
@@ -37,7 +36,6 @@ License
 #include "polyModifyCell.H"
 #include "polyAddFace.H"
 #include "polyRemoveFace.H"
-#include "polyAddPoint.H"
 #include "localPointRegion.H"
 #include "duplicatePoints.H"
 #include "regionSplit.H"
@@ -299,14 +297,14 @@ void Foam::meshRefinement::getBafflePatches
     // later
 
 
-    // 1. Determine cell zones
-    // ~~~~~~~~~~~~~~~~~~~~~~~
-    // Note that this does not determine the surface+region that was intersected
-    // so that is done in step 2 below.
+    // 1. Determine intersections with unnamed surfaces and cell zones
+    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
     labelList cellToZone;
+    labelList unnamedRegion1;
+    labelList unnamedRegion2;
+    labelList namedSurfaceIndex;
     {
-        labelList namedSurfaceIndex;
         PackedBoolList posOrientation;
         zonify
         (
@@ -316,83 +314,24 @@ void Foam::meshRefinement::getBafflePatches
             zonesInMesh,
 
             cellToZone,
+            unnamedRegion1,
+            unnamedRegion2,
             namedSurfaceIndex,
             posOrientation
         );
     }
 
 
-    // The logic is quite complicated and depends on the cell zone allocation
-    // (see zonify). Cells can have zone:
-    //  -2  : unreachable
-    //  -1  : in background zone
-    //  >=0 : in named cellZone
-    // Faces can be intersected by a
-    //  - unnamed surface (no faceZone defined for it)
-    //  - named surface (a faceZone defined for it)
-    // Per intersected faces, depending on the cellToZone on either side of
-    // the face we need to:
-    //
-    // surface type    |   cellToZone      |   action
-    // ----------------+-------------------+---------
-    // unnamed         |  -2  | same       |   -
-    // unnamed         |  -2  | different  |   baffle
-    //                 |      |            |
-    // unnamed         |  -1  | same       |   baffle
-    // unnamed         |  -1  | different  |   -
-    //                 |      |            |
-    // unnamed         | >=0  | same       |   baffle
-    // unnamed         | >=0  | different  |   -
-    //
-    // named           |  -2  | same       |   -
-    // named           |  -2  | different  |   see note
-    //
-    // named           |  -1  | same       |   -
-    // named           |  -1  | different  |   -
-    //
-    // named           | >=0  | same       |   -
-    // named           | >=0  | different  |   -
-    //
-    // So the big difference between surface with a faceZone and those
-    // without is that 'standing-up-baffles' are not supported. Note that
-    // they are still in a faceZone so can be split etc. later on.
-    // Note: this all depends on whether we allow named surfaces
-    //       to be outside the unnamed geometry. 2.3 does not allow this
-    //       so we do the same. We could implement it but it would require
-    //       re-testing of the intersections with the named surfaces to
-    //       obtain the surface and region number.
-
-
-    // 2. Check intersections of all unnamed surfaces
-    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-    const labelList testFaces(intersectedFaces());
-
-    labelList globalRegion1;
-    labelList globalRegion2;
-    getIntersections
-    (
-        surfaceZonesInfo::getUnnamedSurfaces(surfaces_.surfZones()),
-        neiCc,
-        testFaces,
-        globalRegion1,
-        globalRegion2
-    );
-
+    // 2. Baffle all boundary faces
+    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    // The logic is that all intersections with unnamed surfaces become
+    // baffles except where we're inbetween a cellZone and background
+    // or inbetween two different cellZones.
 
     labelList neiCellZone;
     syncTools::swapBoundaryCellList(mesh_, cellToZone, neiCellZone);
 
-
-    // 3. Baffle all boundary faces
-    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    // Baffle all boundary faces except those on outside of unvisited cells
-    // Use patch according to globalRegion1,2
-    // Note: the behaviour is slightly different from version3.0 and earlier
-    //       in that it will not create baffles which are outside the meshed
-    //       domain. On a medium testcase (motorBike tutorial geometry) this
-    //       selects about 20 cells less (out of 120000). These cells are where
-    //       there might e.g. be a single cell which is fully unreachable.
+    const labelList testFaces(intersectedFaces());
 
     ownPatch.setSize(mesh_.nFaces());
     ownPatch = -1;
@@ -402,20 +341,23 @@ void Foam::meshRefinement::getBafflePatches
     {
         label faceI = testFaces[i];
 
-        if (globalRegion1[faceI] != -1 || globalRegion2[faceI] != -1)
+        if (unnamedRegion1[faceI] != -1 || unnamedRegion2[faceI] != -1)
         {
             label ownMasterPatch = -1;
-            if (globalRegion1[faceI] != -1)
+            if (unnamedRegion1[faceI] != -1)
             {
-                ownMasterPatch = globalToMasterPatch[globalRegion1[faceI]];
+                ownMasterPatch = globalToMasterPatch[unnamedRegion1[faceI]];
             }
             label neiMasterPatch = -1;
-            if (globalRegion2[faceI] != -1)
+            if (unnamedRegion2[faceI] != -1)
             {
-                neiMasterPatch = globalToMasterPatch[globalRegion2[faceI]];
+                neiMasterPatch = globalToMasterPatch[unnamedRegion2[faceI]];
             }
 
 
+            // Now we always want to produce a baffle except if
+            // one side is a valid cellZone
+
             label ownZone = cellToZone[mesh_.faceOwner()[faceI]];
             label neiZone = -1;
 
@@ -429,22 +371,26 @@ void Foam::meshRefinement::getBafflePatches
             }
 
 
-            if (ownZone == -2)
-            {
-                if (neiZone != -2)
-                {
-                    ownPatch[faceI] = ownMasterPatch;
-                    neiPatch[faceI] = neiMasterPatch;
-                }
-            }
-            else if (neiZone == -2)
+            if
+            (
+                (ownZone != neiZone)
+             && (
+                    (ownZone >= 0 && neiZone != -2)
+                 || (neiZone >= 0 && ownZone != -2)
+                )
+             && (
+                    namedSurfaceIndex.size() == 0
+                 || namedSurfaceIndex[faceI] == -1
+                )
+            )
             {
-                ownPatch[faceI] = ownMasterPatch;
-                neiPatch[faceI] = neiMasterPatch;
+                // One side is a valid cellZone and the neighbour is a different
+                // one (or -1 but not -2). Do not baffle unless the user has
+                // put both an unnamed and a named surface there. In that
+                // case assume that the user wants both: baffle and faceZone.
             }
-            else if (ownZone == neiZone)
+            else
             {
-                // Free-standing baffle
                 ownPatch[faceI] = ownMasterPatch;
                 neiPatch[faceI] = neiMasterPatch;
             }
@@ -1694,11 +1640,6 @@ void Foam::meshRefinement::findCellZoneInsideWalk
     regionSplit cellRegion(mesh_, blockedFace);
     blockedFace.clear();
 
-    // Mark off which regions correspond to a zone
-    // (note zone is -1 for the non-zoned bit so initialise to -2)
-    labelList regionToZone(cellRegion.nRegions(), -2);
-
-
     // Force calculation of face decomposition (used in findCell)
     (void)mesh_.tetBasePtIs();
 
@@ -1738,9 +1679,6 @@ void Foam::meshRefinement::findCellZoneInsideWalk
         }
 
 
-        // Mark correspondence to zone
-        regionToZone[keepRegionI] = zoneID;
-
 
         // Set all cells with this region to the zoneID
         // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1758,7 +1696,7 @@ void Foam::meshRefinement::findCellZoneInsideWalk
                 }
                 else if (cellToZone[cellI] != zoneID)
                 {
-                    if (nWarnings < 10)
+                    if (cellToZone[cellI] != -1 && nWarnings < 10)
                     {
                         WarningInFunction
                             << "Cell " << cellI
@@ -1778,6 +1716,9 @@ void Foam::meshRefinement::findCellZoneInsideWalk
                             << endl;
                         nWarnings++;
                     }
+
+                    // Override the zone
+                    cellToZone[cellI] = zoneID;
                 }
             }
         }
@@ -1844,7 +1785,7 @@ bool Foam::meshRefinement::calcRegionToZone
             else if (regionToCellZone[neiRegion] == surfZoneI)
             {
                 // Face between unset and my region. Put unset
-                // region into keepRegion
+                // region into background region
                 //MEJ: see comment in findCellZoneTopo
                 if (backgroundZoneID != -2)
                 {
@@ -1873,7 +1814,7 @@ bool Foam::meshRefinement::calcRegionToZone
             else if (regionToCellZone[ownRegion] == surfZoneI)
             {
                 // Face between unset and my region. Put unset
-                // region into keepRegion
+                // region into background region
                 if (backgroundZoneID != -2)
                 {
                     regionToCellZone[neiRegion] = backgroundZoneID;
@@ -1903,25 +1844,21 @@ void Foam::meshRefinement::findCellZoneTopo
     labelList& cellToZone
 ) const
 {
+    // This routine fixes small problems with left over unassigned regions
+    // (after all off the unreachable bits of the mesh have been removed).
     // This routine splits the mesh into regions, based on the intersection
     // with a surface. The problem is that we know the surface which
     // (intersected) face belongs to (in namedSurfaceIndex) but we don't
     // know which side of the face it relates to. So all we are doing here
     // is get the correspondence between surface/cellZone and regionSplit
-    // region.
-    // See the logic in calcRegionToZone. The problem is what to do
-    // with unreachable parts of the mesh (cellToZone = -2).
-    // In 23x this routine was only called for actually zoneing an existing
-    // mesh so we had to do something with these cells and they
-    // would get set to -1 (background). However in this version this routine
-    // also gets used much earlier on when after the surface refinement it
-    // removes unreachable cells ('Removing mesh beyond surface intersections')
-    // and this is when we keep -2 so it gets removed.
+    // region. See the logic in calcRegionToZone.
+    // Basically it looks at the neighbours of a face on a named surface.
+    // If one side is in the cellZone corresponding to the surface and
+    // the other side is unassigned (-2) it sets this to the background zone.
     // So the zone to set these unmarked cells to is provided as argument:
     // - backgroundZoneID = -2 : do not change so remove cells
     // - backgroundZoneID = -1 : put into background
 
-
     // Assumes:
     // - region containing keepPoint does not go into a cellZone
     // - all other regions can be found by crossing faces marked in
@@ -2346,6 +2283,8 @@ void Foam::meshRefinement::zonify
     const wordList& zonesInMesh,
 
     labelList& cellToZone,
+    labelList& unnamedRegion1,
+    labelList& unnamedRegion2,
     labelList& namedSurfaceIndex,
     PackedBoolList& posOrientation
 ) const
@@ -2395,18 +2334,16 @@ void Foam::meshRefinement::zonify
 
     // 1. Test all (unnamed & named) surfaces
 
-    labelList globalRegion1;
-    {
-        labelList globalRegion2;
-        getIntersections
-        (
-            identity(surfaces_.surfaces().size()),  // surfacesToTest,
-            neiCc,
-            intersectedFaces(),     // testFaces
-            globalRegion1,
-            globalRegion2
-        );
-    }
+    // Unnamed surfaces. Global surface region of intersection (or -1)
+    getIntersections
+    (
+        unnamedSurfaces,
+        neiCc,
+        intersectedFaces(),
+        unnamedRegion1,
+        unnamedRegion2
+    );
+
 
     if (namedSurfaces.size())
     {
@@ -2422,6 +2359,7 @@ void Foam::meshRefinement::zonify
 
 
     // 2. Walk from locationsInMesh. Hard set cellZones.
+    //    Note: walk through faceZones! (these might get overridden later)
 
     if (locationsInMesh.size())
     {
@@ -2448,13 +2386,12 @@ void Foam::meshRefinement::zonify
         Info<< endl;
 
 
-        // Assign cellZone according to seed points
+        // Assign cellZone according to seed points. Walk through named surfaces
         findCellZoneInsideWalk
         (
             locationsInMesh,    // locations
             locationsZoneIDs,   // index of cellZone (or -1)
-            globalRegion1,      // per face -1 (unblocked) or >= 0 (blocked)
-
+            unnamedRegion1,     // per face -1 (unblocked) or >= 0 (blocked)
             cellToZone
         );
     }
@@ -2497,11 +2434,23 @@ void Foam::meshRefinement::zonify
             }
         }
 
+
+        // Stop at unnamed or named surface
+        labelList allRegion1(mesh_.nFaces(), -1);
+        forAll(namedSurfaceIndex, faceI)
+        {
+            allRegion1[faceI] = max
+            (
+                unnamedRegion1[faceI],
+                namedSurfaceIndex[faceI]
+            );
+        }
+
         findCellZoneInsideWalk
         (
             insidePoints,           // locations
             insidePointCellZoneIDs, // index of cellZone
-            globalRegion1,          // per face -1 (unblocked) or >= 0 (blocked)
+            allRegion1,             // per face -1 (unblocked) or >= 0 (blocked)
             cellToZone
         );
     }
@@ -2539,33 +2488,6 @@ void Foam::meshRefinement::zonify
         );
     }
 
-    if (debug&MESH)
-    {
-        Pout<< "Writing cell zone allocation on mesh to time "
-            << timeName() << endl;
-        volScalarField volCellToZone
-        (
-            IOobject
-            (
-                "cellToZoneBeforeTopo",
-                timeName(),
-                mesh_,
-                IOobject::NO_READ,
-                IOobject::AUTO_WRITE,
-                false
-            ),
-            mesh_,
-            dimensionedScalar("zero", dimless, 0),
-            zeroGradientFvPatchScalarField::typeName
-        );
-
-        forAll(cellToZone, cellI)
-        {
-            volCellToZone[cellI] = cellToZone[cellI];
-        }
-        volCellToZone.write();
-    }
-
 
     // 5. Find any unassigned regions (from regionSplit)
 
@@ -2574,19 +2496,6 @@ void Foam::meshRefinement::zonify
         Info<< "Walking from known cellZones; crossing a faceZone "
             << "face changes cellZone" << nl << endl;
 
-        labelList unnamedRegion1;
-        {
-            labelList unnamedRegion2;
-            getIntersections
-            (
-                unnamedSurfaces,
-                neiCc,
-                intersectedFaces(),
-                unnamedRegion1,
-                unnamedRegion2
-            );
-        }
-
         findCellZoneTopo
         (
             backgroundZoneID,
@@ -2671,8 +2580,15 @@ void Foam::meshRefinement::zonify
     }
     if (debug&MESH)
     {
+        const_cast<Time&>(mesh_.time())++;
         Pout<< "Writing cell zone allocation on mesh to time "
             << timeName() << endl;
+        write
+        (
+            debugType(debug),
+            writeType(writeLevel() | WRITEMESH),
+            mesh_.time().path()/"cell2Zone"
+        );
         volScalarField volCellToZone
         (
             IOobject
@@ -4358,17 +4274,24 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
     labelList cellToZone;
     labelList namedSurfaceIndex;
     PackedBoolList posOrientation;
-    zonify
-    (
-        allowFreeStandingZoneFaces,
-        -1,                 // Set all cells with cellToZone -2 to -1
-        locationsInMesh,
-        zonesInMesh,
+    {
+        labelList unnamedRegion1;
+        labelList unnamedRegion2;
 
-        cellToZone,
-        namedSurfaceIndex,
-        posOrientation
-    );
+        zonify
+        (
+            allowFreeStandingZoneFaces,
+            -1,             // Set all cells with cellToZone -2 to -1
+            locationsInMesh,
+            zonesInMesh,
+
+            cellToZone,
+            unnamedRegion1,
+            unnamedRegion2,
+            namedSurfaceIndex,
+            posOrientation
+        );
+    }
 
 
     // Convert namedSurfaceIndex (index of named surfaces) to
diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C
index bb8ee5e3b59dac0d57f75b4998e9a6a78eaac2b7..3b27edf918309797dc21cd143bb23bd1e45cf69a 100644
--- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C
+++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementMerge.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2014 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -83,7 +83,7 @@ Foam::label Foam::meshRefinement::mergePatchFaces
         label compactI = 0;
         forAll(mergeSets, setI)
         {
-            if (mergeSets[setI].size() == mergeSize)
+            if (mergeSets[setI].size() == mergeSize && compactI != setI)
             {
                 mergeSets[compactI++] = mergeSets[setI];
             }
diff --git a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H
index 6560a084a0cde32a953567deb2d917cdddb5b886..cdaee882322d7d95096c79d2e47fb062d453f81c 100644
--- a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H
+++ b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H
@@ -25,12 +25,17 @@ Class
     Foam::EulerCoordinateRotation
 
 Description
-    A coordinateRotation defined in the z-x-y Euler convention.
+    A coordinateRotation defined in the z-x-z (intrinsic) Euler convention.
+
+    The 3 rotations are defined in the Euler intrinsic convention
+    (around Z, around X' and around Z'').
+    The order of the parameter arguments matches this rotation order.
 
-    The 3 rotations are defined in the Euler convention
-    (around Z, around X' and around Z').
     For reference and illustration, see
     http://mathworld.wolfram.com/EulerAngles.html
+    and
+    https://en.wikipedia.org/wiki/Euler_angles#Conventions
+
     Note, however, that it is the reverse transformation
     (local->global) that is defined here.
 
diff --git a/src/meshTools/tetOverlapVolume/tetOverlapVolume.C b/src/meshTools/tetOverlapVolume/tetOverlapVolume.C
index 209c2f7e37565a5ab9fec3de1c24613c3b42f209..cc54720dd33afbaa3d384ae80546079b3fdf7c82 100644
--- a/src/meshTools/tetOverlapVolume/tetOverlapVolume.C
+++ b/src/meshTools/tetOverlapVolume/tetOverlapVolume.C
@@ -39,12 +39,6 @@ namespace Foam
     defineTypeNameAndDebug(tetOverlapVolume, 0);
 }
 
-// When to consider a tet to be zero volume. We want to avoid doing clipping
-// against negative volume tets. Tet volume can be calculated incorrectly
-// due to truncation errors. The value below works for single and double
-// precision but could probably be tighter for double precision.
-Foam::scalar Foam::tetOverlapVolume::minTetVolume_ = SMALL*SMALL;
-
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
diff --git a/src/meshTools/tetOverlapVolume/tetOverlapVolume.H b/src/meshTools/tetOverlapVolume/tetOverlapVolume.H
index b027599218c411be3993218e2ef8661d833289c0..a77e608c6e926a455275db78ae34225db50fbf59 100644
--- a/src/meshTools/tetOverlapVolume/tetOverlapVolume.H
+++ b/src/meshTools/tetOverlapVolume/tetOverlapVolume.H
@@ -54,12 +54,6 @@ class polyMesh;
 
 class tetOverlapVolume
 {
-    // Private data
-
-        //- Minimum tet volume to skip test
-        static scalar minTetVolume_;
-
-
     // Private classes
 
         //- tetPoints handling : sum resulting volumes
diff --git a/src/meshTools/tetOverlapVolume/tetOverlapVolumeTemplates.C b/src/meshTools/tetOverlapVolume/tetOverlapVolumeTemplates.C
index 3ff950311f11668f3559d2e1e77b4c959a5d5a92..34eded1ff313478509b37fc627b996297d358213 100644
--- a/src/meshTools/tetOverlapVolume/tetOverlapVolumeTemplates.C
+++ b/src/meshTools/tetOverlapVolume/tetOverlapVolumeTemplates.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -45,51 +45,90 @@ void Foam::tetOverlapVolume::tetTetOverlap
     tetPointRef::storeOp cutInside(cutInsideTets, nCutInside);
     tetPointRef::dummyOp outside;
 
-    if (tetA.tet().mag() < minTetVolume_ || tetB.tet().mag() < minTetVolume_)
+    // Precompute the tet face areas and exit early if any face area is
+    // too small
+    static FixedList<vector, 4> tetAFaceAreas;
+    static FixedList<scalar, 4> tetAMag2FaceAreas;
+    tetPointRef tetATet = tetA.tet();
+    for (label facei = 0; facei < 4; ++facei)
     {
-        return;
+        tetAFaceAreas[facei] = -tetATet.tri(facei).normal();
+        tetAMag2FaceAreas[facei] = magSqr(tetAFaceAreas[facei]);
+        if (tetAMag2FaceAreas[facei] < ROOTVSMALL)
+        {
+            return;
+        }
     }
 
-    // face0
-    plane pl0(tetB[1], tetB[3], tetB[2]);
-    tetA.tet().sliceWithPlane(pl0, cutInside, outside);
-    if (nCutInside == 0)
+    static FixedList<vector, 4> tetBFaceAreas;
+    static FixedList<scalar, 4> tetBMag2FaceAreas;
+    tetPointRef tetBTet = tetB.tet();
+    for (label facei = 0; facei < 4; ++facei)
     {
-        return;
+        tetBFaceAreas[facei] = -tetBTet.tri(facei).normal();
+        tetBMag2FaceAreas[facei] = magSqr(tetBFaceAreas[facei]);
+        if (tetBMag2FaceAreas[facei] < ROOTVSMALL)
+        {
+            return;
+        }
     }
 
-    // face1
-    plane pl1(tetB[0], tetB[2], tetB[3]);
-    nInside = 0;
-    for (label i = 0; i < nCutInside; i++)
-    {
-        const tetPointRef t = cutInsideTets[i].tet();
-        t.sliceWithPlane(pl1, inside, outside);
-    }
-    if (nInside == 0)
+
+    // Face 0
     {
-        return;
+        vector n = tetBFaceAreas[0]/Foam::sqrt(tetBMag2FaceAreas[0]);
+        plane pl0(tetBTet.tri(0).a(), n, false);
+
+        tetA.tet().sliceWithPlane(pl0, cutInside, outside);
+        if (nCutInside == 0)
+        {
+            return;
+        }
     }
 
-    // face2
-    plane pl2(tetB[0], tetB[3], tetB[1]);
-    nCutInside = 0;
-    for (label i = 0; i < nInside; i++)
+    // Face 1
     {
-        const tetPointRef t = insideTets[i].tet();
-        t.sliceWithPlane(pl2, cutInside, outside);
+        vector n = tetBFaceAreas[1]/Foam::sqrt(tetBMag2FaceAreas[1]);
+        plane pl1(tetBTet.tri(1).a(), n, false);
+
+        nInside = 0;
+        for (label i = 0; i < nCutInside; i++)
+        {
+            const tetPointRef t = cutInsideTets[i].tet();
+            t.sliceWithPlane(pl1, inside, outside);
+        }
+        if (nInside == 0)
+        {
+            return;
+        }
     }
-    if (nCutInside == 0)
+
+    // Face 2
     {
-        return;
+        vector n = tetBFaceAreas[2]/Foam::sqrt(tetBMag2FaceAreas[2]);
+        plane pl2(tetBTet.tri(2).a(), n, false);
+
+        nCutInside = 0;
+        for (label i = 0; i < nInside; i++)
+        {
+            const tetPointRef t = insideTets[i].tet();
+            t.sliceWithPlane(pl2, cutInside, outside);
+        }
+        if (nCutInside == 0)
+        {
+            return;
+        }
     }
 
-    // face3
-    plane pl3(tetB[0], tetB[1], tetB[2]);
-    for (label i = 0; i < nCutInside; i++)
+    // Face 3
     {
-        const tetPointRef t = cutInsideTets[i].tet();
-        t.sliceWithPlane(pl3, insideOp, outside);
+        vector n = tetBFaceAreas[3]/Foam::sqrt(tetBMag2FaceAreas[3]);
+        plane pl3(tetBTet.tri(3).a(), n, false);
+        for (label i = 0; i < nCutInside; i++)
+        {
+            const tetPointRef t = cutInsideTets[i].tet();
+            t.sliceWithPlane(pl3, insideOp, outside);
+        }
     }
 }
 
diff --git a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C
index e61a40391e9c6f836c056d18a01c2176fcca41c6..b191f076a2103ff322867383bc3c3a362d0ee56f 100644
--- a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C
+++ b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C
@@ -272,6 +272,10 @@ void Foam::pointToPointPlanarInterpolation::calcWeights
                     << endl;
             }
 
+            OBJstream str("stencil.obj");
+            Pout<< "pointToPointPlanarInterpolation::calcWeights :"
+                << " Dumping stencil to " << str.name() << endl;
+
             forAll(destPoints, i)
             {
                 label v0 = nearestVertex_[i][0];
@@ -285,17 +289,21 @@ void Foam::pointToPointPlanarInterpolation::calcWeights
                     << " at:" << sourcePoints[v0]
                     << " weight:" << nearestVertexWeight_[i][0] << nl;
 
+                str.write(linePointRef(destPoints[i], sourcePoints[v0]));
+
                 if (v1 != -1)
                 {
                     Pout<< "    " << v1
                         << " at:" << sourcePoints[v1]
                         << " weight:" << nearestVertexWeight_[i][1] << nl;
+                    str.write(linePointRef(destPoints[i], sourcePoints[v1]));
                 }
                 if (v2 != -1)
                 {
                     Pout<< "    " << v2
                         << " at:" << sourcePoints[v2]
                         << " weight:" << nearestVertexWeight_[i][2] << nl;
+                    str.write(linePointRef(destPoints[i], sourcePoints[v2]));
                 }
 
                 Pout<< endl;
@@ -317,7 +325,10 @@ Foam::pointToPointPlanarInterpolation::pointToPointPlanarInterpolation
 :
     perturb_(perturb),
     nearestOnly_(nearestOnly),
-    referenceCS_(calcCoordinateSystem(sourcePoints)),
+    referenceCS_
+    (
+        nearestOnly ? coordinateSystem() : calcCoordinateSystem(sourcePoints)
+    ),
     nPoints_(sourcePoints.size())
 {
     calcWeights(sourcePoints, destPoints);
@@ -341,6 +352,43 @@ Foam::pointToPointPlanarInterpolation::pointToPointPlanarInterpolation
 }
 
 
+Foam::pointToPointPlanarInterpolation::pointToPointPlanarInterpolation
+(
+    const scalar perturb,
+    const bool nearestOnly,
+    const coordinateSystem& referenceCS,
+    const label sourceSize,
+    const List<FixedList<label, 3> >& nearestVertex,
+    const List<FixedList<scalar, 3> >& nearestVertexWeight
+)
+:
+    perturb_(perturb),
+    nearestOnly_(nearestOnly),
+    referenceCS_(referenceCS),
+    nPoints_(sourceSize),
+    nearestVertex_(nearestVertex),
+    nearestVertexWeight_(nearestVertexWeight)
+{}
+
+
+Foam::autoPtr<Foam::pointToPointPlanarInterpolation>
+Foam::pointToPointPlanarInterpolation::clone() const
+{
+    return autoPtr<pointToPointPlanarInterpolation>
+    (
+        new pointToPointPlanarInterpolation
+        (
+            perturb_,
+            nearestOnly_,
+            referenceCS_,
+            nPoints_,
+            nearestVertex_,
+            nearestVertexWeight_
+        )
+    );
+}
+
+
 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
 
 Foam::wordList Foam::pointToPointPlanarInterpolation::timeNames
diff --git a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H
index 85f6743485e32d4af3034b37d07feda62570e6d3..ce468fcc02e87fdbd6a1dd535cbf3f4922d583cd 100644
--- a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H
+++ b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H
@@ -73,6 +73,7 @@ class pointToPointPlanarInterpolation
         //  patch
         List<FixedList<scalar, 3>> nearestVertexWeight_;
 
+
     // Private Member Functions
 
         //- Calculate a local coordinate system from set of points
@@ -85,6 +86,7 @@ class pointToPointPlanarInterpolation
             const pointField& destPoints
         );
 
+
 public:
 
     // Declare name of the class and its debug switch
@@ -114,9 +116,35 @@ public:
             const scalar perturb
         );
 
+        //- Construct from components
+        pointToPointPlanarInterpolation
+        (
+            const scalar perturb,
+            const bool nearestOnly,
+            const coordinateSystem& referenceCS,
+            const label sourceSize,
+            const List<FixedList<label, 3> >& nearestVertex,
+            const List<FixedList<scalar, 3> >& nearestVertexWeight
+        );
+
+        //- Construct and return a clone
+        autoPtr<pointToPointPlanarInterpolation> clone() const;
+
 
     // Member Functions
 
+        //- Perturbation factor (for triangulation)
+        scalar perturb() const
+        {
+            return perturb_;
+        }
+
+        //- Whether to use nearest point only (avoids triangulation, projection)
+        bool nearestOnly() const
+        {
+            return nearestOnly_;
+        }
+
         //- Return the coordinateSystem
         const coordinateSystem& referenceCS() const
         {
@@ -158,7 +186,6 @@ public:
         //- Interpolate from field on source points to dest points
         template<class Type>
         tmp<Field<Type>> interpolate(const Field<Type>& sourceFld) const;
-
 };
 
 
diff --git a/src/parallel/decompose/metisDecomp/metisDecomp.C b/src/parallel/decompose/metisDecomp/metisDecomp.C
index 11b75a0ea068c6aa31fd23eafdcca664d74e0efe..28449f42d0d22e4a87b1e6b04364a7d0e12adcd9 100644
--- a/src/parallel/decompose/metisDecomp/metisDecomp.C
+++ b/src/parallel/decompose/metisDecomp/metisDecomp.C
@@ -67,7 +67,7 @@ Foam::label Foam::metisDecomp::decompose
 
     // processor weights initialised with no size, only used if specified in
     // a file
-    Field<floatScalar> processorWeights;
+    Field<scalar> processorWeights;
 
     // cell weights (so on the vertices of the dual)
     List<label> cellWeights;
diff --git a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C
index 9db0d72d4a00037cfb1cdac3283a79ced168a469..de5557bcb55d59a53b6c5dde4b659690e681aee8 100644
--- a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C
+++ b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2015 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2015-2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -1766,6 +1766,8 @@ void Foam::distributedTriSurfaceMesh::findLineAll
     e1.setSize(compactI);
     pointMap.setSize(compactI);
 
+
+    label iter = 0;
     while (returnReduce(e0.size(), sumOp<label>()) > 0)
     {
         findLine
@@ -1791,7 +1793,12 @@ void Foam::distributedTriSurfaceMesh::findLineAll
 
                 point pt = hitInfo[i].hitPoint() + smallVec[pointI];
 
-                if (((pt-start[pointI])&dirVec[pointI]) <= magSqrDirVec[pointI])
+                // Check current coordinate along ray
+                scalar d = ((pt-start[pointI])&dirVec[pointI]);
+
+                // Note check for d>0. Very occasionally the octree will find
+                // an intersection to the left of the ray due to tolerances.
+                if (d > 0 && d <= magSqrDirVec[pointI])
                 {
                     e0[compactI] = pt;
                     e1[compactI] = end[pointI];
@@ -1805,6 +1812,21 @@ void Foam::distributedTriSurfaceMesh::findLineAll
         e0.setSize(compactI);
         e1.setSize(compactI);
         pointMap.setSize(compactI);
+
+        iter++;
+
+        if (iter == 1000)
+        {
+            Pout<< "distributedTriSurfaceMesh::findLineAll :"
+                << " Exiting loop due to excessive number of"
+                << " intersections along ray"
+                << " start:" << UIndirectList<point>(start, pointMap)
+                << " end:" << UIndirectList<point>(end, pointMap)
+                << " e0:" << UIndirectList<point>(e0, pointMap)
+                << " e1:" << UIndirectList<point>(e1, pointMap)
+                << endl;
+            break;
+        }
     }
 }
 
diff --git a/src/postProcessing/functionObjects/field/readFields/readFields.C b/src/postProcessing/functionObjects/field/readFields/readFields.C
index 07a43d6bbc57290c1bf4b025154b4c06a4aa39dc..0179e278743ae9e991700581753db764ef87114a 100644
--- a/src/postProcessing/functionObjects/field/readFields/readFields.C
+++ b/src/postProcessing/functionObjects/field/readFields/readFields.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2015 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2015-2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -30,7 +30,7 @@ License
 
 namespace Foam
 {
-defineTypeNameAndDebug(readFields, 0);
+    defineTypeNameAndDebug(readFields, 0);
 }
 
 
@@ -54,6 +54,9 @@ Foam::readFields::readFields
     if (isA<fvMesh>(obr_))
     {
         read(dict);
+
+        // Fields should all be present from start time so read on construction
+        execute();
     }
     else
     {
@@ -87,16 +90,28 @@ void Foam::readFields::execute()
 {
     if (active_)
     {
+        if (log_) Info << type() << " " << name_ << ":" << nl;
+
+        bool loaded = false;
         forAll(fieldSet_, fieldI)
         {
             const word& fieldName = fieldSet_[fieldI];
 
-            // If necessary load field
-            loadField<scalar>(fieldName);
-            loadField<vector>(fieldName);
-            loadField<sphericalTensor>(fieldName);
-            loadField<symmTensor>(fieldName);
-            loadField<tensor>(fieldName);
+            // Load field if necessary
+            loaded = loadField<scalar>(fieldName) || loaded;
+            loaded = loadField<vector>(fieldName) || loaded;
+            loaded = loadField<sphericalTensor>(fieldName) || loaded;
+            loaded = loadField<symmTensor>(fieldName) || loaded;
+            loaded = loadField<tensor>(fieldName) || loaded;
+        }
+
+        if (log_)
+        {
+            if (!loaded)
+            {
+                Info<< "    no fields loaded" << endl;
+            }
+            Info<< endl;
         }
     }
 }
diff --git a/src/postProcessing/functionObjects/field/readFields/readFields.H b/src/postProcessing/functionObjects/field/readFields/readFields.H
index f785e4a881795e77f0c5e6fe489d40bcf0646eac..dca694a7bc09c2e50a0bd0b4ae0d11a7b1c99af0 100644
--- a/src/postProcessing/functionObjects/field/readFields/readFields.H
+++ b/src/postProcessing/functionObjects/field/readFields/readFields.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2015 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2015-2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -106,7 +106,7 @@ protected:
     // Protected Member Functions
 
         template<class Type>
-        void loadField(const word&) const;
+        bool loadField(const word&) const;
 
 
 private:
diff --git a/src/postProcessing/functionObjects/field/readFields/readFieldsTemplates.C b/src/postProcessing/functionObjects/field/readFields/readFieldsTemplates.C
index 4b128aa3882305dc173a4410cf4085467d8e744a..6810bf7f092df8ea2fbd8d1e19c6352030dab05f 100644
--- a/src/postProcessing/functionObjects/field/readFields/readFieldsTemplates.C
+++ b/src/postProcessing/functionObjects/field/readFields/readFieldsTemplates.C
@@ -31,7 +31,7 @@ License
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 template<class Type>
-void Foam::readFields::loadField(const word& fieldName) const
+bool Foam::readFields::loadField(const word& fieldName) const
 {
     typedef GeometricField<Type, fvPatchField, volMesh> vfType;
     typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfType;
@@ -77,6 +77,7 @@ void Foam::readFields::loadField(const word& fieldName) const
             if (log_) Info<< "    Reading " << fieldName << endl;
             vfType* vfPtr = new vfType(fieldHeader, mesh);
             mesh.objectRegistry::store(vfPtr);
+            return true;
         }
         else if
         (
@@ -88,8 +89,11 @@ void Foam::readFields::loadField(const word& fieldName) const
             if (log_) Info<< "    Reading " << fieldName << endl;
             sfType* sfPtr = new sfType(fieldHeader, mesh);
             mesh.objectRegistry::store(sfPtr);
+            return true;
         }
     }
+
+    return false;
 }
 
 
diff --git a/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C b/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C
index e74bfb2f691ad9e063d169b6fe39754054c596f1..1d8855d665ea38faa8a04389045c646f6a93e74f 100644
--- a/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C
+++ b/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2013-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2015 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -335,7 +335,8 @@ Foam::regionSizeDistribution::regionSizeDistribution
     active_(true),
     alphaName_(dict.lookup("field")),
     patchNames_(dict.lookup("patches")),
-    log_(true)
+    log_(true),
+    isoPlanes_(dict.lookupOrDefault<bool>("isoPlanes", false))
 {
     // Check if the available mesh is an fvMesh, otherwise deactivate
     if (isA<fvMesh>(obr_))
@@ -388,6 +389,17 @@ void Foam::regionSizeDistribution::read(const dictionary& dict)
                 << "Transforming all vectorFields with coordinate system "
                 << coordSysPtr_().name() << endl;
         }
+
+        if (isoPlanes_)
+        {
+             dict.lookup("origin") >> origin_;
+             dict.lookup("direction") >> direction_;
+             dict.lookup("maxDiameter") >> maxDiameter_;
+             dict.lookup("nDownstreamBins") >> nDownstreamBins_;
+             dict.lookup("maxDownstream") >> maxDownstream_;
+
+             direction_ /= mag(direction_);
+        }
     }
 }
 
@@ -691,6 +703,8 @@ void Foam::regionSizeDistribution::write()
         // (patchRegions) and background regions from maps.
         // Note that we have to use mesh volume (allRegionVolume) and not
         // allRegionAlphaVolume since background might not have alpha in it.
+        // Deleting regions where the volume-alpha-weighted is lower than
+        // threshold
         forAllIter(Map<scalar>, allRegionVolume, vIter)
         {
             label regionI = vIter.key();
@@ -698,6 +712,7 @@ void Foam::regionSizeDistribution::write()
             (
                 patchRegions.found(regionI)
              || vIter() >= maxDropletVol
+             || (allRegionAlphaVolume[regionI]/vIter() < threshold_)
             )
             {
                 allRegionVolume.erase(vIter);
@@ -735,6 +750,108 @@ void Foam::regionSizeDistribution::write()
                 )
             );
 
+            vectorField centroids(sortedVols.size(), vector::zero);
+
+            // Check if downstream bins are calculed
+            if (isoPlanes_)
+            {
+                vectorField alphaDistance
+                (
+                    (alpha.internalField()*mesh.V())
+                  * (mesh.C().internalField() - origin_)()
+                );
+
+                Map<vector> allRegionAlphaDistance
+                (
+                    regionSum
+                    (
+                        regions,
+                        alphaDistance
+                    )
+                );
+
+                // 2. centroid
+                vectorField sortedMoment
+                (
+                    extractData
+                    (
+                        sortedRegions,
+                        allRegionAlphaDistance
+                    )
+                );
+
+                centroids = sortedMoment/sortedVols + origin_;
+
+                // Bin according to centroid
+                scalarField distToPlane((centroids - origin_) & direction_);
+
+                vectorField radialDistToOrigin
+                (
+                    (centroids - origin_) - (distToPlane*direction_)
+                );
+
+                const scalar deltaX = maxDownstream_/nDownstreamBins_;
+                labelList downstreamIndices(distToPlane.size(), -1);
+                forAll(distToPlane, i)
+                {
+                    if
+                    (
+                        (mag(radialDistToOrigin[i]) < maxDiameter_)
+                     && (distToPlane[i] < maxDownstream_)
+                    )
+                    {
+                        downstreamIndices[i] = distToPlane[i]/deltaX;
+                    }
+                }
+
+                scalarField binDownCount(nDownstreamBins_, 0.0);
+                forAll(distToPlane, i)
+                {
+                    if (downstreamIndices[i] != -1)
+                    {
+                        binDownCount[downstreamIndices[i]] += 1.0;
+                    }
+                }
+
+                // Write
+                if (Pstream::master())
+                {
+                    // Construct mids of bins for plotting
+                    pointField xBin(nDownstreamBins_);
+
+                    scalar x = 0.5*deltaX;
+                    forAll(xBin, i)
+                    {
+                        xBin[i] = point(x, 0, 0);
+                        x += deltaX;
+                    }
+
+                    const coordSet coords("distance", "x", xBin, mag(xBin));
+                    writeGraph(coords, "isoPlanes", binDownCount);
+                }
+
+                // Write to screen
+                if (log_)
+                {
+                    Info<< "    Iso-planes Bins:" << endl;
+                    Info<< "    " << token::TAB << "Bin"
+                        << token::TAB << "Min distance"
+                        << token::TAB << "Count:"
+                        << endl;
+
+                    scalar delta = 0.0;
+                    forAll(binDownCount, binI)
+                    {
+                        Info<< "    " << token::TAB << binI
+                            << token::TAB << delta
+                            << token::TAB << binDownCount[binI] << endl;
+                        delta += deltaX;
+                    }
+                    Info<< endl;
+
+                }
+            }
+
             // Calculate the diameters
             scalarField sortedDiameters(sortedVols.size());
             forAll(sortedDiameters, i)
diff --git a/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H b/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H
index 29c0bc5ac1ae5021029c3b1d54af28ac5ae27216..657077366bf4d39ef9ef08a9671a609e7276771c 100644
--- a/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H
+++ b/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2013-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2015 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -35,6 +35,8 @@ Description
     based on where the field is below the threshold value.  These
     regions ("droplets") can now be analysed.
 
+
+
     Regions:
     - print the regions connected to a user-defined set of patches.
       (in spray calculation these form the liquid core)
@@ -53,6 +55,9 @@ Description
     - write graph of sum, average and deviation of droplet volume per bin
     - write graph of sum, average and deviation of user-defined fields.  For
       volVectorFields these are those of the 3 components and the magnitude.
+    - (optional) write graph of histogram of centroids on iso planes
+      downstream of the injector determined by origin, direction and maxDiameter
+      up to maxDownstream
 
     Example of function object specification:
     \verbatim
@@ -76,6 +81,24 @@ Description
             e3              (0 1 1);
             e1              (1 0 0);
         }
+
+        // Optional downstream iso-plane bins.
+        isoPlanes       true;
+
+            // Plane normal and point definition
+            direction       (1 0 1);
+            origin          (1e-4 0 5e-4);
+
+            // Maximum diameter of the cylinder formed by the origin point
+            // and direction
+            maxDiameter     3e-4;
+
+            // Maximum downstream distance
+            maxDownstream   6e-4;
+
+            // Number of iso-plane bins
+            nDownstreamBins 20;
+
     }
     \endverbatim
 
@@ -177,6 +200,27 @@ class regionSizeDistribution
         //- Optional coordinate system
         autoPtr<coordinateSystem> coordSysPtr_;
 
+        // Optional extra definition of bins on planes downstream to the origin
+        // point and maximum diameter
+
+            //- Switch to enable iso-planes sampling
+            bool isoPlanes_;
+
+            //- Optional origin point
+            vector origin_;
+
+            //- Optional plane normal direction
+            vector direction_;
+
+            //- Optional maximum diameter on plane
+            scalar maxDiameter_;
+
+            //- Optional number of bins for
+            scalar nDownstreamBins_;
+
+            //- Optional maximum downstream coordinate from origin
+            scalar maxDownstream_;
+
 
     // Private Member Functions
 
diff --git a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/Allwmake b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/Allwmake
index 727f9a20aad94815e224120463f47973a7104a77..277a8c394f6f36ad02f89b0bab074c3f8121925e 100755
--- a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/Allwmake
+++ b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/Allwmake
@@ -18,9 +18,9 @@ echo
 
 if [ -d "$VTK_DIR" -o -d "$ParaView_DIR" ]
 then
-    # ensure CMake gets the correct C++ compiler
+    # ensure CMake gets the correct C/C++ compilers
+    [ -n "$WM_CC" ]  && export CC="$WM_CC"
     [ -n "$WM_CXX" ] && export CXX="$WM_CXX"
-    [ -n "$WM_CC" ] && export CC="$WM_CC"
 
     if type cmake > /dev/null 2>&1
     then
diff --git a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C
index 40f60a7c86c697a5f4868d5fd6815da3f885dc9b..86fd9b0e73605f20c347df3568bbbcc4ff802550 100644
--- a/src/postProcessing/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C
+++ b/src/postProcessing/functionObjects/graphics/runTimePostProcessing/fieldVisualisationBase.C
@@ -43,6 +43,7 @@ License
 #include "vtkSphereSource.h"
 #include "vtkTextActor.h"
 #include "vtkTextProperty.h"
+#include "vtkCellDataToPointData.h"
 
 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
 
@@ -151,6 +152,9 @@ void Foam::fieldVisualisationBase::addScalarBar
     const vector textColour = colours_["text"]->value(position);
 
     // Work-around to supply our own scalarbar title
+    // - Default scalar bar title text is scales by the scalar bar box
+    //   dimensions so if the title is a long string, the text is shrunk to fit
+    //   Instead, suppress title and set the title using a vtkTextActor
     vtkSmartPointer<vtkTextActor> titleActor =
         vtkSmartPointer<vtkTextActor>::New();
     sbar->SetTitle(" ");
@@ -170,19 +174,18 @@ void Foam::fieldVisualisationBase::addScalarBar
     titleActor->GetPositionCoordinate()->
         SetCoordinateSystemToNormalizedViewport();
 
-/*
-    sbar->SetTitle(scalarBar_.title_.c_str());
-    sbar->GetTitleTextProperty()->SetColor
-    (
-        textColour[0],
-        textColour[1],
-        textColour[2]
-    );
-    sbar->GetTitleTextProperty()->SetFontSize(scalarBar_.fontSize_);
-    sbar->GetTitleTextProperty()->ShadowOff();
-    sbar->GetTitleTextProperty()->BoldOn();
-    sbar->GetTitleTextProperty()->ItalicOff();
-*/
+    // How to use the standard scalar bar text
+    // sbar->SetTitle(scalarBar_.title_.c_str());
+    // sbar->GetTitleTextProperty()->SetColor
+    // (
+    //     textColour[0],
+    //     textColour[1],
+    //     textColour[2]
+    // );
+    // sbar->GetTitleTextProperty()->SetFontSize(scalarBar_.fontSize_);
+    // sbar->GetTitleTextProperty()->ShadowOff();
+    // sbar->GetTitleTextProperty()->BoldOn();
+    // sbar->GetTitleTextProperty()->ItalicOff();
 
     sbar->GetLabelTextProperty()->SetColor
     (
@@ -217,8 +220,8 @@ void Foam::fieldVisualisationBase::addScalarBar
         sbar->SetWidth(0.75);
         sbar->SetHeight(0.07);
         sbar->SetBarRatio(0.5);
-//        sbar->SetHeight(0.1);
-//        sbar->SetTitleRatio(0.01);
+        // sbar->SetHeight(0.1);
+        // sbar->SetTitleRatio(0.01);
         sbar->SetTextPositionToPrecedeScalarBar();
     }
 
@@ -228,10 +231,10 @@ void Foam::fieldVisualisationBase::addScalarBar
         scalarBar_.position_.second() + sbar->GetHeight()
     );
 
-//    sbar->DrawFrameOn();
-//    sbar->DrawBackgroundOn();
-//    sbar->UseOpacityOff();
-//    sbar->VisibilityOff();
+    // sbar->DrawFrameOn();
+    // sbar->DrawBackgroundOn();
+    // sbar->UseOpacityOff();
+    // sbar->VisibilityOff();
     sbar->VisibilityOn();
 
     renderer->AddActor(sbar);
@@ -266,18 +269,20 @@ void Foam::fieldVisualisationBase::setField
             lut->SetVectorMode(vtkScalarsToColors::MAGNITUDE);
 
             // Configure the mapper
-            mapper->SelectColorArray(colourFieldName.c_str());
-            mapper->SetScalarRange(range_.first(), range_.second());
-
-            // Set to use either cell or point data
             const char* fieldName = colourFieldName.c_str();
-            if (pData->GetCellData()->HasArray(fieldName) == 1)
+            mapper->SelectColorArray(fieldName);
+
+            // Set to use either point or cell data
+            // Note: if both point and cell data exists, preferentially
+            //       choosing point data.  This is often the case when using
+            //       glyphs
+            if (pData->GetPointData()->HasArray(fieldName) == 1)
             {
-                mapper->SetScalarModeToUseCellFieldData();
+                mapper->SetScalarModeToUsePointFieldData();
             }
-            else if (pData->GetPointData()->HasArray(fieldName) == 1)
+            else if (pData->GetCellData()->HasArray(fieldName) == 1)
             {
-                mapper->SetScalarModeToUsePointFieldData();
+                mapper->SetScalarModeToUseCellFieldData();
             }
             else
             {
@@ -286,7 +291,7 @@ void Foam::fieldVisualisationBase::setField
                     << "- assuming point data";
                 mapper->SetScalarModeToUsePointFieldData();
             }
-
+            mapper->SetScalarRange(range_.first(), range_.second());
             mapper->SetColorModeToMapScalars();
             mapper->SetLookupTable(lut);
             mapper->ScalarVisibilityOn();
@@ -322,9 +327,37 @@ void Foam::fieldVisualisationBase::addGlyphs
     glyph->ScalingOn();
     bool ok = true;
 
-    label nComponents =
-        data->GetPointData()->GetArray(scaleFieldName.c_str())
-            ->GetNumberOfComponents();
+    // Determine whether we have scalar or vector data
+    label nComponents = -1;
+    const char* scaleFieldNameChar = scaleFieldName.c_str();
+    if (data->GetPointData()->HasArray(scaleFieldNameChar) == 1)
+    {
+        nComponents =
+            data->GetPointData()->GetArray(scaleFieldNameChar)
+                ->GetNumberOfComponents();
+    }
+    else if (data->GetCellData()->HasArray(scaleFieldNameChar) == 1)
+    {
+        // Need to convert cell data to point data
+        vtkSmartPointer<vtkCellDataToPointData> cellToPoint =
+            vtkSmartPointer<vtkCellDataToPointData>::New();
+        cellToPoint->SetInputData(data);
+        cellToPoint->Update();
+        vtkDataSet* pds = cellToPoint->GetOutput();
+        vtkDataArray* pData = pds->GetPointData()->GetArray(scaleFieldNameChar);
+
+        // Store in main vtkPolyData
+        data->GetPointData()->AddArray(pData);
+
+        nComponents = pData->GetNumberOfComponents();
+    }
+    else
+    {
+        WarningInFunction
+            << "Glyphs can only be added to scalar or vector data. "
+            << "Unable to process field " << scaleFieldName << endl;
+        return;
+    }
 
     if (nComponents == 1)
     {
@@ -332,9 +365,10 @@ void Foam::fieldVisualisationBase::addGlyphs
             vtkSmartPointer<vtkSphereSource>::New();
         sphere->SetCenter(0, 0, 0);
         sphere->SetRadius(0.5);
-// Setting higher resolution slows the rendering significantly
-//        sphere->SetPhiResolution(20);
-//        sphere->SetThetaResolution(20);
+
+        // Setting higher resolution slows the rendering significantly
+        // sphere->SetPhiResolution(20);
+        // sphere->SetThetaResolution(20);
 
         glyph->SetSourceConnection(sphere->GetOutputPort());
 
@@ -342,18 +376,18 @@ void Foam::fieldVisualisationBase::addGlyphs
         {
             double range[2];
 
-// Can use values to find range
-//            vtkDataArray* values =
-//                data->GetPointData()->GetScalars(scaleFieldName.c_str());
-//            values->GetRange(range);
+            // Can use values to find range
+            // vtkDataArray* values =
+            //     data->GetPointData()->GetScalars(scaleFieldNameChar);
+            // values->GetRange(range);
 
-            // set range accoding to user-supplied limits
+            // Set range accoding to user-supplied limits
             range[0] = range_.first();
             range[1] = range_.second();
             glyph->ClampingOn();
             glyph->SetRange(range);
 
-            // if range[0] != min(value), maxGlyphLength behaviour will not
+            // If range[0] != min(value), maxGlyphLength behaviour will not
             // be correct...
             glyph->SetScaleFactor(maxGlyphLength);
         }
@@ -370,7 +404,7 @@ void Foam::fieldVisualisationBase::addGlyphs
             0,
             0,
             vtkDataObject::FIELD_ASSOCIATION_POINTS,
-            scaleFieldName.c_str()
+            scaleFieldNameChar
         );
     }
     else if (nComponents == 3)
@@ -388,21 +422,21 @@ void Foam::fieldVisualisationBase::addGlyphs
         if (maxGlyphLength > 0)
         {
             vtkDataArray* values =
-                data->GetPointData()->GetVectors(scaleFieldName.c_str());
+                data->GetPointData()->GetVectors(scaleFieldNameChar);
+
             double range[6];
             values->GetRange(range);
 
-/*
             // Attempt to set range for vectors...
-            scalar x0 = sqrt(sqr(range_.first())/3.0);
-            scalar x1 = sqrt(sqr(range_.second())/3.0);
-            range[0] = x0;
-            range[1] = x0;
-            range[2] = x0;
-            range[3] = x1;
-            range[4] = x1;
-            range[5] = x1;
-*/
+            // scalar x0 = sqrt(sqr(range_.first())/3.0);
+            // scalar x1 = sqrt(sqr(range_.second())/3.0);
+            // range[0] = x0;
+            // range[1] = x0;
+            // range[2] = x0;
+            // range[3] = x1;
+            // range[4] = x1;
+            // range[5] = x1;
+
             glyph->ClampingOn();
             glyph->SetRange(range);
             glyph->SetScaleFactor(maxGlyphLength);
@@ -421,7 +455,7 @@ void Foam::fieldVisualisationBase::addGlyphs
             0,
             0,
             vtkDataObject::FIELD_ASSOCIATION_POINTS,
-            scaleFieldName.c_str()
+            scaleFieldNameChar
         );
     }
     else
diff --git a/src/postProcessing/functionObjects/jobControl/externalCoupled/externalCoupledFunctionObject.C b/src/postProcessing/functionObjects/jobControl/externalCoupled/externalCoupledFunctionObject.C
index 46d44f65a317bbb12693aad52c8cf55ef7c78e55..66f11a9038501e3c64b91cedbf6a717e2b387ac0 100644
--- a/src/postProcessing/functionObjects/jobControl/externalCoupled/externalCoupledFunctionObject.C
+++ b/src/postProcessing/functionObjects/jobControl/externalCoupled/externalCoupledFunctionObject.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2015-2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -770,7 +770,7 @@ void Foam::externalCoupledFunctionObject::initialise()
         // Wait for initial data to be made available
         wait();
 
-        // Eead data passed back from external source
+        // Read data passed back from external source
         readData();
     }
 
diff --git a/src/postProcessing/functionObjects/systemCall/controlDict b/src/postProcessing/functionObjects/systemCall/controlDict
index ff192e197cf5d83bd790654dcb71a3eb464535d3..124c5406b9b939eeaa4a2153ed6512eb845b9b0c 100644
--- a/src/postProcessing/functionObjects/systemCall/controlDict
+++ b/src/postProcessing/functionObjects/systemCall/controlDict
@@ -62,14 +62,15 @@ functions
         // called at the end of the run
         endCalls
         (
-            "echo \*\*\* writing .bashrc \*\*\*"
-            "cat ~/.bashrc"
-            "echo \*\*\* done \*\*\*"
+            // Note: single quotes to avoid shell expansion
+            "echo '*** listing ~/.bashrc ***'"
+            "cat ~/.bashrc; echo '*** done ***'"
         );
 
-        // called every ouput time
+        // called every output time
         writeCalls
         (
+            // Note: can also backslash to escape shell meta-characters
             "echo \*\*\* writing data \*\*\*"
         );
     }
diff --git a/src/postProcessing/functionObjects/utilities/Make/files b/src/postProcessing/functionObjects/utilities/Make/files
index e9b8fed1508246f1eedb619433ee712afe639551..fdb2b220ea06a17e9cdd8458578b4d996800476a 100644
--- a/src/postProcessing/functionObjects/utilities/Make/files
+++ b/src/postProcessing/functionObjects/utilities/Make/files
@@ -6,6 +6,9 @@ codedFunctionObject/codedFunctionObject.C
 CourantNo/CourantNo.C
 CourantNo/CourantNoFunctionObject.C
 
+ddt2/ddt2.C
+ddt2/ddt2FunctionObject.C
+
 DESModelRegions/DESModelRegions.C
 DESModelRegions/DESModelRegionsFunctionObject.C
 
@@ -18,6 +21,9 @@ fluxSummary/fluxSummaryFunctionObject.C
 Lambda2/Lambda2.C
 Lambda2/Lambda2FunctionObject.C
 
+mapFields/mapFields.C
+mapFields/mapFieldsFunctionObject.C
+
 Peclet/Peclet.C
 Peclet/PecletFunctionObject.C
 
@@ -48,6 +54,9 @@ wallShearStress/wallShearStressFunctionObject.C
 yPlus/yPlus.C
 yPlus/yPlusFunctionObject.C
 
+zeroGradient/zeroGradient.C
+zeroGradient/zeroGradientFunctionObject.C
+
 setTimeStep/setTimeStepFunctionObject.C
 
 reactionSensitivityAnalysis/reactionsSensitivityAnalysisFunctionObject.C
diff --git a/src/postProcessing/functionObjects/utilities/Make/options b/src/postProcessing/functionObjects/utilities/Make/options
index 82ceb9db5f08b47a77ba0861728512dc01e3f2f8..3feeee001a57981bb3fd6af0888052facf025d9e 100644
--- a/src/postProcessing/functionObjects/utilities/Make/options
+++ b/src/postProcessing/functionObjects/utilities/Make/options
@@ -32,4 +32,4 @@ LIB_LIBS = \
     -lsampling \
     -lsurfMesh \
     -lchemistryModel \
-    -lreactionThermophysicalModels
\ No newline at end of file
+    -lreactionThermophysicalModels
diff --git a/src/postProcessing/functionObjects/utilities/blendingFactor/blendingFactor.H b/src/postProcessing/functionObjects/utilities/blendingFactor/blendingFactor.H
index f7166470afd563e3b5874ea01211b6fd8e37d22b..be2fe747ad1c604c5e5db371277a0649cac54748 100644
--- a/src/postProcessing/functionObjects/utilities/blendingFactor/blendingFactor.H
+++ b/src/postProcessing/functionObjects/utilities/blendingFactor/blendingFactor.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2013-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -88,6 +88,8 @@ SourceFiles
 #include "OFstream.H"
 #include "Switch.H"
 
+#include "convectionScheme.H"
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
@@ -140,6 +142,14 @@ class blendingFactor
         //- Disallow default bitwise assignment
         void operator=(const blendingFactor&);
 
+        //- Helper function to calculate the blending factor for the scheme
+        template<class Type>
+        void calcScheme
+        (
+            const GeometricField<Type, fvPatchField, volMesh>& field,
+            const typename fv::convectionScheme<Type>& cs
+        );
+
         //- Calculate the blending factor
         template<class Type>
         void calc();
diff --git a/src/postProcessing/functionObjects/utilities/blendingFactor/blendingFactorTemplates.C b/src/postProcessing/functionObjects/utilities/blendingFactor/blendingFactorTemplates.C
index 26832a892d62cd2e1070512794c235adc7860dc1..7031607bd480f8a75cf0623cb41b77483bcc6440 100644
--- a/src/postProcessing/functionObjects/utilities/blendingFactor/blendingFactorTemplates.C
+++ b/src/postProcessing/functionObjects/utilities/blendingFactor/blendingFactorTemplates.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2013-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2015 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2015-2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -24,6 +24,7 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "gaussConvectionScheme.H"
+#include "boundedConvectionScheme.H"
 #include "blendedSchemeBase.H"
 #include "fvcCellReduce.H"
 #include "zeroGradientFvPatchFields.H"
@@ -31,39 +32,35 @@ License
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 template<class Type>
-void Foam::blendingFactor::calc()
+void Foam::blendingFactor::calcScheme
+(
+    const GeometricField<Type, fvPatchField, volMesh>& field,
+    const typename fv::convectionScheme<Type>& cs
+)
 {
-    typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
-
-    if (!obr_.foundObject<fieldType>(fieldName_))
+    if (!isA<fv::gaussConvectionScheme<Type>>(cs))
     {
+        WarningInFunction
+            << "Scheme for field " << field.name() << " is not a "
+            << fv::gaussConvectionScheme<Type>::typeName
+            << " scheme. Not calculating " << resultName_ << endl;
+
         return;
     }
 
-    const fvMesh& mesh = refCast<const fvMesh>(obr_);
-
-    const fieldType& field = mesh.lookupObject<fieldType>(fieldName_);
-
-    const word divScheme("div(" + phiName_ + ',' + fieldName_ + ')');
-    ITstream& its = mesh.divScheme(divScheme);
-
-    const surfaceScalarField& phi =
-        mesh.lookupObject<surfaceScalarField>(phiName_);
-
-    tmp<fv::convectionScheme<Type>> cs =
-        fv::convectionScheme<Type>::New(mesh, phi, its);
-
     const fv::gaussConvectionScheme<Type>& gcs =
-        refCast<const fv::gaussConvectionScheme<Type>>(cs());
+        refCast<const fv::gaussConvectionScheme<Type>>(cs);
 
-    const surfaceInterpolationScheme<Type>& interpScheme =
-        gcs.interpScheme();
+
+    const surfaceInterpolationScheme<Type>& interpScheme = gcs.interpScheme();
 
     if (!isA<blendedSchemeBase<Type>>(interpScheme))
     {
-        FatalErrorInFunction
-            << interpScheme.typeName << " is not a blended scheme"
-            << exit(FatalError);
+        WarningInFunction
+            << interpScheme.type() << " is not a blended scheme"
+            << ". Not calculating " << resultName_ << endl;
+
+        return;
     }
 
     // Retrieve the face-based blending factor
@@ -123,4 +120,46 @@ void Foam::blendingFactor::calc()
 }
 
 
+template<class Type>
+void Foam::blendingFactor::calc()
+{
+    typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
+
+    if (!obr_.foundObject<fieldType>(fieldName_))
+    {
+        return;
+    }
+
+    const fvMesh& mesh = refCast<const fvMesh>(obr_);
+
+    const fieldType& field = mesh.lookupObject<fieldType>(fieldName_);
+
+    const word divScheme("div(" + phiName_ + ',' + fieldName_ + ')');
+    ITstream& its = mesh.divScheme(divScheme);
+
+    const surfaceScalarField& phi =
+        mesh.lookupObject<surfaceScalarField>(phiName_);
+
+    tmp<fv::convectionScheme<Type>> tcs =
+        fv::convectionScheme<Type>::New(mesh, phi, its);
+
+    const fv::convectionScheme<Type>& cs = tcs();
+
+    if (isA<fv::boundedConvectionScheme<Type>>(cs))
+    {
+        const fv::boundedConvectionScheme<Type>& bcs =
+            refCast<const fv::boundedConvectionScheme<Type>>(cs);
+
+        calcScheme(field, bcs.scheme());
+    }
+    else
+    {
+        const fv::gaussConvectionScheme<Type>& gcs =
+            refCast<const fv::gaussConvectionScheme<Type>>(cs);
+
+        calcScheme(field, gcs);
+    }
+}
+
+
 // ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/itoa.H b/src/postProcessing/functionObjects/utilities/ddt2/IOddt2.H
similarity index 83%
rename from applications/utilities/postProcessing/dataConversion/foamToEnsight/itoa.H
rename to src/postProcessing/functionObjects/utilities/ddt2/IOddt2.H
index 0977a38960c15e24a75f9d3cede1813350609343..b64407662474f29b0af79078b7391418d9982855 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/itoa.H
+++ b/src/postProcessing/functionObjects/utilities/ddt2/IOddt2.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,27 +21,29 @@ License
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-InApplication
-    foamToEnsight
+Typedef
+    Foam::IOddt2
 
 Description
+    Instance of the generic IOOutputFilter for ddt2.
 
 \*---------------------------------------------------------------------------*/
 
-#include "word.H"
-#include "label.H"
+#ifndef IOddt2_H
+#define IOddt2_H
+
+#include "ddt2.H"
+#include "IOOutputFilter.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
 {
+    typedef IOOutputFilter<ddt2> IOddt2;
+}
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-word itoa(const label n);
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
+#endif
 
 // ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/ddt2/ddt2.C b/src/postProcessing/functionObjects/utilities/ddt2/ddt2.C
new file mode 100644
index 0000000000000000000000000000000000000000..58edbf362710a67a6e2ebd5ffbcfd9a267df265d
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/ddt2/ddt2.C
@@ -0,0 +1,359 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "ddt2.H"
+
+#include "volFields.H"
+#include "dictionary.H"
+#include "FieldFunctions.H"
+#include "fvcDdt.H"
+#include "steadyStateDdtScheme.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(ddt2, 0);
+}
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+bool Foam::ddt2::checkFormatName(const word& str)
+{
+    if (str.find("@@") == string::npos)
+    {
+        WarningInFunction
+            << "Bad result naming "
+            << "(no '@@' token found), deactivating."
+            << nl << endl;
+
+        return false;
+    }
+    else if (str == "@@")
+    {
+        WarningInFunction
+            << "Bad result naming "
+            << "(only a '@@' token found), deactivating."
+            << nl
+            << endl;
+
+        return false;
+    }
+    else
+    {
+        return true;
+    }
+}
+
+
+void Foam::ddt2::uniqWords(wordReList& lst)
+{
+    boolList retain(lst.size());
+    wordHashSet uniq;
+    forAll(lst, i)
+    {
+        const wordRe& select = lst[i];
+
+        retain[i] =
+        (
+            select.isPattern()
+         || uniq.insert(static_cast<const word&>(select))
+        );
+    }
+
+    inplaceSubset(retain, lst);
+}
+
+
+bool Foam::ddt2::accept(const word& fieldName) const
+{
+    // check input vs possible result names
+    // to avoid circular calculations
+    return !blacklist_.match(fieldName);
+}
+
+
+template<class FieldType>
+int Foam::ddt2::apply
+(
+    const fvMesh& mesh,
+    const word& inputName,
+    int& state
+)
+{
+    // state: return 0 (not-processed), -1 (skip), +1 ok
+
+    // already done, or not available
+    if (state || !mesh.foundObject<FieldType>(inputName))
+    {
+        return state;
+    }
+
+    const FieldType& input = mesh.lookupObject<FieldType>(inputName);
+
+    word outputName(resultName_);
+    outputName.replace("@@", inputName);
+
+    results_.set(outputName);
+
+    if (!mesh.foundObject<volScalarField>(outputName))
+    {
+        mesh.objectRegistry::store
+        (
+            new volScalarField
+            (
+                IOobject
+                (
+                    outputName,
+                    mesh.time().timeName(),
+                    mesh,
+                    IOobject::NO_READ,
+                    IOobject::NO_WRITE
+                ),
+                mesh,
+                dimensionedScalar
+                (
+                    "0",
+                    (
+                        mag_
+                      ? mag(input.dimensions()/dimTime)
+                      : magSqr(input.dimensions()/dimTime)
+                    ),
+                    Zero
+                )
+            )
+        );
+    }
+
+    volScalarField& output = const_cast<volScalarField&>
+    (
+        mesh.lookupObject<volScalarField>(outputName)
+    );
+
+    if (mag_)
+    {
+        output = mag(fvc::ddt(input));
+    }
+    else
+    {
+        output = magSqr(fvc::ddt(input));
+    }
+
+    if (log_)
+    {
+        // could add additional statistics here
+        Info<< type() << " " << name_
+            << " field " << outputName
+            << " average: " << gAverage(output) << endl;
+    }
+
+    state = +1;
+    return state;
+}
+
+
+int Foam::ddt2::process(const fvMesh& mesh, const word& fieldName)
+{
+    if (!accept(fieldName))
+    {
+        return -1;
+    }
+
+    int state = 0;
+
+    apply<volScalarField>(mesh, fieldName, state);
+    apply<volVectorField>(mesh, fieldName, state);
+
+    return state;
+}
+
+
+void Foam::ddt2::process(const fvMesh& mesh)
+{
+    results_.clear();
+
+    wordHashSet candidates = subsetStrings(selectFields_, mesh.names());
+    DynamicList<word> missing(selectFields_.size());
+    DynamicList<word> ignored(selectFields_.size());
+
+    // check exact matches first
+    forAll(selectFields_, i)
+    {
+        const wordRe& select = selectFields_[i];
+        if (!select.isPattern())
+        {
+            const word& fieldName = static_cast<const word&>(select);
+
+            if (!candidates.erase(fieldName))
+            {
+                missing.append(fieldName);
+            }
+            else if (process(mesh, fieldName) < 1)
+            {
+                ignored.append(fieldName);
+            }
+        }
+    }
+
+    forAllConstIter(wordHashSet, candidates, iter)
+    {
+        process(mesh, iter.key());
+    }
+
+    if (missing.size())
+    {
+        WarningInFunction
+            << "Missing field " << missing << endl;
+    }
+    if (ignored.size())
+    {
+        WarningInFunction
+            << "Unprocessed field " << ignored << endl;
+    }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::ddt2::ddt2
+(
+    const word& name,
+    const objectRegistry& obr,
+    const dictionary& dict,
+    const bool loadFromFiles
+)
+:
+    name_(name),
+    obr_(obr),
+    active_(true),
+    selectFields_(),
+    resultName_(word::null),
+    blacklist_(),
+    results_(),
+    log_(true),
+    mag_(dict.lookupOrDefault<Switch>("mag", false))
+{
+    // Check if the available mesh is an fvMesh and transient,
+    // otherwise deactivate
+    if (isA<fvMesh>(obr_))
+    {
+        const fvMesh& mesh = refCast<const fvMesh>(obr_);
+
+        if (word(mesh.ddtScheme("default")) == "steadyState")
+        {
+            active_ = false;
+            WarningInFunction
+                << "Steady-state, deactivating." << nl
+                << endl;
+        }
+    }
+    else
+    {
+        active_ = false;
+        WarningInFunction
+            << "No fvMesh available, deactivating." << nl
+            << endl;
+    }
+
+    read(dict);
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::ddt2::~ddt2()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::ddt2::read(const dictionary& dict)
+{
+    if (active_)
+    {
+        log_.readIfPresent("log", dict);
+
+        dict.lookup("fields") >> selectFields_;
+        uniqWords(selectFields_);
+
+        resultName_ = dict.lookupOrDefault<word>
+        (
+            "result",
+            ( mag_ ? "mag(ddt(@@))" : "magSqr(ddt(@@))" )
+        );
+
+        active_ = checkFormatName(resultName_);
+        if (active_)
+        {
+            blacklist_.set
+            (
+                string::quotemeta<regExp>
+                (
+                    resultName_
+                ).replace("@@", "(.+)")
+            );
+        }
+        else
+        {
+            blacklist_.clear();
+        }
+    }
+}
+
+
+void Foam::ddt2::execute()
+{
+    results_.clear();
+    if (active_)
+    {
+        process(refCast<const fvMesh>(obr_));
+    }
+}
+
+
+void Foam::ddt2::write()
+{
+    if (active_)
+    {
+        // consistent output order
+        const wordList outputList = results_.sortedToc();
+
+        forAll(outputList, i)
+        {
+            const word& fieldName = outputList[i];
+
+            if (obr_.foundObject<regIOobject>(fieldName))
+            {
+                const regIOobject& io =
+                    obr_.lookupObject<regIOobject>(fieldName);
+
+                io.write();
+            }
+        }
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/ddt2/ddt2.H b/src/postProcessing/functionObjects/utilities/ddt2/ddt2.H
new file mode 100644
index 0000000000000000000000000000000000000000..acbcc5d47cc902394fa1aa4d61b96cffa2dbc7af
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/ddt2/ddt2.H
@@ -0,0 +1,231 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::ddt2
+
+Group
+    grpFVFunctionObjects
+
+Description
+    This function object calculates the magnitude squared
+    of d(scalarField)/dt.
+
+    The result can be used further for determining variance or RMS values
+    (for example).
+
+    Example of function object specification:
+    \verbatim
+    dpdt2
+    {
+        type        ddt2;
+        functionObjectLibs ("libutilityFunctionObjects.so");
+        fields      (p);
+        result      d@@dt2;
+        ...
+    }
+    \endverbatim
+
+    \heading Function object usage
+    \table
+        Property | Description                | Required  | Default value
+        type     | type name: ddt2            | yes       |
+        fields   | Name of fields to process  | yes       |
+        result   | Name of results            | no        | magSqr(ddt(@@))
+        log      | Log to standard output     | no        | yes
+        mag      | Use 'mag' instead of 'magSqr' | no     | false
+    \endtable
+
+    Note that the optional 'mag' entry cannot be changed during the simulation
+    since it alters the dimensions of the output field.
+
+    A list of fields can contain exact names or regular expressions.
+    The token '\@\@' in the result name is replaced by the name of the source
+    field.
+
+    The function object will skip over fields that appear to have
+    already been processed (ie, their names are similar to the output names).
+
+SourceFiles
+    ddt2.C
+    IOddt2.H
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef ddt2_H
+#define ddt2_H
+
+#include "volFieldsFwd.H"
+#include "OFstream.H"
+#include "wordReList.H"
+#include "regExp.H"
+#include "HashSet.H"
+#include "Switch.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward declaration of classes
+class objectRegistry;
+class dictionary;
+class fvMesh;
+class polyMesh;
+class mapPolyMesh;
+
+/*---------------------------------------------------------------------------*\
+                            Class ddt2 Declaration
+\*---------------------------------------------------------------------------*/
+
+class ddt2
+{
+    // Private data
+
+        //- Name of this ddt2 object
+        word name_;
+
+        //- Reference to the database
+        const objectRegistry& obr_;
+
+        //- On/off switch
+        bool active_;
+
+        //- Name of fields to process
+        wordReList selectFields_;
+
+        //- Formatting for the result fields.
+        word resultName_;
+
+        //- Avoid processing the same field twice.
+        mutable regExp blacklist_;
+
+        //- Hashed names of result fields.
+        wordHashSet results_;
+
+        //- Switch to send output to Info as well as to file
+        Switch log_;
+
+        //- Use 'mag' instead of 'magSqr'.
+        //  Cannot be adjusted during the simulation since it alters the
+        //  dimensions of the output field.
+        const Switch mag_;
+
+
+    // Private Member Functions
+
+        //- Check that the word contains the appropriate substitution token(s).
+        static bool checkFormatName(const word&);
+
+        //- Eliminate duplicate 'word' entries
+        static void uniqWords(wordReList&);
+
+
+        //- Accept unless field name appears to have already been processed
+        bool accept(const word& fieldName) const;
+
+        //- Apply for the volume field type
+        template<class FieldType>
+        int apply(const fvMesh& mesh, const word& inputName, int& state);
+
+        //- Process by trying to apply for various volume field types.
+        int process(const fvMesh& mesh, const word& inputName);
+
+        //- Calculate the ddt2 fields
+        void process(const fvMesh& mesh);
+
+
+        //- Disallow default bitwise copy construct
+        ddt2(const ddt2&) = delete;
+
+        //- Disallow default bitwise assignment
+        void operator=(const ddt2&) = delete;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("ddt2");
+
+
+    // Constructors
+
+        //- Construct for given objectRegistry and dictionary.
+        //  Allow the possibility to load fields from files
+        ddt2
+        (
+            const word& name,
+            const objectRegistry&,
+            const dictionary&,
+            const bool loadFromFiles = false
+        );
+
+
+    //- Destructor
+    virtual ~ddt2();
+
+
+    // Member Functions
+
+        //- Return name of the ddt2 function object
+        virtual const word& name() const
+        {
+            return name_;
+        }
+
+        //- Read the ddt2 specification
+        virtual void read(const dictionary&);
+
+        //- Calculate the ddt2 fields
+        virtual void execute();
+
+        //- Execute at the final time-loop, currently does nothing
+        virtual void end()
+        {}
+
+        //- Called when time was set at the end of the Time::operator++
+        virtual void timeSet()
+        {}
+
+        //- Write the ddt fields
+        virtual void write();
+
+        //- Update for changes of mesh
+        virtual void updateMesh(const mapPolyMesh&)
+        {}
+
+        //- Update for changes of mesh
+        virtual void movePoints(const polyMesh&)
+        {}
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/ddt2/ddt2FunctionObject.C b/src/postProcessing/functionObjects/utilities/ddt2/ddt2FunctionObject.C
new file mode 100644
index 0000000000000000000000000000000000000000..9e09a15681ce4187ffd032376dc6e1a9d1073be9
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/ddt2/ddt2FunctionObject.C
@@ -0,0 +1,42 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "ddt2FunctionObject.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineNamedTemplateTypeNameAndDebug(ddt2FunctionObject, 0);
+
+    addToRunTimeSelectionTable
+    (
+        functionObject,
+        ddt2FunctionObject,
+        dictionary
+    );
+}
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/itoa.C b/src/postProcessing/functionObjects/utilities/ddt2/ddt2FunctionObject.H
similarity index 71%
rename from applications/utilities/postProcessing/dataConversion/foamToEnsight/itoa.C
rename to src/postProcessing/functionObjects/utilities/ddt2/ddt2FunctionObject.H
index 0975da93d30f87fbacbfe7ab0bba0637a7d05cd0..5f36e229c5ad77add481d1bdc654093b47941c8b 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/itoa.C
+++ b/src/postProcessing/functionObjects/utilities/ddt2/ddt2FunctionObject.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,41 +21,33 @@ License
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-\*---------------------------------------------------------------------------*/
-
-#include "itoa.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
+Typedef
+    Foam::ddt2FunctionObject
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+Description
+    FunctionObject wrapper around ddt2 to allow it to be created
+    via the functions entry within controlDict.
 
-word itoa(const label n)
-{
-    const label offset = '0';
-    const label length = 4;
+SourceFiles
+    ddt2FunctionObject.C
 
-    char val[length + 1];
+\*---------------------------------------------------------------------------*/
 
-    label leftOfN = n;
+#ifndef ddt2FunctionObject_H
+#define ddt2FunctionObject_H
 
-    for (label i=0; i<length; i++)
-    {
-        label j = label(leftOfN/pow(10, length - i - 1));
-        leftOfN -= j*pow(10, length - i - 1);
-        val[i] = offset + j;
-    }
+#include "ddt2.H"
+#include "OutputFilterFunctionObject.H"
 
-    val[length] = 0;
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-    return val;
+namespace Foam
+{
+    typedef OutputFilterFunctionObject<ddt2> ddt2FunctionObject;
 }
 
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace Foam
+#endif
 
 // ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightParticlePositions.H b/src/postProcessing/functionObjects/utilities/mapFields/IOmapFields.H
similarity index 75%
rename from applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightParticlePositions.H
rename to src/postProcessing/functionObjects/utilities/mapFields/IOmapFields.H
index 902a9ba658bd0d23dd083c28296f9faa898bfde0..abcd07e3b2725d002c6d27f771c544c29c0a82df 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightParticlePositions.H
+++ b/src/postProcessing/functionObjects/utilities/mapFields/IOmapFields.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,31 +21,26 @@ License
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-InApplication
-    foamToEnsight
+Typedef
+    Foam::IOmapFields
 
 Description
-
-SourceFiles
-    ensightParticlePositions.C
+    Instance of the generic IOOutputFilter for mapFields.
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef ensightParticlePositions_H
-#define ensightParticlePositions_H
+#ifndef IOmapFields_H
+#define IOmapFields_H
 
-#include "fvMesh.H"
+#include "mapFields.H"
+#include "IOOutputFilter.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-void ensightParticlePositions
-(
-    const Foam::fvMesh& mesh,
-    const Foam::fileName& postProcPath,
-    const Foam::word& timeFile,
-    const Foam::word& CloudName,
-    const bool dataExists
-);
+namespace Foam
+{
+    typedef IOOutputFilter<mapFields> IOmapFields;
+}
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/postProcessing/functionObjects/utilities/mapFields/mapFields.C b/src/postProcessing/functionObjects/utilities/mapFields/mapFields.C
new file mode 100644
index 0000000000000000000000000000000000000000..136b321005745c00a6df2a0af20a265bdd0d9064
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/mapFields/mapFields.C
@@ -0,0 +1,221 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "mapFields.H"
+#include "meshToMesh.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(mapFieldsFO, 0);
+}
+
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+void Foam::mapFieldsFO::createInterpolation(const dictionary& dict)
+{
+    const fvMesh& meshTarget = static_cast<const fvMesh&>(obr_);
+    const word mapRegionName(dict.lookup("mapRegion"));
+
+    if (log_)
+    {
+        Info<< name_ << ':' << nl
+            << "    Reading mesh " << mapRegionName << endl;
+    }
+
+    mapRegionPtr_.reset
+    (
+        new fvMesh
+        (
+            IOobject
+            (
+                mapRegionName,
+                meshTarget.time().constant(),
+                meshTarget.time()
+            )
+        )
+    );
+    const fvMesh& mapRegion = mapRegionPtr_();
+    word mapMethodName(dict.lookup("mapMethod"));
+    if (!meshToMesh::interpolationMethodNames_.found(mapMethodName))
+    {
+        FatalErrorInFunction
+            << type() << " " << name_ << ": unknown map method "
+            << mapMethodName << nl
+            << "Available methods include: "
+            << meshToMesh::interpolationMethodNames_.sortedToc()
+            << exit(FatalError);
+    }
+
+    meshToMesh::interpolationMethod mapMethod
+    (
+        meshToMesh::interpolationMethodNames_[mapMethodName]
+    );
+
+    // Lookup corresponding AMI method
+    word patchMapMethodName =
+        AMIPatchToPatchInterpolation::interpolationMethodToWord
+        (
+            meshToMesh::interpolationMethodAMI(mapMethod)
+        );
+
+    // Optionally override
+    if (dict.readIfPresent("patchMapMethod", patchMapMethodName))
+    {
+        if (log_)
+            Info<< "    Patch mapping method: " << patchMapMethodName << endl;
+    }
+
+    bool consistent = readBool(dict.lookup("consistent"));
+
+    if (log_) Info<< "    Creating mesh to mesh interpolation" << endl;
+
+    if (consistent)
+    {
+        interpPtr_.reset
+        (
+            new meshToMesh
+            (
+                mapRegion,
+                meshTarget,
+                mapMethodName,
+                patchMapMethodName
+            )
+        );
+    }
+    else
+    {
+        HashTable<word> patchMap(dict.lookup("patchMap"));
+        wordList cuttingPatches(dict.lookup("cuttingPatches"));
+
+        interpPtr_.reset
+        (
+            new meshToMesh
+            (
+                mapRegion,
+                meshTarget,
+                mapMethodName,
+                patchMapMethodName,
+                patchMap,
+                cuttingPatches
+            )
+        );
+    }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::mapFieldsFO::mapFieldsFO
+(
+    const word& name,
+    const objectRegistry& obr,
+    const dictionary& dict,
+    const bool loadFromFiles
+)
+:
+    name_(name),
+    obr_(obr),
+    active_(true),
+    log_(true),
+    mapRegionPtr_(),
+    interpPtr_(),
+    fieldNames_()
+{
+    if (!isA<fvMesh>(obr_))
+    {
+        active_ = false;
+        WarningInFunction
+            << "No fvMesh available, deactivating " << name_ << nl
+            << endl;
+    }
+
+    read(dict);
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::mapFieldsFO::~mapFieldsFO()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::mapFieldsFO::read(const dictionary& dict)
+{
+    if (active_)
+    {
+        log_.readIfPresent("log", dict);
+        dict.lookup("fields") >> fieldNames_;
+
+        createInterpolation(dict);
+    }
+}
+
+
+void Foam::mapFieldsFO::execute()
+{}
+
+
+void Foam::mapFieldsFO::end()
+{}
+
+
+void Foam::mapFieldsFO::timeSet()
+{}
+
+
+void Foam::mapFieldsFO::write()
+{
+    if (active_)
+    {
+        if (log_) Info
+            << type() << " " << name_ << " output:" << nl;
+
+        bool ok = false;
+
+        ok = writeFieldType<scalar>() || ok;
+        ok = writeFieldType<vector>() || ok;
+        ok = writeFieldType<sphericalTensor>() || ok;
+        ok = writeFieldType<symmTensor>() || ok;
+        ok = writeFieldType<tensor>() || ok;
+
+        if (log_)
+        {
+            if (!ok)
+            {
+                Info<< "    none" << nl;
+            }
+
+            Info<< endl;
+        }
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/mapFields/mapFields.H b/src/postProcessing/functionObjects/utilities/mapFields/mapFields.H
new file mode 100644
index 0000000000000000000000000000000000000000..9343616cfec70661f9f8b4032f8c975540d6d940
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/mapFields/mapFields.H
@@ -0,0 +1,207 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::mapFields
+
+Group
+    grpUtilitiesFunctionObjects
+
+Description
+    Map fields from local mesh to secondary mesh at run-time.
+
+    Example of function object specification to map fields:
+    \verbatim
+    mapFields1
+    {
+        type            mapFields;
+        functionObjectLibs ("libutilityFunctionObjects.so");
+        ...
+
+        mapRegion       coarseMesh;
+        mapMethod       cellVolumeWeight;
+        consistent      yes;
+
+        fields          ("U.*" p);
+    }
+
+    \heading Function object usage
+    \table
+        Property     | Description                | Required  | Default value
+        type         | Type name: mapFields       | yes       |
+        mapRgion     | Name of region to map to   | yes       |
+        mapMethod    | Mapping method             | yes       |
+        patchMapMethod | Patch mapping method     | no        | <auto>
+        consistent   | Mapping meshes have consistent boundaries | yes |
+        fields       | List of field names to map | yes       |
+        log          | Log to standard output     | no        | yes
+    \endtable
+
+
+SourceFiles
+    mapFields.C
+    IOmapFields.H
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef mapFieldsFO_H
+#define mapFieldsFO_H
+
+#include "volFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward declaration of classes
+class objectRegistry;
+class dictionary;
+class polyMesh;
+class mapPolyMesh;
+class meshToMesh;
+
+/*---------------------------------------------------------------------------*\
+                          Class mapFields Declaration
+\*---------------------------------------------------------------------------*/
+
+class mapFieldsFO
+{
+    // Private data
+
+        //- Name of this set of mapFields objects
+        word name_;
+
+        //- Reference to the database
+        const objectRegistry& obr_;
+
+        //- On/off switch
+        bool active_;
+
+        //- Switch to send output to Info as well as to file
+        Switch log_;
+
+        //- Locally cached map region mesh (map to this mesh)
+        autoPtr<fvMesh> mapRegionPtr_;
+
+        //- Mesh-to-mesh interpolation
+        autoPtr<meshToMesh> interpPtr_;
+
+        //- List of field names to interpolate
+        wordReList fieldNames_;
+
+
+    // Private Member Functions
+
+        //- Disallow default bitwise copy construct
+        mapFieldsFO(const mapFieldsFO&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const mapFieldsFO&) = delete;
+
+        //- Helper function to create the mesh-to-mesh interpolation
+        void createInterpolation(const dictionary& dict);
+
+        //- Helper function to evaluate constraint patches after mapping
+        template<class Type>
+        void evaluateConstraintTypes
+        (
+            GeometricField<Type, fvPatchField, volMesh>& fld
+        ) const;
+
+        //- Helper function to interpolate and write the fied
+        template<class Type>
+        bool writeFieldType() const;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("mapFieldsFO");
+
+
+    // Constructors
+
+        //- Construct for given objectRegistry and dictionary.
+        //  Allow the possibility to load fields from files
+        mapFieldsFO
+        (
+            const word& name,
+            const objectRegistry&,
+            const dictionary&,
+            const bool loadFromFiles = false
+        );
+
+
+    //- Destructor
+    virtual ~mapFieldsFO();
+
+
+    // Member Functions
+
+        //- Return name of the set of mapFields
+        virtual const word& name() const
+        {
+            return name_;
+        }
+
+        //- Read the mapFields data
+        virtual void read(const dictionary&);
+
+        //- Execute, currently does nothing
+        virtual void execute();
+
+        //- Execute at the final time-loop, currently does nothing
+        virtual void end();
+
+        //- Called when time was set at the end of the Time::operator++
+        virtual void timeSet();
+
+        //- Calculate the mapFields and write
+        virtual void write();
+
+        //- Update for changes of mesh
+        virtual void updateMesh(const mapPolyMesh&)
+        {}
+
+        //- Update for changes of mesh
+        virtual void movePoints(const polyMesh&)
+        {}
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+    #include "mapFieldsTemplates.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/mapFields/mapFieldsFunctionObject.C b/src/postProcessing/functionObjects/utilities/mapFields/mapFieldsFunctionObject.C
new file mode 100644
index 0000000000000000000000000000000000000000..f9d94f7b517c6d282c6362aeb340a40c7d2f913d
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/mapFields/mapFieldsFunctionObject.C
@@ -0,0 +1,42 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "mapFieldsFunctionObject.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineNamedTemplateTypeNameAndDebug(mapFieldsFunctionObject, 0);
+
+    addToRunTimeSelectionTable
+    (
+        functionObject,
+        mapFieldsFunctionObject,
+        dictionary
+    );
+}
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/mapFields/mapFieldsFunctionObject.H b/src/postProcessing/functionObjects/utilities/mapFields/mapFieldsFunctionObject.H
new file mode 100644
index 0000000000000000000000000000000000000000..087d93d230a82b979753c9889a8c0d4c1e67ecff
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/mapFields/mapFieldsFunctionObject.H
@@ -0,0 +1,53 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Typedef
+    Foam::mapFieldsFunctionObject
+
+Description
+    FunctionObject wrapper around mapFields to allow it to be created
+    via the functions entry within controlDict.
+
+SourceFiles
+    mapFieldsFunctionObject.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef mapFieldsFunctionObject_H
+#define mapFieldsFunctionObject_H
+
+#include "mapFields.H"
+#include "OutputFilterFunctionObject.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    typedef OutputFilterFunctionObject<mapFieldsFO> mapFieldsFunctionObject;
+}
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/mapFields/mapFieldsTemplates.C b/src/postProcessing/functionObjects/utilities/mapFields/mapFieldsTemplates.C
new file mode 100644
index 0000000000000000000000000000000000000000..dd1086049b0910a49a1046535f7f79a9402bfb6d
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/mapFields/mapFieldsTemplates.C
@@ -0,0 +1,153 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "meshToMesh.H"
+
+template<class Type>
+void Foam::mapFieldsFO::evaluateConstraintTypes
+(
+    GeometricField<Type, fvPatchField, volMesh>& fld
+) const
+{
+    typename GeometricField<Type, fvPatchField, volMesh>::
+        GeometricBoundaryField& fldBf = fld.boundaryField();
+
+    if
+    (
+        Pstream::defaultCommsType == Pstream::blocking
+     || Pstream::defaultCommsType == Pstream::nonBlocking
+    )
+    {
+        label nReq = Pstream::nRequests();
+
+        forAll(fldBf, patchi)
+        {
+            fvPatchField<Type>& tgtField = fldBf[patchi];
+
+            if
+            (
+                tgtField.type() == tgtField.patch().patch().type()
+             && polyPatch::constraintType(tgtField.patch().patch().type())
+            )
+            {
+                tgtField.initEvaluate(Pstream::defaultCommsType);
+            }
+        }
+
+        // Block for any outstanding requests
+        if
+        (
+            Pstream::parRun()
+         && Pstream::defaultCommsType == Pstream::nonBlocking
+        )
+        {
+            Pstream::waitRequests(nReq);
+        }
+
+        forAll(fldBf, patchi)
+        {
+            fvPatchField<Type>& tgtField = fldBf[patchi];
+
+            if
+            (
+                tgtField.type() == tgtField.patch().patch().type()
+             && polyPatch::constraintType(tgtField.patch().patch().type())
+            )
+            {
+                tgtField.evaluate(Pstream::defaultCommsType);
+            }
+        }
+    }
+    else if (Pstream::defaultCommsType == Pstream::scheduled)
+    {
+        const lduSchedule& patchSchedule =
+            fld.mesh().globalData().patchSchedule();
+
+        forAll(patchSchedule, patchEvali)
+        {
+            label patchi = patchSchedule[patchEvali].patch;
+            fvPatchField<Type>& tgtField = fldBf[patchi];
+
+            if
+            (
+                tgtField.type() == tgtField.patch().patch().type()
+             && polyPatch::constraintType(tgtField.patch().patch().type())
+            )
+            {
+                if (patchSchedule[patchEvali].init)
+                {
+                    tgtField.initEvaluate(Pstream::scheduled);
+                }
+                else
+                {
+                    tgtField.evaluate(Pstream::scheduled);
+                }
+            }
+        }
+    }
+}
+
+
+template<class Type>
+bool Foam::mapFieldsFO::writeFieldType() const
+{
+    typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
+
+    const fvMesh& mapRegion = mapRegionPtr_();
+
+    wordList fieldNames(obr_.names(FieldType::typeName));
+    labelList selected = findStrings(fieldNames_, fieldNames);
+    forAll(selected, i)
+    {
+        const word& fieldName = fieldNames[selected[i]];
+        const FieldType& field = obr_.lookupObject<FieldType>(fieldName);
+
+        if (log_) Info << "    " << fieldName;
+
+        IOobject mapRegionIO
+        (
+            fieldName,
+            field.time().timeName(),
+            mapRegion
+        );
+
+        tmp<FieldType> tfieldMapRegion(interpPtr_->mapTgtToSrc(field));
+
+        if (log_) Info<< ": interpolated";
+
+        FieldType fieldMapRegion(mapRegionIO, tfieldMapRegion);
+
+        evaluateConstraintTypes(fieldMapRegion);
+
+        fieldMapRegion.write();
+
+        if (log_) Info<< " and written" << nl;
+    }
+
+    return selected.size() > 0;
+}
+
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.C b/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.C
index 02034a8aca128a93ef458b2a0ffe325849635f35..43fa9a0964738e9a0a3a4f4e63c8bff41cf445b7 100644
--- a/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.C
+++ b/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.H b/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.H
index 1a75aa7192f4445f3e26526ea0232b7d6b348485..7fa52e6304f429e4e385bb47043a77967cf0d772 100644
--- a/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.H
+++ b/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysisFunctionObject.C b/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysisFunctionObject.C
index 01110e17c8955c39dedde3f193f6902d44dc8bc2..4f892e9a39b7b8272badbe982f4a87552e914d80 100644
--- a/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysisFunctionObject.C
+++ b/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysisFunctionObject.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysisFunctionObject.H b/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysisFunctionObject.H
index 7abeca2d78f7a14596c0c38cf4ce290e5c16b099..77f90831ed401216287c9522919855787ddb03b0 100644
--- a/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysisFunctionObject.H
+++ b/src/postProcessing/functionObjects/utilities/reactionSensitivityAnalysis/reactionsSensitivityAnalysisFunctionObject.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/postProcessing/functionObjects/utilities/zeroGradient/IOzeroGradient.H b/src/postProcessing/functionObjects/utilities/zeroGradient/IOzeroGradient.H
new file mode 100644
index 0000000000000000000000000000000000000000..eabf6bab3c3ac4954bf4a963272773f361fb85b4
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/zeroGradient/IOzeroGradient.H
@@ -0,0 +1,49 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Typedef
+    Foam::IOzeroGradient
+
+Description
+    Instance of the generic IOOutputFilter for zeroGradient.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef IOzeroGradient_H
+#define IOzeroGradient_H
+
+#include "zeroGradient.H"
+#include "IOOutputFilter.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    typedef IOOutputFilter<zeroGradient> IOzeroGradient;
+}
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/zeroGradient/zeroGradient.C b/src/postProcessing/functionObjects/utilities/zeroGradient/zeroGradient.C
new file mode 100644
index 0000000000000000000000000000000000000000..4b12a948e0fc6cfb2f76b4c463fdccf65700bd7d
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/zeroGradient/zeroGradient.C
@@ -0,0 +1,341 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "zeroGradient.H"
+
+#include "volFields.H"
+#include "dictionary.H"
+#include "symmetryFvPatchField.H"
+#include "symmetryPlaneFvPatchField.H"
+#include "zeroGradientFvPatchField.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(zeroGradient, 0);
+}
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+bool Foam::zeroGradient::checkFormatName(const word& str)
+{
+    if (str.find("@@") == string::npos)
+    {
+        WarningInFunction
+            << "Bad result naming "
+            << "(no '@@' token found), deactivating."
+            << nl << endl;
+
+        return false;
+    }
+    else if (str == "@@")
+    {
+        WarningInFunction
+            << "Bad result naming "
+            << "(only a '@@' token found), deactivating."
+            << nl
+            << endl;
+
+        return false;
+    }
+    else
+    {
+        return true;
+    }
+}
+
+
+void Foam::zeroGradient::uniqWords(wordReList& lst)
+{
+    boolList retain(lst.size());
+    wordHashSet uniq;
+    forAll(lst, i)
+    {
+        const wordRe& select = lst[i];
+
+        retain[i] =
+        (
+            select.isPattern()
+         || uniq.insert(static_cast<const word&>(select))
+        );
+    }
+
+    inplaceSubset(retain, lst);
+}
+
+
+template<class Type>
+bool Foam::zeroGradient::accept
+(
+    const GeometricField<Type, fvPatchField, volMesh>& input
+)
+{
+    const typename GeometricField<Type, fvPatchField, volMesh>
+    ::GeometricBoundaryField& patches = input.boundaryField();
+
+    forAll(patches, patchi)
+    {
+        const fvPatchField<Type>& p = patches[patchi];
+        const polyPatch& pp = p.patch().patch();
+
+        bool ignore =
+        (
+            isA<emptyPolyPatch>(pp)
+         || isA<processorPolyPatch>(pp)
+
+         || isA<zeroGradientFvPatchField<Type>>(p)
+         || isA<symmetryFvPatchField<Type>>(p)
+         || isA<symmetryPlaneFvPatchField<Type>>(p)
+        );
+
+        if (!ignore)
+        {
+            return true;
+        }
+    }
+
+    return false;
+}
+
+
+template<class Type>
+int Foam::zeroGradient::apply
+(
+    const fvMesh& mesh,
+    const word& inputName,
+    int& state
+)
+{
+    typedef GeometricField<Type, fvPatchField, volMesh> vfType;
+
+    // state: return 0 (not-processed), -1 (skip), +1 ok
+
+    // already done, or not available
+    if (state || !mesh.foundObject<vfType>(inputName))
+    {
+        return state;
+    }
+
+    const vfType& input = mesh.lookupObject<vfType>(inputName);
+
+    if (!returnReduce(accept(input), orOp<bool>()))
+    {
+        state = -1;
+        return state;
+    }
+
+    word outputName(resultName_);
+    outputName.replace("@@", inputName);
+
+    // also save the field-type, just in case we want it later
+    results_.set(outputName, vfType::typeName);
+
+    if (!mesh.foundObject<vfType>(outputName))
+    {
+        mesh.objectRegistry::store
+        (
+            new vfType
+            (
+                IOobject
+                (
+                    outputName,
+                    mesh.time().timeName(),
+                    mesh,
+                    IOobject::NO_READ,
+                    IOobject::NO_WRITE
+                ),
+                mesh,
+                dimensioned<Type>("0", input.dimensions(), Zero),
+                zeroGradientFvPatchField<Type>::typeName
+            )
+        );
+    }
+
+    vfType& output = const_cast<vfType&>(mesh.lookupObject<vfType>(outputName));
+    output = input;
+    output.correctBoundaryConditions();
+
+    state = +1;
+    return state;
+}
+
+
+int Foam::zeroGradient::process(const fvMesh& mesh, const word& fieldName)
+{
+    int state = 0;
+    apply<scalar>(mesh, fieldName, state);
+    apply<vector>(mesh, fieldName, state);
+    apply<sphericalTensor>(mesh, fieldName, state);
+    apply<symmTensor>(mesh, fieldName, state);
+    apply<tensor>(mesh, fieldName, state);
+
+    return state;
+}
+
+
+void Foam::zeroGradient::process(const fvMesh& mesh)
+{
+    results_.clear();
+
+    wordHashSet candidates = subsetStrings(selectFields_, mesh.names());
+    DynamicList<word> missing(selectFields_.size());
+    DynamicList<word> ignored(selectFields_.size());
+
+    // check exact matches first
+    forAll(selectFields_, i)
+    {
+        const wordRe& select = selectFields_[i];
+        if (!select.isPattern())
+        {
+            const word& fieldName = static_cast<const word&>(select);
+
+            if (!candidates.erase(fieldName))
+            {
+                missing.append(fieldName);
+            }
+            else if (process(mesh, fieldName) < 1)
+            {
+                ignored.append(fieldName);
+            }
+        }
+    }
+
+    forAllConstIter(wordHashSet, candidates, iter)
+    {
+        process(mesh, iter.key());
+    }
+
+    if (missing.size())
+    {
+        WarningInFunction
+            << "Missing field " << missing << endl;
+    }
+    if (ignored.size())
+    {
+        WarningInFunction
+            << "Unprocessed field " << ignored << endl;
+    }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::zeroGradient::zeroGradient
+(
+    const word& name,
+    const objectRegistry& obr,
+    const dictionary& dict,
+    const bool loadFromFiles
+)
+:
+    name_(name),
+    obr_(obr),
+    active_(true),
+    selectFields_(),
+    resultName_(string::null),
+    results_(),
+    log_(false)
+{
+    // Check if the available mesh is an fvMesh, otherwise deactivate
+    if (!isA<fvMesh>(obr_))
+    {
+        active_ = false;
+        WarningInFunction
+            << "No fvMesh available, deactivating." << nl
+            << endl;
+    }
+
+    read(dict);
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::zeroGradient::~zeroGradient()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::zeroGradient::read(const dictionary& dict)
+{
+    if (active_)
+    {
+        log_ = dict.lookupOrDefault<Switch>("log", false);
+
+        dict.lookup("fields") >> selectFields_;
+        uniqWords(selectFields_);
+
+        resultName_ = dict.lookupOrDefault<word>
+        (
+            "result",
+            type() + "(@@)"
+        );
+        active_ = checkFormatName(resultName_);
+    }
+}
+
+
+void Foam::zeroGradient::execute()
+{
+    results_.clear();
+    if (active_)
+    {
+        process(refCast<const fvMesh>(obr_));
+    }
+}
+
+
+void Foam::zeroGradient::write()
+{
+    if (active_)
+    {
+        // consistent output order
+        const wordList outputList = results_.sortedToc();
+
+        forAll(outputList, i)
+        {
+            const word& fieldName = outputList[i];
+
+            if (obr_.foundObject<regIOobject>(fieldName))
+            {
+                const regIOobject& io =
+                    obr_.lookupObject<regIOobject>(fieldName);
+
+                if (log_)
+                {
+                    Info<< type() << " " << name_
+                        << " output: writing field " << fieldName << endl;
+                }
+
+                io.write();
+            }
+        }
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/zeroGradient/zeroGradient.H b/src/postProcessing/functionObjects/utilities/zeroGradient/zeroGradient.H
new file mode 100644
index 0000000000000000000000000000000000000000..74b83cfa894c80300f4a0b1c9cc0270addf20517
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/zeroGradient/zeroGradient.H
@@ -0,0 +1,220 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::zeroGradient
+
+Group
+    grpFVFunctionObjects
+
+Description
+    This function object creates a volume field with zero-gradient
+    boundary conditions from another volume field.
+
+    The result can be used, for example, to post-process near-wall
+    field values.
+
+    Example of function object specification:
+    \verbatim
+    zeroGrad
+    {
+        type        zeroGradient;
+        functionObjectLibs ("libutilityFunctionObjects.so");
+        fields      (U "(T|k|epsilon|omega)");
+        result      @@nearWall;
+        ...
+    }
+    \endverbatim
+
+    \heading Function object usage
+    \table
+        Property | Description                | Required  | Default value
+        type     | type name: zeroGradient    | yes       |
+        fields   | Name of fields to process  | yes       |
+        result   | Name of results            | no        | zeroGradient(@@)
+        log      | Log to standard output     | no        | no
+    \endtable
+
+    A list of fields can contain exact names or regular expressions.
+    The token '\@\@' in the result name is replaced by the name of the source
+    field.
+
+    The function object will skip over fields that would not benefit
+    - ie, only processor, empty, zeroGradient, symmetry patches.
+    This check should also prevent processing fields multiple times.
+
+SourceFiles
+    zeroGradient.C
+    zeroGradientFunctionObject.C
+    IOzeroGradient.H
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef zeroGradient_H
+#define zeroGradient_H
+
+#include "volFieldsFwd.H"
+#include "OFstream.H"
+#include "wordReList.H"
+#include "Switch.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward declaration of classes
+class objectRegistry;
+class dictionary;
+class fvMesh;
+class polyMesh;
+class mapPolyMesh;
+
+/*---------------------------------------------------------------------------*\
+                            Class zeroGradient Declaration
+\*---------------------------------------------------------------------------*/
+
+class zeroGradient
+{
+    // Private data
+
+        //- Name of this zeroGradient object
+        word name_;
+
+        //- Reference to the database
+        const objectRegistry& obr_;
+
+        //- On/off switch
+        bool active_;
+
+        //- Name of fields to process
+        wordReList selectFields_;
+
+        //- Formatting for the result fields.
+        word resultName_;
+
+        //- Hashed names of result fields, and their type
+        HashTable<word> results_;
+
+        //- Switch to send output to Info as well as to file
+        Switch log_;
+
+
+    // Private Member Functions
+
+        //- Check that the word contains the appropriate substitution token(s).
+        static bool checkFormatName(const word&);
+
+        //- Eliminate duplicate 'word' entries
+        static void uniqWords(wordReList&);
+
+
+        //- Accept unless field only has empty/zero-gradient/processor patches
+        template<class Type>
+        static bool accept(const GeometricField<Type, fvPatchField, volMesh>&);
+
+        //- Apply for the volume field type
+        template<class Type>
+        int apply(const fvMesh& mesh, const word& inputName, int& state);
+
+        //- Process by trying to apply for various volume field types.
+        int process(const fvMesh& mesh, const word& inputName);
+
+        //- Calculate the zeroGradient fields
+        void process(const fvMesh& mesh);
+
+
+        //- Disallow default bitwise copy construct
+        zeroGradient(const zeroGradient&) = delete;
+
+        //- Disallow default bitwise assignment
+        void operator=(const zeroGradient&) = delete;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("zeroGradient");
+
+
+    // Constructors
+
+        //- Construct for given objectRegistry and dictionary.
+        //  Allow the possibility to load fields from files
+        zeroGradient
+        (
+            const word& name,
+            const objectRegistry&,
+            const dictionary&,
+            const bool loadFromFiles = false
+        );
+
+
+    //- Destructor
+    virtual ~zeroGradient();
+
+
+    // Member Functions
+
+        //- Return name of the zeroGradient function object
+        virtual const word& name() const
+        {
+            return name_;
+        }
+
+        //- Read the zeroGradient specification
+        virtual void read(const dictionary&);
+
+        //- Calculate the zeroGradient fields
+        virtual void execute();
+
+        //- Execute at the final time-loop, currently does nothing
+        virtual void end()
+        {}
+
+        //- Called when time was set at the end of the Time::operator++
+        virtual void timeSet()
+        {}
+
+        //- Write the zeroGradient fields
+        virtual void write();
+
+        //- Update for changes of mesh
+        virtual void updateMesh(const mapPolyMesh&)
+        {}
+
+        //- Update for changes of mesh
+        virtual void movePoints(const polyMesh&)
+        {}
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/zeroGradient/zeroGradientFunctionObject.C b/src/postProcessing/functionObjects/utilities/zeroGradient/zeroGradientFunctionObject.C
new file mode 100644
index 0000000000000000000000000000000000000000..89b5c7f09a02aace50cde0011301018ac68be6d8
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/zeroGradient/zeroGradientFunctionObject.C
@@ -0,0 +1,42 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "zeroGradientFunctionObject.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineNamedTemplateTypeNameAndDebug(zeroGradientFunctionObject, 0);
+
+    addToRunTimeSelectionTable
+    (
+        functionObject,
+        zeroGradientFunctionObject,
+        dictionary
+    );
+}
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/zeroGradient/zeroGradientFunctionObject.H b/src/postProcessing/functionObjects/utilities/zeroGradient/zeroGradientFunctionObject.H
new file mode 100644
index 0000000000000000000000000000000000000000..cccea11df971c3a782e4652bfaa7035ca25ba797
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/zeroGradient/zeroGradientFunctionObject.H
@@ -0,0 +1,54 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Typedef
+    Foam::zeroGradientFunctionObject
+
+Description
+    FunctionObject wrapper around zeroGradient to allow it to be created
+    via the functions entry within controlDict.
+
+SourceFiles
+    zeroGradientFunctionObject.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef zeroGradientFunctionObject_H
+#define zeroGradientFunctionObject_H
+
+#include "zeroGradient.H"
+#include "OutputFilterFunctionObject.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    typedef OutputFilterFunctionObject<zeroGradient>
+        zeroGradientFunctionObject;
+}
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/randomProcesses/Allwmake b/src/randomProcesses/Allwmake
new file mode 100755
index 0000000000000000000000000000000000000000..e1ce66ba6abab5e5e9a49683c20d4048e8183b15
--- /dev/null
+++ b/src/randomProcesses/Allwmake
@@ -0,0 +1,18 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # run from this directory
+
+# Parse arguments for library compilation
+targetType=libso
+. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
+
+if [ -f "$FFTW_ARCH_PATH/include/fftw3.h" ] || \
+   [ "${FFTW_ARCH_PATH##*-}" = system -a -f "/usr/include/fftw3.h" ]
+then
+    wmake $targetType
+else
+    echo
+    echo "Skipping randomProcesses library (no FFTW)"
+    echo
+fi
+
+#------------------------------------------------------------------------------
diff --git a/src/randomProcesses/Kmesh/Kmesh.C b/src/randomProcesses/Kmesh/Kmesh.C
index 5bc6ad1de3dbbe80a9cc8051c87473c0e5e0930b..362874cdb20f139c92352f601e3d59444f0b06e0 100644
--- a/src/randomProcesses/Kmesh/Kmesh.C
+++ b/src/randomProcesses/Kmesh/Kmesh.C
@@ -35,7 +35,7 @@ inline Foam::label Foam::Kmesh::index
     const label i,
     const label j,
     const label k,
-    const labelList& nn
+    const UList<int>& nn
 )
 {
     return (k + j*nn[2] + i*nn[1]*nn[2]);
diff --git a/src/randomProcesses/Kmesh/Kmesh.H b/src/randomProcesses/Kmesh/Kmesh.H
index d09a5894cbfd4af1b21f0ff2135c4074948cb045..417f1feacd4684ecf992a65f65da1e4ad792efe3 100644
--- a/src/randomProcesses/Kmesh/Kmesh.H
+++ b/src/randomProcesses/Kmesh/Kmesh.H
@@ -57,7 +57,7 @@ class Kmesh
         vector l_;
 
         //- Multi-dimensional addressing array
-        labelList nn_;
+        List<int> nn_;
 
         //- Maximum wavenumber
         scalar kmax_;
@@ -71,7 +71,7 @@ class Kmesh
             const label i,
             const label j,
             const label k,
-            const labelList& nn
+            const UList<int>& nn
         );
 
 
@@ -92,7 +92,7 @@ public:
             return l_;
         }
 
-        const labelList& nn() const
+        const List<int>& nn() const
         {
             return nn_;
         }
diff --git a/src/randomProcesses/Make/files b/src/randomProcesses/Make/files
index 90cb360357923e76248efb57794d3b8b6d3c2a01..11138bd932cb2bf7bdb1d04e273ac406c25d6671 100644
--- a/src/randomProcesses/Make/files
+++ b/src/randomProcesses/Make/files
@@ -1,25 +1,31 @@
-Kmesh                       = Kmesh
-
-fft                         = fft
-
-processes                   = processes
-UOprocess                   = $(processes)/UOprocess
-
-turbulence                  = turbulence
-
-noise                       = noise
-
+Kmesh = Kmesh
 $(Kmesh)/Kmesh.C
 
+fft = fft
 $(fft)/fft.C
-$(fft)/fftRenumber.C
 $(fft)/calcEk.C
 $(fft)/kShellIntegration.C
 
+processes = processes
+UOprocess = $(processes)/UOprocess
 $(UOprocess)/UOprocess.C
 
+turbulence = turbulence
 $(turbulence)/turbGen.C
 
-$(noise)/noiseFFT.C
+noise = noise
+$(noise)/noiseFFT/noiseFFT.C
+$(noise)/noiseModels/noiseModel/noiseModel.C
+$(noise)/noiseModels/noiseModel/noiseModelNew.C
+$(noise)/noiseModels/pointNoise/pointNoise.C
+$(noise)/noiseModels/surfaceNoise/surfaceNoise.C
+
+
+windowModels = windowModels
+$(windowModels)/windowModel/windowModel.C
+$(windowModels)/windowModel/windowModelNew.C
+$(windowModels)/Hanning/Hanning.C
+$(windowModels)/uniform/uniform.C
+
 
 LIB = $(FOAM_LIBBIN)/librandomProcesses
diff --git a/src/randomProcesses/Make/options b/src/randomProcesses/Make/options
index 71b7873964d544eddf96d22aa40f4c3372c23c9c..e1eddd51d2e71217d6f2143c9258a3d396d4f7ea 100644
--- a/src/randomProcesses/Make/options
+++ b/src/randomProcesses/Make/options
@@ -1,5 +1,11 @@
 EXE_INC = \
-    -I$(LIB_SRC)/finiteVolume/lnInclude
+    -I$(FFTW_ARCH_PATH)/include \
+    -I$(LIB_SRC)/finiteVolume/lnInclude \
+    -I$(LIB_SRC)/sampling/lnInclude \
+    -I$(LIB_SRC)/surfMesh/lnInclude
 
 LIB_LIBS = \
-    -lfiniteVolume
+    -L$(FFTW_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) -lfftw3 \
+    -lfiniteVolume \
+    -lsampling \
+    -lsurfMesh
diff --git a/src/randomProcesses/fft/fft.C b/src/randomProcesses/fft/fft.C
index f859b37f529212cd0fe6393eaa8338736bae37e4..fd44c0109df10e7ab98a7df1456789ee5d56b0d8 100644
--- a/src/randomProcesses/fft/fft.C
+++ b/src/randomProcesses/fft/fft.C
@@ -2,8 +2,8 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -24,7 +24,8 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "fft.H"
-#include "fftRenumber.H"
+
+#include <fftw3.h>
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -33,16 +34,11 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#define SWAP(a,b) tempr=(a); (a)=(b); (b)=tempr
-#define TWOPI 6.28318530717959
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
 void fft::transform
 (
     complexField& field,
-    const labelList& nn,
-    transformDirection isign
+    const UList<int>& nn,
+    transformDirection dir
 )
 {
     forAll(nn, idim)
@@ -59,134 +55,64 @@ void fft::transform
         }
     }
 
-    const label ndim = nn.size();
+    // Copy field into fftw containers
+    label N = field.size();
+    fftw_complex in[N], out[N];
 
-    label i1, i2, i3, i2rev, i3rev, ip1, ip2, ip3, ifp1, ifp2;
-    label ibit, k1, k2, n, nprev, nrem, idim;
-    scalar tempi, tempr;
-    scalar theta, wi, wpi, wpr, wr, wtemp;
-    scalar* data = reinterpret_cast<scalar*>(field.begin()) - 1;
-
-
-    // if inverse transform : renumber before transform
-
-    if (isign == REVERSE_TRANSFORM)
+    forAll(field, i)
     {
-        fftRenumber(field, nn);
+        in[i][0] = field[i].Re();
+        in[i][1] = field[i].Im();
     }
 
+    // Create the plan
+    // FFTW_FORWARD = -1
+    // FFTW_BACKWARD = 1
 
-    label ntot = 1;
-    forAll(nn, idim)
-    {
-        ntot *= nn[idim];
-    }
-
+    // 1-D plan
+    // fftw_plan plan =
+    //    fftw_plan_dft_1d(N, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
 
-    nprev = 1;
+    // Generic 1..3-D plan
+    label rank = nn.size();
+    fftw_plan plan =
+        fftw_plan_dft(rank, nn.begin(), in, out, dir, FFTW_ESTIMATE);
 
-    for (idim=ndim; idim>=1; idim--)
-    {
-        n = nn[idim-1];
-        nrem = ntot/(n*nprev);
-        ip1 = nprev << 1;
-        ip2 = ip1*n;
-        ip3 = ip2*nrem;
-        i2rev = 1;
-
-        for (i2=1; i2<=ip2; i2+=ip1)
-        {
-            if (i2 < i2rev)
-            {
-                for (i1=i2; i1<=i2 + ip1 - 2; i1+=2)
-                {
-                    for (i3=i1; i3<=ip3; i3+=ip2)
-                    {
-                        i3rev = i2rev + i3 - i2;
-                        SWAP(data[i3], data[i3rev]);
-                        SWAP(data[i3 + 1], data[i3rev + 1]);
-                    }
-                }
-            }
-
-            ibit = ip2 >> 1;
-            while (ibit >= ip1 && i2rev > ibit)
-            {
-                i2rev -= ibit;
-                ibit >>= 1;
-            }
-
-            i2rev += ibit;
-        }
+    // Compute the FFT
+    fftw_execute(plan);
 
-        ifp1 = ip1;
-
-        while (ifp1 < ip2)
-        {
-            ifp2 = ifp1 << 1;
-            theta = isign*TWOPI/(ifp2/ip1);
-            wtemp = sin(0.5*theta);
-            wpr = -2.0*wtemp*wtemp;
-            wpi = sin(theta);
-            wr = 1.0;
-            wi = 0.0;
-
-            for (i3 = 1; i3 <= ifp1; i3 += ip1)
-            {
-                for (i1 = i3; i1 <= i3 + ip1 - 2; i1 += 2)
-                {
-                    for (i2 = i1; i2 <= ip3; i2 += ifp2)
-                    {
-                        k1 = i2;
-                        k2 = k1 + ifp1;
-                        tempr = scalar(wr*data[k2]) - scalar(wi*data[k2 + 1]);
-                        tempi = scalar(wr*data[k2 + 1]) + scalar(wi*data[k2]);
-                        data[k2] = data[k1] - tempr;
-                        data[k2 + 1] = data[k1 + 1] - tempi;
-                        data[k1] += tempr;
-                        data[k1 + 1] += tempi;
-                    }
-                }
-
-                wr = (wtemp = wr)*wpr - wi*wpi + wr;
-                wi = wi*wpr + wtemp*wpi + wi;
-            }
-            ifp1 = ifp2;
-        }
-        nprev *= n;
-    }
-
-
-    // if forward transform : renumber after transform
-
-    if (isign == FORWARD_TRANSFORM)
+    forAll(field, i)
     {
-        fftRenumber(field, nn);
+        field[i].Re() = out[i][0];
+        field[i].Im() = out[i][1];
     }
 
+    fftw_destroy_plan(plan);
 
-    // scale result (symmetric scale both forward and inverse transform)
+/*
+    fftw_real in[N], out[N];
+    // Create a plan for real data input
+    // - generates 1-sided FFT
+    // - direction given by FFTW_R2HC or FFTW_HC2R.
+    // - in[N] is the array of real input val ues
+    // - out[N] is the array of N/2 real valuea followed by N/2 complex values
+    // - 0 component = DC component
+    fftw_plan plan = fftw_plan_r2r_2d(N, in, out, FFTW_R2HC, FFTW_ESTIMATE)
 
-    scalar recRootN = 1.0/sqrt(scalar(ntot));
+    // Compute the FFT
+    fftw_execute(plan);
 
-    forAll(field, i)
-    {
-        field[i] *= recRootN;
-    }
+    fftw_destroy_plan(plan);
+*/
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#undef SWAP
-#undef TWOPI
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 tmp<complexField> fft::forwardTransform
 (
     const tmp<complexField>& tfield,
-    const labelList& nn
+    const UList<int>& nn
 )
 {
     tmp<complexField> tfftField(new complexField(tfield));
@@ -202,7 +128,7 @@ tmp<complexField> fft::forwardTransform
 tmp<complexField> fft::reverseTransform
 (
     const tmp<complexField>& tfield,
-    const labelList& nn
+    const UList<int>& nn
 )
 {
     tmp<complexField> tifftField(new complexField(tfield));
@@ -218,7 +144,7 @@ tmp<complexField> fft::reverseTransform
 tmp<complexVectorField> fft::forwardTransform
 (
     const tmp<complexVectorField>& tfield,
-    const labelList& nn
+    const UList<int>& nn
 )
 {
     tmp<complexVectorField> tfftVectorField
@@ -247,7 +173,7 @@ tmp<complexVectorField> fft::forwardTransform
 tmp<complexVectorField> fft::reverseTransform
 (
     const tmp<complexVectorField>& tfield,
-    const labelList& nn
+    const UList<int>& nn
 )
 {
     tmp<complexVectorField> tifftVectorField
diff --git a/src/randomProcesses/fft/fft.H b/src/randomProcesses/fft/fft.H
index f176261eb5f92c707bed3c9268b4bff3d5845419..11cc07575e99b99c41f8942f31647223982d0360 100644
--- a/src/randomProcesses/fft/fft.H
+++ b/src/randomProcesses/fft/fft.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -25,14 +25,16 @@ Class
     Foam::fft
 
 Description
-    Fast fourier transform derived from the Numerical
-    Recipes in C routine.
+    Fast fourier transform using the fftw library.
 
     The complex transform field is returned in the field supplied.  The
-    direction of transform is supplied as an argument (1 = forward, -1 =
+    direction of transform is supplied as an argument (-1 = forward, 1 =
     reverse).  The dimensionality and organisation of the array of values
     in space is supplied in the nn indexing array.
 
+Note
+    The fftw library uses int only (no longs) for its dimensionality.
+
 SourceFiles
     fft.C
 
@@ -42,7 +44,7 @@ SourceFiles
 #define fft_H
 
 #include "complexFields.H"
-#include "labelList.H"
+#include "UList.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -56,15 +58,15 @@ public:
 
     enum transformDirection
     {
-        FORWARD_TRANSFORM = 1,
-        REVERSE_TRANSFORM = -1
+        FORWARD_TRANSFORM = -1,
+        REVERSE_TRANSFORM = 1
     };
 
 
     static void transform
     (
         complexField& field,
-        const labelList& nn,
+        const UList<int>& nn,
         transformDirection fftDirection
     );
 
@@ -72,28 +74,28 @@ public:
     static tmp<complexField> forwardTransform
     (
         const tmp<complexField>& field,
-        const labelList& nn
+        const UList<int>& nn
     );
 
 
     static tmp<complexField> reverseTransform
     (
         const tmp<complexField>& field,
-        const labelList& nn
+        const UList<int>& nn
     );
 
 
     static tmp<complexVectorField> forwardTransform
     (
         const tmp<complexVectorField>& field,
-        const labelList& nn
+        const UList<int>& nn
     );
 
 
     static tmp<complexVectorField> reverseTransform
     (
         const tmp<complexVectorField>& field,
-        const labelList& nn
+        const UList<int>& nn
     );
 };
 
diff --git a/src/randomProcesses/fft/fftRenumber.C b/src/randomProcesses/fft/fftRenumber.C
deleted file mode 100644
index 07f8b238be44c89599647741eff6defde027d8eb..0000000000000000000000000000000000000000
--- a/src/randomProcesses/fft/fftRenumber.C
+++ /dev/null
@@ -1,124 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software: you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
-
-Description
-    Multi-dimensional renumbering used in the Numerical Recipes
-   fft routine. This version is recursive, so works in n-d :
-   determined by the length of array nn
-
-\*---------------------------------------------------------------------------*/
-
-#include "fftRenumber.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-void Foam::fftRenumberRecurse
-(
-    List<complex>& data,
-    List<complex>& renumData,
-    const labelList& nn,
-    label nnprod,
-    label ii,
-    label l1,
-    label l2
-)
-{
-    if (ii == nn.size())
-    {
-        // we've worked out the renumbering scheme. Now copy
-        // the components across
-
-        data[l1] = complex(renumData[l2].Re(),renumData[l2].Im());
-    }
-    else
-    {
-        // do another level of folding. First work out the
-        // multiplicative value of the index
-
-        nnprod /= nn[ii];
-        label i_1(0);
-
-        for (label i=0; i<nn[ii]; i++)
-        {
-            // now evaluate the indices (both from array 1 and to
-            // array 2). These get multiplied by nnprod to (cumulatively)
-            // find the real position in the list corresponding to
-            // this set of indices.
-
-            if (i<nn[ii]/2)
-            {
-                i_1 = i + nn[ii]/2;
-            }
-            else
-            {
-                i_1 = i - nn[ii]/2;
-            }
-
-
-            // go to the next level of recursion.
-
-            fftRenumberRecurse
-            (
-                data,
-                renumData,
-                nn,
-                nnprod,
-                ii+1,
-                l1+i*nnprod,
-                l2+i_1*nnprod
-            );
-        }
-    }
-}
-
-
-void Foam::fftRenumber
-(
-    List<complex>& data,
-    const labelList& nn
-)
-{
-    List<complex> renumData(data);
-
-    label nnprod(1);
-    forAll(nn, i)
-    {
-        nnprod *= nn[i];
-    }
-
-    label ii(0), l1(0), l2(0);
-
-    fftRenumberRecurse
-    (
-        data,
-        renumData,
-        nn,
-        nnprod,
-        ii,
-        l1,
-        l2
-    );
-}
-
-
-// ************************************************************************* //
diff --git a/src/randomProcesses/noise/noiseFFT.C b/src/randomProcesses/noise/noiseFFT.C
deleted file mode 100644
index 0f09cdf817450e18461c9eb49371a82847538d40..0000000000000000000000000000000000000000
--- a/src/randomProcesses/noise/noiseFFT.C
+++ /dev/null
@@ -1,454 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software: you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
-
-\*---------------------------------------------------------------------------*/
-
-#include "noiseFFT.H"
-#include "IFstream.H"
-#include "DynamicList.H"
-#include "fft.H"
-#include "SubField.H"
-#include "mathematicalConstants.H"
-
-// * * * * * * * * * * * * * * Static Member Data  * * * * * * * * * * * * * //
-
-Foam::scalar Foam::noiseFFT::p0 = 2e-5;
-
-
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-Foam::noiseFFT::noiseFFT
-(
-    const scalar deltat,
-    const scalarField& pressure
-)
-:
-    scalarField(pressure),
-    deltat_(deltat)
-{}
-
-
-Foam::noiseFFT::noiseFFT(const fileName& pFileName, const label skip)
-:
-    scalarField(),
-    deltat_(0.0)
-{
-    // Construct pressure data file
-    IFstream pFile(pFileName);
-
-    // Check pFile stream is OK
-    if (!pFile.good())
-    {
-        FatalErrorInFunction
-            << "Cannot read file " << pFileName
-            << exit(FatalError);
-    }
-
-    if (skip)
-    {
-        scalar dummyt, dummyp;
-
-        for (label i=0; i<skip; i++)
-        {
-            pFile >> dummyt;
-
-            if (!pFile.good() || pFile.eof())
-            {
-                FatalErrorInFunction
-                    << "Number of points in file " << pFileName
-                    << " is less than the number to be skipped = " << skip
-                    << exit(FatalError);
-            }
-
-            pFile >> dummyp;
-        }
-    }
-
-    scalar t = 0, T = 0;
-    DynamicList<scalar> pData(100000);
-    label i = 0;
-
-    while (!(pFile >> t).eof())
-    {
-        T = t;
-        pFile >> pData(i++);
-    }
-
-    deltat_ = T/pData.size();
-
-    this->transfer(pData);
-}
-
-
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-Foam::graph Foam::noiseFFT::pt() const
-{
-    scalarField t(size());
-    forAll(t, i)
-    {
-        t[i] = i*deltat_;
-    }
-
-    return graph
-    (
-        "p(t)",
-        "t [s]",
-        "p(t) [Pa]",
-        t,
-        *this
-    );
-}
-
-
-Foam::tmp<Foam::scalarField> Foam::noiseFFT::window
-(
-    const label N,
-    const label ni
-) const
-{
-    label windowOffset = N;
-
-    if ((N + ni*windowOffset) > size())
-    {
-        FatalErrorInFunction
-            << "Requested window is outside set of data" << endl
-            << "number of data = " << size() << endl
-            << "size of window = " << N << endl
-            << "window  = " << ni
-            << exit(FatalError);
-    }
-
-    tmp<scalarField> tpw(new scalarField(N));
-    scalarField& pw = tpw.ref();
-
-    label offset = ni*windowOffset;
-
-    forAll(pw, i)
-    {
-        pw[i] = operator[](i + offset);
-    }
-
-    return tpw;
-}
-
-
-Foam::tmp<Foam::scalarField> Foam::noiseFFT::Hanning(const label N) const
-{
-    scalarField t(N);
-    forAll(t, i)
-    {
-        t[i] = i*deltat_;
-    }
-
-    scalar T = N*deltat_;
-
-    return 2*(0.5 - 0.5*cos(constant::mathematical::twoPi*t/T));
-}
-
-
-Foam::tmp<Foam::scalarField> Foam::noiseFFT::Pf
-(
-    const tmp<scalarField>& tpn
-) const
-{
-    tmp<scalarField> tPn2
-    (
-        mag
-        (
-            fft::reverseTransform
-            (
-                ReComplexField(tpn),
-                labelList(1, tpn().size())
-            )
-        )
-    );
-
-    tpn.clear();
-
-    tmp<scalarField> tPn
-    (
-        new scalarField
-        (
-            scalarField::subField(tPn2(), tPn2().size()/2)
-        )
-    );
-    scalarField& Pn = tPn.ref();
-
-    Pn *= 2.0/sqrt(scalar(tPn2().size()));
-    Pn[0] /= 2.0;
-
-    return tPn;
-}
-
-
-Foam::graph Foam::noiseFFT::meanPf
-(
-    const label N,
-    const label nw
-) const
-{
-    if (N > size())
-    {
-        FatalErrorInFunction
-            << "Requested window is outside set of data" << nl
-            << "number of data = " << size() << nl
-            << "size of window = " << N << nl
-            << "window  = " << nw
-            << exit(FatalError);
-    }
-
-    scalarField MeanPf(N/2, 0.0);
-
-    scalarField Hwf(Hanning(N));
-
-    for (label wi=0; wi<nw; ++wi)
-    {
-        MeanPf += Pf(Hwf*window(N, wi));
-    }
-
-    MeanPf /= nw;
-
-    scalarField f(MeanPf.size());
-    scalar deltaf = 1.0/(N*deltat_);
-
-    forAll(f, i)
-    {
-        f[i] = i*deltaf;
-    }
-
-    return graph
-    (
-        "P(f)",
-        "f [Hz]",
-        "P(f) [Pa]",
-        f,
-        MeanPf
-    );
-}
-
-
-Foam::graph Foam::noiseFFT::RMSmeanPf
-(
-    const label N,
-    const label nw
-) const
-{
-    if (N > size())
-    {
-        FatalErrorInFunction
-            << "Requested window is outside set of data" << endl
-            << "number of data = " << size() << endl
-            << "size of window = " << N << endl
-            << "window  = " << nw
-            << exit(FatalError);
-    }
-
-    scalarField RMSMeanPf(N/2, 0.0);
-
-    scalarField Hwf(Hanning(N));
-
-    for (label wi=0; wi<nw; ++wi)
-    {
-        RMSMeanPf += sqr(Pf(Hwf*window(N, wi)));
-    }
-
-    RMSMeanPf = sqrt(RMSMeanPf/nw);
-
-    scalarField f(RMSMeanPf.size());
-    scalar deltaf = 1.0/(N*deltat_);
-
-    forAll(f, i)
-    {
-        f[i] = i*deltaf;
-    }
-
-    return graph
-    (
-        "P(f)",
-        "f [Hz]",
-        "P(f) [Pa]",
-        f,
-        RMSMeanPf
-    );
-}
-
-
-Foam::graph Foam::noiseFFT::Lf(const graph& gPf) const
-{
-    return graph
-    (
-        "L(f)",
-        "f [Hz]",
-        "L(f) [dB]",
-        gPf.x(),
-        20*log10(gPf.y()/p0)
-    );
-}
-
-
-Foam::graph Foam::noiseFFT::Ldelta
-(
-    const graph& gLf,
-    const scalar f1,
-    const scalar fU
-) const
-{
-    const scalarField& f = gLf.x();
-    const scalarField& Lf = gLf.y();
-
-    scalarField ldelta(Lf.size(), 0.0);
-    scalarField fm(ldelta.size());
-
-    scalar fratio = cbrt(2.0);
-    scalar deltaf = 1.0/(2*Lf.size()*deltat_);
-
-    scalar fl = f1/sqrt(fratio);
-    scalar fu = fratio*fl;
-
-    label istart = label(fl/deltaf);
-    label j = 0;
-
-    for (label i = istart; i<Lf.size(); i++)
-    {
-        scalar fmi = sqrt(fu*fl);
-
-        if (fmi > fU + 1) break;
-
-        if (f[i] >= fu)
-        {
-            fm[j] = fmi;
-            ldelta[j] = 10*log10(ldelta[j]);
-
-            j++;
-
-            fl = fu;
-            fu *= fratio;
-        }
-
-        ldelta[j] += pow(10, Lf[i]/10.0);
-    }
-
-    fm.setSize(j);
-    ldelta.setSize(j);
-
-    return graph
-    (
-        "Ldelta",
-        "fm [Hz]",
-        "Ldelta [dB]",
-        fm,
-        ldelta
-    );
-}
-
-
-Foam::graph Foam::noiseFFT::Pdelta
-(
-    const graph& gPf,
-    const scalar f1,
-    const scalar fU
-) const
-{
-    const scalarField& f = gPf.x();
-    const scalarField& Pf = gPf.y();
-
-    scalarField pdelta(Pf.size(), 0.0);
-    scalarField fm(pdelta.size());
-
-    scalar fratio = cbrt(2.0);
-    scalar deltaf = 1.0/(2*Pf.size()*deltat_);
-
-    scalar fl = f1/sqrt(fratio);
-    scalar fu = fratio*fl;
-
-    label istart = label(fl/deltaf + 1.0 - SMALL);
-    label j = 0;
-
-    for (label i = istart; i<Pf.size(); i++)
-    {
-        scalar fmi = sqrt(fu*fl);
-
-        if (fmi > fU + 1) break;
-
-        if (f[i] >= fu)
-        {
-            fm[j] = fmi;
-            pdelta[j] = sqrt((2.0/3.0)*pdelta[j]);
-
-            j++;
-
-            fl = fu;
-            fu *= fratio;
-        }
-
-        pdelta[j] += sqr(Pf[i]);
-    }
-
-    fm.setSize(j);
-    pdelta.setSize(j);
-
-    return graph
-    (
-        "Pdelta",
-        "fm [Hz]",
-        "Pdelta [dB]",
-        fm,
-        pdelta
-    );
-}
-
-
-Foam::scalar Foam::noiseFFT::Lsum(const graph& gLf) const
-{
-    const scalarField& Lf = gLf.y();
-
-    scalar lsum = 0.0;
-
-    forAll(Lf, i)
-    {
-        lsum += pow(10, Lf[i]/10.0);
-    }
-
-    lsum = 10*log10(lsum);
-
-    return lsum;
-}
-
-
-Foam::scalar Foam::noiseFFT::dbToPa(const scalar db) const
-{
-    return p0*pow(10.0, db/20.0);
-}
-
-
-Foam::tmp<Foam::scalarField> Foam::noiseFFT::dbToPa
-(
-    const tmp<scalarField>& db
-) const
-{
-    return p0*pow(10.0, db/20.0);
-}
-
-
-// ************************************************************************* //
diff --git a/src/randomProcesses/noise/noiseFFT/noiseFFT.C b/src/randomProcesses/noise/noiseFFT/noiseFFT.C
new file mode 100644
index 0000000000000000000000000000000000000000..e82d25b90fbef1fc4f72a70ea37adf37a1c4a6ed
--- /dev/null
+++ b/src/randomProcesses/noise/noiseFFT/noiseFFT.C
@@ -0,0 +1,477 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "noiseFFT.H"
+#include "IFstream.H"
+#include "DynamicList.H"
+#include "SubField.H"
+#include "mathematicalConstants.H"
+#include "HashSet.H"
+#include "fft.H"
+
+using namespace Foam::constant;
+
+// * * * * * * * * * * * * * * Static Member Data  * * * * * * * * * * * * * //
+
+Foam::scalar Foam::noiseFFT::p0 = 2e-5;
+
+
+Foam::tmp<Foam::scalarField> Foam::noiseFFT::frequencies
+(
+    const label N,
+    const scalar deltaT
+)
+{
+    tmp<scalarField> tf(new scalarField(N/2, 0));
+    scalarField& f = tf.ref();
+
+    scalar deltaf = 1.0/(N*deltaT);
+    forAll(f, i)
+    {
+        f[i] = i*deltaf;
+    }
+
+    return tf;
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::noiseFFT::PSD(const scalarField& PSDf)
+{
+    return 10*log10(PSDf/sqr(p0));
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::noiseFFT::SPL(const scalarField& Prms2)
+{
+    return 10*log10(Prms2/sqr(p0));
+}
+
+
+void Foam::noiseFFT::octaveBandInfo
+(
+    const scalarField& f,
+    const scalar fLower,
+    const scalar fUpper,
+    const scalar octave,
+    labelList& fBandIDs,
+    scalarField& fCentre
+)
+{
+    // Set the indices of to the lower frequency bands for the input frequency
+    // range. Ensure that the centre frequency passes though 1000 Hz
+
+    // Low frequency bound given by:
+    //     fLow = f0*(2^(0.5*bandI/octave))
+
+    // Initial (lowest centre frequency)
+    scalar fTest = 15.625;
+
+    const scalar fRatio = pow(2, 1.0/octave);
+    const scalar fRatioL2C = pow(2, 0.5/octave);
+
+    // IDs of band IDs
+    labelHashSet bandIDs(f.size());
+
+    // Centre frequencies
+    DynamicList<scalar> fc;
+
+    // Convert to lower band limit
+    fTest /= fRatioL2C;
+
+    forAll(f, i)
+    {
+        if (f[i] >= fTest)
+        {
+            // Advance band if appropriate
+            while (f[i] > fTest)
+            {
+                fTest *= fRatio;
+            }
+            fTest /= fRatio;
+
+            if (bandIDs.insert(i))
+            {
+                // Also store (next) centre frequency
+                fc.append(fTest*fRatioL2C);
+            }
+            fTest *= fRatio;
+
+            if (fTest > fUpper)
+            {
+                break;
+            }
+        }
+    }
+
+    fBandIDs = bandIDs.toc();
+
+    if (fc.size())
+    {
+        // Remove the last centre frequency (beyond upper frequency limit)
+        fc.remove();
+
+        fCentre.transfer(fc);
+    }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::noiseFFT::noiseFFT
+(
+    const scalar deltaT,
+    const scalarField& pressure
+)
+:
+    scalarField(pressure),
+    deltaT_(deltaT)
+{
+    scalarField& p = *this;
+    p -= average(p);
+}
+
+
+Foam::noiseFFT::noiseFFT(const fileName& pFileName, const label skip)
+:
+    scalarField(),
+    deltaT_(0.0)
+{
+    // Construct pressure data file
+    IFstream pFile(pFileName);
+
+    // Check pFile stream is OK
+    if (!pFile.good())
+    {
+        FatalErrorInFunction
+            << "Cannot read file " << pFileName
+            << exit(FatalError);
+    }
+
+    if (skip)
+    {
+        scalar dummyt, dummyp;
+
+        for (label i = 0; i < skip; i++)
+        {
+            pFile >> dummyt;
+
+            if (!pFile.good() || pFile.eof())
+            {
+                FatalErrorInFunction
+                    << "Number of points in file " << pFileName
+                    << " is less than the number to be skipped = " << skip
+                    << exit(FatalError);
+            }
+
+            pFile >> dummyp;
+        }
+    }
+
+    scalar t = 0, T0 = 0, T1 = 0;
+    DynamicList<scalar> pData(100000);
+    label i = 0;
+
+    while (!(pFile >> t).eof())
+    {
+        if (i == 0)
+        {
+            T0 = t;
+        }
+
+        T1 = t;
+        pFile >> pData(i++);
+    }
+
+    // Note: assumes fixed time step
+    deltaT_ = (T1 - T0)/pData.size();
+
+    this->transfer(pData);
+
+    scalarField& p = *this;
+    p -= average(p);
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+Foam::graph Foam::noiseFFT::pt() const
+{
+    scalarField t(size());
+    forAll(t, i)
+    {
+        t[i] = i*deltaT_;
+    }
+
+    return graph
+    (
+        "p(t)",
+        "t [s]",
+        "p(t) [Pa]",
+        t,
+        *this
+    );
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::noiseFFT::Pf
+(
+    const tmp<scalarField>& tpn
+) const
+{
+    // Calculate the 2-sided fft
+    // Note: result not scaled
+    tmp<scalarField> tPn2
+    (
+        mag
+        (
+            fft::reverseTransform
+            (
+                ReComplexField(tpn),
+                List<int>(1, tpn().size())
+            )
+        )
+    );
+
+    tpn.clear();
+
+    // Only storing the positive half
+    // Note: storing (N/2) values, DC component at position (0)
+    tmp<scalarField> tPn
+    (
+        new scalarField
+        (
+            scalarField::subField(tPn2(), tPn2().size()/2 + 1)
+        )
+    );
+
+    return tPn;
+}
+
+
+Foam::graph Foam::noiseFFT::meanPf(const windowModel& window) const
+{
+    const label N = window.nSamples();
+    const label nWindow = window.nWindow();
+
+    scalarField meanPf(N/2 + 1, 0.0);
+
+    for (label windowI = 0; windowI < nWindow; ++windowI)
+    {
+        meanPf += Pf(window.apply<scalar>(*this, windowI));
+    }
+
+    meanPf /= scalar(nWindow);
+
+    scalar deltaf = 1.0/(N*deltaT_);
+    scalarField f(meanPf.size());
+    forAll(f, i)
+    {
+        f[i] = i*deltaf;
+    }
+
+    return graph
+    (
+        "P(f)",
+        "f [Hz]",
+        "P(f) [Pa]",
+        f,
+        meanPf
+    );
+}
+
+
+Foam::graph Foam::noiseFFT::RMSmeanPf(const windowModel& window) const
+{
+    const label N = window.nSamples();
+    const label nWindow = window.nWindow();
+
+    scalarField RMSMeanPf(N/2 + 1, 0.0);
+    for (label windowI = 0; windowI < nWindow; ++windowI)
+    {
+        RMSMeanPf += sqr(Pf(window.apply<scalar>(*this, windowI)));
+    }
+
+    RMSMeanPf = sqrt(RMSMeanPf/scalar(nWindow))/scalar(N);
+
+    scalar deltaf = 1.0/(N*deltaT_);
+    scalarField f(RMSMeanPf.size());
+    forAll(f, i)
+    {
+        f[i] = i*deltaf;
+    }
+
+    return graph
+    (
+        "Prms(f)",
+        "f [Hz]",
+        "Prms(f) [Pa]",
+        f,
+        RMSMeanPf
+    );
+}
+
+
+Foam::graph Foam::noiseFFT::PSDf(const windowModel& window) const
+{
+    const label N = window.nSamples();
+    const label nWindow = window.nWindow();
+
+    scalarField psd(N/2 + 1, 0.0);
+
+    for (label windowI = 0; windowI < nWindow; ++windowI)
+    {
+        psd += sqr(Pf(window.apply<scalar>(*this, windowI)));
+    }
+
+    scalar deltaf = 1.0/(N*deltaT_);
+    scalar fs =  1.0/deltaT_;
+    psd /= scalar(nWindow)*fs*N;
+
+    // Scaling due to use of 1-sided FFT
+    // Note: do not scale DC component
+    psd *= 2;
+    psd.first() /= 2;
+    psd.last() /= 2;
+
+    scalarField f(psd.size());
+
+    if (0) // if (debug)
+    {
+        Pout<< "Average PSD: " << average(psd) << endl;
+    }
+
+    forAll(f, i)
+    {
+        f[i] = i*deltaf;
+    }
+
+    return graph
+    (
+        "PSD(f)",
+        "f [Hz]",
+        "PSD(f) [PaPa_Hz]",
+        f,
+        psd
+    );
+}
+
+
+Foam::graph Foam::noiseFFT::PSD(const graph& gPSDf) const
+{
+    return graph
+    (
+        "PSD(f)",
+        "f [Hz]",
+        "PSD_dB(f) [dB_Hz]",
+        gPSDf.x(),
+        10*log10(gPSDf.y()/sqr(p0))
+    );
+}
+
+
+Foam::graph Foam::noiseFFT::octaves
+(
+    const graph& g,
+    const labelList& freqBandIDs,
+    bool integrate
+) const
+{
+    if (freqBandIDs.size() < 2)
+    {
+        WarningInFunction
+            << "Octave frequency bands are not defined "
+            << "- skipping octaves calculation"
+            << endl;
+
+        return graph
+        (
+            "octave",
+            "x",
+            "y",
+            scalarField(),
+            scalarField()
+        );
+    }
+
+    const scalarField& f = g.x();
+    const scalarField& data = g.y();
+
+    scalarField octData(freqBandIDs.size() - 1, 0.0);
+    scalarField fm(freqBandIDs.size() -1, 0.0);
+
+    for (label bandI = 0; bandI < freqBandIDs.size() - 1; bandI++)
+    {
+        label fb0 = freqBandIDs[bandI];
+        label fb1 = freqBandIDs[bandI+1];
+        fm[bandI] = f[fb0];
+
+        if (fb0 == fb1) continue;
+
+        if (integrate)
+        {
+            for (label freqI = fb0; freqI < fb1; freqI++)
+            {
+                label f0 = f[freqI];
+                label f1 = f[freqI + 1];
+                scalar dataAve = 0.5*(data[freqI] + data[freqI + 1]);
+                octData[bandI] += dataAve*(f1 - f0);
+            }
+        }
+        else
+        {
+            for (label freqI = fb0; freqI < fb1; freqI++)
+            {
+                octData[bandI] += data[freqI];
+            }
+        }
+    }
+
+    return graph
+    (
+        "octaves(f)",
+        "fm [Hz]",
+        "octave data",
+        fm,
+        octData
+    );
+}
+
+
+Foam::scalar Foam::noiseFFT::dbToPa(const scalar db) const
+{
+    return p0*pow(10.0, db/20.0);
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::noiseFFT::dbToPa
+(
+    const tmp<scalarField>& db
+) const
+{
+    return p0*pow(10.0, db/20.0);
+}
+
+
+// ************************************************************************* //
diff --git a/src/randomProcesses/noise/noiseFFT.H b/src/randomProcesses/noise/noiseFFT/noiseFFT.H
similarity index 53%
rename from src/randomProcesses/noise/noiseFFT.H
rename to src/randomProcesses/noise/noiseFFT/noiseFFT.H
index 085702964cd5a28e0b4bf39a0040b230a3544d8d..6439a2f429a427e0b0a8d3c82d68235138088712 100644
--- a/src/randomProcesses/noise/noiseFFT.H
+++ b/src/randomProcesses/noise/noiseFFT/noiseFFT.H
@@ -2,8 +2,8 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  |
+    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -25,11 +25,26 @@ Class
     Foam::noiseFFT
 
 Description
-    FFT of the pressure field
+    Performs FFT of pressure field to generate noise data.
+
+    General functionality:
+    - Pf: fft of the pressure data
+    - meanPf: multi-window mean fft
+    - RMSmeanPf: multi-window RMS mean fft
+    - PSDf: multi-window power spectral density (PSD) in frequency domain
+    - PSD: power spectral density in dB/Hz
+    - SPL: sound pressure level in dB
+
+    Octave-based data:
+    - PSD spectrum
+    - SPL spectrum
 
 SourceFiles
     noiseFFT.C
 
+SeeAlso
+    windowModel.H
+
 \*---------------------------------------------------------------------------*/
 
 #ifndef noiseFFT_H
@@ -37,6 +52,7 @@ SourceFiles
 
 #include "scalarField.H"
 #include "graph.H"
+#include "windowModel.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -44,7 +60,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class noiseFFT Declaration
+                          Class noiseFFT Declaration
 \*---------------------------------------------------------------------------*/
 
 class noiseFFT
@@ -54,7 +70,18 @@ class noiseFFT
     // Private data
 
         //- Time spacing of the raw data
-        scalar deltat_;
+        scalar deltaT_;
+
+    struct octaveBandInfo
+    {
+        label octave;
+
+        // IDs of bin boundaries in pressure data
+        labelList binIDs;
+
+        // Centre frequencies for each bin
+        scalarField centreFreq;
+    };
 
 
 public:
@@ -81,37 +108,61 @@ public:
 
     // Member Functions
 
-        //- Return the graph of p(t)
-        graph pt() const;
+        //- Return the FFT frequencies
+        static tmp<scalarField> frequencies
+        (
+            const label N,
+            const scalar deltaT
+        );
+
+        //- Return the PSD [dB/Hz]
+        //  Input PSD in [Pa^2/Hz]
+        static tmp<scalarField> PSD(const scalarField& PSDf);
 
-        //- Return the nth window
-        tmp<scalarField> window(const label N, const label n) const;
+        //- Return the SPL [dB]
+        //  Input P(rms)^2 in [Pa^2]
+        static tmp<scalarField> SPL(const scalarField& Prms2);
+
+        //- Return a list of the frequency indices wrt f field that
+        //  correspond to the bands limits for a given octave
+        static void octaveBandInfo
+        (
+            const scalarField& f,
+            const scalar fLower,
+            const scalar fUpper,
+            const scalar octave,
+            labelList& fBandIDs,
+            scalarField& fCentre
+        );
 
-        //- Return the Hanning window function
-        tmp<scalarField> Hanning(const label N) const;
+        //- Return the graph of pressure as a function of time
+        graph pt() const;
 
         //- Return the fft of the given pressure data
         tmp<scalarField> Pf(const tmp<scalarField>& pn) const;
 
-        //- Return the multi-window mean fft of the complete pressure data
-        graph meanPf(const label N, const label nw) const;
+        //- Return the multi-window mean fft of the complete pressure data [Pa]
+        graph meanPf(const windowModel& window) const;
 
-        //- Return the multi-window RMS mean fft of the complete pressure data
-        graph RMSmeanPf(const label N, const label nw) const;
+        //- Return the multi-window RMS mean fft of the complete pressure
+        //  data [Pa]
+        graph RMSmeanPf(const windowModel& window) const;
 
-        //- Return the narrow-band PFL (pressure-fluctuation level) spectrum
-        graph Lf(const graph& gPf) const;
+        //- Return the multi-window PSD (power spectral density) of the complete
+        //  pressure data [Pa^2/Hz]
+        graph PSDf(const windowModel& window) const;
 
-        //- Return the one-third-octave-band PFL spectrum
-        //  starting at octave with mean frequency f1
-        graph Ldelta(const graph& gLf, const scalar f1, const scalar fU) const;
+        //- Return the PSD [dB/Hz]
+        //  Takes PSD in [Pa^2/Hz]
+        graph PSD(const graph& gPSDf) const;
 
-        //- Return the one-third-octave-band pressure spectrum
-        //  starting at octave with mean frequency f1
-        graph Pdelta(const graph& gLf, const scalar f1, const scalar fU) const;
-
-        //- Return the total PFL as the sum of Lf over all frequencies
-        scalar Lsum(const graph& gLf) const;
+        //- Generate octave data
+        graph octaves
+        (
+            const graph& g,
+            const labelList& freqBandIDs,
+            bool integrate
+        ) const;
 
         //- Convert the db into Pa
         scalar dbToPa(const scalar db) const;
diff --git a/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.C b/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.C
new file mode 100644
index 0000000000000000000000000000000000000000..145f992725047247f649688a9e88cff14b86753b
--- /dev/null
+++ b/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.C
@@ -0,0 +1,151 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015-2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "noiseModel.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(noiseModel, 0);
+    defineRunTimeSelectionTable(noiseModel, dictionary);
+}
+
+// * * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * //
+
+Foam::scalar Foam::noiseModel::checkUniformTimeStep
+(
+    const scalarList& times
+) const
+{
+    scalar deltaT = -1.0;
+
+    if (times.size() > 1)
+    {
+        for (label i = 1; i < times.size(); i++)
+        {
+            scalar dT = times[i] - times[i-1];
+
+            if (deltaT < 0)
+            {
+                deltaT = dT;
+            }
+
+            if (mag(deltaT - dT) > SMALL)
+            {
+                FatalErrorInFunction
+                    << "Unable to process data with a variable time step"
+                    << exit(FatalError);
+            }
+        }
+    }
+    else
+    {
+        FatalErrorInFunction
+            << "Unable to create FFT with a single value"
+            << exit(FatalError);
+    }
+
+    return deltaT;
+}
+
+
+Foam::label Foam::noiseModel::findStartTimeIndex
+(
+    const instantList& allTimes,
+    const scalar startTime
+) const
+{
+    forAll(allTimes, timeI)
+    {
+        const instant& i = allTimes[timeI];
+
+        if (i.value() >= startTime)
+        {
+            return timeI;
+        }
+    }
+
+    return 0;
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::noiseModel::noiseModel(const dictionary& dict)
+:
+    dict_(dict),
+    rhoRef_(dict.lookupOrDefault<scalar>("rhoRef", 1)),
+    nSamples_(dict.lookupOrDefault<label>("N", 65536)),
+    fLower_(dict.lookupOrDefault<scalar>("fl", 25)),
+    fUpper_(dict.lookupOrDefault<scalar>("fu", 10000)),
+    startTime_(dict.lookupOrDefault<scalar>("startTime", 0)),
+    windowModelPtr_(windowModel::New(dict, nSamples_)),
+    graphFormat_(dict.lookupOrDefault<word>("graphFormat", "raw"))
+{
+    // Check number of samples  - must be a power of 2 for our FFT
+    bool powerOf2 = ((nSamples_ != 0) && !(nSamples_ & (nSamples_ - 1)));
+    if (!powerOf2)
+    {
+        FatalIOErrorInFunction(dict)
+            << "N: Number of samples in sampling windows must be a "
+            << "power of 2"
+            << exit(FatalIOError);
+    }
+
+    if (fLower_ < 0)
+    {
+        FatalIOErrorInFunction(dict)
+            << "fl: lower frequency bound must be greater than zero"
+            << exit(FatalIOError);
+
+    }
+
+    if (fUpper_ < 0)
+    {
+        FatalIOErrorInFunction(dict)
+            << "fu: upper frequency bound must be greater than zero"
+            << exit(FatalIOError);
+
+    }
+
+    if (fUpper_ < fLower_)
+    {
+        FatalIOErrorInFunction(dict)
+            << "fu: upper frequency bound must be greater than lower "
+            << "frequency bound (fl)"
+            << exit(FatalIOError);
+
+    }
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::noiseModel::~noiseModel()
+{}
+
+
+// ************************************************************************* //
diff --git a/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.H b/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.H
new file mode 100644
index 0000000000000000000000000000000000000000..28643cbf564fe1c48bc670ac7e4aaa5e5dbd5707
--- /dev/null
+++ b/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.H
@@ -0,0 +1,179 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015-2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::noiseModel
+
+Description
+    Base class for noise models.
+
+    Data is read from a dictionary, e.g.
+
+    \verbatim
+    rhoRef          0;
+    N               4096;
+    fl              25;
+    fu              25;
+    startTime       0;
+    \endverbatim
+
+    where
+    \table
+        Property    | Description                   | Required  | Default value
+        rhoRef      | Reference density             | no        | 1
+        N           | Number of samples in sampling window | no | 65536 (2^16)
+        fl          | Lower frequency bounds        | no        | 25
+        fu          | Upper frequency bounds        | no        | 10000
+        startTime   | Start time                    | no        | 0
+        graphFormat | Graph format                  | no        | raw
+    \endtable
+
+Note
+    The number of samples in the sampling window must be a power of 2
+
+
+SourceFiles
+    noiseModel.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef noiseModel_H
+#define noiseModel_H
+
+#include "dictionary.H"
+#include "scalarList.H"
+#include "instantList.H"
+#include "windowModel.H"
+#include "runTimeSelectionTables.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                         Class noiseModel Declaration
+\*---------------------------------------------------------------------------*/
+
+class noiseModel
+{
+
+private:
+
+    // Private Member Functions
+
+        //- Disallow default bitwise copy construct
+        noiseModel(const noiseModel&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const noiseModel&);
+
+
+protected:
+
+    // Protected Data
+
+        //- Copy of dictionary used for construction
+        const dictionary dict_;
+
+        //- Reference density (to convert from kinematic to static pressure)
+        scalar rhoRef_;
+
+        //- Number of samples in sampling window, default = 2^16
+        label nSamples_;
+
+        //- Lower frequency limit, default = 25Hz
+        scalar fLower_;
+
+        //- Upper frequency limit, default = 10kHz
+        scalar fUpper_;
+
+        //- Start time, default = 0s
+        scalar startTime_;
+
+        //- Window model
+        autoPtr<windowModel> windowModelPtr_;
+
+        //- Graph format
+        word graphFormat_;
+
+
+    // Protected Member Functions
+
+        //- Check and return uniform time step
+        scalar checkUniformTimeStep
+        (
+            const scalarList& times
+        ) const; 
+
+        //- Find and return start time index
+        label findStartTimeIndex
+        (
+            const instantList& allTimes,
+            const scalar startTime
+        ) const;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("noiseModel");
+
+    //- Run time selection table  
+    declareRunTimeSelectionTable
+    (
+        autoPtr,
+        noiseModel,
+        dictionary,
+        (
+            const dictionary& dict
+        ),
+        (dict)
+    );
+
+    //- Selector
+    static autoPtr<noiseModel> New(const dictionary& dict);
+
+    //- Constructor
+    noiseModel(const dictionary& dict);
+
+    //- Destructor
+    virtual ~noiseModel();
+
+
+    // Public Member Functions
+
+        //- Abstract call to calculate
+        virtual void calculate() = 0;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/randomProcesses/noise/noiseModels/noiseModel/noiseModelNew.C b/src/randomProcesses/noise/noiseModels/noiseModel/noiseModelNew.C
new file mode 100644
index 0000000000000000000000000000000000000000..3f5fa4f25f8e38d716767f947bdf1f7a070e09f3
--- /dev/null
+++ b/src/randomProcesses/noise/noiseModels/noiseModel/noiseModelNew.C
@@ -0,0 +1,53 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "noiseModel.H"
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::autoPtr<Foam::noiseModel> Foam::noiseModel::New(const dictionary& dict)
+{
+    const word modelType(dict.lookup("noiseModel"));
+
+    Info<< "Selecting noiseModel " << modelType << endl;
+
+    dictionaryConstructorTable::iterator cstrIter =
+        dictionaryConstructorTablePtr_->find(modelType);
+
+    if (cstrIter == dictionaryConstructorTablePtr_->end())
+    {
+        FatalErrorInFunction
+            << "Unknown noiseModel type "
+            << modelType << nl << nl
+            << "Valid noiseModel types are:" << nl
+            << dictionaryConstructorTablePtr_->sortedToc()
+            << exit(FatalError);
+    }
+
+    return autoPtr<noiseModel>(cstrIter()(dict.subDict(modelType + "Coeffs")));
+}
+
+
+// ************************************************************************* //
diff --git a/src/randomProcesses/noise/noiseModels/pointNoise/pointNoise.C b/src/randomProcesses/noise/noiseModels/pointNoise/pointNoise.C
new file mode 100644
index 0000000000000000000000000000000000000000..fc03d0300330d2ff6bee5c98593cf154e69358f1
--- /dev/null
+++ b/src/randomProcesses/noise/noiseModels/pointNoise/pointNoise.C
@@ -0,0 +1,207 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015-2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "pointNoise.H"
+#include "noiseFFT.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace noiseModels
+{
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+defineTypeNameAndDebug(pointNoise, 0);
+addToRunTimeSelectionTable(noiseModel, pointNoise, dictionary);
+
+// * * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * //
+
+void pointNoise::filterTimeData
+(
+    const Function1Types::CSV<scalar>& pData,
+    scalarField& t,
+    scalarField& p
+)
+{
+    const scalarField t0(pData.x());
+    const scalarField p0(pData.y());
+
+    DynamicList<scalar> tf(t0.size());
+    DynamicList<scalar> pf(t0.size());
+
+    forAll(t0, timeI)
+    {
+        if (t0[timeI] >= startTime_)
+        {
+            tf.append(t0[timeI]);
+            pf.append(p0[timeI]);
+        }
+    }
+
+    t.transfer(tf);
+    p.transfer(pf);
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void pointNoise::calculate()
+{
+    // Point data only handled by master
+    if (!Pstream::master())
+    {
+        return;
+    }
+
+    Info<< "Reading data file" << endl;
+
+    Function1Types::CSV<scalar> pData("pressure", dict_, "Data");
+
+    // Time and pressure history data
+    scalarField t, p;
+    filterTimeData(pData, t, p);
+    p *= rhoRef_;
+
+    Info<< "    read " << t.size() << " values" << nl << endl;
+
+    Info<< "Creating noise FFT" << endl;
+    const scalar deltaT = checkUniformTimeStep(t);
+
+    // Determine the windowing
+    windowModelPtr_->validate(t.size());
+    const windowModel& win = windowModelPtr_();
+    const scalar deltaf = 1.0/(deltaT*win.nSamples());
+    fileName outDir(fileName("postProcessing")/"noise"/typeName);
+
+    // Create the fft
+    noiseFFT nfft(deltaT, p);
+
+
+    // Narrow band data
+    // ----------------
+
+    // RMS pressure [Pa]
+    graph Prmsf(nfft.RMSmeanPf(win));
+    Info<< "    Creating graph for " << Prmsf.title() << endl;
+    Prmsf.write(outDir, graph::wordify(Prmsf.title()), graphFormat_);
+
+    // PSD [Pa^2/Hz]
+    graph PSDf(nfft.PSDf(win));
+    Info<< "    Creating graph for " << PSDf.title() << endl;
+    PSDf.write(outDir, graph::wordify(PSDf.title()), graphFormat_);
+
+    // PSD [dB/Hz]
+    graph PSDg
+    (
+        "PSD_dB_Hz(f)",
+        "f [Hz]",
+        "PSD(f) [dB_Hz]",
+        Prmsf.x(),
+        noiseFFT::PSD(PSDf.y())
+    );
+    Info<< "    Creating graph for " << PSDg.title() << endl;
+    PSDg.write(outDir, graph::wordify(PSDg.title()), graphFormat_);
+
+    // SPL [dB]
+    graph SPLg
+    (
+        "SPL_dB(f)",
+        "f [Hz]",
+        "SPL(f) [dB]",
+        Prmsf.x(),
+        noiseFFT::SPL(PSDf.y()*deltaf)
+    );
+    Info<< "    Creating graph for " << SPLg.title() << endl;
+    SPLg.write(outDir, graph::wordify(SPLg.title()), graphFormat_);
+
+    labelList octave13BandIDs;
+    scalarField octave13FreqCentre;
+    noiseFFT::octaveBandInfo
+    (
+        Prmsf.x(),
+        fLower_,
+        fUpper_,
+        3,
+        octave13BandIDs,
+        octave13FreqCentre
+    );
+
+
+    // 1/3 octave data
+    // ---------------
+
+    // PSD [Pa^2/Hz]
+    graph PSD13f(nfft.octaves(PSDf, octave13BandIDs, false));
+
+    // Integrated PSD = P(rms)^2 [Pa^2]
+    graph Prms13f2(nfft.octaves(PSDf, octave13BandIDs, true));
+
+    graph PSD13g
+    (
+        "PSD13_dB_Hz(fm)",
+        "fm [Hz]",
+        "PSD(fm) [dB_Hz]",
+        octave13FreqCentre,
+        noiseFFT::PSD(PSD13f.y())
+    );
+    Info<< "    Creating graph for " << PSD13g.title() << endl;
+    PSD13g.write(outDir, graph::wordify(PSD13g.title()), graphFormat_);
+
+    graph SPL13g
+    (
+        "SPL13_dB(fm)",
+        "fm [Hz]",
+        "SPL(fm) [dB]",
+        octave13FreqCentre,
+        noiseFFT::SPL(Prms13f2.y())
+    );
+    Info<< "    Creating graph for " << SPL13g.title() << endl;
+    SPL13g.write(outDir, graph::wordify(SPL13g.title()), graphFormat_);
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+pointNoise::pointNoise(const dictionary& dict)
+:
+    noiseModel(dict)
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+pointNoise::~pointNoise()
+{}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace noiseModels
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/randomProcesses/noise/noiseModels/pointNoise/pointNoise.H b/src/randomProcesses/noise/noiseModels/pointNoise/pointNoise.H
new file mode 100644
index 0000000000000000000000000000000000000000..30bc669ae96433c3ba8cf689afb9304a79a21067
--- /dev/null
+++ b/src/randomProcesses/noise/noiseModels/pointNoise/pointNoise.H
@@ -0,0 +1,142 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015-2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::noiseModels::pointNoise
+
+Description
+    Perform noise analysis on point-based pressure data.
+
+    Input data is read from a dictionary, e.g.
+
+    \verbatim
+    // Pressure reference
+    pRef            0;
+
+    // Number of samples in sampling window
+    // Must be a power of 2, default = 2^16 (=65536)
+    N               4096;
+
+    // Lower frequency bounds
+    fl              25;
+
+    // Upper frequency bounds
+    fu              25;
+
+    // Start time
+    startTime       0;
+
+    windowModel     <modelType>
+    <modelType>Coeffs
+    {
+        ...
+    }
+
+    // Pressure data supplied in CSV file format
+    csvFileData
+    {
+        fileName        "pressureData";
+        nHeaderLine     1;
+        refColumn       0;
+        componentColumns (1);
+        separator       " ";
+        mergeSeparators yes;
+    }
+
+    graphFormat     raw;
+
+    \endverbatim
+
+SourceFiles
+    pointNoise.C
+
+SeeAlso
+    noiseModel.H
+    windowModel.H
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef pointNoise_H
+#define pointNoise_H
+
+#include "noiseModel.H"
+#include "CSV.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace noiseModels
+{
+
+/*---------------------------------------------------------------------------*\
+                         Class pointNoise Declaration
+\*---------------------------------------------------------------------------*/
+
+class pointNoise
+:
+    public noiseModel
+{
+
+protected:
+
+    // Protected Member Functions
+
+        void filterTimeData
+        (
+            const Function1Types::CSV<scalar>& pData,
+            scalarField& t,
+            scalarField& p
+        );
+
+
+public:
+
+    //- Runtime type information
+    TypeName("pointNoise");
+
+    //- Constructor
+    pointNoise(const dictionary& dict);
+
+    //- Destructor
+    virtual ~pointNoise();
+
+
+    // Public Member Functions
+
+        //- Calculate
+        virtual void calculate();
+
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace noiseModels
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.C b/src/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.C
new file mode 100644
index 0000000000000000000000000000000000000000..92a3df57fd3adfe80e6a55d231c3c2fb1120db31
--- /dev/null
+++ b/src/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.C
@@ -0,0 +1,718 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015-2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "surfaceNoise.H"
+#include "surfaceReader.H"
+#include "surfaceWriter.H"
+#include "noiseFFT.H"
+#include "graph.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace noiseModels
+{
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+defineTypeNameAndDebug(surfaceNoise, 0);
+addToRunTimeSelectionTable(noiseModel, surfaceNoise, dictionary);
+
+// * * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * //
+
+void surfaceNoise::initialise(const dictionary& dict)
+{
+    label nAvailableTimes = 0;
+
+    // All reading performed on the master processor only
+    if (Pstream::master())
+    {
+        // Create the surface reader
+        const word readerType(dict.lookup("reader"));
+        readerPtr_.reset(surfaceReader::New(readerType, inputFileName_).ptr());
+
+        // Find the index of the pressure data
+        const word pName(dict.lookupOrDefault<word>("pName", "p"));
+        const List<word> fieldNames(readerPtr_->fieldNames(0));
+        pIndex_ = findIndex(fieldNames, pName);
+        if (pIndex_ == -1)
+        {
+            FatalErrorInFunction
+                << "Unable to find pressure field name " << pName
+                << " in list of available fields: " << fieldNames
+                << exit(FatalError);
+        }
+
+        // Create the surface writer
+        // - Could be done later, but since this utility can process a lot of
+        //   data we can ensure that the user-input is correct prior to doing
+        //   the heavy lifting
+        const word writerType(dict.lookup("writer"));
+        dictionary optDict
+        (
+            dict.subOrEmptyDict("writeOptions").subOrEmptyDict(writerType)
+        );
+        writerPtr_.reset(surfaceWriter::New(writerType, optDict).ptr());
+
+        // Set the time range
+        const instantList allTimes = readerPtr_->times();
+        startTimeIndex_ = findStartTimeIndex(allTimes, startTime_);
+
+        // Determine the windowing
+        nAvailableTimes = allTimes.size() - startTimeIndex_;
+    }
+
+    Pstream::scatter(pIndex_);
+    Pstream::scatter(startTimeIndex_);
+    Pstream::scatter(nAvailableTimes);
+
+
+    // Note: all processors should call the windowing validate function
+    label nRequiredTimes = windowModelPtr_->validate(nAvailableTimes);
+
+    if (Pstream::master())
+    {
+        // Restrict times
+        const instantList allTimes = readerPtr_->times();
+
+        times_.setSize(nRequiredTimes);
+        forAll(times_, timeI)
+        {
+            times_[timeI] = allTimes[timeI + startTimeIndex_].value();
+        }
+        deltaT_ = checkUniformTimeStep(times_);
+
+        // Read the surface geometry
+        const meshedSurface& surf = readerPtr_->geometry();
+        nFace_ = surf.size();
+    }
+
+    Pstream::scatter(times_);
+    Pstream::scatter(deltaT_);
+    Pstream::scatter(nFace_);
+}
+
+
+void surfaceNoise::readSurfaceData
+(
+    const labelList& procFaceOffset,
+    List<scalarField>& pData
+)
+{
+    // Data is stored as pressure on surface at a given time.  Now we need to
+    // pivot the data so that we have the complete pressure time history per
+    // surface face.  In serial mode, this results in all pressure data being
+    // loaded into memory (!)
+
+    Info << "Reading pressure data" << endl;
+
+    if (Pstream::parRun())
+    {
+        PstreamBuffers pBufs(Pstream::nonBlocking);
+
+        // Procedure:
+        // 1. Master processor reads pressure data for all faces for all times
+        // 2. Master sends each processor a subset of faces
+        // 3. Local processor reconstructs the full time history for the subset
+        //    of faces
+        // Note: reading all data on master to avoid potential NFS problems...
+
+        const label myProcI = Pstream::myProcNo();
+        const label nLocalFace =
+            procFaceOffset[myProcI + 1] - procFaceOffset[myProcI];
+
+        // Complete pressure time history data for subset of faces
+        pData.setSize(nLocalFace);
+        const label nTimes = times_.size();
+        forAll(pData, faceI)
+        {
+            pData[faceI].setSize(nTimes);
+        }
+
+        // Read and send data
+        forAll(times_, i)
+        {
+            pBufs.clear();
+
+            if (Pstream::master())
+            {
+                label timeI = i + startTimeIndex_;
+
+                Info<< "    time: " << times_[i] << endl;
+
+                // Read pressure at all faces for time timeI
+                scalarField p(readerPtr_->field(timeI, pIndex_, scalar(0)));
+
+                // Apply conversions
+                p *= rhoRef_;
+
+                // Send subset of faces to each processor
+                for (label procI = 0; procI < Pstream::nProcs(); procI++)
+                {
+                    label face0 = procFaceOffset[procI];
+                    label nLocalFace =
+                        procFaceOffset[procI + 1] - procFaceOffset[procI];
+
+                    UOPstream toProc(procI, pBufs);
+                    toProc << SubList<scalar>(p, nLocalFace, face0);
+                }
+            }
+
+            pBufs.finishedSends();
+
+            // Receive data from the master
+            UIPstream fromProc(0, pBufs);
+
+            scalarList pSlice(fromProc);
+
+            forAll(pSlice, faceI)
+            {
+                pData[faceI][i] = pSlice[faceI];
+            }
+        }
+    }
+    else
+    {
+        const label nLocalFace = procFaceOffset[0];
+
+        pData.setSize(nLocalFace);
+        forAll(times_, timeI)
+        {
+            forAll(pData, faceI)
+            {
+                pData[faceI].setSize(times_.size());
+            }
+        }
+
+        forAll(times_, i)
+        {
+            label timeI = i + startTimeIndex_;
+
+            Info<< "    time: " << times_[i] << endl;
+            const scalarField p(readerPtr_->field(timeI, pIndex_, scalar(0)));
+
+            forAll(p, faceI)
+            {
+                pData[faceI][i] = p[faceI]*rhoRef_;
+            }
+        }
+    }
+
+    Info<< "Read "
+        << returnReduce(pData.size(), sumOp<label>())
+        << " pressure traces with "
+        << times_.size()
+        << " time values" << nl << endl;
+}
+
+
+Foam::scalar surfaceNoise::writeSurfaceData
+(
+    const word& fName,
+    const word& groupName,
+    const word& title,
+    const scalar freq,
+    const scalarField& data,
+    const labelList& procFaceOffset
+) const
+{
+    Info<< "    processing " << title << " for frequency " << freq << endl;
+
+    fileName outDir
+    (
+        fileName("postProcessing")/"noise"/groupName/Foam::name(freq)
+    );
+
+    if (Pstream::parRun())
+    {
+        // Collect the surface data so that we can output the surfaces
+
+        PstreamBuffers pBufs(Pstream::nonBlocking);
+
+        if (!Pstream::master())
+        {
+            UOPstream toProc(0, pBufs);
+            toProc << data;
+        }
+
+        pBufs.finishedSends();
+
+        scalar areaAverage = 0;
+        if (Pstream::master())
+        {
+            const meshedSurface& surf = readerPtr_->geometry();
+
+            scalarField allData(surf.size());
+
+            forAll(data, faceI)
+            {
+                // Master procFaceOffset is zero...
+                allData[faceI] = data[faceI];
+            }
+
+            for (label procI = 1; procI < Pstream::nProcs(); procI++)
+            {
+                UIPstream fromProc(procI, pBufs);
+                scalarList dataSlice(fromProc);
+                forAll(dataSlice, i)
+                {
+                    label faceI = procFaceOffset[procI] + i;
+                    allData[faceI] = dataSlice[i];
+                }
+            }
+
+            fileName outFileName = writerPtr_->write
+            (
+                outDir,
+                fName,
+                surf.points(),
+                surf.faces(),
+                title,
+                allData,
+                false
+            );
+
+            // TODO: Move faceAreas to demand-driven function in MeshedSurface
+            // scalarField faceAreas(surf.faces().size());
+            // forAll(faceAreas, i)
+            // {
+            //     faceAreas[i] = surf.faces()[i].mag(surf.points());
+            // }
+            //
+            // areaAverage = sum(allData*faceAreas)/sum(faceAreas);
+            areaAverage = sum(allData)/allData.size();
+        }
+        Pstream::scatter(areaAverage);
+
+        return areaAverage;
+    }
+    else
+    {
+        const meshedSurface& surf = readerPtr_->geometry();
+
+        writerPtr_->write
+        (
+            outDir,
+            fName,
+            surf.points(),
+            surf.faces(),
+            title,
+            data,
+            false
+        );
+
+        // TODO: Move faceAreas to demand-driven function in MeshedSurface
+        // scalarField faceAreas(surf.faces().size());
+        // forAll(faceAreas, i)
+        // {
+        //     faceAreas[i] = surf.faces()[i].mag(surf.points());
+        // }
+        //
+        // return sum(data*faceAreas)/sum(faceAreas);
+        return sum(data)/data.size();
+    }
+}
+
+
+Foam::scalar surfaceNoise::surfaceAverage
+(
+    const scalarField& data,
+    const labelList& procFaceOffset
+) const
+{
+    if (Pstream::parRun())
+    {
+        // Collect the surface data so that we can output the surfaces
+
+        PstreamBuffers pBufs(Pstream::nonBlocking);
+
+        if (!Pstream::master())
+        {
+            UOPstream toProc(0, pBufs);
+            toProc << data;
+        }
+
+        pBufs.finishedSends();
+
+        scalar areaAverage = 0;
+        if (Pstream::master())
+        {
+            const meshedSurface& surf = readerPtr_->geometry();
+
+            scalarField allData(surf.size());
+
+            forAll(data, faceI)
+            {
+                // Master procFaceOffset is zero...
+                allData[faceI] = data[faceI];
+            }
+
+            for (label procI = 1; procI < Pstream::nProcs(); procI++)
+            {
+                UIPstream fromProc(procI, pBufs);
+                scalarList dataSlice(fromProc);
+                forAll(dataSlice, i)
+                {
+                    label faceI = procFaceOffset[procI] + i;
+                    allData[faceI] = dataSlice[i];
+                }
+            }
+
+            // TODO: Move faceAreas to demand-driven function in MeshedSurface
+            scalarField faceAreas(surf.faces().size());
+            forAll(faceAreas, i)
+            {
+                faceAreas[i] = surf.faces()[i].mag(surf.points());
+            }
+
+//            areaAverage = sum(allData*faceAreas)/sum(faceAreas);
+            areaAverage = sum(allData)/allData.size();
+        }
+        Pstream::scatter(areaAverage);
+
+        return areaAverage;
+    }
+    else
+    {
+        const meshedSurface& surf = readerPtr_->geometry();
+
+        // TODO: Move faceAreas to demand-driven function in MeshedSurface
+        scalarField faceAreas(surf.faces().size());
+        forAll(faceAreas, i)
+        {
+            faceAreas[i] = surf.faces()[i].mag(surf.points());
+        }
+
+//        return sum(data*faceAreas)/sum(faceAreas);
+        return sum(data)/data.size();
+    }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+surfaceNoise::surfaceNoise(const dictionary& dict)
+:
+    noiseModel(dict),
+    inputFileName_(dict.lookup("inputFile")),
+    pIndex_(0),
+    times_(),
+    deltaT_(0),
+    startTimeIndex_(0),
+    nFace_(0),
+    fftWriteInterval_(dict.lookupOrDefault("fftWriteInterval", 1))
+{
+    initialise(dict);
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+surfaceNoise::~surfaceNoise()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void surfaceNoise::calculate()
+{
+    // Container for pressure time history data per face
+    List<scalarField> pData;
+
+    // Processor procFaceOffsets
+    labelList procFaceOffset;
+    if (Pstream::parRun())
+    {
+        const label nProcs = Pstream::nProcs();
+        const label nFacePerProc = floor(nFace_/nProcs) + 1;
+
+        procFaceOffset.setSize(nProcs + 1, 0);
+        for (label i = 1; i < procFaceOffset.size(); i++)
+        {
+            procFaceOffset[i] = min(i*nFacePerProc, nFace_);
+        }
+    }
+    else
+    {
+        procFaceOffset.setSize(1, nFace_);
+    }
+
+    // Read pressure data from file
+    readSurfaceData(procFaceOffset, pData);
+
+    // Process the pressure data, and store results as surface values per
+    // frequency so that it can be output using the surface writer
+
+    Info<< "Creating noise FFTs" << endl;
+
+    // Storage for FFT data
+    const label nLocalFace = pData.size();
+    const scalarField freq1(noiseFFT::frequencies(nSamples_, deltaT_));
+    const label nFFT = freq1.size()/fftWriteInterval_;
+    List<scalarField> surfPrmsf(nFFT);
+    List<scalarField> surfPSDf(nFFT);
+    forAll(surfPrmsf, freqI)
+    {
+        surfPrmsf[freqI].setSize(nLocalFace);
+        surfPSDf[freqI].setSize(nLocalFace);
+    }
+
+    // Storage for 1/3 octave data
+    labelList octave13BandIDs;
+    scalarField octave13FreqCentre;
+    noiseFFT::octaveBandInfo
+    (
+        freq1,
+        fLower_,
+        fUpper_,
+        3,
+        octave13BandIDs,
+        octave13FreqCentre
+    );
+
+    label bandSize = 0;
+    if (octave13BandIDs.empty())
+    {
+        WarningInFunction
+            << "Ocatve band calculation failed (zero sized). "
+            << "please check your input data"
+            << endl;
+    }
+    else
+    {
+        bandSize = octave13BandIDs.size() - 1;
+    }
+
+    List<scalarField> surfPSD13f(bandSize);
+    List<scalarField> surfPrms13f2(bandSize);
+    forAll(surfPSD13f, freqI)
+    {
+        surfPSD13f[freqI].setSize(nLocalFace);
+        surfPrms13f2[freqI].setSize(nLocalFace);
+    }
+
+    const windowModel& win = windowModelPtr_();
+
+    forAll(pData, faceI)
+    {
+        const scalarField& p = pData[faceI];
+
+        noiseFFT nfft(deltaT_, p);
+        graph Prmsf(nfft.RMSmeanPf(win));
+        graph PSDf(nfft.PSDf(win));
+
+        // Store the frequency results in slot for face of surface
+        forAll(surfPrmsf, i)
+        {
+            label freqI = (i + 1)*fftWriteInterval_ - 1;
+            surfPrmsf[i][faceI] = Prmsf.y()[freqI];
+            surfPSDf[i][faceI] = PSDf.y()[freqI];
+        }
+
+        // PSD [Pa^2/Hz]
+        graph PSD13f(nfft.octaves(PSDf, octave13BandIDs, false));
+
+        // Integrated PSD = P(rms)^2 [Pa^2]
+        graph Prms13f2(nfft.octaves(PSDf, octave13BandIDs, true));
+
+        // Store the 1/3 octave results in slot for face of surface
+        forAll(surfPSD13f, freqI)
+        {
+            surfPSD13f[freqI][faceI] = PSD13f.y()[freqI];
+            surfPrms13f2[freqI][faceI] = Prms13f2.y()[freqI];
+        }
+
+        // Free the storage for p
+//        p.clear();
+    }
+
+    // Output directory for graphs
+    fileName outDir(fileName("postProcessing")/"noise"/typeName);
+
+    const scalar deltaf = 1.0/(deltaT_*win.nSamples());
+    Info<< "Writing fft surface data" << endl;
+    {
+        scalarField PrmsfAve(surfPrmsf.size(), 0);
+        scalarField PSDfAve(surfPrmsf.size(), 0);
+        scalarField fOut(surfPrmsf.size(), 0);
+
+        forAll(surfPrmsf, i)
+        {
+            label freqI = i*fftWriteInterval_;
+            fOut[i] = freq1[freqI];
+            const word& fName = inputFileName_.name(true);
+            const word gName = "fft";
+            PrmsfAve[i] = writeSurfaceData
+            (
+                fName,
+                gName,
+                "Prmsf",
+                freq1[freqI],
+                surfPrmsf[i],
+                procFaceOffset
+            );
+
+            PSDfAve[i] = writeSurfaceData
+            (
+                fName,
+                gName,
+                "PSDf",
+                freq1[freqI],
+                surfPSDf[i],
+                procFaceOffset
+            );
+            writeSurfaceData
+            (
+                fName,
+                gName,
+                "PSD",
+                freq1[freqI],
+                noiseFFT::PSD(surfPSDf[i]),
+                procFaceOffset
+            );
+            writeSurfaceData
+            (
+                fName,
+                gName,
+                "SPL",
+                freq1[freqI],
+                noiseFFT::SPL(surfPSDf[i]*deltaf),
+                procFaceOffset
+            );
+        }
+
+        graph Prmsfg
+        (
+            "Average Prms(f)",
+            "f [Hz]",
+            "P(f) [Pa]",
+            fOut,
+            PrmsfAve
+        );
+        Prmsfg.write(outDir, graph::wordify(Prmsfg.title()), graphFormat_);
+
+        graph PSDfg
+        (
+            "Average PSD_f(f)",
+            "f [Hz]",
+            "PSD(f) [PaPa_Hz]",
+            fOut,
+            PSDfAve
+        );
+        PSDfg.write(outDir, graph::wordify(PSDfg.title()), graphFormat_);
+
+        graph PSDg
+        (
+            "Average PSD_dB_Hz(f)",
+            "f [Hz]",
+            "PSD(f) [dB_Hz]",
+            fOut,
+            noiseFFT::PSD(PSDfAve)
+        );
+        PSDg.write(outDir, graph::wordify(PSDg.title()), graphFormat_);
+
+        graph SPLg
+        (
+            "Average SPL_dB(f)",
+            "f [Hz]",
+            "SPL(f) [dB]",
+            fOut,
+            noiseFFT::SPL(PSDfAve*deltaf)
+        );
+        SPLg.write(outDir, graph::wordify(SPLg.title()), graphFormat_);
+    }
+
+
+    Info<< "Writing one-third octave surface data" << endl;
+    {
+        scalarField PSDfAve(surfPSD13f.size(), 0);
+        scalarField Prms13f2Ave(surfPSD13f.size(), 0);
+
+        forAll(surfPSD13f, i)
+        {
+            const word& fName = inputFileName_.name(true);
+            const word gName = "oneThirdOctave";
+            PSDfAve[i] = writeSurfaceData
+            (
+                fName,
+                gName,
+                "PSD13f",
+                octave13FreqCentre[i],
+                surfPSD13f[i],
+                procFaceOffset
+            );
+            writeSurfaceData
+            (
+                fName,
+                gName,
+                "PSD13",
+                octave13FreqCentre[i],
+                noiseFFT::PSD(surfPSD13f[i]),
+                procFaceOffset
+            );
+            writeSurfaceData
+            (
+                fName,
+                gName,
+                "SPL13",
+                octave13FreqCentre[i],
+                noiseFFT::SPL(surfPrms13f2[i]),
+                procFaceOffset
+            );
+
+            Prms13f2Ave[i] = surfaceAverage(surfPrms13f2[i], procFaceOffset);
+        }
+
+        graph PSD13g
+        (
+            "Average PSD13_dB_Hz(fm)",
+            "fm [Hz]",
+            "PSD(fm) [dB_Hz]",
+            octave13FreqCentre,
+            noiseFFT::PSD(PSDfAve)
+        );
+        PSD13g.write(outDir, graph::wordify(PSD13g.title()), graphFormat_);
+
+        graph SPL13g
+        (
+            "Average SPL13_dB(fm)",
+            "fm [Hz]",
+            "SPL(fm) [dB]",
+            octave13FreqCentre,
+            noiseFFT::SPL(Prms13f2Ave)
+        );
+        SPL13g.write(outDir, graph::wordify(SPL13g.title()), graphFormat_);
+    }
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace noiseModels
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.H b/src/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.H
new file mode 100644
index 0000000000000000000000000000000000000000..1ba1772df4e1c40bf5008a15966bdf0c548bb6e8
--- /dev/null
+++ b/src/randomProcesses/noise/noiseModels/surfaceNoise/surfaceNoise.H
@@ -0,0 +1,208 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015-2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::noiseModels::surfaceNoise
+
+Description
+    Perform noise analysis on surface-based pressure data.
+
+    Input data is read from a dictionary, e.g.
+
+    \verbatim
+    // Pressure reference
+    pRef            0;
+
+    // Number of samples in sampling window
+    // Must be a power of 2, default = 2^16 (=65536)
+    N               4096;
+
+    // Lower frequency bounds
+    fl              25;
+
+    // Upper frequency bounds
+    fu              25;
+
+    // Start time
+    startTime       0;
+
+    windowModel     <modelType>
+    <modelType>Coeffs
+    {
+        ...
+    }
+
+    // Input file
+    inputFile   "postProcessing/faceSource1/surface/patch/patch.case";
+
+    // Write interval for FFT data, default = 1
+    fftWriteInterval 100;
+
+    // Surface reader
+    reader      ensight;
+
+    // Surface writer
+    writer      ensight;
+
+    // Collate times for ensight output - ensures geometry is only written once
+    writeOptions
+    {
+        ensight
+        {
+            collateTimes true;
+        }
+    }
+    \endverbatim
+
+SourceFiles
+    surfaceNoise.C
+
+SeeAlso
+    noiseModel.H
+
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef surfaceNoise_H
+#define surfaceNoise_H
+
+#include "noiseModel.H"
+#include "labelList.H"
+#include "scalarField.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward declaration of classes
+class surfaceReader;
+class surfaceWriter;
+
+namespace noiseModels
+{
+
+/*---------------------------------------------------------------------------*\
+                        Class surfaceNoise Declaration
+\*---------------------------------------------------------------------------*/
+
+class surfaceNoise
+:
+    public noiseModel
+{
+
+protected:
+
+    // Protected Data
+
+        //- Input file name
+        const fileName inputFileName_;
+
+        //- Index of pressure field in reader field list
+        label pIndex_;
+
+        //- Sample times
+        scalarList times_;
+
+        //- Time step (constant)
+        scalar deltaT_;
+
+        //- Start time index
+        label startTimeIndex_;
+
+        //- Number of surface faces
+        label nFace_;
+
+        //- Frequency data output interval, default = 1
+        //  nSamples/2 data points are returned from the FFT, which can
+        //  result in a very large number of output files (1 per frequency)
+        label fftWriteInterval_;
+
+        //- Pointer to the surface reader
+        mutable autoPtr<surfaceReader> readerPtr_;
+
+        //- Pointer to the surface writer
+        autoPtr<surfaceWriter> writerPtr_;
+
+
+    // Protected Member Functions
+
+        //- Initialise
+        void initialise(const dictionary& dict);
+
+        //- Read surface data
+        void readSurfaceData
+        (
+            const labelList& procFaceOffset,
+            List<scalarField>& pData
+        );
+
+        //- Write surface data to file
+        //  Returns the area average value
+        scalar writeSurfaceData
+        (
+            const word& fName,
+            const word& groupName,
+            const word& title,
+            const scalar freq,
+            const scalarField& data,
+            const labelList& procFaceOffset
+        ) const;
+
+        //- Calculate the area average value
+        scalar surfaceAverage
+        (
+            const scalarField& data,
+            const labelList& procFaceOffset
+        ) const;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("surfaceNoise");
+
+    //- Constructor
+    surfaceNoise(const dictionary& dict);
+
+    //- Destructor
+    virtual ~surfaceNoise();
+
+
+    // Public Member Functions
+
+        //- Calculate
+        virtual void calculate();
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace noiseModels
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/randomProcesses/windowModels/Hanning/Hanning.C b/src/randomProcesses/windowModels/Hanning/Hanning.C
new file mode 100644
index 0000000000000000000000000000000000000000..8bafcf9bc574b986e8765824eedcaa60f726e6ba
--- /dev/null
+++ b/src/randomProcesses/windowModels/Hanning/Hanning.C
@@ -0,0 +1,122 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "Hanning.H"
+#include "addToRunTimeSelectionTable.H"
+#include "mathematicalConstants.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace windowModels
+{
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+defineTypeNameAndDebug(Hanning, 0);
+addToRunTimeSelectionTable(windowModel, Hanning, dictionary);
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Hanning::Hanning(const dictionary& dict, const label nSamples)
+:
+    windowModel(dict, nSamples),
+    symmetric_(readBool(dict.lookup("symmetric"))),
+    extended_(readBool(dict.lookup("extended"))),
+    alpha_(dict.lookupOrDefault("alpha", 0.5)) // Hamming = 0.54
+{
+    // Extend range if required
+    label offset = extended_ ? 1 : 0;
+    scalar m = nSamples - 1 + 2*offset;
+    
+    scalarField t(nSamples);
+    forAll(t, i)
+    {
+        t[i] = i + offset;
+    }
+
+    scalarField& wf = *this;
+    wf = alpha_ - (1 - alpha_)*cos(constant::mathematical::twoPi*t/m);
+
+    // Reset second half of window if symmetric
+    if (symmetric_)
+    {
+        label midPointI = 0;
+        if (nSamples % 2 == 0)
+        {
+            midPointI = nSamples/2;
+        }
+        else
+        {
+            midPointI = (nSamples + 1)/2;
+        }
+
+        for (label i = 0; i < midPointI; i++)
+        {
+            wf[nSamples - i - 1] = wf[i];
+        }
+    }
+
+    scalar sumSqr = sum(sqr(wf));
+
+    // Normalisation
+    wf *= sqrt(nSamples/sumSqr);
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Hanning::~Hanning()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+bool Hanning::symmetric() const
+{
+    return symmetric_;
+}
+
+
+bool Hanning::extended() const
+{
+    return extended_;
+}
+
+
+Foam::scalar Hanning::alpha() const
+{
+    return alpha_;
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace windowModels
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/randomProcesses/windowModels/Hanning/Hanning.H b/src/randomProcesses/windowModels/Hanning/Hanning.H
new file mode 100644
index 0000000000000000000000000000000000000000..5522e6a04d9121827948d9870ff6a54b67755a74
--- /dev/null
+++ b/src/randomProcesses/windowModels/Hanning/Hanning.H
@@ -0,0 +1,125 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::windowModels::Hanning
+
+Description
+    Hanning window
+
+    The window is described by the function
+    \f[
+        wf = (1 - \alpha) - \alpha cos(2 \pi t/m);
+    \f]
+
+    Where:
+    \vartable
+        \alpha  | Coefficient with a default value of 0.5
+        t       | time
+        m       | window width
+    \endvartable
+
+    The window can be further manipulated by the controls:
+    - \c symmetric: force the window to be symmetric
+    - \c extended: extend the window by 1 element at start and end to produce
+      non-zero values at the start and end positions.  Note: window is
+      normalised to preserve energy content
+
+SourceFiles
+    Hanning.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef Hanning_H
+#define Hanning_H
+
+#include "autoPtr.H"
+#include "runTimeSelectionTables.H"
+#include "windowModel.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace windowModels
+{
+
+/*---------------------------------------------------------------------------*\
+                           Class Hanning Declaration
+\*---------------------------------------------------------------------------*/
+
+class Hanning
+:
+    public windowModel
+{
+
+protected:
+
+    // Protected Member Data
+
+        //- Symmetric switch
+        bool symmetric_;
+
+        //- Extended switch
+        bool extended_;
+
+        //- Window coefficient, default = 0.5
+        scalar alpha_;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("Hanning");
+
+
+    //- Construct from dictionary
+    Hanning(const dictionary& dict, const label nSamples);
+
+    //- Destuctor
+    virtual ~Hanning();
+
+
+    // Public Member Functions
+
+        //- Return the symmetric flag
+        bool symmetric() const;
+
+        //- Return the extended flag
+        bool extended() const;
+
+        //- Return the window coefficient
+        scalar alpha() const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace windowModels
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/randomProcesses/windowModels/uniform/uniform.C b/src/randomProcesses/windowModels/uniform/uniform.C
new file mode 100644
index 0000000000000000000000000000000000000000..6bc75b31a8f93e79cabe4e4fac62ea8c7219e904
--- /dev/null
+++ b/src/randomProcesses/windowModels/uniform/uniform.C
@@ -0,0 +1,66 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "uniform.H"
+#include "addToRunTimeSelectionTable.H"
+#include "mathematicalConstants.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace windowModels
+{
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+defineTypeNameAndDebug(uniform, 0);
+addToRunTimeSelectionTable(windowModel, uniform, dictionary);
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+uniform::uniform(const dictionary& dict, const label nSamples)
+:
+    windowModel(dict, nSamples),
+    value_(readScalar(dict.lookup("value")))
+{
+    scalarField& wf = *this;
+    wf = value_;
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+uniform::~uniform()
+{}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace windowModels
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/randomProcesses/fft/fftRenumber.H b/src/randomProcesses/windowModels/uniform/uniform.H
similarity index 62%
rename from src/randomProcesses/fft/fftRenumber.H
rename to src/randomProcesses/windowModels/uniform/uniform.H
index fa2e50c58097f65caf1e3f9f84e029584694e87c..c422df79d35b2f944c324ed918eaeb26370a68d1 100644
--- a/src/randomProcesses/fft/fftRenumber.H
+++ b/src/randomProcesses/windowModels/uniform/uniform.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,57 +21,65 @@ License
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-Global
-    fftRenumber
+Class
+    Foam::windowModels::uniform
 
 Description
-    Multi-dimensional renumbering used in the Numerical Recipes
-    fft routine.
+    A window that applies uniform scaling.
 
 SourceFiles
-    fftRenumber.C
+    uniform.C
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef fftRenumber_H
-#define fftRenumber_H
+#ifndef uniform_H
+#define uniform_H
 
-#include "complex.H"
-#include "List.H"
-#include "labelList.H"
+#include "autoPtr.H"
+#include "runTimeSelectionTables.H"
+#include "windowModel.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
 {
+namespace windowModels
+{
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+/*---------------------------------------------------------------------------*\
+                           Class uniform Declaration
+\*---------------------------------------------------------------------------*/
+
+class uniform
+:
+    public windowModel
+{
+
+protected:
+
+    // Protected data
+
+        //- Uniform value
+        scalar value_;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("uniform");
+
+
+    //- Construct from dictionary
+    uniform(const dictionary& dict, const label nSamples);
 
-// Recursively evaluate the indexing necessary to do the folding of the fft
-// data. We recurse until we have the indexing ncessary for the folding in all
-// directions.
-void fftRenumberRecurse
-(
-    List<complex>& data,
-    List<complex>& renumData,
-    const labelList& nn,
-    label nnprod,
-    label ii,
-    label l1,
-    label l2
-);
-
-
-// Fold the n-d data array to get the fft components in the right places.
-void fftRenumber
-(
-    List<complex>& data,
-    const labelList& nn
-);
+    //- Destuctor
+    virtual ~uniform();
+};
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+} // End namespace windowModels
 } // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/randomProcesses/windowModels/windowModel/windowModel.C b/src/randomProcesses/windowModels/windowModel/windowModel.C
new file mode 100644
index 0000000000000000000000000000000000000000..dcaae9afd99318359f57808141545e1592be90b1
--- /dev/null
+++ b/src/randomProcesses/windowModels/windowModel/windowModel.C
@@ -0,0 +1,125 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015-2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "windowModel.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(windowModel, 0);
+    defineRunTimeSelectionTable(windowModel, dictionary);
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::windowModel::windowModel(const dictionary& dict, const label nSamples)
+:
+    scalarField(nSamples),
+    nOverlapSamples_(0),
+    nWindow_(dict.lookupOrDefault("nWindow", -1))
+{
+    scalar prc = readScalar(dict.lookup("overlapPercent"));
+    nOverlapSamples_ = floor(prc/scalar(100)*nSamples);
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::windowModel::~windowModel()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+Foam::label Foam::windowModel::nSamples() const
+{
+    return size();
+}
+
+
+Foam::label Foam::windowModel::nWindow() const
+{
+    return nWindow_;
+}
+
+
+Foam::label Foam::windowModel::nWindowsTotal(label nSamplesTotal) const
+{
+    const label nSamples = this->nSamples();
+
+    return floor((nSamplesTotal - nSamples)/(nSamples - nOverlapSamples_)) + 1;
+}
+
+
+Foam::label Foam::windowModel::validate(const label nSamplesTotal)
+{
+    label nSamples = this->nSamples();
+
+    if (nSamplesTotal < nSamples)
+    {
+        FatalErrorInFunction
+            << "Block size N = " << nSamples
+            << " is larger than total number of data points = " << nSamplesTotal
+            << exit(FatalError);
+    }
+
+    label nWindowAvailable = nWindowsTotal(nSamplesTotal);
+
+    if (nWindow_ == -1)
+    {
+        nWindow_ = nWindowAvailable;
+    }
+
+    if (nWindow_ > nWindowAvailable)
+    {
+        FatalErrorInFunction
+            << "Number of data points calculated with " << nWindow_
+            << " windows greater than the total number of data points"
+            << nl
+            << "    Block size, N = " << nSamples << nl
+            << "    Total number of data points = " << nSamplesTotal << nl
+            << "    Maximum number of windows = " << nWindowAvailable << nl
+            << "    Requested number of windows = " << nWindow_
+            << exit(FatalError);
+    }
+
+    label nRequiredSamples =
+        nWindow_*nSamples - (nWindow_ - 1)*nOverlapSamples_;
+
+    Info<< "Windowing:" << nl
+        << "    Total samples              : " << nSamplesTotal << nl
+        << "    Samples per window         : " << nSamples << nl
+        << "    Number of windows          : " << nWindow_ << nl
+        << "    Overlap size               : " << nOverlapSamples_ << nl
+        << "    Required number of samples : " << nRequiredSamples
+        << endl;
+
+    return nRequiredSamples;
+}
+
+
+// ************************************************************************* //
diff --git a/src/randomProcesses/windowModels/windowModel/windowModel.H b/src/randomProcesses/windowModels/windowModel/windowModel.H
new file mode 100644
index 0000000000000000000000000000000000000000..b9e1845fe0bc25e2f1f73f05ef077fdc92fc2425
--- /dev/null
+++ b/src/randomProcesses/windowModels/windowModel/windowModel.H
@@ -0,0 +1,143 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::windowModel
+
+Description
+    Base class for windowing models
+
+SourceFiles
+    noiseFFT.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef windowModel_H
+#define windowModel_H
+
+#include "autoPtr.H"
+#include "runTimeSelectionTables.H"
+#include "scalarField.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                         Class windowModel Declaration
+\*---------------------------------------------------------------------------*/
+
+class windowModel
+:
+    public scalarField
+{
+
+protected:
+
+    // Protected Data
+
+        //- Number of overlap samples per window
+        label nOverlapSamples_;
+
+        //- Number of windows
+        label nWindow_;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("windowModel");
+
+    // Declare runtime constructor selection table
+    declareRunTimeSelectionTable
+    (
+        autoPtr,
+        windowModel,
+        dictionary,
+        (
+            const dictionary& dict,
+            const label nSamples
+        ),
+        (dict, nSamples)
+    );
+
+
+    //- Construct from dictionary
+    windowModel(const dictionary& dict, const label nSamples);
+
+
+    // Selectors
+
+        //- Return a reference to the selected window model
+        static autoPtr<windowModel> New
+        (
+            const dictionary& dict,
+            const label nSamples
+        );
+
+
+    //- Destuctor
+    virtual ~windowModel();
+
+
+    // Public Member Functions
+
+        //- Return the number of samples in the window
+        label nSamples() const;
+
+        //- Return the number of windows
+        label nWindow() const;
+
+        //- Return the total number of windows for a given number of samples
+        label nWindowsTotal(label nSamplesTotal) const;
+
+        //- Validate that the window is applicable to the data set size, and
+        //  return the number of required data points
+        label validate(label n);
+
+        //- Return the windowed data
+        template<class Type>
+        tmp<Field<Type> > apply
+        (
+            const Field<Type>& fld,
+            const label windowI
+        ) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+    #include "windowModelTemplates.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/randomProcesses/windowModels/windowModel/windowModelNew.C b/src/randomProcesses/windowModels/windowModel/windowModelNew.C
new file mode 100644
index 0000000000000000000000000000000000000000..68aed5d766ed2c004587f0b737e020cde9cb2e62
--- /dev/null
+++ b/src/randomProcesses/windowModels/windowModel/windowModelNew.C
@@ -0,0 +1,63 @@
+#/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "windowModel.H"
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::autoPtr<Foam::windowModel> Foam::windowModel::New
+(
+    const dictionary& dict,
+    const label nSamples
+)
+{
+    const word modelType(dict.lookup("windowModel"));
+
+    Info<< "Selecting windowModel " << modelType << endl;
+
+    dictionaryConstructorTable::iterator cstrIter =
+        dictionaryConstructorTablePtr_->find(modelType);
+
+    if (cstrIter == dictionaryConstructorTablePtr_->end())
+    {
+        FatalErrorIn
+        (
+            "windowModel::New(const dictionary&, const label)"
+        )   << "Unknown windowModel type "
+            << modelType << nl << nl
+            << "Valid windowModel types are:" << nl
+            << dictionaryConstructorTablePtr_->sortedToc()
+            << exit(FatalError);
+    }
+
+    return autoPtr<windowModel>
+    (
+        cstrIter()(dict.subDict(modelType + "Coeffs"), nSamples)
+    );
+
+}
+
+
+// ************************************************************************* //
diff --git a/src/randomProcesses/windowModels/windowModel/windowModelTemplates.C b/src/randomProcesses/windowModels/windowModel/windowModelTemplates.C
new file mode 100644
index 0000000000000000000000000000000000000000..76f1241a8314f43a05dad315b303039bfd8765be
--- /dev/null
+++ b/src/randomProcesses/windowModels/windowModel/windowModelTemplates.C
@@ -0,0 +1,68 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015-2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+template<class Type>
+Foam::tmp<Foam::Field<Type> > Foam::windowModel::apply
+(
+    const Field<Type>& fld,
+    const label windowI
+) const
+{
+    label nSamples = this->nSamples();
+
+    if (nSamples > fld.size())
+    {
+        FatalErrorInFunction
+            << "Number of samples in sampling window is greater than the "
+            << "size of the input field" << nl
+            << "    input field size       = " << fld.size() << nl
+            << "    window size            = " << nSamples << nl
+            << "    requested window index = " << windowI
+            << exit(FatalError);
+    }
+
+
+    tmp<Field<Type> > tresult(new Field<Type>(nSamples, pTraits<Type>::zero));
+    Field<Type>& result = tresult.ref();
+
+    label nWindow = nWindowsTotal(fld.size());
+    if (windowI >= nWindow)
+    {
+        FatalErrorInFunction
+            << "Requested window " << windowI << " outside of range. "
+            << "Number of available windows is " << nWindow
+            << abort(FatalError);
+    }
+
+    label windowOffset = windowI*(nSamples - nOverlapSamples_);
+
+    const scalarField& wf = *this;
+    result = wf*SubField<Type>(fld, nSamples, windowOffset);
+
+    return tresult;
+}
+
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C
index af8bf5563a8f0e67e3477f36ba4011aa8c1b5cad..2d3535d873b36776f9fc0b0085591928aaee58ca 100644
--- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C
+++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C
@@ -335,6 +335,10 @@ void reactingOneDim::solveEnergy()
         hEqn += fvc::div(phiQr);
     }
 
+/* NOTE: The moving mesh option is only correct for reaction such as
+   Solid -> Gas, thus the ddt term is compesated exaclty by chemistrySh and
+   the mesh flux is not necessary.
+   
     if (regionMesh().moving())
     {
         surfaceScalarField phihMesh
@@ -344,7 +348,7 @@ void reactingOneDim::solveEnergy()
 
         hEqn -= fvc::div(phihMesh);
     }
-
+*/
     hEqn.relax();
     hEqn.solve();
 }
diff --git a/src/rigidBodyDynamics/bodies/compositeBody/compositeBody.H b/src/rigidBodyDynamics/bodies/compositeBody/compositeBody.H
index 662ed39e8ae9991993d298fdcd8a41a1c9b71deb..0d7a353d949f93e569f7e0a84ba701b39b544c63 100644
--- a/src/rigidBodyDynamics/bodies/compositeBody/compositeBody.H
+++ b/src/rigidBodyDynamics/bodies/compositeBody/compositeBody.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::compositeBody
 
+Group
+    grpRigidBodyDynamicsBodies
+
 Description
     This specialized rigidBody holds the original body after it has been merged
     into a parent.
diff --git a/src/rigidBodyDynamics/bodies/cuboid/cuboid.H b/src/rigidBodyDynamics/bodies/cuboid/cuboid.H
index 7432f7cbc0738a3f5006d6aaa89de1bb6bd9f066..348792db4adb9a6d259ac3533d1fcbae819f2b48 100644
--- a/src/rigidBodyDynamics/bodies/cuboid/cuboid.H
+++ b/src/rigidBodyDynamics/bodies/cuboid/cuboid.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::cuboid
 
+Group
+    grpRigidBodyDynamicsBodies
+
 Description
     Specialization of rigidBody to construct a cuboid given the mass and
     lengths of the sides.
diff --git a/src/rigidBodyDynamics/bodies/jointBody/jointBody.H b/src/rigidBodyDynamics/bodies/jointBody/jointBody.H
index 1784de009db94ff2a0144bbc7432bbffce88e422..a4b3d41894d39dda3a0ce97f2c9d17390fc8004d 100644
--- a/src/rigidBodyDynamics/bodies/jointBody/jointBody.H
+++ b/src/rigidBodyDynamics/bodies/jointBody/jointBody.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::jointBody
 
+Group
+    grpRigidBodyDynamicsBodies
+
 Description
 
 SourceFiles
diff --git a/src/rigidBodyDynamics/bodies/masslessBody/masslessBody.H b/src/rigidBodyDynamics/bodies/masslessBody/masslessBody.H
index a29585e3f6b0ec0673692cf585c1be1b17bb62e8..0375a54684221fe2ee353e54715b17a2935d46e6 100644
--- a/src/rigidBodyDynamics/bodies/masslessBody/masslessBody.H
+++ b/src/rigidBodyDynamics/bodies/masslessBody/masslessBody.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::masslessBody
 
+Group
+    grpRigidBodyDynamicsBodies
+
 Description
 
 SourceFiles
diff --git a/src/rigidBodyDynamics/bodies/rigidBody/rigidBody.H b/src/rigidBodyDynamics/bodies/rigidBody/rigidBody.H
index 2c8679b1e42bf964f757b6477f4e32aaece25c18..6307234184f99c297c86ebf8e2f0aa59a32b7a15 100644
--- a/src/rigidBodyDynamics/bodies/rigidBody/rigidBody.H
+++ b/src/rigidBodyDynamics/bodies/rigidBody/rigidBody.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::rigidBody
 
+Group
+    grpRigidBodyDynamicsBodies
+
 Description
 
 SourceFiles
diff --git a/src/rigidBodyDynamics/bodies/sphere/sphere.H b/src/rigidBodyDynamics/bodies/sphere/sphere.H
index e3310f735d293a47dac349b47f73b127aa507870..7538f367c4cf0d3758b7c8fc25d8830406ed050a 100644
--- a/src/rigidBodyDynamics/bodies/sphere/sphere.H
+++ b/src/rigidBodyDynamics/bodies/sphere/sphere.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::sphere
 
+Group
+    grpRigidBodyDynamicsBodies
+
 Description
     Specialization of rigidBody to construct a sphere given the mass and radius.
 
diff --git a/src/rigidBodyDynamics/bodies/subBody/subBody.H b/src/rigidBodyDynamics/bodies/subBody/subBody.H
index 0cd3f7c930dd721871b5db7e1381067b778f5cf5..c6a0bc220ee0cedf6cc3a11cfe3b45ec144be30e 100644
--- a/src/rigidBodyDynamics/bodies/subBody/subBody.H
+++ b/src/rigidBodyDynamics/bodies/subBody/subBody.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::subBody
 
+Group
+    grpRigidBodyDynamicsBodies
+
 Description
     This specialized rigidBody holds the original body after it has been merged
     into a master.
diff --git a/src/rigidBodyDynamics/doc/rigidBodyDynamicsDoc.H b/src/rigidBodyDynamics/doc/rigidBodyDynamicsDoc.H
new file mode 100644
index 0000000000000000000000000000000000000000..20f1db927bf92a0cc985df2b5573ee39b9df2efc
--- /dev/null
+++ b/src/rigidBodyDynamics/doc/rigidBodyDynamicsDoc.H
@@ -0,0 +1,50 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+\defgroup grpRigidBodyDynamics Rigid body dynamics
+@{
+    \ingroup grpMeshMotion
+    This group contains rigid body dynamics models.
+@}
+
+\defgroup grpRigidBodyDynamicsBodies Bodies
+@{
+    \ingroup grpRigidBodyDynamics
+    This group contains rigid body dynamics body models.
+@}
+
+\defgroup grpRigidBodyDynamicsJoints Joints
+@{
+    \ingroup grpRigidBodyDynamics
+    This group contains rigid body dynamics joint models.
+@}
+
+\defgroup grpRigidBodyDynamicsRestraints Restraints
+@{
+    \ingroup grpRigidBodyDynamics
+    This group contains rigid body dynamics restraint models.
+@}
+
+\*---------------------------------------------------------------------------*/
diff --git a/src/rigidBodyDynamics/joints/Pa/Pa.H b/src/rigidBodyDynamics/joints/Pa/Pa.H
index d67af31d9a9dd29e768a220c449c542b151cb475..7f02161422b929ae53fc4a6e5cf38d358ec95fe6 100644
--- a/src/rigidBodyDynamics/joints/Pa/Pa.H
+++ b/src/rigidBodyDynamics/joints/Pa/Pa.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::Pa
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Prismatic joint for translation along the specified arbitrary axis.
 
diff --git a/src/rigidBodyDynamics/joints/Px/Px.H b/src/rigidBodyDynamics/joints/Px/Px.H
index 979abcf5c001cc46662df4dbc6fbe4875dcf8e7c..dc03df42df1c0bc5cd6d98d87babbbe973d8606c 100644
--- a/src/rigidBodyDynamics/joints/Px/Px.H
+++ b/src/rigidBodyDynamics/joints/Px/Px.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::Px
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Prismatic joint for translation along the x-axis.
 
diff --git a/src/rigidBodyDynamics/joints/Pxyz/Pxyz.H b/src/rigidBodyDynamics/joints/Pxyz/Pxyz.H
index 02746bf14c740cdbe4e7a4e267b874f13fbab8d5..8f4a83cc02881f06095312c7cd2b9ffcb3f172f9 100644
--- a/src/rigidBodyDynamics/joints/Pxyz/Pxyz.H
+++ b/src/rigidBodyDynamics/joints/Pxyz/Pxyz.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::Pxyz
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Prismatic joint for translation in the x/y/z directions.
 
diff --git a/src/rigidBodyDynamics/joints/Py/Py.H b/src/rigidBodyDynamics/joints/Py/Py.H
index bcbcd47785e919c6567a691e86998e62cfb44a01..ed324124afea44bde021323c26a91ff41edb528a 100644
--- a/src/rigidBodyDynamics/joints/Py/Py.H
+++ b/src/rigidBodyDynamics/joints/Py/Py.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::Py
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Prismatic joint for translation along the y-axis.
 
diff --git a/src/rigidBodyDynamics/joints/Pz/Pz.H b/src/rigidBodyDynamics/joints/Pz/Pz.H
index 611397ded5dfd1f0ce5ae88093a510b558b803d4..bcb9d39df40859850474a3e9cf156d869fba93f8 100644
--- a/src/rigidBodyDynamics/joints/Pz/Pz.H
+++ b/src/rigidBodyDynamics/joints/Pz/Pz.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::Pz
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Prismatic joint for translation along the x-axis.
 
diff --git a/src/rigidBodyDynamics/joints/Ra/Ra.H b/src/rigidBodyDynamics/joints/Ra/Ra.H
index cd634f7b89ce4efe2acd0f2d64b84509f43f85e1..8a3d342edb484e6633b66046d1b037b2b7b985fd 100644
--- a/src/rigidBodyDynamics/joints/Ra/Ra.H
+++ b/src/rigidBodyDynamics/joints/Ra/Ra.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::Ra
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Revolute joint for rotation about the specified arbitrary axis.
 
diff --git a/src/rigidBodyDynamics/joints/Rs/Rs.H b/src/rigidBodyDynamics/joints/Rs/Rs.H
index f689869056c224c29652693912ca4f747ef11b11..7a0ae947c6610a5d964959c158710d1014dc34e1 100644
--- a/src/rigidBodyDynamics/joints/Rs/Rs.H
+++ b/src/rigidBodyDynamics/joints/Rs/Rs.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::Rs
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Spherical joint for rotation about the x/y/z-axes using a quaternion
     (Euler parameters) to avoid gimble-lock.
diff --git a/src/rigidBodyDynamics/joints/Rx/Rx.H b/src/rigidBodyDynamics/joints/Rx/Rx.H
index 892cfcb7099b4e4472afdd62f0c66c0b482a4381..c66667a5425a909c448ea789ddf2a0152fd7f244 100644
--- a/src/rigidBodyDynamics/joints/Rx/Rx.H
+++ b/src/rigidBodyDynamics/joints/Rx/Rx.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::Rx
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Revolute joint for rotation about the x-axis
 
diff --git a/src/rigidBodyDynamics/joints/Rxyz/Rxyz.H b/src/rigidBodyDynamics/joints/Rxyz/Rxyz.H
index 43582796dee2a3f71b2e1b4e21777bf267d42e75..9377f33046fc586e20d7e80e4a915b19ce0b19d1 100644
--- a/src/rigidBodyDynamics/joints/Rxyz/Rxyz.H
+++ b/src/rigidBodyDynamics/joints/Rxyz/Rxyz.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::Rxyz
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Spherical joint for rotation about the x/y/z-axes using Euler-angles
     in the order x, y, z.
diff --git a/src/rigidBodyDynamics/joints/Ry/Ry.H b/src/rigidBodyDynamics/joints/Ry/Ry.H
index 0a870bd9254dfd3fc44318dc908e5303b5578e7b..832fa26a2789139fecc3a4eec96deb4ea0be0da6 100644
--- a/src/rigidBodyDynamics/joints/Ry/Ry.H
+++ b/src/rigidBodyDynamics/joints/Ry/Ry.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::Ry
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Revolute joint for rotation about the y-axis
 
diff --git a/src/rigidBodyDynamics/joints/Ryxz/Ryxz.H b/src/rigidBodyDynamics/joints/Ryxz/Ryxz.H
index 1371abcf8000938232a8255b9aa8adf8f4e486a0..77a2761c19146a59b7db5e8c26105529f5f13e79 100644
--- a/src/rigidBodyDynamics/joints/Ryxz/Ryxz.H
+++ b/src/rigidBodyDynamics/joints/Ryxz/Ryxz.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::Ryxz
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Spherical joint for rotation about the x/y/z-axes using Euler-angles
     in the order y, x, z.
diff --git a/src/rigidBodyDynamics/joints/Rz/Rz.H b/src/rigidBodyDynamics/joints/Rz/Rz.H
index 01ed3139b0a05cc45ea629859fb14aeba1e977ed..d7c848671091c19f34a50ed930d9af710385e023 100644
--- a/src/rigidBodyDynamics/joints/Rz/Rz.H
+++ b/src/rigidBodyDynamics/joints/Rz/Rz.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::Rz
 
+Group
+    grpRigidBodyDynamicsJoints
+    
 Description
     Revolute joint for rotation about the z-axis
 
diff --git a/src/rigidBodyDynamics/joints/Rzyx/Rzyx.H b/src/rigidBodyDynamics/joints/Rzyx/Rzyx.H
index 3aeb85dd63780bcab0f05c9de0f115d977904ab7..9797904352e2fd590183116cf311012e68aece0e 100644
--- a/src/rigidBodyDynamics/joints/Rzyx/Rzyx.H
+++ b/src/rigidBodyDynamics/joints/Rzyx/Rzyx.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::Rzyx
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Spherical joint for rotation about the x/y/z-axes using Euler-angles
     in the order z, y, x.
diff --git a/src/rigidBodyDynamics/joints/composite/compositeJoint.H b/src/rigidBodyDynamics/joints/composite/compositeJoint.H
index 5d12bf5025d70be05943b4fdaa16d0d7a6b6f7c3..709b7abcb0a22abbaebca78897cf1b03c0a9842f 100644
--- a/src/rigidBodyDynamics/joints/composite/compositeJoint.H
+++ b/src/rigidBodyDynamics/joints/composite/compositeJoint.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::composite
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Prismatic joint for translation along the specified arbitrary axis.
 
diff --git a/src/rigidBodyDynamics/joints/floating/floatingJoint.H b/src/rigidBodyDynamics/joints/floating/floatingJoint.H
index 58c314d7840ad18e21540ba18276e485c64c56d0..785077755910b9adaaf0c73f94723e4b6a4d63af 100644
--- a/src/rigidBodyDynamics/joints/floating/floatingJoint.H
+++ b/src/rigidBodyDynamics/joints/floating/floatingJoint.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::floating
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Prismatic joint for translation along the specified arbitrary axis.
 
diff --git a/src/rigidBodyDynamics/joints/joint/joint.H b/src/rigidBodyDynamics/joints/joint/joint.H
index 0ea00b678bcd0699eaa16bd109caabcfd7ce40c2..10bdfc849539bceb030b03e8b1532e4feccd1083 100644
--- a/src/rigidBodyDynamics/joints/joint/joint.H
+++ b/src/rigidBodyDynamics/joints/joint/joint.H
@@ -24,6 +24,9 @@ License
 Namespace
     Foam::RBD::joints
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Namespace for rigid-body joints
 
diff --git a/src/rigidBodyDynamics/joints/null/nullJoint.H b/src/rigidBodyDynamics/joints/null/nullJoint.H
index cc97aed72bc7952f075174a1f9c820f14d6aae33..de3b1164af9f08da6a5fdc1615e99d04eeeedaf9 100644
--- a/src/rigidBodyDynamics/joints/null/nullJoint.H
+++ b/src/rigidBodyDynamics/joints/null/nullJoint.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::joints::null
 
+Group
+    grpRigidBodyDynamicsJoints
+
 Description
     Null joint for the root-body.
 
diff --git a/src/rigidBodyDynamics/restraints/linearAxialAngularSpring/linearAxialAngularSpring.H b/src/rigidBodyDynamics/restraints/linearAxialAngularSpring/linearAxialAngularSpring.H
index 66b34e0df79c621ffb3ef4d8bd17e266175a2916..4698baee707dd8b3bf7adab55427572d0fbf2d64 100644
--- a/src/rigidBodyDynamics/restraints/linearAxialAngularSpring/linearAxialAngularSpring.H
+++ b/src/rigidBodyDynamics/restraints/linearAxialAngularSpring/linearAxialAngularSpring.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::restraints::linearAxialAngularSpring
 
+Group
+    grpRigidBodyDynamicsRestraints
+
 Description
     Linear axial angular spring restraint.
 
diff --git a/src/rigidBodyDynamics/restraints/linearDamper/linearDamper.H b/src/rigidBodyDynamics/restraints/linearDamper/linearDamper.H
index c0a2c3728824cfd67570f1a5abeb1bb7841c2d20..b329dcb0de63cf07609553af4a38b1714014f503 100644
--- a/src/rigidBodyDynamics/restraints/linearDamper/linearDamper.H
+++ b/src/rigidBodyDynamics/restraints/linearDamper/linearDamper.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::restraints::linearDamper
 
+Group
+    grpRigidBodyDynamicsRestraints
+
 Description
     Linear damper restraint.  Operates in the local frame of the body.
 
diff --git a/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.H b/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.H
index b7a90f77d0049965bb28bc536c6d90871a6d7749..c522ffd3f838662b18a98471bed68949690fa2fe 100644
--- a/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.H
+++ b/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::restraints::linearSpring
 
+Group
+    grpRigidBodyDynamicsRestraints
+
 Description
     Linear spring restraint.
 
diff --git a/src/rigidBodyDynamics/restraints/sphericalAngularDamper/sphericalAngularDamper.H b/src/rigidBodyDynamics/restraints/sphericalAngularDamper/sphericalAngularDamper.H
index ccff2ff660863913966f7477b95ec12f00c9ef09..ae0f3356d17418323491a11fee17bbc091dc96ee 100644
--- a/src/rigidBodyDynamics/restraints/sphericalAngularDamper/sphericalAngularDamper.H
+++ b/src/rigidBodyDynamics/restraints/sphericalAngularDamper/sphericalAngularDamper.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::RBD::restraints::sphericalAngularDamper
 
+Group
+    grpRigidBodyDynamicsRestraints
+
 Description
     Spherical angular damper restraint.
     Operates in the local frame of the body.
diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotion.H b/src/rigidBodyMeshMotion/rigidBodyMeshMotion.H
index 35234268d915a39f02ff21288fcd45583301b5ce..1c7b6b8c0ed32d9399bb7179e15856e363b2a041 100644
--- a/src/rigidBodyMeshMotion/rigidBodyMeshMotion.H
+++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotion.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::rigidBodyMeshMotion
 
+Group
+    grpMeshMotionSolvers 
+
 Description
     Rigid-body mesh motion solver for fvMesh.
 
diff --git a/src/sampling/Make/files b/src/sampling/Make/files
index 03fab92a74e898b6c1c31c209660212c2b2c29a6..3416dd38d1a1f1222c48219be263940a412a4ef4 100644
--- a/src/sampling/Make/files
+++ b/src/sampling/Make/files
@@ -51,6 +51,12 @@ $(surfWriters)/starcd/starcdSurfaceWriter.C
 $(surfWriters)/vtk/vtkSurfaceWriter.C
 $(surfWriters)/boundaryData/boundaryDataSurfaceWriter.C
 
+surfReaders = sampledSurface/readers
+
+$(surfReaders)/surfaceReader.C
+$(surfReaders)/surfaceReaderNew.C
+$(surfReaders)/ensight/ensightSurfaceReader.C
+
 graphField/writePatchGraph.C
 graphField/writeCellGraph.C
 graphField/makeGraph.C
diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C
index 95940fdb53b98ad513f68b9e4c9d70857fca0c13..081422eaef0999b1b9da6f043de3f3951fadace9 100644
--- a/src/sampling/sampledSet/sampledSets/sampledSets.C
+++ b/src/sampling/sampledSet/sampledSets/sampledSets.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2015 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2015-2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -223,6 +223,10 @@ void Foam::sampledSets::write()
 
                 mkDir(outputPath_/mesh_.time().timeName());
             }
+            else
+            {
+                Info<< "No fields to sample" << endl;
+            }
         }
 
         if (nFields)
diff --git a/src/sampling/sampledSet/sampledSetsFunctionObject/sampledSetsDict b/src/sampling/sampledSet/sampledSetsFunctionObject/sampledSetsDict
index dc989e813cd69414b21883b9ae7703bab638fccd..66d32ea1eee7bf195f037f2637fb669b443392fe 100644
--- a/src/sampling/sampledSet/sampledSetsFunctionObject/sampledSetsDict
+++ b/src/sampling/sampledSet/sampledSetsFunctionObject/sampledSetsDict
@@ -1,7 +1,7 @@
 /*--------------------------------*- C++ -*----------------------------------*\
 | =========                 |                                                 |
 | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
+|  \\    /   O peration     | Version:  plus                                  |
 |   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
 |    \\/     M anipulation  |                                                 |
 \*---------------------------------------------------------------------------*/
diff --git a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.C b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.C
new file mode 100644
index 0000000000000000000000000000000000000000..f90d05b85db17e915ae3192a74921636365e5725
--- /dev/null
+++ b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.C
@@ -0,0 +1,553 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015-2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "ensightSurfaceReader.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(ensightSurfaceReader, 0);
+    addToRunTimeSelectionTable(surfaceReader, ensightSurfaceReader, fileName);
+}
+
+
+void Foam::ensightSurfaceReader::skip(const label n, Istream& is) const
+{
+    label i = 0;
+    token t;
+    while (is.good() && (i < n))
+    {
+        is >> t;
+        i++;
+
+        if (debug)
+        {
+            Info<< "Skipping token " << t << endl;
+        }
+    }
+
+    if (i != n)
+    {
+        WarningInFunction
+            << "Requested to skip " << n << "tokens, but stream exited after "
+            << i << " tokens. Last token read: " << t
+            << endl;
+    }
+}
+
+
+void Foam::ensightSurfaceReader::readLine(IFstream& is, string& buffer) const
+{
+    buffer = "";
+    while (is.good() && buffer == "")
+    {
+        is.getLine(buffer);
+    }
+}
+
+
+void Foam::ensightSurfaceReader::debugSection
+(
+    const word& expected,
+    IFstream& is
+) const
+{
+    string actual = "";
+    readLine(is, actual);
+
+    if (expected != actual)
+    {
+        FatalIOErrorInFunction(is)
+            << "Expected section header '" << expected
+            << "' but read the word '" << actual << "'"
+            << exit(FatalIOError);
+    }
+
+    if (debug)
+    {
+        Info<< "Read section header: " << expected << endl;
+    }
+}
+
+
+void Foam::ensightSurfaceReader::readGeometryHeader(ensightReadFile& is) const
+{
+    // Binary flag string if applicable
+    is.readBinaryHeader();
+
+    string buffer;
+
+    // Ensight Geometry File
+    is.read(buffer);
+    if (debug) Info<< "buffer: " << buffer << endl;
+
+    // Description - 1
+    is.read(buffer);
+    if (debug) Info<< "buffer: " << buffer << endl;
+
+    // Node info
+    is.read(buffer);
+    if (debug) Info<< "buffer: " << buffer << endl;
+
+    // Element info
+    is.read(buffer);
+    if (debug) Info<< "buffer: " << buffer << endl;
+
+    // Part
+    is.read(buffer);
+    if (debug) Info<< "buffer: " << buffer << endl;
+
+    // Part number
+    label ibuffer;
+    is.read(ibuffer);
+    if (debug) Info<< "ibuffer: " << ibuffer << endl;
+
+    // Description - 2
+    is.read(buffer);
+    if (debug) Info<< "buffer: " << buffer << endl;
+
+    // Co-ordinates
+    is.read(buffer);
+    if (debug) Info<< "buffer: " << buffer << endl;
+}
+
+
+void Foam::ensightSurfaceReader::readCase(IFstream& is)
+{
+    if (debug)
+    {
+        InfoInFunction<< endl;
+    }
+
+    if (!is.good())
+    {
+        FatalErrorInFunction
+            << "Cannot read file " << is.name()
+            << exit(FatalError);
+    }
+
+    string buffer;
+
+    // Read the file
+
+    debugSection("FORMAT", is);
+    readLine(is, buffer);  // type: ensight gold
+
+    debugSection("GEOMETRY", is);
+    readLine(is, buffer);
+    readFromLine(2, buffer, meshFileName_); // model: 1 xxx.0000.mesh
+
+    debugSection("VARIABLE", is);
+
+    // Read the field description
+    DynamicList<word> fieldNames(10);
+    DynamicList<string> fieldFileNames(10);
+    word fieldName;
+    string fieldFileName;
+    while (is.good())
+    {
+        readLine(is, buffer);
+
+        if (buffer == "TIME")
+        {
+            break;
+        }
+
+        IStringStream iss(buffer);
+
+        // Read the field name, e.g. p U etc
+        readFromLine(4, iss, fieldName);
+        fieldNames.append(fieldName);
+
+        // Field file name may contain /'s e.g.
+        //   surfaceName.****.fieldName
+        // This is not parser friendly - simply take remainder of buffer
+        label iPos = iss.stdStream().tellg();
+        fieldFileName = buffer(iPos, buffer.size() - iPos);
+        size_t p0  = fieldFileName.find_first_not_of(' ');
+        if (p0 == string::npos)
+        {
+            WarningInFunction
+                << "Error reading field file name. "
+                << "Current buffer: " << buffer
+                << endl;
+        }
+        else
+        {
+            size_t p1  = fieldFileName.find_last_not_of(' ');
+            fieldFileName = fieldFileName.substr(p0, p1 - p0 + 1);
+        }
+        fieldFileNames.append(fieldFileName);
+    }
+    fieldNames_.transfer(fieldNames);
+    fieldFileNames_.transfer(fieldFileNames);
+
+    if (debug)
+    {
+        Info<< "fieldNames: " << fieldNames_ << nl
+            << "fieldFileNames: " << fieldFileNames_ << endl;
+    }
+
+    // Start reading time information
+    readLine(is, buffer); // time set: 1
+
+    readLine(is, buffer);
+    readFromLine(3, buffer, nTimeSteps_);
+    readLine(is, buffer);
+    readFromLine(3, buffer, timeStartIndex_);
+    readLine(is, buffer);
+    readFromLine(2, buffer, timeIncrement_);
+
+    if (debug)
+    {
+        Info<< "nTimeSteps: " << nTimeSteps_ << nl
+            << "timeStartIndex: " << timeStartIndex_ << nl
+            << "timeIncrement: " << timeIncrement_ << endl;
+    }
+
+    // Read the time values
+    readLine(is, buffer); // time values:
+    timeValues_.setSize(nTimeSteps_);
+    for (label i = 0; i < nTimeSteps_; i++)
+    {
+        scalar t(readScalar(is));
+
+        timeValues_[i].value() = t;
+        // TODO: use character representation of t directly instead of
+        // regenerating from scalar value
+        timeValues_[i].name() = Foam::name(t);
+    }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::ensightSurfaceReader::ensightSurfaceReader(const fileName& fName)
+:
+    surfaceReader(fName),
+    streamFormat_(IOstream::ASCII),
+    baseDir_(fName.path()),
+    meshFileName_(),
+    fieldNames_(),
+    fieldFileNames_(),
+    nTimeSteps_(0),
+    timeStartIndex_(0),
+    timeIncrement_(1),
+    timeValues_(),
+    surfPtr_(NULL)
+{
+    IFstream is(fName);
+    readCase(is);
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::ensightSurfaceReader::~ensightSurfaceReader()
+{}
+
+
+// * * * * * * * * * * * * * Public Member Functions   * * * * * * * * * * * //
+
+const Foam::meshedSurface& Foam::ensightSurfaceReader::geometry()
+{
+    if (debug)
+    {
+        InfoInFunction<< endl;
+    }
+
+    if (!surfPtr_.valid())
+    {
+        IFstream isBinary(baseDir_/meshFileName_, IOstream::BINARY);
+
+        if (!isBinary.good())
+        {
+            FatalErrorInFunction
+                << "Cannot read file " << isBinary.name()
+                << exit(FatalError);
+        }
+
+        streamFormat_ = IOstream::BINARY;
+        {
+            istream& is = isBinary.stdStream();
+
+            char buffer[80];
+            is.read(buffer, 80);
+
+            char test[80];
+            label nChar = 0;
+            for (label i = 0; i < 80; ++i)
+            {
+                if (buffer[i] == '\0')
+                {
+                    break;
+                }
+                test[i] = buffer[i];
+                nChar++;
+            }
+
+            string testStr(test, nChar);
+
+            if
+            (
+                (testStr.find("binary", 0) == string::npos)
+             && (testStr.find("Binary", 0) == string::npos)
+            )
+            {
+                streamFormat_ = IOstream::ASCII;
+            }
+        }
+
+        if (debug)
+        {
+            Info<< "stream format: ";
+            if (streamFormat_ == IOstream::ASCII)
+            {
+                Info<< "ascii" << endl;
+            }
+            else
+            {
+                Info<< "binary" << endl;
+            }
+        }
+            
+
+        ensightReadFile is(baseDir_/meshFileName_, streamFormat_);
+
+        if (debug)
+        {
+            Info<< "File: " << is.name() << endl;
+        }
+
+        readGeometryHeader(is);
+        
+        label nPoints;
+        is.read(nPoints);
+
+        if (debug)
+        {
+            Info<< "nPoints: " << nPoints << endl;
+        }
+
+        pointField points(nPoints);
+        {
+            scalarField x(nPoints);
+            for (label dir = 0; dir < 3; dir++)
+            {
+                forAll(points, pointI)
+                {
+                    is.read(x[pointI]);
+                }
+
+                points.replace(dir, x);
+            }
+        }
+
+
+        // Read faces - may be a mix of tris, quads and polys
+        DynamicList<face> faces(ceil(nPoints/3));
+        DynamicList<Tuple2<string, label> > schema(faces.size());
+        string faceType = "";
+        label nFace = 0;
+        while (is.good()) // (is.peek() != EOF)
+        {
+            is.read(faceType);
+
+            if (!is.good())
+            {
+                break;
+            }
+
+            if (debug)
+            {
+                Info<< "faceType: " << faceType << endl;
+            }
+
+            if (faceType == "tria3")
+            {
+                is.read(nFace);
+
+                label np = 3;
+                for (label faceI = 0; faceI < nFace; ++faceI)
+                {
+                    face f(np);
+                    for (label fpI = 0; fpI < np; fpI++)
+                    {
+                        is.read(f[fpI]);
+                    }
+
+                    faces.append(f);
+                }
+            }
+            else if (faceType == "quad4")
+            {
+                is.read(nFace);
+
+                label np = 4;
+                for (label faceI = 0; faceI < nFace; ++faceI)
+                {
+                    face f(np);
+                    for (label fpI = 0; fpI < np; fpI++)
+                    {
+                        is.read(f[fpI]);
+                    }
+
+                    faces.append(f);
+                }
+            }
+            else if (faceType == "nsided")
+            {
+                is.read(nFace);
+
+                labelList np(nFace);
+                for (label faceI = 0; faceI < nFace; ++faceI)
+                {
+                    is.read(np[faceI]);
+                }
+                for (label faceI = 0; faceI < nFace; ++faceI)
+                {
+                    face f(np[faceI]);
+                    for (label fpI = 0; fpI < f.size(); ++fpI)
+                    {
+                        is.read(f[fpI]);
+                    }
+
+                    faces.append(f);
+                }
+            }
+            else
+            {
+                if (debug)
+                {
+                    WarningInFunction
+                        << "Unknown face type: " << faceType
+                        << ".  Aborting read and continuing with current "
+                        << "elements only" << endl;
+                }
+
+                break;
+            }
+            schema.append(Tuple2<string, label>(faceType, nFace));
+        }
+
+        schema_.transfer(schema);
+
+        if (debug)
+        {
+            Info<< "read nFaces: " << faces.size() << nl
+                << "file schema: " << schema_ << endl;
+        }
+
+        // Convert from 1-based Ensight addressing to 0-based OF addressing
+        forAll(faces, faceI)
+        {
+            face& f = faces[faceI];
+
+            forAll(f, fpI)
+            {
+                f[fpI]--;
+            }
+        }
+
+        surfPtr_.reset(new meshedSurface(xferMove(points), faces.xfer()));
+    }
+
+    return surfPtr_();
+}
+
+
+Foam::instantList Foam::ensightSurfaceReader::times() const
+{
+    return timeValues_;
+}
+
+
+Foam::wordList Foam::ensightSurfaceReader::fieldNames
+(
+    const label timeIndex
+) const
+{
+    return fieldNames_;
+}
+
+
+Foam::tmp<Foam::Field<Foam::scalar> > Foam::ensightSurfaceReader::field
+(
+    const label timeIndex,
+    const label fieldIndex,
+    const scalar& refValue
+) const
+{
+    return readField<scalar>(timeIndex, fieldIndex);
+}
+
+
+Foam::tmp<Foam::Field<Foam::vector> > Foam::ensightSurfaceReader::field
+(
+    const label timeIndex,
+    const label fieldIndex,
+    const vector& refValue
+) const
+{
+    return readField<vector>(timeIndex, fieldIndex);
+}
+
+
+Foam::tmp<Foam::Field<Foam::sphericalTensor> >
+Foam::ensightSurfaceReader::field
+(
+    const label timeIndex,
+    const label fieldIndex,
+    const sphericalTensor& refValue
+) const
+{
+    return readField<sphericalTensor>(timeIndex, fieldIndex);
+}
+
+
+Foam::tmp<Foam::Field<Foam::symmTensor> > Foam::ensightSurfaceReader::field
+(
+    const label timeIndex,
+    const label fieldIndex,
+    const symmTensor& refValue
+) const
+{
+    return readField<symmTensor>(timeIndex, fieldIndex);
+}
+
+
+Foam::tmp<Foam::Field<Foam::tensor> > Foam::ensightSurfaceReader::field
+(
+    const label timeIndex,
+    const label fieldIndex,
+    const tensor& refValue
+) const
+{
+    return readField<tensor>(timeIndex, fieldIndex);
+}
+
+
+// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.H b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.H
new file mode 100644
index 0000000000000000000000000000000000000000..0ba7e1c49b7ef30f84ad003c72a6c5c5b1e79eb8
--- /dev/null
+++ b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReader.H
@@ -0,0 +1,218 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015-2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::ensightensightSurfaceReader
+
+Description
+    Ensight format surface reader
+
+SourceFiles
+    ensightSurfaceReader.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef ensightSurfaceReader_H
+#define ensightSurfaceReader_H
+
+#include "surfaceReader.H"
+#include "ensightReadFile.H"
+#include "Tuple2.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                    Class ensightSurfaceReader Declaration
+\*---------------------------------------------------------------------------*/
+
+class ensightSurfaceReader
+:
+    public surfaceReader
+{
+protected:
+
+    // Protected Data
+
+        //- Format flag
+        IOstream::streamFormat streamFormat_;
+
+        //- Base directory
+        fileName baseDir_;
+
+        //- Name of mesh file
+        word meshFileName_;
+
+        //- Field names
+        List<word> fieldNames_;
+
+        //- Field file names
+        List<string> fieldFileNames_;
+
+        //- Number of time steps
+        label nTimeSteps_;
+
+        //- Start time index
+        label timeStartIndex_;
+
+        //- Time increment
+        label timeIncrement_;
+
+        //- Times
+        instantList timeValues_;
+
+        //- Pointer to the surface
+        autoPtr<meshedSurface> surfPtr_;
+
+        List<Tuple2<string, label> > schema_;
+
+
+    // Protected Member Functions
+
+        //- Helper function to skip forward n steps in stream
+        void skip(const label n, Istream& is) const;
+
+        //- Helper function to read an ascii line from file
+        void readLine(IFstream& is, string& buffer) const;
+
+        //- Read and check a section header
+        void debugSection(const word& expected, IFstream& is) const;
+
+        //- Read (and throw away) geometry file header
+        void readGeometryHeader(ensightReadFile& is) const;
+
+        //- Read the case file
+        void readCase(IFstream& is);
+
+        //- Helper function to return Type after skipping n tokens
+        template<class Type>
+        void readFromLine
+        (
+            const label nSkip,
+            IStringStream& is,
+            Type& value
+        ) const;
+
+        //- Helper function to return Type after skipping n tokens
+        template<class Type>
+        void readFromLine
+        (
+            const label nSkip,
+            const string& buffer,
+            Type& value
+        ) const;
+
+        //- Helper function to return a field
+        template<class Type>
+        tmp<Field<Type> > readField
+        (
+            const label timeIndex,
+            const label fieldIndex
+        ) const;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("ensight");
+
+    // Constructors
+
+        //- Construct from fileName
+        ensightSurfaceReader(const fileName& fName);
+
+
+    //- Destructor
+    virtual ~ensightSurfaceReader();
+
+
+    // Member Functions
+
+        //- Return a reference to the surface geometry
+        virtual const meshedSurface& geometry();
+
+        //- Return a list of the available times
+        virtual instantList times() const;
+
+        //- Return a list of the available fields at a given time
+        virtual wordList fieldNames(const label timeIndex) const;
+
+        //- Return a scalar field at a given time
+        virtual tmp<Field<scalar> > field
+        (
+            const label timeIndex,
+            const label fieldIndex,
+            const scalar& refValue = pTraits<scalar>::zero
+        ) const;
+
+        //- Return a scalar field at a given time
+        virtual tmp<Field<vector> > field
+        (
+            const label timeIndex,
+            const label fieldIndex,
+            const vector& refValue = pTraits<vector>::zero
+        ) const;
+
+        //- Return a sphericalTensor field at a given time
+        virtual tmp<Field<sphericalTensor> > field
+        (
+            const label timeIndex,
+            const label fieldIndex,
+            const sphericalTensor& reValue = pTraits<sphericalTensor>::zero
+        ) const;
+
+        //- Return a symmTensor field at a given time
+        virtual tmp<Field<symmTensor> > field
+        (
+            const label timeIndex,
+            const label fieldIndex,
+            const symmTensor& reValue = pTraits<symmTensor>::zero
+        ) const;
+
+        //- Return a tensor field at a given time
+        virtual tmp<Field<tensor> > field
+        (
+            const label timeIndex,
+            const label fieldIndex,
+            const tensor& reValue = pTraits<tensor>::zero
+        ) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+    #include "ensightSurfaceReaderTemplates.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReaderTemplates.C b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReaderTemplates.C
new file mode 100644
index 0000000000000000000000000000000000000000..dace0703200ddf109ead4409c642943feef53db2
--- /dev/null
+++ b/src/sampling/sampledSurface/readers/ensight/ensightSurfaceReaderTemplates.C
@@ -0,0 +1,185 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015-2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include <iomanip>
+#include <sstream>
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+template<class Type>
+void Foam::ensightSurfaceReader::readFromLine
+(
+    const label nSkip,
+    IStringStream& is,
+    Type& value
+) const
+{
+    skip(nSkip, is);
+
+    is  >> value;
+}
+
+
+template<class Type>
+void Foam::ensightSurfaceReader::readFromLine
+(
+    const label nSkip,
+    const string& buffer,
+    Type& value
+) const
+{
+    IStringStream is(buffer);
+
+    readFromLine(nSkip, is, value);
+}
+
+
+template<class Type>
+Foam::tmp<Foam::Field<Type> > Foam::ensightSurfaceReader::readField
+(
+    const label timeIndex,
+    const label fieldIndex
+) const
+{
+    if (debug)
+    {
+        InfoInFunction<< endl;
+    }
+
+    const word& fieldName(fieldNames_[fieldIndex]);
+    const label fileIndex = timeStartIndex_ + timeIndex*timeIncrement_;
+
+    fileName fieldFileName(fieldFileNames_[fieldIndex]);
+
+    std::ostringstream oss;
+    label nMask = 0;
+    for (size_t chari = 0; chari < fieldFileName.size(); chari++)
+    {
+        if (fieldFileName[chari] == '*')
+        {
+            nMask++;
+        }
+    }
+
+    const std::string maskStr(nMask, '*');
+    oss << std::setfill('0') << std::setw(nMask) << fileIndex;
+    const word indexStr = oss.str();
+    fieldFileName.replace(maskStr, indexStr);
+
+    
+    ensightReadFile is(baseDir_/fieldFileName, streamFormat_);
+
+    if (!is.good())
+    {
+        FatalErrorInFunction
+            << "Cannot read file " << is.name()
+            << " for field " << fieldName
+            << exit(FatalError);
+    }
+
+    // Check that data type is as expected
+    string primitiveType;
+    is.read(primitiveType);
+    
+
+    if (debug)
+    {
+        Info<< "primitiveType: " << primitiveType << endl;
+    }
+
+    if (primitiveType != pTraits<Type>::typeName)
+    {
+        FatalIOErrorInFunction(is)
+            << "Expected " << pTraits<Type>::typeName << "values "
+            << "but found type " << primitiveType
+            << exit(FatalIOError);
+    }
+
+    scalar value;
+    string strValue;
+    label iValue;
+
+    // Read header info: part index, e.g. part 1
+    is.read(strValue);
+    is.read(iValue);
+
+    // Allocate storage for data as a list per component
+    List<DynamicList<scalar> > values(pTraits<Type>::nComponents);
+    label n = surfPtr_->size();
+    forAll(values, cmptI)
+    {
+        values.setSize(n);
+    }
+
+    // Read data file using schema generated while reading the surface
+    forAll(schema_, i)
+    {
+        if (debug)
+        {
+            const string& faceType = schema_[i].first();
+            Info<< "Reading face type " << faceType << " data" << endl;
+        }
+
+        const label nFace = schema_[i].second();
+
+        if (nFace != 0)
+        {
+            is.read(strValue);
+
+            for
+            (
+                direction cmptI=0;
+                cmptI < pTraits<Type>::nComponents;
+                ++cmptI
+            )
+            {
+                for (label faceI = 0; faceI < nFace; ++faceI)
+                {
+                    is.read(value);
+                    values[cmptI].append(value);
+                }
+            }
+        }
+    }
+
+    tmp<Field<Type> > tField(new Field<Type>(n, pTraits<Type>::zero));
+    Field<Type>& field = tField.ref();
+
+    for
+    (
+        direction cmptI=0;
+        cmptI < pTraits<Type>::nComponents;
+        ++cmptI
+    )
+    {
+        field.replace(cmptI, values[cmptI]);
+        values[cmptI].clear();
+    }
+
+    return tField;
+}
+
+
+// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/readers/surfaceReader.C b/src/sampling/sampledSurface/readers/surfaceReader.C
new file mode 100644
index 0000000000000000000000000000000000000000..fb90c1d80fe2049d87d1406ef8fc8fe35eb63c67
--- /dev/null
+++ b/src/sampling/sampledSurface/readers/surfaceReader.C
@@ -0,0 +1,51 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "surfaceReader.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(surfaceReader, 0);
+    defineRunTimeSelectionTable(surfaceReader, fileName);
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::surfaceReader::surfaceReader(const fileName& fName)
+:
+    fileName_(fName)
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::surfaceReader::~surfaceReader()
+{}
+
+
+// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/readers/surfaceReader.H b/src/sampling/sampledSurface/readers/surfaceReader.H
new file mode 100644
index 0000000000000000000000000000000000000000..2ccdc470de4b8de5c9f24ccee27a32fd90ba858e
--- /dev/null
+++ b/src/sampling/sampledSurface/readers/surfaceReader.H
@@ -0,0 +1,161 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::surfaceReader
+
+Description
+    Base class for surface readers
+
+SourceFiles
+    surfaceReader.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef surfaceReader_H
+#define surfaceReader_H
+
+#include "typeInfo.H"
+#include "autoPtr.H"
+#include "MeshedSurfaces.H"
+#include "runTimeSelectionTables.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                        Class surfaceReader Declaration
+\*---------------------------------------------------------------------------*/
+
+class surfaceReader
+{
+protected:
+
+    //- File name
+    fileName fileName_;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("surfaceReader");
+
+    // Declare run-time constructor selection table
+
+        declareRunTimeSelectionTable
+        (
+            autoPtr,
+            surfaceReader,
+            fileName,
+            (
+                const fileName& fName
+            ),
+            (fName)
+        );
+
+
+    // Selectors
+
+        //- Return a reference to the selected surfaceReader
+        static autoPtr<surfaceReader> New
+        (
+            const word& readType,
+            const fileName& fName
+        );
+
+
+    // Constructors
+
+        //- Construct from fileName
+        surfaceReader(const fileName& fName);
+
+
+    //- Destructor
+    virtual ~surfaceReader();
+
+
+    // Member Functions
+
+        //- Return a reference to the surface geometry
+        virtual const meshedSurface& geometry() = 0;
+
+        //- Return a list of the available times
+        virtual instantList times() const = 0;
+
+        //- Return a list of the available fields at a given time
+        virtual wordList fieldNames(const label timeIndex) const = 0;
+
+        //- Return a scalar field at a given time
+        virtual tmp<Field<scalar> > field
+        (
+            const label timeIndex,
+            const label fieldIndex,
+            const scalar& refValue = pTraits<scalar>::zero
+        ) const = 0;
+
+        //- Return a vector field at a given time
+        virtual tmp<Field<vector> > field
+        (
+            const label timeIndex,
+            const label fieldIndex,
+            const vector& refValue = pTraits<vector>::zero
+        ) const = 0;
+
+        //- Return a sphericalTensor field at a given time
+        virtual tmp<Field<sphericalTensor> > field
+        (
+            const label timeIndex,
+            const label fieldIndex,
+            const sphericalTensor& reValue = pTraits<sphericalTensor>::zero
+        ) const = 0;
+
+        //- Return a symmTensor field at a given time
+        virtual tmp<Field<symmTensor> > field
+        (
+            const label timeIndex,
+            const label fieldIndex,
+            const symmTensor& reValue = pTraits<symmTensor>::zero
+        ) const = 0;
+
+        //- Return a tensor field at a given time
+        virtual tmp<Field<tensor> > field
+        (
+            const label timeIndex,
+            const label fieldIndex,
+            const tensor& reValue = pTraits<tensor>::zero
+        ) const = 0;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/readers/surfaceReaderNew.C b/src/sampling/sampledSurface/readers/surfaceReaderNew.C
new file mode 100644
index 0000000000000000000000000000000000000000..415179e2735db4020733ffa34c210ec051c30ecb
--- /dev/null
+++ b/src/sampling/sampledSurface/readers/surfaceReaderNew.C
@@ -0,0 +1,52 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2015-2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "surfaceReader.H"
+
+// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
+
+Foam::autoPtr<Foam::surfaceReader> Foam::surfaceReader::New
+(
+    const word& readerType,
+    const fileName& fName
+)
+{
+    fileNameConstructorTable::iterator cstrIter =
+        fileNameConstructorTablePtr_->find(readerType);
+
+    if (cstrIter == fileNameConstructorTablePtr_->end())
+    {
+        FatalErrorInFunction
+            << "Unknown reader type \"" << readerType << "\"\n\n"
+            << "Valid reader types: "
+            << fileNameConstructorTablePtr_->sortedToc() << nl
+            << exit(FatalError);
+    }
+
+    return autoPtr<surfaceReader>(cstrIter()(fName));
+}
+
+
+// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C
index e8c5589d7d4834cacc23d8399a0f49fe66d49c91..ac2457010d9d69cdb5e9a68dcdc5f7bd6b40a746 100644
--- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C
+++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2015 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2015-2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -42,14 +42,15 @@ Foam::ensightSurfaceWriter::ensightSurfaceWriter()
 :
     surfaceWriter(),
     writeFormat_(IOstream::ASCII),
-    collateTimes_(false)
+    collateTimes_(true)
 {}
 
 
 Foam::ensightSurfaceWriter::ensightSurfaceWriter(const dictionary& options)
 :
     surfaceWriter(),
-    writeFormat_(IOstream::ASCII)
+    writeFormat_(IOstream::ASCII),
+    collateTimes_(true)
 {
     // choose ascii or binary format
     if (options.found("format"))
@@ -68,6 +69,17 @@ Foam::ensightSurfaceWriter::~ensightSurfaceWriter()
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+// Note that ensight does supports geometry in a separate file,
+// but setting this true leaves mesh files in the wrong places
+// (when there are fields).
+//
+// Make this false to let the field writers take back control
+bool Foam::ensightSurfaceWriter::separateGeometry() const
+{
+    return false;
+}
+
+
 Foam::fileName Foam::ensightSurfaceWriter::write
 (
     const fileName& outputDir,
@@ -84,14 +96,13 @@ Foam::fileName Foam::ensightSurfaceWriter::write
         mkDir(outputDir);
     }
 
-    // const scalar timeValue = Foam::name(this->mesh().time().timeValue());
     const scalar timeValue = 0.0;
 
     OFstream osCase(outputDir/surfName + ".case");
     ensightGeoFile osGeom
     (
         outputDir,
-        surfName + ".0000.mesh",
+        surfName + ".00000000.mesh",
         writeFormat_
     );
 
@@ -113,7 +124,7 @@ Foam::fileName Foam::ensightSurfaceWriter::write
         << "filename start number:         0" << nl
         << "filename increment:            1" << nl
         << "time values:" << nl
-        << timeValue << nl
+        << "    " << timeValue << nl
         << nl;
 
     ensightPartFaces ensPart(0, osGeom.name().name(), points, faces, true);
diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H
index 67da74a19390c3dcb55d19d4196c88c8b629c392..9d5ff392b41f92fb7fab3ddc59e9b25a179a3c51 100644
--- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H
+++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2015 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2015-2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -52,9 +52,10 @@ class ensightSurfaceWriter
 {
     // Private data
 
-        //- Write option (default is IOstream::ASCII
+        //- Write option (default: IOstream::ASCII)
         IOstream::streamFormat writeFormat_;
 
+        //- Collate times (default: ASCII)
         bool collateTimes_;
 
 
@@ -126,10 +127,7 @@ public:
 
         //- True if the surface format supports geometry in a separate file.
         //  False if geometry and field must be in a single file
-        virtual bool separateGeometry() const
-        {
-            return !collateTimes_;
-        }
+        virtual bool separateGeometry() const;
 
 
         //- Write single surface geometry to file.
diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterTemplates.C b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterTemplates.C
index b564b5c8e596cda596d07fd293257ca120760d32..41c404deb6e96c53e5ae1f3f3098eb16b0295f41 100644
--- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterTemplates.C
+++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterTemplates.C
@@ -64,6 +64,7 @@ Foam::fileName Foam::ensightSurfaceWriter::writeUncollated
     // - VAR2/SURF1.0001.VAR2
 
     const fileName baseDir = outputDir/varName;
+    const fileName timeDir = outputDir.name();
 
     if (!isDir(baseDir))
     {
@@ -71,19 +72,19 @@ Foam::fileName Foam::ensightSurfaceWriter::writeUncollated
     }
 
     // const scalar timeValue = Foam::name(this->mesh().time().timeValue());
-    const scalar timeValue = 0.0;
+    const scalar timeValue = readScalar(IStringStream(timeDir)());
 
     OFstream osCase(baseDir/surfName + ".case");
     ensightGeoFile osGeom
     (
         baseDir,
-        surfName + ".0000.mesh",
+        surfName + ".00000000.mesh",
         writeFormat_
     );
     ensightFile osField
     (
         baseDir,
-        surfName + ".0000." + varName,
+        surfName + ".00000000." + varName,
         writeFormat_
     );
 
@@ -97,22 +98,23 @@ Foam::fileName Foam::ensightSurfaceWriter::writeUncollated
         << "type: ensight gold" << nl
         << nl
         << "GEOMETRY" << nl
-        << "model:        1     " << osGeom.name().name() << nl
+        << "model:  1   " << osGeom.name().name() << nl
         << nl
         << "VARIABLE" << nl
         << ensightPTraits<Type>::typeName << " per "
-        << word(isNodeValues ? "node:" : "element:") << setw(10) << 1
-        << "       " << varName
-        << "       " << surfName.c_str() << ".****." << varName << nl
+        << word(isNodeValues ? "node:" : "element:")
+        << setw(3) << 1
+        << setw(15) << varName
+        << "   " << surfName.c_str() << ".********." << varName << nl
         << nl
         << "TIME" << nl
-        << "time set:                      1" << nl
-        << "number of steps:               1" << nl
-        << "filename start number:         0" << nl
-        << "filename increment:            1" << nl
+        << "time set:               1" << nl
+        << "number of steps:        1" << nl
+        << "filename start number:  0" << nl
+        << "filename increment:     1" << nl
         << "time values:" << nl
-        << timeValue << nl
-        << nl;
+        << "    " << timeValue
+        << nl << nl << "# end" << nl;
 
     ensightPartFaces ensPart(0, osGeom.name().name(), points, faces, true);
     osGeom << ensPart;
@@ -145,13 +147,13 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
     // eg, something like this:
     // - SURF1/SURF1.case
     // - SURF1/SURF1.0000.mesh
-    // - SURF1/SURF1.0001.VAR1
-    // - SURF1/SURF1.0001.VAR2
+    // - SURF1/SURF1/data/0000/VAR1
+    // - SURF1/SURF1/data/0000/VAR2
     // and
     // - SURF2/SURF2.case
     // - SURF2/SURF2.0000.mesh
-    // - SURF2/SURF2.0001.VAR1
-    // - SURF2/SURF2.0001.VAR2
+    // - SURF2/SURF2/data/0000/VAR1
+    // - SURF2/SURF2/data/0000/VAR2
 
     const fileName baseDir = outputDir.path()/surfName;
     const fileName timeDir = outputDir.name();
@@ -162,11 +164,10 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
     }
 
     // surfName already validated
-    const fileName meshFile(baseDir/surfName + ".0000.mesh");
+    const fileName meshFile(baseDir/surfName + ".000000.mesh");
     const scalar timeValue = readScalar(IStringStream(timeDir)());
     label timeIndex = 0;
 
-
     // Do case file
     {
         dictionary dict;
@@ -235,9 +236,11 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
             {
                 Info<< "Writing state file to fieldsDict" << endl;
             }
-            OFstream os(baseDir/"fieldsDict");
-            os << dict;
-
+            {
+                OFstream os(baseDir/"fieldsDict");
+                os << "// summary of ensight times/fields" << nl << nl;
+                dict.write(os, false);
+            }
 
             OFstream osCase(baseDir/surfName + ".case");
 
@@ -251,7 +254,7 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
                 << "type: ensight gold" << nl
                 << nl
                 << "GEOMETRY" << nl
-                << "model:        1     " << meshFile.name() << nl
+                << "model:  1   " << meshFile.name() << nl
                 << nl
                 << "VARIABLE" << nl;
 
@@ -269,30 +272,32 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
                 osCase
                     << fieldType << " per "
                     << word(isNodeValues ? "node:" : "element:")
-                    << setw(10) << 1
+                    << setw(3)  << 1
                     << setw(15) << varName
-                    << "       " << surfName.c_str() << ".****." << varName
+                    << "   data/******/" << varName
                     << nl;
             }
             osCase << nl;
 
             osCase
                 << "TIME" << nl
-                << "time set:                      1" << nl
-                << "number of steps:               " << timeIndex+1 << nl
-                << "filename start number:         0" << nl
-                << "filename increment:            1" << nl
+                << "time set:               1" << nl
+                << "number of steps:        " << timeIndex+1 << nl
+                << "filename start number:  0" << nl
+                << "filename increment:     1" << nl
                 << "time values:" << nl;
+
+            label count = 0;
             forAll(times, timeI)
             {
-                osCase << setw(12) << times[timeI] << " ";
+                osCase << ' ' << setw(12) << times[timeI];
 
-                if (timeI != 0 && (timeI % 6) == 0)
+                if (++count % 6 == 0)
                 {
                     osCase << nl;
                 }
             }
-            osCase << nl;
+            osCase << nl << nl << "# end" << nl;
         }
     }
 
@@ -316,15 +321,20 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
     {
         OStringStream os;
         os.stdStream().fill('0');
-        os << setw(4) << timeIndex;
+        os << setw(6) << timeIndex;
         timeString = os.str();
     }
 
+    fileName dataDir = baseDir/"data"/timeString;
+
+    // as per mkdir -p "data/000000"
+    mkDir(dataDir);
+
     // Write field
     ensightFile osField
     (
-        baseDir,
-        surfName + "." + timeString + "." + varName,
+        dataDir,
+        varName,
         writeFormat_
     );
     if (verbose)
@@ -334,6 +344,14 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
     osField.writeKeyword(ensightPTraits<Type>::typeName);
     ensPart.writeField(osField, values, isNodeValues);
 
+    // place a timestamp in the directory for future reference
+    {
+        OFstream timeStamp(dataDir/"time");
+        timeStamp
+            << "#   timestep time" << nl
+            << dataDir.name() << " " << timeValue << nl;
+    }
+
     return baseDir/surfName + ".case";
 }
 
diff --git a/src/sixDoFRigidBodyMotion/doc/sixDofRigidBodyMotionDoc.H b/src/sixDoFRigidBodyMotion/doc/sixDofRigidBodyMotionDoc.H
new file mode 100644
index 0000000000000000000000000000000000000000..585cc5ccd8125864001a3f12ffde159235276f69
--- /dev/null
+++ b/src/sixDoFRigidBodyMotion/doc/sixDofRigidBodyMotionDoc.H
@@ -0,0 +1,50 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+\defgroup grpSixDoFRigidBody Six Degree of Freedom (DoF)
+@{
+    \ingroup grpMeshMotion
+    This group contains six DoF models.
+@}
+
+\defgroup grpSixDoFRigidBodySolvers Solvers
+@{
+    \ingroup grpSixDoFRigidBody
+    This group contains six DoF solvers.
+@}
+
+\defgroup grpSixDoFRigidBodyConstraints Constraints
+@{
+    \ingroup grpSixDoFRigidBody
+    This group contains six DoF Constraints.
+@}
+
+\defgroup grpSixDoFRigidBodyRestraints Restraints
+@{
+    \ingroup grpSixDoFRigidBody
+    This group contains six DoF Restraints.
+@}
+
+\*---------------------------------------------------------------------------*/
diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.H b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.H
index 2ad4921aaa961183ed9b1040a7da90fdde1c764f..1c9fd69fc7e323f1a8f8fb9f51b3675a19d0e860 100644
--- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.H
+++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::sixDoFRigidBodyMotionSolver
 
+Group
+   grpMeshMotionSolvers 
+
 Description
     6-DoF solid-body mesh motion solver for an fvMesh.
 
diff --git a/src/sixDoFRigidBodyMotion/sixDoFSolvers/CrankNicolson/CrankNicolson.H b/src/sixDoFRigidBodyMotion/sixDoFSolvers/CrankNicolson/CrankNicolson.H
index a8dd2ccbff3d5c11a7553b1f7475de82fd3bada8..e2f7ae82266efa59d9d32fa88b89079aa2d533f8 100644
--- a/src/sixDoFRigidBodyMotion/sixDoFSolvers/CrankNicolson/CrankNicolson.H
+++ b/src/sixDoFRigidBodyMotion/sixDoFSolvers/CrankNicolson/CrankNicolson.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::sixDoFSolvers::CrankNicolson
 
+Group
+    grpSixDoFRigidBodySolvers
+
 Description
     Crank-Nicolson 2nd-order time-integrator for 6DoF solid-body motion.
 
diff --git a/src/sixDoFRigidBodyMotion/sixDoFSolvers/Newmark/Newmark.H b/src/sixDoFRigidBodyMotion/sixDoFSolvers/Newmark/Newmark.H
index e605fcc294a3103afb4a4dafa633636ca622b577..d15bc2fcb1fa9d33729e042b630355a7534f5585 100644
--- a/src/sixDoFRigidBodyMotion/sixDoFSolvers/Newmark/Newmark.H
+++ b/src/sixDoFRigidBodyMotion/sixDoFSolvers/Newmark/Newmark.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::sixDoFSolvers::Newmark
 
+Group
+    grpSixDoFRigidBodySolvers
+
 Description
     Newmark 2nd-order time-integrator for 6DoF solid-body motion.
 
diff --git a/src/sixDoFRigidBodyMotion/sixDoFSolvers/sixDoFSolver/sixDoFSolver.H b/src/sixDoFRigidBodyMotion/sixDoFSolvers/sixDoFSolver/sixDoFSolver.H
index cb00660314a1be4042070224c4cc0aed1f75cfc1..a1e536f755ea4594f537abfa6e9839d472df032a 100644
--- a/src/sixDoFRigidBodyMotion/sixDoFSolvers/sixDoFSolver/sixDoFSolver.H
+++ b/src/sixDoFRigidBodyMotion/sixDoFSolvers/sixDoFSolver/sixDoFSolver.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::sixDoFSolver
 
+Group
+    grpSixDoFRigidBodySolvers
+
 Description
 
 SourceFiles
diff --git a/src/sixDoFRigidBodyMotion/sixDoFSolvers/symplectic/symplectic.H b/src/sixDoFRigidBodyMotion/sixDoFSolvers/symplectic/symplectic.H
index d03b77bbd59593ea9e914fa828caba5dc2a40a30..3aac7c7e1822fc09bdf7eaee545f3d86f84db61c 100644
--- a/src/sixDoFRigidBodyMotion/sixDoFSolvers/symplectic/symplectic.H
+++ b/src/sixDoFRigidBodyMotion/sixDoFSolvers/symplectic/symplectic.H
@@ -24,6 +24,9 @@ License
 Class
     Foam::sixDoFSolvers::symplectic
 
+Group
+    grpSixDoFRigidBodySolvers
+
 Description
     Symplectic 2nd-order explicit time-integrator for 6DoF solid-body motion.
 
diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.C b/src/surfMesh/MeshedSurface/MeshedSurface.C
index 6eebe1a080851fcf107dcad7d9b364a027e47645..aec8e446a53f09f11911a8532b776aa6d037e5f0 100644
--- a/src/surfMesh/MeshedSurface/MeshedSurface.C
+++ b/src/surfMesh/MeshedSurface/MeshedSurface.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -343,7 +343,10 @@ Foam::MeshedSurface<Face>::MeshedSurface
 
 
 template<class Face>
-Foam::MeshedSurface<Face>::MeshedSurface(const fileName& name)
+Foam::MeshedSurface<Face>::MeshedSurface
+(
+    const fileName& name
+)
 :
     ParentType(List<Face>(), pointField())
 {
@@ -351,6 +354,19 @@ Foam::MeshedSurface<Face>::MeshedSurface(const fileName& name)
 }
 
 
+template<class Face>
+Foam::MeshedSurface<Face>::MeshedSurface
+(
+    Istream& is
+)
+:
+    ParentType(List<Face>(), pointField()),
+    zones_()
+{
+    read(is);
+}
+
+
 template<class Face>
 Foam::MeshedSurface<Face>::MeshedSurface
 (
diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.H b/src/surfMesh/MeshedSurface/MeshedSurface.H
index e3d99ca9993ada566849671313c2e90a7efd8c2f..1362197d8c1c1c5c3d988e24718f57c1863ce5a6 100644
--- a/src/surfMesh/MeshedSurface/MeshedSurface.H
+++ b/src/surfMesh/MeshedSurface/MeshedSurface.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -69,11 +69,18 @@ namespace Foam
 class Time;
 class surfMesh;
 class polyBoundaryMesh;
+class Istream;
+class Ostream;
 
 template<class Face> class MeshedSurface;
 template<class Face> class MeshedSurfaceProxy;
 template<class Face> class UnsortedMeshedSurface;
 
+template<class Face>
+Istream& operator>>(Istream&, MeshedSurface<Face>&);
+template<class Face>
+Ostream& operator<<(Ostream&, const MeshedSurface<Face>&);
+
 /*---------------------------------------------------------------------------*\
                       Class MeshedSurface Declaration
 \*---------------------------------------------------------------------------*/
@@ -84,7 +91,7 @@ class MeshedSurface
     public PrimitivePatch<Face, ::Foam::List, pointField, point>,
     public fileFormats::surfaceFormatsCore
 {
-    // friends - despite different face representationsx
+    // friends - despite different face representations
     template<class Face2> friend class MeshedSurface;
     template<class Face2> friend class UnsortedMeshedSurface;
     friend class surfMesh;
@@ -114,6 +121,15 @@ private:
         List<surfZone> zones_;
 
 
+    // Private Member functions
+
+        //- Read/construct from Istream
+        Istream& read(Istream&);
+
+        //- Write to Ostream
+        Ostream& write(Ostream&) const;
+
+
 protected:
 
     // Protected Member functions
@@ -133,7 +149,7 @@ protected:
         //- Non-const access to the faces
         List<Face>& storedFaces()
         {
-            return static_cast<List<Face> &>(*this);
+            return static_cast<List<Face>&>(*this);
         }
 
         //- Non-const access to the zones
@@ -234,8 +250,15 @@ public:
         //- Construct from file name (uses extension to determine type)
         MeshedSurface(const fileName&, const word& ext);
 
+        //- Construct from Istream
+        MeshedSurface(Istream&);
+
         //- Construct from database
-        MeshedSurface(const Time&, const word& surfName="");
+        MeshedSurface
+        (
+            const Time&,
+            const word& surfName = word::null
+        );
 
 
     // Declare run-time constructor selection table
@@ -285,7 +308,11 @@ public:
         );
 
         //- Write to file
-        static void write(const fileName&, const MeshedSurface<Face>&);
+        static void write
+        (
+            const fileName&,
+            const MeshedSurface<Face>&
+        );
 
 
     // Member Functions
@@ -301,7 +328,7 @@ public:
             //- Return const access to the faces
             inline const List<Face>& faces() const
             {
-                return static_cast<const List<Face> &>(*this);
+                return static_cast<const List<Face>&>(*this);
             }
 
             //- Const access to the surface zones.
@@ -353,7 +380,7 @@ public:
             //  Note, optimized to avoid overwriting data (with Xfer::null)
             virtual void reset
             (
-                const Xfer<pointField >& points,
+                const Xfer<pointField>& points,
                 const Xfer<List<Face>>& faces,
                 const Xfer<surfZoneList>& zones
             );
@@ -364,7 +391,7 @@ public:
             (
                 const Xfer<List<point>>& points,
                 const Xfer<List<Face>>& faces,
-                const Xfer<surfZoneList >& zones
+                const Xfer<surfZoneList>& zones
             );
 
             //- Remove invalid faces
@@ -435,7 +462,11 @@ public:
             }
 
             //- Write to database
-            void write(const Time&, const word& surfName="") const;
+            void write
+            (
+                const Time&,
+                const word& surfName = word::null
+            ) const;
 
 
     // Member operators
@@ -444,6 +475,25 @@ public:
 
         //- Conversion operator to MeshedSurfaceProxy
         operator MeshedSurfaceProxy<Face>() const;
+
+
+    // IOstream Operators
+
+        //- Read MeshedSurface from Istream.
+        friend Istream& operator>> <Face>
+        (
+            Istream&,
+            MeshedSurface<Face>&
+        );
+
+
+        //- Write MeshedSurface to Ostream.
+        friend Ostream& operator<< <Face>
+        (
+            Ostream&,
+            const MeshedSurface<Face>&
+        );
+
 };
 
 
diff --git a/src/surfMesh/MeshedSurface/MeshedSurfaceCore.C b/src/surfMesh/MeshedSurface/MeshedSurfaceCore.C
index 9d579ee59016818198dbcf667f805464dcaa3ded..5e71aa5cbc0ad858f8b921dd72c393d4f8a47e38 100644
--- a/src/surfMesh/MeshedSurface/MeshedSurfaceCore.C
+++ b/src/surfMesh/MeshedSurface/MeshedSurfaceCore.C
@@ -66,12 +66,4 @@ namespace Foam
 }  // end of namespace Foam
 
 
-// * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
-
-
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
 // ************************************************************************* //
diff --git a/src/surfMesh/MeshedSurface/MeshedSurfaceIO.C b/src/surfMesh/MeshedSurface/MeshedSurfaceIO.C
index e968872b50545254c7f1dac09646660abc1b80a4..89204c063b852e033b7c7a940f82af18da09e740 100644
--- a/src/surfMesh/MeshedSurface/MeshedSurfaceIO.C
+++ b/src/surfMesh/MeshedSurface/MeshedSurfaceIO.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -25,10 +25,35 @@ License
 
 #include "MeshedSurface.H"
 #include "boundBox.H"
+#include "Istream.H"
 #include "Ostream.H"
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+template<class Face>
+Foam::Istream& Foam::MeshedSurface<Face>::read(Istream& is)
+{
+    is  >> this->storedZones()
+        >> this->storedPoints()
+        >> this->storedFaces();
+
+    is.check("MeshedSurface::read(Istream&)");
+    return is;
+}
+
+
+template<class Face>
+Foam::Ostream& Foam::MeshedSurface<Face>::write(Ostream& os) const
+{
+    os  << this->surfZones()
+        << this->points()
+        << this->faces();
+
+    os.check("MeshedSurface::write(Ostream&) const");
+    return os;
+}
+
+
 template<class Face>
 void Foam::MeshedSurface<Face>::writeStats(Ostream& os) const
 {
@@ -64,4 +89,28 @@ void Foam::MeshedSurface<Face>::writeStats(Ostream& os) const
 }
 
 
+// * * * * * * * * * * * * * * * IOstream Operators  * * * * * * * * * * * * //
+
+template<class Face>
+Foam::Istream& Foam::operator>>
+(
+    Foam::Istream& is,
+    Foam::MeshedSurface<Face>& surf
+)
+{
+    return surf.read(is);
+}
+
+
+template<class Face>
+Foam::Ostream& Foam::operator<<
+(
+    Foam::Ostream& os,
+    const Foam::MeshedSurface<Face>& surf
+)
+{
+    return surf.write(os);
+}
+
+
 // ************************************************************************* //
diff --git a/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H b/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H
index 4cc7264a4348cd1c0aecfc9978f3d8f138df9d81..9338f7dd68cc9f1619d2d5970ec0066cbef6a489 100644
--- a/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H
+++ b/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -128,7 +128,11 @@ public:
         );
 
         //- Write to file
-        static void write(const fileName&, const MeshedSurfaceProxy<Face>&);
+        static void write
+        (
+            const fileName&,
+            const MeshedSurfaceProxy<Face>&
+        );
 
 
     // Member Functions
@@ -176,7 +180,11 @@ public:
             }
 
             //- Write to database
-            virtual void write(const Time&, const word& surfName = "") const;
+            virtual void write
+            (
+                const Time&,
+                const word& surfName = word::null
+            ) const;
 };
 
 
diff --git a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C
index 10a973eb053477fc186556a8fe525fa20d7db865..11d1237e22b3208e42e7a6229804a7a82fdf089c 100644
--- a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C
+++ b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -263,7 +263,10 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
 
 
 template<class Face>
-Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface(const fileName& name)
+Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
+(
+    const fileName& name
+)
 :
     ParentType()
 {
@@ -271,6 +274,20 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface(const fileName& name)
 }
 
 
+template<class Face>
+Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
+(
+    Istream& is
+)
+:
+    ParentType(),
+    zoneIds_(),
+    zoneToc_()
+{
+    read(is);
+}
+
+
 template<class Face>
 Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
 (
@@ -422,6 +439,30 @@ void Foam::UnsortedMeshedSurface<Face>::remapFaces
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+template<class Face>
+Foam::Istream& Foam::UnsortedMeshedSurface<Face>::read(Istream& is)
+{
+    is  >> this->storedZoneIds()
+        >> this->storedPoints()
+        >> this->storedFaces();
+
+    is.check("UnsortedMeshedSurface::read(Istream&)");
+    return is;
+}
+
+
+template<class Face>
+Foam::Ostream& Foam::UnsortedMeshedSurface<Face>::write(Ostream& os) const
+{
+    os  << this->zoneIds()
+        << this->points()
+        << this->faces();
+
+    os.check("UnsortedMeshedSurface::write(Ostream&) const");
+    return os;
+}
+
+
 template<class Face>
 void Foam::UnsortedMeshedSurface<Face>::setSize(const label s)
 {
@@ -759,6 +800,30 @@ Foam::MeshedSurfaceProxy<Face>() const
 }
 
 
+// * * * * * * * * * * * * * * * IOstream Operators  * * * * * * * * * * * * //
+
+template<class Face>
+Foam::Istream& Foam::operator>>
+(
+    Foam::Istream& is,
+    Foam::UnsortedMeshedSurface<Face>& surf
+)
+{
+    return surf.read(is);
+}
+
+
+template<class Face>
+Foam::Ostream& Foam::operator<<
+(
+    Foam::Ostream& os,
+    const Foam::UnsortedMeshedSurface<Face>& surf
+)
+{
+    return surf.write(os);
+}
+
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 #include "UnsortedMeshedSurfaceNew.C"
diff --git a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H
index 52cbddd3bc2c2d82d2a00273d8abb7961bc1c006..443cf1f7bce90f28863b5711aa05e86c0a81df87 100644
--- a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H
+++ b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -62,12 +62,18 @@ namespace Foam
 // Forward declaration of friend functions and operators
 
 class Time;
-class IFstream;
+class Istream;
+class Ostream;
 
 template<class Face> class MeshedSurface;
 template<class Face> class MeshedSurfaceProxy;
 template<class Face> class UnsortedMeshedSurface;
 
+template<class Face>
+Istream& operator>>(Istream&, UnsortedMeshedSurface<Face>&);
+template<class Face>
+Ostream& operator<<(Ostream&, const UnsortedMeshedSurface<Face>&);
+
 /*---------------------------------------------------------------------------*\
                    Class UnsortedMeshedSurface Declaration
 \*---------------------------------------------------------------------------*/
@@ -77,7 +83,7 @@ class UnsortedMeshedSurface
 :
     public MeshedSurface<Face>
 {
-    // friends - despite different face representationsx
+    // friends - despite different face representations
     template<class Face2> friend class MeshedSurface;
     template<class Face2> friend class UnsortedMeshedSurface;
     friend class surfMesh;
@@ -104,11 +110,16 @@ private:
     // Private Member Functions
 
         //- Disable resize with value
-        void resize(const label, const Face&);
+        void resize(const label, const Face&) = delete;
 
         //- Disable setSize with value
-        void setSize(const label, const Face&);
+        void setSize(const label, const Face&) = delete;
 
+        //- Read/construct from Istream
+        Istream& read(Istream&);
+
+        //- Write to Ostream
+        Ostream& write(Ostream&) const;
 
 protected:
 
@@ -199,8 +210,15 @@ public:
         //- Construct from file name (uses extension to determine type)
         UnsortedMeshedSurface(const fileName&, const word&);
 
+        //- Construct from Istream
+        UnsortedMeshedSurface(Istream&);
+
         //- Construct from objectRegistry and a named surface
-        UnsortedMeshedSurface(const Time&, const word& surfName="");
+        UnsortedMeshedSurface
+        (
+            const Time&,
+            const word& surfName = word::null
+        );
 
 
     // Declare run-time constructor selection table
@@ -250,7 +268,11 @@ public:
         );
 
         //- Write to file
-        static void write(const fileName&, const UnsortedMeshedSurface<Face>&);
+        static void write
+        (
+            const fileName&,
+            const UnsortedMeshedSurface<Face>&
+        );
 
 
     // Member Functions
@@ -363,7 +385,11 @@ public:
             }
 
             //- Write to database
-            void write(const Time&, const word& surfName="") const;
+            void write
+            (
+                const Time&,
+                const word& surfName = word::null
+            ) const;
 
 
         // Member operators
@@ -372,6 +398,24 @@ public:
 
             //- Conversion operator to MeshedSurfaceProxy
             operator MeshedSurfaceProxy<Face>() const;
+
+
+    // IOstream Operators
+
+        //- Read UnsortedMeshedSurface from Istream.
+        friend Istream& operator>> <Face>
+        (
+            Istream&,
+            UnsortedMeshedSurface<Face>&
+        );
+
+
+        //- Write UnsortedMeshedSurface to Ostream.
+        friend Ostream& operator<< <Face>
+        (
+            Ostream&,
+            const UnsortedMeshedSurface<Face>&
+        );
 };
 
 
diff --git a/src/surfMesh/surfMesh/surfMesh.H b/src/surfMesh/surfMesh/surfMesh.H
index 538862680326b1f7bb3af81cdfba2b24367570e5..d8bbff5fe4f561822a2beaf420100a363209c392 100644
--- a/src/surfMesh/surfMesh/surfMesh.H
+++ b/src/surfMesh/surfMesh/surfMesh.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -98,10 +98,10 @@ private:
     // Private Member Functions
 
         //- Disallow construct as copy
-        surfMesh(const surfMesh&);
+        surfMesh(const surfMesh&) = delete;
 
         //- Disallow default bitwise assignment
-        void operator=(const surfMesh&);
+        void operator=(const surfMesh&) = delete;
 
 
 protected:
@@ -155,7 +155,11 @@ public:
     // Constructors
 
         //- Construct from IOobject, with alternative surface name
-        explicit surfMesh(const IOobject&, const word& surfName="");
+        explicit surfMesh
+        (
+            const IOobject&,
+            const word& surfName = word::null
+        );
 
         //- Construct by transferring components (points, faces) without zones.
         //  surfZones are added using addZones() member function
@@ -164,7 +168,7 @@ public:
             const IOobject&,
             const Xfer<pointField>&,
             const Xfer<faceList>&,
-            const word& surfName=""
+            const word& surfName = word::null
         );
 
         //- Construct copy/move from MeshedSurface
@@ -172,7 +176,7 @@ public:
         (
             const IOobject&,
             const Xfer<MeshedSurface<face>>& surf,
-            const word& surfName=""
+            const word& surfName = word::null
         );
 
 
diff --git a/src/surfMesh/surfZone/surfZone/surfZone.C b/src/surfMesh/surfZone/surfZone/surfZone.C
index faab2394569cb012e42f8a59fb8e774466a9f33f..2620f2b4fbf171e78d3908bc2aff5678e48bfe90 100644
--- a/src/surfMesh/surfZone/surfZone/surfZone.C
+++ b/src/surfMesh/surfZone/surfZone/surfZone.C
@@ -116,7 +116,7 @@ void Foam::surfZone::writeDict(Ostream& os) const
         << indent << token::BEGIN_BLOCK << incrIndent << nl;
 
     surfZoneIdentifier::write(os);
-    os.writeKeyword("nFaces") << size() << token::END_STATEMENT << nl;
+    os.writeKeyword("nFaces")    << size()  << token::END_STATEMENT << nl;
     os.writeKeyword("startFace") << start() << token::END_STATEMENT << nl;
 
     os  << decrIndent << indent << token::END_BLOCK << endl;
@@ -135,7 +135,7 @@ bool Foam::surfZone::operator==(const surfZone& rhs) const
 {
     return
     (
-        size() == rhs.size()
+        size()  == rhs.size()
      && start() == rhs.start()
      && geometricType() == rhs.geometricType()
     );
diff --git a/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.C b/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.C
index bf9322aac38a330b62963a90377941b576e4b6fa..049559865785f811a81f6c66ea1909fe0543f272 100644
--- a/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.C
+++ b/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -26,13 +26,26 @@ License
 #include "surfZoneIdentifier.H"
 #include "dictionary.H"
 
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+const Foam::word Foam::surfZoneIdentifier::emptyType = "empty";
+
+
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 Foam::surfZoneIdentifier::surfZoneIdentifier()
 :
-    name_(word::null),
+    name_(),
     index_(0),
-    geometricType_(word::null)
+    geometricType_()
+{}
+
+
+Foam::surfZoneIdentifier::surfZoneIdentifier(label index)
+:
+    name_(),
+    index_(index),
+    geometricType_()
 {}
 
 
@@ -57,7 +70,8 @@ Foam::surfZoneIdentifier::surfZoneIdentifier
 )
 :
     name_(name),
-    index_(index)
+    index_(index),
+    geometricType_()
 {
     dict.readIfPresent("geometricType", geometricType_);
 }
@@ -88,7 +102,8 @@ void Foam::surfZoneIdentifier::write(Ostream& os) const
 {
     if (geometricType_.size())
     {
-        os.writeKeyword("geometricType") << geometricType_
+        os.writeKeyword("geometricType")
+            << geometricType_
             << token::END_STATEMENT << nl;
     }
 }
@@ -96,41 +111,46 @@ void Foam::surfZoneIdentifier::write(Ostream& os) const
 
 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
 
-// bool Foam::surfZoneIdentifier::operator!=
-// (
-//     const surfZoneIdentifier& p
-// ) const
-// {
-//     return !(*this == p);
-// }
-//
-//
-// bool Foam::surfZoneIdentifier::operator==
-// (
-//     const surfZoneIdentifier& p
-// ) const
-// {
-//     return geometricType() == p.geometricType() && name() == p.name();
-// }
+// needed for list output
+
+bool Foam::surfZoneIdentifier::operator!=
+(
+    const surfZoneIdentifier& rhs
+) const
+{
+    return !(*this == rhs);
+}
+
+
+bool Foam::surfZoneIdentifier::operator==
+(
+    const surfZoneIdentifier& rhs
+) const
+{
+    return
+    (
+        name() == rhs.name()
+     && geometricType() == rhs.geometricType()
+    );
+}
 
 
 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
 
-// Foam::Istream& Foam::operator>>(Istream& is, surfZoneIdentifier& p)
-// {
-//     is >> p.name_ >> p.geometricType_;
-//
-//     return is;
-// }
+Foam::Istream& Foam::operator>>(Istream& is, surfZoneIdentifier& obj)
+{
+    is  >> obj.name_
+        >> obj.geometricType_;
+
+    return is;
+}
 
 
-Foam::Ostream& Foam::operator<<(Ostream& os, const surfZoneIdentifier& p)
+Foam::Ostream& Foam::operator<<(Ostream& os, const surfZoneIdentifier& obj)
 {
-    p.write(os);
-    os.check
-    (
-        "Ostream& operator<<(Ostream&, const surfZoneIdentifier&)"
-    );
+    os  << obj.name_ << ' ' << obj.geometricType_;
+
+    os.check("Ostream& operator<<(Ostream&, const surfZoneIdentifier&)");
     return os;
 }
 
diff --git a/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.H b/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.H
index c0687c157c3306b280965d1a3491bd7a56d1984f..3f6a1b9a7790a19dba9126616c744eae92e05b2c 100644
--- a/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.H
+++ b/src/surfMesh/surfZone/surfZoneIdentifier/surfZoneIdentifier.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -25,10 +25,10 @@ Class
     Foam::surfZoneIdentifier
 
 Description
-    An identifier for a surface zone on a meshed surface.
+    Identifies a surface patch/zone by name, patch index and geometricType.
 
-    Similar in concept to a faceZone on the surface, but can also have a
-    "geometricType" as well.
+SeeAlso
+    patchIdentifier
 
 SourceFiles
     surfZoneIdentifier.C
@@ -52,6 +52,7 @@ class dictionary;
 // Forward declaration of friend functions and operators
 
 class surfZoneIdentifier;
+Istream& operator>>(Istream&, surfZoneIdentifier&);
 Ostream& operator<<(Ostream&, const surfZoneIdentifier&);
 
 /*---------------------------------------------------------------------------*\
@@ -74,11 +75,23 @@ class surfZoneIdentifier
 
 public:
 
+    // Public data
+
+        //- The name for an 'empty' type
+        static const word emptyType;
+
+
     // Constructors
 
         //- Construct null
         surfZoneIdentifier();
 
+        //- Construct null with specified index
+        explicit surfZoneIdentifier
+        (
+            const label index
+        );
+
         //- Construct from components
         surfZoneIdentifier
         (
@@ -122,42 +135,57 @@ public:
             return name_;
         }
 
-        //- Return the geometric type of the zone
+        //- Return the geometric type of the patch/zone
         const word& geometricType() const
         {
             return geometricType_;
         }
 
-        //- Return the geometric type of the zone for modification
+        //- Return the geometric type of the patch/zone for modification
         word& geometricType()
         {
             return geometricType_;
         }
 
-        //- Return the index of this zone in the surface mesh
+        //- Return the index of this patch/zone in the surface mesh
         label index() const
         {
             return index_;
         }
 
-        //- Write surfZoneIdentifier as a dictionary
-        void write(Ostream&) const;
+        //- Return the index of this patch/zone for modification
+        label& index()
+        {
+            return index_;
+        }
+
 
         //- Write surfZoneIdentifier as a dictionary
-//        void writeDict(Ostream&) const;
+        void write(Ostream&) const;
 
 
     // Member Operators
 
-//        bool operator!=(const surfZoneIdentifier&) const;
-//
-//        //- compare.
-//        bool operator==(const surfZoneIdentifier&) const;
+        bool operator!=(const surfZoneIdentifier&) const;
+        bool operator==(const surfZoneIdentifier&) const;
+
 
     // Ostream Operator
 
-        friend Ostream& operator<<(Ostream&, const surfZoneIdentifier&);
-//        friend Istream& operator>>(Istream&, surfZoneIdentifier&);
+        //- Read name/type.
+        friend Istream& operator>>
+        (
+            Istream&,
+            surfZoneIdentifier&
+        );
+
+        //- Write name/type.
+        friend Ostream& operator<<
+        (
+            Ostream&,
+            const surfZoneIdentifier&
+        );
+
 };
 
 
diff --git a/src/surfMesh/surfaceRegistry/surfaceRegistry.H b/src/surfMesh/surfaceRegistry/surfaceRegistry.H
index a55bf46a1fe2787697c8f3cd9b158652d2673ee8..dd50c91244c0433279ecb6f3b6b7cbbab3eb16d7 100644
--- a/src/surfMesh/surfaceRegistry/surfaceRegistry.H
+++ b/src/surfMesh/surfaceRegistry/surfaceRegistry.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -54,10 +54,10 @@ class surfaceRegistry
     // Private Member Functions
 
         //- Disallow default bitwise copy construct
-        surfaceRegistry(const surfaceRegistry&);
+        surfaceRegistry(const surfaceRegistry&) = delete;
 
         //- Disallow default bitwise assignment
-        void operator=(const surfaceRegistry&);
+        void operator=(const surfaceRegistry&) = delete;
 
 
 public:
@@ -75,7 +75,11 @@ public:
     // Constructors
 
         //- Construct for the given objectRegistry and named surface
-        surfaceRegistry(const objectRegistry&, const word& surfName = "");
+        surfaceRegistry
+        (
+            const objectRegistry&,
+            const word& surfName = word::null
+        );
 
 
     //- Destructor
diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/doc/thermophysicalBoundaryConditionsDoc.H b/src/thermophysicalModels/basic/derivedFvPatchFields/doc/thermophysicalBoundaryConditionsDoc.H
index f7f9389b7188a11ba552920b52956128e8ec6369..787b9e7dbe96924e581f70199deecbc57ae1f36d 100644
--- a/src/thermophysicalModels/basic/derivedFvPatchFields/doc/thermophysicalBoundaryConditionsDoc.H
+++ b/src/thermophysicalModels/basic/derivedFvPatchFields/doc/thermophysicalBoundaryConditionsDoc.H
@@ -23,7 +23,7 @@ License
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-\defgroup grpThermoBoundaryConditions Thermophysical boundary conditions
+\defgroup grpThermoBoundaryConditions Thermophysical
 @{
     \ingroup grpBoundaryConditions
     This group contains thermophysical model boundary conditions
diff --git a/src/thermophysicalModels/doc/thermophysicalModels.dox b/src/thermophysicalModels/doc/thermophysicalModels.dox
index a8f7f48ae9b0a4e7ef2f12e63cb9622fc6608844..9df1640a0b9cbfca1b99841bc72db43411e15f09 100644
--- a/src/thermophysicalModels/doc/thermophysicalModels.dox
+++ b/src/thermophysicalModels/doc/thermophysicalModels.dox
@@ -23,7 +23,7 @@ License
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-\page pageThermophsyicalModels Thermophsyical Models
+\page pageThermophsyicalModels Thermophysical Models
 
 \section secSchemes Overview
 The available thermophysical models are grouped into the following categories:
diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C
index 8863b95ebe17de43cf3b3f6b24c96f2bb5a8a006..6843c685e43cf4dc001de8e3f327ea21f331e3ed 100644
--- a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C
+++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
diff --git a/src/thermophysicalModels/radiation/doc/radiationModelsDoc.H b/src/thermophysicalModels/radiation/doc/radiationModelsDoc.H
index e192421c2fe906bfcbd8cd40c1a7b8fc42a24dab..20b23cb22d26e0d2d923baa73f8bc64394418c9d 100644
--- a/src/thermophysicalModels/radiation/doc/radiationModelsDoc.H
+++ b/src/thermophysicalModels/radiation/doc/radiationModelsDoc.H
@@ -29,7 +29,7 @@ License
     This group contains radiation models
 @}
 
-\defgroup grpRadiationSubModels Radiation sub-models
+\defgroup grpRadiationSubModels Sub-models
 @{
     \ingroup grpRadiationModels
     This group contains radiation sub-models
diff --git a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C
index 6188b294681141baaa6d54e4d63da09d9afa5da9..d162635f342fae52b86acd23589b72f87530ee5a 100644
--- a/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C
+++ b/src/thermophysicalModels/radiation/radiationModels/solarLoad/faceShading/faceShading.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -62,9 +62,15 @@ void Foam::faceShading::writeRays
         vertI++;
         str << "l " << vertI-1 << ' ' << vertI << nl;
     }
-    string cmd("objToVTK " + fName + " " + fName.lessExt() + ".vtk");
-    Pout<< "cmd:" << cmd << endl;
-    system(cmd);
+    str.flush();
+
+    DynamicList<string> cmd(3);
+    cmd.append("objToVTK");
+    cmd.append(fName);
+    cmd.append(fName.lessExt() + ".vtk");
+
+    Pout<< "cmd: objToVTK " << fName.c_str() << endl;
+    Foam::system(cmd);
 }
 
 
diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C
index ade482077b9213da352402f63f62c780993ee910..10ece3bc459f685d5df733ecf8f957289ea7b5c3 100644
--- a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C
+++ b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2015 OpenCFD Ltd
+     \\/     M anipulation  | Copyright (C) 2015 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.H b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.H
index 077079bfb1133a40f627c43733a1ba06d3d8f902..4bd82c36b20b55525958b25adc698f8e014f4955 100644
--- a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.H
+++ b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2015 OpenCFD Ltd
+     \\/     M anipulation  | Copyright (C) 2015 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandSolidAbsorptionEmission/multiBandSolidAbsorptionEmission.C b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandSolidAbsorptionEmission/multiBandSolidAbsorptionEmission.C
index 31942309d9a0a809ada5f87442102a660a601434..c63354266ba4e9684ce2c6a4d888bd162c60f583 100644
--- a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandSolidAbsorptionEmission/multiBandSolidAbsorptionEmission.C
+++ b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandSolidAbsorptionEmission/multiBandSolidAbsorptionEmission.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandSolidAbsorptionEmission/multiBandSolidAbsorptionEmission.H b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandSolidAbsorptionEmission/multiBandSolidAbsorptionEmission.H
index 2c1797a1a08c2812a107ba64791264db00598207..52b5fed46f9a7c61339214c284b8ea7c2ba781f2 100644
--- a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandSolidAbsorptionEmission/multiBandSolidAbsorptionEmission.H
+++ b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandSolidAbsorptionEmission/multiBandSolidAbsorptionEmission.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationProperties.H b/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationProperties.H
index 39a7f156f9b1ebd4813c84e8717dbdc76159183f..86f253d215bf733ccc9b14e10cac23e396e7b7ae 100644
--- a/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationProperties.H
+++ b/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationProperties.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015-2016 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015-2016 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.H b/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.H
index a78b940bfe5afcf263864b7b53ba90299ae2e531..59ad9a4415a5b4af74df11d7b4f2da73f2942ff7 100644
--- a/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.H
+++ b/src/thermophysicalModels/radiation/submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C
index cc712b4cb244449767e46ea3ba70a1e80d5fd033..905194a91421400c14e8fb08d91173334041359c 100644
--- a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C
+++ b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.H b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.H
index 5c54294d967c71385271050754380ad213a1f4cb..dd83c23f94ff66229925c35dccb5244d35bf03f6 100644
--- a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.H
+++ b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/radiation/submodels/transmissivityModel/constantTransmissivity/constantTransmissivity.C b/src/thermophysicalModels/radiation/submodels/transmissivityModel/constantTransmissivity/constantTransmissivity.C
index a981883006e0ab6f3c478ec5354de52335d40a1d..7f056a115477e2f7de3b267b343574d78ddfd545 100644
--- a/src/thermophysicalModels/radiation/submodels/transmissivityModel/constantTransmissivity/constantTransmissivity.C
+++ b/src/thermophysicalModels/radiation/submodels/transmissivityModel/constantTransmissivity/constantTransmissivity.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/radiation/submodels/transmissivityModel/constantTransmissivity/constantTransmissivity.H b/src/thermophysicalModels/radiation/submodels/transmissivityModel/constantTransmissivity/constantTransmissivity.H
index f195f526c39ab91eb4a360690e536ae37a0e9ee3..44593c42ebe7a871099c59c519e1ccaa1515a342 100644
--- a/src/thermophysicalModels/radiation/submodels/transmissivityModel/constantTransmissivity/constantTransmissivity.H
+++ b/src/thermophysicalModels/radiation/submodels/transmissivityModel/constantTransmissivity/constantTransmissivity.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/radiation/submodels/transmissivityModel/multiBandSolidTransmissivity/multiBandSolidTransmissivity.C b/src/thermophysicalModels/radiation/submodels/transmissivityModel/multiBandSolidTransmissivity/multiBandSolidTransmissivity.C
index d39fa2e1d45df4e16d646bf33b2a876f36a84e80..1db1944b91964f48147d6a4e7d88d4a1a85f5004 100644
--- a/src/thermophysicalModels/radiation/submodels/transmissivityModel/multiBandSolidTransmissivity/multiBandSolidTransmissivity.C
+++ b/src/thermophysicalModels/radiation/submodels/transmissivityModel/multiBandSolidTransmissivity/multiBandSolidTransmissivity.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/radiation/submodels/transmissivityModel/multiBandSolidTransmissivity/multiBandSolidTransmissivity.H b/src/thermophysicalModels/radiation/submodels/transmissivityModel/multiBandSolidTransmissivity/multiBandSolidTransmissivity.H
index bae7831153fc6b7ddb54da77ad45b4e1ef6b2c24..9745accd9a099f2603c2e3edf850ca4f721ddc89 100644
--- a/src/thermophysicalModels/radiation/submodels/transmissivityModel/multiBandSolidTransmissivity/multiBandSolidTransmissivity.H
+++ b/src/thermophysicalModels/radiation/submodels/transmissivityModel/multiBandSolidTransmissivity/multiBandSolidTransmissivity.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/radiation/submodels/transmissivityModel/noTransmissivity/noTransmissivity.C b/src/thermophysicalModels/radiation/submodels/transmissivityModel/noTransmissivity/noTransmissivity.C
index 6d995d89f0263205fe719238aa29bac87e485a54..a76818e03e8d21077ba0813747978126696c4caf 100644
--- a/src/thermophysicalModels/radiation/submodels/transmissivityModel/noTransmissivity/noTransmissivity.C
+++ b/src/thermophysicalModels/radiation/submodels/transmissivityModel/noTransmissivity/noTransmissivity.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/radiation/submodels/transmissivityModel/noTransmissivity/noTransmissivity.H b/src/thermophysicalModels/radiation/submodels/transmissivityModel/noTransmissivity/noTransmissivity.H
index a48f4017ba3b46e25a27ac2868a6f7cd79753064..517bf43771bd34c5c1e840a9b382a10e0c958a1e 100644
--- a/src/thermophysicalModels/radiation/submodels/transmissivityModel/noTransmissivity/noTransmissivity.H
+++ b/src/thermophysicalModels/radiation/submodels/transmissivityModel/noTransmissivity/noTransmissivity.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/radiation/submodels/transmissivityModel/transmissivityModel/transmissivityModel.C b/src/thermophysicalModels/radiation/submodels/transmissivityModel/transmissivityModel/transmissivityModel.C
index ddd9226bf514f367dc3dd7332a0fdd57835b7e50..9d44749c5d3f12214a862484d1eae7c4eb17113b 100644
--- a/src/thermophysicalModels/radiation/submodels/transmissivityModel/transmissivityModel/transmissivityModel.C
+++ b/src/thermophysicalModels/radiation/submodels/transmissivityModel/transmissivityModel/transmissivityModel.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/radiation/submodels/transmissivityModel/transmissivityModel/transmissivityModel.H b/src/thermophysicalModels/radiation/submodels/transmissivityModel/transmissivityModel/transmissivityModel.H
index 46e9babc13ee62c19f0117f8bf52aea308f9e6a4..85ac96fe9715c9ecf8fcb1d1aab79e7e9a5a02c2 100644
--- a/src/thermophysicalModels/radiation/submodels/transmissivityModel/transmissivityModel/transmissivityModel.H
+++ b/src/thermophysicalModels/radiation/submodels/transmissivityModel/transmissivityModel/transmissivityModel.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/radiation/submodels/transmissivityModel/transmissivityModel/transmissivityModelNew.C b/src/thermophysicalModels/radiation/submodels/transmissivityModel/transmissivityModel/transmissivityModelNew.C
index d976fc0652eb0b88851dfae94c9f92dd9eb49b61..897895d7f3f7662d76ed828bd7d7d9a86bad11ae 100644
--- a/src/thermophysicalModels/radiation/submodels/transmissivityModel/transmissivityModel/transmissivityModelNew.C
+++ b/src/thermophysicalModels/radiation/submodels/transmissivityModel/transmissivityModel/transmissivityModelNew.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd
+    \\  /    A nd           | Copyright (C) 2015 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/triSurface/triSurface/triSurface.C b/src/triSurface/triSurface/triSurface.C
index 7946ae338ff33516b59c0c5f4c7947a92f00d233..5e5bf1feba9ae2ce5d586d7f5d258f6987a5dd4d 100644
--- a/src/triSurface/triSurface/triSurface.C
+++ b/src/triSurface/triSurface/triSurface.C
@@ -1108,6 +1108,15 @@ void Foam::triSurface::operator=(const triSurface& ts)
 
 // * * * * * * * * * * * * * * * IOstream Operators  * * * * * * * * * * * * //
 
+Foam::Istream& Foam::operator>>(Istream& is, triSurface& sm)
+{
+    sm.clearOut();
+    sm.read(is);
+    sm.setDefaultPatches();
+    return is;
+}
+
+
 Foam::Ostream& Foam::operator<<(Ostream& os, const triSurface& sm)
 {
     sm.write(os);
diff --git a/src/triSurface/triSurface/triSurface.H b/src/triSurface/triSurface/triSurface.H
index 1d8629f3606086b6cbe89414dbe225f5cce87304..527ab181d10182e4494355da9ba499c02e101c33 100644
--- a/src/triSurface/triSurface/triSurface.H
+++ b/src/triSurface/triSurface/triSurface.H
@@ -409,8 +409,9 @@ public:
         void operator=(const triSurface&);
 
 
-    // Ostream Operator
+    // IOstream Operators
 
+        friend Istream& operator>>(Istream&, triSurface&);
         friend Ostream& operator<<(Ostream&, const triSurface&);
 };
 
diff --git a/tutorials/DNS/dnsFoam/boxTurb16/Allrun b/tutorials/DNS/dnsFoam/boxTurb16/Allrun
index 26449db3a86ff39b2e88eb7d332687b7aa00fa7a..41bac4e87de0095b3b07b54443146decb4d6224f 100755
--- a/tutorials/DNS/dnsFoam/boxTurb16/Allrun
+++ b/tutorials/DNS/dnsFoam/boxTurb16/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Get application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication boxTurb
diff --git a/tutorials/basic/laplacianFoam/flange/Allrun b/tutorials/basic/laplacianFoam/flange/Allrun
index 89c210c48c76536bb44da5b7dd3e198d7c1795d9..91c4818b86203a7025ee9eed8092cb6c054dd52c 100755
--- a/tutorials/basic/laplacianFoam/flange/Allrun
+++ b/tutorials/basic/laplacianFoam/flange/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Get application name
-application=`getApplication`
+application=$(getApplication)
 
 runAnsysToFoam()
 {
diff --git a/tutorials/basic/potentialFoam/cylinder/Allclean b/tutorials/basic/potentialFoam/cylinder/Allclean
index 5734444f4e74e87d3d685ad82df35bcb7e3b300e..7db36b267cf5c15df49ee1d0402efdeadcef574b 100755
--- a/tutorials/basic/potentialFoam/cylinder/Allclean
+++ b/tutorials/basic/potentialFoam/cylinder/Allclean
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial clean functions
 . $WM_PROJECT_DIR/bin/tools/CleanFunctions
 
-rm -rf 0 > /dev/null 2>&1
+\rm -rf 0 > /dev/null 2>&1
 
 cleanCase
 
diff --git a/tutorials/basic/potentialFoam/cylinder/Allrun b/tutorials/basic/potentialFoam/cylinder/Allrun
index d8a1591738f2fa09a5413049a8b7d28190e12119..fc215995a524779911dff4992c9d26b24ac5747a 100755
--- a/tutorials/basic/potentialFoam/cylinder/Allrun
+++ b/tutorials/basic/potentialFoam/cylinder/Allrun
@@ -4,9 +4,9 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
-cp -r 0.org 0 > /dev/null 2>&1
+restore0Dir
 runApplication blockMesh
 runApplication $application -withFunctionObjects -writePhi -writep
 runApplication streamFunction
diff --git a/tutorials/basic/potentialFoam/pitzDaily/Allrun b/tutorials/basic/potentialFoam/pitzDaily/Allrun
index 3383ef1dad75f515d9f84bf358665b43d3efcd4e..8affee72b0f35fafb4b263e5d4112ee6a3967d5e 100755
--- a/tutorials/basic/potentialFoam/pitzDaily/Allrun
+++ b/tutorials/basic/potentialFoam/pitzDaily/Allrun
@@ -4,9 +4,9 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
-cp -r 0.org 0 > /dev/null 2>&1
+restore0Dir
 runApplication blockMesh
 runApplication $application -writePhi -writep
 runApplication streamFunction
diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/Allrun b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/Allrun
index e00af435e67ec22103c9afd04b6c2f0308f84673..12857916b89ad31196fd6649b513a9ffe0089f79 100755
--- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/Allrun
+++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/Allrun
@@ -5,8 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-rm -rf 0
-cp -r 0.org 0
+restore0Dir
 runApplication blockMesh
 runApplication changeDictionary
 runApplication topoSet
@@ -14,6 +13,6 @@ runApplication topoSet
 runApplication PDRMesh -overwrite
 
 # Run
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/combustion/XiDyMFoam/annularCombustorTurbine/Allrun b/tutorials/combustion/XiDyMFoam/annularCombustorTurbine/Allrun
index 595770a6d1448cf428f609ff87b6bf002b9547de..d79a59a4f59e8ef02bd59f191e78813ec1261ace 100755
--- a/tutorials/combustion/XiDyMFoam/annularCombustorTurbine/Allrun
+++ b/tutorials/combustion/XiDyMFoam/annularCombustorTurbine/Allrun
@@ -6,12 +6,12 @@ cd ${0%/*} || exit 1
 
 ./Allrun.mesh
 
-rm -rf 0 && cp -r 0.org 0
+restore0Dir
 
 runApplication decomposePar -force
 
 runParallel potentialFoam -pName pPotential -initialiseUBCs
 
-rm -f processor*/0/phi
+\rm -f processor*/0/phi
 
 runParallel XiDyMFoam
diff --git a/tutorials/combustion/XiFoam/ras/Allrun b/tutorials/combustion/XiFoam/ras/Allrun
index e1db61c60cdd1d1abc86274ec5fc80159e01ea76..4cf6e15fdf56f1ab340305f9fe8ff1b7511c5864 100755
--- a/tutorials/combustion/XiFoam/ras/Allrun
+++ b/tutorials/combustion/XiFoam/ras/Allrun
@@ -33,7 +33,7 @@ cloneCase moriyoshiHomogeneous moriyoshiHomogeneousPart2
 
     cp -r ../moriyoshiHomogeneous/0.005 .
     setControlDict
-    runApplication `getApplication`
+    runApplication $(getApplication)
 )
 
 # Clone case for hydrogen
@@ -48,7 +48,7 @@ cloneCase moriyoshiHomogeneous moriyoshiHomogeneousHydrogen
        constant/thermophysicalProperties.propane
     mv constant/thermophysicalProperties.hydrogen \
        constant/thermophysicalProperties
-    runApplication `getApplication`
+    runApplication $(getApplication)
 )
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/combustion/chemFoam/gri/Allrun b/tutorials/combustion/chemFoam/gri/Allrun
index 62adab28f3460c97ff3112e605c9fb2d5e5c8dcd..de26a4017d4750deb022950c5cd98c87da8d6a6a 100755
--- a/tutorials/combustion/chemFoam/gri/Allrun
+++ b/tutorials/combustion/chemFoam/gri/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication $application
 
diff --git a/tutorials/combustion/chemFoam/h2/Allrun b/tutorials/combustion/chemFoam/h2/Allrun
index 62adab28f3460c97ff3112e605c9fb2d5e5c8dcd..de26a4017d4750deb022950c5cd98c87da8d6a6a 100755
--- a/tutorials/combustion/chemFoam/h2/Allrun
+++ b/tutorials/combustion/chemFoam/h2/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication $application
 
diff --git a/tutorials/combustion/chemFoam/ic8h18/Allrun b/tutorials/combustion/chemFoam/ic8h18/Allrun
index 62adab28f3460c97ff3112e605c9fb2d5e5c8dcd..de26a4017d4750deb022950c5cd98c87da8d6a6a 100755
--- a/tutorials/combustion/chemFoam/ic8h18/Allrun
+++ b/tutorials/combustion/chemFoam/ic8h18/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication $application
 
diff --git a/tutorials/combustion/chemFoam/nc7h16/Allrun b/tutorials/combustion/chemFoam/nc7h16/Allrun
index 62adab28f3460c97ff3112e605c9fb2d5e5c8dcd..de26a4017d4750deb022950c5cd98c87da8d6a6a 100755
--- a/tutorials/combustion/chemFoam/nc7h16/Allrun
+++ b/tutorials/combustion/chemFoam/nc7h16/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication $application
 
diff --git a/tutorials/combustion/engineFoam/kivaTest/Allrun b/tutorials/combustion/engineFoam/kivaTest/Allrun
index e51b7da7c0f9b0cc54a24d0bfd914104a9b47b10..33555b48098a6740d8bfa64f855d6a6524efdf60 100755
--- a/tutorials/combustion/engineFoam/kivaTest/Allrun
+++ b/tutorials/combustion/engineFoam/kivaTest/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Get application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication kivaToFoam -file otape17
 
diff --git a/tutorials/combustion/fireFoam/les/flameSpreadWaterSuppressionPanel/Allrun b/tutorials/combustion/fireFoam/les/flameSpreadWaterSuppressionPanel/Allrun
index 6101e96371cc712f6489b66f4394a08c1132f772..b686d7ee801dadf91026b0f389904998a2308bb1 100755
--- a/tutorials/combustion/fireFoam/les/flameSpreadWaterSuppressionPanel/Allrun
+++ b/tutorials/combustion/fireFoam/les/flameSpreadWaterSuppressionPanel/Allrun
@@ -34,7 +34,7 @@ rm log.createPatch
 runApplication createPatch -region filmRegion -overwrite
 
 # Run
-runApplication `getApplication`
+runApplication $(getApplication)
 
 paraFoam -touchAll
 
diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun
index 63bace3c2cbb04b55c6bd92aca207d191e880bde..42cc66683236704b611ee64cc5cc7a4d490e6522 100755
--- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun
+++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 
@@ -34,7 +34,7 @@ runApplication -s panelRegion \
 runApplication -s fields \
     decomposePar -fields
 
-runParallel `getApplication`
+runParallel $(getApplication)
 
 paraFoam -touch
 paraFoam -touch -region panelRegion
diff --git a/tutorials/combustion/fireFoam/les/simplePMMApanel/Allrun b/tutorials/combustion/fireFoam/les/simplePMMApanel/Allrun
index 241ab1b9765f298392714e06ce7430b53ffe8fe8..9a56766a61c83665993f2e86982e36d3f6dc2ed5 100755
--- a/tutorials/combustion/fireFoam/les/simplePMMApanel/Allrun
+++ b/tutorials/combustion/fireFoam/les/simplePMMApanel/Allrun
@@ -11,7 +11,7 @@ runApplication topoSet
 runApplication extrudeToRegionMesh -overwrite
 
 # Run
-runApplication `getApplication`
+runApplication $(getApplication)
 
 paraFoam -touchAll
 
diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/Allrun b/tutorials/combustion/fireFoam/les/smallPoolFire2D/Allrun
index 11ae4b0d7cdefdf4570ff98eb8069733f5c17f0d..e188e147962b97a015d11425f9a1aa16d8baecd1 100755
--- a/tutorials/combustion/fireFoam/les/smallPoolFire2D/Allrun
+++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/Allrun
@@ -10,6 +10,6 @@ runApplication topoSet
 runApplication createPatch -overwrite
 
 # Run
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire3D/Allrun b/tutorials/combustion/fireFoam/les/smallPoolFire3D/Allrun
index 81460ea38905255d8fff7f90441d2fd547a5d3b6..64bba51d9a42d84080386962e02aae5549c402c1 100755
--- a/tutorials/combustion/fireFoam/les/smallPoolFire3D/Allrun
+++ b/tutorials/combustion/fireFoam/les/smallPoolFire3D/Allrun
@@ -4,7 +4,7 @@
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication topoSet
diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/Allrun b/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/Allrun
index a1d7b7290caa7220822da7fcbcc90e7362aa53c3..93d274a5901b4bd9742631d768f71253713fd936 100755
--- a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/Allrun
+++ b/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/Allrun
@@ -28,7 +28,7 @@ mv $CONST/polyMesh/boundary $CONST/polyMesh/boundary.bak
 sed -f $CONST/wedgeScr $CONST/polyMesh/boundary.bak > $CONST/polyMesh/boundary
 rm $CONST/polyMesh/boundary.bak
 
-runApplication `getApplication`
+runApplication $(getApplication)
 
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/compressible/rhoCentralFoam/shockTube/Allclean b/tutorials/compressible/rhoCentralFoam/shockTube/Allclean
index 416eb9a89d9725fbe8eb68042225b95bf4c2bc5e..6e94f2d9da6aad4e33d77f78a333c0a8efb266b7 100755
--- a/tutorials/compressible/rhoCentralFoam/shockTube/Allclean
+++ b/tutorials/compressible/rhoCentralFoam/shockTube/Allclean
@@ -4,8 +4,9 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial clean functions
 . $WM_PROJECT_DIR/bin/tools/CleanFunctions
 
-rm -rf 0
-cp -r 0.org 0
+# Remove 0.org/ copy
+\rm -rf 0
+
 cleanCase
 cleanSamples
 
diff --git a/tutorials/compressible/rhoCentralFoam/shockTube/Allrun b/tutorials/compressible/rhoCentralFoam/shockTube/Allrun
index 7f1047e95d30274b404a5b9b781790df0708c9c0..4e1c0a9fbc8c39397a0fb6938f290c9b24b6b467 100755
--- a/tutorials/compressible/rhoCentralFoam/shockTube/Allrun
+++ b/tutorials/compressible/rhoCentralFoam/shockTube/Allrun
@@ -4,8 +4,9 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
+restore0Dir
 runApplication blockMesh
 runApplication setFields
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/compressible/rhoPimpleDyMFoam/annularThermalMixer/Allrun b/tutorials/compressible/rhoPimpleDyMFoam/annularThermalMixer/Allrun
index 24b623744936ea2729177eb4c60d5568a7e0b1cb..07492af16c318fe77cfd5ce17b8ea6e3741df09d 100755
--- a/tutorials/compressible/rhoPimpleDyMFoam/annularThermalMixer/Allrun
+++ b/tutorials/compressible/rhoPimpleDyMFoam/annularThermalMixer/Allrun
@@ -9,14 +9,12 @@ runApplication surfaceFeatureExtract
 runApplication blockMesh
 runApplication snappyHexMesh -overwrite
 
-if [ -d 0 ] ; then
-   rm -rf 0
-fi
+\rm -rf 0
 
 runApplication createBaffles -overwrite
 runApplication mergeOrSplitBaffles -split -overwrite
 
-cp -r 0.org 0
+restore0Dir
 
 runApplication $(getApplication)
 
diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/0/T b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/0/T
new file mode 100644
index 0000000000000000000000000000000000000000..08d17aa7ad198ac083960a78a4a63d05ae81934b
--- /dev/null
+++ b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/0/T
@@ -0,0 +1,44 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       volScalarField;
+    location    "0";
+    object      T;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+dimensions      [0 0 0 1 0 0 0];
+
+internalField   uniform 300;
+
+boundaryField
+{
+    inlet
+    {
+        type            fixedValue;
+        value           $internalField;
+    }
+
+    outlet
+    {
+        type            inletOutlet;
+        inletValue      $internalField;
+        value           $internalField;
+    }
+
+    frontAndBack
+    {
+        type            empty;
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/compressible/rhoCentralFoam/shockTube/0/U b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/0/U
similarity index 78%
rename from tutorials/compressible/rhoCentralFoam/shockTube/0/U
rename to tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/0/U
index 6daaa08ce7fb6c4f14989d5cf88766de76ee2c41..23148ebb93cc3e96529354db4b8208ecad725b2e 100644
--- a/tutorials/compressible/rhoCentralFoam/shockTube/0/U
+++ b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/0/U
@@ -10,6 +10,7 @@ FoamFile
     version     2.0;
     format      ascii;
     class       volVectorField;
+    location    "0";
     object      U;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -20,15 +21,23 @@ internalField   uniform (0 0 0);
 
 boundaryField
 {
-    sides
+    inlet
     {
-        type            zeroGradient;
+        type            zeroGradient; // pressureInletVelocity;
+        value           $internalField;
     }
 
-    empty
+    outlet
+    {
+        type            pressureInletOutletVelocity;
+        value           $internalField;
+    }
+
+    frontAndBack
     {
         type            empty;
     }
 }
 
+
 // ************************************************************************* //
diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/0/V b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/0/V
new file mode 100644
index 0000000000000000000000000000000000000000..c385e23f0894912475288a9d8eacb1107049fd76
--- /dev/null
+++ b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/0/V
@@ -0,0 +1,1045 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       volScalarField;
+    location    "0";
+    object      V;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+dimensions      [0 3 0 0 0 0 0];
+
+internalField   nonuniform List<scalar> 
+1000
+(
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000008e-06
+1.000000000000038e-06
+9.999999999999489e-07
+1.000000000000008e-06
+1.000000000000068e-06
+9.999999999999489e-07
+9.999999999999786e-07
+1.000000000000008e-06
+1.000000000000038e-06
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999489e-07
+1.000000000000097e-06
+1.000000000000008e-06
+9.999999999999786e-07
+9.999999999999489e-07
+1.000000000000068e-06
+1.000000000000008e-06
+9.999999999999489e-07
+9.999999999999786e-07
+1.000000000000068e-06
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000008e-06
+1.000000000000038e-06
+1.000000000000008e-06
+9.999999999999489e-07
+1.000000000000008e-06
+1.000000000000038e-06
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000097e-06
+9.999999999999489e-07
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000068e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999489e-07
+1.000000000000068e-06
+1.000000000000008e-06
+9.999999999999489e-07
+1.000000000000008e-06
+1.000000000000038e-06
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000068e-06
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000008e-06
+1.000000000000068e-06
+9.999999999999489e-07
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000097e-06
+9.999999999999489e-07
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000068e-06
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000008e-06
+1.000000000000038e-06
+1.000000000000008e-06
+9.999999999999489e-07
+1.000000000000008e-06
+1.000000000000038e-06
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000068e-06
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000008e-06
+1.000000000000038e-06
+1.000000000000008e-06
+9.999999999999489e-07
+9.999999999999786e-07
+1.000000000000097e-06
+9.999999999999489e-07
+1.000000000000008e-06
+9.999999999999489e-07
+1.000000000000068e-06
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000068e-06
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000008e-06
+1.000000000000068e-06
+9.999999999999489e-07
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999489e-07
+1.000000000000023e-06
+1.000000000000008e-06
+1.000000000000023e-06
+9.999999999999934e-07
+9.999999999999934e-07
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999489e-07
+1.000000000000052e-06
+9.999999999999637e-07
+1.000000000000008e-06
+9.999999999999934e-07
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000008e-06
+1.000000000000008e-06
+1.000000000000008e-06
+9.999999999999637e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999489e-07
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999934e-07
+9.999999999999934e-07
+1.000000000000023e-06
+1.000000000000008e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999637e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+9.999999999999637e-07
+1.000000000000038e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999489e-07
+1.000000000000053e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999637e-07
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999489e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999934e-07
+9.999999999999637e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999489e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000053e-06
+9.999999999999489e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000038e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999786e-07
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999637e-07
+1.000000000000053e-06
+9.999999999999637e-07
+1.000000000000038e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999637e-07
+1.000000000000008e-06
+1.000000000000001e-06
+9.999999999999858e-07
+1.000000000000015e-06
+9.999999999999934e-07
+1.000000000000001e-06
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000008e-06
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999858e-07
+9.999999999999858e-07
+1.000000000000008e-06
+1.000000000000001e-06
+9.999999999999932e-07
+1.000000000000008e-06
+9.999999999999932e-07
+1.000000000000008e-06
+9.999999999999858e-07
+1.000000000000008e-06
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999858e-07
+1.000000000000008e-06
+1.000000000000008e-06
+9.999999999999932e-07
+1.000000000000008e-06
+9.999999999999932e-07
+9.999999999999932e-07
+1.000000000000015e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999932e-07
+1.000000000000001e-06
+1.000000000000008e-06
+9.999999999999712e-07
+1.000000000000001e-06
+9.999999999999932e-07
+1.000000000000008e-06
+1.000000000000008e-06
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999858e-07
+1.000000000000008e-06
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000008e-06
+1.000000000000008e-06
+9.999999999999858e-07
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000008e-06
+1.000000000000001e-06
+9.999999999999934e-07
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999858e-07
+1.000000000000008e-06
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000008e-06
+9.999999999999932e-07
+1.000000000000008e-06
+1.000000000000001e-06
+9.999999999999932e-07
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000008e-06
+9.999999999999932e-07
+1.000000000000001e-06
+1.000000000000008e-06
+1.000000000000001e-06
+9.999999999999934e-07
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999932e-07
+1.000000000000001e-06
+1.000000000000008e-06
+1.000000000000001e-06
+9.999999999999934e-07
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000008e-06
+9.999999999999932e-07
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000004e-06
+1.000000000000001e-06
+9.999999999999968e-07
+1.000000000000001e-06
+1.000000000000004e-06
+9.999999999999932e-07
+9.999999999999972e-07
+9.99999999999997e-07
+1.000000000000001e-06
+9.999999999999968e-07
+1.000000000000008e-06
+1.000000000000001e-06
+9.999999999999972e-07
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000004e-06
+1.000000000000001e-06
+9.999999999999972e-07
+9.999999999999896e-07
+9.999999999999972e-07
+1.000000000000008e-06
+1.000000000000001e-06
+9.999999999999968e-07
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000008e-06
+9.999999999999932e-07
+1.000000000000001e-06
+1.000000000000004e-06
+9.99999999999997e-07
+1.000000000000001e-06
+9.999999999999934e-07
+9.99999999999997e-07
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000004e-06
+9.999999999999972e-07
+1.000000000000004e-06
+9.999999999999972e-07
+1.000000000000004e-06
+9.999999999999972e-07
+1.000000000000004e-06
+9.99999999999997e-07
+9.999999999999898e-07
+1.000000000000001e-06
+1.000000000000004e-06
+9.99999999999997e-07
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000002e-06
+9.999999999999989e-07
+9.999999999999989e-07
+9.999999999999968e-07
+9.999999999999989e-07
+1.000000000000004e-06
+9.999999999999989e-07
+1.000000000000002e-06
+9.999999999999989e-07
+9.999999999999934e-07
+1.000000000000004e-06
+9.999999999999989e-07
+1.000000000000004e-06
+9.99999999999997e-07
+1.000000000000001e-06
+9.999999999999968e-07
+9.999999999999989e-07
+1.000000000000002e-06
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999934e-07
+1.000000000000002e-06
+9.999999999999989e-07
+1.000000000000001e-06
+1.000000000000001e-06
+9.99999999999998e-07
+1.000000000000002e-06
+1.000000000000001e-06
+9.999999999999961e-07
+1.000000000000002e-06
+1.000000000000001e-06
+9.999999999999989e-07
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999972e-07
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999997e-07
+9.999999999999983e-07
+1.000000000000001e-06
+1e-06
+9.999999999999989e-07
+1.000000000000001e-06
+9.999999999999993e-07
+1.000000000000001e-06
+9.999999999999997e-07
+9.999999999999997e-07
+9.999999999999997e-07
+9.999999999999997e-07
+9.999999999999997e-07
+9.999999999999997e-07
+9.999999999999997e-07
+9.999999999999997e-07
+1.000000000000001e-06
+9.999999999999991e-07
+1.000000000000001e-06
+9.999999999999989e-07
+9.999999999999997e-07
+1.000000000000001e-06
+9.999999999999983e-07
+9.999999999999997e-07
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999972e-07
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999989e-07
+1.000000000000001e-06
+1.000000000000002e-06
+9.999999999999964e-07
+1.000000000000001e-06
+1.000000000000002e-06
+9.99999999999998e-07
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999989e-07
+1.000000000000002e-06
+9.999999999999934e-07
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000002e-06
+9.999999999999989e-07
+9.999999999999968e-07
+1.000000000000001e-06
+9.999999999999972e-07
+1.000000000000004e-06
+9.999999999999989e-07
+1.000000000000004e-06
+9.999999999999932e-07
+9.999999999999989e-07
+1.000000000000002e-06
+9.999999999999989e-07
+1.000000000000004e-06
+9.999999999999989e-07
+9.999999999999972e-07
+9.999999999999989e-07
+9.999999999999989e-07
+1.000000000000002e-06
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999972e-07
+1.000000000000004e-06
+1.000000000000001e-06
+9.999999999999896e-07
+9.999999999999972e-07
+1.000000000000004e-06
+9.99999999999997e-07
+1.000000000000004e-06
+9.99999999999997e-07
+1.000000000000004e-06
+9.99999999999997e-07
+1.000000000000004e-06
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999968e-07
+9.999999999999934e-07
+1.000000000000001e-06
+9.999999999999972e-07
+1.000000000000004e-06
+1.000000000000001e-06
+9.999999999999934e-07
+1.000000000000008e-06
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999972e-07
+1.000000000000001e-06
+1.000000000000008e-06
+9.99999999999997e-07
+9.999999999999896e-07
+9.99999999999997e-07
+1.000000000000001e-06
+1.000000000000004e-06
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999972e-07
+1.000000000000001e-06
+1.000000000000008e-06
+9.99999999999997e-07
+1.000000000000001e-06
+9.999999999999968e-07
+9.999999999999972e-07
+9.999999999999934e-07
+1.000000000000004e-06
+1.000000000000001e-06
+9.99999999999997e-07
+1.000000000000001e-06
+1.000000000000004e-06
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999934e-07
+1.000000000000008e-06
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999932e-07
+1.000000000000001e-06
+1.000000000000008e-06
+1.000000000000001e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999932e-07
+1.000000000000008e-06
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999932e-07
+1.000000000000001e-06
+1.000000000000008e-06
+1.000000000000001e-06
+9.999999999999934e-07
+1.000000000000008e-06
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999932e-07
+1.000000000000001e-06
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000008e-06
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000008e-06
+9.999999999999858e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999932e-07
+1.000000000000001e-06
+1.000000000000008e-06
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999858e-07
+1.000000000000008e-06
+1.000000000000008e-06
+1.000000000000001e-06
+1.000000000000001e-06
+9.999999999999932e-07
+1.000000000000008e-06
+1.000000000000008e-06
+9.999999999999858e-07
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000008e-06
+1.000000000000008e-06
+9.999999999999932e-07
+1.000000000000001e-06
+9.999999999999712e-07
+1.000000000000008e-06
+1.000000000000001e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999932e-07
+1.000000000000015e-06
+9.999999999999932e-07
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999932e-07
+1.000000000000008e-06
+1.000000000000008e-06
+9.999999999999858e-07
+1.000000000000008e-06
+9.999999999999932e-07
+1.000000000000008e-06
+1.000000000000008e-06
+9.999999999999858e-07
+1.000000000000008e-06
+9.999999999999932e-07
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000001e-06
+1.000000000000008e-06
+9.999999999999858e-07
+9.999999999999858e-07
+1.000000000000001e-06
+1.000000000000001e-06
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000008e-06
+1.000000000000001e-06
+9.999999999999934e-07
+1.000000000000015e-06
+9.999999999999858e-07
+1.000000000000001e-06
+1.000000000000008e-06
+9.999999999999637e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000038e-06
+9.999999999999637e-07
+1.000000000000052e-06
+9.999999999999637e-07
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999934e-07
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000038e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999489e-07
+1.000000000000052e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999489e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999637e-07
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999489e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999934e-07
+9.999999999999637e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000052e-06
+9.999999999999489e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000038e-06
+9.999999999999637e-07
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999637e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000008e-06
+1.000000000000023e-06
+9.999999999999934e-07
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999934e-07
+9.999999999999489e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999637e-07
+1.000000000000008e-06
+1.000000000000008e-06
+1.000000000000008e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+9.999999999999934e-07
+1.000000000000008e-06
+9.999999999999637e-07
+1.000000000000052e-06
+9.999999999999489e-07
+1.000000000000008e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999637e-07
+1.000000000000023e-06
+9.999999999999934e-07
+1.000000000000023e-06
+9.999999999999786e-07
+9.999999999999934e-07
+9.999999999999934e-07
+1.000000000000023e-06
+1.000000000000008e-06
+1.000000000000023e-06
+9.999999999999489e-07
+1.000000000000023e-06
+9.999999999999786e-07
+1.000000000000038e-06
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999489e-07
+1.000000000000068e-06
+1.000000000000008e-06
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000068e-06
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000068e-06
+9.999999999999489e-07
+1.000000000000008e-06
+9.999999999999489e-07
+1.000000000000097e-06
+9.999999999999786e-07
+9.999999999999489e-07
+1.000000000000008e-06
+1.000000000000038e-06
+1.000000000000008e-06
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000068e-06
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000038e-06
+1.000000000000008e-06
+9.999999999999489e-07
+1.000000000000008e-06
+1.000000000000038e-06
+1.000000000000008e-06
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000068e-06
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999489e-07
+1.000000000000097e-06
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999489e-07
+1.000000000000068e-06
+1.000000000000008e-06
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000068e-06
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000038e-06
+1.000000000000008e-06
+9.999999999999489e-07
+1.000000000000008e-06
+1.000000000000068e-06
+9.999999999999489e-07
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000068e-06
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999489e-07
+1.000000000000097e-06
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000038e-06
+1.000000000000008e-06
+9.999999999999489e-07
+1.000000000000008e-06
+1.000000000000038e-06
+1.000000000000008e-06
+9.999999999999786e-07
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000068e-06
+9.999999999999786e-07
+9.999999999999489e-07
+1.000000000000008e-06
+1.000000000000068e-06
+9.999999999999489e-07
+9.999999999999786e-07
+1.000000000000008e-06
+1.000000000000097e-06
+9.999999999999489e-07
+9.999999999999786e-07
+9.999999999999786e-07
+1.000000000000038e-06
+1.000000000000008e-06
+9.999999999999786e-07
+9.999999999999489e-07
+1.000000000000068e-06
+1.000000000000008e-06
+9.999999999999489e-07
+1.000000000000038e-06
+1.000000000000008e-06
+9.999999999999786e-07
+1.000000000000008e-06
+)
+;
+
+boundaryField
+{
+    inlet
+    {
+        type            calculated;
+        value           uniform 0.0004;
+    }
+    outlet
+    {
+        type            calculated;
+        value           uniform 0.0004;
+    }
+    frontAndBack
+    {
+        type            empty;
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/0/p b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/0/p
old mode 100644
new mode 100755
similarity index 62%
rename from tutorials/lagrangian/reactingParcelFoam/filter/0/p
rename to tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/0/p
index 0438b1fa572c95b1d627eda0e5fddf30338945c4..e9744947ab052cd07005d37963a906643c9b583e
--- a/tutorials/lagrangian/reactingParcelFoam/filter/0/p
+++ b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/0/p
@@ -10,50 +10,44 @@ FoamFile
     version     2.0;
     format      ascii;
     class       volScalarField;
-    location    "1";
+    location    "0";
     object      p;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 dimensions      [1 -1 -2 0 0 0 0];
 
-internalField   uniform 100000;
+internalField   uniform 101325;
 
 boundaryField
 {
-    walls
-    {
-        type            zeroGradient;
-    }
     inlet
     {
-        type            zeroGradient;
+        type            uniformFixedValue; // oscillatingFixedValue;
+        uniformValue    sine;
+        uniformValueCoeffs
+        {
+            amplitude       constant 1;
+            frequency       constant 3000;
+            scale           constant 50;
+            level           constant 101325;
+        }
+        value           $internalField;
     }
+
     outlet
     {
-        type            fixedValue;
-        value           uniform 100000;
-    }
-    cycLeft_half0
-    {
-        type            cyclic;
-    }
-    cycRight_half0
-    {
-        type            cyclic;
+        type            waveTransmissive;
+        gamma           1.4;
+        fieldInf        101325;
+        lInf            2.25;
+        value           $internalField;
     }
+
     frontAndBack
     {
         type            empty;
     }
-    cycLeft_half1
-    {
-        type            cyclic;
-    }
-    cycRight_half1
-    {
-        type            cyclic;
-    }
 }
 
 
diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/Allclean b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/Allclean
new file mode 100755
index 0000000000000000000000000000000000000000..ad2d4ecb971ab4f2eaecd1f75de566f6b6fd0709
--- /dev/null
+++ b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/Allclean
@@ -0,0 +1,10 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # Run from this directory
+
+# Source tutorial clean functions
+. $WM_PROJECT_DIR/bin/tools/CleanFunctions
+
+cleanCase
+
+
+#------------------------------------------------------------------------------
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/Allrun b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/Allrun
similarity index 65%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/Allrun
rename to tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/Allrun
index 6b3f5730251b7a3991c3a90a7a607b5318bf83d8..31f6bc34d0fbfcee28a030447f424b33f27ff6e4 100755
--- a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/Allrun
+++ b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/Allrun
@@ -1,11 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # Run from this directory
 
-m4 system/blockMeshDict.m4 > system/blockMeshDict
-
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 runApplication blockMesh
-runApplication `getApplication`
-
+runApplication $(getApplication)
diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/constant/thermophysicalProperties b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/constant/thermophysicalProperties
new file mode 100644
index 0000000000000000000000000000000000000000..4651aa353f2fcab2782ab9c0ce4b792fdb41f886
--- /dev/null
+++ b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/constant/thermophysicalProperties
@@ -0,0 +1,49 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  2.3.1                                 |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "constant";
+    object      thermophysicalProperties;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+thermoType
+{
+    type            hePsiThermo;
+    mixture         pureMixture;
+    transport       sutherland;
+    thermo          hConst;
+    equationOfState perfectGas;
+    specie          specie;
+    energy          sensibleEnthalpy;
+}
+
+mixture
+{
+    specie
+    {
+        nMoles      1;
+        molWeight   28.9;
+    }
+    thermodynamics
+    {
+        Cp          1007;
+        Hf          0;
+    }
+    transport
+    {
+        As          1.4792e-06;
+        Ts          116;
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/constant/turbulenceProperties b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/constant/turbulenceProperties
new file mode 100644
index 0000000000000000000000000000000000000000..5eec04267266e7fd15e7701a875d683d5e658cd9
--- /dev/null
+++ b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/constant/turbulenceProperties
@@ -0,0 +1,21 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "constant";
+    object      turbulenceProperties;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+simulationType  laminar;
+
+
+// ************************************************************************* //
diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/system/blockMeshDict b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/system/blockMeshDict
new file mode 100644
index 0000000000000000000000000000000000000000..55efa8b2c4600904e08464283cd1d34338dfa99c
--- /dev/null
+++ b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/system/blockMeshDict
@@ -0,0 +1,78 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      blockMeshDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+convertToMeters 1;
+
+vertices
+(
+    (-1.25 -0.01 -0.01)
+    (1.25 -0.01 -0.01)
+    (1.25 0.01 -0.01)
+    (-1.25 0.01 -0.01)
+    (-1.25 -0.01 0.01)
+    (1.25 -0.01 0.01)
+    (1.25 0.01 0.01)
+    (-1.25 0.01 0.01)
+);
+
+blocks
+(
+    hex (0 1 2 3 4 5 6 7) (1000 1 1) simpleGrading (1 1 1)
+);
+
+edges
+(
+);
+
+boundary
+(
+    inlet
+    {
+        type patch;
+        faces
+        (
+            (0 4 7 3)
+        );
+    }
+
+
+    outlet
+    {
+        type patch;
+        faces
+        (
+            (1 2 6 5)
+        );
+    }
+
+    frontAndBack
+    {
+        type empty;
+        faces
+        (
+            (0 1 5 4)
+            (3 7 6 2)
+            (0 3 2 1)
+            (5 6 7 4)
+        );
+    }
+);
+
+mergePatchPairs
+(
+);
+
+// ************************************************************************* //
diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/system/controlDict b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/system/controlDict
new file mode 100644
index 0000000000000000000000000000000000000000..8c02323f69a3675272ec3cabdcd56bec755956ca
--- /dev/null
+++ b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/system/controlDict
@@ -0,0 +1,82 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      controlDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+application     rhoPimpleFoam;
+
+startFrom       startTime;
+
+startTime       0;
+
+stopAt          endTime;
+
+endTime         0.02;
+
+deltaT          2e-6;
+
+writeControl    runTime;
+
+writeInterval   0.0002;
+
+purgeWrite      0;
+
+writeFormat     ascii; // binary;
+
+writePrecision  16;
+
+writeCompression off;
+
+timeFormat      general;
+
+timePrecision   6;
+
+runTimeModifiable true;
+
+adjustTimeStep  no;
+
+maxCo           0.3;
+
+maxDeltaT       1;
+
+
+functions
+{
+    fieldAverage
+    {
+        type            fieldAverage;
+        functionObjectLibs ("libfieldFunctionObjects.so");
+        outputControl   outputTime;
+        fields
+        (
+            U
+            {
+                mean        on;
+                prime2Mean  off;
+                base        time;
+            }
+
+            p
+            {
+                mean        on;
+                prime2Mean  off;
+                base        time;
+            }
+
+        );
+    }
+}
+
+// ************************************************************************* //
diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/system/fvOptions b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/system/fvOptions
new file mode 100644
index 0000000000000000000000000000000000000000..011a5143c636fdb47c0b7b3e3f99fc68de9876a5
--- /dev/null
+++ b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/system/fvOptions
@@ -0,0 +1,37 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      fvOptions;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+acousticDampingSource
+{
+    type            acousticDampingSource;
+    active          yes;
+
+    acousticDampingSourceCoeffs
+    {
+        timeStart        0.004;
+        duration         1000.0;
+        selectionMode    all;
+        centre           (-1.25 0 0);
+        radius1          1.2;
+        radius2          1.65;
+        frequency        3000;
+        URef             UMean;
+    }
+}
+
+
+//************************************************************************* //
diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/system/fvSchemes b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/system/fvSchemes
new file mode 100644
index 0000000000000000000000000000000000000000..b25a89c80ba8a414c18f0f5aa3f21a1d88e2f4f1
--- /dev/null
+++ b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/system/fvSchemes
@@ -0,0 +1,58 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      fvSchemes;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ddtSchemes
+{
+    default         backward;
+}
+
+gradSchemes
+{
+    default         Gauss linear;
+}
+
+divSchemes
+{
+    default         none;
+    div(phi,U)      Gauss linearUpwind grad(U);
+    div(phi,K)      Gauss linear;
+    div(phi,h)      Gauss limitedLinear 1;
+    div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
+}
+
+laplacianSchemes
+{
+    default         Gauss linear orthogonal;
+}
+
+interpolationSchemes
+{
+    default         linear;
+}
+
+snGradSchemes
+{
+    default         no;
+}
+
+wallDist
+{
+    method meshWave;
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/system/fvSolution b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/system/fvSolution
new file mode 100644
index 0000000000000000000000000000000000000000..6240c2447886aea9c7eaa3225bf7ce5e0a28d197
--- /dev/null
+++ b/tutorials/compressible/rhoPimpleFoam/laminar/sineWaveDamping/system/fvSolution
@@ -0,0 +1,71 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      fvSolution;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+solvers
+{
+    p
+    {
+        solver          PCG;
+        preconditioner  DIC;
+        tolerance       1e-08;
+        relTol          0.01;
+    }
+
+    pFinal
+    {
+        $p;
+        relTol          0;
+    }
+
+    "rho.*"
+    {
+        $p;
+        tolerance       1e-05;
+        relTol          0;
+    }
+
+    "(U|h)"
+    {
+        solver          smoothSolver;
+        smoother        symGaussSeidel;
+        tolerance       1e-08;
+        relTol          0.01;
+    }
+
+    "(U|h)Final"
+    {
+        $U;
+        relTol          0;
+    }
+}
+
+PIMPLE
+{
+    momentumPredictor yes;
+    nOuterCorrectors  7;
+    nCorrectors       1;
+    rhoMax            1.5;
+}
+
+
+
+
+
+
+
+
+// ************************************************************************* //
diff --git a/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/Allrun b/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/Allrun
index 8b610fff80dee1501b3b45e3994f363bfa9b09ca..4f55fd7efaf20c8631ec86210c8629a9a3fe234b 100755
--- a/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/Allrun
+++ b/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/Allrun
@@ -7,4 +7,4 @@ m4 system/blockMeshDict.m4 > system/blockMeshDict
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 runApplication blockMesh
-runApplication `getApplication`
+runApplication $(getApplication)
diff --git a/tutorials/compressible/rhoPimpleFoam/ras/angledDuctLTS/Allrun b/tutorials/compressible/rhoPimpleFoam/ras/angledDuctLTS/Allrun
index 8b610fff80dee1501b3b45e3994f363bfa9b09ca..4f55fd7efaf20c8631ec86210c8629a9a3fe234b 100755
--- a/tutorials/compressible/rhoPimpleFoam/ras/angledDuctLTS/Allrun
+++ b/tutorials/compressible/rhoPimpleFoam/ras/angledDuctLTS/Allrun
@@ -7,4 +7,4 @@ m4 system/blockMeshDict.m4 > system/blockMeshDict
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 runApplication blockMesh
-runApplication `getApplication`
+runApplication $(getApplication)
diff --git a/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/Allrun b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/Allrun
index 836276fe9cea7a027c4726fa021088bf33d0da6e..2e9c3f7fb3a2d22443c91d89debe842a936ff205 100755
--- a/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/Allrun
+++ b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/Allrun
@@ -3,7 +3,7 @@
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 ./makeMesh
 runApplication $application
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/T b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/T
similarity index 100%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/T
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/T
index b89d0e399dd3f7fe292668a15ad421c10f74374a..cc59e281391c35303d392d56b5ce6fc22ce77345 100644
--- a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/T
+++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/T
@@ -46,8 +46,8 @@ boundaryField
     outlet
     {
         type            inletOutlet;
-        value           $internalField;
         inletValue      $internalField;
+        value           $internalField;
     }
 }
 
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/U b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/U
similarity index 88%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/U
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/U
index 38d820b97a8bf02576dc8db8457b47d1811770c9..9aabb27fcde565d8c5d81233443f575ddd80572c 100644
--- a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/U
+++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/U
@@ -35,19 +35,19 @@ boundaryField
     porosityWall
     {
         type            slip;
-        value           uniform (0 0 0);
+        value           $internalField;
     }
     inlet
     {
         type            flowRateInletVelocity;
         massFlowRate    constant 0.1;
-        value           uniform (0 0 0);
+        value           $internalField;
     }
     outlet
     {
         type            inletOutlet;
-        value           uniform (0 0 0);
-        inletValue      uniform (0 0 0);
+        inletValue      $internalField;
+        value           $internalField;
     }
 }
 
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/alphat b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/alphat
similarity index 85%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/alphat
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/alphat
index 558b85f7d1024b0d79ed9c3c1fe5eb48e555e48e..df8b021b4007467f1fa12f2d6a233f6676514bfa 100644
--- a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/alphat
+++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/alphat
@@ -24,32 +24,32 @@ boundaryField
     front
     {
         type            compressible::alphatWallFunction;
-        value           uniform 0;
+        value           $internalField;
     }
     back
     {
         type            compressible::alphatWallFunction;
-        value           uniform 0;
+        value           $internalField;
     }
     walls
     {
         type            compressible::alphatWallFunction;
-        value           uniform 0;
+        value           $internalField;
     }
     porosityWall
     {
         type            compressible::alphatWallFunction;
-        value           uniform 0;
+        value           $internalField;
     }
     inlet
     {
         type            calculated;
-        value           uniform 0;
+        value           $internalField;
     }
     outlet
     {
         type            calculated;
-        value           uniform 0;
+        value           $internalField;
     }
 }
 
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/epsilon b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/epsilon
similarity index 83%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/epsilon
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/epsilon
index 495ca71638fb667c81e8b71e52a6ba43ab84c202..3f8a67dcb36177a4bd41e44f6233c0224df755f2 100644
--- a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/epsilon
+++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/epsilon
@@ -24,39 +24,39 @@ boundaryField
     front
     {
         type            epsilonWallFunction;
-        value           uniform 200;
+        value           $internalField;
     }
 
     back
     {
         type            epsilonWallFunction;
-        value           uniform 200;
+        value           $internalField;
     }
 
     walls
     {
         type            epsilonWallFunction;
-        value           uniform 200;
+        value           $internalField;
     }
 
     porosityWall
     {
         type            epsilonWallFunction;
-        value           uniform 200;
+        value           $internalField;
     }
 
     inlet
     {
         type            turbulentMixingLengthDissipationRateInlet;
         mixingLength    0.005;
-        value           uniform 200;
+        value           $internalField;
     }
 
     outlet
     {
         type            inletOutlet;
-        inletValue      uniform 200;
-        value           uniform 200;
+        inletValue      $internalField;
+        value           $internalField;
     }
 }
 
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/k b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/k
similarity index 83%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/k
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/k
index 098e959469c4dd10fa051ba845212e33c39e527b..747fee86788aa5b903ee6f0ee6db427040b0d3de 100644
--- a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/k
+++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/k
@@ -24,39 +24,39 @@ boundaryField
     front
     {
         type            kqRWallFunction;
-        value           uniform 1;
+        value           $internalField;
     }
 
     back
     {
         type            kqRWallFunction;
-        value           uniform 1;
+        value           $internalField;
     }
 
     walls
     {
         type            kqRWallFunction;
-        value           uniform 1;
+        value           $internalField;
     }
 
     porosityWall
     {
         type            kqRWallFunction;
-        value           uniform 1;
+        value           $internalField;
     }
 
     inlet
     {
         type            turbulentIntensityKineticEnergyInlet;
         intensity       0.05;
-        value           uniform 1;
+        value           $internalField;
     }
 
     outlet
     {
         type            inletOutlet;
-        inletValue      uniform 1;
-        value           uniform 1;
+        inletValue      $internalField;
+        value           $internalField;
     }
 }
 
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/nut b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/nut
similarity index 84%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/nut
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/nut
index ccfea96c5aa581339f8c9baa0a4564928016e8e8..83d86e46c1f9ed0ba6e1e3a6ad1b2354c8b33c3a 100644
--- a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/nut
+++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/nut
@@ -24,37 +24,37 @@ boundaryField
     front
     {
         type            nutkWallFunction;
-        value           uniform 0;
+        value           $internalField;
     }
 
     back
     {
         type            nutkWallFunction;
-        value           uniform 0;
+        value           $internalField;
     }
 
     walls
     {
         type            nutkWallFunction;
-        value           uniform 0;
+        value           $internalField;
     }
 
     porosityWall
     {
         type            nutkWallFunction;
-        value           uniform 0;
+        value           $internalField;
     }
 
     inlet
     {
         type            calculated;
-        value           uniform 0;
+        value           $internalField;
     }
 
     outlet
     {
         type            calculated;
-        value           uniform 0;
+        value           $internalField;
     }
 }
 
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/p b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/p
similarity index 100%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/p
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/0.org/p
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/blockMeshDict.m4 b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/blockMeshDict.m4
similarity index 100%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/blockMeshDict.m4
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/blockMeshDict.m4
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/fvOptions b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/constant/fvOptions
similarity index 100%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/fvOptions
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/constant/fvOptions
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/porosityProperties b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/constant/porosityProperties
similarity index 100%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/porosityProperties
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/constant/porosityProperties
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/thermophysicalProperties b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/constant/thermophysicalProperties
similarity index 100%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/thermophysicalProperties
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/constant/thermophysicalProperties
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/turbulenceProperties b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/constant/turbulenceProperties
similarity index 100%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/turbulenceProperties
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/common/constant/turbulenceProperties
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/explicit/Allclean b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/explicit/Allclean
new file mode 100755
index 0000000000000000000000000000000000000000..97591ced3297e7a1efcbd5bbf14a852b542c0703
--- /dev/null
+++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/explicit/Allclean
@@ -0,0 +1,12 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # Run from this directory
+
+# Source tutorial clean functions
+. $WM_PROJECT_DIR/bin/tools/CleanFunctions
+
+# Remove copies of common files
+\rm -rf 0 constant
+
+cleanCase
+
+#------------------------------------------------------------------------------
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/Allrun b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/explicit/Allrun
similarity index 63%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/Allrun
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/explicit/Allrun
index 2a52698c048ffc2190e6ade7004cf628615b9a77..749a4c91c5b9c4f4b1a2ec30b82affe9dd8f1597 100755
--- a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/Allrun
+++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/explicit/Allrun
@@ -1,14 +1,17 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # Run from this directory
 
-m4 system/blockMeshDict.m4 > system/blockMeshDict
-
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+echo "Use common files for 0/, constant/ and blockMeshDict"
+\rm -rf 0 constant
+\cp -r ../common/0.org 0
+\cp -r ../common/constant constant
+
+m4 system/blockMeshDict.m4 > system/blockMeshDict
 
 runApplication blockMesh
-runApplication $application
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/explicit/system/blockMeshDict.m4 b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/explicit/system/blockMeshDict.m4
new file mode 120000
index 0000000000000000000000000000000000000000..55f23c148bb2123e27460000f3762b0ed5bb3ec0
--- /dev/null
+++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/explicit/system/blockMeshDict.m4
@@ -0,0 +1 @@
+../../common/blockMeshDict.m4
\ No newline at end of file
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/controlDict b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/explicit/system/controlDict
similarity index 100%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/controlDict
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/explicit/system/controlDict
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/fvSchemes b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/explicit/system/fvSchemes
similarity index 100%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/fvSchemes
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/explicit/system/fvSchemes
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/fvSolution b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/explicit/system/fvSolution
similarity index 100%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/fvSolution
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/explicit/system/fvSolution
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/Allclean b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/Allclean
new file mode 100755
index 0000000000000000000000000000000000000000..97591ced3297e7a1efcbd5bbf14a852b542c0703
--- /dev/null
+++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/Allclean
@@ -0,0 +1,12 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # Run from this directory
+
+# Source tutorial clean functions
+. $WM_PROJECT_DIR/bin/tools/CleanFunctions
+
+# Remove copies of common files
+\rm -rf 0 constant
+
+cleanCase
+
+#------------------------------------------------------------------------------
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/Allrun b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/Allrun
new file mode 100755
index 0000000000000000000000000000000000000000..749a4c91c5b9c4f4b1a2ec30b82affe9dd8f1597
--- /dev/null
+++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/Allrun
@@ -0,0 +1,17 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # Run from this directory
+
+# Source tutorial run functions
+. $WM_PROJECT_DIR/bin/tools/RunFunctions
+
+echo "Use common files for 0/, constant/ and blockMeshDict"
+\rm -rf 0 constant
+\cp -r ../common/0.org 0
+\cp -r ../common/constant constant
+
+m4 system/blockMeshDict.m4 > system/blockMeshDict
+
+runApplication blockMesh
+runApplication $(getApplication)
+
+#------------------------------------------------------------------------------
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/blockMeshDict.m4 b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/blockMeshDict.m4
new file mode 120000
index 0000000000000000000000000000000000000000..55f23c148bb2123e27460000f3762b0ed5bb3ec0
--- /dev/null
+++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/blockMeshDict.m4
@@ -0,0 +1 @@
+../../common/blockMeshDict.m4
\ No newline at end of file
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/controlDict b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/controlDict
similarity index 100%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/controlDict
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/controlDict
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvSchemes b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/fvSchemes
similarity index 100%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvSchemes
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/fvSchemes
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvSolution b/tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/fvSolution
similarity index 100%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvSolution
rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuct/implicit/system/fvSolution
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/0 b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/0
deleted file mode 120000
index f1c4a884b51ae4171513426c3b7f5f585d0d889e..0000000000000000000000000000000000000000
--- a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/0
+++ /dev/null
@@ -1 +0,0 @@
-../angledDuctImplicit/0
\ No newline at end of file
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/Allrun b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/Allrun
deleted file mode 120000
index 09efeaf930d72136d1edbe49a421bc368227ad21..0000000000000000000000000000000000000000
--- a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/Allrun
+++ /dev/null
@@ -1 +0,0 @@
-../angledDuctImplicit/Allrun
\ No newline at end of file
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/constant b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/constant
deleted file mode 120000
index 28205c782b36471b118c5be2948a56e345961ad4..0000000000000000000000000000000000000000
--- a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/constant
+++ /dev/null
@@ -1 +0,0 @@
-../angledDuctImplicit/constant
\ No newline at end of file
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/blockMeshDict.m4 b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/blockMeshDict.m4
deleted file mode 120000
index baa86f23b953deafb91190ffebcd14cc52a4c9b6..0000000000000000000000000000000000000000
--- a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/blockMeshDict.m4
+++ /dev/null
@@ -1 +0,0 @@
-../../angledDuctImplicit/system/blockMeshDict.m4
\ No newline at end of file
diff --git a/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/Allrun b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/Allrun
index 2a52698c048ffc2190e6ade7004cf628615b9a77..bb18fc3feba924ebddaced6d10f819a199c2870b 100755
--- a/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/Allrun
+++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/Allrun
@@ -6,7 +6,7 @@ m4 system/blockMeshDict.m4 > system/blockMeshDict
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication $application
diff --git a/tutorials/compressible/sonicFoam/laminar/shockTube/0/magU b/tutorials/compressible/sonicFoam/laminar/shockTube/0/magU
deleted file mode 100644
index 16667d2d548f55f83405650dba43f393129eed97..0000000000000000000000000000000000000000
--- a/tutorials/compressible/sonicFoam/laminar/shockTube/0/magU
+++ /dev/null
@@ -1,34 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    object      magU;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 1 -1 0 0 0 0];
-
-internalField   uniform 0;
-
-boundaryField
-{
-    sides
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    empty
-    {
-        type            empty;
-    }
-}
-
-// ************************************************************************* //
diff --git a/tutorials/compressible/sonicFoam/laminar/shockTube/Allclean b/tutorials/compressible/sonicFoam/laminar/shockTube/Allclean
index a0d99d7592b95b40323d2be71a2c72b161434323..6e94f2d9da6aad4e33d77f78a333c0a8efb266b7 100755
--- a/tutorials/compressible/sonicFoam/laminar/shockTube/Allclean
+++ b/tutorials/compressible/sonicFoam/laminar/shockTube/Allclean
@@ -4,9 +4,10 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial clean functions
 . $WM_PROJECT_DIR/bin/tools/CleanFunctions
 
+# Remove 0.org/ copy
+\rm -rf 0
+
 cleanCase
-rm -rf 0
-cp -r 0.org 0
 cleanSamples
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/compressible/sonicFoam/laminar/shockTube/Allrun b/tutorials/compressible/sonicFoam/laminar/shockTube/Allrun
index 20ffce0a1503bf7c7a8a4ae7b80b8bb6c90fe005..1280a8c6d70fa3c18cf6109a575b79696396de1c 100755
--- a/tutorials/compressible/sonicFoam/laminar/shockTube/Allrun
+++ b/tutorials/compressible/sonicFoam/laminar/shockTube/Allrun
@@ -4,8 +4,9 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
+restore0Dir
 runApplication blockMesh
 runApplication setFields
 runApplication $application
diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun
index b6157963bef3ce33c0f5f47dd8dcab1d2665d805..44af4c156cd3f8ad594bd95c1110b9db5cec6a21 100755
--- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun
+++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Get application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication star3ToFoam prostar/nacaAirfoil
 
diff --git a/tutorials/compressible/sonicLiquidFoam/Allrun b/tutorials/compressible/sonicLiquidFoam/Allrun
index 044fd34bfcb7057520ee4a3a2863b3ffa5ce0dd9..deb3e8f4c6ec6c8798de5ea2e8e29f4ed2f9beb1 100755
--- a/tutorials/compressible/sonicLiquidFoam/Allrun
+++ b/tutorials/compressible/sonicLiquidFoam/Allrun
@@ -39,7 +39,7 @@ cloneCase decompressionTank decompressionTankFine
 
     # And execute
     runApplication blockMesh
-    runApplication `getApplication`
+    runApplication $(getApplication)
 )
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/discreteMethods/dsmcFoam/freeSpacePeriodic/Allrun b/tutorials/discreteMethods/dsmcFoam/freeSpacePeriodic/Allrun
index 120c352ecbb28eaf8d242b621877b3672e7eba8a..d56e57bf75b28c7a2a795908570a5ddeafd88e68 100755
--- a/tutorials/discreteMethods/dsmcFoam/freeSpacePeriodic/Allrun
+++ b/tutorials/discreteMethods/dsmcFoam/freeSpacePeriodic/Allrun
@@ -6,6 +6,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 runApplication blockMesh
 runApplication dsmcInitialise
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/discreteMethods/dsmcFoam/freeSpaceStream/Allrun b/tutorials/discreteMethods/dsmcFoam/freeSpaceStream/Allrun
index 120c352ecbb28eaf8d242b621877b3672e7eba8a..d56e57bf75b28c7a2a795908570a5ddeafd88e68 100755
--- a/tutorials/discreteMethods/dsmcFoam/freeSpaceStream/Allrun
+++ b/tutorials/discreteMethods/dsmcFoam/freeSpaceStream/Allrun
@@ -6,6 +6,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 runApplication blockMesh
 runApplication dsmcInitialise
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/discreteMethods/dsmcFoam/supersonicCorner/Allrun b/tutorials/discreteMethods/dsmcFoam/supersonicCorner/Allrun
index f502a72e59f2fe886980a6fa85bfeb4729489c05..d433a8c02696351d94bc86c06d9f46dfe5e8702a 100755
--- a/tutorials/discreteMethods/dsmcFoam/supersonicCorner/Allrun
+++ b/tutorials/discreteMethods/dsmcFoam/supersonicCorner/Allrun
@@ -7,7 +7,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 runApplication blockMesh
 runApplication decomposePar
 runParallel dsmcInitialise
-runParallel `getApplication`
+runParallel $(getApplication)
 runApplication reconstructPar -noLagrangian
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/discreteMethods/dsmcFoam/wedge15Ma5/Allrun b/tutorials/discreteMethods/dsmcFoam/wedge15Ma5/Allrun
index 45c06e38e538e2f5edd69507cad30c258915be46..3d5ec5cbd9fec109f1a3b956843e5297e88a495d 100755
--- a/tutorials/discreteMethods/dsmcFoam/wedge15Ma5/Allrun
+++ b/tutorials/discreteMethods/dsmcFoam/wedge15Ma5/Allrun
@@ -7,7 +7,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 runApplication blockMesh
 runApplication decomposePar
 runParallel dsmcInitialise
-runParallel `getApplication`
+runParallel $(getApplication)
 runApplication reconstructPar -noLagrangian
 
 
diff --git a/tutorials/discreteMethods/molecularDynamics/mdEquilibrationFoam/periodicCubeArgon/Allrun b/tutorials/discreteMethods/molecularDynamics/mdEquilibrationFoam/periodicCubeArgon/Allrun
index 4830eb007fe98f9584308f2323607e754f89c3ad..31e783b003a15e72b62176dbfd6a700dc9f98a0a 100755
--- a/tutorials/discreteMethods/molecularDynamics/mdEquilibrationFoam/periodicCubeArgon/Allrun
+++ b/tutorials/discreteMethods/molecularDynamics/mdEquilibrationFoam/periodicCubeArgon/Allrun
@@ -6,6 +6,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 runApplication blockMesh
 runApplication mdInitialise
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/discreteMethods/molecularDynamics/mdEquilibrationFoam/periodicCubeWater/Allrun b/tutorials/discreteMethods/molecularDynamics/mdEquilibrationFoam/periodicCubeWater/Allrun
index 4830eb007fe98f9584308f2323607e754f89c3ad..31e783b003a15e72b62176dbfd6a700dc9f98a0a 100755
--- a/tutorials/discreteMethods/molecularDynamics/mdEquilibrationFoam/periodicCubeWater/Allrun
+++ b/tutorials/discreteMethods/molecularDynamics/mdEquilibrationFoam/periodicCubeWater/Allrun
@@ -6,6 +6,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 runApplication blockMesh
 runApplication mdInitialise
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/discreteMethods/molecularDynamics/mdFoam/nanoNozzle/Allrun b/tutorials/discreteMethods/molecularDynamics/mdFoam/nanoNozzle/Allrun
index 9f9a93ff378bac9ef7afdd63d968b65a47a67d65..c373ee10797d94fccb059947af2b28817d1cfdd8 100755
--- a/tutorials/discreteMethods/molecularDynamics/mdFoam/nanoNozzle/Allrun
+++ b/tutorials/discreteMethods/molecularDynamics/mdFoam/nanoNozzle/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 
diff --git a/tutorials/electromagnetics/mhdFoam/hartmann/Allrun b/tutorials/electromagnetics/mhdFoam/hartmann/Allrun
index bb8053763d99c22c3d43a793b99a030fa5c09c3b..97d68a3db16ddf90f49ee31ebdac0bd92f2bd41e 100755
--- a/tutorials/electromagnetics/mhdFoam/hartmann/Allrun
+++ b/tutorials/electromagnetics/mhdFoam/hartmann/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication $application
diff --git a/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/Allrun b/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/Allrun
index 0ecf4b2d131e04439b920ab89e582a41b75ef79b..a22b82774fca100b5aeb8158bba2f1658bc60413 100755
--- a/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/Allrun
+++ b/tutorials/heatTransfer/buoyantBoussinesqPimpleFoam/hotRoom/Allrun
@@ -4,10 +4,10 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
-cp 0/T.org 0/T
+\cp 0/T.org 0/T
 runApplication setFields
 runApplication $application
 
diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/Allrun b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/Allrun
index 0ecf4b2d131e04439b920ab89e582a41b75ef79b..a22b82774fca100b5aeb8158bba2f1658bc60413 100755
--- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/Allrun
+++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/Allrun
@@ -4,10 +4,10 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
-cp 0/T.org 0/T
+\cp 0/T.org 0/T
 runApplication setFields
 runApplication $application
 
diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/Allrun b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/Allrun
index de3f6389f8d419db1c3c0de06a858071503bfb90..29414545d79957f2a52f3a2701b069cbef51a4a5 100755
--- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/Allrun
+++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/Allrun
@@ -6,6 +6,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 runApplication blockMesh
 runApplication snappyHexMesh -overwrite
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/Allclean b/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/Allclean
index 6fe57d72bb88c7736433c3c3f301d03fd4930d17..c61a79c8105c65174ff51ea0774bde748d3fad15 100755
--- a/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/Allclean
+++ b/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/Allclean
@@ -5,6 +5,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/CleanFunctions
 
 cleanCase
-cp 0/T.org 0/T
+\cp 0/T.org 0/T
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/Allrun b/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/Allrun
index 0df95afd2e081913dc5c6a301fa9f299262850a1..b18d70e448c13fbaf243f01cff301f0dbb1c7193 100755
--- a/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/Allrun
+++ b/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Get application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication setFields
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/Allrun b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/Allrun
index 740f3a5ed6583c98a7c1c95911d6e64798403c76..ca50fd7fffae4d8fd3bd0932664e024f97c96ba0 100755
--- a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/Allrun
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication $application
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun
index e60b87bdff8224623c169366f20e327989a4e867..ae95e9ed6178a0e3289da1dcbbc5241fea4d3f1e 100755
--- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun
@@ -2,11 +2,11 @@
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Get application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 
-cp -r 0.org 0
+restore0Dir
 
 # Create 1D and 3D baffles
 runApplication createBaffles -overwrite
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/Allrun b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/Allrun
index 2d455d1fbce4041066fbb25494d9e84b6162fbb9..ebc19b3d2a4adff39cf7ca06c6c671b012c42337 100755
--- a/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/Allrun
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication $application
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/Allrun b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/Allrun
index 2d455d1fbce4041066fbb25494d9e84b6162fbb9..ebc19b3d2a4adff39cf7ca06c6c671b012c42337 100755
--- a/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/Allrun
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication $application
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/Allrun
index 42f495ac5ff5d4eeaf7101d3825b142704554b01..225acd829ffc3db0773edc3ec194daf2b88a455c 100755
--- a/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/Allrun
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/Allrun
@@ -23,7 +23,7 @@ do
     viewFactorsGen -region $i > log.viewFactorsGen.$i 2>&1
 done
 
-runApplication `getApplication`
+runApplication $(getApplication)
 
 
 echo
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun
index 602f7159e246c7a5884657fe1cb5338285a73cfc..c569b7602900b6a29519feeac89da53dff5d0480 100755
--- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun
@@ -23,13 +23,13 @@ done
 
 
 #-- Run on single processor
-#runApplication `getApplication`
+#runApplication $(getApplication)
 
 # Decompose
 runApplication decomposePar -allRegions
 
 # Run
-runParallel `getApplication`
+runParallel $(getApplication)
 
 # Reconstruct
 runApplication reconstructPar -allRegions
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun
index 6e65d8528093282cbcb3559e2a71956e765244f7..c21e4adafc5d07096c4e4ff49e6eaeeda2b22686 100755
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun
@@ -27,14 +27,14 @@ done
 
 
 #-- Run on single processor
-runApplication `getApplication`
+runApplication $(getApplication)
 
 
 ## Decompose
 #runApplication decomposePar -allRegions
 #
 ## Run
-#runParallel `getApplication`
+#runParallel $(getApplication)
 #
 ## Reconstruct
 #runApplication reconstructPar -allRegions
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/Allrun
index 0330f6a530dd38e970d6ebf0873b22443bd11a53..b75fde5c9ae8f36318c4379bf242a02aa14b428f 100755
--- a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/Allrun
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/Allrun
@@ -21,7 +21,6 @@ rm log.topoSet
 runApplication topoSet -region cabin -dict system/topoSetDictRegister
 
 # set the initial fields
-rm -rf 0
-cp -rf 0.org 0
+restore0Dir
 
 runApplication $(getApplication)
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldDefrost/Allrun.pre b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldDefrost/Allrun.pre
index f22237bf9d32d1eb9d350251e6e9877b4824c03f..0818ebd1a40260e62abc584c3d06d02b8eeaa0d3 100755
--- a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldDefrost/Allrun.pre
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldDefrost/Allrun.pre
@@ -17,5 +17,4 @@ runApplication subsetMesh c0 -patch walls -overwrite
 runApplication splitMeshRegions -cellZones -overwrite
 
 # set the initial fields
-rm -rf 0
-cp -rf 0.org 0
+restore0Dir
diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun.pre b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun.pre
index 020b201778e407bdb250930be2a642fec4faffec..9780d15756a99cbd58fa55ac1c5c307225c28f93 100755
--- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun.pre
+++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun.pre
@@ -1,5 +1,4 @@
 #!/bin/sh
-
 cd ${0%/*} || exit 1    # Run from this directory
 
 # Source tutorial run functions
@@ -25,5 +24,4 @@ rm -rf constant/air/polyMesh/sets
 paraFoam -touch -region porous
 paraFoam -touch -region air
 
-
-cp -rf 0.org 0
+restore0Dir
diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun
index 1b32e96d009a5187e710cc385beb62bfc7a67ab2..8224dffa9cecfa534e484c4a5b499d5a5d6cac21 100755
--- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun
+++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun
@@ -26,7 +26,7 @@ do
         viewFactorsGen -region $i
 done
 
-runApplication `getApplication`
+runApplication $(getApplication)
 
 
 
diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun-parallel b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun-parallel
index f248b4fb32d4b9118de184d09d45ffb7ce33ec64..919b7d0b75e30b88893e4f236f069c7760c60762 100755
--- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun-parallel
+++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun-parallel
@@ -30,7 +30,7 @@ do
 done
 
 # Run
-runParallel `getApplication`
+runParallel $(getApplication)
 
 # Reconstruct
 runApplication reconstructPar -allRegions
diff --git a/tutorials/incompressible/SRFPimpleFoam/rotor2D/Allrun b/tutorials/incompressible/SRFPimpleFoam/rotor2D/Allrun
index 85523c3f63f17d1a0ce22c3ab71f10bb03efa83e..021754896d883a41abdb24b4ad7788561d03e14f 100755
--- a/tutorials/incompressible/SRFPimpleFoam/rotor2D/Allrun
+++ b/tutorials/incompressible/SRFPimpleFoam/rotor2D/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 ./makeMesh
 runApplication $application
diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun
index 26d2834e812715c80ebc6ae0c5619da949dfb174..b52a9468196e4a09eaf4a4f2bd34fb88ce8ecfcc 100755
--- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun
+++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun
@@ -17,7 +17,7 @@ do
     sed "s/XXX/$e/g" constant/transportProperties.template \
         > constant/transportProperties
 
-    runApplication -s $e  `getApplication`
+    runApplication -s $e  $(getApplication)
 
     # extract y+, U+
     # note: both must be added to foamLog.db
diff --git a/tutorials/incompressible/icoFoam/cavity/Allrun b/tutorials/incompressible/icoFoam/cavity/Allrun
index 97f489d7f8aa7d9837e884ddfee18b787cb1d8bc..fdeea0d08d27ca384b93046e244cd850ec2e756c 100755
--- a/tutorials/incompressible/icoFoam/cavity/Allrun
+++ b/tutorials/incompressible/icoFoam/cavity/Allrun
@@ -83,7 +83,7 @@ do
     esac
 
     previousCase="$caseName"
-    ( cd $caseName && runApplication `getApplication` )
+    ( cd $caseName && runApplication $(getApplication) )
 done
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/compressible/sonicFoam/laminar/shockTube/0/U b/tutorials/incompressible/icoFoam/cavityMappingTest/0/U
similarity index 81%
rename from tutorials/compressible/sonicFoam/laminar/shockTube/0/U
rename to tutorials/incompressible/icoFoam/cavityMappingTest/0/U
index 6daaa08ce7fb6c4f14989d5cf88766de76ee2c41..d7c2b91165036e340fb792eee998e00d2277a39e 100644
--- a/tutorials/compressible/sonicFoam/laminar/shockTube/0/U
+++ b/tutorials/incompressible/icoFoam/cavityMappingTest/0/U
@@ -20,12 +20,19 @@ internalField   uniform (0 0 0);
 
 boundaryField
 {
-    sides
+    movingWall
     {
-        type            zeroGradient;
+        type            fixedValue;
+        value           uniform (1 0 0);
     }
 
-    empty
+    fixedWalls
+    {
+        type            fixedValue;
+        value           uniform (0 0 0);
+    }
+
+    frontAndBack
     {
         type            empty;
     }
diff --git a/tutorials/compressible/sonicFoam/laminar/shockTube/0/p b/tutorials/incompressible/icoFoam/cavityMappingTest/0/p
similarity index 88%
rename from tutorials/compressible/sonicFoam/laminar/shockTube/0/p
rename to tutorials/incompressible/icoFoam/cavityMappingTest/0/p
index 0ea4de322c483eec4f59823b44e9a4989b92c09d..0976329cedb48dfa5dff2d203e19418e7e757993 100644
--- a/tutorials/compressible/sonicFoam/laminar/shockTube/0/p
+++ b/tutorials/incompressible/icoFoam/cavityMappingTest/0/p
@@ -14,18 +14,23 @@ FoamFile
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [1 -1 -2 0 0 0 0];
+dimensions      [0 2 -2 0 0 0 0];
 
 internalField   uniform 0;
 
 boundaryField
 {
-    sides
+    movingWall
     {
         type            zeroGradient;
     }
 
-    empty
+    fixedWalls
+    {
+        type            zeroGradient;
+    }
+
+    frontAndBack
     {
         type            empty;
     }
diff --git a/tutorials/incompressible/icoFoam/cavityMappingTest/Allclean b/tutorials/incompressible/icoFoam/cavityMappingTest/Allclean
new file mode 100755
index 0000000000000000000000000000000000000000..0280fc46544361e40d3891c2fcf9afbf231c2fcb
--- /dev/null
+++ b/tutorials/incompressible/icoFoam/cavityMappingTest/Allclean
@@ -0,0 +1,11 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # run from this directory
+
+# Source tutorial run functions
+. $WM_PROJECT_DIR/bin/tools/CleanFunctions
+
+cleanCase
+
+rm -rf constant/coarseMesh
+
+
diff --git a/tutorials/incompressible/icoFoam/cavityMappingTest/Allrun b/tutorials/incompressible/icoFoam/cavityMappingTest/Allrun
new file mode 100755
index 0000000000000000000000000000000000000000..166a1200d591c5dfdc4a1d24c2b55bf4ab0b33e0
--- /dev/null
+++ b/tutorials/incompressible/icoFoam/cavityMappingTest/Allrun
@@ -0,0 +1,15 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # run from this directory
+
+# Source tutorial run functions
+. $WM_PROJECT_DIR/bin/tools/RunFunctions
+
+runApplication -s coarseMesh blockMesh -dict system/blockMeshDict.coarse
+
+mkdir constant/coarseMesh
+mv constant/polyMesh constant/coarseMesh
+
+runApplication -s fine blockMesh -dict system/blockMeshDict.fine
+
+runApplication $(getApplication)
+
diff --git a/tutorials/incompressible/icoFoam/cavityMappingTest/Allrun-parallel b/tutorials/incompressible/icoFoam/cavityMappingTest/Allrun-parallel
new file mode 100755
index 0000000000000000000000000000000000000000..bd03d75d47d7c35b15bb7aa63dd63783322a4784
--- /dev/null
+++ b/tutorials/incompressible/icoFoam/cavityMappingTest/Allrun-parallel
@@ -0,0 +1,22 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # run from this directory
+
+# Source tutorial run functions
+. $WM_PROJECT_DIR/bin/tools/RunFunctions
+
+runApplication -s coarseMesh blockMesh -dict system/blockMeshDict.coarse
+
+mkdir constant/coarseMesh
+mv constant/polyMesh constant/coarseMesh
+
+runApplication -s fine blockMesh -dict system/blockMeshDict.fine
+
+runApplication -s fine decomposePar
+
+runApplication -s coarseMesh decomposePar -region coarseMesh
+
+runParallel $(getApplication)
+
+#runApplication -s fine reconstructPar
+#
+#runApplication -s coarseMesh reconstructPar -region coarseMesh
diff --git a/tutorials/incompressible/icoFoam/cavityMappingTest/constant/transportProperties b/tutorials/incompressible/icoFoam/cavityMappingTest/constant/transportProperties
new file mode 100644
index 0000000000000000000000000000000000000000..2509c1167036ff6be8aae5ab268ac01b2f71f90a
--- /dev/null
+++ b/tutorials/incompressible/icoFoam/cavityMappingTest/constant/transportProperties
@@ -0,0 +1,21 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "constant";
+    object      transportProperties;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+nu              [0 2 -1 0 0 0 0] 0.01;
+
+
+// ************************************************************************* //
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/0/N2 b/tutorials/incompressible/icoFoam/cavityMappingTest/system/blockMeshDict.coarse
similarity index 56%
rename from tutorials/lagrangian/reactingParcelFoam/filter/0/N2
rename to tutorials/incompressible/icoFoam/cavityMappingTest/system/blockMeshDict.coarse
index 4945cb5afaf6cf316194f62ce9339871f531ceeb..3118c894d875f5cf3287d1714402b6bd2cd2f48f 100644
--- a/tutorials/lagrangian/reactingParcelFoam/filter/0/N2
+++ b/tutorials/incompressible/icoFoam/cavityMappingTest/system/blockMeshDict.coarse
@@ -9,52 +9,67 @@ FoamFile
 {
     version     2.0;
     format      ascii;
-    class       volScalarField;
-    location    "1";
-    object      N2;
+    class       dictionary;
+    object      blockMeshDict;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [0 0 0 0 0 0 0];
+convertToMeters 0.1;
 
-internalField   uniform 0.79;
+vertices
+(
+    (0 0 0)
+    (1 0 0)
+    (1 1 0)
+    (0 1 0)
+    (0 0 0.1)
+    (1 0 0.1)
+    (1 1 0.1)
+    (0 1 0.1)
+);
 
-boundaryField
-{
-    walls
-    {
-        type            zeroGradient;
-    }
-    inlet
-    {
-        type            fixedValue;
-        value           uniform 0.79;
-    }
-    outlet
-    {
-        type            zeroGradient;
-    }
-    cycLeft_half0
+blocks
+(
+    hex (0 1 2 3 4 5 6 7) (10 10 1) simpleGrading (1 1 1)
+);
+
+edges
+(
+);
+
+boundary
+(
+    movingWall
     {
-        type            cyclic;
+        type wall;
+        faces
+        (
+            (3 7 6 2)
+        );
     }
-    cycRight_half0
+    fixedWalls
     {
-        type            cyclic;
+        type wall;
+        faces
+        (
+            (0 4 7 3)
+            (2 6 5 1)
+            (1 5 4 0)
+        );
     }
     frontAndBack
     {
-        type            empty;
-    }
-    cycLeft_half1
-    {
-        type            cyclic;
+        type empty;
+        faces
+        (
+            (0 3 2 1)
+            (4 5 6 7)
+        );
     }
-    cycRight_half1
-    {
-        type            cyclic;
-    }
-}
+);
 
+mergePatchPairs
+(
+);
 
 // ************************************************************************* //
diff --git a/tutorials/incompressible/icoFoam/cavityMappingTest/system/blockMeshDict.fine b/tutorials/incompressible/icoFoam/cavityMappingTest/system/blockMeshDict.fine
new file mode 100644
index 0000000000000000000000000000000000000000..ff18fe91723135de7fa3e1ba09eba593d88f9d53
--- /dev/null
+++ b/tutorials/incompressible/icoFoam/cavityMappingTest/system/blockMeshDict.fine
@@ -0,0 +1,75 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      blockMeshDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+convertToMeters 0.1;
+
+vertices
+(
+    (0 0 0)
+    (1 0 0)
+    (1 1 0)
+    (0 1 0)
+    (0 0 0.1)
+    (1 0 0.1)
+    (1 1 0.1)
+    (0 1 0.1)
+);
+
+blocks
+(
+    hex (0 1 2 3 4 5 6 7) (40 40 1) simpleGrading (1 1 1)
+);
+
+edges
+(
+);
+
+boundary
+(
+    movingWall
+    {
+        type wall;
+        faces
+        (
+            (3 7 6 2)
+        );
+    }
+    fixedWalls
+    {
+        type wall;
+        faces
+        (
+            (0 4 7 3)
+            (2 6 5 1)
+            (1 5 4 0)
+        );
+    }
+    frontAndBack
+    {
+        type empty;
+        faces
+        (
+            (0 3 2 1)
+            (4 5 6 7)
+        );
+    }
+);
+
+mergePatchPairs
+(
+);
+
+// ************************************************************************* //
diff --git a/tutorials/compressible/rhoCentralFoam/shockTube/0/T b/tutorials/incompressible/icoFoam/cavityMappingTest/system/coarseMesh/decomposeParDict
similarity index 76%
rename from tutorials/compressible/rhoCentralFoam/shockTube/0/T
rename to tutorials/incompressible/icoFoam/cavityMappingTest/system/coarseMesh/decomposeParDict
index be0ffe06861659c3099048c43ebd8dff2bc6b576..cf5823a268b17fd8933f76576d5cef47162faec6 100644
--- a/tutorials/compressible/rhoCentralFoam/shockTube/0/T
+++ b/tutorials/incompressible/icoFoam/cavityMappingTest/system/coarseMesh/decomposeParDict
@@ -9,26 +9,15 @@ FoamFile
 {
     version     2.0;
     format      ascii;
-    class       volScalarField;
-    object      T;
+    class       dictionary;
+    note        "mesh decomposition control dictionary";
+    object      decomposeParDict;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [0 0 0 1 0 0 0];
+numberOfSubdomains  4;
 
-internalField   uniform 1;
+method          scotch;
 
-boundaryField
-{
-    sides
-    {
-        type            zeroGradient;
-    }
-
-    empty
-    {
-        type            empty;
-    }
-}
 
 // ************************************************************************* //
diff --git a/tutorials/compressible/sonicFoam/laminar/shockTube/0/T b/tutorials/incompressible/icoFoam/cavityMappingTest/system/coarseMesh/fvSchemes
similarity index 76%
rename from tutorials/compressible/sonicFoam/laminar/shockTube/0/T
rename to tutorials/incompressible/icoFoam/cavityMappingTest/system/coarseMesh/fvSchemes
index be0ffe06861659c3099048c43ebd8dff2bc6b576..ed9c4fbcc411499caa627ed412a47671ed3425c6 100644
--- a/tutorials/compressible/sonicFoam/laminar/shockTube/0/T
+++ b/tutorials/incompressible/icoFoam/cavityMappingTest/system/coarseMesh/fvSchemes
@@ -9,26 +9,35 @@ FoamFile
 {
     version     2.0;
     format      ascii;
-    class       volScalarField;
-    object      T;
+    class       dictionary;
+    location    "system";
+    object      fvSchemes;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [0 0 0 1 0 0 0];
+ddtSchemes
+{
+}
+
+gradSchemes
+{
+}
+
+divSchemes
+{
+}
 
-internalField   uniform 1;
+laplacianSchemes
+{
+}
 
-boundaryField
+interpolationSchemes
 {
-    sides
-    {
-        type            zeroGradient;
-    }
-
-    empty
-    {
-        type            empty;
-    }
 }
 
+snGradSchemes
+{
+}
+
+
 // ************************************************************************* //
diff --git a/tutorials/incompressible/icoFoam/cavityMappingTest/system/coarseMesh/fvSolution b/tutorials/incompressible/icoFoam/cavityMappingTest/system/coarseMesh/fvSolution
new file mode 100644
index 0000000000000000000000000000000000000000..cb6c43877e550400f031a94d663b2cfc0deb94e8
--- /dev/null
+++ b/tutorials/incompressible/icoFoam/cavityMappingTest/system/coarseMesh/fvSolution
@@ -0,0 +1,19 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      fvSolution;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+
+// ************************************************************************* //
diff --git a/tutorials/incompressible/icoFoam/cavityMappingTest/system/controlDict b/tutorials/incompressible/icoFoam/cavityMappingTest/system/controlDict
new file mode 100644
index 0000000000000000000000000000000000000000..ba55911fb4f33869e27e2a81f4f97b566721a90b
--- /dev/null
+++ b/tutorials/incompressible/icoFoam/cavityMappingTest/system/controlDict
@@ -0,0 +1,66 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      controlDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+application     icoFoam;
+
+startFrom       startTime;
+
+startTime       0;
+
+stopAt          endTime;
+
+endTime         0.5;
+
+deltaT          0.005;
+
+writeControl    timeStep;
+
+writeInterval   20;
+
+purgeWrite      0;
+
+writeFormat     ascii;
+
+writePrecision  6;
+
+writeCompression off;
+
+timeFormat      general;
+
+timePrecision   6;
+
+runTimeModifiable true;
+
+functions
+{
+    meshInterp1
+    {
+        type            mapFieldsFO;
+        functionObjectLibs ("libutilityFunctionObjects.so");
+        outputControl   timeStep;
+        outputInterval  1;
+
+        mapRegion       coarseMesh;
+        mapMethod       cellVolumeWeight;
+        consistent      yes;
+
+        fields          (U); // ("U.*" "p.*");
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/compressible/rhoCentralFoam/shockTube/0/p b/tutorials/incompressible/icoFoam/cavityMappingTest/system/decomposeParDict
similarity index 76%
rename from tutorials/compressible/rhoCentralFoam/shockTube/0/p
rename to tutorials/incompressible/icoFoam/cavityMappingTest/system/decomposeParDict
index 0ea4de322c483eec4f59823b44e9a4989b92c09d..cf5823a268b17fd8933f76576d5cef47162faec6 100644
--- a/tutorials/compressible/rhoCentralFoam/shockTube/0/p
+++ b/tutorials/incompressible/icoFoam/cavityMappingTest/system/decomposeParDict
@@ -9,26 +9,15 @@ FoamFile
 {
     version     2.0;
     format      ascii;
-    class       volScalarField;
-    object      p;
+    class       dictionary;
+    note        "mesh decomposition control dictionary";
+    object      decomposeParDict;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [1 -1 -2 0 0 0 0];
+numberOfSubdomains  4;
 
-internalField   uniform 0;
+method          scotch;
 
-boundaryField
-{
-    sides
-    {
-        type            zeroGradient;
-    }
-
-    empty
-    {
-        type            empty;
-    }
-}
 
 // ************************************************************************* //
diff --git a/tutorials/incompressible/icoFoam/cavityMappingTest/system/fvSchemes b/tutorials/incompressible/icoFoam/cavityMappingTest/system/fvSchemes
new file mode 100644
index 0000000000000000000000000000000000000000..b43ea748acac4a463d3b4345302831e83227cce6
--- /dev/null
+++ b/tutorials/incompressible/icoFoam/cavityMappingTest/system/fvSchemes
@@ -0,0 +1,51 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      fvSchemes;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ddtSchemes
+{
+    default         Euler;
+}
+
+gradSchemes
+{
+    default         Gauss linear;
+    grad(p)         Gauss linear;
+}
+
+divSchemes
+{
+    default         none;
+    div(phi,U)      Gauss linear;
+}
+
+laplacianSchemes
+{
+    default         Gauss linear orthogonal;
+}
+
+interpolationSchemes
+{
+    default         linear;
+}
+
+snGradSchemes
+{
+    default         orthogonal;
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/p b/tutorials/incompressible/icoFoam/cavityMappingTest/system/fvSolution
similarity index 60%
rename from tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/p
rename to tutorials/incompressible/icoFoam/cavityMappingTest/system/fvSolution
index bef7aaa77adf9b09852de5ec0b4ae64e36a7162a..fb6e8e4622bd61357b957200d65625fc51c67b5f 100644
--- a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/p
+++ b/tutorials/incompressible/icoFoam/cavityMappingTest/system/fvSolution
@@ -9,44 +9,44 @@ FoamFile
 {
     version     2.0;
     format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      p;
+    class       dictionary;
+    location    "system";
+    object      fvSolution;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [1 -1 -2 0 0 0 0];
-
-internalField   uniform 100000;
-
-boundaryField
+solvers
 {
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
+    p
     {
-        type            symmetryPlane;
+        solver          PCG;
+        preconditioner  DIC;
+        tolerance       1e-06;
+        relTol          0.05;
     }
-    inletCentral
-    {
-        type            zeroGradient;
-    }
-    inletSides
-    {
-        type            zeroGradient;
-    }
-    outlet
+
+    pFinal
     {
-        type            fixedValue;
-        value           uniform 100000;
+        $p;
+        relTol          0;
     }
-    walls
+
+    U
     {
-        type            zeroGradient;
+        solver          smoothSolver;
+        smoother        symGaussSeidel;
+        tolerance       1e-05;
+        relTol          0;
     }
 }
 
+PISO
+{
+    nCorrectors     2;
+    nNonOrthogonalCorrectors 0;
+    pRefCell        0;
+    pRefValue       0;
+}
+
 
 // ************************************************************************* //
diff --git a/tutorials/incompressible/icoFoam/elbow/Allrun b/tutorials/incompressible/icoFoam/elbow/Allrun
index 60c5cad9436d849fb485521dbae712d9bbe576e0..6da96f6a7449cf37b120d9bb2a51add9457c65ab 100755
--- a/tutorials/incompressible/icoFoam/elbow/Allrun
+++ b/tutorials/incompressible/icoFoam/elbow/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Get application directory
-application=`getApplication`
+application=$(getApplication)
 
 runApplication fluentMeshToFoam elbow.msh
 runApplication "$application"
diff --git a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun
index ebb40610158eefe6f05f4487a386212b57b26264..c454c9b3f638cae0f1a9c8cefe4a74b2af56a79e 100755
--- a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun
+++ b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 ./makeMesh
 
diff --git a/tutorials/incompressible/pimpleDyMFoam/oscillatingInletACMI2D/Allrun.pre b/tutorials/incompressible/pimpleDyMFoam/oscillatingInletACMI2D/Allrun.pre
index db20559080d46c1eb5389c8ddd1ffbcb3a8c0c36..c18efa4cc95375c8a4a5ca98b190ad4c02c4b803 100755
--- a/tutorials/incompressible/pimpleDyMFoam/oscillatingInletACMI2D/Allrun.pre
+++ b/tutorials/incompressible/pimpleDyMFoam/oscillatingInletACMI2D/Allrun.pre
@@ -14,4 +14,4 @@ runApplication createBaffles -overwrite
 # remove zero-sized patches
 runApplication createPatch -overwrite
 
-cp -rf 0.org 0
+restore0Dir
diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun b/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun
index 1d24256eb001c223c17e9fda2ebb9b33acd77dbc..3f7cab5d82e34e43d25b7b1a4dfbe80e21a7248f 100755
--- a/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun
+++ b/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun
@@ -8,6 +8,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 runApplication decomposePar
 
-runParallel `getApplication`
+runParallel $(getApplication)
 
 runApplication reconstructPar
diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun.pre b/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun.pre
index e35686cce40151eb195724c43f0096d44e2a53b8..15491d569a9a750b15559cafc559e5775159516e 100755
--- a/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun.pre
+++ b/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun.pre
@@ -11,11 +11,8 @@ cp $FOAM_TUTORIALS/resources/geometry/propellerTip.obj.gz constant/triSurface/
 # - meshing
 
 runApplication blockMesh
-
 runApplication surfaceFeatureExtract
-
 runApplication snappyHexMesh -overwrite
-
 runApplication renumberMesh -overwrite
 
 # force removal of fields generated by snappy
@@ -31,4 +28,4 @@ runApplication createPatch -overwrite
 #runApplication moveDynamicMesh -checkAMI
 
 # - set the initial fields
-cp -rf 0.org 0
+restore0Dir
diff --git a/tutorials/incompressible/pimpleDyMFoam/wingMotion/Allclean b/tutorials/incompressible/pimpleDyMFoam/wingMotion/Allclean
index f7d6ef5a87a7ae4ecf367325d09b64bda498246a..d01b222a10e303146c99367a82f47526ffaed6e7 100755
--- a/tutorials/incompressible/pimpleDyMFoam/wingMotion/Allclean
+++ b/tutorials/incompressible/pimpleDyMFoam/wingMotion/Allclean
@@ -4,14 +4,19 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/CleanFunctions
 
-cd wingMotion_snappyHexMesh
-cleanCase
+(
+    cd wingMotion_snappyHexMesh || exit 1
+    cleanCase
+)
 
-cd ../wingMotion2D_simpleFoam
-cleanCase
-rm -rf 0
-
-cd ../wingMotion2D_pimpleDyMFoam
-cleanCase
-rm -rf 0
+(
+    cd wingMotion2D_simpleFoam || exit 1
+    cleanCase
+    rm -rf 0
+)
 
+(
+    cd wingMotion2D_pimpleDyMFoam || exit 1
+    cleanCase
+    rm -rf 0
+)
diff --git a/tutorials/incompressible/pimpleDyMFoam/wingMotion/Allrun b/tutorials/incompressible/pimpleDyMFoam/wingMotion/Allrun
index 997bdd6cfb8e308c6c960552cef3909f00713369..0b5930fddc5c651b82ca29b0f99359baa3948b52 100755
--- a/tutorials/incompressible/pimpleDyMFoam/wingMotion/Allrun
+++ b/tutorials/incompressible/pimpleDyMFoam/wingMotion/Allrun
@@ -5,26 +5,36 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Make 3D mesh in slab of cells.
-cd wingMotion_snappyHexMesh
-runApplication blockMesh
-runApplication snappyHexMesh -overwrite
+(
+    cd wingMotion_snappyHexMesh || exit 1
+
+    runApplication blockMesh
+    runApplication snappyHexMesh -overwrite
+)
 
 # Make a 2D mesh by extruding a patch and solve to steady state.
-cd ../wingMotion2D_simpleFoam
-runApplication extrudeMesh
-runApplication createPatch -overwrite
-cp -r 0.org 0
-runApplication simpleFoam
-
-# Copy the mesh from the steady state case and map the results to a
-# mesh motion case, then solve transient.
-cd ../wingMotion2D_pimpleDyMFoam
-cp -r ../wingMotion2D_simpleFoam/constant/polyMesh constant
-cp -r 0.org 0
-runApplication mapFields ../wingMotion2D_simpleFoam -sourceTime latestTime -consistent
-mv 0/pointDisplacement.unmapped 0/pointDisplacement
-runApplication decomposePar
-runParallel `getApplication`
-runApplication reconstructPar
+(
+    cd wingMotion2D_simpleFoam || exit 1
+
+    runApplication extrudeMesh
+    runApplication createPatch -overwrite
+    restore0Dir
+    runApplication simpleFoam
+)
+
+# Copy mesh from the steady state case, map the results to a mesh motion case,
+# then solve transient.
+(
+    cd wingMotion2D_pimpleDyMFoam || exit 1
+
+    \rm -rf constant/polyMesh
+    \cp -r ../wingMotion2D_simpleFoam/constant/polyMesh constant
+    restore0Dir
+    runApplication mapFields ../wingMotion2D_simpleFoam -sourceTime latestTime -consistent
+    \mv 0/pointDisplacement.unmapped 0/pointDisplacement
+    runApplication decomposePar
+    runParallel $(getApplication)
+    runApplication reconstructPar
+)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun b/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun
index 628bd511a9424eac90f7addd67860d518b258814..827542cfc5a366343ebbc97cdd52d80cb380ea35 100755
--- a/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun
+++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun
@@ -4,14 +4,14 @@
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Get application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 
 # Create faceZones for baffles and fan
 runApplication topoSet
 
-cp -r 0.org 0
+restore0Dir
 
 # Create wall and cyclic baffles and the fields on them
 runApplication createBaffles -overwrite
diff --git a/tutorials/incompressible/pimpleFoam/channel395/Allrun b/tutorials/incompressible/pimpleFoam/channel395/Allrun
index 989291cfddfce20bf3ec218c646f46f00f39d47e..c34f2384400c2e7055fe566f7c4a8c8221ca8f7f 100755
--- a/tutorials/incompressible/pimpleFoam/channel395/Allrun
+++ b/tutorials/incompressible/pimpleFoam/channel395/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Get application directory
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/0/U b/tutorials/incompressible/pimpleFoam/channel395DFSEM/0/U
similarity index 63%
rename from tutorials/lagrangian/reactingParcelFoam/filter/0/U
rename to tutorials/incompressible/pimpleFoam/channel395DFSEM/0/U
index 3e05c93586cc51a32d73a3562874d0edf64a5740..a03c3479873cb8afe7aa806b42179add964650d8 100644
--- a/tutorials/lagrangian/reactingParcelFoam/filter/0/U
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/0/U
@@ -15,44 +15,45 @@ FoamFile
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [0 1 -1 0 0 0 0];
+dimensions      [ 0 1 -1 0 0 0 0 ];
 
-internalField   uniform (0 0 0);
+// Re = 395, L = pi, utau = 1, nu = pi/395 = 7.9534e-3
+// Ub/utau = 17.55
+internalField   uniform ( 17.55 0 0 );
 
 boundaryField
 {
-    walls
-    {
-        type            noSlip;
-    }
-    inlet
+    bottomWall
     {
         type            fixedValue;
-        value           uniform (5 0 0);
+        value           uniform ( 0 0 0 );
     }
-    outlet
+    topWall
     {
-        type            zeroGradient;
+        type            fixedValue;
+        value           uniform ( 0 0 0 );
     }
-    cycLeft_half0
+    sides_half0
     {
         type            cyclic;
     }
-    cycRight_half0
+    sides_half1
     {
         type            cyclic;
     }
-    frontAndBack
-    {
-        type            empty;
-    }
-    cycLeft_half1
+    inlet
     {
-        type            cyclic;
+        type            turbulentDFSEMInlet;
+        delta           2;
+        nCellPerEddy    1;
+        mapMethod       nearestCell;
+        value           $internalField;
     }
-    cycRight_half1
+    outlet
     {
-        type            cyclic;
+        type            inletOutlet;
+        inletValue      uniform (0 0 0);
+        value           uniform (0 0 0);
     }
 }
 
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/0/T b/tutorials/incompressible/pimpleFoam/channel395DFSEM/0/k
similarity index 72%
rename from tutorials/lagrangian/reactingParcelFoam/filter/0/T
rename to tutorials/incompressible/pimpleFoam/channel395DFSEM/0/k
index 331e1795f0e9cf9d7f62537a182ecb14e49583f3..f440f53296f9af5c26f542713263eb95b61ce832 100644
--- a/tutorials/lagrangian/reactingParcelFoam/filter/0/T
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/0/k
@@ -11,49 +11,43 @@ FoamFile
     format      ascii;
     class       volScalarField;
     location    "1";
-    object      T;
+    object      k;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [0 0 0 1 0 0 0];
+dimensions      [ 0 2 -2 0 0 0 0 ];
 
-internalField   uniform 350;
+internalField   uniform 1e-5;
 
 boundaryField
 {
-    walls
+    bottomWall
     {
         type            fixedValue;
-        value           uniform 400;
+        value           uniform 0;
     }
-    inlet
+    topWall
     {
         type            fixedValue;
-        value           uniform 350;
-    }
-    outlet
-    {
-        type            zeroGradient;
+        value           uniform 0;
     }
-    cycLeft_half0
+    sides_half0
     {
         type            cyclic;
     }
-    cycRight_half0
+    sides_half1
     {
         type            cyclic;
     }
-    frontAndBack
-    {
-        type            empty;
-    }
-    cycLeft_half1
+    inlet
     {
-        type            cyclic;
+        type            fixedValue;
+        value           $internalField;
     }
-    cycRight_half1
+    outlet
     {
-        type            cyclic;
+        type            fixedValue;
+        value           $internalField;
     }
 }
 
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/0/O2 b/tutorials/incompressible/pimpleFoam/channel395DFSEM/0/nut
similarity index 74%
rename from tutorials/lagrangian/reactingParcelFoam/filter/0/O2
rename to tutorials/incompressible/pimpleFoam/channel395DFSEM/0/nut
index 59ea6e8917b33152a284e52c378b01a3273c79ff..3f2c1f0c7b90966f53f2466fd93edeceb10f71d5 100644
--- a/tutorials/lagrangian/reactingParcelFoam/filter/0/O2
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/0/nut
@@ -11,48 +11,41 @@ FoamFile
     format      ascii;
     class       volScalarField;
     location    "1";
-    object      O2;
+    object      nut;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [0 0 0 0 0 0 0];
+dimensions      [ 0 2 -1 0 0 0 0 ];
 
-internalField   uniform 0.21;
+internalField   uniform 0;
 
 boundaryField
 {
-    walls
+    bottomWall
     {
         type            zeroGradient;
     }
-    inlet
-    {
-        type            fixedValue;
-        value           uniform 0.21;
-    }
-    outlet
+    topWall
     {
         type            zeroGradient;
     }
-    cycLeft_half0
+    sides_half0
     {
         type            cyclic;
     }
-    cycRight_half0
+    sides_half1
     {
         type            cyclic;
     }
-    frontAndBack
-    {
-        type            empty;
-    }
-    cycLeft_half1
+    inlet
     {
-        type            cyclic;
+        type            calculated;
+        value           uniform 1e-8;
     }
-    cycRight_half1
+    outlet
     {
-        type            cyclic;
+        type            calculated;
+        value           uniform 1e-8;
     }
 }
 
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/0/H2O b/tutorials/incompressible/pimpleFoam/channel395DFSEM/0/p
similarity index 81%
rename from tutorials/lagrangian/reactingParcelFoam/filter/0/H2O
rename to tutorials/incompressible/pimpleFoam/channel395DFSEM/0/p
index 02b28984a1b7d1f7b5c38fbcb8f3bf4f3352ea73..ba5b4cf7437dea993f5e077e84ae8d2522918e30 100644
--- a/tutorials/lagrangian/reactingParcelFoam/filter/0/H2O
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/0/p
@@ -11,48 +11,40 @@ FoamFile
     format      ascii;
     class       volScalarField;
     location    "1";
-    object      H2O;
+    object      p;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [0 0 0 0 0 0 0];
+dimensions      [ 0 2 -2 0 0 0 0 ];
 
 internalField   uniform 0;
 
 boundaryField
 {
-    walls
+    bottomWall
     {
         type            zeroGradient;
     }
-    inlet
-    {
-        type            fixedValue;
-        value           uniform 0;
-    }
-    outlet
+    topWall
     {
         type            zeroGradient;
     }
-    cycLeft_half0
+    sides_half0
     {
         type            cyclic;
     }
-    cycRight_half0
+    sides_half1
     {
         type            cyclic;
     }
-    frontAndBack
-    {
-        type            empty;
-    }
-    cycLeft_half1
+    inlet
     {
-        type            cyclic;
+        type            zeroGradient;
     }
-    cycRight_half1
+    outlet
     {
-        type            cyclic;
+        type            fixedValue;
+        value           uniform 0;
     }
 }
 
diff --git a/tutorials/incompressible/pimpleFoam/channel395DFSEM/Allrun b/tutorials/incompressible/pimpleFoam/channel395DFSEM/Allrun
new file mode 100755
index 0000000000000000000000000000000000000000..f3cf09467dc6f2f26197d540bafec7a12151fd9c
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/Allrun
@@ -0,0 +1,20 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # run from this directory
+
+# Source tutorial run functions
+. $WM_PROJECT_DIR/bin/tools/RunFunctions
+
+# Get application directory
+application=`getApplication`
+
+runApplication blockMesh
+
+#- Run serial
+#runApplication $application
+
+#- Run parallel
+runApplication decomposePar -cellDist
+runParallel $application
+#runApplication reconstructPar -latestTime
+
+# ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/incompressible/pimpleFoam/channel395DFSEM/README b/tutorials/incompressible/pimpleFoam/channel395DFSEM/README
new file mode 100644
index 0000000000000000000000000000000000000000..5763359c07b25ba617509f51e15b742ae72b1fed
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/README
@@ -0,0 +1,18 @@
+Channel test case for ReTau=395,based on the reference:
+
+    Poletto, R., Craft, T., and Revell, A.,
+    "A New Divergence Free Synthetic Eddy Method for the
+    Reproduction of Inlet Flow Conditions for LES",
+    Flow Turbulence Combust (2013) 91:519-539
+
+
+Inlet patch Reynolds stress, velocity and turbulence length scale data has been
+extracted from DNS data of:
+
+    Moser, Kim & Mansour
+    "DNS of Turbulent Channel Flow up to Re_tau=590",
+    Physics of Fluids (1999) vol 11, 943-945.
+
+Data available from (last checked 28 June 2016)
+
+    http://turbulence.ices.utexas.edu/MKM_1999.html
diff --git a/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/boundaryData/inlet/0/L b/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/boundaryData/inlet/0/L
new file mode 100644
index 0000000000000000000000000000000000000000..94aef1c2034e5847fae59462efcf57f04c520e97
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/boundaryData/inlet/0/L
@@ -0,0 +1,276 @@
+/*--------------------------------*- C++ -*----------------------------------*| =========                 |                                                 |
+| \      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \    /   O peration     | Version:  plus                                  |
+|   \  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       scalarAverageField;
+    object      values;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// LMean
+0
+
+(
+0
+1.76693e-06
+1.06447e-07
+2.85582e-08
+1.73393e-08
+3.56243e-08
+3.79499e-08
+1.50479e-07
+1.55614e-07
+1.93408e-07
+4.50118e-08
+2.6295e-10
+6.18128e-08
+4.4709e-08
+5.98657e-07
+2.25711e-06
+4.20946e-06
+6.292e-06
+7.5414e-06
+9.02814e-06
+1.04737e-05
+1.25187e-05
+1.37559e-05
+1.40338e-05
+1.24681e-05
+1.08272e-05
+9.10144e-06
+7.81661e-06
+6.08627e-06
+4.68729e-06
+3.01241e-06
+1.93855e-06
+1.03945e-06
+2.49601e-07
+2.33919e-07
+3.47823e-08
+3.05604e-06
+8.25413e-06
+1.04748e-05
+1.36651e-05
+2.35252e-05
+3.87371e-05
+5.21582e-05
+6.71737e-05
+6.89399e-05
+4.57512e-05
+1.94891e-05
+9.7778e-06
+1.47858e-05
+3.40409e-05
+6.06823e-05
+8.59513e-05
+8.29571e-05
+5.42278e-05
+3.46015e-05
+2.20432e-05
+1.73878e-05
+1.05749e-05
+4.67814e-06
+8.66793e-06
+1.79361e-05
+1.22464e-05
+3.93103e-06
+1.00778e-06
+1.81983e-06
+2.70815e-05
+9.56468e-05
+0.000139304
+0.00012493
+9.50459e-05
+4.78307e-05
+8.71962e-06
+1.24275e-05
+4.91383e-05
+8.77264e-05
+0.000114449
+0.00014567
+0.000201758
+0.000251863
+0.000272594
+0.000213599
+0.000145126
+0.000115603
+0.000122779
+0.000116865
+8.36843e-05
+4.06009e-05
+3.49149e-05
+5.22978e-05
+5.07525e-05
+2.5995e-05
+2.6683e-06
+9.29144e-06
+1.14821e-05
+9.41939e-06
+1.01946e-05
+6.64024e-06
+1.1913e-06
+3.25066e-06
+8.47834e-06
+1.42023e-06
+4.30742e-05
+0.000106228
+0.000115468
+9.07632e-05
+7.04511e-05
+9.21776e-05
+0.000104486
+0.000111678
+0.000109852
+0.000111867
+9.10747e-05
+6.82206e-05
+4.09085e-05
+2.3961e-05
+2.0467e-06
+7.74345e-06
+1.66716e-05
+1.54967e-05
+2.95089e-05
+4.82299e-05
+6.99781e-05
+7.16947e-05
+7.33475e-05
+7.40551e-05
+9.45846e-05
+0.000107202
+0.000120068
+0.000122517
+0.000120068
+0.000107202
+9.45846e-05
+7.40551e-05
+7.33475e-05
+7.16947e-05
+6.99781e-05
+4.82299e-05
+2.95089e-05
+1.54967e-05
+1.66716e-05
+7.74345e-06
+2.0467e-06
+2.3961e-05
+4.09085e-05
+6.82206e-05
+9.10747e-05
+0.000111867
+0.000109852
+0.000111678
+0.000104486
+9.21776e-05
+7.04511e-05
+9.07632e-05
+0.000115468
+0.000106228
+4.30742e-05
+1.42023e-06
+8.47834e-06
+3.25066e-06
+1.1913e-06
+6.64024e-06
+1.01946e-05
+9.41939e-06
+1.14821e-05
+9.29144e-06
+2.6683e-06
+2.5995e-05
+5.07525e-05
+5.22978e-05
+3.49149e-05
+4.06009e-05
+8.36843e-05
+0.000116865
+0.000122779
+0.000115603
+0.000145126
+0.000213599
+0.000272594
+0.000251863
+0.000201758
+0.00014567
+0.000114449
+8.77264e-05
+4.91383e-05
+1.24275e-05
+8.71962e-06
+4.78307e-05
+9.50459e-05
+0.00012493
+0.000139304
+9.56468e-05
+2.70815e-05
+1.81983e-06
+1.00778e-06
+3.93103e-06
+1.22464e-05
+1.79361e-05
+8.66793e-06
+4.67814e-06
+1.05749e-05
+1.73878e-05
+2.20432e-05
+3.46015e-05
+5.42278e-05
+8.29571e-05
+8.59513e-05
+6.06823e-05
+3.40409e-05
+1.47858e-05
+9.7778e-06
+1.94891e-05
+4.57512e-05
+6.89399e-05
+6.71737e-05
+5.21582e-05
+3.87371e-05
+2.35252e-05
+1.36651e-05
+1.04748e-05
+8.25413e-06
+3.05604e-06
+3.47823e-08
+2.33919e-07
+2.49601e-07
+1.03945e-06
+1.93855e-06
+3.01241e-06
+4.68729e-06
+6.08627e-06
+7.81661e-06
+9.10144e-06
+1.08272e-05
+1.24681e-05
+1.40338e-05
+1.37559e-05
+1.25187e-05
+1.04737e-05
+9.02814e-06
+7.5414e-06
+6.292e-06
+4.20946e-06
+2.25711e-06
+5.98657e-07
+4.4709e-08
+6.18128e-08
+2.6295e-10
+4.50118e-08
+1.93408e-07
+1.55614e-07
+1.50479e-07
+3.79499e-08
+3.56243e-08
+1.73393e-08
+2.85582e-08
+1.06447e-07
+1.76693e-06
+0
+)
diff --git a/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/boundaryData/inlet/0/R b/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/boundaryData/inlet/0/R
new file mode 100644
index 0000000000000000000000000000000000000000..497e864386e606a46edfc42c8eb5c8a95d68b91f
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/boundaryData/inlet/0/R
@@ -0,0 +1,277 @@
+/*--------------------------------*- C++ -*----------------------------------*| =========                 |                                                 |
+| \      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \    /   O peration     | Version:  plus                                  |
+|   \  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       symmTensorAverageField;
+    object      values;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// UU, UV, UZ, VV, VW, WW
+
+// Average
+(0 0 0 0 0 0)
+(
+(5.3376e-28 1.1206e-30 -6.1282e-30 4.9018e-29 6.2793e-32 5.9575e-28)
+(1.3684e-04 -2.4414e-08 5.9464e-08 9.4734e-11 -2.8525e-11 5.2943e-05)
+(2.1828e-03 -1.5728e-06 8.3228e-07 2.3603e-08 -1.7141e-09 8.2715e-04)
+(1.1020e-02 -1.8113e-05 3.3616e-06 5.7878e-07 -1.9051e-08 4.0392e-03)
+(3.4718e-02 -1.0324e-04 1.0732e-05 5.4400e-06 -1.0411e-07 1.2147e-02)
+(8.4454e-02 -4.0027e-04 2.8297e-05 3.0014e-05 -3.8272e-07 2.7852e-02)
+(1.7438e-01 -1.2143e-03 6.6865e-05 1.1756e-04 -1.0969e-06 5.3564e-02)
+(3.2123e-01 -3.1009e-03 1.4506e-04 3.6204e-04 -2.6288e-06 9.0947e-02)
+(5.4336e-01 -6.9486e-03 2.9097e-04 9.3203e-04 -5.4596e-06 1.4062e-01)
+(8.5851e-01 -1.4015e-02 5.4723e-04 2.0879e-03 -1.0091e-05 2.0209e-01)
+(1.2802e+00 -2.5858e-02 9.7373e-04 4.1852e-03 -1.7119e-05 2.7384e-01)
+(1.8132e+00 -4.4135e-02 1.6529e-03 7.6610e-03 -2.7764e-05 3.5369e-01)
+(2.4490e+00 -7.0276e-02 2.6847e-03 1.3005e-02 -4.4587e-05 4.3919e-01)
+(3.1644e+00 -1.0513e-01 4.1721e-03 2.0724e-02 -7.1044e-05 5.2804e-01)
+(3.9229e+00 -1.4869e-01 6.1889e-03 3.1300e-02 -1.0893e-04 6.1834e-01)
+(4.6811e+00 -1.9999e-01 8.7562e-03 4.5157e-02 -1.5460e-04 7.0871e-01)
+(5.3953e+00 -2.5724e-01 1.1834e-02 6.2636e-02 -1.9552e-04 7.9819e-01)
+(6.0286e+00 -3.1808e-01 1.5387e-02 8.3971e-02 -2.1029e-04 8.8610e-01)
+(6.5558e+00 -3.8001e-01 1.9449e-02 1.0928e-01 -1.7262e-04 9.7178e-01)
+(6.9642e+00 -4.4073e-01 2.4133e-02 1.3854e-01 -6.0490e-05 1.0545e+00)
+(7.2524e+00 -4.9837e-01 2.9501e-02 1.7162e-01 1.3268e-04 1.1333e+00)
+(7.4274e+00 -5.5162e-01 3.5418e-02 2.0824e-01 3.9086e-04 1.2075e+00)
+(7.5016e+00 -5.9969e-01 4.1511e-02 2.4803e-01 6.7818e-04 1.2762e+00)
+(7.4897e+00 -6.4224e-01 4.7330e-02 2.9050e-01 9.5511e-04 1.3387e+00)
+(7.4069e+00 -6.7924e-01 5.2512e-02 3.3510e-01 1.1989e-03 1.3948e+00)
+(7.2679e+00 -7.1090e-01 5.6926e-02 3.8121e-01 1.4016e-03 1.4444e+00)
+(7.0865e+00 -7.3759e-01 6.0659e-02 4.2818e-01 1.5532e-03 1.4878e+00)
+(6.8750e+00 -7.5980e-01 6.3835e-02 4.7535e-01 1.6360e-03 1.5251e+00)
+(6.6441e+00 -7.7810e-01 6.6418e-02 5.2211e-01 1.6465e-03 1.5568e+00)
+(6.4025e+00 -7.9302e-01 6.8207e-02 5.6790e-01 1.6026e-03 1.5833e+00)
+(6.1573e+00 -8.0503e-01 6.9001e-02 6.1229e-01 1.5073e-03 1.6047e+00)
+(5.9141e+00 -8.1452e-01 6.8896e-02 6.5493e-01 1.3268e-03 1.6216e+00)
+(5.6767e+00 -8.2184e-01 6.8285e-02 6.9554e-01 1.0303e-03 1.6344e+00)
+(5.4477e+00 -8.2733e-01 6.7481e-02 7.3388e-01 6.4119e-04 1.6439e+00)
+(5.2291e+00 -8.3133e-01 6.6450e-02 7.6971e-01 2.3642e-04 1.6512e+00)
+(5.0223e+00 -8.3412e-01 6.4937e-02 8.0285e-01 -1.3612e-04 1.6567e+00)
+(4.8279e+00 -8.3590e-01 6.2875e-02 8.3316e-01 -4.7569e-04 1.6606e+00)
+(4.6462e+00 -8.3683e-01 6.0710e-02 8.6061e-01 -7.8412e-04 1.6623e+00)
+(4.4768e+00 -8.3700e-01 5.9182e-02 8.8520e-01 -1.0539e-03 1.6618e+00)
+(4.3194e+00 -8.3649e-01 5.8527e-02 9.0700e-01 -1.2655e-03 1.6594e+00)
+(4.1730e+00 -8.3523e-01 5.8437e-02 9.2607e-01 -1.4126e-03 1.6553e+00)
+(4.0370e+00 -8.3321e-01 5.8512e-02 9.4247e-01 -1.4930e-03 1.6500e+00)
+(3.9106e+00 -8.3044e-01 5.8376e-02 9.5626e-01 -1.5118e-03 1.6439e+00)
+(3.7930e+00 -8.2687e-01 5.8084e-02 9.6754e-01 -1.5196e-03 1.6373e+00)
+(3.6834e+00 -8.2252e-01 5.8125e-02 9.7651e-01 -1.6228e-03 1.6299e+00)
+(3.5821e+00 -8.1762e-01 5.8537e-02 9.8341e-01 -1.8295e-03 1.6209e+00)
+(3.4896e+00 -8.1249e-01 5.8809e-02 9.8850e-01 -2.0145e-03 1.6105e+00)
+(3.4053e+00 -8.0726e-01 5.8494e-02 9.9197e-01 -2.0826e-03 1.5991e+00)
+(3.3278e+00 -8.0180e-01 5.7876e-02 9.9396e-01 -2.1101e-03 1.5872e+00)
+(3.2557e+00 -7.9592e-01 5.7034e-02 9.9455e-01 -2.1628e-03 1.5754e+00)
+(3.1886e+00 -7.8961e-01 5.5746e-02 9.9379e-01 -2.2441e-03 1.5637e+00)
+(3.1269e+00 -7.8296e-01 5.4259e-02 9.9183e-01 -2.3220e-03 1.5510e+00)
+(3.0702e+00 -7.7613e-01 5.2957e-02 9.8887e-01 -2.3519e-03 1.5367e+00)
+(3.0178e+00 -7.6929e-01 5.1819e-02 9.8512e-01 -2.3018e-03 1.5212e+00)
+(2.9678e+00 -7.6243e-01 5.0872e-02 9.8075e-01 -2.0851e-03 1.5052e+00)
+(2.9191e+00 -7.5552e-01 5.0514e-02 9.7583e-01 -1.6209e-03 1.4889e+00)
+(2.8712e+00 -7.4851e-01 5.0564e-02 9.7044e-01 -8.5802e-04 1.4721e+00)
+(2.8239e+00 -7.4146e-01 5.0229e-02 9.6465e-01 1.1783e-04 1.4551e+00)
+(2.7776e+00 -7.3445e-01 4.9171e-02 9.5846e-01 1.0337e-03 1.4379e+00)
+(2.7324e+00 -7.2737e-01 4.7565e-02 9.5179e-01 1.6440e-03 1.4206e+00)
+(2.6883e+00 -7.2012e-01 4.5716e-02 9.4459e-01 1.9851e-03 1.4035e+00)
+(2.6453e+00 -7.1271e-01 4.3916e-02 9.3679e-01 2.2291e-03 1.3867e+00)
+(2.6031e+00 -7.0521e-01 4.2134e-02 9.2845e-01 2.4143e-03 1.3696e+00)
+(2.5612e+00 -6.9761e-01 4.0077e-02 9.1976e-01 2.5128e-03 1.3515e+00)
+(2.5196e+00 -6.8985e-01 3.7520e-02 9.1087e-01 2.5006e-03 1.3322e+00)
+(2.4793e+00 -6.8192e-01 3.4358e-02 9.0185e-01 2.3726e-03 1.3118e+00)
+(2.4411e+00 -6.7396e-01 3.0858e-02 8.9268e-01 2.1952e-03 1.2910e+00)
+(2.4055e+00 -6.6598e-01 2.7094e-02 8.8335e-01 2.0517e-03 1.2700e+00)
+(2.3714e+00 -6.5794e-01 2.3371e-02 8.7385e-01 1.9999e-03 1.2488e+00)
+(2.3380e+00 -6.4977e-01 2.0500e-02 8.6418e-01 1.9700e-03 1.2276e+00)
+(2.3046e+00 -6.4148e-01 1.8795e-02 8.5436e-01 1.8189e-03 1.2066e+00)
+(2.2708e+00 -6.3298e-01 1.7891e-02 8.4439e-01 1.4336e-03 1.1855e+00)
+(2.2365e+00 -6.2415e-01 1.7572e-02 8.3421e-01 7.5375e-04 1.1641e+00)
+(2.2023e+00 -6.1500e-01 1.7517e-02 8.2369e-01 -7.9290e-05 1.1423e+00)
+(2.1682e+00 -6.0551e-01 1.7095e-02 8.1285e-01 -8.3720e-04 1.1202e+00)
+(2.1335e+00 -5.9561e-01 1.5913e-02 8.0181e-01 -1.3413e-03 1.0983e+00)
+(2.0983e+00 -5.8530e-01 1.4306e-02 7.9074e-01 -1.5771e-03 1.0767e+00)
+(2.0631e+00 -5.7460e-01 1.2812e-02 7.7968e-01 -1.5179e-03 1.0551e+00)
+(2.0277e+00 -5.6350e-01 1.1907e-02 7.6856e-01 -1.1762e-03 1.0339e+00)
+(1.9920e+00 -5.5204e-01 1.1640e-02 7.5731e-01 -7.0498e-04 1.0131e+00)
+(1.9568e+00 -5.4040e-01 1.1503e-02 7.4588e-01 -2.0689e-04 9.9279e-01)
+(1.9229e+00 -5.2883e-01 1.1097e-02 7.3425e-01 2.0529e-04 9.7254e-01)
+(1.8896e+00 -5.1747e-01 1.0218e-02 7.2249e-01 5.0971e-04 9.5187e-01)
+(1.8562e+00 -5.0626e-01 9.0004e-03 7.1064e-01 7.6211e-04 9.3057e-01)
+(1.8232e+00 -4.9507e-01 7.8753e-03 6.9862e-01 9.2292e-04 9.0936e-01)
+(1.7908e+00 -4.8386e-01 7.1617e-03 6.8642e-01 9.3017e-04 8.8926e-01)
+(1.7591e+00 -4.7269e-01 7.0121e-03 6.7417e-01 7.2814e-04 8.7042e-01)
+(1.7274e+00 -4.6164e-01 7.3802e-03 6.6201e-01 2.7352e-04 8.5243e-01)
+(1.6948e+00 -4.5072e-01 8.2299e-03 6.5007e-01 -2.9303e-04 8.3469e-01)
+(1.6610e+00 -4.3999e-01 9.3954e-03 6.3843e-01 -7.4565e-04 8.1690e-01)
+(1.6264e+00 -4.2949e-01 1.0585e-02 6.2712e-01 -9.5384e-04 7.9939e-01)
+(1.5910e+00 -4.1910e-01 1.1834e-02 6.1613e-01 -9.5389e-04 7.8241e-01)
+(1.5550e+00 -4.0876e-01 1.3728e-02 6.0545e-01 -1.0075e-03 7.6587e-01)
+(1.5184e+00 -3.9853e-01 1.6563e-02 5.9512e-01 -1.2970e-03 7.4931e-01)
+(1.4808e+00 -3.8843e-01 1.9835e-02 5.8523e-01 -1.7620e-03 7.3258e-01)
+(1.4425e+00 -3.7835e-01 2.2555e-02 5.7589e-01 -2.2305e-03 7.1572e-01)
+(1.4037e+00 -3.6810e-01 2.3965e-02 5.6715e-01 -2.5637e-03 6.9868e-01)
+(1.3647e+00 -3.5761e-01 2.4099e-02 5.5896e-01 -2.7183e-03 6.8159e-01)
+(1.3260e+00 -3.4695e-01 2.3378e-02 5.5120e-01 -2.7095e-03 6.6492e-01)
+(1.2881e+00 -3.3621e-01 2.2236e-02 5.4372e-01 -2.5722e-03 6.4916e-01)
+(1.2513e+00 -3.2544e-01 2.0871e-02 5.3642e-01 -2.4646e-03 6.3424e-01)
+(1.2162e+00 -3.1468e-01 1.9224e-02 5.2919e-01 -2.5472e-03 6.2001e-01)
+(1.1827e+00 -3.0393e-01 1.7273e-02 5.2197e-01 -2.7871e-03 6.0660e-01)
+(1.1500e+00 -2.9315e-01 1.5116e-02 5.1473e-01 -3.0094e-03 5.9377e-01)
+(1.1175e+00 -2.8231e-01 1.3055e-02 5.0750e-01 -3.1202e-03 5.8101e-01)
+(1.0843e+00 -2.7133e-01 1.1360e-02 5.0029e-01 -3.1772e-03 5.6815e-01)
+(1.0507e+00 -2.6019e-01 9.9787e-03 4.9312e-01 -3.2410e-03 5.5541e-01)
+(1.0173e+00 -2.4893e-01 8.7677e-03 4.8605e-01 -3.3171e-03 5.4304e-01)
+(9.8478e-01 -2.3753e-01 7.8868e-03 4.7922e-01 -3.3738e-03 5.3113e-01)
+(9.5377e-01 -2.2605e-01 7.6156e-03 4.7268e-01 -3.4135e-03 5.1971e-01)
+(9.2454e-01 -2.1462e-01 7.9424e-03 4.6644e-01 -3.4897e-03 5.0882e-01)
+(8.9706e-01 -2.0326e-01 8.6379e-03 4.6047e-01 -3.6720e-03 4.9853e-01)
+(8.7113e-01 -1.9188e-01 9.5840e-03 4.5478e-01 -3.9882e-03 4.8883e-01)
+(8.4645e-01 -1.8043e-01 1.0540e-02 4.4932e-01 -4.3896e-03 4.7982e-01)
+(8.2296e-01 -1.6898e-01 1.1159e-02 4.4410e-01 -4.7685e-03 4.7164e-01)
+(8.0062e-01 -1.5752e-01 1.1209e-02 4.3915e-01 -5.0417e-03 4.6392e-01)
+(7.7929e-01 -1.4601e-01 1.0617e-02 4.3458e-01 -5.1687e-03 4.5618e-01)
+(7.5889e-01 -1.3442e-01 9.5260e-03 4.3044e-01 -5.1040e-03 4.4842e-01)
+(7.3932e-01 -1.2272e-01 8.2998e-03 4.2671e-01 -4.8287e-03 4.4071e-01)
+(7.2051e-01 -1.1094e-01 7.2287e-03 4.2339e-01 -4.4056e-03 4.3345e-01)
+(7.0261e-01 -9.9120e-02 6.4502e-03 4.2046e-01 -3.8984e-03 4.2708e-01)
+(6.8576e-01 -8.7301e-02 6.1696e-03 4.1796e-01 -3.3462e-03 4.2169e-01)
+(6.7023e-01 -7.5441e-02 6.4277e-03 4.1591e-01 -2.7927e-03 4.1709e-01)
+(6.5620e-01 -6.3452e-02 7.0238e-03 4.1431e-01 -2.2376e-03 4.1319e-01)
+(6.4389e-01 -5.1252e-02 7.7818e-03 4.1313e-01 -1.6855e-03 4.0984e-01)
+(6.3375e-01 -3.8772e-02 8.7489e-03 4.1234e-01 -1.1858e-03 4.0689e-01)
+(6.2626e-01 -2.6001e-02 9.8627e-03 4.1188e-01 -7.6554e-04 4.0431e-01)
+(6.2174e-01 -1.3031e-02 1.0731e-02 4.1166e-01 -3.8835e-04 4.0247e-01)
+(6.2024e-01 0.0000e+00 1.1032e-02 4.1160e-01 0.0000e+00 4.0179e-01)
+(6.2174e-01 1.3031e-02 1.0731e-02 4.1166e-01 3.8835e-04 4.0247e-01)
+(6.2626e-01 2.6001e-02 9.8627e-03 4.1188e-01 7.6554e-04 4.0431e-01)
+(6.3375e-01 3.8772e-02 8.7489e-03 4.1234e-01 1.1858e-03 4.0689e-01)
+(6.4389e-01 5.1252e-02 7.7818e-03 4.1313e-01 1.6855e-03 4.0984e-01)
+(6.5620e-01 6.3452e-02 7.0238e-03 4.1431e-01 2.2376e-03 4.1319e-01)
+(6.7023e-01 7.5441e-02 6.4277e-03 4.1591e-01 2.7927e-03 4.1709e-01)
+(6.8576e-01 8.7301e-02 6.1696e-03 4.1796e-01 3.3462e-03 4.2169e-01)
+(7.0261e-01 9.9120e-02 6.4502e-03 4.2046e-01 3.8984e-03 4.2708e-01)
+(7.2051e-01 1.1094e-01 7.2287e-03 4.2339e-01 4.4056e-03 4.3345e-01)
+(7.3932e-01 1.2272e-01 8.2998e-03 4.2671e-01 4.8287e-03 4.4071e-01)
+(7.5889e-01 1.3442e-01 9.5260e-03 4.3044e-01 5.1040e-03 4.4842e-01)
+(7.7929e-01 1.4601e-01 1.0617e-02 4.3458e-01 5.1687e-03 4.5618e-01)
+(8.0062e-01 1.5752e-01 1.1209e-02 4.3915e-01 5.0417e-03 4.6392e-01)
+(8.2296e-01 1.6898e-01 1.1159e-02 4.4410e-01 4.7685e-03 4.7164e-01)
+(8.4645e-01 1.8043e-01 1.0540e-02 4.4932e-01 4.3896e-03 4.7982e-01)
+(8.7113e-01 1.9188e-01 9.5840e-03 4.5478e-01 3.9882e-03 4.8883e-01)
+(8.9706e-01 2.0326e-01 8.6379e-03 4.6047e-01 3.6720e-03 4.9853e-01)
+(9.2454e-01 2.1462e-01 7.9424e-03 4.6644e-01 3.4897e-03 5.0882e-01)
+(9.5377e-01 2.2605e-01 7.6156e-03 4.7268e-01 3.4135e-03 5.1971e-01)
+(9.8478e-01 2.3753e-01 7.8868e-03 4.7922e-01 3.3738e-03 5.3113e-01)
+(1.0173e+00 2.4893e-01 8.7677e-03 4.8605e-01 3.3171e-03 5.4304e-01)
+(1.0507e+00 2.6019e-01 9.9787e-03 4.9312e-01 3.2410e-03 5.5541e-01)
+(1.0843e+00 2.7133e-01 1.1360e-02 5.0029e-01 3.1772e-03 5.6815e-01)
+(1.1175e+00 2.8231e-01 1.3055e-02 5.0750e-01 3.1202e-03 5.8101e-01)
+(1.1500e+00 2.9315e-01 1.5116e-02 5.1473e-01 3.0094e-03 5.9377e-01)
+(1.1827e+00 3.0393e-01 1.7273e-02 5.2197e-01 2.7871e-03 6.0660e-01)
+(1.2162e+00 3.1468e-01 1.9224e-02 5.2919e-01 2.5472e-03 6.2001e-01)
+(1.2513e+00 3.2544e-01 2.0871e-02 5.3642e-01 2.4646e-03 6.3424e-01)
+(1.2881e+00 3.3621e-01 2.2236e-02 5.4372e-01 2.5722e-03 6.4916e-01)
+(1.3260e+00 3.4695e-01 2.3378e-02 5.5120e-01 2.7095e-03 6.6492e-01)
+(1.3647e+00 3.5761e-01 2.4099e-02 5.5896e-01 2.7183e-03 6.8159e-01)
+(1.4037e+00 3.6810e-01 2.3965e-02 5.6715e-01 2.5637e-03 6.9868e-01)
+(1.4425e+00 3.7835e-01 2.2555e-02 5.7589e-01 2.2305e-03 7.1572e-01)
+(1.4808e+00 3.8843e-01 1.9835e-02 5.8523e-01 1.7620e-03 7.3258e-01)
+(1.5184e+00 3.9853e-01 1.6563e-02 5.9512e-01 1.2970e-03 7.4931e-01)
+(1.5550e+00 4.0876e-01 1.3728e-02 6.0545e-01 1.0075e-03 7.6587e-01)
+(1.5910e+00 4.1910e-01 1.1834e-02 6.1613e-01 9.5389e-04 7.8241e-01)
+(1.6264e+00 4.2949e-01 1.0585e-02 6.2712e-01 9.5384e-04 7.9939e-01)
+(1.6610e+00 4.3999e-01 9.3954e-03 6.3843e-01 7.4565e-04 8.1690e-01)
+(1.6948e+00 4.5072e-01 8.2299e-03 6.5007e-01 2.9303e-04 8.3469e-01)
+(1.7274e+00 4.6164e-01 7.3802e-03 6.6201e-01 -2.7352e-04 8.5243e-01)
+(1.7591e+00 4.7269e-01 7.0121e-03 6.7417e-01 -7.2814e-04 8.7042e-01)
+(1.7908e+00 4.8386e-01 7.1617e-03 6.8642e-01 -9.3017e-04 8.8926e-01)
+(1.8232e+00 4.9507e-01 7.8753e-03 6.9862e-01 -9.2292e-04 9.0936e-01)
+(1.8562e+00 5.0626e-01 9.0004e-03 7.1064e-01 -7.6211e-04 9.3057e-01)
+(1.8896e+00 5.1747e-01 1.0218e-02 7.2249e-01 -5.0971e-04 9.5187e-01)
+(1.9229e+00 5.2883e-01 1.1097e-02 7.3425e-01 -2.0529e-04 9.7254e-01)
+(1.9568e+00 5.4040e-01 1.1503e-02 7.4588e-01 2.0689e-04 9.9279e-01)
+(1.9920e+00 5.5204e-01 1.1640e-02 7.5731e-01 7.0498e-04 1.0131e+00)
+(2.0277e+00 5.6350e-01 1.1907e-02 7.6856e-01 1.1762e-03 1.0339e+00)
+(2.0631e+00 5.7460e-01 1.2812e-02 7.7968e-01 1.5179e-03 1.0551e+00)
+(2.0983e+00 5.8530e-01 1.4306e-02 7.9074e-01 1.5771e-03 1.0767e+00)
+(2.1335e+00 5.9561e-01 1.5913e-02 8.0181e-01 1.3413e-03 1.0983e+00)
+(2.1682e+00 6.0551e-01 1.7095e-02 8.1285e-01 8.3720e-04 1.1202e+00)
+(2.2023e+00 6.1500e-01 1.7517e-02 8.2369e-01 7.9290e-05 1.1423e+00)
+(2.2365e+00 6.2415e-01 1.7572e-02 8.3421e-01 -7.5375e-04 1.1641e+00)
+(2.2708e+00 6.3298e-01 1.7891e-02 8.4439e-01 -1.4336e-03 1.1855e+00)
+(2.3046e+00 6.4148e-01 1.8795e-02 8.5436e-01 -1.8189e-03 1.2066e+00)
+(2.3380e+00 6.4977e-01 2.0500e-02 8.6418e-01 -1.9700e-03 1.2276e+00)
+(2.3714e+00 6.5794e-01 2.3371e-02 8.7385e-01 -1.9999e-03 1.2488e+00)
+(2.4055e+00 6.6598e-01 2.7094e-02 8.8335e-01 -2.0517e-03 1.2700e+00)
+(2.4411e+00 6.7396e-01 3.0858e-02 8.9268e-01 -2.1952e-03 1.2910e+00)
+(2.4793e+00 6.8192e-01 3.4358e-02 9.0185e-01 -2.3726e-03 1.3118e+00)
+(2.5196e+00 6.8985e-01 3.7520e-02 9.1087e-01 -2.5006e-03 1.3322e+00)
+(2.5612e+00 6.9761e-01 4.0077e-02 9.1976e-01 -2.5128e-03 1.3515e+00)
+(2.6031e+00 7.0521e-01 4.2134e-02 9.2845e-01 -2.4143e-03 1.3696e+00)
+(2.6453e+00 7.1271e-01 4.3916e-02 9.3679e-01 -2.2291e-03 1.3867e+00)
+(2.6883e+00 7.2012e-01 4.5716e-02 9.4459e-01 -1.9851e-03 1.4035e+00)
+(2.7324e+00 7.2737e-01 4.7565e-02 9.5179e-01 -1.6440e-03 1.4206e+00)
+(2.7776e+00 7.3445e-01 4.9171e-02 9.5846e-01 -1.0337e-03 1.4379e+00)
+(2.8239e+00 7.4146e-01 5.0229e-02 9.6465e-01 -1.1783e-04 1.4551e+00)
+(2.8712e+00 7.4851e-01 5.0564e-02 9.7044e-01 8.5802e-04 1.4721e+00)
+(2.9191e+00 7.5552e-01 5.0514e-02 9.7583e-01 1.6209e-03 1.4889e+00)
+(2.9678e+00 7.6243e-01 5.0872e-02 9.8075e-01 2.0851e-03 1.5052e+00)
+(3.0178e+00 7.6929e-01 5.1819e-02 9.8512e-01 2.3018e-03 1.5212e+00)
+(3.0702e+00 7.7613e-01 5.2957e-02 9.8887e-01 2.3519e-03 1.5367e+00)
+(3.1269e+00 7.8296e-01 5.4259e-02 9.9183e-01 2.3220e-03 1.5510e+00)
+(3.1886e+00 7.8961e-01 5.5746e-02 9.9379e-01 2.2441e-03 1.5637e+00)
+(3.2557e+00 7.9592e-01 5.7034e-02 9.9455e-01 2.1628e-03 1.5754e+00)
+(3.3278e+00 8.0180e-01 5.7876e-02 9.9396e-01 2.1101e-03 1.5872e+00)
+(3.4053e+00 8.0726e-01 5.8494e-02 9.9197e-01 2.0826e-03 1.5991e+00)
+(3.4896e+00 8.1249e-01 5.8809e-02 9.8850e-01 2.0145e-03 1.6105e+00)
+(3.5821e+00 8.1762e-01 5.8537e-02 9.8341e-01 1.8295e-03 1.6209e+00)
+(3.6834e+00 8.2252e-01 5.8125e-02 9.7651e-01 1.6228e-03 1.6299e+00)
+(3.7930e+00 8.2687e-01 5.8084e-02 9.6754e-01 1.5196e-03 1.6373e+00)
+(3.9106e+00 8.3044e-01 5.8376e-02 9.5626e-01 1.5118e-03 1.6439e+00)
+(4.0370e+00 8.3321e-01 5.8512e-02 9.4247e-01 1.4930e-03 1.6500e+00)
+(4.1730e+00 8.3523e-01 5.8437e-02 9.2607e-01 1.4126e-03 1.6553e+00)
+(4.3194e+00 8.3649e-01 5.8527e-02 9.0700e-01 1.2655e-03 1.6594e+00)
+(4.4768e+00 8.3700e-01 5.9182e-02 8.8520e-01 1.0539e-03 1.6618e+00)
+(4.6462e+00 8.3683e-01 6.0710e-02 8.6061e-01 7.8412e-04 1.6623e+00)
+(4.8279e+00 8.3590e-01 6.2875e-02 8.3316e-01 4.7569e-04 1.6606e+00)
+(5.0223e+00 8.3412e-01 6.4937e-02 8.0285e-01 1.3612e-04 1.6567e+00)
+(5.2291e+00 8.3133e-01 6.6450e-02 7.6971e-01 -2.3642e-04 1.6512e+00)
+(5.4477e+00 8.2733e-01 6.7481e-02 7.3388e-01 -6.4119e-04 1.6439e+00)
+(5.6767e+00 8.2184e-01 6.8285e-02 6.9554e-01 -1.0303e-03 1.6344e+00)
+(5.9141e+00 8.1452e-01 6.8896e-02 6.5493e-01 -1.3268e-03 1.6216e+00)
+(6.1573e+00 8.0503e-01 6.9001e-02 6.1229e-01 -1.5073e-03 1.6047e+00)
+(6.4025e+00 7.9302e-01 6.8207e-02 5.6790e-01 -1.6026e-03 1.5833e+00)
+(6.6441e+00 7.7810e-01 6.6418e-02 5.2211e-01 -1.6465e-03 1.5568e+00)
+(6.8750e+00 7.5980e-01 6.3835e-02 4.7535e-01 -1.6360e-03 1.5251e+00)
+(7.0865e+00 7.3759e-01 6.0659e-02 4.2818e-01 -1.5532e-03 1.4878e+00)
+(7.2679e+00 7.1090e-01 5.6926e-02 3.8121e-01 -1.4016e-03 1.4444e+00)
+(7.4069e+00 6.7924e-01 5.2512e-02 3.3510e-01 -1.1989e-03 1.3948e+00)
+(7.4897e+00 6.4224e-01 4.7330e-02 2.9050e-01 -9.5511e-04 1.3387e+00)
+(7.5016e+00 5.9969e-01 4.1511e-02 2.4803e-01 -6.7818e-04 1.2762e+00)
+(7.4274e+00 5.5162e-01 3.5418e-02 2.0824e-01 -3.9086e-04 1.2075e+00)
+(7.2524e+00 4.9837e-01 2.9501e-02 1.7162e-01 -1.3268e-04 1.1333e+00)
+(6.9642e+00 4.4073e-01 2.4133e-02 1.3854e-01 6.0490e-05 1.0545e+00)
+(6.5558e+00 3.8001e-01 1.9449e-02 1.0928e-01 1.7262e-04 9.7178e-01)
+(6.0286e+00 3.1808e-01 1.5387e-02 8.3971e-02 2.1029e-04 8.8610e-01)
+(5.3953e+00 2.5724e-01 1.1834e-02 6.2636e-02 1.9552e-04 7.9819e-01)
+(4.6811e+00 1.9999e-01 8.7562e-03 4.5157e-02 1.5460e-04 7.0871e-01)
+(3.9229e+00 1.4869e-01 6.1889e-03 3.1300e-02 1.0893e-04 6.1834e-01)
+(3.1644e+00 1.0513e-01 4.1721e-03 2.0724e-02 7.1044e-05 5.2804e-01)
+(2.4490e+00 7.0276e-02 2.6847e-03 1.3005e-02 4.4587e-05 4.3919e-01)
+(1.8132e+00 4.4135e-02 1.6529e-03 7.6610e-03 2.7764e-05 3.5369e-01)
+(1.2802e+00 2.5858e-02 9.7373e-04 4.1852e-03 1.7119e-05 2.7384e-01)
+(8.5851e-01 1.4015e-02 5.4723e-04 2.0879e-03 1.0091e-05 2.0209e-01)
+(5.4336e-01 6.9486e-03 2.9097e-04 9.3203e-04 5.4596e-06 1.4062e-01)
+(3.2123e-01 3.1009e-03 1.4506e-04 3.6204e-04 2.6288e-06 9.0947e-02)
+(1.7438e-01 1.2143e-03 6.6865e-05 1.1756e-04 1.0969e-06 5.3564e-02)
+(8.4454e-02 4.0027e-04 2.8297e-05 3.0014e-05 3.8272e-07 2.7852e-02)
+(3.4718e-02 1.0324e-04 1.0732e-05 5.4400e-06 1.0411e-07 1.2147e-02)
+(1.1020e-02 1.8113e-05 3.3616e-06 5.7878e-07 1.9051e-08 4.0392e-03)
+(2.1828e-03 1.5728e-06 8.3228e-07 2.3603e-08 1.7141e-09 8.2715e-04)
+(1.3684e-04 2.4414e-08 5.9464e-08 9.4734e-11 2.8525e-11 5.2943e-05)
+(5.3376e-28 -1.1206e-30 -6.1282e-30 4.9018e-29 -6.2793e-32 5.9575e-28)
+)
diff --git a/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/boundaryData/inlet/0/U b/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/boundaryData/inlet/0/U
new file mode 100644
index 0000000000000000000000000000000000000000..925381d73a1f95428c04158f4d369beca3a91270
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/boundaryData/inlet/0/U
@@ -0,0 +1,276 @@
+/*--------------------------------*- C++ -*----------------------------------*| =========                 |                                                 |
+| \      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \    /   O peration     | Version:  plus                                  |
+|   \  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       vectorAverageField;
+    object      values;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// UMean
+(0 0 0)
+
+(
+( 0.0000e+00 0 0 )
+( 2.9538e-02 0 0 )
+( 1.1811e-01 0 0 )
+( 2.6562e-01 0 0 )
+( 4.7198e-01 0 0 )
+( 7.3701e-01 0 0 )
+( 1.0605e+00 0 0 )
+( 1.4417e+00 0 0 )
+( 1.8799e+00 0 0 )
+( 2.3729e+00 0 0 )
+( 2.9177e+00 0 0 )
+( 3.5093e+00 0 0 )
+( 4.1409e+00 0 0 )
+( 4.8032e+00 0 0 )
+( 5.4854e+00 0 0 )
+( 6.1754e+00 0 0 )
+( 6.8611e+00 0 0 )
+( 7.5309e+00 0 0 )
+( 8.1754e+00 0 0 )
+( 8.7870e+00 0 0 )
+( 9.3607e+00 0 0 )
+( 9.8937e+00 0 0 )
+( 1.0385e+01 0 0 )
+( 1.0836e+01 0 0 )
+( 1.1248e+01 0 0 )
+( 1.1624e+01 0 0 )
+( 1.1966e+01 0 0 )
+( 1.2278e+01 0 0 )
+( 1.2563e+01 0 0 )
+( 1.2822e+01 0 0 )
+( 1.3060e+01 0 0 )
+( 1.3278e+01 0 0 )
+( 1.3479e+01 0 0 )
+( 1.3664e+01 0 0 )
+( 1.3837e+01 0 0 )
+( 1.3998e+01 0 0 )
+( 1.4148e+01 0 0 )
+( 1.4290e+01 0 0 )
+( 1.4425e+01 0 0 )
+( 1.4552e+01 0 0 )
+( 1.4673e+01 0 0 )
+( 1.4790e+01 0 0 )
+( 1.4902e+01 0 0 )
+( 1.5011e+01 0 0 )
+( 1.5117e+01 0 0 )
+( 1.5221e+01 0 0 )
+( 1.5322e+01 0 0 )
+( 1.5421e+01 0 0 )
+( 1.5518e+01 0 0 )
+( 1.5614e+01 0 0 )
+( 1.5707e+01 0 0 )
+( 1.5799e+01 0 0 )
+( 1.5890e+01 0 0 )
+( 1.5979e+01 0 0 )
+( 1.6067e+01 0 0 )
+( 1.6153e+01 0 0 )
+( 1.6239e+01 0 0 )
+( 1.6324e+01 0 0 )
+( 1.6409e+01 0 0 )
+( 1.6493e+01 0 0 )
+( 1.6576e+01 0 0 )
+( 1.6659e+01 0 0 )
+( 1.6741e+01 0 0 )
+( 1.6823e+01 0 0 )
+( 1.6903e+01 0 0 )
+( 1.6984e+01 0 0 )
+( 1.7063e+01 0 0 )
+( 1.7141e+01 0 0 )
+( 1.7218e+01 0 0 )
+( 1.7294e+01 0 0 )
+( 1.7369e+01 0 0 )
+( 1.7443e+01 0 0 )
+( 1.7517e+01 0 0 )
+( 1.7590e+01 0 0 )
+( 1.7664e+01 0 0 )
+( 1.7738e+01 0 0 )
+( 1.7812e+01 0 0 )
+( 1.7886e+01 0 0 )
+( 1.7960e+01 0 0 )
+( 1.8034e+01 0 0 )
+( 1.8108e+01 0 0 )
+( 1.8182e+01 0 0 )
+( 1.8254e+01 0 0 )
+( 1.8326e+01 0 0 )
+( 1.8396e+01 0 0 )
+( 1.8466e+01 0 0 )
+( 1.8535e+01 0 0 )
+( 1.8603e+01 0 0 )
+( 1.8669e+01 0 0 )
+( 1.8734e+01 0 0 )
+( 1.8797e+01 0 0 )
+( 1.8859e+01 0 0 )
+( 1.8919e+01 0 0 )
+( 1.8978e+01 0 0 )
+( 1.9035e+01 0 0 )
+( 1.9092e+01 0 0 )
+( 1.9148e+01 0 0 )
+( 1.9202e+01 0 0 )
+( 1.9256e+01 0 0 )
+( 1.9308e+01 0 0 )
+( 1.9359e+01 0 0 )
+( 1.9408e+01 0 0 )
+( 1.9456e+01 0 0 )
+( 1.9503e+01 0 0 )
+( 1.9548e+01 0 0 )
+( 1.9593e+01 0 0 )
+( 1.9636e+01 0 0 )
+( 1.9678e+01 0 0 )
+( 1.9719e+01 0 0 )
+( 1.9758e+01 0 0 )
+( 1.9796e+01 0 0 )
+( 1.9832e+01 0 0 )
+( 1.9865e+01 0 0 )
+( 1.9897e+01 0 0 )
+( 1.9927e+01 0 0 )
+( 1.9955e+01 0 0 )
+( 1.9981e+01 0 0 )
+( 2.0004e+01 0 0 )
+( 2.0026e+01 0 0 )
+( 2.0046e+01 0 0 )
+( 2.0064e+01 0 0 )
+( 2.0080e+01 0 0 )
+( 2.0094e+01 0 0 )
+( 2.0106e+01 0 0 )
+( 2.0116e+01 0 0 )
+( 2.0123e+01 0 0 )
+( 2.0129e+01 0 0 )
+( 2.0132e+01 0 0 )
+( 2.0133e+01 0 0 )
+( 2.0132e+01 0 0 )
+( 2.0129e+01 0 0 )
+( 2.0123e+01 0 0 )
+( 2.0116e+01 0 0 )
+( 2.0106e+01 0 0 )
+( 2.0094e+01 0 0 )
+( 2.0080e+01 0 0 )
+( 2.0064e+01 0 0 )
+( 2.0046e+01 0 0 )
+( 2.0026e+01 0 0 )
+( 2.0004e+01 0 0 )
+( 1.9981e+01 0 0 )
+( 1.9955e+01 0 0 )
+( 1.9927e+01 0 0 )
+( 1.9897e+01 0 0 )
+( 1.9865e+01 0 0 )
+( 1.9832e+01 0 0 )
+( 1.9796e+01 0 0 )
+( 1.9758e+01 0 0 )
+( 1.9719e+01 0 0 )
+( 1.9678e+01 0 0 )
+( 1.9636e+01 0 0 )
+( 1.9593e+01 0 0 )
+( 1.9548e+01 0 0 )
+( 1.9503e+01 0 0 )
+( 1.9456e+01 0 0 )
+( 1.9408e+01 0 0 )
+( 1.9359e+01 0 0 )
+( 1.9308e+01 0 0 )
+( 1.9256e+01 0 0 )
+( 1.9202e+01 0 0 )
+( 1.9148e+01 0 0 )
+( 1.9092e+01 0 0 )
+( 1.9035e+01 0 0 )
+( 1.8978e+01 0 0 )
+( 1.8919e+01 0 0 )
+( 1.8859e+01 0 0 )
+( 1.8797e+01 0 0 )
+( 1.8734e+01 0 0 )
+( 1.8669e+01 0 0 )
+( 1.8603e+01 0 0 )
+( 1.8535e+01 0 0 )
+( 1.8466e+01 0 0 )
+( 1.8396e+01 0 0 )
+( 1.8326e+01 0 0 )
+( 1.8254e+01 0 0 )
+( 1.8182e+01 0 0 )
+( 1.8108e+01 0 0 )
+( 1.8034e+01 0 0 )
+( 1.7960e+01 0 0 )
+( 1.7886e+01 0 0 )
+( 1.7812e+01 0 0 )
+( 1.7738e+01 0 0 )
+( 1.7664e+01 0 0 )
+( 1.7590e+01 0 0 )
+( 1.7517e+01 0 0 )
+( 1.7443e+01 0 0 )
+( 1.7369e+01 0 0 )
+( 1.7294e+01 0 0 )
+( 1.7218e+01 0 0 )
+( 1.7141e+01 0 0 )
+( 1.7063e+01 0 0 )
+( 1.6984e+01 0 0 )
+( 1.6903e+01 0 0 )
+( 1.6823e+01 0 0 )
+( 1.6741e+01 0 0 )
+( 1.6659e+01 0 0 )
+( 1.6576e+01 0 0 )
+( 1.6493e+01 0 0 )
+( 1.6409e+01 0 0 )
+( 1.6324e+01 0 0 )
+( 1.6239e+01 0 0 )
+( 1.6153e+01 0 0 )
+( 1.6067e+01 0 0 )
+( 1.5979e+01 0 0 )
+( 1.5890e+01 0 0 )
+( 1.5799e+01 0 0 )
+( 1.5707e+01 0 0 )
+( 1.5614e+01 0 0 )
+( 1.5518e+01 0 0 )
+( 1.5421e+01 0 0 )
+( 1.5322e+01 0 0 )
+( 1.5221e+01 0 0 )
+( 1.5117e+01 0 0 )
+( 1.5011e+01 0 0 )
+( 1.4902e+01 0 0 )
+( 1.4790e+01 0 0 )
+( 1.4673e+01 0 0 )
+( 1.4552e+01 0 0 )
+( 1.4425e+01 0 0 )
+( 1.4290e+01 0 0 )
+( 1.4148e+01 0 0 )
+( 1.3998e+01 0 0 )
+( 1.3837e+01 0 0 )
+( 1.3664e+01 0 0 )
+( 1.3479e+01 0 0 )
+( 1.3278e+01 0 0 )
+( 1.3060e+01 0 0 )
+( 1.2822e+01 0 0 )
+( 1.2563e+01 0 0 )
+( 1.2278e+01 0 0 )
+( 1.1966e+01 0 0 )
+( 1.1624e+01 0 0 )
+( 1.1248e+01 0 0 )
+( 1.0836e+01 0 0 )
+( 1.0385e+01 0 0 )
+( 9.8937e+00 0 0 )
+( 9.3607e+00 0 0 )
+( 8.7870e+00 0 0 )
+( 8.1754e+00 0 0 )
+( 7.5309e+00 0 0 )
+( 6.8611e+00 0 0 )
+( 6.1754e+00 0 0 )
+( 5.4854e+00 0 0 )
+( 4.8032e+00 0 0 )
+( 4.1409e+00 0 0 )
+( 3.5093e+00 0 0 )
+( 2.9177e+00 0 0 )
+( 2.3729e+00 0 0 )
+( 1.8799e+00 0 0 )
+( 1.4417e+00 0 0 )
+( 1.0605e+00 0 0 )
+( 7.3701e-01 0 0 )
+( 4.7198e-01 0 0 )
+( 2.6562e-01 0 0 )
+( 1.1811e-01 0 0 )
+( 2.9538e-02 0 0 )
+( 0.0000e+00 0 0 )
+)
diff --git a/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/boundaryData/inlet/points b/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/boundaryData/inlet/points
new file mode 100644
index 0000000000000000000000000000000000000000..a89fc7634584604cbe0ef0decc9e404f9152bb59
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/boundaryData/inlet/points
@@ -0,0 +1,273 @@
+/*--------------------------------*- C++ -*----------------------------------*| =========                 |                                                 |
+| \      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \    /   O peration     | Version:  plus                                  |
+|   \  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       vectorField;
+    object      points;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+(
+(0 0.0000e+00 0)
+(0 7.5298e-05 0)
+(0 3.0118e-04 0)
+(0 6.7762e-04 0)
+(0 1.2045e-03 0)
+(0 1.8819e-03 0)
+(0 2.7095e-03 0)
+(0 3.6874e-03 0)
+(0 4.8153e-03 0)
+(0 6.0930e-03 0)
+(0 7.5205e-03 0)
+(0 9.0974e-03 0)
+(0 1.0823e-02 0)
+(0 1.2699e-02 0)
+(0 1.4722e-02 0)
+(0 1.6895e-02 0)
+(0 1.9215e-02 0)
+(0 2.1683e-02 0)
+(0 2.4298e-02 0)
+(0 2.7060e-02 0)
+(0 2.9969e-02 0)
+(0 3.3024e-02 0)
+(0 3.6224e-02 0)
+(0 3.9569e-02 0)
+(0 4.3060e-02 0)
+(0 4.6694e-02 0)
+(0 5.0472e-02 0)
+(0 5.4393e-02 0)
+(0 5.8456e-02 0)
+(0 6.2661e-02 0)
+(0 6.7007e-02 0)
+(0 7.1494e-02 0)
+(0 7.6120e-02 0)
+(0 8.0886e-02 0)
+(0 8.5790e-02 0)
+(0 9.0832e-02 0)
+(0 9.6011e-02 0)
+(0 1.0133e-01 0)
+(0 1.0678e-01 0)
+(0 1.1236e-01 0)
+(0 1.1808e-01 0)
+(0 1.2393e-01 0)
+(0 1.2991e-01 0)
+(0 1.3603e-01 0)
+(0 1.4227e-01 0)
+(0 1.4864e-01 0)
+(0 1.5515e-01 0)
+(0 1.6178e-01 0)
+(0 1.6853e-01 0)
+(0 1.7541e-01 0)
+(0 1.8242e-01 0)
+(0 1.8954e-01 0)
+(0 1.9679e-01 0)
+(0 2.0416e-01 0)
+(0 2.1165e-01 0)
+(0 2.1926e-01 0)
+(0 2.2699e-01 0)
+(0 2.3483e-01 0)
+(0 2.4279e-01 0)
+(0 2.5086e-01 0)
+(0 2.5905e-01 0)
+(0 2.6735e-01 0)
+(0 2.7575e-01 0)
+(0 2.8427e-01 0)
+(0 2.9289e-01 0)
+(0 3.0162e-01 0)
+(0 3.1046e-01 0)
+(0 3.1940e-01 0)
+(0 3.2844e-01 0)
+(0 3.3758e-01 0)
+(0 3.4683e-01 0)
+(0 3.5617e-01 0)
+(0 3.6561e-01 0)
+(0 3.7514e-01 0)
+(0 3.8477e-01 0)
+(0 3.9449e-01 0)
+(0 4.0430e-01 0)
+(0 4.1420e-01 0)
+(0 4.2419e-01 0)
+(0 4.3427e-01 0)
+(0 4.4443e-01 0)
+(0 4.5467e-01 0)
+(0 4.6500e-01 0)
+(0 4.7541e-01 0)
+(0 4.8590e-01 0)
+(0 4.9646e-01 0)
+(0 5.0710e-01 0)
+(0 5.1782e-01 0)
+(0 5.2860e-01 0)
+(0 5.3946e-01 0)
+(0 5.5039e-01 0)
+(0 5.6138e-01 0)
+(0 5.7244e-01 0)
+(0 5.8357e-01 0)
+(0 5.9476e-01 0)
+(0 6.0601e-01 0)
+(0 6.1732e-01 0)
+(0 6.2868e-01 0)
+(0 6.4010e-01 0)
+(0 6.5158e-01 0)
+(0 6.6311e-01 0)
+(0 6.7469e-01 0)
+(0 6.8632e-01 0)
+(0 6.9799e-01 0)
+(0 7.0972e-01 0)
+(0 7.2148e-01 0)
+(0 7.3329e-01 0)
+(0 7.4513e-01 0)
+(0 7.5702e-01 0)
+(0 7.6894e-01 0)
+(0 7.8090e-01 0)
+(0 7.9289e-01 0)
+(0 8.0491e-01 0)
+(0 8.1696e-01 0)
+(0 8.2904e-01 0)
+(0 8.4114e-01 0)
+(0 8.5327e-01 0)
+(0 8.6542e-01 0)
+(0 8.7759e-01 0)
+(0 8.8978e-01 0)
+(0 9.0198e-01 0)
+(0 9.1420e-01 0)
+(0 9.2644e-01 0)
+(0 9.3868e-01 0)
+(0 9.5093e-01 0)
+(0 9.6319e-01 0)
+(0 9.7546e-01 0)
+(0 9.8773e-01 0)
+(0 1.0000e-00 0)
+(0 1.01227 0)
+(0 1.02454 0)
+(0 1.03681 0)
+(0 1.04907 0)
+(0 1.06132 0)
+(0 1.07356 0)
+(0 1.0858 0)
+(0 1.09802 0)
+(0 1.11022 0)
+(0 1.12241 0)
+(0 1.13458 0)
+(0 1.14673 0)
+(0 1.15886 0)
+(0 1.17096 0)
+(0 1.18304 0)
+(0 1.19509 0)
+(0 1.20711 0)
+(0 1.2191 0)
+(0 1.23106 0)
+(0 1.24298 0)
+(0 1.25487 0)
+(0 1.26671 0)
+(0 1.27852 0)
+(0 1.29028 0)
+(0 1.30201 0)
+(0 1.31368 0)
+(0 1.32531 0)
+(0 1.33689 0)
+(0 1.34842 0)
+(0 1.3599 0)
+(0 1.37132 0)
+(0 1.38268 0)
+(0 1.39399 0)
+(0 1.40524 0)
+(0 1.41643 0)
+(0 1.42756 0)
+(0 1.43862 0)
+(0 1.44961 0)
+(0 1.46054 0)
+(0 1.4714 0)
+(0 1.48218 0)
+(0 1.4929 0)
+(0 1.50354 0)
+(0 1.5141 0)
+(0 1.52459 0)
+(0 1.535 0)
+(0 1.54533 0)
+(0 1.55557 0)
+(0 1.56573 0)
+(0 1.57581 0)
+(0 1.5858 0)
+(0 1.5957 0)
+(0 1.60551 0)
+(0 1.61523 0)
+(0 1.62486 0)
+(0 1.63439 0)
+(0 1.64383 0)
+(0 1.65317 0)
+(0 1.66242 0)
+(0 1.67156 0)
+(0 1.6806 0)
+(0 1.68954 0)
+(0 1.69838 0)
+(0 1.70711 0)
+(0 1.71573 0)
+(0 1.72425 0)
+(0 1.73265 0)
+(0 1.74095 0)
+(0 1.74914 0)
+(0 1.75721 0)
+(0 1.76517 0)
+(0 1.77301 0)
+(0 1.78074 0)
+(0 1.78835 0)
+(0 1.79584 0)
+(0 1.80321 0)
+(0 1.81046 0)
+(0 1.81758 0)
+(0 1.82459 0)
+(0 1.83147 0)
+(0 1.83822 0)
+(0 1.84485 0)
+(0 1.85136 0)
+(0 1.85773 0)
+(0 1.86397 0)
+(0 1.87009 0)
+(0 1.87607 0)
+(0 1.88192 0)
+(0 1.88764 0)
+(0 1.89322 0)
+(0 1.89867 0)
+(0 1.90399 0)
+(0 1.90917 0)
+(0 1.91421 0)
+(0 1.91911 0)
+(0 1.92388 0)
+(0 1.92851 0)
+(0 1.93299 0)
+(0 1.93734 0)
+(0 1.94154 0)
+(0 1.94561 0)
+(0 1.94953 0)
+(0 1.95331 0)
+(0 1.95694 0)
+(0 1.96043 0)
+(0 1.96378 0)
+(0 1.96698 0)
+(0 1.97003 0)
+(0 1.97294 0)
+(0 1.9757 0)
+(0 1.97832 0)
+(0 1.98079 0)
+(0 1.9831 0)
+(0 1.98528 0)
+(0 1.9873 0)
+(0 1.98918 0)
+(0 1.9909 0)
+(0 1.99248 0)
+(0 1.99391 0)
+(0 1.99518 0)
+(0 1.99631 0)
+(0 1.99729 0)
+(0 1.99812 0)
+(0 1.9988 0)
+(0 1.99932 0)
+(0 1.9997 0)
+(0 1.99992 0)
+(0 2 0)
+)
diff --git a/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/transportProperties b/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/transportProperties
new file mode 100644
index 0000000000000000000000000000000000000000..ca586f463802f73dbd94f8b268c2420e636583ca
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/transportProperties
@@ -0,0 +1,31 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "constant";
+    object      transportProperties;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+transportModel  Newtonian;
+
+// Re_tau = u_tau L / nu
+// Re_tau = 395
+// L = half channel height = 1
+// Ubulk/u_tau = 17.55
+// U_bulk = 17.55 -> u_tau = 1
+// -> nu = 1*1/395 = 2.532e-3
+
+nu              nu [ 0 2 -1 0 0 0 0 ] 2.532e-3;
+
+
+
+// ************************************************************************* //
diff --git a/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/turbulenceProperties b/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/turbulenceProperties
new file mode 100644
index 0000000000000000000000000000000000000000..924410797a6dc998f8984235316e4fe4ade08a62
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/constant/turbulenceProperties
@@ -0,0 +1,47 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "constant";
+    object      turbulenceProperties;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+simulationType LES;
+
+LES
+{
+    turbulence      on;
+
+    LESModel        kEqn;
+    kEqnCoeffs
+    {
+        Ce              1.048;
+        Ck              0.07; // 0.094;
+    }
+
+    printCoeffs     on;
+
+    delta           vanDriest;
+    vanDriestCoeffs
+    {
+        delta           cubeRootVol;
+        cubeRootVolCoeffs
+        {
+            deltaCoeff      1;
+        }
+        Aplus           26;
+        Cdelta          0.158;
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/incompressible/pimpleFoam/channel395DFSEM/system/blockMeshDict b/tutorials/incompressible/pimpleFoam/channel395DFSEM/system/blockMeshDict
new file mode 100644
index 0000000000000000000000000000000000000000..31cee0dff7a42dfb2017b420d2225633ac333a4a
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/system/blockMeshDict
@@ -0,0 +1,94 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      blockMeshDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+convertToMeters 1;
+
+L #calc "20*M_PI";
+H #calc "1";
+H2 #calc "2*$H";
+W #calc "M_PI";
+
+vertices
+(
+    ( 0   0   0)
+    ($L   0   0)
+    ($L  $H   0)
+    ($L $H2   0)
+    ( 0 $H2   0)
+    ( 0  $H   0)
+
+    ( 0   0  $W)
+    ($L   0  $W)
+    ($L  $H  $W)
+    ($L $H2  $W)
+    ( 0 $H2  $W)
+    ( 0  $H  $W)
+);
+
+blocks
+(
+    hex ( 0  1  2  5  6  7  8 11) (500 23 82) simpleGrading (1 25 1)
+    hex ( 5  2  3  4 11  8  9 10) (500 23 82) simpleGrading (1 0.04 1)
+);
+
+edges
+(
+);
+
+boundary
+(
+    bottomWall
+    {
+        type            wall;
+        faces           ((0 6 7 1));
+    }
+    topWall
+    {
+        type            wall;
+        faces           ((4 3 9 10));
+    }
+
+    sides_half0
+    {
+        type            cyclic;
+        neighbourPatch  sides_half1;
+        faces           ((1 2 5 0)(2 3 4 5));
+    }
+    sides_half1
+    {
+        type            cyclic;
+        neighbourPatch  sides_half0;
+        faces           ((6 11 8 7)(11 10 9 8));
+    }
+
+
+    inlet
+    {
+        type            patch;
+        faces           ((0 5 11 6)(5 4 10 11));
+    }
+    outlet
+    {
+        type            patch;
+        faces           ((1 7 8 2)(2 8 9 3));
+    }
+);
+
+mergePatchPairs
+(
+);
+
+// ************************************************************************* //
diff --git a/tutorials/incompressible/pimpleFoam/channel395DFSEM/system/controlDict b/tutorials/incompressible/pimpleFoam/channel395DFSEM/system/controlDict
new file mode 100644
index 0000000000000000000000000000000000000000..66503a3ad5c1f0a3e73ce101139bc36366b0e7f8
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/system/controlDict
@@ -0,0 +1,95 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      controlDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+application     pimpleFoam;
+
+startFrom       startTime;
+
+startTime       0;
+
+stopAt          endTime;
+
+endTime         85;
+
+deltaT          4e-3;
+
+writeControl    timeStep;
+
+writeInterval   25;
+
+purgeWrite      10;
+
+writeFormat     ascii;
+
+writePrecision  6;
+
+writeCompression off;
+
+timeFormat      general;
+
+timePrecision   6;
+
+runTimeModifiable true;
+
+functions
+{
+    Q1
+    {
+        type            Q;
+        functionObjectLibs ("libutilityFunctionObjects.so");
+        outputControl   outputTime;
+    }
+    vorticity1
+    {
+        type            vorticity;
+        functionObjectLibs ("libutilityFunctionObjects.so");
+        outputControl   outputTime;
+    }
+    yPlus
+    {
+        type            yPlus;
+        functionObjectLibs ("libutilityFunctionObjects.so");
+        outputControl   outputTime;
+    }
+    fieldAverage1
+    {
+        type            fieldAverage;
+        functionObjectLibs ( "libfieldFunctionObjects.so" );
+        outputControl   outputTime;
+        timeStart       8.5;
+
+        fields
+        (
+            U
+            {
+                mean        on;
+                prime2Mean  on;
+                base        time;
+            }
+
+            p
+            {
+                mean        on;
+                prime2Mean  on;
+                base        time;
+            }
+        );
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/incompressible/pimpleFoam/channel395DFSEM/system/decomposeParDict b/tutorials/incompressible/pimpleFoam/channel395DFSEM/system/decomposeParDict
new file mode 100644
index 0000000000000000000000000000000000000000..0a7cc129c122b0a07b57a11c873b3b298cc6a424
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/system/decomposeParDict
@@ -0,0 +1,30 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    note        "mesh decomposition control dictionary";
+    object      decomposeParDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+numberOfSubdomains  8;
+
+method          hierarchical;
+
+hierarchicalCoeffs
+{
+    n           (4 2 1);
+    delta       0.001;
+    order       xyz;
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/incompressible/pimpleFoam/channel395DFSEM/system/fvSchemes b/tutorials/incompressible/pimpleFoam/channel395DFSEM/system/fvSchemes
new file mode 100644
index 0000000000000000000000000000000000000000..11697433cedbc72a87242a5601dca543f298d258
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/system/fvSchemes
@@ -0,0 +1,61 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      fvSchemes;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ddtSchemes
+{
+    default         backward;
+}
+
+gradSchemes
+{
+    default         leastSquares;
+}
+
+divSchemes
+{
+    default         none;
+    div(phi,U)      Gauss linear;
+    div(phi,k)      Gauss limitedLinear 0.1;
+    div(phi,B)      Gauss limitedLinear 0.1;
+    div(B)          Gauss linear;
+    div(phi,nuTilda) Gauss limitedLinear 0.1;
+    div((nuEff*dev2(T(grad(U))))) Gauss linear;
+}
+
+laplacianSchemes
+{
+    default         Gauss linear uncorrected;
+}
+
+interpolationSchemes
+{
+    default         linear;
+}
+
+snGradSchemes
+{
+    default         uncorrected;
+}
+
+fluxRequired
+{
+    default         no;
+    p               ;
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/incompressible/pimpleFoam/channel395DFSEM/system/fvSolution b/tutorials/incompressible/pimpleFoam/channel395DFSEM/system/fvSolution
new file mode 100644
index 0000000000000000000000000000000000000000..89a963a45723ffc56bfc4f325da89f487c76cc3c
--- /dev/null
+++ b/tutorials/incompressible/pimpleFoam/channel395DFSEM/system/fvSolution
@@ -0,0 +1,67 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      fvSolution;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+solvers
+{
+    p
+    {
+        solver          GAMG;
+        tolerance       0;
+        relTol          0.01;
+        smoother        DICGaussSeidel;
+        nPreSweeps      0;
+        nPostSweeps     2;
+        cacheAgglomeration true;
+        nCellsInCoarsestLevel 10;
+        agglomerator    faceAreaPair;
+        mergeLevels     1;
+    }
+
+    pFinal
+    {
+        $p;
+        smoother        DICGaussSeidel;
+        tolerance       1e-06;
+        relTol          0;
+    }
+
+    "(U|k)"
+    {
+        solver          smoothSolver;
+        smoother        symGaussSeidel;
+        tolerance       1e-05;
+        relTol          0.1;
+        minIter         1;
+    }
+
+    "(U|k)Final"
+    {
+        $U;
+        tolerance       1e-06;
+        relTol          0;
+    }
+}
+
+PIMPLE
+{
+    nOuterCorrectors 3;
+    nCorrectors     1;
+    nNonOrthogonalCorrectors 0;
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun b/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun
index c82525b2f17e8de026c0598241acb3900553cc93..05b7969601d4822808359395b71f10ecef3b2b53 100755
--- a/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun
+++ b/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Get application directory
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication transformPoints -scale '(1.6666 1 1)'
diff --git a/tutorials/incompressible/pisoFoam/laminar/porousBlockage/Allrun b/tutorials/incompressible/pisoFoam/laminar/porousBlockage/Allrun
index a651bf5d0e69bc5ea56363628127017d56b6977e..fe3da42bf4bbf9c7c14f499dc94cdbda572dc3e2 100755
--- a/tutorials/incompressible/pisoFoam/laminar/porousBlockage/Allrun
+++ b/tutorials/incompressible/pisoFoam/laminar/porousBlockage/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 
diff --git a/tutorials/incompressible/pisoFoam/les/motorBike/Allrun b/tutorials/incompressible/pisoFoam/les/motorBike/Allrun
index 15e3932e9e01c5ce530208c23cc3acca4ef67ccf..6c45de5d8740220319be6578e7662c9c584eb552 100755
--- a/tutorials/incompressible/pisoFoam/les/motorBike/Allrun
+++ b/tutorials/incompressible/pisoFoam/les/motorBike/Allrun
@@ -31,7 +31,7 @@ then
     cloneParallelCase motorBike motorBikeLES
 
     # Do the LES case
-    cp lesFiles/Allrun motorBikeLES/
+    \cp lesFiles/Allrun motorBikeLES/
     (cd motorBikeLES && foamRunTutorials)
 fi
 
diff --git a/tutorials/incompressible/pisoFoam/les/motorBike/lesFiles/Allrun b/tutorials/incompressible/pisoFoam/les/motorBike/lesFiles/Allrun
index be0ad68bf8d0eeedf28a164a183ebcc1d08c9fcf..d6423dc58b14dbfd5a22251c89075e6d5459246f 100755
--- a/tutorials/incompressible/pisoFoam/les/motorBike/lesFiles/Allrun
+++ b/tutorials/incompressible/pisoFoam/les/motorBike/lesFiles/Allrun
@@ -4,12 +4,13 @@
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set-up the LES case
-cp ../lesFiles/fvS* ../lesFiles/controlDict system/
-cp ../lesFiles/turbulenceProperties constant/
+\cp ../lesFiles/fvS* ../lesFiles/controlDict system/
+\cp ../lesFiles/turbulenceProperties constant/
 
-ls -d processor* | xargs -I {} rm -rf ./{}/0 $1
-ls -d processor* | xargs -I {} mv ./{}/500 ./{}/0 $1
-ls -d processor* | xargs -I {} rm -rf ./{}/0/uniform $1
+# restart from iteration 500
+\ls -d processor* | xargs -I {} \rm -rf ./{}/0
+\ls -d processor* | xargs -I {} \mv ./{}/500 ./{}/0
+\ls -d processor* | xargs -I {} \rm -rf ./{}/0/uniform
 
 runParallel pisoFoam
 
diff --git a/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/Allrun b/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/Allrun
index 3aa5f32e812cf1197f75c618c713ca043f140014..1c2b06f78a5fcc4f580795a037c3f47934815584 100755
--- a/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/Allrun
+++ b/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/Allrun
@@ -5,26 +5,25 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # copy motorbike surface from resources directory
-cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/
+\cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/
 
 # Make dummy 0 directory
 mkdir 0
 
 runApplication blockMesh
-# cp system/decomposeParDict.hierarchical system/decomposeParDict
+# \cp system/decomposeParDict.hierarchical system/decomposeParDict
 runApplication decomposePar -decomposeParDict system/decomposeParDict.hierarchical
 
-# cp system/decomposeParDict.ptscotch system/decomposeParDict
+# \cp system/decomposeParDict.ptscotch system/decomposeParDict
 runParallel snappyHexMesh -decomposeParDict system/decomposeParDict.ptscotch -profiling -overwrite -parallel
 
 find . -type f -iname "*level*" -exec rm {} \;
 
-ls -d processor* | xargs -I {} cp -r 0.org ./{}/0 $1
+#- set the initial fields
+restore0Dir -processor
 
 runParallel renumberMesh -overwrite
-
 runParallel potentialFoam -initialiseUBCs
-
-runParallel `getApplication`
+runParallel $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/T b/tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/T
similarity index 100%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/T
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/T
index b89d0e399dd3f7fe292668a15ad421c10f74374a..cc59e281391c35303d392d56b5ce6fc22ce77345 100644
--- a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/T
+++ b/tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/T
@@ -46,8 +46,8 @@ boundaryField
     outlet
     {
         type            inletOutlet;
-        value           $internalField;
         inletValue      $internalField;
+        value           $internalField;
     }
 }
 
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/U b/tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/U
similarity index 91%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/U
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/U
index c5fcae49739afa632cc0de91235f8eedd474fa6c..1dc9751040002ce1430ef588ece1af2dabfd07e1 100644
--- a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/U
+++ b/tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/U
@@ -35,7 +35,7 @@ boundaryField
     porosityWall
     {
         type            slip;
-        value           uniform (0 0 0);
+        value           $internalField;
     }
     inlet
     {
@@ -45,8 +45,8 @@ boundaryField
     outlet
     {
         type            inletOutlet;
-        value           uniform (0 0 0);
-        inletValue      uniform (0 0 0);
+        inletValue      $internalField;
+        value           $internalField;
     }
 }
 
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/epsilon b/tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/epsilon
similarity index 83%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/epsilon
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/epsilon
index 495ca71638fb667c81e8b71e52a6ba43ab84c202..3f8a67dcb36177a4bd41e44f6233c0224df755f2 100644
--- a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/epsilon
+++ b/tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/epsilon
@@ -24,39 +24,39 @@ boundaryField
     front
     {
         type            epsilonWallFunction;
-        value           uniform 200;
+        value           $internalField;
     }
 
     back
     {
         type            epsilonWallFunction;
-        value           uniform 200;
+        value           $internalField;
     }
 
     walls
     {
         type            epsilonWallFunction;
-        value           uniform 200;
+        value           $internalField;
     }
 
     porosityWall
     {
         type            epsilonWallFunction;
-        value           uniform 200;
+        value           $internalField;
     }
 
     inlet
     {
         type            turbulentMixingLengthDissipationRateInlet;
         mixingLength    0.005;
-        value           uniform 200;
+        value           $internalField;
     }
 
     outlet
     {
         type            inletOutlet;
-        inletValue      uniform 200;
-        value           uniform 200;
+        inletValue      $internalField;
+        value           $internalField;
     }
 }
 
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/k b/tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/k
similarity index 85%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/k
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/k
index 098e959469c4dd10fa051ba845212e33c39e527b..7f2371baf1f9a8b4ab5ff46fe1ba18b46cefce5c 100644
--- a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/k
+++ b/tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/k
@@ -24,39 +24,39 @@ boundaryField
     front
     {
         type            kqRWallFunction;
-        value           uniform 1;
+        value           $internalField;
     }
 
     back
     {
         type            kqRWallFunction;
-        value           uniform 1;
+        value           $internalField;
     }
 
     walls
     {
         type            kqRWallFunction;
-        value           uniform 1;
+        value           $internalField;
     }
 
     porosityWall
     {
         type            kqRWallFunction;
-        value           uniform 1;
+        value           $internalField;
     }
 
     inlet
     {
         type            turbulentIntensityKineticEnergyInlet;
         intensity       0.05;
-        value           uniform 1;
+        value           $internalField;
     }
 
     outlet
     {
         type            inletOutlet;
         inletValue      uniform 1;
-        value           uniform 1;
+        value           $internalField;
     }
 }
 
diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/nut b/tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/nut
similarity index 84%
rename from tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/nut
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/nut
index ccfea96c5aa581339f8c9baa0a4564928016e8e8..83d86e46c1f9ed0ba6e1e3a6ad1b2354c8b33c3a 100644
--- a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/nut
+++ b/tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/nut
@@ -24,37 +24,37 @@ boundaryField
     front
     {
         type            nutkWallFunction;
-        value           uniform 0;
+        value           $internalField;
     }
 
     back
     {
         type            nutkWallFunction;
-        value           uniform 0;
+        value           $internalField;
     }
 
     walls
     {
         type            nutkWallFunction;
-        value           uniform 0;
+        value           $internalField;
     }
 
     porosityWall
     {
         type            nutkWallFunction;
-        value           uniform 0;
+        value           $internalField;
     }
 
     inlet
     {
         type            calculated;
-        value           uniform 0;
+        value           $internalField;
     }
 
     outlet
     {
         type            calculated;
-        value           uniform 0;
+        value           $internalField;
     }
 }
 
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/p b/tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/p
similarity index 100%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/0/p
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/common/0.org/p
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/system/blockMeshDict.m4 b/tutorials/incompressible/porousSimpleFoam/angledDuct/common/blockMeshDict.m4
similarity index 100%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/system/blockMeshDict.m4
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/common/blockMeshDict.m4
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/porosityProperties b/tutorials/incompressible/porousSimpleFoam/angledDuct/common/constant/porosityProperties
similarity index 100%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/porosityProperties
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/common/constant/porosityProperties
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/transportProperties b/tutorials/incompressible/porousSimpleFoam/angledDuct/common/constant/transportProperties
similarity index 100%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/transportProperties
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/common/constant/transportProperties
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/turbulenceProperties b/tutorials/incompressible/porousSimpleFoam/angledDuct/common/constant/turbulenceProperties
similarity index 100%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/turbulenceProperties
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/common/constant/turbulenceProperties
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuct/explicit/Allclean b/tutorials/incompressible/porousSimpleFoam/angledDuct/explicit/Allclean
new file mode 100755
index 0000000000000000000000000000000000000000..97591ced3297e7a1efcbd5bbf14a852b542c0703
--- /dev/null
+++ b/tutorials/incompressible/porousSimpleFoam/angledDuct/explicit/Allclean
@@ -0,0 +1,12 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # Run from this directory
+
+# Source tutorial clean functions
+. $WM_PROJECT_DIR/bin/tools/CleanFunctions
+
+# Remove copies of common files
+\rm -rf 0 constant
+
+cleanCase
+
+#------------------------------------------------------------------------------
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuct/explicit/Allrun b/tutorials/incompressible/porousSimpleFoam/angledDuct/explicit/Allrun
new file mode 100755
index 0000000000000000000000000000000000000000..749a4c91c5b9c4f4b1a2ec30b82affe9dd8f1597
--- /dev/null
+++ b/tutorials/incompressible/porousSimpleFoam/angledDuct/explicit/Allrun
@@ -0,0 +1,17 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # Run from this directory
+
+# Source tutorial run functions
+. $WM_PROJECT_DIR/bin/tools/RunFunctions
+
+echo "Use common files for 0/, constant/ and blockMeshDict"
+\rm -rf 0 constant
+\cp -r ../common/0.org 0
+\cp -r ../common/constant constant
+
+m4 system/blockMeshDict.m4 > system/blockMeshDict
+
+runApplication blockMesh
+runApplication $(getApplication)
+
+#------------------------------------------------------------------------------
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuct/explicit/system/blockMeshDict.m4 b/tutorials/incompressible/porousSimpleFoam/angledDuct/explicit/system/blockMeshDict.m4
new file mode 120000
index 0000000000000000000000000000000000000000..55f23c148bb2123e27460000f3762b0ed5bb3ec0
--- /dev/null
+++ b/tutorials/incompressible/porousSimpleFoam/angledDuct/explicit/system/blockMeshDict.m4
@@ -0,0 +1 @@
+../../common/blockMeshDict.m4
\ No newline at end of file
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/system/controlDict b/tutorials/incompressible/porousSimpleFoam/angledDuct/explicit/system/controlDict
similarity index 100%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/system/controlDict
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/explicit/system/controlDict
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/system/fvSchemes b/tutorials/incompressible/porousSimpleFoam/angledDuct/explicit/system/fvSchemes
similarity index 100%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/system/fvSchemes
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/explicit/system/fvSchemes
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/system/fvSolution b/tutorials/incompressible/porousSimpleFoam/angledDuct/explicit/system/fvSolution
similarity index 100%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/system/fvSolution
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/explicit/system/fvSolution
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuct/implicit/Allclean b/tutorials/incompressible/porousSimpleFoam/angledDuct/implicit/Allclean
new file mode 100755
index 0000000000000000000000000000000000000000..97591ced3297e7a1efcbd5bbf14a852b542c0703
--- /dev/null
+++ b/tutorials/incompressible/porousSimpleFoam/angledDuct/implicit/Allclean
@@ -0,0 +1,12 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # Run from this directory
+
+# Source tutorial clean functions
+. $WM_PROJECT_DIR/bin/tools/CleanFunctions
+
+# Remove copies of common files
+\rm -rf 0 constant
+
+cleanCase
+
+#------------------------------------------------------------------------------
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuct/implicit/Allrun b/tutorials/incompressible/porousSimpleFoam/angledDuct/implicit/Allrun
new file mode 100755
index 0000000000000000000000000000000000000000..749a4c91c5b9c4f4b1a2ec30b82affe9dd8f1597
--- /dev/null
+++ b/tutorials/incompressible/porousSimpleFoam/angledDuct/implicit/Allrun
@@ -0,0 +1,17 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # Run from this directory
+
+# Source tutorial run functions
+. $WM_PROJECT_DIR/bin/tools/RunFunctions
+
+echo "Use common files for 0/, constant/ and blockMeshDict"
+\rm -rf 0 constant
+\cp -r ../common/0.org 0
+\cp -r ../common/constant constant
+
+m4 system/blockMeshDict.m4 > system/blockMeshDict
+
+runApplication blockMesh
+runApplication $(getApplication)
+
+#------------------------------------------------------------------------------
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuct/implicit/system/blockMeshDict.m4 b/tutorials/incompressible/porousSimpleFoam/angledDuct/implicit/system/blockMeshDict.m4
new file mode 120000
index 0000000000000000000000000000000000000000..55f23c148bb2123e27460000f3762b0ed5bb3ec0
--- /dev/null
+++ b/tutorials/incompressible/porousSimpleFoam/angledDuct/implicit/system/blockMeshDict.m4
@@ -0,0 +1 @@
+../../common/blockMeshDict.m4
\ No newline at end of file
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/system/controlDict b/tutorials/incompressible/porousSimpleFoam/angledDuct/implicit/system/controlDict
similarity index 100%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/system/controlDict
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/implicit/system/controlDict
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/system/fvSchemes b/tutorials/incompressible/porousSimpleFoam/angledDuct/implicit/system/fvSchemes
similarity index 100%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/system/fvSchemes
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/implicit/system/fvSchemes
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/system/fvSolution b/tutorials/incompressible/porousSimpleFoam/angledDuct/implicit/system/fvSolution
similarity index 100%
rename from tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/system/fvSolution
rename to tutorials/incompressible/porousSimpleFoam/angledDuct/implicit/system/fvSolution
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/0 b/tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/0
deleted file mode 120000
index f1c4a884b51ae4171513426c3b7f5f585d0d889e..0000000000000000000000000000000000000000
--- a/tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/0
+++ /dev/null
@@ -1 +0,0 @@
-../angledDuctImplicit/0
\ No newline at end of file
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/Allrun b/tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/Allrun
deleted file mode 120000
index 09efeaf930d72136d1edbe49a421bc368227ad21..0000000000000000000000000000000000000000
--- a/tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/Allrun
+++ /dev/null
@@ -1 +0,0 @@
-../angledDuctImplicit/Allrun
\ No newline at end of file
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/constant b/tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/constant
deleted file mode 120000
index 28205c782b36471b118c5be2948a56e345961ad4..0000000000000000000000000000000000000000
--- a/tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/constant
+++ /dev/null
@@ -1 +0,0 @@
-../angledDuctImplicit/constant
\ No newline at end of file
diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/system/blockMeshDict.m4 b/tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/system/blockMeshDict.m4
deleted file mode 120000
index baa86f23b953deafb91190ffebcd14cc52a4c9b6..0000000000000000000000000000000000000000
--- a/tutorials/incompressible/porousSimpleFoam/angledDuctExplicit/system/blockMeshDict.m4
+++ /dev/null
@@ -1 +0,0 @@
-../../angledDuctImplicit/system/blockMeshDict.m4
\ No newline at end of file
diff --git a/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/Allrun b/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/Allrun
index f3df037202e8b5ecfe2cd19cce9cb8c6a079e159..dbc0b12711ce8b61d182d0255c0ddd4d0e6a5fd1 100755
--- a/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/Allrun
+++ b/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/Allrun
@@ -6,6 +6,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 ./Allrun.pre
 
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/incompressible/simpleFoam/airFoil2D/Allrun b/tutorials/incompressible/simpleFoam/airFoil2D/Allrun
index 271817324757b30b55bebcb63da5e059b8bc2203..89647850f5239766639961ac7b9da82a32064f43 100755
--- a/tutorials/incompressible/simpleFoam/airFoil2D/Allrun
+++ b/tutorials/incompressible/simpleFoam/airFoil2D/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication $application
 
diff --git a/tutorials/incompressible/simpleFoam/mixerVessel2D/Allrun b/tutorials/incompressible/simpleFoam/mixerVessel2D/Allrun
index 85523c3f63f17d1a0ce22c3ab71f10bb03efa83e..021754896d883a41abdb24b4ad7788561d03e14f 100755
--- a/tutorials/incompressible/simpleFoam/mixerVessel2D/Allrun
+++ b/tutorials/incompressible/simpleFoam/mixerVessel2D/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 ./makeMesh
 runApplication $application
diff --git a/tutorials/incompressible/simpleFoam/motorBike/Allrun b/tutorials/incompressible/simpleFoam/motorBike/Allrun
index 39b3f3785b7003711d021432eb89281e5582f37a..b2bee4f0109859c2569a5ecfa17beacae8045042 100755
--- a/tutorials/incompressible/simpleFoam/motorBike/Allrun
+++ b/tutorials/incompressible/simpleFoam/motorBike/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # copy motorbike surface from resources directory
-cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/
+\cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/
 runApplication surfaceFeatureExtract
 
 runApplication blockMesh
@@ -13,12 +13,11 @@ runApplication blockMesh
 runApplication decomposePar
 runParallel snappyHexMesh -overwrite
 
-#- For non-parallel running
-#cp -r 0.org 0 > /dev/null 2>&1
+#- For non-parallel running: - set the initial fields
+# restore0Dir
 
-#- For parallel running
-ls -d processor* | xargs -I {} rm -rf ./{}/0
-ls -d processor* | xargs -I {} cp -r 0.org ./{}/0
+#- For parallel running: set the initial fields
+restore0Dir -processor
 
 runParallel patchSummary
 runParallel potentialFoam
diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/Allrun b/tutorials/incompressible/simpleFoam/pipeCyclic/Allrun
index 8d9f834d23ca2bf9b18061d35c71787dd7cc86a8..17041f20bcccf14cf0daa22df77b39d7610f48d9 100755
--- a/tutorials/incompressible/simpleFoam/pipeCyclic/Allrun
+++ b/tutorials/incompressible/simpleFoam/pipeCyclic/Allrun
@@ -5,12 +5,13 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Get application directory
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication topoSet
 runApplication refineHexMesh c0 -overwrite
-cp -r 0.org 0
+
+restore0Dir
 
 #runApplication $application
 runApplication decomposePar -cellDist
diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/Allrun b/tutorials/incompressible/simpleFoam/turbineSiting/Allrun
index c8ff7fbe9db40baba8d57759e10e0f6f8772ddf4..81d7b4c4e7d99ede1fa1dea637163582695a0c3e 100755
--- a/tutorials/incompressible/simpleFoam/turbineSiting/Allrun
+++ b/tutorials/incompressible/simpleFoam/turbineSiting/Allrun
@@ -8,18 +8,19 @@ cd ${0%/*} || exit 1    # Run from this directory
 mkdir 0
 
 runApplication blockMesh
-cp system/decomposeParDict.hierarchical system/decomposeParDict
+\cp system/decomposeParDict.hierarchical system/decomposeParDict
 runApplication decomposePar
 
-cp system/decomposeParDict.ptscotch system/decomposeParDict
+\cp system/decomposeParDict.ptscotch system/decomposeParDict
 runParallel snappyHexMesh -overwrite
 
 find . -type f -iname "*level*" -exec rm {} \;
 
-ls -d processor* | xargs -I {} cp -r 0.org ./{}/0
+# - set the initial fields
+restore0Dir -processor
 
 runParallel topoSet
-runParallel `getApplication`
+runParallel $(getApplication)
 
 runApplication reconstructParMesh -constant
 runApplication reconstructPar
diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/Allrun b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/Allrun
index b11e5980cf9937842110aeb249e97a8ed59969f1..1d01582b285cdfc79bbc2c2525074137b0237260 100755
--- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/Allrun
+++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 # create mesh
 runApplication blockMesh
diff --git a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/Allclean b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/Allclean
index 7e6645913764bac716ad9e5ef6a80da9b096aaee..85527724bf1755a5b4ddb251062932f53faba38f 100755
--- a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/Allclean
+++ b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/Allclean
@@ -4,11 +4,17 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/CleanFunctions
 
-cd hopperInitialState
-cleanCase
+(
+    cd hopperInitialState || exit 1
 
-cd ../hopperEmptying
-cleanCase
-rm -rf 0
+    cleanCase
+)
+
+(
+    cd hopperEmptying || exit 1
+
+    cleanCase
+    rm -rf 0
+)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/Allrun b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/Allrun
index 6a0667ccb8449a8adcaedfef8319a6ecb176a017..2beb0f035509562c26da5d2964da525345acd898 100755
--- a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/Allrun
+++ b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/Allrun
@@ -4,20 +4,24 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-cd hopperInitialState
-runApplication blockMesh
-runApplication decomposePar
-runParallel `getApplication`
-runApplication reconstructPar -latestTime
-cd ..
+(
+    cd hopperInitialState || exit 1
 
-cd hopperEmptying
-rm -rf 0
-cp -r 0.org 0
-runApplication blockMesh
-runApplication mapFields ../hopperInitialState -sourceTime latestTime
-runApplication decomposePar
-runParallel `getApplication`
-runApplication reconstructPar
+    runApplication blockMesh
+    runApplication decomposePar
+    runParallel $(getApplication)
+    runApplication reconstructPar -latestTime
+)
+
+(
+    cd hopperEmptying || exit 1
+
+    restore0Dir
+    runApplication blockMesh
+    runApplication mapFields ../hopperInitialState -sourceTime latestTime
+    runApplication decomposePar
+    runParallel $(getApplication)
+    runApplication reconstructPar
+)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun
index 3e58a9551e94f9604a8a8d7c2cb75b9f96fd98a9..ebb4bc401cba320a82525297dcb680deab9af7ec 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun
@@ -5,6 +5,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 ./Allrun.pre
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication $application
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun.pre b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun.pre
index ae65df0e2591de6620bef310130590ead5e4e323..e4d467e68eef7219e9d33d3b22a4b5a4adb8e7c6 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun.pre
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/Allrun.pre
@@ -1,7 +1,7 @@
 #!/bin/sh
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-cp -rf 0.org 0
+restore0Dir
 runApplication blockMesh
 
 #runApplication setSet -batch wallFilmRegion.setSet
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun
index 61f03edcaf4a2b833ea695e78382d266b92cdb83..fa03916ababe270f90a56fc23907f0d76069e2dc 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun
@@ -6,6 +6,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 ./Allrun.pre
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication $application
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun-parallel b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun-parallel
index 29817ff80b6042d4611b1141298fbd6764310619..7779179a354de3dca77e6bddac5a358a2b348918 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun-parallel
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun-parallel
@@ -6,7 +6,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 ./Allrun.pre
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication -s wallFilmRegion decomposePar -region wallFilmRegion
 runApplication -s primaryRegion  decomposePar
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun.pre b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun.pre
index 784b007b2c128a47398e9bb2266add5f8495ab93..ab63cbf9b3afd05b9472fc6bbda7f45e8dce04b5 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun.pre
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/Allrun.pre
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-cp -rf 0.org 0
+restore0Dir
 
 # create the underlying block mesh
 runApplication blockMesh
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/Allrun b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/Allrun
index 3e58a9551e94f9604a8a8d7c2cb75b9f96fd98a9..ebb4bc401cba320a82525297dcb680deab9af7ec 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/Allrun
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/Allrun
@@ -5,6 +5,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 ./Allrun.pre
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication $application
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/Allrun.pre b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/Allrun.pre
index d00e6b23ff0cb06a855c516123420d3a01d0639d..c82f75cd2dda061eb12b224966dc1ba98d153bba 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/Allrun.pre
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/Allrun.pre
@@ -1,7 +1,7 @@
 #!/bin/sh
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-cp -rf 0.org 0
+restore0Dir
 
 runApplication blockMesh
 
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/Allrun b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/Allrun
index 3e58a9551e94f9604a8a8d7c2cb75b9f96fd98a9..ebb4bc401cba320a82525297dcb680deab9af7ec 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/Allrun
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/Allrun
@@ -5,6 +5,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 ./Allrun.pre
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication $application
diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/Allrun.pre b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/Allrun.pre
index 512715678f49206e4727aeef3f39ecf25a1114de..9292f83031bdfea5e212528f1373fe8e61042382 100755
--- a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/Allrun.pre
+++ b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/Allrun.pre
@@ -1,7 +1,7 @@
 #!/bin/sh
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-cp -rf 0.org 0
+restore0Dir
 
 runApplication blockMesh
 
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/0/G b/tutorials/lagrangian/reactingParcelFoam/filter/0/G
deleted file mode 100644
index b7d5f8f6d2d6d300e75fcb66f9d055b676f44fd5..0000000000000000000000000000000000000000
--- a/tutorials/lagrangian/reactingParcelFoam/filter/0/G
+++ /dev/null
@@ -1,73 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "1";
-    object      G;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [1 0 -3 0 0 0 0];
-
-internalField   uniform 0;
-
-boundaryField
-{
-    walls
-    {
-        type            MarshakRadiation;
-        T               T;
-        emissivityMode  lookup;
-        emissivity      uniform 1;
-        value           uniform 0;
-        refValue        uniform 0;
-        refGradient     uniform 0;
-        valueFraction   uniform 0;
-    }
-    inlet
-    {
-        type            MarshakRadiation;
-        T               T;
-        emissivityMode  lookup;
-        emissivity      uniform 1;
-        value           uniform 0;
-        refValue        uniform 0;
-        refGradient     uniform 0;
-        valueFraction   uniform 0;
-    }
-    outlet
-    {
-        type            zeroGradient;
-    }
-    cycLeft_half0
-    {
-        type            cyclic;
-    }
-    cycRight_half0
-    {
-        type            cyclic;
-    }
-    frontAndBack
-    {
-        type            empty;
-    }
-    cycLeft_half1
-    {
-        type            cyclic;
-    }
-    cycRight_half1
-    {
-        type            cyclic;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/0/alphat b/tutorials/lagrangian/reactingParcelFoam/filter/0/alphat
deleted file mode 100644
index b570921ead96db5801c1bdd671189126d33bfdbe..0000000000000000000000000000000000000000
--- a/tutorials/lagrangian/reactingParcelFoam/filter/0/alphat
+++ /dev/null
@@ -1,62 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "1";
-    object      alphat;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [1 -1 -1 0 0 0 0];
-
-internalField   uniform 0;
-
-boundaryField
-{
-    walls
-    {
-        type            compressible::alphatWallFunction;
-        value           uniform 0;
-    }
-    inlet
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    outlet
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    cycLeft_half0
-    {
-        type            cyclic;
-    }
-    cycRight_half0
-    {
-        type            cyclic;
-    }
-    frontAndBack
-    {
-        type            empty;
-    }
-    cycLeft_half1
-    {
-        type            cyclic;
-    }
-    cycRight_half1
-    {
-        type            cyclic;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/0/epsilon b/tutorials/lagrangian/reactingParcelFoam/filter/0/epsilon
deleted file mode 100644
index 088ff1022837baf9e94432f5e339c040404a2c9e..0000000000000000000000000000000000000000
--- a/tutorials/lagrangian/reactingParcelFoam/filter/0/epsilon
+++ /dev/null
@@ -1,61 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "1";
-    object      epsilon;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 2 -3 0 0 0 0];
-
-internalField   uniform 0.0449;
-
-boundaryField
-{
-    walls
-    {
-        type            epsilonWallFunction;
-        value           uniform 0.0449;
-    }
-    inlet
-    {
-        type            fixedValue;
-        value           uniform 0.0449;
-    }
-    outlet
-    {
-        type            zeroGradient;
-    }
-    cycLeft_half0
-    {
-        type            cyclic;
-    }
-    cycRight_half0
-    {
-        type            cyclic;
-    }
-    frontAndBack
-    {
-        type            empty;
-    }
-    cycLeft_half1
-    {
-        type            cyclic;
-    }
-    cycRight_half1
-    {
-        type            cyclic;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/0/k b/tutorials/lagrangian/reactingParcelFoam/filter/0/k
deleted file mode 100644
index 3f150e3b033dceb790ec9cb60ea1f2cf18742c61..0000000000000000000000000000000000000000
--- a/tutorials/lagrangian/reactingParcelFoam/filter/0/k
+++ /dev/null
@@ -1,61 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "1";
-    object      k;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 2 -2 0 0 0 0];
-
-internalField   uniform 0.0938;
-
-boundaryField
-{
-    walls
-    {
-        type            kqRWallFunction;
-        value           uniform 0.0938;
-    }
-    inlet
-    {
-        type            fixedValue;
-        value           uniform 0.0938;
-    }
-    outlet
-    {
-        type            zeroGradient;
-    }
-    cycLeft_half0
-    {
-        type            cyclic;
-    }
-    cycRight_half0
-    {
-        type            cyclic;
-    }
-    frontAndBack
-    {
-        type            empty;
-    }
-    cycLeft_half1
-    {
-        type            cyclic;
-    }
-    cycRight_half1
-    {
-        type            cyclic;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/0/nut b/tutorials/lagrangian/reactingParcelFoam/filter/0/nut
deleted file mode 100644
index 39ecc08b76c26ae7e474d321283008bf0ba9c0a8..0000000000000000000000000000000000000000
--- a/tutorials/lagrangian/reactingParcelFoam/filter/0/nut
+++ /dev/null
@@ -1,62 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "1";
-    object      nut;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 2 -1 0 0 0 0];
-
-internalField   uniform 0;
-
-boundaryField
-{
-    walls
-    {
-        type            nutkWallFunction;
-        value           uniform 0;
-    }
-    inlet
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    outlet
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    cycLeft_half0
-    {
-        type            cyclic;
-    }
-    cycRight_half0
-    {
-        type            cyclic;
-    }
-    frontAndBack
-    {
-        type            empty;
-    }
-    cycLeft_half1
-    {
-        type            cyclic;
-    }
-    cycRight_half1
-    {
-        type            cyclic;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/Allclean b/tutorials/lagrangian/reactingParcelFoam/filter/Allclean
index a298a17347fb11180b118d58176da9d590322bea..eddae4496c8c0fd5a2837494ab2b86277b794034 100755
--- a/tutorials/lagrangian/reactingParcelFoam/filter/Allclean
+++ b/tutorials/lagrangian/reactingParcelFoam/filter/Allclean
@@ -4,15 +4,9 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial clean functions
 . $WM_PROJECT_DIR/bin/tools/CleanFunctions
 
-cleanCase
-
-# remove 0 directory
-rm -rf 0
+# Remove 0.org/ copy and post-processing directories
+\rm -rf 0 postProcessing
 
-# remove post-processing directory
-rm -rf postProcessing
-
-# copy 0.org to 0
-cp -r 0.org 0
+cleanCase
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/Allrun b/tutorials/lagrangian/reactingParcelFoam/filter/Allrun
index 5163ff42ca6d71582e7eff1d775eab21de59d325..2c976e023babdf78cb0088faf33082fd5a4c81bf 100755
--- a/tutorials/lagrangian/reactingParcelFoam/filter/Allrun
+++ b/tutorials/lagrangian/reactingParcelFoam/filter/Allrun
@@ -4,9 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
-
-# create mesh
+restore0Dir
 runApplication blockMesh
 
 # create sets
@@ -15,6 +13,6 @@ runApplication topoSet
 # create baffles and fields
 runApplication createBaffles -overwrite
 
-runApplication $application
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/Allrun b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/Allrun
index 35dc16c075d91d91b244bc9bb9b426964f569404..58c87fca19363c0d55bb112e6e604bb12ac89ea0 100755
--- a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/Allrun
+++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/Allrun
@@ -7,14 +7,14 @@ cd ${0%/*} || exit 1    # Run from this directory
 # create mesh
 runApplication blockMesh
 
-cp -r 0.org 0
+restore0Dir
 
 # initialise with potentialFoam solution
 runApplication potentialFoam
 
-rm -f 0/phi
+\rm -f 0/phi
 
 # run the solver
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/Allrun b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/Allrun
index 35dc16c075d91d91b244bc9bb9b426964f569404..58c87fca19363c0d55bb112e6e604bb12ac89ea0 100755
--- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/Allrun
+++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/Allrun
@@ -7,14 +7,14 @@ cd ${0%/*} || exit 1    # Run from this directory
 # create mesh
 runApplication blockMesh
 
-cp -r 0.org 0
+restore0Dir
 
 # initialise with potentialFoam solution
 runApplication potentialFoam
 
-rm -f 0/phi
+\rm -f 0/phi
 
 # run the solver
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/H2O b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/H2O
deleted file mode 100644
index 802c5d44b57d5885bac14100b8d9f10bbe549205..0000000000000000000000000000000000000000
--- a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/H2O
+++ /dev/null
@@ -1,54 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      H2O;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 0 0 0 0 0 0];
-
-internalField   uniform 0.01;
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    walls
-    {
-        type            zeroGradient;
-    }
-    outlet
-    {
-        type            inletOutlet;
-        inletValue      uniform 0.0;
-    }
-    inletSides
-    {
-        type            fixedValue;
-        value           uniform 0.01;
-    }
-    inletCentral
-    {
-        type            fixedValue;
-        value           uniform 0.01;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/T b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/T
deleted file mode 100644
index 5e3608010f5b89d3f873e8cd4fd4391ad6ad2ba0..0000000000000000000000000000000000000000
--- a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/T
+++ /dev/null
@@ -1,54 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      T;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 0 0 1 0 0 0];
-
-internalField   uniform 473.0;
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    walls
-    {
-        type            zeroGradient;
-    }
-    outlet
-    {
-        type            inletOutlet;
-        inletValue      uniform 473.0;
-    }
-    inletSides
-    {
-        type            fixedValue;
-        value           uniform 473.0;
-    }
-    inletCentral
-    {
-        type            fixedValue;
-        value           uniform 573.0;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/U b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/U
deleted file mode 100644
index 94158b3fe6fafaae71fe2a3a5f7f3cd06c067847..0000000000000000000000000000000000000000
--- a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/U
+++ /dev/null
@@ -1,58 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volVectorField;
-    location    "0";
-    object      U;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 1 -1 0 0 0 0];
-
-internalField   uniform (0 0 0);
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    inletCentral
-    {
-        type            flowRateInletVelocity;
-        rhoInlet        1.2;
-        massFlowRate    constant 0.00379;
-        value           uniform (0 14.68 0);
-    }
-    inletSides
-    {
-        type            flowRateInletVelocity;
-        rhoInlet        1.2;
-        massFlowRate    constant 0.00832;
-        value           uniform (0 17.79 0);
-    }
-    outlet
-    {
-        type            inletOutlet;
-        inletValue      uniform (0 0 0);
-    }
-    walls
-    {
-        type            noSlip;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/air b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/air
deleted file mode 100644
index 29cc2be2dd572c7c5ea60fb5ec612f735c3fa810..0000000000000000000000000000000000000000
--- a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/air
+++ /dev/null
@@ -1,54 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      air;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 0 0 0 0 0 0];
-
-internalField   uniform 0.99;
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    walls
-    {
-        type            zeroGradient;
-    }
-    outlet
-    {
-        type            inletOutlet;
-        inletValue      uniform 1.0;
-    }
-    inletSides
-    {
-        type            fixedValue;
-        value           uniform 0.99;
-    }
-    inletCentral
-    {
-        type            fixedValue;
-        value           uniform 0.99;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/alphat b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/alphat
deleted file mode 100644
index 97f4ec8f38f1f81d15e16d11ae4db9726cc0937c..0000000000000000000000000000000000000000
--- a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/alphat
+++ /dev/null
@@ -1,56 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      alphat;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [1 -1 -1 0 0 0 0];
-
-internalField   uniform 0;
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    inletCentral
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    inletSides
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    outlet
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    walls
-    {
-        type            compressible::alphatWallFunction;
-        Prt             0.85;
-        value           uniform 0;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/k b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/k
deleted file mode 100644
index d5f5819e4806f7a70e45a630dd48407de01b7df9..0000000000000000000000000000000000000000
--- a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/k
+++ /dev/null
@@ -1,57 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      k;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 2 -2 0 0 0 0];
-
-internalField   uniform 3.75e-9;
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    inletCentral
-    {
-        type            turbulentIntensityKineticEnergyInlet;
-        intensity       0.15;
-        value           uniform 3.75e-9;
-    }
-    inletSides
-    {
-        type            turbulentIntensityKineticEnergyInlet;
-        intensity       0.16;
-        value           uniform 3.75e-9;
-    }
-    outlet
-    {
-        type            inletOutlet;
-        inletValue      uniform 3.75e-9;
-    }
-    walls
-    {
-        type            kqRWallFunction;
-        value           uniform 0;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/nut b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/nut
deleted file mode 100644
index c89f6e404442be235d952b3205e37dea9b67167c..0000000000000000000000000000000000000000
--- a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/nut
+++ /dev/null
@@ -1,58 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      nut;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 2 -1 0 0 0 0];
-
-internalField   uniform 0;
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    inletCentral
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    inletSides
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    outlet
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    walls
-    {
-        type            nutkWallFunction;
-        Cmu             0.09;
-        kappa           0.41;
-        E               9.8;
-        value           uniform 0;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/omega b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/omega
deleted file mode 100644
index 26af2dccdd910b9eb67799f6dbf7ea34cd2ce763..0000000000000000000000000000000000000000
--- a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/omega
+++ /dev/null
@@ -1,62 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      omega;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 0 -1 0 0 0 0];
-
-internalField   uniform 4.5e-3;
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    inletCentral
-    {
-        type            turbulentMixingLengthFrequencyInlet;
-        mixingLength    0.007;
-        k               k;
-        value           uniform 4.5e-3;
-    }
-    inletSides
-    {
-        type            turbulentMixingLengthFrequencyInlet;
-        mixingLength    0.007;
-        k               k;
-        value           uniform 4.5e-3;
-    }
-    outlet
-    {
-        type            inletOutlet;
-        inletValue      uniform 4.5e-3;
-    }
-    walls
-    {
-        type            omegaWallFunction;
-        Cmu             0.09;
-        kappa           0.41;
-        E               9.8;
-        value           $internalField;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/Allclean b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/Allclean
index fa0d0929d9603d7d2e4b639d9255e7d07fe0545d..b47f1dd6cc9697939c0dbce686677bcf8b8eb5cf 100755
--- a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/Allclean
+++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/Allclean
@@ -4,11 +4,8 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial clean functions
 . $WM_PROJECT_DIR/bin/tools/CleanFunctions
 
-# remove old time and post-processing directories
-rm -rf 0 *[1-9]* processor* postProcessing
-
-# copy 0.org to 0
-cp -r 0.org 0
+# Remove old time, 0.org/ copy and post-processing directories
+\rm -rf 0 *[1-9]* processor* postProcessing
 
 cleanCase
 
diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/Allrun b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/Allrun
index 94c17f61f5b8f414e5cd35b0e1812125168bdba8..a4698df1e26e7f0f62dc322d80187bd491337d14 100755
--- a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/Allrun
+++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/Allrun
@@ -4,15 +4,14 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-rm -rf 0
-cp -rf 0.org 0
+restore0Dir
 
 runApplication blockMesh
 
 runApplication potentialFoam
 
 # remove incompatible (volumetric) flux field
-rm -f 0/phi
+\rm -f 0/phi 2>/dev/null
 
 runApplication $(getApplication)
 
diff --git a/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-simulation b/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-simulation
index 6d2f7197876afc0a9f174885ccb8e903546effea..5041d32a5589d8d2b21c64e8fbfb9bb5d3830003 100755
--- a/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-simulation
+++ b/tutorials/mesh/foamyHexMesh/mixerVessel/Allrun-simulation
@@ -18,7 +18,7 @@ runApplication mergeOrSplitBaffles -split -overwrite
 runApplication createPatch -overwrite
 
 # Copy fields after meshing to avoind the generation of unnecessary patch fields
-\cp -r 0.org 0
+restore0Dir
 
 # Initialize alpha
 runApplication setFields
diff --git a/tutorials/mesh/foamyQuadMesh/OpenCFD/Allrun-rhoCentralFoam b/tutorials/mesh/foamyQuadMesh/OpenCFD/Allrun-rhoCentralFoam
index 8ab7ec82512e37c4c62a8512aaa8647065541121..266fee9c0b4af31482c6c6f707c4c4c51f9b9882 100755
--- a/tutorials/mesh/foamyQuadMesh/OpenCFD/Allrun-rhoCentralFoam
+++ b/tutorials/mesh/foamyQuadMesh/OpenCFD/Allrun-rhoCentralFoam
@@ -4,8 +4,8 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-cp system/controlDict.rhoCentralFoam system/controlDict
-cp -r 0.org 0
+\cp system/controlDict.rhoCentralFoam system/controlDict
+restore0Dir
 
 runApplication decomposePar
 runParallel rhoCentralFoam
diff --git a/tutorials/mesh/parallel/filter/Allclean b/tutorials/mesh/parallel/filter/Allclean
index 4d4ba35b8b06fd49edcb843e62d14d489df8d4e7..eddae4496c8c0fd5a2837494ab2b86277b794034 100755
--- a/tutorials/mesh/parallel/filter/Allclean
+++ b/tutorials/mesh/parallel/filter/Allclean
@@ -4,12 +4,9 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial clean functions
 . $WM_PROJECT_DIR/bin/tools/CleanFunctions
 
-cleanCase
-
-# remove 0 directory
-rm -rf 0
+# Remove 0.org/ copy and post-processing directories
+\rm -rf 0 postProcessing
 
-# remove post-processing directory
-rm -rf postProcessing
+cleanCase
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/mesh/parallel/filter/Allrun b/tutorials/mesh/parallel/filter/Allrun
index 9dabedb155fce0535a3214c27dfa6fc4d3d1e938..4be640030bc21cd4ba3faceacaa35ed29cb43fa4 100755
--- a/tutorials/mesh/parallel/filter/Allrun
+++ b/tutorials/mesh/parallel/filter/Allrun
@@ -9,8 +9,8 @@ application=$(getApplication)
 # Create mesh
 runApplication blockMesh
 
-# Copy 0.org to 0
-cp -r 0.org 0
+# Restore 0/ from 0.org/
+restore0Dir
 
 # Create sets
 runApplication topoSet
diff --git a/tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/Allrun b/tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/Allrun
index deec9791eac01497cb8186f83b9d4a1eb2f01df8..188dbba1cde0064156c4222d3fd5ebbad406d04f 100755
--- a/tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/Allrun
+++ b/tutorials/multiphase/MPPICInterFoam/twoPhasePachuka/Allrun
@@ -6,14 +6,14 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
 # create the underlying block mesh
 m4 system/pachuka.m4 > system/blockMeshDict
 
 runApplication blockMesh
 
-cp 0/alpha.water.org 0/alpha.water
+\cp 0/alpha.water.org 0/alpha.water
 
 # create faceSet for burner inlet and faceZone for coupled wall
 runApplication topoSet
@@ -28,9 +28,9 @@ runApplication setFields
 decomposePar > log.decomposePar 2>&1
 
 # Run
-runParallel `getApplication`
+runParallel $(getApplication)
 
 # Reconstruct case
 runApplication reconstructPar
 
-# ----------------------------------------------------------------- end-of-file
\ No newline at end of file
+# ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/multiphase/cavitatingFoam/les/throttle/Allrun b/tutorials/multiphase/cavitatingFoam/les/throttle/Allrun
index d0b7026c3a66ba62758d228d09fc5e5d339b60c4..6ed1c6ba9b493effcfa94a9350a40e6a3bf713f8 100755
--- a/tutorials/multiphase/cavitatingFoam/les/throttle/Allrun
+++ b/tutorials/multiphase/cavitatingFoam/les/throttle/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
 refineMeshByCellSet()
 {
diff --git a/tutorials/multiphase/cavitatingFoam/les/throttle3D/Allrun b/tutorials/multiphase/cavitatingFoam/les/throttle3D/Allrun
index fb55f327c68bf87cf5926194b5206b66e61254c6..e020b8a0fc2df5d4c7d01ee8855d8396fbd2e5ec 100755
--- a/tutorials/multiphase/cavitatingFoam/les/throttle3D/Allrun
+++ b/tutorials/multiphase/cavitatingFoam/les/throttle3D/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
 refineMeshByCellSet()
 {
@@ -25,7 +25,7 @@ refineMeshByCellSet()
    done
 }
 
-cp -r 0.org 0
+restore0Dir
 
 runApplication blockMesh
 refineMeshByCellSet 1 2 3
diff --git a/tutorials/multiphase/cavitatingFoam/ras/throttle/Allrun b/tutorials/multiphase/cavitatingFoam/ras/throttle/Allrun
index 4f68fa57c2abd682d08214093ad71be8e2f14f25..746320a279e3083e129740639f4436d502088579 100755
--- a/tutorials/multiphase/cavitatingFoam/ras/throttle/Allrun
+++ b/tutorials/multiphase/cavitatingFoam/ras/throttle/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 refineMeshByCellSet()
 {
diff --git a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/Allrun b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/Allrun
index d527e2ed86fb56c72f30dfd65beafa4b3a53a6d2..41332c6843ed23a0ff8789d36d0005423cca4025 100755
--- a/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/Allrun
+++ b/tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D/Allrun
@@ -6,8 +6,8 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 m4 system/blockMeshDict.m4 > system/blockMeshDict
 runApplication blockMesh
-cp 0/alpha.water.org 0/alpha.water
+\cp 0/alpha.water.org 0/alpha.water
 runApplication setFields
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/Allrun b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/Allrun
index 5040c29590b4a24cc09981728ae2030dc774724f..fd07af1d46bcabef45db9aad9d1c153f0f39becb 100755
--- a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/Allrun
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 runApplication blockMesh
-cp -r 0.org 0
+restore0Dir
 runApplication setFields
 runApplication $(getApplication)
 
diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/Allrun b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/Allrun
index 4e091494f626320faf86d48b07c6e4af2b19229b..6c6dafdea44eef1c91b654482bf3be033f59bc45 100755
--- a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/Allrun
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 runApplication blockMesh
-cp -r 0.org 0
+restore0Dir
 runApplication setFields
 runApplication decomposePar
 runParallel $(getApplication)
diff --git a/tutorials/multiphase/compressibleMultiphaseInterFoam/laminar/damBreak4phase/Allrun b/tutorials/multiphase/compressibleMultiphaseInterFoam/laminar/damBreak4phase/Allrun
index b275240a50dde518b78c9e66ba0b8f558c962907..912c34cfdb7636863fe4782c6bfc402154698b0d 100755
--- a/tutorials/multiphase/compressibleMultiphaseInterFoam/laminar/damBreak4phase/Allrun
+++ b/tutorials/multiphase/compressibleMultiphaseInterFoam/laminar/damBreak4phase/Allrun
@@ -5,10 +5,9 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
-\rm -rf 0
-cp -r 0.org 0
+restore0Dir
 
 runApplication blockMesh
 runApplication setFields
diff --git a/tutorials/multiphase/driftFluxFoam/ras/mixerVessel2D/Allrun b/tutorials/multiphase/driftFluxFoam/ras/mixerVessel2D/Allrun
index 66c1631fd3b21065460d33c1ce838457c787defb..f5e6c61a9e087c0f799e0c700493698c1df8fcf4 100755
--- a/tutorials/multiphase/driftFluxFoam/ras/mixerVessel2D/Allrun
+++ b/tutorials/multiphase/driftFluxFoam/ras/mixerVessel2D/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication ./makeMesh
 runApplication $application
diff --git a/tutorials/multiphase/driftFluxFoam/ras/tank3D/Allrun b/tutorials/multiphase/driftFluxFoam/ras/tank3D/Allrun
index 271817324757b30b55bebcb63da5e059b8bc2203..89647850f5239766639961ac7b9da82a32064f43 100755
--- a/tutorials/multiphase/driftFluxFoam/ras/tank3D/Allrun
+++ b/tutorials/multiphase/driftFluxFoam/ras/tank3D/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication $application
 
diff --git a/tutorials/multiphase/interCondensingEvaporatingFoam/condensatingVessel/Allrun b/tutorials/multiphase/interCondensingEvaporatingFoam/condensatingVessel/Allrun
index 2d455d1fbce4041066fbb25494d9e84b6162fbb9..ebc19b3d2a4adff39cf7ca06c6c671b012c42337 100755
--- a/tutorials/multiphase/interCondensingEvaporatingFoam/condensatingVessel/Allrun
+++ b/tutorials/multiphase/interCondensingEvaporatingFoam/condensatingVessel/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication $application
diff --git a/tutorials/multiphase/interDyMFoam/laminar/sloshingTank2D/Allrun b/tutorials/multiphase/interDyMFoam/laminar/sloshingTank2D/Allrun
index d527e2ed86fb56c72f30dfd65beafa4b3a53a6d2..41332c6843ed23a0ff8789d36d0005423cca4025 100755
--- a/tutorials/multiphase/interDyMFoam/laminar/sloshingTank2D/Allrun
+++ b/tutorials/multiphase/interDyMFoam/laminar/sloshingTank2D/Allrun
@@ -6,8 +6,8 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 m4 system/blockMeshDict.m4 > system/blockMeshDict
 runApplication blockMesh
-cp 0/alpha.water.org 0/alpha.water
+\cp 0/alpha.water.org 0/alpha.water
 runApplication setFields
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/multiphase/interDyMFoam/laminar/sloshingTank2D3DoF/Allrun b/tutorials/multiphase/interDyMFoam/laminar/sloshingTank2D3DoF/Allrun
index d527e2ed86fb56c72f30dfd65beafa4b3a53a6d2..41332c6843ed23a0ff8789d36d0005423cca4025 100755
--- a/tutorials/multiphase/interDyMFoam/laminar/sloshingTank2D3DoF/Allrun
+++ b/tutorials/multiphase/interDyMFoam/laminar/sloshingTank2D3DoF/Allrun
@@ -6,8 +6,8 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 m4 system/blockMeshDict.m4 > system/blockMeshDict
 runApplication blockMesh
-cp 0/alpha.water.org 0/alpha.water
+\cp 0/alpha.water.org 0/alpha.water
 runApplication setFields
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/multiphase/interDyMFoam/laminar/sloshingTank3D/Allrun b/tutorials/multiphase/interDyMFoam/laminar/sloshingTank3D/Allrun
index d527e2ed86fb56c72f30dfd65beafa4b3a53a6d2..41332c6843ed23a0ff8789d36d0005423cca4025 100755
--- a/tutorials/multiphase/interDyMFoam/laminar/sloshingTank3D/Allrun
+++ b/tutorials/multiphase/interDyMFoam/laminar/sloshingTank3D/Allrun
@@ -6,8 +6,8 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 m4 system/blockMeshDict.m4 > system/blockMeshDict
 runApplication blockMesh
-cp 0/alpha.water.org 0/alpha.water
+\cp 0/alpha.water.org 0/alpha.water
 runApplication setFields
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/multiphase/interDyMFoam/laminar/sloshingTank3D3DoF/Allrun b/tutorials/multiphase/interDyMFoam/laminar/sloshingTank3D3DoF/Allrun
index d527e2ed86fb56c72f30dfd65beafa4b3a53a6d2..41332c6843ed23a0ff8789d36d0005423cca4025 100755
--- a/tutorials/multiphase/interDyMFoam/laminar/sloshingTank3D3DoF/Allrun
+++ b/tutorials/multiphase/interDyMFoam/laminar/sloshingTank3D3DoF/Allrun
@@ -6,8 +6,8 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 m4 system/blockMeshDict.m4 > system/blockMeshDict
 runApplication blockMesh
-cp 0/alpha.water.org 0/alpha.water
+\cp 0/alpha.water.org 0/alpha.water
 runApplication setFields
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/multiphase/interDyMFoam/laminar/sloshingTank3D6DoF/Allrun b/tutorials/multiphase/interDyMFoam/laminar/sloshingTank3D6DoF/Allrun
index d527e2ed86fb56c72f30dfd65beafa4b3a53a6d2..41332c6843ed23a0ff8789d36d0005423cca4025 100755
--- a/tutorials/multiphase/interDyMFoam/laminar/sloshingTank3D6DoF/Allrun
+++ b/tutorials/multiphase/interDyMFoam/laminar/sloshingTank3D6DoF/Allrun
@@ -6,8 +6,8 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 m4 system/blockMeshDict.m4 > system/blockMeshDict
 runApplication blockMesh
-cp 0/alpha.water.org 0/alpha.water
+\cp 0/alpha.water.org 0/alpha.water
 runApplication setFields
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/multiphase/interDyMFoam/laminar/testTubeMixer/Allrun b/tutorials/multiphase/interDyMFoam/laminar/testTubeMixer/Allrun
index f49fa8dbc487057f01108bfe25b2504f8a0e3f32..fce37c0511421ff1a97ecce9c3d7f5f4c12e5c05 100755
--- a/tutorials/multiphase/interDyMFoam/laminar/testTubeMixer/Allrun
+++ b/tutorials/multiphase/interDyMFoam/laminar/testTubeMixer/Allrun
@@ -5,8 +5,8 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 runApplication blockMesh
-cp 0/alpha.water.org 0/alpha.water
+\cp 0/alpha.water.org 0/alpha.water
 runApplication setFields
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/multiphase/interDyMFoam/ras/DTCHull/Allrun b/tutorials/multiphase/interDyMFoam/ras/DTCHull/Allrun
index 49e618ecd4306a7f4a56bd195335249ab87a3f1e..3eddb17d71b5821e9b7a7c99afc39b37f5a06e8f 100755
--- a/tutorials/multiphase/interDyMFoam/ras/DTCHull/Allrun
+++ b/tutorials/multiphase/interDyMFoam/ras/DTCHull/Allrun
@@ -5,10 +5,9 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # copy DTC hull surface from resources folder
-cp $FOAM_TUTORIALS/resources/geometry/DTC-scaled.stl.gz constant/triSurface/
+\cp $FOAM_TUTORIALS/resources/geometry/DTC-scaled.stl.gz constant/triSurface/
 
 runApplication surfaceFeatureExtract
-
 runApplication blockMesh
 
 for i in 1 2 3 4 5 6
@@ -21,18 +20,11 @@ do
 done
 
 runApplication snappyHexMesh -overwrite
-
-\rm -rf 0
-\cp -r 0.org 0
-
+restore0Dir
 runApplication setFields
-
 runApplication decomposePar
-
 runParallel renumberMesh -overwrite
-
 runParallel $(getApplication)
-
 runApplication reconstructPar
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/Allrun b/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/Allrun
index 0424df0e63df09cb7456ad5b0e4333c7fe7292b8..755d7612a41f9ec2601a9db825e6a7b5901ce999 100755
--- a/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/Allrun
+++ b/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/Allrun
@@ -4,12 +4,12 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-cp -r 0.org 0 > /dev/null 2>&1
+restore0Dir
 runApplication blockMesh
 #runApplication setSet -batch createObstacle.setSet
 runApplication topoSet
 runApplication subsetMesh -overwrite c0 -patch walls
 runApplication setFields
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun
index 62915ff2cf574a9e8c8f52942d41a3b189d05ecf..875319146664ef804b473341ee56b31c2f801c7a 100755
--- a/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun
+++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun
@@ -5,12 +5,12 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication topoSet
 runApplication subsetMesh -overwrite c0 -patch floatingObject
-cp -r 0.org 0 > /dev/null 2>&1
+restore0Dir
 runApplication setFields
 runApplication $application
 
diff --git a/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun b/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun
index da8fc430fec7e50606d41df489162943eeb8ba9f..f35012c3e0727eab2d157091f5ccc9b10705be80 100755
--- a/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun
+++ b/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 
 ./Allrun.pre
diff --git a/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun.pre b/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun.pre
index a491c1ae2e7aad1f1e3657cd5d6b51916b1f5f1d..1f8a3f5f9fb48e6782250651c0cb5b192fc52b59 100755
--- a/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun.pre
+++ b/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/Allrun.pre
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
 \rm -rf 0
 
@@ -16,8 +16,8 @@ runApplication snappyHexMesh -overwrite
 runApplication createBaffles -overwrite
 runApplication mergeOrSplitBaffles -split -overwrite
 
-# Copy fields after meshing to avoind the generation of unnecessary patch fields
-\cp -r 0.org 0
+# Copy fields after meshing to avoid the generation of unnecessary patch fields
+restore0Dir
 
 # Initialize alpha
 runApplication setFields
diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun.pre b/tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun.pre
index 2a010de9b4a2bc29be44414963548cbf4e9b3d25..5b7c3d7bc2566143f2f0b27fd8c85f012c440a95 100755
--- a/tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun.pre
+++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun.pre
@@ -5,23 +5,27 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # copy motorbike surface from resources directory
-cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/
+\cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/
 
 runApplication surfaceFeatureExtract
 
 runApplication blockMesh
 
+# Serial
+# ------
 #runApplication snappyHexMesh -overwrite
 #\rm -f constant/polyMesh/refinementHistory*
 # - set the initial fields
-#cp -rf 0.org 0
+# restore0Dir
 #runApplication setFields
 
+# Parallel
+# --------
 runApplication decomposePar -force
 runParallel snappyHexMesh -overwrite
-ls -d processor* | xargs -I {} rm -f ./{}/constant/polyMesh/refinementHistory
+\ls -d processor* | xargs -I {} \rm -f ./{}/constant/polyMesh/refinementHistory
 
 # - set the initial fields
-ls -d processor* | xargs -I {} rm -rf ./{}/0
-ls -d processor* | xargs -I {} cp -r 0.org ./{}/0
+restore0Dir -processor
+
 runParallel setFields
diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/system/controlDict b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/controlDict
index fa46cc601da3182340a4a8a2e56c9fd7535f3491..caab84a9c0e4186935a20f1d8c0d3d1ae22d2b3e 100644
--- a/tutorials/multiphase/interDyMFoam/ras/motorBike/system/controlDict
+++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/controlDict
@@ -22,11 +22,11 @@ FoamFile
 
 application     interDyMFoam;
 
-startFrom       latestTime;
+startFrom       startTime;
 
 startTime       0;
 
-stopAt          nextWrite;
+stopAt          endTime;
 
 endTime         2;
 
@@ -56,5 +56,11 @@ maxCo           0.5;
 maxAlphaCo      0.5;
 maxDeltaT       1;
 
+functions
+{
+    // Print stats
+    #include "minMax"
+}
+
 
 // ************************************************************************* //
diff --git a/tutorials/multiphase/interFoam/laminar/capillaryRise/Allrun b/tutorials/multiphase/interFoam/laminar/capillaryRise/Allrun
index 9a17d2d52519c474cb7af67d727fc6efdf054ed6..2bed23d97fa063fa7dbec48de1375c8f66740c17 100755
--- a/tutorials/multiphase/interFoam/laminar/capillaryRise/Allrun
+++ b/tutorials/multiphase/interFoam/laminar/capillaryRise/Allrun
@@ -4,10 +4,10 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
-cp 0/alpha.water.org 0/alpha.water
+\cp 0/alpha.water.org 0/alpha.water
 runApplication setFields
 runApplication $application
 
diff --git a/tutorials/multiphase/interFoam/laminar/damBreak/Allrun b/tutorials/multiphase/interFoam/laminar/damBreak/Allrun
index 125f1aa53b0124fd912c1d8bfd388e8d5587fdd3..1e016f651a9b8f52e13033031491753b6406539c 100755
--- a/tutorials/multiphase/interFoam/laminar/damBreak/Allrun
+++ b/tutorials/multiphase/interFoam/laminar/damBreak/Allrun
@@ -34,12 +34,12 @@ cloneCase damBreak damBreakFine
 
     # Modify case
     setDamBreakFine
-    cp ../damBreak/0/alpha.water.org 0/alpha.water
+    \cp ../damBreak/0/alpha.water.org 0/alpha.water
     # And execute
     runApplication blockMesh
     runApplication setFields
     runApplication decomposePar
-    runParallel `getApplication`
+    runParallel $(getApplication)
     runApplication reconstructPar
 )
 
diff --git a/tutorials/multiphase/interFoam/laminar/damBreak/damBreak/Allclean b/tutorials/multiphase/interFoam/laminar/damBreak/damBreak/Allclean
index 901c358b375a0720811db9110c71c506e1c4136d..f1696e1017ae333fb1843d5776c5bfe6916e9b50 100755
--- a/tutorials/multiphase/interFoam/laminar/damBreak/damBreak/Allclean
+++ b/tutorials/multiphase/interFoam/laminar/damBreak/damBreak/Allclean
@@ -5,6 +5,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/CleanFunctions
 
 cleanCase
-cp 0/alpha.water.org 0/alpha.water
+\cp 0/alpha.water.org 0/alpha.water
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/multiphase/interFoam/laminar/damBreak/damBreak/Allrun b/tutorials/multiphase/interFoam/laminar/damBreak/damBreak/Allrun
index 0df95afd2e081913dc5c6a301fa9f299262850a1..b18d70e448c13fbaf243f01cff301f0dbb1c7193 100755
--- a/tutorials/multiphase/interFoam/laminar/damBreak/damBreak/Allrun
+++ b/tutorials/multiphase/interFoam/laminar/damBreak/damBreak/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Get application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication setFields
diff --git a/tutorials/multiphase/interFoam/laminar/mixerVessel2D/Allrun b/tutorials/multiphase/interFoam/laminar/mixerVessel2D/Allrun
index c0a3a7154e782f3688f3ea8b21143319e16bb73b..6f9ee4e232c712faf794c5e09d897f0ba63ea339 100755
--- a/tutorials/multiphase/interFoam/laminar/mixerVessel2D/Allrun
+++ b/tutorials/multiphase/interFoam/laminar/mixerVessel2D/Allrun
@@ -4,10 +4,10 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication ./makeMesh
-cp 0/alpha.water.org 0/alpha.water
+\cp 0/alpha.water.org 0/alpha.water
 runApplication setFields
 runApplication $application
 
diff --git a/tutorials/multiphase/interFoam/les/nozzleFlow2D/Allrun b/tutorials/multiphase/interFoam/les/nozzleFlow2D/Allrun
index 5b0b162e78c7541ef1c624fcb0869b448271f8e5..f56f378d9f03e5fe5c5b47117c9b465e0f008731 100755
--- a/tutorials/multiphase/interFoam/les/nozzleFlow2D/Allrun
+++ b/tutorials/multiphase/interFoam/les/nozzleFlow2D/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Get application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 
diff --git a/tutorials/multiphase/interFoam/ras/DTCHull/Allrun b/tutorials/multiphase/interFoam/ras/DTCHull/Allrun
index 49e618ecd4306a7f4a56bd195335249ab87a3f1e..99249befa72e6cfcedcc2409fea6a25830f49e38 100755
--- a/tutorials/multiphase/interFoam/ras/DTCHull/Allrun
+++ b/tutorials/multiphase/interFoam/ras/DTCHull/Allrun
@@ -22,8 +22,7 @@ done
 
 runApplication snappyHexMesh -overwrite
 
-\rm -rf 0
-\cp -r 0.org 0
+restore0Dir
 
 runApplication setFields
 
diff --git a/tutorials/multiphase/interFoam/ras/angledDuct/Allrun b/tutorials/multiphase/interFoam/ras/angledDuct/Allrun
index 8b610fff80dee1501b3b45e3994f363bfa9b09ca..4f55fd7efaf20c8631ec86210c8629a9a3fe234b 100755
--- a/tutorials/multiphase/interFoam/ras/angledDuct/Allrun
+++ b/tutorials/multiphase/interFoam/ras/angledDuct/Allrun
@@ -7,4 +7,4 @@ m4 system/blockMeshDict.m4 > system/blockMeshDict
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 runApplication blockMesh
-runApplication `getApplication`
+runApplication $(getApplication)
diff --git a/tutorials/multiphase/interFoam/ras/damBreak/Allrun b/tutorials/multiphase/interFoam/ras/damBreak/Allrun
index 125f1aa53b0124fd912c1d8bfd388e8d5587fdd3..1e016f651a9b8f52e13033031491753b6406539c 100755
--- a/tutorials/multiphase/interFoam/ras/damBreak/Allrun
+++ b/tutorials/multiphase/interFoam/ras/damBreak/Allrun
@@ -34,12 +34,12 @@ cloneCase damBreak damBreakFine
 
     # Modify case
     setDamBreakFine
-    cp ../damBreak/0/alpha.water.org 0/alpha.water
+    \cp ../damBreak/0/alpha.water.org 0/alpha.water
     # And execute
     runApplication blockMesh
     runApplication setFields
     runApplication decomposePar
-    runParallel `getApplication`
+    runParallel $(getApplication)
     runApplication reconstructPar
 )
 
diff --git a/tutorials/multiphase/interFoam/ras/damBreak/damBreak/Allclean b/tutorials/multiphase/interFoam/ras/damBreak/damBreak/Allclean
index 901c358b375a0720811db9110c71c506e1c4136d..f1696e1017ae333fb1843d5776c5bfe6916e9b50 100755
--- a/tutorials/multiphase/interFoam/ras/damBreak/damBreak/Allclean
+++ b/tutorials/multiphase/interFoam/ras/damBreak/damBreak/Allclean
@@ -5,6 +5,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/CleanFunctions
 
 cleanCase
-cp 0/alpha.water.org 0/alpha.water
+\cp 0/alpha.water.org 0/alpha.water
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/multiphase/interFoam/ras/damBreak/damBreak/Allrun b/tutorials/multiphase/interFoam/ras/damBreak/damBreak/Allrun
index 0df95afd2e081913dc5c6a301fa9f299262850a1..b18d70e448c13fbaf243f01cff301f0dbb1c7193 100755
--- a/tutorials/multiphase/interFoam/ras/damBreak/damBreak/Allrun
+++ b/tutorials/multiphase/interFoam/ras/damBreak/damBreak/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Get application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication setFields
diff --git a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allclean b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allclean
index 901c358b375a0720811db9110c71c506e1c4136d..f1696e1017ae333fb1843d5776c5bfe6916e9b50 100755
--- a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allclean
+++ b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allclean
@@ -5,6 +5,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/CleanFunctions
 
 cleanCase
-cp 0/alpha.water.org 0/alpha.water
+\cp 0/alpha.water.org 0/alpha.water
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun
index a3c43a6c317434f7b915a225e4f310ce40811262..cdc9763e1b2c914ccc2c244c2cb2ef4a2a61913d 100755
--- a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun
+++ b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Get application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication setFields
diff --git a/tutorials/multiphase/interFoam/ras/waterChannel/Allmesh b/tutorials/multiphase/interFoam/ras/waterChannel/Allmesh
index 2fcc7a8f5f99962fb35ac408a8bbf18a37061edb..c941916ef134723bcd5f545a3f6196db2193858e 100755
--- a/tutorials/multiphase/interFoam/ras/waterChannel/Allmesh
+++ b/tutorials/multiphase/interFoam/ras/waterChannel/Allmesh
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 
diff --git a/tutorials/multiphase/interFoam/ras/waterChannel/Allrun b/tutorials/multiphase/interFoam/ras/waterChannel/Allrun
index eccd6c92520f9bc05f6f95d5bfc46ecdebdefde8..a5b348b06918737dd9feed2d1a625d24ae2163e5 100755
--- a/tutorials/multiphase/interFoam/ras/waterChannel/Allrun
+++ b/tutorials/multiphase/interFoam/ras/waterChannel/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 ./Allmesh
 
diff --git a/tutorials/multiphase/interFoam/ras/weirOverflow/Allrun b/tutorials/multiphase/interFoam/ras/weirOverflow/Allrun
index 95936e3073ebb2052013c58cccbe2932e0cdc3b9..04c76caa4ab3f0b8e1aaed49f55c44be5792d979 100755
--- a/tutorials/multiphase/interFoam/ras/weirOverflow/Allrun
+++ b/tutorials/multiphase/interFoam/ras/weirOverflow/Allrun
@@ -3,12 +3,12 @@
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-cp -r 0.org 0 > /dev/null 2>&1
+restore0Dir
 
 runApplication blockMesh
 
-cp 0/alpha.water.org 0/alpha.water
+\cp 0/alpha.water.org 0/alpha.water
 
 runApplication setFields
 
-runApplication `getApplication`
+runApplication $(getApplication)
diff --git a/tutorials/multiphase/interMixingFoam/laminar/damBreak/Allrun b/tutorials/multiphase/interMixingFoam/laminar/damBreak/Allrun
index 9ce30331322e7d65c613d31aaf8404b90e0cbf52..71f00053f9e6ffe91f34fa3603f5602c6794bdae 100755
--- a/tutorials/multiphase/interMixingFoam/laminar/damBreak/Allrun
+++ b/tutorials/multiphase/interMixingFoam/laminar/damBreak/Allrun
@@ -9,6 +9,6 @@ cp 0/alpha.air.org 0/alpha.air
 cp 0/alpha.other.org 0/alpha.other
 cp 0/alpha.water.org 0/alpha.water
 runApplication setFields
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun b/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun
index 1d24256eb001c223c17e9fda2ebb9b33acd77dbc..3f7cab5d82e34e43d25b7b1a4dfbe80e21a7248f 100755
--- a/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun
+++ b/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun
@@ -8,6 +8,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 
 runApplication decomposePar
 
-runParallel `getApplication`
+runParallel $(getApplication)
 
 runApplication reconstructPar
diff --git a/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun.pre b/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun.pre
index 40f5f5f1d4d88fc0f5b8a8a11173db2fa3cdae9c..0fb9f454674959f517591d165b83ab2526880ba8 100755
--- a/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun.pre
+++ b/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/Allrun.pre
@@ -5,17 +5,14 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # copy propeller surface from resources directory
-cp $FOAM_TUTORIALS/resources/geometry/propellerTip.obj.gz constant/triSurface/
+\cp $FOAM_TUTORIALS/resources/geometry/propellerTip.obj.gz constant/triSurface/
 
 
 # - meshing
 
 runApplication blockMesh
-
 runApplication surfaceFeatureExtract
-
 runApplication snappyHexMesh -overwrite
-
 runApplication renumberMesh -overwrite
 
 # force removal of fields generated by snappy
@@ -27,7 +24,6 @@ runApplication renumberMesh -overwrite
 #runApplication setSet -batch createInletOutletSets.setSet
 runApplication topoSet -dict system/createInletOutletSets.topoSetDict
 
-
 # - create the inlet/outlet and AMI patches
 
 runApplication createPatch -overwrite
@@ -39,4 +35,4 @@ runApplication createPatch -overwrite
 
 # - apply the initial fields
 
-cp -rf 0.org 0
+restore0Dir
diff --git a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/Allclean b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/Allclean
index b6885c65f14a6774c0db1e62d46ae9bb2dc57e52..dd89f3d3da0c7b1b0df770fbe914f53f306542e4 100755
--- a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/Allclean
+++ b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/Allclean
@@ -7,8 +7,8 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Remove surface
 \rm -f constant/triSurface/bullet.stl.gz
 
-# Remove copy of 0.org
-rm -rf 0
+# Remove 0.org/ copy
+\rm -rf 0
 
 cleanCase
 
diff --git a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/Allrun b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/Allrun
index dc6051766587ccb1378268930cc04cdc14e38ef9..4f35a71a264026b0805b9068be7c528b79f53d5f 100755
--- a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/Allrun
+++ b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/Allrun
@@ -13,12 +13,12 @@ runApplication blockMesh
 # Generate the snappy mesh
 runApplication snappyHexMesh -overwrite
 
-cp -r 0.org 0
+restore0Dir
 
 # Initialise with potentialFoam solution
 runApplication potentialFoam -pName p_rgh
 
 # Run the solver
-runApplication `getApplication`
+runApplication $(getApplication)
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/Allrun b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/Allrun
index b275240a50dde518b78c9e66ba0b8f558c962907..912c34cfdb7636863fe4782c6bfc402154698b0d 100755
--- a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/Allrun
+++ b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/Allrun
@@ -5,10 +5,9 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
-\rm -rf 0
-cp -r 0.org 0
+restore0Dir
 
 runApplication blockMesh
 runApplication setFields
diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/Allrun b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/Allrun
index 6103dad6287cebe2c7122d06af8103e8e117ae83..a0ed70da03a7a41ab05ca3d71b7a07ed38f31c61 100755
--- a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/Allrun
+++ b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/Allrun
@@ -5,10 +5,9 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
-\rm -rf 0
-cp -r 0.org 0
+restore0Dir
 
 runApplication blockMesh
 runApplication setFields
diff --git a/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/Allrun b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/Allrun
index 66c1631fd3b21065460d33c1ce838457c787defb..f5e6c61a9e087c0f799e0c700493698c1df8fcf4 100755
--- a/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/Allrun
+++ b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication ./makeMesh
 runApplication $application
diff --git a/tutorials/multiphase/multiphaseInterDyMFoam/laminar/mixerVesselAMI2D/Allrun b/tutorials/multiphase/multiphaseInterDyMFoam/laminar/mixerVesselAMI2D/Allrun
index d7ecd3dbdcec19d32458b234b7a967823bc895ad..f8ec2f0689d93219c4a6b366c4ae5d60ceea0d19 100755
--- a/tutorials/multiphase/multiphaseInterDyMFoam/laminar/mixerVesselAMI2D/Allrun
+++ b/tutorials/multiphase/multiphaseInterDyMFoam/laminar/mixerVesselAMI2D/Allrun
@@ -4,12 +4,11 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 ./makeMesh
 
-rm -rf 0
-cp -r 0.org 0
+restore0Dir
 runApplication setFields
 
 #runApplication $application
diff --git a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/Allrun b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/Allrun
index b275240a50dde518b78c9e66ba0b8f558c962907..912c34cfdb7636863fe4782c6bfc402154698b0d 100755
--- a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/Allrun
+++ b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/Allrun
@@ -5,10 +5,9 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
-\rm -rf 0
-cp -r 0.org 0
+restore0Dir
 
 runApplication blockMesh
 runApplication setFields
diff --git a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/Allrun b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/Allrun
index b92d6cc19a89c59b5a27fe480f3134e4f3be27ca..a0ed70da03a7a41ab05ca3d71b7a07ed38f31c61 100755
--- a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/Allrun
+++ b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/Allrun
@@ -5,9 +5,9 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
-cp -r 0.org 0
+restore0Dir
 
 runApplication blockMesh
 runApplication setFields
diff --git a/tutorials/multiphase/multiphaseInterFoam/laminar/mixerVessel2D/Allrun b/tutorials/multiphase/multiphaseInterFoam/laminar/mixerVessel2D/Allrun
index 66c1631fd3b21065460d33c1ce838457c787defb..f5e6c61a9e087c0f799e0c700493698c1df8fcf4 100755
--- a/tutorials/multiphase/multiphaseInterFoam/laminar/mixerVessel2D/Allrun
+++ b/tutorials/multiphase/multiphaseInterFoam/laminar/mixerVessel2D/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication ./makeMesh
 runApplication $application
diff --git a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/Allrun b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/Allrun
index 4358c300592a56d0349c1c70cbe6e687820cc130..c2b53fdc45a52fddee2928fb01a0c754a5954358 100755
--- a/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/Allrun
+++ b/tutorials/multiphase/potentialFreeSurfaceDyMFoam/oscillatingBox/Allrun
@@ -5,7 +5,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 
@@ -18,7 +18,7 @@ runApplication -s selectBottom \
 
 runApplication createPatch -overwrite
 
-cp -r 0.org 0 > /dev/null 2>&1
+restore0Dir
 
 runApplication $application
 
diff --git a/tutorials/multiphase/potentialFreeSurfaceFoam/oscillatingBox/Allrun b/tutorials/multiphase/potentialFreeSurfaceFoam/oscillatingBox/Allrun
index 6514e8598bb611041d2692fa18a1e8691ac851bc..7f340efedbbafed441e0ddf2615c276424b20172 100755
--- a/tutorials/multiphase/potentialFreeSurfaceFoam/oscillatingBox/Allrun
+++ b/tutorials/multiphase/potentialFreeSurfaceFoam/oscillatingBox/Allrun
@@ -5,12 +5,13 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
 runApplication blockMesh
 runApplication topoSet
 runApplication subsetMesh -overwrite c0 -patch floatingObject
-cp -r 0.org 0 > /dev/null 2>&1
+
+restore0Dir
 
 runApplication $application
 
diff --git a/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/mixerVessel2D/Allrun b/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/mixerVessel2D/Allrun
index 66c1631fd3b21065460d33c1ce838457c787defb..f5e6c61a9e087c0f799e0c700493698c1df8fcf4 100755
--- a/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/mixerVessel2D/Allrun
+++ b/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/mixerVessel2D/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication ./makeMesh
 runApplication $application
diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/mixerVessel2D/Allrun b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/mixerVessel2D/Allrun
index 66c1631fd3b21065460d33c1ce838457c787defb..f5e6c61a9e087c0f799e0c700493698c1df8fcf4 100755
--- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/mixerVessel2D/Allrun
+++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/mixerVessel2D/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication ./makeMesh
 runApplication $application
diff --git a/tutorials/multiphase/twoLiquidMixingFoam/lockExchange/Allrun b/tutorials/multiphase/twoLiquidMixingFoam/lockExchange/Allrun
index b275240a50dde518b78c9e66ba0b8f558c962907..912c34cfdb7636863fe4782c6bfc402154698b0d 100755
--- a/tutorials/multiphase/twoLiquidMixingFoam/lockExchange/Allrun
+++ b/tutorials/multiphase/twoLiquidMixingFoam/lockExchange/Allrun
@@ -5,10 +5,9 @@ cd ${0%/*} || exit 1    # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 # Set application name
-application=`getApplication`
+application=$(getApplication)
 
-\rm -rf 0
-cp -r 0.org 0
+restore0Dir
 
 runApplication blockMesh
 runApplication setFields
diff --git a/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/Allrun b/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/Allrun
index 66c1631fd3b21065460d33c1ce838457c787defb..f5e6c61a9e087c0f799e0c700493698c1df8fcf4 100755
--- a/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/Allrun
+++ b/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/Allrun
@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
-application=`getApplication`
+application=$(getApplication)
 
 runApplication ./makeMesh
 runApplication $application
diff --git a/wmake/rules/General/CGAL b/wmake/rules/General/CGAL
index 354e719aa47f45158fb3abf0967ccbe33c36ce0d..4bade675a2d8582a08ecb2399e675a333b1215eb 100644
--- a/wmake/rules/General/CGAL
+++ b/wmake/rules/General/CGAL
@@ -5,8 +5,8 @@ CGAL_INC = \
     -I$(BOOST_ARCH_PATH)/include
 
 CGAL_LIBS = \
-    -L$(MPFR_ARCH_PATH)/lib \
-    -L$(GMP_ARCH_PATH)/lib \
+    -L$(MPFR_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
+    -L$(GMP_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
     -L$(BOOST_ARCH_PATH)/lib \
     -L$(CGAL_ARCH_PATH)/lib \
     -lCGAL \
diff --git a/wmake/rules/General/general b/wmake/rules/General/general
index b3f20b48e8668d06765df01ba29c3c9213906f29..4ebb18312d376c1b3176045f2e0d1e73169ce4ab 100644
--- a/wmake/rules/General/general
+++ b/wmake/rules/General/general
@@ -1,4 +1,5 @@
 #-------------------------------*- makefile -*---------------------------------
+WM_VERSION = OPENFOAM_PLUS=1606
 
 AR         = ar
 ARFLAGS    = cr
@@ -6,7 +7,7 @@ RANLIB     = ranlib
 CPP        = cpp
 LD         = ld
 
-GFLAGS     = -D$(WM_ARCH) -DWM_ARCH_OPTION=$(WM_ARCH_OPTION) \
+GFLAGS     = -D$(WM_VERSION) -D$(WM_ARCH) -DWM_ARCH_OPTION=$(WM_ARCH_OPTION) \
              -DWM_$(WM_PRECISION_OPTION) -DWM_LABEL_SIZE=$(WM_LABEL_SIZE)
 GINC       =
 GLIBS      = -lm
diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild
index c23e63d33e4b578f6650ef33b24539bf803076a1..81195a6bac21ee32d28c6c7cbaab9abc1094b443 100755
--- a/wmake/wmakePrintBuild
+++ b/wmake/wmakePrintBuild
@@ -3,8 +3,8 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-#    \\/     M anipulation  |
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
+#    \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 #-------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM.
@@ -72,7 +72,6 @@ do
         ;;
     -c | -check)
         checkOnly=true
-        shift
         ;;
     -major)
         echo ${WM_PROJECT_VERSION:-unknown}
@@ -80,27 +79,26 @@ do
         ;;
     -u | -update)
         update=true
-        shift
         ;;
     -pkg | -package)
         [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
         # Mark empty as 'none', disallow '!' in string
         package=$(echo "${2:-none}" | sed -e 's/!//g')
-        shift 2
+        shift
         ;;
     -short)
         shortOpt=true
-        shift
         ;;
     -v | -version)
         [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
         version="$2"
-        shift 2
+        shift
         ;;
     *)
-        usage "unknown option/argument: '$*'"
+        usage "unknown option/argument: '$1'"
         ;;
     esac
+    shift
 done
 
 #------------------------------------------------------------------------------
@@ -146,12 +144,12 @@ then
     # Specified a version - no error possible
     rc=0
 else
-    # Get the head SHA1 when building under git
-    # if there are multiple values (eg, HEAD, origin/HEAD, ...)
+    # Get the head SHA1 (first 12 chars) when building under git.
+    # If there are multiple values (eg, HEAD, origin/HEAD, ...)
     # only take the first one, which is 'HEAD'
     version=$(
-        cd $WM_PROJECT_DIR 2>/dev/null && \
-        git show-ref --hash=12 --head HEAD 2>/dev/null | head -1
+        git --git-dir=$WM_PROJECT_DIR/.git show-ref --head HEAD 2>/dev/null |\
+        sed -ne '1s@^\(.\{12\}\).*$@\1@p'
     )
 
     if [ -n "$version" ]
@@ -205,10 +203,11 @@ then
         else
             echo "version changed from previous build" 1>&2
         fi
+        exit $rc
     else
         echo "no git description found" 1>&2
+        exit 0
     fi
-    exit $rc
 fi