diff --git a/applications/solvers/lagrangian/DPMFoam/DPMFoam.C b/applications/solvers/lagrangian/DPMFoam/DPMFoam.C
index 9c97968c1cbd3e14531c421119e59ad38af9cb55..513c123ddfef034b9c32e9df4b8810241ca17f16 100644
--- a/applications/solvers/lagrangian/DPMFoam/DPMFoam.C
+++ b/applications/solvers/lagrangian/DPMFoam/DPMFoam.C
@@ -106,7 +106,7 @@ int main(int argc, char *argv[])
             zeroGradientFvPatchVectorField::typeName
         );
 
-        cloudVolSUSu.internalField() = - cloudSU.source()/mesh.V();
+        cloudVolSUSu.internalField() = -cloudSU.source()/mesh.V();
         cloudVolSUSu.correctBoundaryConditions();
         cloudSU.source() = vector::zero;
 
diff --git a/applications/test/hexRef8/Test-hexRef8.C b/applications/test/hexRef8/Test-hexRef8.C
index 67477aae4468087f0e76eae15fde45a98bbeb22f..0e913ff0110a8cb78b38b6946aef90bc3aa4764b 100644
--- a/applications/test/hexRef8/Test-hexRef8.C
+++ b/applications/test/hexRef8/Test-hexRef8.C
@@ -34,11 +34,14 @@ Description
 #include "Time.H"
 #include "volFields.H"
 #include "surfaceFields.H"
+#include "pointFields.H"
 #include "hexRef8.H"
 #include "mapPolyMesh.H"
 #include "polyTopoChange.H"
 #include "Random.H"
 #include "zeroGradientFvPatchFields.H"
+#include "calculatedPointPatchFields.H"
+#include "pointConstraints.H"
 #include "fvcDiv.H"
 
 using namespace Foam;
@@ -61,6 +64,8 @@ int main(int argc, char *argv[])
 #   include "createMesh.H"
 
 
+    const pointConstraints& pc = pointConstraints::New(pointMesh::New(mesh));
+
     const Switch inflate(args.args()[1]);
 
     if (inflate)
@@ -144,6 +149,29 @@ int main(int argc, char *argv[])
     surfaceOne.write();
 
 
+    // Uniform point field
+    pointScalarField pointX
+    (
+        IOobject
+        (
+            "pointX",
+            runTime.timeName(),
+            mesh,
+            IOobject::NO_READ,
+            IOobject::AUTO_WRITE
+        ),
+        pointMesh::New(mesh),
+        dimensionedScalar("one", dimless, 1.0),
+        calculatedPointPatchScalarField::typeName
+    );
+    pointX.internalField() = mesh.points().component(0);
+    pointX.correctBoundaryConditions();
+    Info<< "Writing x-component field "
+        << pointX.name() << " in " << runTime.timeName() << endl;
+    pointX.write();
+
+
+
     // Force allocation of V. Important for any mesh changes since otherwise
     // old time volumes are not stored
     const scalar totalVol = gSum(mesh.V());
@@ -163,89 +191,107 @@ int main(int argc, char *argv[])
         }
 
 
+        mesh.moving(false);
+        mesh.topoChanging(false);
 
-        // Mesh changing engine.
-        polyTopoChange meshMod(mesh);
 
-        if (rndGen.bit())
-        {
-            // Refine
-            label nRefine = mesh.nCells()/20;
-            DynamicList<label> refineCandidates(nRefine);
+        label action = rndGen.integer(0, 5);
 
-            for (label i=0; i<nRefine; i++)
-            {
-                refineCandidates.append(rndGen.integer(0, mesh.nCells()-1));
-            }
 
-            labelList cellsToRefine
-            (
-                meshCutter.consistentRefinement
-                (
-                    refineCandidates,
-                    true                  // buffer layer
-                )
-            );
-            Info<< nl << "-- selected "
-                << returnReduce(cellsToRefine.size(), sumOp<label>())
-                << " cells out of " << mesh.globalData().nTotalCells()
-                << " for refinement" << endl;
-
-            // Play refinement commands into mesh changer.
-            meshCutter.setRefinement(cellsToRefine, meshMod);
+        if (action == 0)
+        {
+            Info<< nl << "-- moving only" << endl;
+            mesh.movePoints(pointField(mesh.points()));
         }
-        else
+        else if (action == 1 || action == 2)
         {
-            // Unrefine
-            labelList allSplitPoints(meshCutter.getSplitPoints());
+            // Mesh changing engine.
+            polyTopoChange meshMod(mesh);
+
+            if (action == 1)
+            {
+                // Refine
+                label nRefine = mesh.nCells()/20;
+                DynamicList<label> refineCandidates(nRefine);
 
-            label nUnrefine = allSplitPoints.size()/20;
-            labelHashSet candidates(2*nUnrefine);
+                for (label i=0; i<nRefine; i++)
+                {
+                    refineCandidates.append(rndGen.integer(0, mesh.nCells()-1));
+                }
+
+                labelList cellsToRefine
+                (
+                    meshCutter.consistentRefinement
+                    (
+                        refineCandidates,
+                        true                  // buffer layer
+                    )
+                );
+                Info<< nl << "-- selected "
+                    << returnReduce(cellsToRefine.size(), sumOp<label>())
+                    << " cells out of " << mesh.globalData().nTotalCells()
+                    << " for refinement" << endl;
 
-            for (label i=0; i<nUnrefine; i++)
+                // Play refinement commands into mesh changer.
+                meshCutter.setRefinement(cellsToRefine, meshMod);
+            }
+            else
             {
-                candidates.insert
+                // Unrefine
+                labelList allSplitPoints(meshCutter.getSplitPoints());
+
+                label nUnrefine = allSplitPoints.size()/20;
+                labelHashSet candidates(2*nUnrefine);
+
+                for (label i=0; i<nUnrefine; i++)
+                {
+                    label index = rndGen.integer(0, allSplitPoints.size()-1);
+                    candidates.insert(allSplitPoints[index]);
+                }
+
+                labelList splitPoints = meshCutter.consistentUnrefinement
                 (
-                    allSplitPoints[rndGen.integer(0, allSplitPoints.size()-1)]
+                    candidates.toc(),
+                    false
                 );
+                Info<< nl << "-- selected "
+                    << returnReduce(splitPoints.size(), sumOp<label>())
+                    << " points out of "
+                    << returnReduce(allSplitPoints.size(), sumOp<label>())
+                    << " for unrefinement" << endl;
+
+                // Play refinement commands into mesh changer.
+                meshCutter.setUnrefinement(splitPoints, meshMod);
             }
 
-            labelList splitPoints = meshCutter.consistentUnrefinement
-            (
-                candidates.toc(),
-                false
-            );
-            Info<< nl << "-- selected "
-                << returnReduce(splitPoints.size(), sumOp<label>())
-                << " points out of "
-                << returnReduce(allSplitPoints.size(), sumOp<label>())
-                << " for unrefinement" << endl;
-
-            // Play refinement commands into mesh changer.
-            meshCutter.setUnrefinement(splitPoints, meshMod);
-        }
 
 
 
+            // Create mesh, return map from old to new mesh.
+            Info<< nl << "-- actually changing mesh" << endl;
+            autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, inflate);
 
-        // Create mesh, return map from old to new mesh.
-        Info<< nl << "-- actually changing mesh" << endl;
-        autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, inflate);
+            // Update fields
+            Info<< nl << "-- mapping mesh data" << endl;
+            mesh.updateMesh(map);
 
-        // Update fields
-        Info<< nl << "-- mapping mesh data" << endl;
-        mesh.updateMesh(map);
+            // Inflate mesh
+            if (map().hasMotionPoints())
+            {
+                Info<< nl << "-- moving mesh" << endl;
+                mesh.movePoints(map().preMotionPoints());
+            }
 
-        // Inflate mesh
-        if (map().hasMotionPoints())
-        {
-            Info<< nl << "-- moving mesh" << endl;
-            mesh.movePoints(map().preMotionPoints());
+            // Update numbering of cells/vertices.
+            Info<< nl << "-- mapping hexRef8 data" << endl;
+            meshCutter.updateMesh(map);
         }
 
-        // Update numbering of cells/vertices.
-        Info<< nl << "-- mapping hexRef8 data" << endl;
-        meshCutter.updateMesh(map);
+
+        Info<< nl<< "-- Mesh : moving:" << mesh.moving()
+            << " topoChanging:" << mesh.topoChanging()
+            << " changing:" << mesh.changing()
+            << endl;
 
 
 
@@ -362,6 +408,9 @@ int main(int argc, char *argv[])
             << nl << endl;
     }
 
+    Info<< "pc:" << pc.patchPatchPointConstraintPoints().size() << endl;
+
+
     Info<< "End\n" << endl;
 
     return 0;
diff --git a/applications/test/hexRef8/block/system/controlDict b/applications/test/hexRef8/block/system/controlDict
index 1ed64adf6161aab2af45501daf28c9b179944e65..0c8cfee218e6a7e7687bb517f5cdba6e3e595d9d 100644
--- a/applications/test/hexRef8/block/system/controlDict
+++ b/applications/test/hexRef8/block/system/controlDict
@@ -17,9 +17,12 @@ FoamFile
 
 DebugSwitches
 {
-    primitiveMesh   1;
-    polyMesh        1;
-    fvMesh          1;
+    primitiveMesh       1;
+    polyMesh            1;
+    fvMesh              1;
+    polyTopoChange      1;
+    pointMesh           1;
+    pointConstraints    1;
 }
 
 application     icoFoam;
diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict
index 44cdbaeec6d46a17498bf53bdd462da16e2ce274..9f7f37d1b129ffb1de53d8b799dd4ed090ed9a96 100644
--- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict
+++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict
@@ -488,7 +488,7 @@ meshQualityControls
 //(
 //    mesh            // write intermediate meshes
 //    intersections   // write current mesh intersections as .obj files
-//    featureSeeds,   // write information about explicit feature edge refinement
+//    featureSeeds    // write information about explicit feature edge refinement
 //    layerInfo       // write information about layers
 //);
 //
diff --git a/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C b/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C
index cc1981e1d5dde1fdb61c099629e0e089fc1e196d..d1e725faee25dd0a8ced157eb14fcbfab91ae64b 100644
--- a/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C
+++ b/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C
@@ -209,6 +209,7 @@ int main(int argc, char *argv[])
         }
 
         // Mu
+        if (mu != 0)
         {
             pointField newLocalPoints
             (
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C
index 162e895170999fe2f37d9266765b6fdf44a8610e..c20baae3f2eee8424e9818185f64fba1a1a0e71e 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C
@@ -34,7 +34,7 @@ License
 #include "indexedOctree.H"
 #include "treeDataCell.H"
 #include "MeshObject.H"
-
+#include "pointMesh.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -1160,6 +1160,7 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
     solutionD_ = Vector<label>::zero;
 
     meshObject::movePoints<polyMesh>(*this);
+    meshObject::movePoints<pointMesh>(*this);
 
     const_cast<Time&>(time()).functionObjects().movePoints(*this);
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C b/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C
index 96297ed3e107e79eab6277796f832742b11eddbe..25eb1fd29d8ac12f3a6ab3a3bea5ad0741bb14e2 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C
@@ -29,6 +29,7 @@ License
 #include "MeshObject.H"
 #include "indexedOctree.H"
 #include "treeDataCell.H"
+#include "pointMesh.H"
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
@@ -61,6 +62,7 @@ void Foam::polyMesh::clearGeom()
     }
 
     // Clear all geometric mesh objects
+    meshObject::clear<pointMesh, GeometricMeshObject>(*this);
     meshObject::clear<polyMesh, GeometricMeshObject>(*this);
 
     primitiveMesh::clearGeom();
@@ -108,6 +110,15 @@ void Foam::polyMesh::clearAddressing(const bool isMeshUpdate)
         // Part of a mesh update. Keep meshObjects that have an updateMesh
         // callback
         meshObject::clearUpto
+        <
+            pointMesh,
+            TopologicalMeshObject,
+            UpdateableMeshObject
+        >
+        (
+            *this
+        );
+        meshObject::clearUpto
         <
             polyMesh,
             TopologicalMeshObject,
@@ -119,6 +130,7 @@ void Foam::polyMesh::clearAddressing(const bool isMeshUpdate)
     }
     else
     {
+        meshObject::clear<pointMesh, TopologicalMeshObject>(*this);
         meshObject::clear<polyMesh, TopologicalMeshObject>(*this);
     }
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C
index 696bb81416f15a7cc348e8c57532ab800990700a..4a8b5dd7d73802016d71614d439423c05d35a3ec 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C
@@ -92,6 +92,7 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
     }
 
     meshObject::updateMesh<polyMesh>(*this, mpm);
+    meshObject::updateMesh<pointMesh>(*this, mpm);
 
     // Reset valid directions (could change by faces put into empty patches)
     geometricD_ = Vector<label>::zero;
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.C
index 5061538f4c64c5a63955fd2133167c4c2ffe8ebe..bd0e06166ae9514722f12fcff6d69eb4908929fa 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.C
@@ -25,6 +25,7 @@ License
 
 #include "symmetryPlanePolyPatch.H"
 #include "addToRunTimeSelectionTable.H"
+#include "symmetryPolyPatch.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -131,7 +132,11 @@ const Foam::vector& Foam::symmetryPlanePolyPatch::n() const
                 if (magSqr(n_ - nf[facei]) > SMALL)
                 {
                     FatalErrorIn("symmetryPlanePolyPatch::n()")
-                        << "Symmetry plane '" << name() << "' is not planar"
+                        << "Symmetry plane '" << name() << "' is not planar."
+                        << endl
+                        << " Either split the patch into planar parts"
+                        << " or use the " << symmetryPolyPatch::typeName
+                        << " patch type"
                         << exit(FatalError);
                 }
             }
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C
index a10563c3d1b1dc4b1e6f25caba6e3523d4b558a3..643e06a47981e5347a2d808cfa05454d5fb127bd 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -62,6 +62,7 @@ void Foam::polyPatch::movePoints(PstreamBuffers&, const pointField& p)
 void Foam::polyPatch::updateMesh(PstreamBuffers&)
 {
     clearAddressing();
+    primitivePatch::clearOut();
 }
 
 
diff --git a/src/finiteVolume/interpolation/volPointInterpolation/pointConstraints.C b/src/finiteVolume/interpolation/volPointInterpolation/pointConstraints.C
index 4993bae684d5ea474236daaa4e6359a9ba5bb774..28d3332c1d622830c1f6eacb45708d3588f70823 100644
--- a/src/finiteVolume/interpolation/volPointInterpolation/pointConstraints.C
+++ b/src/finiteVolume/interpolation/volPointInterpolation/pointConstraints.C
@@ -48,7 +48,7 @@ void pointConstraints::makePatchPatchAddressing()
     {
         Pout<< "pointConstraints::makePatchPatchAddressing() : "
             << "constructing boundary addressing"
-            << endl;
+            << endl << incrIndent;
     }
 
     const pointMesh& pMesh = mesh();
@@ -72,7 +72,7 @@ void pointConstraints::makePatchPatchAddressing()
 
             if (debug)
             {
-                Pout<< "On patch:" << pbm[patchi].name()
+                Pout<< indent << "On patch:" << pbm[patchi].name()
                     << " nBoundaryPoints:" << bp.size() << endl;
             }
         }
@@ -80,7 +80,8 @@ void pointConstraints::makePatchPatchAddressing()
 
     if (debug)
     {
-        Pout<< "Found nPatchPatchPoints:" << nPatchPatchPoints << endl;
+        Pout<< indent << "Found nPatchPatchPoints:" << nPatchPatchPoints
+            << endl;
     }
 
 
@@ -137,7 +138,7 @@ void pointConstraints::makePatchPatchAddressing()
 
     if (debug)
     {
-        Pout<< "Have (local) constrained points:"
+        Pout<< indent << "Have (local) constrained points:"
             << nPatchPatchPoints << endl;
     }
 
@@ -224,7 +225,7 @@ void pointConstraints::makePatchPatchAddressing()
 
                 if (iter == patchPatchPointSet.end())
                 {
-                    //Pout<< "on meshpoint:" << meshPointI
+                    //Pout<< indent << "on meshpoint:" << meshPointI
                     //    << " coupled:" << coupledPointI
                     //    << " at:" << mesh.points()[meshPointI]
                     //    << " have new constraint:"
@@ -242,7 +243,7 @@ void pointConstraints::makePatchPatchAddressing()
                 }
                 else
                 {
-                    //Pout<< "on meshpoint:" << meshPointI
+                    //Pout<< indent << "on meshpoint:" << meshPointI
                     //    << " coupled:" << coupledPointI
                     //    << " at:" << mesh.points()[meshPointI]
                     //    << " have possibly extended constraint:"
@@ -271,7 +272,7 @@ void pointConstraints::makePatchPatchAddressing()
 
     if (debug)
     {
-        Pout<< "Have (global) constrained points:"
+        Pout<< indent << "Have (global) constrained points:"
             << nPatchPatchPoints << endl;
     }
 
@@ -303,7 +304,7 @@ void pointConstraints::makePatchPatchAddressing()
 
     if (debug)
     {
-        Pout<< "Have non-trivial constrained points:"
+        Pout<< indent << "Have non-trivial constrained points:"
             << nConstraints << endl;
     }
 
@@ -314,7 +315,8 @@ void pointConstraints::makePatchPatchAddressing()
 
     if (debug)
     {
-        Pout<< "pointConstraints::makePatchPatchAddressing() : "
+        Pout<< decrIndent
+            << "pointConstraints::makePatchPatchAddressing() : "
             << "finished constructing boundary addressing"
             << endl;
     }
@@ -327,6 +329,13 @@ pointConstraints::pointConstraints(const pointMesh& pm)
 :
     MeshObject<pointMesh, Foam::UpdateableMeshObject, pointConstraints>(pm)
 {
+    if (debug)
+    {
+        Pout<< "pointConstraints::pointConstraints(const pointMesh&): "
+            << "Constructing from pointMesh " << pm.name()
+            << endl;
+    }
+
     makePatchPatchAddressing();
 }
 
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C
index ec9f1c0139807fb1b410f3dbfb1116c518813085..e65f77ec20825761b49c8ed659cf092fe29d8aaf 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C
+++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/CellZoneInjection/CellZoneInjection.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -240,7 +240,7 @@ void Foam::CellZoneInjection<CloudType>::updateMesh()
     Info<< "    cell zone size      = " << nCellsTotal << endl;
     Info<< "    cell zone volume    = " << VCellsTotal << endl;
 
-    if ((nCells == 0) || (VCellsTotal*numberDensity_ < 1))
+    if ((nCellsTotal == 0) || (VCellsTotal*numberDensity_ < 1))
     {
         WarningIn("Foam::CellZoneInjection<CloudType>::updateMesh()")
             << "Number of particles to be added to cellZone " << cellZoneName_
diff --git a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.C b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.C
index 51d9b5b6e5334a4aadfe95ccbbac2645a2d1142c..6600b655ff62681ac7a0c6cdcdcd48a17f78c80e 100644
--- a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.C
+++ b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.C
@@ -123,7 +123,7 @@ void Foam::AveragingMethods::Dual<Type>::tetGeometry
 
     tetIs.tet(this->mesh_).barycentric(position, tetCoordinates_);
 
-    tetCoordinates_ = max(tetCoordinates_, 0.0);
+    tetCoordinates_ = max(tetCoordinates_, scalar(0));
 }
 
 
diff --git a/src/lagrangian/intermediate/submodels/MPPIC/TimeScaleModels/equilibrium/equilibrium.C b/src/lagrangian/intermediate/submodels/MPPIC/TimeScaleModels/equilibrium/equilibrium.C
index c3d35c37fe4cf2830ca7dd13e28ca56697942ec7..eee7d5ab897ab482f69472ceadb1201612ef41a5 100644
--- a/src/lagrangian/intermediate/submodels/MPPIC/TimeScaleModels/equilibrium/equilibrium.C
+++ b/src/lagrangian/intermediate/submodels/MPPIC/TimeScaleModels/equilibrium/equilibrium.C
@@ -85,9 +85,9 @@ Foam::TimeScaleModels::equilibrium::oneByTau
         16.0/sqrt(3.0*constant::mathematical::pi)
        *0.25*(1.0 - e_*e_);
 
-    return 
+    return
         a
-       *alpha*sqrt(max(uSqr, 0.0))/max(r32, SMALL)
+       *alpha*sqrt(max(uSqr, scalar(0)))/max(r32, SMALL)
        *alphaPacked_/max(alphaPacked_ - alpha, SMALL);
 }
 
diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C
index 498b6d48e98b5c75476c8b7d754a5e3cdfae2e32..8b86b71247ceb68230bb74310dbdbb512b2a3711 100644
--- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C
+++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C
@@ -3508,7 +3508,7 @@ void Foam::autoLayerDriver::addLayers
     meshRefiner_.updateMesh(map, labelList(0));
 
     // Update numbering of faceWantedThickness
-    meshRefinement::updateList(map().faceMap(), 0.0, faceWantedThickness);
+    meshRefinement::updateList(map().faceMap(), scalar(0), faceWantedThickness);
 
     // Update numbering on baffles
     forAll(baffles, i)
diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C
index 701c0dbbc077d1f58f5b92cff33265c6cefb711f..adedede35d2733bf4083497757b4e69da821fca5 100644
--- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C
+++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C
@@ -35,7 +35,6 @@ License
 #include "fvMeshDistribute.H"
 #include "polyTopoChange.H"
 #include "mapDistributePolyMesh.H"
-#include "featureEdgeMesh.H"
 #include "Cloud.H"
 //#include "globalIndex.H"
 #include "OBJstream.H"
@@ -358,7 +357,7 @@ void Foam::meshRefinement::markFeatureCellLevel
 
         forAll(features_, featI)
         {
-            const featureEdgeMesh& featureMesh = features_[featI];
+            const edgeMesh& featureMesh = features_[featI];
             const label featureLevel = features_.levels()[featI][0];
             const labelListList& pointEdges = featureMesh.pointEdges();
 
@@ -505,7 +504,7 @@ void Foam::meshRefinement::markFeatureCellLevel
         label featI = startTp.i();
         label pointI = startTp.j();
 
-        const featureEdgeMesh& featureMesh = features_[featI];
+        const edgeMesh& featureMesh = features_[featI];
         const labelList& pEdges = featureMesh.pointEdges()[pointI];
 
         // Now shoot particles down all pEdges.
@@ -561,7 +560,7 @@ void Foam::meshRefinement::markFeatureCellLevel
             label featI = tp.i();
             label pointI = tp.j();
 
-            const featureEdgeMesh& featureMesh = features_[featI];
+            const edgeMesh& featureMesh = features_[featI];
             const labelList& pEdges = featureMesh.pointEdges()[pointI];
 
             // Particle now at pointI. Check connected edges to see which one
diff --git a/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C b/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C
index f2b730bc9d3ca5e00e832f375723c4a20cc37f40..b2b974de02f304b28b7ebdb841e4bf696ea1d082 100644
--- a/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C
+++ b/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C
@@ -186,7 +186,7 @@ void Foam::refinementFeatures::read
             set(featI, new extendedFeatureEdgeMesh(featObj, eeMesh));
         }
 
-        const edgeMesh& eMesh = operator[](featI);
+        const extendedEdgeMesh& eMesh = operator[](featI);
 
         //eMesh.mergePoints(meshRefiner_.mergeDistance());
 
@@ -258,13 +258,9 @@ void Foam::refinementFeatures::read
 }
 
 
-void Foam::refinementFeatures::buildTrees
-(
-    const label featI,
-    const labelList& featurePoints
-)
+void Foam::refinementFeatures::buildTrees(const label featI)
 {
-    const edgeMesh& eMesh = operator[](featI);
+    const extendedEdgeMesh& eMesh = operator[](featI);
     const pointField& points = eMesh.points();
     const edgeList& edges = eMesh.edges();
 
@@ -299,6 +295,9 @@ void Foam::refinementFeatures::buildTrees
         )
     );
 
+
+    labelList featurePoints(identity(eMesh.nonFeatureStart()));
+
     pointTrees_.set
     (
         featI,
@@ -408,24 +407,7 @@ Foam::refinementFeatures::refinementFeatures
     // Search engines
     forAll(*this, i)
     {
-        const extendedEdgeMesh& eMesh = operator[](i);
-        const labelListList& pointEdges = eMesh.pointEdges();
-
-        DynamicList<label> featurePoints;
-        forAll(pointEdges, pointI)
-        {
-            if (pointEdges[pointI].size() > 2)
-            {
-                featurePoints.append(pointI);
-            }
-        }
-
-        Info<< "Detected " << featurePoints.size()
-            << " featurePoints out of " << pointEdges.size()
-            << " points on feature " << operator[](i).name()
-            << endl;
-
-        buildTrees(i, featurePoints);
+        buildTrees(i);
     }
 }
 
diff --git a/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.H b/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.H
index 4cfaf20ffaf80de715f17f367e5ae3f1bcb5bf3c..7d27090b14780e8d251701f8c0de8c2757c8f4c6 100644
--- a/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.H
+++ b/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.H
@@ -76,7 +76,7 @@ private:
         void read(const objectRegistry&, const PtrList<dictionary>&);
 
         //- Build edge tree and feature point tree
-        void buildTrees(const label, const labelList&);
+        void buildTrees(const label);
 
         //- Find shell level higher than ptLevel
         void findHigherLevel
diff --git a/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C b/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C
index c8e8be3d06b276926d448363f22031d1552cc3ee..ce713217cdb290595f009f12da8922450a19a3d4 100644
--- a/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C
+++ b/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C
@@ -90,27 +90,36 @@ Foam::trackedParticle::trackedParticle
 bool Foam::trackedParticle::move
 (
     trackingData& td,
-    const scalar trackedParticle
+    const scalar trackTime
 )
 {
     td.switchProcessor = false;
-    td.keepParticle = true;
 
-    scalar tEnd = (1.0 - stepFraction())*trackedParticle;
+    scalar tEnd = (1.0 - stepFraction())*trackTime;
     scalar dtMax = tEnd;
 
-    while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
+    if (tEnd <= SMALL)
     {
-        // set the lagrangian time-step
-        scalar dt = min(dtMax, tEnd);
+        // Remove the particle
+        td.keepParticle = false;
+    }
+    else
+    {
+        td.keepParticle = true;
 
-        // mark visited cell with max level.
-        td.maxLevel()[cell()] = max(td.maxLevel()[cell()], level_);
+        while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
+        {
+            // set the lagrangian time-step
+            scalar dt = min(dtMax, tEnd);
+
+            // mark visited cell with max level.
+            td.maxLevel()[cell()] = max(td.maxLevel()[cell()], level_);
 
-        dt *= trackToFace(end_, td);
+            dt *= trackToFace(end_, td);
 
-        tEnd -= dt;
-        stepFraction() = 1.0 - tEnd/trackedParticle;
+            tEnd -= dt;
+            stepFraction() = 1.0 - tEnd/trackTime;
+        }
     }
 
     return td.keepParticle;
diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C
index 4c36dc0be4e55f9f142a66860c71dd762cfb3f9c..694fa6126022db98b474cae8dd61b0220ec31a95 100644
--- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C
+++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C
@@ -91,10 +91,10 @@ void Foam::cyclicACMIPolyPatch::resetAMI
         );
 
         srcMask_ =
-            min(1.0 - tolerance_, max(tolerance_, AMI().srcWeightsSum()));
+            min(scalar(1) - tolerance_, max(tolerance_, AMI().srcWeightsSum()));
 
         tgtMask_ =
-            min(1.0 - tolerance_, max(tolerance_, AMI().tgtWeightsSum()));
+            min(scalar(1) - tolerance_, max(tolerance_, AMI().tgtWeightsSum()));
 
         forAll(Sf, faceI)
         {
diff --git a/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H b/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H
index ae3db7635ca55bb539106f54ebaa87ece75906ed..3006ca197dce2ba46dce853898b36c135d20ffff 100644
--- a/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H
+++ b/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H
@@ -43,9 +43,6 @@ SourceFiles
     scalarTransport.C
     IOscalarTransport.H
 
-SeeAlso
-    Foam::basicSourceList
-
 \*---------------------------------------------------------------------------*/
 
 #ifndef scalarTransport_H
diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C
index 58d2b8caddf51619d74549288ac067cae10a9180..e08f31d32fc1dce4eafbaca2c5820250b00e0ad3 100644
--- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C
+++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C
@@ -121,9 +121,9 @@ Foam::sixDoFRigidBodyMotionSolver::sixDoFRigidBodyMotionSolver
                 max
                 (
                     (do_ - pDist.internalField())/(do_ - di_),
-                    0.0
+                    scalar(0)
                 ),
-                1.0
+                scalar(1)
             );
 
         // Convert the scale function to a cosine
@@ -136,9 +136,9 @@ Foam::sixDoFRigidBodyMotionSolver::sixDoFRigidBodyMotionSolver
                   - 0.5
                    *cos(scale_.internalField()
                    *Foam::constant::mathematical::pi),
-                    0.0
+                    scalar(0)
                 ),
-                1.0
+                scalar(1)
             );
 
         scale_.correctBoundaryConditions();
diff --git a/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict b/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict
index d100d0749b2aaa62bc2ac75536f160352cd7c53b..409b18a7811afa2b310c4cd50cf79b752bae66a9 100644
--- a/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict
+++ b/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict
@@ -86,7 +86,7 @@ castellatedMeshControls
     features
     (
         {
-            file "flange.eMesh";
+            file "flange.extendedFeatureEdgeMesh";
             level 0;
         }
     );
@@ -301,12 +301,13 @@ meshQualityControls
 
 // Advanced
 
-// Flags for optional output
-// 0 : only write final meshes
-// 1 : write intermediate meshes
-// 2 : write volScalarField with cellLevel for postprocessing
-// 4 : write current intersections as .obj files
-debug 0;
+// Write flags
+writeFlags
+(
+    scalarLevels    // write volScalarField with cellLevel for postprocessing
+    layerSets       // write cellSets, faceSets of faces in layer
+    layerFields     // write volScalarField for layer coverage
+);
 
 
 // Merge tolerance. Is fraction of overall bounding box of initial mesh.
diff --git a/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/system/fvSolution
index f47969d4bfaa881eb006cc09b04861a5e0cdd694..1a1b04728a1ef4ebf72c0fdde78cf4a590153da2 100644
--- a/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/system/fvSolution
+++ b/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/system/fvSolution
@@ -17,14 +17,14 @@ FoamFile
 
 solvers
 {
-    alpha.water
+    "alpha.water.*"
     {
         nAlphaCorr      1;
         nAlphaSubCycles 3;
         cAlpha          1;
     }
 
-    pcorr
+    "pcorr.*"
     {
         solver          PCG;
         preconditioner
diff --git a/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/system/fvSolution
index 87dac81f6023e46cd81043d5b214a9778755bb10..cced958dc9f819cf89966e8829a65e0b311d9a34 100644
--- a/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/system/fvSolution
+++ b/tutorials/multiphase/interDyMFoam/ras/mixerVesselAMI/system/fvSolution
@@ -17,7 +17,7 @@ FoamFile
 
 solvers
 {
-    alpha.water
+    "alpha.water.*"
     {
         nAlphaCorr          1;
         nAlphaSubCycles     2;
@@ -38,7 +38,7 @@ solvers
         mergeLevels     1;
     }
 
-    pcorr
+    "pcorr.*"
     {
         $p_rgh;
         tolerance       0.1;
diff --git a/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/system/controlDict b/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/system/controlDict
index bb06bdf28dd44040d29cee5000f7e0ddfcb66d32..269adf2b4fbc4547c8ddfa29d4c104fd4858eb49 100644
--- a/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/system/controlDict
+++ b/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/system/controlDict
@@ -54,5 +54,6 @@ runTimeModifiable true;
 adjustTimeStep  yes;
 
 maxCo           2;
+maxAlphaCo      2;
 
 // ************************************************************************* //
diff --git a/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/system/fvSolution b/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/system/fvSolution
index e7a73630a83f6442faa0e4ce3a234fcf94913fea..bc5e84cf8537286f530c93eec83a04e88a846e4b 100644
--- a/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/system/fvSolution
+++ b/tutorials/multiphase/interPhaseChangeDyMFoam/propeller/system/fvSolution
@@ -16,7 +16,7 @@ FoamFile
 
 solvers
 {
-    alpha.water
+    "alpha.water.*"
     {
         cAlpha          0;
         nAlphaCorr      2;
@@ -32,7 +32,7 @@ solvers
         maxIter         10;
     };
 
-    pcorr
+    "pcorr.*"
     {
         solver          GAMG;
         tolerance       1e-2;