diff --git a/README.html b/README.html
index 1e96c05e6a5d50dbca0e3e6d557f16f65f3667c9..280e8adaf69e5ce93ce1759e63ba0e7d092272bf 100644
--- a/README.html
+++ b/README.html
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
-lang="en" xml:lang="en">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 <head>
-<title>OpenFOAM README for version dev</title>
+<title>OpenFOAM README for version 2.2.0</title>
 <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
+<meta name="title" content="OpenFOAM README for version 2.2.0"/>
 <meta name="generator" content="Org-mode"/>
-<meta name="generated" content="15th August 2011"/>
+<meta name="generated" content="11th January 2013"/>
 <meta name="author" content="The OpenFOAM Foundation"/>
 <meta name="description" content=""/>
 <meta name="keywords" content=""/>
@@ -44,6 +44,12 @@ lang="en" xml:lang="en">
   dt { font-weight: bold; }
   div.figure { padding: 0.5em; }
   div.figure p { text-align: center; }
+  div.inlinetask {
+    padding:10px;
+    border:2px solid gray;
+    margin:10px;
+    background: #ffffcc;
+  }
   textarea { overflow-x: auto; }
   .linenr { font-size:smaller }
   .code-highlighted {background-color:#ffff00;}
@@ -79,27 +85,32 @@ lang="en" xml:lang="en">
 
 </head>
 <body>
+
+<div id="preamble">
+
+</div>
+
 <div id="content">
+<h1 class="title">OpenFOAM README for version 2.2.0</h1>
 
-<h1 class="title">OpenFOAM README for version dev</h1>
 
 <div id="table-of-contents">
 <h2>Table of Contents</h2>
 <div id="text-table-of-contents">
 <ul>
-<li><a href="#sec-1">1 About OpenFOAM </a></li>
-<li><a href="#sec-2">2 Copyright </a></li>
-<li><a href="#sec-3">3 Download and installation instructions </a></li>
-<li><a href="#sec-4">4 Release notes </a></li>
-<li><a href="#sec-5">5 Documentation </a></li>
-<li><a href="#sec-6">6 Support and development contracts </a></li>
-<li><a href="#sec-7">7 Reporting Bugs in OpenFOAM </a></li>
+<li><a href="#sec-1">1 About OpenFOAM</a></li>
+<li><a href="#sec-2">2 Copyright</a></li>
+<li><a href="#sec-3">3 Download and installation instructions</a></li>
+<li><a href="#sec-4">4 Release notes</a></li>
+<li><a href="#sec-5">5 Documentation</a></li>
+<li><a href="#sec-6">6 Support and development contracts</a></li>
+<li><a href="#sec-7">7 Reporting Bugs in OpenFOAM</a></li>
 </ul>
 </div>
 </div>
 
 <div id="outline-container-1" class="outline-2">
-<h2 id="sec-1"><span class="section-number-2">1</span> About OpenFOAM </h2>
+<h2 id="sec-1"><span class="section-number-2">1</span> About OpenFOAM</h2>
 <div class="outline-text-2" id="text-1">
 
 <p>  OpenFOAM is a free, open source computational fluid dynamcis (CFD) software
@@ -114,7 +125,7 @@ lang="en" xml:lang="en">
 </div>
 
 <div id="outline-container-2" class="outline-2">
-<h2 id="sec-2"><span class="section-number-2">2</span> Copyright </h2>
+<h2 id="sec-2"><span class="section-number-2">2</span> Copyright</h2>
 <div class="outline-text-2" id="text-2">
 
 <p>  OpenFOAM is free software: you can redistribute it and/or modify it under the
@@ -129,7 +140,7 @@ lang="en" xml:lang="en">
 </div>
 
 <div id="outline-container-3" class="outline-2">
-<h2 id="sec-3"><span class="section-number-2">3</span> Download and installation instructions </h2>
+<h2 id="sec-3"><span class="section-number-2">3</span> Download and installation instructions</h2>
 <div class="outline-text-2" id="text-3">
 
 <ul>
@@ -144,17 +155,17 @@ lang="en" xml:lang="en">
 </div>
 
 <div id="outline-container-4" class="outline-2">
-<h2 id="sec-4"><span class="section-number-2">4</span> Release notes </h2>
+<h2 id="sec-4"><span class="section-number-2">4</span> Release notes</h2>
 <div class="outline-text-2" id="text-4">
 
-<p>  <a href="http://www.OpenFOAM.com/version2.0.0">http://www.OpenFOAM.com/version2.0.0</a>
+<p>  <a href="http://www.OpenFOAM.org/version2.2.0">http://www.OpenFOAM.org/version2.2.0</a>
 </p>
 </div>
 
 </div>
 
 <div id="outline-container-5" class="outline-2">
-<h2 id="sec-5"><span class="section-number-2">5</span> Documentation </h2>
+<h2 id="sec-5"><span class="section-number-2">5</span> Documentation</h2>
 <div class="outline-text-2" id="text-5">
 
 <p>  <a href="http://www.OpenFOAM.com/docs">http://www.OpenFOAM.com/docs</a>
@@ -164,7 +175,7 @@ lang="en" xml:lang="en">
 </div>
 
 <div id="outline-container-6" class="outline-2">
-<h2 id="sec-6"><span class="section-number-2">6</span> Support and development contracts </h2>
+<h2 id="sec-6"><span class="section-number-2">6</span> Support and development contracts</h2>
 <div class="outline-text-2" id="text-6">
 
 <p>  <a href="http://www.OpenFOAM.com/support">http://www.OpenFOAM.com/support</a>
@@ -174,17 +185,19 @@ lang="en" xml:lang="en">
 </div>
 
 <div id="outline-container-7" class="outline-2">
-<h2 id="sec-7"><span class="section-number-2">7</span> Reporting Bugs in OpenFOAM </h2>
+<h2 id="sec-7"><span class="section-number-2">7</span> Reporting Bugs in OpenFOAM</h2>
 <div class="outline-text-2" id="text-7">
 
 <p>  <a href="http://www.OpenFOAM.com/bugs">http://www.OpenFOAM.com/bugs</a>
 </p></div>
 </div>
+</div>
+
 <div id="postamble">
-<p class="date">Date: 15th August 2011</p>
-<p class="creator">Org version 7.5 with Emacs version 23</p>
+<p class="date">Date: 11th January 2013</p>
+<p class="creator">Org version 7.8.11 with Emacs version 24</p>
 <a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a>
-</div>
+
 </div>
 </body>
 </html>
diff --git a/README.org b/README.org
index c107d878700b12fd945892107a4279039581b1a6..bae67922424cbb6de65b9489f422b1a2b625bc30 100644
--- a/README.org
+++ b/README.org
@@ -1,11 +1,11 @@
 #                            -*- mode: org; -*-
 #
-#+TITLE:     OpenFOAM README for version dev
+#+TITLE:            OpenFOAM README for version 2.2.0
 #+AUTHOR:               The OpenFOAM Foundation
-#+DATE:                     15th August 2011
+#+DATE:                     11th January 2013
 #+LINK:                  http://www.openfoam.org
 #+OPTIONS: author:nil ^:{}
-# Copyright (c) 2011 OpenFOAM Foundation.
+# Copyright (c) 2013 OpenFOAM Foundation.
 
 * About OpenFOAM
   OpenFOAM is a free, open source computational fluid dynamcis (CFD) software
@@ -28,7 +28,7 @@
     [[http://www.OpenFOAM.org/git.php]]
 
 * Release notes
-  [[http://www.OpenFOAM.com/version2.0.0]]
+  [[http://www.OpenFOAM.org/version2.2.0]]
 
 * Documentation
   [[http://www.OpenFOAM.com/docs]]
diff --git a/applications/solvers/basic/potentialFoam/Make/options b/applications/solvers/basic/potentialFoam/Make/options
index 725122ea1df804ba46bb14bdca8a527b9e8386cc..159afb0f461dd191ac4becac9255dacbe538a5c7 100644
--- a/applications/solvers/basic/potentialFoam/Make/options
+++ b/applications/solvers/basic/potentialFoam/Make/options
@@ -1,4 +1,11 @@
 EXE_INC = \
-    -I$(LIB_SRC)/finiteVolume/lnInclude
+    -I$(LIB_SRC)/finiteVolume/lnInclude \
+    -I$(LIB_SRC)/meshTools/lnInclude \
+    -I$(LIB_SRC)/fvOptions/lnInclude \
+    -I$(LIB_SRC)/sampling/lnInclude
 
-EXE_LIBS = -lfiniteVolume
+EXE_LIBS = \
+    -lfiniteVolume \
+    -lmeshTools \
+    -lfvOptions \
+    -lsampling
diff --git a/applications/solvers/basic/potentialFoam/potentialFoam.C b/applications/solvers/basic/potentialFoam/potentialFoam.C
index e968fa5c16ac8e513a1fb56a260a28c9880b04e2..33931f051e873db67fa45f68c84f6c7154bfc97a 100644
--- a/applications/solvers/basic/potentialFoam/potentialFoam.C
+++ b/applications/solvers/basic/potentialFoam/potentialFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -31,7 +31,7 @@ Description
 \*---------------------------------------------------------------------------*/
 
 #include "fvCFD.H"
-
+#include "fvIOoptionList.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -49,17 +49,20 @@ int main(int argc, char *argv[])
     #include "createMesh.H"
     #include "readControls.H"
     #include "createFields.H"
+    #include "createFvOptions.H"
 
     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
     Info<< nl << "Calculating potential flow" << endl;
 
     // Since solver contains no time loop it would never execute
-    // function objects so do it ourselves.
+    // function objects so do it ourselves
     runTime.functionObjects().start();
 
     adjustPhi(phi, U, p);
 
+    fvOptions.relativeFlux(phi);
+
     for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
     {
         fvScalarMatrix pEqn
@@ -87,6 +90,8 @@ int main(int argc, char *argv[])
         }
     }
 
+    fvOptions.absoluteFlux(phi);
+
     Info<< "continuity error = "
         << mag(fvc::div(phi))().weightedAverage(mesh.V()).value()
         << endl;
diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C
index fb61460facf54a6f03625b2fb9e0046b3aed6e6d..12cfba078b3acb271fa6c651b71df547b9c18716 100644
--- a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C
+++ b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.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
@@ -116,7 +116,7 @@ void PDRkEpsilon::correct()
     }
 
     tmp<volTensorField> tgradU = fvc::grad(U_);
-    volScalarField G(type() + ".G", mut_*(tgradU() && dev(twoSymm(tgradU()))));
+    volScalarField G(GName(), mut_*(tgradU() && dev(twoSymm(tgradU()))));
     tgradU.clear();
 
     // Update espsilon and G at the wall
diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingFoam/pEqn.H b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/pEqn.H
index 3fb6dfe45e412afeca48b498fb99a2127b03196a..7a5c717cff712da15a12e99911e4580fe6a96845 100644
--- a/applications/solvers/combustion/reactingFoam/rhoReactingFoam/pEqn.H
+++ b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/pEqn.H
@@ -27,7 +27,7 @@
         fvScalarMatrix pDDtEqn
         (
             fvc::ddt(rho) + fvc::div(phiHbyA)
-          + correction(fvm::ddt(psi, p) + fvm::div(phid, p))
+          + correction(psi*fvm::ddt(p) + fvm::div(phid, p))
         );
 
         while (pimple.correctNonOrthogonal())
diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C b/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C
index 5f25016a84eeed80d3545cc386be4b50842ddbbe..a4282534217c6742fd2739cea7645961cf478f2d 100644
--- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C
+++ b/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.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
@@ -165,7 +165,6 @@ int main(int argc, char *argv[])
         mesh.movePoints(motionPtr->newPoints());
 
         phi = aphiv_pos*rho_pos + aphiv_neg*rho_neg;
-        Info<< phi.boundaryField()[0] << endl;
 
         surfaceVectorField phiUp
         (
diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C
index 3d2c18e6684fa8a570f5a5b3f23ff80489bd3809..67df5b61e054ef46b32c8daefe3e367023496248 100644
--- a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C
+++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C
@@ -22,7 +22,7 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Application
-    buoyantSimpleRadiationFoam
+    buoyantSimpleFoam
 
 Description
     Steady-state solver for buoyant, turbulent flow of compressible fluids,
@@ -31,7 +31,7 @@ Description
 \*---------------------------------------------------------------------------*/
 
 #include "fvCFD.H"
-#include "psiThermo.H"
+#include "rhoThermo.H"
 #include "RASModel.H"
 #include "radiationModel.H"
 #include "simpleControl.H"
diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H
index bb7a65cb1d28ac920674974f91563447637874e1..7cee2dc4eda747b76c35f15485f47d01a0125846 100644
--- a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H
+++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H
@@ -1,10 +1,7 @@
     Info<< "Reading thermophysical properties\n" << endl;
 
-    autoPtr<psiThermo> pThermo
-    (
-        psiThermo::New(mesh)
-    );
-    psiThermo& thermo = pThermo();
+    autoPtr<rhoThermo> pThermo(rhoThermo::New(mesh));
+    rhoThermo& thermo = pThermo();
     thermo.validate(args.executable(), "h", "e");
 
     volScalarField rho
diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options
index 06126f0bf86d8f3b6fe8545a230cb91b899dcff3..94dd40ce6b944099f73a4f5b643f4426d90fad1e 100644
--- a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options
+++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options
@@ -11,9 +11,7 @@ EXE_INC = \
     -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
     -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
     -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
-    -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
     -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
-    -I$(LIB_SRC)/turbulenceModels \
     -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
     -I$(LIB_SRC)/fvOptions/lnInclude \
     -I$(LIB_SRC)/regionModels/regionModel/lnInclude
@@ -25,6 +23,7 @@ EXE_LIBS = \
     -lspecie \
     -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
+    -lcompressibleLESModels \
     -lmeshTools \
     -lfiniteVolume \
     -lradiationModels \
diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C
index 9ec57f2f92fad8c27b2bbec760753fc0788bdcfe..0753cd31638fa7f65510e08bb933c676f4e02524 100644
--- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C
+++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.H
index 77eda7c843551345d460e98f5d371b3972df5217..797bb765a0c81f7200b88d6c9099fdcdf4b4451b 100644
--- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.H
+++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/solvers/heatTransfer/thermoFoam/EEqn.H b/applications/solvers/heatTransfer/thermoFoam/EEqn.H
new file mode 100644
index 0000000000000000000000000000000000000000..51232bf0bec20f7dfead229401a45bc5ca2ec706
--- /dev/null
+++ b/applications/solvers/heatTransfer/thermoFoam/EEqn.H
@@ -0,0 +1,34 @@
+{
+    volScalarField& he = thermo.he();
+
+    fvScalarMatrix EEqn
+    (
+        fvm::ddt(rho, he) + fvm::div(phi, he)
+      + fvc::ddt(rho, K) + fvc::div(phi, K)
+      + (
+            he.name() == "e"
+          ? fvc::div
+            (
+                fvc::absolute(phi/fvc::interpolate(rho), U),
+                p,
+                "div(phiv,p)"
+            )
+          : -dpdt
+        )
+      - fvm::laplacian(alphaEff, he)
+     ==
+        radiation->Sh(thermo)
+      + fvOptions(rho, he)
+    );
+
+    EEqn.relax();
+
+    fvOptions.constrain(EEqn);
+
+    EEqn.solve();
+
+    fvOptions.correct(he);
+
+    thermo.correct();
+    radiation->correct();
+}
diff --git a/applications/solvers/heatTransfer/thermoFoam/Make/files b/applications/solvers/heatTransfer/thermoFoam/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..825ed0cba8ac5e0819ccb568cc7541d5f8085262
--- /dev/null
+++ b/applications/solvers/heatTransfer/thermoFoam/Make/files
@@ -0,0 +1,3 @@
+thermoFoam.C
+
+EXE = $(FOAM_APPBIN)/thermoFoam
diff --git a/applications/solvers/heatTransfer/thermoFoam/Make/options b/applications/solvers/heatTransfer/thermoFoam/Make/options
new file mode 100644
index 0000000000000000000000000000000000000000..14bd0d4d24e9b7a22d0c57a8686ea26bd394c681
--- /dev/null
+++ b/applications/solvers/heatTransfer/thermoFoam/Make/options
@@ -0,0 +1,24 @@
+EXE_INC = \
+    -I$(LIB_SRC)/finiteVolume/lnInclude \
+    -I$(LIB_SRC)/sampling/lnInclude \
+    -I$(LIB_SRC)/meshTools/lnInclude \
+    -I$(LIB_SRC)/fvOptions/lnInclude \
+    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
+    -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
+    -I$(LIB_SRC)/turbulenceModels \
+    -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
+    -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
+    -I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
+    -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude
+
+EXE_LIBS = \
+    -lfiniteVolume \
+    -lsampling \
+    -lmeshTools \
+    -lfvOptions \
+    -lfluidThermophysicalModels \
+    -lradiationModels \
+    -lspecie \
+    -lcompressibleTurbulenceModel \
+    -lcompressibleRASModels \
+    -lcompressibleLESModels
diff --git a/applications/solvers/heatTransfer/thermoFoam/createFields.H b/applications/solvers/heatTransfer/thermoFoam/createFields.H
new file mode 100644
index 0000000000000000000000000000000000000000..ffa6c3f3b52113c56d4bc5329c218a1c57f25162
--- /dev/null
+++ b/applications/solvers/heatTransfer/thermoFoam/createFields.H
@@ -0,0 +1,54 @@
+    Info<< "Reading thermophysical properties\n" << endl;
+
+    autoPtr<rhoThermo> pThermo(rhoThermo::New(mesh));
+    rhoThermo& thermo = pThermo();
+    thermo.validate(args.executable(), "h", "e");
+
+    volScalarField rho
+    (
+        IOobject
+        (
+            "rho",
+            runTime.timeName(),
+            mesh,
+            IOobject::NO_READ,
+            IOobject::NO_WRITE
+        ),
+        thermo.rho()
+    );
+
+    volScalarField& p = thermo.p();
+
+    Info<< "Reading field U\n" << endl;
+    volVectorField U
+    (
+        IOobject
+        (
+            "U",
+            runTime.timeName(),
+            mesh,
+            IOobject::MUST_READ,
+            IOobject::AUTO_WRITE
+        ),
+        mesh
+    );
+
+    #include "compressibleCreatePhi.H"
+
+    #include "setAlphaEff.H"
+
+    Info<< "Creating field dpdt\n" << endl;
+    volScalarField dpdt
+    (
+        IOobject
+        (
+            "dpdt",
+            runTime.timeName(),
+            mesh
+        ),
+        mesh,
+        dimensionedScalar("dpdt", p.dimensions()/dimTime, 0)
+    );
+
+    Info<< "Creating field kinetic energy K\n" << endl;
+    volScalarField K("K", 0.5*magSqr(U));
diff --git a/applications/solvers/heatTransfer/thermoFoam/setAlphaEff.H b/applications/solvers/heatTransfer/thermoFoam/setAlphaEff.H
new file mode 100644
index 0000000000000000000000000000000000000000..90b475794b6340365f969f978d14d52811b60d4c
--- /dev/null
+++ b/applications/solvers/heatTransfer/thermoFoam/setAlphaEff.H
@@ -0,0 +1,93 @@
+    Info<< "Creating turbulence model\n" << endl;
+    tmp<volScalarField> talphaEff;
+
+    IOobject turbulenceHeader
+    (
+        "turbulenceProperties",
+        runTime.constant(),
+        mesh,
+        IOobject::MUST_READ
+    );
+
+    IOobject RASHeader
+    (
+        "RASProperties",
+        runTime.constant(),
+        mesh,
+        IOobject::MUST_READ
+    );
+
+    IOobject LESHeader
+    (
+        "LESProperties",
+        runTime.constant(),
+        mesh,
+        IOobject::MUST_READ
+    );
+
+    if (turbulenceHeader.headerOk())
+    {
+        autoPtr<compressible::turbulenceModel> turbulence
+        (
+            compressible::turbulenceModel::New
+            (
+                rho,
+                U,
+                phi,
+                thermo
+            )
+        );
+
+        talphaEff = turbulence->alphaEff();
+    }
+    else if (RASHeader.headerOk())
+    {
+        autoPtr<compressible::RASModel> turbulence
+        (
+            compressible::RASModel::New
+            (
+                rho,
+                U,
+                phi,
+                thermo
+            )
+        );
+
+        talphaEff = turbulence->alphaEff();
+    }
+    else if (LESHeader.headerOk())
+    {
+        autoPtr<compressible::LESModel> turbulence
+        (
+            compressible::LESModel::New
+            (
+                rho,
+                U,
+                phi,
+                thermo
+            )
+        );
+
+        talphaEff = turbulence->alphaEff();
+    }
+    else
+    {
+        talphaEff = tmp<volScalarField>
+        (
+            new volScalarField
+            (
+                IOobject
+                (
+                    "alphaEff",
+                    runTime.timeName(),
+                    mesh,
+                    IOobject::NO_READ,
+                    IOobject::NO_WRITE
+                ),
+                mesh,
+                dimensionedScalar("0", dimMass/dimLength/dimTime, 0.0)
+            )
+        );
+    }
+
+    const volScalarField& alphaEff = talphaEff();
diff --git a/applications/solvers/heatTransfer/thermoFoam/thermoFoam.C b/applications/solvers/heatTransfer/thermoFoam/thermoFoam.C
new file mode 100644
index 0000000000000000000000000000000000000000..f5f88232d2c1fbd9a7bd8fe6d431a99020b848d6
--- /dev/null
+++ b/applications/solvers/heatTransfer/thermoFoam/thermoFoam.C
@@ -0,0 +1,107 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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
+    thermoFoam
+
+Description
+    Evolves the thermodynamics on a forzen flow field
+
+\*---------------------------------------------------------------------------*/
+
+#include "fvCFD.H"
+#include "rhoThermo.H"
+#include "turbulenceModel.H"
+#include "RASModel.H"
+#include "LESModel.H"
+#include "radiationModel.H"
+#include "fvIOoptionList.H"
+#include "simpleControl.H"
+#include "pimpleControl.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+int main(int argc, char *argv[])
+{
+    #include "setRootCase.H"
+
+    #include "createTime.H"
+    #include "createMesh.H"
+    #include "createFields.H"
+    #include "createFvOptions.H"
+    #include "createRadiationModel.H"
+
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+    Info<< "\nEvolving thermodynamics\n" << endl;
+
+    if (mesh.solutionDict().found("SIMPLE"))
+    {
+        simpleControl simple(mesh);
+
+        while (simple.loop())
+        {
+            Info<< "Time = " << runTime.timeName() << nl << endl;
+
+            while (simple.correctNonOrthogonal())
+            {
+                #include "EEqn.H"
+            }
+
+            Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
+                << "  ClockTime = " << runTime.elapsedClockTime() << " s"
+                << nl << endl;
+
+            runTime.write();
+        }
+    }
+    else
+    {
+        pimpleControl pimple(mesh);
+
+        while (runTime.run())
+        {
+            runTime++;
+
+            Info<< "Time = " << runTime.timeName() << nl << endl;
+
+            while (pimple.correctNonOrthogonal())
+            {
+                #include "EEqn.H"
+            }
+
+            Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
+                << "  ClockTime = " << runTime.elapsedClockTime() << " s"
+                << nl << endl;
+
+            runTime.write();
+        }
+    }
+
+    Info<< "End\n" << endl;
+
+    return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H
index 117790446e9509ee3dcbfd235f9dd8db44508a41..9bed803d1e7be78b71e1d7bfde39bb93f8bf1d0e 100644
--- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H
+++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H
@@ -68,4 +68,6 @@
     }
 }
 
+phi.oldTime() = phi;
+
 #include "continuityErrs.H"
diff --git a/applications/solvers/multiphase/cavitatingFoam/Make/options b/applications/solvers/multiphase/cavitatingFoam/Make/options
index 0f2981ab4c1f723977c143543a9dc22fd2710109..5efeeb355d655e16d52a584cf24c7d43abbaa5ce 100644
--- a/applications/solvers/multiphase/cavitatingFoam/Make/options
+++ b/applications/solvers/multiphase/cavitatingFoam/Make/options
@@ -1,4 +1,5 @@
 EXE_INC = \
+    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
     -I$(LIB_SRC)/finiteVolume/lnInclude \
     -I$(LIB_SRC)/transportModels \
     -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/options b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/options
index fa204ce58f0fdee1455d5339c34ad633135d2ac3..34590e930b0391b4a664e3fbe10c70b9f2fed435 100644
--- a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/options
+++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/options
@@ -1,6 +1,7 @@
 EXE_INC = \
     -I.. \
     -I$(LIB_SRC)/finiteVolume/lnInclude \
+    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
     -I$(LIB_SRC)/transportModels \
     -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
     -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C
index 45bc766761a0270ce9458fa1648b2cdb3d105c51..cf608d0a6ab498e18bbd55fae57409bc9e9738fb 100644
--- a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C
+++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -35,7 +35,7 @@ Description
 #include "fvCFD.H"
 #include "dynamicFvMesh.H"
 #include "barotropicCompressibilityModel.H"
-#include "twoPhaseMixture.H"
+#include "incompressibleTwoPhaseMixture.H"
 #include "turbulenceModel.H"
 #include "pimpleControl.H"
 
diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H
index a4e9e0b40f6c77500d7b55adad6daa8d399c3279..3c4cbb0d32e48f0ff38415408ec669119b4f9f03 100644
--- a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H
+++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H
@@ -4,8 +4,8 @@
         p =
         (
             rho
-          - (1.0 - gamma)*rhol0
-          - ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat
+          - gamma2*rhol0
+          - ((gamma*psiv + gamma2*psil) - psi)*pSat
         )/psi;
     }
 
@@ -57,8 +57,8 @@
     p =
     (
         rho
-      - (1.0 - gamma)*rhol0
-      - ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat
+      - gamma2*rhol0
+      - ((gamma*psiv + gamma2*psil) - psi)*pSat
     )/psi;
 
     p.correctBoundaryConditions();
diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C b/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C
index 256a58d95339b7bb657d697fcef46223a1d38acc..73e9577029b89c186478b4a211cbff054f69d5e6 100644
--- a/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C
+++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -34,7 +34,7 @@ Description
 
 #include "fvCFD.H"
 #include "barotropicCompressibilityModel.H"
-#include "twoPhaseMixture.H"
+#include "incompressibleTwoPhaseMixture.H"
 #include "turbulenceModel.H"
 #include "pimpleControl.H"
 
diff --git a/applications/solvers/multiphase/cavitatingFoam/continuityErrs.H b/applications/solvers/multiphase/cavitatingFoam/continuityErrs.H
index c5e93c7efb3d537892e22228143b8103e9ce3a21..ce618ee40f2c3a04bf660d08c385389ecdebd570 100644
--- a/applications/solvers/multiphase/cavitatingFoam/continuityErrs.H
+++ b/applications/solvers/multiphase/cavitatingFoam/continuityErrs.H
@@ -1,5 +1,5 @@
 {
-    volScalarField thermoRho = psi*p + (1.0 - gamma)*rhol0;
+    volScalarField thermoRho = psi*p + gamma2*rhol0;
 
     dimensionedScalar totalMass = fvc::domainIntegrate(rho);
 
diff --git a/applications/solvers/multiphase/cavitatingFoam/createFields.H b/applications/solvers/multiphase/cavitatingFoam/createFields.H
index dbacf1dbd3f1c416bffccc6e2c3b5e7f67d4baf0..8958dc3c5ed261572dd3a34ee118de9038bb7cc0 100644
--- a/applications/solvers/multiphase/cavitatingFoam/createFields.H
+++ b/applications/solvers/multiphase/cavitatingFoam/createFields.H
@@ -44,11 +44,13 @@
 
     Info<< "Reading transportProperties\n" << endl;
 
-    twoPhaseMixture twoPhaseProperties(U, phiv, "gamma");
+    incompressibleTwoPhaseMixture twoPhaseProperties(U, phiv, "gamma");
 
     volScalarField& gamma(twoPhaseProperties.alpha1());
     gamma.oldTime();
 
+    volScalarField& gamma2(twoPhaseProperties.alpha2());
+
     Info<< "Creating compressibilityModel\n" << endl;
     autoPtr<barotropicCompressibilityModel> psiModel =
         barotropicCompressibilityModel::New
@@ -62,8 +64,8 @@
     rho == max
     (
         psi*p
-      + (1.0 - gamma)*rhol0
-      + ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
+      + gamma2*rhol0
+      + ((gamma*psiv + gamma2*psil) - psi)*pSat,
         rhoMin
     );
 
diff --git a/applications/solvers/multiphase/cavitatingFoam/gammaPsi.H b/applications/solvers/multiphase/cavitatingFoam/gammaPsi.H
index b259ddd3222ff00fe49a83854a1bcae1e84ba240..4edda7336de09a5e212dbded85bcc70c2ddee6dc 100644
--- a/applications/solvers/multiphase/cavitatingFoam/gammaPsi.H
+++ b/applications/solvers/multiphase/cavitatingFoam/gammaPsi.H
@@ -1,5 +1,6 @@
 {
     gamma = max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0));
+    gamma2 = 1.0 - gamma;
 
     Info<< "max-min gamma: " << max(gamma).value()
         << " " << min(gamma).value() << endl;
diff --git a/applications/solvers/multiphase/cavitatingFoam/pEqn.H b/applications/solvers/multiphase/cavitatingFoam/pEqn.H
index ea35f79fa14c505d87f62be95f2bab9fd1c56bf9..b2c7d953b5368b2b46adb91223c06d9ceab4242d 100644
--- a/applications/solvers/multiphase/cavitatingFoam/pEqn.H
+++ b/applications/solvers/multiphase/cavitatingFoam/pEqn.H
@@ -4,8 +4,8 @@
         p =
         (
             rho
-          - (1.0 - gamma)*rhol0
-          - ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat
+          - gamma2*rhol0
+          - ((gamma*psiv + gamma2*psil) - psi)*pSat
         )/psi;
     }
 
@@ -49,8 +49,8 @@
     rho == max
     (
         psi*p
-      + (1.0 - gamma)*rhol0
-      + ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
+      + gamma2*rhol0
+      + ((gamma*psiv + gamma2*psil) - psi)*pSat,
         rhoMin
     );
 
@@ -59,8 +59,8 @@
     p =
     (
         rho
-      - (1.0 - gamma)*rhol0
-      - ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat
+      - gamma2*rhol0
+      - ((gamma*psiv + gamma2*psil) - psi)*pSat
     )/psi;
 
     p.correctBoundaryConditions();
diff --git a/applications/solvers/multiphase/compressibleInterFoam/Allwclean b/applications/solvers/multiphase/compressibleInterFoam/Allwclean
index 2f4544cb4c0a192b4a83d7f39729bed83de3a23e..aa0f3c01c6ba74c8d0cd77ee40e09214002110f6 100755
--- a/applications/solvers/multiphase/compressibleInterFoam/Allwclean
+++ b/applications/solvers/multiphase/compressibleInterFoam/Allwclean
@@ -2,7 +2,7 @@
 cd ${0%/*} || exit 1    # run from this directory
 set -x
 
-wclean libso phaseEquationsOfState
+wclean libso twoPhaseMixtureThermo
 wclean
 wclean compressibleInterDyMFoam
 
diff --git a/applications/solvers/multiphase/compressibleInterFoam/Allwmake b/applications/solvers/multiphase/compressibleInterFoam/Allwmake
index b4b7f6ffa7fbc5f1f247d108cdbe9270489850c1..a93da26cddb8cbeb7421c7bf086ef7ef86241fc4 100755
--- a/applications/solvers/multiphase/compressibleInterFoam/Allwmake
+++ b/applications/solvers/multiphase/compressibleInterFoam/Allwmake
@@ -2,7 +2,7 @@
 cd ${0%/*} || exit 1    # run from this directory
 set -x
 
-wmake libso phaseEquationsOfState
+wmake libso twoPhaseMixtureThermo
 wmake
 wmake compressibleInterDyMFoam
 
diff --git a/applications/solvers/multiphase/compressibleInterFoam/Make/files b/applications/solvers/multiphase/compressibleInterFoam/Make/files
index 0e009f09bcd767c85f1541acab665277ce0f5175..de5437219c00fd0ec616736c21ad3b570b7d9f5e 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/Make/files
+++ b/applications/solvers/multiphase/compressibleInterFoam/Make/files
@@ -1,4 +1,3 @@
-derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
 compressibleInterFoam.C
 
 EXE = $(FOAM_APPBIN)/compressibleInterFoam
diff --git a/applications/solvers/multiphase/compressibleInterFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/Make/options
index 48c253b21316c4e8b76158cc9627723d73fba48b..035116d2d5723d4f0ef19facc19be5732966c612 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/Make/options
+++ b/applications/solvers/multiphase/compressibleInterFoam/Make/options
@@ -1,17 +1,19 @@
 EXE_INC = \
-    -I$(LIB_SRC)/transportModels \
-    -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
+    -ItwoPhaseMixtureThermo \
+    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
+    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
     -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-    -IphaseEquationsOfState/lnInclude \
-    -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
+    -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
     -I$(LIB_SRC)/finiteVolume/lnInclude
 
 EXE_LIBS = \
+    -ltwoPhaseMixtureThermo \
+    -lfluidThermophysicalModels \
+    -lspecie \
+    -ltwoPhaseMixture \
+    -ltwoPhaseProperties \
     -linterfaceProperties \
-    -ltwoPhaseInterfaceProperties \
-    -lincompressibleTransportModels \
-    -lphaseEquationsOfState \
-    -lincompressibleTurbulenceModel \
-    -lincompressibleRASModels \
-    -lincompressibleLESModels \
+    -lcompressibleTurbulenceModel \
+    -lcompressibleRASModels \
+    -lcompressibleLESModels \
     -lfiniteVolume
diff --git a/applications/solvers/multiphase/compressibleInterFoam/TEqn.H b/applications/solvers/multiphase/compressibleInterFoam/TEqn.H
index 2605ce345a973f19d71f43f83bbc18a2070de16d..d97e8b2a3549db8ea23edc6c073a5bb160c6537c 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/TEqn.H
+++ b/applications/solvers/multiphase/compressibleInterFoam/TEqn.H
@@ -1,20 +1,21 @@
 {
-    volScalarField kByCv
-    (
-        "kByCv",
-        (alpha1*k1/Cv1 + alpha2*k2/Cv2)
-      + (alpha1*rho1 + alpha2*rho2)*turbulence->nut()
-    );
-
-    solve
+    fvScalarMatrix TEqn
     (
         fvm::ddt(rho, T)
       + fvm::div(rhoPhi, T)
-      - fvm::laplacian(kByCv, T)
-      + p*fvc::div(phi)*(alpha1/Cv1 + alpha2/Cv2)
+      - fvm::laplacian(twoPhaseProperties.alphaEff(turbulence->mut()), T)
+      + (
+            fvc::div(fvc::absolute(phi, U), p)
+          + fvc::ddt(rho, K) + fvc::div(rhoPhi, K)
+        )
+       *(
+           alpha1/twoPhaseProperties.thermo1().Cv()
+         + alpha2/twoPhaseProperties.thermo2().Cv()
+        )
     );
 
-    // Update compressibilities
-    psi1 = eos1->psi(p, T);
-    psi2 = eos2->psi(p, T);
+    TEqn.relax();
+    TEqn.solve();
+
+    twoPhaseProperties.correct();
 }
diff --git a/applications/solvers/multiphase/compressibleInterFoam/UEqn.H b/applications/solvers/multiphase/compressibleInterFoam/UEqn.H
index 7cc250a66a2ab15a22680ab352f321e731b17c17..8fc397e8020c8d6c0786192d39dc386d57c0af4f 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/UEqn.H
+++ b/applications/solvers/multiphase/compressibleInterFoam/UEqn.H
@@ -2,7 +2,7 @@
     (
         fvm::ddt(rho, U)
       + fvm::div(rhoPhi, U)
-      + turbulence->divDevRhoReff(rho, U)
+      + turbulence->divDevRhoReff(U)
     );
 
     UEqn.relax();
@@ -22,4 +22,6 @@
                 ) * mesh.magSf()
             )
         );
+
+        K = 0.5*magSqr(U);
     }
diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options
index d4d0fa9b5ab36194421b3a8e160265dff04dd6ef..cf9a1d85ecfb9f3452ac945cdc49057a25b8f1be 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options
+++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options
@@ -1,24 +1,26 @@
 EXE_INC = \
     -I.. \
-    -I$(LIB_SRC)/transportModels \
-    -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
+    -I../twoPhaseMixtureThermo \
+    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
+    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
     -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-    -I../phaseEquationsOfState/lnInclude \
-    -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
-    -I$(LIB_SRC)/finiteVolume/lnInclude \
+    -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
     -I$(LIB_SRC)/dynamicMesh/lnInclude \
     -I$(LIB_SRC)/meshTools/lnInclude \
-    -I$(LIB_SRC)/dynamicFvMesh/lnInclude
+    -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
+    -I$(LIB_SRC)/finiteVolume/lnInclude
 
 EXE_LIBS = \
+    -ltwoPhaseMixtureThermo \
+    -lfluidThermophysicalModels \
+    -lspecie \
+    -ltwoPhaseMixture \
+    -ltwoPhaseProperties \
     -linterfaceProperties \
-    -ltwoPhaseInterfaceProperties \
-    -lincompressibleTransportModels \
-    -lphaseEquationsOfState \
-    -lincompressibleTurbulenceModel \
-    -lincompressibleRASModels \
-    -lincompressibleLESModels \
-    -lfiniteVolume \
+    -lcompressibleTurbulenceModel \
+    -lcompressibleRASModels \
+    -lcompressibleLESModels \
     -ldynamicMesh \
     -lmeshTools \
-    -ldynamicFvMesh
+    -ldynamicFvMesh \
+    -lfiniteVolume
diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C
index acf563fc8e2d4e1591a93c184eab5f40b86ee96e..27d3b87cd1d676f267f5bf811ea297dc3a7cf2e2 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.C
+++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/compressibleInterDyMFoam.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
@@ -43,7 +43,7 @@ Description
 #include "subCycle.H"
 #include "interfaceProperties.H"
 #include "twoPhaseMixture.H"
-#include "phaseEquationOfState.H"
+#include "twoPhaseMixtureThermo.H"
 #include "turbulenceModel.H"
 #include "pimpleControl.H"
 
diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H
index 1d7b9ca624a4e0acb1d653890c23adda345b5627..513ef961bd7e411cde9fee70434c1c418e84f4e5 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H
+++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H
@@ -56,6 +56,8 @@
             phi -= pcorrEqn.flux();
         }
     }
-
-    #include "continuityErrs.H"
 }
+
+phi.oldTime() = phi;
+
+#include "continuityErrs.H"
diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C
index 54c246f203b5f5ed9083d192fa3d0013ee01af3a..a42d9119804c8e61031ee217ec38b8722781f236 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C
+++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.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
@@ -38,9 +38,10 @@ Description
 #include "fvCFD.H"
 #include "MULES.H"
 #include "subCycle.H"
+#include "rhoThermo.H"
 #include "interfaceProperties.H"
 #include "twoPhaseMixture.H"
-#include "phaseEquationOfState.H"
+#include "twoPhaseMixtureThermo.H"
 #include "turbulenceModel.H"
 #include "pimpleControl.H"
 
@@ -103,8 +104,6 @@ int main(int argc, char *argv[])
             }
         }
 
-        rho = alpha1*rho1 + alpha2*rho2;
-
         runTime.write();
 
         Info<< "ExecutionTime = "
diff --git a/applications/solvers/multiphase/compressibleInterFoam/createFields.H b/applications/solvers/multiphase/compressibleInterFoam/createFields.H
index 1c22600170bc1a4dbfa189d0041c341ee6256e63..c7289b23f901906c4fe7c96366c041ac8f0a3e9d 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/createFields.H
+++ b/applications/solvers/multiphase/compressibleInterFoam/createFields.H
@@ -28,141 +28,20 @@
 
     #include "createPhi.H"
 
-    Info<< "Reading field T\n" << endl;
-    volScalarField T
-    (
-        IOobject
-        (
-            "T",
-            runTime.timeName(),
-            mesh,
-            IOobject::MUST_READ,
-            IOobject::AUTO_WRITE
-        ),
-        mesh
-    );
-
-    volScalarField p
-    (
-        IOobject
-        (
-            "p",
-            runTime.timeName(),
-            mesh,
-            IOobject::READ_IF_PRESENT,
-            IOobject::AUTO_WRITE
-        ),
-        p_rgh
-    );
-
-
-    Info<< "Reading transportProperties\n" << endl;
-    twoPhaseMixture twoPhaseProperties(U, phi);
+    Info<< "Constructing twoPhaseMixtureThermo\n" << endl;
+    twoPhaseMixtureThermo twoPhaseProperties(mesh);
 
     volScalarField& alpha1(twoPhaseProperties.alpha1());
+    volScalarField& alpha2(twoPhaseProperties.alpha2());
 
-    Info<< "Calculating phase-fraction alpha" << twoPhaseProperties.phase2Name()
-        << nl << endl;
-    volScalarField alpha2
-    (
-        "alpha" + twoPhaseProperties.phase2Name(),
-        scalar(1) - alpha1
-    );
+    Info<< "Reading thermophysical properties\n" << endl;
 
-    dimensionedScalar k1
-    (
-        "k",
-        dimensionSet(1, 1, -3, -1, 0),
-        twoPhaseProperties.subDict
-        (
-            twoPhaseProperties.phase1Name()
-        ).lookup("k")
-    );
-
-    dimensionedScalar k2
-    (
-        "k",
-        dimensionSet(1, 1, -3, -1, 0),
-        twoPhaseProperties.subDict
-        (
-            twoPhaseProperties.phase2Name()
-        ).lookup("k")
-    );
-
-    dimensionedScalar Cv1
-    (
-        "Cv",
-        dimensionSet(0, 2, -2, -1, 0),
-        twoPhaseProperties.subDict
-        (
-            twoPhaseProperties.phase1Name()
-        ).lookup("Cv")
-    );
-
-    dimensionedScalar Cv2
-    (
-        "Cv",
-        dimensionSet(0, 2, -2, -1, 0),
-        twoPhaseProperties.subDict
-        (
-            twoPhaseProperties.phase2Name()
-        ).lookup("Cv")
-    );
-
-    autoPtr<phaseEquationOfState> eos1
-    (
-        phaseEquationOfState::New
-        (
-            twoPhaseProperties.subDict
-            (
-                twoPhaseProperties.phase1Name()
-            )
-        )
-    );
-
-    autoPtr<phaseEquationOfState> eos2
-    (
-        phaseEquationOfState::New
-        (
-            twoPhaseProperties.subDict
-            (
-                twoPhaseProperties.phase2Name()
-            )
-        )
-    );
-
-    volScalarField psi1
-    (
-        IOobject
-        (
-            "psi1",
-            runTime.timeName(),
-            mesh
-        ),
-        eos1->psi(p, T)
-    );
-    psi1.oldTime();
-
-    volScalarField psi2
-    (
-        IOobject
-        (
-            "psi2",
-            runTime.timeName(),
-            mesh
-        ),
-        eos2->psi(p, T)
-    );
-    psi2.oldTime();
-
-    dimensionedScalar pMin(twoPhaseProperties.lookup("pMin"));
-
-    Info<< "Calculating field g.h\n" << endl;
-    volScalarField gh("gh", g & mesh.C());
-    surfaceScalarField ghf("ghf", g & mesh.Cf());
-
-    volScalarField rho1("rho1", eos1->rho(p, T));
-    volScalarField rho2("rho2", eos2->rho(p, T));
+    volScalarField& p = twoPhaseProperties.p();
+    volScalarField& T = twoPhaseProperties.T();
+    volScalarField& rho1 = twoPhaseProperties.thermo1().rho();
+    const volScalarField& psi1 = twoPhaseProperties.thermo1().psi();
+    volScalarField& rho2 = twoPhaseProperties.thermo2().rho();
+    const volScalarField& psi2 = twoPhaseProperties.thermo2().psi();
 
     volScalarField rho
     (
@@ -178,6 +57,12 @@
     );
 
 
+    dimensionedScalar pMin(twoPhaseProperties.lookup("pMin"));
+
+    Info<< "Calculating field g.h\n" << endl;
+    volScalarField gh("gh", g & mesh.C());
+    surfaceScalarField ghf("ghf", g & mesh.Cf());
+
     // Mass flux
     // Initialisation does not matter because rhoPhi is reset after the
     // alpha1 solution before it is used in the U equation.
@@ -202,8 +87,11 @@
     // Construct interface from alpha1 distribution
     interfaceProperties interface(alpha1, U, twoPhaseProperties);
 
-    // Construct incompressible turbulence model
-    autoPtr<incompressible::turbulenceModel> turbulence
+    // Construct compressible turbulence model
+    autoPtr<compressible::turbulenceModel> turbulence
     (
-        incompressible::turbulenceModel::New(U, phi, twoPhaseProperties)
+        compressible::turbulenceModel::New(rho, U, rhoPhi, twoPhaseProperties)
     );
+
+    Info<< "Creating field kinetic energy K\n" << endl;
+    volScalarField K("K", 0.5*magSqr(U));
diff --git a/applications/solvers/multiphase/compressibleInterFoam/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C b/applications/solvers/multiphase/compressibleInterFoam/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
deleted file mode 100644
index e6782e8b3a9b1649a2053bea98af7becabbc51d1..0000000000000000000000000000000000000000
--- a/applications/solvers/multiphase/compressibleInterFoam/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
+++ /dev/null
@@ -1,184 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 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 "wallHeatTransferFvPatchScalarField.H"
-#include "addToRunTimeSelectionTable.H"
-#include "fvPatchFieldMapper.H"
-#include "volFields.H"
-
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
-(
-    const fvPatch& p,
-    const DimensionedField<scalar, volMesh>& iF
-)
-:
-    mixedFvPatchScalarField(p, iF),
-    Tinf_(p.size(), 0.0),
-    alphaWall_(p.size(), 0.0)
-{
-    refValue() = 0.0;
-    refGrad() = 0.0;
-    valueFraction() = 0.0;
-}
-
-
-Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
-(
-    const wallHeatTransferFvPatchScalarField& ptf,
-    const fvPatch& p,
-    const DimensionedField<scalar, volMesh>& iF,
-    const fvPatchFieldMapper& mapper
-)
-:
-    mixedFvPatchScalarField(ptf, p, iF, mapper),
-    Tinf_(ptf.Tinf_, mapper),
-    alphaWall_(ptf.alphaWall_, mapper)
-{}
-
-
-Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
-(
-    const fvPatch& p,
-    const DimensionedField<scalar, volMesh>& iF,
-    const dictionary& dict
-)
-:
-    mixedFvPatchScalarField(p, iF),
-    Tinf_("Tinf", dict, p.size()),
-    alphaWall_("alphaWall", dict, p.size())
-{
-    refValue() = Tinf_;
-    refGrad() = 0.0;
-    valueFraction() = 0.0;
-
-    if (dict.found("value"))
-    {
-        fvPatchField<scalar>::operator=
-        (
-            scalarField("value", dict, p.size())
-        );
-    }
-    else
-    {
-        evaluate();
-    }
-}
-
-
-Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
-(
-    const wallHeatTransferFvPatchScalarField& tppsf
-)
-:
-    mixedFvPatchScalarField(tppsf),
-    Tinf_(tppsf.Tinf_),
-    alphaWall_(tppsf.alphaWall_)
-{}
-
-
-Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
-(
-    const wallHeatTransferFvPatchScalarField& tppsf,
-    const DimensionedField<scalar, volMesh>& iF
-)
-:
-    mixedFvPatchScalarField(tppsf, iF),
-    Tinf_(tppsf.Tinf_),
-    alphaWall_(tppsf.alphaWall_)
-{}
-
-
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-void Foam::wallHeatTransferFvPatchScalarField::autoMap
-(
-    const fvPatchFieldMapper& m
-)
-{
-    scalarField::autoMap(m);
-    Tinf_.autoMap(m);
-    alphaWall_.autoMap(m);
-}
-
-
-void Foam::wallHeatTransferFvPatchScalarField::rmap
-(
-    const fvPatchScalarField& ptf,
-    const labelList& addr
-)
-{
-    mixedFvPatchScalarField::rmap(ptf, addr);
-
-    const wallHeatTransferFvPatchScalarField& tiptf =
-        refCast<const wallHeatTransferFvPatchScalarField>(ptf);
-
-    Tinf_.rmap(tiptf.Tinf_, addr);
-    alphaWall_.rmap(tiptf.alphaWall_, addr);
-}
-
-
-void Foam::wallHeatTransferFvPatchScalarField::updateCoeffs()
-{
-    if (updated())
-    {
-        return;
-    }
-
-    const fvPatchScalarField& Cpw =
-        patch().lookupPatchField<volScalarField, scalar>("Cp");
-
-    const fvPatchScalarField& kByCpw =
-        patch().lookupPatchField<volScalarField, scalar>("kByCp");
-
-    valueFraction() =
-        1.0/
-        (
-            1.0
-          + Cpw*kByCpw*patch().deltaCoeffs()/alphaWall_
-        );
-
-    mixedFvPatchScalarField::updateCoeffs();
-}
-
-
-void Foam::wallHeatTransferFvPatchScalarField::write(Ostream& os) const
-{
-    fvPatchScalarField::write(os);
-    Tinf_.writeEntry("Tinf", os);
-    alphaWall_.writeEntry("alphaWall", os);
-    writeEntry("value", os);
-}
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-    makePatchTypeField(fvPatchScalarField, wallHeatTransferFvPatchScalarField);
-}
-
-// ************************************************************************* //
diff --git a/applications/solvers/multiphase/compressibleInterFoam/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.H b/applications/solvers/multiphase/compressibleInterFoam/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.H
deleted file mode 100644
index cf5284a087d09fecd5df969ece76878f091ccd34..0000000000000000000000000000000000000000
--- a/applications/solvers/multiphase/compressibleInterFoam/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.H
+++ /dev/null
@@ -1,194 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 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/>.
-
-Class
-    Foam::wallHeatTransferFvPatchScalarField
-
-Description
-    Enthalpy boundary conditions for wall heat transfer
-
-SourceFiles
-    wallHeatTransferFvPatchScalarField.C
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef wallHeatTransferFvPatchScalarField_H
-#define wallHeatTransferFvPatchScalarField_H
-
-#include "mixedFvPatchFields.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-/*---------------------------------------------------------------------------*\
-                  Class wallHeatTransferFvPatch Declaration
-\*---------------------------------------------------------------------------*/
-
-class wallHeatTransferFvPatchScalarField
-:
-    public mixedFvPatchScalarField
-{
-    // Private data
-
-        //- Tinf
-        scalarField Tinf_;
-
-        //- alphaWall
-        scalarField alphaWall_;
-
-
-public:
-
-    //- Runtime type information
-    TypeName("wallHeatTransfer");
-
-
-    // Constructors
-
-        //- Construct from patch and internal field
-        wallHeatTransferFvPatchScalarField
-        (
-            const fvPatch&,
-            const DimensionedField<scalar, volMesh>&
-        );
-
-        //- Construct from patch, internal field and dictionary
-        wallHeatTransferFvPatchScalarField
-        (
-            const fvPatch&,
-            const DimensionedField<scalar, volMesh>&,
-            const dictionary&
-        );
-
-        //- Construct by mapping given wallHeatTransferFvPatchScalarField
-        // onto a new patch
-        wallHeatTransferFvPatchScalarField
-        (
-            const wallHeatTransferFvPatchScalarField&,
-            const fvPatch&,
-            const DimensionedField<scalar, volMesh>&,
-            const fvPatchFieldMapper&
-        );
-
-        //- Construct as copy
-        wallHeatTransferFvPatchScalarField
-        (
-            const wallHeatTransferFvPatchScalarField&
-        );
-
-        //- Construct and return a clone
-        virtual tmp<fvPatchScalarField> clone() const
-        {
-            return tmp<fvPatchScalarField>
-            (
-                new wallHeatTransferFvPatchScalarField(*this)
-            );
-        }
-
-        //- Construct as copy setting internal field reference
-        wallHeatTransferFvPatchScalarField
-        (
-            const wallHeatTransferFvPatchScalarField&,
-            const DimensionedField<scalar, volMesh>&
-        );
-
-        //- Construct and return a clone setting internal field reference
-        virtual tmp<fvPatchScalarField> clone
-        (
-            const DimensionedField<scalar, volMesh>& iF
-        ) const
-        {
-            return tmp<fvPatchScalarField>
-            (
-                new wallHeatTransferFvPatchScalarField(*this, iF)
-            );
-        }
-
-
-    // Member functions
-
-        // Access
-
-            //- Return Tinf
-            const scalarField& Tinf() const
-            {
-                return Tinf_;
-            }
-
-            //- Return reference to Tinf to allow adjustment
-            scalarField& Tinf()
-            {
-                return Tinf_;
-            }
-
-            //- Return alphaWall
-            const scalarField& alphaWall() const
-            {
-                return alphaWall_;
-            }
-
-            //- Return reference to alphaWall to allow adjustment
-            scalarField& alphaWall()
-            {
-                return alphaWall_;
-            }
-
-
-        // Mapping functions
-
-            //- Map (and resize as needed) from self given a mapping object
-            virtual void autoMap
-            (
-                const fvPatchFieldMapper&
-            );
-
-            //- Reverse map the given fvPatchField onto this fvPatchField
-            virtual void rmap
-            (
-                const fvPatchScalarField&,
-                const labelList&
-            );
-
-
-        // Evaluation functions
-
-            //- Update the coefficients associated with the patch field
-            virtual void updateCoeffs();
-
-
-        //- Write
-        virtual void write(Ostream&) const;
-};
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H
index 3197a72beeed1203b6248d6394e27dcdcf940269..73babb08f04ae70d23f2b3ed58831060ec0c771e 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H
+++ b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H
@@ -1,7 +1,4 @@
 {
-    rho1 = eos1->rho(p, T);
-    rho2 = eos2->rho(p, T);
-
     volScalarField rAU("rAU", 1.0/UEqn.A());
     surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
 
@@ -29,28 +26,44 @@
     tmp<fvScalarMatrix> p_rghEqnComp1;
     tmp<fvScalarMatrix> p_rghEqnComp2;
 
-    //if (transonic)
-    //{
-    //}
-    //else
+    if (pimple.transonic())
     {
         surfaceScalarField phid1("phid1", fvc::interpolate(psi1)*phi);
         surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi);
 
+        p_rghEqnComp1 =
+            fvc::ddt(rho1) + fvc::div(phi, rho1) - fvc::Sp(fvc::div(phi), rho1)
+          + correction
+            (
+                psi1*fvm::ddt(p_rgh)
+              + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh)
+            );
+        deleteDemandDrivenData(p_rghEqnComp1().faceFluxCorrectionPtr());
+        p_rghEqnComp1().relax();
+
+        p_rghEqnComp2 =
+            fvc::ddt(rho2) + fvc::div(phi, rho2) - fvc::Sp(fvc::div(phi), rho2)
+          + correction
+            (
+                psi2*fvm::ddt(p_rgh)
+              + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
+            );
+        deleteDemandDrivenData(p_rghEqnComp2().faceFluxCorrectionPtr());
+        p_rghEqnComp2().relax();
+    }
+    else
+    {
         p_rghEqnComp1 =
             fvc::ddt(rho1) + psi1*correction(fvm::ddt(p_rgh))
-          + fvc::div(phid1, p_rgh)
-          - fvc::Sp(fvc::div(phid1), p_rgh);
+          + fvc::div(phi, rho1) - fvc::Sp(fvc::div(phi), rho1);
 
         p_rghEqnComp2 =
             fvc::ddt(rho2) + psi2*correction(fvm::ddt(p_rgh))
-          + fvc::div(phid2, p_rgh)
-          - fvc::Sp(fvc::div(phid2), p_rgh);
+          + fvc::div(phi, rho2) - fvc::Sp(fvc::div(phi), rho2);
     }
 
-    // Thermodynamic density needs to be updated by psi*d(p) after the
-    // pressure solution - done in 2 parts. Part 1:
-    //thermo.rho() -= psi*p_rgh;
+    // Cache p_rgh prior to solve for density update
+    volScalarField p_rgh_0(p_rgh);
 
     while (pimple.correctNonOrthogonal())
     {
@@ -72,8 +85,8 @@
 
         if (pimple.finalNonOrthogonalIter())
         {
-            // Second part of thermodynamic density update
-            //thermo.rho() += psi*p_rgh;
+            //p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
+            //p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
 
             dgdt =
             (
@@ -91,8 +104,13 @@
 
     p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
 
-    rho1 = eos1->rho(p, T);
-    rho2 = eos2->rho(p, T);
+    // Update densities from change in p_rgh
+    rho1 += psi1*(p_rgh - p_rgh_0);
+    rho2 += psi2*(p_rgh - p_rgh_0);
+
+    rho = alpha1*rho1 + alpha2*rho2;
+
+    K = 0.5*magSqr(U);
 
     Info<< "max(U) " << max(mag(U)).value() << endl;
     Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/Make/files b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/Make/files
deleted file mode 100644
index e6e260c74a68a195bde00195048386638e1c11f7..0000000000000000000000000000000000000000
--- a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/Make/files
+++ /dev/null
@@ -1,8 +0,0 @@
-phaseEquationOfState/phaseEquationOfState.C
-phaseEquationOfState/newPhaseEquationOfState.C
-constant/constant.C
-linear/linear.C
-perfectFluid/perfectFluid.C
-adiabaticPerfectFluid/adiabaticPerfectFluid.C
-
-LIB = $(FOAM_LIBBIN)/libphaseEquationsOfState
diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/Make/options b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/Make/options
deleted file mode 100644
index 0ec11392098bd862e78e2790e25cf1f49ec557fd..0000000000000000000000000000000000000000
--- a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/Make/options
+++ /dev/null
@@ -1,6 +0,0 @@
-EXE_INC = \
-    -I$(LIB_SRC)/finiteVolume/lnInclude \
-    -I$(LIB_SRC)/transportModels/incompressible/lnInclude
-
-LIB_LIBS = \
-    -lincompressibleTransportModels
diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.C b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.C
deleted file mode 100644
index 82a195dca955430147ad60e125aeb61721a83a7c..0000000000000000000000000000000000000000
--- a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.C
+++ /dev/null
@@ -1,124 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 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 "adiabaticPerfectFluid.H"
-#include "volFields.H"
-#include "addToRunTimeSelectionTable.H"
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-namespace Foam
-{
-namespace phaseEquationsOfState
-{
-    defineTypeNameAndDebug(adiabaticPerfectFluid, 0);
-
-    addToRunTimeSelectionTable
-    (
-        phaseEquationOfState,
-        adiabaticPerfectFluid,
-        dictionary
-    );
-}
-}
-
-
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-Foam::phaseEquationsOfState::adiabaticPerfectFluid::adiabaticPerfectFluid
-(
-    const dictionary& dict
-)
-:
-    phaseEquationOfState(dict),
-    p0_("p0", dimPressure, dict.lookup("p0")),
-    rho0_("rho0", dimDensity, dict.lookup("rho0")),
-    gamma_("gamma", dimless, dict.lookup("gamma")),
-    B_("B", dimPressure, dict.lookup("B"))
-{}
-
-
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-Foam::phaseEquationsOfState::adiabaticPerfectFluid::~adiabaticPerfectFluid()
-{}
-
-
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-Foam::tmp<Foam::volScalarField>
-Foam::phaseEquationsOfState::adiabaticPerfectFluid::rho
-(
-    const volScalarField& p,
-    const volScalarField& T
-) const
-{
-    return tmp<Foam::volScalarField>
-    (
-        new volScalarField
-        (
-            IOobject
-            (
-                "rho",
-                p.time().timeName(),
-                p.mesh(),
-                IOobject::NO_READ,
-                IOobject::NO_WRITE,
-                false
-            ),
-            rho0_*pow((p + B_)/(p0_ + B_), 1.0/gamma_)
-        )
-    );
-}
-
-
-Foam::tmp<Foam::volScalarField>
-Foam::phaseEquationsOfState::adiabaticPerfectFluid::psi
-(
-    const volScalarField& p,
-    const volScalarField& T
-) const
-{
-    return tmp<Foam::volScalarField>
-    (
-        new volScalarField
-        (
-            IOobject
-            (
-                "psi",
-                p.time().timeName(),
-                p.mesh(),
-                IOobject::NO_READ,
-                IOobject::NO_WRITE,
-                false
-            ),
-            (rho0_/(gamma_*(p0_ + B_)))
-           *pow((p + B_)/(p0_ + B_), 1.0/gamma_ - 1.0)
-        )
-    );
-}
-
-
-// ************************************************************************* //
diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/constant/constant.C b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/constant/constant.C
deleted file mode 100644
index 54b6705dd9e1597cf6c37bbbaa02bef1ed5c9492..0000000000000000000000000000000000000000
--- a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/constant/constant.C
+++ /dev/null
@@ -1,120 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 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 "constant.H"
-#include "volFields.H"
-#include "addToRunTimeSelectionTable.H"
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-namespace Foam
-{
-namespace phaseEquationsOfState
-{
-    defineTypeNameAndDebug(constant, 0);
-
-    addToRunTimeSelectionTable
-    (
-        phaseEquationOfState,
-        constant,
-        dictionary
-    );
-}
-}
-
-
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-Foam::phaseEquationsOfState::constant::constant
-(
-    const dictionary& dict
-)
-:
-    phaseEquationOfState(dict),
-    rho_("rho", dimDensity, dict.lookup("rho"))
-{}
-
-
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-Foam::phaseEquationsOfState::constant::~constant()
-{}
-
-
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::constant::rho
-(
-    const volScalarField& p,
-    const volScalarField& T
-) const
-{
-    return tmp<Foam::volScalarField>
-    (
-        new volScalarField
-        (
-            IOobject
-            (
-                "rho",
-                p.time().timeName(),
-                p.mesh(),
-                IOobject::NO_READ,
-                IOobject::NO_WRITE,
-                false
-            ),
-            p.mesh(),
-            rho_
-        )
-    );
-}
-
-
-Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::constant::psi
-(
-    const volScalarField& p,
-    const volScalarField& T
-) const
-{
-    return tmp<Foam::volScalarField>
-    (
-        new volScalarField
-        (
-            IOobject
-            (
-                "psi",
-                p.time().timeName(),
-                p.mesh(),
-                IOobject::NO_READ,
-                IOobject::NO_WRITE,
-                false
-            ),
-            p.mesh(),
-            dimensionedScalar("psi", dimDensity/dimPressure, 0)
-        )
-    );
-}
-
-
-// ************************************************************************* //
diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/linear/linear.C b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/linear/linear.C
deleted file mode 100644
index 3680735a1bccfa2d61f1dc1abe980ee4db2a8e42..0000000000000000000000000000000000000000
--- a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/linear/linear.C
+++ /dev/null
@@ -1,120 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 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 "linear.H"
-#include "volFields.H"
-#include "addToRunTimeSelectionTable.H"
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-namespace Foam
-{
-namespace phaseEquationsOfState
-{
-    defineTypeNameAndDebug(linear, 0);
-
-    addToRunTimeSelectionTable
-    (
-        phaseEquationOfState,
-        linear,
-        dictionary
-    );
-}
-}
-
-
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-Foam::phaseEquationsOfState::linear::linear
-(
-    const dictionary& dict
-)
-:
-    phaseEquationOfState(dict),
-    rho0_("rho0", dimDensity, dict.lookup("rho0")),
-    psi_("psi", dimDensity/dimPressure, dict.lookup("psi"))
-{}
-
-
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-Foam::phaseEquationsOfState::linear::~linear()
-{}
-
-
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::linear::rho
-(
-    const volScalarField& p,
-    const volScalarField& T
-) const
-{
-    return tmp<Foam::volScalarField>
-    (
-        new volScalarField
-        (
-            IOobject
-            (
-                "rho",
-                p.time().timeName(),
-                p.mesh(),
-                IOobject::NO_READ,
-                IOobject::NO_WRITE,
-                false
-            ),
-            rho0_ + psi_*p
-        )
-    );
-}
-
-
-Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::linear::psi
-(
-    const volScalarField& p,
-    const volScalarField& T
-) const
-{
-    return tmp<Foam::volScalarField>
-    (
-        new volScalarField
-        (
-            IOobject
-            (
-                "psi",
-                p.time().timeName(),
-                p.mesh(),
-                IOobject::NO_READ,
-                IOobject::NO_WRITE,
-                false
-            ),
-            p.mesh(),
-            psi_
-        )
-    );
-}
-
-
-// ************************************************************************* //
diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/perfectFluid/perfectFluid.C b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/perfectFluid/perfectFluid.C
deleted file mode 100644
index 6a148d8d689a77c28b511265ce55255c0e34b725..0000000000000000000000000000000000000000
--- a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/perfectFluid/perfectFluid.C
+++ /dev/null
@@ -1,119 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 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 "perfectFluid.H"
-#include "volFields.H"
-#include "addToRunTimeSelectionTable.H"
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-namespace Foam
-{
-namespace phaseEquationsOfState
-{
-    defineTypeNameAndDebug(perfectFluid, 0);
-
-    addToRunTimeSelectionTable
-    (
-        phaseEquationOfState,
-        perfectFluid,
-        dictionary
-    );
-}
-}
-
-
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-Foam::phaseEquationsOfState::perfectFluid::perfectFluid
-(
-    const dictionary& dict
-)
-:
-    phaseEquationOfState(dict),
-    rho0_("rho0", dimDensity, dict.lookup("rho0")),
-    R_("R", dimensionSet(0, 2, -2, -1, 0), dict.lookup("R"))
-{}
-
-
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-Foam::phaseEquationsOfState::perfectFluid::~perfectFluid()
-{}
-
-
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::perfectFluid::rho
-(
-    const volScalarField& p,
-    const volScalarField& T
-) const
-{
-    return tmp<Foam::volScalarField>
-    (
-        new volScalarField
-        (
-            IOobject
-            (
-                "rho",
-                p.time().timeName(),
-                p.mesh(),
-                IOobject::NO_READ,
-                IOobject::NO_WRITE,
-                false
-            ),
-            rho0_ + psi(p, T)*p
-        )
-    );
-}
-
-
-Foam::tmp<Foam::volScalarField> Foam::phaseEquationsOfState::perfectFluid::psi
-(
-    const volScalarField& p,
-    const volScalarField& T
-) const
-{
-    return tmp<Foam::volScalarField>
-    (
-        new volScalarField
-        (
-            IOobject
-            (
-                "psi",
-                p.time().timeName(),
-                p.mesh(),
-                IOobject::NO_READ,
-                IOobject::NO_WRITE,
-                false
-            ),
-            1.0/(R_*T)
-        )
-    );
-}
-
-
-// ************************************************************************* //
diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/phaseEquationOfState.H b/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/phaseEquationOfState.H
deleted file mode 100644
index 45a5079d0d98671696515eb1deed507b3cfcf881..0000000000000000000000000000000000000000
--- a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/phaseEquationOfState.H
+++ /dev/null
@@ -1,127 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 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/>.
-
-Class
-    Foam::phaseEquationOfState
-
-Description
-    A2stract base-class for dispersed-phase particle diameter models.
-
-SourceFiles
-    phaseEquationOfState.C
-    newDiameterModel.C
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef phaseEquationOfState_H
-#define phaseEquationOfState_H
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#include "dictionary.H"
-#include "volFieldsFwd.H"
-#include "runTimeSelectionTables.H"
-
-namespace Foam
-{
-
-/*---------------------------------------------------------------------------*\
-                           Class phaseEquationOfState Declaration
-\*---------------------------------------------------------------------------*/
-
-class phaseEquationOfState
-{
-protected:
-
-    // Protected data
-
-        const dictionary& dict_;
-
-
-public:
-
-    //- Runtime type information
-    TypeName("phaseEquationOfState");
-
-
-    // Declare runtime construction
-
-        declareRunTimeSelectionTable
-        (
-            autoPtr,
-            phaseEquationOfState,
-            dictionary,
-            (
-                const dictionary& dict
-            ),
-            (dict)
-        );
-
-
-    // Constructors
-
-        phaseEquationOfState
-        (
-            const dictionary& dict
-        );
-
-
-    //- Destructor
-    virtual ~phaseEquationOfState();
-
-
-    // Selectors
-
-        static autoPtr<phaseEquationOfState> New
-        (
-            const dictionary& dict
-        );
-
-
-    // Member Functions
-
-        //- Return the phase density
-        virtual tmp<volScalarField> rho
-        (
-            const volScalarField& p,
-            const volScalarField& T
-        ) const = 0;
-
-        //- Return the phase compressibility
-        virtual tmp<volScalarField> psi
-        (
-            const volScalarField& p,
-            const volScalarField& T
-        ) const = 0;
-};
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/Make/files b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..1cd0a09577c241265ce500c16b0df145a4aa3b2c
--- /dev/null
+++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/Make/files
@@ -0,0 +1,3 @@
+twoPhaseMixtureThermo.C
+
+LIB = $(FOAM_LIBBIN)/libtwoPhaseMixtureThermo
diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/Make/options b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/Make/options
new file mode 100644
index 0000000000000000000000000000000000000000..8dbf02aa064f4b84035f1add8501ab51a817af5f
--- /dev/null
+++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/Make/options
@@ -0,0 +1,10 @@
+EXE_INC = \
+    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
+    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
+    -I$(LIB_SRC)/finiteVolume/lnInclude
+
+LIB_LIBS = \
+    -lfluidThermophysicalModels \
+    -lspecie \
+    -ltwoPhaseMixture \
+    -lfiniteVolume
diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C
new file mode 100644
index 0000000000000000000000000000000000000000..d81f5ccb1f249ff004711bfaeef3ca9bf4049ae0
--- /dev/null
+++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C
@@ -0,0 +1,335 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "twoPhaseMixtureThermo.H"
+#include "gradientEnergyFvPatchScalarField.H"
+#include "mixedEnergyFvPatchScalarField.H"
+
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(twoPhaseMixtureThermo, 0);
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::twoPhaseMixtureThermo::twoPhaseMixtureThermo
+(
+    const fvMesh& mesh
+)
+:
+    psiThermo(mesh, word::null),
+    twoPhaseMixture(mesh, *this),
+    thermo1_(NULL),
+    thermo2_(NULL)
+{
+    {
+        volScalarField T1("T" + phase1Name(), T_);
+        T1.write();
+    }
+
+    {
+        volScalarField T2("T" + phase2Name(), T_);
+        T2.write();
+    }
+
+    thermo1_ = rhoThermo::New(mesh, phase1Name());
+    thermo2_ = rhoThermo::New(mesh, phase2Name());
+
+    thermo1_->validate(phase1Name(), "e");
+    thermo2_->validate(phase2Name(), "e");
+
+    correct();
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::twoPhaseMixtureThermo::~twoPhaseMixtureThermo()
+{}
+
+
+// * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
+
+void Foam::twoPhaseMixtureThermo::correct()
+{
+    thermo1_->he() = thermo1_->he(p_, T_);
+    thermo1_->correct();
+
+    thermo2_->he() = thermo2_->he(p_, T_);
+    thermo2_->correct();
+
+    psi_ = alpha1()*thermo1_->psi() + alpha2()*thermo2_->psi();
+    mu_ = alpha1()*thermo1_->mu() + alpha2()*thermo2_->mu();
+    alpha_ = alpha1()*thermo1_->alpha() + alpha2()*thermo2_->alpha();
+}
+
+
+bool Foam::twoPhaseMixtureThermo::incompressible() const
+{
+    return thermo1_->incompressible() && thermo2_->incompressible();
+}
+
+
+bool Foam::twoPhaseMixtureThermo::isochoric() const
+{
+    return thermo1_->isochoric() && thermo2_->isochoric();
+}
+
+
+Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::he
+(
+    const volScalarField& p,
+    const volScalarField& T
+) const
+{
+    return alpha1()*thermo1_->he(p, T) + alpha2()*thermo2_->he(p, T);
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::he
+(
+    const scalarField& p,
+    const scalarField& T,
+    const labelList& cells
+) const
+{
+    return
+        scalarField(alpha1(), cells)*thermo1_->he(p, T, cells)
+      + scalarField(alpha2(), cells)*thermo2_->he(p, T, cells);
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::he
+(
+    const scalarField& p,
+    const scalarField& T,
+    const label patchi
+) const
+{
+    return
+        alpha1().boundaryField()[patchi]*thermo1_->he(p, T, patchi)
+      + alpha2().boundaryField()[patchi]*thermo2_->he(p, T, patchi);
+}
+
+
+Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::hc() const
+{
+    return alpha1()*thermo1_->hc() + alpha2()*thermo2_->hc();
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::THE
+(
+    const scalarField& h,
+    const scalarField& p,
+    const scalarField& T0,
+    const labelList& cells
+) const
+{
+    notImplemented("twoPhaseMixtureThermo::THE(...)");
+    return T0;
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::THE
+(
+    const scalarField& h,
+    const scalarField& p,
+    const scalarField& T0,
+    const label patchi
+) const
+{
+    notImplemented("twoPhaseMixtureThermo::THE(...)");
+    return T0;
+}
+
+
+Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::Cp() const
+{
+    return alpha1()*thermo1_->Cp() + alpha2()*thermo2_->Cp();
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::Cp
+(
+    const scalarField& p,
+    const scalarField& T,
+    const label patchi
+) const
+{
+    return
+        alpha1().boundaryField()[patchi]*thermo1_->Cp(p, T, patchi)
+      + alpha2().boundaryField()[patchi]*thermo2_->Cp(p, T, patchi);
+}
+
+
+Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::Cv() const
+{
+    return alpha1()*thermo1_->Cv() + alpha2()*thermo2_->Cv();
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::Cv
+(
+    const scalarField& p,
+    const scalarField& T,
+    const label patchi
+) const
+{
+    return
+        alpha1().boundaryField()[patchi]*thermo1_->Cv(p, T, patchi)
+      + alpha2().boundaryField()[patchi]*thermo2_->Cv(p, T, patchi);
+}
+
+
+Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::gamma() const
+{
+    return alpha1()*thermo1_->gamma() + alpha2()*thermo2_->gamma();
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::gamma
+(
+    const scalarField& p,
+    const scalarField& T,
+    const label patchi
+) const
+{
+    return
+        alpha1().boundaryField()[patchi]*thermo1_->gamma(p, T, patchi)
+      + alpha2().boundaryField()[patchi]*thermo2_->gamma(p, T, patchi);
+}
+
+
+Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::Cpv() const
+{
+    return alpha1()*thermo1_->Cpv() + alpha2()*thermo2_->Cpv();
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::Cpv
+(
+    const scalarField& p,
+    const scalarField& T,
+    const label patchi
+) const
+{
+    return
+        alpha1().boundaryField()[patchi]*thermo1_->Cpv(p, T, patchi)
+      + alpha2().boundaryField()[patchi]*thermo2_->Cpv(p, T, patchi);
+}
+
+
+Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::CpByCpv() const
+{
+    return
+        alpha1()*thermo1_->CpByCpv()
+      + alpha2()*thermo2_->CpByCpv();
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::CpByCpv
+(
+    const scalarField& p,
+    const scalarField& T,
+    const label patchi
+) const
+{
+    return
+        alpha1().boundaryField()[patchi]*thermo1_->CpByCpv(p, T, patchi)
+      + alpha2().boundaryField()[patchi]*thermo2_->CpByCpv(p, T, patchi);
+}
+
+
+Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::kappa() const
+{
+    return alpha1()*thermo1_->kappa() + alpha2()*thermo2_->kappa();
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::kappa
+(
+    const label patchi
+) const
+{
+    return
+        alpha1().boundaryField()[patchi]*thermo1_->kappa(patchi)
+      + alpha2().boundaryField()[patchi]*thermo2_->kappa(patchi);
+}
+
+
+Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::kappaEff
+(
+    const volScalarField& alphat
+) const
+{
+    return
+        alpha1()*thermo1_->kappaEff(alphat)
+      + alpha2()*thermo2_->kappaEff(alphat);
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::kappaEff
+(
+    const scalarField& alphat,
+    const label patchi
+) const
+{
+    return
+        alpha1().boundaryField()[patchi]*thermo1_->kappaEff(alphat, patchi)
+      + alpha2().boundaryField()[patchi]*thermo2_->kappaEff(alphat, patchi)
+    ;
+}
+
+
+Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::alphaEff
+(
+    const volScalarField& alphat
+) const
+{
+    return
+        alpha1()*thermo1_->alphaEff(alphat)
+      + alpha2()*thermo2_->alphaEff(alphat);
+}
+
+
+Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::alphaEff
+(
+    const scalarField& alphat,
+    const label patchi
+) const
+{
+    return
+        alpha1().boundaryField()[patchi]*thermo1_->alphaEff(alphat, patchi)
+      + alpha2().boundaryField()[patchi]*thermo2_->alphaEff(alphat, patchi)
+    ;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H
new file mode 100644
index 0000000000000000000000000000000000000000..608dc91a9b18718a506dbb403a83203a4f6c9d87
--- /dev/null
+++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H
@@ -0,0 +1,287 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+Class
+    Foam::twoPhaseMixtureThermo
+
+Description
+
+SourceFiles
+    twoPhaseMixtureThermoI.H
+    twoPhaseMixtureThermo.C
+    twoPhaseMixtureThermoIO.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef twoPhaseMixtureThermo_H
+#define twoPhaseMixtureThermo_H
+
+#include "rhoThermo.H"
+#include "psiThermo.H"
+#include "twoPhaseMixture.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                         Class twoPhaseMixtureThermo Declaration
+\*---------------------------------------------------------------------------*/
+
+class twoPhaseMixtureThermo
+:
+    public psiThermo,
+    public twoPhaseMixture
+{
+    // Private data
+
+        //- Thermo-package of phase 1
+        autoPtr<rhoThermo> thermo1_;
+
+        //- Thermo-package of phase 2
+        autoPtr<rhoThermo> thermo2_;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("twoPhaseMixtureThermo");
+
+
+    // Constructors
+
+        //- Construct from mesh
+        twoPhaseMixtureThermo
+        (
+            const fvMesh& mesh
+        );
+
+
+    //- Destructor
+    virtual ~twoPhaseMixtureThermo();
+
+
+    // Member Functions
+
+        const rhoThermo& thermo1() const
+        {
+            return thermo1_();
+        }
+
+        const rhoThermo& thermo2() const
+        {
+            return thermo2_();
+        }
+
+        rhoThermo& thermo1()
+        {
+            return thermo1_();
+        }
+
+        rhoThermo& thermo2()
+        {
+            return thermo2_();
+        }
+
+        //- Update properties
+        virtual void correct();
+
+        //- Return true if the equation of state is incompressible
+        //  i.e. rho != f(p)
+        virtual bool incompressible() const;
+
+        //- Return true if the equation of state is isochoric
+        //  i.e. rho = const
+        virtual bool isochoric() const;
+
+
+        // Access to thermodynamic state variables
+
+            //- Enthalpy/Internal energy [J/kg]
+            //  Non-const access allowed for transport equations
+            virtual volScalarField& he()
+            {
+                notImplemented("twoPhaseMixtureThermo::he()");
+                return thermo1_->he();
+            }
+
+            //- Enthalpy/Internal energy [J/kg]
+            virtual const volScalarField& he() const
+            {
+                notImplemented("twoPhaseMixtureThermo::he() const");
+                return thermo1_->he();
+            }
+
+            //- Enthalpy/Internal energy
+            //  for given pressure and temperature [J/kg]
+            virtual tmp<volScalarField> he
+            (
+                const volScalarField& p,
+                const volScalarField& T
+            ) const;
+
+            //- Enthalpy/Internal energy for cell-set [J/kg]
+            virtual tmp<scalarField> he
+            (
+                const scalarField& p,
+                const scalarField& T,
+                const labelList& cells
+            ) const;
+
+            //- Enthalpy/Internal energy for patch [J/kg]
+            virtual tmp<scalarField> he
+            (
+                const scalarField& p,
+                const scalarField& T,
+                const label patchi
+            ) const;
+
+            //- Chemical enthalpy [J/kg]
+            virtual tmp<volScalarField> hc() const;
+
+            //- Temperature from enthalpy/internal energy for cell-set
+            virtual tmp<scalarField> THE
+            (
+                const scalarField& h,
+                const scalarField& p,
+                const scalarField& T0,      // starting temperature
+                const labelList& cells
+            ) const;
+
+            //- Temperature from enthalpy/internal energy for patch
+            virtual tmp<scalarField> THE
+            (
+                const scalarField& h,
+                const scalarField& p,
+                const scalarField& T0,      // starting temperature
+                const label patchi
+            ) const;
+
+
+        // Fields derived from thermodynamic state variables
+
+            //- Heat capacity at constant pressure [J/kg/K]
+            virtual tmp<volScalarField> Cp() const;
+
+            //- Heat capacity at constant pressure for patch [J/kg/K]
+            virtual tmp<scalarField> Cp
+            (
+                const scalarField& p,
+                const scalarField& T,
+                const label patchi
+            ) const;
+
+            //- Heat capacity at constant volume [J/kg/K]
+            virtual tmp<volScalarField> Cv() const;
+
+            //- Heat capacity at constant volume for patch [J/kg/K]
+            virtual tmp<scalarField> Cv
+            (
+                const scalarField& p,
+                const scalarField& T,
+                const label patchi
+            ) const;
+
+            //- gamma = Cp/Cv []
+            virtual tmp<volScalarField> gamma() const;
+
+            //- gamma = Cp/Cv for patch []
+            virtual tmp<scalarField> gamma
+            (
+                const scalarField& p,
+                const scalarField& T,
+                const label patchi
+            ) const;
+
+            //- Heat capacity at constant pressure/volume [J/kg/K]
+            virtual tmp<volScalarField> Cpv() const;
+
+            //- Heat capacity at constant pressure/volume for patch [J/kg/K]
+            virtual tmp<scalarField> Cpv
+            (
+                const scalarField& p,
+                const scalarField& T,
+                const label patchi
+            ) const;
+
+            //- Heat capacity ratio []
+            virtual tmp<volScalarField> CpByCpv() const;
+
+            //- Heat capacity ratio for patch []
+            virtual tmp<scalarField> CpByCpv
+            (
+                const scalarField& p,
+                const scalarField& T,
+                const label patchi
+            ) const;
+
+
+        // Fields derived from transport state variables
+
+            //- Thermal diffusivity for temperature of mixture [J/m/s/K]
+            virtual tmp<volScalarField> kappa() const;
+
+            //- Thermal diffusivity of mixture for patch [J/m/s/K]
+            virtual tmp<scalarField> kappa
+            (
+                const label patchi
+            ) const;
+
+            //- Effective thermal diffusivity of mixture [J/m/s/K]
+            virtual tmp<volScalarField> kappaEff
+            (
+                const volScalarField& alphat
+            ) const;
+
+            //- Effective thermal diffusivity of mixture for patch [J/m/s/K]
+            virtual tmp<scalarField> kappaEff
+            (
+                const scalarField& alphat,
+                const label patchi
+            ) const;
+
+            //- Effective thermal diffusivity of mixture [J/m/s/K]
+            virtual tmp<volScalarField> alphaEff
+            (
+                const volScalarField& alphat
+            ) const;
+
+            //- Effective thermal diffusivity of mixture for patch [J/m/s/K]
+            virtual tmp<scalarField> alphaEff
+            (
+                const scalarField& alphat,
+                const label patchi
+            ) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/EEqns.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/EEqns.H
index b64277749ee75097a985f1db9f60f45503d0a61c..1f12fc9a121bcdafe7f9ea906210bbd83d6c140c 100644
--- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/EEqns.H
+++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/EEqns.H
@@ -19,34 +19,46 @@
 
     fvScalarMatrix he1Eqn
     (
-        fvm::ddt(alpha1, he1)
-      + fvm::div(alphaPhi1, he1)
+        fvm::ddt(alpha1, he1) + fvm::div(alphaPhi1, he1)
+      + fvc::ddt(alpha1, K1) + fvc::div(alphaPhi1, K1)
 
         // Compressibity correction
       - fvm::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), he1)
+      - (fvc::ddt(alpha1) + fvc::div(alphaPhi1))*K1
+
+      + (
+            he1.name() == thermo1.phasePropertyName("e")
+          ? fvc::div(alphaPhi1, p)
+          : -dalpha1pdt
+        )/rho1
 
       - fvm::laplacian(k1, he1)
      ==
         heatTransferCoeff*(thermo2.T() - thermo1.T())/rho1
       + heatTransferCoeff*he1/Cpv1/rho1
       - fvm::Sp(heatTransferCoeff/Cpv1/rho1, he1)
-      + alpha1*(dpdt/rho1 - (fvc::ddt(K1) + fvc::div(phi1, K1)))
     );
 
     fvScalarMatrix he2Eqn
     (
-        fvm::ddt(alpha2, he2)
-      + fvm::div(alphaPhi2, he2)
+        fvm::ddt(alpha2, he2) + fvm::div(alphaPhi2, he2)
+      + fvc::ddt(alpha2, K2) + fvc::div(alphaPhi2, K2)
 
         // Compressibity correction
       - fvm::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), he2)
+      - (fvc::ddt(alpha2) + fvc::div(alphaPhi2))*K2
+
+      + (
+            he2.name() == thermo2.phasePropertyName("e")
+          ? fvc::div(alphaPhi2, p)
+          : -dalpha2pdt
+        )/rho2
 
       - fvm::laplacian(k2, he2)
      ==
         heatTransferCoeff*(thermo1.T() - thermo2.T())/rho2
       + heatTransferCoeff*he2/Cpv2/rho2
       - fvm::Sp(heatTransferCoeff/Cpv2/rho2, he2)
-      + alpha2*(dpdt/rho2 - (fvc::ddt(K2) + fvc::div(phi2, K2)))
     );
 
     he1Eqn.relax();
diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/UEqns.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/UEqns.H
index ce5c622f9a041b5e4e6df0bf81cbdbc7c8c584ba..ae22926c4e79f29ebf2ebdaccca548933218a9d1 100644
--- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/UEqns.H
+++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/UEqns.H
@@ -1,3 +1,7 @@
+mrfZones.correctBoundaryVelocity(U1);
+mrfZones.correctBoundaryVelocity(U2);
+mrfZones.correctBoundaryVelocity(U);
+
 fvVectorMatrix U1Eqn(U1, U1.dimensions()*dimVol/dimTime);
 fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime);
 
diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/alphaEqn.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/alphaEqn.H
index a20f53e014692a610610356ab2441b092ac885de..601ff0e919a5b3537f01799ae3a425ede07dae43 100644
--- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/alphaEqn.H
+++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/alphaEqn.H
@@ -104,6 +104,35 @@ surfaceScalarField alphaPhi2("alphaPhi" + phase2Name, phi2);
             {
                 alphaPhi1 = alphaPhic1;
             }
+
+            /*
+            // Legacy semi-implicit and potentially unbounded form
+            fvScalarMatrix alpha1Eqn
+            (
+                fvm::ddt(alpha1)
+              + fvm::div(phic, alpha1, alphaScheme)
+              + fvm::div
+                (
+                    -fvc::flux(-phir, alpha2, alpharScheme),
+                    alpha1,
+                    alpharScheme
+                )
+             ==
+               fvm::Sp(Sp, alpha1) + Su
+            );
+
+            alpha1Eqn.relax();
+            alpha1Eqn.solve();
+
+            if (nAlphaSubCycles > 1)
+            {
+                alphaPhi1 += (runTime.deltaT()/totalDeltaT)*alpha1Eqn.flux();
+            }
+            else
+            {
+                alphaPhi1 = alpha1Eqn.flux();
+            }
+            */
         }
 
         if (g0.value() > 0.0)
diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H
index cf19664d853ac63669070fd1db6c440380ce4b1d..cc5b3ebe21915bc2b19c97c32a3bc067a28b73d7 100644
--- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H
+++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H
@@ -62,10 +62,10 @@
 
     volScalarField& p = thermo1.p();
 
-    volScalarField rho1("rho" + phase1Name, thermo1.rho());
+    volScalarField& rho1 = thermo1.rho();
     const volScalarField& psi1 = thermo1.psi();
 
-    volScalarField rho2("rho" + phase2Name, thermo2.rho());
+    volScalarField& rho2 = thermo2.rho();
     const volScalarField& psi2 = thermo2.psi();
 
     volVectorField U
@@ -275,8 +275,8 @@
     );
 
 
-    Info<< "Creating field dpdt\n" << endl;
-    volScalarField dpdt
+    Info<< "Creating field dalpha1pdt\n" << endl;
+    volScalarField dalpha1pdt
     (
         IOobject
         (
@@ -285,7 +285,20 @@
             mesh
         ),
         mesh,
-        dimensionedScalar("dpdt", p.dimensions()/dimTime, 0)
+        dimensionedScalar("dalpha1pdt", p.dimensions()/dimTime, 0)
+    );
+
+    Info<< "Creating field dalpha2pdt\n" << endl;
+    volScalarField dalpha2pdt
+    (
+        IOobject
+        (
+            "dpdt",
+            runTime.timeName(),
+            mesh
+        ),
+        mesh,
+        dimensionedScalar("dalpha2pdt", p.dimensions()/dimTime, 0)
     );
 
     Info<< "Creating field kinetic energy K\n" << endl;
diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H
index f9a7807d00d46f51c83c8ee2f21679866b898d68..02e49b56618430559a3482700ec6fa02971f22c9 100644
--- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H
+++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H
@@ -1,7 +1,4 @@
 {
-    rho1 = thermo1.rho();
-    rho2 = thermo2.rho();
-
     surfaceScalarField alpha1f(fvc::interpolate(alpha1));
     surfaceScalarField alpha2f(scalar(1) - alpha1f);
 
@@ -91,10 +88,7 @@
     tmp<fvScalarMatrix> pEqnComp1;
     tmp<fvScalarMatrix> pEqnComp2;
 
-    //if (transonic)
-    //{
-    //}
-    //else
+    if (pimple.transonic())
     {
         surfaceScalarField phid1
         (
@@ -107,17 +101,42 @@
             fvc::interpolate(psi2)*phi2
         );
 
+        pEqnComp1 =
+            fvc::ddt(rho1)
+          + fvc::div(phi1, rho1) - fvc::Sp(fvc::div(phi1), rho1)
+          + correction
+            (
+                psi1*fvm::ddt(p)
+              + fvm::div(phid1, p) - fvm::Sp(fvc::div(phid1), p)
+            );
+        deleteDemandDrivenData(pEqnComp1().faceFluxCorrectionPtr());
+        pEqnComp1().relax();
+
+        pEqnComp2 =
+            fvc::ddt(rho2)
+          + fvc::div(phi2, rho2) - fvc::Sp(fvc::div(phi2), rho2)
+          + correction
+            (
+                psi2*fvm::ddt(p)
+              + fvm::div(phid2, p) - fvm::Sp(fvc::div(phid2), p)
+            );
+        deleteDemandDrivenData(pEqnComp2().faceFluxCorrectionPtr());
+        pEqnComp2().relax();
+    }
+    else
+    {
         pEqnComp1 =
             fvc::ddt(rho1) + psi1*correction(fvm::ddt(p))
-          + fvc::div(phid1, p)
-          - fvc::Sp(fvc::div(phid1), p);
+          + fvc::div(phi1, rho1) - fvc::Sp(fvc::div(phi1), rho1);
 
         pEqnComp2 =
             fvc::ddt(rho2) + psi2*correction(fvm::ddt(p))
-          + fvc::div(phid2, p)
-          - fvc::Sp(fvc::div(phid2), p);
+          + fvc::div(phi2, rho2) - fvc::Sp(fvc::div(phi2), rho2);
     }
 
+    // Cache p prior to solve for density update
+    volScalarField p_0(p);
+
     while (pimple.correctNonOrthogonal())
     {
         fvScalarMatrix pEqnIncomp
@@ -182,16 +201,20 @@
 
     p = max(p, pMin);
 
-    thermo1.correct();
-    thermo2.correct();
-    rho1 = thermo1.rho();
-    rho2 = thermo2.rho();
+    // Update densities from change in p
+    rho1 += psi1*(p - p_0);
+    rho2 += psi2*(p - p_0);
 
     K1 = 0.5*magSqr(U1);
     K2 = 0.5*magSqr(U2);
 
     if (thermo1.dpdt())
     {
-        dpdt = fvc::ddt(p);
+        dalpha1pdt = fvc::ddt(alpha1, p);
+    }
+
+    if (thermo2.dpdt())
+    {
+        dalpha2pdt = fvc::ddt(alpha2, p);
     }
 }
diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C
index 5dff309b57c1f4d17df847dc175e7305f04376d9..112a30218896b55c184c7d8740956f602a8b9474 100644
--- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C
+++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C
@@ -26,6 +26,7 @@ License
 #include "phaseModel.H"
 #include "diameterModel.H"
 #include "fixedValueFvPatchFields.H"
+#include "slipFvPatchFields.H"
 #include "surfaceInterpolate.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
@@ -118,7 +119,11 @@ Foam::phaseModel::phaseModel
 
         forAll(U_.boundaryField(), i)
         {
-            if (isA<fixedValueFvPatchVectorField>(U_.boundaryField()[i]))
+            if
+            (
+                isA<fixedValueFvPatchVectorField>(U_.boundaryField()[i])
+             || isA<slipFvPatchVectorField>(U_.boundaryField()[i])
+            )
             {
                 phiTypes[i] = fixedValueFvPatchScalarField::typeName;
             }
diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C
index 7580c3f9ac17fee77f35432ace060fd65c4470c2..3d1b93f429c460c6987f6260dc3a492d8b8f0926 100644
--- a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C
+++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C
@@ -41,7 +41,7 @@ Description
 #include "MULES.H"
 #include "subCycle.H"
 #include "interfaceProperties.H"
-#include "twoPhaseMixture.H"
+#include "incompressibleTwoPhaseMixture.H"
 #include "turbulenceModel.H"
 #include "fvcSmooth.H"
 #include "pimpleControl.H"
diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/Make/options b/applications/solvers/multiphase/interFoam/LTSInterFoam/Make/options
index b5c7b88e4f82a4f201b9b7e397402c11a2cd8fb9..33560b54e64a17538ef23339bd195840edaff4a7 100644
--- a/applications/solvers/multiphase/interFoam/LTSInterFoam/Make/options
+++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/Make/options
@@ -1,5 +1,6 @@
 EXE_INC = \
     -I.. \
+    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
     -I$(LIB_SRC)/transportModels \
     -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
     -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
@@ -11,7 +12,8 @@ EXE_INC = \
 
 EXE_LIBS = \
     -linterfaceProperties \
-    -ltwoPhaseInterfaceProperties \
+    -ltwoPhaseMixture \
+    -ltwoPhaseProperties \
     -lincompressibleTransportModels \
     -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqn.H b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqn.H
index 5f5ac824b8aacfdd77227f03bdcba07026870939..faae19767035025223dbd22b6be483d7dc6d6ace 100644
--- a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqn.H
+++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqn.H
@@ -18,7 +18,7 @@
             )
           + fvc::flux
             (
-                -fvc::flux(-phir, scalar(1) - alpha1, alpharScheme),
+                -fvc::flux(-phir, alpha2, alpharScheme),
                 alpha1,
                 alpharScheme
             )
@@ -27,6 +27,7 @@
         MULES::explicitLTSSolve(alpha1, phi, phiAlpha, 1, 0);
         //MULES::explicitSolve(alpha1, phi, phiAlpha, 1, 0);
 
+        alpha2 = 1.0 - alpha1;
         rhoPhi = phiAlpha*(rho1 - rho2) + phi*rho2;
     }
 
diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H
index 6c82f940499ea39567db1e400274832dfa354b0f..57c78027a471f712cf06e17486b62fcd05cd3014 100644
--- a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H
+++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H
@@ -23,4 +23,4 @@ else
     #include "alphaEqn.H"
 }
 
-rho == alpha1*rho1 + (scalar(1) - alpha1)*rho2;
+rho == alpha1*rho1 + alpha2*rho2;
diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C
index 99cc1dd8bd62bd46a76fcb44f3ff89b5a83d822c..b819068ddd53f56d6af4456906466158eace7f51 100644
--- a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C
+++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C
@@ -40,7 +40,7 @@ Description
 #include "MULES.H"
 #include "subCycle.H"
 #include "interfaceProperties.H"
-#include "twoPhaseMixture.H"
+#include "incompressibleTwoPhaseMixture.H"
 #include "turbulenceModel.H"
 #include "IOMRFZoneList.H"
 #include "pimpleControl.H"
diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/Make/options b/applications/solvers/multiphase/interFoam/MRFInterFoam/Make/options
index b5c7b88e4f82a4f201b9b7e397402c11a2cd8fb9..db2e1736ee2101bfe80abb1e725574d36c3c320a 100644
--- a/applications/solvers/multiphase/interFoam/MRFInterFoam/Make/options
+++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/Make/options
@@ -1,5 +1,6 @@
 EXE_INC = \
     -I.. \
+    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
     -I$(LIB_SRC)/transportModels \
     -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
     -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
@@ -10,8 +11,9 @@ EXE_INC = \
     -I$(LIB_SRC)/sampling/lnInclude
 
 EXE_LIBS = \
+    -ltwoPhaseMixture \
     -linterfaceProperties \
-    -ltwoPhaseInterfaceProperties \
+    -ltwoPhaseProperties \
     -lincompressibleTransportModels \
     -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
diff --git a/applications/solvers/multiphase/interFoam/Make/options b/applications/solvers/multiphase/interFoam/Make/options
index b87380d8a1e515abe6dc6a27d643ef0f21d1e43b..b1cfcac9bd812c22bd62a4560d5c5b2d42ac20e6 100644
--- a/applications/solvers/multiphase/interFoam/Make/options
+++ b/applications/solvers/multiphase/interFoam/Make/options
@@ -1,4 +1,5 @@
 EXE_INC = \
+    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
     -I$(LIB_SRC)/transportModels \
     -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
     -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
@@ -9,8 +10,9 @@ EXE_INC = \
     -I$(LIB_SRC)/sampling/lnInclude
 
 EXE_LIBS = \
+    -ltwoPhaseMixture \
     -linterfaceProperties \
-    -ltwoPhaseInterfaceProperties \
+    -ltwoPhaseProperties \
     -lincompressibleTransportModels \
     -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
diff --git a/applications/solvers/multiphase/interFoam/alphaEqn.H b/applications/solvers/multiphase/interFoam/alphaEqn.H
index b96dcf898daaeaec279adcce7ac3f5916623089a..a2720e20eeec598b64ac4e783e175670069f98da 100644
--- a/applications/solvers/multiphase/interFoam/alphaEqn.H
+++ b/applications/solvers/multiphase/interFoam/alphaEqn.H
@@ -18,7 +18,7 @@
             )
           + fvc::flux
             (
-                -fvc::flux(-phir, scalar(1) - alpha1, alpharScheme),
+                -fvc::flux(-phir, alpha2, alpharScheme),
                 alpha1,
                 alpharScheme
             )
@@ -26,6 +26,7 @@
 
         MULES::explicitSolve(alpha1, phi, phiAlpha, 1, 0);
 
+        alpha2 = 1.0 - alpha1;
         rhoPhi = phiAlpha*(rho1 - rho2) + phi*rho2;
     }
 
diff --git a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H
index 6c82f940499ea39567db1e400274832dfa354b0f..57c78027a471f712cf06e17486b62fcd05cd3014 100644
--- a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H
+++ b/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H
@@ -23,4 +23,4 @@ else
     #include "alphaEqn.H"
 }
 
-rho == alpha1*rho1 + (scalar(1) - alpha1)*rho2;
+rho == alpha1*rho1 + alpha2*rho2;
diff --git a/applications/solvers/multiphase/interFoam/createFields.H b/applications/solvers/multiphase/interFoam/createFields.H
index df1edf04e1e4c1ef7f1cf802d4645bbe2c0ca122..f0d18098483634633a10f2c7ffb9068a06f91cb6 100644
--- a/applications/solvers/multiphase/interFoam/createFields.H
+++ b/applications/solvers/multiphase/interFoam/createFields.H
@@ -30,9 +30,10 @@
 
 
     Info<< "Reading transportProperties\n" << endl;
-    twoPhaseMixture twoPhaseProperties(U, phi);
+    incompressibleTwoPhaseMixture twoPhaseProperties(U, phi);
 
     volScalarField& alpha1(twoPhaseProperties.alpha1());
+    volScalarField& alpha2(twoPhaseProperties.alpha2());
 
     const dimensionedScalar& rho1 = twoPhaseProperties.rho1();
     const dimensionedScalar& rho2 = twoPhaseProperties.rho2();
@@ -48,7 +49,7 @@
             mesh,
             IOobject::READ_IF_PRESENT
         ),
-        alpha1*rho1 + (scalar(1) - alpha1)*rho2,
+        alpha1*rho1 + alpha2*rho2,
         alpha1.boundaryField().types()
     );
     rho.oldTime();
diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options b/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options
index 4fa14dd6d22655aa1fe2a693c0055c1c9ca0662f..2a5429f7a8a944497ef0d1a06da89c3dbb090948 100644
--- a/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options
+++ b/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options
@@ -1,5 +1,6 @@
 EXE_INC = \
     -I.. \
+    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
     -I$(LIB_SRC)/transportModels \
     -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
     -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
@@ -12,8 +13,9 @@ EXE_INC = \
     -I$(LIB_SRC)/sampling/lnInclude
 
 EXE_LIBS = \
+    -ltwoPhaseMixture \
     -linterfaceProperties \
-    -ltwoPhaseInterfaceProperties \
+    -ltwoPhaseProperties \
     -lincompressibleTransportModels \
     -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/correctPhi.H b/applications/solvers/multiphase/interFoam/interDyMFoam/correctPhi.H
index 0e373e1f404f7f747795202797049a0b212f367b..c4cdbc044bc772744e1769cce6ea5c4873de93c8 100644
--- a/applications/solvers/multiphase/interFoam/interDyMFoam/correctPhi.H
+++ b/applications/solvers/multiphase/interFoam/interDyMFoam/correctPhi.H
@@ -53,6 +53,8 @@
             fvc::makeRelative(phi, U);
         }
     }
-
-    #include "continuityErrs.H"
 }
+
+phi.oldTime() = phi;
+
+#include "continuityErrs.H"
diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C
index 1a9d210e23dd3df76df9c29f3b6e977a34d482ef..fa16f17141fa5b78af74044c339b792a90072798 100644
--- a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C
+++ b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C
@@ -37,7 +37,7 @@ Description
 #include "MULES.H"
 #include "subCycle.H"
 #include "interfaceProperties.H"
-#include "twoPhaseMixture.H"
+#include "incompressibleTwoPhaseMixture.H"
 #include "turbulenceModel.H"
 #include "pimpleControl.H"
 #include "fvIOoptionList.H"
diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C
index 53cc2719b93810902900bb6316a7d2a493fc6782..51f082b6165a6b494066241e7a988877eab86dd2 100644
--- a/applications/solvers/multiphase/interFoam/interFoam.C
+++ b/applications/solvers/multiphase/interFoam/interFoam.C
@@ -41,7 +41,7 @@ Description
 #include "MULES.H"
 #include "subCycle.H"
 #include "interfaceProperties.H"
-#include "twoPhaseMixture.H"
+#include "incompressibleTwoPhaseMixture.H"
 #include "turbulenceModel.H"
 #include "pimpleControl.H"
 #include "fvIOoptionList.H"
diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options b/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options
index 6c54b4454b840f8e0829378dedcbd0357cd67192..cc09aeb2f35740e5b384a56d387317ac8859693b 100644
--- a/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options
+++ b/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options
@@ -1,9 +1,10 @@
 EXE_INC = \
     -I.. \
+    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
     -IincompressibleThreePhaseMixture \
     -IthreePhaseInterfaceProperties \
     -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-    -I$(LIB_SRC)/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle \
+    -I$(LIB_SRC)/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle \
     -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
     -I$(LIB_SRC)/finiteVolume/lnInclude \
     -I$(LIB_SRC)/transportModels \
@@ -12,7 +13,8 @@ EXE_INC = \
     -I$(LIB_SRC)/sampling/lnInclude
 
 EXE_LIBS = \
-    -ltwoPhaseInterfaceProperties \
+    -ltwoPhaseMixture \
+    -ltwoPhaseProperties \
     -lincompressibleTransportModels \
     -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
diff --git a/applications/solvers/multiphase/interFoam/porousInterFoam/Make/options b/applications/solvers/multiphase/interFoam/porousInterFoam/Make/options
index b5c7b88e4f82a4f201b9b7e397402c11a2cd8fb9..db2e1736ee2101bfe80abb1e725574d36c3c320a 100644
--- a/applications/solvers/multiphase/interFoam/porousInterFoam/Make/options
+++ b/applications/solvers/multiphase/interFoam/porousInterFoam/Make/options
@@ -1,5 +1,6 @@
 EXE_INC = \
     -I.. \
+    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
     -I$(LIB_SRC)/transportModels \
     -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
     -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
@@ -10,8 +11,9 @@ EXE_INC = \
     -I$(LIB_SRC)/sampling/lnInclude
 
 EXE_LIBS = \
+    -ltwoPhaseMixture \
     -linterfaceProperties \
-    -ltwoPhaseInterfaceProperties \
+    -ltwoPhaseProperties \
     -lincompressibleTransportModels \
     -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
diff --git a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C
index ea1a15b03222b823fc93eed6ca22bfff3978bed4..39c81c7a8dc9fb58cc2bda021b6ed73177803688 100644
--- a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C
+++ b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C
@@ -42,7 +42,7 @@ Description
 #include "MULES.H"
 #include "subCycle.H"
 #include "interfaceProperties.H"
-#include "twoPhaseMixture.H"
+#include "incompressibleTwoPhaseMixture.H"
 #include "turbulenceModel.H"
 #include "IOporosityModelList.H"
 #include "pimpleControl.H"
diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/Make/options b/applications/solvers/multiphase/interPhaseChangeFoam/Make/options
index 5416a161a866fc1d66bd7b320079c1b5c7266fad..58b340781f2d35e0eb103fa024d80e92ad3bb1e5 100644
--- a/applications/solvers/multiphase/interPhaseChangeFoam/Make/options
+++ b/applications/solvers/multiphase/interPhaseChangeFoam/Make/options
@@ -1,4 +1,5 @@
 EXE_INC = \
+    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
     -I$(LIB_SRC)/transportModels \
     -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
     -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
@@ -7,8 +8,9 @@ EXE_INC = \
     -I$(LIB_SRC)/finiteVolume/lnInclude
 
 EXE_LIBS = \
+    -ltwoPhaseMixture \
     -linterfaceProperties \
-    -ltwoPhaseInterfaceProperties \
+    -ltwoPhaseProperties \
     -lincompressibleTransportModels \
     -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H b/applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H
index 7ff971ed7f7d36b31df61896e47146acdbdaeeca..817db5012c294263f4bf9bb2e14503b8584c4802 100644
--- a/applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H
+++ b/applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H
@@ -49,8 +49,6 @@
         }
     }
 
-    #include "continuityErrs.H"
-
     p == p_rgh + rho*gh;
 
     if (p_rgh.needReference())
diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C
index f1e8feec003e46603286ec3dfe3ea47a8a8ca069..08728c8f926b94c29e68b2c78ea8d89d310fbcba 100644
--- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C
+++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -24,7 +24,7 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "phaseChangeTwoPhaseMixture.H"
-#include "twoPhaseMixture.H"
+#include "incompressibleTwoPhaseMixture.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C
index 3a7c4c7a53d3c01a44836d9d215e1aed4ed5cf26..c08eba939067edd6151c61816c6ac510b2f25ffc 100644
--- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C
+++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -43,7 +43,7 @@ Foam::phaseChangeTwoPhaseMixture::phaseChangeTwoPhaseMixture
     const word& alpha1Name
 )
 :
-    twoPhaseMixture(U, phi, alpha1Name),
+    incompressibleTwoPhaseMixture(U, phi, alpha1Name),
     phaseChangeTwoPhaseMixtureCoeffs_(subDict(type + "Coeffs")),
     pSat_(lookup("pSat"))
 {}
@@ -76,7 +76,7 @@ Foam::phaseChangeTwoPhaseMixture::vDotP() const
 
 bool Foam::phaseChangeTwoPhaseMixture::read()
 {
-    if (twoPhaseMixture::read())
+    if (incompressibleTwoPhaseMixture::read())
     {
         phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
         lookup("pSat") >> pSat_;
diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.H b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.H
index fdfe30d5e7e831a1d4230dc28863878f517a95a5..fc81d080d3e4211b00c5b9da76d2cff28c8763e8 100644
--- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.H
+++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -35,7 +35,7 @@ SourceFiles
 #ifndef phaseChangeTwoPhaseMixture_H
 #define phaseChangeTwoPhaseMixture_H
 
-#include "twoPhaseMixture.H"
+#include "incompressibleTwoPhaseMixture.H"
 #include "typeInfo.H"
 #include "runTimeSelectionTables.H"
 #include "volFields.H"
@@ -54,7 +54,7 @@ namespace Foam
 
 class phaseChangeTwoPhaseMixture
 :
-    public twoPhaseMixture
+    public incompressibleTwoPhaseMixture
 {
 
 protected:
diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/UEqns.H b/applications/solvers/multiphase/multiphaseEulerFoam/UEqns.H
index a63ff3c85afccbd1d568e106e992bfcac185e684..7584d84f27e95d9a6ccfd6712120c7d3ba46d7a9 100644
--- a/applications/solvers/multiphase/multiphaseEulerFoam/UEqns.H
+++ b/applications/solvers/multiphase/multiphaseEulerFoam/UEqns.H
@@ -1,3 +1,5 @@
+#include "mrfZonesCorrectBCs.H"
+
 PtrList<fvVectorMatrix> UEqns(fluid.phases().size());
 autoPtr<multiphaseSystem::dragCoeffFields> dragCoeffs(fluid.dragCoeffs());
 
diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/mrfZonesCorrectBCs.H b/applications/solvers/multiphase/multiphaseEulerFoam/mrfZonesCorrectBCs.H
new file mode 100644
index 0000000000000000000000000000000000000000..d670aa4a41777cae4042a884de02975d6fb081d1
--- /dev/null
+++ b/applications/solvers/multiphase/multiphaseEulerFoam/mrfZonesCorrectBCs.H
@@ -0,0 +1,6 @@
+    forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter)
+    {
+        mrfZones.correctBoundaryVelocity(iter().U());
+    }
+
+    mrfZones.correctBoundaryVelocity(U);
diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C
index d1804b5b6dfe606997829f909b56a380df1fa2e7..acad49cd9663f44afdd51752269e3ddcf918a937 100644
--- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C
+++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.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
@@ -418,6 +418,47 @@ Foam::multiphaseSystem::multiphaseSystem
             ).ptr()
         );
     }
+
+    forAllConstIter(PtrDictionary<phaseModel>, phases_, iter1)
+    {
+        const phaseModel& phase1 = iter1();
+
+        forAllConstIter(PtrDictionary<phaseModel>, phases_, iter2)
+        {
+            const phaseModel& phase2 = iter2();
+
+            if (&phase2 != &phase1)
+            {
+                scalarCoeffSymmTable::const_iterator sigma
+                (
+                    sigmas_.find(interfacePair(phase1, phase2))
+                );
+
+                if (sigma != sigmas_.end())
+                {
+                    scalarCoeffSymmTable::const_iterator cAlpha
+                    (
+                        cAlphas_.find(interfacePair(phase1, phase2))
+                    );
+
+                    if (cAlpha == cAlphas_.end())
+                    {
+                        WarningIn
+                        (
+                            "multiphaseSystem::multiphaseSystem"
+                            "(const volVectorField& U,"
+                            "const surfaceScalarField& phi)"
+                        ) << "Compression coefficient not specified for "
+                             "phase pair ("
+                          << phase1.name() << ' ' << phase2.name()
+                          << ") for which a surface tension "
+                             "coefficient is specified"
+                          << endl;
+                    }
+                }
+            }
+        }
+    }
 }
 
 
diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseModel/phaseModel/phaseModel.C b/applications/solvers/multiphase/multiphaseEulerFoam/phaseModel/phaseModel/phaseModel.C
index 543927e29b59a54e9e8025d20b35d52175bd7641..f74ef12513cd362a9d7971c5c8e44b693fe72b92 100644
--- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseModel/phaseModel/phaseModel.C
+++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseModel/phaseModel/phaseModel.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -26,6 +26,7 @@ License
 #include "phaseModel.H"
 #include "diameterModel.H"
 #include "fixedValueFvPatchFields.H"
+#include "slipFvPatchFields.H"
 #include "surfaceInterpolate.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
@@ -152,7 +153,11 @@ Foam::phaseModel::phaseModel
 
         forAll(U_.boundaryField(), i)
         {
-            if (isA<fixedValueFvPatchVectorField>(U_.boundaryField()[i]))
+            if
+            (
+                isA<fixedValueFvPatchVectorField>(U_.boundaryField()[i])
+             || isA<slipFvPatchVectorField>(U_.boundaryField()[i])
+            )
             {
                 phiTypes[i] = fixedValueFvPatchScalarField::typeName;
             }
diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options b/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options
index 6e20519ec98d90ae8f38ba26587a05c72e39374c..53ea250a164143c1ffaa76a583187ac9520f1dae 100644
--- a/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options
+++ b/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options
@@ -1,5 +1,6 @@
 EXE_INC = \
     -I../interFoam \
+    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
     -I$(LIB_SRC)/transportModels \
     -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
     -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
@@ -7,7 +8,7 @@ EXE_INC = \
     -I$(LIB_SRC)/finiteVolume/lnInclude
 
 EXE_LIBS = \
-    -ltwoPhaseInterfaceProperties \
+    -ltwoPhaseMixture \
     -lincompressibleTransportModels \
     -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/alphaDiffusionEqn.H b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaDiffusionEqn.H
index 139646e43c6023c1486e3ee53dfdb0a14c63e158..6bc5953a4a6424f3bd28406e6f09ed88a8a30680 100644
--- a/applications/solvers/multiphase/twoLiquidMixingFoam/alphaDiffusionEqn.H
+++ b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaDiffusionEqn.H
@@ -12,7 +12,8 @@
 
     alpha1Eqn.solve();
 
+    alpha2 = 1.0 - alpha1;
     rhoPhi += alpha1Eqn.flux()*(rho1 - rho2);
 }
 
-rho = alpha1*rho1 + (scalar(1) - alpha1)*rho2;
+rho = alpha1*rho1 + alpha2*rho2;
diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H
index 6c82f940499ea39567db1e400274832dfa354b0f..57c78027a471f712cf06e17486b62fcd05cd3014 100644
--- a/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H
+++ b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H
@@ -23,4 +23,4 @@ else
     #include "alphaEqn.H"
 }
 
-rho == alpha1*rho1 + (scalar(1) - alpha1)*rho2;
+rho == alpha1*rho1 + alpha2*rho2;
diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/createFields.H b/applications/solvers/multiphase/twoLiquidMixingFoam/createFields.H
index 0d01b9a9e5ed82abc4a0420ece0ca464830b7b97..18b686f4f8afcfdcbf92f61f2e4f7c3a54d26893 100644
--- a/applications/solvers/multiphase/twoLiquidMixingFoam/createFields.H
+++ b/applications/solvers/multiphase/twoLiquidMixingFoam/createFields.H
@@ -29,9 +29,10 @@
     #include "createPhi.H"
 
     Info<< "Reading transportProperties\n" << endl;
-    twoPhaseMixture twoPhaseProperties(U, phi);
+    incompressibleTwoPhaseMixture twoPhaseProperties(U, phi);
 
     volScalarField& alpha1(twoPhaseProperties.alpha1());
+    volScalarField& alpha2(twoPhaseProperties.alpha2());
 
     const dimensionedScalar& rho1 = twoPhaseProperties.rho1();
     const dimensionedScalar& rho2 = twoPhaseProperties.rho2();
@@ -42,7 +43,7 @@
     dimensionedScalar alphatab(twoPhaseProperties.lookup("alphatab"));
 
     // Need to store rho for ddt(rho, U)
-    volScalarField rho("rho", alpha1*rho1 + (scalar(1) - alpha1)*rho2);
+    volScalarField rho("rho", alpha1*rho1 + alpha2*rho2);
     rho.oldTime();
 
 
diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C b/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C
index 6113aba01f1b42c4cda46109d3724f93fa4fdbda..8c51a402ee377d49a61b1429fbcfc4c7ddb34afc 100644
--- a/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.C
+++ b/applications/solvers/multiphase/twoLiquidMixingFoam/twoLiquidMixingFoam.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
@@ -34,7 +34,7 @@ Description
 #include "fvCFD.H"
 #include "MULES.H"
 #include "subCycle.H"
-#include "twoPhaseMixture.H"
+#include "incompressibleTwoPhaseMixture.H"
 #include "turbulenceModel.H"
 #include "pimpleControl.H"
 
diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C
index aebc7ba6cb01645ed9f638c4cb80501bfe8b0f3b..85ee12b3164f08028dc53ea236b4c0b0dc9f0fac 100644
--- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C
+++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,6 +25,7 @@ License
 
 #include "phaseModel.H"
 #include "fixedValueFvPatchFields.H"
+#include "slipFvPatchFields.H"
 #include "surfaceInterpolate.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
@@ -114,7 +115,11 @@ Foam::phaseModel::phaseModel
 
         forAll(U_.boundaryField(), i)
         {
-            if (isA<fixedValueFvPatchVectorField>(U_.boundaryField()[i]))
+            if
+            (
+                isA<fixedValueFvPatchVectorField>(U_.boundaryField()[i])
+             || isA<slipFvPatchVectorField>(U_.boundaryField()[i])
+            )
             {
                 phiTypes[i] = fixedValueFvPatchScalarField::typeName;
             }
diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C b/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C
index a0056d3c9ad52b4e6a2b7d55d18bc453b3a3824c..57f4e6858947f4ad9b49f667085c75726db6c577 100644
--- a/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C
+++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -181,7 +181,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
 
     gradient() =
     (
-        (traction_ + pressure_*n)/rho
+        (traction_ - pressure_*n)/rho
       + twoMuLambda*fvPatchField<vector>::snGrad() - (n & sigmaD)
     )/twoMuLambda;
 
diff --git a/applications/test/BinSum/Test-BinSum.C b/applications/test/BinSum/Test-BinSum.C
index f8d9532aeb14f12267790ca861ec33a7df79ed0a..873e7eb8939c8dfddd709ae40775ace2b3cac01c 100644
--- a/applications/test/BinSum/Test-BinSum.C
+++ b/applications/test/BinSum/Test-BinSum.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/test/Matrix/Test-Matrix.C b/applications/test/Matrix/Test-Matrix.C
index eac3e9a8e8d8a6ea10ed73d76fb00ebe82b4a506..9663ae82174efaeba5ae64f9b3406814f3bb6157 100644
--- a/applications/test/Matrix/Test-Matrix.C
+++ b/applications/test/Matrix/Test-Matrix.C
@@ -56,9 +56,9 @@ int main(int argc, char *argv[])
 
     Info<< hmm << endl;
 
-    SquareMatrix<scalar> hmm3(Sin);
+    //SquareMatrix<scalar> hmm3(Sin);
 
-    Info<< hmm3 << endl;
+    //Info<< hmm3 << endl;
 
     SquareMatrix<scalar> hmm4;
 
@@ -72,47 +72,14 @@ int main(int argc, char *argv[])
     Info<< hmm5 << endl;
 
     {
-        scalarSquareMatrix squareMatrix(3, 3, 0);
-
-        squareMatrix[0][0] = 4;
-        squareMatrix[0][1] = 12;
-        squareMatrix[0][2] = -16;
-        squareMatrix[1][0] = 12;
-        squareMatrix[1][1] = 37;
-        squareMatrix[1][2] = -43;
-        squareMatrix[2][0] = -16;
-        squareMatrix[2][1] = -43;
-        squareMatrix[2][2] = 98;
-
-        Info<< nl << "Square Matrix = " << squareMatrix << endl;
+        scalarSymmetricSquareMatrix symmMatrix(3, 3, 0);
 
-        scalarDiagonalMatrix rhs(3, 0);
-        rhs[0] = 1;
-        rhs[1] = 2;
-        rhs[2] = 3;
-
-        LUsolve(squareMatrix, rhs);
-
-        Info<< "Decomposition = " << squareMatrix << endl;
-        Info<< "Solution = " << rhs << endl;
-    }
-
-    {
-        scalarSymmetricSquareMatrix symmMatrix(4, 4, 0);
-
-        symmMatrix(0, 0) = 3.44854;
-
-        symmMatrix(1, 0) = -2.70766;
-        symmMatrix(1, 1) = 5.49922;
-
-        symmMatrix(2, 0) = -0.96245;
-        symmMatrix(2, 1) = 2.40948;
-        symmMatrix(2, 2) = 1.56918;
-
-        symmMatrix(3, 0) = 1.95912;
-        symmMatrix(3, 1) = -3.46118;
-        symmMatrix(3, 2) = -1.01410;
-        symmMatrix(3, 3) = 3.24753;
+        symmMatrix(0, 0) = 4;
+        symmMatrix(1, 0) = 12;
+        symmMatrix(1, 1) = 37;
+        symmMatrix(2, 0) = -16;
+        symmMatrix(2, 1) = -43;
+        symmMatrix(2, 2) = 98;
 
         Info<< "Symmetric Square Matrix = " << symmMatrix << endl;
 
@@ -125,11 +92,10 @@ int main(int argc, char *argv[])
         Info<< "Inverse = " << invDecomposed(symmMatrix2) << endl;
         Info<< "Determinant = " << detDecomposed(symmMatrix2) << endl;
 
-        scalarDiagonalMatrix rhs(4, 0);
+        scalarDiagonalMatrix rhs(3, 0);
         rhs[0] = 1;
         rhs[1] = 2;
         rhs[2] = 3;
-        rhs[3] = 4;
 
         LUsolve(symmMatrix, rhs);
 
@@ -138,20 +104,28 @@ int main(int argc, char *argv[])
     }
 
     {
-        IFstream str("datafile");
-        scalarSymmetricSquareMatrix symmMatrix(str);
-        Info<< "Symmetric Square Matrix = " << symmMatrix << endl;
+        scalarSquareMatrix squareMatrix(3, 3, 0);
 
-        Info<< "Inverse = " << inv(symmMatrix) << endl;
-        Info<< "Determinant (ans = 0.24130) = " << det(symmMatrix) << endl;
+        squareMatrix[0][0] = 4;
+        squareMatrix[0][1] = 12;
+        squareMatrix[0][2] = -16;
+        squareMatrix[1][0] = 12;
+        squareMatrix[1][1] = 37;
+        squareMatrix[1][2] = -43;
+        squareMatrix[2][0] = -16;
+        squareMatrix[2][1] = -43;
+        squareMatrix[2][2] = 98;
+
+        Info<< nl << "Square Matrix = " << squareMatrix << endl;
 
-        scalarDiagonalMatrix rhs(4, 0);
+        scalarDiagonalMatrix rhs(3, 0);
         rhs[0] = 1;
         rhs[1] = 2;
         rhs[2] = 3;
-        rhs[3] = 4;
 
-        LUsolve(symmMatrix, rhs);
+        LUsolve(squareMatrix, rhs);
+
+        Info<< "Decomposition = " << squareMatrix << endl;
         Info<< "Solution = " << rhs << endl;
     }
 
diff --git a/applications/test/PointEdgeWave/Test-PointEdgeWave.C b/applications/test/PointEdgeWave/Test-PointEdgeWave.C
index 229268d518b0e81d44c7449dd5d0e1ed88513d23..c49c8662c16263dde97baeaad40a6c156c306cde 100644
--- a/applications/test/PointEdgeWave/Test-PointEdgeWave.C
+++ b/applications/test/PointEdgeWave/Test-PointEdgeWave.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -41,50 +41,50 @@ using namespace Foam;
 
 int main(int argc, char *argv[])
 {
-    argList::validArgs.append("patch");
+    argList::validArgs.append("(patches)");
 
 #   include "setRootCase.H"
 #   include "createTime.H"
 #   include "createPolyMesh.H"
 
-    const polyBoundaryMesh& patches = mesh.boundaryMesh();
+    const polyBoundaryMesh& pbm = mesh.boundaryMesh();
 
-    // Get name of patch
-    const word patchName = args[1];
+    labelList patchIDs
+    (
+        pbm.patchSet(wordReList(IStringStream(args[1])())).sortedToc()
+    );
 
-    // Find the label in patches by name.
-    label patchI = patches.findPatchID(patchName);
+    Info<< "Starting walk from patches "
+        << UIndirectList<word>(pbm.names(), patchIDs)
+        << nl
+        << endl;
 
+    label nPoints = 0;
+    forAll(patchIDs, i)
     {
-        // Test whether any processor has patch
-        label maxPatchI = patchI;
-
-        reduce(maxPatchI, maxOp<label>());
-
-        if (maxPatchI == -1)
-        {
-            FatalErrorIn(args.executable())
-                << "Cannot find patch named " << patchName << exit(FatalError);
-        }
+        nPoints += pbm[patchIDs[i]].nPoints();
     }
 
+    Info<< "Seeding " << returnReduce(nPoints, sumOp<label>())
+        << " patch points" << nl << endl;
+
 
     // Set initial changed points to all the patch points(if patch present)
-    List<pointEdgePoint> wallInfo;
-    labelList wallPoints;
+    List<pointEdgePoint> wallInfo(nPoints);
+    labelList wallPoints(nPoints);
+    nPoints = 0;
 
-    if (patchI != -1)
+    forAll(patchIDs, i)
     {
         // Retrieve the patch now we have its index in patches.
-        const polyPatch& pp = mesh.boundaryMesh()[patchI];
-
-        wallPoints = pp.meshPoints();
-
-        wallInfo.setSize(pp.nPoints());
+        const polyPatch& pp = pbm[patchIDs[i]];
 
-        forAll(pp.localPoints(), ppI)
+        forAll(pp.meshPoints(), ppI)
         {
-            wallInfo[ppI] = pointEdgePoint(pp.localPoints()[ppI], 0.0);
+            label meshPointI = pp.meshPoints()[ppI];
+            wallPoints[nPoints] = meshPointI;
+            wallInfo[nPoints] = pointEdgePoint(mesh.points()[meshPointI], 0.0);
+            nPoints++;
         }
     }
 
diff --git a/applications/test/extendedStencil/Test-ExtendedStencil.C b/applications/test/extendedStencil/Test-ExtendedStencil.C
index 4a5ce855ef3a25904611c656adef574320ed25e9..72c1afb2c11b96322b9266c35c93ed9d58e34cb7 100644
--- a/applications/test/extendedStencil/Test-ExtendedStencil.C
+++ b/applications/test/extendedStencil/Test-ExtendedStencil.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -53,7 +53,9 @@ Description
 //#include "upwindCECCellToFaceStencilObject.H"
 
 //#include "upwindCFCCellToFaceStencilObject.H"
-#include "centredCFCFaceToCellStencilObject.H"
+//#include "centredCFCFaceToCellStencilObject.H"
+
+#include "centredCECCellToCellStencilObject.H"
 
 using namespace Foam;
 
@@ -437,20 +439,20 @@ int main(int argc, char *argv[])
     // ~~~~~~~~~~~~~~~~~~~~~
 
     {
-        const extendedCentredFaceToCellStencil& addressing =
-        centredCFCFaceToCellStencilObject::New
+        const extendedCentredCellToCellStencil& addressing =
+        centredCECCellToCellStencilObject::New
         (
             mesh
         );
 
-        Info<< "cellFaceCell:" << endl;
+        Info<< "cellCellCell:" << endl;
         writeStencilStats(addressing.stencil());
 
-        // Collect stencil face centres
+        // Collect stencil cell centres
         List<List<point> > stencilPoints(mesh.nCells());
         addressing.collectData
         (
-            mesh.Cf(),
+            mesh.C(),
             stencilPoints
         );
 
diff --git a/applications/test/momentOfInertia/Test-momentOfInertia.C b/applications/test/momentOfInertia/Test-momentOfInertia.C
index 73aaee649b2439555930d8209041ac878519c0e0..a1d9c7c13352f225b1a079c93fff0746c5c273cb 100644
--- a/applications/test/momentOfInertia/Test-momentOfInertia.C
+++ b/applications/test/momentOfInertia/Test-momentOfInertia.C
@@ -2,7 +2,7 @@
  =========                   |
  \\      /   F ield          | OpenFOAM: The Open Source CFD Toolbox
   \\    /    O peration      |
-   \\  /     A nd            | Copyright (C) 2012 OpenFOAM Foundation
+   \\  /     A nd            | Copyright (C) 2011-2013 OpenFOAM Foundation
     \\/      M anipulation   |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/test/router/Gather/Gather.C b/applications/test/router/Gather/Gather.C
index 24098b939e3b0df9f35ee0b0366d4bd08828f332..dd2035b6264ffb8eee4575b6fd53b65205562f2a 100644
--- a/applications/test/router/Gather/Gather.C
+++ b/applications/test/router/Gather/Gather.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -37,7 +37,7 @@ namespace Foam
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 // Construct from component
-template <class T0>
+template<class T0>
 Gather<T0>::Gather(const T0& localData, const bool redistribute)
 :
     List<T0>(0),
diff --git a/applications/test/router/Gather/Gather.H b/applications/test/router/Gather/Gather.H
index 337f7a690845fbfd20e18956d412fd491d61b778..678ad6c908b6557a35eba1062bbbf02d7b1b3cce 100644
--- a/applications/test/router/Gather/Gather.H
+++ b/applications/test/router/Gather/Gather.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -48,7 +48,7 @@ namespace Foam
                            Class Gather Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class T0>
+template<class T0>
 class Gather
 :
     public GatherBase,
diff --git a/applications/test/router/Gather/GatherBase.C b/applications/test/router/Gather/GatherBase.C
index ecba2768b97bd9e3cd9ea012fbbf3e4d55449554..553e41a818a849cdcd14a5a983032de567f23457 100644
--- a/applications/test/router/Gather/GatherBase.C
+++ b/applications/test/router/Gather/GatherBase.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -32,7 +32,7 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Type GatherBase::flatten(const List<Type> lst)
 {
     label sum = 0;
@@ -60,7 +60,7 @@ Type GatherBase::flatten(const List<Type> lst)
 }
 
 
-template <class DataType, class IndexType, class AddOp>
+template<class DataType, class IndexType, class AddOp>
 IndexType GatherBase::offset
 (
     const List<DataType>& values,
diff --git a/applications/test/router/Gather/GatherBase.H b/applications/test/router/Gather/GatherBase.H
index 6a90aef845f9bf675c13d9fbf0b822ab0cdc9a8c..b77e897836f6a208567876179ed8466f66780649 100644
--- a/applications/test/router/Gather/GatherBase.H
+++ b/applications/test/router/Gather/GatherBase.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -53,12 +53,12 @@ public:
 
         //- Flatten: appends all elements of list into one single list.
         //  Used to collapse 'Gathered' data.
-        template <class T>
+        template<class T>
         static T flatten(const List<T>);
 
         //- Flatten and offset 'Gathered' indices (into value) so they
         //  remain valid with respect to values (after they have been flattened)
-        template <class DataType, class IndexType, class AddOp>
+        template<class DataType, class IndexType, class AddOp>
         static IndexType offset
         (
             const List<DataType>& values,
@@ -68,7 +68,7 @@ public:
 };
 
 
-template <class T>
+template<class T>
 class AddOp
 {
 
diff --git a/applications/test/spline/Test-spline.C b/applications/test/spline/Test-spline.C
index 9254c2a3fa205579570b2ebf956cb30509c5398b..077e13a1df769aacb21131123a672eeff74694d3 100644
--- a/applications/test/spline/Test-spline.C
+++ b/applications/test/spline/Test-spline.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -22,6 +22,7 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 \*---------------------------------------------------------------------------*/
+
 #include "argList.H"
 
 #include "vector.H"
diff --git a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C
index b3a1f4ed96669a0be0b43c8b3e76cb3443ff9b74..cfa2868fdff417b2a7a85fd175fa8993888bc31a 100644
--- a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C
+++ b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C
@@ -2,16 +2,16 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    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 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
@@ -19,8 +19,10 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Application
+    PDRMesh
 
 Description
     Mesh and field preparation utility for PDR type simulations.
@@ -553,7 +555,6 @@ label findPatch(const polyBoundaryMesh& patches, const word& patchName)
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C
index b158dbae38ef9f340b70ce62395e17c0d95d83bc..44a02e234a265e088f1d05e18e31c7f0e4b86594 100644
--- a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C
+++ b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.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
@@ -21,6 +21,9 @@ 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
+    autoRefineMesh
+
 Description
     Utility to refine cells near to a surface.
 
@@ -615,7 +618,6 @@ void classifyCells
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C
index f617fd6ad1cacd0b5fce206be455ee5e0c54e99f..c2c9d0a0d3e10483a8443051bbbb6d5467c42898 100644
--- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C
+++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,8 +21,11 @@ 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
+    collapseEdges
+
 Description
-    Collapse short edges and combines edges that are in line.
+    Collapses short edges and combines edges that are in line.
 
     - collapse short edges. Length of edges to collapse provided as argument.
     - merge two edges if they are in line. Maximum angle provided as argument.
@@ -54,7 +57,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 int main(int argc, char *argv[])
 {
     timeSelector::addOptions(true, false);
diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C
index 8c8be624f040a21b0db6416559ac8b97cb2246c4..c9063c35b45aa56993a9eef3fed7ce815ca95a8a 100644
--- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C
+++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.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
@@ -21,10 +21,13 @@ 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
+    combinePatchFaces
+
 Description
-    Checks for multiple patch faces on same cell and combines them. These
-    result from e.g. refined neighbouring cells getting removed, leaving 4
-    exposed faces with same owner.
+    Checks for multiple patch faces on same cell and combines them.
+    Multiple patch faces can result from e.g. removal of refined
+    neighbouring cells, leaving 4 exposed faces with same owner.
 
     Rules for merging:
     - only boundary faces (since multiple internal faces between two cells
@@ -336,7 +339,6 @@ label mergeEdges(const scalar minCos, polyMesh& mesh)
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C
index eea69b7e51caea0a517b0db5b83495dd19f871b8..f92aad9fb03a73ab6a23b275f867dc0474fe1487 100644
--- a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C
+++ b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.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
@@ -21,6 +21,9 @@ 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
+    modifyMesh
+
 Description
     Manipulates mesh elements.
 
@@ -324,7 +327,6 @@ label findCell(const primitiveMesh& mesh, const point& nearPoint)
 
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C
index 94aecd2ffcef7a4b8f52e614d4a54ea2b0c37d09..b6669b0925cad3fdbc44abbf9e12661fcaa4e9fd 100644
--- a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C
+++ b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.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
@@ -21,6 +21,9 @@ 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
+    refineHexMesh
+
 Description
     Refines a hex mesh by 2x2x2 cell splitting.
 
@@ -48,7 +51,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 int main(int argc, char *argv[])
 {
 #   include "addOverwriteOption.H"
diff --git a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C
index 04637652d65d6a2720c63f44c80cb7837529a7d3..b0fcf3417fc53b3a481107ead63c8734eff7acb5 100644
--- a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C
+++ b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    refineWallLayer
+
 Description
     Utility to refine cells next to patches.
 
@@ -42,7 +45,6 @@ Description
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C b/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C
index 7181cb868a2ab1c7aeb26d3869f3f5c7209b92d1..a992deb519e617f74e14952c8c552b7861f137a9 100644
--- a/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C
+++ b/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    refinementLevel
+
 Description
     Tries to figure out what the refinement level is on refined cartesian
     meshes. Run BEFORE snapping.
@@ -92,7 +95,6 @@ bool limitRefinementLevel
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C
index 6c342f4cce3bc2d3f395654fd8976c6172abea99..96c0f7330a0137b40a35bf9336863959768e07fb 100644
--- a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C
+++ b/applications/utilities/mesh/advanced/removeFaces/removeFaces.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    removeFaces
+
 Description
     Utility to remove faces (combines cells on both sides).
 
@@ -43,7 +46,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/advanced/selectCells/selectCells.C b/applications/utilities/mesh/advanced/selectCells/selectCells.C
index dfa2a5ce24385391a8775ab1ce38c2ceda59b43f..41db908013d207db5be3c8ec277856b35315d35a 100644
--- a/applications/utilities/mesh/advanced/selectCells/selectCells.C
+++ b/applications/utilities/mesh/advanced/selectCells/selectCells.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    selectCells
+
 Description
     Select cells in relation to surface.
 
@@ -326,7 +329,6 @@ label selectOutsideCells
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/advanced/splitCells/splitCells.C b/applications/utilities/mesh/advanced/splitCells/splitCells.C
index f66d15e0ce65aab95a2282580c2ddf1430f67e43..ec1a480ad87924c9164cecca531174d49ca29056 100644
--- a/applications/utilities/mesh/advanced/splitCells/splitCells.C
+++ b/applications/utilities/mesh/advanced/splitCells/splitCells.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    splitCells
+
 Description
     Utility to split cells with flat faces.
 
@@ -513,7 +516,6 @@ void collectCuts
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C b/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C
index bc0314141829de2e7fcfc7b241026df47ee7680c..239bb208320756c1c3e41a2b8e396c5f985ae470 100644
--- a/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C
+++ b/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -577,7 +577,6 @@ void ReadCells
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
@@ -951,7 +950,8 @@ int main(int argc, char *argv[])
                     foamPatchSizes[patchI],
                     meshFaceI,
                     patchI,
-                    mesh.boundaryMesh()
+                    mesh.boundaryMesh(),
+                    patchType
                 );
         }
         else if (patchType == "symmetryplane")
@@ -963,7 +963,8 @@ int main(int argc, char *argv[])
                     foamPatchSizes[patchI],
                     meshFaceI,
                     patchI,
-                    mesh.boundaryMesh()
+                    mesh.boundaryMesh(),
+                    patchType
                 );
         }
         else if (patchType == "empty")
@@ -976,13 +977,14 @@ int main(int argc, char *argv[])
                     foamPatchSizes[patchI],
                     meshFaceI,
                     patchI,
-                    mesh.boundaryMesh()
+                    mesh.boundaryMesh(),
+                    patchType
                 );
         }
         else
         {
             // All other ccm types become straight polyPatch:
-            // 'inlet', 'outlet', 'pressured'.
+            // 'inlet', 'outlet', ...
             newPatches[patchI] =
                 new polyPatch
                 (
@@ -990,7 +992,8 @@ int main(int argc, char *argv[])
                     foamPatchSizes[patchI],
                     meshFaceI,
                     patchI,
-                    mesh.boundaryMesh()
+                    mesh.boundaryMesh(),
+                    word::null
                 );
         }
 
diff --git a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C
index 2d209691e22ec824507905169b320345de5a2871..e1e4cb5f6834ef8f8f677dd28807efbe0616c111 100644
--- a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C
+++ b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,7 +25,7 @@ Application
     cfx4ToFoam
 
 Description
-    Converts a CFX 4 mesh to OpenFOAM format
+    Converts a CFX 4 mesh to OpenFOAM format.
 
 \*---------------------------------------------------------------------------*/
 
@@ -43,7 +43,6 @@ Description
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/conversion/datToFoam/datToFoam.C b/applications/utilities/mesh/conversion/datToFoam/datToFoam.C
index 24e4e9ebad427e01cb1d1485a42d83e66c58239e..c10b7c761d9c3434ece7882334a8129c44d6771b 100644
--- a/applications/utilities/mesh/conversion/datToFoam/datToFoam.C
+++ b/applications/utilities/mesh/conversion/datToFoam/datToFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -40,7 +40,6 @@ Description
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/conversion/foamMeshToFluent/foamMeshToFluent.C b/applications/utilities/mesh/conversion/foamMeshToFluent/foamMeshToFluent.C
index f29d2e550a9f6fef030b85d0972be4a0e11ffb95..16f71860b1bc8b589302d131f91d289bcea33e6e 100644
--- a/applications/utilities/mesh/conversion/foamMeshToFluent/foamMeshToFluent.C
+++ b/applications/utilities/mesh/conversion/foamMeshToFluent/foamMeshToFluent.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    foamMeshToFluent
+
 Description
     Writes out the OpenFOAM mesh in Fluent mesh format.
 
@@ -33,7 +36,6 @@ Description
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C
index b16363e0b1d0a6c4ebd499fd7c9d288b2d382afe..9a239cf5a2da0e69d37160b0d6dd6325ef10f37b 100644
--- a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C
+++ b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -58,7 +58,6 @@ See Also
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C b/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C
index e95fc1efb54efc6c636463d76ef87be6694683c3..64c6e9dffd8351a86395006545ea0cccba023465 100644
--- a/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C
+++ b/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -50,7 +50,6 @@ Usage
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C
index 80296ab532594d2b967a30a6beeca1368867171b..1e807f38b7aab1b446112bea4bdafca148d9584c 100644
--- a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C
+++ b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,11 +21,15 @@ 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
+    gmshToFoam
+
 Description
     Reads .msh file as written by Gmsh.
 
     Needs surface elements on mesh to be present and aligned with outside faces
-    of the mesh. I.e. if the mesh is hexes, the outside faces need to be quads
+    of the mesh. I.e. if the mesh is hexes, the outside faces need to be
+    quads.
 
     Note: There is something seriously wrong with the ordering written in the
     .msh file. Normal operation is to check the ordering and invert prisms
@@ -38,6 +42,7 @@ Description
 
     A use of the cell zone information, is for field initialization with the
     "setFields" utility. see the classes:  topoSetSource, zoneToCell.
+
 \*---------------------------------------------------------------------------*/
 
 #include "argList.H"
@@ -745,7 +750,6 @@ void readCells
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
@@ -1059,7 +1063,7 @@ int main(int argc, char *argv[])
         {
             if (zoneFaces[zoneI].size())
             {
-                label physReg = zoneToPhys[zoneI];
+                label physReg = patchToPhys[zoneI];
 
                 Map<word>::const_iterator iter = physicalNames.find(physReg);
 
diff --git a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C
index 6b9e96b8725437a721619c7ac87ce66f9df8aa40..fb5df1f37015f8f4dfb4db3d12f493d5fae407ee 100644
--- a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C
+++ b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    ideasUnvToFoam
+
 Description
     I-Deas unv format mesh conversion.
 
@@ -650,7 +653,6 @@ label findPatch(const List<labelHashSet>& dofGroups, const face& f)
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
@@ -907,6 +909,8 @@ int main(int argc, char *argv[])
         {
             if (own[faceI] != -1 && nei[faceI] != -1)
             {
+                faceToCell[1].insert(faceI, own[faceI]);
+                faceToCell[0].insert(faceI, nei[faceI]);
                 cnt++;
             }
         }
diff --git a/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C b/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C
index b574b1525d4e28fc8d6df7f580e3069029f595d9..35160836ee3c7cdf6f53e79a4fe065345918d7d1 100644
--- a/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C
+++ b/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,7 +25,7 @@ Application
     kivaToFoam
 
 Description
-    Converts a KIVA3v grid to OpenFOAM format
+    Converts a KIVA3v grid to OpenFOAM format.
 
 \*---------------------------------------------------------------------------*/
 
@@ -54,7 +54,6 @@ enum kivaVersions
 };
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C b/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C
index 20b205a006015a1f0542d2d3551bc2baab8add16..13bda715db5e0c7fe2b525a534a8b85efa645eed 100644
--- a/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C
+++ b/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    mshToFoam
+
 Description
     Converts .msh file generated by the Adventure system.
 
@@ -50,7 +53,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C
index 38d564b178849dfc8f3423ea06748956a9384c2e..5cc4c77dcaa0177e212bcef35bf02f8d59cf9c9c 100644
--- a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C
+++ b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    netgenNeutralToFoam
+
 Description
     Converts neutral file format as written by Netgen v4.4.
 
@@ -83,7 +86,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C
index 361f13efadb5813445df8fb13c629d795317f206..ef5d5fd0a0cf5329614bb97b7cd80d3a4825a416 100644
--- a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C
+++ b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    plot3dToFoam
+
 Description
     Plot3d mesh (ascii/formatted format) converter.
 
@@ -50,7 +53,6 @@ Description
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C b/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C
index 0507be57f986fe720242331a87cbb1c7f65d2c50..8aba0df523ad03cd570b9e25d1a92bdd2463dd63 100644
--- a/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C
+++ b/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -34,7 +34,6 @@ Description
 #include "sammMesh.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//  Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/conversion/star3ToFoam/star3ToFoam.C b/applications/utilities/mesh/conversion/star3ToFoam/star3ToFoam.C
index 52b2a275c7082c72de2c2579bddb6a21315d2373..6b57de942362d63481d17b72ab87a930a58da26f 100644
--- a/applications/utilities/mesh/conversion/star3ToFoam/star3ToFoam.C
+++ b/applications/utilities/mesh/conversion/star3ToFoam/star3ToFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -34,7 +34,6 @@ Description
 #include "starMesh.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//  Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C
index ee270890410712356550bef41e1bf9a8923a6895..45491d1bd8758325d6c3a03b86d1b5ff7717ec19 100644
--- a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C
+++ b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -55,7 +55,6 @@ Note
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//  Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C
index d2cef35cd0218b8ade219a1a72a75ecf78195713..bc2121a02d91eb5d2d6caf238864c95de794db76 100644
--- a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C
+++ b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    tetgenToFoam
+
 Description
     Converts .ele and .node and .face files, written by tetgen.
 
@@ -92,7 +95,6 @@ label findFace(const primitiveMesh& mesh, const face& f)
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C b/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C
index 753246e43efd1de4738fb2f618c97d0da2e9c688..277b67242842b9b7bd6192886baba0d5085365f6 100644
--- a/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C
+++ b/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.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
@@ -41,7 +41,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C
index 068e8415abe5fa2f04a8683ef5fcdb69019636be..3b0a2269339a16d2e19b5662647e979902c03fde 100644
--- a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C
+++ b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    writeMeshObj
+
 Description
     For mesh debugging: writes mesh as three separate OBJ files which can
     be viewed with e.g. javaview.
@@ -368,7 +371,6 @@ void writePointCells
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C
index 097330487e2ab92d2a581bf0b02e487ba5b08b6a..95b8741e4323481683492e2eed8893d4fbd7ed30 100644
--- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C
+++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.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
@@ -65,7 +65,6 @@ Usage
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/generation/cv2DMesh/indexedFace.H b/applications/utilities/mesh/generation/cv2DMesh/indexedFace.H
index 0c30fcc952cc84f0894e7eb1476f0be0cf113ed3..257c988f6064dc23e60508a8885b8b1c61dfe475 100644
--- a/applications/utilities/mesh/generation/cv2DMesh/indexedFace.H
+++ b/applications/utilities/mesh/generation/cv2DMesh/indexedFace.H
@@ -70,7 +70,7 @@ public:
     typedef typename Fb::Vertex_handle                   Vertex_handle;
     typedef typename Fb::Face_handle                     Face_handle;
 
-    template < typename TDS2 >
+    template<typename TDS2>
     struct Rebind_TDS
     {
         typedef typename Fb::template Rebind_TDS<TDS2>::Other Fb2;
diff --git a/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/cellSizeAndAlignmentGrid.C b/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/cellSizeAndAlignmentGrid.C
index 454416299d2d2539171dbd73023db41d4cf00cc2..716d4cef154556814801c6c72461e0c086bc099d 100644
--- a/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/cellSizeAndAlignmentGrid.C
+++ b/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/cellSizeAndAlignmentGrid.C
@@ -54,7 +54,7 @@ using namespace Foam;
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 // Main program:
 
-template <class Triangulation, class Type>
+template<class Triangulation, class Type>
 Foam::tmp<Foam::Field<Type> > filterFarPoints
 (
     const Triangulation& mesh,
@@ -89,7 +89,7 @@ Foam::tmp<Foam::Field<Type> > filterFarPoints
 }
 
 
-template <class T>
+template<class T>
 autoPtr<mapDistribute> buildMap
 (
     const T& mesh,
@@ -153,7 +153,7 @@ autoPtr<mapDistribute> buildMap
 }
 
 
-template <class T>
+template<class T>
 Foam::tmp<Foam::triadField> buildAlignmentField(const T& mesh)
 {
     tmp<triadField> tAlignments
@@ -181,7 +181,7 @@ Foam::tmp<Foam::triadField> buildAlignmentField(const T& mesh)
 }
 
 
-template <class T>
+template<class T>
 Foam::tmp<Foam::pointField> buildPointField(const T& mesh)
 {
     tmp<pointField> tPoints
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.C
index 26fef8683c4a023d6118eea298ce24c3f7e8e9a7..eb23a2d7613343ee2b42baccb28eba1bbed691cf 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.C
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.C
@@ -33,7 +33,7 @@ License
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template <class Triangulation, class Type>
+template<class Triangulation, class Type>
 Foam::tmp<Foam::Field<Type> > Foam::smoothAlignmentSolver::filterFarPoints
 (
     const Triangulation& mesh,
@@ -68,7 +68,7 @@ Foam::tmp<Foam::Field<Type> > Foam::smoothAlignmentSolver::filterFarPoints
 }
 
 
-template <class Triangulation>
+template<class Triangulation>
 Foam::autoPtr<Foam::mapDistribute> Foam::smoothAlignmentSolver::buildReferredMap
 (
     const Triangulation& mesh,
@@ -111,7 +111,7 @@ Foam::autoPtr<Foam::mapDistribute> Foam::smoothAlignmentSolver::buildReferredMap
 }
 
 
-template <class Triangulation>
+template<class Triangulation>
 Foam::autoPtr<Foam::mapDistribute> Foam::smoothAlignmentSolver::buildMap
 (
     const Triangulation& mesh,
@@ -175,7 +175,7 @@ Foam::autoPtr<Foam::mapDistribute> Foam::smoothAlignmentSolver::buildMap
 }
 
 
-template <class Triangulation>
+template<class Triangulation>
 Foam::tmp<Foam::triadField> Foam::smoothAlignmentSolver::buildAlignmentField
 (
     const Triangulation& mesh
@@ -207,7 +207,7 @@ Foam::tmp<Foam::triadField> Foam::smoothAlignmentSolver::buildAlignmentField
 }
 
 
-template <class Triangulation>
+template<class Triangulation>
 Foam::tmp<Foam::pointField> Foam::smoothAlignmentSolver::buildPointField
 (
     const Triangulation& mesh
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.H
index fa158605c220c1cda7cd662e42e1c8af1cc7c93d..78fa0d2e09a15dbf4dcb305472d7f3ab0e183036 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.H
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.H
@@ -57,31 +57,31 @@ class smoothAlignmentSolver
 
     // Private Member Functions
 
-        template <class Triangulation, class Type>
+        template<class Triangulation, class Type>
         tmp<Field<Type> > filterFarPoints
         (
             const Triangulation& mesh,
             const Field<Type>& field
         );
 
-        template <class Triangulation>
+        template<class Triangulation>
         autoPtr<mapDistribute> buildMap
         (
             const Triangulation& mesh,
             labelListList& pointPoints
         );
 
-        template <class Triangulation>
+        template<class Triangulation>
         autoPtr<mapDistribute> buildReferredMap
         (
             const Triangulation& mesh,
             labelList& indices
         );
 
-        template <class Triangulation>
+        template<class Triangulation>
         tmp<triadField> buildAlignmentField(const Triangulation& mesh);
 
-        template <class Triangulation>
+        template<class Triangulation>
         tmp<pointField> buildPointField(const Triangulation& mesh);
 
         //- Disallow default bitwise copy construct
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H
index 02fe559580b3771e58ed9407a0d83b61eaddd53c..cce7c469c706a6dbf5b8b62aecf08cbdc0b853f7 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H
@@ -503,7 +503,7 @@ private:
         void insertInitialPoints();
 
         //- Calculate the worst load balance
-        template <class Triangulation>
+        template<class Triangulation>
         scalar calculateLoadUnbalance(const Triangulation& mesh) const;
 
         //- In parallel redistribute the backgroundMeshDecomposition and
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshTemplates.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshTemplates.C
index 4ac76d0949b7cfa6089af40c23747cfd115e6dea..dcc4a51dd1e6561eeb1dfed0cc6c2fd7a2329614 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshTemplates.C
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshTemplates.C
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Triangulation>
+template<class Triangulation>
 Foam::scalar Foam::conformalVoronoiMesh::calculateLoadUnbalance
 (
     const Triangulation& mesh
@@ -68,7 +68,7 @@ Foam::scalar Foam::conformalVoronoiMesh::calculateLoadUnbalance
 }
 
 
-template <class Triangulation>
+template<class Triangulation>
 bool Foam::conformalVoronoiMesh::distributeBackground(const Triangulation& mesh)
 {
     if (!Pstream::parRun())
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.H
index 4669110b6e9edbb95dd1e0a9ea240576f95a49fd..dd53a865379d63a84719704c1d7b3e0c86d0857b 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.H
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -118,7 +118,7 @@ public:
     typedef typename Cb::Vertex_handle                   Vertex_handle;
     typedef typename Cb::Cell_handle                     Cell_handle;
 
-    template < typename TDS2 >
+    template<typename TDS2>
     struct Rebind_TDS
     {
         typedef typename Cb::template Rebind_TDS<TDS2>::Other Cb2;
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellChecks.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellChecks.C
index 7213739844d2035931f2177751a37ac76311ea1a..5f42f0e352884c563cb1aac44f4ce0e75c50a20d 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellChecks.C
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellChecks.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -29,7 +29,7 @@ License
 #include "CGALTriangulation3DKernel.H"
 
 
-template <typename Cell>
+template<typename Cell>
 Foam::scalar Foam::cvMeshChecks::coplanarTet
 (
     Cell& c,
@@ -74,7 +74,7 @@ Foam::scalar Foam::cvMeshChecks::coplanarTet
 }
 
 
-template <typename Cell>
+template<typename Cell>
 bool Foam::cvMeshChecks::closePoints
 (
     Cell& c,
@@ -104,7 +104,7 @@ bool Foam::cvMeshChecks::closePoints
 }
 
 
-template <typename Cell>
+template<typename Cell>
 bool Foam::cvMeshChecks::smallVolume
 (
     Cell& c,
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellChecks.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellChecks.H
index c040eafab67c1b07447377de165db13fb32b7dce..64960b931c9793b6c18675633ccd940d09426050 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellChecks.H
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellChecks.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -34,21 +34,21 @@ namespace Foam
 namespace cvMeshChecks
 {
 
-    template <typename Cell>
+    template<typename Cell>
     scalar coplanarTet
     (
         Cell& c,
         const scalar tol = 1e-12
     );
 
-    template <typename Cell>
+    template<typename Cell>
     bool closePoints
     (
         Cell& c,
         const scalar tol = 1e-12
     );
 
-    template <typename Cell>
+    template<typename Cell>
     bool smallVolume
     (
         Cell& c,
diff --git a/applications/utilities/mesh/generation/cvMesh/vectorTools/vectorTools.H b/applications/utilities/mesh/generation/cvMesh/vectorTools/vectorTools.H
index 9fb39a159bafbfb8de882cb4b469fbf6e7d14af8..106755153e7a46b8299ac9ee371d4a4bc3430e35 100644
--- a/applications/utilities/mesh/generation/cvMesh/vectorTools/vectorTools.H
+++ b/applications/utilities/mesh/generation/cvMesh/vectorTools/vectorTools.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -52,7 +52,7 @@ namespace vectorTools
     //- Test if a and b are parallel: a.b = 1
     //  Uses the cross product, so the tolerance is proportional to
     //  the sine of the angle between a and b in radians
-    template <typename T>
+    template<typename T>
     bool areParallel
     (
         const Vector<T>& a,
@@ -69,7 +69,7 @@ namespace vectorTools
     //- Test if a and b are orthogonal: a.b = 0
     //  Uses the dot product, so the tolerance is proportional to
     //  the cosine of the angle between a and b in radians
-    template <typename T>
+    template<typename T>
     bool areOrthogonal
     (
         const Vector<T>& a,
@@ -81,7 +81,7 @@ namespace vectorTools
     }
 
     //- Test if angle between a and b is acute: a.b > 0
-    template <typename T>
+    template<typename T>
     bool areAcute
     (
         const Vector<T>& a,
@@ -92,7 +92,7 @@ namespace vectorTools
     }
 
     //- Test if angle between a and b is obtuse: a.b < 0
-    template <typename T>
+    template<typename T>
     bool areObtuse
     (
         const Vector<T>& a,
@@ -103,7 +103,7 @@ namespace vectorTools
     }
 
     //- Calculate angle between a and b in radians
-    template <typename T>
+    template<typename T>
     T cosPhi
     (
         const Vector<T>& a,
@@ -118,7 +118,7 @@ namespace vectorTools
     }
 
     //- Calculate angle between a and b in radians
-    template <typename T>
+    template<typename T>
     T radAngleBetween
     (
         const Vector<T>& a,
@@ -133,7 +133,7 @@ namespace vectorTools
     }
 
     //- Calculate angle between a and b in degrees
-    template <typename T>
+    template<typename T>
     T degAngleBetween
     (
         const Vector<T>& a,
diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C
index cdd6f52d15fce2954c01764e5f51700260adb9f3..f2c091e4adad7c2feedef870eb83e6f1980ec9e9 100644
--- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C
+++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C
@@ -21,6 +21,9 @@ 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
+    extrudeMesh
+
 Description
     Extrude mesh from existing patch (by default outwards facing normals;
     optional flips faces) or from patch read from file.
@@ -190,7 +193,6 @@ void updateFaceLabels(const mapPolyMesh& map, labelList& faceLabels)
 
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C
index 112de47faf92be168361d9d626ee8a027baea00f..34f97162852a3deda8ff73ca112603abdc93009e 100644
--- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C
+++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C
@@ -21,6 +21,9 @@ 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
+    extrudeToRegionMesh
+
 Description
     Extrude faceZones (internal or boundary faces) or faceSets (boundary faces
     only) into a separate mesh (as a different region).
@@ -1481,7 +1484,6 @@ void extrudeGeometricProperties
 
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.C
index 0bbe7d926a16733c25ff9b63d58ffea347a39642..178df8fa4a4e67da19d0d871ea550a6b49e18dd0 100644
--- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.C
+++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.H b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.H
index 3b6efd267efbcc44be597de5edac863b554c616d..20b07dae87134a6b51686561dc5c65042ebacb34 100644
--- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.H
+++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C
index 1b83599b31633309a0870dbd214139d25575182f..a63a88035b2f0ab3909fd5821f37e340e28e6909 100644
--- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C
+++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.H b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.H
index b7c81e68a29ed9e9b1e3f2bd3eae35b97ae86fe6..05ee88739702a8a6b16383485a3e2434efb82cbb 100644
--- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.H
+++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C
index 0b04d91b729aa9cf0938ada2756a569927aec3f7..363a60653ebb2d27a1cc7a94447bdac16ffacea8 100644
--- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C
+++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -108,7 +108,6 @@ static const NamedEnum<ExtrudeMode, 2> ExtrudeModeNames;
 //}
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict
index 99d1d5dcfbc2c7e149fccbf8bd00612760b169c8..f2a52c2e5b0abfb494eed576e019f185e2c45471 100644
--- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict
+++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict
@@ -337,55 +337,75 @@ addLayersControls
 
     // Advanced settings
 
-    // When not to extrude surface. 0 is flat surface, 90 is when two faces
-    // are perpendicular
-    featureAngle 60;
 
-    // At non-patched sides allow mesh to slip if extrusion direction makes
-    // angle larger than slipFeatureAngle.
-    slipFeatureAngle 30;
+    // Static analysis of starting mesh
 
-    // Maximum number of snapping relaxation iterations. Should stop
-    // before upon reaching a correct mesh.
-    nRelaxIter 5;
+        // When not to extrude surface. 0 is flat surface, 90 is when two faces
+        // are perpendicular
+        featureAngle 130;
+
+        // Stop layer growth on highly warped cells
+        maxFaceThicknessRatio 0.5;
+
+
+    // Patch displacement
+
+        // Number of smoothing iterations of surface normals
+        nSmoothSurfaceNormals 1;
+
+        // Smooth layer thickness over surface patches
+        nSmoothThickness 10;
+
+
+
+    // Medial axis analysis
+
+        // Angle used to pick up medial axis points
+        // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130
+        // in 17x.
+        minMedianAxisAngle 90;
+
+        // Reduce layer growth where ratio thickness to medial
+        // distance is large
+        maxThicknessToMedialRatio 0.3;
 
-    // Number of smoothing iterations of surface normals
-    nSmoothSurfaceNormals 1;
+        // Number of smoothing iterations of interior mesh movement direction
+        nSmoothNormals 3;
 
-    // Number of smoothing iterations of interior mesh movement direction
-    nSmoothNormals 3;
+        // Optional: smooth displacement after medial axis determination.
+        // default is 0.
+        nSmoothDisplacement 90;
 
-    // Smooth layer thickness over surface patches
-    nSmoothThickness 10;
 
-    // Stop layer growth on highly warped cells
-    maxFaceThicknessRatio 0.5;
+    // Mesh shrinking
 
-    // Reduce layer growth where ratio thickness to medial
-    // distance is large
-    maxThicknessToMedialRatio 0.3;
+        // Optional: at non-patched sides allow mesh to slip if extrusion
+        // direction makes angle larger than slipFeatureAngle. Default is
+        // 0.5*featureAngle.
+        slipFeatureAngle 30;
 
-    // Angle used to pick up medial axis points
-    // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x.
-    minMedianAxisAngle 90;
+        // Maximum number of snapping relaxation iterations. Should stop
+        // before upon reaching a correct mesh.
+        nRelaxIter 5;
 
-    // Create buffer region for new layer terminations
-    nBufferCellsNoExtrude 0;
+        // Create buffer region for new layer terminations
+        nBufferCellsNoExtrude 0;
 
-    // Overall max number of layer addition iterations. The mesher will exit
-    // if it reaches this number of iterations; possibly with an illegal
-    // mesh.
-    nLayerIter 50;
+        // Overall max number of layer addition iterations. The mesher will
+        // exit if it reaches this number of iterations; possibly with an
+        // illegal mesh.
+        nLayerIter 50;
 
-    // Max number of iterations after which relaxed meshQuality controls
-    // get used. Up to nRelaxIter it uses the settings in meshQualityControls,
-    // after nRelaxIter it uses the values in meshQualityControls::relaxed.
-    nRelaxedIter 20;
+        // Max number of iterations after which relaxed meshQuality controls
+        // get used. Up to nRelaxIter it uses the settings in
+        // meshQualityControls,
+        // after nRelaxIter it uses the values in meshQualityControls::relaxed.
+        nRelaxedIter 20;
 
-    // Additional reporting: if there are just a few faces where there
-    // are mesh errors (after adding the layers) print their face centres.
-    // This helps in tracking down problematic mesh areas.
-    //additionalReporting true;
+        // Additional reporting: if there are just a few faces where there
+        // are mesh errors (after adding the layers) print their face centres.
+        // This helps in tracking down problematic mesh areas.
+        //additionalReporting true;
 }
 
 // Generic mesh quality settings. At any undoable phase these determine
diff --git a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C
index e050ab9d9417d2b2723e92a3a2215f581a3e9090..6ee2ea56a24439c7582bd4257722301edc5afecb 100644
--- a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C
+++ b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    autoPatch
+
 Description
     Divides external faces into patches based on (user supplied) feature
     angle.
@@ -64,7 +67,6 @@ void collectFeatureEdges(const boundaryMesh& bMesh, labelList& markedEdges)
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C
index 12b948a43e6f34b06f90738aef24f1870690fe34..3245db0370d0ec4b35b9abb85a9fee99141252a2 100644
--- a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C
+++ b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.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
@@ -25,7 +25,7 @@ Application
     checkMesh
 
 Description
-    Checks validity of a mesh
+    Checks validity of a mesh.
 
 Usage
     - checkMesh [OPTION]
diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C
index 89beec32efee04e612c4ace9eab43c561032f1c5..fb53d4fef43eee2bb2521bb725cd66eb3c6a5f23 100644
--- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C
+++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.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
@@ -21,6 +21,9 @@ 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
+    createBaffles
+
 Description
     Makes internal faces into boundary faces. Does not duplicate points, unlike
     mergeOrSplitBaffles.
@@ -108,7 +111,6 @@ void modifyOrAddFace
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.C b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.C
index 1dbaaafaf8415d43339f57bfc499ac91cc3b32f7..04dbe07929ed96a0474109c32fdd149baf0a88ee 100644
--- a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.C
+++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -97,7 +97,7 @@ void Foam::faceSelections::searchableSurfaceSelection::select
 
     // Boundary faces
     vectorField neighbourCellCentres;
-    syncTools::swapBoundaryCellList
+    syncTools::swapBoundaryCellPositions
     (
         mesh_,
         mesh_.cellCentres(),
diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C
index 9e89c8d4dfc67f57522ba2ac516db98ccfe480b3..a2abec368c36bbe5974f9e0181ae06f9b26ebf2a 100644
--- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C
+++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.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
@@ -21,6 +21,9 @@ 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
+    createPatch
+
 Description
     Utility to create patches out of selected boundary faces. Faces come either
     from existing patches or from a faceSet.
@@ -288,7 +291,7 @@ void separateList
 
 
 // Synchronise points on both sides of coupled boundaries.
-template <class CombineOp>
+template<class CombineOp>
 void syncPoints
 (
     const polyMesh& mesh,
@@ -499,7 +502,6 @@ void syncPoints
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.C b/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.C
index 5bc667ff8a52b64bb0a3e3ae69a4417c96e19d97..00df77dfc522e7579b92dd2f32cde08872ca957c 100644
--- a/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.C
+++ b/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -38,7 +38,6 @@ Description
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//  Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/insideCells/insideCells.C b/applications/utilities/mesh/manipulation/insideCells/insideCells.C
index d2199ac74e681715fa1eb18213288c2dca5d07e8..58c8516450850091dc1d24d465ac2bd1721d809f 100644
--- a/applications/utilities/mesh/manipulation/insideCells/insideCells.C
+++ b/applications/utilities/mesh/manipulation/insideCells/insideCells.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    insideCells
+
 Description
     Picks up cells with cell centre 'inside' of surface.
     Requires surface to be closed and singly connected.
@@ -38,7 +41,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C b/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C
index 98304abf411840bb0f62e55480f6f0e7e4439946..46f59e91e8e63ac669a7d72d33776eebd0a61bed 100644
--- a/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C
+++ b/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.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
@@ -21,8 +21,11 @@ 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
+    mergeMeshes
+
 Description
-    Merge two meshes.
+    Merges two meshes.
 
 \*---------------------------------------------------------------------------*/
 
@@ -51,7 +54,6 @@ void getRootCase(fileName& casePath)
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMesh.C b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMesh.C
index e607080a66d3fb34b541b507823b929cd679f391..dc4c199a4a495bbde02c9154b531442cc1e3f516 100644
--- a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMesh.C
+++ b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMesh.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    mirrorMesh
+
 Description
     Mirrors a mesh around a given plane.
 
@@ -33,7 +36,6 @@ Description
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C
index 052cd9121006667120556a91bb305e4e9644e124..698a76b81f2546d8377277fae2476de8c5d62100 100644
--- a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C
+++ b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.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
@@ -103,7 +103,6 @@ void writeWeights(const polyMesh& mesh)
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/moveEngineMesh/moveEngineMesh.C b/applications/utilities/mesh/manipulation/moveEngineMesh/moveEngineMesh.C
index b64a68448eb1be654d0b54d87eebaf91c7fc7993..a804a1ab6ee546ae0fb2fded3f0f04bc90b41404 100644
--- a/applications/utilities/mesh/manipulation/moveEngineMesh/moveEngineMesh.C
+++ b/applications/utilities/mesh/manipulation/moveEngineMesh/moveEngineMesh.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
             << nl << endl;
     }
 
-    Info<< "\n end\n";
+    Info<< "End\n" << endl;
 
     return 0;
 }
diff --git a/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C b/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C
index 15ecb25ae5bd9117847eb713a746833edbb35cd8..dd30d5d038bc9cad330cfd40e36d491423dc79e8 100644
--- a/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C
+++ b/applications/utilities/mesh/manipulation/moveMesh/moveMesh.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,8 +21,11 @@ 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
+    moveMesh
+
 Description
-    Solver for moving meshes
+    Solver for moving meshes.
 
 \*---------------------------------------------------------------------------*/
 
@@ -34,7 +37,6 @@ Description
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C b/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C
index 4ff721f4857b61cf1746b3023cb9022b98c2ff77..375e38961b1625b10176931bc955a49055f055cf 100644
--- a/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C
+++ b/applications/utilities/mesh/manipulation/objToVTK/objToVTK.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    objToVTK
+
 Description
     Read obj line (not surface!) file and convert into vtk.
 
@@ -105,7 +108,6 @@ labelList parseVertices(const string& line)
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMeshApp.C b/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMeshApp.C
index 0969b1e5603517bf326af6d797dffd96eb470598..431656fefa5ef44c3663bda3166cd3fc58fa8505 100644
--- a/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMeshApp.C
+++ b/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMeshApp.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
@@ -21,8 +21,11 @@ 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
+    polyDualMesh
+
 Description
-    Calculate the dual of a polyMesh. Adheres to all the feature and patch
+    Calculates the dual of a polyMesh. Adheres to all the feature and patch
     edges.
 
 Usage
diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C
index 098864102d65185e290f572a5a50fcc2dca57b9a..cbb528e74d4525812f55d3cc00a8141775d372f2 100644
--- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C
+++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.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
@@ -21,6 +21,9 @@ 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
+    refineMesh
+
 Description
     Utility to refine cells in multiple directions.
 
@@ -287,7 +290,6 @@ label twoDNess(const polyMesh& mesh)
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
index d03f24cd7c2e4f442f2143b95c0ba59028420f28..af968f8120ff14fc37411db26fa67b86c36c494a 100644
--- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
+++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.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 anispulation  |
 -------------------------------------------------------------------------------
 License
@@ -494,7 +494,13 @@ autoPtr<mapPolyMesh> reorderMesh
                     newFlipMap[i] = fZone.flipMap()[i];
                 }
             }
-            fZone.resetAddressing(newAddressing, newFlipMap);
+            labelList newToOld;
+            sortedOrder(newAddressing, newToOld);
+            fZone.resetAddressing
+            (
+                UIndirectList<label>(newAddressing, newToOld)(),
+                UIndirectList<bool>(newFlipMap, newToOld)()
+            );
         }
     }
     // Re-do the cellZones
@@ -508,6 +514,7 @@ autoPtr<mapPolyMesh> reorderMesh
                 reverseCellOrder,
                 cellZones[zoneI]
             )();
+            Foam::sort(cellZones[zoneI]);
         }
     }
 
diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C
index 0ea97db164106ca759ee245b913a88b7651fefd2..7caeb3fd0d3f4d9556858b67e3419e7a50e5dc25 100644
--- a/applications/utilities/mesh/manipulation/setSet/setSet.C
+++ b/applications/utilities/mesh/manipulation/setSet/setSet.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
@@ -21,6 +21,9 @@ 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
+    setSet
+
 Description
     Manipulate a cell/face/point/ set or zone interactively.
 
@@ -806,7 +809,6 @@ commandStatus parseAction(const word& actionName)
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C
index c3d3d6297afa1938c22edbba58e65b5d3259a5cc..60484b356a2f708a2bbc63c5fb943730c729bb4e 100644
--- a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C
+++ b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.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
@@ -21,6 +21,9 @@ 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
+    setsToZones
+
 Description
     Add pointZones/faceZones/cellZones to the mesh from similar named
     pointSets/faceSets/cellSets.
@@ -54,7 +57,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C b/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C
index facacddcb0203315bd37a97ac3e803775e2baea8..bef13a2dca7055b9f61db339b761e04aad8d362c 100644
--- a/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C
+++ b/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -28,8 +28,7 @@ Description
     Reads all fields and maps them to a mesh with all internal faces removed
     (singleCellFvMesh) which gets written to region "singleCell".
 
-    Used to generate mesh and fields
-    that can be used for boundary-only data.
+    Used to generate mesh and fields that can be used for boundary-only data.
     Might easily result in illegal mesh though so only look at boundaries
     in paraview.
 
@@ -68,7 +67,6 @@ void interpolateFields
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C b/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C
index b39c8d1f10118368d5ad2d8b367a4ad8ffd80052..46f3ca3137c92214a9dbf70aba330cab67b9b4c2 100644
--- a/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C
+++ b/applications/utilities/mesh/manipulation/splitMesh/splitMesh.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    splitMesh
+
 Description
     Splits mesh by making internal faces external. Uses attachDetach.
 
@@ -105,7 +108,6 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
index b57e181a03684ca1ff7708a2f94722bbe5117bc5..9771757c9edea8022c98326a7daeb9c0de171730 100644
--- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
+++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.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
@@ -85,6 +85,7 @@ Description
         this is the original facelabel+1, for a turned face this is -facelabel-1
         - boundaryRegionAddressing : for every patch in this region the
         patch in the original mesh (or -1 if added patch)
+
 \*---------------------------------------------------------------------------*/
 
 #include "SortableList.H"
@@ -1396,7 +1397,6 @@ void writeCellToRegion(const fvMesh& mesh, const labelList& cellRegion)
 
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
@@ -1404,6 +1404,7 @@ int main(int argc, char *argv[])
     (
         "splits mesh into multiple regions (detected by walking across faces)"
     );
+#   include "addRegionOption.H"
     #include "addOverwriteOption.H"
     argList::addBoolOption
     (
@@ -1467,7 +1468,7 @@ int main(int argc, char *argv[])
     #include "setRootCase.H"
     #include "createTime.H"
     runTime.functionObjects().off();
-    #include "createMesh.H"
+    #include "createNamedMesh.H"
     const word oldInstance = mesh.pointsInstance();
 
     word blockedFacesName;
diff --git a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C
index 63097809505f238293650b9061f78787198f7943..90601e8730f9b0d95fd989888dc8f91a76530993 100644
--- a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C
+++ b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    stitchMesh
+
 Description
     'Stitches' a mesh.
 
@@ -190,7 +193,6 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C
index a3358770a82f1bbf748cd1cad672d4de4289d4bd..74c5fe0bf635e34531220feb05165217df381a9a 100644
--- a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C
+++ b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.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
@@ -21,11 +21,15 @@ 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
+    subsetMesh
+
 Description
     Selects a section of mesh based on a cellSet.
 
     The utility sub-sets the mesh to choose only a part of interest. Check
-    the setSet/cellSet utilities to see how to select cells based on various.
+    the setSet/cellSet/topoSet utilities to see how to select cells based on
+    various shapes.
 
     The mesh will subset all points, faces and cells needed to make a sub-mesh
     but will not preserve attached boundary types.
@@ -146,7 +150,6 @@ void subsetPointFields
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSet.C b/applications/utilities/mesh/manipulation/topoSet/topoSet.C
index 6dee4fd0b509ff679245d5ed4f31b440bc4a1f4d..a64c051a09cb9e9c8fdcad41614a342c9b94fa80 100644
--- a/applications/utilities/mesh/manipulation/topoSet/topoSet.C
+++ b/applications/utilities/mesh/manipulation/topoSet/topoSet.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
@@ -21,6 +21,9 @@ 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
+    topoSet
+
 Description
     Operates on cellSets/faceSets/pointSets through a dictionary.
 
@@ -188,7 +191,6 @@ polyMesh::readUpdateState meshReadUpdate(polyMesh& mesh)
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C
index d7a07bf667bc2f98e9147f9988117435b1baa22a..26900011e93c75fad0c28d6df46479434ae63034 100644
--- a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C
+++ b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -137,7 +137,6 @@ void rotateFields(const argList& args, const Time& runTime, const tensor& T)
 }
 
 
-//  Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/miscellaneous/expandDictionary/expandDictionary.C b/applications/utilities/miscellaneous/expandDictionary/expandDictionary.C
index 36f9d859ff8f37262950645717640df967e0124c..1b8ecac86d086750eb52230ef5f97410d8d90ea9 100644
--- a/applications/utilities/miscellaneous/expandDictionary/expandDictionary.C
+++ b/applications/utilities/miscellaneous/expandDictionary/expandDictionary.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -59,7 +59,6 @@ Note
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//  Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options
index 6fa4104188a79deb511308fe1cf34d9e80243768..43f0c24cb535928cd2280c59b22338245ddebd46 100644
--- a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options
+++ b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options
@@ -63,5 +63,5 @@ EXE_LIBS = \
     -lthermophysicalFunctions \
     -ltopoChangerFvMesh \
     -ltriSurface \
-    -ltwoPhaseInterfaceProperties \
+    -ltwoPhaseProperties \
     -lutilityFunctionObjects
diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C b/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C
index 4c74174e2e2db63a0801477f95f09b0d25f2ff87..1943b7d631b49ce7503f7429c5238b96e2e5ece1 100644
--- a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C
+++ b/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,8 +21,11 @@ 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
+    foamDebugSwitches
+
 Description
-    Write out all library debug switches
+    Write out all library debug switches.
 
 \*---------------------------------------------------------------------------*/
 
@@ -35,7 +38,6 @@ Description
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C
index 8104f9e7c3f8736d5754e51661e7289b6863dc3b..e5f04b1ca2cea659fa271aa151b27e156ffdbab3 100644
--- a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C
+++ b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.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
@@ -139,7 +139,6 @@ bool writeZones(const word& name, const fileName& meshDir, Time& runTime)
 
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundaryTemplates.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundaryTemplates.C
index f2ce4a0f006a411142109fbf77454bcc20fd9ddf..15ef8f484800818decc76c27c4aa4e921154fd78 100644
--- a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundaryTemplates.C
+++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundaryTemplates.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,6 @@ 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 "GeometricField.H"
diff --git a/applications/utilities/miscellaneous/foamInfoExec/Make/files b/applications/utilities/miscellaneous/foamInfoExec/Make/files
index 40c938c39fe5bcb53f40fa7d24b6d55928e86fd5..b127a2bc471f8177011a77828f8360ea616501a9 100644
--- a/applications/utilities/miscellaneous/foamInfoExec/Make/files
+++ b/applications/utilities/miscellaneous/foamInfoExec/Make/files
@@ -1,2 +1,3 @@
 foamInfoExec.C
+
 EXE = $(FOAM_APPBIN)/foamInfoExec
diff --git a/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C b/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C
index 49c70eb1c355747cc611092d4b295f36edec694c..3e9f8cd159e1bac2283dd32447c55ec850e1de70 100644
--- a/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C
+++ b/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.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
@@ -21,8 +21,11 @@ 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
+    foamInfoExec
+
 Description
-    Interrogates a case and prints information to stdout
+    Interrogates a case and prints information to stdout.
 
 \*---------------------------------------------------------------------------*/
 
@@ -34,7 +37,6 @@ Description
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.C b/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.C
index 9c9842bd324eaa86a9df9476dc0765b89615a17b..bc0eee1ea2edb68622580bfeee0de206a1371cd1 100644
--- a/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.C
+++ b/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.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
@@ -21,7 +21,6 @@ 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 "patchSummaryTemplates.H"
diff --git a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C
index 0412b67f15d346ceb74a94f19e4bd7dfba76b9d6..e3638fd15041da8675e82dd527c8cf38fc96b959 100644
--- a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C
+++ b/applications/utilities/parallelProcessing/redistributePar/redistributePar.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
@@ -422,7 +422,6 @@ void compareFields
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C
index febb45821eb00d4d313ab9a550fcf1853f045aa2..9d78a3485d2138492a99efa3d3f789aaef8d3a48 100644
--- a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C
+++ b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    foamDataToFluent
+
 Description
     Translates OpenFOAM data to Fluent format.
 
@@ -32,7 +35,6 @@ Description
 #include "IOobjectList.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudField.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudField.C
index 091461d13c3bbcc54d4dfbe36f29290c84d73309..18f3deabf0db5e6e52e2d834cb03e3509a57a25e 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudField.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudField.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -68,7 +68,7 @@ void ensightCloudField
         ensightCaseFile.setf(ios_base::left);
         ensightCaseFile
             << ("c" + fieldObject.name()).c_str()
-            << (' ' + prepend + "***." + cloudName
+            << (' ' + prepend + "****." + cloudName
               + "." + fieldObject.name()).c_str()
             << nl;
     }
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C
index 3342435ad6e8c9bc0a2c4698ca384f629cffac34..0b07b7f2ebcc05bdb3f0e903875d5f681b9b4572 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -201,7 +201,7 @@ void writePatchField
                 << pTraits<Type>::typeName
                 << " per element:            1       "
                 << setw(15) << pfName
-                << (' ' + prepend + "***." + pfName).c_str()
+                << (' ' + prepend + "****." + pfName).c_str()
                 << nl;
         }
 
@@ -344,7 +344,7 @@ void ensightField
                     << pTraits<Type>::typeName
                     << " per element:            1       "
                     << setw(15) << vf.name()
-                    << (' ' + prepend + "***." + vf.name()).c_str()
+                    << (' ' + prepend + "****." + vf.name()).c_str()
                     << nl;
             }
 
@@ -558,7 +558,7 @@ void ensightPointField
                     << pTraits<Type>::typeName
                     << " per node:            1       "
                     << setw(15) << pf.name()
-                    << (' ' + prepend + "***." + pf.name()).c_str()
+                    << (' ' + prepend + "****." + pf.name()).c_str()
                     << nl;
             }
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C
index 8a44c5411b3fe81208f7e336163ff8814d6fa4db..df6fe4da410916a26eeaafe81dee7094ef8c203b 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.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
@@ -1150,13 +1150,13 @@ void Foam::ensightMesh::write
                 labelList pointToGlobal;
                 labelList uniqueMeshPointLabels;
                 autoPtr<globalIndex> globalPointsPtr =
-                mesh_.globalData().mergePoints
-                (
-                    p.meshPoints(),
-                    p.meshPointMap(),
-                    pointToGlobal,
-                    uniqueMeshPointLabels
-                );
+                    mesh_.globalData().mergePoints
+                    (
+                        p.meshPoints(),
+                        p.meshPointMap(),
+                        pointToGlobal,
+                        uniqueMeshPointLabels
+                    );
 
                 pointField uniquePoints(mesh_.points(), uniqueMeshPointLabels);
                 // Renumber the patch faces
@@ -1225,13 +1225,13 @@ void Foam::ensightMesh::write
             labelList pointToGlobal;
             labelList uniqueMeshPointLabels;
             autoPtr<globalIndex> globalPointsPtr =
-            mesh_.globalData().mergePoints
-            (
-                fz().meshPoints(),
-                fz().meshPointMap(),
-                pointToGlobal,
-                uniqueMeshPointLabels
-            );
+                mesh_.globalData().mergePoints
+                (
+                    fz().meshPoints(),
+                    fz().meshPointMap(),
+                    pointToGlobal,
+                    uniqueMeshPointLabels
+                );
 
             pointField uniquePoints(mesh_.points(), uniqueMeshPointLabels);
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C
index 05db6c0d05b47bffad3db9925a501190a7645e94..53ee48b894acef29584af166bc4c05c1ef93a4ea 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.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
@@ -21,6 +21,9 @@ 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
+    foamToEnsight
+
 Description
     Translates OpenFOAM data to EnSight format.
 
@@ -91,7 +94,6 @@ bool inFileNameList
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
@@ -243,7 +245,7 @@ int main(int argc, char *argv[])
         // test pre check variable if there is a moving mesh
         if (meshMoving)
         {
-            geomFileName = prepend + "***";
+            geomFileName = prepend + "****";
         }
 
         ensightCaseFile
@@ -292,7 +294,7 @@ int main(int argc, char *argv[])
             <<  (
                     "measured:     1     "
                   + prepend
-                  + "***."
+                  + "****."
                   + cloudIter.key()
                 ).c_str()
             << nl;
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/itoa.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/itoa.C
index 2f8ce716565eb06929ecef9c7e09cedb40b72afd..0975da93d30f87fbacbfe7ab0bba0637a7d05cd0 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/itoa.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/itoa.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -35,7 +35,7 @@ namespace Foam
 word itoa(const label n)
 {
     const label offset = '0';
-    const label length = 3;
+    const label length = 4;
 
     char val[length + 1];
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C
index 2df564e0d0cec528601eaadda55eb3398f247dfd..2e661680fbb9197e50f1fb54e8a713d559c082e3 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -207,7 +207,7 @@ void Foam::ensightLagrangianField
 
 
 //- write generalized field components
-template <class Type>
+template<class Type>
 void Foam::ensightVolField
 (
     const ensightParts& partsList,
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C
index cb7f5705aa902207f7fbbc1440bca6a33204c410..2b15f61a59e8bd5ed052ac7c9fe0e77a2a4eecf9 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.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
@@ -75,7 +75,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/Make/files b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/Make/files
deleted file mode 100644
index 86d2d39d74d4153f4edb3c100513434b855ab4a7..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/Make/files
+++ /dev/null
@@ -1,7 +0,0 @@
-foamToFieldview9.C
-fieldviewTopology.C
-write_binary_uns.c
-calcFaceAddressing.C
-writeFunctions.C
-
-EXE = $(FOAM_APPBIN)/foamToFieldview9
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/Make/options b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/Make/options
deleted file mode 100644
index 0bc784e4c51713ba377f8f2dfc47e7340d8589e7..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/Make/options
+++ /dev/null
@@ -1,10 +0,0 @@
-EXE_INC = \
-    -I$(LIB_SRC)/finiteVolume/lnInclude \
-    -I$(LIB_SRC)/meshTools/lnInclude \
-    -I$(LIB_SRC)/lagrangian/basic/lnInclude
-
-EXE_LIBS = \
-    -lfiniteVolume \
-    -lmeshTools \
-    -lgenericPatchFields \
-    -llagrangian
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/calcFaceAddressing.C b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/calcFaceAddressing.C
deleted file mode 100644
index cbe425d4a8b2d66137cfe8f1b3202b7093812843..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/calcFaceAddressing.C
+++ /dev/null
@@ -1,92 +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 "calcFaceAddressing.H"
-
-using namespace Foam;
-
-// * * * * * * * * * * * * * * * Friend Functions  * * * * * * * * * * * * * //
-
-// Returns the face labels of the shape in an order consistent with the
-// shape.
-labelList calcFaceAddressing
-(
-    const faceList& allFaces,   // faces given faceLabels
-    const cellShape& shape,
-    const labelList& faces,     // faceLabels for given cell
-    const label cellI
-)
-{
-    // return value.
-    labelList shapeToMesh(shape.nFaces(), -1);
-
-    const faceList modelFaces(shape.faces());
-
-    // Loop over all faces of cellShape
-    forAll(modelFaces, cellFaceI)
-    {
-        // face (vertex list)
-        const face& modelFace = modelFaces[cellFaceI];
-
-        // Loop over all face labels
-        forAll(faces, faceI)
-        {
-            const face& vertLabels = allFaces[faces[faceI]];
-
-            if (vertLabels == modelFace)
-            {
-                //Info<< "match:" << modelFace
-                //    << "  to " << vertLabels << endl;
-                shapeToMesh[cellFaceI] = faces[faceI];
-                break;
-            }
-        }
-
-        if (shapeToMesh[cellFaceI] == -1)
-        {
-            FatalErrorIn("foamToFieldview : calcFaceAddressing")
-                << "calcFaceAddressing : can't match face to shape.\n"
-                << "    shape face:" << modelFace << endl
-                << "    face labels:" << faces << endl
-                << "    cellI:" << cellI << endl;
-
-            FatalError
-                << "Faces consist of vertices:" << endl;
-
-            forAll(faces, faceI)
-            {
-                FatalError
-                    << "    face:" << faces[faceI]
-                    << allFaces[faces[faceI]] << endl;
-            }
-            FatalError
-                << exit(FatalError);
-        }
-    }
-    return shapeToMesh;
-}
-
-
-// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createFields.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createFields.H
deleted file mode 100644
index 77f5f0ebc9a62bb42028fd47191192e558018a73..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createFields.H
+++ /dev/null
@@ -1,197 +0,0 @@
-// Construct List of pointers to all vol fields
-int nFields = volScalarNames.size() + 3*volVectorNames.size();
-List<volScalarField*> volFieldPtrs
-(
-    nFields,
-    reinterpret_cast<volScalarField*>(0)
-);
-
-stringList volFieldNames(nFields);
-
-nFields = 0;
-{
-    // Load all scalar fields and store ptr to it
-    forAll(volScalarNames, fieldI)
-    {
-        word fieldName = volScalarNames[fieldI];
-
-        // Check if present
-        IOobject ioHeader
-        (
-            fieldName,
-            runTime.timeName(),
-            mesh,
-            IOobject::MUST_READ,
-            IOobject::NO_WRITE
-        );
-
-        if (ioHeader.headerOk())
-        {
-           volFieldPtrs[nFields] = new volScalarField
-            (
-                ioHeader,
-                mesh
-            );
-        }
-
-        fieldName = getFieldViewName(fieldName);
-
-        volFieldNames[nFields] = fieldName;
-
-        nFields++;
-    }
-
-
-    // Load all  (componenents of) vector fields
-    forAll(volVectorNames, fieldI)
-    {
-        word fieldName = volVectorNames[fieldI];
-
-        // Check if present
-        IOobject ioHeader
-        (
-            fieldName,
-            runTime.timeName(),
-            mesh,
-            IOobject::MUST_READ,
-            IOobject::NO_WRITE
-        );
-
-        if (ioHeader.headerOk())
-        {
-            volVectorField vvf(ioHeader, mesh);
-
-            // X component
-            volFieldPtrs[nFields] =
-                new volScalarField
-                (
-                    vvf.component(vector::X)
-                );
-
-            // Y component
-            volFieldPtrs[nFields+1] =
-                new volScalarField
-                (
-                    vvf.component(vector::Y)
-                );
-
-            // Z component
-            volFieldPtrs[nFields+2] =
-                new volScalarField
-                (
-                    vvf.component(vector::Z)
-                );
-        }
-
-        fieldName = getFieldViewName(fieldName);
-
-        volFieldNames[nFields]   = fieldName + ("x;" +  fieldName);
-        volFieldNames[nFields+1] = fieldName + "y";
-        volFieldNames[nFields+2] = fieldName + "z";
-
-        nFields += 3;
-    }
-}
-
-
-
-//
-// Construct List of pointers to all surface fields
-//
-
-
-
-int nSurfFields = surfScalarNames.size() + 3*surfVectorNames.size();
-List<surfaceScalarField*> surfFieldPtrs
-(
-    nSurfFields,
-    reinterpret_cast<surfaceScalarField*>(0)
-);
-
-stringList surfFieldNames(nSurfFields);
-
-nSurfFields = 0;
-{
-    // Load all scalar fields
-    forAll(surfScalarNames, fieldI)
-    {
-        word fieldName = surfScalarNames[fieldI];
-
-        // Check if present
-        IOobject ioHeader
-        (
-            fieldName,
-            runTime.timeName(),
-            mesh,
-            IOobject::MUST_READ,
-            IOobject::NO_WRITE
-        );
-
-        if (ioHeader.headerOk())
-        {
-            surfFieldPtrs[nSurfFields] =
-                new surfaceScalarField
-                (
-                    ioHeader,
-                    mesh
-                );
-        }
-
-        fieldName = getFieldViewName(fieldName);
-
-        surfFieldNames[nSurfFields] = fieldName;
-
-        nSurfFields++;
-    }
-
-
-    // Set (componenents of) vector fields
-    forAll(surfVectorNames, fieldI)
-    {
-        word fieldName = surfVectorNames[fieldI];
-
-        // Check if present
-        IOobject ioHeader
-        (
-            fieldName,
-            runTime.timeName(),
-            mesh,
-            IOobject::MUST_READ,
-            IOobject::NO_WRITE
-        );
-
-        if (ioHeader.headerOk())
-        {
-            surfaceVectorField svf(ioHeader, mesh);
-
-            // X component
-            surfFieldPtrs[nSurfFields] =
-                new surfaceScalarField
-                (
-                    svf.component(vector::X)
-                );
-
-            // Y component
-            surfFieldPtrs[nSurfFields+1] =
-                new surfaceScalarField
-                (
-                    svf.component(vector::Y)
-                );
-
-            // Z component
-            surfFieldPtrs[nSurfFields+2] =
-                new surfaceScalarField
-                (
-                    svf.component(vector::Z)
-                );
-        }
-
-        fieldName = getFieldViewName(fieldName);
-
-        surfFieldNames[nSurfFields]   = fieldName + ("x;" + fieldName);
-        surfFieldNames[nSurfFields+1] = fieldName + "y";
-        surfFieldNames[nSurfFields+2] = fieldName + "z";
-
-        nSurfFields += 3;
-    }
-}
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createSprayFields.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createSprayFields.H
deleted file mode 100644
index a5a218de804abed8fd523d5241979e4073fc66c4..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/createSprayFields.H
+++ /dev/null
@@ -1,75 +0,0 @@
-// Construct of ptrs to all spray fields
-List<IOField<scalar>* > sprayScalarFieldPtrs
-(
-    sprayScalarNames.size(),
-    reinterpret_cast<IOField<scalar>*>(0)
-);
-
-List<IOField<vector>* > sprayVectorFieldPtrs
-(
-    sprayVectorNames.size(),
-    reinterpret_cast<IOField<vector>*>(0)
-);
-
-{
-     int sprayFieldI = 0;
-
-    // Set scalar fields
-    forAll(sprayScalarNames, fieldI)
-    {
-        IOobject ioHeader
-        (
-            sprayScalarNames[fieldI],
-            runTime.timeName(),
-            cloud::prefix,
-            mesh,
-            IOobject::MUST_READ,
-            IOobject::NO_WRITE
-        );
-
-        if (ioHeader.headerOk())
-        {
-            sprayScalarFieldPtrs[sprayFieldI] = new IOField<scalar>(ioHeader);
-        }
-        else
-        {
-            Info<< "    dummy lagrangian field for "
-                << sprayScalarNames[fieldI] << endl;
-        }
-
-        sprayFieldI++;
-    }
-}
-
-
-// Set vector fields
-
-{
-    int sprayFieldI = 0;
-
-    forAll(sprayVectorNames, fieldI)
-    {
-        IOobject ioHeader
-        (
-            sprayVectorNames[fieldI],
-            runTime.timeName(),
-            cloud::prefix,
-            mesh,
-            IOobject::MUST_READ,
-            IOobject::NO_WRITE
-        );
-
-        if (ioHeader.headerOk())
-        {
-            sprayVectorFieldPtrs[sprayFieldI] = new IOField<vector>(ioHeader);
-        }
-        else
-        {
-            Info<< "    dummy lagrangian field for "
-                << sprayVectorNames[fieldI] << endl;
-        }
-
-        sprayFieldI++;
-    }
-}
-
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fieldviewTopology.C b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fieldviewTopology.C
deleted file mode 100644
index ec31f67ed533629809afaa752a113eb61b33bf0a..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fieldviewTopology.C
+++ /dev/null
@@ -1,436 +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 "fieldviewTopology.H"
-#include "polyMesh.H"
-#include "cellShape.H"
-#include "cellModeller.H"
-#include "wallPolyPatch.H"
-#include "symmetryPolyPatch.H"
-
-
-#include "fv_reader_tags.h"
-
-extern "C"
-{
-    unsigned int fv_encode_elem_header(int elem_type, int wall_info[]);
-}
-
-
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
-
-Foam::labelList Foam::fieldviewTopology::calcFaceAddressing
-(
-    const faceList& allFaces,   // faces given faceLabels
-    const cellShape& shape,
-    const labelList& faces,     // faceLabels for given cell
-    const label cellI
-)
-{
-    // return value.
-    labelList shapeToMesh(shape.nFaces(), -1);
-
-    const faceList modelFaces(shape.faces());
-
-    // Loop over all faces of cellShape
-    forAll(modelFaces, cellFaceI)
-    {
-        // face (vertex list)
-        const face& modelFace = modelFaces[cellFaceI];
-
-        // Loop over all face labels
-        forAll(faces, faceI)
-        {
-            const face& vertLabels = allFaces[faces[faceI]];
-
-            if (vertLabels == modelFace)
-            {
-                shapeToMesh[cellFaceI] = faces[faceI];
-                break;
-            }
-        }
-
-        if (shapeToMesh[cellFaceI] == -1)
-        {
-            FatalErrorIn("foamToFieldview : calcFaceAddressing")
-                << "calcFaceAddressing : can't match face to shape.\n"
-                << "    shape face:" << modelFace << endl
-                << "    face labels:" << faces << endl
-                << "    cellI:" << cellI << endl;
-
-            FatalError << "Faces consist of vertices:" << endl;
-            forAll(faces, faceI)
-            {
-                FatalError
-                    << "    face:" << faces[faceI]
-                    << allFaces[faces[faceI]] << endl;
-            }
-            FatalError << exit(FatalError);
-        }
-    }
-    return shapeToMesh;
-}
-
-
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-// Construct from components
-Foam::fieldviewTopology::fieldviewTopology
-(
-    const polyMesh& mesh,
-    const bool setWallInfo
-)
-:
-    hexLabels_((1+8)*mesh.nCells()),
-    prismLabels_((1+6)*mesh.nCells()),
-    pyrLabels_((1+5)*mesh.nCells()),
-    tetLabels_((1+4)*mesh.nCells()),
-    nPoly_(0),
-    quadFaceLabels_(mesh.boundaryMesh().size()),
-    nPolyFaces_(mesh.boundaryMesh().size())
-{
-    // Mark all faces that are to be seen as wall for particle
-    // tracking and all cells that use one or more of these walls
-
-    List<int> wallFace(mesh.nFaces(), NOT_A_WALL);
-    boolList wallCell(mesh.nCells(), false);
-
-    if (setWallInfo)
-    {
-        forAll(mesh.boundaryMesh(), patchI)
-        {
-            const polyPatch& currPatch = mesh.boundaryMesh()[patchI];
-            if
-            (
-                isA<wallPolyPatch>(currPatch)
-             || isA<symmetryPolyPatch>(currPatch)
-            )
-            {
-                forAll(currPatch, patchFaceI)
-                {
-                    label meshFaceI = currPatch.start() + patchFaceI;
-
-                    wallFace[meshFaceI] = A_WALL;
-                    wallCell[mesh.faceOwner()[meshFaceI]] = true;
-                }
-            }
-        }
-    }
-
-
-
-    const cellModel& tet = *(cellModeller::lookup("tet"));
-    const cellModel& pyr = *(cellModeller::lookup("pyr"));
-    const cellModel& prism = *(cellModeller::lookup("prism"));
-    const cellModel& wedge = *(cellModeller::lookup("wedge"));
-    const cellModel& tetWedge = *(cellModeller::lookup("tetWedge"));
-    const cellModel& hex = *(cellModeller::lookup("hex"));
-
-    // Pre calculate headers for cells not on walls
-    List<int> notWallFlags(6, NOT_A_WALL);
-    unsigned int tetNotWall = fv_encode_elem_header
-    (
-        FV_TET_ELEM_ID, notWallFlags.begin()
-    );
-    unsigned int pyrNotWall = fv_encode_elem_header
-    (
-        FV_PYRA_ELEM_ID, notWallFlags.begin()
-    );
-    unsigned int prismNotWall = fv_encode_elem_header
-    (
-        FV_PRISM_ELEM_ID, notWallFlags.begin()
-    );
-    unsigned int hexNotWall = fv_encode_elem_header
-    (
-        FV_HEX_ELEM_ID, notWallFlags.begin()
-    );
-
-    // Some aliases
-    const cellList& cellFaces = mesh.cells();
-    const cellShapeList& cellShapes = mesh.cellShapes();
-
-
-    label hexi = 0;
-    label prismi = 0;
-    label pyri = 0;
-    label teti = 0;
-
-    const faceList& allFaces = mesh.faces();
-
-    List<int> wallFlags(6);
-    forAll(cellShapes, celli)
-    {
-        const cellShape& cellShape = cellShapes[celli];
-        const cellModel& cellModel = cellShape.model();
-
-        if (cellModel == tet)
-        {
-            if (!wallCell[celli])
-            {
-                tetLabels_[teti++] = tetNotWall;
-            }
-            else
-            {
-                labelList modelToMesh = calcFaceAddressing
-                (
-                    allFaces, cellShape, cellFaces[celli], celli
-                );
-
-                wallFlags[0] = wallFace[modelToMesh[0]];
-                wallFlags[1] = wallFace[modelToMesh[1]];
-                wallFlags[2] = wallFace[modelToMesh[2]];
-                wallFlags[3] = wallFace[modelToMesh[3]];
-
-                tetLabels_[teti++] = fv_encode_elem_header
-                (
-                    FV_TET_ELEM_ID, wallFlags.begin()
-                );
-            }
-
-            tetLabels_[teti++] = cellShape[0] + 1;
-            tetLabels_[teti++] = cellShape[1] + 1;
-            tetLabels_[teti++] = cellShape[2] + 1;
-            tetLabels_[teti++] = cellShape[3] + 1;
-        }
-        else if (cellModel == pyr)
-        {
-            if (!wallCell[celli])
-            {
-                pyrLabels_[pyri++] = pyrNotWall;
-            }
-            else
-            {
-                labelList modelToMesh = calcFaceAddressing
-                (
-                    allFaces, cellShape, cellFaces[celli], celli
-                );
-
-                wallFlags[0] = wallFace[modelToMesh[0]];
-                wallFlags[1] = wallFace[modelToMesh[3]];
-                wallFlags[2] = wallFace[modelToMesh[2]];
-                wallFlags[3] = wallFace[modelToMesh[1]];
-                wallFlags[4] = wallFace[modelToMesh[4]];
-
-                pyrLabels_[pyri++] = fv_encode_elem_header
-                (
-                    FV_PYRA_ELEM_ID, wallFlags.begin()
-                );
-            }
-
-            pyrLabels_[pyri++] = cellShape[0] + 1;
-            pyrLabels_[pyri++] = cellShape[1] + 1;
-            pyrLabels_[pyri++] = cellShape[2] + 1;
-            pyrLabels_[pyri++] = cellShape[3] + 1;
-            pyrLabels_[pyri++] = cellShape[4] + 1;
-        }
-        else if (cellModel == prism)
-        {
-            if (!wallCell[celli])
-            {
-                prismLabels_[prismi++] = prismNotWall;
-            }
-            else
-            {
-                labelList modelToMesh = calcFaceAddressing
-                (
-                    allFaces, cellShape, cellFaces[celli], celli
-                );
-
-                wallFlags[0] = wallFace[modelToMesh[4]];
-                wallFlags[1] = wallFace[modelToMesh[2]];
-                wallFlags[2] = wallFace[modelToMesh[3]];
-                wallFlags[3] = wallFace[modelToMesh[0]];
-                wallFlags[4] = wallFace[modelToMesh[1]];
-
-                prismLabels_[prismi++] = fv_encode_elem_header
-                (
-                    FV_PRISM_ELEM_ID, wallFlags.begin()
-                );
-            }
-
-            prismLabels_[prismi++] = cellShape[0] + 1;
-            prismLabels_[prismi++] = cellShape[3] + 1;
-            prismLabels_[prismi++] = cellShape[4] + 1;
-            prismLabels_[prismi++] = cellShape[1] + 1;
-            prismLabels_[prismi++] = cellShape[5] + 1;
-            prismLabels_[prismi++] = cellShape[2] + 1;
-        }
-        else if (cellModel == tetWedge)
-        {
-            // Treat as prism with collapsed edge
-            if (!wallCell[celli])
-            {
-                prismLabels_[prismi++] = prismNotWall;
-            }
-            else
-            {
-                labelList modelToMesh = calcFaceAddressing
-                (
-                    allFaces, cellShape, cellFaces[celli], celli
-                );
-
-                wallFlags[0] = wallFace[modelToMesh[1]];
-                wallFlags[1] = wallFace[modelToMesh[2]];
-                wallFlags[2] = wallFace[modelToMesh[3]];
-                wallFlags[3] = wallFace[modelToMesh[0]];
-                wallFlags[4] = wallFace[modelToMesh[3]];
-
-                prismLabels_[prismi++] = fv_encode_elem_header
-                (
-                    FV_PRISM_ELEM_ID, wallFlags.begin()
-                );
-            }
-
-            prismLabels_[prismi++] = cellShape[0] + 1;
-            prismLabels_[prismi++] = cellShape[3] + 1;
-            prismLabels_[prismi++] = cellShape[4] + 1;
-            prismLabels_[prismi++] = cellShape[1] + 1;
-            prismLabels_[prismi++] = cellShape[4] + 1;
-            prismLabels_[prismi++] = cellShape[2] + 1;
-        }
-        else if (cellModel == wedge)
-        {
-            if (!wallCell[celli])
-            {
-                hexLabels_[hexi++] = hexNotWall;
-            }
-            else
-            {
-                labelList modelToMesh = calcFaceAddressing
-                (
-                    allFaces, cellShape, cellFaces[celli], celli
-                );
-
-                wallFlags[0] = wallFace[modelToMesh[2]];
-                wallFlags[1] = wallFace[modelToMesh[3]];
-                wallFlags[2] = wallFace[modelToMesh[0]];
-                wallFlags[3] = wallFace[modelToMesh[1]];
-                wallFlags[4] = wallFace[modelToMesh[4]];
-                wallFlags[5] = wallFace[modelToMesh[5]];
-
-                hexLabels_[hexi++] = fv_encode_elem_header
-                (
-                    FV_HEX_ELEM_ID, wallFlags.begin()
-                );
-            }
-            hexLabels_[hexi++] = cellShape[0] + 1;
-            hexLabels_[hexi++] = cellShape[1] + 1;
-            hexLabels_[hexi++] = cellShape[0] + 1;
-            hexLabels_[hexi++] = cellShape[2] + 1;
-            hexLabels_[hexi++] = cellShape[3] + 1;
-            hexLabels_[hexi++] = cellShape[4] + 1;
-            hexLabels_[hexi++] = cellShape[6] + 1;
-            hexLabels_[hexi++] = cellShape[5] + 1;
-        }
-        else if (cellModel == hex)
-        {
-            if (!wallCell[celli])
-            {
-                hexLabels_[hexi++] = hexNotWall;
-            }
-            else
-            {
-                labelList modelToMesh = calcFaceAddressing
-                (
-                    allFaces, cellShape, cellFaces[celli], celli
-                );
-
-                wallFlags[0] = wallFace[modelToMesh[0]];
-                wallFlags[1] = wallFace[modelToMesh[1]];
-                wallFlags[2] = wallFace[modelToMesh[4]];
-                wallFlags[3] = wallFace[modelToMesh[5]];
-                wallFlags[4] = wallFace[modelToMesh[2]];
-                wallFlags[5] = wallFace[modelToMesh[3]];
-
-                hexLabels_[hexi++] = fv_encode_elem_header
-                (
-                    FV_HEX_ELEM_ID, wallFlags.begin()
-                );
-            }
-            hexLabels_[hexi++] = cellShape[0] + 1;
-            hexLabels_[hexi++] = cellShape[1] + 1;
-            hexLabels_[hexi++] = cellShape[3] + 1;
-            hexLabels_[hexi++] = cellShape[2] + 1;
-            hexLabels_[hexi++] = cellShape[4] + 1;
-            hexLabels_[hexi++] = cellShape[5] + 1;
-            hexLabels_[hexi++] = cellShape[7] + 1;
-            hexLabels_[hexi++] = cellShape[6] + 1;
-        }
-        else
-        {
-            nPoly_++;
-        }
-    }
-
-    hexLabels_.setSize(hexi);
-    prismLabels_.setSize(prismi);
-    pyrLabels_.setSize(pyri);
-    tetLabels_.setSize(teti);
-
-
-    //
-    // Patches
-    //
-    forAll(mesh.boundaryMesh(), patchI)
-    {
-        const polyPatch& patchFaces = mesh.boundaryMesh()[patchI];
-
-        labelList& faceLabels = quadFaceLabels_[patchI];
-
-        // Faces, each 4 labels. Size big enough
-        faceLabels.setSize(patchFaces.size()*4);
-
-        label labelI = 0;
-
-        forAll(patchFaces, faceI)
-        {
-            const face& patchFace = patchFaces[faceI];
-
-            if (patchFace.size() == 3)
-            {
-                faceLabels[labelI++] = patchFace[0] + 1;
-                faceLabels[labelI++] = patchFace[1] + 1;
-                faceLabels[labelI++] = patchFace[2] + 1;
-                faceLabels[labelI++] = 0;   // Fieldview:triangle definition
-            }
-            else if (patchFace.size() == 4)
-            {
-                faceLabels[labelI++] = patchFace[0] + 1;
-                faceLabels[labelI++] = patchFace[1] + 1;
-                faceLabels[labelI++] = patchFace[2] + 1;
-                faceLabels[labelI++] = patchFace[3] + 1;
-            }
-        }
-
-        faceLabels.setSize(labelI);
-
-        label nFaces = labelI/4;
-
-        nPolyFaces_[patchI] = patchFaces.size() - nFaces;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fieldviewTopology.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fieldviewTopology.H
deleted file mode 100644
index d0591a35412b52947c629b8d2089edade27110bc..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fieldviewTopology.H
+++ /dev/null
@@ -1,176 +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/>.
-
-Class
-    Foam::fieldviewTopology
-
-Description
-
-SourceFiles
-    fieldviewTopology.C
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef fieldviewTopology_H
-#define fieldviewTopology_H
-
-#include "labelList.H"
-#include "faceList.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// Forward declaration of classes
-class polyMesh;
-class cellShape;
-
-/*---------------------------------------------------------------------------*\
-                           Class fieldviewTopology Declaration
-\*---------------------------------------------------------------------------*/
-
-class fieldviewTopology
-{
-    // Private data
-
-        //- Hexes in fieldview format
-        List<int> hexLabels_;
-
-        List<int> prismLabels_;
-
-        List<int> pyrLabels_;
-
-        List<int> tetLabels_;
-
-        //- Number of non-hex/prism/pyr/tet labels
-        label nPoly_;
-
-
-        //
-        // Patches
-        //
-
-        //- Quad and tri patch faces in fv format
-        labelListList quadFaceLabels_;
-
-        //- Number of polyhedral faces per patch
-        labelList nPolyFaces_;
-
-
-    // Private Member Functions
-
-        static labelList calcFaceAddressing
-        (
-            const faceList& allFaces,   // faces given faceLabels
-            const cellShape& shape,
-            const labelList& faces,     // faceLabels for given cell
-            const label cellI
-        );
-
-
-        //- Disallow default bitwise copy construct
-        fieldviewTopology(const fieldviewTopology&);
-
-        //- Disallow default bitwise assignment
-        void operator=(const fieldviewTopology&);
-
-
-public:
-
-    // Constructors
-
-        //- Construct from components
-        fieldviewTopology(const polyMesh& mesh, const bool setWallInfo);
-
-
-    // Member Functions
-
-        // Access
-
-            const List<int>& hexLabels() const
-            {
-                return hexLabels_;
-            }
-
-            const List<int>& prismLabels() const
-            {
-                return prismLabels_;
-            }
-
-            const List<int>& pyrLabels() const
-            {
-                return pyrLabels_;
-            }
-
-            const List<int>& tetLabels() const
-            {
-                return tetLabels_;
-            }
-
-            label nHex() const
-            {
-                return hexLabels().size()/9;
-            }
-
-            label nPrism() const
-            {
-                return prismLabels().size()/7;
-            }
-
-            label nPyr() const
-            {
-                return pyrLabels().size()/6;
-            }
-
-            label nTet() const
-            {
-                return tetLabels().size()/5;
-            }
-
-            label nPoly() const
-            {
-                return nPoly_;
-            }
-
-            const labelListList& quadFaceLabels() const
-            {
-                return quadFaceLabels_;
-            }
-
-            const labelList& nPolyFaces() const
-            {
-                return nPolyFaces_;
-            }
-};
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C
deleted file mode 100644
index 9b872ab13428de77f1af244c47a02cf96ac653c7..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C
+++ /dev/null
@@ -1,1009 +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/>.
-
-Description
-    Write out the OpenFOAM mesh in Version 3.0 Fieldview-UNS format (binary).
-
-    See Fieldview Release 9 Reference Manual - Appendix D
-    (Unstructured Data Format)
-    Borrows various from uns/write_binary_uns.c from FieldView dist.
-
-\*---------------------------------------------------------------------------*/
-
-#include "argList.H"
-#include "timeSelector.H"
-#include "volFields.H"
-#include "surfaceFields.H"
-#include "pointFields.H"
-#include "scalarIOField.H"
-#include "volPointInterpolation.H"
-#include "wallFvPatch.H"
-#include "symmetryFvPatch.H"
-
-#include "Cloud.H"
-#include "passiveParticle.H"
-
-#include "IOobjectList.H"
-#include "boolList.H"
-#include "stringList.H"
-#include "cellModeller.H"
-
-#include "floatScalar.H"
-#include "calcFaceAddressing.H"
-#include "writeFunctions.H"
-#include "fieldviewTopology.H"
-
-#include <fstream>
-
-#include "fv_reader_tags.h"
-
-extern "C"
-{
-    unsigned int fv_encode_elem_header(int elem_type, int wall_info[]);
-}
-
-using namespace Foam;
-
-typedef Field<floatScalar> floatField;
-
-
-static HashTable<word> FieldviewNames;
-
-
-static word getFieldViewName(const word& foamName)
-{
-    if (FieldviewNames.found(foamName))
-    {
-        return FieldviewNames[foamName];
-    }
-    else
-    {
-        return foamName;
-    }
-}
-
-
-static void printNames(const wordList& names, Ostream& os)
-{
-    forAll(names, fieldI)
-    {
-        Info<< " " << names[fieldI] << '/' << getFieldViewName(names[fieldI]);
-    }
-}
-
-
-// Count number of vertices used by celli
-static label countVerts(const primitiveMesh& mesh, const label celli)
-{
-    const cell& cll = mesh.cells()[celli];
-
-    // Count number of vertices used
-    labelHashSet usedVerts(10*cll.size());
-
-    forAll(cll, cellFacei)
-    {
-        const face& f = mesh.faces()[cll[cellFacei]];
-
-        forAll(f, fp)
-        {
-            if (!usedVerts.found(f[fp]))
-            {
-                usedVerts.insert(f[fp]);
-            }
-        }
-    }
-    return usedVerts.toc().size();
-}
-
-
-static void writeFaceData
-(
-    const polyMesh& mesh,
-    const fieldviewTopology& topo,
-    const label patchI,
-    const scalarField& patchField,
-    const bool writePolyFaces,
-    std::ofstream& fvFile
-)
-{
-    const polyPatch& pp = mesh.boundaryMesh()[patchI];
-
-    // Start off with dummy value.
-    if (writePolyFaces)
-    {
-        floatField fField(topo.nPolyFaces()[patchI], 0.0);
-
-        // Fill selected faces with field values
-        label polyFaceI = 0;
-        forAll(patchField, faceI)
-        {
-            if (pp[faceI].size() > 4)
-            {
-                fField[polyFaceI++] = float(patchField[faceI]);
-            }
-        }
-
-        fvFile.write
-        (
-            reinterpret_cast<char*>(fField.begin()), fField.size()*sizeof(float)
-        );
-    }
-    else
-    {
-        floatField fField(pp.size() - topo.nPolyFaces()[patchI], 0.0);
-
-        // Fill selected faces with field values
-        label quadFaceI = 0;
-        forAll(patchField, faceI)
-        {
-            if (pp[faceI].size() <= 4)
-            {
-                fField[quadFaceI++] = float(patchField[faceI]);
-            }
-        }
-
-        fvFile.write
-        (
-            reinterpret_cast<char*>(fField.begin()), fField.size()*sizeof(float)
-        );
-    }
-}
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
-
-int main(int argc, char *argv[])
-{
-    argList::noParallel();
-    argList::addBoolOption
-    (
-        "noWall",
-        "skip setting wall information"
-    );
-    timeSelector::addOptions(true, false);
-
-#   include "addRegionOption.H"
-
-#   include "setRootCase.H"
-#   include "createTime.H"
-
-    instantList timeDirs = timeSelector::select0(runTime, args);
-
-#   include "createNamedMesh.H"
-
-    // Initialize name mapping table
-    FieldviewNames.insert("alpha", "aalpha");
-    FieldviewNames.insert("Alpha", "AAlpha");
-    FieldviewNames.insert("fsmach", "ffsmach");
-    FieldviewNames.insert("FSMach", "FFSMach");
-    FieldviewNames.insert("re", "rre");
-    FieldviewNames.insert("Re", "RRe");
-    FieldviewNames.insert("time", "ttime");
-    FieldviewNames.insert("Time", "TTime");
-    FieldviewNames.insert("pi", "ppi");
-    FieldviewNames.insert("PI", "PPI");
-    FieldviewNames.insert("x", "xx");
-    FieldviewNames.insert("X", "XX");
-    FieldviewNames.insert("y", "yy");
-    FieldviewNames.insert("Y", "YY");
-    FieldviewNames.insert("z", "zz");
-    FieldviewNames.insert("Z", "ZZ");
-    FieldviewNames.insert("rcyl", "rrcyl");
-    FieldviewNames.insert("Rcyl", "RRcyl");
-    FieldviewNames.insert("theta", "ttheta");
-    FieldviewNames.insert("Theta", "TTheta");
-    FieldviewNames.insert("rsphere", "rrsphere");
-    FieldviewNames.insert("Rsphere", "RRsphere");
-    FieldviewNames.insert("k", "kk");
-    FieldviewNames.insert("K", "KK");
-
-
-    // Scan for all available fields, in all timesteps
-    //     volScalarNames  : all scalar fields
-    //     volVectorNames  : ,,  vector ,,
-    //     surfScalarNames : surface fields
-    //     surfVectorNames : ,,
-    //     sprayScalarNames: spray fields
-    //     sprayVectorNames: ,,
-#   include "getFieldNames.H"
-
-    bool hasLagrangian = false;
-    if (sprayScalarNames.size() || sprayVectorNames.size())
-    {
-        hasLagrangian = true;
-    }
-
-    Info<< "All fields:   Foam/Fieldview" << endl;
-    Info<< "    volScalar   :";
-    printNames(volScalarNames, Info);
-    Info<< endl;
-    Info<< "    volVector   :";
-    printNames(volVectorNames, Info);
-    Info<< endl;
-    Info<< "    surfScalar  :";
-    printNames(surfScalarNames, Info);
-    Info<< endl;
-    Info<< "    surfVector  :";
-    printNames(surfVectorNames, Info);
-    Info<< endl;
-    Info<< "    sprayScalar :";
-    printNames(sprayScalarNames, Info);
-    Info<< endl;
-    Info<< "    sprayVector :";
-    printNames(sprayVectorNames, Info);
-    Info<< endl;
-
-
-    //
-    // Start writing
-    //
-
-    // make a directory called FieldView in the case
-    fileName fvPath(runTime.path()/"Fieldview");
-
-    if (regionName != polyMesh::defaultRegion)
-    {
-        fvPath = fvPath/regionName;
-    }
-
-    if (isDir(fvPath))
-    {
-        if (regionName != polyMesh::defaultRegion)
-        {
-            Info<< "Keeping old FieldView files in " << fvPath << nl << endl;
-        }
-        else
-        {
-            Info<< "Deleting old FieldView files in " << fvPath << nl << endl;
-            rmDir(fvPath);
-        }
-    }
-
-    mkDir(fvPath);
-
-    fileName fvParticleFileName(fvPath/runTime.caseName() + ".fvp");
-    if (hasLagrangian)
-    {
-        Info<< "Opening particle file " << fvParticleFileName << endl;
-    }
-    std::ofstream fvParticleFile(fvParticleFileName.c_str());
-
-    // Write spray file header
-    if (hasLagrangian)
-    {
-#       include "writeSprayHeader.H"
-    }
-
-    // Current mesh. Start off from unloaded mesh.
-    autoPtr<fieldviewTopology> topoPtr(NULL);
-
-    label fieldViewTime = 0;
-
-    forAll(timeDirs, timeI)
-    {
-        runTime.setTime(timeDirs[timeI], timeI);
-        Info<< "Time: " << runTime.timeName() << endl;
-
-        fvMesh::readUpdateState state = mesh.readUpdate();
-
-        if
-        (
-            timeI == 0
-         || state == fvMesh::TOPO_CHANGE
-         || state == fvMesh::TOPO_PATCH_CHANGE
-        )
-        {
-            // Mesh topo changed. Update Fieldview topo.
-
-            topoPtr.reset
-            (
-                new fieldviewTopology
-                (
-                    mesh,
-                    !args.optionFound("noWall")
-                )
-            );
-
-            Info<< "    Mesh read:" << endl
-                << "        tet   : " << topoPtr().nTet() << endl
-                << "        hex   : " << topoPtr().nHex() << endl
-                << "        prism : " << topoPtr().nPrism() << endl
-                << "        pyr   : " << topoPtr().nPyr() << endl
-                << "        poly  : " << topoPtr().nPoly() << endl
-                << endl;
-        }
-        else if (state == fvMesh::POINTS_MOVED)
-        {
-            // points exists for time step, let's read them
-            Info<< "    Points file detected - updating points" << endl;
-        }
-
-        const fieldviewTopology& topo = topoPtr();
-
-
-        //
-        // Create file and write header
-        //
-
-        fileName fvFileName
-        (
-            fvPath/runTime.caseName() + "_" + Foam::name(timeI) + ".uns"
-        );
-
-        Info<< "    file:" << fvFileName.c_str() << endl;
-
-
-        std::ofstream fvFile(fvFileName.c_str());
-
-        //Info<< "Writing header ..." << endl;
-
-        // Output the magic number.
-        writeInt(fvFile, FV_MAGIC);
-
-        // Output file header and version number.
-        writeStr80(fvFile, "FIELDVIEW");
-
-        // This version of the FIELDVIEW unstructured file is "3.0".
-        // This is written as two integers.
-        writeInt(fvFile, 3);
-        writeInt(fvFile, 0);
-
-
-        // File type code. Grid and results.
-        writeInt(fvFile, FV_COMBINED_FILE);
-
-        // Reserved field, always zero
-        writeInt(fvFile, 0);
-
-        // Output constants for time, fsmach, alpha and re.
-        float fBuf[4];
-        fBuf[0] = runTime.value();
-        fBuf[1] = 0.0;
-        fBuf[2] = 0.0;
-        fBuf[3] = 1.0;
-        fvFile.write(reinterpret_cast<char*>(fBuf), 4*sizeof(float));
-
-
-        // Output the number of grids
-        writeInt(fvFile, 1);
-
-
-        //
-        //  Boundary table
-        //
-        //Info<< "Writing boundary table ..." << endl;
-
-        // num patches
-        writeInt(fvFile, mesh.boundary().size());
-
-        forAll(mesh.boundary(), patchI)
-        {
-            const fvPatch& currPatch = mesh.boundary()[patchI];
-
-            writeInt(fvFile, 1);   // data present
-            writeInt(fvFile, 1);   // normals ok
-
-            // name
-            writeStr80(fvFile, currPatch.name().c_str());
-        }
-
-
-        //
-        // Create fields:
-        //     volFieldPtrs     : List of ptrs to all volScalar/Vector fields
-        //                        (null if field not present at current time)
-        //     volFieldNames    : FieldView compatible names of volFields
-        //     surfFieldPtrs    : same for surfaceScalar/Vector
-        //     surfFieldNames
-#       include "createFields.H"
-
-
-
-        //
-        // Write Variables table
-        //
-
-        //Info<< "Writing variables table ..." << endl;
-
-        writeInt(fvFile, volFieldNames.size());
-        forAll(volFieldNames, fieldI)
-        {
-            if (volFieldPtrs[fieldI] == NULL)
-            {
-                Info<< "    dummy field for "
-                    << volFieldNames[fieldI].c_str() << endl;
-            }
-
-            writeStr80(fvFile, volFieldNames[fieldI].c_str());
-        }
-
-        //
-        // Write Boundary Variables table = vol + surface fields
-        //
-
-        //Info<< "Writing boundary variables table ..." << endl;
-
-        writeInt
-        (
-            fvFile,
-            volFieldNames.size() + surfFieldNames.size()
-        );
-        forAll(volFieldNames, fieldI)
-        {
-            writeStr80(fvFile, volFieldNames[fieldI].c_str());
-        }
-        forAll(surfFieldNames, fieldI)
-        {
-            if (surfFieldPtrs[fieldI] == NULL)
-            {
-                Info<< "    dummy surface field for "
-                    << surfFieldNames[fieldI].c_str() << endl;
-            }
-
-            writeStr80(fvFile, surfFieldNames[fieldI].c_str());
-        }
-
-
-        // Output grid data.
-
-        //
-        // Nodes
-        //
-
-        //Info<< "Writing points ..." << endl;
-
-        const pointField& points = mesh.points();
-        label nPoints = points.size();
-
-        writeInt(fvFile, FV_NODES);
-        writeInt(fvFile, nPoints);
-
-        for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
-        {
-            floatField fField(nPoints);
-
-            for (label pointi = 0; pointi<nPoints; pointi++)
-            {
-                fField[pointi] = float(points[pointi][cmpt]);
-            }
-
-            fvFile.write
-            (
-                reinterpret_cast<char*>(fField.begin()),
-                fField.size()*sizeof(float)
-            );
-        }
-
-        //
-        // Boundary Faces - regular
-        //
-
-        //Info<< "Writing regular boundary faces ..." << endl;
-
-        forAll(mesh.boundary(), patchI)
-        {
-            label nQuadFaces = topo.quadFaceLabels()[patchI].size()/4;
-
-            if (nQuadFaces != 0)
-            {
-                writeInt(fvFile, FV_FACES);
-                writeInt(fvFile, patchI + 1);  // patch number
-                writeInt(fvFile, nQuadFaces);  // number of faces in patch
-                fvFile.write
-                (
-                    reinterpret_cast<const char*>
-                        (topo.quadFaceLabels()[patchI].begin()),
-                    nQuadFaces*4*sizeof(int)
-                );
-            }
-        }
-
-        //
-        // Boundary Faces - arbitrary polygon
-        //
-
-        //Info<< "Write polygonal boundary faces ..." << endl;
-
-        forAll(mesh.boundary(), patchI)
-        {
-            if (topo.nPolyFaces()[patchI] > 0)
-            {
-                writeInt(fvFile, FV_ARB_POLY_FACES);
-                writeInt(fvFile, patchI + 1);
-
-                // number of arb faces in patch
-                writeInt(fvFile, topo.nPolyFaces()[patchI]);
-
-                const polyPatch& patchFaces = mesh.boundary()[patchI].patch();
-
-                forAll(patchFaces, faceI)
-                {
-                    const face& f = patchFaces[faceI];
-
-                    if (f.size() > 4)
-                    {
-                        writeInt(fvFile, f.size());
-
-                        forAll(f, fp)
-                        {
-                            writeInt(fvFile, f[fp] + 1);
-                        }
-                    }
-                }
-            }
-        }
-
-
-        //
-        // Write regular topology
-        //
-
-        //Info<< "Writing regular elements ..." << endl;
-
-        writeInt(fvFile, FV_ELEMENTS);
-        writeInt(fvFile, topo.nTet());
-        writeInt(fvFile, topo.nHex());
-        writeInt(fvFile, topo.nPrism());
-        writeInt(fvFile, topo.nPyr());
-        fvFile.write
-        (
-            reinterpret_cast<const char*>(topo.tetLabels().begin()),
-            topo.nTet()*(1+4)*sizeof(int)
-        );
-        fvFile.write
-        (
-            reinterpret_cast<const char*>(topo.hexLabels().begin()),
-            topo.nHex()*(1+8)*sizeof(int)
-        );
-        fvFile.write
-        (
-            reinterpret_cast<const char*>(topo.prismLabels().begin()),
-            topo.nPrism()*(1+6)*sizeof(int)
-        );
-        fvFile.write
-        (
-            reinterpret_cast<const char*>(topo.pyrLabels().begin()),
-            topo.nPyr()*(1+5)*sizeof(int)
-        );
-
-
-        //
-        // Write arbitrary polyhedra
-        //
-
-        //Info<< "Writing polyhedral elements ..." << endl;
-
-
-        const cellShapeList& cellShapes = mesh.cellShapes();
-        const cellModel& unknown = *(cellModeller::lookup("unknown"));
-
-        if (topo.nPoly() > 0)
-        {
-            writeInt(fvFile, FV_ARB_POLY_ELEMENTS);
-            writeInt(fvFile, topo.nPoly());
-
-            forAll(cellShapes, celli)
-            {
-                if (cellShapes[celli].model() == unknown)
-                {
-                    const cell& cll = mesh.cells()[celli];
-
-                    // number of faces
-                    writeInt(fvFile, cll.size());
-                    // number of vertices used (no cell centre)
-                    writeInt(fvFile, countVerts(mesh, celli));
-                    // cell centre node id
-                    writeInt(fvFile, -1);
-
-                    forAll(cll, cellFacei)
-                    {
-                        label faceI = cll[cellFacei];
-
-                        const face& f = mesh.faces()[faceI];
-
-                        // Not a wall for now
-                        writeInt(fvFile, NOT_A_WALL);
-
-                        writeInt(fvFile, f.size());
-
-                        if (mesh.faceOwner()[faceI] == celli)
-                        {
-                            forAll(f, fp)
-                            {
-                                writeInt(fvFile, f[fp]+1);
-                            }
-                        }
-                        else
-                        {
-                            for (label fp = f.size()-1; fp >= 0; fp--)
-                            {
-                                writeInt(fvFile, f[fp]+1);
-                            }
-                        }
-
-                        // Number of hanging nodes
-                        writeInt(fvFile, 0);
-                    }
-                }
-            }
-        }
-
-
-        //
-        // Variables data
-        //
-
-        //Info<< "Writing variables data ..." << endl;
-
-        volPointInterpolation pInterp(mesh);
-
-        writeInt(fvFile, FV_VARIABLES);
-
-
-        forAll(volFieldPtrs, fieldI)
-        {
-            if (volFieldPtrs[fieldI] != NULL)
-            {
-                const volScalarField& vField = *volFieldPtrs[fieldI];
-
-                // Interpolate to points
-                pointScalarField psf(pInterp.interpolate(vField));
-
-                floatField fField(nPoints);
-
-                for (label pointi = 0; pointi<nPoints; pointi++)
-                {
-                    fField[pointi] = float(psf[pointi]);
-                }
-
-                fvFile.write
-                (
-                    reinterpret_cast<char*>(fField.begin()),
-                    fField.size()*sizeof(float)
-                );
-            }
-            else
-            {
-                // Create dummy field
-                floatField dummyField(nPoints, 0.0);
-
-                fvFile.write
-                (
-                    reinterpret_cast<char*>(dummyField.begin()),
-                    dummyField.size()*sizeof(float)
-                );
-            }
-        }
-
-
-        //
-        // Boundary variables data
-        //     1. volFields
-        //     2. surfFields
-
-        //Info<< "Writing regular boundary elements data ..." << endl;
-
-        writeInt(fvFile, FV_BNDRY_VARS);
-
-        forAll(volFieldPtrs, fieldI)
-        {
-            if (volFieldPtrs[fieldI] != NULL)
-            {
-                const volScalarField& vsf = *volFieldPtrs[fieldI];
-
-                forAll(mesh.boundary(), patchI)
-                {
-                    writeFaceData
-                    (
-                        mesh,
-                        topo,
-                        patchI,
-                        vsf.boundaryField()[patchI],
-                        false,
-                        fvFile
-                    );
-                }
-            }
-            else
-            {
-                forAll(mesh.boundaryMesh(), patchI)
-                {
-                    // Dummy value.
-                    floatField fField
-                    (
-                        mesh.boundaryMesh()[patchI].size()
-                      - topo.nPolyFaces()[patchI],
-                        0.0
-                    );
-
-                    fvFile.write
-                    (
-                        reinterpret_cast<char*>(fField.begin()),
-                        fField.size()*sizeof(float)
-                    );
-                }
-            }
-        }
-
-        // surfFields
-        forAll(surfFieldPtrs, fieldI)
-        {
-            if (surfFieldPtrs[fieldI] != NULL)
-            {
-                const surfaceScalarField& ssf = *surfFieldPtrs[fieldI];
-
-                forAll(mesh.boundary(), patchI)
-                {
-                    writeFaceData
-                    (
-                        mesh,
-                        topo,
-                        patchI,
-                        ssf.boundaryField()[patchI],
-                        false,
-                        fvFile
-                    );
-                }
-            }
-            else
-            {
-                forAll(mesh.boundaryMesh(), patchI)
-                {
-                    // Dummy value.
-                    floatField fField
-                    (
-                        mesh.boundaryMesh()[patchI].size()
-                      - topo.nPolyFaces()[patchI],
-                        0.0
-                    );
-
-                    fvFile.write
-                    (
-                        reinterpret_cast<char*>(fField.begin()),
-                        fField.size()*sizeof(float)
-                    );
-                }
-            }
-        }
-
-        //
-        // Polygonal faces boundary data
-        //     1. volFields
-        //     2. surfFields
-
-        //Info<< "Writing polygonal boundary elements data ..." << endl;
-
-        writeInt(fvFile, FV_ARB_POLY_BNDRY_VARS);
-        forAll(volFieldPtrs, fieldI)
-        {
-            if (volFieldPtrs[fieldI] != NULL)
-            {
-                const volScalarField& vsf = *volFieldPtrs[fieldI];
-
-                // All non-empty patches
-                forAll(mesh.boundary(), patchI)
-                {
-                    writeFaceData
-                    (
-                        mesh,
-                        topo,
-                        patchI,
-                        vsf.boundaryField()[patchI],
-                        true,
-                        fvFile
-                    );
-                }
-            }
-            else
-            {
-                forAll(mesh.boundary(), patchI)
-                {
-                    // Dummy value.
-                    floatField fField(topo.nPolyFaces()[patchI], 0.0);
-
-                    fvFile.write
-                    (
-                        reinterpret_cast<char*>(fField.begin()),
-                        fField.size()*sizeof(float)
-                    );
-                }
-            }
-        }
-
-        // surfFields
-        forAll(surfFieldPtrs, fieldI)
-        {
-            if (surfFieldPtrs[fieldI] != NULL)
-            {
-                const surfaceScalarField& ssf = *surfFieldPtrs[fieldI];
-
-                // All non-empty patches
-                forAll(mesh.boundary(), patchI)
-                {
-                    writeFaceData
-                    (
-                        mesh,
-                        topo,
-                        patchI,
-                        ssf.boundaryField()[patchI],
-                        true,
-                        fvFile
-                    );
-                }
-            }
-            else
-            {
-                forAll(mesh.boundaryMesh(), patchI)
-                {
-                    // Dummy value.
-                    floatField fField
-                    (
-                        mesh.boundaryMesh()[patchI].size()
-                      - topo.nPolyFaces()[patchI],
-                        0.0
-                    );
-
-                    fvFile.write
-                    (
-                        reinterpret_cast<char*>(fField.begin()),
-                        fField.size()*sizeof(float)
-                    );
-                }
-            }
-        }
-
-
-        //
-        // Cleanup volume and surface fields
-        //
-        forAll(volFieldPtrs, fieldI)
-        {
-            delete volFieldPtrs[fieldI];
-        }
-        forAll(surfFieldPtrs, fieldI)
-        {
-            delete surfFieldPtrs[fieldI];
-        }
-
-
-
-
-        //
-        // Spray
-        //
-        if (hasLagrangian)
-        {
-            // Read/create fields:
-            //     sprayScalarFieldPtrs: List of ptrs to lagrangian scalfields
-            //     sprayVectorFieldPtrs:               ,,           vec  ,,
-#           include "createSprayFields.H"
-
-
-            // Write time header
-
-            // Time index (FieldView: has to start from 1)
-            writeInt(fvParticleFile, fieldViewTime + 1);
-
-            // Time value
-            writeFloat(fvParticleFile, runTime.value());
-
-            // Read particles
-            Cloud<passiveParticle> parcels(mesh);
-
-            // Num particles
-            writeInt(fvParticleFile, parcels.size());
-
-            Info<< "    Writing " << parcels.size() << " particles." << endl;
-
-
-            //
-            // Output data parcelwise
-            //
-
-            label parcelNo = 0;
-
-
-            for
-            (
-                Cloud<passiveParticle>::iterator elmnt = parcels.begin();
-                elmnt != parcels.end();
-                ++elmnt, parcelNo++
-            )
-            {
-                writeInt(fvParticleFile, parcelNo+1);
-
-                writeFloat(fvParticleFile, elmnt().position().x());
-                writeFloat(fvParticleFile, elmnt().position().y());
-                writeFloat(fvParticleFile, elmnt().position().z());
-
-                forAll(sprayScalarFieldPtrs, fieldI)
-                {
-                    if (sprayScalarFieldPtrs[fieldI] != NULL)
-                    {
-                        const IOField<scalar>& sprayField =
-                            *sprayScalarFieldPtrs[fieldI];
-                        writeFloat
-                        (
-                            fvParticleFile,
-                            sprayField[parcelNo]
-                        );
-                    }
-                    else
-                    {
-                        writeFloat(fvParticleFile, 0.0);
-                    }
-                }
-                forAll(sprayVectorFieldPtrs, fieldI)
-                {
-                    if (sprayVectorFieldPtrs[fieldI] != NULL)
-                    {
-                        const IOField<vector>& sprayVectorField =
-                            *sprayVectorFieldPtrs[fieldI];
-                        const vector& val =
-                            sprayVectorField[parcelNo];
-
-                        writeFloat(fvParticleFile, val.x());
-                        writeFloat(fvParticleFile, val.y());
-                        writeFloat(fvParticleFile, val.z());
-                    }
-                    else
-                    {
-                        writeFloat(fvParticleFile, 0.0);
-                        writeFloat(fvParticleFile, 0.0);
-                        writeFloat(fvParticleFile, 0.0);
-                    }
-                }
-            }
-
-            // increment fieldView particle time
-            fieldViewTime++;
-
-
-            //
-            // Cleanup spray fields
-            //
-            forAll(sprayScalarFieldPtrs, fieldI)
-            {
-                delete sprayScalarFieldPtrs[fieldI];
-            }
-            forAll(sprayVectorFieldPtrs, fieldI)
-            {
-                delete sprayVectorFieldPtrs[fieldI];
-            }
-
-        } // end of hasLagrangian
-    }
-
-    if (!hasLagrangian)
-    {
-        rm(fvParticleFileName);
-    }
-
-    Info<< "End\n" << endl;
-
-    return 0;
-}
-
-
-// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fv_reader_tags.h b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fv_reader_tags.h
deleted file mode 100644
index 6fd11fd5dbbc17d9404deba4cbeeb26f244fe5bf..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/fv_reader_tags.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef FV_READER_TAGS_H
-#define FV_READER_TAGS_H
-
-/* Numeric tags (codes) for FIELDVIEW binary file format. */
-
-#define FV_MAGIC	0x00010203	/* decimal 66051 */
-
-/* Content of the file (grid only, results only or combined). */
-#define FV_GRIDS_FILE           1
-#define FV_RESULTS_FILE         2
-#define FV_COMBINED_FILE        3
-
-#define FV_NODES        	1001
-#define FV_FACES        	1002
-#define FV_ELEMENTS     	1003
-#define FV_VARIABLES    	1004
-#define FV_BNDRY_VARS   	1006
-#define FV_ARB_POLY_FACES       1007
-#define FV_ARB_POLY_ELEMENTS    1008
-#define FV_ARB_POLY_BNDRY_VARS  1009
-
-#define FV_TET_ELEM_ID          1
-#define FV_HEX_ELEM_ID          2
-#define FV_PRISM_ELEM_ID        3
-#define FV_PYRA_ELEM_ID         4
-#define FV_ARB_POLY_ELEM_ID     5
-
-/* Values for "wall_info" array (see comments in fv_encode_elem_header). */
-#ifdef __STDC__
-#define A_WALL         (07u)
-#define NOT_A_WALL     (0u)
-#else
-#define A_WALL         (07)
-#define NOT_A_WALL     (0)
-#endif
-
-#endif /* FV_READER_TAGS_H */
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H
deleted file mode 100644
index ec540efe7df467f5ce5136303309ce71eb3b602e..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H
+++ /dev/null
@@ -1,68 +0,0 @@
-HashSet<word> volScalarHash;
-HashSet<word> volVectorHash;
-HashSet<word> surfScalarHash;
-HashSet<word> surfVectorHash;
-HashSet<word> sprayScalarHash;
-HashSet<word> sprayVectorHash;
-
-forAll(timeDirs, timeI)
-{
-    runTime.setTime(timeDirs[timeI], timeI);
-
-    // Add all fields to hashtable
-    IOobjectList objects(mesh, runTime.timeName());
-    {
-        wordList fieldNames(objects.names(volScalarField::typeName));
-        forAll(fieldNames, fieldI)
-        {
-            volScalarHash.insert(fieldNames[fieldI]);
-        }
-    }
-    {
-        wordList fieldNames(objects.names(volVectorField::typeName));
-        forAll(fieldNames, fieldI)
-        {
-            volVectorHash.insert(fieldNames[fieldI]);
-        }
-    }
-    {
-        wordList fieldNames(objects.names(surfaceScalarField::typeName));
-        forAll(fieldNames, fieldI)
-        {
-            surfScalarHash.insert(fieldNames[fieldI]);
-        }
-    }
-    {
-        wordList fieldNames(objects.names(surfaceVectorField::typeName));
-        forAll(fieldNames, fieldI)
-        {
-            surfVectorHash.insert(fieldNames[fieldI]);
-        }
-    }
-
-
-    // Same for spray
-    IOobjectList sprayObjects(mesh, runTime.timeName(), cloud::prefix);
-    {
-        wordList fieldNames(sprayObjects.names(scalarIOField::typeName));
-        forAll(fieldNames, fieldI)
-        {
-            sprayScalarHash.insert(fieldNames[fieldI]);
-        }
-    }
-    {
-        wordList fieldNames(sprayObjects.names(vectorIOField::typeName));
-        forAll(fieldNames, fieldI)
-        {
-            sprayVectorHash.insert(fieldNames[fieldI]);
-        }
-    }
-}
-
-
-wordList volScalarNames(volScalarHash.toc());
-wordList volVectorNames(volVectorHash.toc());
-wordList surfScalarNames(surfScalarHash.toc());
-wordList surfVectorNames(surfVectorHash.toc());
-wordList sprayScalarNames(sprayScalarHash.toc());
-wordList sprayVectorNames(sprayVectorHash.toc());
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/moveMesh.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/moveMesh.H
deleted file mode 100644
index 68d0f6f2ccd5850c40bb50b7cce8e4af90cc1d43..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/moveMesh.H
+++ /dev/null
@@ -1,34 +0,0 @@
-
-//
-// Check if new points (so moving mesh)
-//
-{
-    IOobject pointsHeader
-    (
-        "points",
-        runTime.timeName(),
-        polyMesh::defaultRegion,
-        runTime
-    );
-    if (pointsHeader.headerOk())
-    {
-        // points exists for time step, let's read them
-        Info<< "    Points file detected - updating points" << endl;
-
-        // Reading new points
-        pointIOField newPoints
-        (
-            IOobject
-            (
-                "points",
-                runTime.timeName(),
-                polyMesh::defaultRegion,
-                mesh,
-                IOobject::MUST_READ,
-                IOobject::NO_WRITE
-            )
-        );
-
-        mesh.polyMesh::movePoints(newPoints);
-    }
-}
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeFunctions.C b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeFunctions.C
deleted file mode 100644
index e690b45140ac1c3a45b0fbeea76dd78b976f7ff1..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeFunctions.C
+++ /dev/null
@@ -1,97 +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 "writeFunctions.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-// C++ version of fwrite_str80 from FieldView/uns/write_binary_uns.c
-// Write padded string of 80 char.
-bool writeStr80(std::ostream& os, const string& str)
-{
-    char cBuf[80];
-
-    memset(cBuf, '\0', 80);
-
-    int len = str.size();
-
-    strncpy(cBuf, str.c_str(), (len < 80 ? len : 80));
-
-    os.write(cBuf, 80*sizeof(char));
-
-    return os.good();
-}
-
-
-// Write single integer
-bool writeInt(std::ostream& os, int val1)
-{
-    os.write(reinterpret_cast<char*>(&val1), sizeof(int));
-
-    return os.good();
-}
-
-
-// Write single float
-bool writeFloat(std::ostream& os, scalar val1)
-{
-    float floatVal = val1;
-
-    os.write(reinterpret_cast<char*>(&floatVal), sizeof(float));
-
-    return os.good();
-}
-
-
-// Debug: write raw bytes
-void writeBytes(char* start, int nBytes)
-{
-    cout.setf(std::ios::hex, std::ios::basefield);
-
-    cout<< start << " : ";
-
-    for (int i = 0; i < nBytes; i++)
-    {
-        cout<< " " << start[i];
-    }
-    cout << std::endl;
-
-    cout.setf(std::ios::dec);
-}
-
-
-// Debug: write wall flags data
-void writeWallFlags(Ostream& os, label cellI, const labelList& wallFlags)
-{
-    os  << "cell " << cellI << " wallsFlags:";
-    forAll(wallFlags, wallFaceI)
-    {
-        os  << wallFlags[wallFaceI] << ' ';
-    }
-    os  << endl;
-}
-
-
-// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeSprayHeader.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeSprayHeader.H
deleted file mode 100644
index 377e1e2c082b7f83ae9abd4ff0cc4382631f4e46..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeSprayHeader.H
+++ /dev/null
@@ -1,26 +0,0 @@
-{
-    /* Output the magic number. */
-    writeInt(fvParticleFile, FV_MAGIC);
-
-    /* Output file header and version number. */
-    writeStr80(fvParticleFile, "FVPARTICLES");
-
-    /* version */
-    writeInt(fvParticleFile, 1);
-    writeInt(fvParticleFile, 1);
-
-    int nFields = sprayScalarNames.size() + 3*sprayVectorNames.size();
-    writeInt(fvParticleFile, nFields);
-
-    forAll(sprayScalarNames, nameI)
-    {
-        writeStr80(fvParticleFile, sprayScalarNames[nameI]);
-    }
-    forAll(sprayVectorNames, nameI)
-    {
-        const string& name(sprayVectorNames[nameI]);
-        writeStr80(fvParticleFile, name + ("x;" + name));
-        writeStr80(fvParticleFile, name + ("y;" + name));
-        writeStr80(fvParticleFile, name + ("z;" + name));
-    }
-}
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/write_binary_uns.c b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/write_binary_uns.c
deleted file mode 100644
index 6cd3eb6620b4ebfed7b19341a08af33118e25f6a..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/write_binary_uns.c
+++ /dev/null
@@ -1,641 +0,0 @@
-/*
-** Support functions for writing a combined (grid and results) file
-** in the binary FIELDVIEW unstructured format.
-*/
-
-/* Include system stuff for I/O and string and exit functions. */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* Include the defines for the FV_* codes and wall_info values. */
-#include "fv_reader_tags.h"
-
-
-/* Don't change these - used by fv_encode_elem_header ! */
-#define MAX_NUM_ELEM_FACES     6
-#define BITS_PER_WALL  3
-#define ELEM_TYPE_BIT_SHIFT    (MAX_NUM_ELEM_FACES*BITS_PER_WALL)
-
-
-/*
-** fv_encode_elem_header:  return an encoded binary element header
-**
-** Input:
-**    elem_type:  integer element type as shown in fv_reader_tags.h
-**    wall_info:  array of integer "wall" flags, one for each face of
-**                the element.  The wall flags are used during streamline
-**                calculation.  Currently, the only meaningful values are
-**                A_WALL and NOT_A_WALL as shown in fv_reader_tags.h.
-**                Streamlines are forced away from faces marked as
-**                "A_WALL", by limiting velocity and position very near
-**                the wall.
-** Output:
-**    Function return value is the encoded binary element header.
-*/
-
-#ifdef __STDC__
-unsigned int fv_encode_elem_header (int elem_type, int wall_info[])
-#else
-unsigned int fv_encode_elem_header (elem_type, wall_info)
-int elem_type;
-int wall_info[];
-#endif
-{
-    unsigned int header;
-    int i, nfaces;
-
-    switch (elem_type)
-    {
-        case FV_TET_ELEM_ID:
-            header = (1 << ELEM_TYPE_BIT_SHIFT);
-            nfaces = 4;
-            break;
-        case FV_HEX_ELEM_ID:
-            header = (4 << ELEM_TYPE_BIT_SHIFT);
-            nfaces = 6;
-            break;
-        case FV_PRISM_ELEM_ID:
-            header = (3 << ELEM_TYPE_BIT_SHIFT);
-            nfaces = 5;
-            break;
-        case FV_PYRA_ELEM_ID:
-            header = (2 << ELEM_TYPE_BIT_SHIFT);
-            nfaces = 5;
-            break;
-        default:
-            fprintf(stderr, "ERROR:  Unknown element type\n");
-            return 0;
-    }
-
-    for (i = 0; i < nfaces; i++)
-    {
-        unsigned int u = wall_info[i];
-        if (u > A_WALL)
-        {
-            fprintf(stderr, "ERROR:  Bad wall value\n");
-            return 0;
-        }
-        header |= (u << (i*BITS_PER_WALL));
-    }
-    return header;
-}
-
-/*
-** fwrite_str80:  write out a string padded to 80 characters.
-**
-** Like fwrite, this returns the number of items written, which
-** should be 80 if successful, and less than 80 if it failed.
-*/
-#ifdef __STDC__
-size_t fwrite_str80 (char *str, FILE *fp)
-#else
-int fwrite_str80 (str, fp)
-char *str;
-FILE *fp;
-#endif
-{
-    char cbuf[80];
-    size_t len;
-    int i;
-
-    /* Most of this just to avoid garbage after the name. */
-    len = strlen(str);
-    strncpy(cbuf, str, len < 80 ? len : 80);
-
-    for (i = len; i < 80; i++)
-        cbuf[i] = '\0';  /* pad with zeros */
-
-    return fwrite(cbuf, sizeof(char), 80, fp);
-}
-
-
-/*
-** Sample program which writes out a single unstructured grid containing
-** four hex elements, with pressure and velocity data at the nodes, and
-** surface data for temperature and velocity on some of the boundaries.
-**
-** The data is written as a combined (grid and results) file in the
-** binary FIELDVIEW unstructured format.
-**
-** For simplicity, no error checking is done on the calls to fwrite
-** and fwrite_str80.
-*/
-#if 0	/***** CHANGE THIS TO "#if 1" TO RUN THE SAMPLE PROGRAM. *****/
-int main()
-{
-    char *file_name = "quad_hex.uns";
-    FILE *outfp;
-    int num_grids = 1;
-    int num_face_types = 5;
-    /*
-    ** Note that one of the boundary type names is "wall."
-    ** The boundary name "wall" has no special meaning in FIELDVIEW.
-    ** Boundary types and element walls are independent pieces of
-    ** information.  The only way to mark an element face as a wall
-    ** (for streamline calculation) is with the wall_info array passed
-    ** to fv_encode_elem_header.
-    */
-    static char *face_type_names[5] = { "bottom", "top", "wall",
-                                        "trimmed cell", "hanging node cell"};
-    /*
-    ** Each boundary type is flagged with 1 or 0 depending on
-    ** whether surface results are present or absent (see below).
-    */
-    static int results_flag[5]      =  { 1, 1, 0, 1, 1 };
-    /*
-    ** Each boundary type is flagged with 1 or 0 depending on
-    ** whether surface normals can be calculated from a "right
-    ** hand rule" (see below).
-    */
-    static int normals_flag[5]      =  { 1, 1, 0, 1, 1 };
-
-    /*
-    ** Note that vector variables are specified by a ';' and vector name
-    ** following the first scalar name of 3 scalar components of the
-    ** vector.  If writing 2-D results, the third component must still
-    ** be provided here, and its values must be written in the variables
-    ** section below (typically padded with zeros.)
-    */
-    int num_vars = 4;
-    static char *var_names[4] = { "pressure", "uvel; velocity", "vvel", "wvel" };
-    int num_bvars = 4;
-    static char *bvar_names[4] = { "temperature", "uvel; velocity", "vvel", "wvel" };
-
-    unsigned int elem_header;
-    int grid, i;
-    int ibuf[10];
-
-    int nnodes = 31;	/* Number of nodes in the grid. */
-    const int num_faces_trim_cell = 7;
-    const int num_faces_hang_cell = 6;
-
-    /* Constants. */
-    static float consts[4] = { 1., 0., 0., 0. };
-
-    /* XYZ coordinates of the nodes. */
-    static float x[31] = {-1., -1., 1., 1., -1., -1., 1., 1., -1., -1., 1.,1., 			  	  2., 2., 3., 3., 2.5, 3., 2., 3., 3., 2., 2.5,
-        		   3., 3., 3., 2.5, 2., 2., 2.0, 2.5};
-
-    static float y[31] = {-1., -1., -1., -1., 1., 1., 1., 1., 3., 3., 3., 3.,
-                           0., 0., 0., 0., 0., .5, 1., 1., 1., 1., .5,
-			   2., 2., 1.5, 2., 2., 2., 1.45, 1.5};
-
-    static float z[31] = {-1., 1., -1., 1., -1., 1., -1., 1., -1., 1., -1.,1.,			  	  1., 0., 0., .5, 1., 1., 1., 1., 0., 0., .5,
-			   0., 1., 1., 1., 1., 0., 1., 1.};
-
-    /* hex1 and hex2 are hex elements, defined as an array of node numbers. */
-    static int hex1[8] = {1,2,3,4,5,6,7,8};
-    static int hex2[8] = {5,6,7,8,9,10,11,12};
-
-    /*
-    ** Face definitions for boundary faces.
-    ** All faces have 4 vertices.  If the face is triangular,
-    ** the last vertex should be zero.
-    */
-    static int bot_faces[4] = { 1,2,4,3 };
-    static int top_faces[4] = { 9,10,12,11 };
-    static int wall_faces[8][4] =
-        { {1,2,6,5}, {5,6,10,9}, {3,4,8,7}, {7,8,12,11},
-          {1,3,7,5}, {5,7,11,9}, {2,4,8,6}, {6,8,12,10} };
-
-    /* Arbitrary Polyhedron faces: */
-    static int trim_cell_face[num_faces_trim_cell][6] =
-                                      { {5,13,14,15,16,17}, {3,16,18,17},
-					{5,15,21,20,18,16}, {5,13,17,18,20,19},
-					{4,13,19,22,14},  {4,14,22,21,15},
-					{4,19,20,21,22} };
-
-    static int hang_cell_face[num_faces_hang_cell][8] =
-                                        { {5,20,21,24,25,26},
-					  {5,24,29,28,27,25},
-					  {7,20,26,25,27,28,30,19},
-					  {4,20,19,22,21},
-				          {4,21,22,29,24},
-					  {5,22,19,30,28,29} };
-
-    /* Wall values for element faces. */
-    static int hex1_walls[6] = { A_WALL, A_WALL, NOT_A_WALL,
-	    NOT_A_WALL, A_WALL, A_WALL };
-    static int hex2_walls[6] = { A_WALL, A_WALL, NOT_A_WALL,
-	    NOT_A_WALL, A_WALL, A_WALL };
-
-    /* 4 variables (pressure and velocity values) at the 31 grid nodes. */
-    static float vars[4][31] =
-      { {1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,1.10,1.11,
-         1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,1.10,1.11,
-         1.12,1.13,1.14,1.15,1.16,1.17,1.18},
-        {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,
-	 1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,1.10,1.11,
-	 1.12,1.13,1.14,1.15,1.16,1.17,1.18},
-        {1.2,1.1,1.0,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,
-	 1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,1.10,1.11,
-	 1.12,1.13,1.14,1.15,1.16,1.17,1.18},
-        {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,
-	 1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,1.10,1.11,
-	 1.12,1.13,1.14,1.15,1.16,1.17,1.18} };
-
-    /*
-    ** 4 boundary variables (temperature and velocity values) defined on
-    ** the single top face, and the the single bottom face.
-    */
-    static float top_bvars[4] = { 1.0, 2.0,4.0,2.5 };
-    static float bot_bvars[4] = { 1.0, 4.5,3.0,3.0 };
-
-    /* Arbitrary Polyhedron boundary face variables: */
-    static float trim_cell_bvars[4][num_faces_trim_cell] =
-                                      { {1.0,1.1,1.2,1.3,1.4,1.5,1.6},
-					{1.7,1.8,1.9,1.1,1.11,1.12,1.13},
-					{1.14,1.15,1.16,1.17,1.18,1.19,1.2},
-					{1.21,1.22,1.23,1.24,1.25,1.26,1.27} };
-
-    static float hang_cell_bvars[4][num_faces_hang_cell] =
-                                         { {1.1,1.11,1.12,1.13,1.14,1.15},
-					   {1.16,1.17,1.18,1.19,1.2,1.21},
-					   {1.22,1.23,1.24,1.25,1.26,1.27},
-					   {1.28,1.29,1.30,1.31,1.32,1.33} };
-
-    /* Open the file for binary write access. */
-    if ((outfp = fopen(file_name, "wb")) == NULL)
-    {
-        perror ("Cannot open output file");
-        exit(1);
-    }
-
-    /* Output the magic number. */
-    ibuf[0] = FV_MAGIC;
-    fwrite(ibuf, sizeof(int), 1, outfp);
-
-    /* Output file header and version number. */
-    fwrite_str80("FIELDVIEW", outfp);
-
-    /*
-    ** This version of the FIELDVIEW unstructured file is "3.0".
-    ** This is written as two integers.
-    */
-    ibuf[0] = 3;
-    ibuf[1] = 0;
-    fwrite(ibuf, sizeof(int), 2, outfp);
-
-    /* File type code - new in version 2.7 */
-    ibuf[0] = FV_COMBINED_FILE;
-    fwrite(ibuf, sizeof(int), 1, outfp);
-
-    /* Reserved field, always write a zero - new in version 2.6 */
-    ibuf[0] = 0;
-    fwrite(ibuf, sizeof(int), 1, outfp);
-
-    /* Output constants for time, fsmach, alpha and re. */
-    fwrite(consts, sizeof(float), 4, outfp);
-
-    /* Output the number of grids. */
-    ibuf[0] = num_grids;
-    fwrite(ibuf, sizeof(int), 1, outfp);
-
-    /*
-    ** Output the table of boundary types.
-    ** Each boundary type is preceded by 2 integer flags.
-    ** The first flag is an "surface results flag".
-    ** A value of 1 means surface results will be present for this
-    ** boundary type (if any boundary variables are specified in the
-    ** boundary variable names table below).
-    ** A value of 0 means no surface results will be present.
-    ** The second flag indicates whether boundary faces of this type have
-    ** consistent "clockness" for the purpose of calculating a surface
-    ** normal.  A value of 1 means that all faces of this type are
-    ** written following a "right hand rule" for clockness.  In other
-    ** words, if the vertices are written on counter-clockwise:
-    ** 4 --- 3
-    ** |     |
-    ** 1 --- 2
-    ** then the normal to the face is pointing towards you (not away
-    ** from you).  A value of 0 means that the faces do not have any
-    ** consistent clockness.  The "clockness" of surface normals is
-    ** only used for calculating certain special surface integrals
-    ** that involve surface normals.  If the surface normals flag
-    ** is 0, these special integrals will not be available.
-    */
-    ibuf[0] = num_face_types;
-    fwrite(ibuf, sizeof(int), 1, outfp);
-    for (i = 0; i < num_face_types; i++) {
-	ibuf[0] = results_flag[i];
-	ibuf[1] = normals_flag[i];
-	fwrite(ibuf, sizeof(int), 2, outfp);
-        fwrite_str80(face_type_names[i], outfp);
-    }
-
-    /* Output the table of variable names. */
-    /* The number of variables can be zero. */
-    ibuf[0] = num_vars;
-    fwrite(ibuf, sizeof(int), 1, outfp);
-    for (i = 0; i < num_vars; i++)
-        fwrite_str80(var_names[i], outfp);
-
-    /*
-    ** Output the table of boundary variable names.
-    ** Boundary variables are associated with boundary faces, rather than
-    ** with grid nodes.
-    ** FIELDVIEW will automatically append "[BNDRY]" to each name
-    ** so boundary variables can be easily distinguished from ordinary
-    ** (grid node) variables.
-    ** The number of boundary variables can be different from the number
-    ** of ordinary variables.  The number of boundary variables can be
-    ** zero.
-    */
-    ibuf[0] = num_bvars;
-    fwrite(ibuf, sizeof(int), 1, outfp);
-    for (i = 0; i < num_bvars; i++)
-        fwrite_str80(bvar_names[i], outfp);
-
-    /* Output grid data. */
-    for (grid = 0; grid < num_grids; grid++)
-    {
-	/* Output the node definition section for this grid. */
-        ibuf[0] = FV_NODES;
-        ibuf[1] = nnodes;
-        fwrite(ibuf, sizeof(int), 2, outfp);
-
-	/*
-	** Output the X, then Y, then Z node coordinates.
-	** Note that all of the X coordinates are output before any of
-	** the Y coordinates.
-	*/
-        fwrite(x, sizeof(float), nnodes, outfp);
-        fwrite(y, sizeof(float), nnodes, outfp);
-        fwrite(z, sizeof(float), nnodes, outfp);
-
-	/*
-        ** Output boundary faces of the 3 different types.
-	** All faces have 4 vertices.  If the face is triangular,
-	** the last vertex should be zero.
-	** TIP: A single boundary type can be broken into several sections
-	** if you prefer.  Also, boundary face sections do not have to
-	** be in order.  You may have a section of 10 faces of type 3,
-	** followed by a section of 20 faces of type 2, followed by a
-	** section of 15 more faces of type 3.  Breaking a boundary
-	** type into very many short sections is less efficient.  The
-	** boundaries will require more memory and be somewhat
-	** slower to calculate in FIELDVIEW.
-	**
-	*/
-        ibuf[0] = FV_FACES;
-        ibuf[1] = 1;	/* first boundary type */
-        ibuf[2] = 1;	/* number of faces of this type */
-        fwrite(ibuf, sizeof(int), 3, outfp);
-        fwrite(bot_faces, sizeof(int), 4, outfp);
-
-        ibuf[0] = FV_FACES;
-        ibuf[1] = 2;	/* second boundary type */
-        ibuf[2] = 1;	/* number of faces of this type */
-        fwrite(ibuf, sizeof(int), 3, outfp);
-        fwrite(top_faces, sizeof(int), 4, outfp);
-
-        ibuf[0] = FV_FACES;
-        ibuf[1] = 3;	/* third boundary type */
-        ibuf[2] = 8;	/* number of faces of this type */
-        fwrite(ibuf, sizeof(int), 3, outfp);
-        fwrite(wall_faces, sizeof(int), 8*4, outfp);
-
-	/* Arbitrary Polygon boundary faces:
-	** The format (in psuedocode) is as follows:
-	**   >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-	**   FV_ARB_POLY_FACES (section header)
-	**   BndryFaceType NumBndryFaces
-	**
-	**   [for N = 1, NumBndryFaces]
-	**       NumVertsFaceN Vert1 Vert2 ... Vert{NumVertsFaceN}
-	**
-	**   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-	** * The above block should be repeated for different boundary face
-	** 	types, as is the case for standard boundary faces.
-	** * These blocks should be after the blocks for standard faces,
-	** 	within the FIELDVIEW-Uns file.
-	** * The node ordering for specifying faces should follow a
-	**	right-handed rule with the normal pointing away from the
-	**	cell center. So nodes should be given by traversing the face
-	** 	in a counter-clockwise manner.
-	** * Hanging nodes are not permitted on boundary faces.
-	*/
-
-	ibuf[0] = FV_ARB_POLY_FACES;
-	ibuf[1] = 4;  /* boundary face type */
-	ibuf[2] = 7;  /* num faces for the trimmed cell */
-
-	fwrite(ibuf, sizeof(int), 3, outfp);
-
-	for (i = 0; i < num_faces_trim_cell; ++i) /* loop over the faces */
-	    fwrite(trim_cell_face[i], sizeof(int), trim_cell_face[i][0] + 1,
-		   outfp);
-
-	ibuf[0] = FV_ARB_POLY_FACES;
-	ibuf[1] = 5;  /* boundary face type */
-	ibuf[2] = 6;  /* num faces for the hanging node cell */
-
-	fwrite(ibuf, sizeof(int), 3, outfp);
-
-	for (i = 0; i < num_faces_hang_cell; ++i) /* loop over the faces */
-	    fwrite(hang_cell_face[i], sizeof(int), hang_cell_face[i][0] + 1,
-		   outfp);
-
-	/*
-	** Start an elements section.
-	** There may be as many elements sections as needed.
-	** Each section may contain a single element type or a
-	** mixture of element types.
-	** For maximum efficiency, each section should contain
-	** a significant percentage of the elements in the grid.
-	** The most efficient case is a single section containing
-	** all elements in the grid.
-	*/
-        ibuf[0] = FV_ELEMENTS;
-        ibuf[1] = 0;  /* tet count */
-        ibuf[2] = 2;  /* hex count */
-        ibuf[3] = 0;  /* prism count */
-        ibuf[4] = 0;  /* pyramid count */
-        fwrite(ibuf, sizeof(int), 5, outfp);
-
-        /* Write header for first element. */
-        elem_header = fv_encode_elem_header(FV_HEX_ELEM_ID, hex1_walls);
-	if (elem_header == 0)
-	{
-	    fprintf (stderr, "fv_encode_elem_header failed for first hex.\n");
-	    exit(1);
-	}
-	fwrite (&elem_header, sizeof(elem_header), 1, outfp);
-
-	/* Write node definition for first element. */
-        fwrite(hex1, sizeof(int), 8, outfp);
-
-        /* Write header for second element. */
-        elem_header = fv_encode_elem_header(FV_HEX_ELEM_ID, hex2_walls);
-	if (elem_header == 0)
-	{
-	    fprintf (stderr, "fv_encode_elem_header failed for second hex.\n");
-	    exit(1);
-	}
-	fwrite (&elem_header, sizeof(elem_header), 1, outfp);
-
-	/* Write node definition for second element. */
-        fwrite(hex2, sizeof(int), 8, outfp);
-
-        /* Arbitrary Polyhedron elements:
-	** The format (in psuedocode) is as follows:
-	** >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-	** FV_ARB_POLY_ELEMENTS (section header)
-	** NumArbPolyElements
-	**
-	** [for elem = 1, NumArbPolyElements]
-	** {
-	**    NumFaces NumNodesElement CenterNode
-	**
-	**    [for face = 1, NumFaces]
-	**        WallFlag NumNodesFace FaceNode1 ... FaceNode{NumNodesFace}
-	**	NumHangNodes HangNode1 ... HangNode{NumHangNodes}
-	** }
-	** <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-	** * These blocks can be after or before the standard element blocks.
-	** 	There can be any number of these for any one grid.
-	** * The WallFlag has the same meaning as for standard elements,
-	** 	i.e., A_WALL or NOT_A_WALL.
-	** * The node ordering for specifying faces should follow a
-	**	right-handed rule with the normal pointing away from the
-	**	cell center. So nodes should be given by traversing the face
-	** 	in a counter-clockwise manner.
-	** * Hanging nodes are associated with a face interior and should
-	** 	not be on an edge. Hanging nodes on an edge should be
-	**	interpretted as a regular face node.
-	*/
-	ibuf[0] = FV_ARB_POLY_ELEMENTS;
-	ibuf[1] = 2; /* have 2 elements here */
-
-	fwrite(ibuf, sizeof(int), 2, outfp);
-
-	/* trimmed face element */
-	ibuf[0] = 7;  /* num faces for the trimmed cell */
-	ibuf[1] = 11; /* number of nodes including a center node */
-	ibuf[2] = 23; /* the center node */
-	fwrite(ibuf, sizeof(int), 3, outfp);
-
-	ibuf[0] = A_WALL; /* wall value */
-	ibuf[1] = 0; /* number of hanging nodes */
-
-	for (i = 0; i < num_faces_trim_cell; ++i) /* write out face info */
-	{
-	    fwrite(ibuf, sizeof(int), 1, outfp); /* write wall value */
-	    fwrite(trim_cell_face[i], sizeof(int), trim_cell_face[i][0] + 1,
-		   outfp); /* write num verts and verts */
-	    fwrite(&ibuf[1], sizeof(int), 1, outfp); /* write num hang nodes */
-	}
-
-        /* hanging node element */
-	ibuf[0] = 6;  /* num faces for the hanging node cell */
-	ibuf[1] = 12; /* number of nodes excluding a center node */
-	ibuf[2] = -1; /* the center node, this indicates that FIELDVIEW
-		     ** should calculate the center node and associated
-		     ** centernode variable values
-		     */
-	fwrite(ibuf, sizeof(int), 3, outfp);
-
-	ibuf[0] = A_WALL; /* wall value */
-	ibuf[1] = 0; /* number of hanging nodes */
-	ibuf[2] = 1; /* number of hanging nodes for face 3 */
-	ibuf[3] = 31; /* the node number for the hanging node on face 3*/
-
-	for (i = 0; i < 2; ++i) /* write out face info for first 2 faces */
-	{
-	    fwrite(ibuf, sizeof(int), 1, outfp); /* write wall value */
-	    fwrite(hang_cell_face[i], sizeof(int), hang_cell_face[i][0] + 1,
-		   outfp); /* write num verts and verts */
-	    fwrite(&ibuf[1], sizeof(int), 1, outfp); /* write num hang nodes */
-	}
-
-	/* this face has a hanging node */
-	fwrite(ibuf, sizeof(int), 1, outfp);
-	fwrite(hang_cell_face[2], sizeof(int), hang_cell_face[2][0] + 1, outfp);
-	fwrite(&ibuf[2], sizeof(int), 2, outfp);
-
-	/* write out face info for last 3 faces */
-	for (i = 3; i < num_faces_hang_cell; ++i)
-	{
-	    fwrite(ibuf, sizeof(int), 1, outfp); /* write wall value */
-	    fwrite(hang_cell_face[i], sizeof(int), hang_cell_face[i][0] + 1,
-		   outfp); /* write num verts and verts */
-	    fwrite(&ibuf[1], sizeof(int), 1, outfp); /* write num hang nodes */
-	}
-
-        /*
-	** Output the variables data.
-	** You must write the section header even if the number
-	** of variables is zero.
-	*/
-	ibuf[0] = FV_VARIABLES;
-	fwrite(ibuf, sizeof(int), 1, outfp);
-
-	/*
-	** Note that all of the data for the first variable is output
-	** before any of the data for the second variable.
-	*/
-	for (i = 0; i < num_vars; i++)
-	    fwrite(vars[i], sizeof(float), nnodes, outfp);
-
-        /*
-	** Output the boundary variables data.
-	** Remember that the Boundary Table above has a "surface results
-	** flag" indicating which boundary types have surface results.
-	** The data should be written in the same order as the faces in
-	** the Boundary Faces section, skipping over faces whose boundary
-	** type has a surface results flag of zero (false).
-	** For each variable, you should write one number per boundary face.
-	** You must write the section header even if the number of boundary
-	** variables is zero.
-	*/
-	ibuf[0] = FV_BNDRY_VARS;
-	fwrite(ibuf, sizeof(int), 1, outfp);
-
-	/*
-	** Note that all of the data for the first variable is output
-	** before any of the data for the second variable.
-	*/
-	for (i = 0; i < num_bvars; i++) {
-	    int num_faces;
-	    /*
-	    ** The data for the bottom face is written first for each
-	    ** variable, because the bottom face was written first in the
-	    ** "Boundary Faces" section.
-	    ** The "wall" faces are skipped, because the surface results
-	    ** flag for the wall boundary type was 0 (false) in the
-	    ** Boundary Table section.
-	    */
-	    num_faces = 1;	/* number of bottom faces */
-	    fwrite(&bot_bvars[i], sizeof(float), num_faces, outfp);
-	    num_faces = 1;	/* number of top faces */
-	    fwrite(&top_bvars[i], sizeof(float), num_faces, outfp);
-	}
-
-	/* Arbitrary Polyhedron boundary face results:
-	** The format is the same as for standard boundary face results.
-	*/
-	ibuf[0] = FV_ARB_POLY_BNDRY_VARS;
-	fwrite(ibuf, sizeof(int), 1, outfp);
-
-	for (i = 0; i < num_bvars; ++i)
-	{
-	    int num_faces;
-
-	    num_faces = 7;  /* num faces for the trimmed cell */
-	    fwrite(trim_cell_bvars[i], sizeof(float), num_faces, outfp);
-
-	    num_faces = 6;  /* num faces for the hanging node cell */
-	    fwrite(hang_cell_bvars[i], sizeof(float), num_faces, outfp);
-	}
-    }
-
-    if (fclose(outfp) != 0)
-    {
-	perror ("Cannot close output file");
-	exit(1);
-    }
-
-    return 0;
-}
-#endif	/* end commenting out the sample program */
diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.C b/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.C
index 69c76ff754b817966e18f94c26f00f3ba885b75f..7195ec2ced2452e5cf2e02405296f6f47a84df4b 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    foamToGMV
+
 Description
     Translates foam output to GMV readable files.
 
@@ -39,7 +42,6 @@ Description
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C
index 098c2e0e04025284177364c57bc2aebbc861f1bf..870f33f24b308a08ea9ab3c9ef2931e295add05a 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -159,7 +159,6 @@ labelList getSelectedPatches
 
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C b/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C
index 39544cd3d83ddd887c5110b77c3ec3a935c3f9ea..00db027b2068465507f4218d11ffdef5fcb69f3c 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -142,7 +142,6 @@ void ReadAndMapFields
 
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
index 247abb6f0e51d5ed5062752e25017a3e3d7e8139..d74211866e9d7b52a396284f076ebce9eae14f49 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -227,7 +227,6 @@ labelList getSelectedPatches
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/postProcessing/dataConversion/smapToFoam/Make/files b/applications/utilities/postProcessing/dataConversion/smapToFoam/Make/files
index 994212cf03499947199c09858c1cc22405c83f31..5df42a80bdd7055c096d0a23a64a8c99190e9a01 100644
--- a/applications/utilities/postProcessing/dataConversion/smapToFoam/Make/files
+++ b/applications/utilities/postProcessing/dataConversion/smapToFoam/Make/files
@@ -1,2 +1,3 @@
 smapToFoam.C
+
 EXE = $(FOAM_APPBIN)/smapToFoam
diff --git a/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C b/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C
index 36d6c845813fbd150788b472e479aa7000d03b61..506166a409155622675a8ac6cad38bebda4f8681 100644
--- a/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C
+++ b/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    smapToFoam
+
 Description
     Translates a STAR-CD SMAP data file into OpenFOAM field format.
 
@@ -30,7 +33,6 @@ Description
 #include "IFstream.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake b/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake
deleted file mode 100755
index e4825541df7abca62ba2b230030f6046cef7a2e2..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-# disabled
-
-# if [ "$FV_HOME" -a -r $FV_HOME ]
-# then
-#    wmake fieldview9Reader
-# fi
-
-# ----------------------------------------------------------------- end-of-file
diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/Make/files b/applications/utilities/postProcessing/graphics/fieldview9Reader/Make/files
deleted file mode 100644
index 2b7c03bf8059de3abf6e7544add6c585472f78fb..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/graphics/fieldview9Reader/Make/files
+++ /dev/null
@@ -1,5 +0,0 @@
-errno.c
-readerDatabase.C
-fieldview9Reader.C
-
-EXE = $(FOAM_APPBIN)/fvbinFoam
diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/Make/options b/applications/utilities/postProcessing/graphics/fieldview9Reader/Make/options
deleted file mode 100644
index 1303d319afce22a4438a85aea682122ff3ceae8b..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/graphics/fieldview9Reader/Make/options
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Note: compilation options takes from ld_fv script from Fieldview9.
- * Only Linux tested.
- *
- */
-
-#if defined(linux) || defined(linux64)
-
-    FV_LIBS = \
-        $(FV_HOME)/user/obj/linux_x86/fv.o \
-        -lGL -lGLU -lXmu -lXp -lXt $(XLIBS) -ldl
-
-#elif defined(solaris) || defined(solarisGcc)
-
-    FV_LIBS = \
-        $(FV_HOME)/user/obj/solaris/fv.o \
-        -i \
-        -L/usr/dt/lib -R/usr/dt/lib -lMrm -lXm \
-        -L/opt/SUNWits/Graphics-sw/xgl-3.0/lib \
-        -R/opt/SUNWits/Graphics-sw/xgl-3.0/lib -lxgl \
-        -L/usr/openwin/lib -R/usr/openwin/lib \
-        -L$(FV_HOME)/user/obj/solaris \
-        -lGL -lGLU  -lXt $(XLIBS) \
-        -lgen -lnsl -lsocket -lw -lintl -ldl
-
-#elif defined(sgiN32) || defined(sgiN32Gcc)
-
-    FV_LIBS = \
-        $(FV_HOME)/user/obj/iris/fv.o \
-        $(FV_HOME)/user/obj/iris/fv2.o \
-        $(FV_HOME)/user/obj/iris/fv3.o \
-        $(FV_HOME)/user/obj/iris/netserver.o \
-        $(FV_HOME)/user/obj/iris/pV_Server.o \
-        $(FV_HOME)/user/obj/iris/dore.o \
-        $(FV_HOME)/user/obj/iris/libpV3ser.a \
-        $(FV_HOME)/user/obj/iris/libgpvm3.a \
-        $(FV_HOME)/user/obj/iris/libpvm3.a \
-        $(FV_HOME)/user/obj/iris/libBLT.a \
-        $(FV_HOME)/user/obj/iris/libtk8.2.a \
-        $(FV_HOME)/user/obj/iris/libtcl8.2.a \
-        -lGL -lGLU -lgl \
-        -lMrm -lXm -lXt $(XLIBS) -lPW \
-        -lftn -lc
-
-#elif defined(sgi64) || defined(sgi64Gcc)
-
-    FV_LIBS = \
-        $(FV_HOME)/user/obj/iris64/fv.o \
-        $(FV_HOME)/user/obj/iris64/fv2.o \
-        $(FV_HOME)/user/obj/iris64/fv3.o \
-        $(FV_HOME)/user/obj/iris64/netserver.o \
-        $(FV_HOME)/user/obj/iris64/pV_Server.o \
-        $(FV_HOME)/user/obj/iris64/dore.o \
-        $(FV_HOME)/user/obj/iris64/libpV3ser.a \
-        $(FV_HOME)/user/obj/iris64/libgpvm3.a \
-        $(FV_HOME)/user/obj/iris64/libpvm3.a \
-        $(FV_HOME)/user/obj/iris64/libBLT.a \
-        $(FV_HOME)/user/obj/iris64/libtk8.2.a \
-        $(FV_HOME)/user/obj/iris64/libtcl8.2.a \
-        -lGL -lGLU \
-        -lMrm -lXm -lXt $(XLIBS) -lPW \
-        -lftn -lc
-
-#elif defined(ibm) || defined(ibmGcc)
-
-    FV_LIBS = \
-        -bh:4 -T512 -H512 \
-        -bmaxdata:0x60000000 \
-        $(FV_HOME)/user/obj/ibm_rs/fv.o \
-        -L/usr/lib -L$(FV_HOME)/user/obj/ibm_rs \
-        -lMrm -lXm -lXt -lX11 -lxlf90 \
-        -lGL -lGLU -lXext \
-        -lm -lc -lPW -lIM -lgl
-
-#elif defined(hpux)
-
-    FV_LIBS = \
-        $(FV_HOME)/user/obj/hp_700/fv.o \
-        -L/opt/graphics/common/lib \
-        -L/usr/lib/Motif1.2 \
-        -L/opt/graphics/OpenGL/lib \
-        -L$(FV_HOME)/user/obj/hp_700 \
-        -lGL -lGLU  -lXext \
-        -lXwindow  -lhpgfx \
-        -lXhp11 -lMrm -lXm -lXt -lX11 \
-        -lM -lc -lPW -ldld -ldce $endlib \
-        -Wl,+b: -Wl,+s
-
-#endif
-
-
-EXE_INC = \
-    -I$(FV_HOME)/uns \
-    -I$(LIB_SRC)/finiteVolume/lnInclude \
-    -I$(LIB_SRC)/meshTools/lnInclude \
-    -I$(LIB_SRC)/browser/lnInclude \
-    -I$(LIB_SRC)/lagrangian/basic/lnInclude
-
-EXE_LIBS = \
-    $(FV_LIBS) \
-    -lfiniteVolume \
-    -lgenericPatchFields \
-    -lmeshTools
diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/README b/applications/utilities/postProcessing/graphics/fieldview9Reader/README
deleted file mode 100644
index a70ed87df7ec08ffc48ac035f862011b7e0a7ab6..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/graphics/fieldview9Reader/README
+++ /dev/null
@@ -1,56 +0,0 @@
-Fieldview9 reader module
-------------------------
-This is a version of the fvbin executable with a built-in reader for Foam
-data.
-
-1] Limitations
---------------
-- only volScalarFields and volVectorFields and only on points, not on boundary.
-- handles polyhedra by decomposition (introduces cell centre)
-- no surface fields, no lagrangian fields, no tetFem fields.
-- does not run in parallel
-
-2] Building
------------
-It has only been tested on Linux. Other platforms should build with a little
-bit of effort. Have a look at the Fieldview link script and see which options
-you need to add to Make/options to make it build.
-
-Instructions:
-0. Make sure FV_HOME is set to the root of the FieldView installation.
-(i.e. $FV_HOME/user should exist)
-
-1. Add $FV_HOME/bin to your path and make sure you can actually run fv.
-
-2. Make the new fv executable by typing
-
-    wmake
-
-   This should create an 'fvbinFoam' executable.
-
-3. On Linux you can directly run this executable instead of through the 'fv'
-script. On other machines you might have to backup the old $FV_HOME/bin/fvbin
-executable and move the fvbinFoam one into its position. Now you can use the
-fv script to start it all up.
-
-
-3] Running
-----------
-After starting it up (see step above) you should have a 'Foam Reader' under
-the 'Data Files' pull-down menu. This will open a file selection box. Go to the
-case directory and click on any file. The reader will recognize that the
-current directory is a case directory (it has checks for a 'constant' directory)
-and start reading the mesh. It will
-pop-up a box with time steps and a list of variables as usual.
-
-In case of a case with topology changes (i.e. more than one mesh) it
-will ask for the time step a second time. This is due to a limitation in
-Fieldview. Choose the same time as before.
-
-In the terminal window it will print various informational messages.
-
-A not fairly well tested feature is cellSet displaying. Instead of selecting
-a case directory selecting a cellSet (in a polyMesh/sets/ directory) it
-will try to subset the mesh using the selected cellSet. It is not possible
-to display fields on subsetted meshes.
-
diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/errno.c b/applications/utilities/postProcessing/graphics/fieldview9Reader/errno.c
deleted file mode 100644
index 8330a8fd14710e8a84777b4d4ea1ded367312ab2..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/graphics/fieldview9Reader/errno.c
+++ /dev/null
@@ -1 +0,0 @@
-int errno = 0;
diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C b/applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C
deleted file mode 100644
index 301f2e66f728c7b8e431d78fc8e3898c3aa68471..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C
+++ /dev/null
@@ -1,1209 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2012 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
-    Reader module for Fieldview9 to read OpenFOAM mesh and data.
-
-    Creates new 'fvbin' type executable which needs to be installed in place
-    of bin/fvbin.
-
-    Implements a reader for combined mesh&results on an unstructured mesh.
-
-    See Fieldview Release 9 Reference Manual and coding in user/ directory
-    of the Fieldview release.
-
-\*---------------------------------------------------------------------------*/
-
-#include "fvCFD.H"
-#include "IOobjectList.H"
-#include "GeometricField.H"
-#include "pointFields.H"
-#include "volPointInterpolation.H"
-#include "readerDatabase.H"
-#include "wallPolyPatch.H"
-#include "ListOps.H"
-#include "cellModeller.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-extern "C"
-{
-// Define various Fieldview constants and prototypes
-
-#include "fv_reader_tags.h"
-
-static const int FVHEX     = 2;
-static const int FVPRISM   = 3;
-static const int FVPYRAMID = 4;
-static const int FVTET     = 1;
-static const int ITYPE     = 1;
-
-unsigned int fv_encode_elem_header(int elem_type, int wall_info[]);
-void time_step_get_value(float*, int, int*, float*, int*);
-void fv_error_msg(const char*, const char*);
-
-void reg_single_unstruct_reader
-(
-    char *,
-    void
-    (
-        char*, int*, int*, int*, int*, int*, int*,
-        int[], int*, char[][80], int[], int*, char[][80], int*
-    ),
-    void
-    (
-        int*, int*, int*, float[], int*, float[], int*
-    )
-);
-
-int create_tet(const int, const int[8], const int[]);
-int create_pyramid(const int, const int[8], const int[]);
-int create_prism(const int, const int[8], const int[]);
-int create_hex(const int, const int[8], const int[]);
-
-typedef unsigned char uChar;
-extern uChar create_bndry_face_buffered
-(
-    int bndry_type,
-    int num_verts,
-    int verts[],
-    int *normals_flags,
-    int num_grid_nodes
-);
-
-/*
- * just define empty readers here for ease of linking.
- * Comment out if you have doubly defined linking error on this symbol
- */
-void ftn_register_data_readers()
-{}
-
-/*
- * just define empty readers here for ease of linking.
- * Comment out if you have doubly defined linking error on this symbol
- */
-void ftn_register_functions()
-{}
-
-/*
- * just define empty readers here for ease of linking.
- * Comment out if you have doubly defined linking error on this symbol
- */
-void register_functions()
-{}
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-
-//
-// Storage for all OpenFOAM state (mainly database & mesh)
-//
-static readerDatabase db_;
-
-
-// Write fv error message.
-static void errorMsg(const string& msg)
-{
-    fv_error_msg("Foam Reader", msg.c_str());
-}
-
-
-// Simple check if directory is valid case directory.
-static bool validCase(const fileName& rootAndCase)
-{
-    //if (isDir(rootAndCase/"system") && isDir(rootAndCase/"constant"))
-    if (isDir(rootAndCase/"constant"))
-    {
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
-
-// Check whether case has topo changes by looking back from last time
-// to first directory with polyMesh/cells.
-static bool hasTopoChange(const instantList& times)
-{
-    label lastIndex = times.size()-1;
-
-    const Time& runTime = db_.runTime();
-
-    // Only set time; do not update mesh.
-    runTime.setTime(times[lastIndex], lastIndex);
-
-    fileName facesInst(runTime.findInstance(polyMesh::meshSubDir, "faces"));
-
-    // See if cellInst is constant directory. Note extra .name() is for
-    // parallel cases when runTime.constant is '../constant'
-    if (facesInst != runTime.constant().name())
-    {
-        Info<< "Found cells file in " << facesInst << " so case has "
-            << "topological changes" << endl;
-
-        return true;
-    }
-    else
-    {
-        Info<< "Found cells file in " << facesInst << " so case has "
-            << "no topological changes" << endl;
-
-        return false;
-    }
-}
-
-
-static bool selectTime(const instantList& times, int* iret)
-{
-    List<float> fvTimes(2*times.size());
-
-    forAll(times, timeI)
-    {
-        fvTimes[2*timeI]   = float(timeI);
-        fvTimes[2*timeI+1] = float(times[timeI].value());
-    }
-
-    int istep;
-
-    float time;
-
-    *iret=0;
-
-    time_step_get_value(fvTimes.begin(), times.size(), &istep, &time, iret);
-
-    if (*iret == -5)
-    {
-        errorMsg("Out of memory.");
-
-        return false;
-    }
-    if (*iret == -15)
-    {
-        // Cancel action.
-        return false;
-    }
-    if (*iret != 0)
-    {
-        errorMsg("Unspecified error.");
-
-        return false;
-    }
-    Info<< "Selected timeStep:" << istep << "  time:" << scalar(time) << endl;
-
-    // Set time and load mesh.
-    db_.setTime(times[istep], istep);
-
-    return true;
-}
-
-
-// Gets (names of) all fields in all timesteps.
-static void createFieldNames
-(
-    const Time& runTime,
-    const instantList& Times,
-    const word& setName
-)
-{
-    // From foamToFieldView9/getFieldNames.H:
-
-    HashSet<word> volScalarHash;
-    HashSet<word> volVectorHash;
-    HashSet<word> surfScalarHash;
-    HashSet<word> surfVectorHash;
-
-    if (setName.empty())
-    {
-        forAll(Times, timeI)
-        {
-            const word& timeName = Times[timeI].name();
-
-            // Add all fields to hashtable
-            IOobjectList objects(runTime, timeName);
-
-            wordList vsNames(objects.names(volScalarField::typeName));
-
-            forAll(vsNames, fieldI)
-            {
-                volScalarHash.insert(vsNames[fieldI]);
-            }
-
-            wordList vvNames(objects.names(volVectorField::typeName));
-
-            forAll(vvNames, fieldI)
-            {
-                volVectorHash.insert(vvNames[fieldI]);
-            }
-        }
-    }
-    db_.setFieldNames(volScalarHash.toc(), volVectorHash.toc());
-}
-
-
-// Appends interpolated values of fieldName to vars array.
-static void storeScalarField
-(
-    const volPointInterpolation& pInterp,
-    const word& fieldName,
-    float vars[],
-    label& pointI
-)
-{
-    label nPoints = db_.mesh().nPoints();
-    label nTotPoints = nPoints + db_.polys().size();
-
-    // Check if present
-    IOobject ioHeader
-    (
-        fieldName,
-        db_.runTime().timeName(),
-        db_.runTime(),
-        IOobject::MUST_READ,
-        IOobject::NO_WRITE
-    );
-
-    if (ioHeader.headerOk())
-    {
-        Info<< "Storing " << nTotPoints << " of interpolated " << fieldName
-            << endl;
-
-        volScalarField field(ioHeader, db_.mesh());
-
-        pointScalarField psf(pInterp.interpolate(field));
-
-        forAll(psf, i)
-        {
-            vars[pointI++] = float(psf[i]);
-        }
-
-        const labelList& polys = db_.polys();
-
-        forAll(polys, i)
-        {
-            label cellI = polys[i];
-
-            vars[pointI++] = float(field[cellI]);
-        }
-    }
-    else
-    {
-        Info<< "Storing " << nTotPoints << " of dummy values of " << fieldName
-            << endl;
-
-        for (label i = 0; i < nPoints; i++)
-        {
-            vars[pointI++] = 0.0;
-        }
-
-        const labelList& polys = db_.polys();
-
-        forAll(polys, i)
-        {
-            vars[pointI++] = 0.0;
-        }
-    }
-}
-
-
-// Appends interpolated values of fieldName to vars array.
-static void storeVectorField
-(
-    const volPointInterpolation& pInterp,
-    const word& fieldName,
-    float vars[],
-    label& pointI
-)
-{
-    label nPoints = db_.mesh().nPoints();
-
-    label nTotPoints = nPoints + db_.polys().size();
-
-    // Check if present
-    IOobject ioHeader
-    (
-        fieldName,
-        db_.runTime().timeName(),
-        db_.runTime(),
-        IOobject::MUST_READ,
-        IOobject::NO_WRITE
-    );
-
-    if (ioHeader.headerOk())
-    {
-        Info<< "Storing " << nTotPoints << " of interpolated " << fieldName
-            << endl;
-
-        volVectorField field(ioHeader, db_.mesh());
-
-        for (direction d = 0; d < vector::nComponents; d++)
-        {
-            tmp<volScalarField> tcomp = field.component(d);
-            const volScalarField& comp = tcomp();
-
-            pointScalarField psf(pInterp.interpolate(comp));
-
-            forAll(psf, i)
-            {
-                vars[pointI++] = float(psf[i]);
-            }
-
-            const labelList& polys = db_.polys();
-
-            forAll(polys, i)
-            {
-                label cellI = polys[i];
-
-                vars[pointI++] = float(comp[cellI]);
-            }
-        }
-    }
-    else
-    {
-        Info<< "Storing " << nTotPoints << " of dummy values of " << fieldName
-            << endl;
-
-        for (direction d = 0; d < vector::nComponents; d++)
-        {
-            for (label i = 0; i < nPoints; i++)
-            {
-                vars[pointI++] = 0.0;
-            }
-
-            const labelList& polys = db_.polys();
-
-            forAll(polys, i)
-            {
-                vars[pointI++] = 0.0;
-            }
-        }
-    }
-}
-
-
-// Returns Fieldview face_type of mesh face faceI.
-static label getFvType(const polyMesh& mesh, const label faceI)
-{
-    return mesh.boundaryMesh().whichPatch(faceI) + 1;
-}
-
-
-// Returns Fieldview face_type of face f.
-static label getFaceType
-(
-    const polyMesh& mesh,
-    const labelList& faceLabels,
-    const face& f
-)
-{
-    // Search in subset faceLabels of faces for index of face f.
-    const faceList& faces = mesh.faces();
-
-    forAll(faceLabels, i)
-    {
-        label faceI = faceLabels[i];
-
-        if (f == faces[faceI])
-        {
-            // Convert patch to Fieldview face_type.
-            return getFvType(mesh, faceI);
-        }
-    }
-
-    FatalErrorIn("getFaceType")
-        << "Cannot find face " << f << " in mesh face subset " << faceLabels
-        << abort(FatalError);
-
-    return -1;
-}
-
-
-// Returns Fieldview face_types for set of faces
-static labelList getFaceTypes
-(
-    const polyMesh& mesh,
-    const labelList& cellFaces,
-    const faceList& cellShapeFaces
-)
-{
-    labelList faceLabels(cellShapeFaces.size());
-
-    forAll(cellShapeFaces, i)
-    {
-        faceLabels[i] = getFaceType(mesh, cellFaces, cellShapeFaces[i]);
-    }
-    return faceLabels;
-}
-
-
-/*
- * Callback for querying file contents. Taken from user/user_unstruct_combined.f
- */
-void user_query_file_function
-(
-    /* input */
-    char* fname,        /* filename */
-    int* lenf,          /* length of fName */
-    int* iunit,         /* fortran unit to use */
-    int* max_grids,     /* maximum number of grids allowed */
-    int* max_face_types,/* maximum number of face types allowed */
-    int* max_vars,      /* maximum number of result variables allowed per */
-                        /* grid point*/
-
-    /* output */
-    int* num_grids,     /* number of grids that will be read from data file */
-    int  num_nodes[],   /* (array of node counts for all grids) */
-    int* num_face_types,        /* number of special face types */
-    char face_type_names[][80], /* array of face-type names */
-    int  wall_flags[],          /* array of flags for the "wall" behavior */
-    int* num_vars,              /* number of result variables per grid point */
-    char var_names[][80],       /* array of variable names */
-    int* iret                   /* return value */
-)
-{
-    fprintf(stderr, "\n** user_query_file_function\n");
-
-    string rootAndCaseString(fname, *lenf);
-
-    fileName rootAndCase(rootAndCaseString);
-
-    word setName("");
-
-    if (!validCase(rootAndCase))
-    {
-        setName = rootAndCase.name();
-
-        rootAndCase = rootAndCase.path();
-
-        word setDir = rootAndCase.name();
-
-        rootAndCase = rootAndCase.path();
-
-        word meshDir = rootAndCase.name();
-
-        rootAndCase = rootAndCase.path();
-        rootAndCase = rootAndCase.path();
-
-        if
-        (
-            setDir == "sets"
-         && meshDir == polyMesh::typeName
-         && validCase(rootAndCase)
-        )
-        {
-            // Valid set (hopefully - cannot check contents of setName yet).
-        }
-        else
-        {
-            errorMsg
-            (
-                "Could not find system/ and constant/ directory in\n"
-              + rootAndCase
-              + "\nPlease select an OpenFOAM case directory."
-            );
-
-            *iret = 1;
-
-            return;
-        }
-
-    }
-
-    fileName rootDir(rootAndCase.path());
-
-    fileName caseName(rootAndCase.name());
-
-    // handle trailing '/'
-    if (caseName.empty())
-    {
-        caseName = rootDir.name();
-        rootDir  = rootDir.path();
-    }
-
-    Info<< "rootDir  : " << rootDir << endl
-        << "caseName : " << caseName << endl
-        << "setName  : " << setName << endl;
-
-    //
-    // Get/reuse database and mesh
-    //
-
-    bool caseChanged = db_.setRunTime(rootDir, caseName, setName);
-
-
-    //
-    // Select time
-    //
-
-    instantList Times = db_.runTime().times();
-
-    // If topo case set database time and update mesh.
-    if (hasTopoChange(Times))
-    {
-        if (!selectTime(Times, iret))
-        {
-            return;
-        }
-    }
-    else if (caseChanged)
-    {
-        // Load mesh (if case changed) to make sure we have nPoints etc.
-        db_.loadMesh();
-    }
-
-
-    //
-    // Set output variables
-    //
-
-    *num_grids = 1;
-
-    const fvMesh& mesh = db_.mesh();
-
-    label nTotPoints = mesh.nPoints() + db_.polys().size();
-
-    num_nodes[0] = nTotPoints;
-
-    Info<< "setting num_nodes:" << num_nodes[0] << endl;
-
-    Info<< "setting num_face_types:" << mesh.boundary().size() << endl;
-
-    *num_face_types = mesh.boundary().size();
-
-    if (*num_face_types > *max_face_types)
-    {
-        errorMsg("Too many patches. FieldView limit:" + name(*max_face_types));
-
-        *iret = 1;
-
-        return;
-    }
-
-
-    forAll(mesh.boundaryMesh(), patchI)
-    {
-        const polyPatch& patch = mesh.boundaryMesh()[patchI];
-
-        strcpy(face_type_names[patchI], patch.name().c_str());
-
-        if (isA<wallPolyPatch>(patch))
-        {
-            wall_flags[patchI] = 1;
-        }
-        else
-        {
-            wall_flags[patchI] = 0;
-        }
-        Info<< "Patch " << patch.name() << " is wall:"
-            <<  wall_flags[patchI] << endl;
-    }
-
-    //- Find all volFields and add them to database
-    createFieldNames(db_.runTime(), Times, setName);
-
-    *num_vars = db_.volScalarNames().size() + 3*db_.volVectorNames().size();
-
-    if (*num_vars > *max_vars)
-    {
-        errorMsg("Too many variables. FieldView limit:" + name(*max_vars));
-
-        *iret = 1;
-
-        return;
-    }
-
-
-    int nameI = 0;
-
-    forAll(db_.volScalarNames(), i)
-    {
-        const word& fieldName = db_.volScalarNames()[i];
-
-        const word& fvName = db_.getFvName(fieldName);
-
-        strcpy(var_names[nameI++], fvName.c_str());
-    }
-
-    forAll(db_.volVectorNames(), i)
-    {
-        const word& fieldName = db_.volVectorNames()[i];
-
-        const word& fvName = db_.getFvName(fieldName);
-
-        strcpy(var_names[nameI++], (fvName + "x;" + fvName).c_str());
-        strcpy(var_names[nameI++], (fvName + "y").c_str());
-        strcpy(var_names[nameI++], (fvName + "z").c_str());
-    }
-
-    *iret = 0;
-}
-
-
-/*
- * Callback for reading timestep. Taken from user/user_unstruct_combined.f
- */
-void user_read_one_grid_function
-(
-    int* iunit,     /* in: fortran unit number */
-    int* igrid,     /* in: grid number to read */
-    int* nodecnt,   /* in: number of nodes to read */
-    float xyz[],    /* out: coordinates of nodes: x1..xN y1..yN z1..zN */
-    int* num_vars,  /* in: number of results per node */
-    float vars[],   /* out: values per node */
-    int* iret       /* out: return value */
-)
-{
-    fprintf(stderr, "\n** user_read_one_grid_function\n");
-
-    if (*igrid != 1)
-    {
-        errorMsg("Illegal grid number " + Foam::name(*igrid));
-
-        *iret = 1;
-
-        return;
-    }
-
-    // Get current time
-    instantList Times = db_.runTime().times();
-
-    // Set database time and update mesh.
-    // Note: this should not be nessecary here. We already have the correct
-    // time set and mesh loaded. This is only nessecary because Fieldview
-    // otherwise thinks the case is non-transient.
-    if (!selectTime(Times, iret))
-    {
-        return;
-    }
-
-
-    const fvMesh& mesh = db_.mesh();
-
-    // With mesh now loaded check for change in number of points.
-    label nTotPoints = mesh.nPoints() + db_.polys().size();
-
-    if (*nodecnt != nTotPoints)
-    {
-        errorMsg
-        (
-            "nodecnt differs from number of points in mesh.\nnodecnt:"
-          + Foam::name(*nodecnt)
-          + "  mesh:"
-          + Foam::name(nTotPoints)
-        );
-
-        *iret = 1;
-
-        return;
-    }
-
-
-    if
-    (
-        *num_vars
-     != (db_.volScalarNames().size() + 3*db_.volVectorNames().size())
-    )
-    {
-        errorMsg("Illegal number of variables " + name(*num_vars));
-
-        *iret = 1;
-
-        return;
-    }
-
-    //
-    // Set coordinates
-    //
-
-    const pointField& points = mesh.points();
-
-    int xIndex = 0;
-    int yIndex = xIndex + nTotPoints;
-    int zIndex = yIndex + nTotPoints;
-
-    // Add mesh points first.
-    forAll(points, pointI)
-    {
-        xyz[xIndex++] = points[pointI].x();
-        xyz[yIndex++] = points[pointI].y();
-        xyz[zIndex++] = points[pointI].z();
-    }
-
-    // Add cell centres of polys
-    const pointField& ctrs = mesh.cellCentres();
-
-    const labelList& polys = db_.polys();
-
-    forAll(polys, i)
-    {
-        label cellI = polys[i];
-
-        xyz[xIndex++] = ctrs[cellI].x();
-        xyz[yIndex++] = ctrs[cellI].y();
-        xyz[zIndex++] = ctrs[cellI].z();
-    }
-
-
-    //
-    // Define elements by calling fv routines
-    //
-
-    static const cellModel& tet = *(cellModeller::lookup("tet"));
-    static const cellModel& tetWedge = *(cellModeller::lookup("tetWedge"));
-    static const cellModel& pyr = *(cellModeller::lookup("pyr"));
-    static const cellModel& prism = *(cellModeller::lookup("prism"));
-    static const cellModel& wedge = *(cellModeller::lookup("wedge"));
-    static const cellModel& hex = *(cellModeller::lookup("hex"));
-    //static const cellModel& splitHex = *(cellModeller::lookup("splitHex"));
-
-    int tetVerts[4];
-    int pyrVerts[5];
-    int prismVerts[6];
-    int hexVerts[8];
-
-    int tetFaces[4];
-    int pyrFaces[5];
-    int prismFaces[5];
-    int hexFaces[6];
-
-    const cellShapeList& cellShapes = mesh.cellShapes();
-    const faceList& faces = mesh.faces();
-    const cellList& cells = mesh.cells();
-    const labelList& owner = mesh.faceOwner();
-    label nPoints = mesh.nPoints();
-
-    // Fieldview face_types array with all faces marked as internal.
-    labelList internalFaces(6, 0);
-
-    // Mark all cells next to boundary so we don't have to calculate
-    // wall_types for internal cells and can just pass internalFaces.
-    boolList wallCell(mesh.nCells(), false);
-
-    label nWallCells = 0;
-
-    for (label faceI = mesh.nInternalFaces(); faceI < mesh.nFaces(); faceI++)
-    {
-        label cellI = owner[faceI];
-
-        if (!wallCell[cellI])
-        {
-            wallCell[cellI] = true;
-
-            nWallCells++;
-        }
-    }
-
-    label nPolys = 0;
-
-    forAll(cellShapes, cellI)
-    {
-        const cellShape& cellShape = cellShapes[cellI];
-        const cellModel& cellModel = cellShape.model();
-        const cell& cellFaces = cells[cellI];
-
-        int istat = 0;
-
-        if (cellModel == tet)
-        {
-            tetVerts[0] = cellShape[3] + 1;
-            tetVerts[1] = cellShape[0] + 1;
-            tetVerts[2] = cellShape[1] + 1;
-            tetVerts[3] = cellShape[2] + 1;
-
-            if (wallCell[cellI])
-            {
-                labelList faceTypes =
-                    getFaceTypes(mesh, cellFaces, cellShape.faces());
-
-                tetFaces[0] = faceTypes[2];
-                tetFaces[1] = faceTypes[3];
-                tetFaces[2] = faceTypes[0];
-                tetFaces[3] = faceTypes[1];
-
-                istat = create_tet(ITYPE, tetVerts, tetFaces);
-            }
-            else
-            {
-                // All faces internal so use precalculated zero.
-                istat = create_tet(ITYPE, tetVerts, internalFaces.begin());
-            }
-        }
-        else if (cellModel == tetWedge)
-        {
-            prismVerts[0] = cellShape[0] + 1;
-            prismVerts[1] = cellShape[3] + 1;
-            prismVerts[2] = cellShape[4] + 1;
-            prismVerts[3] = cellShape[1] + 1;
-            prismVerts[4] = cellShape[4] + 1;
-            prismVerts[5] = cellShape[2] + 1;
-
-            if (wallCell[cellI])
-            {
-                labelList faceTypes =
-                    getFaceTypes(mesh, cellFaces, cellShape.faces());
-
-                prismFaces[0] = faceTypes[1];
-                prismFaces[1] = faceTypes[2];
-                prismFaces[2] = faceTypes[3];
-                prismFaces[3] = faceTypes[0];
-                prismFaces[4] = faceTypes[3];
-
-                istat = create_prism(ITYPE, prismVerts, prismFaces);
-            }
-            else
-            {
-                istat = create_prism(ITYPE, prismVerts, internalFaces.begin());
-            }
-        }
-        else if (cellModel == pyr)
-        {
-            pyrVerts[0] = cellShape[0] + 1;
-            pyrVerts[1] = cellShape[1] + 1;
-            pyrVerts[2] = cellShape[2] + 1;
-            pyrVerts[3] = cellShape[3] + 1;
-            pyrVerts[4] = cellShape[4] + 1;
-
-            if (wallCell[cellI])
-            {
-                labelList faceTypes =
-                    getFaceTypes(mesh, cellFaces, cellShape.faces());
-
-                pyrFaces[0] = faceTypes[0];
-                pyrFaces[1] = faceTypes[3];
-                pyrFaces[2] = faceTypes[2];
-                pyrFaces[3] = faceTypes[1];
-                pyrFaces[4] = faceTypes[4];
-
-                istat = create_pyramid(ITYPE, pyrVerts, pyrFaces);
-            }
-            else
-            {
-                istat = create_pyramid(ITYPE, pyrVerts, internalFaces.begin());
-            }
-        }
-        else if (cellModel == prism)
-        {
-            prismVerts[0] = cellShape[0] + 1;
-            prismVerts[1] = cellShape[3] + 1;
-            prismVerts[2] = cellShape[4] + 1;
-            prismVerts[3] = cellShape[1] + 1;
-            prismVerts[4] = cellShape[5] + 1;
-            prismVerts[5] = cellShape[2] + 1;
-
-            if (wallCell[cellI])
-            {
-                labelList faceTypes =
-                    getFaceTypes(mesh, cellFaces, cellShape.faces());
-
-                prismFaces[0] = faceTypes[4];
-                prismFaces[1] = faceTypes[2];
-                prismFaces[2] = faceTypes[3];
-                prismFaces[3] = faceTypes[0];
-                prismFaces[4] = faceTypes[1];
-
-                istat = create_prism(ITYPE, prismVerts, prismFaces);
-            }
-            else
-            {
-                istat = create_prism(ITYPE, prismVerts, internalFaces.begin());
-            }
-        }
-        else if (cellModel == wedge)
-        {
-            hexVerts[0] = cellShape[0] + 1;
-            hexVerts[1] = cellShape[1] + 1;
-            hexVerts[2] = cellShape[0] + 1;
-            hexVerts[3] = cellShape[2] + 1;
-            hexVerts[4] = cellShape[3] + 1;
-            hexVerts[5] = cellShape[4] + 1;
-            hexVerts[6] = cellShape[6] + 1;
-            hexVerts[7] = cellShape[5] + 1;
-
-            if (wallCell[cellI])
-            {
-                labelList faceTypes =
-                    getFaceTypes(mesh, cellFaces, cellShape.faces());
-
-                hexFaces[0] = faceTypes[2];
-                hexFaces[1] = faceTypes[3];
-                hexFaces[2] = faceTypes[0];
-                hexFaces[3] = faceTypes[1];
-                hexFaces[4] = faceTypes[4];
-                hexFaces[5] = faceTypes[5];
-
-                istat = create_hex(ITYPE, hexVerts, hexFaces);
-            }
-            else
-            {
-                istat = create_hex(ITYPE, hexVerts, internalFaces.begin());
-            }
-        }
-        else if (cellModel == hex)
-        {
-            hexVerts[0] = cellShape[0] + 1;
-            hexVerts[1] = cellShape[1] + 1;
-            hexVerts[2] = cellShape[3] + 1;
-            hexVerts[3] = cellShape[2] + 1;
-            hexVerts[4] = cellShape[4] + 1;
-            hexVerts[5] = cellShape[5] + 1;
-            hexVerts[6] = cellShape[7] + 1;
-            hexVerts[7] = cellShape[6] + 1;
-
-            if (wallCell[cellI])
-            {
-                labelList faceTypes =
-                    getFaceTypes(mesh, cellFaces, cellShape.faces());
-
-                hexFaces[0] = faceTypes[0];
-                hexFaces[1] = faceTypes[1];
-                hexFaces[2] = faceTypes[4];
-                hexFaces[3] = faceTypes[5];
-                hexFaces[4] = faceTypes[2];
-                hexFaces[5] = faceTypes[3];
-
-                istat = create_hex(ITYPE, hexVerts, hexFaces);
-            }
-            else
-            {
-                istat = create_hex(ITYPE, hexVerts, internalFaces.begin());
-            }
-        }
-        else
-        {
-            forAll(cellFaces, cFaceI)
-            {
-                label faceI = cellFaces[cFaceI];
-
-                // Get Fieldview facetype (internal/on patch)
-                label fvFaceType = getFvType(mesh, faceI);
-
-                const face& f = faces[faceI];
-
-                // Indices into storage
-                label nQuads = 0;
-                label nTris = 0;
-
-                // Storage for triangles and quads created by face
-                // decomposition (sized for worst case)
-                faceList quadFaces((f.size() - 2)/2);
-                faceList triFaces(f.size() - 2);
-
-                f.trianglesQuads
-                (
-                    points,
-                    nTris,
-                    nQuads,
-                    triFaces,
-                    quadFaces
-                );
-
-                // Label of cell centre in fv point list.
-                label polyCentrePoint = nPoints + nPolys;
-
-                for (label i=0; i<nTris; i++)
-                {
-                    if (cellI == owner[faceI])
-                    {
-                        tetVerts[0] = triFaces[i][0] + 1;
-                        tetVerts[1] = triFaces[i][1] + 1;
-                        tetVerts[2] = triFaces[i][2] + 1;
-                        tetVerts[3] = polyCentrePoint + 1;
-                    }
-                    else
-                    {
-                        tetVerts[0] = triFaces[i][2] + 1;
-                        tetVerts[1] = triFaces[i][1] + 1;
-                        tetVerts[2] = triFaces[i][0] + 1;
-                        tetVerts[3] = polyCentrePoint + 1;
-                    }
-
-                    if (wallCell[cellI])
-                    {
-                        // Outside face is one without polyCentrePoint
-                        tetFaces[0] = fvFaceType;
-                        tetFaces[1] = 0;
-                        tetFaces[2] = 0;
-                        tetFaces[3] = 0;
-
-                        istat = create_tet(ITYPE, tetVerts, tetFaces);
-                    }
-                    else
-                    {
-                        istat =
-                            create_tet
-                            (
-                                ITYPE,
-                                tetVerts,
-                                internalFaces.begin()
-                            );
-                    }
-                }
-
-                for (label i=0; i<nQuads; i++)
-                {
-                    if (cellI == owner[faceI])
-                    {
-                        pyrVerts[0] = quadFaces[i][3] + 1;
-                        pyrVerts[1] = quadFaces[i][2] + 1;
-                        pyrVerts[2] = quadFaces[i][1] + 1;
-                        pyrVerts[3] = quadFaces[i][0] + 1;
-                        pyrVerts[4] = polyCentrePoint + 1;
-
-                    }
-                    else
-                    {
-                        pyrVerts[0] = quadFaces[i][0] + 1;
-                        pyrVerts[1] = quadFaces[i][1] + 1;
-                        pyrVerts[2] = quadFaces[i][2] + 1;
-                        pyrVerts[3] = quadFaces[i][3] + 1;
-                        pyrVerts[4] = polyCentrePoint + 1;
-                    }
-
-                    if (wallCell[cellI])
-                    {
-                        // Outside face is one without polyCentrePoint
-                        pyrFaces[0] = fvFaceType;
-                        pyrFaces[1] = 0;
-                        pyrFaces[2] = 0;
-                        pyrFaces[3] = 0;
-                        pyrFaces[4] = 0;
-
-                        istat = create_pyramid(ITYPE, pyrVerts, pyrFaces);
-                    }
-                    else
-                    {
-                        istat =
-                            create_pyramid
-                            (
-                                ITYPE,
-                                pyrVerts,
-                                internalFaces.begin()
-                            );
-                    }
-                }
-
-                if (istat != 0)
-                {
-                    errorMsg("Error during adding cell " + name(cellI));
-
-                    *iret = 1;
-
-                    return;
-                }
-            }
-
-            nPolys++;
-        }
-
-        if (istat != 0)
-        {
-            errorMsg("Error during adding cell " + name(cellI));
-
-            *iret = 1;
-
-            return;
-        }
-    }
-
-
-
-    //
-    // Set fieldvalues
-    //
-
-    const pointMesh& pMesh = pointMesh::New(mesh);
-
-    volPointInterpolation pInterp(mesh, pMesh);
-
-    int pointI = 0;
-
-    forAll(db_.volScalarNames(), i)
-    {
-        const word& fieldName = db_.volScalarNames()[i];
-
-        storeScalarField(pInterp, fieldName, vars, pointI);
-    }
-
-
-    forAll(db_.volVectorNames(), i)
-    {
-        const word& fieldName = db_.volVectorNames()[i];
-
-        storeVectorField(pInterp, fieldName, vars, pointI);
-    }
-
-    // Return without failure.
-    *iret = 0;
-}
-
-
-void register_data_readers()
-{
-    /*
-    **
-    ** You should edit this file to "register" a user-defined data
-    ** reader with FIELDVIEW, if the user functions being registered
-    ** here are written in C.
-    ** You should edit "ftn_register_data_readers.f" if the user functions
-    ** being registered are written in Fortran.
-    ** In either case, the user functions being registered may call other
-    ** functions written in either language (C or Fortran); only the
-    ** language of the "query" and "read" functions referenced here matters
-    ** to FIELDVIEW.
-    **
-    ** The following shows a sample user-defined data reader being
-    ** "registered" with FIELDVIEW.
-    **
-    ** The "extern void" declarations should match the names of the
-    ** query and grid-reading functions you are providing. It is
-    ** strongly suggested that all such names begin with "user" so
-    ** as not to conflict with global names in FIELDVIEW.
-    **
-    ** You may call any combination of the data reader registration
-    ** functions shown below ("register_two_file_reader" and/or
-    ** "register_single_file_reader" and/or "register_single_unstruct_reader"
-    ** and/or "register_double_unstruct_reader") as many times as you like,
-    ** in order to create several different data readers. Each data reader
-    ** should of course have different "query" and "read" functions, all of
-    ** which should also appear in "extern void" declarations.
-    **
-    */
-
-    /*
-    ** like this for combined unstructured grids & results in a single file
-    */
-    reg_single_unstruct_reader
-    (
-        "Foam Reader",                 /* title you want for data reader */
-        user_query_file_function,      /* whatever you called this */
-        user_read_one_grid_function    /* whatever you called this */
-    );
-}
-
-
-}
-
-
-// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.C b/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.C
deleted file mode 100644
index 7de4b9bc8393ea8119e4c4ffbafcf4436b2c9112..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.C
+++ /dev/null
@@ -1,340 +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 "readerDatabase.H"
-#include "demandDrivenData.H"
-#include "fvMesh.H"
-#include "fvMeshSubset.H"
-#include "Time.H"
-#include "fileName.H"
-#include "instant.H"
-#include "cellSet.H"
-#include "cellModeller.H"
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-const bool Foam::readerDatabase::debug_ = Foam::env("readerDatabase");
-
-
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
-
-// Gets cell numbers of all polyHedra
-void Foam::readerDatabase::getPolyHedra()
-{
-    const cellModel& tet = *(cellModeller::lookup("tet"));
-    const cellModel& pyr = *(cellModeller::lookup("pyr"));
-    const cellModel& prism = *(cellModeller::lookup("prism"));
-    const cellModel& wedge = *(cellModeller::lookup("wedge"));
-    const cellModel& tetWedge = *(cellModeller::lookup("tetWedge"));
-    const cellModel& hex = *(cellModeller::lookup("hex"));
-
-    DynamicList<label> polys(mesh().nCells()/100 + 1);
-
-    const cellShapeList& cellShapes = mesh().cellShapes();
-
-    forAll(cellShapes, celli)
-    {
-        const cellShape& cellShape = cellShapes[celli];
-        const cellModel& cellModel = cellShape.model();
-
-        if
-        (
-            (cellModel != tet)
-         && (cellModel != pyr)
-         && (cellModel != prism)
-         && (cellModel != wedge)
-         && (cellModel != tetWedge)
-         && (cellModel != hex)
-        )
-        {
-            polys.append(celli);
-        }
-    }
-
-    Info<< "Found " << polys.size() << " polyhedral cells " << endl;
-    polys_.transfer(polys);
-}
-
-
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-// Null constructor
-Foam::readerDatabase::readerDatabase()
-:
-    fieldviewNames_(10),
-    runTimePtr_(NULL),
-    meshPtr_(NULL),
-    setName_(""),
-    polys_(),
-    volScalarNames_(),
-    volVectorNames_()
-{
-    // Initialize name mapping table. See note on static in header file.
-    fieldviewNames_.insert("alpha", "aalpha");
-    fieldviewNames_.insert("Alpha", "AAlpha");
-    fieldviewNames_.insert("fsmach", "ffsmach");
-    fieldviewNames_.insert("FSMach", "FFSMach");
-    fieldviewNames_.insert("re", "rre");
-    fieldviewNames_.insert("Re", "RRe");
-    fieldviewNames_.insert("time", "ttime");
-    fieldviewNames_.insert("Time", "TTime");
-    fieldviewNames_.insert("pi", "ppi");
-    fieldviewNames_.insert("PI", "PPI");
-    fieldviewNames_.insert("x", "xx");
-    fieldviewNames_.insert("X", "XX");
-    fieldviewNames_.insert("y", "yy");
-    fieldviewNames_.insert("Y", "YY");
-    fieldviewNames_.insert("z", "zz");
-    fieldviewNames_.insert("Z", "ZZ");
-    fieldviewNames_.insert("rcyl", "rrcyl");
-    fieldviewNames_.insert("Rcyl", "RRcyl");
-    fieldviewNames_.insert("theta", "ttheta");
-    fieldviewNames_.insert("Theta", "TTheta");
-    fieldviewNames_.insert("rsphere", "rrsphere");
-    fieldviewNames_.insert("Rsphere", "RRsphere");
-    fieldviewNames_.insert("k", "kk");
-    fieldviewNames_.insert("K", "KK");
-}
-
-
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-Foam::readerDatabase::~readerDatabase()
-{
-    deleteDemandDrivenData(meshPtr_);
-    deleteDemandDrivenData(runTimePtr_);
-}
-
-
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-const Foam::Time& Foam::readerDatabase::runTime() const
-{
-    if (!runTimePtr_)
-    {
-        FatalErrorIn("readerDatabase::runTime()")
-            << "No database set" << abort(FatalError);
-    }
-    return *runTimePtr_;
-}
-
-
-const Foam::fvMesh& Foam::readerDatabase::mesh() const
-{
-    if (!meshPtr_)
-    {
-        FatalErrorIn("readerDatabase::runTime()")
-            << "No mesh set" << abort(FatalError);
-    }
-
-    if (setName_.empty())
-    {
-        return *meshPtr_;
-    }
-    else
-    {
-        return meshPtr_->subMesh();
-    }
-}
-
-
-const Foam::labelList& Foam::readerDatabase::polys() const
-{
-    return polys_;
-}
-
-
-const Foam::wordList& Foam::readerDatabase::volScalarNames() const
-{
-    return volScalarNames_;
-}
-
-
-const Foam::wordList& Foam::readerDatabase::volVectorNames() const
-{
-    return volVectorNames_;
-}
-
-
-const Foam::word& Foam::readerDatabase::getFvName(const word& foamName) const
-{
-    if (fieldviewNames_.found(foamName))
-    {
-        return fieldviewNames_[foamName];
-    }
-    else
-    {
-        return foamName;
-    }
-}
-
-
-bool Foam::readerDatabase::setRunTime
-(
-    const fileName& rootDir,
-    const fileName& caseName,
-    const word& setName
-)
-{
-    bool newDatabase = false;
-
-    if (runTimePtr_)
-    {
-        if
-        (
-            (runTimePtr_->caseName() != caseName)
-         || (runTimePtr_->rootPath() != rootDir)
-         || (setName_ != setName)
-        )
-        {
-            if (debug_)
-            {
-                Info<< "Deleting old mesh since deleting old database" << endl;
-            }
-
-            deleteDemandDrivenData(meshPtr_);
-
-            if (debug_)
-            {
-                Info<< "Deleting old database for " << runTimePtr_->caseName()
-                    << endl;
-            }
-
-            deleteDemandDrivenData(runTimePtr_);
-        }
-    }
-
-    setName_ = setName;
-
-    if (!runTimePtr_)
-    {
-        if (debug_)
-        {
-            Info<< "Deleting old mesh since loading new Time" << endl;
-        }
-
-        deleteDemandDrivenData(meshPtr_);
-
-        if (debug_)
-        {
-            Info<< "Creating database for " << caseName << endl;
-        }
-
-        runTimePtr_ = new Time(Time::controlDictName, rootDir, caseName);
-
-        newDatabase = true;
-    }
-
-    return newDatabase;
-}
-
-
-void Foam::readerDatabase::loadMesh()
-{
-    deleteDemandDrivenData(meshPtr_);
-
-    Info<< "Loading new mesh" << endl;
-
-    meshPtr_ = new fvMeshSubset
-    (
-        *runTimePtr_,
-        IOobject::MUST_READ,
-        IOobject::AUTO_WRITE
-    );
-
-    if (setName_.size())
-    {
-        Info<< "Subsetting mesh based on cellSet " << setName_ << endl;
-
-        fvMeshSubset& mesh = *meshPtr_;
-
-        cellSet currentSet(mesh, setName_);
-
-        mesh.setCellSubset(currentSet);
-    }
-    getPolyHedra();
-}
-
-
-Foam::polyMesh::readUpdateState Foam::readerDatabase::setTime
-(
-    const instant& timeInstance,
-    const label timeIndex
-)
-{
-    runTime().setTime(timeInstance, timeIndex);
-
-    polyMesh::readUpdateState meshChange;
-
-    if (meshPtr_)
-    {
-        // Update loaded mesh
-        meshChange = meshPtr_->readUpdate();
-
-        if (setName_.size() && meshChange != polyMesh::UNCHANGED)
-        {
-            Info<< "Subsetting mesh based on " << setName_ << endl;
-
-            fvMeshSubset& mesh = *meshPtr_;
-
-            cellSet currentSet(mesh, setName_);
-
-            mesh.setCellSubset(currentSet);
-        }
-
-        if
-        (
-            (meshChange == polyMesh::TOPO_CHANGE)
-         || (meshChange == polyMesh::TOPO_PATCH_CHANGE)
-        )
-        {
-            getPolyHedra();
-        }
-    }
-    else
-    {
-        // Force new mesh to be loaded for current time
-        loadMesh();
-        meshChange = polyMesh::TOPO_CHANGE;
-    }
-
-    return meshChange;
-}
-
-
-void Foam::readerDatabase::setFieldNames
-(
-   const wordList& vsNames,
-   const wordList& vvNames
-)
-{
-    volScalarNames_ = vsNames;
-    volVectorNames_ = vvNames;
-}
-
-
-
-
-// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.H b/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.H
deleted file mode 100644
index 9b75731a7d6dacf10282fb2ef118c97fd55092fb..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.H
+++ /dev/null
@@ -1,172 +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/>.
-
-Class
-    Foam::readerDatabase
-
-Description
-    Singleton caching OpenFOAM database and mesh and various.
-    Used in Fv reader to keep track of data in between callbacks.
-
-SourceFiles
-    readerDatabase.C
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef readerDatabase_H
-#define readerDatabase_H
-
-#include "wordList.H"
-#include "Time.H"
-#include "polyMesh.H"
-#include "label.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// Forward declaration of classes
-class fvMesh;
-class fvMeshSubset;
-class Time;
-class fileName;
-class instant;
-
-/*---------------------------------------------------------------------------*\
-                       Class readerDatabase Declaration
-\*---------------------------------------------------------------------------*/
-
-class readerDatabase
-{
-    // Private data
-
-        //- Names for protected Fieldview keywords. Gets set at construction
-        //  time.
-        //  Note: Should be static but this gives problem with construction
-        //  order since *this is static as well.
-        HashTable<word> fieldviewNames_;
-
-    // Private data
-
-        //- Cached database
-        Time* runTimePtr_;
-
-        //- Cached mesh, guaranteed uptodate with runTime.
-        fvMeshSubset* meshPtr_;
-
-        //- Empty string or name of current set.
-        word setName_;
-
-        //- Cell labels of polyHedra. Uptodate with meshPtr.
-        labelList polys_;
-
-        //- All volScalarFields in all time directories
-        wordList volScalarNames_;
-
-        //- All volVectorFields ,,
-        wordList volVectorNames_;
-
-
-    // Private Member Functions
-
-        //- Gets cell numbers of all polyHedra
-        void getPolyHedra();
-
-        //- Disallow default bitwise copy construct
-        readerDatabase(const readerDatabase&);
-
-        //- Disallow default bitwise assignment
-        void operator=(const readerDatabase&);
-
-
-public:
-
-    // Static
-
-        //- Debug flag. Note: uses envvar instead of controlDict since
-        //  *this is static as well. Might be initialized before controlDict
-        //  read.
-        static const bool debug_;
-
-
-    // Constructors
-
-        //- Construct null
-        readerDatabase();
-
-
-    //- Destructor
-    ~readerDatabase();
-
-
-    // Member Functions
-
-        // Access
-
-            const Time& runTime() const;
-
-            const fvMesh& mesh() const;
-
-            const labelList& polys() const;
-
-            const wordList& volScalarNames() const;
-
-            const wordList& volVectorNames() const;
-
-            //- Get fieldview compatible name.
-            const word& getFvName(const word& foamName) const;
-
-        // Edit
-
-            //- Create database (if nessecary).
-            //  Returns true if new Time created, false if old one reused.
-            //  Optional fvMeshSubset using setName.
-            bool setRunTime
-            (
-                const fileName& rootDir,
-                const fileName& caseName,
-                const word& setName
-            );
-
-            //- Forcibly load mesh.
-            void loadMesh();
-
-            //- Set time (use this instead of database::setTime), updates
-            //  mesh as well and returns mesh update status
-            polyMesh::readUpdateState setTime(const instant&, const label);
-
-            //- Set volScalarNames, volVectorNames.
-            void setFieldNames(const wordList&, const wordList&);
-};
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C b/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C
index 1b1d3fcac0f22618996dcb7a40cfb886051cd9c9..4988fc969f871553df55c3e3f5c36ab1ba092845 100644
--- a/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C
+++ b/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.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
@@ -26,7 +26,7 @@ Application
 
 Description
     Generates a VTK file of particle tracks for cases that were computed using
-    a tracked-parcel-type cloud
+    a tracked-parcel-type cloud.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C b/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C
index e32e012efe9ef965fd274682db438db3010e5c2c..b9c321b87a8b265c34b8c6f0264e0fcb9560a437 100644
--- a/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C
+++ b/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -22,7 +22,7 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Application
-    dsmcFields
+    dsmcFieldsCalc
 
 Description
     Calculate intensive fields (U and T) from averaged extensive fields from a
diff --git a/applications/utilities/postProcessing/miscellaneous/engineCompRatio/engineCompRatio.C b/applications/utilities/postProcessing/miscellaneous/engineCompRatio/engineCompRatio.C
index 5ea4e7bc5ab2192db354b1761b60eefc2c8a88f1..9754e76402fadfa16fc2e55be70d9e708c90a126 100644
--- a/applications/utilities/postProcessing/miscellaneous/engineCompRatio/engineCompRatio.C
+++ b/applications/utilities/postProcessing/miscellaneous/engineCompRatio/engineCompRatio.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -22,7 +22,7 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Application
-    engineCompRatioFoam
+    engineCompRatio
 
 Description
     Calculate the geometric compression ratio.
diff --git a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/Make/options b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/Make/options
index e42252ff31c8d5368759d02839d0bbf777eadda7..2d8a8780380ec3118b155f7de0a6dd0aec9bb0c7 100644
--- a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/Make/options
+++ b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/Make/options
@@ -1,5 +1,4 @@
 EXE_INC = \
-    -I$(LIB_SRC)/postProcessing/postCalc \
     -I$(LIB_SRC)/transportModels \
     -I$(LIB_SRC)/turbulenceModels \
     -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
@@ -7,7 +6,6 @@ EXE_INC = \
     -I$(LIB_SRC)/finiteVolume/lnInclude
 
 EXE_LIBS = \
-    $(FOAM_LIBBIN)/postCalc.o \
     -lincompressibleTransportModels \
     -lincompressibleRASModels \
     -lincompressibleLESModels \
diff --git a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C
index e5c6735d8c8b52545c2efd19728131c0a6f3bfe7..a1e3387aad8341eb0ed62c1d4d6ecf8f1135927a 100644
--- a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C
+++ b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,7 @@ 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
+Application
     execFlowFunctionObjects
 
 Description
@@ -35,7 +35,8 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
-#include "calc.H"
+#include "argList.H"
+#include "timeSelector.H"
 
 #include "volFields.H"
 #include "surfaceFields.H"
@@ -51,12 +52,18 @@ Description
 #include "compressible/RAS/RASModel/RASModel.H"
 #include "compressible/LES/LESModel/LESModel.H"
 
+using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-namespace Foam
+void execFunctionObjects
+(
+    const argList& args,
+    const Time& runTime,
+    autoPtr<functionObjectList>& folPtr
+)
 {
-    void execFlowFunctionObjects(const argList& args, const Time& runTime)
+    if (folPtr.empty())
     {
         if (args.optionFound("dict"))
         {
@@ -70,23 +77,27 @@ namespace Foam
                 )
             );
 
-            functionObjectList fol(runTime, dict);
-            fol.start();
-            fol.execute(true);  // override outputControl - force writing
+            folPtr.reset(new functionObjectList(runTime, dict));
         }
         else
         {
-            functionObjectList fol(runTime);
-            fol.start();
-            fol.execute(true);  // override outputControl - force writing
+            folPtr.reset(new functionObjectList(runTime));
         }
+
+        folPtr->start();
     }
-}
 
+    folPtr->execute(true);
+}
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
+void calc
+(
+    const argList& args,
+    const Time& runTime,
+    const fvMesh& mesh,
+    autoPtr<functionObjectList>& folPtr
+)
 {
     if (args.optionFound("noFlow"))
     {
@@ -148,7 +159,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
         PtrList<pointTensorField> ptFlds;
         ReadFields(pMesh, objects, ptFlds);
 
-        execFlowFunctionObjects(args, runTime);
+        execFunctionObjects(args, runTime, folPtr);
     }
     else
     {
@@ -191,7 +202,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
             mesh
         );
 
-        if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
+        if (phi.dimensions() == dimVolume/dimTime)
         {
             IOobject RASPropertiesHeader
             (
@@ -228,7 +239,8 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
                         laminarTransport
                     )
                 );
-                execFlowFunctionObjects(args, runTime);
+
+                execFunctionObjects(args, runTime, folPtr);
             }
             else if (LESPropertiesHeader.headerOk())
             {
@@ -241,7 +253,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
                     incompressible::LESModel::New(U, phi, laminarTransport)
                 );
 
-                execFlowFunctionObjects(args, runTime);
+                execFunctionObjects(args, runTime, folPtr);
             }
             else
             {
@@ -257,12 +269,10 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
                     )
                 );
 
-                dimensionedScalar nu(transportProperties.lookup("nu"));
-
-                execFlowFunctionObjects(args, runTime);
+                execFunctionObjects(args, runTime, folPtr);
             }
         }
-        else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0))
+        else if (phi.dimensions() == dimMass/dimTime)
         {
             autoPtr<fluidThermo> thermo(fluidThermo::New(mesh));
 
@@ -312,7 +322,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
                     )
                 );
 
-                execFlowFunctionObjects(args, runTime);
+                execFunctionObjects(args, runTime, folPtr);
             }
             else if (LESPropertiesHeader.headerOk())
             {
@@ -323,7 +333,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
                     compressible::LESModel::New(rho, U, phi, thermo())
                 );
 
-                execFlowFunctionObjects(args, runTime);
+                execFunctionObjects(args, runTime, folPtr);
             }
             else
             {
@@ -339,9 +349,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
                     )
                 );
 
-                dimensionedScalar mu(transportProperties.lookup("mu"));
-
-                execFlowFunctionObjects(args, runTime);
+                execFunctionObjects(args, runTime, folPtr);
             }
         }
         else
@@ -354,4 +362,48 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
 }
 
 
+int main(int argc, char *argv[])
+{
+    Foam::timeSelector::addOptions();
+    #include "addRegionOption.H"
+    Foam::argList::addBoolOption
+    (
+        "noFlow",
+        "suppress creating flow models"
+    );
+    #include "addDictOption.H"
+
+    #include "setRootCase.H"
+    #include "createTime.H"
+    Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
+    #include "createNamedMesh.H"
+
+    autoPtr<functionObjectList> folPtr;
+
+    forAll(timeDirs, timeI)
+    {
+        runTime.setTime(timeDirs[timeI], timeI);
+
+        Info<< "Time = " << runTime.timeName() << endl;
+
+        mesh.readUpdate();
+
+        FatalIOError.throwExceptions();
+
+        try
+        {
+            calc(args, runTime, mesh, folPtr);
+        }
+        catch (IOerror& err)
+        {
+            Warning<< err << endl;
+        }
+
+        Info<< endl;
+    }
+
+    return 0;
+}
+
+
 // ************************************************************************* //
diff --git a/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C b/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C
index ed439aec3366789ed84d271ed672620e6af822f0..8d4c0b12002800c7992546e2a9daa598a19de2e5 100644
--- a/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C
+++ b/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,7 +25,7 @@ Application
     foamListTimes
 
 Description
-    List times using timeSelector
+    List times using timeSelector.
 
 Usage
 
diff --git a/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfDict b/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfDict
index 0b89073b25715e9f8eb21be83212e333bce10f45..c54da3eb040b33ee38221dff35ce37490cf2ec9f 100644
--- a/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfDict
+++ b/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfDict
@@ -1,7 +1,7 @@
 /*--------------------------------*- C++ -*----------------------------------*\
 | =========                 |                                                 |
 | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
+|  \\    /   O peration     | Version:  dev                                 |
 |   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
 |    \\/     M anipulation  |                                                 |
 \*---------------------------------------------------------------------------*/
@@ -21,18 +21,18 @@ nIntervals      20;
 nSamples        10000;
 
 // Type of pdf
-pdfType         RosinRammler;
+type            RosinRammler;
 
 // Write data flag
 writeData       true;
 
 // PDF model coefficients
-RosinRammlerPDF
+RosinRammlerDistribution
 {
     minValue        1e-06;
     maxValue        200e-06;
-    d               (60.0e-06);
-    n               (0.8);
+    d               60.0e-06;
+    n               0.8;
 }
 
 // ************************************************************************* //
diff --git a/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfPlot.C b/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfPlot.C
index b6e30fd4e33da9bea349790e633b59c8e79de840..ea9f4f03bb306fc31440b8b5c7baa5b320597855 100644
--- a/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfPlot.C
+++ b/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfPlot.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,8 +21,11 @@ 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
+    pdfPlot
+
 Description
-    Generates a graph of a probability distribution function
+    Generates a graph of a probability distribution function.
 
 \*---------------------------------------------------------------------------*/
 
@@ -32,7 +35,6 @@ Description
 #include "OFstream.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C b/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C
index 6bb6094b90bf88b5d019a389be61d15fd12af836..7c31a03e9847ff9c867bbdde0ad3e3d0398b089d 100644
--- a/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C
+++ b/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,7 +25,7 @@ Application
     postChannel
 
 Description
-    Post-processes data from channel flow calculations
+    Post-processes data from channel flow calculations.
 
     For each time: calculate: txx, txy,tyy, txy,
     eps, prod, vorticity, enstrophy and helicity. Assuming that the mesh
@@ -42,7 +42,6 @@ Description
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//  Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C b/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C
index 98ead1f4bbe808d2676ce1e352f24e41e69e3887..a5ed7039cbf4af63491d458b025a99d93d85d699 100644
--- a/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.C
+++ b/applications/utilities/postProcessing/miscellaneous/temporalInterpolate/temporalInterpolate.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
@@ -182,7 +182,6 @@ void fieldInterpolator::interpolate()
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 int main(int argc, char *argv[])
 {
     timeSelector::addOptions();
diff --git a/applications/utilities/postProcessing/miscellaneous/writeCellCentres/writeCellCentres.C b/applications/utilities/postProcessing/miscellaneous/writeCellCentres/writeCellCentres.C
index 5bce3be0c234e9c3e0eedd24d450178e90448288..ce40f502e187ffecf35cc9b45fc1cb0b7329fbb6 100644
--- a/applications/utilities/postProcessing/miscellaneous/writeCellCentres/writeCellCentres.C
+++ b/applications/utilities/postProcessing/miscellaneous/writeCellCentres/writeCellCentres.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
@@ -38,7 +38,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/postProcessing/noise/Make/files b/applications/utilities/postProcessing/noise/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..f39ca7345d41ec49f42c97b0689aa1d2320d2269
--- /dev/null
+++ b/applications/utilities/postProcessing/noise/Make/files
@@ -0,0 +1,3 @@
+noise.C
+
+EXE = $(FOAM_APPBIN)/noise
diff --git a/applications/utilities/postProcessing/noise/Make/options b/applications/utilities/postProcessing/noise/Make/options
new file mode 100644
index 0000000000000000000000000000000000000000..b29b939580748d59669a36947c8687210c2b4bc5
--- /dev/null
+++ b/applications/utilities/postProcessing/noise/Make/options
@@ -0,0 +1,7 @@
+EXE_INC = \
+    -I$(LIB_SRC)/randomProcesses/lnInclude \
+    -I$(LIB_SRC)/sampling/lnInclude
+
+EXE_LIBS = \
+    -lrandomProcesses \
+    -lsampling
diff --git a/applications/utilities/postProcessing/noise/createFields.H b/applications/utilities/postProcessing/noise/createFields.H
new file mode 100644
index 0000000000000000000000000000000000000000..53598de047b8b65eb068794ac01794a6959c1425
--- /dev/null
+++ b/applications/utilities/postProcessing/noise/createFields.H
@@ -0,0 +1,34 @@
+    word dictName("noiseDict");
+    if (args.optionFound("dict"))
+    {
+        dictName = args["dict"];
+    }
+
+    IOdictionary dict
+    (
+        IOobject
+        (
+            dictName,
+            runTime.system(),
+            runTime,
+            IOobject::MUST_READ
+        )
+    );
+
+    // reference pressure
+    scalar pRef = dict.lookupOrDefault("pRef", 0.0);
+
+    // number of samples in sampling window
+    label N = dict.lookupOrDefault("N", 65536);
+
+    // number of sampling windows
+    label nw = dict.lookupOrDefault("nw", 100);
+
+    // lower frequency of frequency band
+    scalar f1 = dict.lookupOrDefault("f1", 25.0);
+
+    // upper frequency of frequency band
+    scalar fU = dict.lookupOrDefault("fU", 10000.0);
+
+    // graph format
+    word graphFormat = dict.lookupOrDefault<word>("graphFormat", "raw");
diff --git a/applications/utilities/postProcessing/noise/noise.C b/applications/utilities/postProcessing/noise/noise.C
new file mode 100644
index 0000000000000000000000000000000000000000..9c19aadb99ad4a53cc59125b318972c05f4010f9
--- /dev/null
+++ b/applications/utilities/postProcessing/noise/noise.C
@@ -0,0 +1,177 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  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
+    noise
+
+Description
+    Utility to perform noise analysis of pressure data using the noiseFFT
+    library.
+
+    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:
+
+    \heading Usage
+
+    \verbatim
+    pRef        101325;
+    N           65536;
+    nw          100;
+    f1          25;
+    fU          10000;
+    graphFormat raw;
+
+    csvFileData
+    {
+        fileName        "pressureData"
+        nHeaderLine     1;
+        refColumn       0;
+        componentColumns (1);
+        separator       " ";
+    }
+    \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 grapch format          | no        | raw
+    \endtable
+
+
+SeeAlso
+    CSV.H
+
+\*---------------------------------------------------------------------------*/
+
+
+#include "noiseFFT.H"
+#include "argList.H"
+#include "Time.H"
+#include "functionObjectFile.H"
+#include "CSV.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)
+            {
+                FatalErrorIn("checkUniformTimeStep(const scalarField&)")
+                    << "Unable to process data with a variable time step"
+                    << exit(FatalError);
+            }
+        }
+    }
+    else
+    {
+        FatalErrorIn("checkUniformTimeStep(const scalarField&)")
+            << "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;
+    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)
+    {
+        FatalErrorIn(args.executable())
+            << "Block size N = " << N
+            << " is larger than number of data = " << t.size()
+            << exit(FatalError);
+    }
+
+    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);
+
+    Info<< nl << "End\n" << endl;
+
+    return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C b/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C
index f7948701cc584552f0ee8b3fa9c66484e9adda3d..9464734307f23d4b4cf50de88e202ac19c41e9f1 100644
--- a/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C
+++ b/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -73,7 +73,6 @@ void printAverage
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C
index 5004df4c9e5c85f63aab1c8b0cdb0ef64efc8dbb..c0a96503c9b7aa901dfd09b9fa1853f3b20bf4cf 100644
--- a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C
+++ b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -103,18 +103,17 @@ void printSum
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
     timeSelector::addOptions();
-#   include "addRegionOption.H"
+    #include "addRegionOption.H"
     argList::validArgs.append("fieldName");
     argList::validArgs.append("patchName");
-#   include "setRootCase.H"
-#   include "createTime.H"
+    #include "setRootCase.H"
+    #include "createTime.H"
     instantList timeDirs = timeSelector::select0(runTime, args);
-#   include "createNamedMesh.H"
+    #include "createNamedMesh.H"
 
     const word fieldName = args[1];
     const word patchName = args[2];
diff --git a/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C b/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C
index 59c73ffc60d8cff7c586f294ebea851ec4e84d0c..09daaee2773ae89c15f8769f25dc96a64cdb669e 100644
--- a/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C
+++ b/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.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
@@ -21,6 +21,9 @@ 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
+    probeLocations
+
 Description
     Probe locations.
 
@@ -33,7 +36,6 @@ Description
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/postProcessing/sampling/sample/sample.C b/applications/utilities/postProcessing/sampling/sample/sample.C
index 6641508a573946fbf394db86662bcd97d38eb1b2..e357f2f7e535e1fc8f028399c80ae22e24d52cd2 100644
--- a/applications/utilities/postProcessing/sampling/sample/sample.C
+++ b/applications/utilities/postProcessing/sampling/sample/sample.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
@@ -21,6 +21,9 @@ 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
+    sample
+
 Description
     Sample field data with a choice of interpolation schemes, sampling options
     and write formats.
@@ -91,7 +94,6 @@ Notes
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/postProcessing/turbulence/createTurbulenceFields/createTurbulenceFields.C b/applications/utilities/postProcessing/turbulence/createTurbulenceFields/createTurbulenceFields.C
index 928f0abf5e0e452251ab4a514d2fd104d400eb4a..1982b4f24280015e0d274e271cdea1b1123730fc 100644
--- a/applications/utilities/postProcessing/turbulence/createTurbulenceFields/createTurbulenceFields.C
+++ b/applications/utilities/postProcessing/turbulence/createTurbulenceFields/createTurbulenceFields.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -22,7 +22,7 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Application
-    CreateTurbulenceFields
+    createTurbulenceFields
 
 Description
     Creates a full set of turbulence fields.
diff --git a/applications/utilities/postProcessing/velocityField/Mach/Mach.C b/applications/utilities/postProcessing/velocityField/Mach/Mach.C
index 45e286d247f2e280c9b891e97cab4275864b8e78..aeb7c7c7d7369a4c7b541f99ee6c3dc222e632d6 100644
--- a/applications/utilities/postProcessing/velocityField/Mach/Mach.C
+++ b/applications/utilities/postProcessing/velocityField/Mach/Mach.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/utilities/postProcessing/velocityField/Pe/Pe.C b/applications/utilities/postProcessing/velocityField/Pe/Pe.C
index 959eaad312d004a946c917b88c31e9ebe8c01051..0c4f61729cef4986ef4d7893400c08c43ab7bf3d 100644
--- a/applications/utilities/postProcessing/velocityField/Pe/Pe.C
+++ b/applications/utilities/postProcessing/velocityField/Pe/Pe.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C b/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C
index 69ba83ee926abcf929fbdac7214ecd214d901613..aa56086c90e6c23f6c76c90d52f092f9cb0e6cdb 100644
--- a/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C
+++ b/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.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
@@ -25,7 +25,8 @@ Application
     streamFunction
 
 Description
-    Calculates and writes the stream function of velocity field U at each time
+    Calculates and writes the stream function of velocity field U at each
+    time.
 
 \*---------------------------------------------------------------------------*/
 
@@ -37,7 +38,6 @@ Description
 #include "OSspecific.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//  Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/postProcessing/wall/wallGradU/wallGradU.C b/applications/utilities/postProcessing/wall/wallGradU/wallGradU.C
index d09da627606e810dc0970abfdc98d6ec75bdc9d0..8ea4dadafc75f5af2908dce912de113ec40f2a90 100644
--- a/applications/utilities/postProcessing/wall/wallGradU/wallGradU.C
+++ b/applications/utilities/postProcessing/wall/wallGradU/wallGradU.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,7 +25,7 @@ Application
     wallGradU
 
 Description
-    Calculates and writes the gradient of U at the wall
+    Calculates and writes the gradient of U at the wall.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/applications/utilities/postProcessing/wall/wallHeatFlux/Make/options b/applications/utilities/postProcessing/wall/wallHeatFlux/Make/options
index 444af26ce07e9df782f54946a33e889f36f9623d..cd09f8d5b764d65350fb4fb0dec1645a8455b374 100644
--- a/applications/utilities/postProcessing/wall/wallHeatFlux/Make/options
+++ b/applications/utilities/postProcessing/wall/wallHeatFlux/Make/options
@@ -9,6 +9,9 @@ EXE_INC = \
 
 EXE_LIBS = \
     -lcompressibleTurbulenceModel \
+    -lcompressibleRASModels \
+    -lcompressibleLESModels \
+    -lLESdeltas \
     -lreactionThermophysicalModels \
     -lfiniteVolume \
     -lgenericPatchFields \
diff --git a/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C b/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C
index 137c4c0cfb9b6acc19bb850a61d5ba2ef6e6a217..c45c48b35e6e6ccd94711ebb35780ba859d17259 100644
--- a/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C
+++ b/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C b/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C
index ce89695567e0e583071bdd9d934adce5e5d88817..360f03b39c58b0c7668b564e8899a8f607063c18 100644
--- a/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C
+++ b/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C b/applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C
index 09d945fc4ae255d649f7aac3df647d6497e4065e..bbdfb0362d4f52060a398c5edc06ccd4257669ef 100644
--- a/applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C
+++ b/applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.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
@@ -25,7 +25,8 @@ Application
     yPlusLES
 
 Description
-    Calculates and reports yPlus for all wall patches, for the specified times.
+    Calculates and reports yPlus for all wall patches, for the specified times
+    when using LES turbulence models.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C b/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C
index 58f6a7b063aaf037615e8fe4e4c70126ce30be26..46614b7e55cbf282a92ab0d69d72a7a9e5c1edf0 100644
--- a/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C
+++ b/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C
index b4a83722e6e3205d4bf57a2e18487ea9234f9af0..756b92cd494f8a4f2920a45ab259634f5ba0ea74 100644
--- a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C
+++ b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.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
@@ -136,7 +136,7 @@ int main(int argc, char *argv[])
         }
 
         // Create G field - used by RAS wall functions
-        volScalarField G(turbulence().type() + ".G", nut*2*sqr(S));
+        volScalarField G(turbulence().GName(), nut*2*sqr(S));
 
 
         //--- Read and modify turbulence fields
diff --git a/applications/utilities/preProcessing/applyWallFunctionBoundaryConditions/applyWallFunctionBoundaryConditions.C b/applications/utilities/preProcessing/applyWallFunctionBoundaryConditions/applyWallFunctionBoundaryConditions.C
index 38b0bf0eb73e95dcfb9c96840bc2fc41c278cb6f..95222a4a7ab757c3dd7af191d1abfe7a1bfce6fb 100644
--- a/applications/utilities/preProcessing/applyWallFunctionBoundaryConditions/applyWallFunctionBoundaryConditions.C
+++ b/applications/utilities/preProcessing/applyWallFunctionBoundaryConditions/applyWallFunctionBoundaryConditions.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
@@ -25,10 +25,10 @@ Application
     applyWallFunctionBounaryConditions
 
 Description
-    Updates OpenFOAM RAS cases to use the new (v1.6) wall function framework
+    Updates OpenFOAM RAS cases to use the new (v1.6) wall function framework.
 
     Attempts to determine whether case is compressible or incompressible, or
-    can be supplied with -compressible command line argument
+    can be supplied with -compressible command line argument.
 
 \*---------------------------------------------------------------------------*/
 
@@ -332,7 +332,7 @@ int main(int argc, char *argv[])
     argList::addBoolOption
     (
         "compressible",
-        "force use of compressible wall functions. default is auto-detect."
+        "force use of compressible wall functions. Default is auto-detect."
     );
 
     #include "setRootCase.H"
diff --git a/applications/utilities/preProcessing/boxTurb/boxTurb.C b/applications/utilities/preProcessing/boxTurb/boxTurb.C
index b5f904c4bec626814c3e03c57e4c6e88adca4c6c..55a35322abad886d8ba68dea721168ca2027fe8e 100644
--- a/applications/utilities/preProcessing/boxTurb/boxTurb.C
+++ b/applications/utilities/preProcessing/boxTurb/boxTurb.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -22,7 +22,7 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Application
-    boxTurb3D
+    boxTurb
 
 Description
     Makes a box of turbulence which conforms to a given energy
diff --git a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C
index 4bb711880a309c5c51c39be36ace7ae95abcb576..a53a6142cff08dd371c507a2645ed9576510b945 100644
--- a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C
+++ b/applications/utilities/preProcessing/changeDictionary/changeDictionary.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
@@ -381,7 +381,6 @@ bool merge
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
@@ -399,7 +398,7 @@ int main(int argc, char *argv[])
     argList::addBoolOption
     (
         "literalRE",
-        "treat regular expressions literally (ie, as a keyword)"
+        "treat regular expressions literally (i.e., as a keyword)"
     );
     argList::addBoolOption
     (
diff --git a/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/Make/files b/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..fb1928c9232e2d0ae68b615af73f668075c1ae8f
--- /dev/null
+++ b/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/Make/files
@@ -0,0 +1,3 @@
+createExternalCoupledPatchGeometry.C
+
+EXE = $(FOAM_APPBIN)/createExternalCoupledPatchGeometry
diff --git a/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/Make/options b/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/Make/options
new file mode 100644
index 0000000000000000000000000000000000000000..a5b0bb57772c85ec65b7f1d736acf7b9ad5ab275
--- /dev/null
+++ b/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/Make/options
@@ -0,0 +1,6 @@
+EXE_INC = \
+    -I$(LIB_SRC)/finiteVolume/lnInclude
+
+EXE_LIBS = \
+    -lfiniteVolume \
+    -lcompressibleTurbulenceModel
diff --git a/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometry.C b/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometry.C
new file mode 100644
index 0000000000000000000000000000000000000000..dc0348da1a48cf2c7bf25a7590d7d5cc9ea3de65
--- /dev/null
+++ b/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometry.C
@@ -0,0 +1,87 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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
+    createExternalCoupledPatchGeometry.
+
+Description
+    Application to generate the patch geometry (points and faces) for use
+    with the externalCoupled boundary condition.
+
+    Usage:
+
+        createExternalCoupledPatchGeometry <fieldName>
+
+    On execution, the field <fieldName> is read, and its boundary conditions
+    interrogated for the presence of an \c externalCoupled type.  If found,
+    the patch geometry (points and faces) for the coupled patches are output
+    to the communications folder.
+
+Note:
+    The addressing is patch-local, i.e. point indices for each patch point
+    used for face addressing starts at index 0.
+
+SeeAlso
+    externalCoupledMixedFvPatchField
+
+\*---------------------------------------------------------------------------*/
+
+#include "fvCFD.H"
+#include "createExternalCoupledPatchGeometryTemplates.H"
+#include "IOobjectList.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+int main(int argc, char *argv[])
+{
+    #include "addRegionOption.H"
+    argList::validArgs.append("fieldName");
+    #include "setRootCase.H"
+    #include "createTime.H"
+    #include "createNamedMesh.H"
+
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+    const word fieldName = args[1];
+
+    IOobjectList objects(IOobjectList(mesh, mesh.time().timeName()));
+
+    label processed = -1;
+    processField<scalar>(mesh, objects, fieldName, processed);
+    processField<vector>(mesh, objects, fieldName, processed);
+    processField<sphericalTensor>(mesh, objects, fieldName, processed);
+    processField<symmTensor>(mesh, objects, fieldName, processed);
+    processField<tensor>(mesh, objects, fieldName, processed);
+
+    if (processed == -1)
+    {
+        Info<< "Field " << fieldName << " not found" << endl;
+    }
+
+    Info<< "\nEnd\n" << endl;
+
+    return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometryTemplates.C b/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometryTemplates.C
new file mode 100644
index 0000000000000000000000000000000000000000..c5d842237e157e1208c779215e883fd05129df00
--- /dev/null
+++ b/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometryTemplates.C
@@ -0,0 +1,90 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "createExternalCoupledPatchGeometryTemplates.H"
+#include "externalCoupledMixedFvPatchField.H"
+#include "IOobjectList.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+template<class Type>
+void processField
+(
+    const fvMesh& mesh,
+    const IOobjectList& objects,
+    const word& fieldName,
+    label& processed
+)
+{
+    if (processed != -1)
+    {
+        return;
+    }
+
+    typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
+
+    const word timeName(mesh.time().timeName());
+
+    IOobjectList fieldObjbjects(objects.lookupClass(fieldType::typeName));
+
+    if (fieldObjbjects.lookup(fieldName) != NULL)
+    {
+        fieldType vtf(*fieldObjbjects.lookup(fieldName), mesh);
+        const typename fieldType::GeometricBoundaryField& bf =
+            vtf.boundaryField();
+
+        forAll(bf, patchI)
+        {
+            if (isA<externalCoupledMixedFvPatchField<Type> >(bf[patchI]))
+            {
+                Info<< "Generating external coupled geometry for field "
+                    << fieldName << endl;
+
+                const externalCoupledMixedFvPatchField<Type>& pf =
+                    refCast<const externalCoupledMixedFvPatchField<Type> >
+                    (
+                        bf[patchI]
+                    );
+
+                pf.writeGeometry();
+                processed = 1;
+
+                break;
+            }
+        }
+
+        if (processed != 1)
+        {
+            processed = 0;
+
+            Info<< "Field " << fieldName << " found, but does not have any "
+                << externalCoupledMixedFvPatchField<Type>::typeName
+                << " boundary conditions" << endl;
+        }
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometryTemplates.H b/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometryTemplates.H
new file mode 100644
index 0000000000000000000000000000000000000000..9617f7eb5b65195543cbd68969414cb0df63605d
--- /dev/null
+++ b/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometryTemplates.H
@@ -0,0 +1,49 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef createExternalCoupledPatchGeometryTemplates_H
+#define createExternalCoupledPatchGeometryTemplates_H
+
+#include "word.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    template<class Type>
+    void processField(bool& processed, const word& fieldName);
+}
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+#   include "createExternalCoupledPatchGeometryTemplates.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/applications/utilities/preProcessing/dsmcInitialise/dsmcInitialise.C b/applications/utilities/preProcessing/dsmcInitialise/dsmcInitialise.C
index a199d17505e218d54ee018105830951fed2f46e6..23574153b6bc6467467ffd0de739926a28f0a4be 100644
--- a/applications/utilities/preProcessing/dsmcInitialise/dsmcInitialise.C
+++ b/applications/utilities/preProcessing/dsmcInitialise/dsmcInitialise.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -22,11 +22,11 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Application
-    dsmcFoam
+    dsmcInitialise
 
 Description
     Initialise a case for dsmcFoam by reading the initialisation dictionary
-    system/dsmcInitialise
+    system/dsmcInitialise.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/applications/utilities/preProcessing/engineSwirl/engineSwirl.C b/applications/utilities/preProcessing/engineSwirl/engineSwirl.C
index f905250817496171f96bb20505da3b40f4de8d52..8b5ab965dbddf2fe6311bd63bec233025a0d28e9 100644
--- a/applications/utilities/preProcessing/engineSwirl/engineSwirl.C
+++ b/applications/utilities/preProcessing/engineSwirl/engineSwirl.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,7 +25,7 @@ Application
     engineSwirl
 
 Description
-    Generates a swirling flow for engine calulations
+    Generates a swirling flow for engine calulations.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C b/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C
index acd02a9851f48bda5c5dfd31ee09de9ab5b13f01..7481fdb4d640b805999afc7d4d4bac593823cf5d 100644
--- a/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C
+++ b/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,7 +25,7 @@ Application
     foamUpgradeCyclics
 
 Description
-    Tool to upgrade mesh and fields for split cyclics
+    Tool to upgrade mesh and fields for split cyclics.
 
 Usage
 
@@ -388,7 +388,6 @@ void rewriteFields
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/preProcessing/foamUpgradeFvSolution/foamUpgradeFvSolution.C b/applications/utilities/preProcessing/foamUpgradeFvSolution/foamUpgradeFvSolution.C
index 9bd9bd170a02994feda6eeb91cce53765cb11cc0..e5c65c30dc85fb02c561070468a071615312c569 100644
--- a/applications/utilities/preProcessing/foamUpgradeFvSolution/foamUpgradeFvSolution.C
+++ b/applications/utilities/preProcessing/foamUpgradeFvSolution/foamUpgradeFvSolution.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,11 +25,10 @@ Application
     foamUpgradeFvSolution
 
 Description
-    Simple tool to upgrade the syntax of system/fvSolution::solvers
+    Simple tool to upgrade the syntax of system/fvSolution.solvers.
 
 Usage
-
-    - foamUpgradeFvSolution [OPTION]
+    foamUpgradeFvSolution [OPTION]
 
     \param -test \n
     Suppress writing the updated fvSolution file
@@ -44,7 +43,6 @@ Usage
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
@@ -60,8 +58,8 @@ int main(int argc, char *argv[])
         "suppress writing the updated system/fvSolution file"
     );
 
-#   include "setRootCase.H"
-#   include "createTime.H"
+    #include "setRootCase.H"
+    #include "createTime.H"
 
     IOdictionary solutionDict
     (
diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C
index 274258ffd22f2e65a29893902bc02ed8856c9ba6..0dbc03540f5c90b274029918687063447125f61c 100644
--- a/applications/utilities/preProcessing/setFields/setFields.C
+++ b/applications/utilities/preProcessing/setFields/setFields.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
@@ -54,6 +54,7 @@ bool setCellFieldType
 
     word fieldName(fieldValueStream);
 
+    // Check the current time directory
     IOobject fieldHeader
     (
         fieldName,
@@ -62,6 +63,18 @@ bool setCellFieldType
         IOobject::MUST_READ
     );
 
+    // Check the "constant" directory
+    if (!fieldHeader.headerOk())
+    {
+        fieldHeader = IOobject
+        (
+            fieldName,
+            mesh.time().constant(),
+            mesh,
+            IOobject::MUST_READ
+        );
+    }
+
     // Check field exists
     if (fieldHeader.headerOk())
     {
@@ -193,6 +206,7 @@ bool setFaceFieldType
 
     word fieldName(fieldValueStream);
 
+    // Check the current time directory
     IOobject fieldHeader
     (
         fieldName,
@@ -201,6 +215,18 @@ bool setFaceFieldType
         IOobject::MUST_READ
     );
 
+    // Check the "constant" directory
+    if (!fieldHeader.headerOk())
+    {
+        fieldHeader = IOobject
+        (
+            fieldName,
+            mesh.time().constant(),
+            mesh,
+            IOobject::MUST_READ
+        );
+    }
+
     // Check field exists
     if (fieldHeader.headerOk())
     {
diff --git a/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C b/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C
index c204920ec2b239d368e7d8e30cc64a7b7335da65..140ac3da8aaa19a9d293c18e0600e01b143a9497 100644
--- a/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C
+++ b/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -22,7 +22,7 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Application
-    viewFactorGenerator
+    viewFactorsGen
 
 Description
     View factors are calculated based on a face agglomeration array
@@ -572,7 +572,7 @@ int main(int argc, char *argv[])
     label totalPatches = coarsePatches.size();
     reduce(totalPatches, maxOp<label>());
 
-    // Matrix sum in j(Fij) for each i (if enclosure sum = 1
+    // Matrix sum in j(Fij) for each i (if enclosure sum = 1)
     scalarSquareMatrix sumViewFactorPatch
     (
         totalPatches,
diff --git a/applications/utilities/preProcessing/wallFunctionTable/wallFunctionTableApp.C b/applications/utilities/preProcessing/wallFunctionTable/wallFunctionTableApp.C
index 42ecc7a198a86881024758430780116d2d03d529..eca14ca40c10b17e91c28670acb3918f1feb1ae8 100644
--- a/applications/utilities/preProcessing/wallFunctionTable/wallFunctionTableApp.C
+++ b/applications/utilities/preProcessing/wallFunctionTable/wallFunctionTableApp.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,7 +25,7 @@ Application
     wallFunctionTable
 
 Description
-    Generates a table suitable for use by tabulated wall functions
+    Generates a table suitable for use by tabulated wall functions.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/applications/utilities/surface/surfaceAdd/Make/files b/applications/utilities/surface/surfaceAdd/Make/files
index cae8b166e1f6b418bd311368bc658908f8b269af..d3d8a3a10273bc424a6db0e3fe93067c34c3ec17 100644
--- a/applications/utilities/surface/surfaceAdd/Make/files
+++ b/applications/utilities/surface/surfaceAdd/Make/files
@@ -1,4 +1,3 @@
-
 surfaceAdd.C
 
 EXE = $(FOAM_APPBIN)/surfaceAdd
diff --git a/applications/utilities/surface/surfaceAdd/surfaceAdd.C b/applications/utilities/surface/surfaceAdd/surfaceAdd.C
index 51a1dfeac2685471e4d1f8edea6e71db8b51aec6..9ac5bbbb94b0603573afa9c3d98b99f23d3e4645 100644
--- a/applications/utilities/surface/surfaceAdd/surfaceAdd.C
+++ b/applications/utilities/surface/surfaceAdd/surfaceAdd.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    surfaceAdd
+
 Description
     Add two surfaces. Does geometric merge on points. Does not check for
     overlapping/intersecting triangles.
@@ -41,7 +44,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceAutoPatch/surfaceAutoPatch.C b/applications/utilities/surface/surfaceAutoPatch/surfaceAutoPatch.C
index 57f5beac2ce9da20fa8c0c6ce9382798ef98749b..f53ec829635b309221fda439443aa83e1bd820eb 100644
--- a/applications/utilities/surface/surfaceAutoPatch/surfaceAutoPatch.C
+++ b/applications/utilities/surface/surfaceAutoPatch/surfaceAutoPatch.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -41,7 +41,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C
index 1000f845141bf4afd04800698d85414349c3dc33..fb36589061da30f47554bd93d38876b8076d5199 100644
--- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C
+++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.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
@@ -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
+    surfaceCheck
+
+Description
+    Checks geometric and topological quality of a surface.
+
 \*---------------------------------------------------------------------------*/
 
 #include "triangle.H"
@@ -165,7 +171,6 @@ labelList countBins
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceClean/surfaceClean.C b/applications/utilities/surface/surfaceClean/surfaceClean.C
index 2ff98ae8c1903822ca96988f39ad13dfc7eac1d4..acea21f0bed29ae5844b2cfc44f230bc0806e0b0 100644
--- a/applications/utilities/surface/surfaceClean/surfaceClean.C
+++ b/applications/utilities/surface/surfaceClean/surfaceClean.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -43,7 +43,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C b/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C
index 10c6378b6dd3f008de77657758e169cdb015b2b8..4fcb9b1978de651bc52e72a28a8137cea3e3202e 100644
--- a/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C
+++ b/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    surfaceCoarsen
+
 Description
     Surface coarsening using 'bunnylod':
 
@@ -59,7 +62,6 @@ int mapVertex(::List<int>& collapse_map, int a, int mx)
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceConvert/surfaceConvert.C b/applications/utilities/surface/surfaceConvert/surfaceConvert.C
index 66af664ad7d844c9e979563e6d82a537c3a3f076..5d826824d07db2160c7e89250701d32b3d224e65 100644
--- a/applications/utilities/surface/surfaceConvert/surfaceConvert.C
+++ b/applications/utilities/surface/surfaceConvert/surfaceConvert.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,7 +25,7 @@ Application
     surfaceConvert
 
 Description
-    Converts from one surface mesh format to another
+    Converts from one surface mesh format to another.
 
 Usage
     - surfaceConvert inputFile outputFile [OPTION]
@@ -55,7 +55,6 @@ using namespace Foam;
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C b/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C
index 7c03938234b1d057b6d17d42337e817de411aaa8..fadf9a7ec7816880a3e4dcb6636f82bb01e4a619 100644
--- a/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C
+++ b/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,7 +25,7 @@ Application
     surfaceFeatureConvert
 
 Description
-    Convert between edgeMesh formats
+    Convert between edgeMesh formats.
 
 \*---------------------------------------------------------------------------*/
 
@@ -38,7 +38,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/CGALPolyhedronRings.H b/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/CGALPolyhedronRings.H
index 7aa4459e893d67b82107b05944ccfa6f406afb18..6d54cc70d47fcd55f6627727ad66ca2d4a4006af 100644
--- a/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/CGALPolyhedronRings.H
+++ b/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/CGALPolyhedronRings.H
@@ -106,7 +106,7 @@ public:
 
 ////IMPLEMENTATION////////////////////////////////////////////////////
 
-template < class TPoly , class VertexPropertyMap>
+template< class TPoly , class VertexPropertyMap>
 void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
 push_neighbours_of(Vertex* start, int ith,
                    std::vector< Vertex* >& nextRing,
@@ -129,7 +129,7 @@ push_neighbours_of(Vertex* start, int ith,
 }
 
 
-template <class TPoly, class VertexPropertyMap>
+template<class TPoly, class VertexPropertyMap>
 void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
 collect_ith_ring(int ith, std::vector< Vertex* >& currentRing,
                  std::vector< Vertex* >& nextRing,
@@ -146,7 +146,7 @@ collect_ith_ring(int ith, std::vector< Vertex* >& currentRing,
 }
 
 
-template <class TPoly, class VertexPropertyMap>
+template<class TPoly, class VertexPropertyMap>
 void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
 reset_ring_indices(std::vector< Vertex* >& vces,
                    VertexPropertyMap& vpm)
@@ -161,7 +161,7 @@ reset_ring_indices(std::vector< Vertex* >& vces,
 }
 
 
-template <class TPoly, class VertexPropertyMap>
+template<class TPoly, class VertexPropertyMap>
 void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
 collect_i_rings(Vertex* v,
                 int ring_i,
@@ -192,7 +192,7 @@ collect_i_rings(Vertex* v,
 }
 
 
-template <class TPoly, class VertexPropertyMap>
+template<class TPoly, class VertexPropertyMap>
 void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
 collect_enough_rings(Vertex* v,
                      unsigned int min_nb,
diff --git a/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/buildCGALPolyhedron.H b/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/buildCGALPolyhedron.H
index 30627c7463ffd0a91f2b3b5cc8bf0f3deaf260ec..1afaf8e8de138094f7be488241850beb47fea1df 100644
--- a/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/buildCGALPolyhedron.H
+++ b/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/buildCGALPolyhedron.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C
index ef2d7f14265fefcf5925193adba3c6df0131c998..4a5469793cac5c272d95e6e6677ee6653b330b7c 100644
--- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C
+++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C
@@ -929,7 +929,6 @@ void writeStats(const extendedFeatureEdgeMesh& fem, Ostream& os)
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceFind/Make/files b/applications/utilities/surface/surfaceFind/Make/files
index 7d0ad65e272713d1493bf329390960c2a7718876..b918032ab2f9935af168a550f3b6cab1056679e7 100644
--- a/applications/utilities/surface/surfaceFind/Make/files
+++ b/applications/utilities/surface/surfaceFind/Make/files
@@ -1,4 +1,3 @@
-
 surfaceFind.C
 
 EXE = $(FOAM_APPBIN)/surfaceFind
diff --git a/applications/utilities/surface/surfaceFind/surfaceFind.C b/applications/utilities/surface/surfaceFind/surfaceFind.C
index 6e0d6ed53429f114fd49a158aa18b3aad38b29c5..b002e13d315fee0fd0bfeb369cf35ec56c625810 100644
--- a/applications/utilities/surface/surfaceFind/surfaceFind.C
+++ b/applications/utilities/surface/surfaceFind/surfaceFind.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    surfaceFind
+
 Description
     Finds nearest face and vertex.
 
@@ -35,7 +38,6 @@ using namespace Foam;
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceInertia/surfaceInertia.C b/applications/utilities/surface/surfaceInertia/surfaceInertia.C
index b1bdb66a114989e7f6b867a8a4d8a3184fd76d2f..6b30f610b134dfa1e69a455a7f73fda1f6879c69 100644
--- a/applications/utilities/surface/surfaceInertia/surfaceInertia.C
+++ b/applications/utilities/surface/surfaceInertia/surfaceInertia.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) 2011-2013 OpenFOAM Foundation
     \\/      M anipulation   |
 -------------------------------------------------------------------------------
 License
@@ -22,11 +22,11 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Application
-    momentOfInertiaTest
+    surfaceInertia
 
 Description
-    Calculates the inertia tensor and principal axes and moments of a
-    command line specified triSurface.  Inertia can either be of the
+    Calculates the inertia tensor, principal axes and moments of a
+    command line specified triSurface. Inertia can either be of the
     solid body or of a thin shell.
 
 \*---------------------------------------------------------------------------*/
diff --git a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C
index ea30c2dd55d4631fb3e6a2f1aacb6d24f9a4bb3c..849cf6ea71683251f8bf56426ceac92df4b6c182 100644
--- a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C
+++ b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.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
@@ -25,7 +25,7 @@ Application
     surfaceMeshConvert
 
 Description
-    Convert between surface formats with optional scaling or
+    Converts between surface formats with optional scaling or
     transformations (rotate/translate) on a coordinateSystem.
 
 Usage
@@ -66,7 +66,6 @@ Note
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//  Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C
index cbc5059f10b0e8d6e5f8a310025c3aef55309a24..b83be115f5e3ddc3edd0b739a188190e96cde407 100644
--- a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C
+++ b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.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
@@ -66,7 +66,6 @@ Note
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//  Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C
index f8a5ebf57a25ad8cd4dafa325b265203e459f1e3..bfc46ccd758e06dc255783452e431c68e709ca10 100644
--- a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C
+++ b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.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
@@ -67,7 +67,6 @@ Note
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//  Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C
index 87ff39d182edceabeeb8a6555a3b0ff31f641258..a8a093868183647e976abbee66db75958221abbe 100644
--- a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C
+++ b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.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
@@ -67,7 +67,6 @@ Note
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//  Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C b/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C
index 80638bf4dbdc79fbab0024a32c0c2faa8c5c6ed6..0129154b84c2b114ab9d3370af7a3cee6065fd78 100644
--- a/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C
+++ b/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.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
@@ -25,7 +25,7 @@ Application
     surfaceMeshInfo
 
 Description
-    Miscellaneous information about surface meshes
+    Miscellaneous information about surface meshes.
 
 Usage
     - surfaceMeshInfo surfaceFile [OPTION]
@@ -64,7 +64,6 @@ using namespace Foam;
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//  Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
index 8ac04195ac3bc685b34a5eb829946fdf4183655b..80ba2bec5fcdb596d7fb6be8e48f0e6c5eea4a72 100644
--- a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
+++ b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.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
@@ -21,6 +21,9 @@ 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
+    surfaceMeshTriangulate
+
 Description
     Extracts surface from a polyMesh. Depending on output surface format
     triangulates faces.
@@ -50,7 +53,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceOrient/surfaceOrient.C b/applications/utilities/surface/surfaceOrient/surfaceOrient.C
index 86266a3db934ed2eb25c86a2901f17b4d4172c2c..29b60c791677faf28e357f19b408230fbda9179a 100644
--- a/applications/utilities/surface/surfaceOrient/surfaceOrient.C
+++ b/applications/utilities/surface/surfaceOrient/surfaceOrient.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,9 +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
+    surfaceOrient
+
 Description
     Set normal consistent with respect to a user provided 'outside' point.
-    If -inside the point is considered inside.
+    If the -inside option is used the point is considered inside.
 
 \*---------------------------------------------------------------------------*/
 
@@ -35,7 +38,6 @@ using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfacePointMerge/Make/files b/applications/utilities/surface/surfacePointMerge/Make/files
index b2007f991187947ca04733cc0a5440c5c06f3737..bff3cb9d1b36cecfa7a2a5e797b666a383b7c13e 100644
--- a/applications/utilities/surface/surfacePointMerge/Make/files
+++ b/applications/utilities/surface/surfacePointMerge/Make/files
@@ -1,4 +1,3 @@
-
 surfacePointMerge.C
 
 EXE = $(FOAM_APPBIN)/surfacePointMerge
diff --git a/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C b/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C
index 55edcd68507c8d253d9da3a6ba4c71df9e80d263..b63686881ae08d6baab542a9d1d77df7591299bf 100644
--- a/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C
+++ b/applications/utilities/surface/surfacePointMerge/surfacePointMerge.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    surfacePointMerge
+
 Description
     Merges points on surface if they are within absolute distance.
     Since absolute distance use with care!
@@ -37,7 +40,6 @@ using namespace Foam;
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C
index 76a385733eb0e77ae7f641fb3b9c71fefa2991b1..6e4db35a0bdce4829099f02569402298cd78aebf 100644
--- a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C
+++ b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.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
@@ -26,8 +26,8 @@ Application
 
 Description
     (Re)distribution of triSurface. Either takes an undecomposed surface
-    or an already decomposed surface and redistribute it so each processor
-    has all triangles that overlap its mesh.
+    or an already decomposed surface and redistributes it so that each
+    processor has all triangles that overlap its mesh.
 
 Note
     - best decomposition option is hierarchGeomDecomp since
@@ -95,7 +95,6 @@ void writeProcStats
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.C b/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.C
index f44a3c2316963115f6b6d2142cfd2dfa8750e595..c10397bc01ebc8c2ae8a9f81da60f97d56bbdf5e 100644
--- a/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.C
+++ b/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ Application
 Description
     Refine by splitting all three edges of triangle ('red' refinement).
     Neighbouring triangles (which are not marked for refinement get split
-    in half ('green') refinement. (R. Verfuerth, "A review of a posteriori
+    in half ('green' refinement). (R. Verfuerth, "A review of a posteriori
     error estimation and adaptive mesh refinement techniques",
     Wiley-Teubner, 1996)
 
@@ -42,7 +42,6 @@ using namespace Foam;
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceSmooth/Make/files b/applications/utilities/surface/surfaceSmooth/Make/files
index a0517bb97a32ecec50f8d43934e6c89c915dc3e3..97ec8c043ea42cf16ec062c3a00b0cd8ce7c28e7 100644
--- a/applications/utilities/surface/surfaceSmooth/Make/files
+++ b/applications/utilities/surface/surfaceSmooth/Make/files
@@ -1,4 +1,3 @@
-
 surfaceSmooth.C
 
 EXE = $(FOAM_APPBIN)/surfaceSmooth
diff --git a/applications/utilities/surface/surfaceSmooth/surfaceSmooth.C b/applications/utilities/surface/surfaceSmooth/surfaceSmooth.C
index 6365fdb8a7dd6675ad879cbde293241a1418586b..0242044c82249d89af1e1a7ee134f78f91d5047c 100644
--- a/applications/utilities/surface/surfaceSmooth/surfaceSmooth.C
+++ b/applications/utilities/surface/surfaceSmooth/surfaceSmooth.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,8 +21,11 @@ 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
+    surfaceSmooth
+
 Description
-    Example of a simple laplacian smoother
+    Example of a simple laplacian smoother.
 
 \*---------------------------------------------------------------------------*/
 
@@ -36,7 +39,6 @@ using namespace Foam;
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C b/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C
index fc820c2b16454c1c04cc348a4212347782bf20d6..2825822607c2620f0d7a4f54b544fca540b599e2 100644
--- a/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C
+++ b/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    surfaceSplitByPatch
+
 Description
     Writes regions of triSurface to separate files.
 
@@ -32,7 +35,6 @@ Description
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C b/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C
index 29948a3a425a67293c3279d775745521f1467f30..184d326e26869e8fbff3e62b0c8c02316b0f8588 100644
--- a/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C
+++ b/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    surfaceSplitNonManifolds
+
 Description
     Takes multiply connected surface and tries to split surface at
     multiply connected edges by duplicating points. Introduces concept of
@@ -660,7 +663,6 @@ bool splitBorderEdges
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceSubset/surfaceSubset.C b/applications/utilities/surface/surfaceSubset/surfaceSubset.C
index 5ca325acba9266c813d98bad4b7caf5a84128a68..9df166e6e28ee194e01e067a32a994a3995d5999 100644
--- a/applications/utilities/surface/surfaceSubset/surfaceSubset.C
+++ b/applications/utilities/surface/surfaceSubset/surfaceSubset.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
@@ -21,6 +21,9 @@ 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
+    surfaceSubset
+
 Description
     A surface analysis tool which sub-sets the triSurface
     to choose only a part of interest. Based on subsetMesh.
@@ -41,7 +44,6 @@ Description
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C b/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C
index 12131e8c724678fbaff4d72992c217e078788708..bbcf96b96e3a57aca7b44364a4252a404e11a68b 100644
--- a/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C
+++ b/applications/utilities/surface/surfaceToPatch/surfaceToPatch.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
@@ -21,6 +21,9 @@ 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
+    surfaceToPatch
+
 Description
     Reads surface and applies surface regioning to a mesh. Uses boundaryMesh
     to do the hard work.
@@ -160,7 +163,6 @@ bool repatchFace
 }
 
 
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/surface/surfaceTransformPoints/Make/files b/applications/utilities/surface/surfaceTransformPoints/Make/files
index 89663576aa563cf6aa339d9858b2d68ace372af9..9b4cc1e08dd1a881dd85bd0e97c9e46a46b8d24d 100644
--- a/applications/utilities/surface/surfaceTransformPoints/Make/files
+++ b/applications/utilities/surface/surfaceTransformPoints/Make/files
@@ -1,4 +1,3 @@
-
 surfaceTransformPoints.C
 
 EXE = $(FOAM_APPBIN)/surfaceTransformPoints
diff --git a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C
index 4bb5171094c26700c7e9021a68ffb24a3ffa00aa..8bdcd357417bdfecbce1f9147cc6fc1f18379fdc 100644
--- a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C
+++ b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    surfaceTransformPoints
+
 Description
     Transform (scale/rotate) a surface.
     Like transformPoints but for surfaces.
@@ -50,7 +53,6 @@ using namespace Foam::constant::mathematical;
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C
index 2f56ee07dea1f13086c13c4c1c33c266c102b183..8399c1085653798d1beff588191c127a10ba766e 100644
--- a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C
+++ b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,6 +21,9 @@ 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
+    chemkinToFoam
+
 Description
     Converts CHEMKINIII thermodynamics and reaction data files into
     OpenFOAM format.
@@ -34,7 +37,6 @@ Description
 using namespace Foam;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
@@ -42,11 +44,20 @@ int main(int argc, char *argv[])
     argList::validArgs.append("CHEMKINThermodynamicsFile");
     argList::validArgs.append("FOAMChemistryFile");
     argList::validArgs.append("FOAMThermodynamicsFile");
+
+    argList::addBoolOption
+    (
+        "newFormat",
+        "read Chemkin thermo file in new format"
+    );
+
     argList args(argc, argv);
 
+    bool newFormat = args.optionFound("newFormat");
+
     speciesTable species;
 
-    chemkinReader cr(args[1], species, args[2]);
+    chemkinReader cr(args[1], species, args[2], newFormat);
 
     OFstream reactionsFile(args[3]);
     reactionsFile
diff --git a/applications/utilities/thermophysical/equilibriumCO/equilibriumCO.C b/applications/utilities/thermophysical/equilibriumCO/equilibriumCO.C
index 49441dde9d7b3bb8a807d27a476e359b71e08412..7af84242b9c3f5490c9187baa8d7eb5ec956dd28 100644
--- a/applications/utilities/thermophysical/equilibriumCO/equilibriumCO.C
+++ b/applications/utilities/thermophysical/equilibriumCO/equilibriumCO.C
@@ -22,9 +22,10 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Application
+    equilibriumCO
 
 Description
-    Calculates the equilibrium level of carbon monoxide
+    Calculates the equilibrium level of carbon monoxide.
 
 \*---------------------------------------------------------------------------*/
 
@@ -49,7 +50,6 @@ typedef species::thermo<janafThermo<perfectGas<specie> >, absoluteEnthalpy>
     thermo;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Main program:
 
 int main(int argc, char *argv[])
 {
diff --git a/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C b/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C
index 83ae17e368fccbe5de9b96542448c529bdddb2e4..9879031cf8e023a9d228c0bc10efe76fa32c125f 100644
--- a/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C
+++ b/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C
@@ -22,7 +22,7 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Application
-    adiabaticFlameT
+    equilibriumFlameT
 
 Description
     Calculates the equilibrium flame temperature for a given fuel and
diff --git a/bin/foamInstallationTest b/bin/foamInstallationTest
index 9d8c1545f23e9780cff8984c3607bb39506ddc8a..fe72e8ce96e4cafe589221d6dac3331978695c8b 100755
--- a/bin/foamInstallationTest
+++ b/bin/foamInstallationTest
@@ -3,7 +3,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #-------------------------------------------------------------------------------
 # License
@@ -32,7 +32,7 @@
 #------------------------------------------------------------------------------
 
 # Base settings
-MIN_VERSION_GCC=4.3.2
+MIN_VERSION_GCC=4.5.0
 
 # General
 WIDTH=20
diff --git a/bin/tools/foamConfigurePaths b/bin/tools/foamConfigurePaths
index 98d3a832d16a90f9f431d60e38dd9ecce6f23436..254f5e4380ff7273d682b41e311b20ada7787d86 100755
--- a/bin/tools/foamConfigurePaths
+++ b/bin/tools/foamConfigurePaths
@@ -36,11 +36,11 @@ usage() {
 
 usage: ${0##*/}
   --foamInstall dir         specify installation directory (e.g. /opt)
-  --projectName name        specify project name (e.g. openfoam170)
-  --projectVersion ver      specify project version (e.g. 1.7.x)
-  --archOption  arch        specify architecture option (only 32 or 64 applicable)
-  --paraviewInstall dir     specify ParaView_DIR (e.g. /opt/paraviewopenfoam380)
-  --paraviewVersion ver     specify ParaView_VERSION (e.g. 3.14.1)
+  --projectName name        specify project name (e.g. openfoam220)
+  --projectVersion ver      specify project version (e.g. 2.2.0)
+  --archOption arch         specify architecture option (only 32 or 64 applicable)
+  --paraviewInstall dir     specify ParaView_DIR (e.g. /opt/paraviewopenfoam3120)
+  --paraviewVersion ver     specify ParaView_VERSION (e.g. 3.12.0)
 
 * hardcode paths to installation
 
@@ -51,26 +51,51 @@ USAGE
 
 # Function to do replacement on file. Checks if any replacement has been done.
 # inlineSed <file> <sedCommand> <description>
+#_inlineSed()
+#{
+#    [ -f "$1" ] || {
+#        echo "Missing file: $1"
+#        exit 1
+#    }
+#
+#    backup="temp.$$"
+#    cp $1 $backup
+#    sed -i -e "$2" $1
+#
+#    if cmp $1 $backup > /dev/null 2>&1
+#    then
+#        echo "Failed: $3 in $1"
+#        rm $backup 2>/dev/null
+#        exit 1
+#    else
+#        echo "Okay: $3 in $1"
+#        rm $backup 2>/dev/null
+#    fi
+#
+#    return 0
+#}
+
+# Function to do replacement on file. Checks if any replacement has been done.
+# _inlineSed <file> <regexp> <replacement> <msg>
 _inlineSed()
 {
-    [ -f "$1" ] || {
-        echo "Missing file: $1"
+    file="$1"
+
+    [ -f "$file" ] || {
+        echo "Missing file: $file"
         exit 1
     }
 
-    backup="temp.$$"
-    cp $1 $backup
-    sed -i -e "$2" $1
+    regexp="$2"
+    replacement="$3"
+    msg="$4"
 
-    if cmp $1 $backup > /dev/null 2>&1
-    then
-        echo "Failed: $3 in $1"
-        rm $backup 2>/dev/null
-        exit 1
-    else
-        echo "Okay: $3 in $1"
-        rm $backup 2>/dev/null
-    fi
+    cmd='/^[^#]/s@'"$regexp"'@'"$replacement"'@'
+
+    grep -q "$regexp" "$file" && sed -i -e "$cmd" "$file" || \
+        (echo "Failed: $msg in $file" && exit 1)
+
+    echo "Okay: $msg in $file"
 
     return 0
 }
@@ -93,7 +118,8 @@ do
         # replace foamInstall=...
         _inlineSed \
             etc/bashrc \
-            '/^[^#]/s@foamInstall=.*@foamInstall='"$foamInstall@" \
+            'foamInstall=.*' \
+            'foamInstall='"$foamInstall" \
             "Replacing foamInstall setting by '$foamInstall'"
         shift 2
         ;;
@@ -103,7 +129,8 @@ do
         # replace WM_PROJECT_DIR=...
         _inlineSed \
             etc/bashrc \
-            '/^[^#]/s@WM_PROJECT_DIR=.*@WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/'"$projectName@" \
+            'WM_PROJECT_DIR=.*' \
+            'WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/'"$projectName" \
             "Replacing WM_PROJECT_DIR setting by $projectName"
         shift 2
         ;;
@@ -111,11 +138,13 @@ do
         [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
         projectVersion="$2"
         # replace WM_PROJECT_VERSION=...
-        # No checking since might already be set.
         echo "Replacing WM_PROJECT_VERSION setting by $projectVersion"
-        sed -i \
-            '/^[^#]/s@WM_PROJECT_VERSION=.*@WM_PROJECT_VERSION='"$projectVersion@" \
-            etc/bashrc
+        _inlineSed \
+            etc/bashrc \
+            'WM_PROJECT_VERSION=.*' \
+            'WM_PROJECT_VERSION='"$projectVersion" \
+            "Replacing WM_PROJECT_VERSION setting by $projectVersion"
+
         shift 2
         ;;
     -archOption | --archOption)
@@ -127,8 +156,9 @@ do
             # replace WM_ARCH_OPTION=...
             _inlineSed \
                 etc/bashrc \
-                '/^[^#]/s@WM_ARCH_OPTION=.*@WM_ARCH_OPTION='"$archOption@" \
-                 "Replacing WM_ARCH_OPTION setting by '$archOption'"
+                'WM_ARCH_OPTION=.*' \
+                'WM_ARCH_OPTION='"$archOption" \
+                "Replacing WM_ARCH_OPTION setting by '$archOption'"
         else
             echo "WM_ARCH_OPTION already set to $archOption"
         fi
@@ -140,7 +170,8 @@ do
         # replace ParaView_DIR=...
         _inlineSed \
             etc/config/paraview.sh \
-            '/^[^#]/s@ParaView_DIR=.*@ParaView_DIR='"$paraviewInstall@" \
+            'ParaView_DIR=.*' \
+            'ParaView_DIR='"$paraviewInstall" \
              "Replacing ParaView_DIR setting by '$paraviewInstall'"
         shift 2
         ;;
@@ -150,8 +181,9 @@ do
         # replace ParaView_VERSION=...
         _inlineSed \
             etc/config/paraview.sh \
-            '/^[^#]/s@ParaView_VERSION=.*@ParaView_VERSION='"$paraviewVersion@" \
-             "Replacing ParaView_VERSION setting by '$paraviewVersion'"
+            'ParaView_VERSION=.*' \
+            'ParaView_VERSION='"$paraviewVersion" \
+            "Replacing ParaView_VERSION setting by '$paraviewVersion'"
         shift 2
         ;;
     *)
@@ -168,13 +200,15 @@ done
 # Set WM_MPLIB=SYSTEMOPENMPI always
 _inlineSed \
     etc/bashrc \
-    '/^[^#]/s@export WM_MPLIB=.*@export WM_MPLIB=SYSTEMOPENMPI@' \
+    'export WM_MPLIB=.*' \
+    'export WM_MPLIB=SYSTEMOPENMPI' \
     "Replacing WM_MPLIB setting by 'SYSTEMOPENMPI'"
 
 ## set foamCompiler=system always
 #_inlineSed \
 #    etc/bashrc \
-#    '/^[^#]/s@foamCompiler=.*@foamCompiler=system@' \
+#    'foamCompiler=.*' \
+#    'foamCompiler=system' \
 #    "Replacing foamCompiler setting by 'system'"
 
 #------------------------------------------------------------------------------
diff --git a/bin/tools/pre-commit-hook b/bin/tools/pre-commit-hook
index 551af76c6ce41eeabc4868351e17ffe205237a2f..e4506658619d7a30ea5cbff6cea8e27c648fe491 100755
--- a/bin/tools/pre-commit-hook
+++ b/bin/tools/pre-commit-hook
@@ -3,7 +3,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
@@ -147,7 +147,7 @@ checkIllegalCode()
     do
         case "$f" in
         # exclude potential makefiles
-        (*[Mm]akefile* | wmake/rules/*)
+        (*[Mm]akefile* | wmake/rules/* | *.f* | *.v[cf]proj | *.pdf | *.png | *.html | *.gif | *.css)
         ;;
         (*)
             fileType=`file -b $f`
diff --git a/doc/Doxygen/Doxyfile b/doc/Doxygen/Doxyfile
index 4e3829d65a160d2be0b193f68ad7e6be977967ac..5e1108d06b3ea57b05ffe8824383e84af63dc523 100644
--- a/doc/Doxygen/Doxyfile
+++ b/doc/Doxygen/Doxyfile
@@ -1,14 +1,14 @@
-# Doxyfile 1.6.3
+# Doxyfile 1.6.3-1.8.1
 
 # This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
+# doxygen (www.doxygen.org) for a project.
 #
-# All text after a hash (#) is considered a comment and will be ignored
+# All text after a hash (#) is considered a comment and will be ignored.
 # The format is:
 #       TAG = value [value, ...]
 # For lists items can also be appended using:
 #       TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
+# Values that contain spaces should be placed between quotes (" ").
 
 #---------------------------------------------------------------------------
 # Project related configuration options
@@ -22,8 +22,9 @@
 
 DOXYFILE_ENCODING      = UTF-8
 
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
+# The PROJECT_NAME tag is a single word (or sequence of words) that should
+# identify the project. Note that if you do not use Doxywizard you need
+# to put quotes around the project name if it contains spaces.
 
 PROJECT_NAME           = OpenFOAM-$(WM_PROJECT_VERSION)
 
@@ -33,6 +34,19 @@ PROJECT_NAME           = OpenFOAM-$(WM_PROJECT_VERSION)
 
 PROJECT_NUMBER         =
 
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer
+# a quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO           =
+
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
 # base path where the generated documentation will be put.
 # If a relative path is entered, it will be relative to the location
@@ -57,7 +71,7 @@ CREATE_SUBDIRS         = NO
 # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
 # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
 # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
 # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
 
 OUTPUT_LANGUAGE        = English
@@ -126,7 +140,7 @@ STRIP_FROM_PATH        = $(WM_PROJECT_DIR)
 STRIP_FROM_INC_PATH    =
 
 # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
+# (but less readable) file names. This can be useful if your file system
 # doesn't support long names like on DOS, Mac, or CD-ROM.
 
 SHORT_NAMES            = YES
@@ -181,6 +195,13 @@ TAB_SIZE               = 4
 
 ALIASES                =
 
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding
+# "class=itcl::class" will allow you to use the command class in the
+# itcl::class meaning.
+
+TCL_SUBST              =
+
 # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
 # sources only. Doxygen will then generate output that is more tailored for C.
 # For instance, some of the names that are used will be different. The list
@@ -208,23 +229,31 @@ OPTIMIZE_FOR_FORTRAN   = NO
 OPTIMIZE_OUTPUT_VHDL   = NO
 
 # Doxygen selects the parser to use depending on the extension of the files it
-# parses.  With this tag you can assign which parser to use for a given
-# extension.  Doxygen has a built-in mapping, but you can override or extend it
-# using this tag.  The format is ext=language, where ext is a file extension,
-# and language is one of the parsers supported by doxygen: IDL, Java,
-# Javascript, C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C,
-# C++. For instance to make doxygen treat .inc files as Fortran files (default
-# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note
-# that for custom extensions you also need to set FILE_PATTERNS otherwise the
-# files are not read by doxygen.
+# parses. With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this
+# tag. The format is ext=language, where ext is a file extension, and language
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
 
 EXTENSION_MAPPING      =
 
+# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all
+# comments according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you
+# can mix doxygen, HTML, and XML commands with Markdown formatting.
+# Disable only in case of backward compatibilities issues.
+
+MARKDOWN_SUPPORT       = NO
+
 # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
 # to include (a tag file for) the STL sources as input, then you should
 # set this tag to YES in order to let doxygen match functions declarations and
 # definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
+# func(std::string) {}). This also makes the inheritance and collaboration
 # diagrams that involve STL classes more complete and accurate.
 
 BUILTIN_STL_SUPPORT    = NO
@@ -240,10 +269,10 @@ CPP_CLI_SUPPORT        = NO
 
 SIP_SUPPORT            = NO
 
-# For Microsoft's IDL there are propget and propput attributes to indicate
-# getter and setter methods for a property. Setting this option to YES (the
-# default) will make doxygen to replace the get and set methods by a property in
-# the documentation. This will only work if the methods are indeed getting or
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
 # setting a simple type. If this is not the case, or you want to show the
 # methods anyway, you should set this option to NO.
 
@@ -264,6 +293,22 @@ DISTRIBUTE_GROUP_DOC   = NO
 
 SUBGROUPING            = YES
 
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
+# unions are shown inside the group in which they are included (e.g. using
+# @ingroup) instead of on a separate page (for HTML and Man pages) or
+# section (for LaTeX and RTF).
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
+# unions with only public data fields will be shown inline in the documentation
+# of the scope in which they are defined (i.e. file, namespace, or group
+# documentation), provided this scope is documented. If set to NO (the default),
+# structs, classes, and unions are shown on a separate page (for HTML and Man
+# pages) or section (for LaTeX and RTF).
+
+INLINE_SIMPLE_STRUCTS  = NO
+
 # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
 # is documented as struct, union, or enum with the name of the typedef. So
 # typedef struct TypeS {} TypeT, will appear in the documentation as a struct
@@ -280,16 +325,27 @@ TYPEDEF_HIDES_STRUCT   = NO
 # For small to medium size projects (<1000 input files) the default value is
 # probably good enough. For larger projects a too small cache size can cause
 # doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
+# causing a significant performance penalty.
 # If the system has enough physical memory increasing the cache will improve the
 # performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
+# a logarithmic scale so increasing the size by one will roughly double the
 # memory usage. The cache size is given by this formula:
 # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
+# corresponding to a cache size of 2^16 = 65536 symbols.
 
 SYMBOL_CACHE_SIZE      = 0
 
+# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
+# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
+# their name and scope. Since this can be an expensive process and often the
+# same symbol appear multiple times in the code, doxygen keeps a cache of
+# pre-resolved symbols. If the cache is too small doxygen will become slower.
+# If the cache is too large, memory is wasted. The cache size is given by this
+# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols.
+
+LOOKUP_CACHE_SIZE      = 0
+
 #---------------------------------------------------------------------------
 # Build related configuration options
 #---------------------------------------------------------------------------
@@ -306,6 +362,10 @@ EXTRACT_ALL            = YES
 
 EXTRACT_PRIVATE        = NO
 
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation.
+
+EXTRACT_PACKAGE        = NO
+
 # If the EXTRACT_STATIC tag is set to YES all static members of a file
 # will be included in the documentation.
 
@@ -328,7 +388,7 @@ EXTRACT_LOCAL_METHODS  = NO
 # extracted and appear in the documentation as a namespace called
 # 'anonymous_namespace{file}', where file will be replaced with the base
 # name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
+# anonymous namespaces are hidden.
 
 EXTRACT_ANON_NSPACES   = NO
 
@@ -413,12 +473,13 @@ SORT_MEMBER_DOCS       = NO
 
 SORT_BRIEF_DOCS        = NO
 
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
-# (brief and detailed) documentation of class members so that constructors and
-# destructors are listed first. If set to NO (the default) the constructors will
-# appear in the respective orders defined by SORT_MEMBER_DOCS and
-# SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is
-# set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
 
 SORT_MEMBERS_CTORS_1ST = NO
 
@@ -438,6 +499,15 @@ SORT_GROUP_NAMES       = NO
 
 SORT_BY_SCOPE_NAME     = NO
 
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
+# do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even
+# if there is only one candidate or it is obvious which candidate to choose
+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING  = NO
+
 # The GENERATE_TODOLIST tag can be used to enable (YES) or
 # disable (NO) the todo list. This list is created by putting \todo
 # commands in the documentation.
@@ -468,10 +538,10 @@ GENERATE_DEPRECATEDLIST= YES
 ENABLED_SECTIONS       =
 
 # The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
+# the initial value of a variable or macro consists of for it to appear in
 # the documentation. If the initializer consists of more lines than specified
 # here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
+# The appearance of the initializer of individual variables and macros in the
 # documentation can be controlled using \showinitializer or \hideinitializer
 # command in the documentation regardless of this setting.
 
@@ -483,6 +553,7 @@ MAX_INITIALIZER_LINES  = 30
 
 SHOW_USED_FILES        = YES
 
+# 1.6.3-1.7.4 SETTING
 # If the sources in your project are distributed over multiple directories
 # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
 # in the documentation. The default is NO.
@@ -515,12 +586,22 @@ FILE_VERSION_FILTER    =
 # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
 # by doxygen. The layout file controls the global structure of the generated
 # output files in an output format independent way. The create the layout file
-# that represents doxygen's defaults, run doxygen with the -l option. You can
-# optionally specify a file name after the option, if omitted DoxygenLayout.xml
-# will be used as the name of the layout file.
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
 
 LAYOUT_FILE            =
 
+# The CITE_BIB_FILES tag can be used to specify one or more bib files
+# containing the references data. This must be a list of .bib files. The
+# .bib extension is automatically appended if omitted. Using this command
+# requires the bibtex tool to be installed. See also
+# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
+# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
+# feature you need bibtex and perl available in the search path.
+
+CITE_BIB_FILES         =
+
 #---------------------------------------------------------------------------
 # configuration options related to warning and progress messages
 #---------------------------------------------------------------------------
@@ -549,7 +630,7 @@ WARN_IF_UNDOCUMENTED   = YES
 
 WARN_IF_DOC_ERROR      = YES
 
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# The WARN_NO_PARAMDOC option can be enabled to get warnings for
 # functions that are documented, but have no documentation for their parameters
 # or return value. If set to NO (the default) doxygen will only warn about
 # wrong or incomplete parameter documentation, but not about the absence of
@@ -564,7 +645,7 @@ WARN_NO_PARAMDOC       = NO
 # $version, which will be replaced by the version of the file (if it could
 # be obtained via FILE_VERSION_FILTER)
 
-WARN_FORMAT            = "$file:$line: $text "
+WARN_FORMAT            = "$file:$line: $text"
 
 # The WARN_LOGFILE tag can be used to specify a file to which warning
 # and error messages should be written. If left blank the output is written
@@ -604,8 +685,9 @@ INPUT_ENCODING         = UTF-8
 # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
 # and *.h) to filter out the source-files in the directories. If left
 # blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
+# *.f90 *.f *.for *.vhd *.vhdl
 
 FILE_PATTERNS          = *.H \
                          *.C \
@@ -617,14 +699,16 @@ FILE_PATTERNS          = *.H \
 
 RECURSIVE              = YES
 
-# The EXCLUDE tag can be used to specify files and/or directories that should
+# The EXCLUDE tag can be used to specify files and/or directories that should be
 # excluded from the INPUT source files. This way you can easily exclude a
 # subdirectory from a directory tree whose root is specified with the INPUT tag.
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
 
 EXCLUDE                =
 
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
 # from the input.
 
 EXCLUDE_SYMLINKS       = NO
@@ -689,8 +773,8 @@ INPUT_FILTER           = $(WM_PROJECT_DIR)/bin/tools/doxyFilter
 # filter if there is a match.
 # The filters are a list of the form:
 # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
+# info on how filters are used. If FILTER_PATTERNS is empty or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
 
 FILTER_PATTERNS        =
 
@@ -700,6 +784,14 @@ FILTER_PATTERNS        =
 
 FILTER_SOURCE_FILES    = NO
 
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS =
+
 #---------------------------------------------------------------------------
 # configuration options related to source browsing
 #---------------------------------------------------------------------------
@@ -788,6 +880,7 @@ IGNORE_PREFIX          =
 
 GENERATE_HTML          = YES
 
+# 1.6.3 SETTING
 # If the HTML_FOOTER_DESCRIPTION tag is set to YES, Doxygen will
 # add generated date, project name and doxygen version to HTML footer.
 
@@ -807,7 +900,14 @@ HTML_FILE_EXTENSION    = .html
 
 # The HTML_HEADER tag can be used to specify a personal HTML header for
 # each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
+# standard header. Note that when using a custom header you are responsible
+#  for the proper inclusion of any scripts and style sheets that doxygen
+# needs, which is dependent on the configuration options used.
+# It is advised to generate a default header using "doxygen -w html
+# header.html footer.html stylesheet.css YourConfigFile" and then modify
+# that header. Note that the header is subject to change so you typically
+# have to redo this when upgrading to a newer version of doxygen or when
+# changing the value of configuration settings such as GENERATE_TREEVIEW!
 
 HTML_HEADER            = $(WM_PROJECT_DIR)/doc/Doxygen/_Header
 
@@ -822,16 +922,51 @@ HTML_FOOTER            = $(WM_PROJECT_DIR)/doc/Doxygen/_Footer
 # fine-tune the look of the HTML output. If the tag is left blank doxygen
 # will generate a default style sheet. Note that doxygen will try to copy
 # the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
+# style sheet in the HTML output directory as well, or it will be erased!
 
 HTML_STYLESHEET        =
 
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that
+# the files will be copied as-is; there are no commands or markers available.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the style sheet and background images
+# according to this color. Hue is specified as an angle on a colorwheel,
+# see http://en.wikipedia.org/wiki/Hue for more information.
+# For instance the value 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
 # page will contain the date and time when the page was generated. Setting
 # this to NO can help when comparing the output of multiple runs.
 
 HTML_TIMESTAMP         = NO
 
+# 1.6.3-1.7.4 SETTING
 # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
 # files or namespaces will be aligned in HTML using tables. If set to
 # NO a bullet list will be used.
@@ -840,21 +975,31 @@ HTML_ALIGN_MEMBERS     = YES
 
 # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
 # documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+# page has loaded.
 
 HTML_DYNAMIC_SECTIONS  = NO
 
-# If the GENERATE_DOCSET tag is set to YES, additional index files will be
-# generated that can be used as input for Apple's Xcode 3 integrated development
-# environment, introduced with OSX 10.5 (Leopard).  To create a documentation
-# set, doxygen will generate a Makefile in the HTML output directory. Running
-# make will produce the docset in that directory and running "make install" will
-# install the docset in ~/Library/Developer/Shared/Documentation/DocSets so that
-# Xcode will find it at startup.  See
-# http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more
-# information.
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of
+# entries shown in the various tree structured indices initially; the user
+# can expand and collapse entries dynamically later on. Doxygen will expand
+# the tree to such a level that at most the specified number of entries are
+# visible (unless a fully collapsed tree already exceeds this amount).
+# So setting the number of entries 1 will produce a full collapsed tree by
+# default. 0 is a special value representing an infinite number of entries
+# and will result in a full expanded tree by default.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
 
 GENERATE_DOCSET        = NO
 
@@ -872,6 +1017,16 @@ DOCSET_FEEDNAME        = "Doxygen generated docs"
 
 DOCSET_BUNDLE_ID       = org.doxygen.Project
 
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
 # If the GENERATE_HTMLHELP tag is set to YES, additional index files
 # will be generated that can be used as input for tools like the
 # Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
@@ -917,9 +1072,9 @@ BINARY_TOC             = NO
 TOC_EXPAND             = NO
 
 # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
-# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
-# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
-# (.qch) of the generated HTML documentation.
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
 
 GENERATE_QHP           = NO
 
@@ -942,22 +1097,23 @@ QHP_NAMESPACE          = org.doxygen.Project
 QHP_VIRTUAL_FOLDER     = doc
 
 # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
-# add.  For more information please see
+# add. For more information please see
 # http://doc.trolltech.com/qthelpproject.html#custom-filters
 
 QHP_CUST_FILTER_NAME   =
 
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom
-# filter to add.For more information please see <a
-# href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help
-# Project / Custom Filters</a>.
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
+# Qt Help Project / Custom Filters</a>.
 
 QHP_CUST_FILTER_ATTRS  =
 
 # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
-# project's filter section matches.  <a
-# href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help
-# Project / Filter Attributes</a>.
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
+# Qt Help Project / Filter Attributes</a>.
 
 QHP_SECT_FILTER_ATTRS  =
 
@@ -968,14 +1124,14 @@ QHP_SECT_FILTER_ATTRS  =
 
 QHG_LOCATION           =
 
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
-#  generated, which together with the HTML files, form an Eclipse help
-#  plugin. To install this plugin and make it available under the help contents
-#  menu in Eclipse, the contents of the directory containing the HTML and XML
-#  files needs to be copied into the plugins directory of eclipse. The name of
-#  the directory within the plugins directory should be the same as the
-#  ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the
-#  help appears.
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+#  will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
 
 GENERATE_ECLIPSEHELP   = NO
 
@@ -985,16 +1141,14 @@ GENERATE_ECLIPSEHELP   = NO
 
 ECLIPSE_DOC_ID         = org.doxygen.Project
 
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
+# at top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it. Since the tabs have the same information as the
+# navigation tree you can set this option to NO if you already set
+# GENERATE_TREEVIEW to YES.
 
 DISABLE_INDEX          = NO
 
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE   = 4
 
 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
 # structure should be generated to display hierarchical information.
@@ -1003,9 +1157,19 @@ ENUM_VALUES_PER_LINE   = 4
 # is generated for HTML Help). For this to work a browser that supports
 # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
 # Windows users are probably better off using the HTML help feature.
+# Since the tree basically has the same information as the tab index you
+# could consider to set DISABLE_INDEX to NO when enabling this option.
 
 GENERATE_TREEVIEW      = NO
 
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
+# (range [0,1..20]) that doxygen will group on one line in the generated HTML
+# documentation. Note that a value of 0 will completely suppress the enum
+# values from appearing in the overview section.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# 1.6.3-1.7.4 SETTING
 # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
 # and Class Hierarchy pages using a tree view instead of an ordered list.
 
@@ -1017,6 +1181,11 @@ USE_INLINE_TREES       = NO
 
 TREEVIEW_WIDTH         = 250
 
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW    = NO
+
 # Use this tag to change the font size of Latex formulas included
 # as images in the HTML documentation. The default is 10. Note that
 # when you change the font size after a successful doxygen run you need
@@ -1025,27 +1194,59 @@ TREEVIEW_WIDTH         = 250
 
 FORMULA_FONTSIZE       = 10
 
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
-# the HTML output. The underlying search engine uses javascript and DHTML and
-# should work on any modern browser. Note that when using HTML help
-# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
-# there is already a search function so this one should typically be
-# disabled. For large projects the javascript based search engine can be slow,
-# then enabling SERVER_BASED_SEARCH may provide a better solution.
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# (see http://www.mathjax.org) which uses client side Javascript for the
+# rendering instead of using prerendered bitmaps. Use this if you do not
+# have LaTeX installed or if you want to formulas look prettier in the HTML
+# output. When enabled you may also need to install MathJax separately and
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you need to specify the location relative to the
+# HTML output directory using the MATHJAX_RELPATH option. The destination
+# directory should contain the MathJax.js script. For instance, if the mathjax
+# directory is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to
+# the MathJax Content Delivery Network so you can quickly see the result without
+# installing MathJax.
+# However, it is strongly recommended to install a local
+# copy of MathJax from http://www.mathjax.org before deployment.
+
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
+# names that should be enabled during MathJax rendering.
+
+MATHJAX_EXTENSIONS     =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
 
 SEARCHENGINE           = YES
 
 # When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a PHP enabled web server instead of at the web client using
-# Javascript. Doxygen will generate the search PHP script and index file to put
-# on the web server. The advantage of the server based approach is that it
-# scales better to large projects and allows full text search. The disadvances
-# is that it is more difficult to setup and does not have live searching
-# capabilities.
+# implemented using a PHP enabled web server instead of at the web client
+# using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server
+# based approach is that it scales better to large projects and allows
+# full text search. The disadvantages are that it is more difficult to setup
+# and does not have live searching capabilities.
 
 SERVER_BASED_SEARCH    = NO
-# old default
-# SERVER_BASED_SEARCH    = YES
 
 #---------------------------------------------------------------------------
 # configuration options related to the LaTeX output
@@ -1083,7 +1284,7 @@ MAKEINDEX_CMD_NAME     = makeindex
 COMPACT_LATEX          = NO
 
 # The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
+# by the printer. Possible values are: a4, letter, legal and
 # executive. If left blank a4wide will be used.
 
 PAPER_TYPE             = a4wide
@@ -1100,6 +1301,13 @@ EXTRA_PACKAGES         = $(WM_PROJECT_DIR)/doc/Doxygen/Macros/tensorOperator
 
 LATEX_HEADER           =
 
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
+# the generated latex document. The footer should contain everything after
+# the last chapter. If it is left blank doxygen will generate a
+# standard footer. Notice: only use this tag if you know what you are doing!
+
+LATEX_FOOTER           =
+
 # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
 # is prepared for conversion to pdf (using ps2pdf). The pdf file will
 # contain links (just like the HTML output) instead of page references
@@ -1126,12 +1334,19 @@ LATEX_BATCHMODE        = NO
 
 LATEX_HIDE_INDICES     = NO
 
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with
-# syntax highlighting in the LaTeX output. Note that which sources are shown
-# also depends on other settings such as SOURCE_BROWSER.
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
 
 LATEX_SOURCE_CODE      = NO
 
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
+# http://en.wikipedia.org/wiki/BibTeX for more info.
+
+LATEX_BIB_STYLE        = plain
+
 #---------------------------------------------------------------------------
 # configuration options related to the RTF output
 #---------------------------------------------------------------------------
@@ -1163,7 +1378,7 @@ COMPACT_RTF            = NO
 
 RTF_HYPERLINKS         = NO
 
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# Load style sheet definitions from file. Syntax is similar to doxygen's
 # config file, i.e. a series of assignments. You only have to provide
 # replacements, missing definitions are set to their default value.
 
@@ -1308,7 +1523,7 @@ MACRO_EXPANSION        = YES
 EXPAND_ONLY_PREDEF     = NO
 
 # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
+# pointed to by INCLUDE_PATH will be searched when a #include is found.
 
 SEARCH_INCLUDES        = NO
 
@@ -1338,15 +1553,15 @@ PREDEFINED             =
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
 # this tag can be used to specify a list of macro names that should be expanded.
 # The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
+# Use the PREDEFINED tag if you want to use a different macro definition that
+# overrules the definition found in the source code.
 
 EXPAND_AS_DEFINED      =
 
 # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
+# semicolon, because these will confuse the parser if not removed.
 
 SKIP_FUNCTION_MACROS   = YES
 
@@ -1354,22 +1569,18 @@ SKIP_FUNCTION_MACROS   = YES
 # Configuration::additions related to external references
 #---------------------------------------------------------------------------
 
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
+# The TAGFILES option can be used to specify one or more tagfiles. For each
+# tag file the location of the external documentation should be added. The
+# format of a tag file without this location is as follows:
 #
 # TAGFILES = file1 file2 ...
 # Adding location for the tag files is done as follows:
 #
 # TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
+# where "loc1" and "loc2" can be relative or absolute paths
+# or URLs. Note that each tag file must have a unique name (where the name does
+# NOT include the path). If a tag file is not located in the directory in which
+# doxygen is run, you must also specify the path to the tagfile here.
 
 TAGFILES               =
 
@@ -1402,9 +1613,8 @@ PERL_PATH              = /usr/bin/perl
 # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
 # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
 # or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
+# this option also works with HAVE_DOT disabled, but it is recommended to
+# install and use dot, since it yields more powerful graphs.
 
 CLASS_DIAGRAMS         = YES
 
@@ -1430,14 +1640,20 @@ HIDE_UNDOC_RELATIONS   = YES
 
 HAVE_DOT               = YES
 
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This font
-# does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS        = 0
+
+# By default doxygen will use the Helvetica font for all dot files that
+# doxygen generates. When you want a differently looking font you can specify
+# the font name using DOT_FONTNAME. You need to make sure dot is able to find
+# the font, which can be done by putting it in a standard location or by setting
+# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
+# directory containing the font.
 
 DOT_FONTNAME           = FreeSans
 
@@ -1446,17 +1662,16 @@ DOT_FONTNAME           = FreeSans
 
 DOT_FONTSIZE           = 10
 
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
+# By default doxygen will tell dot to use the Helvetica font.
+# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
+# set the path where dot can find it.
 
 DOT_FONTPATH           =
 
 # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
 # will generate a graph for each documented class showing the direct and
 # indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
+# CLASS_DIAGRAMS tag to NO.
 
 CLASS_GRAPH            = YES
 
@@ -1478,6 +1693,15 @@ GROUP_GRAPHS           = YES
 
 UML_LOOK               = NO
 
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside
+# the class node. If there are many fields or methods and many nodes the
+# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
+# threshold limits the number of items for each type to make the size more
+# managable. Set this to 0 for no limit. Note that the threshold may be
+# exceeded by 50% before the limit is enforced.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
 # If set to YES, the inheritance and collaboration graphs will show the
 # relations between templates and their instances.
 
@@ -1514,11 +1738,11 @@ CALL_GRAPH             = YES
 CALLER_GRAPH           = YES
 
 # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
+# will generate a graphical hierarchy of all classes instead of a textual one.
 
 GRAPHICAL_HIERARCHY    = YES
 
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES
 # then doxygen will show the dependencies a directory has on other directories
 # in a graphical way. The dependency relations are determined by the #include
 # relations between the files in the directories.
@@ -1526,11 +1750,22 @@ GRAPHICAL_HIERARCHY    = YES
 DIRECTORY_GRAPH        = YES
 
 # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
+# generated by dot. Possible values are svg, png, jpg, or gif.
+# If left blank png will be used. If you choose svg you need to set
+# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# visible in IE 9+ (other browsers do not have this requirement).
 
 DOT_IMAGE_FORMAT       = png
 
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+# Note that this requires a modern browser other than Internet Explorer.
+# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
+# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# visible. Older versions of IE do not have SVG support.
+
+INTERACTIVE_SVG        = NO
+
 # The tag DOT_PATH can be used to specify the path where the dot tool can be
 # found. If left blank, it is assumed the dot tool can be found in the path.
 
@@ -1542,6 +1777,12 @@ DOT_PATH               =
 
 DOTFILE_DIRS           =
 
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the
+# \mscfile command).
+
+MSCFILE_DIRS           =
+
 # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
 # nodes that will be shown in the graph. If the number of nodes in a graph
 # becomes larger than this value, doxygen will truncate the graph, which is
@@ -1560,7 +1801,7 @@ DOT_GRAPH_MAX_NODES    = 50
 # code bases. Also note that the size of a graph can be further restricted by
 # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
 
-MAX_DOT_GRAPH_DEPTH    = 3
+MAX_DOT_GRAPH_DEPTH    = 1
 
 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
 # background. This is disabled by default, because dot on Windows does not
@@ -1587,4 +1828,4 @@ GENERATE_LEGEND        = YES
 # remove the intermediate dot files that are used to generate
 # the various graphs.
 
-DOT_CLEANUP            = YES
+DOT_CLEANUP            = NO
diff --git a/doc/Doxygen/README b/doc/Doxygen/README
new file mode 100644
index 0000000000000000000000000000000000000000..911dbfd83f2b91a28bb8603ae7847c843356b63a
--- /dev/null
+++ b/doc/Doxygen/README
@@ -0,0 +1,26 @@
+Building the Doxygen help for OpenFOAM
+======================================
+
+The HTML documentation of OpenFOAM can be built using the Doxygen
+software.  Images in the documentation are generated using "dot", a
+program within the graphviz software package.  To build the
+documentation on the Ubuntu Linux system, for example, the user should
+install both doxygen and graphviz packages, e.g. by typing in a
+terminal window:
+
+    sudo apt-get install doxygen graphviz
+
+The Doxygen documentation will build automatically for a user that is
+configured to run OpenFOAM, i.e. has environment variables such as
+$WM_PROJECT_DIR set.  The user must also ensure they have write
+permission for the directory that Doxygen writes files to.
+
+The Doygen configuration file, Doxyfile, in the
+$WM_PROJECT_DIR/doc/Doxygen directory is configured to work with
+Doxygen versions 1.6.3-1.8.1.
+
+
+**Note**:
+    For versions of Doxygen below 1.7, the final <div> in the
+    _Header file (line 37) must be deleted before running Doxygen to
+    produce the correctly formatted HTML files.
diff --git a/doc/Doxygen/_Footer b/doc/Doxygen/_Footer
index b9f0e767c8b3c4ab0548cddac4e99dc7a7e56da7..a9a791baee5df77a2efaa59cdea7cba64513a84a 100644
--- a/doc/Doxygen/_Footer
+++ b/doc/Doxygen/_Footer
@@ -2,7 +2,7 @@
   </div> <!-- main -->
   <div class="footer">
     <p>
-      Copyright&nbsp;&copy;&nbsp;2011&nbsp;
+      Copyright&nbsp;&copy;&nbsp;2011-2013&nbsp;
       <a href="http://www.openfoam.org/about">OpenFOAM Foundation</a>
       |
       OPENFOAM&reg; is a registered
diff --git a/doc/Doxygen/_Header b/doc/Doxygen/_Header
index 3889ae86bcc25fbe86db0a897074e99d79aadb00..2b4b441decca106d09b1e0bc6fccff106c521470 100644
--- a/doc/Doxygen/_Header
+++ b/doc/Doxygen/_Header
@@ -3,7 +3,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UFT-8"/>
-<title> OpenFOAM&reg; programmer's C++ documentation </title>
+<title> OpenFOAM&reg; Programmer's C++ documentation </title>
 <!-- links -->
 <link href="../OpenFOAMdocIcon.png" rel="icon" type="image/png" />
 <link href="search/search.css" rel="stylesheet" type="text/css" />
@@ -34,4 +34,5 @@
   </div>  <!-- header -->
 
   <div class="main">
-  <!-- begin of doxygen-generated content -->
+    <div>
+    <!-- begin of doxygen-generated content -->
diff --git a/doc/Doxygen/css/cfdNav.css b/doc/Doxygen/css/cfdNav.css
index 506d7a6c7244c91fba90436b7bb9d41d17db9c6b..9c590e8695cabd4bb6282f369f5bcaaebbcf449d 100644
--- a/doc/Doxygen/css/cfdNav.css
+++ b/doc/Doxygen/css/cfdNav.css
@@ -326,6 +326,11 @@ nav3-bullet
     color:rgb(42,90,138);
 }
 
+div.navpath, div.summary
+{
+    display: none;
+}
+
 /*main-navigation ************************************************/
 .main-navigation .loginform
 {
diff --git a/doc/Doxygen/css/doxyMod.css b/doc/Doxygen/css/doxyMod.css
index e5909a50dbd2c910f9122586940b9af44185ecd9..a1b3e7ed0d0533074df4243b48ea528afaa5f783 100644
--- a/doc/Doxygen/css/doxyMod.css
+++ b/doc/Doxygen/css/doxyMod.css
@@ -12,6 +12,17 @@
     list-style-type: square;
 }
 
+/* colour and underline to match OpenFOAM style */
+div.title
+{
+    text-align: center;
+    font-size: 150%;
+    color:  #646464;
+    padding-top: 1em;
+    padding-bottom: 1em;
+    margin-bottom: 1em;
+    border-bottom: 7px solid #E1E1E1;
+}
 
 /* colour and underline to match OpenFOAM style */
 .contents h1,
@@ -72,8 +83,12 @@ tr.memlist
 }
 
 .OFTable th {
+    text-align: left;
     padding: 5px;
     border-bottom: 2px solid rgb(175,175,175);
 }
 
+.OFTable td {
+    padding-left: 5px;
+}
 
diff --git a/etc/config/settings.csh b/etc/config/settings.csh
index 27ad49aea859fac9b08a5abaed3711c06195a049..2264c4ee03850cf37610384befd7b4238ba99bd2 100644
--- a/etc/config/settings.csh
+++ b/etc/config/settings.csh
@@ -219,14 +219,14 @@ case ThirdParty:
     case Gcc++0x:
     case Gcc46:
     case Gcc46++0x:
-        set gcc_version=gcc-4.6.2
+        set gcc_version=gcc-4.6.1
         set gmp_version=gmp-5.0.4
         set mpfr_version=mpfr-3.1.0
         set mpc_version=mpc-0.9
         breaksw
     case Gcc47:
     case Gcc47++0x:
-        set gcc_version=gcc-4.7.0
+        set gcc_version=gcc-4.7.2
         set gmp_version=gmp-5.0.4
         set mpfr_version=mpfr-3.1.0
         set mpc_version=mpc-0.9
@@ -238,17 +238,6 @@ case ThirdParty:
         set mpfr_version=mpfr-2.4.2
         set mpc_version=mpc-0.8.1
         breaksw
-    case Gcc44:
-    case Gcc44++0x:
-        set gcc_version=gcc-4.4.3
-        set gmp_version=gmp-5.0.1
-        set mpfr_version=mpfr-2.4.2
-        breaksw
-    case Gcc43:
-        set gcc_version=gcc-4.3.3
-        set gmp_version=gmp-4.2.4
-        set mpfr_version=mpfr-2.4.1
-        breaksw
     case Clang:
         # using clang - not gcc
         setenv WM_CC 'clang'
diff --git a/etc/config/settings.sh b/etc/config/settings.sh
index ad336dd871e0492cadfe1d3053de13d1857f4533..5a77479b568f7e653a9fb4b0e81293f1357d6748 100644
--- a/etc/config/settings.sh
+++ b/etc/config/settings.sh
@@ -240,12 +240,6 @@ fi
 case "${foamCompiler}" in
 OpenFOAM | ThirdParty)
     case "$WM_COMPILER" in
-    Gcc463)
-        gcc_version=gcc-4.6.3
-        gmp_version=gmp-5.0.2
-        mpfr_version=mpfr-3.0.1
-        mpc_version=mpc-0.9
-        ;;
     Gcc | Gcc++0x | Gcc46 | Gcc46++0x)
         gcc_version=gcc-4.6.1
         gmp_version=gmp-5.0.4
@@ -253,7 +247,7 @@ OpenFOAM | ThirdParty)
         mpc_version=mpc-0.9
         ;;
     Gcc47 | Gcc47++0x)
-        gcc_version=gcc-4.7.0
+        gcc_version=gcc-4.7.2
         gmp_version=gmp-5.0.4
         mpfr_version=mpfr-3.1.0
         mpc_version=mpc-0.9
@@ -264,16 +258,6 @@ OpenFOAM | ThirdParty)
         mpfr_version=mpfr-2.4.2
         mpc_version=mpc-0.8.1
         ;;
-    Gcc44 | Gcc44++0x)
-        gcc_version=gcc-4.4.3
-        gmp_version=gmp-5.0.1
-        mpfr_version=mpfr-2.4.2
-        ;;
-    Gcc43)
-        gcc_version=gcc-4.3.3
-        gmp_version=gmp-4.2.4
-        mpfr_version=mpfr-2.4.1
-        ;;
     Clang)
         # using clang - not gcc
         export WM_CC='clang'
diff --git a/src/OSspecific/POSIX/fileMonitor.C b/src/OSspecific/POSIX/fileMonitor.C
index a960ac39fed81ed7f715d34fed111a5d74a2698b..936e815717f3efc408fc965e236c88010fc8099e 100644
--- a/src/OSspecific/POSIX/fileMonitor.C
+++ b/src/OSspecific/POSIX/fileMonitor.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
@@ -21,7 +21,7 @@ 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 "fileMonitor.H"
 #include "IOstreams.H"
diff --git a/src/OSspecific/POSIX/signals/sigFpe.C b/src/OSspecific/POSIX/signals/sigFpe.C
index a275fd7a3ad34cb7951bdc76d110451420dea5c4..501ff95c4e4063fae3fdf38ba1b2491b2b3dbc87 100644
--- a/src/OSspecific/POSIX/signals/sigFpe.C
+++ b/src/OSspecific/POSIX/signals/sigFpe.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -263,8 +263,8 @@ void Foam::sigFpe::set(const bool verbose)
         {
             if (supported)
             {
-            Info<< "SetNaN : Initialising allocated memory to NaN"
-                << " (FOAM_SETNAN)." << endl;
+                Info<< "SetNaN : Initialising allocated memory to NaN"
+                    << " (FOAM_SETNAN)." << endl;
             }
             else
             {
diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files
index 0bb3467ec438c3c7394d30b4872674c7404900d6..42af9b33493740058749dc2179a78bb9d6aefc90 100644
--- a/src/OpenFOAM/Make/files
+++ b/src/OpenFOAM/Make/files
@@ -368,6 +368,8 @@ $(cellShape)/cellShapeIOList.C
 
 meshes/Identifiers/patch/patchIdentifier.C
 
+meshes/MeshObject/meshObject.C
+
 polyMesh = meshes/polyMesh
 
 polyPatches = $(polyMesh)/polyPatches
diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C
index 01bd647b8acb1a2e2c0d80295169e7a71125532f..b18b2892cb8205db1ea80f0b522aa74aa8e3351e 100644
--- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C
+++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -30,7 +30,7 @@ License
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::scalar Foam::dynamicIndexedOctree<Type>::perturbTol_ = 10*SMALL;
 
 
@@ -38,7 +38,7 @@ Foam::scalar Foam::dynamicIndexedOctree<Type>::perturbTol_ = 10*SMALL;
 
 // Does bb intersect a sphere around sample? Or is any corner point of bb
 // closer than nearestDistSqr to sample.
-template <class Type>
+template<class Type>
 bool Foam::dynamicIndexedOctree<Type>::overlaps
 (
     const point& p0,
@@ -82,7 +82,7 @@ bool Foam::dynamicIndexedOctree<Type>::overlaps
 
 // Does bb intersect a sphere around sample? Or is any corner point of bb
 // closer than nearestDistSqr to sample.
-template <class Type>
+template<class Type>
 bool Foam::dynamicIndexedOctree<Type>::overlaps
 (
     const treeBoundBox& parentBb,
@@ -145,7 +145,7 @@ bool Foam::dynamicIndexedOctree<Type>::overlaps
 //
 
 // Split list of indices into 8 bins
-template <class Type>
+template<class Type>
 void Foam::dynamicIndexedOctree<Type>::divide
 (
     const autoPtr<DynamicList<label> >& indices,
@@ -187,7 +187,7 @@ void Foam::dynamicIndexedOctree<Type>::divide
 
 
 // Subdivide the (content) node.
-template <class Type>
+template<class Type>
 typename Foam::dynamicIndexedOctree<Type>::node
 Foam::dynamicIndexedOctree<Type>::divide
 (
@@ -280,7 +280,7 @@ Foam::dynamicIndexedOctree<Type>::divide
 }
 
 
-template <class Type>
+template<class Type>
 void Foam::dynamicIndexedOctree<Type>::recursiveSubDivision
 (
     const treeBoundBox& subBb,
@@ -333,7 +333,7 @@ void Foam::dynamicIndexedOctree<Type>::recursiveSubDivision
 // Pre-calculates wherever possible the volume status per node/subnode.
 // Recurses to determine status of lowest level boxes. Level above is
 // combination of octants below.
-template <class Type>
+template<class Type>
 typename Foam::dynamicIndexedOctree<Type>::volumeType
 Foam::dynamicIndexedOctree<Type>::calcVolumeType
 (
@@ -391,7 +391,7 @@ Foam::dynamicIndexedOctree<Type>::calcVolumeType
 }
 
 
-template <class Type>
+template<class Type>
 typename Foam::dynamicIndexedOctree<Type>::volumeType
 Foam::dynamicIndexedOctree<Type>::getVolumeType
 (
@@ -467,7 +467,7 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
 }
 
 
-template <class Type>
+template<class Type>
 typename Foam::dynamicIndexedOctree<Type>::volumeType
 Foam::dynamicIndexedOctree<Type>::getSide
 (
@@ -492,7 +492,7 @@ Foam::dynamicIndexedOctree<Type>::getSide
 //
 
 // Find nearest point starting from nodeI
-template <class Type>
+template<class Type>
 void Foam::dynamicIndexedOctree<Type>::findNearest
 (
     const label nodeI,
@@ -564,7 +564,7 @@ void Foam::dynamicIndexedOctree<Type>::findNearest
 
 
 // Find nearest point to line.
-template <class Type>
+template<class Type>
 void Foam::dynamicIndexedOctree<Type>::findNearest
 (
     const label nodeI,
@@ -630,7 +630,7 @@ void Foam::dynamicIndexedOctree<Type>::findNearest
 }
 
 
-template <class Type>
+template<class Type>
 Foam::treeBoundBox Foam::dynamicIndexedOctree<Type>::subBbox
 (
     const label parentNodeI,
@@ -656,7 +656,7 @@ Foam::treeBoundBox Foam::dynamicIndexedOctree<Type>::subBbox
 
 // Takes a bb and a point on/close to the edge of the bb and pushes the point
 // inside by a small fraction.
-template <class Type>
+template<class Type>
 Foam::point Foam::dynamicIndexedOctree<Type>::pushPoint
 (
     const treeBoundBox& bb,
@@ -727,7 +727,7 @@ Foam::point Foam::dynamicIndexedOctree<Type>::pushPoint
 
 // Takes a bb and a point on the edge of the bb and pushes the point
 // outside by a small fraction.
-template <class Type>
+template<class Type>
 Foam::point Foam::dynamicIndexedOctree<Type>::pushPoint
 (
     const treeBoundBox& bb,
@@ -840,7 +840,7 @@ Foam::point Foam::dynamicIndexedOctree<Type>::pushPoint
 // Guarantees that if pt is on a face it gets perturbed so it is away
 // from the face edges.
 // If pt is not on a face does nothing.
-template <class Type>
+template<class Type>
 Foam::point Foam::dynamicIndexedOctree<Type>::pushPointIntoFace
 (
     const treeBoundBox& bb,
@@ -1000,7 +1000,7 @@ Foam::point Foam::dynamicIndexedOctree<Type>::pushPointIntoFace
 //// Takes a bb and a point on the outside of the bb. Checks if on multiple
 // faces
 //// and if so perturbs point so it is only on one face.
-//template <class Type>
+//template<class Type>
 //void Foam::dynamicIndexedOctree<Type>::checkMultipleFaces
 //(
 //    const treeBoundBox& bb,
@@ -1196,7 +1196,7 @@ Foam::point Foam::dynamicIndexedOctree<Type>::pushPointIntoFace
 
 
 // Get parent node and octant. Return false if top of tree reached.
-template <class Type>
+template<class Type>
 bool Foam::dynamicIndexedOctree<Type>::walkToParent
 (
     const label nodeI,
@@ -1246,7 +1246,7 @@ bool Foam::dynamicIndexedOctree<Type>::walkToParent
 // node and octant in this node and walks in the direction given by
 // the facePointBits (combination of treeBoundBox::LEFTBIT, TOPBIT etc.)
 // Returns false if edge of tree hit.
-template <class Type>
+template<class Type>
 bool Foam::dynamicIndexedOctree<Type>::walkToNeighbour
 (
     const point& facePoint,
@@ -1484,7 +1484,7 @@ bool Foam::dynamicIndexedOctree<Type>::walkToNeighbour
 }
 
 
-template <class Type>
+template<class Type>
 Foam::word Foam::dynamicIndexedOctree<Type>::faceString
 (
     const direction faceID
@@ -1536,7 +1536,7 @@ Foam::word Foam::dynamicIndexedOctree<Type>::faceString
 // Else return a miss and the bounding box face hit:
 //  hitInfo.point = coordinate of intersection of ray with bounding box
 //  hitBits  = posbits of point on bounding box
-template <class Type>
+template<class Type>
 void Foam::dynamicIndexedOctree<Type>::traverseNode
 (
     const bool findAny,
@@ -1699,7 +1699,7 @@ void Foam::dynamicIndexedOctree<Type>::traverseNode
 
 
 // Find first intersection
-template <class Type>
+template<class Type>
 Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLine
 (
     const bool findAny,
@@ -1887,7 +1887,7 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLine
 
 
 // Find first intersection
-template <class Type>
+template<class Type>
 Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLine
 (
     const bool findAny,
@@ -1958,7 +1958,7 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLine
 }
 
 
-template <class Type>
+template<class Type>
 void Foam::dynamicIndexedOctree<Type>::findBox
 (
     const label nodeI,
@@ -2005,7 +2005,7 @@ void Foam::dynamicIndexedOctree<Type>::findBox
 }
 
 
-template <class Type>
+template<class Type>
 void Foam::dynamicIndexedOctree<Type>::findSphere
 (
     const label nodeI,
@@ -2053,8 +2053,8 @@ void Foam::dynamicIndexedOctree<Type>::findSphere
 }
 
 
-template <class Type>
-template <class CompareOp>
+template<class Type>
+template<class CompareOp>
 void Foam::dynamicIndexedOctree<Type>::findNear
 (
     const scalar nearDist,
@@ -2228,7 +2228,7 @@ void Foam::dynamicIndexedOctree<Type>::findNear
 
 
 // Number of elements in node.
-template <class Type>
+template<class Type>
 Foam::label Foam::dynamicIndexedOctree<Type>::countElements
 (
     const labelBits index
@@ -2261,7 +2261,7 @@ Foam::label Foam::dynamicIndexedOctree<Type>::countElements
 }
 
 
-template <class Type>
+template<class Type>
 void Foam::dynamicIndexedOctree<Type>::writeOBJ
 (
     const label nodeI,
@@ -2310,7 +2310,7 @@ void Foam::dynamicIndexedOctree<Type>::writeOBJ
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::dynamicIndexedOctree<Type>::dynamicIndexedOctree
 (
     const Type& shapes,
@@ -2347,14 +2347,14 @@ Foam::dynamicIndexedOctree<Type>::dynamicIndexedOctree
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::scalar& Foam::dynamicIndexedOctree<Type>::perturbTol()
 {
     return perturbTol_;
 }
 
 
-template <class Type>
+template<class Type>
 Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findNearest
 (
     const point& sample,
@@ -2382,7 +2382,7 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findNearest
 }
 
 
-template <class Type>
+template<class Type>
 Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findNearest
 (
     const linePointRef& ln,
@@ -2416,7 +2416,7 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findNearest
 
 
 // Find nearest intersection
-template <class Type>
+template<class Type>
 Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLine
 (
     const point& start,
@@ -2428,7 +2428,7 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLine
 
 
 // Find nearest intersection
-template <class Type>
+template<class Type>
 Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLineAny
 (
     const point& start,
@@ -2439,7 +2439,7 @@ Foam::pointIndexHit Foam::dynamicIndexedOctree<Type>::findLineAny
 }
 
 
-template <class Type>
+template<class Type>
 Foam::labelList Foam::dynamicIndexedOctree<Type>::findBox
 (
     const treeBoundBox& searchBox
@@ -2457,7 +2457,7 @@ Foam::labelList Foam::dynamicIndexedOctree<Type>::findBox
 }
 
 
-template <class Type>
+template<class Type>
 Foam::labelList Foam::dynamicIndexedOctree<Type>::findSphere
 (
     const point& centre,
@@ -2477,7 +2477,7 @@ Foam::labelList Foam::dynamicIndexedOctree<Type>::findSphere
 
 
 // Find node (as parent+octant) containing point
-template <class Type>
+template<class Type>
 Foam::labelBits Foam::dynamicIndexedOctree<Type>::findNode
 (
     const label nodeI,
@@ -2524,7 +2524,7 @@ Foam::labelBits Foam::dynamicIndexedOctree<Type>::findNode
 }
 
 
-template <class Type>
+template<class Type>
 Foam::label Foam::dynamicIndexedOctree<Type>::findInside
 (
     const point& sample
@@ -2556,7 +2556,7 @@ Foam::label Foam::dynamicIndexedOctree<Type>::findInside
 }
 
 
-template <class Type>
+template<class Type>
 const Foam::labelList& Foam::dynamicIndexedOctree<Type>::findIndices
 (
     const point& sample
@@ -2581,7 +2581,7 @@ const Foam::labelList& Foam::dynamicIndexedOctree<Type>::findIndices
 
 
 // Determine type (inside/outside/mixed) per node.
-template <class Type>
+template<class Type>
 typename Foam::dynamicIndexedOctree<Type>::volumeType
 Foam::dynamicIndexedOctree<Type>::getVolumeType
 (
@@ -2651,8 +2651,8 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
 }
 
 
-template <class Type>
-template <class CompareOp>
+template<class Type>
+template<class CompareOp>
 void Foam::dynamicIndexedOctree<Type>::findNear
 (
     const scalar nearDist,
@@ -2675,7 +2675,7 @@ void Foam::dynamicIndexedOctree<Type>::findNear
 }
 
 
-template <class Type>
+template<class Type>
 bool Foam::dynamicIndexedOctree<Type>::insert(label startIndex, label endIndex)
 {
     if (startIndex == endIndex)
@@ -2721,7 +2721,7 @@ bool Foam::dynamicIndexedOctree<Type>::insert(label startIndex, label endIndex)
 }
 
 
-template <class Type>
+template<class Type>
 bool Foam::dynamicIndexedOctree<Type>::insertIndex
 (
     const label nodIndex,
@@ -2798,7 +2798,7 @@ bool Foam::dynamicIndexedOctree<Type>::insertIndex
 }
 
 
-template <class Type>
+template<class Type>
 bool Foam::dynamicIndexedOctree<Type>::remove(const label index)
 {
     if (nodes_.empty())
@@ -2812,7 +2812,7 @@ bool Foam::dynamicIndexedOctree<Type>::remove(const label index)
 }
 
 
-template <class Type>
+template<class Type>
 Foam::label Foam::dynamicIndexedOctree<Type>::removeIndex
 (
     const label nodIndex,
@@ -2896,7 +2896,7 @@ Foam::label Foam::dynamicIndexedOctree<Type>::removeIndex
 
 
 // Print contents of nodeI
-template <class Type>
+template<class Type>
 void Foam::dynamicIndexedOctree<Type>::print
 (
     prefixOSstream& os,
@@ -2969,7 +2969,7 @@ void Foam::dynamicIndexedOctree<Type>::print
 }
 
 
-template <class Type>
+template<class Type>
 void Foam::dynamicIndexedOctree<Type>::writeTreeInfo() const
 {
     label nEntries = 0;
@@ -2996,7 +2996,7 @@ void Foam::dynamicIndexedOctree<Type>::writeTreeInfo() const
 
 
 // Print contents of nodeI
-template <class Type>
+template<class Type>
 bool Foam::dynamicIndexedOctree<Type>::write(Ostream& os) const
 {
     os << *this;
@@ -3005,7 +3005,7 @@ bool Foam::dynamicIndexedOctree<Type>::write(Ostream& os) const
 }
 
 
-template <class Type>
+template<class Type>
 Foam::Ostream&
 Foam::operator<<(Ostream& os, const dynamicIndexedOctree<Type>& t)
 {
diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H
index 7309af83e1dfbeb4f84b0eeca5d9c57b933df44d..0bbf7a0e2ea76808020ba80aa74af13abb807eec 100644
--- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H
+++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -74,7 +74,7 @@ TemplateName(dynamicIndexedOctree);
                            Class dynamicIndexedOctree Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class Type>
+template<class Type>
 class dynamicIndexedOctree
 :
     public dynamicIndexedOctreeName
@@ -372,7 +372,7 @@ private:
             ) const;
 
 
-            template <class CompareOp>
+            template<class CompareOp>
             static void findNear
             (
                 const scalar nearDist,
@@ -632,7 +632,7 @@ public:
 
             //- Find near pairs and apply CompareOp to them.
             //  tree2 can be *this or different tree.
-            template <class CompareOp>
+            template<class CompareOp>
             void findNear
             (
                 const scalar nearDist,
diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C
index 7b68821abc06d86f157599ccee89b819852037e5..e8ca08e94bf08f7ee75560f7c479561a2d2ab297 100644
--- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C
+++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C
@@ -30,7 +30,7 @@ License
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::scalar Foam::indexedOctree<Type>::perturbTol_ = 10*SMALL;
 
 
@@ -38,7 +38,7 @@ Foam::scalar Foam::indexedOctree<Type>::perturbTol_ = 10*SMALL;
 
 // Does bb intersect a sphere around sample? Or is any corner point of bb
 // closer than nearestDistSqr to sample.
-template <class Type>
+template<class Type>
 bool Foam::indexedOctree<Type>::overlaps
 (
     const point& p0,
@@ -55,7 +55,7 @@ bool Foam::indexedOctree<Type>::overlaps
 
 // Does bb intersect a sphere around sample? Or is any corner point of bb
 // closer than nearestDistSqr to sample.
-template <class Type>
+template<class Type>
 bool Foam::indexedOctree<Type>::overlaps
 (
     const treeBoundBox& parentBb,
@@ -118,7 +118,7 @@ bool Foam::indexedOctree<Type>::overlaps
 //
 
 // Split list of indices into 8 bins
-template <class Type>
+template<class Type>
 void Foam::indexedOctree<Type>::divide
 (
     const labelList& indices,
@@ -161,7 +161,7 @@ void Foam::indexedOctree<Type>::divide
 
 
 // Subdivide the (content) node.
-template <class Type>
+template<class Type>
 typename Foam::indexedOctree<Type>::node
 Foam::indexedOctree<Type>::divide
 (
@@ -231,7 +231,7 @@ Foam::indexedOctree<Type>::divide
 
 
 // Split any contents node with more than minSize elements.
-template <class Type>
+template<class Type>
 void Foam::indexedOctree<Type>::splitNodes
 (
     const label minSize,
@@ -285,7 +285,7 @@ void Foam::indexedOctree<Type>::splitNodes
 
 // Reorder contents to be in same order as nodes. Returns number of nodes on
 // the compactLevel.
-template <class Type>
+template<class Type>
 Foam::label Foam::indexedOctree<Type>::compactContents
 (
     DynamicList<node>& nodes,
@@ -355,7 +355,7 @@ Foam::label Foam::indexedOctree<Type>::compactContents
 // Pre-calculates wherever possible the volume status per node/subnode.
 // Recurses to determine status of lowest level boxes. Level above is
 // combination of octants below.
-template <class Type>
+template<class Type>
 typename Foam::indexedOctree<Type>::volumeType
 Foam::indexedOctree<Type>::calcVolumeType
 (
@@ -413,7 +413,7 @@ Foam::indexedOctree<Type>::calcVolumeType
 }
 
 
-template <class Type>
+template<class Type>
 typename Foam::indexedOctree<Type>::volumeType
 Foam::indexedOctree<Type>::getVolumeType
 (
@@ -489,7 +489,7 @@ Foam::indexedOctree<Type>::getVolumeType
 }
 
 
-template <class Type>
+template<class Type>
 typename Foam::indexedOctree<Type>::volumeType
 Foam::indexedOctree<Type>::getSide
 (
@@ -514,7 +514,7 @@ Foam::indexedOctree<Type>::getSide
 //
 
 
-//template <class Type>
+//template<class Type>
 //bool Foam::indexedOctree<Type>::findAnyOverlap
 //(
 //    const label nodeI,
@@ -575,8 +575,8 @@ Foam::indexedOctree<Type>::getSide
 
 
 // Find nearest point starting from nodeI
-template <class Type>
-template <class FindNearestOp>
+template<class Type>
+template<class FindNearestOp>
 void Foam::indexedOctree<Type>::findNearest
 (
     const label nodeI,
@@ -652,8 +652,8 @@ void Foam::indexedOctree<Type>::findNearest
 
 
 // Find nearest point to line.
-template <class Type>
-template <class FindNearestOp>
+template<class Type>
+template<class FindNearestOp>
 void Foam::indexedOctree<Type>::findNearest
 (
     const label nodeI,
@@ -723,7 +723,7 @@ void Foam::indexedOctree<Type>::findNearest
 }
 
 
-template <class Type>
+template<class Type>
 Foam::treeBoundBox Foam::indexedOctree<Type>::subBbox
 (
     const label parentNodeI,
@@ -749,7 +749,7 @@ Foam::treeBoundBox Foam::indexedOctree<Type>::subBbox
 
 // Takes a bb and a point on/close to the edge of the bb and pushes the point
 // inside by a small fraction.
-template <class Type>
+template<class Type>
 Foam::point Foam::indexedOctree<Type>::pushPoint
 (
     const treeBoundBox& bb,
@@ -820,7 +820,7 @@ Foam::point Foam::indexedOctree<Type>::pushPoint
 
 // Takes a bb and a point on the edge of the bb and pushes the point
 // outside by a small fraction.
-template <class Type>
+template<class Type>
 Foam::point Foam::indexedOctree<Type>::pushPoint
 (
     const treeBoundBox& bb,
@@ -933,7 +933,7 @@ Foam::point Foam::indexedOctree<Type>::pushPoint
 // Guarantees that if pt is on a face it gets perturbed so it is away
 // from the face edges.
 // If pt is not on a face does nothing.
-template <class Type>
+template<class Type>
 Foam::point Foam::indexedOctree<Type>::pushPointIntoFace
 (
     const treeBoundBox& bb,
@@ -1093,7 +1093,7 @@ Foam::point Foam::indexedOctree<Type>::pushPointIntoFace
 //// Takes a bb and a point on the outside of the bb. Checks if on multiple
 // faces
 //// and if so perturbs point so it is only on one face.
-//template <class Type>
+//template<class Type>
 //void Foam::indexedOctree<Type>::checkMultipleFaces
 //(
 //    const treeBoundBox& bb,
@@ -1289,7 +1289,7 @@ Foam::point Foam::indexedOctree<Type>::pushPointIntoFace
 
 
 // Get parent node and octant. Return false if top of tree reached.
-template <class Type>
+template<class Type>
 bool Foam::indexedOctree<Type>::walkToParent
 (
     const label nodeI,
@@ -1339,7 +1339,7 @@ bool Foam::indexedOctree<Type>::walkToParent
 // node and octant in this node and walks in the direction given by
 // the facePointBits (combination of treeBoundBox::LEFTBIT, TOPBIT etc.)
 // Returns false if edge of tree hit.
-template <class Type>
+template<class Type>
 bool Foam::indexedOctree<Type>::walkToNeighbour
 (
     const point& facePoint,
@@ -1577,7 +1577,7 @@ bool Foam::indexedOctree<Type>::walkToNeighbour
 }
 
 
-template <class Type>
+template<class Type>
 Foam::word Foam::indexedOctree<Type>::faceString
 (
     const direction faceID
@@ -1629,8 +1629,8 @@ Foam::word Foam::indexedOctree<Type>::faceString
 // Else return a miss and the bounding box face hit:
 //  hitInfo.point = coordinate of intersection of ray with bounding box
 //  hitBits  = posbits of point on bounding box
-template <class Type>
-template <class FindIntersectOp>
+template<class Type>
+template<class FindIntersectOp>
 void Foam::indexedOctree<Type>::traverseNode
 (
     const bool findAny,
@@ -1790,8 +1790,8 @@ void Foam::indexedOctree<Type>::traverseNode
 
 
 // Find first intersection
-template <class Type>
-template <class FindIntersectOp>
+template<class Type>
+template<class FindIntersectOp>
 Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
 (
     const bool findAny,
@@ -1987,7 +1987,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
 }
 
 
-//template <class Type>
+//template<class Type>
 //bool Foam::indexedOctree<Type>::isLineInsideOrOutside
 //(
 //    const label nodeI,
@@ -2020,8 +2020,8 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
 
 
 // Find first intersection
-template <class Type>
-template <class FindIntersectOp>
+template<class Type>
+template<class FindIntersectOp>
 Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
 (
     const bool findAny,
@@ -2094,7 +2094,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
 }
 
 
-template <class Type>
+template<class Type>
 void Foam::indexedOctree<Type>::findBox
 (
     const label nodeI,
@@ -2141,7 +2141,7 @@ void Foam::indexedOctree<Type>::findBox
 }
 
 
-template <class Type>
+template<class Type>
 void Foam::indexedOctree<Type>::findSphere
 (
     const label nodeI,
@@ -2189,8 +2189,8 @@ void Foam::indexedOctree<Type>::findSphere
 }
 
 
-template <class Type>
-template <class CompareOp>
+template<class Type>
+template<class CompareOp>
 void Foam::indexedOctree<Type>::findNear
 (
     const scalar nearDist,
@@ -2364,7 +2364,7 @@ void Foam::indexedOctree<Type>::findNear
 
 
 // Number of elements in node.
-template <class Type>
+template<class Type>
 Foam::label Foam::indexedOctree<Type>::countElements
 (
     const labelBits index
@@ -2397,7 +2397,7 @@ Foam::label Foam::indexedOctree<Type>::countElements
 }
 
 
-template <class Type>
+template<class Type>
 void Foam::indexedOctree<Type>::writeOBJ
 (
     const label nodeI,
@@ -2446,7 +2446,7 @@ void Foam::indexedOctree<Type>::writeOBJ
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::indexedOctree<Type>::indexedOctree(const Type& shapes)
 :
     shapes_(shapes),
@@ -2456,7 +2456,7 @@ Foam::indexedOctree<Type>::indexedOctree(const Type& shapes)
 {}
 
 
-template <class Type>
+template<class Type>
 Foam::indexedOctree<Type>::indexedOctree
 (
     const Type& shapes,
@@ -2471,7 +2471,7 @@ Foam::indexedOctree<Type>::indexedOctree
 {}
 
 
-template <class Type>
+template<class Type>
 Foam::indexedOctree<Type>::indexedOctree
 (
     const Type& shapes,
@@ -2623,7 +2623,7 @@ Foam::indexedOctree<Type>::indexedOctree
 }
 
 
-template <class Type>
+template<class Type>
 Foam::indexedOctree<Type>::indexedOctree
 (
     const Type& shapes,
@@ -2639,14 +2639,14 @@ Foam::indexedOctree<Type>::indexedOctree
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::scalar& Foam::indexedOctree<Type>::perturbTol()
 {
     return perturbTol_;
 }
 
 
-//template <class Type>
+//template<class Type>
 //bool Foam::indexedOctree<Type>::findAnyOverlap
 //(
 //    const point& sample,
@@ -2667,7 +2667,7 @@ Foam::scalar& Foam::indexedOctree<Type>::perturbTol()
 //}
 
 
-template <class Type>
+template<class Type>
 Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
 (
     const point& sample,
@@ -2683,8 +2683,8 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
 }
 
 
-template <class Type>
-template <class FindNearestOp>
+template<class Type>
+template<class FindNearestOp>
 Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
 (
     const point& sample,
@@ -2716,7 +2716,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
 }
 
 
-template <class Type>
+template<class Type>
 Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
 (
     const linePointRef& ln,
@@ -2734,8 +2734,8 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
 }
 
 
-template <class Type>
-template <class FindNearestOp>
+template<class Type>
+template<class FindNearestOp>
 Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
 (
     const linePointRef& ln,
@@ -2769,7 +2769,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
 
 
 // Find nearest intersection
-template <class Type>
+template<class Type>
 Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
 (
     const point& start,
@@ -2787,7 +2787,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
 
 
 // Find nearest intersection
-template <class Type>
+template<class Type>
 Foam::pointIndexHit Foam::indexedOctree<Type>::findLineAny
 (
     const point& start,
@@ -2805,8 +2805,8 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLineAny
 
 
 // Find nearest intersection
-template <class Type>
-template <class FindIntersectOp>
+template<class Type>
+template<class FindIntersectOp>
 Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
 (
     const point& start,
@@ -2819,8 +2819,8 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
 
 
 // Find nearest intersection
-template <class Type>
-template <class FindIntersectOp>
+template<class Type>
+template<class FindIntersectOp>
 Foam::pointIndexHit Foam::indexedOctree<Type>::findLineAny
 (
     const point& start,
@@ -2832,7 +2832,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLineAny
 }
 
 
-template <class Type>
+template<class Type>
 Foam::labelList Foam::indexedOctree<Type>::findBox
 (
     const treeBoundBox& searchBox
@@ -2850,7 +2850,7 @@ Foam::labelList Foam::indexedOctree<Type>::findBox
 }
 
 
-template <class Type>
+template<class Type>
 Foam::labelList Foam::indexedOctree<Type>::findSphere
 (
     const point& centre,
@@ -2870,7 +2870,7 @@ Foam::labelList Foam::indexedOctree<Type>::findSphere
 
 
 // Find node (as parent+octant) containing point
-template <class Type>
+template<class Type>
 Foam::labelBits Foam::indexedOctree<Type>::findNode
 (
     const label nodeI,
@@ -2917,7 +2917,7 @@ Foam::labelBits Foam::indexedOctree<Type>::findNode
 }
 
 
-template <class Type>
+template<class Type>
 Foam::label Foam::indexedOctree<Type>::findInside(const point& sample) const
 {
     labelBits index = findNode(0, sample);
@@ -2946,7 +2946,7 @@ Foam::label Foam::indexedOctree<Type>::findInside(const point& sample) const
 }
 
 
-template <class Type>
+template<class Type>
 const Foam::labelList& Foam::indexedOctree<Type>::findIndices
 (
     const point& sample
@@ -2971,7 +2971,7 @@ const Foam::labelList& Foam::indexedOctree<Type>::findIndices
 
 
 // Determine type (inside/outside/mixed) per node.
-template <class Type>
+template<class Type>
 typename Foam::indexedOctree<Type>::volumeType
 Foam::indexedOctree<Type>::getVolumeType
 (
@@ -3041,8 +3041,8 @@ Foam::indexedOctree<Type>::getVolumeType
 }
 
 
-template <class Type>
-template <class CompareOp>
+template<class Type>
+template<class CompareOp>
 void Foam::indexedOctree<Type>::findNear
 (
     const scalar nearDist,
@@ -3066,7 +3066,7 @@ void Foam::indexedOctree<Type>::findNear
 
 
 // Print contents of nodeI
-template <class Type>
+template<class Type>
 void Foam::indexedOctree<Type>::print
 (
     prefixOSstream& os,
@@ -3140,7 +3140,7 @@ void Foam::indexedOctree<Type>::print
 
 
 // Print contents of nodeI
-template <class Type>
+template<class Type>
 bool Foam::indexedOctree<Type>::write(Ostream& os) const
 {
     os << *this;
@@ -3149,7 +3149,7 @@ bool Foam::indexedOctree<Type>::write(Ostream& os) const
 }
 
 
-template <class Type>
+template<class Type>
 Foam::Ostream& Foam::operator<<(Ostream& os, const indexedOctree<Type>& t)
 {
     return
diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H
index 98ae67d590db25d47414947c99b49ff395cc823a..32d0ed070524aa29f856140f6e11a75bfb360ebf 100644
--- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H
+++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H
@@ -65,7 +65,7 @@ TemplateName(indexedOctree);
                            Class indexedOctree Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class Type>
+template<class Type>
 class indexedOctree
 :
     public indexedOctreeName
@@ -212,7 +212,7 @@ private:
         // Query
 
             //- Find nearest point to line.
-            template <class FindNearestOp>
+            template<class FindNearestOp>
             void findNearest
             (
                 const label nodeI,
@@ -297,7 +297,7 @@ private:
             // intersection point.
             // findAny=true : return any intersection
             // findAny=false: return nearest (to start) intersection
-            template <class FindIntersectOp>
+            template<class FindIntersectOp>
             void traverseNode
             (
                 const bool findAny,
@@ -316,7 +316,7 @@ private:
             ) const;
 
             //- Find any or nearest intersection
-            template <class FindIntersectOp>
+            template<class FindIntersectOp>
             pointIndexHit findLine
             (
                 const bool findAny,
@@ -336,7 +336,7 @@ private:
 //            ) const;
 
             //- Find any or nearest intersection of line between start and end.
-            template <class FindIntersectOp>
+            template<class FindIntersectOp>
             pointIndexHit findLine
             (
                 const bool findAny,
@@ -364,7 +364,7 @@ private:
             ) const;
 
 
-            template <class CompareOp>
+            template<class CompareOp>
             static void findNear
             (
                 const scalar nearDist,
@@ -549,7 +549,7 @@ public:
             //  - bool : any point found nearer than nearestDistSqr
             //  - label: index in shapes
             //  - point: actual nearest point found
-            template <class FindNearestOp>
+            template<class FindNearestOp>
             pointIndexHit findNearest
             (
                 const point& sample,
@@ -572,7 +572,7 @@ public:
 //            ) const;
 
             //- Low level: calculate nearest starting from subnode.
-            template <class FindNearestOp>
+            template<class FindNearestOp>
             void findNearest
             (
                 const label nodeI,
@@ -599,7 +599,7 @@ public:
                 point& linePoint
             ) const;
 
-            template <class FindNearestOp>
+            template<class FindNearestOp>
             pointIndexHit findNearest
             (
                 const linePointRef& ln,
@@ -624,7 +624,7 @@ public:
             ) const;
 
             //- Find nearest intersection of line between start and end.
-            template <class FindIntersectOp>
+            template<class FindIntersectOp>
             pointIndexHit findLine
             (
                 const point& start,
@@ -633,7 +633,7 @@ public:
             ) const;
 
             //- Find any intersection of line between start and end.
-            template <class FindIntersectOp>
+            template<class FindIntersectOp>
             pointIndexHit findLineAny
             (
                 const point& start,
@@ -690,7 +690,7 @@ public:
 
             //- Find near pairs and apply CompareOp to them.
             //  tree2 can be *this or different tree.
-            template <class CompareOp>
+            template<class CompareOp>
             void findNear
             (
                 const scalar nearDist,
diff --git a/src/OpenFOAM/containers/Lists/Distribution/Distribution.C b/src/OpenFOAM/containers/Lists/Distribution/Distribution.C
index 5afae8895fb10cac100b0cd1ac327d7a06ab83fa..89f0969826a8381b0e487911bad6401a2640f083 100644
--- a/src/OpenFOAM/containers/Lists/Distribution/Distribution.C
+++ b/src/OpenFOAM/containers/Lists/Distribution/Distribution.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -583,7 +583,7 @@ void Foam::Distribution<Type>::operator=
 
 // * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::Istream& Foam::operator>>
 (
     Istream& is,
@@ -621,7 +621,7 @@ Foam::Ostream& Foam::operator<<
 
 // * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::Distribution<Type> Foam::operator+
 (
     const Distribution<Type>& d1,
diff --git a/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.C b/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.C
index d83b4a9f3af4bb1f244f16d74b3f684392cc7fee..55c5eb9ce4df562c254f833996647c408a84e55f 100644
--- a/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.C
+++ b/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.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
@@ -30,7 +30,7 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class AccessType, class T, class AccessOp>
+template<class AccessType, class T, class AccessOp>
 AccessType ListListOps::combine(const List<T>& lst, AccessOp aop)
 {
     label sum = 0;
@@ -57,7 +57,7 @@ AccessType ListListOps::combine(const List<T>& lst, AccessOp aop)
 }
 
 
-template <class T, class AccessOp>
+template<class T, class AccessOp>
 labelList ListListOps::subSizes(const List<T>& lst, AccessOp aop)
 {
     labelList sizes(lst.size());
@@ -70,7 +70,7 @@ labelList ListListOps::subSizes(const List<T>& lst, AccessOp aop)
 }
 
 
-template <class AccessType, class T, class AccessOp, class OffsetOp>
+template<class AccessType, class T, class AccessOp, class OffsetOp>
 AccessType ListListOps::combineOffset
 (
     const List<T>& lst,
diff --git a/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.H b/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.H
index 05cef4a723bad9d8c03d0871d2cd9b9a2a30a05a..02afe8abf338bef11254f94a1b8b1aca816052b0 100644
--- a/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.H
+++ b/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.H
@@ -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
@@ -94,7 +94,7 @@ namespace Foam
 {
 
 // Dummy access operator for ListListOps::combine()
-template <class T>
+template<class T>
 class accessOp
 {
 public:
@@ -107,7 +107,7 @@ public:
 
 
 // Offset operator for ListListOps::combineOffset()
-template <class T>
+template<class T>
 class offsetOp
 {
 public:
@@ -126,15 +126,15 @@ namespace ListListOps
 {
 
     //- Combines sublists into one big list
-    template <class AccessType, class T, class AccessOp>
+    template<class AccessType, class T, class AccessOp>
     AccessType combine(const List<T>&, AccessOp aop = accessOp<T>());
 
     //- Gets sizes of sublists
-    template <class T, class AccessOp>
+    template<class T, class AccessOp>
     labelList subSizes(const List<T>&, AccessOp aop = accessOp<T>());
 
     //- Like combine but also offsets sublists based on passed sizes
-    template <class AccessType, class T, class AccessOp, class OffsetOp>
+    template<class AccessType, class T, class AccessOp, class OffsetOp>
     AccessType combineOffset
     (
         const List<T>&,
diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H
index 8da376020d4c38e602582c47ab539562ec318fdb..f878a6f969deba67665afa3aab561d7a2426448f 100644
--- a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H
+++ b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H
@@ -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
@@ -255,23 +255,23 @@ public:
 
 
 //- Reverse a list. First element becomes last element etc.
-template <class ListType>
+template<class ListType>
 ListType reverseList(const ListType& list);
 
 
 //- Inplace reversal of a list using Swap.
-template <class ListType>
+template<class ListType>
 void inplaceReverseList(ListType& list);
 
 
 //- Rotate a list by n places. If n is positive rotate clockwise/right/down.
 //  If n is negative rotate anti-clockwise/left/up.
-template <class ListType>
+template<class ListType>
 ListType rotateList(const ListType& list, const label n);
 
 
 //- Inplace reversal of a list using the Reversal Block Swapping algorithm.
-template <template <typename> class ListType, class DataType>
+template<template<typename> class ListType, class DataType>
 void inplaceRotateList(ListType<DataType>& list, label n);
 
 
diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C
index d55e3fd982abd8176162b66e40b72a118a8387c1..ab6f9bf511e90a28abee4852d5e1d0ee4a40a53e 100644
--- a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C
+++ b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.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
@@ -706,7 +706,7 @@ void Foam::ListAppendEqOp<T>::operator()(List<T>& x, const List<T>& y) const
 }
 
 
-template <class ListType>
+template<class ListType>
 ListType Foam::reverseList(const ListType& list)
 {
     const label listSize = list.size();
@@ -723,7 +723,7 @@ ListType Foam::reverseList(const ListType& list)
 }
 
 
-template <class ListType>
+template<class ListType>
 void Foam::inplaceReverseList(ListType& list)
 {
     const label listSize = list.size();
@@ -740,7 +740,7 @@ void Foam::inplaceReverseList(ListType& list)
 }
 
 
-template <class ListType>
+template<class ListType>
 ListType Foam::rotateList(const ListType& list, const label n)
 {
     const label listSize = list.size();
@@ -763,7 +763,7 @@ ListType Foam::rotateList(const ListType& list, const label n)
 }
 
 
-template <template <typename> class ListType, class DataType>
+template<template<typename> class ListType, class DataType>
 void Foam::inplaceRotateList(ListType<DataType>& list, label n)
 {
     const label listSize = list.size();
diff --git a/src/OpenFOAM/containers/Lists/PtrList/PtrListI.H b/src/OpenFOAM/containers/Lists/PtrList/PtrListI.H
index 3f29e9238f3cfa971f5711667501d76d1e15f45e..979e862d4a7c59e8eeb26e69d741bcbf750cd19e 100644
--- a/src/OpenFOAM/containers/Lists/PtrList/PtrListI.H
+++ b/src/OpenFOAM/containers/Lists/PtrList/PtrListI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -132,7 +132,9 @@ inline const T& Foam::PtrList<T>::operator[](const label i) const
     if (!ptrs_[i])
     {
         FatalErrorIn("PtrList::operator[] const")
-            << "hanging pointer, cannot dereference"
+            << "hanging pointer at index " << i
+            << " (size " << size()
+            << "), cannot dereference"
             << abort(FatalError);
     }
 
@@ -146,7 +148,9 @@ inline T& Foam::PtrList<T>::operator[](const label i)
     if (!ptrs_[i])
     {
         FatalErrorIn("PtrList::operator[]")
-            << "hanging pointer, cannot dereference"
+            << "hanging pointer at index " << i
+            << " (size " << size()
+            << "), cannot dereference"
             << abort(FatalError);
     }
 
diff --git a/src/OpenFOAM/containers/Lists/SortableList/ParSortableList.C b/src/OpenFOAM/containers/Lists/SortableList/ParSortableList.C
index 64deb50c490eba4b5d636a919cf54dbbf04ca492..ef9e71ffc209a1cc79847df2d3d0fd8ad729fe9a 100644
--- a/src/OpenFOAM/containers/Lists/SortableList/ParSortableList.C
+++ b/src/OpenFOAM/containers/Lists/SortableList/ParSortableList.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -31,7 +31,7 @@ License
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 void Foam::ParSortableList<Type>::write
 (
     const List<Type>& elems,
@@ -49,7 +49,7 @@ void Foam::ParSortableList<Type>::write
 
 
 // Copy src, starting at destI into dest.
-template <class Type>
+template<class Type>
 void Foam::ParSortableList<Type>::copyInto
 (
     const List<Type>& values,
@@ -72,7 +72,7 @@ void Foam::ParSortableList<Type>::copyInto
 }
 
 
-template <class Type>
+template<class Type>
 void Foam::ParSortableList<Type>::getPivots
 (
     const List<Type>& elems,
@@ -92,7 +92,7 @@ void Foam::ParSortableList<Type>::getPivots
 }
 
 
-template <class Type>
+template<class Type>
 void Foam::ParSortableList<Type>::checkAndSend
 (
     List<Type>& values,
@@ -123,7 +123,7 @@ void Foam::ParSortableList<Type>::checkAndSend
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 // Construct from List, sorting the elements
-template <class Type>
+template<class Type>
 Foam::ParSortableList<Type>::ParSortableList(const UList<Type>& values)
 :
     List<Type>(values),
@@ -135,7 +135,7 @@ Foam::ParSortableList<Type>::ParSortableList(const UList<Type>& values)
 
 
 // Construct given size. Sort later on.
-template <class Type>
+template<class Type>
 Foam::ParSortableList<Type>::ParSortableList(const label size)
 :
     List<Type>(size),
@@ -147,7 +147,7 @@ Foam::ParSortableList<Type>::ParSortableList(const label size)
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 // Sort
-template <class Type>
+template<class Type>
 void Foam::ParSortableList<Type>::sort()
 {
     //
diff --git a/src/OpenFOAM/containers/Lists/SortableList/ParSortableList.H b/src/OpenFOAM/containers/Lists/SortableList/ParSortableList.H
index 67966e5004050bf44517564bd6f3705df15266b5..c528d94d86bcea09511212a4f9f7929d748a1473 100644
--- a/src/OpenFOAM/containers/Lists/SortableList/ParSortableList.H
+++ b/src/OpenFOAM/containers/Lists/SortableList/ParSortableList.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -66,7 +66,7 @@ TemplateName(ParSortableList);
                            Class ParSortableList Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class Type>
+template<class Type>
 class ParSortableList
 :
     public ParSortableListName,
diff --git a/src/OpenFOAM/containers/Lists/UPtrList/UPtrListI.H b/src/OpenFOAM/containers/Lists/UPtrList/UPtrListI.H
index dceeb1f279689244ad354d32499c951b5f43450e..38bb43093148519ad6353b9fd4fd423267fa3ff5 100644
--- a/src/OpenFOAM/containers/Lists/UPtrList/UPtrListI.H
+++ b/src/OpenFOAM/containers/Lists/UPtrList/UPtrListI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -107,7 +107,9 @@ inline const T& Foam::UPtrList<T>::operator[](const label i) const
     if (!ptrs_[i])
     {
         FatalErrorIn("UPtrList::operator[] const")
-            << "hanging pointer, cannot dereference"
+            << "hanging pointer at index " << i
+            << " (size " << size()
+            << "), cannot dereference"
             << abort(FatalError);
     }
 
@@ -121,7 +123,9 @@ inline T& Foam::UPtrList<T>::operator[](const label i)
     if (!ptrs_[i])
     {
         FatalErrorIn("UPtrList::operator[]")
-            << "hanging pointer, cannot dereference"
+            << "hanging pointer at index " << i
+            << " (size " << size()
+            << "), cannot dereference"
             << abort(FatalError);
     }
 
diff --git a/src/OpenFOAM/db/IOobjectList/IOobjectList.C b/src/OpenFOAM/db/IOobjectList/IOobjectList.C
index 0a5fda9fdad5a02f898244550342e38531c9c6b2..128de963c74bc62c1430e67c031c2fc05b4c792a 100644
--- a/src/OpenFOAM/db/IOobjectList/IOobjectList.C
+++ b/src/OpenFOAM/db/IOobjectList/IOobjectList.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -148,6 +148,27 @@ Foam::IOobject* Foam::IOobjectList::lookup(const word& name) const
 }
 
 
+Foam::IOobjectList Foam::IOobjectList::lookupRe(const wordRe& name) const
+{
+    IOobjectList objectsOfName(size());
+
+    forAllConstIter(HashPtrTable<IOobject>, *this, iter)
+    {
+        if (name.match(iter()->name()))
+        {
+            if (IOobject::debug)
+            {
+                Info<< "IOobjectList::lookupRe : found " << iter.key() << endl;
+            }
+
+            objectsOfName.insert(iter.key(), new IOobject(*iter()));
+        }
+    }
+
+    return objectsOfName;
+}
+
+
 Foam::IOobjectList Foam::IOobjectList::lookupClass(const word& ClassName) const
 {
     IOobjectList objectsOfClass(size());
diff --git a/src/OpenFOAM/db/IOobjectList/IOobjectList.H b/src/OpenFOAM/db/IOobjectList/IOobjectList.H
index 3930b37045790649f094b173ea3b0478589ca434..945042b728aad9c34c7f188f85497e0d6b49cbe4 100644
--- a/src/OpenFOAM/db/IOobjectList/IOobjectList.H
+++ b/src/OpenFOAM/db/IOobjectList/IOobjectList.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -44,7 +44,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class IOobjectList Declaration
+                        Class IOobjectList Declaration
 \*---------------------------------------------------------------------------*/
 
 class IOobjectList
@@ -91,6 +91,9 @@ public:
         //- Lookup a given name and return IOobject ptr if found else NULL
         IOobject* lookup(const word& name) const;
 
+        //- Return the list for all IOobects whose name matches name
+        IOobjectList lookupRe(const wordRe& name) const;
+
         //- Return the list for all IOobjects of a given class
         IOobjectList lookupClass(const word& className) const;
 
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.H
index 9f39306ccce019c735a34c1a0d382816ce38e96e..c26e0d77e06e05503dddb06ba2bf699a52d8a2ca 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.H
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -92,7 +92,7 @@ public:
 
             //- Gather data. Apply bop to combine Value
             //  from different processors
-            template <class T, class BinaryOp>
+            template<class T, class BinaryOp>
             static void gather
             (
                 const List<commsStruct>& comms,
@@ -102,7 +102,7 @@ public:
             );
 
             //- Like above but switches between linear/tree communication
-            template <class T, class BinaryOp>
+            template<class T, class BinaryOp>
             static void gather
             (
                 T& Value,
@@ -111,7 +111,7 @@ public:
             );
 
             //- Scatter data. Distribute without modification. Reverse of gather
-            template <class T>
+            template<class T>
             static void scatter
             (
                 const List<commsStruct>& comms,
@@ -120,14 +120,14 @@ public:
             );
 
             //- Like above but switches between linear/tree communication
-            template <class T>
+            template<class T>
             static void scatter(T& Value, const int tag = Pstream::msgType());
 
 
         // Combine variants. Inplace combine values from processors.
         // (Uses construct from Istream instead of <<)
 
-            template <class T, class CombineOp>
+            template<class T, class CombineOp>
             static void combineGather
             (
                 const List<commsStruct>& comms,
@@ -137,7 +137,7 @@ public:
             );
 
             //- Like above but switches between linear/tree communication
-            template <class T, class CombineOp>
+            template<class T, class CombineOp>
             static void combineGather
             (
                 T& Value,
@@ -146,7 +146,7 @@ public:
             );
 
             //- Scatter data. Reverse of combineGather
-            template <class T>
+            template<class T>
             static void combineScatter
             (
                 const List<commsStruct>& comms,
@@ -155,7 +155,7 @@ public:
             );
 
             //- Like above but switches between linear/tree communication
-            template <class T>
+            template<class T>
             static void combineScatter
             (
                 T& Value,
@@ -164,7 +164,7 @@ public:
 
         // Combine variants working on whole List at a time.
 
-            template <class T, class CombineOp>
+            template<class T, class CombineOp>
             static void listCombineGather
             (
                 const List<commsStruct>& comms,
@@ -174,7 +174,7 @@ public:
             );
 
             //- Like above but switches between linear/tree communication
-            template <class T, class CombineOp>
+            template<class T, class CombineOp>
             static void listCombineGather
             (
                 List<T>& Value,
@@ -183,7 +183,7 @@ public:
             );
 
             //- Scatter data. Reverse of combineGather
-            template <class T>
+            template<class T>
             static void listCombineScatter
             (
                 const List<commsStruct>& comms,
@@ -192,7 +192,7 @@ public:
             );
 
             //- Like above but switches between linear/tree communication
-            template <class T>
+            template<class T>
             static void listCombineScatter
             (
                 List<T>& Value,
@@ -202,7 +202,7 @@ public:
         // Combine variants working on whole map at a time. Container needs to
         // have iterators and find() defined.
 
-            template <class Container, class CombineOp>
+            template<class Container, class CombineOp>
             static void mapCombineGather
             (
                 const List<commsStruct>& comms,
@@ -212,7 +212,7 @@ public:
             );
 
             //- Like above but switches between linear/tree communication
-            template <class Container, class CombineOp>
+            template<class Container, class CombineOp>
             static void mapCombineGather
             (
                 Container& Values,
@@ -221,7 +221,7 @@ public:
             );
 
             //- Scatter data. Reverse of combineGather
-            template <class Container>
+            template<class Container>
             static void mapCombineScatter
             (
                 const List<commsStruct>& comms,
@@ -230,7 +230,7 @@ public:
             );
 
             //- Like above but switches between linear/tree communication
-            template <class Container>
+            template<class Container>
             static void mapCombineScatter
             (
                 Container& Values,
@@ -244,7 +244,7 @@ public:
         // Values[UPstream::myProcNo()] is the data for the current processor.
 
             //- Gather data but keep individual values separate
-            template <class T>
+            template<class T>
             static void gatherList
             (
                 const List<commsStruct>& comms,
@@ -253,7 +253,7 @@ public:
             );
 
             //- Like above but switches between linear/tree communication
-            template <class T>
+            template<class T>
             static void gatherList
             (
                 List<T>& Values,
@@ -261,7 +261,7 @@ public:
             );
 
             //- Scatter data. Reverse of gatherList
-            template <class T>
+            template<class T>
             static void scatterList
             (
                 const List<commsStruct>& comms,
@@ -270,7 +270,7 @@ public:
             );
 
             //- Like above but switches between linear/tree communication
-            template <class T>
+            template<class T>
             static void scatterList
             (
                 List<T>& Values,
@@ -284,7 +284,7 @@ public:
             //  sizes (not bytes). sizes[p0][p1] is what processor p0 has
             //  sent to p1. Continuous data only.
             //  If block=true will wait for all transfers to finish.
-            template <class Container, class T>
+            template<class Container, class T>
             static void exchange
             (
                 const List<Container >&,
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamCombineReduceOps.H b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamCombineReduceOps.H
index c657e0a140fcc8d19c5978f85b9184d8d252cf61..952ca399bda7e42025d0010623bc536906691a20 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamCombineReduceOps.H
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamCombineReduceOps.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -47,7 +47,7 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-template <class T, class CombineOp>
+template<class T, class CombineOp>
 void combineReduce
 (
     const List<UPstream::commsStruct>& comms,
@@ -61,7 +61,7 @@ void combineReduce
 }
 
 
-template <class T, class CombineOp>
+template<class T, class CombineOp>
 void combineReduce
 (
     T& Value,
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamReduceOps.H b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamReduceOps.H
index 47c7c51acdd658e3fb223b2035dfd5b98ca68ae0..68269754ff07ac7cfe37c139edcefe6f69000016 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamReduceOps.H
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamReduceOps.H
@@ -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
@@ -38,7 +38,7 @@ namespace Foam
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 // Reduce operation with user specified communication schedule
-template <class T, class BinaryOp>
+template<class T, class BinaryOp>
 void reduce
 (
     const List<UPstream::commsStruct>& comms,
@@ -53,7 +53,7 @@ void reduce
 
 
 // Reduce using either linear or tree communication schedule
-template <class T, class BinaryOp>
+template<class T, class BinaryOp>
 void reduce
 (
     T& Value,
@@ -73,7 +73,7 @@ void reduce
 
 
 // Reduce using either linear or tree communication schedule
-template <class T, class BinaryOp>
+template<class T, class BinaryOp>
 T returnReduce
 (
     const T& Value,
@@ -97,7 +97,7 @@ T returnReduce
 
 
 // Reduce with sum of both value and count (for averaging)
-template <class T>
+template<class T>
 void sumReduce
 (
     T& Value,
@@ -111,7 +111,7 @@ void sumReduce
 
 
 // Non-blocking version of reduce. Sets request.
-template <class T, class BinaryOp>
+template<class T, class BinaryOp>
 void reduce
 (
     T& Value,
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C
index 2167d15b6defd06cdbb936c7cefe3b8630b47fe5..ebf293d70830930679c35bac5a45eb30beeece4f 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.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
@@ -172,6 +172,13 @@ Foam::Istream& Foam::UIPstream::read(token& t)
             t.type() = token::VERBATIMSTRING;
             return *this;
         }
+        case token::VARIABLE :
+        {
+            // Recurse to read actual string
+            read(t);
+            t.type() = token::VARIABLE;
+            return *this;
+        }
         case token::STRING :
         {
             string* pval = new string;
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C
index e01e8de01bdbb307cb560570e8a64062c10f32d8..4e21d6c82c4f128542390e73ee78463c5d36206c 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.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
@@ -159,6 +159,11 @@ Foam::Ostream& Foam::UOPstream::write(const token& t)
         write(char(token::VERBATIMSTRING));
         write(t.stringToken());
     }
+    else if (t.type() == token::VARIABLE)
+    {
+        write(char(token::VARIABLE));
+        write(t.stringToken());
+    }
     else
     {
         notImplemented("Ostream& UOPstream::write(const token&)");
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C
index 9cc6d9d6f5de5deef4f24e41cee80db0d8b043d0..c708f9cd2b95ec4f71986828d454762006dd08b0 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H
index 1ad4aa99ccc9e9b09c1798ca4e24f780e6012971..572a524afcf513aedb40b0758c97b43d08a00cb7 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/combineGatherScatter.C b/src/OpenFOAM/db/IOstreams/Pstreams/combineGatherScatter.C
index fbe246f1eafecad46d51253f64e949c3aad52e63..3152cd242abe2f859d7d7865fda29e8527ea7dcd 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/combineGatherScatter.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/combineGatherScatter.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -45,7 +45,7 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class T, class CombineOp>
+template<class T, class CombineOp>
 void Pstream::combineGather
 (
     const List<UPstream::commsStruct>& comms,
@@ -129,7 +129,7 @@ void Pstream::combineGather
 }
 
 
-template <class T, class CombineOp>
+template<class T, class CombineOp>
 void Pstream::combineGather(T& Value, const CombineOp& cop, const int tag)
 {
     if (UPstream::nProcs() < UPstream::nProcsSimpleSum)
@@ -143,7 +143,7 @@ void Pstream::combineGather(T& Value, const CombineOp& cop, const int tag)
 }
 
 
-template <class T>
+template<class T>
 void Pstream::combineScatter
 (
     const List<UPstream::commsStruct>& comms,
@@ -214,7 +214,7 @@ void Pstream::combineScatter
 }
 
 
-template <class T>
+template<class T>
 void Pstream::combineScatter(T& Value, const int tag)
 {
     if (UPstream::nProcs() < UPstream::nProcsSimpleSum)
@@ -232,7 +232,7 @@ void Pstream::combineScatter(T& Value, const int tag)
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
-template <class T, class CombineOp>
+template<class T, class CombineOp>
 void Pstream::listCombineGather
 (
     const List<UPstream::commsStruct>& comms,
@@ -323,7 +323,7 @@ void Pstream::listCombineGather
 }
 
 
-template <class T, class CombineOp>
+template<class T, class CombineOp>
 void Pstream::listCombineGather
 (
     List<T>& Values,
@@ -342,7 +342,7 @@ void Pstream::listCombineGather
 }
 
 
-template <class T>
+template<class T>
 void Pstream::listCombineScatter
 (
     const List<UPstream::commsStruct>& comms,
@@ -413,7 +413,7 @@ void Pstream::listCombineScatter
 }
 
 
-template <class T>
+template<class T>
 void Pstream::listCombineScatter(List<T>& Values, const int tag)
 {
     if (UPstream::nProcs() < UPstream::nProcsSimpleSum)
@@ -433,7 +433,7 @@ void Pstream::listCombineScatter(List<T>& Values, const int tag)
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
-template <class Container, class CombineOp>
+template<class Container, class CombineOp>
 void Pstream::mapCombineGather
 (
     const List<UPstream::commsStruct>& comms,
@@ -499,7 +499,7 @@ void Pstream::mapCombineGather
 }
 
 
-template <class Container, class CombineOp>
+template<class Container, class CombineOp>
 void Pstream::mapCombineGather
 (
     Container& Values,
@@ -518,7 +518,7 @@ void Pstream::mapCombineGather
 }
 
 
-template <class Container>
+template<class Container>
 void Pstream::mapCombineScatter
 (
     const List<UPstream::commsStruct>& comms,
@@ -561,7 +561,7 @@ void Pstream::mapCombineScatter
 }
 
 
-template <class Container>
+template<class Container>
 void Pstream::mapCombineScatter(Container& Values, const int tag)
 {
     if (UPstream::nProcs() < UPstream::nProcsSimpleSum)
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/exchange.C b/src/OpenFOAM/db/IOstreams/Pstreams/exchange.C
index 48c166935a12b25f90c05148fadefbd5bd47e009..8c0cb4bbedc77c6e6a37fbcdfd5fe995e4523836 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/exchange.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/exchange.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -38,8 +38,8 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-//template <template<class> class ListType, class T>
-template <class Container, class T>
+//template<template<class> class ListType, class T>
+template<class Container, class T>
 void Pstream::exchange
 (
     const List<Container>& sendBufs,
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/gatherScatter.C b/src/OpenFOAM/db/IOstreams/Pstreams/gatherScatter.C
index 7065383d38c32e65c7cf9b6176e38fb125896609..33c7581f76070a8052e6ed5edf2083230b9388c3 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/gatherScatter.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/gatherScatter.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -42,7 +42,7 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class T, class BinaryOp>
+template<class T, class BinaryOp>
 void Pstream::gather
 (
     const List<UPstream::commsStruct>& comms,
@@ -111,7 +111,7 @@ void Pstream::gather
 }
 
 
-template <class T, class BinaryOp>
+template<class T, class BinaryOp>
 void Pstream::gather(T& Value, const BinaryOp& bop, const int tag)
 {
     if (UPstream::nProcs() < UPstream::nProcsSimpleSum)
@@ -125,7 +125,7 @@ void Pstream::gather(T& Value, const BinaryOp& bop, const int tag)
 }
 
 
-template <class T>
+template<class T>
 void Pstream::scatter
 (
     const List<UPstream::commsStruct>& comms,
@@ -189,7 +189,7 @@ void Pstream::scatter
 }
 
 
-template <class T>
+template<class T>
 void Pstream::scatter(T& Value, const int tag)
 {
     if (UPstream::nProcs() < UPstream::nProcsSimpleSum)
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/gatherScatterList.C b/src/OpenFOAM/db/IOstreams/Pstreams/gatherScatterList.C
index b309ea7932106b4d52190f9265eeb28adacccb50..4e39bafda937ddc2f154d7e141cbfaca877ae306 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/gatherScatterList.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/gatherScatterList.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -44,7 +44,7 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class T>
+template<class T>
 void Pstream::gatherList
 (
     const List<UPstream::commsStruct>& comms,
@@ -179,7 +179,7 @@ void Pstream::gatherList
 }
 
 
-template <class T>
+template<class T>
 void Pstream::gatherList(List<T>& Values, const int tag)
 {
     if (UPstream::nProcs() < UPstream::nProcsSimpleSum)
@@ -193,7 +193,7 @@ void Pstream::gatherList(List<T>& Values, const int tag)
 }
 
 
-template <class T>
+template<class T>
 void Pstream::scatterList
 (
     const List<UPstream::commsStruct>& comms,
@@ -307,7 +307,7 @@ void Pstream::scatterList
 }
 
 
-template <class T>
+template<class T>
 void Pstream::scatterList(List<T>& Values, const int tag)
 {
     if (UPstream::nProcs() < UPstream::nProcsSimpleSum)
diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C
index 4cbf8bf1fa98563fbae17ff2b72f75add6564237..90f77a4802a33decf4508862c0dd921fb5030589 100644
--- a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C
+++ b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.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
@@ -39,6 +39,10 @@ Foam::Ostream& Foam::OSstream::write(const token& t)
         write(char(token::HASH));
         write(char(token::END_BLOCK));
     }
+    else if (t.type() == token::VARIABLE)
+    {
+        writeQuoted( t.stringToken(), false);
+    }
     return *this;
 }
 
diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C b/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C
index 7ca977bf978562fe0cf2c843cac473149be199ac..a1b80fe57bfd47b76b11aa00f8388dd46d6cc06f 100644
--- a/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C
+++ b/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.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
@@ -75,6 +75,10 @@ Foam::Ostream& Foam::prefixOSstream::write(const token& t)
         write(char(token::HASH));
         write(char(token::END_BLOCK));
     }
+    else if (t.type() == token::VARIABLE)
+    {
+        writeQuoted(t.stringToken(), false);
+    }
     return *this;
 }
 
diff --git a/src/OpenFOAM/db/IOstreams/token/tokenIO.C b/src/OpenFOAM/db/IOstreams/token/tokenIO.C
index b513a4be0eda7d991b10f538ae11499ced859134..f45386d8a6e0f2684603334ce7f830a4b2cec7f6 100644
--- a/src/OpenFOAM/db/IOstreams/token/tokenIO.C
+++ b/src/OpenFOAM/db/IOstreams/token/tokenIO.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
@@ -75,8 +75,8 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const token& t)
         break;
 
         case token::VARIABLE:
-            // Write variable as word so without ""
-            os.writeQuoted(*t.stringTokenPtr_, false);
+            // Behaviour differs according to stream type
+            os.write(t);
         break;
 
         case token::LABEL:
diff --git a/src/OpenFOAM/db/dictionary/entry/entryIO.C b/src/OpenFOAM/db/dictionary/entry/entryIO.C
index bc0ffb9c09bbb0cc068072180ee72282bac25b1a..9dd60fdebf204ab548b265ca646bd950f85b44a0 100644
--- a/src/OpenFOAM/db/dictionary/entry/entryIO.C
+++ b/src/OpenFOAM/db/dictionary/entry/entryIO.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
@@ -30,6 +30,8 @@ License
 #include "inputModeEntry.H"
 #include "stringOps.H"
 
+#include "IOstreams.H"
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 bool Foam::entry::getKeyword(keyType& keyword, Istream& is)
@@ -114,6 +116,9 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is)
          && keyword[0] == '$'
         )                           // ... Substitution entry
         {
+            token nextToken(is);
+            is.putBack(nextToken);
+
             if (keyword.size() > 2 && keyword[1] == token::BEGIN_BLOCK)
             {
                 // Recursive substitution mode. Replace between {} with
@@ -125,7 +130,48 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is)
                 stringOps::inplaceExpand(s, parentDict, true, false);
                 keyword.std::string::replace(1, keyword.size()-1, s);
             }
-            parentDict.substituteScopedKeyword(keyword);
+
+            if (nextToken == token::BEGIN_BLOCK)
+            {
+                word varName = keyword(1, keyword.size()-1);
+
+                // lookup the variable name in the given dictionary
+                const entry* ePtr = parentDict.lookupScopedEntryPtr
+                (
+                    varName,
+                    true,
+                    true
+                );
+
+                if (ePtr)
+                {
+                    // Read as primitiveEntry
+                    const word newKeyword(ePtr->stream());
+
+                    return parentDict.add
+                    (
+                        new dictionaryEntry(newKeyword, parentDict, is),
+                        false
+                    );
+                }
+                else
+                {
+                    FatalIOErrorIn
+                    (
+                        "entry::New(const dictionary& parentDict, Istream&)",
+                        is
+                    )
+                        << "Attempt to use undefined variable " << varName
+                        << " as keyword"
+                        << exit(FatalIOError);
+                    return false;
+                }
+            }
+            else
+            {
+                parentDict.substituteScopedKeyword(keyword);
+            }
+
             return true;
         }
         else if
diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C
index ffad0cc4e6b2e39f7ef494c79ff22aec139fee9a..002e4fab5b2866552592314cad524d8d98bbf509 100644
--- a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C
+++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -26,6 +26,7 @@ License
 #include "functionObjectFile.H"
 #include "Time.H"
 #include "polyMesh.H"
+#include "IFstream.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -84,7 +85,16 @@ void Foam::functionObjectFile::createFiles()
 
                 mkDir(outputDir);
 
-                filePtrs_.set(i, new OFstream(outputDir/(iter.key() + ".dat")));
+                word fName(iter.key());
+
+                // check if file already exists
+                IFstream is(outputDir/(fName + ".dat"));
+                if (is.good())
+                {
+                    fName = fName + "_" + obr_.time().timeName();
+                }
+
+                filePtrs_.set(i, new OFstream(outputDir/(fName + ".dat")));
 
                 writeFileHeader(i);
             }
diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.H b/src/OpenFOAM/db/objectRegistry/objectRegistry.H
index 84b295c4d749ea20ebda9451948e47e87e33525b..535dffe3bddbebbf9df59abfbbb2cb9e5945a4dc 100644
--- a/src/OpenFOAM/db/objectRegistry/objectRegistry.H
+++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.H
@@ -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
@@ -159,6 +159,14 @@ public:
             template<class Type>
             HashTable<const Type*> lookupClass(const bool strict = false) const;
 
+            //- Lookup and return all objects of the given Type
+            template<class Type>
+            HashTable<Type*> lookupClass(const bool strict = false);
+
+            //- Return the list of objects whose name matches the input regExp
+            template<class Type>
+            wordList foundObjectRe(const wordRe& name) const;
+
             //- Is the named Type found?
             template<class Type>
             bool foundObject(const word& name) const;
diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C
index 960605e049da4f9560f398d7270b6128d790963d..1b3e9ef701375a8e59a20d9c93998a3659752b64 100644
--- a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C
+++ b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.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
@@ -76,6 +76,34 @@ Foam::HashTable<const Type*> Foam::objectRegistry::lookupClass
 }
 
 
+template<class Type>
+Foam::HashTable<Type*> Foam::objectRegistry::lookupClass
+(
+    const bool strict
+)
+{
+    HashTable<Type*> objectsOfClass(size());
+
+    forAllIter(HashTable<regIOobject*>, *this, iter)
+    {
+        if
+        (
+            (strict && isType<Type>(*iter()))
+         || (!strict && isA<Type>(*iter()))
+        )
+        {
+            objectsOfClass.insert
+            (
+                iter()->name(),
+                dynamic_cast<Type*>(iter())
+            );
+        }
+    }
+
+    return objectsOfClass;
+}
+
+
 template<class Type>
 bool Foam::objectRegistry::foundObject(const word& name) const
 {
@@ -99,6 +127,31 @@ bool Foam::objectRegistry::foundObject(const word& name) const
 }
 
 
+template<class Type>
+Foam::wordList Foam::objectRegistry::foundObjectRe(const wordRe& name) const
+{
+    wordList objectNames(size());
+
+    label count = 0;
+    forAllConstIter(HashTable<regIOobject*>, *this, iter)
+    {
+        if (isA<Type>(*iter()))
+        {
+            const word& objectName = iter()->name();
+
+            if (name.match(objectName))
+            {
+                objectNames[count++] = objectName;
+            }
+        }
+    }
+
+    objectNames.setSize(count);
+
+    return objectNames;
+}
+
+
 template<class Type>
 const Type& Foam::objectRegistry::lookupObject(const word& name) const
 {
diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedSphericalTensor/dimensionedSphericalTensor.C b/src/OpenFOAM/dimensionedTypes/dimensionedSphericalTensor/dimensionedSphericalTensor.C
index c79a9ecc1e2db14512967cf0eeea22205d4b1c0a..0fb7de0ae9d1d8d2409b9ea7172e5f0dae681d0b 100644
--- a/src/OpenFOAM/dimensionedTypes/dimensionedSphericalTensor/dimensionedSphericalTensor.C
+++ b/src/OpenFOAM/dimensionedTypes/dimensionedSphericalTensor/dimensionedSphericalTensor.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -20,7 +20,6 @@ License
 
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
-    Dimensioned sphericalTensor obtained from generic dimensioned type.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedSymmTensor/dimensionedSymmTensor.C b/src/OpenFOAM/dimensionedTypes/dimensionedSymmTensor/dimensionedSymmTensor.C
index b9dff9779935184208e4e4b8c219a82f11661913..f60976510cb4942ba284b19f65c5ce385834b7a9 100644
--- a/src/OpenFOAM/dimensionedTypes/dimensionedSymmTensor/dimensionedSymmTensor.C
+++ b/src/OpenFOAM/dimensionedTypes/dimensionedSymmTensor/dimensionedSymmTensor.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -20,7 +20,6 @@ License
 
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
-    Dimensioned tensor obtained from generic dimensioned type.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedTensor/dimensionedTensor.C b/src/OpenFOAM/dimensionedTypes/dimensionedTensor/dimensionedTensor.C
index d3437d7171fd055e3bc62294bc02d1ef68344703..8c56ef7aaa5ada9270d60684051370d16dd3fabb 100644
--- a/src/OpenFOAM/dimensionedTypes/dimensionedTensor/dimensionedTensor.C
+++ b/src/OpenFOAM/dimensionedTypes/dimensionedTensor/dimensionedTensor.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -20,7 +20,6 @@ License
 
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
-    Dimensioned tensor obtained from generic dimensioned type.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C
index 73fea9fdd2c0b9cc4ce12b62223482cbfdc5c36b..b78fbed97a7d30f33d9a090006df708d66cd769a 100644
--- a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C
+++ b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.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
@@ -34,7 +34,7 @@ namespace Foam
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 dimensioned<Type> dimensioned<Type>::lookupOrDefault
 (
     const word& name,
@@ -48,7 +48,7 @@ dimensioned<Type> dimensioned<Type>::lookupOrDefault
 }
 
 
-template <class Type>
+template<class Type>
 dimensioned<Type> dimensioned<Type>::lookupOrAddToDict
 (
     const word& name,
@@ -64,7 +64,7 @@ dimensioned<Type> dimensioned<Type>::lookupOrAddToDict
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 dimensioned<Type>::dimensioned
 (
     const word& name,
@@ -78,7 +78,7 @@ dimensioned<Type>::dimensioned
 {}
 
 
-template <class Type>
+template<class Type>
 dimensioned<Type>::dimensioned
 (
     const word& name,
@@ -91,7 +91,7 @@ dimensioned<Type>::dimensioned
 {}
 
 
-template <class Type>
+template<class Type>
 dimensioned<Type>::dimensioned
 (
     Istream& is
@@ -103,7 +103,7 @@ dimensioned<Type>::dimensioned
 }
 
 
-template <class Type>
+template<class Type>
 dimensioned<Type>::dimensioned
 (
     const word& name,
@@ -120,7 +120,7 @@ dimensioned<Type>::dimensioned
 }
 
 
-template <class Type>
+template<class Type>
 dimensioned<Type>::dimensioned
 (
     const word& name,
@@ -171,7 +171,7 @@ dimensioned<Type>::dimensioned
 }
 
 
-template <class Type>
+template<class Type>
 dimensioned<Type>::dimensioned
 ()
 :
@@ -183,46 +183,46 @@ dimensioned<Type>::dimensioned
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 const word& dimensioned<Type>::name() const
 {
     return name_;
 }
 
-template <class Type>
+template<class Type>
 word& dimensioned<Type>::name()
 {
     return name_;
 }
 
 
-template <class Type>
+template<class Type>
 const dimensionSet& dimensioned<Type>::dimensions() const
 {
     return dimensions_;
 }
 
-template <class Type>
+template<class Type>
 dimensionSet& dimensioned<Type>::dimensions()
 {
     return dimensions_;
 }
 
 
-template <class Type>
+template<class Type>
 const Type& dimensioned<Type>::value() const
 {
     return value_;
 }
 
-template <class Type>
+template<class Type>
 Type& dimensioned<Type>::value()
 {
     return value_;
 }
 
 
-template <class Type>
+template<class Type>
 dimensioned<typename dimensioned<Type>::cmptType> dimensioned<Type>::component
 (
     const direction d
@@ -237,7 +237,7 @@ dimensioned<typename dimensioned<Type>::cmptType> dimensioned<Type>::component
 }
 
 
-template <class Type>
+template<class Type>
 void dimensioned<Type>::replace
 (
     const direction d,
@@ -249,14 +249,14 @@ void dimensioned<Type>::replace
 }
 
 
-template <class Type>
+template<class Type>
 bool dimensioned<Type>::readIfPresent(const dictionary& dict)
 {
     return dict.readIfPresent(name_, value_);
 }
 
 
-template <class Type>
+template<class Type>
 Foam::Istream& dimensioned<Type>::read(Istream& is, const dictionary& readSet)
 {
     // Read name
@@ -280,7 +280,7 @@ Foam::Istream& dimensioned<Type>::read(Istream& is, const dictionary& readSet)
 }
 
 
-template <class Type>
+template<class Type>
 Foam::Istream& dimensioned<Type>::read
 (
     Istream& is,
@@ -309,7 +309,7 @@ Foam::Istream& dimensioned<Type>::read
 }
 
 
-template <class Type>
+template<class Type>
 Foam::Istream& dimensioned<Type>::read(Istream& is)
 {
     // Read name
@@ -335,7 +335,7 @@ Foam::Istream& dimensioned<Type>::read(Istream& is)
 
 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 dimensioned<typename dimensioned<Type>::cmptType> dimensioned<Type>::operator[]
 (
     const direction d
@@ -345,7 +345,7 @@ dimensioned<typename dimensioned<Type>::cmptType> dimensioned<Type>::operator[]
 }
 
 
-template <class Type>
+template<class Type>
 void dimensioned<Type>::operator+=
 (
     const dimensioned<Type>& dt
@@ -356,7 +356,7 @@ void dimensioned<Type>::operator+=
 }
 
 
-template <class Type>
+template<class Type>
 void dimensioned<Type>::operator-=
 (
     const dimensioned<Type>& dt
@@ -367,7 +367,7 @@ void dimensioned<Type>::operator-=
 }
 
 
-template <class Type>
+template<class Type>
 void dimensioned<Type>::operator*=
 (
     const scalar s
@@ -377,7 +377,7 @@ void dimensioned<Type>::operator*=
 }
 
 
-template <class Type>
+template<class Type>
 void dimensioned<Type>::operator/=
 (
     const scalar s
@@ -436,7 +436,7 @@ dimensioned<scalar> mag(const dimensioned<Type>& dt)
 }
 
 
-template <class Type>
+template<class Type>
 dimensioned<Type> max
 (
     const dimensioned<Type>& dt1,
@@ -459,7 +459,7 @@ dimensioned<Type> max
 }
 
 
-template <class Type>
+template<class Type>
 dimensioned<Type> min
 (
     const dimensioned<Type>& dt1,
@@ -484,7 +484,7 @@ dimensioned<Type> min
 
 // * * * * * * * * * * * * * * * IOstream Operators  * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Istream& operator>>(Istream& is, dimensioned<Type>& dt)
 {
     token nextToken(is);
@@ -517,7 +517,7 @@ Istream& operator>>(Istream& is, dimensioned<Type>& dt)
 }
 
 
-template <class Type>
+template<class Type>
 Ostream& operator<<(Ostream& os, const dimensioned<Type>& dt)
 {
     // Write the name
@@ -541,7 +541,7 @@ Ostream& operator<<(Ostream& os, const dimensioned<Type>& dt)
 
 // * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 bool operator>
 (
     const dimensioned<Type>& dt1,
@@ -552,7 +552,7 @@ bool operator>
 }
 
 
-template <class Type>
+template<class Type>
 bool operator<
 (
     const dimensioned<Type>& dt1,
@@ -563,7 +563,7 @@ bool operator<
 }
 
 
-template <class Type>
+template<class Type>
 dimensioned<Type> operator+
 (
     const dimensioned<Type>& dt1,
@@ -579,7 +579,7 @@ dimensioned<Type> operator+
 }
 
 
-template <class Type>
+template<class Type>
 dimensioned<Type> operator-(const dimensioned<Type>& dt)
 {
     return dimensioned<Type>
@@ -591,7 +591,7 @@ dimensioned<Type> operator-(const dimensioned<Type>& dt)
 }
 
 
-template <class Type>
+template<class Type>
 dimensioned<Type> operator-
 (
     const dimensioned<Type>& dt1,
@@ -607,7 +607,7 @@ dimensioned<Type> operator-
 }
 
 
-template <class Type>
+template<class Type>
 dimensioned<Type> operator*
 (
     const dimensioned<scalar>& ds,
@@ -623,7 +623,7 @@ dimensioned<Type> operator*
 }
 
 
-template <class Type>
+template<class Type>
 dimensioned<Type> operator/
 (
     const dimensioned<Type>& dt,
diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H
index 8f5108df0b12137b5db35d8450111d80193c5d3a..1c4a5c0d3c86a81612f8b8282085d3fc952f469e 100644
--- a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H
+++ b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H
@@ -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
@@ -61,7 +61,7 @@ class dictionary;
                            Class dimensioned Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class Type>
+template<class Type>
 class dimensioned
 {
     // private data
diff --git a/src/OpenFOAM/fields/Fields/transformList/transformList.C b/src/OpenFOAM/fields/Fields/transformList/transformList.C
index af3c93d516a1500b75f39a16a0877d24499a4e70..f962d68990b60f417de2271f8ca4d57107da516a 100644
--- a/src/OpenFOAM/fields/Fields/transformList/transformList.C
+++ b/src/OpenFOAM/fields/Fields/transformList/transformList.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-template <class T>
+template<class T>
 Foam::List<T> Foam::transform
 (
     const tensor& rotTensor,
@@ -45,7 +45,7 @@ Foam::List<T> Foam::transform
 }
 
 
-template <class T>
+template<class T>
 void Foam::transformList(const tensor& rotTensor, UList<T>& field)
 {
     forAll(field, i)
@@ -55,7 +55,7 @@ void Foam::transformList(const tensor& rotTensor, UList<T>& field)
 }
 
 
-template <class T>
+template<class T>
 void Foam::transformList(const tensorField& rotTensor, UList<T>& field)
 {
     if (rotTensor.size() == 1)
@@ -84,7 +84,7 @@ void Foam::transformList(const tensorField& rotTensor, UList<T>& field)
 }
 
 
-template <class T>
+template<class T>
 void Foam::transformList(const tensor& rotTensor, Map<T>& field)
 {
     forAllIter(typename Map<T>, field, iter)
@@ -94,7 +94,7 @@ void Foam::transformList(const tensor& rotTensor, Map<T>& field)
 }
 
 
-template <class T>
+template<class T>
 void Foam::transformList(const tensorField& rotTensor, Map<T>& field)
 {
     if (rotTensor.size() == 1)
@@ -116,7 +116,7 @@ void Foam::transformList(const tensorField& rotTensor, Map<T>& field)
 }
 
 
-template <class T>
+template<class T>
 void Foam::transformList(const tensor& rotTensor, EdgeMap<T>& field)
 {
     forAllIter(typename EdgeMap<T>, field, iter)
@@ -126,7 +126,7 @@ void Foam::transformList(const tensor& rotTensor, EdgeMap<T>& field)
 }
 
 
-template <class T>
+template<class T>
 void Foam::transformList(const tensorField& rotTensor, EdgeMap<T>& field)
 {
     if (rotTensor.size() == 1)
diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C
index 2b8216956161bb4aad0998c80d3b16c4c21cb634..b3eb2a9e1f35ef3743cff74944a185dfeecac40d 100644
--- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C
+++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.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
@@ -146,7 +146,8 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::readOldTimeIfPresent()
         this->time().timeName(),
         this->db(),
         IOobject::READ_IF_PRESENT,
-        IOobject::AUTO_WRITE
+        IOobject::AUTO_WRITE,
+        this->registerObject()
     );
 
     if (field0.headerOk())
@@ -761,7 +762,10 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::oldTime() const
             (
                 this->name() + "_0",
                 this->time().timeName(),
-                this->db()
+                this->db(),
+                IOobject::NO_READ,
+                IOobject::NO_WRITE,
+                this->registerObject()
             ),
             *this
         );
diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C
index c3d68e28374dcb65032f72bf0befa9bcb8cdcb25..8a647b6db0392dbfa6e450781600ce2cbc209fce 100644
--- a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C
+++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -24,7 +24,6 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "processorPointPatchField.H"
-//#include "transformField.H"
 #include "processorPolyPatch.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -92,73 +91,6 @@ processorPointPatchField<Type>::~processorPointPatchField()
 {}
 
 
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-template<class Type>
-void processorPointPatchField<Type>::initSwapAddSeparated
-(
-    const Pstream::commsTypes commsType,
-    Field<Type>& pField
-)
-const
-{
-//    if (Pstream::parRun())
-//    {
-//        // Get internal field into correct order for opposite side
-//        Field<Type> pf
-//        (
-//            this->patchInternalField
-//            (
-//                pField,
-//                procPatch_.reverseMeshPoints()
-//            )
-//        );
-//
-//        OPstream::write
-//        (
-//            commsType,
-//            procPatch_.neighbProcNo(),
-//            reinterpret_cast<const char*>(pf.begin()),
-//            pf.byteSize(),
-//            procPatch_.tag()
-//        );
-//    }
-}
-
-
-template<class Type>
-void processorPointPatchField<Type>::swapAddSeparated
-(
-    const Pstream::commsTypes commsType,
-    Field<Type>& pField
-) const
-{
-//    if (Pstream::parRun())
-//    {
-//        Field<Type> pnf(this->size());
-//
-//        IPstream::read
-//        (
-//            commsType,
-//            procPatch_.neighbProcNo(),
-//            reinterpret_cast<char*>(pnf.begin()),
-//            pnf.byteSize(),
-//            procPatch_.tag()
-//        );
-//
-//        if (doTransform())
-//        {
-//            const processorPolyPatch& ppp = procPatch_.procPolyPatch();
-//            const tensor& forwardT = ppp.forwardT();
-//
-//            transform(pnf, forwardT, pnf);
-//        }
-//
-//        addToInternalField(pField, pnf, procPatch_.separatedPoints());
-//    }
-}
-
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 } // End namespace Foam
diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H
index 6582b62861afe20db4a12ccc3723de4c032370a2..5dfceda2d118ee6195f58f816a4affb2ed292144 100644
--- a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H
+++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -57,7 +57,6 @@ class processorPointPatchField
         //- Local reference to processor patch
         const processorPointPatch& procPatch_;
 
-
 public:
 
     //- Runtime type information
@@ -176,19 +175,13 @@ public:
             )
             {}
 
-            //- Initialise swap of non-collocated patch point values
-            virtual void initSwapAddSeparated
-            (
-                const Pstream::commsTypes commsType,
-                Field<Type>&
-            ) const;
-
-            //- Complete swap of patch point values and add to local values
+            //- Assume processor patch always collocated
             virtual void swapAddSeparated
             (
                 const Pstream::commsTypes commsType,
                 Field<Type>&
-            ) const;
+            ) const
+            {}
 };
 
 
diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C
index 4e28c3466df64c53627cb2d7a6a14e51e387fe7a..6bea99a1bc998c4598358bb620f4b3c87b9e66c9 100644
--- a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C
+++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -38,7 +38,8 @@ Foam::processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
 )
 :
     coupledPointPatchField<Type>(p, iF),
-    procPatch_(refCast<const processorCyclicPointPatch>(p))
+    procPatch_(refCast<const processorCyclicPointPatch>(p)),
+    receiveBuf_(0)
 {}
 
 
@@ -51,7 +52,8 @@ Foam::processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
 )
 :
     coupledPointPatchField<Type>(p, iF, dict),
-    procPatch_(refCast<const processorCyclicPointPatch>(p))
+    procPatch_(refCast<const processorCyclicPointPatch>(p)),
+    receiveBuf_(0)
 {}
 
 
@@ -65,7 +67,8 @@ Foam::processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
 )
 :
     coupledPointPatchField<Type>(ptf, p, iF, mapper),
-    procPatch_(refCast<const processorCyclicPointPatch>(ptf.patch()))
+    procPatch_(refCast<const processorCyclicPointPatch>(ptf.patch())),
+    receiveBuf_(0)
 {}
 
 
@@ -77,7 +80,8 @@ Foam::processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
 )
 :
     coupledPointPatchField<Type>(ptf, iF),
-    procPatch_(refCast<const processorCyclicPointPatch>(ptf.patch()))
+    procPatch_(refCast<const processorCyclicPointPatch>(ptf.patch())),
+    receiveBuf_(0)
 {}
 
 
@@ -109,6 +113,18 @@ void Foam::processorCyclicPointPatchField<Type>::initSwapAddSeparated
             )
         );
 
+        if (commsType == Pstream::nonBlocking)
+        {
+            receiveBuf_.setSize(pf.size());
+            IPstream::read
+            (
+                commsType,
+                procPatch_.neighbProcNo(),
+                reinterpret_cast<char*>(receiveBuf_.begin()),
+                receiveBuf_.byteSize(),
+                procPatch_.tag()
+            );
+        }
         OPstream::write
         (
             commsType,
@@ -130,16 +146,19 @@ void Foam::processorCyclicPointPatchField<Type>::swapAddSeparated
 {
     if (Pstream::parRun())
     {
-        Field<Type> pnf(this->size());
-
-        IPstream::read
-        (
-            commsType,
-            procPatch_.neighbProcNo(),
-            reinterpret_cast<char*>(pnf.begin()),
-            pnf.byteSize(),
-            procPatch_.tag()
-        );
+        // If nonblocking data has already been received into receiveBuf_
+        if (commsType != Pstream::nonBlocking)
+        {
+            receiveBuf_.setSize(this->size());
+            IPstream::read
+            (
+                commsType,
+                procPatch_.neighbProcNo(),
+                reinterpret_cast<char*>(receiveBuf_.begin()),
+                receiveBuf_.byteSize(),
+                procPatch_.tag()
+            );
+        }
 
         if (doTransform())
         {
@@ -147,11 +166,11 @@ void Foam::processorCyclicPointPatchField<Type>::swapAddSeparated
                 procPatch_.procCyclicPolyPatch();
             const tensor& forwardT = ppp.forwardT()[0];
 
-            transform(pnf, forwardT, pnf);
+            transform(receiveBuf_, forwardT, receiveBuf_);
         }
 
         // All points are separated
-        this->addToInternalField(pField, pnf);
+        this->addToInternalField(pField, receiveBuf_);
     }
 }
 
diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.H
index c8575240603f5daeb6ba12b4fd5477e0cd53df66..6aa358b868b33f718f8fd717a3aab24141aa2489 100644
--- a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.H
+++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -57,6 +57,9 @@ class processorCyclicPointPatchField
         //- Local reference to processor patch
         const processorCyclicPointPatch& procPatch_;
 
+        //- Receive buffer for non-blocking communication
+        mutable Field<Type> receiveBuf_;
+
 
 public:
 
diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H
index 563f1aadab506cab474e48de6360cfb065737695..9aa6a77ab59b262143827bc52ec8a8529fbf29bb 100644
--- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H
+++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -38,7 +38,11 @@ Description
 
             code
             #{
-                operator==(min(10, 0.1*this->db().time().value()));
+                operator==
+                (
+                    vector(0,0,1)
+                   *min(10, 0.1*this->db().time().value())
+                );
             #};
 
             //codeInclude
diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C
index 16f6157a227fc12ecd16473a271184d1cb49e2e5..4db10a9941050ada7b88564e57c24f62a3ccc814 100644
--- a/src/OpenFOAM/global/argList/argList.C
+++ b/src/OpenFOAM/global/argList/argList.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/global/debug/debug.C b/src/OpenFOAM/global/debug/debug.C
index f8f513322c6d821cd5e39b7721cbfd57da2d770a..479c56db0e8787e583b92c80e865086921ea043d 100644
--- a/src/OpenFOAM/global/debug/debug.C
+++ b/src/OpenFOAM/global/debug/debug.C
@@ -95,10 +95,18 @@ Foam::dictionary& Foam::debug::controlDict()
         controlDictPtr_ = new dictionary();
         forAllReverse(controlDictFiles, cdfi)
         {
-            controlDictPtr_->merge
-            (
-                dictionary(IFstream(controlDictFiles[cdfi])())
-            );
+            IFstream ifs(controlDictFiles[cdfi]);
+
+            if (!ifs.good())
+            {
+                SafeFatalIOErrorIn
+                (
+                    "debug::controlDict()",
+                    ifs,
+                    "Cannot open controlDict"
+                );
+            }
+            controlDictPtr_->merge(dictionary(ifs));
         }
     }
 
diff --git a/src/OpenFOAM/global/foamDoc.H b/src/OpenFOAM/global/foamDoc.H
index cd3f1998a5aecdbb2f4d2eaed8b2fe1a87716a6d..1dbd19ff312a7ad2eacae71678936a9813a27c86 100644
--- a/src/OpenFOAM/global/foamDoc.H
+++ b/src/OpenFOAM/global/foamDoc.H
@@ -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
@@ -28,7 +28,7 @@ License
 \section about About OpenFOAM
 
     OpenFOAM is a free, open source CFD software package released free and
-    open-source under the GNU General Public License by the OpenFOAM Foundation,
+    open-source under the GNU General Public License by the,
     <a href="http://www.openfoam.org">OpenFOAM Foundation</a>.  It has a large
     user base across most areas of engineering and science, from both commercial
     and academic organisations.  OpenFOAM has an extensive range of features to
diff --git a/src/OpenFOAM/graph/graph.C b/src/OpenFOAM/graph/graph.C
index 7c59cfc2f692ce68dccd07bab5b4cfd75f51c827..0ec122dcc320c76966d7a0de5cec406ad9655231 100644
--- a/src/OpenFOAM/graph/graph.C
+++ b/src/OpenFOAM/graph/graph.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
@@ -41,6 +41,17 @@ namespace Foam
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
+Foam::word Foam::graph::wordify(const Foam::string& sname)
+{
+    string wname = sname;
+    wname.replace(' ', '_');
+    wname.replace('(', '_');
+    wname.replace(')', "");
+
+    return word(wname);
+}
+
+
 void Foam::graph::readCurves(Istream& is)
 {
     List<xy> xyData(is);
@@ -54,7 +65,11 @@ void Foam::graph::readCurves(Istream& is)
         y[i] = xyData[i].y_;
     }
 
-    insert(yName_, new curve(yName_, curve::curveStyle::CONTINUOUS, y));
+    insert
+    (
+        wordify(yName_),
+        new curve(wordify(yName_), curve::curveStyle::CONTINUOUS, y)
+    );
 }
 
 
@@ -89,7 +104,7 @@ Foam::graph::graph
     yName_(yName),
     x_(x)
 {
-    insert(yName, new curve(yName, curve::curveStyle::CONTINUOUS, y));
+    insert(wordify(yName), new curve(yName, curve::curveStyle::CONTINUOUS, y));
 }
 
 
diff --git a/src/OpenFOAM/graph/graph.H b/src/OpenFOAM/graph/graph.H
index 2a414980618710a4722f4b1683c4416b044fc5d7..b3ff00c37d5938a826bc3cc889d88622fc78ba8f 100644
--- a/src/OpenFOAM/graph/graph.H
+++ b/src/OpenFOAM/graph/graph.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -263,6 +263,9 @@ public:
                 const word& format
             ) const;
 
+            //- Helper function to convert string name into appropriate word
+            static word wordify(const string& sname);
+
 
     // Friend operators
 
diff --git a/src/OpenFOAM/interpolations/interpolationLookUpTable/interpolationLookUpTable.C b/src/OpenFOAM/interpolations/interpolationLookUpTable/interpolationLookUpTable.C
index a836882bdf22cb37656673572b2e0dbee8cb6b34..8159b62c9e8bc50cfe82b3e828c364208635b767 100644
--- a/src/OpenFOAM/interpolations/interpolationLookUpTable/interpolationLookUpTable.C
+++ b/src/OpenFOAM/interpolations/interpolationLookUpTable/interpolationLookUpTable.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -26,7 +26,7 @@ License
 
 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::label Foam::interpolationLookUpTable<Type>::index
 (
     const List<scalar>& indices,
@@ -70,7 +70,7 @@ Foam::label Foam::interpolationLookUpTable<Type>::index
 }
 
 
-template <class Type>
+template<class Type>
 Foam::label Foam::interpolationLookUpTable<Type>::index
 (
     const scalar indice
diff --git a/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.C b/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.C
index 4fdacbb94017faaf1a0a0e8611fecbd996e572b9..e150c64c6a0a55b447696014c4fde4425610be9b 100644
--- a/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.C
+++ b/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -28,7 +28,7 @@ License
 
 // * * * * * * * * * * * *  Private Member Functions * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 void Foam::uniformInterpolationTable<Type>::checkTable() const
 {
     if (size() < 2)
@@ -44,7 +44,7 @@ void Foam::uniformInterpolationTable<Type>::checkTable() const
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
 (
     const IOobject& io,
@@ -73,7 +73,7 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
 }
 
 
-template <class Type>
+template<class Type>
 Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
 (
     const word& tableName,
@@ -112,7 +112,7 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
 }
 
 
-template <class Type>
+template<class Type>
 Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
 (
     const uniformInterpolationTable& uit
@@ -131,14 +131,14 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::uniformInterpolationTable<Type>::~uniformInterpolationTable()
 {}
 
 
 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Type Foam::uniformInterpolationTable<Type>::interpolate(scalar x) const
 {
     if (bound_)
@@ -186,7 +186,7 @@ Type Foam::uniformInterpolationTable<Type>::interpolate(scalar x) const
 }
 
 
-template <class Type>
+template<class Type>
 Type Foam::uniformInterpolationTable<Type>::interpolateLog10
 (
     scalar x
@@ -217,7 +217,7 @@ Type Foam::uniformInterpolationTable<Type>::interpolateLog10
 }
 
 
-template <class Type>
+template<class Type>
 void Foam::uniformInterpolationTable<Type>::write() const
 {
     IOdictionary dict(*this);
diff --git a/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.H b/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.H
index 87c41609e0c6a92c16e1016619bb2417335a705a..680999cbc6d1ab10067955fc538f4009d8907d21 100644
--- a/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.H
+++ b/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -67,7 +67,7 @@ namespace Foam
                  Class uniformInterpolationTable Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class Type>
+template<class Type>
 class uniformInterpolationTable
 :
     public IOobject,
diff --git a/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTableI.H b/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTableI.H
index 90b19e8f97fd032885c6ca0795c6f97ec8ee1015..237dcede2f9577d8646abaf114f59d28c8f030c0 100644
--- a/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTableI.H
+++ b/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTableI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -23,70 +23,70 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-template <class Type>
+template<class Type>
 Foam::scalar Foam::uniformInterpolationTable<Type>::x0() const
 {
     return x0_;
 }
 
 
-template <class Type>
+template<class Type>
 Foam::scalar Foam::uniformInterpolationTable<Type>::dx() const
 {
     return dx_;
 }
 
 
-template <class Type>
+template<class Type>
 const Foam::Switch& Foam::uniformInterpolationTable<Type>::log10() const
 {
     return log10_;
 }
 
 
-template <class Type>
+template<class Type>
 const Foam::Switch& Foam::uniformInterpolationTable<Type>::bound() const
 {
     return bound_;
 }
 
 
-template <class Type>
+template<class Type>
 Foam::scalar& Foam::uniformInterpolationTable<Type>::x0()
 {
     return x0_;
 }
 
 
-template <class Type>
+template<class Type>
 Foam::scalar& Foam::uniformInterpolationTable<Type>::dx()
 {
     return dx_;
 }
 
 
-template <class Type>
+template<class Type>
 Foam::Switch& Foam::uniformInterpolationTable<Type>::log10()
 {
     return log10_;
 }
 
 
-template <class Type>
+template<class Type>
 Foam::Switch& Foam::uniformInterpolationTable<Type>::bound()
 {
     return bound_;
 }
 
 
-template <class Type>
+template<class Type>
 Foam::scalar Foam::uniformInterpolationTable<Type>::xMin() const
 {
     return x0_;
 }
 
 
-template <class Type>
+template<class Type>
 Foam::scalar Foam::uniformInterpolationTable<Type>::xMax() const
 {
     return x0_ + dx_*(size() - 1);
diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H
index 06718d1c786674a484c14ecb967dd3c1ca7074e5..3d497e93fa955a05b42152b79437ada784b0d84d 100644
--- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H
+++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C
index 396845ffe86fe9cc802dbcc1a07a899b32d16f1e..a40188a2fd8f8a6be7339cac799ffea0726bb9ea 100644
--- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C
+++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H
index 45ad3f0dcad680588863a877f04870dcd0748953..1fdd8f4219c00aa42dc2b6ccae0daf74b0f56892 100644
--- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H
+++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixOperations.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixOperations.C
index df1ba0d9455eaa0ef1b35dcf6bd8b9571b5cdbb4..108f60d7e5bd66e71bd64ba51ad113ce40b5fb5e 100644
--- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixOperations.C
+++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixOperations.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixUpdateMatrixInterfaces.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixUpdateMatrixInterfaces.C
index bf48d3852b8c23e8f47dac63a5ff3dacc1ae2c69..f40b23dc873deea4e2ab13323ade758dc3b96a28 100644
--- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixUpdateMatrixInterfaces.C
+++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixUpdateMatrixInterfaces.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C
index 51421910c278aa4452d4bf87f39d87620e240e27..aacea11eaf3ae43b9323c464e3ad27601562354a 100644
--- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C
+++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -70,7 +70,7 @@ Foam::GAMGAgglomeration::GAMGAgglomeration
     const dictionary& controlDict
 )
 :
-    MeshObject<lduMesh, GAMGAgglomeration>(mesh),
+    MeshObject<lduMesh, Foam::GeometricMeshObject, GAMGAgglomeration>(mesh),
 
     maxLevels_(50),
 
diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H
index e35cdd379f5690ccdc5152e46ac037293c57dfe8..c6ad6d2c5c1d6dd51ded14639ab60282f4ef8911 100644
--- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H
+++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -58,7 +58,7 @@ class lduMatrix;
 
 class GAMGAgglomeration
 :
-    public MeshObject<lduMesh, GAMGAgglomeration>
+    public MeshObject<lduMesh, GeometricMeshObject, GAMGAgglomeration>
 {
 protected:
 
diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.C
index 184630bb49f5c35fc868bf5e632864431e2d245a..bdee7b16cc11e35078fa526c5418f7792fdca90b 100644
--- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.C
+++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H
index c64f0738ee4df01c29019deebb9971a33454ca75..8ac8e88be12b9041209af4743a6fdf13f90d839d 100644
--- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H
+++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterface.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterface.H
index 69ed4414043c5bcb6c141a453f43b1cb3048d570..236f761bfa92220fea05ffba857754db8432dca8 100644
--- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterface.H
+++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterface.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterfaceTemplates.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterfaceTemplates.C
index 4890618ab12781c44a18b40239c013386b89dbaf..79e5f04259ed232a643fddbd2f0fbc71d016d3dc 100644
--- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterfaceTemplates.C
+++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/GAMGInterface/GAMGInterfaceTemplates.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/meshes/MeshObject/MeshObject.C b/src/OpenFOAM/meshes/MeshObject/MeshObject.C
index eed1d7aad8d212690107ac26860785fe42fa95ba..01e86da379045050f220dc211d2c4e5ba2a7beb5 100644
--- a/src/OpenFOAM/meshes/MeshObject/MeshObject.C
+++ b/src/OpenFOAM/meshes/MeshObject/MeshObject.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,29 +25,22 @@ License
 
 #include "MeshObject.H"
 #include "objectRegistry.H"
+#include "IOstreams.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template<class Mesh, class Type>
-Foam::MeshObject<Mesh, Type>::MeshObject(const Mesh& mesh)
+template<class Mesh, template<class> class MeshObjectType, class Type>
+Foam::MeshObject<Mesh, MeshObjectType, Type>::MeshObject(const Mesh& mesh)
 :
-    regIOobject
-    (
-        IOobject
-        (
-            Type::typeName,
-            mesh.thisDb().instance(),
-            mesh.thisDb()
-        )
-    ),
+    MeshObjectType<Mesh>(Type::typeName, mesh.thisDb()),
     mesh_(mesh)
 {}
 
 
 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
 
-template<class Mesh, class Type>
-const Type& Foam::MeshObject<Mesh, Type>::New
+template<class Mesh, template<class> class MeshObjectType, class Type>
+const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New
 (
     const Mesh& mesh
 )
@@ -67,14 +60,19 @@ const Type& Foam::MeshObject<Mesh, Type>::New
     }
     else
     {
-        return store(new Type(mesh));
+        if (meshObject::debug)
+        {
+            Pout<< "MeshObject::New(const Mesh&) : constructing new "
+                << Type::typeName << endl;
+        }
+        return regIOobject::store(new Type(mesh));
     }
 }
 
 
-template<class Mesh, class Type>
+template<class Mesh, template<class> class MeshObjectType, class Type>
 template<class Data1>
-const Type& Foam::MeshObject<Mesh, Type>::New
+const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New
 (
     const Mesh& mesh,
     const Data1& d
@@ -95,14 +93,19 @@ const Type& Foam::MeshObject<Mesh, Type>::New
     }
     else
     {
-        return store(new Type(mesh, d));
+        if (meshObject::debug)
+        {
+            Pout<< "MeshObject::New(const Mesh&) : constructing new "
+                << Type::typeName << endl;
+        }
+        return regIOobject::store(new Type(mesh, d));
     }
 }
 
 
-template<class Mesh, class Type>
+template<class Mesh, template<class> class MeshObjectType, class Type>
 template<class Data1, class Data2>
-const Type& Foam::MeshObject<Mesh, Type>::New
+const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New
 (
     const Mesh& mesh,
     const Data1& d1,
@@ -124,14 +127,19 @@ const Type& Foam::MeshObject<Mesh, Type>::New
     }
     else
     {
-        return store(new Type(mesh, d1, d2));
+        if (meshObject::debug)
+        {
+            Pout<< "MeshObject(const Mesh&) : constructing new "
+                << Type::typeName << endl;
+        }
+        return regIOobject::store(new Type(mesh, d1, d2));
     }
 }
 
 
-template<class Mesh, class Type>
+template<class Mesh, template<class> class MeshObjectType, class Type>
 template<class Data1, class Data2, class Data3>
-const Type& Foam::MeshObject<Mesh, Type>::New
+const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New
 (
     const Mesh& mesh,
     const Data1& d1,
@@ -154,14 +162,19 @@ const Type& Foam::MeshObject<Mesh, Type>::New
     }
     else
     {
-        return store(new Type(mesh, d1, d2, d3));
+        if (meshObject::debug)
+        {
+            Pout<< "MeshObject(const Mesh&) : constructing new "
+                << Type::typeName << endl;
+        }
+        return regIOobject::store(new Type(mesh, d1, d2, d3));
     }
 }
 
 
-template<class Mesh, class Type>
+template<class Mesh, template<class> class MeshObjectType, class Type>
 template<class Data1, class Data2, class Data3, class Data4>
-const Type& Foam::MeshObject<Mesh, Type>::New
+const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New
 (
     const Mesh& mesh,
     const Data1& d1,
@@ -185,15 +198,20 @@ const Type& Foam::MeshObject<Mesh, Type>::New
     }
     else
     {
-        return store(new Type(mesh, d1, d2, d3, d4));
+        if (meshObject::debug)
+        {
+            Pout<< "MeshObject(const Mesh&) : constructing new "
+                << Type::typeName << endl;
+        }
+        return regIOobject::store(new Type(mesh, d1, d2, d3, d4));
     }
 }
 
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * //
 
-template<class Mesh, class Type>
-bool Foam::MeshObject<Mesh, Type>::Delete(const Mesh& mesh)
+template<class Mesh, template<class> class MeshObjectType, class Type>
+bool Foam::MeshObject<Mesh, MeshObjectType, Type>::Delete(const Mesh& mesh)
 {
     if
     (
@@ -203,6 +221,12 @@ bool Foam::MeshObject<Mesh, Type>::Delete(const Mesh& mesh)
         )
     )
     {
+        if (meshObject::debug)
+        {
+            Pout<< "MeshObject::Delete(const Mesh&) : deleting "
+                << Type::typeName << endl;
+        }
+
         return mesh.thisDb().checkOut
         (
             const_cast<Type&>
@@ -221,10 +245,107 @@ bool Foam::MeshObject<Mesh, Type>::Delete(const Mesh& mesh)
 }
 
 
-template<class Mesh, class Type>
-Foam::MeshObject<Mesh, Type>::~MeshObject()
+template<class Mesh, template<class> class MeshObjectType, class Type>
+Foam::MeshObject<Mesh, MeshObjectType, Type>::~MeshObject()
+{
+    MeshObjectType<Mesh>::release();
+}
+
+
+template<class Mesh>
+void Foam::meshObject::movePoints(objectRegistry& obr)
+{
+    HashTable<GeometricMeshObject<Mesh>*> meshObjects
+    (
+        obr.lookupClass<GeometricMeshObject<Mesh> >()
+    );
+
+    forAllIter
+    (
+        typename HashTable<GeometricMeshObject<Mesh>*>,
+        meshObjects,
+        iter
+    )
+    {
+        if (isA<MoveableMeshObject<Mesh> >(*iter()))
+        {
+            if (meshObject::debug)
+            {
+                Pout<< "meshObject::movePoints(objectRegistry&) :"
+                    << " movePoints on "
+                    << iter()->name() << endl;
+            }
+            dynamic_cast<MoveableMeshObject<Mesh>*>(iter())->movePoints();
+        }
+        else
+        {
+            if (meshObject::debug)
+            {
+                Pout<< "meshObject::movePoints(objectRegistry&) :"
+                    << " destroying "
+                    << iter()->name() << endl;
+            }
+            obr.checkOut(*iter());
+        }
+    }
+}
+
+
+template<class Mesh>
+void Foam::meshObject::updateMesh(objectRegistry& obr, const mapPolyMesh& mpm)
+{
+    HashTable<GeometricMeshObject<Mesh>*> meshObjects
+    (
+        obr.lookupClass<GeometricMeshObject<Mesh> >()
+    );
+
+    forAllIter
+    (
+        typename HashTable<GeometricMeshObject<Mesh>*>,
+        meshObjects,
+        iter
+    )
+    {
+        if (isA<UpdateableMeshObject<Mesh> >(*iter()))
+        {
+            if (meshObject::debug)
+            {
+                Pout<< "meshObject::updateMesh(objectRegistry&) :"
+                    << " updateMesh on "
+                    << iter()->name() << endl;
+            }
+            dynamic_cast<UpdateableMeshObject<Mesh>*>(iter())->updateMesh(mpm);
+        }
+        else
+        {
+            if (meshObject::debug)
+            {
+                Pout<< "meshObject::updateMesh(objectRegistry&) : destroying "
+                    << iter()->name() << endl;
+            }
+            obr.checkOut(*iter());
+        }
+    }
+}
+
+
+template<class Mesh, template<class> class MeshObjectType>
+void Foam::meshObject::clear(objectRegistry& obr)
 {
-    release();
+    HashTable<MeshObjectType<Mesh>*> meshObjects
+    (
+        obr.lookupClass<MeshObjectType<Mesh> >()
+    );
+
+    forAllIter(typename HashTable<MeshObjectType<Mesh>*>, meshObjects, iter)
+    {
+        if (meshObject::debug)
+        {
+            Pout<< "meshObject::clear(objectRegistry&) : destroying "
+                << iter()->name() << endl;
+        }
+        obr.checkOut(*iter());
+    }
 }
 
 
diff --git a/src/OpenFOAM/meshes/MeshObject/MeshObject.H b/src/OpenFOAM/meshes/MeshObject/MeshObject.H
index 95cf9daf2ceb844958d0ce702de05c579d0d9740..b95c631e52fe1147c297d3d2645ad93130fe6d2a 100644
--- a/src/OpenFOAM/meshes/MeshObject/MeshObject.H
+++ b/src/OpenFOAM/meshes/MeshObject/MeshObject.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,9 +25,36 @@ Class
     Foam::MeshObject
 
 Description
-    Templated abstract base-class for dynamic mesh objects used to automate
+    Templated abstract base-class for optional mesh objects used to automate
     their allocation to the mesh database and the mesh-modifier event-loop.
 
+    MeshObject is templated on the type of mesh it is allocated to, the type of
+    the mesh object (TopologicalMeshObject, GeometricMeshObject,
+    MoveableMeshObject, UpdateableMeshObject) and the type of the actual object
+    it is created for example:
+
+    class leastSquaresVectors
+    :
+        public MeshObject<fvMesh, MoveableMeshObject, leastSquaresVectors>
+    {
+    .
+    .
+    .
+        //- Delete the least square vectors when the mesh moves
+        virtual bool movePoints();
+    };
+
+    MeshObject types:
+
+    TopologicalMeshObject: mesh object to be deleted on topology change
+    GeometricMeshObject: mesh object to be deleted on geometry change
+    MoveableMeshObject: mesh object to be updated in movePoints
+    UpdateableMeshObject: mesh object to be updated in updateMesh or movePoints
+
+    Note that movePoints must be provided for MeshObjects of type
+    MoveableMeshObject and both movePoints and updateMesh functions must exist
+    provided for MeshObjects of type UpdateableMeshObject.
+
 SourceFiles
     MeshObject.C
 
@@ -37,21 +64,24 @@ SourceFiles
 #define MeshObject_H
 
 #include "regIOobject.H"
+#include "objectRegistry.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
 {
 
+// Forward declarations
+class mapPolyMesh;
+
 /*---------------------------------------------------------------------------*\
-                           Class MeshObject Declaration
+                         Class MeshObject Declaration
 \*---------------------------------------------------------------------------*/
 
-
-template<class Mesh, class Type>
+template<class Mesh, template<class> class MeshObjectType, class Type>
 class MeshObject
 :
-    public regIOobject
+    public MeshObjectType<Mesh>
 {
 
 protected:
@@ -124,6 +154,113 @@ public:
 };
 
 
+/*---------------------------------------------------------------------------*\
+                           Class meshObject Declaration
+\*---------------------------------------------------------------------------*/
+
+class meshObject
+:
+    public regIOobject
+{
+public:
+
+    // Declare name of the class and its debug switch
+    ClassName("meshObject");
+
+    // Constructors
+
+        meshObject(const word& typeName, const objectRegistry& obr);
+
+
+    // Static member functions
+
+        template<class Mesh>
+        static void movePoints(objectRegistry&);
+
+        template<class Mesh>
+        static void updateMesh(objectRegistry&, const mapPolyMesh&);
+
+        template<class Mesh, template<class> class MeshObjectType>
+        static void clear(objectRegistry&);
+};
+
+
+/*---------------------------------------------------------------------------*\
+                    Class TopologicalMeshObject Declaration
+\*---------------------------------------------------------------------------*/
+
+template<class Mesh>
+class TopologicalMeshObject
+:
+    public meshObject
+{
+public:
+
+    TopologicalMeshObject(const word& typeName, const objectRegistry& obr)
+    :
+        meshObject(typeName, obr)
+    {}
+};
+
+
+/*---------------------------------------------------------------------------*\
+                    Class GeometricMeshObject Declaration
+\*---------------------------------------------------------------------------*/
+
+template<class Mesh>
+class GeometricMeshObject
+:
+    public TopologicalMeshObject<Mesh>
+{
+public:
+
+    GeometricMeshObject(const word& typeName, const objectRegistry& obr)
+    :
+        TopologicalMeshObject<Mesh>(typeName, obr)
+    {}
+};
+
+
+/*---------------------------------------------------------------------------*\
+                    Class MoveableMeshObject Declaration
+\*---------------------------------------------------------------------------*/
+
+template<class Mesh>
+class MoveableMeshObject
+:
+    public GeometricMeshObject<Mesh>
+{
+public:
+
+    MoveableMeshObject(const word& typeName, const objectRegistry& obr)
+    :
+        GeometricMeshObject<Mesh>(typeName, obr)
+    {}
+
+    virtual bool movePoints() = 0;
+};
+
+
+/*---------------------------------------------------------------------------*\
+                    Class UpdateableMeshObject Declaration
+\*---------------------------------------------------------------------------*/
+
+template<class Mesh>
+class UpdateableMeshObject
+:
+    public MoveableMeshObject<Mesh>
+{
+public:
+
+    UpdateableMeshObject(const word& typeName, const objectRegistry& obr)
+    :
+        MoveableMeshObject<Mesh>(typeName, obr)
+    {}
+
+    virtual void updateMesh(const mapPolyMesh& mpm) = 0;
+};
+
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 } // End namespace Foam
diff --git a/src/OpenFOAM/meshes/MeshObject/meshObject.C b/src/OpenFOAM/meshes/MeshObject/meshObject.C
new file mode 100644
index 0000000000000000000000000000000000000000..7130f38b5dfd738ff2d9ef9b4c6f2316dc24badd
--- /dev/null
+++ b/src/OpenFOAM/meshes/MeshObject/meshObject.C
@@ -0,0 +1,52 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "MeshObject.H"
+
+/* * * * * * * * * * * * * * * Static Member Data  * * * * * * * * * * * * * */
+
+namespace Foam
+{
+    defineTypeNameAndDebug(meshObject, 0);
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::meshObject::meshObject(const word& typeName, const objectRegistry& obr)
+:
+    regIOobject
+    (
+        IOobject
+        (
+            typeName,
+            obr.instance(),
+            obr
+        )
+    )
+{}
+
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/meshes/meshShapes/tetCell/tetCell.H b/src/OpenFOAM/meshes/meshShapes/tetCell/tetCell.H
index 91e3926c7f9d0675b898d9e9caf4dcac32fd1528..ea4a14862e4406739ccfa088830ba5a94c2f174f 100644
--- a/src/OpenFOAM/meshes/meshShapes/tetCell/tetCell.H
+++ b/src/OpenFOAM/meshes/meshShapes/tetCell/tetCell.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.C b/src/OpenFOAM/meshes/pointMesh/pointMesh.C
index f378a5d78026fa466a2b8bd338202f82e39d8b35..de6f88d16cc0cfffa1545a9d3e09e84b5e5650d1 100644
--- a/src/OpenFOAM/meshes/pointMesh/pointMesh.C
+++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.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
@@ -72,7 +72,7 @@ void Foam::pointMesh::mapFields(const mapPolyMesh& mpm)
 
 Foam::pointMesh::pointMesh(const polyMesh& pMesh)
 :
-    MeshObject<polyMesh, pointMesh>(pMesh),
+    MeshObject<polyMesh, Foam::UpdateableMeshObject, pointMesh>(pMesh),
     GeoMesh<polyMesh>(pMesh),
     boundary_(*this, pMesh.boundaryMesh())
 {
@@ -88,7 +88,7 @@ Foam::pointMesh::pointMesh(const polyMesh& pMesh)
 }
 
 
-void Foam::pointMesh::movePoints(const pointField& newPoints)
+bool Foam::pointMesh::movePoints()
 {
     if (debug)
     {
@@ -96,7 +96,9 @@ void Foam::pointMesh::movePoints(const pointField& newPoints)
             << "Moving points." << endl;
     }
 
-    boundary_.movePoints(newPoints);
+    boundary_.movePoints(GeoMesh<polyMesh>::mesh_.points());
+
+    return true;
 }
 
 
diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.H b/src/OpenFOAM/meshes/pointMesh/pointMesh.H
index 25e8af95304c4719b1747bfa4429b26a53106ac0..15dbf5bf88011296d9ce1ab76a20f265147565be 100644
--- a/src/OpenFOAM/meshes/pointMesh/pointMesh.H
+++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.H
@@ -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
@@ -48,7 +48,7 @@ namespace Foam
 
 class pointMesh
 :
-    public MeshObject<polyMesh, pointMesh>,
+    public MeshObject<polyMesh, UpdateableMeshObject, pointMesh>,
     public GeoMesh<polyMesh>
 {
     // Permanent data
@@ -121,7 +121,7 @@ public:
         // Mesh motion
 
             //- Move points, returns volumes swept by faces in motion
-            void movePoints(const pointField&);
+            bool movePoints();
 
             //- Update the mesh corresponding to given map
             void updateMesh(const mapPolyMesh& mpm);
diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H
index 3d254c04ba3e2045101d070d379a6b603eb6fb63..ab1858b1484f436d7434f0e5c84044cb34a15b9e 100644
--- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H
+++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H
@@ -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
@@ -112,7 +112,7 @@ class globalMeshData
     // Private class
 
         // To combineReduce a pointField. Just appends all lists.
-        template <class T>
+        template<class T>
         class plusEqOp
         {
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C
index 8201254e0b3276e9945f652c854507042ff753ce..9b0d11ac7adf4ae8455b09b0db1f2b572679c6ca 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.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
@@ -26,30 +26,24 @@ License
 #include "polyMesh.H"
 #include "Time.H"
 #include "cellIOList.H"
-#include "SubList.H"
 #include "wedgePolyPatch.H"
 #include "emptyPolyPatch.H"
 #include "globalMeshData.H"
 #include "processorPolyPatch.H"
-#include "OSspecific.H"
 #include "polyMeshTetDecomposition.H"
 #include "indexedOctree.H"
 #include "treeDataCell.H"
-#include "SubField.H"
+#include "MeshObject.H"
 
-#include "pointMesh.H"
-#include "Istream.H"
-#include "Ostream.H"
-#include "simpleRegIOobject.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 namespace Foam
 {
-defineTypeNameAndDebug(polyMesh, 0);
+    defineTypeNameAndDebug(polyMesh, 0);
 
-word polyMesh::defaultRegion = "region0";
-word polyMesh::meshSubDir = "polyMesh";
+    word polyMesh::defaultRegion = "region0";
+    word polyMesh::meshSubDir = "polyMesh";
 }
 
 
@@ -1162,21 +1156,7 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
     geometricD_ = Vector<label>::zero;
     solutionD_ = Vector<label>::zero;
 
-
-    // Hack until proper callbacks. Below are all the polyMeh MeshObjects with a
-    // movePoints function.
-
-    // pointMesh
-    if (thisDb().foundObject<pointMesh>(pointMesh::typeName))
-    {
-        const_cast<pointMesh&>
-        (
-            thisDb().lookupObject<pointMesh>
-            (
-                pointMesh::typeName
-            )
-        ).movePoints(points_);
-    }
+    meshObject::movePoints<polyMesh>(*this);
 
     const_cast<Time&>(time()).functionObjects().movePoints(*this);
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.H b/src/OpenFOAM/meshes/polyMesh/polyMesh.H
index e4c189767192ae87ddddc131ea0ea3e0d1068353..76c5f1c8a3777cc65b520d2a720fc1fc66ddd895 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMesh.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.H
@@ -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
@@ -576,9 +576,6 @@ public:
 
         // Geometric checks. Selectively override primitiveMesh functionality.
 
-            //- Check boundary for closedness
-            virtual bool checkClosedBoundary(const bool report = false) const;
-
             //- Check non-orthogonality
             virtual bool checkFaceOrthogonality
             (
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshCheck.C b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshCheck.C
index 748c7da21a63f0b9d25acb21f34d5df839415ee0..f7daba04955b96710f570267d344519909a3d9f9 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshCheck.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshCheck.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -434,22 +434,6 @@ bool Foam::polyMesh::checkCellDeterminant
             << "checking for under-determined cells" << endl;
     }
 
-    // Determine number of dimensions and (for 2D) missing dimension
-    label nDims = 0;
-    label twoD = -1;
-    for (direction dir = 0; dir < vector::nComponents; dir++)
-    {
-        if (meshD[dir] == 1)
-        {
-            nDims++;
-        }
-        else
-        {
-            twoD = dir;
-        }
-    }
-
-
     tmp<scalarField> tcellDeterminant = primitiveMeshTools::cellDeterminant
     (
         *this,
@@ -516,15 +500,17 @@ bool Foam::polyMesh::checkCellDeterminant
 }
 
 
-bool Foam::polyMesh::checkClosedBoundary(const bool report) const
-{
-    return primitiveMesh::checkClosedBoundary
-    (
-        faceAreas(),
-        report,
-        syncTools::getInternalOrCoupledFaces(*this)
-    );
-}
+//- Could override checkClosedBoundary to not look at (collocated!) coupled
+//  faces
+//bool Foam::polyMesh::checkClosedBoundary(const bool report) const
+//{
+//    return primitiveMesh::checkClosedBoundary
+//    (
+//        faceAreas(),
+//        report,
+//        syncTools::getInternalOrCollocatedCoupledFaces(*this)
+//    );
+//}
 
 
 bool Foam::polyMesh::checkFaceOrthogonality
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.C b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.C
index fc0739e79faf42d048b133d79b2a97f572b99388..55f6a907676e7f241fd34c11befaa23a5de4332f 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -60,7 +60,7 @@ Foam::tmp<Foam::scalarField> Foam::polyMeshTools::faceOrthogonality
     // Coupled faces
 
     pointField neighbourCc;
-    syncTools::swapBoundaryCellList(mesh, cc, neighbourCc);
+    syncTools::swapBoundaryCellPositions(mesh, cc, neighbourCc);
 
     forAll(pbm, patchI)
     {
@@ -123,7 +123,7 @@ Foam::tmp<Foam::scalarField> Foam::polyMeshTools::faceSkewness
     // (i.e. treat as if mirror cell on other side)
 
     pointField neighbourCc;
-    syncTools::swapBoundaryCellList(mesh, cellCtrs, neighbourCc);
+    syncTools::swapBoundaryCellPositions(mesh, cellCtrs, neighbourCc);
 
     forAll(pbm, patchI)
     {
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C b/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C
index 95474da4050a1edd3f89a357630b0077a25ecd74..7a9558187d54f0b862f09f14be06ff8b59058911 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMeshClear.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
@@ -26,8 +26,7 @@ License
 #include "polyMesh.H"
 #include "primitiveMesh.H"
 #include "globalMeshData.H"
-#include "pointMesh.H"
-#include "Time.H"
+#include "MeshObject.H"
 #include "indexedOctree.H"
 #include "treeDataCell.H"
 
@@ -61,6 +60,8 @@ void Foam::polyMesh::clearGeom()
             << endl;
     }
 
+    meshObject::clear<polyMesh, GeometricMeshObject>(*this);
+
     primitiveMesh::clearGeom();
 
     boundary_.clearGeom();
@@ -101,6 +102,8 @@ void Foam::polyMesh::clearAddressing()
             << endl;
     }
 
+    meshObject::clear<polyMesh, TopologicalMeshObject>(*this);
+
     primitiveMesh::clearAddressing();
 
     // parallelData depends on the processorPatch ordering so force
@@ -118,6 +121,7 @@ void Foam::polyMesh::clearAddressing()
 
     // Remove the stored tet base points
     tetBasePtIsPtr_.clear();
+
     // Remove the cell tree
     cellTreePtr_.clear();
 }
@@ -132,8 +136,6 @@ void Foam::polyMesh::clearPrimitives()
     owner_.setSize(0);
     neighbour_.setSize(0);
 
-    pointMesh::Delete(*this);
-
     clearedPrimitives_ = true;
 }
 
@@ -142,8 +144,6 @@ void Foam::polyMesh::clearOut()
 {
     clearGeom();
     clearAddressing();
-
-    pointMesh::Delete(*this);
 }
 
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.H b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.H
index e1dfbfbf63f3da5417a4a9e0ed5ded0ee7109926..af1defbf6501110a2fb52f503997e9d2c6898941 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndices.H b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndices.H
index 4eb21b6ac9e46231d69d5018f6cc3cf87ce9b31b..7c2102ff55159acf21ea4ad1c3d82fac3a0d5f22 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndices.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndices.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C
index aa4d2bb4b5b1bf1614f99b77d3d20c7059dd41f0..696bb81416f15a7cc348e8c57532ab800990700a 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.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
@@ -91,25 +91,12 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
         }
     }
 
+    meshObject::updateMesh<polyMesh>(*this, mpm);
+
     // Reset valid directions (could change by faces put into empty patches)
     geometricD_ = Vector<label>::zero;
     solutionD_ = Vector<label>::zero;
 
-
-    // Hack until proper callbacks. Below are all the polyMesh-MeshObjects.
-
-    // pointMesh
-    if (thisDb().foundObject<pointMesh>(pointMesh::typeName))
-    {
-        const_cast<pointMesh&>
-        (
-            thisDb().lookupObject<pointMesh>
-            (
-                pointMesh::typeName
-            )
-        ).updateMesh(mpm);
-    }
-
     const_cast<Time&>(time()).functionObjects().updateMesh(mpm);
 }
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C
index 730fa402490fc6f162329fc9a32c4eee82afcd4c..54a49523f7718189c4bdb1c3ba378a121c272e1e 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C
index 8988a06eb211dad9cf592dddbdec24def09fe970..137339e631ee2d9c3153883b8f52430583e2fc70 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.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
@@ -37,10 +37,7 @@ namespace Foam
 }
 
 
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
 (
@@ -66,20 +63,10 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
         neighbProcNo,
         transform
     ),
-    tag_
-    (
-        Pstream::nProcs()*max(myProcNo, neighbProcNo)
-      + min(myProcNo, neighbProcNo)
-    ),
     referPatchName_(referPatchName),
+    tag_(-1),
     referPatchID_(-1)
-{
-    if (debug)
-    {
-        Pout<< "processorCyclicPolyPatch " << name << " uses tag " << tag_
-            << endl;
-    }
-}
+{}
 
 
 Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
@@ -92,20 +79,10 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
 )
 :
     processorPolyPatch(name, dict, index, bm, patchType),
-    tag_
-    (
-        Pstream::nProcs()*max(myProcNo(), neighbProcNo())
-      + min(myProcNo(), neighbProcNo())
-    ),
     referPatchName_(dict.lookup("referPatch")),
+    tag_(dict.lookupOrDefault<int>("tag", -1)),
     referPatchID_(-1)
-{
-    if (debug)
-    {
-        Pout<< "processorCyclicPolyPatch " << name << " uses tag " << tag_
-            << endl;
-    }
-}
+{}
 
 
 Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
@@ -115,8 +92,8 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
 )
 :
     processorPolyPatch(pp, bm),
-    tag_(pp.tag_),
     referPatchName_(pp.referPatchName()),
+    tag_(pp.tag()),
     referPatchID_(-1)
 {}
 
@@ -132,8 +109,8 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
 )
 :
     processorPolyPatch(pp, bm, index, newSize, newStart),
-    tag_(pp.tag_),
     referPatchName_(referPatchName),
+    tag_(-1),
     referPatchID_(-1)
 {}
 
@@ -148,8 +125,8 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
 )
 :
     processorPolyPatch(pp, bm, index, mapAddressing, newStart),
-    tag_(pp.tag_),
     referPatchName_(pp.referPatchName()),
+    tag_(-1),
     referPatchID_(-1)
 {}
 
@@ -162,6 +139,45 @@ Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch()
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+int Foam::processorCyclicPolyPatch::tag() const
+{
+    if (tag_ == -1)
+    {
+        // Get unique tag to use for all comms. Make sure that both sides
+        // use the same tag
+        const cyclicPolyPatch& cycPatch = refCast<const cyclicPolyPatch>
+        (
+            referPatch()
+        );
+
+        if (owner())
+        {
+            tag_ = Hash<word>()(cycPatch.name()) % 32768u;
+        }
+        else
+        {
+            tag_ = Hash<word>()(cycPatch.neighbPatch().name()) % 32768u;
+        }
+
+        if (tag_ == Pstream::msgType() || tag_ == -1)
+        {
+            FatalErrorIn("processorCyclicPolyPatch::tag() const")
+                << "Tag calculated from cyclic patch name " << tag_
+                << " is the same as the current message type "
+                << Pstream::msgType() << " or -1" << nl
+                << "Please set a non-conflicting, unique, tag by hand"
+                << " using the 'tag' entry"
+                << exit(FatalError);
+        }
+        if (debug)
+        {
+            Pout<< "processorCyclicPolyPatch " << name() << " uses tag " << tag_
+                << endl;
+        }
+    }
+    return tag_;
+}
+
 
 void Foam::processorCyclicPolyPatch::initGeometry(PstreamBuffers& pBufs)
 {
@@ -283,6 +299,11 @@ void Foam::processorCyclicPolyPatch::write(Ostream& os) const
     processorPolyPatch::write(os);
     os.writeKeyword("referPatch") << referPatchName_
         << token::END_STATEMENT << nl;
+    if (tag_ != -1)
+    {
+        os.writeKeyword("tag") << tag_
+            << token::END_STATEMENT << nl;
+    }
 }
 
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H
index fa59414586b676ac17899a43c6a822d384b009aa..0b9d4f70d94439fcf120b74ea404f75105a5aa53 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H
@@ -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
@@ -54,12 +54,12 @@ class processorCyclicPolyPatch
 {
     // Private data
 
-        //- Message tag to use for communication
-        const int tag_;
-
         //- Name of originating patch
         const word referPatchName_;
 
+        //- Message tag to use for communication
+        mutable int tag_;
+
         //- Index of originating patch
         mutable label referPatchID_;
 
@@ -264,10 +264,7 @@ public:
         }
 
         //- Return message tag to use for communication
-        virtual int tag() const
-        {
-            return tag_;
-        }
+        virtual int tag() const;
 
         //- Does this side own the patch ?
         virtual bool owner() const
diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C
index 670daa726c17fe5fa9749a516f8372b1b857c4cd..4326d43f38f3f33dd0f7ea35f86a7720e49ee2ac 100644
--- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C
+++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.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
@@ -21,12 +21,50 @@ 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 "syncTools.H"
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
+void Foam::syncTools::swapBoundaryCellPositions
+(
+    const polyMesh& mesh,
+    const UList<point>& cellData,
+    List<point>& neighbourCellData
+)
+{
+    if (cellData.size() != mesh.nCells())
+    {
+        FatalErrorIn
+        (
+            "syncTools<class T>::swapBoundaryCellPositions"
+            "(const polyMesh&, const UList<T>&, List<T>&)"
+        )   << "Number of cell values " << cellData.size()
+            << " is not equal to the number of cells in the mesh "
+            << mesh.nCells() << abort(FatalError);
+    }
+
+    const polyBoundaryMesh& patches = mesh.boundaryMesh();
+
+    label nBnd = mesh.nFaces()-mesh.nInternalFaces();
+
+    neighbourCellData.setSize(nBnd);
+
+    forAll(patches, patchI)
+    {
+        const polyPatch& pp = patches[patchI];
+        const labelUList& faceCells = pp.faceCells();
+        forAll(faceCells, i)
+        {
+            label bFaceI = pp.start()+i-mesh.nInternalFaces();
+            neighbourCellData[bFaceI] = cellData[faceCells[i]];
+        }
+    }
+    syncTools::swapBoundaryFacePositions(mesh, neighbourCellData);
+}
+
+
 Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh)
 {
     PackedBoolList isMasterPoint(mesh.nPoints());
diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H
index 26711f2d0b3b5c87ae4f79208c0da46c8b851a9a..cb1484b3b0f7316358e021ddc31a5eb707545be1 100644
--- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H
+++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H
@@ -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
@@ -65,7 +65,7 @@ class syncTools
     // Private Member Functions
 
         //- Combine value with existing value in map.
-        template <class T, class CombineOp>
+        template<class T, class CombineOp>
         static void combine
         (
             Map<T>& pointValues,
@@ -75,7 +75,7 @@ class syncTools
         );
 
         //- Combine val with existing value at (implicit index) e.
-        template <class T, class CombineOp>
+        template<class T, class CombineOp>
         static void combine
         (
             EdgeMap<T>& edgeValues,
@@ -92,7 +92,7 @@ public:
         // use specialisations below.
 
             //- Synchronize values on selected points.
-            template <class T, class CombineOp, class TransformOp>
+            template<class T, class CombineOp, class TransformOp>
             static void syncPointMap
             (
                 const polyMesh&,
@@ -102,7 +102,7 @@ public:
             );
 
             //- Synchronize values on selected edges.
-            template <class T, class CombineOp, class TransformOp>
+            template<class T, class CombineOp, class TransformOp>
             static void syncEdgeMap
             (
                 const polyMesh&,
@@ -112,7 +112,7 @@ public:
             );
 
             //- Synchronize values on all mesh points.
-            template <class T, class CombineOp, class TransformOp>
+            template<class T, class CombineOp, class TransformOp>
             static void syncPointList
             (
                 const polyMesh&,
@@ -123,7 +123,7 @@ public:
             );
 
             //- Synchronize values on selected mesh points.
-            template <class T, class CombineOp, class TransformOp>
+            template<class T, class CombineOp, class TransformOp>
             static void syncPointList
             (
                 const polyMesh&,
@@ -135,7 +135,7 @@ public:
             );
 
             //- Synchronize values on all mesh edges.
-            template <class T, class CombineOp, class TransformOp>
+            template<class T, class CombineOp, class TransformOp>
             static void syncEdgeList
             (
                 const polyMesh&,
@@ -146,7 +146,7 @@ public:
             );
 
             //- Synchronize values on selected mesh edges.
-            template <class T, class CombineOp, class TransformOp>
+            template<class T, class CombineOp, class TransformOp>
             static void syncEdgeList
             (
                 const polyMesh&,
@@ -158,7 +158,7 @@ public:
             );
 
             //- Synchronize values on boundary faces only.
-            template <class T, class CombineOp, class TransformOp>
+            template<class T, class CombineOp, class TransformOp>
             static void syncBoundaryFaceList
             (
                 const polyMesh&,
@@ -171,7 +171,7 @@ public:
         // Synchronise point-wise data
 
             //- Synchronize values on all mesh points.
-            template <class T, class CombineOp>
+            template<class T, class CombineOp>
             static void syncPointList
             (
                 const polyMesh& mesh,
@@ -191,7 +191,7 @@ public:
             }
 
             //- Synchronize locations on all mesh points.
-            template <class CombineOp>
+            template<class CombineOp>
             static void syncPointPositions
             (
                 const polyMesh& mesh,
@@ -211,7 +211,7 @@ public:
             }
 
             //- Synchronize values on selected mesh points.
-            template <class T, class CombineOp>
+            template<class T, class CombineOp>
             static void syncPointList
             (
                 const polyMesh& mesh,
@@ -233,7 +233,7 @@ public:
             }
 
             //- Synchronize locations on selected mesh points.
-            template <class CombineOp>
+            template<class CombineOp>
             static void syncPointPositions
             (
                 const polyMesh& mesh,
@@ -258,7 +258,7 @@ public:
         // Synchronise edge-wise data
 
             //- Synchronize values on all mesh edges.
-            template <class T, class CombineOp>
+            template<class T, class CombineOp>
             static void syncEdgeList
             (
                 const polyMesh& mesh,
@@ -278,7 +278,7 @@ public:
             }
 
             //- Synchronize locations on all mesh edges.
-            template <class CombineOp>
+            template<class CombineOp>
             static void syncEdgePositions
             (
                 const polyMesh& mesh,
@@ -298,7 +298,7 @@ public:
             }
 
             //- Synchronize values on selected mesh edges.
-            template <class T, class CombineOp>
+            template<class T, class CombineOp>
             static void syncEdgeList
             (
                 const polyMesh& mesh,
@@ -320,7 +320,7 @@ public:
             }
 
             //- Synchronize locations on selected mesh edges.
-            template <class CombineOp>
+            template<class CombineOp>
             static void syncEdgePositions
             (
                 const polyMesh& mesh,
@@ -346,7 +346,7 @@ public:
         // Synchronise face-wise data
 
             //- Synchronize values on boundary faces only.
-            template <class T, class CombineOp>
+            template<class T, class CombineOp>
             static void syncBoundaryFaceList
             (
                 const polyMesh& mesh,
@@ -358,7 +358,7 @@ public:
             }
 
             //- Synchronize locations on boundary faces only.
-            template <class CombineOp>
+            template<class CombineOp>
             static void syncBoundaryFacePositions
             (
                 const polyMesh& mesh,
@@ -376,7 +376,7 @@ public:
             }
 
             //- Synchronize values on all mesh faces.
-            template <class T, class CombineOp>
+            template<class T, class CombineOp>
             static void syncFaceList
             (
                 const polyMesh& mesh,
@@ -401,7 +401,7 @@ public:
             }
 
             //- Synchronize locations on all mesh faces.
-            template <class CombineOp>
+            template<class CombineOp>
             static void syncFacePositions
             (
                 const polyMesh& mesh,
@@ -425,7 +425,7 @@ public:
             }
 
             //- Swap coupled boundary face values.
-            template <class T>
+            template<class T>
             static void swapBoundaryFaceList
             (
                 const polyMesh& mesh,
@@ -442,24 +442,23 @@ public:
             }
 
              //- Swap coupled positions.
-            template <class T>
             static void swapBoundaryFacePositions
             (
                 const polyMesh& mesh,
-                UList<T>& l
+                UList<point>& l
             )
             {
                 syncBoundaryFaceList
                 (
                     mesh,
                     l,
-                    eqOp<T>(),
+                    eqOp<point>(),
                     mapDistribute::transformPosition()
                 );
             }
 
             //- Swap coupled face values.
-            template <class T>
+            template<class T>
             static void swapFaceList
             (
                 const polyMesh& mesh,
@@ -482,7 +481,7 @@ public:
             }
 
             //- Swap to obtain neighbour cell values for all boundary faces
-            template <class T>
+            template<class T>
             static void swapBoundaryCellList
             (
                 const polyMesh& mesh,
@@ -490,10 +489,18 @@ public:
                 List<T>& neighbourCellData
             );
 
+            //- Swap to obtain neighbour cell positions for all boundary faces
+            static void swapBoundaryCellPositions
+            (
+                const polyMesh& mesh,
+                const UList<point>& cellData,
+                List<point>& neighbourCellData
+            );
+
         // Sparse versions
 
             //- Synchronize values on selected points.
-            template <class T, class CombineOp>
+            template<class T, class CombineOp>
             static void syncPointMap
             (
                 const polyMesh& mesh,
@@ -505,7 +512,7 @@ public:
             }
 
             //- Synchronize locations on selected points.
-            template <class CombineOp>
+            template<class CombineOp>
             static void syncPointPositions
             (
                 const polyMesh& mesh,
@@ -519,7 +526,7 @@ public:
             //- Synchronize values on selected edges. Edges are represented
             //  by the two vertices that make it up so global edges never get
             //  constructed.
-            template <class T, class CombineOp>
+            template<class T, class CombineOp>
             static void syncEdgeMap
             (
                 const polyMesh& mesh,
@@ -531,11 +538,11 @@ public:
             }
 
             //- Synchronize locations on selected edges.
-            template <class T, class CombineOp>
+            template<class CombineOp>
             static void syncEdgePositions
             (
                 const polyMesh& mesh,
-                EdgeMap<T>& l,
+                EdgeMap<point>& l,
                 const CombineOp& cop
             )
             {
@@ -544,7 +551,7 @@ public:
 
         // PackedList versions
 
-            template <unsigned nBits, class CombineOp>
+            template<unsigned nBits, class CombineOp>
             static void syncFaceList
             (
                 const polyMesh& mesh,
@@ -552,14 +559,14 @@ public:
                 const CombineOp& cop
             );
 
-            template <unsigned nBits>
+            template<unsigned nBits>
             static void swapFaceList
             (
                 const polyMesh& mesh,
                 PackedList<nBits>& faceValues
             );
 
-            template <unsigned nBits, class CombineOp>
+            template<unsigned nBits, class CombineOp>
             static void syncPointList
             (
                 const polyMesh& mesh,
@@ -568,7 +575,7 @@ public:
                 const unsigned int nullValue
             );
 
-            template <unsigned nBits, class CombineOp>
+            template<unsigned nBits, class CombineOp>
             static void syncEdgeList
             (
                 const polyMesh& mesh,
diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C
index 5d6364a681602c6c0fcf3a7aaa575980dd32b757..f9b90ae0a129f220c7c6ca8151fb57a77d788d9c 100644
--- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C
+++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.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
@@ -21,7 +21,7 @@ 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 "syncTools.H"
 #include "polyMesh.H"
@@ -36,7 +36,7 @@ License
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 // Combine val with existing value at index
-template <class T, class CombineOp>
+template<class T, class CombineOp>
 void Foam::syncTools::combine
 (
     Map<T>& pointValues,
@@ -59,7 +59,7 @@ void Foam::syncTools::combine
 
 
 // Combine val with existing value at (implicit index) e.
-template <class T, class CombineOp>
+template<class T, class CombineOp>
 void Foam::syncTools::combine
 (
     EdgeMap<T>& edgeValues,
@@ -81,7 +81,7 @@ void Foam::syncTools::combine
 }
 
 
-template <class T, class CombineOp, class TransformOp>
+template<class T, class CombineOp, class TransformOp>
 void Foam::syncTools::syncPointMap
 (
     const polyMesh& mesh,
@@ -386,7 +386,7 @@ void Foam::syncTools::syncPointMap
 }
 
 
-template <class T, class CombineOp, class TransformOp>
+template<class T, class CombineOp, class TransformOp>
 void Foam::syncTools::syncEdgeMap
 (
     const polyMesh& mesh,
@@ -761,7 +761,7 @@ void Foam::syncTools::syncEdgeMap
 }
 
 
-//template <class T, class CombineOp, class TransformOp>
+//template<class T, class CombineOp, class TransformOp>
 //void Foam::syncTools::syncPointList
 //(
 //    const polyMesh& mesh,
@@ -937,7 +937,7 @@ void Foam::syncTools::syncEdgeMap
 //}
 
 
-//template <class T, class CombineOp, class TransformOp>
+//template<class T, class CombineOp, class TransformOp>
 //void Foam::syncTools::syncPointList
 //(
 //    const polyMesh& mesh,
@@ -987,7 +987,7 @@ void Foam::syncTools::syncEdgeMap
 //    }
 //}
 
-template <class T, class CombineOp, class TransformOp>
+template<class T, class CombineOp, class TransformOp>
 void Foam::syncTools::syncPointList
 (
     const polyMesh& mesh,
@@ -1013,7 +1013,7 @@ void Foam::syncTools::syncPointList
 }
 
 
-//template <class CombineOp>
+//template<class CombineOp>
 //void Foam::syncTools::syncPointPositions
 //(
 //    const polyMesh& mesh,
@@ -1037,7 +1037,7 @@ void Foam::syncTools::syncPointList
 //}
 
 
-template <class T, class CombineOp, class TransformOp>
+template<class T, class CombineOp, class TransformOp>
 void Foam::syncTools::syncPointList
 (
     const polyMesh& mesh,
@@ -1097,7 +1097,7 @@ void Foam::syncTools::syncPointList
 }
 
 
-//template <class CombineOp>
+//template<class CombineOp>
 //void Foam::syncTools::syncPointPositions
 //(
 //    const polyMesh& mesh,
@@ -1157,7 +1157,7 @@ void Foam::syncTools::syncPointList
 //}
 
 
-template <class T, class CombineOp, class TransformOp>
+template<class T, class CombineOp, class TransformOp>
 void Foam::syncTools::syncEdgeList
 (
     const polyMesh& mesh,
@@ -1204,7 +1204,7 @@ void Foam::syncTools::syncEdgeList
 }
 
 
-//template <class CombineOp>
+//template<class CombineOp>
 //void Foam::syncTools::syncEdgePositions
 //(
 //    const polyMesh& mesh,
@@ -1251,7 +1251,7 @@ void Foam::syncTools::syncEdgeList
 //}
 
 
-template <class T, class CombineOp, class TransformOp>
+template<class T, class CombineOp, class TransformOp>
 void Foam::syncTools::syncEdgeList
 (
     const polyMesh& mesh,
@@ -1310,7 +1310,7 @@ void Foam::syncTools::syncEdgeList
     }
 }
 
-template <class T, class CombineOp, class TransformOp>
+template<class T, class CombineOp, class TransformOp>
 void Foam::syncTools::syncBoundaryFaceList
 (
     const polyMesh& mesh,
@@ -1436,7 +1436,7 @@ void Foam::syncTools::syncBoundaryFaceList
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <unsigned nBits, class CombineOp>
+template<unsigned nBits, class CombineOp>
 void Foam::syncTools::syncFaceList
 (
     const polyMesh& mesh,
@@ -1553,7 +1553,7 @@ void Foam::syncTools::syncFaceList
 }
 
 
-template <class T>
+template<class T>
 void Foam::syncTools::swapBoundaryCellList
 (
     const polyMesh& mesh,
@@ -1592,7 +1592,7 @@ void Foam::syncTools::swapBoundaryCellList
 }
 
 
-template <unsigned nBits>
+template<unsigned nBits>
 void Foam::syncTools::swapFaceList
 (
     const polyMesh& mesh,
@@ -1603,7 +1603,7 @@ void Foam::syncTools::swapFaceList
 }
 
 
-template <unsigned nBits, class CombineOp>
+template<unsigned nBits, class CombineOp>
 void Foam::syncTools::syncPointList
 (
     const polyMesh& mesh,
@@ -1650,7 +1650,7 @@ void Foam::syncTools::syncPointList
 }
 
 
-template <unsigned nBits, class CombineOp>
+template<unsigned nBits, class CombineOp>
 void Foam::syncTools::syncEdgeList
 (
     const polyMesh& mesh,
diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H
index 7a34efcd865b428cae707628114a7c8ce57ebb13..e0800452a177d7cd26cdc1db1f9272e9e75a7d31 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H
+++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H
@@ -270,8 +270,8 @@ public:
     );
 
 
-    //- Gather points and faces onto master and merge (geometrically) into
-    //  single patch.
+    //- Gather points and faces onto master and merge into single patch.
+    //  Note: uses faces/points, not localFaces/localPoints.
     template
     <
         class Face,
diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C
index 89ffdec2ae21668e99e4e90bdb6db9e0774e9700..ee47e50a854efbdcdfae9505b649fae5139ddb5c 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C
+++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -52,7 +52,8 @@ void Foam::PatchTools::gatherAndMerge
     labelList pointSizes;
     {
         List<Field<PointType> > gatheredPoints(Pstream::nProcs());
-        gatheredPoints[Pstream::myProcNo()] = p.localPoints();
+        gatheredPoints[Pstream::myProcNo()] = p.points();
+
         Pstream::gatherList(gatheredPoints);
 
         if (Pstream::master())
@@ -75,7 +76,7 @@ void Foam::PatchTools::gatherAndMerge
     // gathered points
     {
         List<List<Face> > gatheredFaces(Pstream::nProcs());
-        gatheredFaces[Pstream::myProcNo()] = p.localFaces();
+        gatheredFaces[Pstream::myProcNo()] = p;
         Pstream::gatherList(gatheredFaces);
 
         if (Pstream::master())
diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H
index db8f216c2d817705b5fe74fe0950e8c4cdf836ff..354dfa3f99390c3dbe51ad655fd05ffd6e1a2b91 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H
+++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H
@@ -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
@@ -394,7 +394,7 @@ public:
         // Other patch operations
 
             //- Project vertices of patch onto another patch
-            template <class ToPatch>
+            template<class ToPatch>
             List<objectHit> projectPoints
             (
                 const ToPatch& targetPatch,
@@ -404,7 +404,7 @@ public:
             ) const;
 
             //- Project vertices of patch onto another patch
-            template <class ToPatch>
+            template<class ToPatch>
             List<objectHit> projectFaceCentres
             (
                 const ToPatch& targetPatch,
diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchProjectPoints.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchProjectPoints.C
index 2c0115a96cf2e70af230af4630346f338f2de7f6..61dc971e3999f5e208a484456e23fb6f0e94fd9a 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchProjectPoints.C
+++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchProjectPoints.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -41,7 +41,7 @@ template
     class PointField,
     class PointType
 >
-template <class ToPatch>
+template<class ToPatch>
 Foam::List<Foam::objectHit>
 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
 projectPoints
@@ -288,7 +288,7 @@ template
     class PointField,
     class PointType
 >
-template <class ToPatch>
+template<class ToPatch>
 Foam::List<Foam::objectHit>
 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
 projectFaceCentres
diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C
index d805608e4480c11a75c1605a6d5a7b2fe2fb3877..dd506217842a79cbbcdf8932e7a218e767b67959 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C
+++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -64,7 +64,7 @@ bool Foam::primitiveMesh::checkClosedBoundary
 
     for (label faceI = nInternalFaces(); faceI < areas.size(); faceI++)
     {
-        if (internalOrCoupledFaces.size() && !internalOrCoupledFaces[faceI])
+        if (!internalOrCoupledFaces.size() || !internalOrCoupledFaces[faceI])
         {
             sumClosed += areas[faceI];
             sumMagClosedBoundary += mag(areas[faceI]);
diff --git a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H
index 7831e2614befd181ba6331ace1beddaf7b7752ee..e941956d60227e5f1ef56902496f2654c92684ac 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H
+++ b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H b/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H
index 57f6faf2912591d342f5d610279ca6445539f81f..2d64825ed773b75333672f07f0f1e34251f677f7 100644
--- a/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H
+++ b/src/OpenFOAM/primitives/DiagTensor/DiagTensor.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -50,7 +50,7 @@ namespace Foam
                            Class DiagTensor Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class Cmpt>
+template<class Cmpt>
 class DiagTensor
 :
     public VectorSpace<DiagTensor<Cmpt>, Cmpt, 3>
@@ -86,7 +86,8 @@ public:
         inline DiagTensor();
 
         //- Construct given VectorSpace
-        inline DiagTensor(const VectorSpace<DiagTensor<Cmpt>, Cmpt, 3>&);
+        template<class Cmpt2>
+        inline DiagTensor(const VectorSpace<DiagTensor<Cmpt2>, Cmpt2, 3>&);
 
         //- Construct given three components
         inline DiagTensor(const Cmpt& txx, const Cmpt& tyy, const Cmpt& tzz);
diff --git a/src/OpenFOAM/primitives/DiagTensor/DiagTensorI.H b/src/OpenFOAM/primitives/DiagTensor/DiagTensorI.H
index 1f09330bf4a87c0ad0e85e0e96569f2b365f8d5b..4fd082897ae1546d46ea6a7497d3c5e9e8e05b42 100644
--- a/src/OpenFOAM/primitives/DiagTensor/DiagTensorI.H
+++ b/src/OpenFOAM/primitives/DiagTensor/DiagTensorI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -32,25 +32,23 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct null
-template <class Cmpt>
+template<class Cmpt>
 inline DiagTensor<Cmpt>::DiagTensor()
 {}
 
 
-// Construct given VectorSpace
-template <class Cmpt>
+template<class Cmpt>
+template<class Cmpt2>
 inline DiagTensor<Cmpt>::DiagTensor
 (
-    const VectorSpace<DiagTensor<Cmpt>, Cmpt, 3>& vs
+    const VectorSpace<DiagTensor<Cmpt2>, Cmpt2, 3>& vs
 )
 :
     VectorSpace<DiagTensor<Cmpt>, Cmpt, 3>(vs)
 {}
 
 
-// Construct given three Cmpts
-template <class Cmpt>
+template<class Cmpt>
 inline DiagTensor<Cmpt>::DiagTensor
 (
     const Cmpt& vxx,
@@ -64,8 +62,7 @@ inline DiagTensor<Cmpt>::DiagTensor
 }
 
 
-// Construct from Istream
-template <class Cmpt>
+template<class Cmpt>
 inline DiagTensor<Cmpt>::DiagTensor(Istream& is)
 :
     VectorSpace<DiagTensor<Cmpt>, Cmpt, 3>(is)
@@ -74,38 +71,38 @@ inline DiagTensor<Cmpt>::DiagTensor(Istream& is)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  DiagTensor<Cmpt>::xx() const
 {
     return this->v_[XX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  DiagTensor<Cmpt>::yy() const
 {
     return this->v_[YY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  DiagTensor<Cmpt>::zz() const
 {
     return this->v_[ZZ];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& DiagTensor<Cmpt>::xx()
 {
     return this->v_[XX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& DiagTensor<Cmpt>::yy()
 {
     return this->v_[YY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& DiagTensor<Cmpt>::zz()
 {
     return this->v_[ZZ];
@@ -114,7 +111,7 @@ inline Cmpt& DiagTensor<Cmpt>::zz()
 
 // * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator+(const DiagTensor<Cmpt>& dt1, const Tensor<Cmpt>& t2)
 {
@@ -127,7 +124,7 @@ operator+(const DiagTensor<Cmpt>& dt1, const Tensor<Cmpt>& t2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator+(const Tensor<Cmpt>& t1, const DiagTensor<Cmpt>& dt2)
 {
@@ -140,7 +137,7 @@ operator+(const Tensor<Cmpt>& t1, const DiagTensor<Cmpt>& dt2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator-(const DiagTensor<Cmpt>& dt1, const Tensor<Cmpt>& t2)
 {
@@ -153,7 +150,7 @@ operator-(const DiagTensor<Cmpt>& dt1, const Tensor<Cmpt>& t2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator-(const Tensor<Cmpt>& t1, const DiagTensor<Cmpt>& dt2)
 {
@@ -167,7 +164,7 @@ operator-(const Tensor<Cmpt>& t1, const DiagTensor<Cmpt>& dt2)
 
 
 //- Inner-product between two diagonal tensors
-template <class Cmpt>
+template<class Cmpt>
 inline DiagTensor<Cmpt>
 operator&(const DiagTensor<Cmpt>& dt1, const DiagTensor<Cmpt>& dt2)
 {
@@ -181,7 +178,7 @@ operator&(const DiagTensor<Cmpt>& dt1, const DiagTensor<Cmpt>& dt2)
 
 
 //- Inner-product between a diagonal tensor and a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator&(const DiagTensor<Cmpt>& dt1, const Tensor<Cmpt>& t2)
 {
@@ -203,7 +200,7 @@ operator&(const DiagTensor<Cmpt>& dt1, const Tensor<Cmpt>& t2)
 
 
 //- Inner-product between a tensor and a diagonal tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator&(const Tensor<Cmpt>& t1, const DiagTensor<Cmpt>& dt2)
 {
@@ -225,7 +222,7 @@ operator&(const Tensor<Cmpt>& t1, const DiagTensor<Cmpt>& dt2)
 
 
 //- Inner-product between a diagonal tensor and a vector
-template <class Cmpt>
+template<class Cmpt>
 inline Vector<Cmpt>
 operator&(const DiagTensor<Cmpt>& dt, const Vector<Cmpt>& v)
 {
@@ -239,7 +236,7 @@ operator&(const DiagTensor<Cmpt>& dt, const Vector<Cmpt>& v)
 
 
 //- Inner-product between a vector and a diagonal tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Vector<Cmpt>
 operator&(const Vector<Cmpt>& v, const DiagTensor<Cmpt>& dt)
 {
@@ -253,7 +250,7 @@ operator&(const Vector<Cmpt>& v, const DiagTensor<Cmpt>& dt)
 
 
 //- Division of a scalar by a diagonalTensor
-template <class Cmpt>
+template<class Cmpt>
 inline DiagTensor<Cmpt>
 operator/(const scalar s, const DiagTensor<Cmpt>& dt)
 {
@@ -262,7 +259,7 @@ operator/(const scalar s, const DiagTensor<Cmpt>& dt)
 
 
 //- Division of a vector by a diagonalTensor
-template <class Cmpt>
+template<class Cmpt>
 inline Vector<Cmpt>
 operator/(const Vector<Cmpt> v, const DiagTensor<Cmpt>& dt)
 {
@@ -271,7 +268,7 @@ operator/(const Vector<Cmpt> v, const DiagTensor<Cmpt>& dt)
 
 
 //- Return the trace of a diagonal tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt tr(const DiagTensor<Cmpt>& dt)
 {
     return dt.xx() + dt.yy() + dt.zz();
@@ -279,7 +276,7 @@ inline Cmpt tr(const DiagTensor<Cmpt>& dt)
 
 
 //- Return the spherical part of a diagonal tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor<Cmpt> sph(const DiagTensor<Cmpt>& dt)
 {
     return 0.5*tr(dt);
@@ -287,7 +284,7 @@ inline SphericalTensor<Cmpt> sph(const DiagTensor<Cmpt>& dt)
 
 
 //- Return the determinant of a diagonal tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt det(const DiagTensor<Cmpt>& t)
 {
     return t.xx()*t.yy()*t.zz();
@@ -295,7 +292,7 @@ inline Cmpt det(const DiagTensor<Cmpt>& t)
 
 
 //- Return the inverse of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline DiagTensor<Cmpt> inv(const DiagTensor<Cmpt>& dt)
 {
     return DiagTensor<Cmpt>(1.0/dt.xx(), 1.0/dt.yy(), 1.0/dt.zz());
@@ -303,7 +300,7 @@ inline DiagTensor<Cmpt> inv(const DiagTensor<Cmpt>& dt)
 
 
 //- Return the diagonal of a tensor as a diagonal tensor
-template <class Cmpt>
+template<class Cmpt>
 inline DiagTensor<Cmpt> diag(const Tensor<Cmpt>& t)
 {
     return DiagTensor<Cmpt>(t.xx(), t.yy(), t.zz());
diff --git a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H
index ddd4a5f243ffbbc8ab4d20b2fa8827b7e8bde6ae..a2bb56e3f4c96a0398b6ab2ac724fae9af36ff96 100644
--- a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H
+++ b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -91,9 +91,10 @@ public:
         inline SphericalTensor();
 
         //- Construct given VectorSpace
+        template<class Cmpt2>
         inline SphericalTensor
         (
-            const VectorSpace<SphericalTensor<Cmpt>, Cmpt, 1>&
+            const VectorSpace<SphericalTensor<Cmpt2>, Cmpt2, 1>&
         );
 
         //- Construct given the component
diff --git a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensorI.H b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensorI.H
index d0f4014f30d72b85ec3a92289fcd61b1b4b449bb..5db52eb1bb45606184751aed5a987a5c3966977d 100644
--- a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensorI.H
+++ b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensorI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -32,33 +32,30 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct null
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor<Cmpt>::SphericalTensor()
 {}
 
 
-// Construct given VectorSpace
-template <class Cmpt>
+template<class Cmpt>
+template<class Cmpt2>
 inline SphericalTensor<Cmpt>::SphericalTensor
 (
-    const VectorSpace<SphericalTensor<Cmpt>, Cmpt, 1>& vs
+    const VectorSpace<SphericalTensor<Cmpt2>, Cmpt2, 1>& vs
 )
 :
     VectorSpace<SphericalTensor<Cmpt>, Cmpt, 1>(vs)
 {}
 
 
-// Construct given three Cmpts
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor<Cmpt>::SphericalTensor(const Cmpt& stii)
 {
     this->v_[II] = stii;
 }
 
 
-// Construct from Istream
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor<Cmpt>::SphericalTensor(Istream& is)
 :
     VectorSpace<SphericalTensor<Cmpt>, Cmpt, 1>(is)
@@ -67,21 +64,21 @@ inline SphericalTensor<Cmpt>::SphericalTensor(Istream& is)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  SphericalTensor<Cmpt>::ii() const
 {
     return this->v_[II];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& SphericalTensor<Cmpt>::ii()
 {
     return this->v_[II];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline const SphericalTensor<Cmpt>& SphericalTensor<Cmpt>::T() const
 {
     return *this;
@@ -91,7 +88,7 @@ inline const SphericalTensor<Cmpt>& SphericalTensor<Cmpt>::T() const
 // * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
 
 //- Inner-product between two spherical tensors
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor<Cmpt>
 operator&(const SphericalTensor<Cmpt>& st1, const SphericalTensor<Cmpt>& st2)
 {
@@ -100,7 +97,7 @@ operator&(const SphericalTensor<Cmpt>& st1, const SphericalTensor<Cmpt>& st2)
 
 
 //- Inner-product between a spherical tensor and a vector
-template <class Cmpt>
+template<class Cmpt>
 inline Vector<Cmpt>
 operator&(const SphericalTensor<Cmpt>& st, const Vector<Cmpt>& v)
 {
@@ -114,7 +111,7 @@ operator&(const SphericalTensor<Cmpt>& st, const Vector<Cmpt>& v)
 
 
 //- Inner-product between a vector and a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Vector<Cmpt>
 operator&(const Vector<Cmpt>& v, const SphericalTensor<Cmpt>& st)
 {
@@ -128,7 +125,7 @@ operator&(const Vector<Cmpt>& v, const SphericalTensor<Cmpt>& st)
 
 
 //- Double-dot-product between a spherical tensor and a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt
 operator&&(const SphericalTensor<Cmpt>& st1, const SphericalTensor<Cmpt>& st2)
 {
@@ -137,7 +134,7 @@ operator&&(const SphericalTensor<Cmpt>& st1, const SphericalTensor<Cmpt>& st2)
 
 
 //- Division of a scalar by a sphericalTensor
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor<Cmpt>
 operator/(const scalar s, const SphericalTensor<Cmpt>& st)
 {
@@ -145,7 +142,7 @@ operator/(const scalar s, const SphericalTensor<Cmpt>& st)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt magSqr(const SphericalTensor<Cmpt>& st)
 {
     return 3*magSqr(st.ii());
@@ -153,7 +150,7 @@ inline Cmpt magSqr(const SphericalTensor<Cmpt>& st)
 
 
 //- Return the trace of a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt tr(const SphericalTensor<Cmpt>& st)
 {
     return 3*st.ii();
@@ -161,7 +158,7 @@ inline Cmpt tr(const SphericalTensor<Cmpt>& st)
 
 
 //- Return the spherical part of a spherical tensor, i.e. itself
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor<Cmpt> sph(const SphericalTensor<Cmpt>& st)
 {
     return st;
@@ -169,7 +166,7 @@ inline SphericalTensor<Cmpt> sph(const SphericalTensor<Cmpt>& st)
 
 
 //- Return the determinant of a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt det(const SphericalTensor<Cmpt>& st)
 {
     return st.ii()*st.ii()*st.ii();
@@ -177,7 +174,7 @@ inline Cmpt det(const SphericalTensor<Cmpt>& st)
 
 
 //- Return the inverse of a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor<Cmpt> inv(const SphericalTensor<Cmpt>& st)
 {
     return SphericalTensor<Cmpt>(1.0/st.ii());
diff --git a/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2DI.H b/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2DI.H
index 42007e199ad79d571257fd16ab58c88eef85db15..389180fe5cd495c93e5e810c83d173ccb0c165d8 100644
--- a/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2DI.H
+++ b/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2DI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -33,13 +33,13 @@ namespace Foam
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 // Construct null
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor2D<Cmpt>::SphericalTensor2D()
 {}
 
 
 // Construct given VectorSpace
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor2D<Cmpt>::SphericalTensor2D
 (
     const VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>& vs
@@ -50,7 +50,7 @@ inline SphericalTensor2D<Cmpt>::SphericalTensor2D
 
 
 // Construct given three Cmpts
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor2D<Cmpt>::SphericalTensor2D(const Cmpt& stii)
 {
     this->v_[II] = stii;
@@ -58,7 +58,7 @@ inline SphericalTensor2D<Cmpt>::SphericalTensor2D(const Cmpt& stii)
 
 
 // Construct from Istream
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor2D<Cmpt>::SphericalTensor2D(Istream& is)
 :
     VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>(is)
@@ -67,14 +67,14 @@ inline SphericalTensor2D<Cmpt>::SphericalTensor2D(Istream& is)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  SphericalTensor2D<Cmpt>::ii() const
 {
     return this->v_[II];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& SphericalTensor2D<Cmpt>::ii()
 {
     return this->v_[II];
@@ -84,7 +84,7 @@ inline Cmpt& SphericalTensor2D<Cmpt>::ii()
 // * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
 
 //- Inner-product between two spherical tensors
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor2D<Cmpt>
 operator&
 (
@@ -97,7 +97,7 @@ operator&
 
 
 //- Inner-product between a spherical tensor and a vector
-template <class Cmpt>
+template<class Cmpt>
 inline Vector2D<Cmpt>
 operator&(const SphericalTensor2D<Cmpt>& st, const Vector2D<Cmpt>& v)
 {
@@ -110,7 +110,7 @@ operator&(const SphericalTensor2D<Cmpt>& st, const Vector2D<Cmpt>& v)
 
 
 //- Inner-product between a vector and a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Vector2D<Cmpt>
 operator&(const Vector2D<Cmpt>& v, const SphericalTensor2D<Cmpt>& st)
 {
@@ -123,7 +123,7 @@ operator&(const Vector2D<Cmpt>& v, const SphericalTensor2D<Cmpt>& st)
 
 
 //- Division of a scalar by a sphericalTensor2D
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor2D<Cmpt>
 operator/(const scalar s, const SphericalTensor2D<Cmpt>& st)
 {
@@ -132,7 +132,7 @@ operator/(const scalar s, const SphericalTensor2D<Cmpt>& st)
 
 
 //- Return the trace of a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt tr(const SphericalTensor2D<Cmpt>& st)
 {
     return 2*st.ii();
@@ -140,7 +140,7 @@ inline Cmpt tr(const SphericalTensor2D<Cmpt>& st)
 
 
 //- Return the spherical part of a spherical tensor, i.e. itself
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor2D<Cmpt> sph(const SphericalTensor2D<Cmpt>& st)
 {
     return st;
@@ -148,7 +148,7 @@ inline SphericalTensor2D<Cmpt> sph(const SphericalTensor2D<Cmpt>& st)
 
 
 //- Return the determinant of a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt det(const SphericalTensor2D<Cmpt>& st)
 {
     return st.ii()*st.ii();
@@ -156,7 +156,7 @@ inline Cmpt det(const SphericalTensor2D<Cmpt>& st)
 
 
 //- Return the inverse of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor2D<Cmpt> inv(const SphericalTensor2D<Cmpt>& st)
 {
     return SphericalTensor2D<Cmpt>(1.0/st.ii());
diff --git a/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H b/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H
index 07eaba880da82dd0c7b158ce971c1227a497aa6f..afa1dbb622f14964f1e1390071699166444ec9cb 100644
--- a/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H
+++ b/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H
@@ -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
@@ -50,7 +50,7 @@ namespace Foam
                            Class SymmTensor Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class Cmpt>
+template<class Cmpt>
 class SymmTensor
 :
     public VectorSpace<SymmTensor<Cmpt>, Cmpt, 6>
@@ -91,8 +91,9 @@ public:
         //- Construct null
         inline SymmTensor();
 
-        //- Construct given VectorSpace
-        inline SymmTensor(const VectorSpace<SymmTensor<Cmpt>, Cmpt, 6>&);
+        //- Construct given VectorSpace of the same rank
+        template<class Cmpt2>
+        inline SymmTensor(const VectorSpace<SymmTensor<Cmpt2>, Cmpt2, 6>&);
 
         //- Construct given SphericalTensor
         inline SymmTensor(const SphericalTensor<Cmpt>&);
diff --git a/src/OpenFOAM/primitives/SymmTensor/SymmTensorI.H b/src/OpenFOAM/primitives/SymmTensor/SymmTensorI.H
index 4566cc7550897d5625a52ca7c12c73c1f7425a13..dce79844d803b88122654c29c34df3ded71c64fc 100644
--- a/src/OpenFOAM/primitives/SymmTensor/SymmTensorI.H
+++ b/src/OpenFOAM/primitives/SymmTensor/SymmTensorI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -33,22 +33,23 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt>::SymmTensor()
 {}
 
 
-template <class Cmpt>
+template<class Cmpt>
+template<class Cmpt2>
 inline SymmTensor<Cmpt>::SymmTensor
 (
-    const VectorSpace<SymmTensor<Cmpt>, Cmpt, 6>& vs
+    const VectorSpace<SymmTensor<Cmpt2>, Cmpt2, 6>& vs
 )
 :
     VectorSpace<SymmTensor<Cmpt>, Cmpt, 6>(vs)
 {}
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt>::SymmTensor(const SphericalTensor<Cmpt>& st)
 {
     this->v_[XX] = st.ii(); this->v_[XY] = 0;       this->v_[XZ] = 0;
@@ -57,7 +58,7 @@ inline SymmTensor<Cmpt>::SymmTensor(const SphericalTensor<Cmpt>& st)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt>::SymmTensor
 (
     const Cmpt txx, const Cmpt txy, const Cmpt txz,
@@ -71,7 +72,7 @@ inline SymmTensor<Cmpt>::SymmTensor
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt>::SymmTensor(Istream& is)
 :
     VectorSpace<SymmTensor<Cmpt>, Cmpt, 6>(is)
@@ -80,81 +81,81 @@ inline SymmTensor<Cmpt>::SymmTensor(Istream& is)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  SymmTensor<Cmpt>::xx() const
 {
     return this->v_[XX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  SymmTensor<Cmpt>::xy() const
 {
     return this->v_[XY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  SymmTensor<Cmpt>::xz() const
 {
     return this->v_[XZ];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  SymmTensor<Cmpt>::yy() const
 {
     return this->v_[YY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  SymmTensor<Cmpt>::yz() const
 {
     return this->v_[YZ];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  SymmTensor<Cmpt>::zz() const
 {
     return this->v_[ZZ];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& SymmTensor<Cmpt>::xx()
 {
     return this->v_[XX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& SymmTensor<Cmpt>::xy()
 {
     return this->v_[XY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& SymmTensor<Cmpt>::xz()
 {
     return this->v_[XZ];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& SymmTensor<Cmpt>::yy()
 {
     return this->v_[YY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& SymmTensor<Cmpt>::yz()
 {
     return this->v_[YZ];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& SymmTensor<Cmpt>::zz()
 {
     return this->v_[ZZ];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline const SymmTensor<Cmpt>& SymmTensor<Cmpt>::T() const
 {
     return *this;
@@ -163,7 +164,7 @@ inline const SymmTensor<Cmpt>& SymmTensor<Cmpt>::T() const
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline void SymmTensor<Cmpt>::operator=(const SphericalTensor<Cmpt>& st)
 {
     this->v_[XX] = st.ii(); this->v_[XY] = 0;       this->v_[XZ] = 0;
@@ -176,7 +177,7 @@ inline void SymmTensor<Cmpt>::operator=(const SphericalTensor<Cmpt>& st)
 // * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
 
 //- Hodge Dual operator (tensor -> vector)
-template <class Cmpt>
+template<class Cmpt>
 inline Vector<Cmpt> operator*(const SymmTensor<Cmpt>& st)
 {
     return Vector<Cmpt>(st.yz(), -st.xz(), st.xy());
@@ -184,7 +185,7 @@ inline Vector<Cmpt> operator*(const SymmTensor<Cmpt>& st)
 
 
 //- Inner-product between two symmetric tensors
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator&(const SymmTensor<Cmpt>& st1, const SymmTensor<Cmpt>& st2)
 {
@@ -206,7 +207,7 @@ operator&(const SymmTensor<Cmpt>& st1, const SymmTensor<Cmpt>& st2)
 
 
 //- Double-dot-product between a symmetric tensor and a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt
 operator&&(const SymmTensor<Cmpt>& st1, const SymmTensor<Cmpt>& st2)
 {
@@ -220,7 +221,7 @@ operator&&(const SymmTensor<Cmpt>& st1, const SymmTensor<Cmpt>& st2)
 
 
 //- Inner-product between a symmetric tensor and a vector
-template <class Cmpt>
+template<class Cmpt>
 inline Vector<Cmpt>
 operator&(const SymmTensor<Cmpt>& st, const Vector<Cmpt>& v)
 {
@@ -234,7 +235,7 @@ operator&(const SymmTensor<Cmpt>& st, const Vector<Cmpt>& v)
 
 
 //- Inner-product between a vector and a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Vector<Cmpt>
 operator&(const Vector<Cmpt>& v, const SymmTensor<Cmpt>& st)
 {
@@ -247,7 +248,7 @@ operator&(const Vector<Cmpt>& v, const SymmTensor<Cmpt>& st)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt magSqr(const SymmTensor<Cmpt>& st)
 {
     return
@@ -260,7 +261,7 @@ inline Cmpt magSqr(const SymmTensor<Cmpt>& st)
 
 
 //- Return the trace of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt tr(const SymmTensor<Cmpt>& st)
 {
     return st.xx() + st.yy() + st.zz();
@@ -268,7 +269,7 @@ inline Cmpt tr(const SymmTensor<Cmpt>& st)
 
 
 //- Return the spherical part of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor<Cmpt> sph(const SymmTensor<Cmpt>& st)
 {
     return (1.0/3.0)*tr(st);
@@ -276,7 +277,7 @@ inline SphericalTensor<Cmpt> sph(const SymmTensor<Cmpt>& st)
 
 
 //- Return the symmetric part of a symmetric tensor, i.e. itself
-template <class Cmpt>
+template<class Cmpt>
 inline const SymmTensor<Cmpt>& symm(const SymmTensor<Cmpt>& st)
 {
     return st;
@@ -284,7 +285,7 @@ inline const SymmTensor<Cmpt>& symm(const SymmTensor<Cmpt>& st)
 
 
 //- Return twice the symmetric part of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt> twoSymm(const SymmTensor<Cmpt>& st)
 {
     return 2*st;
@@ -292,7 +293,7 @@ inline SymmTensor<Cmpt> twoSymm(const SymmTensor<Cmpt>& st)
 
 
 //- Return the deviatoric part of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt> dev(const SymmTensor<Cmpt>& st)
 {
     return st - SphericalTensor<Cmpt>::oneThirdI*tr(st);
@@ -300,7 +301,7 @@ inline SymmTensor<Cmpt> dev(const SymmTensor<Cmpt>& st)
 
 
 //- Return the deviatoric part of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt> dev2(const SymmTensor<Cmpt>& st)
 {
     return st - SphericalTensor<Cmpt>::twoThirdsI*tr(st);
@@ -308,7 +309,7 @@ inline SymmTensor<Cmpt> dev2(const SymmTensor<Cmpt>& st)
 
 
 //- Return the determinant of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt det(const SymmTensor<Cmpt>& st)
 {
     return
@@ -321,7 +322,7 @@ inline Cmpt det(const SymmTensor<Cmpt>& st)
 
 
 //- Return the cofactor symmetric tensor of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt> cof(const SymmTensor<Cmpt>& st)
 {
     return SymmTensor<Cmpt>
@@ -339,7 +340,7 @@ inline SymmTensor<Cmpt> cof(const SymmTensor<Cmpt>& st)
 
 
 //- Return the inverse of a symmetric tensor give the determinant
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt> inv(const SymmTensor<Cmpt>& st, const Cmpt detst)
 {
     return SymmTensor<Cmpt>
@@ -357,7 +358,7 @@ inline SymmTensor<Cmpt> inv(const SymmTensor<Cmpt>& st, const Cmpt detst)
 
 
 //- Return the inverse of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt> inv(const SymmTensor<Cmpt>& st)
 {
     return inv(st, det(st));
@@ -365,7 +366,7 @@ inline SymmTensor<Cmpt> inv(const SymmTensor<Cmpt>& st)
 
 
 //- Return the 1st invariant of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt invariantI(const SymmTensor<Cmpt>& st)
 {
     return tr(st);
@@ -373,7 +374,7 @@ inline Cmpt invariantI(const SymmTensor<Cmpt>& st)
 
 
 //- Return the 2nd invariant of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt invariantII(const SymmTensor<Cmpt>& st)
 {
     return
@@ -390,14 +391,14 @@ inline Cmpt invariantII(const SymmTensor<Cmpt>& st)
 
 
 //- Return the 3rd invariant of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt invariantIII(const SymmTensor<Cmpt>& st)
 {
     return det(st);
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt>
 operator+(const SphericalTensor<Cmpt>& spt1, const SymmTensor<Cmpt>& st2)
 {
@@ -410,7 +411,7 @@ operator+(const SphericalTensor<Cmpt>& spt1, const SymmTensor<Cmpt>& st2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt>
 operator+(const SymmTensor<Cmpt>& st1, const SphericalTensor<Cmpt>& spt2)
 {
@@ -423,7 +424,7 @@ operator+(const SymmTensor<Cmpt>& st1, const SphericalTensor<Cmpt>& spt2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt>
 operator-(const SphericalTensor<Cmpt>& spt1, const SymmTensor<Cmpt>& st2)
 {
@@ -436,7 +437,7 @@ operator-(const SphericalTensor<Cmpt>& spt1, const SymmTensor<Cmpt>& st2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt>
 operator-(const SymmTensor<Cmpt>& st1, const SphericalTensor<Cmpt>& spt2)
 {
@@ -450,7 +451,7 @@ operator-(const SymmTensor<Cmpt>& st1, const SphericalTensor<Cmpt>& spt2)
 
 
 //- Inner-product between a spherical symmetric tensor and a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt>
 operator&(const SphericalTensor<Cmpt>& spt1, const SymmTensor<Cmpt>& st2)
 {
@@ -464,7 +465,7 @@ operator&(const SphericalTensor<Cmpt>& spt1, const SymmTensor<Cmpt>& st2)
 
 
 //- Inner-product between a tensor and a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt>
 operator&(const SymmTensor<Cmpt>& st1, const SphericalTensor<Cmpt>& spt2)
 {
@@ -478,7 +479,7 @@ operator&(const SymmTensor<Cmpt>& st1, const SphericalTensor<Cmpt>& spt2)
 
 
 //- Double-dot-product between a spherical tensor and a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt
 operator&&(const SphericalTensor<Cmpt>& spt1, const SymmTensor<Cmpt>& st2)
 {
@@ -487,7 +488,7 @@ operator&&(const SphericalTensor<Cmpt>& spt1, const SymmTensor<Cmpt>& st2)
 
 
 //- Double-dot-product between a tensor and a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt
 operator&&(const SymmTensor<Cmpt>& st1, const SphericalTensor<Cmpt>& spt2)
 {
@@ -495,7 +496,7 @@ operator&&(const SymmTensor<Cmpt>& st1, const SphericalTensor<Cmpt>& spt2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt> sqr(const Vector<Cmpt>& v)
 {
     return SymmTensor<Cmpt>
diff --git a/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.H b/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.H
index 6e0c39b512457e26fb1726b5d011a0abfe6d4089..550e9bfec077a685430de6a61551bfe02addbff9 100644
--- a/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.H
+++ b/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.H
@@ -50,7 +50,7 @@ namespace Foam
                          Class SymmTensor2D Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class Cmpt>
+template<class Cmpt>
 class SymmTensor2D
 :
     public VectorSpace<SymmTensor2D<Cmpt>, Cmpt, 3>
diff --git a/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2DI.H b/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2DI.H
index 89d489a62efe8a8419eb82c5c227d25f2391fee2..e021707370661f8901651a92c2cf9889555dd157 100644
--- a/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2DI.H
+++ b/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2DI.H
@@ -33,12 +33,12 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt>::SymmTensor2D()
 {}
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt>::SymmTensor2D
 (
     const VectorSpace<SymmTensor2D<Cmpt>, Cmpt, 3>& vs
@@ -48,7 +48,7 @@ inline SymmTensor2D<Cmpt>::SymmTensor2D
 {}
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt>::SymmTensor2D(const SphericalTensor2D<Cmpt>& st)
 {
     this->v_[XX] = st.ii(); this->v_[XY] = 0;
@@ -56,7 +56,7 @@ inline SymmTensor2D<Cmpt>::SymmTensor2D(const SphericalTensor2D<Cmpt>& st)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt>::SymmTensor2D
 (
     const Cmpt txx, const Cmpt txy,
@@ -68,7 +68,7 @@ inline SymmTensor2D<Cmpt>::SymmTensor2D
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt>::SymmTensor2D(Istream& is)
 :
     VectorSpace<SymmTensor2D<Cmpt>, Cmpt, 3>(is)
@@ -77,45 +77,45 @@ inline SymmTensor2D<Cmpt>::SymmTensor2D(Istream& is)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt& SymmTensor2D<Cmpt>::xx() const
 {
     return this->v_[XX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt& SymmTensor2D<Cmpt>::xy() const
 {
     return this->v_[XY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt& SymmTensor2D<Cmpt>::yy() const
 {
     return this->v_[YY];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& SymmTensor2D<Cmpt>::xx()
 {
     return this->v_[XX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& SymmTensor2D<Cmpt>::xy()
 {
     return this->v_[XY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& SymmTensor2D<Cmpt>::yy()
 {
     return this->v_[YY];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline const SymmTensor2D<Cmpt>& SymmTensor2D<Cmpt>::T() const
 {
     return *this;
@@ -124,7 +124,7 @@ inline const SymmTensor2D<Cmpt>& SymmTensor2D<Cmpt>::T() const
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline void SymmTensor2D<Cmpt>::operator=(const SphericalTensor2D<Cmpt>& st)
 {
     this->v_[XX] = st.ii(); this->v_[XY] = 0;
@@ -135,7 +135,7 @@ inline void SymmTensor2D<Cmpt>::operator=(const SphericalTensor2D<Cmpt>& st)
 // * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
 
 //- Inner-product between two symmetric tensors
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>
 operator&(const SymmTensor2D<Cmpt>& st1, const SymmTensor2D<Cmpt>& st2)
 {
@@ -151,7 +151,7 @@ operator&(const SymmTensor2D<Cmpt>& st1, const SymmTensor2D<Cmpt>& st2)
 
 
 //- Double-dot-product between a symmetric tensor and a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt
 operator&&(const SymmTensor2D<Cmpt>& st1, const SymmTensor2D<Cmpt>& st2)
 {
@@ -164,7 +164,7 @@ operator&&(const SymmTensor2D<Cmpt>& st1, const SymmTensor2D<Cmpt>& st2)
 
 
 //- Inner-product between a symmetric tensor and a vector
-template <class Cmpt>
+template<class Cmpt>
 inline Vector2D<Cmpt>
 operator&(const SymmTensor2D<Cmpt>& st, const Vector2D<Cmpt>& v)
 {
@@ -177,7 +177,7 @@ operator&(const SymmTensor2D<Cmpt>& st, const Vector2D<Cmpt>& v)
 
 
 //- Inner-product between a vector and a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Vector2D<Cmpt>
 operator&(const Vector2D<Cmpt>& v, const SymmTensor2D<Cmpt>& st)
 {
@@ -189,7 +189,7 @@ operator&(const Vector2D<Cmpt>& v, const SymmTensor2D<Cmpt>& st)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt magSqr(const SymmTensor2D<Cmpt>& st)
 {
     return
@@ -201,7 +201,7 @@ inline Cmpt magSqr(const SymmTensor2D<Cmpt>& st)
 
 
 //- Return the trace of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt tr(const SymmTensor2D<Cmpt>& st)
 {
     return st.xx() + st.yy();
@@ -209,7 +209,7 @@ inline Cmpt tr(const SymmTensor2D<Cmpt>& st)
 
 
 //- Return the spherical part of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor2D<Cmpt> sph(const SymmTensor2D<Cmpt>& st)
 {
     return (1.0/2.0)*tr(st);
@@ -217,7 +217,7 @@ inline SphericalTensor2D<Cmpt> sph(const SymmTensor2D<Cmpt>& st)
 
 
 //- Return the symmetric part of a symmetric tensor, i.e. itself
-template <class Cmpt>
+template<class Cmpt>
 inline const SymmTensor2D<Cmpt>& symm(const SymmTensor2D<Cmpt>& st)
 {
     return st;
@@ -225,7 +225,7 @@ inline const SymmTensor2D<Cmpt>& symm(const SymmTensor2D<Cmpt>& st)
 
 
 //- Return twice the symmetric part of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt> twoSymm(const SymmTensor2D<Cmpt>& st)
 {
     return 2*st;
@@ -233,7 +233,7 @@ inline SymmTensor2D<Cmpt> twoSymm(const SymmTensor2D<Cmpt>& st)
 
 
 //- Return the deviatoric part of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt> dev(const SymmTensor2D<Cmpt>& st)
 {
     return st - SphericalTensor2D<Cmpt>::oneThirdI*tr(st);
@@ -241,7 +241,7 @@ inline SymmTensor2D<Cmpt> dev(const SymmTensor2D<Cmpt>& st)
 
 
 //- Return the deviatoric part of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt> dev2(const SymmTensor2D<Cmpt>& st)
 {
     return st - SphericalTensor2D<Cmpt>::twoThirdsI*tr(st);
@@ -249,7 +249,7 @@ inline SymmTensor2D<Cmpt> dev2(const SymmTensor2D<Cmpt>& st)
 
 
 //- Return the determinant of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt det(const SymmTensor2D<Cmpt>& st)
 {
     return
@@ -260,7 +260,7 @@ inline Cmpt det(const SymmTensor2D<Cmpt>& st)
 
 
 //- Return the cofactor symmetric tensor of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt> cof(const SymmTensor2D<Cmpt>& st)
 {
     return SymmTensor2D<Cmpt>
@@ -272,7 +272,7 @@ inline SymmTensor2D<Cmpt> cof(const SymmTensor2D<Cmpt>& st)
 
 
 //- Return the inverse of a symmetric tensor give the determinant
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt> inv(const SymmTensor2D<Cmpt>& st, const Cmpt detst)
 {
     return cof(st)/detst;
@@ -280,7 +280,7 @@ inline SymmTensor2D<Cmpt> inv(const SymmTensor2D<Cmpt>& st, const Cmpt detst)
 
 
 //- Return the inverse of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt> inv(const SymmTensor2D<Cmpt>& st)
 {
     return inv(st, det(st));
@@ -288,7 +288,7 @@ inline SymmTensor2D<Cmpt> inv(const SymmTensor2D<Cmpt>& st)
 
 
 //- Return the 1st invariant of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt invariantI(const SymmTensor2D<Cmpt>& st)
 {
     return tr(st);
@@ -296,7 +296,7 @@ inline Cmpt invariantI(const SymmTensor2D<Cmpt>& st)
 
 
 //- Return the 2nd invariant of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt invariantII(const SymmTensor2D<Cmpt>& st)
 {
     return
@@ -312,14 +312,14 @@ inline Cmpt invariantII(const SymmTensor2D<Cmpt>& st)
 
 
 //- Return the 3rd invariant of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt invariantIII(const SymmTensor2D<Cmpt>& st)
 {
     return det(st);
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt>
 operator+(const SphericalTensor2D<Cmpt>& spt1, const SymmTensor2D<Cmpt>& st2)
 {
@@ -331,7 +331,7 @@ operator+(const SphericalTensor2D<Cmpt>& spt1, const SymmTensor2D<Cmpt>& st2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt>
 operator+(const SymmTensor2D<Cmpt>& st1, const SphericalTensor2D<Cmpt>& spt2)
 {
@@ -343,7 +343,7 @@ operator+(const SymmTensor2D<Cmpt>& st1, const SphericalTensor2D<Cmpt>& spt2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt>
 operator-(const SphericalTensor2D<Cmpt>& spt1, const SymmTensor2D<Cmpt>& st2)
 {
@@ -355,7 +355,7 @@ operator-(const SphericalTensor2D<Cmpt>& spt1, const SymmTensor2D<Cmpt>& st2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt>
 operator-(const SymmTensor2D<Cmpt>& st1, const SphericalTensor2D<Cmpt>& spt2)
 {
@@ -368,7 +368,7 @@ operator-(const SymmTensor2D<Cmpt>& st1, const SphericalTensor2D<Cmpt>& spt2)
 
 
 //- Inner-product between a spherical symmetric tensor and a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt>
 operator&(const SphericalTensor2D<Cmpt>& spt1, const SymmTensor2D<Cmpt>& st2)
 {
@@ -381,7 +381,7 @@ operator&(const SphericalTensor2D<Cmpt>& spt1, const SymmTensor2D<Cmpt>& st2)
 
 
 //- Inner-product between a tensor and a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt>
 operator&(const SymmTensor2D<Cmpt>& st1, const SphericalTensor2D<Cmpt>& spt2)
 {
@@ -394,7 +394,7 @@ operator&(const SymmTensor2D<Cmpt>& st1, const SphericalTensor2D<Cmpt>& spt2)
 
 
 //- Double-dot-product between a spherical tensor and a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt
 operator&&(const SphericalTensor2D<Cmpt>& spt1, const SymmTensor2D<Cmpt>& st2)
 {
@@ -403,7 +403,7 @@ operator&&(const SphericalTensor2D<Cmpt>& spt1, const SymmTensor2D<Cmpt>& st2)
 
 
 //- Double-dot-product between a tensor and a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt
 operator&&(const SymmTensor2D<Cmpt>& st1, const SphericalTensor2D<Cmpt>& spt2)
 {
@@ -411,7 +411,7 @@ operator&&(const SymmTensor2D<Cmpt>& st1, const SphericalTensor2D<Cmpt>& spt2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt> sqr(const Vector2D<Cmpt>& v)
 {
     return SymmTensor2D<Cmpt>
diff --git a/src/OpenFOAM/primitives/Tensor/Tensor.H b/src/OpenFOAM/primitives/Tensor/Tensor.H
index 94b567d532b08ce10c40afbd255ac0b47400735e..4a82e7ba2fa0b63cddf1174e5d78d59339e9efab 100644
--- a/src/OpenFOAM/primitives/Tensor/Tensor.H
+++ b/src/OpenFOAM/primitives/Tensor/Tensor.H
@@ -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
@@ -53,7 +53,7 @@ class SymmTensor;
                            Class Tensor Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class Cmpt>
+template<class Cmpt>
 class Tensor
 :
     public VectorSpace<Tensor<Cmpt>, Cmpt, 9>
@@ -94,8 +94,9 @@ public:
         //- Construct null
         inline Tensor();
 
-        //- Construct given VectorSpace
-        inline Tensor(const VectorSpace<Tensor<Cmpt>, Cmpt, 9>&);
+        //- Construct given VectorSpace of the same rank
+        template<class Cmpt2>
+        inline Tensor(const VectorSpace<Tensor<Cmpt2>, Cmpt2, 9>&);
 
         //- Construct given SphericalTensor
         inline Tensor(const SphericalTensor<Cmpt>&);
diff --git a/src/OpenFOAM/primitives/Tensor/TensorI.H b/src/OpenFOAM/primitives/Tensor/TensorI.H
index 416507e6b758ccee0e9fdb44a8584fb37bd8c76d..06c52b75c33c1e7f69e8c6404133ef1a8fad1f25 100644
--- a/src/OpenFOAM/primitives/Tensor/TensorI.H
+++ b/src/OpenFOAM/primitives/Tensor/TensorI.H
@@ -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
@@ -32,22 +32,20 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-//- Construct null
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>::Tensor()
 {}
 
 
-//- Construct given VectorSpace
-template <class Cmpt>
-inline Tensor<Cmpt>::Tensor(const VectorSpace<Tensor<Cmpt>, Cmpt, 9>& vs)
+template<class Cmpt>
+template<class Cmpt2>
+inline Tensor<Cmpt>::Tensor(const VectorSpace<Tensor<Cmpt2>, Cmpt2, 9>& vs)
 :
     VectorSpace<Tensor<Cmpt>, Cmpt, 9>(vs)
 {}
 
 
-//- Construct given SphericalTensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>::Tensor(const SphericalTensor<Cmpt>& st)
 {
     this->v_[XX] = st.ii(); this->v_[XY] = 0; this->v_[XZ] = 0;
@@ -56,8 +54,7 @@ inline Tensor<Cmpt>::Tensor(const SphericalTensor<Cmpt>& st)
 }
 
 
-//- Construct given SymmTensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>::Tensor(const SymmTensor<Cmpt>& st)
 {
     this->v_[XX] = st.xx(); this->v_[XY] = st.xy(); this->v_[XZ] = st.xz();
@@ -66,8 +63,7 @@ inline Tensor<Cmpt>::Tensor(const SymmTensor<Cmpt>& st)
 }
 
 
-//- Construct given triad
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>::Tensor(const Vector<Vector<Cmpt> >& tr)
 {
     this->v_[XX] = tr.x().x();
@@ -84,8 +80,7 @@ inline Tensor<Cmpt>::Tensor(const Vector<Vector<Cmpt> >& tr)
 }
 
 
-//- Construct given the three vector components
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>::Tensor
 (
     const Vector<Cmpt>& x,
@@ -99,8 +94,7 @@ inline Tensor<Cmpt>::Tensor
 }
 
 
-//- Construct from components
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>::Tensor
 (
     const Cmpt txx, const Cmpt txy, const Cmpt txz,
@@ -114,8 +108,7 @@ inline Tensor<Cmpt>::Tensor
 }
 
 
-//- Construct from Istream
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>::Tensor(Istream& is)
 :
     VectorSpace<Tensor<Cmpt>, Cmpt, 9>(is)
@@ -124,133 +117,133 @@ inline Tensor<Cmpt>::Tensor(Istream& is)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Vector<Cmpt> Tensor<Cmpt>::x() const
 {
     return Vector<Cmpt>(this->v_[XX], this->v_[XY], this->v_[XZ]);
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Vector<Cmpt> Tensor<Cmpt>::y() const
 {
     return Vector<Cmpt>(this->v_[YX], this->v_[YY], this->v_[YZ]);
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Vector<Cmpt>  Tensor<Cmpt>::z() const
 {
     return Vector<Cmpt>(this->v_[ZX], this->v_[ZY], this->v_[ZZ]);
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  Tensor<Cmpt>::xx() const
 {
     return this->v_[XX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  Tensor<Cmpt>::xy() const
 {
     return this->v_[XY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  Tensor<Cmpt>::xz() const
 {
     return this->v_[XZ];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  Tensor<Cmpt>::yx() const
 {
     return this->v_[YX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  Tensor<Cmpt>::yy() const
 {
     return this->v_[YY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  Tensor<Cmpt>::yz() const
 {
     return this->v_[YZ];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  Tensor<Cmpt>::zx() const
 {
     return this->v_[ZX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  Tensor<Cmpt>::zy() const
 {
     return this->v_[ZY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  Tensor<Cmpt>::zz() const
 {
     return this->v_[ZZ];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Tensor<Cmpt>::xx()
 {
     return this->v_[XX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Tensor<Cmpt>::xy()
 {
     return this->v_[XY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Tensor<Cmpt>::xz()
 {
     return this->v_[XZ];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Tensor<Cmpt>::yx()
 {
     return this->v_[YX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Tensor<Cmpt>::yy()
 {
     return this->v_[YY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Tensor<Cmpt>::yz()
 {
     return this->v_[YZ];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Tensor<Cmpt>::zx()
 {
     return this->v_[ZX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Tensor<Cmpt>::zy()
 {
     return this->v_[ZY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Tensor<Cmpt>::zz()
 {
     return this->v_[ZZ];
@@ -258,7 +251,7 @@ inline Cmpt& Tensor<Cmpt>::zz()
 
 
 //- Return tensor transpose
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt> Tensor<Cmpt>::T() const
 {
     return Tensor<Cmpt>
@@ -272,7 +265,7 @@ inline Tensor<Cmpt> Tensor<Cmpt>::T() const
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline void Tensor<Cmpt>::operator=(const SphericalTensor<Cmpt>& st)
 {
     this->v_[XX] = st.ii(); this->v_[XY] = 0; this->v_[XZ] = 0;
@@ -281,7 +274,7 @@ inline void Tensor<Cmpt>::operator=(const SphericalTensor<Cmpt>& st)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline void Tensor<Cmpt>::operator=(const SymmTensor<Cmpt>& st)
 {
     this->v_[XX] = st.xx(); this->v_[XY] = st.xy(); this->v_[XZ] = st.xz();
@@ -290,7 +283,7 @@ inline void Tensor<Cmpt>::operator=(const SymmTensor<Cmpt>& st)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline void Tensor<Cmpt>::operator=(const Vector<Vector<Cmpt> >& tr)
 {
     this->v_[XX] = tr.x().x();
@@ -310,7 +303,7 @@ inline void Tensor<Cmpt>::operator=(const Vector<Vector<Cmpt> >& tr)
 // * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
 
 //- Hodge Dual operator (tensor -> vector)
-template <class Cmpt>
+template<class Cmpt>
 inline Vector<Cmpt> operator*(const Tensor<Cmpt>& t)
 {
     return Vector<Cmpt>(t.yz(), -t.xz(), t.xy());
@@ -318,7 +311,7 @@ inline Vector<Cmpt> operator*(const Tensor<Cmpt>& t)
 
 
 //- Hodge Dual operator (vector -> tensor)
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt> operator*(const Vector<Cmpt>& v)
 {
     return Tensor<Cmpt>
@@ -331,7 +324,7 @@ inline Tensor<Cmpt> operator*(const Vector<Cmpt>& v)
 
 
 //- Inner-product between two tensors
-template <class Cmpt>
+template<class Cmpt>
 inline typename innerProduct<Tensor<Cmpt>, Tensor<Cmpt> >::type
 operator&(const Tensor<Cmpt>& t1, const Tensor<Cmpt>& t2)
 {
@@ -353,7 +346,7 @@ operator&(const Tensor<Cmpt>& t1, const Tensor<Cmpt>& t2)
 
 
 //- Inner-product between a tensor and a vector
-template <class Cmpt>
+template<class Cmpt>
 inline typename innerProduct<Tensor<Cmpt>, Vector<Cmpt> >::type
 operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
 {
@@ -367,7 +360,7 @@ operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
 
 
 //- Inner-product between a vector and a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt> >::type
 operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
 {
@@ -381,7 +374,7 @@ operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
 
 
 //- Outer-product between two vectors
-template <class Cmpt>
+template<class Cmpt>
 inline typename outerProduct<Vector<Cmpt>, Vector<Cmpt> >::type
 operator*(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
 {
@@ -395,7 +388,7 @@ operator*(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
 
 
 //- Division of a vector by a tensor, i.e. dot-product with the tensor inverse
-template <class Cmpt>
+template<class Cmpt>
 inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt> >::type
 operator/(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
 {
@@ -406,7 +399,7 @@ operator/(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
 // * * * * * * * * * * * * * * * Global Functions  * * * * * * * * * * * * * //
 
 //- Return the trace of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt tr(const Tensor<Cmpt>& t)
 {
     return t.xx() + t.yy() + t.zz();
@@ -414,7 +407,7 @@ inline Cmpt tr(const Tensor<Cmpt>& t)
 
 
 //- Return the spherical part of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor<Cmpt> sph(const Tensor<Cmpt>& t)
 {
     return (1.0/3.0)*tr(t);
@@ -422,7 +415,7 @@ inline SphericalTensor<Cmpt> sph(const Tensor<Cmpt>& t)
 
 
 //- Return the symmetric part of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt> symm(const Tensor<Cmpt>& t)
 {
     return SymmTensor<Cmpt>
@@ -435,7 +428,7 @@ inline SymmTensor<Cmpt> symm(const Tensor<Cmpt>& t)
 
 
 //- Return twice the symmetric part of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor<Cmpt> twoSymm(const Tensor<Cmpt>& t)
 {
     return SymmTensor<Cmpt>
@@ -448,7 +441,7 @@ inline SymmTensor<Cmpt> twoSymm(const Tensor<Cmpt>& t)
 
 
 //- Return the skew-symmetric part of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt> skew(const Tensor<Cmpt>& t)
 {
     return Tensor<Cmpt>
@@ -461,7 +454,7 @@ inline Tensor<Cmpt> skew(const Tensor<Cmpt>& t)
 
 
 //- Return the skew-symmetric part of a symmetric tensor
-template <class Cmpt>
+template<class Cmpt>
 inline const Tensor<Cmpt>& skew(const SymmTensor<Cmpt>& st)
 {
     return Tensor<Cmpt>::zero;
@@ -469,7 +462,7 @@ inline const Tensor<Cmpt>& skew(const SymmTensor<Cmpt>& st)
 
 
 //- Return the deviatoric part of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt> dev(const Tensor<Cmpt>& t)
 {
     return t - SphericalTensor<Cmpt>::oneThirdI*tr(t);
@@ -477,7 +470,7 @@ inline Tensor<Cmpt> dev(const Tensor<Cmpt>& t)
 
 
 //- Return the deviatoric part of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt> dev2(const Tensor<Cmpt>& t)
 {
     return t - SphericalTensor<Cmpt>::twoThirdsI*tr(t);
@@ -485,7 +478,7 @@ inline Tensor<Cmpt> dev2(const Tensor<Cmpt>& t)
 
 
 //- Return the determinant of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt det(const Tensor<Cmpt>& t)
 {
     return
@@ -498,7 +491,7 @@ inline Cmpt det(const Tensor<Cmpt>& t)
 
 
 //- Return the cofactor tensor of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt> cof(const Tensor<Cmpt>& t)
 {
     return Tensor<Cmpt>
@@ -519,7 +512,7 @@ inline Tensor<Cmpt> cof(const Tensor<Cmpt>& t)
 
 
 //- Return the inverse of a tensor given the determinant
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt> inv(const Tensor<Cmpt>& t, const Cmpt dett)
 {
     return Tensor<Cmpt>
@@ -540,7 +533,7 @@ inline Tensor<Cmpt> inv(const Tensor<Cmpt>& t, const Cmpt dett)
 
 
 //- Return the inverse of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt> inv(const Tensor<Cmpt>& t)
 {
     return inv(t, det(t));
@@ -548,7 +541,7 @@ inline Tensor<Cmpt> inv(const Tensor<Cmpt>& t)
 
 
 //- Return the 1st invariant of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt invariantI(const Tensor<Cmpt>& t)
 {
     return tr(t);
@@ -556,7 +549,7 @@ inline Cmpt invariantI(const Tensor<Cmpt>& t)
 
 
 //- Return the 2nd invariant of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt invariantII(const Tensor<Cmpt>& t)
 {
     return
@@ -573,7 +566,7 @@ inline Cmpt invariantII(const Tensor<Cmpt>& t)
 
 
 //- Return the 3rd invariant of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt invariantIII(const Tensor<Cmpt>& t)
 {
     return det(t);
@@ -582,7 +575,7 @@ inline Cmpt invariantIII(const Tensor<Cmpt>& t)
 
 // * * * * * * * * * Mixed Tensor SphericalTensor Operators  * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator+(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 {
@@ -595,7 +588,7 @@ operator+(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator+(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
 {
@@ -608,7 +601,7 @@ operator+(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator-(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 {
@@ -621,7 +614,7 @@ operator-(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator-(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
 {
@@ -635,7 +628,7 @@ operator-(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
 
 
 //- Inner-product between a spherical tensor and a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 {
@@ -649,7 +642,7 @@ operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 
 
 //- Inner-product between a tensor and a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
 {
@@ -663,7 +656,7 @@ operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
 
 
 //- Double-dot-product between a spherical tensor and a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt
 operator&&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 {
@@ -672,7 +665,7 @@ operator&&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 
 
 //- Double-dot-product between a tensor and a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt
 operator&&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
 {
@@ -714,7 +707,7 @@ public:
 
 // * * * * * * * * * * Mixed Tensor SymmTensor Operators * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator+(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 {
@@ -727,7 +720,7 @@ operator+(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator+(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
 {
@@ -740,7 +733,7 @@ operator+(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator-(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 {
@@ -753,7 +746,7 @@ operator-(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator-(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
 {
@@ -767,7 +760,7 @@ operator-(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
 
 
 //- Inner-product between a spherical tensor and a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 {
@@ -789,7 +782,7 @@ operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 
 
 //- Inner-product between a tensor and a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor<Cmpt>
 operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
 {
@@ -811,7 +804,7 @@ operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
 
 
 //- Double-dot-product between a spherical tensor and a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt
 operator&&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 {
@@ -825,7 +818,7 @@ operator&&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
 
 
 //- Double-dot-product between a tensor and a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt
 operator&&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
 {
diff --git a/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H b/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H
index e2b7add0d10ef0b68a6edc49ca32a812953090ee..ac49d74d53aac23fadc6b8b243a52dadbe46e59e 100644
--- a/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H
+++ b/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H
@@ -53,7 +53,7 @@ class SymmTensor2D;
                            Class Tensor2D Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class Cmpt>
+template<class Cmpt>
 class Tensor2D
 :
     public VectorSpace<Tensor2D<Cmpt>, Cmpt, 4>
diff --git a/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H b/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H
index 063d4cddf7186416e6ef565ac73c5c6b63967d46..f5ddd4d6504b526ed28ee2552d1987d7048a94da 100644
--- a/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H
+++ b/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H
@@ -30,19 +30,19 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>::Tensor2D()
 {}
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>::Tensor2D(const VectorSpace<Tensor2D<Cmpt>, Cmpt, 4>& vs)
 :
     VectorSpace<Tensor2D<Cmpt>, Cmpt, 4>(vs)
 {}
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>::Tensor2D(const SymmTensor2D<Cmpt>& st)
 {
     this->v_[XX] = st.xx(); this->v_[XY] = st.xy();
@@ -50,7 +50,7 @@ inline Tensor2D<Cmpt>::Tensor2D(const SymmTensor2D<Cmpt>& st)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>::Tensor2D(const SphericalTensor2D<Cmpt>& st)
 {
     this->v_[XX] = st.ii(); this->v_[XY] = 0;
@@ -58,7 +58,7 @@ inline Tensor2D<Cmpt>::Tensor2D(const SphericalTensor2D<Cmpt>& st)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>::Tensor2D
 (
     const Vector2D<Cmpt>& x,
@@ -70,7 +70,7 @@ inline Tensor2D<Cmpt>::Tensor2D
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>::Tensor2D
 (
     const Cmpt txx, const Cmpt txy,
@@ -82,7 +82,7 @@ inline Tensor2D<Cmpt>::Tensor2D
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>::Tensor2D(Istream& is)
 :
     VectorSpace<Tensor2D<Cmpt>, Cmpt, 4>(is)
@@ -91,70 +91,70 @@ inline Tensor2D<Cmpt>::Tensor2D(Istream& is)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline Vector2D<Cmpt> Tensor2D<Cmpt>::x() const
 {
     return Vector2D<Cmpt>(this->v_[XX], this->v_[XY]);
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Vector2D<Cmpt> Tensor2D<Cmpt>::y() const
 {
     return Vector2D<Cmpt>(this->v_[YX], this->v_[YY]);
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt& Tensor2D<Cmpt>::xx() const
 {
     return this->v_[XX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt& Tensor2D<Cmpt>::xy() const
 {
     return this->v_[XY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt& Tensor2D<Cmpt>::yx() const
 {
     return this->v_[YX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt& Tensor2D<Cmpt>::yy() const
 {
     return this->v_[YY];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Tensor2D<Cmpt>::xx()
 {
     return this->v_[XX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Tensor2D<Cmpt>::xy()
 {
     return this->v_[XY];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Tensor2D<Cmpt>::yx()
 {
     return this->v_[YX];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Tensor2D<Cmpt>::yy()
 {
     return this->v_[YY];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt> Tensor2D<Cmpt>::T() const
 {
     return Tensor2D<Cmpt>
@@ -167,7 +167,7 @@ inline Tensor2D<Cmpt> Tensor2D<Cmpt>::T() const
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline void Tensor2D<Cmpt>::operator=(const SymmTensor2D<Cmpt>& st)
 {
     this->v_[XX] = st.xx(); this->v_[XY] = st.xy();
@@ -175,7 +175,7 @@ inline void Tensor2D<Cmpt>::operator=(const SymmTensor2D<Cmpt>& st)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline void Tensor2D<Cmpt>::operator=(const SphericalTensor2D<Cmpt>& st)
 {
     this->v_[XX] = st.ii(); this->v_[XY] = 0;
@@ -187,7 +187,7 @@ inline void Tensor2D<Cmpt>::operator=(const SphericalTensor2D<Cmpt>& st)
 // * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
 
 //- Inner-product between two tensors
-template <class Cmpt>
+template<class Cmpt>
 inline typename innerProduct<Tensor2D<Cmpt>, Tensor2D<Cmpt> >::type
 operator&(const Tensor2D<Cmpt>& t1, const Tensor2D<Cmpt>& t2)
 {
@@ -202,7 +202,7 @@ operator&(const Tensor2D<Cmpt>& t1, const Tensor2D<Cmpt>& t2)
 }
 
 //- Inner-product between a tensor and a vector
-template <class Cmpt>
+template<class Cmpt>
 inline typename innerProduct<Tensor2D<Cmpt>, Vector2D<Cmpt> >::type
 operator&(const Tensor2D<Cmpt>& t, const Vector2D<Cmpt>& v)
 {
@@ -214,7 +214,7 @@ operator&(const Tensor2D<Cmpt>& t, const Vector2D<Cmpt>& v)
 }
 
 //- Inner-product between a vector and a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline typename innerProduct<Vector2D<Cmpt>, Tensor2D<Cmpt> >::type
 operator&(const Vector2D<Cmpt>& v, const Tensor2D<Cmpt>& t)
 {
@@ -226,7 +226,7 @@ operator&(const Vector2D<Cmpt>& v, const Tensor2D<Cmpt>& t)
 }
 
 //- Outer-product between two vectors
-template <class Cmpt>
+template<class Cmpt>
 inline typename outerProduct<Vector2D<Cmpt>, Vector2D<Cmpt> >::type
 operator*(const Vector2D<Cmpt>& v1, const Vector2D<Cmpt>& v2)
 {
@@ -239,7 +239,7 @@ operator*(const Vector2D<Cmpt>& v1, const Vector2D<Cmpt>& v2)
 
 
 //- Return the trace of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt tr(const Tensor2D<Cmpt>& t)
 {
     return t.xx() + t.yy();
@@ -247,7 +247,7 @@ inline Cmpt tr(const Tensor2D<Cmpt>& t)
 
 
 //- Return the spherical part of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SphericalTensor2D<Cmpt> sph(const Tensor2D<Cmpt>& t)
 {
     return 0.5*tr(t);
@@ -255,7 +255,7 @@ inline SphericalTensor2D<Cmpt> sph(const Tensor2D<Cmpt>& t)
 
 
 //- Return the symmetric part of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt> symm(const Tensor2D<Cmpt>& t)
 {
     return SymmTensor2D<Cmpt>
@@ -266,7 +266,7 @@ inline SymmTensor2D<Cmpt> symm(const Tensor2D<Cmpt>& t)
 }
 
 //- Return the twice the symmetric part of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline SymmTensor2D<Cmpt> twoSymm(const Tensor2D<Cmpt>& t)
 {
     return SymmTensor2D<Cmpt>
@@ -277,7 +277,7 @@ inline SymmTensor2D<Cmpt> twoSymm(const Tensor2D<Cmpt>& t)
 }
 
 //- Return the skew-symmetric part of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt> skew(const Tensor2D<Cmpt>& t)
 {
     return Tensor2D<Cmpt>
@@ -289,7 +289,7 @@ inline Tensor2D<Cmpt> skew(const Tensor2D<Cmpt>& t)
 
 
 //- Return the deviatoric part of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt> dev(const Tensor2D<Cmpt>& t)
 {
     return t - SphericalTensor2D<Cmpt>::oneThirdI*tr(t);
@@ -297,7 +297,7 @@ inline Tensor2D<Cmpt> dev(const Tensor2D<Cmpt>& t)
 
 
 //- Return the deviatoric part of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt> dev2(const Tensor2D<Cmpt>& t)
 {
     return t - SphericalTensor2D<Cmpt>::twoThirdsI*tr(t);
@@ -305,7 +305,7 @@ inline Tensor2D<Cmpt> dev2(const Tensor2D<Cmpt>& t)
 
 
 //- Return the determinant of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt det(const Tensor2D<Cmpt>& t)
 {
     return(t.xx()*t.yy() - t.xy()*t.yx());
@@ -313,7 +313,7 @@ inline Cmpt det(const Tensor2D<Cmpt>& t)
 
 
 //- Return the cofactor tensor of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt> cof(const Tensor2D<Cmpt>& t)
 {
     return Tensor2D<Cmpt>
@@ -325,7 +325,7 @@ inline Tensor2D<Cmpt> cof(const Tensor2D<Cmpt>& t)
 
 
 //- Return the inverse of a tensor given the determinant
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt> inv(const Tensor2D<Cmpt>& t, const Cmpt dett)
 {
     return cof(t)/dett;
@@ -333,7 +333,7 @@ inline Tensor2D<Cmpt> inv(const Tensor2D<Cmpt>& t, const Cmpt dett)
 
 
 //- Return the inverse of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt> inv(const Tensor2D<Cmpt>& t)
 {
     return inv(t, det(t));
@@ -341,7 +341,7 @@ inline Tensor2D<Cmpt> inv(const Tensor2D<Cmpt>& t)
 
 
 //- Return the 1st invariant of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt invariantI(const Tensor2D<Cmpt>& t)
 {
     return tr(t);
@@ -349,7 +349,7 @@ inline Cmpt invariantI(const Tensor2D<Cmpt>& t)
 
 
 //- Return the 2nd invariant of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt invariantII(const Tensor2D<Cmpt>& t)
 {
     return
@@ -365,7 +365,7 @@ inline Cmpt invariantII(const Tensor2D<Cmpt>& t)
 
 
 //- Return the 3rd invariant of a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt invariantIII(const Tensor2D<Cmpt>& t)
 {
     return det(t);
@@ -374,7 +374,7 @@ inline Cmpt invariantIII(const Tensor2D<Cmpt>& t)
 
 // * * * * * * * * * Mixed Tensor SphericalTensor Operators  * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>
 operator+(const SphericalTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 {
@@ -386,7 +386,7 @@ operator+(const SphericalTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>
 operator+(const Tensor2D<Cmpt>& t1, const SphericalTensor2D<Cmpt>& st2)
 {
@@ -398,7 +398,7 @@ operator+(const Tensor2D<Cmpt>& t1, const SphericalTensor2D<Cmpt>& st2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>
 operator-(const SphericalTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 {
@@ -410,7 +410,7 @@ operator-(const SphericalTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>
 operator-(const Tensor2D<Cmpt>& t1, const SphericalTensor2D<Cmpt>& st2)
 {
@@ -423,7 +423,7 @@ operator-(const Tensor2D<Cmpt>& t1, const SphericalTensor2D<Cmpt>& st2)
 
 
 //- Inner-product between a spherical tensor and a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>
 operator&(const SphericalTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 {
@@ -438,7 +438,7 @@ operator&(const SphericalTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 
 
 //- Inner-product between a tensor and a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>
 operator&(const Tensor2D<Cmpt>& t1, const SphericalTensor2D<Cmpt>& st2)
 {
@@ -454,7 +454,7 @@ operator&(const Tensor2D<Cmpt>& t1, const SphericalTensor2D<Cmpt>& st2)
 
 
 //- Double-dot-product between a spherical tensor and a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt
 operator&&(const SphericalTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 {
@@ -463,7 +463,7 @@ operator&&(const SphericalTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 
 
 //- Double-dot-product between a tensor and a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt
 operator&&(const Tensor2D<Cmpt>& t1, const SphericalTensor2D<Cmpt>& st2)
 {
@@ -473,7 +473,7 @@ operator&&(const Tensor2D<Cmpt>& t1, const SphericalTensor2D<Cmpt>& st2)
 
 // * * * * * * * * * * Mixed Tensor SymmTensor Operators * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>
 operator+(const SymmTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 {
@@ -485,7 +485,7 @@ operator+(const SymmTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>
 operator+(const Tensor2D<Cmpt>& t1, const SymmTensor2D<Cmpt>& st2)
 {
@@ -497,7 +497,7 @@ operator+(const Tensor2D<Cmpt>& t1, const SymmTensor2D<Cmpt>& st2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>
 operator-(const SymmTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 {
@@ -509,7 +509,7 @@ operator-(const SymmTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>
 operator-(const Tensor2D<Cmpt>& t1, const SymmTensor2D<Cmpt>& st2)
 {
@@ -522,7 +522,7 @@ operator-(const Tensor2D<Cmpt>& t1, const SymmTensor2D<Cmpt>& st2)
 
 
 //- Inner-product between a spherical tensor and a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>
 operator&(const SymmTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 {
@@ -538,7 +538,7 @@ operator&(const SymmTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 
 
 //- Inner-product between a tensor and a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Tensor2D<Cmpt>
 operator&(const Tensor2D<Cmpt>& t1, const SymmTensor2D<Cmpt>& st2)
 {
@@ -554,7 +554,7 @@ operator&(const Tensor2D<Cmpt>& t1, const SymmTensor2D<Cmpt>& st2)
 
 
 //- Double-dot-product between a spherical tensor and a tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt
 operator&&(const SymmTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 {
@@ -567,7 +567,7 @@ operator&&(const SymmTensor2D<Cmpt>& st1, const Tensor2D<Cmpt>& t2)
 
 
 //- Double-dot-product between a tensor and a spherical tensor
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt
 operator&&(const Tensor2D<Cmpt>& t1, const SymmTensor2D<Cmpt>& st2)
 {
diff --git a/src/OpenFOAM/primitives/Vector/Vector.H b/src/OpenFOAM/primitives/Vector/Vector.H
index 0a59344b668eefeff730349ac7d8751abddd49cd..cb2e71d10658831f23d0fbe16efc07b8e370d175 100644
--- a/src/OpenFOAM/primitives/Vector/Vector.H
+++ b/src/OpenFOAM/primitives/Vector/Vector.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -54,7 +54,7 @@ template<class T> class List;
                            Class Vector Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class Cmpt>
+template<class Cmpt>
 class Vector
 :
     public VectorSpace<Vector<Cmpt>, Cmpt, 3>
@@ -93,8 +93,9 @@ public:
         //- Construct null
         inline Vector();
 
-        //- Construct given VectorSpace
-        inline Vector(const VectorSpace<Vector<Cmpt>, Cmpt, 3>&);
+        //- Construct given VectorSpace of the same rank
+        template<class Cmpt2>
+        inline Vector(const VectorSpace<Vector<Cmpt2>, Cmpt2, 3>&);
 
         //- Construct given three components
         inline Vector(const Cmpt& vx, const Cmpt& vy, const Cmpt& vz);
diff --git a/src/OpenFOAM/primitives/Vector/VectorI.H b/src/OpenFOAM/primitives/Vector/VectorI.H
index 6ab90aefaac6c068da4d787c22bc30f0c034ae42..cf26a40722f7c98fedd2f78eea8ded1f81a83b1e 100644
--- a/src/OpenFOAM/primitives/Vector/VectorI.H
+++ b/src/OpenFOAM/primitives/Vector/VectorI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -30,22 +30,20 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct null
-template <class Cmpt>
+template<class Cmpt>
 inline Vector<Cmpt>::Vector()
 {}
 
 
-// Construct given VectorSpace
-template <class Cmpt>
-inline Vector<Cmpt>::Vector(const VectorSpace<Vector<Cmpt>, Cmpt, 3>& vs)
+template<class Cmpt>
+template<class Cmpt2>
+inline Vector<Cmpt>::Vector(const VectorSpace<Vector<Cmpt2>, Cmpt2, 3>& vs)
 :
     VectorSpace<Vector<Cmpt>, Cmpt, 3>(vs)
 {}
 
 
-// Construct given three Cmpts
-template <class Cmpt>
+template<class Cmpt>
 inline Vector<Cmpt>::Vector(const Cmpt& vx, const Cmpt& vy, const Cmpt& vz)
 {
     this->v_[X] = vx;
@@ -54,8 +52,7 @@ inline Vector<Cmpt>::Vector(const Cmpt& vx, const Cmpt& vy, const Cmpt& vz)
 }
 
 
-// Construct from Istream
-template <class Cmpt>
+template<class Cmpt>
 inline Vector<Cmpt>::Vector(Istream& is)
 :
     VectorSpace<Vector<Cmpt>, Cmpt, 3>(is)
@@ -64,38 +61,38 @@ inline Vector<Cmpt>::Vector(Istream& is)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  Vector<Cmpt>::x() const
 {
     return this->v_[X];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  Vector<Cmpt>::y() const
 {
     return this->v_[Y];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  Vector<Cmpt>::z() const
 {
     return this->v_[Z];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Vector<Cmpt>::x()
 {
     return this->v_[X];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Vector<Cmpt>::y()
 {
     return this->v_[Y];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Vector<Cmpt>::z()
 {
     return this->v_[Z];
@@ -104,7 +101,7 @@ inline Cmpt& Vector<Cmpt>::z()
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Vector<Cmpt>& Vector<Cmpt>::centre
 (
     const Foam::List<Vector<Cmpt> >&
@@ -116,7 +113,7 @@ inline const Vector<Cmpt>& Vector<Cmpt>::centre
 
 // * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline typename innerProduct<Vector<Cmpt>, Vector<Cmpt> >::type
 operator&(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
 {
@@ -124,7 +121,7 @@ operator&(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Vector<Cmpt> operator^(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
 {
     return Vector<Cmpt>
diff --git a/src/OpenFOAM/primitives/Vector2D/Vector2D.H b/src/OpenFOAM/primitives/Vector2D/Vector2D.H
index 9b5a4260bfb5f21d4909f8cb009f9a7704302b49..2f429673d1f3aa1d8f217dc26b698690eb6666d8 100644
--- a/src/OpenFOAM/primitives/Vector2D/Vector2D.H
+++ b/src/OpenFOAM/primitives/Vector2D/Vector2D.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -48,7 +48,7 @@ namespace Foam
                            Class Vector2D Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class Cmpt>
+template<class Cmpt>
 class Vector2D
 :
     public VectorSpace<Vector2D<Cmpt>, Cmpt, 2>
diff --git a/src/OpenFOAM/primitives/Vector2D/Vector2DI.H b/src/OpenFOAM/primitives/Vector2D/Vector2DI.H
index f65df35acff134b0174509b1b0c2772acc0b0100..beb077485ff14e9d4ad5f919a6865d5db14c401f 100644
--- a/src/OpenFOAM/primitives/Vector2D/Vector2DI.H
+++ b/src/OpenFOAM/primitives/Vector2D/Vector2DI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -31,13 +31,13 @@ namespace Foam
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 // Construct null
-template <class Cmpt>
+template<class Cmpt>
 inline Vector2D<Cmpt>::Vector2D()
 {}
 
 
 // Construct given VectorSpace
-template <class Cmpt>
+template<class Cmpt>
 inline Vector2D<Cmpt>::Vector2D(const VectorSpace<Vector2D<Cmpt>, Cmpt, 2>& vs)
 :
     VectorSpace<Vector2D<Cmpt>, Cmpt, 2>(vs)
@@ -45,7 +45,7 @@ inline Vector2D<Cmpt>::Vector2D(const VectorSpace<Vector2D<Cmpt>, Cmpt, 2>& vs)
 
 
 // Construct given three Cmpts
-template <class Cmpt>
+template<class Cmpt>
 inline Vector2D<Cmpt>::Vector2D(const Cmpt& vx, const Cmpt& vy)
 {
     this->v_[X] = vx;
@@ -54,7 +54,7 @@ inline Vector2D<Cmpt>::Vector2D(const Cmpt& vx, const Cmpt& vy)
 
 
 // Construct from Istream
-template <class Cmpt>
+template<class Cmpt>
 inline Vector2D<Cmpt>::Vector2D(Istream& is)
 :
     VectorSpace<Vector2D<Cmpt>, Cmpt, 2>(is)
@@ -63,26 +63,26 @@ inline Vector2D<Cmpt>::Vector2D(Istream& is)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  Vector2D<Cmpt>::x() const
 {
     return this->v_[X];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline const Cmpt&  Vector2D<Cmpt>::y() const
 {
     return this->v_[Y];
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Vector2D<Cmpt>::x()
 {
     return this->v_[X];
 }
 
-template <class Cmpt>
+template<class Cmpt>
 inline Cmpt& Vector2D<Cmpt>::y()
 {
     return this->v_[Y];
@@ -91,7 +91,7 @@ inline Cmpt& Vector2D<Cmpt>::y()
 
 // * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
 
-template <class Cmpt>
+template<class Cmpt>
 inline typename innerProduct<Vector2D<Cmpt>, Vector2D<Cmpt> >::type
 operator&(const Vector2D<Cmpt>& v1, const Vector2D<Cmpt>& v2)
 {
@@ -99,7 +99,7 @@ operator&(const Vector2D<Cmpt>& v1, const Vector2D<Cmpt>& v2)
 }
 
 
-template <class Cmpt>
+template<class Cmpt>
 inline scalar Vector2D<Cmpt>::perp(const Vector2D<Cmpt>& b) const
 {
     return x()*b.y()-y()*b.x();
diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.H b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.H
index c6980add1ea412d45cef50f8c6644efc8e5c2c31..f9bf6dfc67b2e9ced2658df060d9d0889f851332 100644
--- a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.H
+++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -107,6 +107,10 @@ public:
         //- Construct as copy
         inline VectorSpace(const VectorSpace<Form, Cmpt, nCmpt>&);
 
+        //- Construct as copy of another VectorSpace type of the same rank
+        template<class Form2, class Cmpt2>
+        inline VectorSpace(const VectorSpace<Form2, Cmpt2, nCmpt>&);
+
 
     // Member Functions
 
diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H
index 82ecce7f06d0d73732731697fbd458fef02f0898..70ccf2a1856a34cbd62dc86dbc931e3d8b2cf657 100644
--- a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H
+++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -50,6 +50,17 @@ inline VectorSpace<Form, Cmpt, nCmpt>::VectorSpace
 }
 
 
+template<class Form, class Cmpt, int nCmpt>
+template<class Form2, class Cmpt2>
+inline VectorSpace<Form, Cmpt, nCmpt>::VectorSpace
+(
+    const VectorSpace<Form2, Cmpt2, nCmpt>& vs
+)
+{
+    VectorSpaceOps<nCmpt,0>::eqOp(*this, vs, eqOp<Cmpt>());
+}
+
+
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class Form, class Cmpt, int nCmpt>
diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C
index 4719be11452ff760d4808066876f249dd9157f76..53428cb126d062005735530fc7861ce0eb58044d 100644
--- a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -87,37 +87,84 @@ void Foam::CSV<Type>::read()
     DynamicList<Tuple2<scalar, Type> > values;
 
     // skip header
-    if (headerLine_)
+    for (label i = 0; i < nHeaderLine_; i++)
     {
         string line;
         is.getLine(line);
     }
 
+    label nEntries = max(componentColumns_);
+
     // read data
     while (is.good())
     {
         string line;
         is.getLine(line);
 
-        DynamicList<string> splitted;
 
+        label n = 0;
         std::size_t pos = 0;
-        while (pos != std::string::npos)
+        DynamicList<string> splitted;
+
+        if (mergeSeparators_)
         {
-            std::size_t nPos = line.find(separator_, pos);
+            std::size_t nPos = 0;
 
-            if (nPos == std::string::npos)
+            while ((pos != std::string::npos) && (n <= nEntries))
             {
-                splitted.append(line.substr(pos));
-                pos = nPos;
+                bool found = false;
+                while (!found)
+                {
+                    nPos = line.find(separator_, pos);
+
+                    if ((nPos != std::string::npos) && (nPos - pos == 0))
+                    {
+                        pos = nPos + 1;
+                    }
+                    else
+                    {
+                        found = true;
+                    }
+                }
+
+                nPos = line.find(separator_, pos);
+
+                if (nPos == std::string::npos)
+                {
+                    splitted.append(line.substr(pos));
+                    pos = nPos;
+                    n++;
+                }
+                else
+                {
+                    splitted.append(line.substr(pos, nPos - pos));
+                    pos = nPos + 1;
+                    n++;
+                }
             }
-            else
+        }
+        else
+        {
+            while ((pos != std::string::npos) && (n <= nEntries))
             {
-                splitted.append(line.substr(pos, nPos - pos));
-                pos = nPos + 1;
+                std::size_t nPos = line.find(separator_, pos);
+
+                if (nPos == std::string::npos)
+                {
+                    splitted.append(line.substr(pos));
+                    pos = nPos;
+                    n++;
+                }
+                else
+                {
+                    splitted.append(line.substr(pos, nPos - pos));
+                    pos = nPos + 1;
+                    n++;
+                }
             }
         }
 
+
         if (splitted.size() <= 1)
         {
             break;
@@ -136,15 +183,21 @@ void Foam::CSV<Type>::read()
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class Type>
-Foam::CSV<Type>::CSV(const word& entryName, const dictionary& dict)
+Foam::CSV<Type>::CSV
+(
+    const word& entryName,
+    const dictionary& dict,
+    const word& ext
+)
 :
     DataEntry<Type>(entryName),
-    TableBase<Type>(entryName, dict.subDict(type() + "Coeffs")),
-    coeffs_(dict.subDict(type() + "Coeffs")),
-    headerLine_(readBool(coeffs_.lookup("hasHeaderLine"))),
+    TableBase<Type>(entryName, dict.subDict(type() + ext)),
+    coeffs_(dict.subDict(type() + ext)),
+    nHeaderLine_(readLabel(coeffs_.lookup("nHeaderLine"))),
     refColumn_(readLabel(coeffs_.lookup("refColumn"))),
     componentColumns_(coeffs_.lookup("componentColumns")),
     separator_(coeffs_.lookupOrDefault<string>("separator", string(","))[0]),
+    mergeSeparators_(readBool(coeffs_.lookup("mergeSeparators"))),
     fName_(coeffs_.lookup("fileName"))
 {
     if (componentColumns_.size() != pTraits<Type>::nComponents)
@@ -166,10 +219,11 @@ Foam::CSV<Type>::CSV(const CSV<Type>& tbl)
 :
     DataEntry<Type>(tbl),
     TableBase<Type>(tbl),
-    headerLine_(tbl.headerLine_),
+    nHeaderLine_(tbl.nHeaderLine_),
     refColumn_(tbl.refColumn_),
     componentColumns_(tbl.componentColumns_),
     separator_(tbl.separator_),
+    mergeSeparators_(tbl.mergeSeparators_),
     fName_(tbl.fName_)
 {}
 
@@ -181,6 +235,15 @@ Foam::CSV<Type>::~CSV()
 {}
 
 
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+template<class Type>
+const Foam::fileName& Foam::CSV<Type>::fName() const
+{
+    return fName_;
+}
+
+
 // * * * * * * * * * * * * * *  IOStream operators * * * * * * * * * * * * * //
 
 #include "CSVIO.C"
diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H
index bcc3aee956b34f1e3dba5dbe9632f31f11714e74..e5d0d23055bbb9da55e80e514aac5439c490f702 100644
--- a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H
+++ b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H
@@ -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
@@ -32,10 +32,11 @@ Description
         <entryName>   csvFile;
         csvFileCoeffs
         {
-            hasHeaderLine       true;
+            nHeaderLines        4;
             refColumn           0;          // reference column index
             componentColumns    (1 2 3);    // component column indices
             separator           ",";        // optional (defaults to ",")
+            mergeSeparators     no;         // merge multiple separators
             fileName            "fileXYZ";  // name of csv data file
             outOfBounds         clamp;      // optional out-of-bounds handling
             interpolationScheme linear;     // optional interpolation scheme
@@ -86,8 +87,8 @@ class CSV
         //- Coefficients dictionary (for convenience on reading)
         dictionary coeffs_;
 
-        //- Does the file have a header line?
-        bool headerLine_;
+        //- Number header lines
+        label nHeaderLine_;
 
         //- Column of the time
         label refColumn_;
@@ -98,7 +99,10 @@ class CSV
         //- Separator character
         char separator_;
 
-        //- File name for csv table (optional)
+        //- Merge separators flag, e.g. ',,,' becomes ','
+        bool mergeSeparators_;
+
+        //- File name for csv table
         fileName fName_;
 
 
@@ -122,8 +126,13 @@ public:
 
     // Constructors
 
-        //- Construct from entry name and Istream
-        CSV(const word& entryName, const dictionary& dict);
+        //- Construct from entry name and dictionary
+        CSV
+        (
+            const word& entryName,
+            const dictionary& dict,
+            const word& ext = "Ceoffs"
+        );
 
         //- Copy constructor
         CSV(const CSV<Type>& tbl);
@@ -150,6 +159,12 @@ public:
             }
 
 
+        // Access
+
+            //- Return const access to the file name
+            virtual const fileName& fName() const;
+
+
         // Evaluation
 
             //- Return Table value
diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C
index b5bfad8b3af813f7bc72cbcd52cf3dbecb289586..36595e7dd6d625092c5b5ba3cf63ff3fbc2cfd54 100644
--- a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSVIO.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -37,10 +37,11 @@ Foam::Ostream& Foam::operator<<
     if (os.format() == IOstream::ASCII)
     {
         os  << static_cast<const DataEntry<Type>& >(tbl)
-            << token::SPACE << tbl.headerLine_
+            << token::SPACE << tbl.nHeaderLine_
             << token::SPACE << tbl.timeColumn_
             << token::SPACE << tbl.componentColumns_
             << token::SPACE << tbl.separator_
+            << token::SPACE << tbl.mergeSeparators_
             << token::SPACE << tbl.fileName_;
     }
     else
@@ -70,13 +71,15 @@ void Foam::CSV<Type>::writeData(Ostream& os) const
     // the values themselves
     TableBase<Type>::writeEntries(os);
 
-    os.writeKeyword("hasHeaderLine") << headerLine_ << token::END_STATEMENT
+    os.writeKeyword("nHeaderLine") << nHeaderLine_ << token::END_STATEMENT
         << nl;
     os.writeKeyword("refColumn") << refColumn_ << token::END_STATEMENT << nl;
     os.writeKeyword("componentColumns") << componentColumns_
         << token::END_STATEMENT << nl;
     os.writeKeyword("separator") << string(separator_)
         << token::END_STATEMENT << nl;
+    os.writeKeyword("mergeSeparators") << string(mergeSeparators_)
+        << token::END_STATEMENT << nl;
     os.writeKeyword("fileName") << fName_ << token::END_STATEMENT << nl;
     os  << decrIndent << indent << token::END_BLOCK << endl;
 }
diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C
index 08dde8e7583ba8efb189e77ebf2df6742cc43d8d..054d87575e233f582dca293d42a4b8f05205ae87 100644
--- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.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
@@ -414,6 +414,36 @@ Foam::dimensioned<Type> Foam::TableBase<Type>::dimIntegrate
 }
 
 
+template<class Type>
+Foam::tmp<Foam::scalarField> Foam::TableBase<Type>::x() const
+{
+    tmp<scalarField> tfld(new scalarField(table_.size(), 0.0));
+    scalarField& fld = tfld();
+
+    forAll(table_, i)
+    {
+        fld[i] = table_[i].first();
+    }
+
+    return tfld;
+}
+
+
+template<class Type>
+Foam::tmp<Foam::Field<Type> > Foam::TableBase<Type>::y() const
+{
+    tmp<Field<Type> > tfld(new Field<Type>(table_.size(), pTraits<Type>::zero));
+    Field<Type>& fld = tfld();
+
+    forAll(table_, i)
+    {
+        fld[i] = table_[i].second();
+    }
+
+    return tfld;
+}
+
+
 // * * * * * * * * * * * * * *  IOStream operators * * * * * * * * * * * * * //
 
 #include "TableBaseIO.C"
diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H
index da670e2db56a80ec8eecc6e781963219464e79ce..793716803aeb6388f1029a85b19c13f125c88094 100644
--- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H
+++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H
@@ -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
@@ -172,6 +172,12 @@ public:
             const scalar x2
         ) const;
 
+        //- Return the reference values
+        virtual tmp<scalarField> x() const;
+
+        //- Return the dependent values
+        virtual tmp<Field<Type> > y() const;
+
 
     // I/O
 
diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBaseIO.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBaseIO.C
index 10d79420f794565f88c1fe22b1c059e12f518176..556a9fbb76dbb9756ef7547f855dfece09e1c968 100644
--- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBaseIO.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBaseIO.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.C b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.C
index 15fe8b57a265ef270198339197f9656200261ee6..a30251be3e6b5e98e0ca96daee28d837772136cd 100644
--- a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFileIO.C b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFileIO.C
index b213ad8b139515187911e9fea20a731c830e347b..cbfa4585e6aaae6b2214a6144c7ae85ce29684bd 100644
--- a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFileIO.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFileIO.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.C b/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.C
index b5e74a78c0bdcedcaa283210ab2c909ce7dfafb8..e46962bd3137506d8afb671c92f6899ac0850c72 100644
--- a/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.C
+++ b/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -60,8 +60,13 @@ Foam::TimeDataEntry<Type>::TimeDataEntry
 :
     time_(tde.time_),
     name_(tde.name_),
-    entry_(tde.entry_->clone().ptr())
-{}
+    entry_()
+{
+    if (tde.entry_.valid())
+    {
+        entry_.reset(tde.entry_->clone().ptr());
+    }
+}
 
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/primitives/ops/ops.H b/src/OpenFOAM/primitives/ops/ops.H
index cab91fcfb5eee81d71a4cb8280b8d21e0c25e1a0..427679118f2e2a0f179285f8855da314fac8cb6c 100644
--- a/src/OpenFOAM/primitives/ops/ops.H
+++ b/src/OpenFOAM/primitives/ops/ops.H
@@ -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
@@ -175,7 +175,7 @@ Op(lessEq, x <= y)
 Op(greater, x > y)
 Op(greaterEq, x >= y)
 
-weightedOp(multiply, weight * y)
+weightedOp(multiply, (weight*y))
 
 #undef Op
 
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.C b/src/OpenFOAM/primitives/strings/fileName/fileName.C
index 8bacf62b90d8658f9cac3232ab1e735796cda5e2..3f24ca7426029a2f48ed7f550c8d2428654ba4b2 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileName.C
+++ b/src/OpenFOAM/primitives/strings/fileName/fileName.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -204,6 +204,25 @@ Foam::word Foam::fileName::name() const
 }
 
 
+Foam::string Foam::fileName::caseName() const
+{
+    string cName = *this;
+
+    const string caseStr(getEnv("FOAM_CASE"));
+
+    const size_type i = find(caseStr);
+
+    if (i == npos)
+    {
+        return cName;
+    }
+    else
+    {
+        return cName.replace(i, caseStr.size(), string("$FOAM_CASE"));
+    }
+}
+
+
 Foam::word Foam::fileName::name(const bool noExt) const
 {
     if (noExt)
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.H b/src/OpenFOAM/primitives/strings/fileName/fileName.H
index 3a6ef1a25922de5793b0e7ffc67338df570a274d..3e97853a1f67598aa6daec5c8c17ba6995aead5e 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileName.H
+++ b/src/OpenFOAM/primitives/strings/fileName/fileName.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -153,6 +153,9 @@ public:
             //- Return file name (part beyond last /)
             word name() const;
 
+            //- Return file name (part beyond last /), subsitute for FOAM_CASE
+            string caseName() const;
+
             //- Return file name, optionally without extension
             word name(const bool noExt) const;
 
diff --git a/src/combustionModels/FSD/FSD.C b/src/combustionModels/FSD/FSD.C
index 9d86d1038488b0fe878d7bbbfc7b502088f6d5f4..307d2410c5462d933e7079c52757c331d6be28c1 100644
--- a/src/combustionModels/FSD/FSD.C
+++ b/src/combustionModels/FSD/FSD.C
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  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
+    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
diff --git a/src/combustionModels/FSD/FSD.H b/src/combustionModels/FSD/FSD.H
index e5c396329a964b49e1144138d8ae939c38453f5a..f9156edcbd0b89d7e147cc8802b9564a3e71a23a 100644
--- a/src/combustionModels/FSD/FSD.H
+++ b/src/combustionModels/FSD/FSD.H
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  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
+    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
diff --git a/src/combustionModels/FSD/FSDs.C b/src/combustionModels/FSD/FSDs.C
index aed10a40a1f4a58324238d172c236a2a599bb76a..8b36ce8f89f47cb2e8c9ec87060c14d8471d5126 100644
--- a/src/combustionModels/FSD/FSDs.C
+++ b/src/combustionModels/FSD/FSDs.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C b/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C
index 782f8456c4abfd6ed12b0a356dfa3219a2e7bb0d..1ff3208491f845bb8ce82ef45bab3b4f91fce3b1 100644
--- a/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C
+++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C
@@ -2,16 +2,16 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    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 2 of the License, or (at your
-    option) any later version.
+    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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.H b/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.H
index 329cac554ef0c005185d411c2bda011948777324..d56216903cb1937bce28f1cc7d5d3f8a04f7ea8d 100644
--- a/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.H
+++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.H
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    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
diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.C b/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.C
index 5a06c5fdcce716ca4f489995409edc1554b0a7ff..bc9f4481a8e058aeebfac847d23df107845e4318 100644
--- a/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.C
+++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.C
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    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
diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.H b/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.H
index ea3f52fbfb6893a9e5b5628c97881c3b9c72252a..b6267a3892e87ebef12df937ecb339a046514759 100644
--- a/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.H
+++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.H
@@ -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
@@ -21,7 +21,6 @@ License
     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::reactionRateFlameArea
 
diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameAreaNew.C b/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameAreaNew.C
index 655b588f60a1a12524862bdfc784ead56dbffada..0d18abb27f88b072d27b8df64655c99d761b354d 100644
--- a/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameAreaNew.C
+++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameAreaNew.C
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  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
+    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
diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.C b/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.C
index bf9a84158c77bb4e2be83dfedea1a19581f8a1a3..9352dd83961d30200f03284794755ea513c570b0 100644
--- a/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.C
+++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.C
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    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
diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.H b/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.H
index 717c7cbbb991782815dff38425b55b5938551350..b647997ddacb4453d1d63cf908d79babafeb4dd6 100644
--- a/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.H
+++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.H
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  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
+    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
diff --git a/src/combustionModels/PaSR/PaSR.C b/src/combustionModels/PaSR/PaSR.C
index d90eb6835770540d11cf8483614e596a43c085f0..b0051e4689f4fdb20df233c9cc35fd9b24c00b87 100644
--- a/src/combustionModels/PaSR/PaSR.C
+++ b/src/combustionModels/PaSR/PaSR.C
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  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
+    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
diff --git a/src/combustionModels/PaSR/PaSR.H b/src/combustionModels/PaSR/PaSR.H
index cc9cb3b4a1798d5dd76fd33ff09037e01fef37d1..fa6c73eb955715e68c45f5a7f45762f176e07584 100644
--- a/src/combustionModels/PaSR/PaSR.H
+++ b/src/combustionModels/PaSR/PaSR.H
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  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
+    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
diff --git a/src/combustionModels/combustionModel/combustionModel.C b/src/combustionModels/combustionModel/combustionModel.C
index 4c8365d9f4b63638717c762198f70325e25ab06a..1eb4f2348ffb11efcf795a4e2fa63d78a58b122b 100644
--- a/src/combustionModels/combustionModel/combustionModel.C
+++ b/src/combustionModels/combustionModel/combustionModel.C
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    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
diff --git a/src/combustionModels/combustionModel/combustionModel.H b/src/combustionModels/combustionModel/combustionModel.H
index 46077de9e4c417609b53b386cd4c7515bbf3a5ba..3f887c8de654ef1ab203b908fc24deaf0333722c 100644
--- a/src/combustionModels/combustionModel/combustionModel.H
+++ b/src/combustionModels/combustionModel/combustionModel.H
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    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
diff --git a/src/combustionModels/combustionModel/combustionModelNew.C b/src/combustionModels/combustionModel/combustionModelNew.C
index 66dc66abca51653c0b27a49343c6b8e9bea29839..5a3c8e1243146e78b9b6c381b03760545e6210fd 100644
--- a/src/combustionModels/combustionModel/combustionModelNew.C
+++ b/src/combustionModels/combustionModel/combustionModelNew.C
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  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
+    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
diff --git a/src/combustionModels/diffusion/diffusion.C b/src/combustionModels/diffusion/diffusion.C
index 44e413dfc0fc9c18e71bfc715820df210a76fc93..f56421a4ebeca9d15b7b477c0527841d544d1d99 100644
--- a/src/combustionModels/diffusion/diffusion.C
+++ b/src/combustionModels/diffusion/diffusion.C
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-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
diff --git a/src/combustionModels/diffusion/diffusion.H b/src/combustionModels/diffusion/diffusion.H
index c3002a894f790ce4689214e46d58b108a4c9ad5b..add1a643a48ee325f7779b104318810004b6d61e 100644
--- a/src/combustionModels/diffusion/diffusion.H
+++ b/src/combustionModels/diffusion/diffusion.H
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-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
diff --git a/src/combustionModels/diffusion/diffusions.C b/src/combustionModels/diffusion/diffusions.C
index 0376a91bf906e6e71b331e56fd65330568bb8ee9..1e08d210ee080731e65dde25d2dc2ab3cd24ab22 100644
--- a/src/combustionModels/diffusion/diffusions.C
+++ b/src/combustionModels/diffusion/diffusions.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C
index 558ec8b274549e529dd82481042c38c6e18e39ff..980c4697cfc2bd7ba422a6e62bd7ce7b58bcbd01 100644
--- a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C
+++ b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  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
+    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
diff --git a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H
index 778670ce4c6a9d7c116d25863bacd7bac34ce99c..0e10e9347e85f657967ca1d16091dc3f3ec33d53 100644
--- a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H
+++ b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  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
+    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
diff --git a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistrys.C b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistrys.C
index 89ea70d85c7986dd9b53342aa877ea5febf0ce66..c2c8b63e6778e1fae749007c49a214662266f392 100644
--- a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistrys.C
+++ b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistrys.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/combustionModels/noCombustion/noCombustion.C b/src/combustionModels/noCombustion/noCombustion.C
index aa38aad70fc50814a7189d59e8cdc5231717e4aa..18bb0c37514cd1d0d491e499590df3c333329d1f 100644
--- a/src/combustionModels/noCombustion/noCombustion.C
+++ b/src/combustionModels/noCombustion/noCombustion.C
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    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
@@ -25,7 +26,6 @@ License
 #include "noCombustion.H"
 #include "fvmSup.H"
 
-
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class CombThermoType>
diff --git a/src/combustionModels/noCombustion/noCombustion.H b/src/combustionModels/noCombustion/noCombustion.H
index d8f8f39912d4fee0fd5c1d22c4dd1e1a53d1cc25..835317268c860828eabb77610d29502cbea15e93 100644
--- a/src/combustionModels/noCombustion/noCombustion.H
+++ b/src/combustionModels/noCombustion/noCombustion.H
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    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
@@ -24,6 +25,7 @@ Class
     Foam::combustionModels::noCombustion
 
 Description
+    Dummy combustion model for 'no combustion'
 
 SourceFiles
     noCombustion.C
@@ -41,7 +43,7 @@ namespace combustionModels
 {
 
 /*---------------------------------------------------------------------------*\
-                            Class noCombustion Declaration
+                        Class noCombustion Declaration
 \*---------------------------------------------------------------------------*/
 
 template<class CombThermoType>
diff --git a/src/combustionModels/singleStepCombustion/singleStepCombustion.C b/src/combustionModels/singleStepCombustion/singleStepCombustion.C
index 7a354e0c6412f128e1e0191912e354b7850fbcb5..a705ff246ca422c0d34615a85834e95a42dffe48 100644
--- a/src/combustionModels/singleStepCombustion/singleStepCombustion.C
+++ b/src/combustionModels/singleStepCombustion/singleStepCombustion.C
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  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
+    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
diff --git a/src/combustionModels/singleStepCombustion/singleStepCombustion.H b/src/combustionModels/singleStepCombustion/singleStepCombustion.H
index 7d691396ae803e76e045715caf82587bf582dd33..cafa24f6d3d0ef8973ed57022346cf8d93514735 100644
--- a/src/combustionModels/singleStepCombustion/singleStepCombustion.H
+++ b/src/combustionModels/singleStepCombustion/singleStepCombustion.H
@@ -2,10 +2,11 @@
   =========                 |
   \\      /  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
+    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
diff --git a/src/conversion/ensight/part/ensightPart.C b/src/conversion/ensight/part/ensightPart.C
index 3881e76fc0d7dbdd872e9d5e6227ff1235269741..fa89a8cafe6c1d8587f0e20cbdf61a318760291f 100644
--- a/src/conversion/ensight/part/ensightPart.C
+++ b/src/conversion/ensight/part/ensightPart.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,7 @@ 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 "ensightPart.H"
 #include "dictionary.H"
diff --git a/src/conversion/ensight/part/ensightPartCells.C b/src/conversion/ensight/part/ensightPartCells.C
index 80f0cdc4ce61126c71f9f35b7a422fcac139fcfe..031aeeda3e171d83bdb2a4713684b00e2d7c31a1 100644
--- a/src/conversion/ensight/part/ensightPartCells.C
+++ b/src/conversion/ensight/part/ensightPartCells.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
@@ -21,7 +21,7 @@ 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 "ensightPartCells.H"
 #include "IOstream.H"
diff --git a/src/conversion/ensight/part/ensightPartFaces.C b/src/conversion/ensight/part/ensightPartFaces.C
index 97ee7a0204f959d32a1e58fac6ae0ce84951f76c..9257e94c9cdcc730144eacfabd2566dbc888b11a 100644
--- a/src/conversion/ensight/part/ensightPartFaces.C
+++ b/src/conversion/ensight/part/ensightPartFaces.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,7 @@ 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 "ensightPartFaces.H"
 #include "IOstreams.H"
diff --git a/src/conversion/ensight/part/ensightParts.C b/src/conversion/ensight/part/ensightParts.C
index cf843fd0c6334a1e3ca265ecfe5fe02d0b0484da..dce9cabfed270c0e39e5951665295093455e1332 100644
--- a/src/conversion/ensight/part/ensightParts.C
+++ b/src/conversion/ensight/part/ensightParts.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,7 @@ 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 "ensightParts.H"
 
diff --git a/src/conversion/meshReader/meshReaderAux.C b/src/conversion/meshReader/meshReaderAux.C
index 95360dba1e71965d77dd330fd367cb57a6c45e40..eb7c86248ccd4121589bf244155cdb302f74d468 100644
--- a/src/conversion/meshReader/meshReaderAux.C
+++ b/src/conversion/meshReader/meshReaderAux.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
@@ -21,7 +21,7 @@ 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 "meshReader.H"
 #include "IOMap.H"
diff --git a/src/conversion/meshWriter/meshWriter.C b/src/conversion/meshWriter/meshWriter.C
index 94720dcf422730c62c66ae775f344ee483991f65..36d6426757254d8ab97ecf9da6d3bbfaeadcbb2c 100644
--- a/src/conversion/meshWriter/meshWriter.C
+++ b/src/conversion/meshWriter/meshWriter.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,7 @@ 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 "meshWriter.H"
 #include "cellModeller.H"
diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C
index c8819904ea461809cb4ce1e4a6d400dddea04801..f42bed3b2dfb52db8cf29c5acfd3e079c9dc6b5b 100644
--- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C
+++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.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
@@ -302,11 +302,11 @@ Foam::dynamicRefineFvMesh::refine
             Pout<< "Found " << masterFaces.size() << " split faces " << endl;
         }
 
-        HashTable<const surfaceScalarField*> fluxes
+        HashTable<surfaceScalarField*> fluxes
         (
             lookupClass<surfaceScalarField>()
         );
-        forAllConstIter(HashTable<const surfaceScalarField*>, fluxes, iter)
+        forAllIter(HashTable<surfaceScalarField*>, fluxes, iter)
         {
             if (!correctFluxes_.found(iter.key()))
             {
@@ -336,7 +336,7 @@ Foam::dynamicRefineFvMesh::refine
                     << endl;
             }
 
-            surfaceScalarField& phi = const_cast<surfaceScalarField&>(*iter());
+            surfaceScalarField& phi = *iter();
             const surfaceScalarField phiU
             (
                 fvc::interpolate
@@ -519,11 +519,11 @@ Foam::dynamicRefineFvMesh::unrefine
         const labelList& reversePointMap = map().reversePointMap();
         const labelList& reverseFaceMap = map().reverseFaceMap();
 
-        HashTable<const surfaceScalarField*> fluxes
+        HashTable<surfaceScalarField*> fluxes
         (
             lookupClass<surfaceScalarField>()
         );
-        forAllConstIter(HashTable<const surfaceScalarField*>, fluxes, iter)
+        forAllIter(HashTable<surfaceScalarField*>, fluxes, iter)
         {
             if (!correctFluxes_.found(iter.key()))
             {
@@ -553,7 +553,7 @@ Foam::dynamicRefineFvMesh::unrefine
                     << endl;
             }
 
-            surfaceScalarField& phi = const_cast<surfaceScalarField&>(*iter());
+            surfaceScalarField& phi = *iter();
             surfaceScalarField::GeometricBoundaryField& bphi =
                 phi.boundaryField();
 
diff --git a/src/dynamicMesh/attachDetach/attachInterface.C b/src/dynamicMesh/attachDetach/attachInterface.C
index 11332a6257631a98b9773147f49b207adfcb7bd9..40c68cb8453c246bfa9bded9b2db6883bddf2caa 100644
--- a/src/dynamicMesh/attachDetach/attachInterface.C
+++ b/src/dynamicMesh/attachDetach/attachInterface.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -83,6 +83,10 @@ void Foam::attachDetach::attachInterface
 
     forAll(removedPoints, pointI)
     {
+        //Pout<< "Removing point:" << removedPoints[pointI]
+        //    << " currently at:" << ref.points()[removedPoints[pointI]]
+        //    << endl;
+
         ref.setAction(polyRemovePoint(removedPoints[pointI]));
     }
 
@@ -90,8 +94,16 @@ void Foam::attachDetach::attachInterface
     // Remove all faces from the slave patch
     forAll(slavePatch, i)
     {
+        //Pout<< "Removing face " << i + slavePatchStart
+        //    << " with verts:" << ref.faces()[i + slavePatchStart]
+        //    << " at:"
+        //    <<  UIndirectList<point>
+        //        (
+        //            ref.points(),
+        //            ref.faces()[i + slavePatchStart]
+        //        )
+        //    << endl;
         ref.setAction(polyRemoveFace(i + slavePatchStart));
-// Pout<< "Removing face " << i + slavePatchStart << endl;
     }
 
     // Modify the faces from the master patch
diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C
index a21cfb6300a642e8dfb035a2da225e2c018014ee..61cc9986a8f5eaf38542f1cd69f6858957bda839 100644
--- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C
+++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.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
@@ -21,7 +21,7 @@ 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 "fvMeshDistribute.H"
 #include "PstreamCombineReduceOps.H"
diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H
index ae9d512529b037937086aa067ae12b03cb592dca..4b2080fbf9872acb0ffaca17d2ea21193ac0a4b8 100644
--- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H
+++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H
@@ -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
@@ -103,14 +103,14 @@ class fvMeshDistribute
             label findNonEmptyPatch() const;
 
             //- Save boundary fields
-            template <class T, class Mesh>
+            template<class T, class Mesh>
             void saveBoundaryFields
             (
                 PtrList<FieldField<fvsPatchField, T> >& bflds
             ) const;
 
             //- Map boundary fields
-            template <class T, class Mesh>
+            template<class T, class Mesh>
             void mapBoundaryFields
             (
                 const mapPolyMesh& map,
diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C
index a09d538083c93c41a032d55aeace7536b6c890d4..fbc436ba410fa56fce8fc3bc4aee1e6fe31cf6db 100644
--- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C
+++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.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
@@ -56,7 +56,7 @@ void Foam::fvMeshDistribute::printFieldInfo(const fvMesh& mesh)
 
 
 // Save whole boundary field
-template <class T, class Mesh>
+template<class T, class Mesh>
 void Foam::fvMeshDistribute::saveBoundaryFields
 (
     PtrList<FieldField<fvsPatchField, T> >& bflds
@@ -66,7 +66,7 @@ void Foam::fvMeshDistribute::saveBoundaryFields
 
     HashTable<const fldType*> flds
     (
-        mesh_.objectRegistry::lookupClass<fldType>()
+        static_cast<const fvMesh&>(mesh_).objectRegistry::lookupClass<fldType>()
     );
 
     bflds.setSize(flds.size());
@@ -85,7 +85,7 @@ void Foam::fvMeshDistribute::saveBoundaryFields
 
 
 // Map boundary field
-template <class T, class Mesh>
+template<class T, class Mesh>
 void Foam::fvMeshDistribute::mapBoundaryFields
 (
     const mapPolyMesh& map,
@@ -97,7 +97,7 @@ void Foam::fvMeshDistribute::mapBoundaryFields
 
     typedef GeometricField<T, fvsPatchField, Mesh> fldType;
 
-    HashTable<const fldType*> flds
+    HashTable<fldType*> flds
     (
         mesh_.objectRegistry::lookupClass<fldType>()
     );
@@ -110,15 +110,11 @@ void Foam::fvMeshDistribute::mapBoundaryFields
 
     label fieldI = 0;
 
-    forAllConstIter(typename HashTable<const fldType*>, flds, iter)
+    forAllIter(typename HashTable<fldType*>, flds, iter)
     {
-        const fldType& fld = *iter();
+        fldType& fld = *iter();
         typename fldType::GeometricBoundaryField& bfld =
-            const_cast<typename fldType::GeometricBoundaryField&>
-            (
-                fld.boundaryField()
-            );
-
+            fld.boundaryField();
 
         const FieldField<fvsPatchField, T>& oldBfld = oldBflds[fieldI++];
 
@@ -156,20 +152,17 @@ void Foam::fvMeshDistribute::initPatchFields
     const typename GeoField::value_type& initVal
 )
 {
-    HashTable<const GeoField*> flds
+    HashTable<GeoField*> flds
     (
         mesh_.objectRegistry::lookupClass<GeoField>()
     );
 
-    forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
+    forAllIter(typename HashTable<GeoField*>, flds, iter)
     {
-        const GeoField& fld = *iter();
+        GeoField& fld = *iter();
 
         typename GeoField::GeometricBoundaryField& bfld =
-            const_cast<typename GeoField::GeometricBoundaryField&>
-            (
-                fld.boundaryField()
-            );
+            fld.boundaryField();
 
         forAll(bfld, patchI)
         {
@@ -186,16 +179,15 @@ void Foam::fvMeshDistribute::initPatchFields
 template<class GeoField>
 void Foam::fvMeshDistribute::correctBoundaryConditions()
 {
-    HashTable<const GeoField*> flds
+    HashTable<GeoField*> flds
     (
         mesh_.objectRegistry::lookupClass<GeoField>()
     );
 
-    forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
+    forAllIter(typename HashTable<GeoField*>, flds, iter)
     {
         const GeoField& fld = *iter();
-
-        const_cast<GeoField&>(fld).correctBoundaryConditions();
+        fld.correctBoundaryConditions();
     }
 }
 
diff --git a/src/dynamicMesh/fvMeshTools/fvMeshToolsTemplates.C b/src/dynamicMesh/fvMeshTools/fvMeshToolsTemplates.C
index 3e9ca9d0887e61a5b554a8b5073205c483ce102b..424fc29b3c4cbd7f39ac309fb4b35014a9a1a6e7 100644
--- a/src/dynamicMesh/fvMeshTools/fvMeshToolsTemplates.C
+++ b/src/dynamicMesh/fvMeshTools/fvMeshToolsTemplates.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -38,20 +38,17 @@ void Foam::fvMeshTools::addPatchFields
     const typename GeoField::value_type& defaultPatchValue
 )
 {
-    HashTable<const GeoField*> flds
+    HashTable<GeoField*> flds
     (
         mesh.objectRegistry::lookupClass<GeoField>()
     );
 
-    forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
+    forAllIter(typename HashTable<GeoField*>, flds, iter)
     {
-        const GeoField& fld = *iter();
+        GeoField& fld = *iter();
 
         typename GeoField::GeometricBoundaryField& bfld =
-            const_cast<typename GeoField::GeometricBoundaryField&>
-            (
-                fld.boundaryField()
-            );
+            fld.boundaryField();
 
         label sz = bfld.size();
         bfld.setSize(sz+1);
@@ -95,20 +92,17 @@ void Foam::fvMeshTools::setPatchFields
     const dictionary& patchFieldDict
 )
 {
-    HashTable<const GeoField*> flds
+    HashTable<GeoField*> flds
     (
         mesh.objectRegistry::lookupClass<GeoField>()
     );
 
-    forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
+    forAllIter(typename HashTable<GeoField*>, flds, iter)
     {
-        const GeoField& fld = *iter();
+        GeoField& fld = *iter();
 
         typename GeoField::GeometricBoundaryField& bfld =
-            const_cast<typename GeoField::GeometricBoundaryField&>
-            (
-                fld.boundaryField()
-            );
+            fld.boundaryField();
 
         if (patchFieldDict.found(fld.name()))
         {
@@ -137,20 +131,17 @@ void Foam::fvMeshTools::setPatchFields
     const typename GeoField::value_type& value
 )
 {
-    HashTable<const GeoField*> flds
+    HashTable<GeoField*> flds
     (
         mesh.objectRegistry::lookupClass<GeoField>()
     );
 
-    forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
+    forAllIter(typename HashTable<GeoField*>, flds, iter)
     {
-        const GeoField& fld = *iter();
+        GeoField& fld = *iter();
 
         typename GeoField::GeometricBoundaryField& bfld =
-            const_cast<typename GeoField::GeometricBoundaryField&>
-            (
-                fld.boundaryField()
-            );
+            fld.boundaryField();
 
         bfld[patchI] == value;
     }
@@ -161,19 +152,15 @@ void Foam::fvMeshTools::setPatchFields
 template<class GeoField>
 void Foam::fvMeshTools::trimPatchFields(fvMesh& mesh, const label nPatches)
 {
-    HashTable<const GeoField*> flds
+    HashTable<GeoField*> flds
     (
         mesh.objectRegistry::lookupClass<GeoField>()
     );
 
-    forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
+    forAllIter(typename HashTable<GeoField*>, flds, iter)
     {
-        const GeoField& fld = *iter();
-
-        const_cast<typename GeoField::GeometricBoundaryField&>
-        (
-            fld.boundaryField()
-        ).setSize(nPatches);
+        GeoField& fld = *iter();
+        fld.boundaryField().setSize(nPatches);
     }
 }
 
@@ -186,20 +173,18 @@ void Foam::fvMeshTools::reorderPatchFields
     const labelList& oldToNew
 )
 {
-    HashTable<const GeoField*> flds
+    HashTable<GeoField*> flds
     (
         mesh.objectRegistry::lookupClass<GeoField>()
     );
 
-    forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
+    forAllIter(typename HashTable<GeoField*>, flds, iter)
     {
-        const GeoField& fld = *iter();
+        GeoField& fld = *iter();
 
         typename GeoField::GeometricBoundaryField& bfld =
-            const_cast<typename GeoField::GeometricBoundaryField&>
-            (
-                fld.boundaryField()
-            );
+            fld.boundaryField();
+
         bfld.reorder(oldToNew);
     }
 }
diff --git a/src/dynamicMesh/layerAdditionRemoval/addCellLayer.C b/src/dynamicMesh/layerAdditionRemoval/addCellLayer.C
index fdcc41b6cb445690e4dd56a6c624334e19720809..2fe428d45c0c071b1de0c1aed58607d68d712b92 100644
--- a/src/dynamicMesh/layerAdditionRemoval/addCellLayer.C
+++ b/src/dynamicMesh/layerAdditionRemoval/addCellLayer.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -203,8 +203,8 @@ void Foam::layerAdditionRemoval::addCellLayer
         // Flip the face as necessary
         if
         (
-            mc[faceI] == nei[mf[faceI]]
-         || !mesh.isInternalFace(mf[faceI])
+           !mesh.isInternalFace(mf[faceI])
+         || mc[faceI] == nei[mf[faceI]]
         )
         {
             flipFaceFlux = true;
diff --git a/src/dynamicMesh/layerAdditionRemoval/removeCellLayer.C b/src/dynamicMesh/layerAdditionRemoval/removeCellLayer.C
index c6348af363460a07fac9a3e88470b761e605525a..1edaf10735c298436ac4d2bffba2ea53a0237b27 100644
--- a/src/dynamicMesh/layerAdditionRemoval/removeCellLayer.C
+++ b/src/dynamicMesh/layerAdditionRemoval/removeCellLayer.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -275,7 +275,7 @@ void Foam::layerAdditionRemoval::removeCellLayer
         // of the cell to be removed
         label masterSideCell = own[mf[faceI]];
 
-        if (masterSideCell == mc[faceI])
+        if (mesh.isInternalFace(mf[faceI]) && masterSideCell == mc[faceI])
         {
             // Owner cell of the face is being removed.
             // Grab the neighbour instead
@@ -284,7 +284,7 @@ void Foam::layerAdditionRemoval::removeCellLayer
 
         label slaveSideCell = own[ftc[faceI]];
 
-        if (slaveSideCell == mc[faceI])
+        if (mesh.isInternalFace(ftc[faceI]) && slaveSideCell == mc[faceI])
         {
             // Owner cell of the face is being removed.
             // Grab the neighbour instead
diff --git a/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C b/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C
index d1f847629252723372fcc77d6ba10353b0311f59..ce04d65990a60c3be98c42e1446d2c5d005d4e50 100644
--- a/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C
+++ b/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -49,7 +49,7 @@ const Foam::scalar Foam::topoCellLooper::featureCos = Foam::cos(degToRad(10.0));
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 // In-memory truncate a list
-template <class T>
+template<class T>
 void Foam::topoCellLooper::subsetList
 (
     const label startI,
diff --git a/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.H b/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.H
index 8804f4c46bed62c26be7022644ce55fa8220d754..2e33ef880fe46b5185e85888fc8f5a02f4143643 100644
--- a/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.H
+++ b/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -72,7 +72,7 @@ class topoCellLooper
     // Private Member Functions
 
         //- In-memory truncate a list
-        template <class T>
+        template<class T>
         static void subsetList
         (
             const label startI,
diff --git a/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.C b/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.C
index 0272f0cb5617a48abf335ebca1b6c95fe179dcac..2e19bb7e324ed4615b441312d4af21cf6fb7ca01 100644
--- a/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.C
+++ b/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,6 @@ 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 "directionInfo.H"
diff --git a/src/dynamicMesh/meshCut/directions/directionInfo/directionInfoI.H b/src/dynamicMesh/meshCut/directions/directionInfo/directionInfoI.H
index 2f0fdd004f7c8f6c07fdf45be636d1fd5110ae55..c2c77f7384ae468ec84e72a7e80bce20d0e375ee 100644
--- a/src/dynamicMesh/meshCut/directions/directionInfo/directionInfoI.H
+++ b/src/dynamicMesh/meshCut/directions/directionInfo/directionInfoI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -285,7 +285,7 @@ inline bool Foam::directionInfo::updateFace
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::directionInfo::equal
 (
     const directionInfo& rhs,
diff --git a/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfoI.H b/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfoI.H
index 2e584576800671cb6c76d528fae563aa41e32b58..e24734607b813da582b3ab4ac79280fd2401af58 100644
--- a/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfoI.H
+++ b/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfoI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -194,7 +194,7 @@ inline bool Foam::wallNormalInfo::updateFace
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::wallNormalInfo::equal
 (
     const wallNormalInfo& rhs,
diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.C b/src/dynamicMesh/motionSmoother/motionSmoother.C
index a89d1cf60fd1fa503884def286feb4463dcbc258..c7d5d28e765ada2e25f0562519b16b5b5c7c4d7d 100644
--- a/src/dynamicMesh/motionSmoother/motionSmoother.C
+++ b/src/dynamicMesh/motionSmoother/motionSmoother.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
@@ -37,7 +37,7 @@ License
 
 namespace Foam
 {
-defineTypeNameAndDebug(motionSmoother, 0);
+    defineTypeNameAndDebug(motionSmoother, 0);
 }
 
 
@@ -65,7 +65,11 @@ void Foam::motionSmoother::testSyncPositions
         {
             FatalErrorIn
             (
-                "motionSmoother::testSyncPositions(const pointField&)"
+                "motionSmoother::testSyncPositions"
+                "("
+                    "const pointField&, "
+                    "const scalar"
+                ")"
             )   << "On point " << i << " point:" << fld[i]
                 << " synchronised point:" << syncedFld[i]
                 << abort(FatalError);
@@ -245,7 +249,7 @@ void Foam::motionSmoother::checkFld(const pointScalarField& fld)
         {}
         else
         {
-            FatalErrorIn("motionSmoother::checkFld")
+            FatalErrorIn("motionSmoother::checkFld(const pointScalarField&)")
                 << "Problem : point:" << pointI << " value:" << val
                 << abort(FatalError);
         }
@@ -870,7 +874,7 @@ Foam::tmp<Foam::scalarField> Foam::motionSmoother::movePoints
 
         if (mesh_.globalData().parallel())
         {
-            WarningIn("motionSmoother::movePoints(pointField& newPoints)")
+            WarningIn("motionSmoother::movePoints(pointField&)")
                 << "2D mesh-motion probably not correct in parallel" << endl;
         }
 
@@ -981,7 +985,18 @@ bool Foam::motionSmoother::scaleMesh
 {
     if (!smoothMesh && adaptPatchIDs_.empty())
     {
-        FatalErrorIn("motionSmoother::scaleMesh(const bool")
+        FatalErrorIn
+        (
+            "motionSmoother::scaleMesh"
+            "("
+                "labelList&, "
+                "const List<labelPair>&, "
+                "const dictionary&, "
+                "const dictionary&, "
+                "const bool, "
+                "const label"
+            ")"
+        )
             << "You specified both no movement on the internal mesh points"
             << " (smoothMesh = false)" << nl
             << "and no movement on the patch (adaptPatchIDs is empty)" << nl
@@ -1062,7 +1077,7 @@ bool Foam::motionSmoother::scaleMesh
         newPoints = oldPoints_ + totalDisplacement.internalField();
     }
 
-    Info<< "Moving mesh using diplacement scaling :"
+    Info<< "Moving mesh using displacement scaling :"
         << " min:" << gMin(scale_.internalField())
         << "  max:" << gMax(scale_.internalField())
         << endl;
@@ -1225,7 +1240,7 @@ void Foam::motionSmoother::updateMesh()
         {
             FatalErrorIn
             (
-                "motionSmoother::motionSmoother"
+                "motionSmoother::updateMesh"
             )   << "Patch " << patches[patchI].name()
                 << " has wrong boundary condition "
                 << displacement_.boundaryField()[patchI].type()
diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.H b/src/dynamicMesh/motionSmoother/motionSmoother.H
index fe4073c1b5a450d4871b5663d57580f8b2a9d96e..ee5432ad4ec4218768f8226a95770ecd71915897 100644
--- a/src/dynamicMesh/motionSmoother/motionSmoother.H
+++ b/src/dynamicMesh/motionSmoother/motionSmoother.H
@@ -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
@@ -179,7 +179,7 @@ class motionSmoother
     // Private Member Functions
 
         //- Average of connected points.
-        template <class Type>
+        template<class Type>
         tmp<GeometricField<Type, pointPatchField, pointMesh> > avg
         (
             const GeometricField<Type, pointPatchField, pointMesh>& fld,
@@ -187,7 +187,7 @@ class motionSmoother
         ) const;
 
         //- Average postion of connected points.
-        template <class Type>
+        template<class Type>
         tmp<GeometricField<Type, pointPatchField, pointMesh> > avgPositions
         (
             const GeometricField<Type, pointPatchField, pointMesh>& fld,
@@ -510,7 +510,7 @@ public:
 
                 //- Fully explicit smoothing of fields (not positions)
                 //  of internal points with varying diffusivity.
-                template <class Type>
+                template<class Type>
                 void smooth
                 (
                     const GeometricField<Type, pointPatchField, pointMesh>& fld,
diff --git a/src/dynamicMesh/motionSmoother/motionSmootherTemplates.C b/src/dynamicMesh/motionSmoother/motionSmootherTemplates.C
index 74a255dc854a93d6a6cf1355c9a3d590249947fc..89667aade37ff693125799db48ff47b2a4d0a05d 100644
--- a/src/dynamicMesh/motionSmoother/motionSmootherTemplates.C
+++ b/src/dynamicMesh/motionSmoother/motionSmootherTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -153,7 +153,7 @@ void Foam::motionSmoother::applyCornerConstraints
 
 
 // Average of connected points.
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
 Foam::motionSmoother::avg
 (
@@ -252,7 +252,7 @@ Foam::motionSmoother::avg
 
 
 // smooth field (point-jacobi)
-template <class Type>
+template<class Type>
 void Foam::motionSmoother::smooth
 (
     const GeometricField<Type, pointPatchField, pointMesh>& fld,
diff --git a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C
index 13786a1c1cb901c07d9925f7aa1e8cbed99d2f04..d3b69d392f391a8d554d3557d677b006a3d8902e 100644
--- a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C
+++ b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.H b/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.H
index 5370797094f02b9bffae69aa980b2007196ed5d8..10449407774ff6c906b615e20d042dea8c4149b9 100644
--- a/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.H
+++ b/src/dynamicMesh/motionSolver/componentVelocity/componentVelocityMotionSolver.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -108,6 +108,13 @@ public:
 
     // Member Functions
 
+        //- Non-const access to the pointMotionU in order to allow changes
+        //  to the boundary motion
+        pointScalarField& pointMotionU()
+        {
+            return pointMotionU_;
+        }
+
         //- Update local data for geometry changes
         virtual void movePoints(const pointField&);
 
diff --git a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C
index e8e7b52721da4e438b0f1d69370f92389c13cb1f..986922f61d8c83c2ff8d15bc9cba785c427ca4bf 100644
--- a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C
+++ b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.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
@@ -21,7 +21,7 @@ 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 "faceCoupleInfo.H"
 #include "polyMesh.H"
diff --git a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C
index dfcc6a545eeacdc1692c53c2fc5304445e0cff25..45c96fc38552ffd13aac5b469b28b37b2d1e10f3 100644
--- a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C
+++ b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.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
@@ -21,7 +21,7 @@ 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 "polyMeshAdder.H"
 #include "mapAddedPolyMesh.H"
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.H
index dc6b1578c15764e302a2297dac48a7253b0f7e53..f56c5b45e30643c7ec8874e89337d9061508e790 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.H
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapseI.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapseI.H
index 76bcdf4753da00b906857b4f8e0d1ebe7f8ffc68..84a11d1cbe657365bdcdc40e9c66ae03d469313f 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapseI.H
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapseI.H
@@ -266,7 +266,7 @@ inline bool Foam::pointEdgeCollapse::updateEdge
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::pointEdgeCollapse::equal
 (
     const pointEdgeCollapse& rhs,
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChangeTemplates.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChangeTemplates.C
index b55c89e6ee108555b8d5af2d783c7f2b48fe9faf..69da6c4a2ece2802acbafc31a02bb5bfcc0f5e09 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChangeTemplates.C
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChangeTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class T>
+template<class T>
 void Foam::polyTopoChange::reorder
 (
     const labelList& oldToNew,
@@ -49,7 +49,7 @@ void Foam::polyTopoChange::reorder
 }
 
 
-template <class T>
+template<class T>
 void Foam::polyTopoChange::reorder
 (
     const labelList& oldToNew,
@@ -71,7 +71,7 @@ void Foam::polyTopoChange::reorder
 }
 
 
-template <class T>
+template<class T>
 void Foam::polyTopoChange::renumberKey
 (
     const labelList& oldToNew,
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDataI.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDataI.H
index fa519750241a56deedff0aed42fdce46634aa24b..edf115b3a88abc7dc9583ce3cb522ff969e79382 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDataI.H
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDataI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -236,7 +236,7 @@ inline bool Foam::refinementData::updateFace
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::refinementData::equal
 (
     const refinementData& rhs,
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceDataI.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceDataI.H
index 33045f2541d00b734b8c09f317b97c73598b3db5..28d24017751c0a651ec899b7ffa953e50595e1a6 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceDataI.H
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceDataI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -260,7 +260,7 @@ inline bool Foam::refinementDistanceData::updateFace
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::refinementDistanceData::equal
 (
     const refinementDistanceData& rhs,
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/removePoints.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/removePoints.C
index e0ea2e41af4a239e150b22746e9ba87a8ffd833d..b628afde9a6ed642b2d5772df9503a27dcf3e318 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/removePoints.C
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/removePoints.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -44,7 +44,7 @@ defineTypeNameAndDebug(removePoints, 0);
 
 //- Combine-reduce operator to combine data on faces. Takes care
 //  of reverse orientation on coupled face.
-template <class T, template<class> class CombineOp>
+template<class T, template<class> class CombineOp>
 class faceEqOp
 {
 
@@ -73,7 +73,7 @@ public:
 
 
 //// Dummy transform for List. Used in synchronisation.
-//template <class T>
+//template<class T>
 //class dummyTransformList
 //{
 //public:
diff --git a/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C b/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C
index cc66e0201d9d0266bcb60770c6e6d809d5e987d5..50ad3749b861d100cc57ffaf3d6879f24febbae5 100644
--- a/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C
+++ b/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.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
@@ -80,19 +80,20 @@ void Foam::fvMotionSolverEngineMesh::move()
     // Position of the top of the static mesh layers above the piston
     scalar pistonPlusLayers = pistonPosition_.value() + pistonLayers_.value();
 
-    motionSolver_.cellMotionU().boundaryField()[pistonIndex_] == deltaZ;
+    scalar pistonSpeed = deltaZ/engineDB_.deltaTValue();
+
+    motionSolver_.pointMotionU().boundaryField()[pistonIndex_] == pistonSpeed;
 
     {
         scalarField linerPoints
         (
-            motionSolver_.cellMotionU()
-           .boundaryField()[linerIndex_].patch().Cf().component(vector::Z)
+            boundary()[linerIndex_].patch().localPoints().component(vector::Z)
         );
 
-        motionSolver_.cellMotionU().boundaryField()[linerIndex_] ==
-            deltaZ*pos(deckHeight_.value() - linerPoints)
-            *(deckHeight_.value() - linerPoints)
-            /(deckHeight_.value() - pistonPlusLayers);
+        motionSolver_.pointMotionU().boundaryField()[linerIndex_] ==
+            pistonSpeed*pos(deckHeight_.value() - linerPoints)
+           *(deckHeight_.value() - linerPoints)
+           /(deckHeight_.value() - pistonPlusLayers);
     }
 
     motionSolver_.solve();
@@ -130,7 +131,6 @@ void Foam::fvMotionSolverEngineMesh::move()
 
 
     pistonPosition_.value() += deltaZ;
-    scalar pistonSpeed = deltaZ/engineDB_.deltaTValue();
 
     Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl
         << "Piston speed = " << pistonSpeed << " m/s" << endl;
diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files
index 47bdb976b3f4d6800b47156a3ec7cc2a5348a2ea..1ce1f78949b80b58cb39789306dded602293c741 100644
--- a/src/finiteVolume/Make/files
+++ b/src/finiteVolume/Make/files
@@ -53,17 +53,22 @@ $(fvMeshMapper)/fvSurfaceMapper.C
 extendedStencil = fvMesh/extendedStencil
 
 cellToCell = $(extendedStencil)/cellToCell
-$(cellToCell)/fullStencils/cellToCellStencil.C
-$(cellToCell)/fullStencils/CFCCellToCellStencil.C
-$(cellToCell)/fullStencils/CPCCellToCellStencil.C
-$(cellToCell)/fullStencils/CECCellToCellStencil.C
+$(cellToCell)/extendedCellToCellStencil.C
+$(cellToCell)/extendedCentredCellToCellStencil.C
+$(cellToCell)/globalIndexStencils/cellToCellStencil.C
+$(cellToCell)/globalIndexStencils/CFCCellToCellStencil.C
+$(cellToCell)/globalIndexStencils/CPCCellToCellStencil.C
+$(cellToCell)/globalIndexStencils/CECCellToCellStencil.C
+$(cellToCell)/MeshObjects/centredCECCellToCellStencilObject.C
+$(cellToCell)/MeshObjects/centredCFCCellToCellStencilObject.C
+$(cellToCell)/MeshObjects/centredCPCCellToCellStencilObject.C
 
 cellToFace = $(extendedStencil)/cellToFace
-$(cellToFace)/fullStencils/cellToFaceStencil.C
-$(cellToFace)/fullStencils/CFCCellToFaceStencil.C
-$(cellToFace)/fullStencils/CECCellToFaceStencil.C
-$(cellToFace)/fullStencils/CPCCellToFaceStencil.C
-$(cellToFace)/fullStencils/FECCellToFaceStencil.C
+$(cellToFace)/globalIndexStencils/cellToFaceStencil.C
+$(cellToFace)/globalIndexStencils/CFCCellToFaceStencil.C
+$(cellToFace)/globalIndexStencils/CECCellToFaceStencil.C
+$(cellToFace)/globalIndexStencils/CPCCellToFaceStencil.C
+$(cellToFace)/globalIndexStencils/FECCellToFaceStencil.C
 $(cellToFace)/extendedCellToFaceStencil.C
 $(cellToFace)/extendedCentredCellToFaceStencil.C
 $(cellToFace)/extendedUpwindCellToFaceStencil.C
@@ -78,8 +83,8 @@ $(cellToFace)/MeshObjects/upwindFECCellToFaceStencilObject.C
 $(cellToFace)/MeshObjects/pureUpwindCFCCellToFaceStencilObject.C
 
 faceToCell = $(extendedStencil)/faceToCell
-$(faceToCell)/fullStencils/faceToCellStencil.C
-$(faceToCell)/fullStencils/CFCFaceToCellStencil.C
+$(faceToCell)/globalIndexStencils/faceToCellStencil.C
+$(faceToCell)/globalIndexStencils/CFCFaceToCellStencil.C
 $(faceToCell)/extendedFaceToCellStencil.C
 $(faceToCell)/extendedCentredFaceToCellStencil.C
 $(faceToCell)/MeshObjects/centredCFCFaceToCellStencilObject.C
@@ -124,6 +129,7 @@ $(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C
 $(derivedFvPatchFields)/codedFixedValue/codedFixedValueFvPatchFields.C
 $(derivedFvPatchFields)/codedMixed/codedMixedFvPatchFields.C
 $(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C
+$(derivedFvPatchFields)/externalCoupledMixed/externalCoupledMixedFvPatchFields.C
 $(derivedFvPatchFields)/fan/fanFvPatchFields.C
 $(derivedFvPatchFields)/fanPressure/fanPressureFvPatchScalarField.C
 $(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C
@@ -334,8 +340,7 @@ $(gradSchemes)/gaussGrad/gaussGrads.C
 
 $(gradSchemes)/leastSquaresGrad/leastSquaresVectors.C
 $(gradSchemes)/leastSquaresGrad/leastSquaresGrads.C
-$(gradSchemes)/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C
-$(gradSchemes)/extendedLeastSquaresGrad/extendedLeastSquaresGrads.C
+$(gradSchemes)/LeastSquaresGrad/LeastSquaresGrads.C
 $(gradSchemes)/fourthGrad/fourthGrads.C
 
 limitedGradSchemes = $(gradSchemes)/limitedGradSchemes
diff --git a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C
index d78bfc41a58b4d7123938463bd6d44cea507c6a3..c44d23712395f5931f9d61d35ed0fba566ffd1a2 100644
--- a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C
+++ b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,8 +27,9 @@ License
 #include "addToRunTimeSelectionTable.H"
 #include "volFields.H"
 #include "surfaceFields.H"
-
 #include "SRFModel.H"
+#include "steadyStateDdtScheme.H"
+
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
@@ -40,6 +41,7 @@ SRFFreestreamVelocityFvPatchVectorField
 )
 :
     inletOutletFvPatchVectorField(p, iF),
+    relative_(false),
     UInf_(vector::zero)
 {}
 
@@ -54,6 +56,7 @@ SRFFreestreamVelocityFvPatchVectorField
 )
 :
     inletOutletFvPatchVectorField(ptf, p, iF, mapper),
+    relative_(ptf.relative_),
     UInf_(ptf.UInf_)
 {}
 
@@ -67,6 +70,7 @@ SRFFreestreamVelocityFvPatchVectorField
 )
 :
     inletOutletFvPatchVectorField(p, iF),
+    relative_(dict.lookupOrDefault("relative", false)),
     UInf_(dict.lookup("UInf"))
 {
     fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
@@ -80,6 +84,7 @@ SRFFreestreamVelocityFvPatchVectorField
 )
 :
     inletOutletFvPatchVectorField(srfvpvf),
+    relative_(srfvpvf.relative_),
     UInf_(srfvpvf.UInf_)
 {}
 
@@ -92,6 +97,7 @@ SRFFreestreamVelocityFvPatchVectorField
 )
 :
     inletOutletFvPatchVectorField(srfvpvf, iF),
+    relative_(srfvpvf.relative_),
     UInf_(srfvpvf.UInf_)
 {}
 
@@ -109,12 +115,36 @@ void Foam::SRFFreestreamVelocityFvPatchVectorField::updateCoeffs()
     const SRF::SRFModel& srf =
         db().lookupObject<SRF::SRFModel>("SRFProperties");
 
-    scalar time = this->db().time().value();
-    scalar theta = time*mag(srf.omega().value());
 
-    refValue() =
-        cos(theta)*UInf_ + sin(theta)*(srf.axis() ^ UInf_)
-      - srf.velocity(patch().Cf());
+    word ddtScheme
+    (
+        this->dimensionedInternalField().mesh()
+       .ddtScheme(this->dimensionedInternalField().name())
+    );
+
+    if (ddtScheme == fv::steadyStateDdtScheme<scalar>::typeName)
+    {
+        // If not relative to the SRF include the effect of the SRF
+        if (!relative_)
+        {
+            refValue() = UInf_ - srf.velocity(patch().Cf());
+        }
+        // If already relative to the SRF simply supply the inlet value
+        // as a fixed value
+        else
+        {
+            refValue() = UInf_;
+        }
+    }
+    else
+    {
+        scalar time = this->db().time().value();
+        scalar theta = time*mag(srf.omega().value());
+
+        refValue() =
+            cos(theta)*UInf_ + sin(theta)*(srf.axis() ^ UInf_)
+          - srf.velocity(patch().Cf());
+    }
 
     // Set the inlet-outlet choice based on the direction of the freestream
     valueFraction() = 1.0 - pos(refValue() & patch().Sf());
@@ -126,6 +156,7 @@ void Foam::SRFFreestreamVelocityFvPatchVectorField::updateCoeffs()
 void Foam::SRFFreestreamVelocityFvPatchVectorField::write(Ostream& os) const
 {
     fvPatchVectorField::write(os);
+    os.writeKeyword("relative") << relative_ << token::END_STATEMENT << nl;
     os.writeKeyword("UInf") << UInf_ << token::END_STATEMENT << nl;
     writeEntry("value", os);
 }
diff --git a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.H b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.H
index 58c7ab9ce081d103576f51f41df1c165427eb262..75bef5835d496a0dbe5f1133f240595bb666b385 100644
--- a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.H
+++ b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.H
@@ -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
@@ -28,7 +28,7 @@ Description
     Freestream velocity condition to be used in conjunction with the single
     rotating frame (SRF) model (see: SRFModel class)
 
-    Given the free stream velocity in the absolute frame, the condition 
+    Given the free stream velocity in the absolute frame, the condition
     applies the appropriate rotation transformation in time and space to
     determine the local velocity using:
 
@@ -49,8 +49,9 @@ Description
     \heading Patch usage
 
     \table
-        Property     | Description             | Required    | Default value
-        UInf         | free stream velocity    | yes         |
+        Property        | Description               | Required | Default value
+        UInf            | freestream velocity       | yes      |
+        relative        | UInf relative to the SRF? | no       |
     \endtable
 
     Example of the boundary condition specification:
@@ -58,13 +59,18 @@ Description
     myPatch
     {
         type            SRFFreestreamVelocity;
-        UInf            (0 0 0);
-        value           uniform (0 0 0);    // optional value entry
+        UInf            uniform (0 0 0);
+        relative        no;
+        value           uniform (0 0 0);    // initial value
     }
     \endverbatim
 
+SeeAlso
+    Foam::freestreamFvPatchField
+    Foam::SRFVelocityFvPatchVectorField
+
 SourceFiles
-    SRFVelocityFvPatchVectorField.C
+    SRFFreestreamVelocityFvPatchVectorField.C
 
 \*---------------------------------------------------------------------------*/
 
@@ -72,6 +78,7 @@ SourceFiles
 #define SRFFreestreamVelocityFvPatchVectorField_H
 
 #include "inletOutletFvPatchFields.H"
+#include "Switch.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -88,6 +95,9 @@ class SRFFreestreamVelocityFvPatchVectorField
 {
     // Private data
 
+        //- Is the supplied inlet value relative to the SRF
+        Switch relative_;
+
         //- Velocity of the free stream in the absolute frame [m/s]
         vector UInf_;
 
diff --git a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H
index 32aaa246a76693adea2654d6b0533e9ca06cfe14..33b0314cef286ee0202e6a1cb99f17a44e5cf558 100644
--- a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H
+++ b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H
@@ -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
@@ -31,7 +31,7 @@ Description
     Velocity condition to be used in conjunction with the single
     rotating frame (SRF) model (see: SRFModel class)
 
-    Given the free stream velocity in the absolute frame, the condition 
+    Given the free stream velocity in the absolute frame, the condition
     applies the appropriate rotation transformation in time and space to
     determine the local velocity.
 
@@ -62,8 +62,8 @@ Description
 
     \table
         Property     | Description             | Required    | Default value
-        relative     | relative motion to the SRF? | yes     |
         inletValue   | inlet velocity          | yes         |
+        relative     | inletValue relative motion to the SRF? | yes     |
     \endtable
 
     Example of the boundary condition specification:
@@ -71,8 +71,8 @@ Description
     myPatch
     {
         type            SRFVelocity;
-        relative        yes;
         inletValue      uniform (0 0 0);
+        relative        yes;
         value           uniform (0 0 0);    // initial value
     }
     \endverbatim
diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlTemplates.C b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlTemplates.C
index 2b20a75ae22e0b44b09a75540439198a45fe0c4a..e7391cb1b85690d1e87d2f432b3df431f35d0fc7 100644
--- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlTemplates.C
+++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControlTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -34,12 +34,12 @@ void Foam::solutionControl::storePrevIter() const
 {
     typedef GeometricField<Type, fvPatchField, volMesh> GeoField;
 
-    HashTable<const GeoField*>
+    HashTable<GeoField*>
         flds(mesh_.objectRegistry::lookupClass<GeoField>());
 
-    forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
+    forAllIter(typename HashTable<GeoField*>, flds, iter)
     {
-        GeoField& fld = const_cast<GeoField&>(*iter());
+        GeoField& fld = *iter();
 
         const word& fName = fld.name();
 
diff --git a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C
index 895f3404799786cb817e53fac4f0632a800a08a8..1a0aacd03039f349486cc1a29a8cbc5cc84dc3b3 100644
--- a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.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
@@ -25,15 +25,10 @@ License
 
 #include "coupledFvPatchField.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class Type>
-coupledFvPatchField<Type>::coupledFvPatchField
+Foam::coupledFvPatchField<Type>::coupledFvPatchField
 (
     const fvPatch& p,
     const DimensionedField<Type, volMesh>& iF
@@ -45,7 +40,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
 
 
 template<class Type>
-coupledFvPatchField<Type>::coupledFvPatchField
+Foam::coupledFvPatchField<Type>::coupledFvPatchField
 (
     const fvPatch& p,
     const DimensionedField<Type, volMesh>& iF,
@@ -58,7 +53,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
 
 
 template<class Type>
-coupledFvPatchField<Type>::coupledFvPatchField
+Foam::coupledFvPatchField<Type>::coupledFvPatchField
 (
     const coupledFvPatchField<Type>& ptf,
     const fvPatch& p,
@@ -72,7 +67,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
 
 
 template<class Type>
-coupledFvPatchField<Type>::coupledFvPatchField
+Foam::coupledFvPatchField<Type>::coupledFvPatchField
 (
     const fvPatch& p,
     const DimensionedField<Type, volMesh>& iF,
@@ -85,7 +80,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
 
 
 template<class Type>
-coupledFvPatchField<Type>::coupledFvPatchField
+Foam::coupledFvPatchField<Type>::coupledFvPatchField
 (
     const coupledFvPatchField<Type>& ptf
 )
@@ -96,7 +91,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
 
 
 template<class Type>
-coupledFvPatchField<Type>::coupledFvPatchField
+Foam::coupledFvPatchField<Type>::coupledFvPatchField
 (
     const coupledFvPatchField<Type>& ptf,
     const DimensionedField<Type, volMesh>& iF
@@ -110,16 +105,19 @@ coupledFvPatchField<Type>::coupledFvPatchField
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class Type>
-tmp<Field<Type> > coupledFvPatchField<Type>::snGrad() const
+Foam::tmp<Foam::Field<Type> > Foam::coupledFvPatchField<Type>::snGrad
+(
+    const scalarField& deltaCoeffs
+) const
 {
     return
-        (this->patchNeighbourField() - this->patchInternalField())
-       *this->patch().deltaCoeffs();
+        deltaCoeffs
+       *(this->patchNeighbourField() - this->patchInternalField());
 }
 
 
 template<class Type>
-void coupledFvPatchField<Type>::initEvaluate(const Pstream::commsTypes)
+void Foam::coupledFvPatchField<Type>::initEvaluate(const Pstream::commsTypes)
 {
     if (!this->updated())
     {
@@ -129,7 +127,7 @@ void coupledFvPatchField<Type>::initEvaluate(const Pstream::commsTypes)
 
 
 template<class Type>
-void coupledFvPatchField<Type>::evaluate(const Pstream::commsTypes)
+void Foam::coupledFvPatchField<Type>::evaluate(const Pstream::commsTypes)
 {
     if (!this->updated())
     {
@@ -147,7 +145,8 @@ void coupledFvPatchField<Type>::evaluate(const Pstream::commsTypes)
 
 
 template<class Type>
-tmp<Field<Type> > coupledFvPatchField<Type>::valueInternalCoeffs
+Foam::tmp<Foam::Field<Type> >
+Foam::coupledFvPatchField<Type>::valueInternalCoeffs
 (
     const tmp<scalarField>& w
 ) const
@@ -155,8 +154,10 @@ tmp<Field<Type> > coupledFvPatchField<Type>::valueInternalCoeffs
     return Type(pTraits<Type>::one)*w;
 }
 
+
 template<class Type>
-tmp<Field<Type> > coupledFvPatchField<Type>::valueBoundaryCoeffs
+Foam::tmp<Foam::Field<Type> >
+Foam::coupledFvPatchField<Type>::valueBoundaryCoeffs
 (
     const tmp<scalarField>& w
 ) const
@@ -164,30 +165,53 @@ tmp<Field<Type> > coupledFvPatchField<Type>::valueBoundaryCoeffs
     return Type(pTraits<Type>::one)*(1.0 - w);
 }
 
+
 template<class Type>
-tmp<Field<Type> > coupledFvPatchField<Type>::gradientInternalCoeffs() const
+Foam::tmp<Foam::Field<Type> >
+Foam::coupledFvPatchField<Type>::gradientInternalCoeffs
+(
+    const scalarField& deltaCoeffs
+) const
 {
+    return -Type(pTraits<Type>::one)*deltaCoeffs;
+}
+
+
+template<class Type>
+Foam::tmp<Foam::Field<Type> >
+Foam::coupledFvPatchField<Type>::gradientInternalCoeffs() const
+{
+    notImplemented("coupledFvPatchField<Type>::gradientInternalCoeffs()");
     return -Type(pTraits<Type>::one)*this->patch().deltaCoeffs();
 }
 
 
 template<class Type>
-tmp<Field<Type> > coupledFvPatchField<Type>::gradientBoundaryCoeffs() const
+Foam::tmp<Foam::Field<Type> >
+Foam::coupledFvPatchField<Type>::gradientBoundaryCoeffs
+(
+    const scalarField& deltaCoeffs
+) const
 {
+    return -this->gradientInternalCoeffs(deltaCoeffs);
+}
+
+
+template<class Type>
+Foam::tmp<Foam::Field<Type> >
+Foam::coupledFvPatchField<Type>::gradientBoundaryCoeffs() const
+{
+    notImplemented("coupledFvPatchField<Type>::gradientBoundaryCoeffs()");
     return -this->gradientInternalCoeffs();
 }
 
 
 template<class Type>
-void coupledFvPatchField<Type>::write(Ostream& os) const
+void Foam::coupledFvPatchField<Type>::write(Ostream& os) const
 {
     fvPatchField<Type>::write(os);
     this->writeEntry("value", os);
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H
index 1f2dcbfb61400aa80421f8e878ad5668887b27ac..4a443c6f115205304d6323c329f3b8edaf64a49c 100644
--- a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H
@@ -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
@@ -139,7 +139,20 @@ public:
         // Evaluation functions
 
             //- Return patch-normal gradient
-            virtual tmp<Field<Type> > snGrad() const;
+            virtual tmp<Field<Type> > snGrad
+            (
+                const scalarField& deltaCoeffs
+            ) const;
+
+            //- Return patch-normal gradient
+            virtual tmp<Field<Type> > snGrad() const
+            {
+                notImplemented
+                (
+                    type() + "::coupledFvPatchField<Type>::snGrad()"
+                );
+                return *this;
+            }
 
             //- Initialise the evaluation of the patch field
             virtual void initEvaluate
@@ -167,10 +180,24 @@ public:
                 const tmp<scalarField>&
             ) const;
 
+            //- Return the matrix diagonal coefficients corresponding to the
+            //  evaluation of the gradient of this patchField
+            virtual tmp<Field<Type> > gradientInternalCoeffs
+            (
+                const scalarField& deltaCoeffs
+            ) const;
+
             //- Return the matrix diagonal coefficients corresponding to the
             //  evaluation of the gradient of this patchField
             virtual tmp<Field<Type> > gradientInternalCoeffs() const;
 
+            //- Return the matrix source coefficients corresponding to the
+            //  evaluation of the gradient of this patchField
+            virtual tmp<Field<Type> > gradientBoundaryCoeffs
+            (
+                const scalarField& deltaCoeffs
+            ) const;
+
             //- Return the matrix source coefficients corresponding to the
             //  evaluation of the gradient of this patchField
             virtual tmp<Field<Type> > gradientBoundaryCoeffs() const;
diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H
index 3540c9254ca7198422e26d4af1d8d5a0627821cc..8e1b21691f72ffd3aec03f8abd481f3ac9a6c29f 100644
--- a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H
@@ -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
@@ -35,7 +35,7 @@ Description
 
     \table
         Property     | Description             | Required    | Default value
-        value        | values                  | yes         |
+        value        | Patch face values       | yes         |
     \endtable
 
     Example of the boundary condition specification:
diff --git a/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.C
index f530fd1ac9d6e2955bc05e8c5465dacdda4c7309..ffb59873df23b4672e606becd5a860ab8feb3148 100644
--- a/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.H
index 06671ea1326fe3b52df4ae591720781e6b77362d..b9c794641df40812a2745852cd2ce56536bcb4da 100644
--- a/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -55,7 +55,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class slicedFvPatch Declaration
+                        Class slicedFvPatch Declaration
 \*---------------------------------------------------------------------------*/
 
 template<class Type>
diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C
index c9fb2563c162c0ac19931865fa673addac20b5d5..e670468b69d954ebe455fc58e0776d9e0d60de3e 100644
--- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -28,15 +28,10 @@ License
 #include "demandDrivenData.H"
 #include "transformField.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
 
 template<class Type>
-processorFvPatchField<Type>::processorFvPatchField
+Foam::processorFvPatchField<Type>::processorFvPatchField
 (
     const fvPatch& p,
     const DimensionedField<Type, volMesh>& iF
@@ -54,7 +49,7 @@ processorFvPatchField<Type>::processorFvPatchField
 
 
 template<class Type>
-processorFvPatchField<Type>::processorFvPatchField
+Foam::processorFvPatchField<Type>::processorFvPatchField
 (
     const fvPatch& p,
     const DimensionedField<Type, volMesh>& iF,
@@ -74,7 +69,7 @@ processorFvPatchField<Type>::processorFvPatchField
 
 // Construct by mapping given processorFvPatchField<Type>
 template<class Type>
-processorFvPatchField<Type>::processorFvPatchField
+Foam::processorFvPatchField<Type>::processorFvPatchField
 (
     const processorFvPatchField<Type>& ptf,
     const fvPatch& p,
@@ -119,7 +114,7 @@ processorFvPatchField<Type>::processorFvPatchField
 
 
 template<class Type>
-processorFvPatchField<Type>::processorFvPatchField
+Foam::processorFvPatchField<Type>::processorFvPatchField
 (
     const fvPatch& p,
     const DimensionedField<Type, volMesh>& iF,
@@ -157,7 +152,7 @@ processorFvPatchField<Type>::processorFvPatchField
 
 
 template<class Type>
-processorFvPatchField<Type>::processorFvPatchField
+Foam::processorFvPatchField<Type>::processorFvPatchField
 (
     const processorFvPatchField<Type>& ptf
 )
@@ -182,7 +177,7 @@ processorFvPatchField<Type>::processorFvPatchField
 
 
 template<class Type>
-processorFvPatchField<Type>::processorFvPatchField
+Foam::processorFvPatchField<Type>::processorFvPatchField
 (
     const processorFvPatchField<Type>& ptf,
     const DimensionedField<Type, volMesh>& iF
@@ -209,14 +204,15 @@ processorFvPatchField<Type>::processorFvPatchField
 // * * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * //
 
 template<class Type>
-processorFvPatchField<Type>::~processorFvPatchField()
+Foam::processorFvPatchField<Type>::~processorFvPatchField()
 {}
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class Type>
-tmp<Field<Type> > processorFvPatchField<Type>::patchNeighbourField() const
+Foam::tmp<Foam::Field<Type> >
+Foam::processorFvPatchField<Type>::patchNeighbourField() const
 {
     if (debug && !this->ready())
     {
@@ -230,7 +226,7 @@ tmp<Field<Type> > processorFvPatchField<Type>::patchNeighbourField() const
 
 
 template<class Type>
-void processorFvPatchField<Type>::initEvaluate
+void Foam::processorFvPatchField<Type>::initEvaluate
 (
     const Pstream::commsTypes commsType
 )
@@ -272,7 +268,7 @@ void processorFvPatchField<Type>::initEvaluate
 
 
 template<class Type>
-void processorFvPatchField<Type>::evaluate
+void Foam::processorFvPatchField<Type>::evaluate
 (
     const Pstream::commsTypes commsType
 )
@@ -308,14 +304,18 @@ void processorFvPatchField<Type>::evaluate
 
 
 template<class Type>
-tmp<Field<Type> > processorFvPatchField<Type>::snGrad() const
+Foam::tmp<Foam::Field<Type> >
+Foam::processorFvPatchField<Type>::snGrad
+(
+    const scalarField& deltaCoeffs
+) const
 {
-    return this->patch().deltaCoeffs()*(*this - this->patchInternalField());
+    return deltaCoeffs*(*this - this->patchInternalField());
 }
 
 
 template<class Type>
-void processorFvPatchField<Type>::initInterfaceMatrixUpdate
+void Foam::processorFvPatchField<Type>::initInterfaceMatrixUpdate
 (
     scalarField&,
     const scalarField& psiInternal,
@@ -371,7 +371,7 @@ void processorFvPatchField<Type>::initInterfaceMatrixUpdate
 
 
 template<class Type>
-void processorFvPatchField<Type>::updateInterfaceMatrix
+void Foam::processorFvPatchField<Type>::updateInterfaceMatrix
 (
     scalarField& result,
     const scalarField&,
@@ -435,7 +435,7 @@ void processorFvPatchField<Type>::updateInterfaceMatrix
 
 
 template<class Type>
-void processorFvPatchField<Type>::initInterfaceMatrixUpdate
+void Foam::processorFvPatchField<Type>::initInterfaceMatrixUpdate
 (
     Field<Type>&,
     const Field<Type>& psiInternal,
@@ -490,7 +490,7 @@ void processorFvPatchField<Type>::initInterfaceMatrixUpdate
 
 
 template<class Type>
-void processorFvPatchField<Type>::updateInterfaceMatrix
+void Foam::processorFvPatchField<Type>::updateInterfaceMatrix
 (
     Field<Type>& result,
     const Field<Type>&,
@@ -553,7 +553,7 @@ void processorFvPatchField<Type>::updateInterfaceMatrix
 
 
 template<class Type>
-bool processorFvPatchField<Type>::ready() const
+bool Foam::processorFvPatchField<Type>::ready() const
 {
     if
     (
@@ -587,8 +587,4 @@ bool processorFvPatchField<Type>::ready() const
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H
index a913aaf60672c0bd7b604a2ed026bbe9ba7ac44f..1e7186efa1d308c1fa36f95e8900627f457cb480 100644
--- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H
@@ -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
@@ -198,7 +198,10 @@ public:
             virtual void evaluate(const Pstream::commsTypes commsType);
 
             //- Return patch-normal gradient
-            virtual tmp<Field<Type> > snGrad() const;
+            virtual tmp<Field<Type> > snGrad
+            (
+                const scalarField& deltaCoeffs
+            ) const;
 
             //- Is all data available
             virtual bool ready() const;
diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.C
index 82dcf7ca36ef430b45e3b745db5ef4026788b38f..f88bed7f638b2f3e37bbf4da30b25e8242e19915 100644
--- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.C
+++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.C
index d36da92ef362d3458dece311f13ccd69b26e2bcb..3a0f7fd1b4cc30404a2a55b955d6d935145a09d7 100644
--- a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.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
@@ -28,15 +28,10 @@ License
 #include "demandDrivenData.H"
 #include "transformField.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
 
 template<class Type>
-processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
+Foam::processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
 (
     const fvPatch& p,
     const DimensionedField<Type, volMesh>& iF
@@ -48,7 +43,7 @@ processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
 
 
 template<class Type>
-processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
+Foam::processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
 (
     const fvPatch& p,
     const DimensionedField<Type, volMesh>& iF,
@@ -63,7 +58,7 @@ processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
 
 // Construct by mapping given processorCyclicFvPatchField<Type>
 template<class Type>
-processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
+Foam::processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
 (
     const processorCyclicFvPatchField<Type>& ptf,
     const fvPatch& p,
@@ -97,7 +92,7 @@ processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
 
 
 template<class Type>
-processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
+Foam::processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
 (
     const fvPatch& p,
     const DimensionedField<Type, volMesh>& iF,
@@ -144,7 +139,7 @@ processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
 
 
 template<class Type>
-processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
+Foam::processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
 (
     const processorCyclicFvPatchField<Type>& ptf
 )
@@ -157,7 +152,7 @@ processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
 
 
 template<class Type>
-processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
+Foam::processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
 (
     const processorCyclicFvPatchField<Type>& ptf,
     const DimensionedField<Type, volMesh>& iF
@@ -172,107 +167,8 @@ processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
 // * * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * //
 
 template<class Type>
-processorCyclicFvPatchField<Type>::~processorCyclicFvPatchField()
+Foam::processorCyclicFvPatchField<Type>::~processorCyclicFvPatchField()
 {}
 
 
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-//template<class Type>
-//tmp<Field<Type> >
-//processorCyclicFvPatchField<Type>::patchNeighbourField() const
-//{
-//   return *this;
-//}
-//
-//
-//template<class Type>
-//void processorCyclicFvPatchField<Type>::initEvaluate
-//(
-//    const Pstream::commsTypes commsType
-//)
-//{
-//    if (Pstream::parRun())
-//    {
-//        procPatch_.compressedSend(commsType, this->patchInternalField()());
-//    }
-//}
-//
-//
-//template<class Type>
-//void processorCyclicFvPatchField<Type>::evaluate
-//(
-//    const Pstream::commsTypes commsType
-//)
-//{
-//    if (Pstream::parRun())
-//    {
-//        procPatch_.compressedReceive<Type>(commsType, *this);
-//
-//        if (doTransform())
-//        {
-//            transform(*this, procPatch_.forwardT(), *this);
-//        }
-//    }
-//}
-//
-//
-//template<class Type>
-//tmp<Field<Type> > processorCyclicFvPatchField<Type>::snGrad() const
-//{
-//    return this->patch().deltaCoeffs()*(*this - this->patchInternalField());
-//}
-//
-//
-//template<class Type>
-//void processorCyclicFvPatchField<Type>::initInterfaceMatrixUpdate
-//(
-//    scalarField&,
-//    const scalarField& psiInternal,
-//    const scalarField&,
-//    const direction,
-//    const Pstream::commsTypes commsType
-//) const
-//{
-//    procPatch_.compressedSend
-//    (
-//        commsType,
-//        this->patch().patchInternalField(psiInternal)()
-//    );
-//}
-//
-//
-//template<class Type>
-//void processorCyclicFvPatchField<Type>::updateInterfaceMatrix
-//(
-//    scalarField& result,
-//    const scalarField&,
-//    const scalarField& coeffs,
-//    const direction cmpt,
-//    const Pstream::commsTypes commsType
-//) const
-//{
-//    scalarField pnf
-//    (
-//        procPatch_.compressedReceive<scalar>(commsType, this->size())()
-//    );
-//
-//    // Transform according to the transformation tensor
-//    transformCoupleField(pnf, cmpt);
-//
-//    // Multiply the field by coefficients and add into the result
-//
-//    const labelUList& faceCells = this->patch().faceCells();
-//
-//    forAll(faceCells, elemI)
-//    {
-//        result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
-//    }
-//}
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C
index 28b01cac24a7dad49fe794f5f663be61238577af..238bb5d21ddde241b9d5bf52cbeae64a89eac39c 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C
@@ -2,16 +2,16 @@
   =========                 |
   \\      /  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
     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 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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C
new file mode 100644
index 0000000000000000000000000000000000000000..fed1b4403a7892e8059a0e1657799b02a800c6f9
--- /dev/null
+++ b/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C
@@ -0,0 +1,850 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "externalCoupledMixedFvPatchField.H"
+#include "fvPatchFieldMapper.H"
+#include "volFields.H"
+#include "IFstream.H"
+#include "globalIndex.H"
+#include "ListListOps.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+template<class Type>
+Foam::word Foam::externalCoupledMixedFvPatchField<Type>::lockName = "OpenFOAM";
+
+template<class Type>
+Foam::string
+Foam::externalCoupledMixedFvPatchField<Type>::patchKey = "# Patch: ";
+
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+template<class Type>
+Foam::fileName Foam::externalCoupledMixedFvPatchField<Type>::baseDir
+(
+    const word& patchName
+) const
+{
+    word regionName(this->dimensionedInternalField().mesh().name());
+    if (regionName == polyMesh::defaultRegion)
+    {
+        regionName = ".";
+    }
+
+    fileName result(commsDir_/regionName);
+    result.clean();
+
+    if (collate_)
+    {
+        return result;
+    }
+    else
+    {
+        if (patchName == word::null)
+        {
+            return fileName(result/this->patch().name());
+        }
+        else
+        {
+            return fileName(result/patchName);
+        }
+    }
+}
+
+
+template<class Type>
+void Foam::externalCoupledMixedFvPatchField<Type>::setMaster()
+{
+    typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
+
+    const volFieldType& cvf =
+        static_cast<const volFieldType&>(this->dimensionedInternalField());
+
+    volFieldType& vf = const_cast<volFieldType&>(cvf);
+
+    typename volFieldType::GeometricBoundaryField& bf = vf.boundaryField();
+
+    if (collate_)
+    {
+        bool found = false;
+        forAll(bf, patchI)
+        {
+            if (isA<externalCoupledMixedFvPatchField<Type> >(bf[patchI]))
+            {
+                externalCoupledMixedFvPatchField<Type>& pf =
+                    refCast<externalCoupledMixedFvPatchField<Type> >
+                    (
+                        bf[patchI]
+                    );
+
+                // only attempt to change master flags of BCs that have not
+                // been set (or at least only the master)
+                if (pf.master())
+                {
+                    if (!found)
+                    {
+                        pf.master() = true;
+                        found = true;
+                    }
+                    else
+                    {
+                        pf.master() = false;
+                    }
+                }
+            }
+        }
+    }
+    else
+    {
+        // check that collated flag is not set on any other patches
+        forAll(bf, patchI)
+        {
+            if (isA<externalCoupledMixedFvPatchField<Type> >(bf[patchI]))
+            {
+                const externalCoupledMixedFvPatchField<Type>& pf =
+                    refCast<const externalCoupledMixedFvPatchField<Type> >
+                    (
+                        bf[patchI]
+                    );
+
+                if (pf.collate())
+                {
+                    FatalErrorIn
+                    (
+                        "void Foam::externalCoupledMixedFvPatchField<Type>::"
+                        "setMaster()"
+                    )   << "All " << type() << " patches should either use "
+                        << "collate = true OR false, but not a mix of both"
+                        << exit(FatalError);
+                }
+            }
+        }
+
+        master_ = true;
+    }
+}
+
+
+template<class Type>
+void Foam::externalCoupledMixedFvPatchField<Type>::writeGeometry
+(
+    OFstream& osPoints,
+    OFstream& osFaces
+) const
+{
+    int tag = Pstream::msgType() + 1;
+
+    const label procI = Pstream::myProcNo();
+    const polyPatch& p = this->patch().patch();
+    const polyMesh& mesh = p.boundaryMesh().mesh();
+
+    labelList pointToGlobal;
+    labelList uniquePointIDs;
+    (void)mesh.globalData().mergePoints
+    (
+        p.meshPoints(),
+        p.meshPointMap(),
+        pointToGlobal,
+        uniquePointIDs
+    );
+
+    List<pointField> allPoints(Pstream::nProcs());
+    allPoints[procI] = pointField(mesh.points(), uniquePointIDs);
+    Pstream::gatherList(allPoints, tag);
+
+    List<faceList> allFaces(Pstream::nProcs());
+    faceList& patchFaces = allFaces[procI];
+    patchFaces = p.localFaces();
+    forAll(patchFaces, faceI)
+    {
+        inplaceRenumber(pointToGlobal, patchFaces[faceI]);
+    }
+
+    Pstream::gatherList(allFaces, tag);
+
+    if (Pstream::master())
+    {
+        pointField pts
+        (
+            ListListOps::combine<pointField>(allPoints, accessOp<pointField>())
+        );
+
+        // write points
+        osPoints << patchKey.c_str() << this->patch().name() << pts << endl;
+
+        faceList fcs
+        (
+            ListListOps::combine<faceList>(allFaces, accessOp<faceList>())
+        );
+
+        // write faces
+        osFaces<< patchKey.c_str() << this->patch().name() << fcs << endl;
+    }
+}
+
+
+template<class Type>
+Foam::fileName Foam::externalCoupledMixedFvPatchField<Type>::lockFile() const
+{
+    return fileName(baseDir()/(lockName + ".lock"));
+}
+
+
+template<class Type>
+void Foam::externalCoupledMixedFvPatchField<Type>::createLockFile() const
+{
+    if (!master_ || !Pstream::master())
+    {
+        return;
+    }
+
+    const fileName fName(lockFile());
+    IFstream is(fName);
+
+    // only create lock file if it doesn't already exist
+    if (!is.good())
+    {
+        if (log_)
+        {
+            Info<< type() << ": creating lock file" << endl;
+        }
+
+        OFstream os(fName);
+        os  << "lock file";
+        os.flush();
+    }
+}
+
+
+template<class Type>
+void Foam::externalCoupledMixedFvPatchField<Type>::removeLockFile() const
+{
+    if (!master_ || !Pstream::master())
+    {
+        return;
+    }
+
+    if (log_)
+    {
+        Info<< type() << ": removing lock file" << endl;
+    }
+
+    rm(lockFile());
+}
+
+
+template<class Type>
+void Foam::externalCoupledMixedFvPatchField<Type>::startWait() const
+{
+    if (collate_)
+    {
+        // only wait on master patch
+
+        typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
+
+        const volFieldType& cvf =
+            static_cast<const volFieldType&>(this->dimensionedInternalField());
+
+        const typename volFieldType::GeometricBoundaryField& bf =
+            cvf.boundaryField();
+
+        forAll(bf, patchI)
+        {
+            if (isA<externalCoupledMixedFvPatchField<Type> >(bf[patchI]))
+            {
+                const externalCoupledMixedFvPatchField<Type>& pf =
+                    refCast<const externalCoupledMixedFvPatchField<Type> >
+                    (
+                        bf[patchI]
+                    );
+
+                if (pf.master())
+                {
+                    pf.wait();
+                    break;
+                }
+            }
+        }
+    }
+    else
+    {
+        wait();
+    }
+}
+
+
+template<class Type>
+void Foam::externalCoupledMixedFvPatchField<Type>::wait() const
+{
+    const fileName fName(lockFile());
+    bool found = false;
+    label totalTime = 0;
+
+    if (log_)
+    {
+        Info<< type() << ": beginning wait for lock file " << fName << endl;
+    }
+
+    while (!found)
+    {
+        if (totalTime > timeOut_)
+        {
+            FatalErrorIn
+            (
+                "void "
+                "Foam::externalCoupledMixedFvPatchField<Type>::wait() const"
+            )
+                << "Wait time exceeded time out time of " << timeOut_
+                << " s" << abort(FatalError);
+        }
+
+        IFstream is(fName);
+
+        if (is.good())
+        {
+            if (log_)
+            {
+                Info<< type() << ": found lock file " << fName << endl;
+            }
+
+            found = true;
+            break;
+        }
+
+        sleep(waitInterval_);
+        totalTime += waitInterval_;
+
+        if (log_)
+        {
+            Info<< type() << ": wait time = " << totalTime << endl;
+        }
+    }
+}
+
+
+template<class Type>
+void Foam::externalCoupledMixedFvPatchField<Type>::initialiseRead
+(
+    IFstream& is
+) const
+{
+    if (!is.good())
+    {
+        FatalErrorIn
+        (
+            "void Foam::externalCoupledMixedFvPatchField<Type>::"
+            "initialiseRead()"
+        )
+            << "Unable to open data transfer file " << is.name().caseName()
+            << " for patch " << this->patch().name()
+            << exit(FatalError);
+    }
+
+    string line;
+
+    // scan forward to the line that starts '# Patch: <myPatchName>'
+    const string searchStr(patchKey + this->patch().name());
+
+    bool scan = true;
+    while (is.good() && scan)
+    {
+        is.getLine(line);
+
+        if (line.rfind(searchStr) != std::string::npos)
+        {
+            scan = false;
+        }
+    }
+
+    if (scan)
+    {
+        FatalErrorIn
+        (
+            "void Foam::externalCoupledMixedFvPatchField<Type>::"
+            "initialiseRead"
+            "("
+                "IFstream&"
+            ") const"
+        )
+            << "Unable to find data starting with " << searchStr
+            << " in file" << nl
+            << "    " << is.name().caseName() << abort(FatalError);
+    }
+
+    if (Pstream::parRun())
+    {
+        // fast-forward to relevant point in file
+        globalIndex gi(this->patch().size());
+
+        if (this->patch().size())
+        {
+            const label offset = gi.offset(Pstream::myProcNo());
+            for (label i = 0; i < offset; i++)
+            {
+                if (is.good())
+                {
+                    is.getLine(line);
+                }
+                else
+                {
+                    FatalErrorIn
+                    (
+                        "void Foam::externalCoupledMixedFvPatchField<Type>::"
+                        "initialiseRead"
+                        "("
+                            "IFstream&"
+                        ") const"
+                    )
+                        << "Unable to distribute parallel data for file "
+                        << is.name().caseName() << " for patch "
+                        << this->patch().name() << exit(FatalError);
+                }
+            }
+        }
+    }
+}
+
+
+// * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
+
+template<class Type>
+void Foam::externalCoupledMixedFvPatchField<Type>::writeData
+(
+    const fileName& transferFile
+) const
+{
+    if (!master_)
+    {
+        return;
+    }
+
+    OFstream os(transferFile);
+
+    writeHeader(os);
+
+    if (collate_)
+    {
+        typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
+
+        const volFieldType& cvf =
+            static_cast<const volFieldType&>(this->dimensionedInternalField());
+
+        volFieldType& vf = const_cast<volFieldType&>(cvf);
+
+        typename volFieldType::GeometricBoundaryField& bf = vf.boundaryField();
+
+        forAll(bf, patchI)
+        {
+            if (isA<externalCoupledMixedFvPatchField<Type> >(bf[patchI]))
+            {
+                const externalCoupledMixedFvPatchField<Type>& pf =
+                    refCast<const externalCoupledMixedFvPatchField<Type> >
+                    (
+                        bf[patchI]
+                    );
+
+                os  << patchKey.c_str() << pf.patch().name() << nl;
+                pf.transferData(os);
+            }
+        }
+    }
+    else
+    {
+        os  << patchKey.c_str() << this->patch().name() << nl;
+        transferData(os);
+    }
+}
+
+
+template<class Type>
+void Foam::externalCoupledMixedFvPatchField<Type>::writeHeader
+(
+    OFstream& os
+) const
+{
+    os  << "# Values: magSf value snGrad" << endl;
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+template<class Type>
+Foam::externalCoupledMixedFvPatchField<Type>::externalCoupledMixedFvPatchField
+(
+    const fvPatch& p,
+    const DimensionedField<Type, volMesh>& iF
+)
+:
+    mixedFvPatchField<Type>(p, iF),
+    commsDir_("unknown-commsDir"),
+    fName_("unknown-fName"),
+    collate_(false),
+    waitInterval_(0),
+    timeOut_(0),
+    calcFrequency_(0),
+    log_(false),
+    master_(false)
+{
+    this->refValue() = pTraits<Type>::zero;
+    this->refGrad() = pTraits<Type>::zero;
+    this->valueFraction() = 0.0;
+}
+
+
+template<class Type>
+Foam::externalCoupledMixedFvPatchField<Type>::externalCoupledMixedFvPatchField
+(
+    const externalCoupledMixedFvPatchField& ptf,
+    const fvPatch& p,
+    const DimensionedField<Type, volMesh>& iF,
+    const fvPatchFieldMapper& mapper
+)
+:
+    mixedFvPatchField<Type>(ptf, p, iF, mapper),
+    commsDir_(ptf.commsDir_),
+    fName_(ptf.fName_),
+    collate_(ptf.collate_),
+    waitInterval_(ptf.waitInterval_),
+    timeOut_(ptf.timeOut_),
+    calcFrequency_(ptf.calcFrequency_),
+    log_(ptf.log_),
+    master_(ptf.master_)
+{}
+
+
+template<class Type>
+Foam::externalCoupledMixedFvPatchField<Type>::externalCoupledMixedFvPatchField
+(
+    const fvPatch& p,
+    const DimensionedField<Type, volMesh>& iF,
+    const dictionary& dict
+)
+:
+    mixedFvPatchField<Type>(p, iF),
+    commsDir_(dict.lookup("commsDir")),
+    fName_(dict.lookup("fileName")),
+    collate_(readBool(dict.lookup("collate"))),
+    waitInterval_(dict.lookupOrDefault("waitInterval", 1)),
+    timeOut_(dict.lookupOrDefault("timeOut", 100*waitInterval_)),
+    calcFrequency_(dict.lookupOrDefault("calcFrequency", 1)),
+    log_(dict.lookupOrDefault("log", false)),
+    master_(true)
+{
+    if (dict.found("value"))
+    {
+        fvPatchField<Type>::operator=
+        (
+            Field<Type>("value", dict, p.size())
+        );
+    }
+    else
+    {
+        fvPatchField<Type>::operator=(this->patchInternalField());
+    }
+
+    if (Pstream::master())
+    {
+        commsDir_.expand();
+        mkDir(baseDir());
+    }
+
+    createLockFile();
+
+    // initialise as a fixed value
+    this->refValue() = *this;
+    this->refGrad() = pTraits<Type>::zero;
+    this->valueFraction() = 1.0;
+}
+
+
+template<class Type>
+Foam::externalCoupledMixedFvPatchField<Type>::externalCoupledMixedFvPatchField
+(
+    const externalCoupledMixedFvPatchField& ecmpf
+)
+:
+    mixedFvPatchField<Type>(ecmpf),
+    commsDir_(ecmpf.commsDir_),
+    fName_(ecmpf.fName_),
+    collate_(ecmpf.collate_),
+    waitInterval_(ecmpf.waitInterval_),
+    timeOut_(ecmpf.timeOut_),
+    calcFrequency_(ecmpf.calcFrequency_),
+    log_(ecmpf.log_),
+    master_(ecmpf.master_)
+{}
+
+
+template<class Type>
+Foam::externalCoupledMixedFvPatchField<Type>::externalCoupledMixedFvPatchField
+(
+    const externalCoupledMixedFvPatchField& ecmpf,
+    const DimensionedField<Type, volMesh>& iF
+)
+:
+    mixedFvPatchField<Type>(ecmpf, iF),
+    commsDir_(ecmpf.commsDir_),
+    fName_(ecmpf.fName_),
+    collate_(ecmpf.collate_),
+    waitInterval_(ecmpf.waitInterval_),
+    timeOut_(ecmpf.timeOut_),
+    calcFrequency_(ecmpf.calcFrequency_),
+    log_(ecmpf.log_),
+    master_(ecmpf.master_)
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+template<class Type>
+Foam::externalCoupledMixedFvPatchField<Type>::
+~externalCoupledMixedFvPatchField()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+template<class Type>
+void Foam::externalCoupledMixedFvPatchField<Type>::updateCoeffs()
+{
+    if (this->updated())
+    {
+        return;
+    }
+
+    setMaster();
+
+    if (this->db().time().timeIndex() % calcFrequency_ == 0)
+    {
+        fileName transferFile(baseDir()/fName_);
+
+        // write data for external source
+        writeData(transferFile + ".out");
+
+        // remove lock file, signalling external source to execute
+        removeLockFile();
+
+        // wait for response
+        startWait();
+
+        if (master_ && Pstream::master())
+        {
+            // remove old data file from OpenFOAM
+            rm(transferFile + ".out");
+        }
+
+        // read data passed back from external source
+        IFstream is(transferFile + ".in");
+
+        // pre-process the input transfer file
+        initialiseRead(is);
+
+        // read data from file
+        forAll(this->patch(), faceI)
+        {
+            if (is.good())
+            {
+                is  >> this->refValue()[faceI]
+                    >> this->refGrad()[faceI]
+                    >> this->valueFraction()[faceI];
+            }
+            else
+            {
+                FatalErrorIn
+                (
+                    "void Foam::externalCoupledMixedFvPatchField<Type>::"
+                    "updateCoeffs()"
+                )
+                    << "Insufficient data for patch " << this->patch().name()
+                    << " in file " << is.name().caseName() << exit(FatalError);
+            }
+        }
+
+        // create lock file for external source
+        createLockFile();
+    }
+
+    mixedFvPatchField<Type>::updateCoeffs();
+}
+
+
+template<class Type>
+void Foam::externalCoupledMixedFvPatchField<Type>::transferData
+(
+    OFstream& os
+) const
+{
+    if (log_)
+    {
+        Info<< type() << ": writing data to " << os.name().caseName() << endl;
+    }
+
+    if (Pstream::parRun())
+    {
+        int tag = Pstream::msgType() + 1;
+
+        List<Field<scalar> > magSfs(Pstream::nProcs());
+        magSfs[Pstream::myProcNo()].setSize(this->patch().size());
+        magSfs[Pstream::myProcNo()] = this->patch().magSf();
+        Pstream::gatherList(magSfs, tag);
+
+        List<Field<Type> > values(Pstream::nProcs());
+        values[Pstream::myProcNo()].setSize(this->patch().size());
+        values[Pstream::myProcNo()] = this->refValue();
+        Pstream::gatherList(values, tag);
+
+        List<Field<Type> > snGrads(Pstream::nProcs());
+        snGrads[Pstream::myProcNo()].setSize(this->patch().size());
+        snGrads[Pstream::myProcNo()] = this->snGrad();
+        Pstream::gatherList(snGrads, tag);
+
+        if (Pstream::master())
+        {
+            forAll(values, procI)
+            {
+                const Field<scalar>& magSf = magSfs[procI];
+                const Field<Type>& value = values[procI];
+                const Field<Type>& snGrad = snGrads[procI];
+
+                forAll(magSf, faceI)
+                {
+                    os  << magSf[faceI] << token::SPACE
+                        << value[faceI] << token::SPACE
+                        << snGrad[faceI] << nl;
+                }
+            }
+
+            os.flush();
+        }
+    }
+    else
+    {
+        const Field<scalar>& magSf(this->patch().magSf());
+        const Field<Type>& value(this->refValue());
+        const Field<Type> snGrad(this->snGrad());
+
+        forAll(magSf, faceI)
+        {
+            os  << magSf[faceI] << token::SPACE
+                << value[faceI] << token::SPACE
+                << snGrad[faceI] << nl;
+        }
+
+        os.flush();
+    }
+}
+
+
+template<class Type>
+void Foam::externalCoupledMixedFvPatchField<Type>::writeGeometry() const
+{
+    typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
+
+    const volFieldType& cvf =
+        static_cast<const volFieldType&>(this->dimensionedInternalField());
+
+    const typename volFieldType::GeometricBoundaryField& bf =
+        cvf.boundaryField();
+
+    if (collate_)
+    {
+        OFstream osPoints(baseDir()/"patchPoints");
+        OFstream osFaces(baseDir()/"patchFaces");
+
+        if (log_)
+        {
+            Info<< "writing collated patch points to: "
+                << osPoints.name().caseName() << endl;
+            Info<< "writing collated patch faces to: "
+                << osFaces.name().caseName() << endl;
+        }
+
+        forAll(bf, patchI)
+        {
+            if (isA<externalCoupledMixedFvPatchField<Type> >(bf[patchI]))
+            {
+                const externalCoupledMixedFvPatchField<Type>& pf =
+                    refCast<const externalCoupledMixedFvPatchField<Type> >
+                    (
+                        bf[patchI]
+                    );
+
+                pf.writeGeometry(osPoints, osFaces);
+            }
+        }
+    }
+    else
+    {
+        forAll(bf, patchI)
+        {
+            if (isA<externalCoupledMixedFvPatchField<Type> >(bf[patchI]))
+            {
+                const word& patchName = this->patch().name();
+
+                OFstream osPoints(baseDir(patchName)/"patchPoints");
+                OFstream osFaces(baseDir(patchName)/"patchFaces");
+
+                if (log_)
+                {
+                    Info<< "writing patch " << patchName << " points to: "
+                        << osPoints.name().caseName() << endl;
+                    Info<< "writing patch " << patchName << " faces to: "
+                        << osFaces.name().caseName() << endl;
+                }
+
+                const externalCoupledMixedFvPatchField<Type>& pf =
+                    refCast<const externalCoupledMixedFvPatchField<Type> >
+                    (
+                        bf[patchI]
+                    );
+
+                pf.writeGeometry(osPoints, osFaces);
+            }
+        }
+    }
+}
+
+
+template<class Type>
+void Foam::externalCoupledMixedFvPatchField<Type>::write(Ostream& os) const
+{
+    mixedFvPatchField<Type>::write(os);
+
+    os.writeKeyword("commsDir") << commsDir_ << token::END_STATEMENT << nl;
+    os.writeKeyword("fileName") << fName_ << token::END_STATEMENT << nl;
+    os.writeKeyword("collate") << collate_ << token::END_STATEMENT << nl;
+    os.writeKeyword("waitInterval") << waitInterval_ << token::END_STATEMENT
+        << nl;
+    os.writeKeyword("timeOut") << timeOut_ << token::END_STATEMENT << nl;
+    os.writeKeyword("calcFrequency") << calcFrequency_ << token::END_STATEMENT
+        << nl;
+    os.writeKeyword("log") << log_ << token::END_STATEMENT << nl;
+
+    this->writeEntry("value", os);
+}
+
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H
new file mode 100644
index 0000000000000000000000000000000000000000..cfe08cd78eb9d78f427774d6296090385ef599be
--- /dev/null
+++ b/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H
@@ -0,0 +1,345 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+Class
+    Foam::externalCoupledMixedFvPatchField
+
+Group
+    grpGenericBoundaryConditions grpCoupledBoundaryConditions
+
+Description
+    This boundary condition provides an interface to an external application.
+    Values are transferred as plain text files, where OperFOAM data is written
+    as:
+
+        # Patch: <patch name>
+        <magSf1> <value1> <surfaceNormalGradient1>
+        <magSf2> <value2> <surfaceNormalGradient2>
+        <magSf3> <value3> <surfaceNormalGradient3>
+        ...
+        <magSfN> <valueN> <surfaceNormalGradientN>
+
+    and received as the constituent pieces of the `mixed' condition, i.e.
+
+        # Patch: <patch name>
+        <value1> <gradient1> <valueFracion1>
+        <value2> <gradient2> <valueFracion2>
+        <value3> <gradient3> <valueFracion3>
+        ...
+        <valueN> <gradientN> <valueFracionN>
+
+    Data is either sent/received as one file per patch, or as a single file
+    for all patches, based on the \c collate flag.  In the former case, the
+    folder used for communications is:
+
+        $FOAM_CASE/<commsDir>/patchName
+
+    and when using the \c collate option:
+
+        $FOAM_CASE/<commsDir>
+
+    At start-up, the boundary creates a lock file, i.e..
+
+        OpenFOAM.lock
+
+    ... to signal the external source to wait.  During the boundary condition
+    update, boundary values are written to file, e.g.
+
+        <fileName>.out
+
+    The lock file is then removed, instructing the external source to take
+    control of the program execution.  When ready, the external program
+    should create the return values, e.g. to file
+
+        <fileName>.in
+
+    ... and then re-instate the lock file.  The boundary condition will then
+    read the return values, and pass program execution back to OpenFOAM.
+
+
+    \heading Patch usage
+
+    \table
+        Property     | Description             | Required    | Default value
+        commsDir     | communications folder   | yes         |
+        fileName     | transfer file name      | yes         |
+        collate      | collate all patch data into single file | yes |
+        waitInterval | interval [s] between file checks | no | 1
+        timeOut      | time after which error invoked [s] |no |100*waitInterval
+        calcFrequency | calculation frequency  | no          | 1
+        log          | log program control     | no          | no
+    \endtable
+
+    Example of the boundary condition specification:
+    \verbatim
+    myPatch
+    {
+        type            externalCoupled;
+        commsDir        "$FOAM_CASE/comms";
+        fileName        data;
+        collate         yes;
+        calcFrequency   1;
+    }
+    \endverbatim
+
+SeeAlso
+    mixedFvPatchField
+
+SourceFiles
+    externalCoupledMixedFvPatchField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef externalCoupledMixedFvPatchField_H
+#define externalCoupledMixedFvPatchField_H
+
+#include "mixedFvPatchFields.H"
+#include "OFstream.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+class IFstream;
+
+/*---------------------------------------------------------------------------*\
+              Class externalCoupledMixedFvPatchField Declaration
+\*---------------------------------------------------------------------------*/
+
+template<class Type>
+class externalCoupledMixedFvPatchField
+:
+    public mixedFvPatchField<Type>
+{
+
+private:
+
+    // Private data
+
+        //- Path to communications folder
+        fileName commsDir_;
+
+        //- Name of data file
+        word fName_;
+
+        //- Flag to collate all data into single transfer file
+        bool collate_;
+
+        //- Interval time between checking for return data [s]
+        label waitInterval_;
+
+        //- Time out time [s]
+        label timeOut_;
+
+        //- Calculation frequency
+        label calcFrequency_;
+
+        //- Log flag
+        bool log_;
+
+        //- Master patch flag - controls when to pause/resume execution
+        //  Note: only valid when collate option is selected
+        bool master_;
+
+
+    // Private Member Functions
+
+        //- Set the master flag when collate option is selected
+        void setMaster();
+
+        //- Return the file path to the base communications folder
+        fileName baseDir(const word& patchName = word::null) const;
+
+        //- Write the geometry to the comms dir
+        void writeGeometry(OFstream& osPoints, OFstream& osFaces) const;
+
+        //- Return the file path to the lock file
+        fileName lockFile() const;
+
+        //- Create lock file
+        void createLockFile() const;
+
+        //- Remove lock file
+        void removeLockFile() const;
+
+        //- Wait for response from external source
+        void startWait() const;
+
+        //- Wait for response from external source
+        void wait() const;
+
+        //- Initialise input stream for reading
+        void initialiseRead(IFstream& is) const;
+
+
+protected:
+
+    // Protected Member Functions
+
+        //- Write data for external source - calls transferData
+        virtual void writeData(const fileName& transferFile) const;
+
+        //- Write header to transfer file
+        virtual void writeHeader(OFstream& os) const;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("externalCoupled");
+
+    //- Name of lock file
+    static word lockName;
+
+    //- Name of patch key, e.g. '# Patch:' when looking for start of patch data
+    static string patchKey;
+
+
+    // Constructors
+
+        //- Construct from patch and internal field
+        externalCoupledMixedFvPatchField
+        (
+            const fvPatch&,
+            const DimensionedField<Type, volMesh>&
+        );
+
+        //- Construct from patch, internal field and dictionary
+        externalCoupledMixedFvPatchField
+        (
+            const fvPatch&,
+            const DimensionedField<Type, volMesh>&,
+            const dictionary&
+        );
+
+        //- Construct by mapping given externalCoupledMixedFvPatchField
+        //  onto a new patch
+        externalCoupledMixedFvPatchField
+        (
+            const externalCoupledMixedFvPatchField<Type>&,
+            const fvPatch&,
+            const DimensionedField<Type, volMesh>&,
+            const fvPatchFieldMapper&
+        );
+
+        //- Construct as copy
+        externalCoupledMixedFvPatchField
+        (
+            const externalCoupledMixedFvPatchField&
+        );
+
+        //- Construct and return a clone
+        virtual tmp<fvPatchField<Type> > clone() const
+        {
+            return tmp<fvPatchField<Type> >
+            (
+                new externalCoupledMixedFvPatchField<Type>(*this)
+            );
+        }
+
+        //- Construct as copy setting internal field reference
+        externalCoupledMixedFvPatchField
+        (
+            const externalCoupledMixedFvPatchField&,
+            const DimensionedField<Type, volMesh>&
+        );
+
+        //- Construct and return a clone setting internal field reference
+        virtual tmp<fvPatchField<Type> > clone
+        (
+            const DimensionedField<Type, volMesh>& iF
+        ) const
+        {
+            return tmp<fvPatchField<Type> >
+            (
+                new externalCoupledMixedFvPatchField<Type>(*this, iF)
+            );
+        }
+
+
+    //- Destructor
+    virtual ~externalCoupledMixedFvPatchField();
+
+
+    // Member functions
+
+        // Access
+
+            //- Return the log flag
+            bool log() const
+            {
+                return log_;
+            }
+
+            //- Return the collate flag
+            bool collate() const
+            {
+                return collate_;
+            }
+
+            //- Return the master flag
+            bool master() const
+            {
+                return master_;
+            }
+
+            //- Return the master flag
+            bool& master()
+            {
+                return master_;
+            }
+
+
+        // Evaluation functions
+
+            //- Update the coefficients associated with the patch field
+            virtual void updateCoeffs();
+
+            //- Transfer data for external source
+            virtual void transferData(OFstream& os) const;
+
+
+        //- Write the geometry to the comms dir
+        void writeGeometry() const;
+
+        //- Write
+        virtual void write(Ostream&) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+#   include "externalCoupledMixedFvPatchField.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/phaseEquationOfState.C b/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C
similarity index 72%
rename from applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/phaseEquationOfState.C
rename to src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C
index 41ed49322b2a8c5dea3003a96969670e56408240..42ab10636d5cf304bfadc234540066b8e5d62a85 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/phaseEquationOfState.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -23,32 +23,20 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "phaseEquationOfState.H"
+#include "externalCoupledMixedFvPatchFields.H"
+#include "addToRunTimeSelectionTable.H"
 
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
 {
-    defineTypeNameAndDebug(phaseEquationOfState, 0);
-    defineRunTimeSelectionTable(phaseEquationOfState, dictionary);
-}
-
-
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-Foam::phaseEquationOfState::phaseEquationOfState
-(
-    const dictionary& dict
-)
-:
-    dict_(dict)
-{}
 
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+makePatchFields(externalCoupledMixed);
 
-Foam::phaseEquationOfState::~phaseEquationOfState()
-{}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+} // End namespace Foam
 
 // ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/calcFaceAddressing.H b/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H
similarity index 72%
rename from applications/utilities/postProcessing/dataConversion/foamToFieldview9/calcFaceAddressing.H
rename to src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.H
index f3647986c92d1643a8bdda7bf2553f28bb24f78c..36d457004b0a9992f7fa24ba7048fcef6327a3e8 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/calcFaceAddressing.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFields.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) 2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,32 +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/>.
 
-InClass
-    Foam::calcFaceAddressing
+\*---------------------------------------------------------------------------*/
 
-Description
+#ifndef externalCoupledMixedFvPatchFields_H
+#define externalCoupledMixedFvPatchFields_H
 
-SourceFiles
-    calcFaceAddressing.C
+#include "externalCoupledMixedFvPatchField.H"
+#include "fieldTypes.H"
 
-\*---------------------------------------------------------------------------*/
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#ifndef calcFaceAddressing_H
-#define calcFaceAddressing_H
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#include "faceList.H"
-#include "cellShape.H"
-#include "labelList.H"
+makePatchTypeFieldTypedefs(externalCoupledMixed);
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-Foam::labelList calcFaceAddressing
-(
-    const Foam::faceList& allFaces,   // faces given faceLabels
-    const Foam::cellShape& shape,
-    const Foam::labelList& faces,     // faceLabels for given cell
-    const Foam::label cellI
-);
+} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeFunctions.H b/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFieldsFwd.H
similarity index 70%
rename from applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeFunctions.H
rename to src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFieldsFwd.H
index eb61827d42785b9f41a5707e3dc82263c12948a1..7aae5c7b502ea25242f635c936398f08d5873d9f 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/writeFunctions.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchFieldsFwd.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) 2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,33 +21,27 @@ License
     You should have received a copy of the GNU General Public License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-InClass
-    Foam::writeFunctions
+\*---------------------------------------------------------------------------*/
 
-Description
+#ifndef externalCoupledMixedFvPatchFieldsFwd_H
+#define externalCoupledMixedFvPatchFieldsFwd_H
 
-SourceFiles
-    writeFunctions.C
+#include "fieldTypes.H"
 
-\*---------------------------------------------------------------------------*/
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#ifndef writeFunctions_H
-#define writeFunctions_H
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#include "scalar.H"
-#include "string.H"
-#include "labelList.H"
-#include <iostream>
+template<class Type> class externalCoupledMixedFvPatchField;
 
-using namespace Foam;
+makePatchTypeFieldTypedefs(externalCoupledMixed);
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-bool writeStr80(std::ostream& os, const string& str);
-bool writeInt(std::ostream& os, int val1);
-bool writeFloat(std::ostream& os, scalar val1);
-void writeBytes(char* start, int nBytes);
-void writeWallFlags(Ostream& os, label cellI, const labelList& wallFlags);
+} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.H
index adcb570f937b8b1cc569cbbf74ed054ce0429fb6..057c667b7b9104dc880e12b7bba347c6bbd5b1bc 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.H
@@ -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
@@ -37,6 +37,7 @@ Description
 
     \table
         Property     | Description             | Required    | Default value
+        freestreamValue   | freestream velocity          | yes         |
         phi          | flux field name         | no          | phi
     \endtable
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C
index bd15d4764ad68e6b1de1b23dcb2558de80e89348..5d359bc691550b2a9c65b443acf2d5bbf4937571 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -42,12 +42,9 @@ mappedFieldFvPatchField<Type>::mappedFieldFvPatchField
     const DimensionedField<Type, volMesh>& iF
 )
 :
-    mappedPatchBase(p.patch()),
     fixedValueFvPatchField<Type>(p, iF),
-    fieldName_(iF.name()),
-    setAverage_(false),
-    average_(pTraits<Type>::zero),
-    interpolationScheme_(interpolationCell<Type>::typeName)
+    mappedPatchBase(p.patch()),
+    mappedPatchFieldBase<Type>(*this, *this)
 {}
 
 
@@ -60,12 +57,9 @@ mappedFieldFvPatchField<Type>::mappedFieldFvPatchField
     const fvPatchFieldMapper& mapper
 )
 :
-    mappedPatchBase(p.patch(), ptf),
     fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
-    fieldName_(ptf.fieldName_),
-    setAverage_(ptf.setAverage_),
-    average_(ptf.average_),
-    interpolationScheme_(ptf.interpolationScheme_)
+    mappedPatchBase(p.patch(), ptf),
+    mappedPatchFieldBase<Type>(*this, *this, ptf)
 {}
 
 
@@ -77,18 +71,10 @@ mappedFieldFvPatchField<Type>::mappedFieldFvPatchField
     const dictionary& dict
 )
 :
-    mappedPatchBase(p.patch(), dict),
     fixedValueFvPatchField<Type>(p, iF, dict),
-    fieldName_(dict.template lookupOrDefault<word>("fieldName", iF.name())),
-    setAverage_(readBool(dict.lookup("setAverage"))),
-    average_(pTraits<Type>(dict.lookup("average"))),
-    interpolationScheme_(interpolationCell<Type>::typeName)
-{
-    if (mode() == mappedPatchBase::NEARESTCELL)
-    {
-        dict.lookup("interpolationScheme") >> interpolationScheme_;
-    }
-}
+    mappedPatchBase(p.patch(), dict),
+    mappedPatchFieldBase<Type>(*this, *this, dict)
+{}
 
 
 template<class Type>
@@ -110,6 +96,7 @@ mappedFieldFvPatchField<Type>::mappedFieldFvPatchField
     const word& interpolationScheme
 )
 :
+    fixedValueFvPatchField<Type>(p, iF),
     mappedPatchBase
     (
         p.patch(),
@@ -118,11 +105,15 @@ mappedFieldFvPatchField<Type>::mappedFieldFvPatchField
         samplePatch,
         distance
     ),
-    fixedValueFvPatchField<Type>(p, iF),
-    fieldName_(fieldName),
-    setAverage_(setAverage),
-    average_(average),
-    interpolationScheme_(interpolationScheme)
+    mappedPatchFieldBase<Type>
+    (
+        *this,
+        *this,
+        fieldName,
+        setAverage,
+        average,
+        interpolationScheme
+    )
 {}
 
 
@@ -132,12 +123,9 @@ mappedFieldFvPatchField<Type>::mappedFieldFvPatchField
     const mappedFieldFvPatchField<Type>& ptf
 )
 :
-    mappedPatchBase(ptf.patch().patch(), ptf),
     fixedValueFvPatchField<Type>(ptf),
-    fieldName_(ptf.fieldName_),
-    setAverage_(ptf.setAverage_),
-    average_(ptf.average_),
-    interpolationScheme_(ptf.interpolationScheme_)
+    mappedPatchBase(ptf.patch().patch(), ptf),
+    mappedPatchFieldBase<Type>(ptf)
 {}
 
 
@@ -148,65 +136,14 @@ mappedFieldFvPatchField<Type>::mappedFieldFvPatchField
     const DimensionedField<Type, volMesh>& iF
 )
 :
-    mappedPatchBase(ptf.patch().patch(), ptf),
     fixedValueFvPatchField<Type>(ptf, iF),
-    fieldName_(ptf.fieldName_),
-    setAverage_(ptf.setAverage_),
-    average_(ptf.average_),
-    interpolationScheme_(ptf.interpolationScheme_)
+    mappedPatchBase(ptf.patch().patch(), ptf),
+    mappedPatchFieldBase<Type>(*this, *this, ptf)
 {}
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template<class Type>
-const GeometricField<Type, fvPatchField, volMesh>&
-mappedFieldFvPatchField<Type>::sampleField() const
-{
-    typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
-
-    const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
-
-    if (sameRegion())
-    {
-        if (fieldName_ == this->dimensionedInternalField().name())
-        {
-            // Optimisation: bypass field lookup
-            return
-                dynamic_cast<const fieldType&>
-                (
-                    this->dimensionedInternalField()
-                );
-        }
-        else
-        {
-            const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
-            return thisMesh.template lookupObject<fieldType>(fieldName_);
-        }
-    }
-    else
-    {
-        return nbrMesh.template lookupObject<fieldType>(fieldName_);
-    }
-}
-
-
-template<class Type>
-const interpolation<Type>&
-mappedFieldFvPatchField<Type>::interpolator() const
-{
-    if (!interpolator_.valid())
-    {
-        interpolator_ = interpolation<Type>::New
-        (
-            interpolationScheme_,
-            sampleField()
-        );
-    }
-    return interpolator_();
-}
-
-
 template<class Type>
 void mappedFieldFvPatchField<Type>::updateCoeffs()
 {
@@ -215,132 +152,7 @@ void mappedFieldFvPatchField<Type>::updateCoeffs()
         return;
     }
 
-    typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
-
-    // Since we're inside initEvaluate/evaluate there might be processor
-    // comms underway. Change the tag we use.
-    int oldTag = UPstream::msgType();
-    UPstream::msgType() = oldTag + 1;
-
-    const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
-    const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
-
-    // Result of obtaining remote values
-    Field<Type> newValues;
-
-    switch (mode())
-    {
-        case NEARESTCELL:
-        {
-            const mapDistribute& mapDist = this->mappedPatchBase::map();
-
-            if (interpolationScheme_ != interpolationCell<Type>::typeName)
-            {
-                // Need to do interpolation so need cells to sample
-
-                // Send back sample points to the processor that holds the cell
-                vectorField samples(samplePoints());
-                mapDist.reverseDistribute
-                (
-                    (sameRegion() ? thisMesh.nCells() : nbrMesh.nCells()),
-                    point::max,
-                    samples
-                );
-
-                const interpolation<Type>& interp = interpolator();
-
-                newValues.setSize(samples.size(), pTraits<Type>::max);
-                forAll(samples, cellI)
-                {
-                    if (samples[cellI] != point::max)
-                    {
-                        newValues[cellI] = interp.interpolate
-                        (
-                            samples[cellI],
-                            cellI
-                        );
-                    }
-                }
-            }
-            else
-            {
-                newValues = sampleField();
-            }
-
-            mapDist.distribute(newValues);
-
-            break;
-        }
-        case NEARESTPATCHFACE: case NEARESTPATCHFACEAMI:
-        {
-            const label nbrPatchID =
-                nbrMesh.boundaryMesh().findPatchID(samplePatch());
-            if (nbrPatchID < 0)
-            {
-                FatalErrorIn
-                (
-                    "void mappedFieldFvPatchField<Type>::updateCoeffs()"
-                )<< "Unable to find sample patch " << samplePatch()
-                 << " in region " << sampleRegion()
-                 << " for patch " << this->patch().name() << nl
-                 << abort(FatalError);
-            }
-
-            const fieldType& nbrField = sampleField();
-
-            newValues = nbrField.boundaryField()[nbrPatchID];
-            this->distribute(newValues);
-
-            break;
-        }
-        case NEARESTFACE:
-        {
-            Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero);
-
-            const fieldType& nbrField = sampleField();
-
-            forAll(nbrField.boundaryField(), patchI)
-            {
-                const fvPatchField<Type>& pf =
-                    nbrField.boundaryField()[patchI];
-                label faceStart = pf.patch().patch().start();
-
-                forAll(pf, faceI)
-                {
-                    allValues[faceStart++] = pf[faceI];
-                }
-            }
-
-            this->distribute(allValues);
-            newValues.transfer(allValues);
-
-            break;
-        }
-        default:
-        {
-            FatalErrorIn("mappedFieldFvPatchField<Type>::updateCoeffs()")
-                << "Unknown sampling mode: " << mode()
-                << nl << abort(FatalError);
-        }
-    }
-
-    if (setAverage_)
-    {
-        Type averagePsi =
-            gSum(this->patch().magSf()*newValues)
-           /gSum(this->patch().magSf());
-
-        if (mag(averagePsi)/mag(average_) > 0.5)
-        {
-            newValues *= mag(average_)/mag(averagePsi);
-        }
-        else
-        {
-            newValues += (average_ - averagePsi);
-        }
-    }
-
-    this->operator==(newValues);
+    this->operator==(this->mappedField());
 
     if (debug)
     {
@@ -352,9 +164,6 @@ void mappedFieldFvPatchField<Type>::updateCoeffs()
             << endl;
     }
 
-    // Restore tag
-    UPstream::msgType() = oldTag;
-
     fixedValueFvPatchField<Type>::updateCoeffs();
 }
 
@@ -364,11 +173,7 @@ void mappedFieldFvPatchField<Type>::write(Ostream& os) const
 {
     fvPatchField<Type>::write(os);
     mappedPatchBase::write(os);
-    os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl;
-    os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl;
-    os.writeKeyword("average") << average_ << token::END_STATEMENT << nl;
-    os.writeKeyword("interpolationScheme") << interpolationScheme_
-        << token::END_STATEMENT << nl;
+    mappedPatchFieldBase<Type>::write(os);
     this->writeEntry("value", os);
 }
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.H
index 6dd9f3efb5c8579b8c9c966394d4aa34a5e8685a..983df12eb4aec8ecf35dceb4476bd3922c279613 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.H
@@ -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
@@ -75,6 +75,7 @@ SourceFiles
 #define mappedFieldFvPatchField_H
 
 #include "mappedPatchBase.H"
+#include "mappedPatchFieldBase.H"
 #include "fixedValueFvPatchFields.H"
 #include "interpolation.H"
 
@@ -90,37 +91,10 @@ namespace Foam
 template<class Type>
 class mappedFieldFvPatchField
 :
+    public fixedValueFvPatchField<Type>,
     public mappedPatchBase,
-    public fixedValueFvPatchField<Type>
+    public mappedPatchFieldBase<Type>
 {
-    // Private data
-
-        //- Name of field to sample - defaults to field associated with this
-        //  patchField if not specified
-        word fieldName_;
-
-        //- If true adjust the mapped field to maintain average value average_
-        const bool setAverage_;
-
-        //- Average value the mapped field is adjusted to maintain if
-        //  setAverage_ is set true
-        const Type average_;
-
-        //- Interpolation scheme to use for nearestCell mode
-        word interpolationScheme_;
-
-        //- Pointer to the cell interpolator
-        mutable autoPtr<interpolation<Type> > interpolator_;
-
-
-    // Private Member Functions
-
-        //- Field to sample. Either on my or nbr mesh
-        const GeometricField<Type, fvPatchField, volMesh>& sampleField() const;
-
-        //- Access the interpolation method
-        const interpolation<Type>& interpolator() const;
-
 
 public:
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C
new file mode 100644
index 0000000000000000000000000000000000000000..291fe316dce70579cc6353b3380f1713888f2990
--- /dev/null
+++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C
@@ -0,0 +1,340 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "mappedPatchFieldBase.H"
+#include "mappedPatchBase.H"
+#include "interpolationCell.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+template<class Type>
+mappedPatchFieldBase<Type>::mappedPatchFieldBase
+(
+    const mappedPatchBase& mapper,
+    const fvPatchField<Type>& patchField,
+    const word& fieldName,
+    const bool setAverage,
+    const Type average,
+    const word& interpolationScheme
+)
+:
+    mapper_(mapper),
+    patchField_(patchField),
+    fieldName_(fieldName),
+    setAverage_(setAverage),
+    average_(average),
+    interpolationScheme_(interpolationScheme)
+{}
+
+
+template<class Type>
+mappedPatchFieldBase<Type>::mappedPatchFieldBase
+(
+    const mappedPatchBase& mapper,
+    const fvPatchField<Type>& patchField,
+    const dictionary& dict
+)
+:
+    mapper_(mapper),
+    patchField_(patchField),
+    fieldName_
+    (
+        dict.template lookupOrDefault<word>
+        (
+            "fieldName",
+            patchField_.dimensionedInternalField().name()
+        )
+    ),
+    setAverage_(readBool(dict.lookup("setAverage"))),
+    average_(pTraits<Type>(dict.lookup("average"))),
+    interpolationScheme_(interpolationCell<Type>::typeName)
+{
+    if (mapper_.mode() == mappedPatchBase::NEARESTCELL)
+    {
+        dict.lookup("interpolationScheme") >> interpolationScheme_;
+    }
+}
+
+
+template<class Type>
+mappedPatchFieldBase<Type>::mappedPatchFieldBase
+(
+    const mappedPatchBase& mapper,
+    const fvPatchField<Type>& patchField
+)
+:
+    mapper_(mapper),
+    patchField_(patchField),
+    fieldName_(patchField_.dimensionedInternalField().name()),
+    setAverage_(false),
+    average_(pTraits<Type>::zero),
+    interpolationScheme_(interpolationCell<Type>::typeName)
+{}
+
+
+template<class Type>
+mappedPatchFieldBase<Type>::mappedPatchFieldBase
+(
+    const mappedPatchFieldBase<Type>& mapper
+)
+:
+    mapper_(mapper.mapper_),
+    patchField_(mapper.patchField_),
+    fieldName_(mapper.fieldName_),
+    setAverage_(mapper.setAverage_),
+    average_(mapper.average_),
+    interpolationScheme_(mapper.interpolationScheme_)
+{}
+
+
+template<class Type>
+mappedPatchFieldBase<Type>::mappedPatchFieldBase
+(
+    const mappedPatchBase& mapper,
+    const fvPatchField<Type>& patchField,
+    const mappedPatchFieldBase<Type>& base
+)
+:
+    mapper_(mapper),
+    patchField_(patchField),
+    fieldName_(base.fieldName_),
+    setAverage_(base.setAverage_),
+    average_(base.average_),
+    interpolationScheme_(base.interpolationScheme_)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+template<class Type>
+const GeometricField<Type, fvPatchField, volMesh>&
+mappedPatchFieldBase<Type>::sampleField() const
+{
+    typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
+
+    const fvMesh& nbrMesh = refCast<const fvMesh>(mapper_.sampleMesh());
+
+    if (mapper_.sameRegion())
+    {
+        if (fieldName_ == patchField_.dimensionedInternalField().name())
+        {
+            // Optimisation: bypass field lookup
+            return
+                dynamic_cast<const fieldType&>
+                (
+                    patchField_.dimensionedInternalField()
+                );
+        }
+        else
+        {
+            const fvMesh& thisMesh = patchField_.patch().boundaryMesh().mesh();
+            return thisMesh.template lookupObject<fieldType>(fieldName_);
+        }
+    }
+    else
+    {
+        return nbrMesh.template lookupObject<fieldType>(fieldName_);
+    }
+}
+
+
+template<class Type>
+const interpolation<Type>& mappedPatchFieldBase<Type>::interpolator() const
+{
+    if (!interpolator_.valid())
+    {
+        interpolator_ = interpolation<Type>::New
+        (
+            interpolationScheme_,
+            sampleField()
+        );
+    }
+    return interpolator_();
+}
+
+
+template<class Type>
+tmp<Field<Type> > mappedPatchFieldBase<Type>::mappedField() const
+{
+    typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
+
+    // Since we're inside initEvaluate/evaluate there might be processor
+    // comms underway. Change the tag we use.
+    int oldTag = UPstream::msgType();
+    UPstream::msgType() = oldTag + 1;
+
+    const fvMesh& thisMesh = patchField_.patch().boundaryMesh().mesh();
+    const fvMesh& nbrMesh = refCast<const fvMesh>(mapper_.sampleMesh());
+
+    // Result of obtaining remote values
+    tmp<Field<Type> > tnewValues(new Field<Type>(0));
+    Field<Type>& newValues = tnewValues();
+
+    switch (mapper_.mode())
+    {
+        case mappedPatchBase::NEARESTCELL:
+        {
+            const mapDistribute& distMap = mapper_.map();
+
+            if (interpolationScheme_ != interpolationCell<Type>::typeName)
+            {
+                // Send back sample points to the processor that holds the cell
+                vectorField samples(mapper_.samplePoints());
+                distMap.reverseDistribute
+                (
+                    (
+                        mapper_.sameRegion()
+                      ? thisMesh.nCells()
+                      : nbrMesh.nCells()
+                    ),
+                    point::max,
+                    samples
+                );
+
+                const interpolation<Type>& interp = interpolator();
+
+                newValues.setSize(samples.size(), pTraits<Type>::max);
+                forAll(samples, cellI)
+                {
+                    if (samples[cellI] != point::max)
+                    {
+                        newValues[cellI] = interp.interpolate
+                        (
+                            samples[cellI],
+                            cellI
+                        );
+                    }
+                }
+            }
+            else
+            {
+                newValues = sampleField();
+            }
+
+            distMap.distribute(newValues);
+
+            break;
+        }
+        case mappedPatchBase::NEARESTPATCHFACE:
+        case mappedPatchBase::NEARESTPATCHFACEAMI:
+        {
+            const label nbrPatchID =
+                nbrMesh.boundaryMesh().findPatchID(mapper_.samplePatch());
+
+            if (nbrPatchID < 0)
+            {
+                FatalErrorIn
+                (
+                    "void mappedPatchFieldBase<Type>::updateCoeffs()"
+                )<< "Unable to find sample patch " << mapper_.samplePatch()
+                 << " in region " << mapper_.sampleRegion()
+                 << " for patch " << patchField_.patch().name() << nl
+                 << abort(FatalError);
+            }
+
+            const fieldType& nbrField = sampleField();
+
+            newValues = nbrField.boundaryField()[nbrPatchID];
+            mapper_.distribute(newValues);
+
+            break;
+        }
+        case mappedPatchBase::NEARESTFACE:
+        {
+            Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero);
+
+            const fieldType& nbrField = sampleField();
+
+            forAll(nbrField.boundaryField(), patchI)
+            {
+                const fvPatchField<Type>& pf =
+                    nbrField.boundaryField()[patchI];
+                label faceStart = pf.patch().start();
+
+                forAll(pf, faceI)
+                {
+                    allValues[faceStart++] = pf[faceI];
+                }
+            }
+
+            mapper_.distribute(allValues);
+            newValues.transfer(allValues);
+
+            break;
+        }
+        default:
+        {
+            FatalErrorIn
+            (
+                "mappedPatchFieldBase<Type>::updateCoeffs()"
+            )<< "Unknown sampling mode: " << mapper_.mode()
+             << nl << abort(FatalError);
+        }
+    }
+
+    if (setAverage_)
+    {
+        Type averagePsi =
+            gSum(patchField_.patch().magSf()*newValues)
+           /gSum(patchField_.patch().magSf());
+
+        if (mag(averagePsi)/mag(average_) > 0.5)
+        {
+            newValues *= mag(average_)/mag(averagePsi);
+        }
+        else
+        {
+            newValues += (average_ - averagePsi);
+        }
+    }
+
+    // Restore tag
+    UPstream::msgType() = oldTag;
+
+    return tnewValues;
+}
+
+
+template<class Type>
+void mappedPatchFieldBase<Type>::write(Ostream& os) const
+{
+    os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl;
+    os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl;
+    os.writeKeyword("average") << average_ << token::END_STATEMENT << nl;
+    os.writeKeyword("interpolationScheme") << interpolationScheme_
+        << token::END_STATEMENT << nl;
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.H b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.H
new file mode 100644
index 0000000000000000000000000000000000000000..50728410949b23ae732b5110718dfc7a3b2642c3
--- /dev/null
+++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.H
@@ -0,0 +1,166 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+Class
+    Foam::mappedPatchFieldBase
+
+Description
+    Functionality for sampling fields using mappedPatchBase.
+
+SourceFiles
+    mappedPatchFieldBase.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef mappedPatchFieldBase_H
+#define mappedPatchFieldBase_H
+
+#include "fixedValueFvPatchFields.H"
+#include "volFieldsFwd.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+class mappedPatchBase;
+template<class> class interpolation;
+
+/*---------------------------------------------------------------------------*\
+                  Class mappedPatchFieldBase Declaration
+\*---------------------------------------------------------------------------*/
+
+template<class Type>
+class mappedPatchFieldBase
+{
+
+protected:
+
+    // Protected data
+
+        //- Mapping engine
+        const mappedPatchBase& mapper_;
+
+        //- Underlying patch field
+        const fvPatchField<Type>& patchField_;
+
+        //- Name of field to sample
+        word fieldName_;
+
+        //- If true adjust the mapped field to maintain average value average_
+        const bool setAverage_;
+
+        //- Average value the mapped field is adjusted to maintain if
+        //  setAverage_ is set true
+        const Type average_;
+
+        //- Interpolation scheme to use for nearestcell mode
+        word interpolationScheme_;
+
+        mutable autoPtr<interpolation<Type> > interpolator_;
+
+
+    // Protected Member Functions
+
+
+public:
+
+    // Constructors
+
+        //- Construct from components
+        mappedPatchFieldBase
+        (
+            const mappedPatchBase& mapper,
+            const fvPatchField<Type>& patchField,
+            const word& fieldName,
+            const bool setAverage,
+            const Type average,
+            const word& interpolationScheme
+        );
+
+        //- Construct from dictionary
+        mappedPatchFieldBase
+        (
+            const mappedPatchBase& mapper,
+            const fvPatchField<Type>& patchField,
+            const dictionary& dict
+        );
+
+        //- Construct empty
+        mappedPatchFieldBase
+        (
+            const mappedPatchBase& mapper,
+            const fvPatchField<Type>& patchField
+        );
+
+        //- Construct copy
+        mappedPatchFieldBase
+        (
+            const mappedPatchFieldBase<Type>& mapper
+        );
+
+        //- Construct copy, resetting patch and field
+        mappedPatchFieldBase
+        (
+            const mappedPatchBase& mapper,
+            const fvPatchField<Type>& patchField,
+            const mappedPatchFieldBase<Type>& base
+        );
+
+
+    //- Destructor
+    virtual ~mappedPatchFieldBase<Type>()
+    {}
+
+
+    // Member functions
+
+        //- Field to sample. Either on my or nbr mesh
+        const GeometricField<Type, fvPatchField, volMesh>& sampleField() const;
+
+        //- Access the interpolation method
+        const interpolation<Type>& interpolator() const;
+
+        //- Map sampleField onto *this patch
+        virtual tmp<Field<Type> > mappedField() const;
+
+        //- Write
+        virtual void write(Ostream&) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+#   include "mappedPatchFieldBase.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.C
index 819f39ecfb88b20368f1f8c6db3522d87066fc36..680d3f89f0fa51d9042a14435acd65539b51bbb3 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -135,6 +135,7 @@ void Foam::mappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
             break;
         }
         case mappedPatchBase::NEARESTPATCHFACE:
+        case mappedPatchBase::NEARESTPATCHFACEAMI:
         {
             const label samplePatchI = mpp.samplePolyPatch().index();
             const fvPatchField<Type>& nbrPatchField =
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C
index 77cc8d61a9d8dad64d7cf0935df71d716bf1d167..851344194b554ac57457754983d74cddc289eb59 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.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
@@ -26,7 +26,6 @@ License
 #include "mappedFixedValueFvPatchField.H"
 #include "mappedPatchBase.H"
 #include "volFields.H"
-#include "interpolationCell.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -43,10 +42,7 @@ mappedFixedValueFvPatchField<Type>::mappedFixedValueFvPatchField
 )
 :
     fixedValueFvPatchField<Type>(p, iF),
-    fieldName_(iF.name()),
-    setAverage_(false),
-    average_(pTraits<Type>::zero),
-    interpolationScheme_(interpolationCell<Type>::typeName)
+    mappedPatchFieldBase<Type>(this->mapper(p, iF), *this)
 {}
 
 
@@ -60,31 +56,8 @@ mappedFixedValueFvPatchField<Type>::mappedFixedValueFvPatchField
 )
 :
     fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
-    fieldName_(ptf.fieldName_),
-    setAverage_(ptf.setAverage_),
-    average_(ptf.average_),
-    interpolationScheme_(ptf.interpolationScheme_)
-{
-    if (!isA<mappedPatchBase>(this->patch().patch()))
-    {
-        FatalErrorIn
-        (
-            "mappedFixedValueFvPatchField<Type>::"
-            "mappedFixedValueFvPatchField\n"
-            "(\n"
-            "    const mappedFixedValueFvPatchField<Type>&,\n"
-            "    const fvPatch&,\n"
-            "    const Field<Type>&,\n"
-            "    const fvPatchFieldMapper&\n"
-            ")\n"
-        )   << "\n    patch type '" << p.type()
-            << "' not type '" << mappedPatchBase::typeName << "'"
-            << "\n    for patch " << p.name()
-            << " of field " << this->dimensionedInternalField().name()
-            << " in file " << this->dimensionedInternalField().objectPath()
-            << exit(FatalError);
-    }
-}
+    mappedPatchFieldBase<Type>(this->mapper(p, iF), *this, ptf)
+{}
 
 
 template<class Type>
@@ -96,39 +69,8 @@ mappedFixedValueFvPatchField<Type>::mappedFixedValueFvPatchField
 )
 :
     fixedValueFvPatchField<Type>(p, iF, dict),
-    fieldName_(dict.lookupOrDefault<word>("fieldName", iF.name())),
-    setAverage_(readBool(dict.lookup("setAverage"))),
-    average_(pTraits<Type>(dict.lookup("average"))),
-    interpolationScheme_(interpolationCell<Type>::typeName)
-{
-    if (!isA<mappedPatchBase>(this->patch().patch()))
-    {
-        FatalErrorIn
-        (
-            "mappedFixedValueFvPatchField<Type>::"
-            "mappedFixedValueFvPatchField\n"
-            "(\n"
-            "    const fvPatch& p,\n"
-            "    const DimensionedField<Type, volMesh>& iF,\n"
-            "    const dictionary& dict\n"
-            ")\n"
-        )   << "\n    patch type '" << p.type()
-            << "' not type '" << mappedPatchBase::typeName << "'"
-            << "\n    for patch " << p.name()
-            << " of field " << this->dimensionedInternalField().name()
-            << " in file " << this->dimensionedInternalField().objectPath()
-            << exit(FatalError);
-    }
-
-    const mappedPatchBase& mpp = refCast<const mappedPatchBase>
-    (
-        mappedFixedValueFvPatchField<Type>::patch().patch()
-    );
-    if (mpp.mode() == mappedPatchBase::NEARESTCELL)
-    {
-        dict.lookup("interpolationScheme") >> interpolationScheme_;
-    }
-}
+    mappedPatchFieldBase<Type>(this->mapper(p, iF), *this, dict)
+{}
 
 
 template<class Type>
@@ -138,10 +80,7 @@ mappedFixedValueFvPatchField<Type>::mappedFixedValueFvPatchField
 )
 :
     fixedValueFvPatchField<Type>(ptf),
-    fieldName_(ptf.fieldName_),
-    setAverage_(ptf.setAverage_),
-    average_(ptf.average_),
-    interpolationScheme_(ptf.interpolationScheme_)
+    mappedPatchFieldBase<Type>(ptf)
 {}
 
 
@@ -153,64 +92,32 @@ mappedFixedValueFvPatchField<Type>::mappedFixedValueFvPatchField
 )
 :
     fixedValueFvPatchField<Type>(ptf, iF),
-    fieldName_(ptf.fieldName_),
-    setAverage_(ptf.setAverage_),
-    average_(ptf.average_),
-    interpolationScheme_(ptf.interpolationScheme_)
+    mappedPatchFieldBase<Type>(this->mapper(this->patch(), iF), *this, ptf)
 {}
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class Type>
-const GeometricField<Type, fvPatchField, volMesh>&
-mappedFixedValueFvPatchField<Type>::sampleField() const
-{
-    typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
-
-    const mappedPatchBase& mpp = refCast<const mappedPatchBase>
-    (
-        mappedFixedValueFvPatchField<Type>::patch().patch()
-    );
-    const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
-
-    if (mpp.sameRegion())
-    {
-        if (fieldName_ == this->dimensionedInternalField().name())
-        {
-            // Optimisation: bypass field lookup
-            return
-                dynamic_cast<const fieldType&>
-                (
-                    this->dimensionedInternalField()
-                );
-        }
-        else
-        {
-            const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
-            return thisMesh.lookupObject<fieldType>(fieldName_);
-        }
-    }
-    else
-    {
-        return nbrMesh.lookupObject<fieldType>(fieldName_);
-    }
-}
-
-
-template<class Type>
-const interpolation<Type>&
-mappedFixedValueFvPatchField<Type>::interpolator() const
+const mappedPatchBase& mappedFixedValueFvPatchField<Type>::mapper
+(
+    const fvPatch& p,
+    const DimensionedField<Type, volMesh>& iF
+)
 {
-    if (!interpolator_.valid())
+    if (!isA<mappedPatchBase>(p.patch()))
     {
-        interpolator_ = interpolation<Type>::New
+        FatalErrorIn
         (
-            interpolationScheme_,
-            sampleField()
-        );
+            "mappedFixedValueFvPatchField<Type>::mapper()"
+        )   << "\n    patch type '" << p.patch().type()
+            << "' not type '" << mappedPatchBase::typeName << "'"
+            << "\n    for patch " << p.patch().name()
+            << " of field " << iF.name()
+            << " in file " << iF.objectPath()
+            << exit(FatalError);
     }
-    return interpolator_();
+    return refCast<const mappedPatchBase>(p.patch());
 }
 
 
@@ -222,140 +129,7 @@ void mappedFixedValueFvPatchField<Type>::updateCoeffs()
         return;
     }
 
-    typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
-
-    // Since we're inside initEvaluate/evaluate there might be processor
-    // comms underway. Change the tag we use.
-    int oldTag = UPstream::msgType();
-    UPstream::msgType() = oldTag + 1;
-
-    // Get the scheduling information from the mappedPatchBase
-    const mappedPatchBase& mpp = refCast<const mappedPatchBase>
-    (
-        mappedFixedValueFvPatchField<Type>::patch().patch()
-    );
-
-    const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
-    const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
-
-    // Result of obtaining remote values
-    Field<Type> newValues;
-
-    switch (mpp.mode())
-    {
-        case mappedPatchBase::NEARESTCELL:
-        {
-            const mapDistribute& distMap = mpp.map();
-
-            if (interpolationScheme_ != interpolationCell<Type>::typeName)
-            {
-                // Send back sample points to the processor that holds the cell
-                vectorField samples(mpp.samplePoints());
-                distMap.reverseDistribute
-                (
-                    (mpp.sameRegion() ? thisMesh.nCells() : nbrMesh.nCells()),
-                    point::max,
-                    samples
-                );
-
-                const interpolation<Type>& interp = interpolator();
-
-                newValues.setSize(samples.size(), pTraits<Type>::max);
-                forAll(samples, cellI)
-                {
-                    if (samples[cellI] != point::max)
-                    {
-                        newValues[cellI] = interp.interpolate
-                        (
-                            samples[cellI],
-                            cellI
-                        );
-                    }
-                }
-            }
-            else
-            {
-                newValues = sampleField();
-            }
-
-            distMap.distribute(newValues);
-
-            break;
-        }
-        case mappedPatchBase::NEARESTPATCHFACE:
-        case mappedPatchBase::NEARESTPATCHFACEAMI:
-        {
-            const label nbrPatchID =
-                nbrMesh.boundaryMesh().findPatchID(mpp.samplePatch());
-
-            if (nbrPatchID < 0)
-            {
-                FatalErrorIn
-                (
-                    "void mappedFixedValueFvPatchField<Type>::updateCoeffs()"
-                )<< "Unable to find sample patch " << mpp.samplePatch()
-                 << " in region " << mpp.sampleRegion()
-                 << " for patch " << this->patch().name() << nl
-                 << abort(FatalError);
-            }
-
-            const fieldType& nbrField = sampleField();
-
-            newValues = nbrField.boundaryField()[nbrPatchID];
-            mpp.distribute(newValues);
-
-            break;
-        }
-        case mappedPatchBase::NEARESTFACE:
-        {
-            Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero);
-
-            const fieldType& nbrField = sampleField();
-
-            forAll(nbrField.boundaryField(), patchI)
-            {
-                const fvPatchField<Type>& pf =
-                    nbrField.boundaryField()[patchI];
-                label faceStart = pf.patch().start();
-
-                forAll(pf, faceI)
-                {
-                    allValues[faceStart++] = pf[faceI];
-                }
-            }
-
-            mpp.distribute(allValues);
-            newValues.transfer(allValues);
-
-            break;
-        }
-        default:
-        {
-            FatalErrorIn
-            (
-                "mappedFixedValueFvPatchField<Type>::updateCoeffs()"
-            )<< "Unknown sampling mode: " << mpp.mode()
-             << nl << abort(FatalError);
-        }
-    }
-
-    if (setAverage_)
-    {
-        Type averagePsi =
-            gSum(this->patch().magSf()*newValues)
-           /gSum(this->patch().magSf());
-
-        if (mag(averagePsi)/mag(average_) > 0.5)
-        {
-            newValues *= mag(average_)/mag(averagePsi);
-        }
-        else
-        {
-            newValues += (average_ - averagePsi);
-        }
-    }
-
-    this->operator==(newValues);
+    this->operator==(this->mappedField());
 
     if (debug)
     {
@@ -368,9 +142,6 @@ void mappedFixedValueFvPatchField<Type>::updateCoeffs()
             << endl;
     }
 
-    // Restore tag
-    UPstream::msgType() = oldTag;
-
     fixedValueFvPatchField<Type>::updateCoeffs();
 }
 
@@ -379,11 +150,7 @@ template<class Type>
 void mappedFixedValueFvPatchField<Type>::write(Ostream& os) const
 {
     fvPatchField<Type>::write(os);
-    os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl;
-    os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl;
-    os.writeKeyword("average") << average_ << token::END_STATEMENT << nl;
-    os.writeKeyword("interpolationScheme") << interpolationScheme_
-        << token::END_STATEMENT << nl;
+    mappedPatchFieldBase<Type>::write(os);
     this->writeEntry("value", os);
 }
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.H
index dd52f2a2b635b725368edc81cf7654ccdeab7485..6267e88ab228791cf362cdeeb494351f7e5653fc 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.H
@@ -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
@@ -83,7 +83,8 @@ SourceFiles
 #define mappedFixedValueFvPatchField_H
 
 #include "fixedValueFvPatchFields.H"
-#include "interpolation.H"
+//#include "interpolation.H"
+#include "mappedPatchFieldBase.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -97,37 +98,19 @@ namespace Foam
 template<class Type>
 class mappedFixedValueFvPatchField
 :
-    public fixedValueFvPatchField<Type>
+    public fixedValueFvPatchField<Type>,
+    public mappedPatchFieldBase<Type>
 {
 
 protected:
 
-    // Protected data
-
-        //- Name of field to sample - defaults to field associated with this
-        //  patchField if not specified
-        word fieldName_;
-
-        //- If true adjust the mapped field to maintain average value average_
-        const bool setAverage_;
-
-        //- Average value the mapped field is adjusted to maintain if
-        //  setAverage_ is set true
-        const Type average_;
-
-        //- Interpolation scheme to use for nearestcell mode
-        word interpolationScheme_;
-
-        mutable autoPtr<interpolation<Type> > interpolator_;
-
-
     // Protected Member Functions
 
-        //- Field to sample. Either on my or nbr mesh
-        const GeometricField<Type, fvPatchField, volMesh>& sampleField() const;
-
-        //- Access the interpolation method
-        const interpolation<Type>& interpolator() const;
+        const mappedPatchBase& mapper
+        (
+            const fvPatch& p,
+            const DimensionedField<Type, volMesh>& iF
+        );
 
 
 public:
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.C
index 47fd87059f95fc8ed8cb38603b71bcde71c5ad8e..42d52401d8701e17e4fabdfb6e4cca1c7a959e1c 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -104,7 +104,11 @@ oscillatingFixedValueFvPatchField<Type>::oscillatingFixedValueFvPatchField
     }
     else
     {
-        fixedValueFvPatchField<Type>::operator==(refValue_*currentScale());
+        fixedValueFvPatchField<Type>::operator==
+        (
+            refValue_*currentScale()
+          + offset_
+        );
     }
 }
 
@@ -179,9 +183,11 @@ void oscillatingFixedValueFvPatchField<Type>::updateCoeffs()
 
     if (curTimeIndex_ != this->db().time().timeIndex())
     {
-        Field<Type>& patchField = *this;
-
-        patchField = refValue_*currentScale() + offset_;
+        fixedValueFvPatchField<Type>::operator==
+        (
+            refValue_*currentScale()
+          + offset_
+        );
 
         curTimeIndex_ = this->db().time().timeIndex();
     }
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C
index f613a7e6a2c13e47c86947d186d18bd5e3cbefe7..6ea997f3fd8e41fc4e1d9ba464744ad40b03574f 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.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
@@ -343,6 +343,18 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
                 )
             );
 
+            if (vals.size() != mapperPtr_().sourceSize())
+            {
+                FatalErrorIn
+                (
+                    "timeVaryingMappedFixedValueFvPatchField<Type>::"
+                    "checkTable()"
+                )   << "Number of values (" << vals.size()
+                    << ") differs from the number of points ("
+                    <<  mapperPtr_().sourceSize()
+                    << ") in file " << vals.objectPath() << exit(FatalError);
+            }
+
             startAverage_ = vals.average();
             startSampledValues_ = mapperPtr_().interpolate(vals);
         }
@@ -388,6 +400,19 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
                     false
                 )
             );
+
+            if (vals.size() != mapperPtr_().sourceSize())
+            {
+                FatalErrorIn
+                (
+                    "timeVaryingMappedFixedValueFvPatchField<Type>::"
+                    "checkTable()"
+                )   << "Number of values (" << vals.size()
+                    << ") differs from the number of points ("
+                    <<  mapperPtr_().sourceSize()
+                    << ") in file " << vals.objectPath() << exit(FatalError);
+            }
+
             endAverage_ = vals.average();
             endSampledValues_ = mapperPtr_().interpolate(vals);
         }
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.H
index 3917d167bd42369234baf356e4082f9187ff2632..f99a71cc354f2bbfe960aba728f00c71f13e4454 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -39,7 +39,7 @@ Description
 
     \vartable
         x_p     | patch values
-        x_{ref} | refernce patch values
+        x_{ref} | reference patch values
         n       | time level
         \alpha  | fraction of new random component added to previous time value
         C_{RMS} | RMS coefficient
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C
index 9b0a6694e7ad9aba9048e02b9618e3acc43ca74a..72af0d8d9c08ce5aad71fdfafc80110c2c7496e0 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C
@@ -2,16 +2,16 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-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 2 of the License, or (at your
-    option) any later version.
+    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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C
index 975e11ff2b1a51a8fbee093c20afb07d80689b82..fa3d6d7a315e0fcea6297366534e853e408fa9bc 100644
--- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -173,15 +173,13 @@ void Foam::fvPatchField<Type>::check(const fvPatchField<Type>& ptf) const
 }
 
 
-// Return gradient at boundary
 template<class Type>
 Foam::tmp<Foam::Field<Type> > Foam::fvPatchField<Type>::snGrad() const
 {
-    return (*this - patchInternalField())*patch_.deltaCoeffs();
+    return patch_.deltaCoeffs()*(*this - patchInternalField());
 }
 
 
-// Return internal field next to patch as patch field
 template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::fvPatchField<Type>::patchInternalField() const
@@ -200,10 +198,61 @@ void Foam::fvPatchField<Type>::patchInternalField(Field<Type>& pif) const
 template<class Type>
 void Foam::fvPatchField<Type>::autoMap
 (
-    const fvPatchFieldMapper& m
+    const fvPatchFieldMapper& mapper
 )
 {
-    Field<Type>::autoMap(m);
+    Field<Type>& f = *this;
+
+    if (!this->size())
+    {
+        f.setSize(mapper.size());
+        if (f.size())
+        {
+            f = this->patchInternalField();
+        }
+    }
+    else
+    {
+        // Map all faces provided with mapping data
+        Field<Type>::autoMap(mapper);
+
+        // For unmapped faces set to internal field value (zero-gradient)
+        if
+        (
+            mapper.direct()
+         && &mapper.directAddressing()
+         && mapper.directAddressing().size()
+        )
+        {
+            Field<Type> pif(this->patchInternalField());
+
+            const labelList& mapAddressing = mapper.directAddressing();
+
+            forAll(mapAddressing, i)
+            {
+                if (mapAddressing[i] < 0)
+                {
+                    f[i] = pif[i];
+                }
+            }
+        }
+        else if (!mapper.direct() && mapper.addressing().size())
+        {
+            Field<Type> pif(this->patchInternalField());
+
+            const labelListList& mapAddressing = mapper.addressing();
+
+            forAll(mapAddressing, i)
+            {
+                const labelList& localAddrs = mapAddressing[i];
+
+                if (!localAddrs.size())
+                {
+                    f[i] = pif[i];
+                }
+            }
+        }
+    }
 }
 
 
diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H
index ecace2a0519d3e28c1da600c08aecb38bacce0b6..6047f1e4af794e10a5abbcc8e89176c337a90cf6 100644
--- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -349,6 +349,20 @@ public:
             //- Return patch-normal gradient
             virtual tmp<Field<Type> > snGrad() const;
 
+            //- Return patch-normal gradient for coupled-patches
+            //  using the deltaCoeffs provided
+            virtual tmp<Field<Type> > snGrad
+            (
+                const scalarField& deltaCoeffs
+            ) const
+            {
+                notImplemented
+                (
+                    type() + "::snGrad(const scalarField& deltaCoeffs)"
+                );
+                return *this;
+            }
+
             //- Update the coefficients associated with the patch field
             //  Sets Updated to true
             virtual void updateCoeffs()
@@ -421,6 +435,22 @@ public:
                 return *this;
             }
 
+            //- Return the matrix diagonal coefficients corresponding to the
+            //  evaluation of the gradient of this coupled patchField
+            //  using the deltaCoeffs provided
+            virtual tmp<Field<Type> > gradientInternalCoeffs
+            (
+                const scalarField& deltaCoeffs
+            ) const
+            {
+                notImplemented
+                (
+                    type()
+                  + "::gradientInternalCoeffs(const scalarField& deltaCoeffs)"
+                );
+                return *this;
+            }
+
             //- Return the matrix source coefficients corresponding to the
             //  evaluation of the gradient of this patchField
             virtual tmp<Field<Type> > gradientBoundaryCoeffs() const
@@ -429,6 +459,22 @@ public:
                 return *this;
             }
 
+            //- Return the matrix source coefficients corresponding to the
+            //  evaluation of the gradient of this coupled patchField
+            //  using the deltaCoeffs provided
+            virtual tmp<Field<Type> > gradientBoundaryCoeffs
+            (
+                const scalarField& deltaCoeffs
+            ) const
+            {
+                notImplemented
+                (
+                    type()
+                  + "::gradientBoundaryCoeffs(const scalarField& deltaCoeffs)"
+                );
+                return *this;
+            }
+
 
             //- Manipulate matrix
             virtual void manipulateMatrix(fvMatrix<Type>& matrix);
diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/convectionScheme/convectionScheme.H b/src/finiteVolume/finiteVolume/convectionSchemes/convectionScheme/convectionScheme.H
index 67fc732bf7d7de44e4b9000e380ee93a036783a1..e871aec19a30be1dfebb7ecace4bfb1b5a56c049 100644
--- a/src/finiteVolume/finiteVolume/convectionSchemes/convectionScheme/convectionScheme.H
+++ b/src/finiteVolume/finiteVolume/convectionSchemes/convectionScheme/convectionScheme.H
@@ -2,13 +2,13 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
 
-    OpenFOAM is free software: you can redistribute itand/or modify it
+    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.
diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.C
index 2fcb4b5f4b59d391eff4dbc9ca8cc76db3cb413d..dd531848e63ae7563732cb16ef942a76928438e2 100644
--- a/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.C
+++ b/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -387,7 +387,8 @@ SLTSDdtScheme<Type>::fvmDdt
 
     scalarField rDeltaT(SLrDeltaT()().internalField());
 
-    Info<< "max/min rDeltaT " << max(rDeltaT) << " " << min(rDeltaT) << endl;
+    Info<< "SLTSDdtScheme<Type>::fvmDdt: max/min rDeltaT "
+        << gMax(rDeltaT) << " " << gMin(rDeltaT) << endl;
 
     fvm.diag() = rDeltaT*mesh().V();
 
diff --git a/src/finiteVolume/finiteVolume/fvc/fvcSmooth/smoothDataI.H b/src/finiteVolume/finiteVolume/fvc/fvcSmooth/smoothDataI.H
index 162389fb80087fa45ae8821b2d83a64c59814381..fa39a6e09452bb5b5b1adbfab93c1289f53251c8 100644
--- a/src/finiteVolume/finiteVolume/fvc/fvcSmooth/smoothDataI.H
+++ b/src/finiteVolume/finiteVolume/fvc/fvcSmooth/smoothDataI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -177,7 +177,7 @@ inline bool Foam::smoothData::updateFace
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::smoothData::equal
 (
     const smoothData& rhs,
diff --git a/src/finiteVolume/finiteVolume/fvc/fvcSmooth/sweepDataI.H b/src/finiteVolume/finiteVolume/fvc/fvcSmooth/sweepDataI.H
index 1cd43e52de92afd8e7576f209338e01ccf01333d..0668fad184d1732f6b6f0dbc12890fa9bf157622 100644
--- a/src/finiteVolume/finiteVolume/fvc/fvcSmooth/sweepDataI.H
+++ b/src/finiteVolume/finiteVolume/fvc/fvcSmooth/sweepDataI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -193,7 +193,7 @@ inline bool Foam::sweepData::updateFace
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::sweepData::equal
 (
     const sweepData& rhs,
diff --git a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.C
similarity index 50%
rename from src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.C
rename to src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.C
index 91e2cc50f5fcf28888a3eb89f7d263befedc860d..03a6f1c84fd00e6ddcfa158a0145132a78b1124a 100644
--- a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.C
+++ b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.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) 2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -23,18 +23,16 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "extendedLeastSquaresGrad.H"
-#include "extendedLeastSquaresVectors.H"
+#include "LeastSquaresGrad.H"
+#include "LeastSquaresVectors.H"
 #include "gaussGrad.H"
 #include "fvMesh.H"
 #include "volMesh.H"
-#include "surfaceMesh.H"
-#include "GeometricField.H"
 #include "zeroGradientFvPatchField.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-template<class Type>
+template<class Type, class Stencil>
 Foam::tmp
 <
     Foam::GeometricField
@@ -44,15 +42,21 @@ Foam::tmp
     Foam::volMesh
     >
 >
-Foam::fv::extendedLeastSquaresGrad<Type>::calcGrad
+Foam::fv::LeastSquaresGrad<Type, Stencil>::calcGrad
 (
-    const GeometricField<Type, fvPatchField, volMesh>& vsf,
+    const GeometricField<Type, fvPatchField, volMesh>& vtf,
     const word& name
 ) const
 {
     typedef typename outerProduct<vector, Type>::type GradType;
 
-    const fvMesh& mesh = vsf.mesh();
+    const fvMesh& mesh = vtf.mesh();
+
+    // Get reference to least square vectors
+    const LeastSquaresVectors<Stencil>& lsv = LeastSquaresVectors<Stencil>::New
+    (
+        mesh
+    );
 
     tmp<GeometricField<GradType, fvPatchField, volMesh> > tlsGrad
     (
@@ -61,7 +65,7 @@ Foam::fv::extendedLeastSquaresGrad<Type>::calcGrad
             IOobject
             (
                 name,
-                vsf.instance(),
+                vtf.instance(),
                 mesh,
                 IOobject::NO_READ,
                 IOobject::NO_WRITE
@@ -70,87 +74,64 @@ Foam::fv::extendedLeastSquaresGrad<Type>::calcGrad
             dimensioned<GradType>
             (
                 "zero",
-                vsf.dimensions()/dimLength,
+                vtf.dimensions()/dimLength,
                 pTraits<GradType>::zero
             ),
             zeroGradientFvPatchField<GradType>::typeName
         )
     );
     GeometricField<GradType, fvPatchField, volMesh>& lsGrad = tlsGrad();
+    Field<GradType>& lsGradIf = lsGrad;
 
-    // Get reference to least square vectors
-    const extendedLeastSquaresVectors& lsv = extendedLeastSquaresVectors::New
-    (
-        mesh,
-        minDet_
-    );
+    const extendedCentredCellToCellStencil& stencil = lsv.stencil();
+    const List<List<label> >& stencilAddr = stencil.stencil();
+    const List<List<vector> >& lsvs = lsv.vectors();
 
-    const surfaceVectorField& ownLs = lsv.pVectors();
-    const surfaceVectorField& neiLs = lsv.nVectors();
+    // Construct flat version of vtf
+    // including all values referred to by the stencil
+    List<Type> flatVtf(stencil.map().constructSize(), pTraits<Type>::zero);
 
-    const labelUList& owner = mesh.owner();
-    const labelUList& neighbour = mesh.neighbour();
-
-    forAll(owner, facei)
+    // Insert internal values
+    forAll(vtf, celli)
     {
-        label own = owner[facei];
-        label nei = neighbour[facei];
-
-        Type deltaVsf = vsf[nei] - vsf[own];
-
-        lsGrad[own] += ownLs[facei]*deltaVsf;
-        lsGrad[nei] -= neiLs[facei]*deltaVsf;
+        flatVtf[celli] = vtf[celli];
     }
 
-    // Boundary faces
-    forAll(vsf.boundaryField(), patchi)
+    // Insert boundary values
+    forAll(vtf.boundaryField(), patchi)
     {
-        const fvsPatchVectorField& patchOwnLs = ownLs.boundaryField()[patchi];
+        const fvPatchField<Type>& ptf = vtf.boundaryField()[patchi];
 
-        const labelUList& faceCells =
-            lsGrad.boundaryField()[patchi].patch().faceCells();
+        label nCompact =
+            ptf.patch().start()
+          - mesh.nInternalFaces()
+          + mesh.nCells();
 
-        if (vsf.boundaryField()[patchi].coupled())
+        forAll(ptf, i)
         {
-            const Field<Type> neiVsf
-            (
-                vsf.boundaryField()[patchi].patchNeighbourField()
-            );
-
-            forAll(neiVsf, patchFaceI)
-            {
-                lsGrad[faceCells[patchFaceI]] +=
-                    patchOwnLs[patchFaceI]
-                   *(neiVsf[patchFaceI] - vsf[faceCells[patchFaceI]]);
-            }
-        }
-        else
-        {
-            const fvPatchField<Type>& patchVsf = vsf.boundaryField()[patchi];
-
-            forAll(patchVsf, patchFaceI)
-            {
-                lsGrad[faceCells[patchFaceI]] +=
-                     patchOwnLs[patchFaceI]
-                    *(patchVsf[patchFaceI] - vsf[faceCells[patchFaceI]]);
-            }
+            flatVtf[nCompact++] = ptf[i];
         }
     }
 
+    // Do all swapping to complete flatVtf
+    stencil.map().distribute(flatVtf);
 
-    const List<labelPair>& additionalCells = lsv.additionalCells();
-    const vectorField& additionalVectors = lsv.additionalVectors();
-
-    forAll(additionalCells, i)
+    // Accumulate the cell-centred gradient from the
+    // weighted least-squares vectors and the flattened field values
+    forAll(stencilAddr, celli)
     {
-        lsGrad[additionalCells[i][0]] +=
-            additionalVectors[i]
-           *(vsf[additionalCells[i][1]] - vsf[additionalCells[i][0]]);
-    }
+        const labelList& compactCells = stencilAddr[celli];
+        const List<vector>& lsvc = lsvs[celli];
 
+        forAll(compactCells, i)
+        {
+            lsGradIf[celli] += lsvc[i]*flatVtf[compactCells[i]];
+        }
+    }
 
+    // Correct the boundary conditions
     lsGrad.correctBoundaryConditions();
-    gaussGrad<Type>::correctBoundaryConditions(vsf, lsGrad);
+    gaussGrad<Type>::correctBoundaryConditions(vtf, lsGrad);
 
     return tlsGrad;
 }
diff --git a/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.H
new file mode 100644
index 0000000000000000000000000000000000000000..edc94184650bf43270d9f30900c88ff007f0809a
--- /dev/null
+++ b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrad.H
@@ -0,0 +1,174 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+Class
+    Foam::fv::LeastSquaresGrad
+
+Description
+    Gradient calculated using weighted least-squares on an arbitrary stencil.
+    The stencil type is provided via a template argument and any cell-based
+    stencil is supported:
+
+    \table
+        Stencil                     | Connections     | Scheme name
+        centredCFCCellToCellStencil | cell-face-cell  | Not Instantiated
+        centredCPCCellToCellStencil | cell-point-cell | pointCellsLeastSquares
+        centredCECCellToCellStencil | cell-edge-cell  | edgeCellsLeastSquares
+    \endtable
+
+    The first of these is not instantiated by default as the standard
+    leastSquaresGrad is equivalent and more efficient.
+
+    \heading Usage
+
+    Example of the gradient specification:
+    \verbatim
+    gradSchemes
+    {
+        default         pointCellsLeastSquares;
+    }
+    \endverbatim
+
+See Also
+    Foam::fv::LeastSquaresVectors
+    Foam::fv::leastSquaresGrad
+
+SourceFiles
+    LeastSquaresGrad.C
+    LeastSquaresVectors.H
+    LeastSquaresVectors.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef LeastSquaresGrad_H
+#define LeastSquaresGrad_H
+
+#include "gradScheme.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace fv
+{
+
+/*---------------------------------------------------------------------------*\
+                      Class LeastSquaresGrad Declaration
+\*---------------------------------------------------------------------------*/
+
+template<class Type, class Stencil>
+class LeastSquaresGrad
+:
+    public fv::gradScheme<Type>
+{
+    // Private Data
+
+        //- Minimum determinant criterion to choose extra cells
+        scalar minDet_;
+
+
+    // Private Member Functions
+
+        //- Disallow default bitwise copy construct
+        LeastSquaresGrad(const LeastSquaresGrad&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const LeastSquaresGrad&);
+
+
+public:
+
+    //- Runtime type information
+    TypeName("LeastSquares");
+
+
+    // Constructors
+
+        //- Construct from Istream
+        LeastSquaresGrad(const fvMesh& mesh, Istream& schemeData)
+        :
+            gradScheme<Type>(mesh)
+        {}
+
+
+    // Member Functions
+
+        //- Return the gradient of the given field to the gradScheme::grad
+        //  for optional caching
+        virtual tmp
+        <
+            GeometricField
+            <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
+        > calcGrad
+        (
+            const GeometricField<Type, fvPatchField, volMesh>& vsf,
+            const word& name
+        ) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace fv
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+// Add the patch constructor functions to the hash tables
+
+#define makeLeastSquaresGradTypeScheme(SS, STENCIL, TYPE)                     \
+                                                                              \
+typedef LeastSquaresGrad<TYPE, STENCIL> LeastSquaresGrad##TYPE##STENCIL##_;   \
+defineTemplateTypeNameAndDebugWithName                                        \
+    (LeastSquaresGrad##TYPE##STENCIL##_, #SS, 0);                             \
+                                                                              \
+gradScheme<TYPE>::addIstreamConstructorToTable                                \
+<LeastSquaresGrad<TYPE, STENCIL> >                                            \
+    add##SS##STENCIL##TYPE##IstreamConstructorToTable_;
+
+#define makeLeastSquaresGradScheme(SS, STENCIL)                               \
+                                                                              \
+typedef LeastSquaresVectors<STENCIL> LeastSquaresVectors##STENCIL##_;         \
+defineTemplateTypeNameAndDebugWithName                                        \
+    (LeastSquaresVectors##STENCIL##_, #SS, 0);                                \
+                                                                              \
+makeLeastSquaresGradTypeScheme(SS,STENCIL,scalar)                             \
+makeLeastSquaresGradTypeScheme(SS,STENCIL,vector)
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+#   include "LeastSquaresGrad.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrads.C b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrads.C
new file mode 100644
index 0000000000000000000000000000000000000000..021e2da28ef2c0352e3a0d2f6dc8be830c57ad08
--- /dev/null
+++ b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresGrads.C
@@ -0,0 +1,57 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "LeastSquaresGrad.H"
+//#include "centredCFCCellToCellStencilObject.H"
+#include "centredCPCCellToCellStencilObject.H"
+#include "centredCECCellToCellStencilObject.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace fv
+{
+    // makeLeastSquaresGradScheme
+    // (
+    //     faceCellsLeastSquares,
+    //     centredCFCCellToCellStencilObject
+    // )
+
+    makeLeastSquaresGradScheme
+    (
+        pointCellsLeastSquares,
+        centredCPCCellToCellStencilObject
+    )
+
+    makeLeastSquaresGradScheme
+    (
+        edgeCellsLeastSquares,
+        centredCECCellToCellStencilObject
+    )
+}
+}
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.C
new file mode 100644
index 0000000000000000000000000000000000000000..ea30ffa3dbfb3d7be7d0d8d8d5c40bba52d290b5
--- /dev/null
+++ b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.C
@@ -0,0 +1,118 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "LeastSquaresVectors.H"
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+template<class Stencil>
+Foam::fv::LeastSquaresVectors<Stencil>::LeastSquaresVectors
+(
+    const fvMesh& mesh
+)
+:
+    MeshObject<fvMesh, Foam::MoveableMeshObject, LeastSquaresVectors>(mesh),
+    vectors_(mesh.nCells())
+{
+    calcLeastSquaresVectors();
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+template<class Stencil>
+Foam::fv::LeastSquaresVectors<Stencil>::~LeastSquaresVectors()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+template<class Stencil>
+void Foam::fv::LeastSquaresVectors<Stencil>::calcLeastSquaresVectors()
+{
+    if (debug)
+    {
+        Info<< "LeastSquaresVectors::calcLeastSquaresVectors() :"
+            << "Calculating least square gradient vectors"
+            << endl;
+    }
+
+    const fvMesh& mesh = this->mesh_;
+    const extendedCentredCellToCellStencil& stencil = this->stencil();
+
+    stencil.collectData(mesh.C(), vectors_);
+
+    // Create the base form of the dd-tensor
+    // including components for the "empty" directions
+    symmTensor dd0(sqr((Vector<label>::one - mesh.geometricD())/2));
+
+    forAll (vectors_, i)
+    {
+        List<vector>& lsvi = vectors_[i];
+        symmTensor dd(dd0);
+
+        // The current cell is 0 in the stencil
+        // Calculate the deltas and sum the weighted dd
+        for (label j=1; j<lsvi.size(); j++)
+        {
+            lsvi[j] = lsvi[j] - lsvi[0];
+            scalar magSqrLsvi = magSqr(lsvi[j]);
+            dd += sqr(lsvi[j])/magSqrLsvi;
+            lsvi[j] /= magSqrLsvi;
+        }
+
+        // Invert dd
+        dd = inv(dd);
+
+        // Remove the components corresponding to the empty directions
+        dd -= dd0;
+
+        // Finalize the gradient weighting vectors
+        lsvi[0] = vector::zero;
+        for (label j=1; j<lsvi.size(); j++)
+        {
+            lsvi[j] = dd & lsvi[j];
+            lsvi[0] -= lsvi[j];
+        }
+    }
+
+    if (debug)
+    {
+        Info<< "LeastSquaresVectors::calcLeastSquaresVectors() :"
+            << "Finished calculating least square gradient vectors"
+            << endl;
+    }
+}
+
+
+template<class Stencil>
+bool Foam::fv::LeastSquaresVectors<Stencil>::movePoints()
+{
+    calcLeastSquaresVectors();
+    return true;
+}
+
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.H b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.H
similarity index 56%
rename from src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.H
rename to src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.H
index 5d8113c9245ad8e7fe46a827a627f41abd5c7fe5..d454e8cb3f48022518996992c913efdf176e2bb8 100644
--- a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.H
+++ b/src/finiteVolume/finiteVolume/gradSchemes/LeastSquaresGrad/LeastSquaresVectors.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) 2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -22,100 +22,107 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
-    Foam::extendedLeastSquaresVectors
+    Foam::fv::LeastSquaresVectors
 
 Description
-    Extended molecule least-squares gradient scheme vectors
+    Least-squares gradient scheme vectors
+
+See Also
+    Foam::fv::LeastSquaresGrad
 
 SourceFiles
-    extendedLeastSquaresVectors.C
+    LeastSquaresVectors.C
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef extendedLeastSquaresVectors_H
-#define extendedLeastSquaresVectors_H
+#ifndef LeastSquaresVectors_H
+#define LeastSquaresVectors_H
 
+#include "extendedCentredCellToCellStencil.H"
 #include "MeshObject.H"
-#include "fvMesh.H"
-#include "surfaceFieldsFwd.H"
-#include "labelPair.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
 {
 
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace fv
+{
+
 /*---------------------------------------------------------------------------*\
-                     Class extendedLeastSquaresVectors Declaration
+                     Class LeastSquaresVectors Declaration
 \*---------------------------------------------------------------------------*/
 
-class extendedLeastSquaresVectors
+template<class Stencil>
+class LeastSquaresVectors
 :
-    public MeshObject<fvMesh, extendedLeastSquaresVectors>
+    public MeshObject<fvMesh, MoveableMeshObject, LeastSquaresVectors<Stencil> >
 {
     // Private data
 
-        //- Minimum determinant criterion to choose extra cells
-        scalar minDet_;
-
         //- Least-squares gradient vectors
-        mutable surfaceVectorField* pVectorsPtr_;
-        mutable surfaceVectorField* nVectorsPtr_;
-
-        mutable List<labelPair>* additionalCellsPtr_;
-        mutable vectorField* additionalVectorsPtr_;
+        List<List<vector> > vectors_;
 
 
     // Private Member Functions
 
-        //- Construct Least-squares gradient vectors
-        void makeLeastSquaresVectors() const;
+        //- Calculate Least-squares gradient vectors
+        void calcLeastSquaresVectors();
 
 
 public:
 
     // Declare name of the class and its debug switch
-    TypeName("extendedLeastSquaresVectors");
+    TypeName("LeastSquaresVectors");
 
 
     // Constructors
 
         //- Construct given an fvMesh and the minimum determinant criterion
-        extendedLeastSquaresVectors
+        LeastSquaresVectors
         (
-            const fvMesh&,
-            const scalar minDet
+            const fvMesh&
         );
 
 
     //- Destructor
-    virtual ~extendedLeastSquaresVectors();
+    virtual ~LeastSquaresVectors();
 
 
     // Member functions
 
-        //- Return reference to owner least square vectors
-        const surfaceVectorField& pVectors() const;
+        //- Return reference to the stencil
+        const extendedCentredCellToCellStencil& stencil() const
+        {
+            return Stencil::New(this->mesh_);
+        }
 
-        //- Return reference to neighbour least square vectors
-        const surfaceVectorField& nVectors() const;
+        //- Return reference to the least square vectors
+        const List<List<vector> >& vectors() const
+        {
+            return vectors_;
+        }
 
+        //- Update the least square vectors when the mesh moves
+        virtual bool movePoints();
+};
 
-        //- Return reference to additional cells
-        const List<labelPair>& additionalCells() const;
 
-        //- Return reference to additional least square vectors
-        const vectorField& additionalVectors() const;
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+} // End namespace fv
 
-        //- Delete the least square vectors when the mesh moves
-        virtual bool movePoints();
-};
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace Foam
+#ifdef NoRepository
+#   include "LeastSquaresVectors.C"
+#endif
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.H
deleted file mode 100644
index f734409d0936ce04ed4fc488bbcacad139a1667a..0000000000000000000000000000000000000000
--- a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.H
+++ /dev/null
@@ -1,136 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2012 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/>.
-
-Class
-    Foam::fv::extendedLeastSquaresGrad
-
-Description
-    Second-order gradient scheme using least-squares.
-
-SourceFiles
-    extendedLeastSquaresGrad.C
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef extendedLeastSquaresGrad_H
-#define extendedLeastSquaresGrad_H
-
-#include "gradScheme.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace fv
-{
-
-/*---------------------------------------------------------------------------*\
-                      Class extendedLeastSquaresGrad Declaration
-\*---------------------------------------------------------------------------*/
-
-template<class Type>
-class extendedLeastSquaresGrad
-:
-    public fv::gradScheme<Type>
-{
-    // Private Data
-
-        //- Minimum determinant criterion to choose extra cells
-        scalar minDet_;
-
-
-    // Private Member Functions
-
-        //- Disallow default bitwise copy construct
-        extendedLeastSquaresGrad(const extendedLeastSquaresGrad&);
-
-        //- Disallow default bitwise assignment
-        void operator=(const extendedLeastSquaresGrad&);
-
-
-public:
-
-    //- Runtime type information
-    TypeName("extendedLeastSquares");
-
-
-    // Constructors
-
-        //- Construct from Istream
-        extendedLeastSquaresGrad(const fvMesh& mesh, Istream& schemeData)
-        :
-            gradScheme<Type>(mesh),
-            minDet_(readScalar(schemeData))
-        {
-            if (minDet_ < 0)    //-for facearea weighted: || minDet_ > 8)
-            {
-                FatalIOErrorIn
-                (
-                    "extendedLeastSquaresGrad"
-                    "(const fvMesh&, Istream& schemeData)",
-                    schemeData
-                )   << "Minimum determinant = " << minDet_
-                    << " should be >= 0"    // and <= 8"
-                    << exit(FatalIOError);
-            }
-        }
-
-
-    // Member Functions
-
-        //- Return the gradient of the given field to the gradScheme::grad
-        //  for optional caching
-        virtual tmp
-        <
-            GeometricField
-            <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
-        > calcGrad
-        (
-            const GeometricField<Type, fvPatchField, volMesh>& vsf,
-            const word& name
-        ) const;
-};
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace fv
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#ifdef NoRepository
-#   include "extendedLeastSquaresGrad.C"
-#endif
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C
deleted file mode 100644
index b0ec820d69693fd970a18141181fbb72adad0d23..0000000000000000000000000000000000000000
--- a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C
+++ /dev/null
@@ -1,453 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2012 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 "extendedLeastSquaresVectors.H"
-#include "surfaceFields.H"
-#include "volFields.H"
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-namespace Foam
-{
-defineTypeNameAndDebug(extendedLeastSquaresVectors, 0);
-}
-
-
-// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
-
-Foam::extendedLeastSquaresVectors::extendedLeastSquaresVectors
-(
-    const fvMesh& mesh,
-    const scalar minDet
-)
-:
-    MeshObject<fvMesh, extendedLeastSquaresVectors>(mesh),
-    minDet_(minDet),
-    pVectorsPtr_(NULL),
-    nVectorsPtr_(NULL),
-    additionalCellsPtr_(NULL),
-    additionalVectorsPtr_(NULL)
-{}
-
-
-// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
-
-Foam::extendedLeastSquaresVectors::~extendedLeastSquaresVectors()
-{
-    deleteDemandDrivenData(pVectorsPtr_);
-    deleteDemandDrivenData(nVectorsPtr_);
-
-    deleteDemandDrivenData(additionalCellsPtr_);
-    deleteDemandDrivenData(additionalVectorsPtr_);
-}
-
-
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const
-{
-    if (debug)
-    {
-        Info<< "extendedLeastSquaresVectors::makeLeastSquaresVectors() :"
-            << "Constructing least square gradient vectors"
-            << endl;
-    }
-
-    const fvMesh& mesh = mesh_;
-
-    pVectorsPtr_ = new surfaceVectorField
-    (
-        IOobject
-        (
-            "LeastSquaresP",
-            mesh_.pointsInstance(),
-            mesh_,
-            IOobject::NO_READ,
-            IOobject::NO_WRITE,
-            false
-        ),
-        mesh_,
-        dimensionedVector("zero", dimless/dimLength, vector::zero)
-    );
-    surfaceVectorField& lsP = *pVectorsPtr_;
-
-    nVectorsPtr_ = new surfaceVectorField
-    (
-        IOobject
-        (
-            "LeastSquaresN",
-            mesh_.pointsInstance(),
-            mesh_,
-            IOobject::NO_READ,
-            IOobject::NO_WRITE,
-            false
-        ),
-        mesh_,
-        dimensionedVector("zero", dimless/dimLength, vector::zero)
-    );
-    surfaceVectorField& lsN = *nVectorsPtr_;
-
-    // Set local references to mesh data
-    const labelUList& owner = mesh_.owner();
-    const labelUList& neighbour = mesh_.neighbour();
-
-
-    // Determine number of dimensions and (for 2D) missing dimension
-    label nDims = 0;
-    label twoD = -1;
-    for (direction dir = 0; dir < vector::nComponents; dir++)
-    {
-        if (mesh.geometricD()[dir] == 1)
-        {
-            nDims++;
-        }
-        else
-        {
-            twoD = dir;
-        }
-    }
-
-    if (nDims == 1)
-    {
-        FatalErrorIn
-        (
-            "extendedLeastSquaresVectors::makeLeastSquaresVectors() const"
-        )   << "Found a mesh with only one geometric dimension : "
-            << mesh.geometricD()
-            << exit(FatalError);
-    }
-    else if (nDims == 2)
-    {
-        Info<< "extendedLeastSquares : detected " << nDims
-            << " valid directions. Missing direction " << twoD << endl;
-    }
-
-
-    const volVectorField& C = mesh.C();
-
-    // Set up temporary storage for the dd tensor (before inversion)
-    symmTensorField dd(mesh_.nCells(), symmTensor::zero);
-
-    forAll(owner, facei)
-    {
-        label own = owner[facei];
-        label nei = neighbour[facei];
-
-        vector d = C[nei] - C[own];
-
-        const symmTensor wdd(1.0/magSqr(d)*sqr(d));
-
-        dd[own] += wdd;
-        dd[nei] += wdd;
-    }
-
-    // Visit the boundaries. Coupled boundaries are taken into account
-    // in the construction of d vectors.
-    surfaceVectorField::GeometricBoundaryField& blsP = lsP.boundaryField();
-
-    forAll(blsP, patchi)
-    {
-        const fvPatch& p = blsP[patchi].patch();
-        const labelUList& faceCells = p.faceCells();
-
-        // Build the d-vectors
-        vectorField pd(p.delta());
-
-        forAll(pd, patchFaceI)
-        {
-            dd[faceCells[patchFaceI]] +=
-                (1.0/magSqr(pd[patchFaceI]))*sqr(pd[patchFaceI]);
-        }
-    }
-
-
-    // Check for missing dimensions
-    // Add the missing eigenvector (such that it does not
-    // affect the determinant)
-    if (nDims == 2)
-    {
-        forAll(dd, cellI)
-        {
-            if (twoD == 0)
-            {
-                dd[cellI].xx() = 1;
-            }
-            else if (twoD == 1)
-            {
-                dd[cellI].yy() = 1;
-            }
-            else
-            {
-                dd[cellI].zz() = 1;
-            }
-        }
-    }
-    scalarField detdd(det(dd));
-
-    Info<< "max(detdd) = " << max(detdd) << nl
-        << "min(detdd) = " << min(detdd) << nl
-        << "average(detdd) = " << average(detdd) << endl;
-
-    label nAdaptedCells = 0;
-    label nAddCells = 0;
-    label maxNaddCells = 4*detdd.size();
-    additionalCellsPtr_ = new List<labelPair>(maxNaddCells);
-    List<labelPair>& additionalCells_ = *additionalCellsPtr_;
-
-    forAll(detdd, i)
-    {
-        label count = 0;
-
-        label oldNAddCells = nAddCells;
-
-        while (++count < 100 && detdd[i] < minDet_)
-        {
-            if (nAddCells == maxNaddCells)
-            {
-                FatalErrorIn
-                (
-                    "extendedLeastSquaresVectors::"
-                    "makeLeastSquaresVectors() const"
-                )   << "nAddCells exceeds maxNaddCells ("
-                    << maxNaddCells << ")"
-                    << exit(FatalError);
-            }
-
-            labelList pointLabels = mesh.cells()[i].labels(mesh.faces());
-
-            scalar maxDetddij = 0.0;
-
-            label addCell = -1;
-
-            forAll(pointLabels, j)
-            {
-                forAll(mesh.pointCells()[pointLabels[j]], k)
-                {
-                    label cellj = mesh.pointCells()[pointLabels[j]][k];
-
-                    if (cellj != i)
-                    {
-                        vector dCij = (mesh.C()[cellj] - mesh.C()[i]);
-
-                        symmTensor ddij =
-                            dd[i] + (1.0/magSqr(dCij))*sqr(dCij);
-
-                        // Add the missing eigenvector (such that it does not
-                        // affect the determinant)
-                        if (nDims == 2)
-                        {
-                            if (twoD == 0)
-                            {
-                                ddij.xx() = 1;
-                            }
-                            else if (twoD == 1)
-                            {
-                                ddij.yy() = 1;
-                            }
-                            else
-                            {
-                                ddij.zz() = 1;
-                            }
-                        }
-
-                        scalar detddij = det(ddij);
-
-                        if (detddij > maxDetddij)
-                        {
-                            addCell = cellj;
-                            maxDetddij = detddij;
-                        }
-                    }
-                }
-            }
-
-            if (addCell != -1)
-            {
-                additionalCells_[nAddCells][0] = i;
-                additionalCells_[nAddCells++][1] = addCell;
-                vector dCij = mesh.C()[addCell] - mesh.C()[i];
-                dd[i] += (1.0/magSqr(dCij))*sqr(dCij);
-
-                // Add the missing eigenvector (such that it does not
-                // affect the determinant)
-                if (nDims == 2)
-                {
-                    if (twoD == 0)
-                    {
-                        dd[i].xx() = 1;
-                    }
-                    else if (twoD == 1)
-                    {
-                        dd[i].yy() = 1;
-                    }
-                    else
-                    {
-                        dd[i].zz() = 1;
-                    }
-                }
-
-                detdd[i] = det(dd[i]);
-            }
-        }
-
-        if (oldNAddCells < nAddCells)
-        {
-            nAdaptedCells++;
-        }
-    }
-
-    additionalCells_.setSize(nAddCells);
-
-    reduce(nAddCells, sumOp<label>());
-    reduce(nAdaptedCells, sumOp<label>());
-    if (nAddCells)
-    {
-        Info<< "max(detdd) = " << max(detdd) << nl
-            << "min(detdd) = " << min(detdd) << nl
-            << "average(detdd) = " << average(detdd) << nl
-            << "nAdapted/nCells = "
-            << scalar(nAdaptedCells)/mesh.globalData().nTotalCells() << nl
-            << "nAddCells/nCells = "
-            << scalar(nAddCells)/mesh.globalData().nTotalCells()
-            << endl;
-    }
-
-    // Invert the dd tensor
-    const symmTensorField invDd(inv(dd));
-
-
-    // Revisit all faces and calculate the lsP and lsN vectors
-    forAll(owner, facei)
-    {
-        label own = owner[facei];
-        label nei = neighbour[facei];
-
-        vector d = C[nei] - C[own];
-
-        lsP[facei] = (1.0/magSqr(d))*(invDd[own] & d);
-        lsN[facei] = ((-1.0)/magSqr(d))*(invDd[nei] & d);
-    }
-
-    forAll(blsP, patchI)
-    {
-        fvsPatchVectorField& patchLsP = blsP[patchI];
-
-        const fvPatch& p = patchLsP.patch();
-        const labelUList& faceCells = p.faceCells();
-
-        // Build the d-vectors
-        vectorField pd(p.delta());
-
-        forAll(p, patchFaceI)
-        {
-            patchLsP[patchFaceI] =
-                (1.0/magSqr(pd[patchFaceI]))
-               *(invDd[faceCells[patchFaceI]] & pd[patchFaceI]);
-        }
-    }
-
-
-    additionalVectorsPtr_ = new vectorField(additionalCells_.size());
-    vectorField& additionalVectors_ = *additionalVectorsPtr_;
-
-    forAll(additionalCells_, i)
-    {
-        vector dCij =
-            mesh.C()[additionalCells_[i][1]] - mesh.C()[additionalCells_[i][0]];
-
-        additionalVectors_[i] =
-            (1.0/magSqr(dCij))*(invDd[additionalCells_[i][0]] & dCij);
-    }
-
-    if (debug)
-    {
-        Info<< "extendedLeastSquaresVectors::makeLeastSquaresVectors() :"
-            << "Finished constructing least square gradient vectors"
-            << endl;
-    }
-}
-
-
-const Foam::surfaceVectorField&
-Foam::extendedLeastSquaresVectors::pVectors() const
-{
-    if (!pVectorsPtr_)
-    {
-        makeLeastSquaresVectors();
-    }
-
-    return *pVectorsPtr_;
-}
-
-
-const Foam::surfaceVectorField&
-Foam::extendedLeastSquaresVectors::nVectors() const
-{
-    if (!nVectorsPtr_)
-    {
-        makeLeastSquaresVectors();
-    }
-
-    return *nVectorsPtr_;
-}
-
-
-const Foam::List<Foam::labelPair>&
-Foam::extendedLeastSquaresVectors::additionalCells() const
-{
-    if (!additionalCellsPtr_)
-    {
-        makeLeastSquaresVectors();
-    }
-
-    return *additionalCellsPtr_;
-}
-
-
-const Foam::vectorField&
-Foam::extendedLeastSquaresVectors::additionalVectors() const
-{
-    if (!additionalVectorsPtr_)
-    {
-        makeLeastSquaresVectors();
-    }
-
-    return *additionalVectorsPtr_;
-}
-
-
-bool Foam::extendedLeastSquaresVectors::movePoints()
-{
-    deleteDemandDrivenData(pVectorsPtr_);
-    deleteDemandDrivenData(nVectorsPtr_);
-
-    deleteDemandDrivenData(additionalCellsPtr_);
-    deleteDemandDrivenData(additionalVectorsPtr_);
-
-    return true;
-}
-
-
-// ************************************************************************* //
diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C
index 95db626d720fef9a9b4409e2d4d0d88f7fdb8d44..48c4c8a25699edfc099d43cb14221925f6221d35 100644
--- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C
+++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.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
@@ -24,14 +24,13 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "leastSquaresVectors.H"
-#include "surfaceFields.H"
 #include "volFields.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 namespace Foam
 {
-defineTypeNameAndDebug(leastSquaresVectors, 0);
+    defineTypeNameAndDebug(leastSquaresVectors, 0);
 }
 
 
@@ -39,35 +38,8 @@ defineTypeNameAndDebug(leastSquaresVectors, 0);
 
 Foam::leastSquaresVectors::leastSquaresVectors(const fvMesh& mesh)
 :
-    MeshObject<fvMesh, leastSquaresVectors>(mesh),
-    pVectorsPtr_(NULL),
-    nVectorsPtr_(NULL)
-{}
-
-
-// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
-
-Foam::leastSquaresVectors::~leastSquaresVectors()
-{
-    deleteDemandDrivenData(pVectorsPtr_);
-    deleteDemandDrivenData(nVectorsPtr_);
-}
-
-
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
-{
-    if (debug)
-    {
-        Info<< "leastSquaresVectors::makeLeastSquaresVectors() :"
-            << "Constructing least square gradient vectors"
-            << endl;
-    }
-
-    const fvMesh& mesh = mesh_;
-
-    pVectorsPtr_ = new surfaceVectorField
+    MeshObject<fvMesh, Foam::MoveableMeshObject, leastSquaresVectors>(mesh),
+    pVectors_
     (
         IOobject
         (
@@ -80,10 +52,8 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
         ),
         mesh_,
         dimensionedVector("zero", dimless/dimLength, vector::zero)
-    );
-    surfaceVectorField& lsP = *pVectorsPtr_;
-
-    nVectorsPtr_ = new surfaceVectorField
+    ),
+    nVectors_
     (
         IOobject
         (
@@ -96,8 +66,30 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
         ),
         mesh_,
         dimensionedVector("zero", dimless/dimLength, vector::zero)
-    );
-    surfaceVectorField& lsN = *nVectorsPtr_;
+    )
+{
+    calcLeastSquaresVectors();
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+Foam::leastSquaresVectors::~leastSquaresVectors()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::leastSquaresVectors::calcLeastSquaresVectors()
+{
+    if (debug)
+    {
+        Info<< "leastSquaresVectors::calcLeastSquaresVectors() :"
+            << "Calculating least square gradient vectors"
+            << endl;
+    }
+
+    const fvMesh& mesh = mesh_;
 
     // Set local references to mesh data
     const labelUList& owner = mesh_.owner();
@@ -124,7 +116,8 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
     }
 
 
-    surfaceVectorField::GeometricBoundaryField& blsP = lsP.boundaryField();
+    surfaceVectorField::GeometricBoundaryField& blsP =
+        pVectors_.boundaryField();
 
     forAll(blsP, patchi)
     {
@@ -164,7 +157,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
     const symmTensorField invDd(inv(dd));
 
 
-    // Revisit all faces and calculate the lsP and lsN vectors
+    // Revisit all faces and calculate the pVectors_ and nVectors_ vectors
     forAll(owner, facei)
     {
         label own = owner[facei];
@@ -173,8 +166,8 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
         vector d = C[nei] - C[own];
         scalar magSfByMagSqrd = magSf[facei]/magSqr(d);
 
-        lsP[facei] = (1 - w[facei])*magSfByMagSqrd*(invDd[own] & d);
-        lsN[facei] = -w[facei]*magSfByMagSqrd*(invDd[nei] & d);
+        pVectors_[facei] = (1 - w[facei])*magSfByMagSqrd*(invDd[own] & d);
+        nVectors_[facei] = -w[facei]*magSfByMagSqrd*(invDd[nei] & d);
     }
 
     forAll(blsP, patchi)
@@ -214,127 +207,18 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
         }
     }
 
-
-    // For 3D meshes check the determinant of the dd tensor and switch to
-    // Gauss if it is less than 3
-    /* Currently the det(dd[celli]) criterion is incorrect: dd is weighted by Sf
-    if (mesh.nGeometricD() == 3)
-    {
-        label nBadCells = 0;
-
-        const cellList& cells = mesh.cells();
-        const scalarField& V = mesh.V();
-        const surfaceVectorField& Sf = mesh.Sf();
-        const surfaceScalarField& w = mesh.weights();
-
-        forAll(dd, celli)
-        {
-            if (det(dd[celli]) < 3)
-            {
-                nBadCells++;
-
-                const cell& c = cells[celli];
-
-                forAll(c, cellFacei)
-                {
-                    label facei = c[cellFacei];
-
-                    if (mesh.isInternalFace(facei))
-                    {
-                        scalar wf = max(min(w[facei], 0.8), 0.2);
-
-                        if (celli == owner[facei])
-                        {
-                            lsP[facei] = (1 - wf)*Sf[facei]/V[celli];
-                        }
-                        else
-                        {
-                            lsN[facei] = -wf*Sf[facei]/V[celli];
-                        }
-                    }
-                    else
-                    {
-                        label patchi = mesh.boundaryMesh().whichPatch(facei);
-
-                        if (mesh.boundary()[patchi].size())
-                        {
-                            label patchFacei =
-                                facei - mesh.boundaryMesh()[patchi].start();
-
-                            if (w.boundaryField()[patchi].coupled())
-                            {
-                                scalar wf = max
-                                (
-                                    min
-                                    (
-                                        w.boundaryField()[patchi][patchFacei],
-                                        0.8
-                                    ),
-                                    0.2
-                                );
-
-                                lsP.boundaryField()[patchi][patchFacei] =
-                                    (1 - wf)
-                                   *Sf.boundaryField()[patchi][patchFacei]
-                                   /V[celli];
-                            }
-                            else
-                            {
-                                lsP.boundaryField()[patchi][patchFacei] =
-                                    Sf.boundaryField()[patchi][patchFacei]
-                                   /V[celli];
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        if (debug)
-        {
-            InfoIn("leastSquaresVectors::makeLeastSquaresVectors()")
-                << "number of bad cells switched to Gauss = " << nBadCells
-                << endl;
-        }
-    }
-    */
-
     if (debug)
     {
-        Info<< "leastSquaresVectors::makeLeastSquaresVectors() :"
-            << "Finished constructing least square gradient vectors"
+        Info<< "leastSquaresVectors::calcLeastSquaresVectors() :"
+            << "Finished calculating least square gradient vectors"
             << endl;
     }
 }
 
 
-const Foam::surfaceVectorField& Foam::leastSquaresVectors::pVectors() const
-{
-    if (!pVectorsPtr_)
-    {
-        makeLeastSquaresVectors();
-    }
-
-    return *pVectorsPtr_;
-}
-
-
-const Foam::surfaceVectorField& Foam::leastSquaresVectors::nVectors() const
-{
-    if (!nVectorsPtr_)
-    {
-        makeLeastSquaresVectors();
-    }
-
-    return *nVectorsPtr_;
-}
-
-
 bool Foam::leastSquaresVectors::movePoints()
 {
-    deleteDemandDrivenData(pVectorsPtr_);
-    deleteDemandDrivenData(nVectorsPtr_);
-
+    calcLeastSquaresVectors();
     return true;
 }
 
diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.H b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.H
index e2454efa6dbfa93db98c99047635ebf5dadabf27..d603759e9e8291995c83c9ac44706a8c1efe1700 100644
--- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.H
+++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -37,8 +37,7 @@ SourceFiles
 
 #include "MeshObject.H"
 #include "fvMesh.H"
-#include "surfaceFieldsFwd.H"
-#include "labelPair.H"
+#include "surfaceFields.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -51,19 +50,19 @@ namespace Foam
 
 class leastSquaresVectors
 :
-    public MeshObject<fvMesh, leastSquaresVectors>
+    public MeshObject<fvMesh, MoveableMeshObject, leastSquaresVectors>
 {
     // Private data
 
         //- Least-squares gradient vectors
-        mutable surfaceVectorField* pVectorsPtr_;
-        mutable surfaceVectorField* nVectorsPtr_;
+        surfaceVectorField pVectors_;
+        surfaceVectorField nVectors_;
 
 
     // Private Member Functions
 
         //- Construct Least-squares gradient vectors
-        void makeLeastSquaresVectors() const;
+        void calcLeastSquaresVectors();
 
 
 public:
@@ -85,11 +84,16 @@ public:
     // Member functions
 
         //- Return reference to owner least square vectors
-        const surfaceVectorField& pVectors() const;
+        const surfaceVectorField& pVectors() const
+        {
+            return pVectors_;
+        }
 
         //- Return reference to neighbour least square vectors
-        const surfaceVectorField& nVectors() const;
-
+        const surfaceVectorField& nVectors() const
+        {
+            return nVectors_;
+        }
 
         //- Delete the least square vectors when the mesh moves
         virtual bool movePoints();
diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C
index dd9f68ec669c161758b2a0ef0c49a0f9c16a9702..0da6e26eb339defd30b7482f816e57e0c2383684 100644
--- a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C
+++ b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.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
@@ -65,12 +65,23 @@ gaussLaplacianScheme<Type, GType>::fvmLaplacianUncorrected
 
     forAll(vf.boundaryField(), patchi)
     {
-        const fvPatchField<Type>& psf = vf.boundaryField()[patchi];
-        const fvsPatchScalarField& patchGamma =
-            gammaMagSf.boundaryField()[patchi];
-
-        fvm.internalCoeffs()[patchi] = patchGamma*psf.gradientInternalCoeffs();
-        fvm.boundaryCoeffs()[patchi] = -patchGamma*psf.gradientBoundaryCoeffs();
+        const fvPatchField<Type>& pvf = vf.boundaryField()[patchi];
+        const fvsPatchScalarField& pGamma = gammaMagSf.boundaryField()[patchi];
+        const fvsPatchScalarField& pDeltaCoeffs =
+            deltaCoeffs.boundaryField()[patchi];
+
+        if (pvf.coupled())
+        {
+            fvm.internalCoeffs()[patchi] =
+                pGamma*pvf.gradientInternalCoeffs(pDeltaCoeffs);
+            fvm.boundaryCoeffs()[patchi] =
+               -pGamma*pvf.gradientBoundaryCoeffs(pDeltaCoeffs);
+        }
+        else
+        {
+            fvm.internalCoeffs()[patchi] = pGamma*pvf.gradientInternalCoeffs();
+            fvm.boundaryCoeffs()[patchi] = -pGamma*pvf.gradientBoundaryCoeffs();
+        }
     }
 
     return tfvm;
diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C
index a88ca9dad7cc3b0e502b45ae268d60524314dd06..2f8ef75d9c4a5c553ae26ab1d4d8908c5549ef1e 100644
--- a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C
+++ b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.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
@@ -144,7 +144,17 @@ snGradScheme<Type>::snGrad
 
     forAll(vf.boundaryField(), patchi)
     {
-        ssf.boundaryField()[patchi] = vf.boundaryField()[patchi].snGrad();
+        const fvPatchField<Type>& pvf = vf.boundaryField()[patchi];
+
+        if (pvf.coupled())
+        {
+            ssf.boundaryField()[patchi] =
+                pvf.snGrad(tdeltaCoeffs().boundaryField()[patchi]);
+        }
+        else
+        {
+            ssf.boundaryField()[patchi] = pvf.snGrad();
+        }
     }
 
     return tsf;
diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C
index c9dd621d3e2dc711a3daa7aa85611fd90b01faec..d45cc25f2981635ba95b50ba0a862a9c21636bdd 100644
--- a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C
+++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.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
@@ -601,12 +601,13 @@ void Foam::MULES::limiter
         {
             fvsPatchScalarField& lambdaPf = lambdaBf[patchi];
             const scalarField& phiCorrfPf = phiCorrBf[patchi];
+            const fvPatchScalarField& psiPf = psiBf[patchi];
 
             if (isA<wedgeFvPatch>(mesh.boundary()[patchi]))
             {
                 lambdaPf = 0;
             }
-            else
+            else if (psiPf.coupled())
             {
                 const labelList& pFaceCells =
                     mesh.boundary()[patchi].faceCells();
@@ -627,6 +628,32 @@ void Foam::MULES::limiter
                     }
                 }
             }
+            else
+            {
+                const labelList& pFaceCells =
+                    mesh.boundary()[patchi].faceCells();
+                const scalarField& phiBDPf = phiBDBf[patchi];
+
+                forAll(lambdaPf, pFacei)
+                {
+                    // Limit outlet faces only
+                    if (phiBDPf[pFacei] > 0)
+                    {
+                        label pfCelli = pFaceCells[pFacei];
+
+                        if (phiCorrfPf[pFacei] > 0.0)
+                        {
+                            lambdaPf[pFacei] =
+                                min(lambdaPf[pFacei], lambdap[pfCelli]);
+                        }
+                        else
+                        {
+                            lambdaPf[pFacei] =
+                                min(lambdaPf[pFacei], lambdam[pfCelli]);
+                        }
+                    }
+                }
+            }
         }
 
         syncTools::syncFaceList(mesh, allLambda, minEqOp<scalar>());
diff --git a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrads.C b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCECCellToCellStencilObject.C
similarity index 82%
rename from src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrads.C
rename to src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCECCellToCellStencilObject.C
index a9364b5a0c7a24d83c8be4a851b9d03969d9ced1..f6e7ee46e1f960198c147bc27332b930b4987e3f 100644
--- a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrads.C
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCECCellToCellStencilObject.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) 2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -23,17 +23,15 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "fvMesh.H"
-#include "extendedLeastSquaresGrad.H"
+#include "centredCECCellToCellStencilObject.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 namespace Foam
 {
-namespace fv
-{
-    makeFvGradScheme(extendedLeastSquaresGrad)
-}
+    defineTypeNameAndDebug(centredCECCellToCellStencilObject, 0);
 }
 
+
 // ************************************************************************* //
diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/linear/linear.H b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCECCellToCellStencilObject.H
similarity index 61%
rename from applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/linear/linear.H
rename to src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCECCellToCellStencilObject.H
index d357bb3ec08884a45571588abb6353907bcc49c5..7c95877769d8f4c18d2be5b61055043ba774e6ec 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/linear/linear.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCECCellToCellStencilObject.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -22,84 +22,71 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
-    Foam::phaseEquationsOfState::linear
+    Foam::centredCECCellToCellStencilObject
 
 Description
-    Linear phase density model.
 
 SourceFiles
-    linear.C
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef linear_H
-#define linear_H
+#ifndef centredCECCellToCellStencilObject_H
+#define centredCECCellToCellStencilObject_H
 
-#include "phaseEquationOfState.H"
-#include "dimensionedTypes.H"
+#include "extendedCentredCellToCellStencil.H"
+#include "CECCellToCellStencil.H"
+#include "MeshObject.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
 {
-namespace phaseEquationsOfState
-{
 
 /*---------------------------------------------------------------------------*\
-                           Class linear Declaration
+              Class centredCECCellToCellStencilObject Declaration
 \*---------------------------------------------------------------------------*/
 
-class linear
+class centredCECCellToCellStencilObject
 :
-    public phaseEquationOfState
+    public MeshObject
+    <
+        fvMesh,
+        TopologicalMeshObject,
+        centredCECCellToCellStencilObject
+    >,
+    public extendedCentredCellToCellStencil
 {
-    // Private data
-
-        //- The reference density of the phase
-        dimensionedScalar rho0_;
-
-        //- The constant compressibility of the phase
-        dimensionedScalar psi_;
-
 
 public:
 
-    //- Runtime type information
-    TypeName("linear");
-
+    TypeName("centredCECCellToCellStencil");
 
     // Constructors
 
-        //- Construct from components
-        linear
+        //- Construct from uncompacted cell stencil
+        explicit centredCECCellToCellStencilObject
         (
-            const dictionary& dict
-        );
+            const fvMesh& mesh
+        )
+        :
+            MeshObject
+            <
+                fvMesh,
+                Foam::TopologicalMeshObject,
+                centredCECCellToCellStencilObject
+            >(mesh),
+            extendedCentredCellToCellStencil(CECCellToCellStencil(mesh))
+        {}
 
 
     //- Destructor
-    virtual ~linear();
-
-
-    // Member Functions
-
-        tmp<volScalarField> rho
-        (
-            const volScalarField& p,
-            const volScalarField& T
-        ) const;
-
-        tmp<volScalarField> psi
-        (
-            const volScalarField& p,
-            const volScalarField& T
-        ) const;
+    virtual ~centredCECCellToCellStencilObject()
+    {}
 };
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace phaseEquationsOfState
 } // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCFCCellToCellStencilObject.C b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCFCCellToCellStencilObject.C
new file mode 100644
index 0000000000000000000000000000000000000000..422e10de1993dc5cad95ce750ced602974161cb7
--- /dev/null
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCFCCellToCellStencilObject.C
@@ -0,0 +1,37 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "centredCFCCellToCellStencilObject.H"
+
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(centredCFCCellToCellStencilObject, 0);
+}
+
+
+// ************************************************************************* //
diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/constant/constant.H b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCFCCellToCellStencilObject.H
similarity index 61%
rename from applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/constant/constant.H
rename to src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCFCCellToCellStencilObject.H
index 5cfe44c26e4546d5f6f19803fdaf63dd98eb5cc6..c3dbb3bf2750554d0de09e096a631c427ed2321e 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/constant/constant.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCFCCellToCellStencilObject.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -22,81 +22,71 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
-    Foam::phaseEquationsOfState::constant
+    Foam::centredCFCCellToCellStencilObject
 
 Description
-    Constant phase density model.
 
 SourceFiles
-    constant.C
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef constant_H
-#define constant_H
+#ifndef centredCFCCellToCellStencilObject_H
+#define centredCFCCellToCellStencilObject_H
 
-#include "phaseEquationOfState.H"
-#include "dimensionedTypes.H"
+#include "extendedCentredCellToCellStencil.H"
+#include "CFCCellToCellStencil.H"
+#include "MeshObject.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
 {
-namespace phaseEquationsOfState
-{
 
 /*---------------------------------------------------------------------------*\
-                           Class constant Declaration
+              Class centredCFCCellToCellStencilObject Declaration
 \*---------------------------------------------------------------------------*/
 
-class constant
+class centredCFCCellToCellStencilObject
 :
-    public phaseEquationOfState
+    public MeshObject
+    <
+        fvMesh,
+        TopologicalMeshObject,
+        centredCFCCellToCellStencilObject
+    >,
+    public extendedCentredCellToCellStencil
 {
-    // Private data
-
-        //- The constant density of the phase
-        dimensionedScalar rho_;
-
 
 public:
 
-    //- Runtime type information
-    TypeName("constant");
-
+    TypeName("centredCFCCellToCellStencil");
 
     // Constructors
 
-        //- Construct from components
-        constant
+        //- Construct from uncompacted cell stencil
+        explicit centredCFCCellToCellStencilObject
         (
-            const dictionary& dict
-        );
+            const fvMesh& mesh
+        )
+        :
+            MeshObject
+            <
+                fvMesh,
+                Foam::TopologicalMeshObject,
+                centredCFCCellToCellStencilObject
+            >(mesh),
+            extendedCentredCellToCellStencil(CFCCellToCellStencil(mesh))
+        {}
 
 
     //- Destructor
-    virtual ~constant();
-
-
-    // Member Functions
-
-        tmp<volScalarField> rho
-        (
-            const volScalarField& p,
-            const volScalarField& T
-        ) const;
-
-        tmp<volScalarField> psi
-        (
-            const volScalarField& p,
-            const volScalarField& T
-        ) const;
+    virtual ~centredCFCCellToCellStencilObject()
+    {}
 };
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace phaseEquationsOfState
 } // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCPCCellToCellStencilObject.C b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCPCCellToCellStencilObject.C
new file mode 100644
index 0000000000000000000000000000000000000000..7a3146c6648dfa052bd69de678de6698599dc1ce
--- /dev/null
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCPCCellToCellStencilObject.C
@@ -0,0 +1,37 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "centredCPCCellToCellStencilObject.H"
+
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(centredCPCCellToCellStencilObject, 0);
+}
+
+
+// ************************************************************************* //
diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/perfectFluid/perfectFluid.H b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCPCCellToCellStencilObject.H
similarity index 60%
rename from applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/perfectFluid/perfectFluid.H
rename to src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCPCCellToCellStencilObject.H
index b854f1d84fb6b7ed6a2d7c1ae399f7fa1c9eeaef..c436844e7bcd7f4b63d9a04c346021ec811422e6 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/perfectFluid/perfectFluid.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/MeshObjects/centredCPCCellToCellStencilObject.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -22,84 +22,71 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
-    Foam::phaseEquationsOfState::perfectFluid
+    Foam::centredCPCCellToCellStencilObject
 
 Description
-    PerfectFluid phase density model.
 
 SourceFiles
-    perfectFluid.C
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef perfectFluid_H
-#define perfectFluid_H
+#ifndef centredCPCCellToCellStencilObject_H
+#define centredCPCCellToCellStencilObject_H
 
-#include "phaseEquationOfState.H"
-#include "dimensionedTypes.H"
+#include "extendedCentredCellToCellStencil.H"
+#include "CPCCellToCellStencil.H"
+#include "MeshObject.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
 {
-namespace phaseEquationsOfState
-{
 
 /*---------------------------------------------------------------------------*\
-                           Class perfectFluid Declaration
+              Class centredCPCCellToCellStencilObject Declaration
 \*---------------------------------------------------------------------------*/
 
-class perfectFluid
+class centredCPCCellToCellStencilObject
 :
-    public phaseEquationOfState
+    public MeshObject
+    <
+        fvMesh,
+        TopologicalMeshObject,
+        centredCPCCellToCellStencilObject
+    >,
+    public extendedCentredCellToCellStencil
 {
-    // Private data
-
-        //- The reference density of the phase
-        dimensionedScalar rho0_;
-
-        //- The fluid constant of the phase
-        dimensionedScalar R_;
-
 
 public:
 
-    //- Runtime type information
-    TypeName("perfectFluid");
-
+    TypeName("centredCPCCellToCellStencil");
 
     // Constructors
 
-        //- Construct from components
-        perfectFluid
+        //- Construct from uncompacted cell stencil
+        explicit centredCPCCellToCellStencilObject
         (
-            const dictionary& dict
-        );
+            const fvMesh& mesh
+        )
+        :
+            MeshObject
+            <
+                fvMesh,
+                Foam::TopologicalMeshObject,
+                centredCPCCellToCellStencilObject
+            >(mesh),
+            extendedCentredCellToCellStencil(CPCCellToCellStencil(mesh))
+        {}
 
 
     //- Destructor
-    virtual ~perfectFluid();
-
-
-    // Member Functions
-
-        tmp<volScalarField> rho
-        (
-            const volScalarField& p,
-            const volScalarField& T
-        ) const;
-
-        tmp<volScalarField> psi
-        (
-            const volScalarField& p,
-            const volScalarField& T
-        ) const;
+    virtual ~centredCPCCellToCellStencilObject()
+    {}
 };
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace phaseEquationsOfState
 } // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/newPhaseEquationOfState.C b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCellToCellStencil.C
similarity index 54%
rename from applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/newPhaseEquationOfState.C
rename to src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCellToCellStencil.C
index 3d9a842a9f31e171e5901c3ac5322f7d4bf1372a..4852332c32054e69c5f4b5fbb2442a1247c44560 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/phaseEquationOfState/newPhaseEquationOfState.C
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCellToCellStencil.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -23,37 +23,36 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "phaseEquationOfState.H"
+#include "extendedCellToCellStencil.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::autoPtr<Foam::phaseEquationOfState> Foam::phaseEquationOfState::New
-(
-    const dictionary& dict
-)
+Foam::extendedCellToCellStencil::extendedCellToCellStencil(const polyMesh& mesh)
+:
+    mesh_(mesh)
 {
-    word phaseEquationOfStateType
-    (
-        dict.subDict("equationOfState").lookup("type")
-    );
+    // Check for transformation - not supported.
+    const polyBoundaryMesh& patches = mesh.boundaryMesh();
 
-    Info<< "Selecting phaseEquationOfState "
-        << phaseEquationOfStateType << endl;
-
-    dictionaryConstructorTable::iterator cstrIter =
-        dictionaryConstructorTablePtr_->find(phaseEquationOfStateType);
-
-    if (cstrIter == dictionaryConstructorTablePtr_->end())
+    forAll(patches, patchI)
     {
-        FatalErrorIn("phaseEquationOfState::New")
-           << "Unknown phaseEquationOfStateType type "
-           << phaseEquationOfStateType << endl << endl
-           << "Valid phaseEquationOfState types are : " << endl
-           << dictionaryConstructorTablePtr_->sortedToc()
-           << exit(FatalError);
+        if (patches[patchI].coupled())
+        {
+            const coupledPolyPatch& cpp =
+                refCast<const coupledPolyPatch>(patches[patchI]);
+
+            if (!cpp.parallel() || cpp.separated())
+            {
+                FatalErrorIn
+                (
+                    "extendedCellToCellStencil::extendedCellToCellStencil"
+                    "(const polyMesh&)"
+                )   << "Coupled patches with transformations not supported."
+                    << endl
+                    << "Problematic patch " << cpp.name() << exit(FatalError);
+            }
+        }
     }
-
-    return cstrIter()(dict.subDict("equationOfState"));
 }
 
 
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCellToCellStencil.H b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCellToCellStencil.H
new file mode 100644
index 0000000000000000000000000000000000000000..dee4ee411c34960aa2d7c04ef24ba07651d833de
--- /dev/null
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCellToCellStencil.H
@@ -0,0 +1,106 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+Class
+    Foam::extendedCellToCellStencil
+
+Description
+    Baseclass for cell-to-cell stencils
+
+SourceFiles
+    extendedCellToCellStencil.C
+    extendedCellToCellStencilTemplates.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef extendedCellToCellStencil_H
+#define extendedCellToCellStencil_H
+
+#include "mapDistribute.H"
+#include "volFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+class globalIndex;
+
+/*---------------------------------------------------------------------------*\
+                  Class extendedCellToCellStencil Declaration
+\*---------------------------------------------------------------------------*/
+
+class extendedCellToCellStencil
+{
+protected:
+
+    // Protected data
+
+        const polyMesh& mesh_;
+
+public:
+
+    // Constructors
+
+        //- Construct from mesh
+        explicit extendedCellToCellStencil(const polyMesh&);
+
+
+    // Member Functions
+
+        //- Sum surface field contributions to create cell values
+        template<class Type, class WeightType>
+        static
+        tmp
+        <
+            GeometricField
+            <
+                typename outerProduct<WeightType, Type>::type,
+                fvPatchField,
+                volMesh
+            >
+        > weightedSum
+        (
+            const mapDistribute& map,
+            const labelListList& stencil,
+            const GeometricField<Type, fvPatchField, volMesh>& fld,
+            const List<List<WeightType> >& stencilWeights
+        );
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+#   include "extendedCellToCellStencilTemplates.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCellToCellStencilTemplates.C b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCellToCellStencilTemplates.C
new file mode 100644
index 0000000000000000000000000000000000000000..2a066403702c8ad32e8535641e41ac5830c6ef46
--- /dev/null
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCellToCellStencilTemplates.C
@@ -0,0 +1,96 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "extendedCellToCellStencil.H"
+#include "extendedCellToFaceStencil.H"
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+template<class Type, class WeightType>
+Foam::tmp
+<
+    Foam::GeometricField
+    <
+        typename Foam::outerProduct<WeightType, Type>::type,
+        Foam::fvPatchField,
+        Foam::volMesh
+    >
+> Foam::extendedCellToCellStencil::weightedSum
+(
+    const mapDistribute& map,
+    const labelListList& stencil,
+    const GeometricField<Type, fvPatchField, volMesh>& fld,
+    const List<List<WeightType> >& stencilWeights
+)
+{
+    typedef typename outerProduct<WeightType, Type>::type WeightedType;
+    typedef GeometricField<WeightedType, fvPatchField, volMesh>
+        WeightedFieldType;
+
+    const fvMesh& mesh = fld.mesh();
+
+    // Collect internal and boundary values
+    List<List<Type> > stencilFld;
+    extendedCellToFaceStencil::collectData(map, stencil, fld, stencilFld);
+
+    tmp<WeightedFieldType> twf
+    (
+        new WeightedFieldType
+        (
+            IOobject
+            (
+                fld.name(),
+                mesh.time().timeName(),
+                mesh
+            ),
+            mesh,
+            dimensioned<WeightedType>
+            (
+                fld.name(),
+                fld.dimensions(),
+                pTraits<WeightedType>::zero
+            )
+        )
+    );
+    WeightedFieldType& wf = twf();
+
+    forAll(wf, celli)
+    {
+        const List<Type>& stField = stencilFld[celli];
+        const List<WeightType>& stWeight = stencilWeights[celli];
+
+        forAll(stField, i)
+        {
+            wf[celli] += stWeight[i]*stField[i];
+        }
+    }
+
+    // Boundaries values?
+
+    return twf;
+}
+
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCentredCellToCellStencil.C b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCentredCellToCellStencil.C
new file mode 100644
index 0000000000000000000000000000000000000000..f1969f2af18e3c3ca0a1472cd5850d63323f1600
--- /dev/null
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCentredCellToCellStencil.C
@@ -0,0 +1,75 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "extendedCentredCellToCellStencil.H"
+#include "mapDistribute.H"
+#include "cellToCellStencil.H"
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::extendedCentredCellToCellStencil::extendedCentredCellToCellStencil
+(
+    const cellToCellStencil& stencil
+)
+:
+    extendedCellToCellStencil(stencil.mesh()),
+    stencil_(stencil)
+{
+    // Calculate distribute map (also renumbers elements in stencil)
+    List<Map<label> > compactMap(Pstream::nProcs());
+    mapPtr_.reset
+    (
+        new mapDistribute
+        (
+            stencil.globalNumbering(),
+            stencil_,
+            compactMap
+        )
+    );
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+// Per cell which elements of the stencil to keep.
+void Foam::extendedCentredCellToCellStencil::compact()
+{
+    boolList isInStencil(map().constructSize(), false);
+
+    forAll(stencil_, cellI)
+    {
+        const labelList& stencilCells = stencil_[cellI];
+
+        forAll(stencilCells, i)
+        {
+            isInStencil[stencilCells[i]] = true;
+        }
+    }
+
+    mapPtr_().compact(isInStencil, Pstream::msgType());
+}
+
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCentredCellToCellStencil.H b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCentredCellToCellStencil.H
new file mode 100644
index 0000000000000000000000000000000000000000..f325a1fcc83c050cbccbe548f9f4e73b4381927a
--- /dev/null
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/extendedCentredCellToCellStencil.H
@@ -0,0 +1,153 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+Class
+    Foam::extendedCentredCellToCellStencil
+
+Description
+
+SourceFiles
+    extendedCentredCellToCellStencil.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef extendedCentredCellToCellStencil_H
+#define extendedCentredCellToCellStencil_H
+
+#include "extendedCellToCellStencil.H"
+#include "extendedCellToFaceStencil.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+class cellToCellStencil;
+
+/*---------------------------------------------------------------------------*\
+              Class extendedCentredCellToCellStencil Declaration
+\*---------------------------------------------------------------------------*/
+
+class extendedCentredCellToCellStencil
+:
+    public extendedCellToCellStencil
+{
+    // Private data
+
+        //- Swap map for getting neigbouring data
+        autoPtr<mapDistribute> mapPtr_;
+
+        //- Per cell the stencil.
+        labelListList stencil_;
+
+
+    // Private Member Functions
+
+        //- Disallow default bitwise copy construct
+        extendedCentredCellToCellStencil
+        (
+            const extendedCentredCellToCellStencil&
+        );
+
+        //- Disallow default bitwise assignment
+        void operator=(const extendedCentredCellToCellStencil&);
+
+
+public:
+
+    // Constructors
+
+        //- Construct from uncompacted cell stencil
+        explicit extendedCentredCellToCellStencil(const cellToCellStencil&);
+
+
+    // Member Functions
+
+        //- Return reference to the parallel distribution map
+        const mapDistribute& map() const
+        {
+            return mapPtr_();
+        }
+
+        //- Return reference to the stencil
+        const labelListList& stencil() const
+        {
+            return stencil_;
+        }
+
+        //- After removing elements from the stencil adapt the schedule (map).
+        void compact();
+
+        //- Use map to get the data into stencil order
+        template<class Type>
+        void collectData
+        (
+            const GeometricField<Type, fvPatchField, volMesh>& fld,
+            List<List<Type> >& stencilFld
+        ) const
+        {
+            extendedCellToFaceStencil::collectData
+            (
+                map(),
+                stencil(),
+                fld,
+                stencilFld
+            );
+        }
+
+        //- Sum vol field contributions to create cell values
+        template<class Type, class WeightType>
+        tmp
+        <
+            GeometricField
+            <
+                typename outerProduct<WeightType, Type>::type,
+                fvPatchField,
+                volMesh
+            >
+        > weightedSum
+        (
+            const GeometricField<Type, fvPatchField, volMesh>& fld,
+            const List<List<WeightType> >& stencilWeights
+        ) const
+        {
+            return extendedCellToCellStencil::weightedSum
+            (
+                map(),
+                stencil(),
+                fld,
+                stencilWeights
+            );
+        }
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CECCellToCellStencil.C b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CECCellToCellStencil.C
similarity index 98%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CECCellToCellStencil.C
rename to src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CECCellToCellStencil.C
index 20b63d824f2719da17e59785cef974090af250ef..7d2d6648c45ddce45c58f5f40aaf61ae881d28af 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CECCellToCellStencil.C
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CECCellToCellStencil.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CECCellToCellStencil.H b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CECCellToCellStencil.H
similarity index 97%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CECCellToCellStencil.H
rename to src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CECCellToCellStencil.H
index 7205c93fa805f54888f44d1e1137f069906d3445..df7733c46dc002c2dbe2c0c63e0dba99ff313afc 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CECCellToCellStencil.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CECCellToCellStencil.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CFCCellToCellStencil.C b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CFCCellToCellStencil.C
similarity index 98%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CFCCellToCellStencil.C
rename to src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CFCCellToCellStencil.C
index dd0f4050c18dc94a0fd09b15637c753cb8d3091a..d034b9549cf3a71b3df205fbcc0c8c7265569928 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CFCCellToCellStencil.C
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CFCCellToCellStencil.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CFCCellToCellStencil.H b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CFCCellToCellStencil.H
similarity index 96%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CFCCellToCellStencil.H
rename to src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CFCCellToCellStencil.H
index 1bbfe7e611d48b8c30a708c029b1f63fbc7398f6..6c7edac71e1918d4018647bd27c28e3c399b3123 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CFCCellToCellStencil.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CFCCellToCellStencil.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CPCCellToCellStencil.C b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CPCCellToCellStencil.C
similarity index 98%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CPCCellToCellStencil.C
rename to src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CPCCellToCellStencil.C
index 5a581f24dde13ef4a801f61893f17d1728d2c5b3..024bb7e2acffded88d0ef387457b39db9bf6d69c 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CPCCellToCellStencil.C
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CPCCellToCellStencil.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CPCCellToCellStencil.H b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CPCCellToCellStencil.H
similarity index 97%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CPCCellToCellStencil.H
rename to src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CPCCellToCellStencil.H
index a216673f05c7d1dbe69d3226efeace98afda5bc0..4bb75f2ddf479284031f5a4b65d1e7702bab190e 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/CPCCellToCellStencil.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/CPCCellToCellStencil.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/cellToCellStencil.C b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/cellToCellStencil.C
similarity index 99%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/cellToCellStencil.C
rename to src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/cellToCellStencil.C
index 6d784532aed0d6084bc1f560cce22d4be8c5f5f9..c2bc9d7e7ff0056876fd01135aab971c78649888 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/cellToCellStencil.C
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/cellToCellStencil.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/cellToCellStencil.H b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/cellToCellStencil.H
similarity index 98%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/cellToCellStencil.H
rename to src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/cellToCellStencil.H
index e31b6395aae4ae4b0e8b8220bb30560c072cc6b9..cb8dd8592763d33085046e0d0cb3437ccd0d0d7a 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToCell/fullStencils/cellToCellStencil.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToCell/globalIndexStencils/cellToCellStencil.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCECCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCECCellToFaceStencilObject.H
index eb80912208e5b0788e8b8165f074edefbb92a3a3..0e782aa5da52c7de27a09755c1de9c19f2bbc06a 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCECCellToFaceStencilObject.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCECCellToFaceStencilObject.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -48,7 +48,12 @@ namespace Foam
 
 class centredCECCellToFaceStencilObject
 :
-    public MeshObject<fvMesh, centredCECCellToFaceStencilObject>,
+    public MeshObject
+    <
+        fvMesh,
+        TopologicalMeshObject,
+        centredCECCellToFaceStencilObject
+    >,
     public extendedCentredCellToFaceStencil
 {
 
@@ -64,7 +69,12 @@ public:
             const fvMesh& mesh
         )
         :
-            MeshObject<fvMesh, centredCECCellToFaceStencilObject>(mesh),
+            MeshObject
+            <
+                fvMesh,
+                Foam::TopologicalMeshObject,
+                centredCECCellToFaceStencilObject
+            >(mesh),
             extendedCentredCellToFaceStencil(CECCellToFaceStencil(mesh))
         {
             if (extendedCellToFaceStencil::debug)
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCFCCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCFCCellToFaceStencilObject.H
index d5d300c3d4415cb7fea76c4a1c36232285109762..f2454e9a2e6e7c5d374341a64d1ce3ceb694f1d2 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCFCCellToFaceStencilObject.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCFCCellToFaceStencilObject.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -48,7 +48,12 @@ namespace Foam
 
 class centredCFCCellToFaceStencilObject
 :
-    public MeshObject<fvMesh, centredCFCCellToFaceStencilObject>,
+    public MeshObject
+    <
+        fvMesh,
+        TopologicalMeshObject,
+        centredCFCCellToFaceStencilObject
+    >,
     public extendedCentredCellToFaceStencil
 {
 
@@ -64,7 +69,12 @@ public:
             const fvMesh& mesh
         )
         :
-            MeshObject<fvMesh, centredCFCCellToFaceStencilObject>(mesh),
+            MeshObject
+            <
+                fvMesh,
+                Foam::TopologicalMeshObject,
+                centredCFCCellToFaceStencilObject
+            >(mesh),
             extendedCentredCellToFaceStencil(CFCCellToFaceStencil(mesh))
         {
             if (extendedCellToFaceStencil::debug)
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCPCCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCPCCellToFaceStencilObject.H
index e4e49b2466c7ac9de517f7b2e86dd748bc73059c..4f1e324075f491c1ed02da3eb05d0a48a93e8055 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCPCCellToFaceStencilObject.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredCPCCellToFaceStencilObject.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -48,7 +48,12 @@ namespace Foam
 
 class centredCPCCellToFaceStencilObject
 :
-    public MeshObject<fvMesh, centredCPCCellToFaceStencilObject>,
+    public MeshObject
+    <
+        fvMesh,
+        TopologicalMeshObject,
+        centredCPCCellToFaceStencilObject
+    >,
     public extendedCentredCellToFaceStencil
 {
 
@@ -64,7 +69,12 @@ public:
             const fvMesh& mesh
         )
         :
-            MeshObject<fvMesh, centredCPCCellToFaceStencilObject>(mesh),
+            MeshObject
+            <
+                fvMesh,
+                Foam::TopologicalMeshObject,
+                centredCPCCellToFaceStencilObject
+            >(mesh),
             extendedCentredCellToFaceStencil(CPCCellToFaceStencil(mesh))
         {
             if (extendedCellToFaceStencil::debug)
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredFECCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredFECCellToFaceStencilObject.H
index a4847074a015330244976ee0aca78a97558bdd8d..382033d06ea47787a47938f0796a3515898a79f7 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredFECCellToFaceStencilObject.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/centredFECCellToFaceStencilObject.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -48,7 +48,12 @@ namespace Foam
 
 class centredFECCellToFaceStencilObject
 :
-    public MeshObject<fvMesh, centredFECCellToFaceStencilObject>,
+    public MeshObject
+    <
+        fvMesh,
+        TopologicalMeshObject,
+        centredFECCellToFaceStencilObject
+    >,
     public extendedCentredCellToFaceStencil
 {
 
@@ -64,7 +69,12 @@ public:
             const fvMesh& mesh
         )
         :
-            MeshObject<fvMesh, centredFECCellToFaceStencilObject>(mesh),
+            MeshObject
+            <
+                fvMesh,
+                Foam::TopologicalMeshObject,
+                centredFECCellToFaceStencilObject
+            >(mesh),
             extendedCentredCellToFaceStencil(FECCellToFaceStencil(mesh))
         {
             if (extendedCellToFaceStencil::debug)
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/pureUpwindCFCCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/pureUpwindCFCCellToFaceStencilObject.H
index 32da6fbf463e9c6751d6d51b185f3ef3dff97580..494995ef20664aa2e5d1f0a6297fcf92f88635e7 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/pureUpwindCFCCellToFaceStencilObject.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/pureUpwindCFCCellToFaceStencilObject.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -48,7 +48,12 @@ namespace Foam
 
 class pureUpwindCFCCellToFaceStencilObject
 :
-    public MeshObject<fvMesh, pureUpwindCFCCellToFaceStencilObject>,
+    public MeshObject
+    <
+        fvMesh,
+        TopologicalMeshObject,
+        pureUpwindCFCCellToFaceStencilObject
+    >,
     public extendedUpwindCellToFaceStencil
 {
 
@@ -64,7 +69,12 @@ public:
             const fvMesh& mesh
         )
         :
-            MeshObject<fvMesh, pureUpwindCFCCellToFaceStencilObject>(mesh),
+            MeshObject
+            <
+                fvMesh,
+                Foam::TopologicalMeshObject,
+                pureUpwindCFCCellToFaceStencilObject
+            >(mesh),
             extendedUpwindCellToFaceStencil(CFCCellToFaceStencil(mesh))
         {
             if (extendedCellToFaceStencil::debug)
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCECCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCECCellToFaceStencilObject.H
index cb699db8fe4fdfff4350477732a1167438de4117..9882a8253a8a6b92175dcb8c13c987b3c7ca874c 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCECCellToFaceStencilObject.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCECCellToFaceStencilObject.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -48,7 +48,12 @@ namespace Foam
 
 class upwindCECCellToFaceStencilObject
 :
-    public MeshObject<fvMesh, upwindCECCellToFaceStencilObject>,
+    public MeshObject
+    <
+        fvMesh,
+        TopologicalMeshObject,
+        upwindCECCellToFaceStencilObject
+    >,
     public extendedUpwindCellToFaceStencil
 {
 
@@ -66,7 +71,12 @@ public:
             const scalar minOpposedness
         )
         :
-            MeshObject<fvMesh, upwindCECCellToFaceStencilObject>(mesh),
+            MeshObject
+            <
+                fvMesh,
+                Foam::TopologicalMeshObject,
+                upwindCECCellToFaceStencilObject
+            >(mesh),
             extendedUpwindCellToFaceStencil
             (
                 CECCellToFaceStencil(mesh),
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCFCCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCFCCellToFaceStencilObject.H
index b6db59a41597f82b6ccf7cc0c439420d88a898a8..ecedf99593ad17a5e1d80916c7c01f829a03ae54 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCFCCellToFaceStencilObject.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCFCCellToFaceStencilObject.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -48,7 +48,12 @@ namespace Foam
 
 class upwindCFCCellToFaceStencilObject
 :
-    public MeshObject<fvMesh, upwindCFCCellToFaceStencilObject>,
+    public MeshObject
+    <
+        fvMesh,
+        TopologicalMeshObject,
+        upwindCFCCellToFaceStencilObject
+    >,
     public extendedUpwindCellToFaceStencil
 {
 
@@ -66,7 +71,12 @@ public:
             const scalar minOpposedness
         )
         :
-            MeshObject<fvMesh, upwindCFCCellToFaceStencilObject>(mesh),
+            MeshObject
+            <
+                fvMesh,
+                Foam::TopologicalMeshObject,
+                upwindCFCCellToFaceStencilObject
+            >(mesh),
             extendedUpwindCellToFaceStencil
             (
                 CFCCellToFaceStencil(mesh),
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCPCCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCPCCellToFaceStencilObject.H
index 17c3913453fd232ecfe57fc378a3a7fe90f8404e..d5a359d797a1a893784fcc3f5df170f8d1c924cc 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCPCCellToFaceStencilObject.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindCPCCellToFaceStencilObject.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -48,7 +48,12 @@ namespace Foam
 
 class upwindCPCCellToFaceStencilObject
 :
-    public MeshObject<fvMesh, upwindCPCCellToFaceStencilObject>,
+    public MeshObject
+    <
+        fvMesh,
+        TopologicalMeshObject,
+        upwindCPCCellToFaceStencilObject
+    >,
     public extendedUpwindCellToFaceStencil
 {
 
@@ -66,7 +71,12 @@ public:
             const scalar minOpposedness
         )
         :
-            MeshObject<fvMesh, upwindCPCCellToFaceStencilObject>(mesh),
+            MeshObject
+            <
+                fvMesh,
+                Foam::TopologicalMeshObject,
+                upwindCPCCellToFaceStencilObject
+            >(mesh),
             extendedUpwindCellToFaceStencil
             (
                 CPCCellToFaceStencil(mesh),
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindFECCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindFECCellToFaceStencilObject.H
index 261da27db3931376e875e82cb5cb72fbe6057479..babb254e2216f4791b7512bb968cebd9fba0130e 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindFECCellToFaceStencilObject.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/upwindFECCellToFaceStencilObject.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -48,7 +48,12 @@ namespace Foam
 
 class upwindFECCellToFaceStencilObject
 :
-    public MeshObject<fvMesh, upwindFECCellToFaceStencilObject>,
+    public MeshObject
+    <
+        fvMesh,
+        TopologicalMeshObject,
+        upwindFECCellToFaceStencilObject
+    >,
     public extendedUpwindCellToFaceStencil
 {
 
@@ -66,7 +71,12 @@ public:
             const scalar minOpposedness
         )
         :
-            MeshObject<fvMesh, upwindFECCellToFaceStencilObject>(mesh),
+            MeshObject
+            <
+                fvMesh,
+                Foam::TopologicalMeshObject,
+                upwindFECCellToFaceStencilObject
+            >(mesh),
             extendedUpwindCellToFaceStencil
             (
                 FECCellToFaceStencil(mesh),
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CECCellToFaceStencil.C b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CECCellToFaceStencil.C
similarity index 95%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CECCellToFaceStencil.C
rename to src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CECCellToFaceStencil.C
index 30dfc852a604e7c18900ff52e5e610fb36a0c3e4..fdce95c55024dca5307453bfd5c1f3d55ed47e26 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CECCellToFaceStencil.C
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CECCellToFaceStencil.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CECCellToFaceStencil.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CECCellToFaceStencil.H
similarity index 96%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CECCellToFaceStencil.H
rename to src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CECCellToFaceStencil.H
index c6ced6d6fab6e96090cc876eadc22c48b65a4f02..92fe51edabffa6a588dcb773a78f873596a23c6c 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CECCellToFaceStencil.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CECCellToFaceStencil.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CFCCellToFaceStencil.C b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CFCCellToFaceStencil.C
similarity index 96%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CFCCellToFaceStencil.C
rename to src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CFCCellToFaceStencil.C
index 5a77cab318c4e512612c1468bd0f62f75fd3660d..e7cb4c43dc0eb6b7cda9b9b1caa2a3266b196010 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CFCCellToFaceStencil.C
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CFCCellToFaceStencil.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CFCCellToFaceStencil.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CFCCellToFaceStencil.H
similarity index 96%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CFCCellToFaceStencil.H
rename to src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CFCCellToFaceStencil.H
index ea040a544d7c47e5aca17839915459625620b0fc..bef19a852e4a0ff8fef7015355fd2a1a5ad594b0 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CFCCellToFaceStencil.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CFCCellToFaceStencil.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CPCCellToFaceStencil.C b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CPCCellToFaceStencil.C
similarity index 96%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CPCCellToFaceStencil.C
rename to src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CPCCellToFaceStencil.C
index 0cc2306779ac69cd2595f1ee75ea5623a9a76a5c..39b57ab9c1231f1e542e63e9a50fd5d261e23f10 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CPCCellToFaceStencil.C
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CPCCellToFaceStencil.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CPCCellToFaceStencil.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CPCCellToFaceStencil.H
similarity index 96%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CPCCellToFaceStencil.H
rename to src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CPCCellToFaceStencil.H
index 17742e47f4c4ab0ed26ca96452e665cd2565d234..77cbffd3826059e4532fdf979489c8cbb1eef407 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/CPCCellToFaceStencil.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/CPCCellToFaceStencil.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/FECCellToFaceStencil.C b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/FECCellToFaceStencil.C
similarity index 99%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/FECCellToFaceStencil.C
rename to src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/FECCellToFaceStencil.C
index 4d171aa7177ca0961c0c635ea9391511a4a70165..78425f1190b64b7bd42c0efd65082290f0e9e8cf 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/FECCellToFaceStencil.C
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/FECCellToFaceStencil.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/FECCellToFaceStencil.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/FECCellToFaceStencil.H
similarity index 97%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/FECCellToFaceStencil.H
rename to src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/FECCellToFaceStencil.H
index dab62919ad0ee71dcdcb70436f7e52516e12557c..6d85ea414e51d51f3ea094ff15f3a12c8b839d67 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/FECCellToFaceStencil.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/FECCellToFaceStencil.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/cellToFaceStencil.C b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/cellToFaceStencil.C
similarity index 99%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/cellToFaceStencil.C
rename to src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/cellToFaceStencil.C
index 8c5ccbff7a17dc14b73271f5cc61b1a60a4d229a..c57cf9e1005315518756342b33a9d48aba5ea5fc 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/cellToFaceStencil.C
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/cellToFaceStencil.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/cellToFaceStencil.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/cellToFaceStencil.H
similarity index 98%
rename from src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/cellToFaceStencil.H
rename to src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/cellToFaceStencil.H
index d29130b20c3bcb77c7f48bae1a1a58815504c400..1b325ac3f54d3fd7e7253029845382a234bb807e 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/fullStencils/cellToFaceStencil.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/globalIndexStencils/cellToFaceStencil.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/MeshObjects/centredCFCFaceToCellStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/MeshObjects/centredCFCFaceToCellStencilObject.H
index 7763c9fb157dec1592aec3d3d1c7bd4a9bc827f5..1ea4c349ba509d86f498f33cb0deae91fb1a8fa2 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/MeshObjects/centredCFCFaceToCellStencilObject.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/MeshObjects/centredCFCFaceToCellStencilObject.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -48,7 +48,12 @@ namespace Foam
 
 class centredCFCFaceToCellStencilObject
 :
-    public MeshObject<fvMesh, centredCFCFaceToCellStencilObject>,
+    public MeshObject
+    <
+        fvMesh,
+        TopologicalMeshObject,
+        centredCFCFaceToCellStencilObject
+    >,
     public extendedCentredFaceToCellStencil
 {
 
@@ -64,7 +69,12 @@ public:
             const fvMesh& mesh
         )
         :
-            MeshObject<fvMesh, centredCFCFaceToCellStencilObject>(mesh),
+            MeshObject
+            <
+                fvMesh,
+                Foam::TopologicalMeshObject,
+                centredCFCFaceToCellStencilObject
+            >(mesh),
             extendedCentredFaceToCellStencil(CFCFaceToCellStencil(mesh))
         {}
 
diff --git a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/fullStencils/CFCFaceToCellStencil.C b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/globalIndexStencils/CFCFaceToCellStencil.C
similarity index 98%
rename from src/finiteVolume/fvMesh/extendedStencil/faceToCell/fullStencils/CFCFaceToCellStencil.C
rename to src/finiteVolume/fvMesh/extendedStencil/faceToCell/globalIndexStencils/CFCFaceToCellStencil.C
index 6e7a53a8d23000ccd4e49a4d94b5537472dd28d1..7e49959a8bad1d9686826ea14e203607100b5724 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/fullStencils/CFCFaceToCellStencil.C
+++ b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/globalIndexStencils/CFCFaceToCellStencil.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/fullStencils/CFCFaceToCellStencil.H b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/globalIndexStencils/CFCFaceToCellStencil.H
similarity index 96%
rename from src/finiteVolume/fvMesh/extendedStencil/faceToCell/fullStencils/CFCFaceToCellStencil.H
rename to src/finiteVolume/fvMesh/extendedStencil/faceToCell/globalIndexStencils/CFCFaceToCellStencil.H
index 7f0619d0ea826bb36a3e4cd6d72a0b54fd7f007e..29c083449e8a39f867a72d049360f6fbc26afc27 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/fullStencils/CFCFaceToCellStencil.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/globalIndexStencils/CFCFaceToCellStencil.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/fullStencils/faceToCellStencil.C b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/globalIndexStencils/faceToCellStencil.C
similarity index 95%
rename from src/finiteVolume/fvMesh/extendedStencil/faceToCell/fullStencils/faceToCellStencil.C
rename to src/finiteVolume/fvMesh/extendedStencil/faceToCell/globalIndexStencils/faceToCellStencil.C
index 69bdd9a6004d85fc07efd83bbebcd8a811b4bae8..ac7f8b7ff08e12fdaba309eb96fbe00068ccbc4f 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/fullStencils/faceToCellStencil.C
+++ b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/globalIndexStencils/faceToCellStencil.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/fullStencils/faceToCellStencil.H b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/globalIndexStencils/faceToCellStencil.H
similarity index 97%
rename from src/finiteVolume/fvMesh/extendedStencil/faceToCell/fullStencils/faceToCellStencil.H
rename to src/finiteVolume/fvMesh/extendedStencil/faceToCell/globalIndexStencils/faceToCellStencil.H
index 4e64c865c4da2e9475d7488d48d2bb4d34a1ca50..f46e14b22fdc87407435057b881fdf5181f2b124 100644
--- a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/fullStencils/faceToCellStencil.H
+++ b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/globalIndexStencils/faceToCellStencil.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C
index b32cc11ce0536b8ba2b3d3e674d0f449a5cb3d4b..8185c2a084cbbba059b8a48b8fe9f3dc6bd5d264 100644
--- a/src/finiteVolume/fvMesh/fvMesh.C
+++ b/src/finiteVolume/fvMesh/fvMesh.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
@@ -31,42 +31,17 @@ License
 #include "SubField.H"
 #include "demandDrivenData.H"
 #include "fvMeshLduAddressing.H"
-#include "emptyPolyPatch.H"
 #include "mapPolyMesh.H"
 #include "MapFvFields.H"
 #include "fvMeshMapper.H"
 #include "mapClouds.H"
-
-#include "volPointInterpolation.H"
-#include "extendedLeastSquaresVectors.H"
-#include "extendedLeastSquaresVectors.H"
-#include "leastSquaresVectors.H"
-#include "CentredFitData.H"
-#include "linearFitPolynomial.H"
-#include "quadraticFitPolynomial.H"
-#include "quadraticLinearFitPolynomial.H"
-//#include "quadraticFitSnGradData.H"
-#include "skewCorrectionVectors.H"
-
-
-#include "centredCECCellToFaceStencilObject.H"
-#include "centredCFCCellToFaceStencilObject.H"
-#include "centredCPCCellToFaceStencilObject.H"
-#include "centredFECCellToFaceStencilObject.H"
-#include "upwindCECCellToFaceStencilObject.H"
-#include "upwindCFCCellToFaceStencilObject.H"
-#include "upwindCPCCellToFaceStencilObject.H"
-#include "upwindFECCellToFaceStencilObject.H"
-
-#include "centredCFCFaceToCellStencilObject.H"
-#include "meshSearchMeshObject.H"
-#include "meshSearchFACECENTRETETSMeshObject.H"
+#include "MeshObject.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 namespace Foam
 {
-defineTypeNameAndDebug(fvMesh, 0);
+    defineTypeNameAndDebug(fvMesh, 0);
 }
 
 
@@ -74,6 +49,9 @@ defineTypeNameAndDebug(fvMesh, 0);
 
 void Foam::fvMesh::clearGeomNotOldVol()
 {
+    meshObject::clear<fvMesh, GeometricMeshObject>(*this);
+    meshObject::clear<lduMesh, GeometricMeshObject>(*this);
+
     slicedVolScalarField::DimensionedInternalField* VPtr =
         static_cast<slicedVolScalarField::DimensionedInternalField*>(VPtr_);
     deleteDemandDrivenData(VPtr);
@@ -129,55 +107,14 @@ void Foam::fvMesh::clearGeom()
 
     // Mesh motion flux cannot be deleted here because the old-time flux
     // needs to be saved.
-
-    // Things geometry dependent that are not updated.
-    volPointInterpolation::Delete(*this);
-    extendedLeastSquaresVectors::Delete(*this);
-    leastSquaresVectors::Delete(*this);
-    CentredFitData<linearFitPolynomial>::Delete(*this);
-    CentredFitData<quadraticFitPolynomial>::Delete(*this);
-    CentredFitData<quadraticLinearFitPolynomial>::Delete(*this);
-    skewCorrectionVectors::Delete(*this);
-    //quadraticFitSnGradData::Delete(*this);
-
-    // Note: should be in polyMesh::clearGeom but meshSearch not in OpenFOAM
-    // library
-    meshSearchMeshObject::Delete(*this);
-    meshSearchFACECENTRETETSMeshObject::Delete(*this);
 }
 
 
 void Foam::fvMesh::clearAddressing()
 {
+    meshObject::clear<fvMesh, TopologicalMeshObject>(*this);
+    meshObject::clear<lduMesh, TopologicalMeshObject>(*this);
     deleteDemandDrivenData(lduPtr_);
-
-    // Hack until proper callbacks. Below are all the fvMesh-MeshObjects.
-
-    volPointInterpolation::Delete(*this);
-    extendedLeastSquaresVectors::Delete(*this);
-    leastSquaresVectors::Delete(*this);
-    CentredFitData<linearFitPolynomial>::Delete(*this);
-    CentredFitData<quadraticFitPolynomial>::Delete(*this);
-    CentredFitData<quadraticLinearFitPolynomial>::Delete(*this);
-    skewCorrectionVectors::Delete(*this);
-    //quadraticFitSnGradData::Delete(*this);
-
-    centredCECCellToFaceStencilObject::Delete(*this);
-    centredCFCCellToFaceStencilObject::Delete(*this);
-    centredCPCCellToFaceStencilObject::Delete(*this);
-    centredFECCellToFaceStencilObject::Delete(*this);
-    // Is this geometry related - cells distorting to upwind direction?
-    upwindCECCellToFaceStencilObject::Delete(*this);
-    upwindCFCCellToFaceStencilObject::Delete(*this);
-    upwindCPCCellToFaceStencilObject::Delete(*this);
-    upwindFECCellToFaceStencilObject::Delete(*this);
-
-    centredCFCFaceToCellStencilObject::Delete(*this);
-
-    // Note: should be in polyMesh::clearGeom but meshSearch not in OpenFOAM
-    // library
-    meshSearchMeshObject::Delete(*this);
-    meshSearchFACECENTRETETSMeshObject::Delete(*this);
 }
 
 
@@ -234,7 +171,8 @@ Foam::fvMesh::fvMesh(const IOobject& io)
                 time().timeName(),
                 *this,
                 IOobject::MUST_READ,
-                IOobject::NO_WRITE
+                IOobject::NO_WRITE,
+                false
             ),
             *this
         );
@@ -254,7 +192,8 @@ Foam::fvMesh::fvMesh(const IOobject& io)
                 time().timeName(),
                 *this,
                 IOobject::MUST_READ,
-                IOobject::AUTO_WRITE
+                IOobject::AUTO_WRITE,
+                false
             ),
             *this
         );
@@ -603,24 +542,6 @@ void Foam::fvMesh::mapFields(const mapPolyMesh& meshMap)
 }
 
 
-// Temporary helper function to call move points on
-// MeshObjects
-template<class Type>
-void MeshObjectMovePoints(const Foam::fvMesh& mesh)
-{
-    if (mesh.thisDb().foundObject<Type>(Type::typeName))
-    {
-        const_cast<Type&>
-        (
-            mesh.thisDb().lookupObject<Type>
-            (
-                Type::typeName
-            )
-        ).movePoints();
-    }
-}
-
-
 Foam::tmp<Foam::scalarField> Foam::fvMesh::movePoints(const pointField& p)
 {
     // Grab old time volumes if the time has been incremented
@@ -645,7 +566,8 @@ Foam::tmp<Foam::scalarField> Foam::fvMesh::movePoints(const pointField& p)
                     time().timeName(),
                     *this,
                     IOobject::NO_READ,
-                    IOobject::NO_WRITE
+                    IOobject::NO_WRITE,
+                    false
                 ),
                 V()
             );
@@ -666,7 +588,8 @@ Foam::tmp<Foam::scalarField> Foam::fvMesh::movePoints(const pointField& p)
                 this->time().timeName(),
                 *this,
                 IOobject::NO_READ,
-                IOobject::AUTO_WRITE
+                IOobject::AUTO_WRITE,
+                false
             ),
             *this,
             dimVolume/dimTime
@@ -714,17 +637,8 @@ Foam::tmp<Foam::scalarField> Foam::fvMesh::movePoints(const pointField& p)
     boundary_.movePoints();
     surfaceInterpolation::movePoints();
 
-
-    // Hack until proper callbacks. Below are all the fvMesh MeshObjects with a
-    // movePoints function.
-    MeshObjectMovePoints<volPointInterpolation>(*this);
-    MeshObjectMovePoints<extendedLeastSquaresVectors>(*this);
-    MeshObjectMovePoints<leastSquaresVectors>(*this);
-    MeshObjectMovePoints<CentredFitData<linearFitPolynomial> >(*this);
-    MeshObjectMovePoints<CentredFitData<quadraticFitPolynomial> >(*this);
-    MeshObjectMovePoints<CentredFitData<quadraticLinearFitPolynomial> >(*this);
-    MeshObjectMovePoints<skewCorrectionVectors>(*this);
-    //MeshObjectMovePoints<quadraticFitSnGradData>(*this);
+    meshObject::movePoints<fvMesh>(*this);
+    meshObject::movePoints<lduMesh>(*this);
 
     return tsweptVols;
 }
@@ -746,9 +660,8 @@ void Foam::fvMesh::updateMesh(const mapPolyMesh& mpm)
 
     clearAddressing();
 
-    // handleMorph() should also clear out the surfaceInterpolation.
-    // This is a temporary solution
-    surfaceInterpolation::movePoints();
+    meshObject::updateMesh<fvMesh>(*this, mpm);
+    meshObject::updateMesh<lduMesh>(*this, mpm);
 }
 
 
diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H
index 7cb9d97a00b0b8105d0f2331a6047dd3034d5c27..a09e037a95ce61e6b1c13d2e2bec579e77b5c55a 100644
--- a/src/finiteVolume/fvMesh/fvMesh.H
+++ b/src/finiteVolume/fvMesh/fvMesh.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/fvMeshGeometry.C b/src/finiteVolume/fvMesh/fvMeshGeometry.C
index ddd395a722966801a068f41e6306b64bb9148621..6c7dde98162c7e3a374c43b13d817f6470b29e8a 100644
--- a/src/finiteVolume/fvMesh/fvMeshGeometry.C
+++ b/src/finiteVolume/fvMesh/fvMeshGeometry.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
@@ -208,7 +208,8 @@ const volScalarField::DimensionedInternalField& fvMesh::V() const
                 time().timeName(),
                 *this,
                 IOobject::NO_READ,
-                IOobject::NO_WRITE
+                IOobject::NO_WRITE,
+                false
             ),
             *this,
             dimVolume,
@@ -258,7 +259,8 @@ const volScalarField::DimensionedInternalField& fvMesh::V00() const
                 time().timeName(),
                 *this,
                 IOobject::NO_READ,
-                IOobject::NO_WRITE
+                IOobject::NO_WRITE,
+                false
             ),
             V0()
         );
diff --git a/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.C b/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.C
index 736e1e44568e851298cb0eb58858fbfcf21c6c33..6a3e337357cb053f7367aee8085e1951c47f0c03 100644
--- a/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.C
+++ b/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -82,7 +82,8 @@ void Foam::fvPatchMapper::calcAddressing() const
             }
             else
             {
-                addr[faceI] = 0;
+                //addr[faceI] = 0;
+                addr[faceI] = -1;
             }
         }
 
@@ -90,12 +91,14 @@ void Foam::fvPatchMapper::calcAddressing() const
         {
             if (min(addr) < 0)
             {
-                FatalErrorIn
+                //FatalErrorIn
+                WarningIn
                 (
                     "void fvPatchMapper::calcAddressing() const"
-                )   << "Error in patch mapping for patch "
+                )   << "Unmapped entry in patch mapping for patch "
                     << patch_.index() << " named " << patch_.name()
-                    << abort(FatalError);
+                    //<< abort(FatalError);
+                    << endl;
             }
         }
     }
@@ -156,19 +159,22 @@ void Foam::fvPatchMapper::calcAddressing() const
                     }
                 }
 
-                // Cater for bad mapping
-                if (nActive == 0)
-                {
-                    newAddr[nActive] = 0;
-                    newWeights[nActive] = 1;
-                    nActive++;
-                }
+                //// Cater for bad mapping
+                //if (nActive == 0)
+                //{
+                //    newAddr[nActive] = 0;
+                //    newWeights[nActive] = 1;
+                //    nActive++;
+                //}
 
                 newAddr.setSize(nActive);
                 newWeights.setSize(nActive);
 
                 // Re-scale the weights
-                newWeights /= sum(newWeights);
+                if (nActive > 0)
+                {
+                    newWeights /= sum(newWeights);
+                }
 
                 // Reset addressing and weights
                 curAddr = newAddr;
diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C
index 1c9a6ca20c9371d440dfe980b6010b26f2ef6b28..de5df5157d4f05c72bfa766be34b44870a212faf 100644
--- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C
+++ b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -161,6 +161,7 @@ void Foam::fvPatch::movePoints()
 const Foam::scalarField& Foam::fvPatch::deltaCoeffs() const
 {
     return boundaryMesh().mesh().deltaCoeffs().boundaryField()[index()];
+  //return boundaryMesh().mesh().nonOrthDeltaCoeffs().boundaryField()[index()];
 }
 
 
diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H
index d135007da06c79e3abea94586a0259f693203822..f8cef73a787683f80340c5757e80885cfa4220c7 100644
--- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H
+++ b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchTemplates.C b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchTemplates.C
index 11aef36b05ffdec01c37739ce04570618b9e1b39..f9459a7718008c2d4e4dc53781ad6681d9ed801f 100644
--- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchTemplates.C
+++ b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatchTemplates.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.C b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.C
index 9d75e3233624107cd518d9dc46e8da0979787485..52152cee2c1c395f3cd1c2879d64951760f9b690 100644
--- a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.C
+++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.C
index a4bd976668e0576ebc107a366832aeddd670fdcd..5b227e12eb4e445e59de75399127f71dce2505a3 100644
--- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.C
+++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -40,7 +40,7 @@ Foam::FitData<Form, ExtendedStencil, Polynomial>::FitData
     const scalar centralWeight
 )
 :
-    MeshObject<fvMesh, Form>(mesh),
+    MeshObject<fvMesh, Foam::MoveableMeshObject, Form>(mesh),
     stencil_(stencil),
     linearCorrection_(linearCorrection),
     linearLimitFactor_(linearLimitFactor),
diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.H
index 4c6a71b4f992cd8e96400cb0db6d07e2c01f25bd..cee373b6c4d8f4fce1ab28549a9b0ade2f68bcb5 100644
--- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.H
+++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -54,7 +54,7 @@ namespace Foam
 template<class FitDataType, class ExtendedStencil, class Polynomial>
 class FitData
 :
-    public MeshObject<fvMesh, FitDataType>
+    public MeshObject<fvMesh, MoveableMeshObject, FitDataType>
 {
     // Private data
 
diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.C
index 9e5ad7f3a02e89bb57288775d34f7ddc3ee46f97..6368d2accd863cc9d6965b94b0a826e6ef2bbbaa 100644
--- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.C
+++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -70,8 +70,8 @@ Foam::linearUpwindV<Type>::correction
     const labelList& own = mesh.owner();
     const labelList& nei = mesh.neighbour();
 
-    const vectorField& C = mesh.C();
-    const vectorField& Cf = mesh.Cf();
+    const volVectorField& C = mesh.C();
+    const surfaceVectorField& Cf = mesh.Cf();
 
     tmp
     <
@@ -97,8 +97,7 @@ Foam::linearUpwindV<Type>::correction
         if (faceFlux[facei] > 0.0)
         {
             maxCorr =
-                (1.0 - w[facei])
-               *(vf[nei[facei]] - vf[own[facei]]);
+                (1.0 - w[facei])*(vf[nei[facei]] - vf[own[facei]]);
 
             sfCorr[facei] =
                 (Cf[facei] - C[own[facei]]) & gradVf[own[facei]];
@@ -139,6 +138,86 @@ Foam::linearUpwindV<Type>::correction
         }
     }
 
+
+    typename GeometricField<Type, fvsPatchField, surfaceMesh>::
+        GeometricBoundaryField& bSfCorr = sfCorr.boundaryField();
+
+    forAll(bSfCorr, patchi)
+    {
+        fvsPatchField<Type>& pSfCorr = bSfCorr[patchi];
+
+        if (pSfCorr.coupled())
+        {
+            const labelUList& pOwner =
+                mesh.boundary()[patchi].faceCells();
+
+            const vectorField& pCf = Cf.boundaryField()[patchi];
+            const scalarField& pW = w.boundaryField()[patchi];
+
+            const scalarField& pFaceFlux = faceFlux.boundaryField()[patchi];
+
+            const Field<typename outerProduct<vector, Type>::type> pGradVfNei
+            (
+                gradVf.boundaryField()[patchi].patchNeighbourField()
+            );
+
+            const Field<Type> pVfNei
+            (
+                vf.boundaryField()[patchi].patchNeighbourField()
+            );
+
+            // Build the d-vectors
+            vectorField pd(Cf.boundaryField()[patchi].patch().delta());
+
+            forAll(pOwner, facei)
+            {
+                label own = pOwner[facei];
+
+                vector maxCorr;
+
+                if (pFaceFlux[facei] > 0)
+                {
+                    pSfCorr[facei] = (pCf[facei] - C[own]) & gradVf[own];
+
+                    maxCorr = (1.0 - pW[facei])*(pVfNei[facei] - vf[own]);
+                }
+                else
+                {
+                    pSfCorr[facei] =
+                        (pCf[facei] - pd[facei] - C[own]) & pGradVfNei[facei];
+
+                    maxCorr = pW[facei]*(vf[own] - pVfNei[facei]);
+                }
+
+                scalar pSfCorrs = magSqr(pSfCorr[facei]);
+                scalar maxCorrs = pSfCorr[facei] & maxCorr;
+
+                if (pSfCorrs > 0)
+                {
+                    if (maxCorrs < 0)
+                    {
+                        pSfCorr[facei] = vector::zero;
+                    }
+                    else if (pSfCorrs > maxCorrs)
+                    {
+                        pSfCorr[facei] *= maxCorrs/(pSfCorrs + VSMALL);
+                    }
+                }
+                else if (pSfCorrs < 0)
+                {
+                    if (maxCorrs > 0)
+                    {
+                        pSfCorr[facei] = vector::zero;
+                    }
+                    else if (pSfCorrs < maxCorrs)
+                    {
+                        pSfCorr[facei] *= maxCorrs/(pSfCorrs - VSMALL);
+                    }
+                }
+            }
+        }
+    }
+
     return tsfCorr;
 }
 
diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.C
index a25994792ac43dff368af466b6e9b25c75eb11a7..9ba9be2b31437488ab77fb6ba7ad0a82daca681e 100644
--- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.C
+++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.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
@@ -24,7 +24,6 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "skewCorrectionVectors.H"
-#include "surfaceFields.H"
 #include "volFields.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@@ -39,28 +38,9 @@ namespace Foam
 
 Foam::skewCorrectionVectors::skewCorrectionVectors(const fvMesh& mesh)
 :
-    MeshObject<fvMesh, skewCorrectionVectors>(mesh),
-    skew_(true),
-    skewCorrectionVectors_(NULL)
-{}
-
-
-Foam::skewCorrectionVectors::~skewCorrectionVectors()
-{
-    deleteDemandDrivenData(skewCorrectionVectors_);
-}
-
-
-void Foam::skewCorrectionVectors::makeSkewCorrectionVectors() const
-{
-    if (debug)
-    {
-        Info<< "surfaceInterpolation::makeSkewCorrectionVectors() : "
-            << "Constructing skew correction vectors"
-            << endl;
-    }
-
-    skewCorrectionVectors_ = new surfaceVectorField
+    MeshObject<fvMesh, Foam::MoveableMeshObject, skewCorrectionVectors>(mesh),
+    skew_(false),
+    skewCorrectionVectors_
     (
         IOobject
         (
@@ -73,8 +53,24 @@ void Foam::skewCorrectionVectors::makeSkewCorrectionVectors() const
         ),
         mesh_,
         dimless
-    );
-    surfaceVectorField& SkewCorrVecs = *skewCorrectionVectors_;
+    )
+{
+    calcSkewCorrectionVectors();
+}
+
+
+Foam::skewCorrectionVectors::~skewCorrectionVectors()
+{}
+
+
+void Foam::skewCorrectionVectors::calcSkewCorrectionVectors()
+{
+    if (debug)
+    {
+        Info<< "surfaceInterpolation::calcSkewCorrectionVectors() : "
+            << "Calculating skew correction vectors"
+            << endl;
+    }
 
     // Set local references to mesh data
     const volVectorField& C = mesh_.C();
@@ -92,14 +88,15 @@ void Foam::skewCorrectionVectors::makeSkewCorrectionVectors() const
         vector d = C[nei] - C[own];
         vector Cpf = Cf[facei] - C[own];
 
-        SkewCorrVecs[facei] = Cpf - ((Sf[facei] & Cpf)/(Sf[facei] & d))*d;
+        skewCorrectionVectors_[facei] =
+            Cpf - ((Sf[facei] & Cpf)/(Sf[facei] & d))*d;
     }
 
 
-    forAll(SkewCorrVecs.boundaryField(), patchI)
+    forAll(skewCorrectionVectors_.boundaryField(), patchI)
     {
         fvsPatchVectorField& patchSkewCorrVecs =
-            SkewCorrVecs.boundaryField()[patchI];
+            skewCorrectionVectors_.boundaryField()[patchI];
 
         if (!patchSkewCorrVecs.coupled())
         {
@@ -132,21 +129,19 @@ void Foam::skewCorrectionVectors::makeSkewCorrectionVectors() const
 
     if (Sf.internalField().size())
     {
-        skewCoeff = max(mag(SkewCorrVecs)*mesh_.deltaCoeffs()).value();
+        skewCoeff =
+            max(mag(skewCorrectionVectors_)*mesh_.deltaCoeffs()).value();
     }
 
     if (debug)
     {
-        Info<< "surfaceInterpolation::makeSkewCorrectionVectors() : "
+        Info<< "surfaceInterpolation::calcSkewCorrectionVectors() : "
             << "skew coefficient = " << skewCoeff << endl;
     }
 
-    //skewCoeff = 0.0;
-
     if (skewCoeff < 1e-5)
     {
         skew_ = false;
-        deleteDemandDrivenData(skewCorrectionVectors_);
     }
     else
     {
@@ -155,43 +150,16 @@ void Foam::skewCorrectionVectors::makeSkewCorrectionVectors() const
 
     if (debug)
     {
-        Info<< "surfaceInterpolation::makeSkewCorrectionVectors() : "
+        Info<< "surfaceInterpolation::calcSkewCorrectionVectors() : "
             << "Finished constructing skew correction vectors"
             << endl;
     }
 }
 
 
-bool Foam::skewCorrectionVectors::skew() const
-{
-    if (skew_ == true && !skewCorrectionVectors_)
-    {
-        makeSkewCorrectionVectors();
-    }
-
-    return skew_;
-}
-
-
-const Foam::surfaceVectorField& Foam::skewCorrectionVectors::operator()() const
-{
-    if (!skew())
-    {
-        FatalErrorIn("skewCorrectionVectors::operator()()")
-            << "Cannot return skewCorrectionVectors; mesh is not skewed"
-            << abort(FatalError);
-    }
-
-    return *skewCorrectionVectors_;
-}
-
-
-// Do what is neccessary if the mesh has moved
 bool Foam::skewCorrectionVectors::movePoints()
 {
-    skew_ = true;
-    deleteDemandDrivenData(skewCorrectionVectors_);
-
+    calcSkewCorrectionVectors();
     return true;
 }
 
diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.H
index 1dee3317a3b285bf96ba608dbd03ed0558525659..38b66f90c6ce86154f3246e2e026a6d8b0557124 100644
--- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.H
+++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -37,7 +37,7 @@ SourceFiles
 
 #include "MeshObject.H"
 #include "fvMesh.H"
-#include "surfaceFieldsFwd.H"
+#include "surfaceFields.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -52,18 +52,18 @@ class fvMesh;
 
 class skewCorrectionVectors
 :
-    public MeshObject<fvMesh, skewCorrectionVectors>
+    public MeshObject<fvMesh, MoveableMeshObject, skewCorrectionVectors>
 {
     // Private data
 
         //- Is mesh skew
-        mutable bool skew_;
+        bool skew_;
 
         //- Skew correction vectors
-        mutable surfaceVectorField* skewCorrectionVectors_;
+        surfaceVectorField skewCorrectionVectors_;
 
-        //- Construct skewness correction vectors
-        void makeSkewCorrectionVectors() const;
+        //- Calculate skewness correction vectors
+        void calcSkewCorrectionVectors();
 
 
 public:
@@ -83,12 +83,18 @@ public:
     // Member functions
 
         //- Return whether mesh is skew or not
-        bool skew() const;
+        bool skew() const
+        {
+            return skew_;
+        }
 
         //- Return reference to skew vectors array
-        const surfaceVectorField& operator()() const;
+        const surfaceVectorField& operator()() const
+        {
+            return skewCorrectionVectors_;
+        }
 
-        //- Delete the correction vectors when the mesh moves
+        //- Update the correction vectors when the mesh moves
         virtual bool movePoints();
 };
 
diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C
index 4386716a17e892ff308de387ba5b9fc021cf6792..5fc0b4fa9d22e2917647636f9adccc279a0409d0 100644
--- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C
+++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.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
@@ -148,7 +148,10 @@ void Foam::surfaceInterpolation::makeWeights() const
         (
             "weights",
             mesh_.pointsInstance(),
-            mesh_
+            mesh_,
+            IOobject::NO_READ,
+            IOobject::NO_WRITE,
+            false // Do not register
         ),
         mesh_,
         dimless
@@ -217,7 +220,10 @@ void Foam::surfaceInterpolation::makeDeltaCoeffs() const
         (
             "deltaCoeffs",
             mesh_.pointsInstance(),
-            mesh_
+            mesh_,
+            IOobject::NO_READ,
+            IOobject::NO_WRITE,
+            false // Do not register
         ),
         mesh_,
         dimless/dimLength
@@ -262,7 +268,10 @@ void Foam::surfaceInterpolation::makeNonOrthDeltaCoeffs() const
         (
             "nonOrthDeltaCoeffs",
             mesh_.pointsInstance(),
-            mesh_
+            mesh_,
+            IOobject::NO_READ,
+            IOobject::NO_WRITE,
+            false // Do not register
         ),
         mesh_,
         dimless/dimLength
@@ -320,7 +329,10 @@ void Foam::surfaceInterpolation::makeNonOrthCorrectionVectors() const
         (
             "nonOrthCorrectionVectors",
             mesh_.pointsInstance(),
-            mesh_
+            mesh_,
+            IOobject::NO_READ,
+            IOobject::NO_WRITE,
+            false // Do not register
         ),
         mesh_,
         dimless
diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C
index 0baffa6c5eb9428192efb1e4f4a67cce739bc0e0..f66c3acfa6e047eba3f95f563e74824a9a7cb3cd 100644
--- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C
+++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C
@@ -171,7 +171,10 @@ surfaceInterpolationScheme<Type>::interpolate
                "(const GeometricField<Type, fvPatchField, volMesh>&, "
                "const tmp<surfaceScalarField>&, "
                "const tmp<surfaceScalarField>&) : "
-               "interpolating volTypeField from cells to faces "
+               "interpolating "
+            << vf.type() << " "
+            << vf.name()
+            << " from cells to faces "
                "without explicit correction"
             << endl;
     }
@@ -252,7 +255,10 @@ surfaceInterpolationScheme<Type>::interpolate
         Info<< "surfaceInterpolationScheme<Type>::interpolate"
                "(const GeometricField<Type, fvPatchField, volMesh>&, "
                "const tmp<surfaceScalarField>&) : "
-               "interpolating volTypeField from cells to faces "
+               "interpolating "
+            << vf.type() << " "
+            << vf.name()
+            << " from cells to faces "
                "without explicit correction"
             << endl;
     }
@@ -326,7 +332,10 @@ surfaceInterpolationScheme<Type>::interpolate
     {
         Info<< "surfaceInterpolationScheme<Type>::interpolate"
                "(const GeometricField<Type, fvPatchField, volMesh>&) : "
-            << "interpolating volTypeField from cells to faces"
+               "interpolating "
+            << vf.type() << " "
+            << vf.name()
+            << " from cells to faces"
             << endl;
     }
 
diff --git a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C
index 87305f2fa80f2fa5b6a210d2bef08f1137f76f7e..74b6b52c74e526b5bf9f2aae40877702335acb3b 100644
--- a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.C
+++ b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.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
@@ -612,9 +612,10 @@ void volPointInterpolation::makePatchPatchAddressing()
 
 volPointInterpolation::volPointInterpolation(const fvMesh& vm)
 :
-    MeshObject<fvMesh, volPointInterpolation>(vm)
+    MeshObject<fvMesh, Foam::UpdateableMeshObject, volPointInterpolation>(vm)
 {
-    updateMesh();
+    makeWeights();
+    makePatchPatchAddressing();
 }
 
 
@@ -626,7 +627,7 @@ volPointInterpolation::~volPointInterpolation()
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-void volPointInterpolation::updateMesh()
+void volPointInterpolation::updateMesh(const mapPolyMesh&)
 {
     makeWeights();
     makePatchPatchAddressing();
diff --git a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.H b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.H
index d5a1a2eab46ecc0f7095663fada6f8085c210e19..96765ea14d7195feb9ea9fc22116ddc1eace5aac 100644
--- a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.H
+++ b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolation.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -56,7 +56,7 @@ class pointMesh;
 
 class volPointInterpolation
 :
-    public MeshObject<fvMesh, volPointInterpolation>
+    public MeshObject<fvMesh, UpdateableMeshObject, volPointInterpolation>
 {
     // Private data
 
@@ -174,7 +174,7 @@ public:
         // Edit
 
             //- Update mesh topology using the morph engine
-            void updateMesh();
+            void updateMesh(const mapPolyMesh&);
 
             //- Correct weighting factors for moving mesh.
             bool movePoints();
diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C
index 8b34742672bda53cd3b0a0c651f976fce8c26dd2..6029c8383f47c440aa6c35faa39b4b6e5bcfdbbd 100644
--- a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C
+++ b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.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
@@ -325,7 +325,7 @@ Foam::displacementInterpolationMotionSolver::curPoints() const
     tmp<pointField> tcurPoints(new pointField(points0()));
     pointField& curPoints = tcurPoints();
 
-    // Interpolate the diplacement of the face zones.
+    // Interpolate the displacement of the face zones.
     vectorField zoneDisp(displacements_.size(), vector::zero);
     forAll(zoneDisp, zoneI)
     {
diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.H b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.H
index acb74235b78c3e7b440a1ffae29ec802c3327d79..d65fcc672bfe6314345109f705bda907ef46fc55 100644
--- a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.H
+++ b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -264,7 +264,7 @@ inline bool Foam::pointEdgeStructuredWalk::updateEdge
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::pointEdgeStructuredWalk::equal
 (
     const pointEdgeStructuredWalk& rhs,
diff --git a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C
index 1fa44b5d64c0c54c14453a7f49270a89f6081a4e..edcd775d3a9fb8e1f928a9bb108ea75606b94fb4 100644
--- a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C
+++ b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -156,6 +156,47 @@ timeVaryingMappedFixedValuePointPatchField
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+template<class Type>
+void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::autoMap
+(
+    const pointPatchFieldMapper& m
+)
+{
+    fixedValuePointPatchField<Type>::autoMap(m);
+    if (startSampledValues_.size())
+    {
+        startSampledValues_.autoMap(m);
+        endSampledValues_.autoMap(m);
+    }
+    // Clear interpolator
+    mapperPtr_.clear();
+    startSampleTime_ = -1;
+    endSampleTime_ = -1;
+}
+
+
+template<class Type>
+void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::rmap
+(
+    const pointPatchField<Type>& ptf,
+    const labelList& addr
+)
+{
+    fixedValuePointPatchField<Type>::rmap(ptf, addr);
+
+    const timeVaryingMappedFixedValuePointPatchField<Type>& tiptf =
+        refCast<const timeVaryingMappedFixedValuePointPatchField<Type> >(ptf);
+
+    startSampledValues_.rmap(tiptf.startSampledValues_, addr);
+    endSampledValues_.rmap(tiptf.endSampledValues_, addr);
+
+    // Clear interpolator
+    mapperPtr_.clear();
+    startSampleTime_ = -1;
+    endSampleTime_ = -1;
+}
+
+
 template<class Type>
 void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::checkTable()
 {
@@ -313,6 +354,18 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::checkTable()
                 )
             );
 
+            if (vals.size() != mapperPtr_().sourceSize())
+            {
+                FatalErrorIn
+                (
+                    "timeVaryingMappedFixedValuePointPatchField<Type>::"
+                    "checkTable()"
+                )   << "Number of values (" << vals.size()
+                    << ") differs from the number of points ("
+                    <<  mapperPtr_().sourceSize()
+                    << ") in file " << vals.objectPath() << exit(FatalError);
+            }
+
             startAverage_ = vals.average();
             startSampledValues_ = mapperPtr_().interpolate(vals);
         }
@@ -357,6 +410,19 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::checkTable()
                     false
                 )
             );
+
+            if (vals.size() != mapperPtr_().sourceSize())
+            {
+                FatalErrorIn
+                (
+                    "timeVaryingMappedFixedValuePointPatchField<Type>::"
+                    "checkTable()"
+                )   << "Number of values (" << vals.size()
+                    << ") differs from the number of points ("
+                    <<  mapperPtr_().sourceSize()
+                    << ") in file " << vals.objectPath() << exit(FatalError);
+            }
+
             endAverage_ = vals.average();
             endSampledValues_ = mapperPtr_().interpolate(vals);
         }
diff --git a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.H b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.H
index 108ec6786ee9b4a804ec0e5c1ebe0068f56ae538..942dc3e4a643960058160516e32533b59cc49937 100644
--- a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.H
+++ b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -167,6 +167,23 @@ public:
             void checkTable();
 
 
+        // Mapping functions
+
+            //- Map (and resize as needed) from self given a mapping object
+            virtual void autoMap
+            (
+                const pointPatchFieldMapper&
+            );
+
+            //- Reverse map the given PointPatchField onto
+            //  this PointPatchField
+            virtual void rmap
+            (
+                const pointPatchField<Type>&,
+                const labelList&
+            );
+
+
         // Evaluation functions
 
             //- Update the coefficients associated with the patch field
diff --git a/src/fvOptions/Make/files b/src/fvOptions/Make/files
index 23fdf0282f79f2151a91baac02f4112def7ec7e8..d45448f27aef145edfdb2b669d7cfb2648428d1f 100644
--- a/src/fvOptions/Make/files
+++ b/src/fvOptions/Make/files
@@ -27,6 +27,7 @@ $(derivedSources)/rotorDiskSource/trimModel/trimModel/trimModel.C
 $(derivedSources)/rotorDiskSource/trimModel/trimModel/trimModelNew.C
 $(derivedSources)/rotorDiskSource/trimModel/fixed/fixedTrim.C
 $(derivedSources)/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C
+$(derivedSources)/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C
 
 interRegion = sources/interRegion
 $(interRegion)/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C
@@ -36,6 +37,7 @@ $(interRegion)/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTra
 $(interRegion)/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C
 
 
+
 /* constraints */
 
 generalConstraints=constraints/general
diff --git a/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.C b/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.C
index c0594704656cc756e606f8e843769297949ecc14..48c9b5df2eb36da5454b5e3bec472bfcba489b93 100644
--- a/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.C
+++ b/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.C
@@ -8,10 +8,10 @@
 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 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
@@ -19,10 +19,9 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-\*----------------------------------------------------------------------------*/
+\*---------------------------------------------------------------------------*/
 
 #include "fixedTemperatureConstraint.H"
 #include "fvMesh.H"
diff --git a/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H b/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H
index 0c8cf930c3d498610edf92098c7722adabc5700c..ffce89d754280b20bbb22d5625c2b5f9297b5d27 100644
--- a/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H
+++ b/src/fvOptions/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H
@@ -8,10 +8,10 @@
 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 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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
     Foam::fv::fixedTemperatureConstraint
diff --git a/src/fvOptions/constraints/derived/temperatureLimitsConstraint/temperatureLimitsConstraint.C b/src/fvOptions/constraints/derived/temperatureLimitsConstraint/temperatureLimitsConstraint.C
index 4dcf2249b0eea65ed6f2b90a6883a7a53231346c..7892a41b2ca78cf3ba95f27ef4f0dbb716112a16 100644
--- a/src/fvOptions/constraints/derived/temperatureLimitsConstraint/temperatureLimitsConstraint.C
+++ b/src/fvOptions/constraints/derived/temperatureLimitsConstraint/temperatureLimitsConstraint.C
@@ -8,10 +8,10 @@
 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 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
@@ -19,10 +19,9 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-\*----------------------------------------------------------------------------*/
+\*---------------------------------------------------------------------------*/
 
 #include "temperatureLimitsConstraint.H"
 #include "fvMesh.H"
diff --git a/src/fvOptions/constraints/derived/temperatureLimitsConstraint/temperatureLimitsConstraint.H b/src/fvOptions/constraints/derived/temperatureLimitsConstraint/temperatureLimitsConstraint.H
index cd69e81bda11e8fe57f19dc9d01fe7fa44dcd98d..5ebcd30c18741dcf365941990b7a0edfab973e19 100644
--- a/src/fvOptions/constraints/derived/temperatureLimitsConstraint/temperatureLimitsConstraint.H
+++ b/src/fvOptions/constraints/derived/temperatureLimitsConstraint/temperatureLimitsConstraint.H
@@ -8,10 +8,10 @@
 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 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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
     Foam::fv::temperatureLimitsConstraint
diff --git a/src/fvOptions/fvOptions/fvOption.C b/src/fvOptions/fvOptions/fvOption.C
index 8cb72b8e996b90a89826b037d0781aa5f6b4da5b..1a46a99794a25dd36132dca04e79be3130856857 100644
--- a/src/fvOptions/fvOptions/fvOption.C
+++ b/src/fvOptions/fvOptions/fvOption.C
@@ -193,7 +193,8 @@ void Foam::fv::option::setCellSet()
                             meshToMeshNew::interpolationMethodNames_.read
                             (
                                 dict_.lookup("interpolationMethod")
-                            )
+                            ),
+                            false // not interpolating patches
                         )
                     );
                 }
diff --git a/src/fvOptions/sources/derived/MRFSource/MRFSource.C b/src/fvOptions/sources/derived/MRFSource/MRFSource.C
index 1ab4c39fb18bd8de3cedec0b0fb0265236893025..b3eaa5eafd4734552e2e8584a113bed6eb46d305 100644
--- a/src/fvOptions/sources/derived/MRFSource/MRFSource.C
+++ b/src/fvOptions/sources/derived/MRFSource/MRFSource.C
@@ -8,10 +8,10 @@
 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 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
@@ -19,10 +19,9 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-\*----------------------------------------------------------------------------*/
+\*---------------------------------------------------------------------------*/
 
 #include "MRFSource.H"
 #include "fvMesh.H"
diff --git a/src/fvOptions/sources/derived/MRFSource/MRFSource.H b/src/fvOptions/sources/derived/MRFSource/MRFSource.H
index f2a84dee302657c3838064a3a2b8db76511b5781..7dccdf8c7cd77feda190ee5ec8a239b453503f6f 100644
--- a/src/fvOptions/sources/derived/MRFSource/MRFSource.H
+++ b/src/fvOptions/sources/derived/MRFSource/MRFSource.H
@@ -8,10 +8,10 @@
 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 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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
     Foam::fv::MRFSource
@@ -28,14 +27,18 @@ Class
 Description
     Multiple Reference Frame (MRF) source
 
+    \heading Source usage
+
     Example usage:
+    \verbatim
+    MRFSourceCoeffs
+    {
+        origin      (0 0 0);
+        axis        (0 0 1);
+        omega       104.72;
+    }
+    \endverbatim
 
-        MRFSourceCoeffs
-        {
-            origin      (0 0 0);
-            axis        (0 0 1);
-            omega       104.72;
-        }
 
 SourceFiles
     MRFSource.C
diff --git a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.C b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.C
index a84cdc21540e80cad3c2e2eb0d842adb26719540..be835645517bfc800a9b38093d11df5e20d3fdc2 100644
--- a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.C
+++ b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.C
@@ -8,10 +8,10 @@
 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 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
@@ -19,10 +19,9 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-\*----------------------------------------------------------------------------*/
+\*---------------------------------------------------------------------------*/
 
 #include "actuationDiskSource.H"
 #include "fvMesh.H"
diff --git a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.H b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.H
index ca6734402db4e2f6d46f5d9548883aded4054587..3d95d8f70fdc6549d25afe0a58ee619bd4f58512 100644
--- a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.H
+++ b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSource.H
@@ -8,10 +8,10 @@
 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 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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
     Foam::fv::actuationDiskSource
@@ -29,27 +28,36 @@ Description
     Actuation disk source
 
     Constant values for momentum source for actuation disk
-
-        T = 2*rho*A*sqr(Uo)*a*(1-a)
-        U1 = (1 -a)Uo
+    \f[
+        T = 2 \rho A U_{o}^2 a (1-a)
+    \f]
+    and
+    \f[
+        U_1 = (1 - a)U_{o}
+    \f]
 
     where:
-        A: disk area
-        Uo: upstream velocity
-        a: 1 - Cp/Ct
-        U1: velocity at the disk
-
-    Sources described by:
-
-        actuationDiskSourceCoeffs
-        {
-            fieldNames      (U);        // names of fields to apply source
-            diskDir         (-1 0 0);   // disk direction
-            Cp              0.1;        // power coefficient
-            Ct              0.5;        // thrust coefficient
-            diskArea        5.0;        // disk area
-            upstreamPoint   (0 0 0);    // upstream point
-        }
+    \vartable
+        A   | disk area
+        U_o | upstream velocity
+        a   | 1 - Cp/Ct
+        U_1 | velocity at the disk
+    \endvartable
+
+    \heading Source usage
+
+    Example usage:
+    \verbatim
+    actuationDiskSourceCoeffs
+    {
+        fieldNames      (U);        // names of fields to apply source
+        diskDir         (-1 0 0);   // disk direction
+        Cp              0.1;        // power coefficient
+        Ct              0.5;        // thrust coefficient
+        diskArea        5.0;        // disk area
+        upstreamPoint   (0 0 0);    // upstream point
+    }
+    \endverbatim
 
 
 SourceFiles
diff --git a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSourceTemplates.C b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSourceTemplates.C
index d38a0e48e6910a1e78d857c0f91f799b353f7ccb..191bf9286fe46773955e762ee7ac0c609867e779 100644
--- a/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSourceTemplates.C
+++ b/src/fvOptions/sources/derived/actuationDiskSource/actuationDiskSourceTemplates.C
@@ -8,10 +8,10 @@
 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 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
@@ -19,10 +19,9 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-\*----------------------------------------------------------------------------*/
+\*---------------------------------------------------------------------------*/
 
 #include "actuationDiskSource.H"
 #include "volFields.H"
diff --git a/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C b/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C
new file mode 100644
index 0000000000000000000000000000000000000000..8fc10530958a098ed5682accef84631ca23cf520
--- /dev/null
+++ b/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C
@@ -0,0 +1,334 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "effectivenessHeatExchangerSource.H"
+#include "fvMesh.H"
+#include "fvMatrix.H"
+#include "addToRunTimeSelectionTable.H"
+#include "basicThermo.H"
+#include "coupledPolyPatch.H"
+#include "surfaceInterpolate.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace fv
+{
+    defineTypeNameAndDebug(effectivenessHeatExchangerSource, 0);
+    addToRunTimeSelectionTable
+    (
+        option,
+        effectivenessHeatExchangerSource,
+        dictionary
+    );
+}
+}
+
+
+// * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+void Foam::fv::effectivenessHeatExchangerSource::initialise()
+{
+    const faceZone& fZone = mesh_.faceZones()[zoneID_];
+
+    faceId_.setSize(fZone.size());
+    facePatchId_.setSize(fZone.size());
+    faceSign_.setSize(fZone.size());
+
+    label count = 0;
+    forAll(fZone, i)
+    {
+        label faceI = fZone[i];
+        label faceId = -1;
+        label facePatchId = -1;
+        if (mesh_.isInternalFace(faceI))
+        {
+            faceId = faceI;
+            facePatchId = -1;
+        }
+        else
+        {
+            facePatchId = mesh_.boundaryMesh().whichPatch(faceI);
+            const polyPatch& pp = mesh_.boundaryMesh()[facePatchId];
+            if (isA<coupledPolyPatch>(pp))
+            {
+                if (refCast<const coupledPolyPatch>(pp).owner())
+                {
+                    faceId = pp.whichFace(faceI);
+                }
+                else
+                {
+                    faceId = -1;
+                }
+            }
+            else if (!isA<emptyPolyPatch>(pp))
+            {
+                faceId = faceI - pp.start();
+            }
+            else
+            {
+                faceId = -1;
+                facePatchId = -1;
+            }
+        }
+
+        if (faceId >= 0)
+        {
+            if (fZone.flipMap()[i])
+            {
+                faceSign_[count] = -1;
+            }
+            else
+            {
+                faceSign_[count] = 1;
+            }
+            faceId_[count] = faceId;
+            facePatchId_[count] = facePatchId;
+            count++;
+        }
+    }
+    faceId_.setSize(count);
+    facePatchId_.setSize(count);
+    faceSign_.setSize(count);
+
+    calculateTotalArea(faceZoneArea_);
+}
+
+
+void Foam::fv::effectivenessHeatExchangerSource::calculateTotalArea
+(
+    scalar& area
+)
+{
+    area = 0;
+    forAll(faceId_, i)
+    {
+        label faceI = faceId_[i];
+        if (facePatchId_[i] != -1)
+        {
+            label patchI = facePatchId_[i];
+            area += mesh_.magSf().boundaryField()[patchI][faceI];
+        }
+        else
+        {
+            area += mesh_.magSf()[faceI];
+        }
+    }
+    reduce(area, sumOp<scalar>());
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::fv::effectivenessHeatExchangerSource::effectivenessHeatExchangerSource
+(
+    const word& name,
+    const word& modelType,
+    const dictionary& dict,
+    const fvMesh& mesh
+)
+:
+    option(name, modelType, dict, mesh),
+    secondaryMassFlowRate_(readScalar(coeffs_.lookup("secondaryMassFlowRate"))),
+    secondaryInletT_(readScalar(coeffs_.lookup("secondaryInletT"))),
+    primaryInletT_(readScalar(coeffs_.lookup("primaryInletT"))),
+    eTable_(),
+    UName_(coeffs_.lookupOrDefault<word>("UName", "U")),
+    TName_(coeffs_.lookupOrDefault<word>("TName", "T")),
+    phiName_(coeffs_.lookupOrDefault<word>("phiName", "phi")),
+    faceZoneName_(coeffs_.lookup("faceZone")),
+    zoneID_(mesh_.faceZones().findZoneID(faceZoneName_)),
+    faceId_(),
+    facePatchId_(),
+    faceSign_(),
+    faceZoneArea_(0)
+{
+
+    if (zoneID_ < 0)
+    {
+        FatalErrorIn
+        (
+            "effectivenessHeatExchangerSource::effectivenessHeatExchangerSource"
+            "("
+                "const word&, "
+                "const word&, "
+                "const dictionary&, "
+                "const fvMesh&"
+            ")"
+        )
+            << type() << " " << this->name() << ": "
+            << "    Unknown face zone name: " << faceZoneName_
+            << ". Valid face zones are: " << mesh_.faceZones().names()
+            << nl << exit(FatalError);
+    }
+
+    fieldNames_.setSize(1, "energy");
+    applied_.setSize(1, false);
+
+    eTable_.reset(new interpolation2DTable<scalar>(coeffs_));
+
+    initialise();
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+bool Foam::fv::effectivenessHeatExchangerSource::alwaysApply() const
+{
+    return true;
+}
+
+
+void Foam::fv::effectivenessHeatExchangerSource::addSup
+(
+    fvMatrix<scalar>& eqn,
+    const label
+)
+{
+    const basicThermo& thermo =
+        mesh_.lookupObject<basicThermo>("thermophysicalProperties");
+
+    if (eqn.psi().name() != thermo.he().name())
+    {
+        return;
+    }
+
+    const surfaceScalarField Cpf(fvc::interpolate(thermo.Cp()));
+
+    const surfaceScalarField& phi =
+        mesh_.lookupObject<surfaceScalarField>(phiName_);
+
+    scalar totalphi = 0;
+    scalar CpfMean = 0;
+    forAll(faceId_, i)
+    {
+        label faceI = faceId_[i];
+        if (facePatchId_[i] != -1)
+        {
+            label patchI = facePatchId_[i];
+            totalphi += phi.boundaryField()[patchI][faceI]*faceSign_[i];
+
+            CpfMean +=
+                Cpf.boundaryField()[patchI][faceI]
+               *mesh_.magSf().boundaryField()[patchI][faceI];
+        }
+        else
+        {
+            totalphi += phi[faceI]*faceSign_[i];
+            CpfMean += Cpf[faceI]*mesh_.magSf()[faceI];
+        }
+    }
+    reduce(CpfMean, sumOp<scalar>());
+    reduce(totalphi, sumOp<scalar>());
+
+    scalar Qt =
+        eTable_()(mag(totalphi), secondaryMassFlowRate_)
+       *(secondaryInletT_ - primaryInletT_)
+       *(CpfMean/faceZoneArea_)*mag(totalphi);
+
+    const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
+    const scalarField TCells(T, cells_);
+    scalar Tref = 0;
+    if (Qt > 0)
+    {
+        Tref = max(TCells);
+        reduce(Tref, maxOp<scalar>());
+    }
+    else
+    {
+        Tref = min(TCells);
+        reduce(Tref, minOp<scalar>());
+    }
+
+    scalarField deltaTCells(cells_.size(), 0);
+    forAll(deltaTCells, i)
+    {
+        if (Qt > 0)
+        {
+            deltaTCells[i] = max(Tref - TCells[i], 0.0);
+        }
+        else
+        {
+            deltaTCells[i] = max(TCells[i] - Tref, 0.0);
+        }
+    }
+
+    const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
+    const scalarField& V = mesh_.V();
+    scalar sumWeight = 0;
+    forAll(cells_, i)
+    {
+        sumWeight += V[cells_[i]]*mag(U[cells_[i]])*deltaTCells[i];
+    }
+    reduce(sumWeight, sumOp<scalar>());
+
+    if (this->V() > VSMALL && mag(Qt) > VSMALL)
+    {
+        scalarField& heSource = eqn.source();
+
+        forAll(cells_, i)
+        {
+            heSource[cells_[i]] -=
+                Qt*V[cells_[i]]*mag(U[cells_[i]])*deltaTCells[i]/sumWeight;
+        }
+    }
+
+    if (debug && Pstream::master())
+    {
+        Info<< indent << "Net mass flux [Kg/s] = " << totalphi << nl;
+        Info<< indent << "Total energy exchange [W] = " << Qt << nl;
+        Info<< indent << "Tref [K] = " << Tref << nl;
+        Info<< indent << "Efficiency : "
+            << eTable_()(mag(totalphi), secondaryMassFlowRate_) << endl;
+    }
+}
+
+
+void Foam::fv::effectivenessHeatExchangerSource::writeData(Ostream& os) const
+{
+    os  << indent << name_ << endl;
+    dict_.write(os);
+}
+
+
+bool Foam::fv::effectivenessHeatExchangerSource::read(const dictionary& dict)
+{
+    if (option::read(dict))
+    {
+        coeffs_.lookup("secondaryMassFlowRate") >> secondaryMassFlowRate_;
+        coeffs_.lookup("secondaryInletT") >> secondaryInletT_;
+        coeffs_.lookup("primaryInletT") >> primaryInletT_;
+
+        return true;
+    }
+    else
+    {
+        return false;
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.H b/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.H
new file mode 100644
index 0000000000000000000000000000000000000000..d5ee68b61ff60d6f98c652573b4eae3bae47c390
--- /dev/null
+++ b/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.H
@@ -0,0 +1,240 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+Class
+    Foam::fv::effectivenessHeatExchangerSource
+
+Description
+    Heat exchanger source model, in which the heat exchanger is defined as a
+    selection of cells.
+
+    The total heat exchange source is given by:
+    \f[
+        Q_t = e(\phi, \dot{m}_2) (T_2 - T_1) \phi c_p
+    \f]
+
+    where:
+    \vartable
+        Q_t       | total heat source
+        e(\phi,\dot{m}_2) | effectivenes table
+        \phi      | net mass flux entering heat exchanger [kg/s]
+        \dot{m}_2 | secondary mass flow rate [kg/s]
+        T_1       | primary inlet temperature [K]
+        T_2       | secondary inlet temperature [K]
+        c_p       | specific heat capacity [J/kg/K]
+    \endvartable
+
+
+    The distribution inside the hear exchanger is given by:
+    \f[
+        Q_c = \frac{V_c |U_c| (T_c - T_{ref})}{\sum(V_c |U_c| (T_c - T_{ref}))}
+    \f]
+
+    where:
+    \vartable
+        Q_c     | source for cell
+        V_c     | volume of the cell [m3]
+        U_c     | local cell velocity [m/s]
+        T_c     | local call temperature [K]
+        T_{ref} | min or max(T) in cell zone depending on the sign of Q_t [K]
+    \endvartable
+
+    \heading Source usage
+
+    Example usage:
+    \verbatim
+    effectivenessHeatExchangerSource1
+    {
+        type            effectivenessHeatExchangerSource;
+        active          true;
+        selectionMode   cellZone;
+        cellZone        porosity;
+
+        effectivenessHeatExchangerSourceCoeffs
+        {
+            secondaryMassFlowRate   1.0;
+            secondaryInletT         336;
+            primaryInletT           293;
+            faceZone                facesZoneInletOriented;
+            outOfBounds             clamp;
+            fileName                "effTable";
+        }
+    }
+    \endverbatim
+
+Note
+- the table with name "fileName" should have the same units as the
+  secondary mass flow rate and kg/s for phi
+- faceZone is the faces at the inlet of the cellzone, it needs to be
+  created with flip map flags. It is used to integrate the net mass flow
+  rate into the heat exchanger
+
+
+SourceFiles
+    effectivenessHeatExchangerSource.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef effectivenessHeatExchangerSource_H
+#define effectivenessHeatExchangerSource_H
+
+#include "fvOption.H"
+#include "autoPtr.H"
+#include "interpolation2DTable.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace fv
+{
+
+/*---------------------------------------------------------------------------*\
+              Class effectivenessHeatExchangerSource Declaration
+\*---------------------------------------------------------------------------*/
+
+class effectivenessHeatExchangerSource
+:
+    public option
+{
+
+protected:
+
+    // Protected data
+
+        //- Secondary flow mass rate [kg/s]
+        scalar secondaryMassFlowRate_;
+
+        //- Inlet secondary temperature [K]
+        scalar secondaryInletT_;
+
+        //- Primary air temperature at the heat exchanger inlet [K]
+        scalar primaryInletT_;
+
+        //- 2D look up table efficiency = function of primary and secondary
+        // mass flow rates [kg/s]
+        autoPtr<interpolation2DTable<scalar> > eTable_;
+
+        //- Name of velocity field; default = U
+        word UName_;
+
+        //- Name of temperature field; default = T
+        word TName_;
+
+        //- Name of the flux
+        word phiName_;
+
+        //- Name of the faceZone at the heat exchange inlet
+        word faceZoneName_;
+
+        //- Id for the face zone
+        label zoneID_;
+
+         //- Local list of face IDs
+        labelList faceId_;
+
+        //- Local list of patch ID per face
+        labelList facePatchId_;
+
+        //- List of +1/-1 representing face flip map (1 use as is, -1 negate)
+        labelList faceSign_;
+
+        //- Area of the face zone
+        scalar faceZoneArea_;
+
+
+private:
+
+    // Private Member Functions
+
+
+        //- Disallow default bitwise copy construct
+        effectivenessHeatExchangerSource
+        (
+            const effectivenessHeatExchangerSource&
+        );
+
+        //- Disallow default bitwise assignment
+        void operator=(const effectivenessHeatExchangerSource&);
+
+        //- Initialise heat exchanger source model
+        void initialise();
+
+        //- Calculate total area of faceZone accross processors
+        void calculateTotalArea(scalar& area);
+
+
+public:
+
+    //- Runtime type information
+    TypeName("effectivenessHeatExchangerSource");
+
+
+    // Constructors
+
+        //- Construct from components
+        effectivenessHeatExchangerSource
+        (
+            const word& name,
+            const word& modelType,
+            const dictionary& dict,
+            const fvMesh& mesh
+        );
+
+
+    //- Destructor
+    virtual ~effectivenessHeatExchangerSource()
+    {}
+
+
+    // Member Functions
+
+        virtual bool alwaysApply() const;
+
+
+        // Public Functions
+
+            //- Source term to fvMatrix<scalar>
+            virtual void addSup(fvMatrix<scalar>& eqn, const label fieldI);
+
+
+        // I-O
+
+            //- Write data
+            virtual void writeData(Ostream&) const;
+
+            //- Read dictionary
+            virtual bool read(const dictionary& dict);
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace fv
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.C b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.C
index 87c5268eeda8e6700b9b34d8ac53c7bff7c4c0b6..c398085a0a6bd1291c8ef7bb432d8e9f17cce0d8 100644
--- a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.C
+++ b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.C
@@ -8,10 +8,10 @@
 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 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
@@ -19,10 +19,9 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-\*----------------------------------------------------------------------------*/
+\*---------------------------------------------------------------------------*/
 
 #include "explicitPorositySource.H"
 #include "fvMesh.H"
diff --git a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H
index 2bd602ac1f4b41205ad964cefe23df6082c02cf4..a89503ecf7fac326fa00cc1d430d03bfb31afafa 100644
--- a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H
+++ b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H
@@ -8,10 +8,10 @@
 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 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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
     Foam::fv::explicitPorositySource
@@ -28,23 +27,26 @@ Class
 Description
     Explicit porosity source
 
-    Sources described by, for example using the DarcyForchheimer model:
+    \heading Source usage
 
-        explicitPorositySourceCoeffs
+    Example usage, here employing the Darcy-Forchheimer model:
+    \verbatim
+    explicitPorositySourceCoeffs
+    {
+        type            DarcyForchheimer;
+        DarcyForchheimerCoeffs
         {
-            type            DarcyForchheimer;
-            DarcyForchheimerCoeffs
+            d   d [0 -2 0 0 0 0 0] (5e7 -1000 -1000);
+            f   f [0 -1 0 0 0 0 0] (0 0 0);
+
+            coordinateSystem
             {
-                d   d [0 -2 0 0 0 0 0] (5e7 -1000 -1000);
-                f   f [0 -1 0 0 0 0 0] (0 0 0);
-
-                coordinateSystem
-                {
-                    e1  (0.70710678 0.70710678 0);
-                    e2  (0 0 1);
-                }
+                e1  (0.70710678 0.70710678 0);
+                e2  (0 0 1);
             }
         }
+    }
+    \endverbatim
 
 Note:
     The porous region must be selected as a cellZone.
diff --git a/src/fvOptions/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C b/src/fvOptions/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C
index 896b78478534a3f305edc29f63dfe80633215600..380f177937a47e4f0ddb01195ab9184bc68b08ef 100644
--- a/src/fvOptions/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C
+++ b/src/fvOptions/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C
@@ -217,7 +217,7 @@ void Foam::fv::pressureGradientExplicitSource::setValue
             (
                 IOobject
                 (
-                    name_ + ".invA",
+                    name_ + ":invA",
                     mesh_.time().timeName(),
                     mesh_,
                     IOobject::NO_READ,
diff --git a/src/fvOptions/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.H b/src/fvOptions/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.H
index 47a48a24c04a8a810645e01104f6256525af8361..0b8390f9f900f58d564baf8f6e1bbc6507bf1f97 100644
--- a/src/fvOptions/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.H
+++ b/src/fvOptions/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.H
@@ -29,15 +29,17 @@ Description
 
     Note: Currently only handles kinematic pressure
 
-    Sources described by:
-
-        pressureGradientExplicitSourceCoeffs
-        {
-            fieldNames  (U);        // name of velocity field
-            Ubar        (10.0 0 0); // desired average velocity
-            gradPini    gradPini [0 2 -2 0 0] 0; // initial pressure gradient
-            flowDir     (1 0 0);    // flow direction
-        }
+    \heading Source usage
+    Example usage:
+    \verbatim
+    pressureGradientExplicitSourceCoeffs
+    {
+        fieldNames  (U);                        // name of velocity field
+        Ubar        (10.0 0 0);                 // desired average velocity
+        gradPini    gradPini [0 2 -2 0 0] 0;    // initial pressure gradient
+        flowDir     (1 0 0);                    // flow direction
+    }
+    \endverbatim
 
 
 SourceFiles
diff --git a/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.C b/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.C
index e5316f35519add8d467fdfedd9eb14a3fca98119..791e55e5f19c24514c6da9e6743cd6da0ce8b380 100644
--- a/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.C
+++ b/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.C
@@ -8,10 +8,10 @@
 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 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
@@ -19,10 +19,9 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-\*----------------------------------------------------------------------------*/
+\*---------------------------------------------------------------------------*/
 
 #include "radialActuationDiskSource.H"
 #include "geometricOneField.H"
diff --git a/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.H b/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.H
index 02a2970e8c812cb806c11bec24719c172ccbc317..3fb20e45d555341b35eaee16709ea424fef87b43 100644
--- a/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.H
+++ b/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSource.H
@@ -8,10 +8,10 @@
 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 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
@@ -19,42 +19,52 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
     Foam::fv::radialActuationDiskSource
 
 Description
-    Actuation disk zone definition.
-    Constant values for momentum source for actuation disk
+    Actuation disk source including radial thrust
 
-        T = 2*rho*A*sqr(Uo)*a*(1-a)
-        U1 = (1 -a)Uo
+    Constant values for momentum source for actuation disk
+    \f[
+        T = 2 \rho A U_{o}^2 a (1-a)
+    \f]
+    and
+    \f[
+        U_1 = (1 - a)U_{o}
+    \f]
 
     where:
-        A: disk area
-        Uo: upstream velocity
-        a: 1 - Cp/Ct
-        U1: velocity at the disk
+    \vartable
+        A   | disk area
+        U_o | upstream velocity
+        a   | 1 - Cp/Ct
+        U_1 | velocity at the disk
+    \endvartable
 
 
     The thrust is distributed by a radial function:
-
-        thrust(r) = T*(C0 + C1*r^2 + C2*r^4)
-
-    Sources described by:
-
-        actuationDiskSourceCoeffs
-        {
-            fieldName       U;          // name of field to apply source
-            diskDir         (-1 0 0);   // disk direction
-            Cp              0.1;        // power coefficient
-            Ct              0.5;        // thrust coefficient
-            diskArea        5.0;        // disk area
-            coeffs          (0.1 0.5 0.01); // radial distribution coefficients
-            upstreamPoint   (0 0 0);    // upstream point
-        }
+    \f[
+        thrust(r) = T (C_0 + C_1 r^2 + C_2 r^4)
+    \f]
+
+    \heading Source usage
+
+    Example usage:
+    \verbatim
+    actuationDiskSourceCoeffs
+    {
+        fieldName       U;          // name of field to apply source
+        diskDir         (-1 0 0);   // disk direction
+        Cp              0.1;        // power coefficient
+        Ct              0.5;        // thrust coefficient
+        diskArea        5.0;        // disk area
+        coeffs          (0.1 0.5 0.01); // radial distribution coefficients
+        upstreamPoint   (0 0 0);    // upstream point
+    }
+    \endverbatim
 
 
 SourceFiles
diff --git a/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSourceTemplates.C b/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSourceTemplates.C
index f9e1a894b60df6c6150b250a3b3a2d7a7f17dcdd..65290d600f68fd3880b2fa83566c0c87936a0c92 100644
--- a/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSourceTemplates.C
+++ b/src/fvOptions/sources/derived/radialActuationDiskSource/radialActuationDiskSourceTemplates.C
@@ -8,10 +8,10 @@
 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 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
@@ -19,10 +19,9 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-\*----------------------------------------------------------------------------*/
+\*---------------------------------------------------------------------------*/
 
 #include "radialActuationDiskSource.H"
 #include "volFields.H"
diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C
index 7896ae5dda5d69fe7467cf5d4388d82e19c51427..9ce537b7663b9ca23a1f4ea8df812655672966cf 100644
--- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C
+++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C
@@ -203,7 +203,7 @@ void Foam::fv::rotorDiskSource::setFaceArea(vector& axis, const bool correct)
             {
                 const label faceI = pp.start() + j;
                 const label own = cellAddr[mesh_.faceOwner()[faceI]];
-                const bool nbr = nbrFaceCellAddr[faceI - nInternalFaces];
+                const label nbr = nbrFaceCellAddr[faceI - nInternalFaces];
                 const vector nf = Sfp[j]/magSfp[j];
 
                 if ((own != -1) && (nbr == -1) && ((nf & axis) > tol))
diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H
index 70775644dbd0a092165d1cf5f93e586f3033504f..1ac30fcfb8a434ee3bf0621cd7fc88b673c16e49 100644
--- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H
+++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H
@@ -30,52 +30,54 @@ Description
     Source approximates the mean effects of rotor forces on a cylindrical
     region within the domain
 
-    Sources described by:
+    \heading Source usage
 
-        rotorDiskSourceCoeffs
-        {
-            fieldNames      (U);    // names of fields on which to apply source
-            rhoName         rho;    // density field if compressible case
-            nBlades         3;      // number of blades
-            tipEffect       0.96;   // normalised radius above which lift = 0
+    Example usage:
+    \verbatim
+    rotorDiskSourceCoeffs
+    {
+        fieldNames      (U);    // names of fields on which to apply source
+        rhoName         rho;    // density field if compressible case
+        nBlades         3;      // number of blades
+        tipEffect       0.96;   // normalised radius above which lift = 0
 
-            inletFlowType   local;  // inlet flow type specification
+        inletFlowType   local;  // inlet flow type specification
 
-            geometryMode    auto;   // geometry specification
+        geometryMode    auto;   // geometry specification
 
-            refDirection    (-1 0 0); // reference direction
-                                      // - used as reference for psi angle
+        refDirection    (-1 0 0); // reference direction
+                                  // - used as reference for psi angle
 
-            trimModel       fixed;  // fixed || targetForce
+        trimModel       fixed;  // fixed || targetForce
 
-            flapCoeffs
-            {
-                beta0           0;  // coning angle [deg]
-                beta1c          0;  // lateral flapping coeff (cos coeff)
-                beta2s          0;  // longitudinal flapping coeff (sin coeff)
-            }
+        flapCoeffs
+        {
+            beta0           0;  // coning angle [deg]
+            beta1c          0;  // lateral flapping coeff (cos coeff)
+            beta2s          0;  // longitudinal flapping coeff (sin coeff)
+        }
 
-            blade
-            {
-                ...
-            }
+        blade
+        {
+            ...
+        }
 
-            profiles
-            {
-                ...
-            }
+        profiles
+        {
+            ...
         }
+    }
+    \endverbatim
 
     Where:
-
-        geometryMode =
-            auto          : determine rototor co-ord system from cells
-            specified     : specified co-ord system
-
-        inletFlowType =
-            fixed         : specified velocity
-            surfaceNormal : specified normal velocity (positive towards rotor)
-            local         : use local flow conditions
+    Valid options for the \c geometryMode entry include:
+    - auto          : determine rototor co-ord system from cells
+    - specified     : specified co-ord system
+
+    Valid options for the \c inletFlowType entry include:
+    - fixed         : specified velocity
+    - local         : use local flow conditions
+    - surfaceNormal : specified normal velocity (positive towards rotor)
 
 
 SourceFiles
diff --git a/src/fvOptions/sources/general/codedSource/CodedSource.H b/src/fvOptions/sources/general/codedSource/CodedSource.H
index bbc93e5aec12e250703111d58fb8a24e340bc767..e414bc1e02c3289bb05187d025fdf97e0386e02a 100644
--- a/src/fvOptions/sources/general/codedSource/CodedSource.H
+++ b/src/fvOptions/sources/general/codedSource/CodedSource.H
@@ -25,52 +25,46 @@ Class
     Foam::fv::codedSource
 
 Description
-    Constructs on-the-fly a new fvOption.
+    Constructs on-the-fly source
 
-    E.g. in system/fvOptions
+    \heading Source usage
 
-    momentumSource
+    Example usage:
+    \verbatim
+    vectorCodedSourceCoeffs
     {
-        type            vectorCodedSource;
-        active          on;            //on/off switch
-        timeStart       0.0;           //start time
-        duration        1000000.0;     //duration
-        selectionMode   all;       //cellSet // points //cellZone
-
-        vectorCodedSourceCoeffs
-        {
-            fieldNames  (U);
-            redirectType    ramp;
-
-            codeCorrect
-            #{
-                Pout<< "**codeCorrect**" << endl;
-            #};
-
-            codeAddSup
-            #{
-                Pout<< "**codeAddSup**" << endl;
-            #};
-
-            codeSetValue
-            #{
-                Pout<< "**codeSetValue**" << endl;
-            #};
-
-            // Dummy entry. Make dependent on above to trigger recompilation
-            code
-            #{
-                $codeCorrect
-                $codeAddSup
-                $codeSetValue
-            #};
-        }
-
-        // Dummy entry
-        rampCoeffs
-        {}
+        fieldNames  (U);
+        redirectType    ramp;
+
+        codeCorrect
+        #{
+            Pout<< "**codeCorrect**" << endl;
+        #};
+
+        codeAddSup
+        #{
+            Pout<< "**codeAddSup**" << endl;
+        #};
+
+        codeSetValue
+        #{
+            Pout<< "**codeSetValue**" << endl;
+        #};
+
+        // Dummy entry. Make dependent on above to trigger recompilation
+        code
+        #{
+            $codeCorrect
+            $codeAddSup
+            $codeSetValue
+        #};
     }
 
+    // Dummy entry
+    rampCoeffs
+    {}
+    \endverbatim
+
 
 SourceFiles
     codedSource.C
diff --git a/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.H b/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.H
index 0a806fcdf920abccc3a2e07c53afb8764c9c7314..f956b8fb3e15ccecc5f87f9bbc45fc0e295a8c7f 100644
--- a/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.H
+++ b/src/fvOptions/sources/general/semiImplicitSource/SemiImplicitSource.H
@@ -51,7 +51,7 @@ Description
             epsilon     (1.5  0);
         }
     }
-    \verbatim
+    \endverbatim
 
     Valid options for the \c volumeMode entry include:
     - absolute: values are given as \<quantity\>
diff --git a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C
index 0c0cf7f284dba71aee14c85870798039f91006d1..799a901bae9ecebd023dd21ee5f37fe2891b9bab 100644
--- a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C
+++ b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C
@@ -8,10 +8,10 @@
 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 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
@@ -19,10 +19,9 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
-\*----------------------------------------------------------------------------*/
+\*---------------------------------------------------------------------------*/
 
 #include "interRegionExplicitPorositySource.H"
 #include "fvMesh.H"
@@ -55,7 +54,7 @@ void Foam::fv::interRegionExplicitPorositySource::initialise()
         return;
     }
 
-    const word zoneName(name_ + ".porous");
+    const word zoneName(name_ + ":porous");
 
     const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName_);
     const cellZoneMesh& cellZones = nbrMesh.cellZones();
@@ -152,7 +151,7 @@ void Foam::fv::interRegionExplicitPorositySource::addSup
     (
         IOobject
         (
-            name_ + ".UNbr",
+            name_ + ":UNbr",
             nbrMesh.time().timeName(),
             nbrMesh,
             IOobject::NO_READ,
diff --git a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H
index da93314a0a1c58e4541a7f76ce788c282fbdabdd..84fac78b8f7af20d90ac0d9464e417cf670a4db7 100644
--- a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H
+++ b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H
@@ -8,10 +8,10 @@
 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 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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
     Foam::fv::interRegionExplicitPorositySource
diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C
index 710a43cf3eced30de48c54b0d74e14970ec6bb11..d1b085f1574d0db0739ad138d8260641c57beedf 100644
--- a/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C
+++ b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C
@@ -78,6 +78,9 @@ void Foam::fv::interRegionHeatTransferModel::setNbrModel()
     }
 
     firstIter_ = false;
+
+    // set nbr model's nbr model to avoid construction order problems
+    nbrModel_->setNbrModel();
 }
 
 
@@ -118,7 +121,7 @@ Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel
     (
         IOobject
         (
-            type() + ".htc",
+            type() + ":htc",
             mesh.time().timeName(),
             mesh,
             IOobject::NO_READ,
@@ -177,7 +180,7 @@ void Foam::fv::interRegionHeatTransferModel::addSup
         (
             IOobject
             (
-                type() + ".Tmapped",
+                type() + ":Tmapped",
                 mesh_.time().timeName(),
                 mesh_,
                 IOobject::NO_READ,
diff --git a/src/lagrangian/basic/particle/particle.H b/src/lagrangian/basic/particle/particle.H
index 51f008e2d137bc0e847247bc329ed93fdb3c8d2d..cf293c5691c45b3650661eb863b77431a36e0b98 100644
--- a/src/lagrangian/basic/particle/particle.H
+++ b/src/lagrangian/basic/particle/particle.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelIO.C b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelIO.C
index 7ec34aad080ab6de1c8c769ee05b61c82cfb2666..378e58621f97eef9f360c7eb6f3ca2060f0a59c3 100644
--- a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelIO.C
+++ b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelIO.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -30,7 +30,7 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class ParcelType>
+template<class ParcelType>
 Foam::DsmcParcel<ParcelType>::DsmcParcel
 (
     const polyMesh& mesh,
diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C
index f7672204d0f5be1a09e68410994d025f00326ff4..9c0540bd0b5c22cb3317bc75497bda8407487d0c 100644
--- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C
+++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -30,7 +30,7 @@ using namespace Foam::constant::mathematical;
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::scalar Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::energyRatio
 (
     scalar ChiA,
@@ -91,7 +91,7 @@ Foam::scalar Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::energyRatio
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::
 LarsenBorgnakkeVariableHardSphere
 (
@@ -110,7 +110,7 @@ LarsenBorgnakkeVariableHardSphere
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::
 ~LarsenBorgnakkeVariableHardSphere()
 {}
@@ -125,7 +125,7 @@ bool Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::active() const
 }
 
 
-template <class CloudType>
+template<class CloudType>
 Foam::scalar Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::sigmaTcR
 (
     const typename CloudType::parcelType& pP,
@@ -174,7 +174,7 @@ Foam::scalar Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::sigmaTcR
 }
 
 
-template <class CloudType>
+template<class CloudType>
 void Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::collide
 (
     typename CloudType::parcelType& pP,
diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.H b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.H
index 1de6688aa8f90554f79c50e54a3736285d6be72e..1f65db3877e4a41836920b4928a95e44185376a3 100644
--- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.H
+++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -20,6 +20,7 @@ License
 
     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::LarsenBorgnakkeVariableHardSphere
 
diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/NoBinaryCollision/NoBinaryCollision.C b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/NoBinaryCollision/NoBinaryCollision.C
index f5fc9ec0384d6accfd6e78d41fdbf05ef668cf8c..2f2de553197d1be2f65f3697261015d80ffdb4b6 100644
--- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/NoBinaryCollision/NoBinaryCollision.C
+++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/NoBinaryCollision/NoBinaryCollision.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
@@ -30,7 +30,7 @@ using namespace Foam::constant::mathematical;
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::NoBinaryCollision<CloudType>::NoBinaryCollision
 (
     const dictionary& dict,
@@ -43,7 +43,7 @@ Foam::NoBinaryCollision<CloudType>::NoBinaryCollision
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::NoBinaryCollision<CloudType>::~NoBinaryCollision()
 {}
 
@@ -57,7 +57,7 @@ bool Foam::NoBinaryCollision<CloudType>::active() const
 }
 
 
-template <class CloudType>
+template<class CloudType>
 Foam::scalar Foam::NoBinaryCollision<CloudType>::sigmaTcR
 (
     const typename CloudType::parcelType& pP,
@@ -82,7 +82,7 @@ Foam::scalar Foam::NoBinaryCollision<CloudType>::sigmaTcR
 }
 
 
-template <class CloudType>
+template<class CloudType>
 void Foam::NoBinaryCollision<CloudType>::collide
 (
     typename CloudType::parcelType& pP,
diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/NoBinaryCollision/NoBinaryCollision.H b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/NoBinaryCollision/NoBinaryCollision.H
index 415760177466ee27dde08f5e4f2af0b9fd7ffe28..54e325ba6fb82e93eb25cec81597e24c87ec57ff 100644
--- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/NoBinaryCollision/NoBinaryCollision.H
+++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/NoBinaryCollision/NoBinaryCollision.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -20,6 +20,7 @@ License
 
     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::NoBinaryCollision
 
diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C
index 1aa69335e1ea36c10bc496266ef0854adbba29f0..53bd85065ad422af316aa10d93b129cb63b2cdc9 100644
--- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C
+++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -30,7 +30,7 @@ using namespace Foam::constant::mathematical;
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::VariableHardSphere<CloudType>::VariableHardSphere
 (
     const dictionary& dict,
@@ -44,7 +44,7 @@ Foam::VariableHardSphere<CloudType>::VariableHardSphere
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::VariableHardSphere<CloudType>::~VariableHardSphere()
 {}
 
@@ -58,7 +58,7 @@ bool Foam::VariableHardSphere<CloudType>::active() const
 }
 
 
-template <class CloudType>
+template<class CloudType>
 Foam::scalar Foam::VariableHardSphere<CloudType>::sigmaTcR
 (
     const typename CloudType::parcelType& pP,
@@ -107,7 +107,7 @@ Foam::scalar Foam::VariableHardSphere<CloudType>::sigmaTcR
 }
 
 
-template <class CloudType>
+template<class CloudType>
 void Foam::VariableHardSphere<CloudType>::collide
 (
     typename CloudType::parcelType& pP,
diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.H b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.H
index b410d6d9b51390724935cf6e12d527c4f86e17cd..53c5cbf4400407d1d3026246945abf61ec3c4e4a 100644
--- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.H
+++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -20,6 +20,7 @@ License
 
     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::VariableHardSphere
 
diff --git a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C
index 34ceb5744d811421bb13c08c908866d7c8c33b1e..725c97f3827df949196a1b595b62a0b9f433c54a 100644
--- a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C
+++ b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -32,7 +32,7 @@ using namespace Foam::constant::mathematical;
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::FreeStream<CloudType>::FreeStream
 (
     const dictionary& dict,
@@ -116,14 +116,14 @@ Foam::FreeStream<CloudType>::FreeStream
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::FreeStream<CloudType>::~FreeStream()
 {}
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 void Foam::FreeStream<CloudType>::inflow()
 {
     CloudType& cloud(this->owner());
diff --git a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/NoInflow/NoInflow.C b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/NoInflow/NoInflow.C
index 3450c9ca4c77782147dbf6041425bb38ed0bf993..2e66fbbb88c5efd776be3e8be81510727265fc54 100644
--- a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/NoInflow/NoInflow.C
+++ b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/NoInflow/NoInflow.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::NoInflow<CloudType>::NoInflow
 (
     const dictionary& dict,
@@ -40,14 +40,14 @@ Foam::NoInflow<CloudType>::NoInflow
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::NoInflow<CloudType>::~NoInflow()
 {}
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 void Foam::NoInflow<CloudType>::inflow()
 {}
 
diff --git a/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.C b/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.C
index 27faac9e72482c58b2a61a7f9e7a0f10461b4bc8..bad0545f1ad62b3a84d10ff3c47232268b501e23 100644
--- a/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.C
+++ b/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -30,7 +30,7 @@ using namespace Foam::constant;
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::MaxwellianThermal<CloudType>::MaxwellianThermal
 (
     const dictionary& dict,
@@ -43,14 +43,14 @@ Foam::MaxwellianThermal<CloudType>::MaxwellianThermal
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::MaxwellianThermal<CloudType>::~MaxwellianThermal()
 {}
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 void Foam::MaxwellianThermal<CloudType>::correct
 (
     typename CloudType::parcelType& p,
diff --git a/src/lagrangian/dsmc/submodels/WallInteractionModel/MixedDiffuseSpecular/MixedDiffuseSpecular.C b/src/lagrangian/dsmc/submodels/WallInteractionModel/MixedDiffuseSpecular/MixedDiffuseSpecular.C
index da0ec1b0827904b838bcd3d14e93d8fc4229418c..19273a756e9c2c8f9343bbd0a792cebdbc54c189 100644
--- a/src/lagrangian/dsmc/submodels/WallInteractionModel/MixedDiffuseSpecular/MixedDiffuseSpecular.C
+++ b/src/lagrangian/dsmc/submodels/WallInteractionModel/MixedDiffuseSpecular/MixedDiffuseSpecular.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::MixedDiffuseSpecular<CloudType>::MixedDiffuseSpecular
 (
     const dictionary& dict,
@@ -41,14 +41,14 @@ Foam::MixedDiffuseSpecular<CloudType>::MixedDiffuseSpecular
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::MixedDiffuseSpecular<CloudType>::~MixedDiffuseSpecular()
 {}
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 void Foam::MixedDiffuseSpecular<CloudType>::correct
 (
     typename CloudType::parcelType& p,
diff --git a/src/lagrangian/dsmc/submodels/WallInteractionModel/SpecularReflection/SpecularReflection.C b/src/lagrangian/dsmc/submodels/WallInteractionModel/SpecularReflection/SpecularReflection.C
index 06b12fbafbe068f5b6e5e9b28285503b3049ef01..1161600af5fefe7d13c297b7bdf71164e071790d 100644
--- a/src/lagrangian/dsmc/submodels/WallInteractionModel/SpecularReflection/SpecularReflection.C
+++ b/src/lagrangian/dsmc/submodels/WallInteractionModel/SpecularReflection/SpecularReflection.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -29,7 +29,7 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::SpecularReflection<CloudType>::SpecularReflection
 (
     const dictionary& dict,
@@ -42,14 +42,14 @@ Foam::SpecularReflection<CloudType>::SpecularReflection
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::SpecularReflection<CloudType>::~SpecularReflection()
 {}
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 void Foam::SpecularReflection<CloudType>::correct
 (
     typename CloudType::parcelType& p,
diff --git a/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationScheme.H b/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationScheme.H
index 7293a4b22b72396816b026baaf43c78eb01be282..068f7e8c861ae3d3aebcff5eb0d31ff6811cf4f2 100644
--- a/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationScheme.H
+++ b/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationScheme.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,6 @@ License
     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::IntegrationScheme
 
diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C
index e9cd4a0ac8552bcfc6e6f3cf821a57ff15e61086..03765b5c5720eefd46be227fb87b188d6382c18a 100644
--- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C
+++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.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
@@ -346,7 +346,7 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
         (
             IOobject
             (
-                this->name() + ".UTrans",
+                this->name() + ":UTrans",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::READ_IF_PRESENT,
@@ -362,7 +362,7 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
         (
             IOobject
             (
-                this->name() + ".UCoeff",
+                this->name() + ":UCoeff",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::READ_IF_PRESENT,
@@ -426,7 +426,7 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
         (
             IOobject
             (
-                this->name() + ".UTrans",
+                this->name() + ":UTrans",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::NO_READ,
@@ -442,7 +442,7 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
         (
             IOobject
             (
-                name + ".UCoeff",
+                name + ":UCoeff",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::NO_READ,
diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H
index be67f1829268a8dd7519f182512d64179bcdca32..7e50b0b67c26427ea6393b612ced236c8979b09d 100644
--- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H
+++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H
@@ -372,8 +372,14 @@ inline Foam::scalar Foam::KinematicCloud<CloudType>::penetration
     }
 
     // lists of parcels mass and distance from initial injection point
-    List<scalar> mass(nParcel, 0.0);
-    List<scalar> dist(nParcel, 0.0);
+    List<List<scalar> > procMass(Pstream::nProcs());
+    List<List<scalar> > procDist(Pstream::nProcs());
+
+    List<scalar>& mass = procMass[Pstream::myProcNo()];
+    List<scalar>& dist = procDist[Pstream::myProcNo()];
+
+    mass.setSize(nParcel);
+    dist.setSize(nParcel);
 
     label i = 0;
     scalar mSum = 0.0;
@@ -392,75 +398,86 @@ inline Foam::scalar Foam::KinematicCloud<CloudType>::penetration
 
     // calculate total mass across all processors
     reduce(mSum, sumOp<scalar>());
+    Pstream::gatherList(procMass);
+    Pstream::gatherList(procDist);
 
-    // flatten the mass list
-    List<scalar> allMass(nParcelSum, 0.0);
-    SubList<scalar>
-    (
-        allMass,
-        globalParcels.localSize(Pstream::myProcNo()),
-        globalParcels.offset(Pstream::myProcNo())
-    ).assign(mass);
-
-    // flatten the distance list
-    SortableList<scalar> allDist(nParcelSum, 0.0);
-    SubList<scalar>
-    (
-        allDist,
-        globalParcels.localSize(Pstream::myProcNo()),
-        globalParcels.offset(Pstream::myProcNo())
-    ).assign(dist);
-
-    // sort allDist distances into ascending order
-    // note: allMass masses are left unsorted
-    allDist.sort();
-
-    if (nParcelSum > 1)
+    if (Pstream::master())
     {
-        const scalar mLimit = fraction*mSum;
-        const labelList& indices = allDist.indices();
-
-        if (mLimit > (mSum - allMass[indices.last()]))
+        // flatten the mass lists
+        List<scalar> allMass(nParcelSum, 0.0);
+        SortableList<scalar> allDist(nParcelSum, 0.0);
+        for (label procI = 0; procI < Pstream::nProcs(); procI++)
         {
-            distance = allDist.last();
-        }
-        else
-        {
-            // assuming that 'fraction' is generally closer to 1 than 0, loop
-            // through in reverse distance order
-            const scalar mThreshold = (1.0 - fraction)*mSum;
-            scalar mCurrent = 0.0;
-            label i0 = 0;
+            SubList<scalar>
+            (
+                allMass,
+                globalParcels.localSize(procI),
+                globalParcels.offset(procI)
+            ).assign(procMass[procI]);
 
-            forAllReverse(indices, i)
-            {
-                label indI = indices[i];
+            // flatten the distance list
+            SubList<scalar>
+            (
+                allDist,
+                globalParcels.localSize(procI),
+                globalParcels.offset(procI)
+            ).assign(procDist[procI]);
+        }
 
-                mCurrent += allMass[indI];
+        // sort allDist distances into ascending order
+        // note: allMass masses are left unsorted
+        allDist.sort();
 
-                if (mCurrent > mThreshold)
-                {
-                    i0 = i;
-                    break;
-                }
-            }
+        if (nParcelSum > 1)
+        {
+            const scalar mLimit = fraction*mSum;
+            const labelList& indices = allDist.indices();
 
-            if (i0 == indices.size() - 1)
+            if (mLimit > (mSum - allMass[indices.last()]))
             {
                 distance = allDist.last();
             }
             else
             {
-                // linearly interpolate to determine distance
-                scalar alpha = (mCurrent - mThreshold)/allMass[indices[i0]];
-                distance = allDist[i0] + alpha*(allDist[i0+1] - allDist[i0]);
+                // assuming that 'fraction' is generally closer to 1 than 0,
+                // loop through in reverse distance order
+                const scalar mThreshold = (1.0 - fraction)*mSum;
+                scalar mCurrent = 0.0;
+                label i0 = 0;
+
+                forAllReverse(indices, i)
+                {
+                    label indI = indices[i];
+
+                    mCurrent += allMass[indI];
+
+                    if (mCurrent > mThreshold)
+                    {
+                        i0 = i;
+                        break;
+                    }
+                }
+
+                if (i0 == indices.size() - 1)
+                {
+                    distance = allDist.last();
+                }
+                else
+                {
+                    // linearly interpolate to determine distance
+                    scalar alpha = (mCurrent - mThreshold)/allMass[indices[i0]];
+                    distance =
+                        allDist[i0] + alpha*(allDist[i0+1] - allDist[i0]);
+                }
             }
         }
+        else
+        {
+            distance = allDist.first();
+        }
     }
-    else
-    {
-        distance = allDist.first();
-    }
+
+    Pstream::scatter(distance);
 
     return distance;
 }
@@ -564,7 +581,7 @@ Foam::KinematicCloud<CloudType>::theta() const
         (
             IOobject
             (
-                this->name() + ".theta",
+                this->name() + ":theta",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::NO_READ,
@@ -603,7 +620,7 @@ Foam::KinematicCloud<CloudType>::alpha() const
         (
             IOobject
             (
-                this->name() + ".alpha",
+                this->name() + ":alpha",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::NO_READ,
@@ -640,7 +657,7 @@ Foam::KinematicCloud<CloudType>::rhoEff() const
         (
             IOobject
             (
-                this->name() + ".rhoEff",
+                this->name() + ":rhoEff",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::NO_READ,
diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C
index eb3a3fc11cfe1c67fd856dec6d7e9efe0ddea976..0464da7e48e5dc15dea834b1c2314ab0db7edfe9 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C
+++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.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
@@ -132,7 +132,7 @@ Foam::ReactingCloud<CloudType>::ReactingCloud
             (
                 IOobject
                 (
-                    this->name() + "::rhoTrans_" + specieName,
+                    this->name() + ":rhoTrans_" + specieName,
                     this->db().time().timeName(),
                     this->db(),
                     IOobject::READ_IF_PRESENT,
@@ -176,7 +176,7 @@ Foam::ReactingCloud<CloudType>::ReactingCloud
             (
                 IOobject
                 (
-                    this->name() + "::rhoTrans_" + specieName,
+                    this->name() + ":rhoTrans_" + specieName,
                     this->db().time().timeName(),
                     this->db(),
                     IOobject::NO_READ,
diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H
index bfa14486821a059a8f5982961ba742ac97b9cac4..a5d5fc1e454bc4f11b53c864a40081533a95eed2 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H
+++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H
@@ -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
@@ -107,7 +107,7 @@ inline Foam::tmp<Foam::fvScalarMatrix> Foam::ReactingCloud<CloudType>::SYi
                 (
                     IOobject
                     (
-                        this->name() + ".rhoTrans",
+                        this->name() + ":rhoTrans",
                         this->db().time().timeName(),
                         this->db(),
                         IOobject::NO_READ,
@@ -155,7 +155,7 @@ Foam::ReactingCloud<CloudType>::Srho(const label i) const
         (
             IOobject
             (
-                this->name() + ".rhoTrans",
+                this->name() + ":rhoTrans",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::NO_READ,
@@ -192,7 +192,7 @@ Foam::ReactingCloud<CloudType>::Srho() const
         (
             IOobject
             (
-                this->name() + ".rhoTrans",
+                this->name() + ":rhoTrans",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::NO_READ,
@@ -236,7 +236,7 @@ Foam::ReactingCloud<CloudType>::Srho(volScalarField& rho) const
             (
                 IOobject
                 (
-                    this->name() + ".rhoTrans",
+                    this->name() + ":rhoTrans",
                     this->db().time().timeName(),
                     this->db(),
                     IOobject::NO_READ,
diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C
index 60c7b79241bb183f19f6276d0952ebdfa9c12d36..e97b6cfc2f48b3e2bd397689af9163b14e8cddd1 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C
+++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C
@@ -64,7 +64,7 @@ void Foam::ThermoCloud<CloudType>::setModels()
             (
                 IOobject
                 (
-                    this->name() + ".radAreaP",
+                    this->name() + ":radAreaP",
                     this->db().time().timeName(),
                     this->db(),
                     IOobject::READ_IF_PRESENT,
@@ -81,7 +81,7 @@ void Foam::ThermoCloud<CloudType>::setModels()
             (
                 IOobject
                 (
-                    this->name() + ".radT4",
+                    this->name() + ":radT4",
                     this->db().time().timeName(),
                     this->db(),
                     IOobject::READ_IF_PRESENT,
@@ -98,7 +98,7 @@ void Foam::ThermoCloud<CloudType>::setModels()
             (
                 IOobject
                 (
-                    this->name() + ".radAreaPT4",
+                    this->name() + ":radAreaPT4",
                     this->db().time().timeName(),
                     this->db(),
                     IOobject::READ_IF_PRESENT,
@@ -169,7 +169,7 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
         (
             IOobject
             (
-                this->name() + ".hsTrans",
+                this->name() + ":hsTrans",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::READ_IF_PRESENT,
@@ -185,7 +185,7 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
         (
             IOobject
             (
-                this->name() + ".hsCoeff",
+                this->name() + ":hsCoeff",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::READ_IF_PRESENT,
@@ -239,7 +239,7 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
         (
             IOobject
             (
-                this->name() + ".hsTrans",
+                this->name() + ":hsTrans",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::NO_READ,
@@ -255,7 +255,7 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
         (
             IOobject
             (
-                this->name() + ".hsCoeff",
+                this->name() + ":hsCoeff",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::NO_READ,
@@ -274,7 +274,7 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
             (
                 IOobject
                 (
-                    this->name() + ".radAreaP",
+                    this->name() + ":radAreaP",
                     this->db().time().timeName(),
                     this->db(),
                     IOobject::NO_READ,
@@ -291,7 +291,7 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
             (
                 IOobject
                 (
-                    this->name() + ".radT4",
+                    this->name() + ":radT4",
                     this->db().time().timeName(),
                     this->db(),
                     IOobject::NO_READ,
@@ -308,7 +308,7 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
             (
                 IOobject
                 (
-                    this->name() + ".radAreaPT4",
+                    this->name() + ":radAreaPT4",
                     this->db().time().timeName(),
                     this->db(),
                     IOobject::NO_READ,
diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H
index 6b5969666078c86cdd6c954ac882ec683386b802..80288cb52c123657cc2095a1484dc7b2fdc989b0 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H
+++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H
@@ -278,7 +278,7 @@ inline Foam::tmp<Foam::volScalarField> Foam::ThermoCloud<CloudType>::Ep() const
         (
             IOobject
             (
-                this->name() + "::radiation::Ep",
+                this->name() + ":radiation:Ep",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::NO_READ,
@@ -314,7 +314,7 @@ inline Foam::tmp<Foam::volScalarField> Foam::ThermoCloud<CloudType>::ap() const
         (
             IOobject
             (
-                this->name() + "::radiation::ap",
+                this->name() + ":radiation:ap",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::NO_READ,
@@ -351,7 +351,7 @@ Foam::ThermoCloud<CloudType>::sigmap() const
         (
             IOobject
             (
-                this->name() + "::radiation::sigmap",
+                this->name() + ":radiation:sigmap",
                 this->db().time().timeName(),
                 this->db(),
                 IOobject::NO_READ,
diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H
index f1b58c79ca24ae660a46e4ee54446eb8c435f57b..6956a8b74cf80ff284e12d90760b88c528971a46 100644
--- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H
+++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -341,21 +341,21 @@ inline const Foam::vector& Foam::KinematicParcel<ParcelType>::UTurb() const
 }
 
 
-template <class ParcelType>
+template<class ParcelType>
 inline Foam::scalar Foam::KinematicParcel<ParcelType>::rhoc() const
 {
     return rhoc_;
 }
 
 
-template <class ParcelType>
+template<class ParcelType>
 inline const Foam::vector& Foam::KinematicParcel<ParcelType>::Uc() const
 {
     return Uc_;
 }
 
 
-template <class ParcelType>
+template<class ParcelType>
 inline Foam::scalar Foam::KinematicParcel<ParcelType>::muc() const
 {
     return muc_;
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C
index 32473b8acf1a35d2c875205f87bdae1b687f45b5..94eb19932e63af60c1c1a0aecf522ee08e78e055 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C
+++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.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
@@ -49,12 +49,12 @@ bool Foam::InjectionModel<CloudType>::prepareForNextTimeStep
 (
     const scalar time,
     label& newParcels,
-    scalar& newVolume
+    scalar& newVolumeFraction
 )
 {
     // Initialise values
     newParcels = 0;
-    newVolume = 0.0;
+    newVolumeFraction = 0.0;
     bool validInjection = false;
 
     // Return if not started injection event
@@ -72,9 +72,9 @@ bool Foam::InjectionModel<CloudType>::prepareForNextTimeStep
     newParcels = this->parcelsToInject(t0, t1);
 
     // Volume of parcels to inject
-    newVolume = this->volumeToInject(t0, t1);
+    newVolumeFraction = this->volumeToInject(t0, t1)/volumeTotal_;
 
-    if (newVolume > 0)
+    if (newVolumeFraction > 0)
     {
         if (newParcels > 0)
         {
@@ -196,7 +196,7 @@ template<class CloudType>
 Foam::scalar Foam::InjectionModel<CloudType>::setNumberOfParticles
 (
     const label parcels,
-    const scalar volume,
+    const scalar volumeFraction,
     const scalar diameter,
     const scalar rho
 )
@@ -206,10 +206,10 @@ Foam::scalar Foam::InjectionModel<CloudType>::setNumberOfParticles
     {
         case pbMass:
         {
-            nP =
-                volume/volumeTotal_
-               *massTotal_/rho
-               /(parcels*pi/6.0*pow3(diameter));
+            scalar volumep = pi/6.0*pow3(diameter);
+            scalar volumeTot = massTotal_/rho;
+
+            nP = (volumeFraction*volumeTot + delayedVolume_)/(parcels*volumep);
             break;
         }
         case pbNumber:
@@ -501,11 +501,10 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
     label parcelsAdded = 0;
     scalar massAdded = 0.0;
     label newParcels = 0;
-    scalar newVolume = 0.0;
+    scalar newVolumeFraction = 0.0;
 
-    if (prepareForNextTimeStep(time, newParcels, newVolume))
+    if (prepareForNextTimeStep(time, newParcels, newVolumeFraction))
     {
-        newVolume += delayedVolume_;
         scalar delayedVolume = 0;
 
         const scalar trackTime = this->owner().solution().trackTime();
@@ -580,7 +579,7 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
                         setNumberOfParticles
                         (
                             newParcels,
-                            newVolume,
+                            newVolumeFraction,
                             pPtr->d(),
                             pPtr->rho()
                         );
@@ -644,7 +643,7 @@ void Foam::InjectionModel<CloudType>::injectSteadyState
     for (label parcelI = 0; parcelI < newParcels; parcelI++)
     {
         // Volume to inject is split equally amongst all parcel streams
-        scalar newVolume = volumeTotal_/newParcels;
+        scalar newVolumeFraction = 1.0/scalar(newParcels);
 
         // Determine the injection position and owner cell,
         // tetFace and tetPt
@@ -691,7 +690,7 @@ void Foam::InjectionModel<CloudType>::injectSteadyState
                 setNumberOfParticles
                 (
                     1,
-                    newVolume,
+                    newVolumeFraction,
                     pPtr->d(),
                     pPtr->rho()
                 );
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H
index 64e085edcc766551e98d08dee0bcf9d8837d03a7..a5492a12b6116ed715b49a166725658888c4a1c0 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H
+++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H
@@ -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
@@ -150,7 +150,7 @@ protected:
         (
             const scalar time,
             label& newParcels,
-            scalar& newVolume
+            scalar& newVolumeFraction
         );
 
         //- Find the cell that contains the supplied position
@@ -169,7 +169,7 @@ protected:
         virtual scalar setNumberOfParticles
         (
             const label parcels,
-            const scalar volume,
+            const scalar volumeFraction,
             const scalar diameter,
             const scalar rho
         );
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C
index c9d61f6d34d606eb2f72618b435f17cea7bcdaa2..4949ed7bf1dbd30c7b41418ff3fcb3471e3d0f94 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C
+++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H
index b1986348fba94f22f64ada538c6008935d6032b0..c4768d047825e032f4e878ede920ca4d120d81ed 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H
+++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H
index 6c085241dedf4289c9cc7b183141a57a0e401e8e..dc58dde52aee57e8676c85bc243a339e22238b0e 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H
+++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C
index fc4ed0de563975c7313b37cf1efd1d60bb756cce..47e73f18182bdfd40f3bfc9673575b9629120f0d 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C
+++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.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
@@ -46,8 +46,8 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
 {
     if (writeFields_)
     {
-        word massEscapeName(this->owner().name() + ".massEscape");
-        word massStickName(this->owner().name() + ".massStick");
+        word massEscapeName(this->owner().name() + ":massEscape");
+        word massStickName(this->owner().name() + ":massStick");
         Info<< "    Interaction fields will be written to " << massEscapeName
             << " and " << massStickName << endl;
 
@@ -121,7 +121,7 @@ Foam::volScalarField& Foam::LocalInteraction<CloudType>::massEscape()
             (
                 IOobject
                 (
-                    this->owner().name() + ".massEscape",
+                    this->owner().name() + ":massEscape",
                     mesh.time().timeName(),
                     mesh,
                     IOobject::READ_IF_PRESENT,
@@ -150,7 +150,7 @@ Foam::volScalarField& Foam::LocalInteraction<CloudType>::massStick()
             (
                 IOobject
                 (
-                    this->owner().name() + ".massStick",
+                    this->owner().name() + ":massStick",
                     mesh.time().timeName(),
                     mesh,
                     IOobject::READ_IF_PRESENT,
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.C
index ae8d7963445e1cb1fa92558a909c323ac82acf65..d2701fbdc8e34455d35ff5c5e695dc0919ff0660 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.C
+++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -110,7 +110,7 @@ Foam::MultiInteraction<CloudType>::MultiInteraction
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::MultiInteraction<CloudType>::~MultiInteraction()
 {}
 
@@ -131,7 +131,7 @@ bool Foam::MultiInteraction<CloudType>::active() const
 }
 
 
-template <class CloudType>
+template<class CloudType>
 bool Foam::MultiInteraction<CloudType>::correct
 (
     typename CloudType::parcelType& p,
diff --git a/src/lagrangian/molecularDynamics/molecularMeasurements/distribution/distribution.C b/src/lagrangian/molecularDynamics/molecularMeasurements/distribution/distribution.C
index 2089fb0e0764f6736e5b1573c84763c020646ea0..ecae0dc4656d6fd9966b534e40503e1f5f3390d2 100644
--- a/src/lagrangian/molecularDynamics/molecularMeasurements/distribution/distribution.C
+++ b/src/lagrangian/molecularDynamics/molecularMeasurements/distribution/distribution.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,7 @@ 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 "distribution.H"
 #include "OFstream.H"
diff --git a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C
index 3091e403534a3dd2290dfcbf8bbf4db85b01a416..d45bcc9633b0a3c4f6131a46a119db6be67ba15b 100644
--- a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C
+++ b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,7 @@ 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 "moleculeCloud.H"
 #include "molecule.H"
diff --git a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C
index 4cae869652df013c3e456c2e0bc7c92ad2df9150..d0e0dfdd98f3085b5ba7f65eb416af05778731e8 100644
--- a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C
+++ b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,7 @@ 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 "moleculeCloud.H"
 #include "fvMesh.H"
diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialList.C b/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialList.C
index d19dd6668f88936062870e01abeb530d41811c92..d423141a585073453326dade977a6b19c0f8e914 100644
--- a/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialList.C
+++ b/src/lagrangian/molecularDynamics/potential/pairPotential/pairPotentialList/pairPotentialList.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,7 @@ 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 "pairPotentialList.H"
 #include "OFstream.H"
diff --git a/src/lagrangian/molecularDynamics/potential/tetherPotential/tetherPotentialList/tetherPotentialList.C b/src/lagrangian/molecularDynamics/potential/tetherPotential/tetherPotentialList/tetherPotentialList.C
index e4c1b5df7ebc7cc237af374d06cbadcb0b12df38..341b950b515ed9f6aaa926b116e96cdf1d5688ff 100644
--- a/src/lagrangian/molecularDynamics/potential/tetherPotential/tetherPotentialList/tetherPotentialList.C
+++ b/src/lagrangian/molecularDynamics/potential/tetherPotential/tetherPotentialList/tetherPotentialList.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,7 @@ 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 "tetherPotentialList.H"
 
diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C
index 9bbd82d21f10e418ba833bc3a79b97e515f1583d..b93d687c209ef7775a97448267f9bf09792bdd01 100644
--- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C
+++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.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
@@ -441,7 +441,7 @@ void Foam::SprayParcel<ParcelType>::solveTABEq
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class ParcelType>
+template<class ParcelType>
 Foam::SprayParcel<ParcelType>::SprayParcel(const SprayParcel<ParcelType>& p)
 :
     ParcelType(p),
@@ -459,7 +459,7 @@ Foam::SprayParcel<ParcelType>::SprayParcel(const SprayParcel<ParcelType>& p)
 {}
 
 
-template <class ParcelType>
+template<class ParcelType>
 Foam::SprayParcel<ParcelType>::SprayParcel
 (
     const SprayParcel<ParcelType>& p,
diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C
index cdca04af29c5c2e0a7b62563bc7d43cf7085d59e..f4d443f92a7bc27a2f3bf70d87b7678f1725c8f8 100644
--- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C
+++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -28,7 +28,7 @@ License
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-template <class ParcelType>
+template<class ParcelType>
 Foam::string Foam::SprayParcel<ParcelType>::propHeader =
     ParcelType::propHeader
   + " d0"
diff --git a/src/lagrangian/spray/submodels/AtomizationModel/BlobsSheetAtomization/BlobsSheetAtomization.C b/src/lagrangian/spray/submodels/AtomizationModel/BlobsSheetAtomization/BlobsSheetAtomization.C
index 51661a89718e9e76b9d2a3cf85a7b00e18b4daa3..c3424551367aebf4e8e1bc0c9d392b9b92a853f7 100644
--- a/src/lagrangian/spray/submodels/AtomizationModel/BlobsSheetAtomization/BlobsSheetAtomization.C
+++ b/src/lagrangian/spray/submodels/AtomizationModel/BlobsSheetAtomization/BlobsSheetAtomization.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::BlobsSheetAtomization<CloudType>::BlobsSheetAtomization
 (
     const dictionary& dict,
@@ -40,7 +40,7 @@ Foam::BlobsSheetAtomization<CloudType>::BlobsSheetAtomization
 {}
 
 
-template <class CloudType>
+template<class CloudType>
 Foam::BlobsSheetAtomization<CloudType>::BlobsSheetAtomization
 (
     const BlobsSheetAtomization<CloudType>& am
@@ -54,7 +54,7 @@ Foam::BlobsSheetAtomization<CloudType>::BlobsSheetAtomization
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::BlobsSheetAtomization<CloudType>::~BlobsSheetAtomization()
 {}
 
diff --git a/src/lagrangian/spray/submodels/AtomizationModel/LISAAtomization/LISAAtomization.C b/src/lagrangian/spray/submodels/AtomizationModel/LISAAtomization/LISAAtomization.C
index 75fcb6a88c8ee2e0590fd406f8c44af16601ec8d..33cda4093b969f7808646f77674ba7ff29fdf1c9 100644
--- a/src/lagrangian/spray/submodels/AtomizationModel/LISAAtomization/LISAAtomization.C
+++ b/src/lagrangian/spray/submodels/AtomizationModel/LISAAtomization/LISAAtomization.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::LISAAtomization<CloudType>::LISAAtomization
 (
     const dictionary& dict,
@@ -62,7 +62,7 @@ Foam::LISAAtomization<CloudType>::LISAAtomization
     }
 }
 
-template <class CloudType>
+template<class CloudType>
 Foam::LISAAtomization<CloudType>::LISAAtomization
 (
     const LISAAtomization<CloudType>& am
@@ -80,7 +80,7 @@ Foam::LISAAtomization<CloudType>::LISAAtomization
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::LISAAtomization<CloudType>::~LISAAtomization()
 {}
 
diff --git a/src/lagrangian/spray/submodels/AtomizationModel/NoAtomization/NoAtomization.C b/src/lagrangian/spray/submodels/AtomizationModel/NoAtomization/NoAtomization.C
index 1c34ae6e9382c293677d4b730054b58198cfe622..038e90c5b46239d9eee0e95555da10466035a5a4 100644
--- a/src/lagrangian/spray/submodels/AtomizationModel/NoAtomization/NoAtomization.C
+++ b/src/lagrangian/spray/submodels/AtomizationModel/NoAtomization/NoAtomization.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::NoAtomization<CloudType>::NoAtomization
 (
     const dictionary& dict,
@@ -38,7 +38,7 @@ Foam::NoAtomization<CloudType>::NoAtomization
 {}
 
 
-template <class CloudType>
+template<class CloudType>
 Foam::NoAtomization<CloudType>::NoAtomization
 (
     const NoAtomization<CloudType>& am
@@ -50,7 +50,7 @@ Foam::NoAtomization<CloudType>::NoAtomization
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::NoAtomization<CloudType>::~NoAtomization()
 {}
 
diff --git a/src/lagrangian/spray/submodels/BreakupModel/NoBreakup/NoBreakup.C b/src/lagrangian/spray/submodels/BreakupModel/NoBreakup/NoBreakup.C
index cbe837eafd8557d783c7b28e342410ff7d5bcc2e..1a233e2b2969fb06015849bc35fe597d03066aad 100644
--- a/src/lagrangian/spray/submodels/BreakupModel/NoBreakup/NoBreakup.C
+++ b/src/lagrangian/spray/submodels/BreakupModel/NoBreakup/NoBreakup.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::NoBreakup<CloudType>::NoBreakup
 (
     const dictionary&,
@@ -39,7 +39,7 @@ Foam::NoBreakup<CloudType>::NoBreakup
 
 
 
-template <class CloudType>
+template<class CloudType>
 Foam::NoBreakup<CloudType>::NoBreakup(const NoBreakup<CloudType>& bum)
 :
     BreakupModel<CloudType>(bum)
@@ -48,7 +48,7 @@ Foam::NoBreakup<CloudType>::NoBreakup(const NoBreakup<CloudType>& bum)
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::NoBreakup<CloudType>::~NoBreakup()
 {}
 
diff --git a/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.C b/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.C
index 2aca8ae5ad602142514d3aa82afea261a21adadf..d2ca617bbd77d018e52e52b68ab6ed074a2458e4 100644
--- a/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.C
+++ b/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.C
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::PilchErdman<CloudType>::PilchErdman
 (
     const dictionary& dict,
@@ -46,7 +46,7 @@ Foam::PilchErdman<CloudType>::PilchErdman
 }
 
 
-template <class CloudType>
+template<class CloudType>
 Foam::PilchErdman<CloudType>::PilchErdman(const PilchErdman<CloudType>& bum)
 :
     BreakupModel<CloudType>(bum),
@@ -57,7 +57,7 @@ Foam::PilchErdman<CloudType>::PilchErdman(const PilchErdman<CloudType>& bum)
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::PilchErdman<CloudType>::~PilchErdman()
 {}
 
diff --git a/src/lagrangian/spray/submodels/BreakupModel/ReitzDiwakar/ReitzDiwakar.C b/src/lagrangian/spray/submodels/BreakupModel/ReitzDiwakar/ReitzDiwakar.C
index 25a123fc6973c8a2e2497f747fcdb8d8e3868ddd..79b26186eb154f6f85b2e09d4194dd62a6e92fbf 100644
--- a/src/lagrangian/spray/submodels/BreakupModel/ReitzDiwakar/ReitzDiwakar.C
+++ b/src/lagrangian/spray/submodels/BreakupModel/ReitzDiwakar/ReitzDiwakar.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::ReitzDiwakar<CloudType>::ReitzDiwakar
 (
     const dictionary& dict,
@@ -50,7 +50,7 @@ Foam::ReitzDiwakar<CloudType>::ReitzDiwakar
 }
 
 
-template <class CloudType>
+template<class CloudType>
 Foam::ReitzDiwakar<CloudType>::ReitzDiwakar(const ReitzDiwakar<CloudType>& bum)
 :
     BreakupModel<CloudType>(bum),
@@ -63,7 +63,7 @@ Foam::ReitzDiwakar<CloudType>::ReitzDiwakar(const ReitzDiwakar<CloudType>& bum)
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::ReitzDiwakar<CloudType>::~ReitzDiwakar()
 {}
 
diff --git a/src/lagrangian/spray/submodels/BreakupModel/ReitzKHRT/ReitzKHRT.C b/src/lagrangian/spray/submodels/BreakupModel/ReitzKHRT/ReitzKHRT.C
index d58678c4bd8a2ddca5c654a876ccdeea69c60357..e714db22dc349b31f99b16a7ed6b846eb0696d8c 100644
--- a/src/lagrangian/spray/submodels/BreakupModel/ReitzKHRT/ReitzKHRT.C
+++ b/src/lagrangian/spray/submodels/BreakupModel/ReitzKHRT/ReitzKHRT.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::ReitzKHRT<CloudType>::ReitzKHRT
 (
     const dictionary& dict,
@@ -54,7 +54,7 @@ Foam::ReitzKHRT<CloudType>::ReitzKHRT
 }
 
 
-template <class CloudType>
+template<class CloudType>
 Foam::ReitzKHRT<CloudType>::ReitzKHRT(const ReitzKHRT<CloudType>& bum)
 :
     BreakupModel<CloudType>(bum),
@@ -69,7 +69,7 @@ Foam::ReitzKHRT<CloudType>::ReitzKHRT(const ReitzKHRT<CloudType>& bum)
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::ReitzKHRT<CloudType>::~ReitzKHRT()
 {}
 
diff --git a/src/lagrangian/spray/submodels/BreakupModel/SHF/SHF.C b/src/lagrangian/spray/submodels/BreakupModel/SHF/SHF.C
index a5816c8f99732ce11a966a6bbc5564b157e8b495..41e3ac307a724c61d6217010c2cfea50a1757d14 100644
--- a/src/lagrangian/spray/submodels/BreakupModel/SHF/SHF.C
+++ b/src/lagrangian/spray/submodels/BreakupModel/SHF/SHF.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
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::SHF<CloudType>::SHF
 (
     const dictionary& dict,
@@ -67,7 +67,7 @@ Foam::SHF<CloudType>::SHF
 {}
 
 
-template <class CloudType>
+template<class CloudType>
 Foam::SHF<CloudType>::SHF(const SHF<CloudType>& bum)
 :
     BreakupModel<CloudType>(bum),
@@ -105,7 +105,7 @@ Foam::SHF<CloudType>::SHF(const SHF<CloudType>& bum)
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::SHF<CloudType>::~SHF()
 {}
 
diff --git a/src/lagrangian/spray/submodels/BreakupModel/TAB/TAB.C b/src/lagrangian/spray/submodels/BreakupModel/TAB/TAB.C
index 8838a73ea06cdb9ed395eebc93410b5935527325..0fe325fbacff1f9d22ac2fbe9fb01c1625d539d1 100644
--- a/src/lagrangian/spray/submodels/BreakupModel/TAB/TAB.C
+++ b/src/lagrangian/spray/submodels/BreakupModel/TAB/TAB.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::TAB<CloudType>::TAB
 (
     const dictionary& dict,
@@ -80,7 +80,7 @@ Foam::TAB<CloudType>::TAB
 }
 
 
-template <class CloudType>
+template<class CloudType>
 Foam::TAB<CloudType>::TAB(const TAB<CloudType>& bum)
 :
     BreakupModel<CloudType>(bum),
@@ -93,7 +93,7 @@ Foam::TAB<CloudType>::TAB(const TAB<CloudType>& bum)
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::TAB<CloudType>::~TAB()
 {}
 
diff --git a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C
index 6eca022bc4e1d42bbe767555cff0c8566d82e0df..793eb50a35e7986d7f697e226252d05d45f3f385 100644
--- a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C
+++ b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::ORourkeCollision<CloudType>::ORourkeCollision
 (
     const dictionary& dict,
@@ -39,7 +39,7 @@ Foam::ORourkeCollision<CloudType>::ORourkeCollision
 {}
 
 
-template <class CloudType>
+template<class CloudType>
 Foam::ORourkeCollision<CloudType>::ORourkeCollision
 (
     const ORourkeCollision<CloudType>& cm
@@ -52,7 +52,7 @@ Foam::ORourkeCollision<CloudType>::ORourkeCollision
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::ORourkeCollision<CloudType>::~ORourkeCollision()
 {}
 
diff --git a/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.C b/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.C
index 585d7199f3c0771ccd7e4f63898471e223119b60..fa09dfc2ca9f162b01680ad292e91df74e70409c 100644
--- a/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.C
+++ b/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::TrajectoryCollision<CloudType>::TrajectoryCollision
 (
     const dictionary& dict,
@@ -41,7 +41,7 @@ Foam::TrajectoryCollision<CloudType>::TrajectoryCollision
 {}
 
 
-template <class CloudType>
+template<class CloudType>
 Foam::TrajectoryCollision<CloudType>::TrajectoryCollision
 (
     const TrajectoryCollision<CloudType>& cm
@@ -56,7 +56,7 @@ Foam::TrajectoryCollision<CloudType>::TrajectoryCollision
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class CloudType>
+template<class CloudType>
 Foam::TrajectoryCollision<CloudType>::~TrajectoryCollision()
 {}
 
diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C
index d6556a95083f401061c99db53c78fdc4f74b9f3e..1f36aa1ab8c4fa7968d0a7a3f81656badbc98b0a 100644
--- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C
+++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C
@@ -1287,7 +1287,7 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
               + ".obj"
             )
         );
-        Info<< "Writing points with too large a extrusion distance to "
+        Info<< "Writing points with too large an extrusion distance to "
             << str().name() << endl;
     }
 
@@ -1304,7 +1304,7 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
               + ".obj"
             )
         );
-        Info<< "Writing points with too large a extrusion distance to "
+        Info<< "Writing points with too large an extrusion distance to "
             << medialVecStr().name() << endl;
     }
 
diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C
index 3215e4b7e74e08dce463cea5b32c53498b602d33..484f851c0f65fe26375bd1064db074db3d6290e9 100644
--- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C
+++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.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
@@ -21,7 +21,7 @@ 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 "autoRefineDriver.H"
 #include "meshRefinement.H"
diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C
index b7b79d715e3e71cd3ca2656d511ff86b46ac3282..0178c1387537fa855195bb85a802a52784b57099 100644
--- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C
+++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.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
@@ -1360,6 +1360,19 @@ void Foam::autoSnapDriver::doSnap
                 regionSide
             );
             meshRefinement::updateList(mapPtr().faceMap(), -1, filterFace);
+
+            if (debug&meshRefinement::MESH)
+            {
+                const_cast<Time&>(mesh.time())++;
+                Pout<< "Writing duplicatedPoints mesh to time "
+                    << meshRefiner_.timeName()
+                    << endl;
+                meshRefiner_.write
+                (
+                    debug, mesh.time().path()
+                   /"duplicatedPoints"
+                );
+            }
         }
 
 
@@ -1516,13 +1529,18 @@ void Foam::autoSnapDriver::doSnap
 
             if (!meshOk)
             {
-                Info<< "Did not succesfully snap mesh. Giving up."
-                    << nl << endl;
-
-                // Use current mesh as base mesh
-                meshMover.correct();
-
-                break;
+                WarningIn("autoSnapDriver::doSnap(..)")
+                    << "Did not succesfully snap mesh."
+                    << " Continuing to snap to resolve easy surfaces but the"
+                    << " resulting mesh will not satisfy your quality"
+                    << " constraints" << nl << endl;
+                //Info<< "Did not succesfully snap mesh. Giving up."
+                //    << nl << endl;
+                //
+                //// Use current mesh as base mesh
+                //meshMover.correct();
+                //
+                //break;
             }
 
             if (debug&meshRefinement::MESH)
diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C
index 7285c1ed003b3a3de61b1c54c38bed4f8acc6b54..cecee33cef3b84352108fd5024b014bfe3333dcc 100644
--- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C
+++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.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
@@ -21,7 +21,7 @@ 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 "autoSnapDriver.H"
 #include "polyTopoChange.H"
diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H
index b00ca55097d19bc18fe3ceb904f71d268cd74da4..69d59bcb0007e0545f1df44fbaeabf0db1bf7513 100644
--- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H
+++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H
@@ -75,7 +75,7 @@ inline const Foam::vector& Foam::pointData::v() const
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline void Foam::pointData::transform
 (
     const tensor& rotTensor,
@@ -88,7 +88,7 @@ inline void Foam::pointData::transform
 
 
 // Update this with information from connected edge
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::pointData::updatePoint
 (
     const polyMesh& mesh,
@@ -123,7 +123,7 @@ inline bool Foam::pointData::updatePoint
 }
 
 // Update this with new information on same point
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::pointData::updatePoint
 (
     const polyMesh& mesh,
@@ -157,7 +157,7 @@ inline bool Foam::pointData::updatePoint
 
 
 // Update this with new information on same point. No extra information.
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::pointData::updatePoint
 (
     const pointData& newPointInfo,
@@ -179,7 +179,7 @@ inline bool Foam::pointData::updatePoint
 
 
 // Update this with information from connected point
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::pointData::updateEdge
 (
     const polyMesh& mesh,
diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
index 04c5786ea62dc5f0dd23a1e47b4bb7d1526e97bb..c32f659896f2bdc3d9092fee76f77b4951503f2b 100644
--- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
+++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
@@ -21,7 +21,7 @@ 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 "meshRefinement.H"
 #include "volMesh.H"
diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C
index 11dde360ebb20829b3bb2267be1246eb7d6a847b..97a7e59d18131963e5b7ad6179937cfeabf76466 100644
--- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C
+++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.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
@@ -21,7 +21,7 @@ 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 "meshRefinement.H"
 #include "fvMesh.H"
diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C
index aa6bf82a838ab610c476feb6a8bf863768948a35..c8ac47b5c54d13c605f8e943af67e56d22e9230b 100644
--- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C
+++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.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
@@ -21,7 +21,7 @@ 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 "meshRefinement.H"
 #include "combineFaces.H"
diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C
index 114480e8c96c7269c220130344eadd926b31a8d2..8676847fd4124c4254747b35cf57d85bdd9e2f19 100644
--- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C
+++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.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
@@ -21,7 +21,7 @@ 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 "meshRefinement.H"
 #include "fvMesh.H"
diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C
index 2c15a847ead3d6571c75656d7352cc9f762d3bb0..42e7983e5a73aa2274c81e05ff712b46d90fdcd9 100644
--- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C
+++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.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
@@ -21,7 +21,7 @@ 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 "meshRefinement.H"
 #include "trackedParticle.H"
diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.C
index c4999c64c3a902a29d5459f6eb728593df0f956d..beeb47ca3cbfb0e8eb97ac18454f0b86050aa86d 100644
--- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.C
+++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -116,24 +116,19 @@ void meshRefinement::testSyncBoundaryFaceList
 }
 
 
-//template <class T, class Mesh>
+//template<class T, class Mesh>
 template<class GeoField>
 void meshRefinement::addPatchFields(fvMesh& mesh, const word& patchFieldType)
 {
-    HashTable<const GeoField*> flds
+    HashTable<GeoField*> flds
     (
         mesh.objectRegistry::lookupClass<GeoField>()
     );
 
-    forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
+    forAllIter(typename HashTable<GeoField*>, flds, iter)
     {
-        const GeoField& fld = *iter();
-
-        typename GeoField::GeometricBoundaryField& bfld =
-            const_cast<typename GeoField::GeometricBoundaryField&>
-            (
-                fld.boundaryField()
-            );
+        GeoField& fld = *iter();
+        typename GeoField::GeometricBoundaryField& bfld = fld.boundaryField();
 
         label sz = bfld.size();
         bfld.setSize(sz+1);
@@ -155,28 +150,21 @@ void meshRefinement::addPatchFields(fvMesh& mesh, const word& patchFieldType)
 template<class GeoField>
 void meshRefinement::reorderPatchFields(fvMesh& mesh, const labelList& oldToNew)
 {
-    HashTable<const GeoField*> flds
+    HashTable<GeoField*> flds
     (
         mesh.objectRegistry::lookupClass<GeoField>()
     );
 
-    forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
+    forAllIter(typename HashTable<GeoField*>, flds, iter)
     {
-        const GeoField& fld = *iter();
-
-        typename GeoField::GeometricBoundaryField& bfld =
-            const_cast<typename GeoField::GeometricBoundaryField&>
-            (
-                fld.boundaryField()
-            );
+        GeoField& fld = *iter();
+        typename GeoField::GeometricBoundaryField& bfld = fld.boundaryField();
 
         bfld.reorder(oldToNew);
     }
 }
 
 
-
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 } // End namespace Foam
diff --git a/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C b/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C
index e72f13d72663e3683a878f7267c116d2428be75e..9c8f08630f189deeda3eacee7cc520896c58f7c0 100644
--- a/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C
+++ b/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.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
@@ -41,23 +41,31 @@ void Foam::refinementFeatures::read
 
         fileName featFileName(dict.lookup("file"));
 
-        set
-        (
-            featI,
-            new featureEdgeMesh
+        {
+            IOobject featObj
             (
-                IOobject
+                featFileName,                       // name
+                io.time().constant(),               // instance
+                "triSurface",                       // local
+                io.time(),                          // registry
+                IOobject::MUST_READ,
+                IOobject::NO_WRITE,
+                false
+            );
+
+            autoPtr<edgeMesh> eMeshPtr = edgeMesh::New(featObj.filePath());
+
+            set
+            (
+                featI,
+                new featureEdgeMesh
                 (
-                    featFileName,                       // name
-                    io.time().constant(),               // instance
-                    "triSurface",                       // local
-                    io.time(),                          // registry
-                    IOobject::MUST_READ,
-                    IOobject::NO_WRITE,
-                    false
+                    featObj,
+                    eMeshPtr->points(),
+                    eMeshPtr->edges()
                 )
-            )
-        );
+            );
+        }
 
         const featureEdgeMesh& eMesh = operator[](featI);
 
diff --git a/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C
index 5dc9d062729146118134a501efb040bd783146bd..a45a06a6b2c735d34770d51937a9d9f536ac75e3 100644
--- a/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C
+++ b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.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
@@ -21,7 +21,7 @@ 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 "refinementSurfaces.H"
 #include "Time.H"
diff --git a/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C b/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C
index 35b32de3f88c492663cc6081cf8f1c697d3b5e7c..2b90da54b72887fb97b2d01f74059d6a84d41215 100644
--- a/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C
+++ b/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,7 @@ 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 "trackedParticle.H"
 
diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C
index 3ee8869ea5f494f5ca474988ea51d577842d6f17..3bcc089c7cc19c9ee1c9ea6961742bbfef04d1f3 100644
--- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C
+++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C
@@ -862,7 +862,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
 
         if (nFace)
         {
-            Info<< "AMI: Patch " << patchName << " weights min/max/average = "
+            IInfo<< "AMI: Patch " << patchName << " weights min/max/average = "
                 << gMin(wghtSum) << ", "
                 << gMax(wghtSum) << ", "
                 << gAverage(wghtSum) << endl;
@@ -1161,7 +1161,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
     label srcSize = returnReduce(srcPatch.size(), sumOp<label>());
     label tgtSize = returnReduce(tgtPatch.size(), sumOp<label>());
 
-    Info<< "AMI: Creating addressing and weights between "
+    IInfo<< "AMI: Creating addressing and weights between "
         << srcSize << " source faces and " << tgtSize << " target faces"
         << endl;
 
@@ -1196,7 +1196,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
     label srcSize = returnReduce(srcPatch.size(), sumOp<label>());
     label tgtSize = returnReduce(tgtPatch.size(), sumOp<label>());
 
-    Info<< "AMI: Creating addressing and weights between "
+    IInfo<< "AMI: Creating addressing and weights between "
         << srcSize << " source faces and " << tgtSize << " target faces"
         << endl;
 
@@ -1317,9 +1317,9 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
         (
             "AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation"
             "("
-            "    const AMIInterpolation<SourcePatch, TargetPatch>&, "
-            "    const labelList&, "
-            "    const labelList&"
+                "const AMIInterpolation<SourcePatch, TargetPatch>&, "
+                "const labelList&, "
+                "const labelList&"
             ")"
         )   << "Size mismatch." << nl
             << "Source patch size:" << fineAMI.srcAddress().size() << nl
@@ -1584,7 +1584,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
     if (debug)
     {
         Info<< "AMIInterpolation : Constructed addressing and weights" << nl
-            << "    triMode        :" << triMode_ << nl
+            << "    triMode        :"
+            << faceAreaIntersect::triangulationModeNames_[triMode_] << nl
             << "    singlePatchProc:" << singlePatchProc_ << nl
             << "    srcMagSf       :" << gSum(srcMagSf_) << nl
             << "    tgtMagSf       :" << gSum(tgtMagSf_) << nl
diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H
index 1ce855b3aec678896dc6eadbb216e66877bacdf2..9f94fa41169965fbd12bece06b9c0afc0edb6563 100644
--- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H
+++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H
@@ -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
@@ -42,6 +42,7 @@ Description
 SourceFiles
     AMIInterpolation.C
     AMIInterpolationName.C
+    AMIInterpolationParallelOps.C
 
 \*---------------------------------------------------------------------------*/
 
@@ -468,7 +469,7 @@ public:
                 ) const;
 
 
-            //- Interpolate from target to source with supplied binary op
+            //- Interpolate from target to source with supplied op
             template<class Type, class CombineOp>
             tmp<Field<Type> > interpolateToSource
             (
@@ -476,8 +477,7 @@ public:
                 const CombineOp& cop
             ) const;
 
-            //- Interpolate from target tmp field to source with supplied
-            //  binary op
+            //- Interpolate from target tmp field to source with supplied op
             template<class Type, class CombineOp>
             tmp<Field<Type> > interpolateToSource
             (
diff --git a/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.C b/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.C
index 4135cfe04191b4ffc2e2135c41dbf5b802a6b5dc..45d1eb515b519035e4c9f733709636414890899c 100644
--- a/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.C
+++ b/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.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
@@ -27,6 +27,19 @@ License
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
+namespace Foam
+{
+    template<>
+    const char* NamedEnum<faceAreaIntersect::triangulationMode, 2>::names[] =
+    {
+        "fan",
+        "mesh"
+    };
+}
+
+const Foam::NamedEnum<Foam::faceAreaIntersect::triangulationMode, 2>
+    Foam::faceAreaIntersect::triangulationModeNames_;
+
 Foam::scalar Foam::faceAreaIntersect::tol = 1e-6;
 
 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
diff --git a/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.H b/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.H
index bfbe7c08a2e2a1d31cbec044e7a01d12eea68399..a8dd739151f9a2a1756b6a3978b2952ae07ec370 100644
--- a/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.H
+++ b/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.H
@@ -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
@@ -41,6 +41,7 @@ SourceFiles
 #include "FixedList.H"
 #include "plane.H"
 #include "face.H"
+#include "NamedEnum.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -63,6 +64,8 @@ public:
         tmMesh
     };
 
+    static const NamedEnum<triangulationMode, 2> triangulationModeNames_;
+
 
 private:
 
diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C
index 49ba94fda2f1056ee02516d5bb985f7bba0778cf..1d37199cd3b6087ba6e97f08d3ff3b45e7e99b56 100644
--- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C
+++ b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.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
@@ -239,7 +239,11 @@ void Foam::cyclicAMIPolyPatch::resetAMI() const
         AMIPtr_.clear();
 
         const polyPatch& nbr = neighbPatch();
-        pointField nbrPoints = neighbPatch().localPoints();
+        pointField nbrPoints
+        (
+            neighbPatch().boundaryMesh().mesh().points(),
+            neighbPatch().meshPoints()
+        );
 
         if (debug)
         {
@@ -326,6 +330,9 @@ void Foam::cyclicAMIPolyPatch::initMovePoints
 )
 {
     polyPatch::initMovePoints(pBufs, p);
+
+    // See below. Clear out any local geometry
+    primitivePatch::movePoints(p);
 }
 
 
@@ -339,6 +346,10 @@ void Foam::cyclicAMIPolyPatch::movePoints
 
     calcTransforms();
 
+    // Note: resetAMI is called whilst in geometry update. So the slave
+    // side might not have reached 'movePoints'. Is explicitly handled by
+    // - clearing geometry of neighbour inside initMovePoints
+    // - not using localPoints() inside resetAMI
     resetAMI();
 }
 
diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files
index ddbac0db681e1cb486d8e551cf5dc9abcae1843f..32098cab0636206ff375e6415bdb39015f11ea5f 100644
--- a/src/meshTools/Make/files
+++ b/src/meshTools/Make/files
@@ -129,6 +129,7 @@ faceZoneSources = sets/faceZoneSources
 $(faceZoneSources)/faceZoneToFaceZone/faceZoneToFaceZone.C
 $(faceZoneSources)/setsToFaceZone/setsToFaceZone.C
 $(faceZoneSources)/setToFaceZone/setToFaceZone.C
+$(faceZoneSources)/setAndNormalToFaceZone/setAndNormalToFaceZone.C
 $(faceZoneSources)/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C
 
 cellZoneSources = sets/cellZoneSources
diff --git a/src/meshTools/algorithms/MeshWave/FaceCellWave.C b/src/meshTools/algorithms/MeshWave/FaceCellWave.C
index bcba11321ae50f5803ad05e2cb9f53a464ff0555..946e23e53f89cfdb654b3eaa3f0c377beb666002 100644
--- a/src/meshTools/algorithms/MeshWave/FaceCellWave.C
+++ b/src/meshTools/algorithms/MeshWave/FaceCellWave.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
@@ -38,13 +38,13 @@ License
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 const Foam::scalar Foam::FaceCellWave<Type, TrackingData>::geomTol_ = 1e-6;
 
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::scalar Foam::FaceCellWave<Type, TrackingData>::propagationTol_ = 0.01;
 
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 int Foam::FaceCellWave<Type, TrackingData>::dummyTrackData_ = 12345;
 
 namespace Foam
@@ -111,7 +111,7 @@ namespace Foam
 // Updates:
 //      - changedCell_, changedCells_, nChangedCells_,
 //      - statistics: nEvals_, nUnvisitedCells_
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 bool Foam::FaceCellWave<Type, TrackingData>::updateCell
 (
     const label cellI,
@@ -159,7 +159,7 @@ bool Foam::FaceCellWave<Type, TrackingData>::updateCell
 // Updates:
 //      - changedFace_, changedFaces_, nChangedFaces_,
 //      - statistics: nEvals_, nUnvisitedFaces_
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 bool Foam::FaceCellWave<Type, TrackingData>::updateFace
 (
     const label faceI,
@@ -207,7 +207,7 @@ bool Foam::FaceCellWave<Type, TrackingData>::updateFace
 // Updates:
 //      - changedFace_, changedFaces_, nChangedFaces_,
 //      - statistics: nEvals_, nUnvisitedFaces_
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 bool Foam::FaceCellWave<Type, TrackingData>::updateFace
 (
     const label faceI,
@@ -249,7 +249,7 @@ bool Foam::FaceCellWave<Type, TrackingData>::updateFace
 
 
 // For debugging: check status on both sides of cyclic
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::FaceCellWave<Type, TrackingData>::checkCyclic
 (
     const polyPatch& patch
@@ -302,8 +302,8 @@ void Foam::FaceCellWave<Type, TrackingData>::checkCyclic
 
 
 // Check if has cyclic patches
-template <class Type, class TrackingData>
-template <class PatchType>
+template<class Type, class TrackingData>
+template<class PatchType>
 bool Foam::FaceCellWave<Type, TrackingData>::hasPatch() const
 {
     forAll(mesh_.boundaryMesh(), patchI)
@@ -318,7 +318,7 @@ bool Foam::FaceCellWave<Type, TrackingData>::hasPatch() const
 
 
 // Copy face information into member data
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::FaceCellWave<Type, TrackingData>::setFaceInfo
 (
     const labelList& changedFaces,
@@ -349,7 +349,7 @@ void Foam::FaceCellWave<Type, TrackingData>::setFaceInfo
 
 
 // Merge face information into member data
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::FaceCellWave<Type, TrackingData>::mergeFaceInfo
 (
     const polyPatch& patch,
@@ -384,7 +384,7 @@ void Foam::FaceCellWave<Type, TrackingData>::mergeFaceInfo
 // Construct compact patchFace change arrays for a (slice of a) single patch.
 // changedPatchFaces in local patch numbering.
 // Return length of arrays.
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::label Foam::FaceCellWave<Type, TrackingData>::getChangedPatchFaces
 (
     const polyPatch& patch,
@@ -414,7 +414,7 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::getChangedPatchFaces
 
 
 // Handle leaving domain. Implementation referred to Type
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::FaceCellWave<Type, TrackingData>::leaveDomain
 (
     const polyPatch& patch,
@@ -436,7 +436,7 @@ void Foam::FaceCellWave<Type, TrackingData>::leaveDomain
 
 
 // Handle entering domain. Implementation referred to Type
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::FaceCellWave<Type, TrackingData>::enterDomain
 (
     const polyPatch& patch,
@@ -458,7 +458,7 @@ void Foam::FaceCellWave<Type, TrackingData>::enterDomain
 
 
 // Transform. Implementation referred to Type
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::FaceCellWave<Type, TrackingData>::transform
 (
     const tensorField& rotTensor,
@@ -486,7 +486,7 @@ void Foam::FaceCellWave<Type, TrackingData>::transform
 
 
 // Offset mesh face. Used for transferring from one cyclic half to the other.
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::FaceCellWave<Type, TrackingData>::offset
 (
     const polyPatch&,
@@ -503,7 +503,7 @@ void Foam::FaceCellWave<Type, TrackingData>::offset
 
 
 // Tranfer all the information to/from neighbouring processors
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches()
 {
     const globalMeshData& pData = mesh_.globalData();
@@ -622,7 +622,7 @@ void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches()
 
 
 // Transfer information across cyclic halves.
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::FaceCellWave<Type, TrackingData>::handleCyclicPatches()
 {
     forAll(mesh_.boundaryMesh(), patchI)
@@ -707,7 +707,7 @@ void Foam::FaceCellWave<Type, TrackingData>::handleCyclicPatches()
 
 
 // Transfer information across cyclic halves.
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::FaceCellWave<Type, TrackingData>::handleAMICyclicPatches()
 {
     forAll(mesh_.boundaryMesh(), patchI)
@@ -800,7 +800,7 @@ void Foam::FaceCellWave<Type, TrackingData>::handleAMICyclicPatches()
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 // Set up only. Use setFaceInfo and iterate() to do actual calculation.
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
 (
     const polyMesh& mesh,
@@ -852,7 +852,7 @@ Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
 
 // Iterate, propagating changedFacesInfo across mesh, until no change (or
 // maxIter reached). Initial cell values specified.
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
 (
     const polyMesh& mesh,
@@ -929,14 +929,14 @@ Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::label Foam::FaceCellWave<Type, TrackingData>::getUnsetCells() const
 {
     return nUnvisitedCells_;
 }
 
 
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::label Foam::FaceCellWave<Type, TrackingData>::getUnsetFaces() const
 {
     return nUnvisitedFaces_;
@@ -945,7 +945,7 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::getUnsetFaces() const
 
 
 // Propagate cell to face
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::label Foam::FaceCellWave<Type, TrackingData>::faceToCell()
 {
     const labelList& owner = mesh_.faceOwner();
@@ -1030,7 +1030,7 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::faceToCell()
 
 
 // Propagate cell to face
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::label Foam::FaceCellWave<Type, TrackingData>::cellToFace()
 {
     const cellList& cells = mesh_.cells();
@@ -1112,7 +1112,7 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::cellToFace()
 
 
 // Iterate
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::label Foam::FaceCellWave<Type, TrackingData>::iterate(const label maxIter)
 {
     if (hasCyclicPatches_)
diff --git a/src/meshTools/algorithms/MeshWave/FaceCellWave.H b/src/meshTools/algorithms/MeshWave/FaceCellWave.H
index cecfc6b5d3ea32fb22935307452fdbdd0cc87f61..93e2277daa2f900bcd7550e2cc6eb7939d5ce297 100644
--- a/src/meshTools/algorithms/MeshWave/FaceCellWave.H
+++ b/src/meshTools/algorithms/MeshWave/FaceCellWave.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -166,7 +166,7 @@ class FaceCellWave
             void checkCyclic(const polyPatch& pPatch) const;
 
             //- Has cyclic patch?
-            template <class PatchType>
+            template<class PatchType>
             bool hasPatch() const;
 
             //- Merge received patch data into global data
diff --git a/src/meshTools/algorithms/MeshWave/MeshWave.C b/src/meshTools/algorithms/MeshWave/MeshWave.C
index 0a6ca3e794a38f64df01913d5a489a2e5911e44c..d7efb5626a761594fcb12ac9c99659cb2a1d04d4 100644
--- a/src/meshTools/algorithms/MeshWave/MeshWave.C
+++ b/src/meshTools/algorithms/MeshWave/MeshWave.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -29,7 +29,7 @@ License
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 int Foam::MeshWave<Type, TrackingData>::dummyTrackData_ = 12345;
 
 
@@ -37,7 +37,7 @@ int Foam::MeshWave<Type, TrackingData>::dummyTrackData_ = 12345;
 
 // Iterate, propagating changedFacesInfo across mesh, until no change (or
 // maxIter reached).
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::MeshWave<Type, TrackingData>::MeshWave
 (
     const polyMesh& mesh,
@@ -64,7 +64,7 @@ Foam::MeshWave<Type, TrackingData>::MeshWave
 
 // Iterate, propagating changedFacesInfo across mesh, until no change (or
 // maxIter reached). Initial cell values specified.
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::MeshWave<Type, TrackingData>::MeshWave
 (
     const polyMesh& mesh,
diff --git a/src/meshTools/algorithms/MeshWave/MeshWave.H b/src/meshTools/algorithms/MeshWave/MeshWave.H
index 21316d8fb6974b22387dc0ab756635002e90374c..04fe52c5199558b44476395eb295fdcbf207f6a8 100644
--- a/src/meshTools/algorithms/MeshWave/MeshWave.H
+++ b/src/meshTools/algorithms/MeshWave/MeshWave.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -53,7 +53,7 @@ TemplateName(MeshWave);
                            Class MeshWave Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class Type, class TrackingData = int>
+template<class Type, class TrackingData = int>
 class MeshWave
 :
     public MeshWaveName
diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfoI.H b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfoI.H
index 881e586626a1f69760486c948a9a66ed0da341dd..433fbfc207953088f37844a72386c13ad2106cec 100644
--- a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfoI.H
+++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfoI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -234,7 +234,7 @@ inline bool Foam::patchEdgeFaceInfo::updateFace
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::patchEdgeFaceInfo::equal
 (
     const patchEdgeFaceInfo& rhs,
diff --git a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C
index e6dd1846acfd4f4b8512155c69133d5c9bc217e4..765e1e6136d8c2d7a7acec286ba52dd690349af0 100644
--- a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C
+++ b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C
@@ -37,10 +37,10 @@ License
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::scalar Foam::PointEdgeWave<Type, TrackingData>::propagationTol_ = 0.01;
 
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 int Foam::PointEdgeWave<Type, TrackingData>::dummyTrackData_ = 12345;
 
 namespace Foam
@@ -71,7 +71,7 @@ namespace Foam
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 // Handle leaving domain. Implementation referred to Type
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::PointEdgeWave<Type, TrackingData>::leaveDomain
 (
     const polyPatch& patch,
@@ -93,7 +93,7 @@ void Foam::PointEdgeWave<Type, TrackingData>::leaveDomain
 
 
 // Handle entering domain. Implementation referred to Type
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::PointEdgeWave<Type, TrackingData>::enterDomain
 (
     const polyPatch& patch,
@@ -115,7 +115,7 @@ void Foam::PointEdgeWave<Type, TrackingData>::enterDomain
 
 
 // Transform. Implementation referred to Type
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::PointEdgeWave<Type, TrackingData>::transform
 (
     const polyPatch& patch,
@@ -156,7 +156,7 @@ void Foam::PointEdgeWave<Type, TrackingData>::transform
 // Updates:
 //      - changedPoint_, changedPoints_, nChangedPoints_,
 //      - statistics: nEvals_, nUnvisitedPoints_
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 bool Foam::PointEdgeWave<Type, TrackingData>::updatePoint
 (
     const label pointI,
@@ -203,7 +203,7 @@ bool Foam::PointEdgeWave<Type, TrackingData>::updatePoint
 // Updates:
 //      - changedPoint_, changedPoints_, nChangedPoints_,
 //      - statistics: nEvals_, nUnvisitedPoints_
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 bool Foam::PointEdgeWave<Type, TrackingData>::updatePoint
 (
     const label pointI,
@@ -248,7 +248,7 @@ bool Foam::PointEdgeWave<Type, TrackingData>::updatePoint
 // Updates:
 //      - changedEdge_, changedEdges_, nChangedEdges_,
 //      - statistics: nEvals_, nUnvisitedEdge_
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 bool Foam::PointEdgeWave<Type, TrackingData>::updateEdge
 (
     const label edgeI,
@@ -291,8 +291,8 @@ bool Foam::PointEdgeWave<Type, TrackingData>::updateEdge
 
 
 // Check if patches of given type name are present
-template <class Type, class TrackingData>
-template <class PatchType>
+template<class Type, class TrackingData>
+template<class PatchType>
 Foam::label Foam::PointEdgeWave<Type, TrackingData>::countPatchType() const
 {
     label nPatches = 0;
@@ -309,7 +309,7 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::countPatchType() const
 
 
 // Transfer all the information to/from neighbouring processors
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::PointEdgeWave<Type, TrackingData>::handleProcPatches()
 {
     // 1. Send all point info on processor patches.
@@ -458,7 +458,7 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleProcPatches()
 }
 
 
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::PointEdgeWave<Type, TrackingData>::handleCyclicPatches()
 {
     // 1. Send all point info on cyclic patches.
@@ -549,7 +549,7 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleCyclicPatches()
 
 // Guarantee collocated points have same information.
 // Return number of points changed.
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::label Foam::PointEdgeWave<Type, TrackingData>::handleCollocatedPoints()
 {
     // Transfer onto coupled patch
@@ -643,7 +643,7 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::handleCollocatedPoints()
 
 // Iterate, propagating changedPointsInfo across mesh, until no change (or
 // maxIter reached). Initial point values specified.
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::PointEdgeWave<Type, TrackingData>::PointEdgeWave
 (
     const polyMesh& mesh,
@@ -728,7 +728,7 @@ Foam::PointEdgeWave<Type, TrackingData>::PointEdgeWave
 }
 
 
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::PointEdgeWave<Type, TrackingData>::PointEdgeWave
 (
     const polyMesh& mesh,
@@ -756,7 +756,7 @@ Foam::PointEdgeWave<Type, TrackingData>::PointEdgeWave
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::PointEdgeWave<Type, TrackingData>::~PointEdgeWave()
 {}
 
@@ -764,14 +764,14 @@ Foam::PointEdgeWave<Type, TrackingData>::~PointEdgeWave()
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::label Foam::PointEdgeWave<Type, TrackingData>::getUnsetPoints() const
 {
     return nUnvisitedPoints_;
 }
 
 
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::label Foam::PointEdgeWave<Type, TrackingData>::getUnsetEdges() const
 {
     return nUnvisitedEdges_;
@@ -779,7 +779,7 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::getUnsetEdges() const
 
 
 // Copy point information into member data
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 void Foam::PointEdgeWave<Type, TrackingData>::setPointInfo
 (
     const labelList& changedPoints,
@@ -816,7 +816,7 @@ void Foam::PointEdgeWave<Type, TrackingData>::setPointInfo
 
 
 // Propagate information from edge to point. Return number of points changed.
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::label Foam::PointEdgeWave<Type, TrackingData>::edgeToPoint()
 {
     for
@@ -892,7 +892,7 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::edgeToPoint()
 
 
 // Propagate information from point to edge. Return number of edges changed.
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::label Foam::PointEdgeWave<Type, TrackingData>::pointToEdge()
 {
     const labelListList& pointEdges = mesh_.pointEdges();
@@ -960,7 +960,7 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::pointToEdge()
 
 
 // Iterate
-template <class Type, class TrackingData>
+template<class Type, class TrackingData>
 Foam::label Foam::PointEdgeWave<Type, TrackingData>::iterate
 (
     const label maxIter
diff --git a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.H b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.H
index 440e90367657925f4bcacc64b6751562d1b226e3..1e951590b8ffb1c329bce9d9535a14bc3ec967cd 100644
--- a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.H
+++ b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.H
@@ -82,7 +82,7 @@ TemplateName(PointEdgeWave);
                            Class PointEdgeWave Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class Type, class TrackingData = int>
+template<class Type, class TrackingData = int>
 class PointEdgeWave
 :
     public PointEdgeWaveName
@@ -196,7 +196,7 @@ class PointEdgeWave
         // Parallel, cyclic
 
             //- Has patches of certain type?
-            template <class PatchType>
+            template<class PatchType>
             label countPatchType() const;
 
             //- Merge data from across processor boundaries
@@ -323,7 +323,7 @@ public:
 \*---------------------------------------------------------------------------*/
 
 //- List update operation
-template <class Type, class TrackingData = int>
+template<class Type, class TrackingData = int>
 class listUpdateOp
 {
     //- Additional data to be passed into container
diff --git a/src/meshTools/algorithms/PointEdgeWave/pointEdgePointI.H b/src/meshTools/algorithms/PointEdgeWave/pointEdgePointI.H
index b466b268287a92453280bd06326364b43d59aaf7..bc55dda9ce9f7049f8b8212dcb5d95e495b7b900 100644
--- a/src/meshTools/algorithms/PointEdgeWave/pointEdgePointI.H
+++ b/src/meshTools/algorithms/PointEdgeWave/pointEdgePointI.H
@@ -296,7 +296,7 @@ inline bool Foam::pointEdgePoint::updateEdge
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::pointEdgePoint::equal
 (
     const pointEdgePoint& rhs,
diff --git a/src/meshTools/cellClassification/cellInfoI.H b/src/meshTools/cellClassification/cellInfoI.H
index 357bc247d65f850d9ec7c21e43479188589418cf..300f920036746327f65b40f658ff0eddf1db9e14 100644
--- a/src/meshTools/cellClassification/cellInfoI.H
+++ b/src/meshTools/cellClassification/cellInfoI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -244,7 +244,7 @@ inline bool Foam::cellInfo::updateFace
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::cellInfo::equal
 (
     const cellInfo& rhs,
diff --git a/src/meshTools/cellDist/wallPoint/wallPointData.C b/src/meshTools/cellDist/wallPoint/wallPointData.C
index 6143cb570a9aa5635d77dab28a929d2b69e7d694..7379e2c11386a0557eabc0580b96d787d69c5233 100644
--- a/src/meshTools/cellDist/wallPoint/wallPointData.C
+++ b/src/meshTools/cellDist/wallPoint/wallPointData.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -32,7 +32,7 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Ostream& operator<<
 (
     Ostream& os,
@@ -45,7 +45,7 @@ Ostream& operator<<
 }
 
 
-template <class Type>
+template<class Type>
 Istream& operator>>
 (
     Istream& is,
diff --git a/src/meshTools/cellDist/wallPoint/wallPointData.H b/src/meshTools/cellDist/wallPoint/wallPointData.H
index 406a3b9dc56ea3873b9b0203c6efeb9065677547..0c40fde65042a84eecf2aac0bb13936222cf9af9 100644
--- a/src/meshTools/cellDist/wallPoint/wallPointData.H
+++ b/src/meshTools/cellDist/wallPoint/wallPointData.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -58,7 +58,7 @@ template<class Type> Ostream& operator<<(Ostream&, const wallPointData<Type>&);
                            Class wallPointData Declaration
 \*---------------------------------------------------------------------------*/
 
-template <class Type>
+template<class Type>
 class wallPointData
 :
     public wallPoint
@@ -163,37 +163,37 @@ public:
 //- Data associated with wallPointData type are contiguous. List the usual
 //  ones.
 
-template <>
+template<>
 inline bool contiguous<wallPointData<bool> >()
 {
     return contiguous<wallPoint>();
 }
-template <>
+template<>
 inline bool contiguous<wallPointData<label> >()
 {
     return contiguous<wallPoint>();
 }
-template <>
+template<>
 inline bool contiguous<wallPointData<scalar> >()
 {
     return contiguous<wallPoint>();
 }
-template <>
+template<>
 inline bool contiguous<wallPointData<vector> >()
 {
     return contiguous<wallPoint>();
 }
-template <>
+template<>
 inline bool contiguous<wallPointData<sphericalTensor> >()
 {
     return contiguous<wallPoint>();
 }
-template <>
+template<>
 inline bool contiguous<wallPointData<symmTensor> >()
 {
     return contiguous<wallPoint>();
 }
-template <>
+template<>
 inline bool contiguous<wallPointData<tensor> >()
 {
     return contiguous<wallPoint>();
diff --git a/src/meshTools/cellDist/wallPoint/wallPointDataI.H b/src/meshTools/cellDist/wallPoint/wallPointDataI.H
index 3ec9dd9d5b6ccaf21ab067b557e7032e1ad94a2d..73de754ef992651f6615639ded19f7b03ff96416 100644
--- a/src/meshTools/cellDist/wallPoint/wallPointDataI.H
+++ b/src/meshTools/cellDist/wallPoint/wallPointDataI.H
@@ -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
@@ -31,8 +31,8 @@ namespace Foam
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 // Update this with w2 if w2 nearer to pt.
-template <class Type>
-template <class TrackingData>
+template<class Type>
+template<class TrackingData>
 inline bool wallPointData<Type>::update
 (
     const point& pt,
@@ -75,7 +75,7 @@ inline bool wallPointData<Type>::update
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 // Null constructor
-template <class Type>
+template<class Type>
 inline wallPointData<Type>::wallPointData()
 :
     wallPoint(),
@@ -84,7 +84,7 @@ inline wallPointData<Type>::wallPointData()
 
 
 // Construct from components
-template <class Type>
+template<class Type>
 inline wallPointData<Type>::wallPointData
 (
     const point& origin,
@@ -99,14 +99,14 @@ inline wallPointData<Type>::wallPointData
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 inline const Type& wallPointData<Type>::data() const
 {
     return data_;
 }
 
 
-template <class Type>
+template<class Type>
 inline Type& wallPointData<Type>::data()
 {
     return data_;
@@ -114,8 +114,8 @@ inline Type& wallPointData<Type>::data()
 
 
 // Update this with w2 if w2 nearer to pt.
-template <class Type>
-template <class TrackingData>
+template<class Type>
+template<class TrackingData>
 inline bool wallPointData<Type>::updateCell
 (
     const polyMesh& mesh,
@@ -139,8 +139,8 @@ inline bool wallPointData<Type>::updateCell
 
 
 // Update this with w2 if w2 nearer to pt.
-template <class Type>
-template <class TrackingData>
+template<class Type>
+template<class TrackingData>
 inline bool wallPointData<Type>::updateFace
 (
     const polyMesh& mesh,
@@ -164,8 +164,8 @@ inline bool wallPointData<Type>::updateFace
 
 
 // Update this with w2 if w2 nearer to pt.
-template <class Type>
-template <class TrackingData>
+template<class Type>
+template<class TrackingData>
 inline bool wallPointData<Type>::updateFace
 (
     const polyMesh& mesh,
diff --git a/src/meshTools/cellDist/wallPoint/wallPointI.H b/src/meshTools/cellDist/wallPoint/wallPointI.H
index 8cad5f6a764b36ba09b9ce6a0e3779c26fba5b2c..95f0f02cdb3372cb463efa529f276a691aad2f73 100644
--- a/src/meshTools/cellDist/wallPoint/wallPointI.H
+++ b/src/meshTools/cellDist/wallPoint/wallPointI.H
@@ -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
@@ -277,7 +277,7 @@ inline bool Foam::wallPoint::updateFace
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::wallPoint::equal
 (
     const wallPoint& rhs,
diff --git a/src/meshTools/cellQuality/cellQuality.C b/src/meshTools/cellQuality/cellQuality.C
index ed030358e0127da534550ab32c6b617ef43ea35a..95fe7e53399487da905660c1782dbf91793d75d9 100644
--- a/src/meshTools/cellQuality/cellQuality.C
+++ b/src/meshTools/cellQuality/cellQuality.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,6 @@ 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 "cellQuality.H"
diff --git a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C
index 039e3fb2533849e36872836efe3c5d19d55a6de6..a502eb02fd6c206d351dca7f41348f3dc397b423 100644
--- a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C
+++ b/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C
@@ -171,12 +171,7 @@ Foam::tmp<Foam::vectorField> Foam::axesRotation::transform
     const vectorField& st
 ) const
 {
-    notImplemented
-    (
-        "tmp<vectorField> Foam::axesRotation:: "
-        "transform(const vectorField& st) const"
-    );
-    return tmp<vectorField>(NULL);
+    return (R_ & st);
 }
 
 
@@ -185,12 +180,7 @@ Foam::tmp<Foam::vectorField> Foam::axesRotation::invTransform
     const vectorField& st
 ) const
 {
-    notImplemented
-    (
-        "tmp<vectorField>  Foam::axesRotation::"
-        "invTransform(const vectorField& st) const"
-    );
-    return tmp<vectorField>(NULL);
+    return (Rtr_ & st);
 }
 
 
diff --git a/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.C b/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.C
index ab023bfdc293dd1842d162cb77c0324cf21968db..7944c350cd5cc4115f4706d050e8e5fbf0f39af4 100644
--- a/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.C
+++ b/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -40,7 +40,12 @@ Foam::meshSearchFACECENTRETETSMeshObject::meshSearchFACECENTRETETSMeshObject
     const polyMesh& mesh
 )
 :
-    MeshObject<polyMesh, meshSearchFACECENTRETETSMeshObject>(mesh),
+    MeshObject
+    <
+        polyMesh,
+        Foam::GeometricMeshObject,
+        meshSearchFACECENTRETETSMeshObject
+    >(mesh),
     meshSearch(mesh, polyMesh::FACECENTRETETS)
 {}
 
diff --git a/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.H b/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.H
index 2ddaf9d4fa3edfce313217a7b9264f8140fd5dcf..81b41fb50dae06911117c4a375b0a1817a3af2a7 100644
--- a/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.H
+++ b/src/meshTools/meshSearch/meshSearchFACECENTRETETSMeshObject.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -48,7 +48,12 @@ namespace Foam
 
 class meshSearchFACECENTRETETSMeshObject
 :
-    public MeshObject<polyMesh, meshSearchFACECENTRETETSMeshObject>,
+    public MeshObject
+    <
+        polyMesh,
+        GeometricMeshObject,
+        meshSearchFACECENTRETETSMeshObject
+    >,
     public meshSearch
 {
 
@@ -66,18 +71,6 @@ public:
     //- Destructor
     virtual ~meshSearchFACECENTRETETSMeshObject()
     {}
-
-//
-//    // Member functions
-//
-//        // Edit
-//
-//            //- Update mesh topology using the morph engine
-//            void updateMesh();
-//
-//            //- Correct weighting factors for moving mesh.
-//            bool movePoints();
-//
 };
 
 
diff --git a/src/meshTools/meshSearch/meshSearchMeshObject.C b/src/meshTools/meshSearch/meshSearchMeshObject.C
index 12211345a17b5c3706d207c5f03c855999bc5040..9ac70a7c6e6b559737da7f906fe4a16484622064 100644
--- a/src/meshTools/meshSearch/meshSearchMeshObject.C
+++ b/src/meshTools/meshSearch/meshSearchMeshObject.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -37,7 +37,7 @@ namespace Foam
 
 Foam::meshSearchMeshObject::meshSearchMeshObject(const polyMesh& mesh)
 :
-    MeshObject<polyMesh, meshSearchMeshObject>(mesh),
+    MeshObject<polyMesh, Foam::GeometricMeshObject, meshSearchMeshObject>(mesh),
     meshSearch(mesh)
 {}
 
diff --git a/src/meshTools/meshSearch/meshSearchMeshObject.H b/src/meshTools/meshSearch/meshSearchMeshObject.H
index 838aa80c70540eb8ac88e5686d486428733678b7..2e251a357acae464e0c4d1f640b2f66fe80277f7 100644
--- a/src/meshTools/meshSearch/meshSearchMeshObject.H
+++ b/src/meshTools/meshSearch/meshSearchMeshObject.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -48,7 +48,7 @@ namespace Foam
 
 class meshSearchMeshObject
 :
-    public MeshObject<polyMesh, meshSearchMeshObject>,
+    public MeshObject<polyMesh, GeometricMeshObject, meshSearchMeshObject>,
     public meshSearch
 {
 
@@ -66,18 +66,6 @@ public:
     //- Destructor
     virtual ~meshSearchMeshObject()
     {}
-
-//
-//    // Member functions
-//
-//        // Edit
-//
-//            //- Update mesh topology using the morph engine
-//            void updateMesh();
-//
-//            //- Correct weighting factors for moving mesh.
-//            bool movePoints();
-//
 };
 
 
diff --git a/src/meshTools/meshStructure/pointTopoDistanceDataI.H b/src/meshTools/meshStructure/pointTopoDistanceDataI.H
index c42dbffce2e7f01795d215fe81b5b05d7aa3c8c8..4dcf167625f28b27b69d03f57e8ca658173834de 100644
--- a/src/meshTools/meshStructure/pointTopoDistanceDataI.H
+++ b/src/meshTools/meshStructure/pointTopoDistanceDataI.H
@@ -52,7 +52,7 @@ inline Foam::pointTopoDistanceData::pointTopoDistanceData
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::pointTopoDistanceData::valid(TrackingData& td) const
 {
     return distance_ != -1;
@@ -60,7 +60,7 @@ inline bool Foam::pointTopoDistanceData::valid(TrackingData& td) const
 
 
 // No geometric data so never any problem on cyclics
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::pointTopoDistanceData::sameGeometry
 (
     const pointTopoDistanceData&,
@@ -73,7 +73,7 @@ inline bool Foam::pointTopoDistanceData::sameGeometry
 
 
 // No geometric data.
-template <class TrackingData>
+template<class TrackingData>
 inline void Foam::pointTopoDistanceData::leaveDomain
 (
     const polyPatch& patch,
@@ -85,7 +85,7 @@ inline void Foam::pointTopoDistanceData::leaveDomain
 
 
 // No geometric data.
-template <class TrackingData>
+template<class TrackingData>
 inline void Foam::pointTopoDistanceData::transform
 (
     const tensor& rotTensor,
@@ -95,7 +95,7 @@ inline void Foam::pointTopoDistanceData::transform
 
 
 // No geometric data.
-template <class TrackingData>
+template<class TrackingData>
 inline void Foam::pointTopoDistanceData::enterDomain
 (
     const polyPatch& patch,
@@ -107,7 +107,7 @@ inline void Foam::pointTopoDistanceData::enterDomain
 
 
 // Update this with information from connected edge
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::pointTopoDistanceData::updatePoint
 (
     const polyMesh& mesh,
@@ -199,7 +199,7 @@ inline bool Foam::pointTopoDistanceData::updateEdge
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::pointTopoDistanceData::equal
 (
     const pointTopoDistanceData& rhs,
diff --git a/src/meshTools/meshStructure/topoDistanceDataI.H b/src/meshTools/meshStructure/topoDistanceDataI.H
index 388c923a2ae0d63808b88bf3888c71b2987a3fcb..a0a5ddae1396a7e7cfe959eacad35abb0cb55939 100644
--- a/src/meshTools/meshStructure/topoDistanceDataI.H
+++ b/src/meshTools/meshStructure/topoDistanceDataI.H
@@ -52,7 +52,7 @@ inline Foam::topoDistanceData::topoDistanceData
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::topoDistanceData::valid(TrackingData& td) const
 {
     return distance_ != -1;
@@ -60,7 +60,7 @@ inline bool Foam::topoDistanceData::valid(TrackingData& td) const
 
 
 // No geometric data so never any problem on cyclics
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::topoDistanceData::sameGeometry
 (
     const polyMesh&,
@@ -74,7 +74,7 @@ inline bool Foam::topoDistanceData::sameGeometry
 
 
 // No geometric data.
-template <class TrackingData>
+template<class TrackingData>
 inline void Foam::topoDistanceData::leaveDomain
 (
     const polyMesh&,
@@ -87,7 +87,7 @@ inline void Foam::topoDistanceData::leaveDomain
 
 
 // No geometric data.
-template <class TrackingData>
+template<class TrackingData>
 inline void Foam::topoDistanceData::transform
 (
     const polyMesh&,
@@ -98,7 +98,7 @@ inline void Foam::topoDistanceData::transform
 
 
 // No geometric data.
-template <class TrackingData>
+template<class TrackingData>
 inline void Foam::topoDistanceData::enterDomain
 (
     const polyMesh&,
@@ -111,7 +111,7 @@ inline void Foam::topoDistanceData::enterDomain
 
 
 // Update cell with neighbouring face information
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::topoDistanceData::updateCell
 (
     const polyMesh&,
@@ -135,7 +135,7 @@ inline bool Foam::topoDistanceData::updateCell
 
 
 // Update face with neighbouring cell information
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::topoDistanceData::updateFace
 (
     const polyMesh& mesh,
@@ -162,7 +162,7 @@ inline bool Foam::topoDistanceData::updateFace
 
 
 // Update face with coupled face information
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::topoDistanceData::updateFace
 (
     const polyMesh&,
@@ -185,7 +185,7 @@ inline bool Foam::topoDistanceData::updateFace
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::topoDistanceData::equal
 (
     const topoDistanceData& rhs,
diff --git a/src/meshTools/meshTools/meshTools.H b/src/meshTools/meshTools/meshTools.H
index 7522f08789100ac9c5813597d5bb4c0e2626515b..bd2257e2e005020bd023158b12f8fb40ed021df9 100644
--- a/src/meshTools/meshTools/meshTools.H
+++ b/src/meshTools/meshTools/meshTools.H
@@ -136,7 +136,7 @@ namespace meshTools
         );
 
         //- Write obj representation of faces subset
-        template <class FaceType>
+        template<class FaceType>
         void writeOBJ
         (
             Ostream& os,
@@ -146,7 +146,7 @@ namespace meshTools
         );
 
         //- Write obj representation of faces
-        template <class FaceType>
+        template<class FaceType>
         void writeOBJ
         (
             Ostream& os,
diff --git a/src/meshTools/meshTools/meshToolsTemplates.C b/src/meshTools/meshTools/meshToolsTemplates.C
index 980557a471a332e5b2040d9b229c12f9d97b6035..3887ae154ad5f2230007a1ecabbfd83b94f1be92 100644
--- a/src/meshTools/meshTools/meshToolsTemplates.C
+++ b/src/meshTools/meshTools/meshToolsTemplates.C
@@ -23,7 +23,7 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-template <class FaceType>
+template<class FaceType>
 void Foam::meshTools::writeOBJ
 (
     Ostream& os,
@@ -59,7 +59,7 @@ void Foam::meshTools::writeOBJ
 }
 
 
-template <class FaceType>
+template<class FaceType>
 void Foam::meshTools::writeOBJ
 (
     Ostream& os,
diff --git a/src/meshTools/momentOfInertia/momentOfInertia.H b/src/meshTools/momentOfInertia/momentOfInertia.H
index f21f1f298311da10a97d81ae2fbb5365200ee33a..e521d41c77476948ad6e87e5c7a8beeeab055efe 100644
--- a/src/meshTools/momentOfInertia/momentOfInertia.H
+++ b/src/meshTools/momentOfInertia/momentOfInertia.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/meshTools/regionSplit/regionSplit.C b/src/meshTools/regionSplit/regionSplit.C
index 70b0759c711a6b734d30b2385e6432af8f0c66e0..9ed7b10856af98046bb71c1be11169429600c153 100644
--- a/src/meshTools/regionSplit/regionSplit.C
+++ b/src/meshTools/regionSplit/regionSplit.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -692,7 +692,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
 
 Foam::regionSplit::regionSplit(const polyMesh& mesh)
 :
-    MeshObject<polyMesh, regionSplit>(mesh),
+    MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
     labelList(mesh.nCells(), -1)
 {
     globalNumberingPtr_ = calcRegionSplit
@@ -710,7 +710,7 @@ Foam::regionSplit::regionSplit
     const boolList& blockedFace
 )
 :
-    MeshObject<polyMesh, regionSplit>(mesh),
+    MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
     labelList(mesh.nCells(), -1)
 {
     globalNumberingPtr_ = calcRegionSplit
@@ -729,7 +729,7 @@ Foam::regionSplit::regionSplit
     const List<labelPair>& explicitConnections
 )
 :
-    MeshObject<polyMesh, regionSplit>(mesh),
+    MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
     labelList(mesh.nCells(), -1)
 {
     globalNumberingPtr_ = calcRegionSplit
diff --git a/src/meshTools/regionSplit/regionSplit.H b/src/meshTools/regionSplit/regionSplit.H
index 6c41d1fb8380204c2d2eed02ff1c0a703feff48c..b7be9dd32eb51567ad036050bb50f21d1f4adfee 100644
--- a/src/meshTools/regionSplit/regionSplit.H
+++ b/src/meshTools/regionSplit/regionSplit.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -108,12 +108,12 @@ namespace Foam
 class polyMesh;
 
 /*---------------------------------------------------------------------------*\
-                           Class regionSplit Declaration
+                         Class regionSplit Declaration
 \*---------------------------------------------------------------------------*/
 
 class regionSplit
 :
-    public MeshObject<polyMesh, regionSplit>,
+    public MeshObject<polyMesh, TopologicalMeshObject, regionSplit>,
     public labelList
 {
     // Private data
diff --git a/src/meshTools/searchableSurface/searchableSurfaces.C b/src/meshTools/searchableSurface/searchableSurfaces.C
index 8115407843750b8fbdf24eb918c089b62b5d9339..08569aba78c155437d42bbf086470fd11dedc419 100644
--- a/src/meshTools/searchableSurface/searchableSurfaces.C
+++ b/src/meshTools/searchableSurface/searchableSurfaces.C
@@ -21,7 +21,7 @@ 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 "searchableSurfaces.H"
 #include "searchableSurfacesQueries.H"
diff --git a/src/meshTools/searchableSurface/searchableSurfacesQueries.C b/src/meshTools/searchableSurface/searchableSurfacesQueries.C
index cce61240e94852c733a7f41146ff1f4520d78a31..c7f7157d7ebd9d9647a0b44c39f82eec28c7876f 100644
--- a/src/meshTools/searchableSurface/searchableSurfacesQueries.C
+++ b/src/meshTools/searchableSurface/searchableSurfacesQueries.C
@@ -21,7 +21,7 @@ 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 "searchableSurfacesQueries.H"
 #include "ListOps.H"
diff --git a/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C b/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C
index a80688a184bc2147c00d68758d848a9dfe6eb72e..dde6c52c4e43e48e316d9a6fa0959860c170c720 100644
--- a/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C
+++ b/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -139,7 +139,7 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
         const boundBox& bb = mesh_.bounds();
         pointField points(bb.points());
 
-        label minPointI = -1;
+        //label minPointI = -1;
         label maxPointI = -1;
         forAll(points, pointI)
         {
@@ -152,7 +152,7 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
             else if (c < minComp)
             {
                 minComp = c;
-                minPointI = pointI;
+                //minPointI = pointI;
             }
         }
 
@@ -179,7 +179,7 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
     PackedBoolList selected(mesh_.nCells());
     label nSelected = -1;
     scalar selectedVol = 0.0;
-    scalar selectedComp = 0.0;
+    //scalar selectedComp = 0.0;
 
 
     scalar low = minComp;
@@ -228,7 +228,7 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
 
     if (selectedVol < vol_)
     {
-        selectedComp = high;
+        //selectedComp = high;
     }
     else
     {
@@ -237,7 +237,7 @@ void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const
 
         if (selectedVol < vol_)
         {
-            selectedComp = low;
+            //selectedComp = low;
         }
         else
         {
diff --git a/src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegionI.H b/src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegionI.H
index eea60716a74a6a44c8d26b9a24d96413fb16c279..07e6935b257fbaa6b84a3c6513c1a4ddbb0ecf9c 100644
--- a/src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegionI.H
+++ b/src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegionI.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -163,7 +163,7 @@ inline bool Foam::patchEdgeFaceRegion::updateFace
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool Foam::patchEdgeFaceRegion::equal
 (
     const patchEdgeFaceRegion& rhs,
diff --git a/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C b/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C
index b91ec33b8285b7bbb31f417938d4c4dd810c1557..039e14555f8515fa01346f9cc2a643d563606bab 100644
--- a/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C
+++ b/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -120,7 +120,7 @@ void Foam::searchableSurfaceToFaceZone::applyToSet
 
         // Boundary faces
         vectorField nbrCellCentres;
-        syncTools::swapBoundaryCellList(mesh_, cc, nbrCellCentres);
+        syncTools::swapBoundaryCellPositions(mesh_, cc, nbrCellCentres);
 
         const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
 
diff --git a/src/meshTools/sets/faceZoneSources/setAndNormalToFaceZone/setAndNormalToFaceZone.C b/src/meshTools/sets/faceZoneSources/setAndNormalToFaceZone/setAndNormalToFaceZone.C
new file mode 100644
index 0000000000000000000000000000000000000000..e94a2bf6d0f0df8c3156369770880c16c131cf08
--- /dev/null
+++ b/src/meshTools/sets/faceZoneSources/setAndNormalToFaceZone/setAndNormalToFaceZone.C
@@ -0,0 +1,189 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "setAndNormalToFaceZone.H"
+#include "polyMesh.H"
+#include "faceZoneSet.H"
+
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+defineTypeNameAndDebug(setAndNormalToFaceZone, 0);
+
+addToRunTimeSelectionTable(topoSetSource, setAndNormalToFaceZone, word);
+
+addToRunTimeSelectionTable(topoSetSource, setAndNormalToFaceZone, istream);
+
+}
+
+
+Foam::topoSetSource::addToUsageTable Foam::setAndNormalToFaceZone::usage_
+(
+    setAndNormalToFaceZone::typeName,
+    "\n    Usage: setAndNormalToFaceZone <faceSet> <normal>\n\n"
+    "    Select all faces in the faceSet and orient using normal.\n\n"
+);
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::setAndNormalToFaceZone::setAndNormalToFaceZone
+(
+    const polyMesh& mesh,
+    const word& setName,
+    const vector& normal
+)
+:
+    topoSetSource(mesh),
+    setName_(setName),
+    normal_(normal)
+{}
+
+
+Foam::setAndNormalToFaceZone::setAndNormalToFaceZone
+(
+    const polyMesh& mesh,
+    const dictionary& dict
+)
+:
+    topoSetSource(mesh),
+    setName_(dict.lookup("faceSet")),
+    normal_(dict.lookup("normal"))
+{}
+
+
+Foam::setAndNormalToFaceZone::setAndNormalToFaceZone
+(
+    const polyMesh& mesh,
+    Istream& is
+)
+:
+    topoSetSource(mesh),
+    setName_(checkIs(is)),
+    normal_(checkIs(is))
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::setAndNormalToFaceZone::~setAndNormalToFaceZone()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::setAndNormalToFaceZone::applyToSet
+(
+    const topoSetSource::setAction action,
+    topoSet& set
+) const
+{
+    if (!isA<faceZoneSet>(set))
+    {
+        WarningIn
+        (
+            "setAndNormalToFaceZone::applyToSet"
+            "("
+                "const topoSetSource::setAction, "
+                "topoSet&"
+            ")"
+        )   << "Operation only allowed on a faceZoneSet." << endl;
+    }
+    else
+    {
+        faceZoneSet& fzSet = refCast<faceZoneSet>(set);
+
+        if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
+        {
+            Info<< "    Adding all faces from faceSet " << setName_
+                << " ..." << endl;
+
+            // Load the sets
+            faceSet fSet(mesh_, setName_);
+
+            // Start off from copy
+            DynamicList<label> newAddressing(fzSet.addressing());
+            DynamicList<bool> newFlipMap(fzSet.flipMap());
+
+            const faceList& faces = mesh_.faces();
+            const pointField& points = mesh_.points();
+
+            forAllConstIter(faceSet, fSet, iter)
+            {
+                label faceI = iter.key();
+
+                if (!fzSet.found(faceI))
+                {
+                    newAddressing.append(faceI);
+
+                    vector n = faces[faceI].normal(points);
+                    if ((n & normal_) > 0)
+                    {
+                        newFlipMap.append(false);
+                    }
+                    else
+                    {
+                        newFlipMap.append(true);
+                    }
+                }
+            }
+
+            fzSet.addressing().transfer(newAddressing);
+            fzSet.flipMap().transfer(newFlipMap);
+            fzSet.updateSet();
+        }
+        else if (action == topoSetSource::DELETE)
+        {
+            Info<< "    Removing all faces from faceSet " << setName_
+                << " ..." << endl;
+
+            // Load the set
+            faceSet loadedSet(mesh_, setName_);
+
+            // Start off empty
+            DynamicList<label> newAddressing(fzSet.addressing().size());
+            DynamicList<bool> newFlipMap(fzSet.flipMap().size());
+
+            forAll(fzSet.addressing(), i)
+            {
+                if (!loadedSet.found(fzSet.addressing()[i]))
+                {
+                    newAddressing.append(fzSet.addressing()[i]);
+                    newFlipMap.append(fzSet.flipMap()[i]);
+                }
+            }
+            fzSet.addressing().transfer(newAddressing);
+            fzSet.flipMap().transfer(newFlipMap);
+            fzSet.updateSet();
+        }
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.H b/src/meshTools/sets/faceZoneSources/setAndNormalToFaceZone/setAndNormalToFaceZone.H
similarity index 59%
rename from applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.H
rename to src/meshTools/sets/faceZoneSources/setAndNormalToFaceZone/setAndNormalToFaceZone.H
index 49f5218e4928119b189a16ad63b896d5c5dfd293..23c9c266fe46d3fab5e0509fa330dfd7a473dd5a 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/phaseEquationsOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.H
+++ b/src/meshTools/sets/faceZoneSources/setAndNormalToFaceZone/setAndNormalToFaceZone.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -22,90 +22,99 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
-    Foam::phaseEquationsOfState::adiabaticPerfectFluid
+    Foam::setAndNormalToFaceZone
 
 Description
-    AdiabaticPerfectFluid phase density model.
+    A topoSetSource to select faces based on usage in a faceSet, where the
+    normal vector is used to orient the faces.
 
 SourceFiles
-    adiabaticPerfectFluid.C
+    setAndNormalToFaceZone.C
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef adiabaticPerfectFluid_H
-#define adiabaticPerfectFluid_H
+#ifndef setAndNormalToFaceZone_H
+#define setAndNormalToFaceZone_H
 
-#include "phaseEquationOfState.H"
-#include "dimensionedTypes.H"
+#include "topoSetSource.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
 {
-namespace phaseEquationsOfState
-{
 
 /*---------------------------------------------------------------------------*\
-                           Class adiabaticPerfectFluid Declaration
+                   Class setAndNormalToFaceZone Declaration
 \*---------------------------------------------------------------------------*/
 
-class adiabaticPerfectFluid
+class setAndNormalToFaceZone
 :
-    public phaseEquationOfState
+    public topoSetSource
 {
     // Private data
 
-        //- Reference pressure
-        dimensionedScalar p0_;
-
-        //- Reference density
-        dimensionedScalar rho0_;
+        //- Add usage string
+        static addToUsageTable usage_;
 
-        //- The isentropic exponent
-        dimensionedScalar gamma_;
+        //- Name of set to use
+        word setName_;
 
-        //- Pressure offset for a stiffened gas
-        dimensionedScalar B_;
+        //- Normal used to orient the faces
+        vector normal_;
 
 
 public:
 
     //- Runtime type information
-    TypeName("adiabaticPerfectFluid");
-
+    TypeName("setAndNormalToFaceZone");
 
     // Constructors
 
         //- Construct from components
-        adiabaticPerfectFluid
+        setAndNormalToFaceZone
+        (
+            const polyMesh& mesh,
+            const word& setName,
+            const vector& normal
+        );
+
+        //- Construct from dictionary
+        setAndNormalToFaceZone
         (
+            const polyMesh& mesh,
             const dictionary& dict
         );
 
+        //- Construct from Istream
+        setAndNormalToFaceZone
+        (
+            const polyMesh& mesh,
+            Istream&
+        );
+
 
     //- Destructor
-    virtual ~adiabaticPerfectFluid();
+    virtual ~setAndNormalToFaceZone();
 
 
     // Member Functions
 
-        tmp<volScalarField> rho
-        (
-            const volScalarField& p,
-            const volScalarField& T
-        ) const;
+        virtual sourceType setType() const
+        {
+            return FACEZONESOURCE;
+        }
 
-        tmp<volScalarField> psi
+        virtual void applyToSet
         (
-            const volScalarField& p,
-            const volScalarField& T
+            const topoSetSource::setAction action,
+            topoSet&
         ) const;
+
 };
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace phaseEquationsOfState
 } // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/meshTools/sets/topoSets/faceZoneSet.C b/src/meshTools/sets/topoSets/faceZoneSet.C
index 10d9c0b9bfd0887e88a67969651c880822601cba..5b4849c1eff51e974aa474be8bc2b47e75e71691 100644
--- a/src/meshTools/sets/topoSets/faceZoneSet.C
+++ b/src/meshTools/sets/topoSets/faceZoneSet.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -49,8 +49,8 @@ void faceZoneSet::updateSet()
 {
     labelList order;
     sortedOrder(addressing_, order);
-    inplaceReorder(order, addressing_);
-    inplaceReorder(order, flipMap_);
+    addressing_ = UIndirectList<label>(addressing_, order)();
+    flipMap_ = UIndirectList<bool>(flipMap_, order)();
 
     faceSet::clearStorage();
     faceSet::resize(2*addressing_.size());
diff --git a/src/meshTools/tetOverlapVolume/tetOverlapVolume.H b/src/meshTools/tetOverlapVolume/tetOverlapVolume.H
index 58646f2e5a7ce3693391bbdb6d01acfb6f2284c3..87c65dcd89cf96be6cb59ec19e2b0d8b78036f0c 100644
--- a/src/meshTools/tetOverlapVolume/tetOverlapVolume.H
+++ b/src/meshTools/tetOverlapVolume/tetOverlapVolume.H
@@ -21,7 +21,6 @@ License
     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::tetOverlapVolume
 
diff --git a/src/meshTools/triSurface/surfaceLocation/surfaceLocation.C b/src/meshTools/triSurface/surfaceLocation/surfaceLocation.C
index 73f1d3bf9368d6cc8feec6b060cffe24de114529..1063a7f6b8dd7873a5d298bcb0f884a80474cbde 100644
--- a/src/meshTools/triSurface/surfaceLocation/surfaceLocation.C
+++ b/src/meshTools/triSurface/surfaceLocation/surfaceLocation.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,7 +21,7 @@ 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 "surfaceLocation.H"
 #include "triSurface.H"
diff --git a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C
index 9f8a6a5179bf739ac3b41244c337924ac3c7fd96..bc1402bd7a3c00e8ad3249452e76748a83d73aba 100644
--- a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C
+++ b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -222,7 +222,8 @@ Foam::pointToPointPlanarInterpolation::pointToPointPlanarInterpolation
 )
 :
     perturb_(perturb),
-    referenceCS_(calcCoordinateSystem(sourcePoints))
+    referenceCS_(calcCoordinateSystem(sourcePoints)),
+    nPoints_(sourcePoints.size())
 
 {
     calcWeights(sourcePoints, destPoints);
@@ -238,7 +239,8 @@ Foam::pointToPointPlanarInterpolation::pointToPointPlanarInterpolation
 )
 :
     perturb_(perturb),
-    referenceCS_(referenceCS)
+    referenceCS_(referenceCS),
+    nPoints_(sourcePoints.size())
 {
     calcWeights(sourcePoints, destPoints);
 }
diff --git a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H
index daec2e46880a4aad4b79988e4bce3282f052f685..e3428d80fea5af4cf98569ef22fc0fb7d9b1a763 100644
--- a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H
+++ b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -59,6 +59,9 @@ class pointToPointPlanarInterpolation
         //- Coordinate system
         coordinateSystem referenceCS_;
 
+        //- Number of source points (for checking)
+        label nPoints_;
+
         //- Current interpolation addressing to face centres of underlying
         //  patch
         List<FixedList<label, 3> > nearestVertex_;
@@ -114,6 +117,12 @@ public:
             return referenceCS_;
         }
 
+        //- Number of source points
+        label sourceSize() const
+        {
+            return nPoints_;
+        }
+
         //  patch
         const List<FixedList<label, 3> >& nearestVertex() const
         {
diff --git a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolationTemplates.C b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolationTemplates.C
index 9159a03eddecdc0faef4261314ac203c1f536b6d..f17f249d13a1a8384ca5334ea67b06b0a4d89ab0 100644
--- a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolationTemplates.C
+++ b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolationTemplates.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -33,6 +33,17 @@ Foam::tmp<Foam::Field<Type> > Foam::pointToPointPlanarInterpolation::interpolate
     const Field<Type>& sourceFld
 ) const
 {
+    if (nPoints_ != sourceFld.size())
+    {
+        FatalErrorIn
+        (
+            "pointToPointPlanarInterpolation::interpolate"
+            "(const Field<Type>&) const"
+        )   << "Number of source points = " << nPoints_
+            << " number of values = " << sourceFld.size()
+            << exit(FatalError);
+    }
+
     tmp<Field<Type> > tfld(new Field<Type>(nearestVertex_.size()));
     Field<Type>& fld = tfld();
 
diff --git a/src/parallel/decompose/scotchDecomp/scotchDecomp.C b/src/parallel/decompose/scotchDecomp/scotchDecomp.C
index e8bfe1aa10ebe92b6370494a5a539f190b199fcf..1715f316f27f58085da5339043486dbdf8331932 100644
--- a/src/parallel/decompose/scotchDecomp/scotchDecomp.C
+++ b/src/parallel/decompose/scotchDecomp/scotchDecomp.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
@@ -485,6 +485,40 @@ Foam::label Foam::scotchDecomp::decomposeOneProc
             SCOTCH_archCmplt(&archdat, nProcessors_),
             "SCOTCH_archCmplt"
         );
+
+
+        //- Hack to test clustering. Note that finalDecomp is non-compact
+        //  numbers!
+        //
+        ////- Set up variable sizes architecture
+        //check
+        //(
+        //    SCOTCH_archVcmplt(&archdat),
+        //    "SCOTCH_archVcmplt"
+        //);
+        //
+        ////- stategy flags: go for quality or load balance (or leave default)
+        //SCOTCH_Num straval = 0;
+        ////straval |= SCOTCH_STRATQUALITY;
+        ////straval |= SCOTCH_STRATQUALITY;
+        //
+        ////- Number of cells per agglomeration
+        ////SCOTCH_Num agglomSize = SCOTCH_archSize(&archdat);
+        //SCOTCH_Num agglomSize = 3;
+        //
+        ////- Build strategy for agglomeration
+        //check
+        //(
+        //    SCOTCH_stratGraphClusterBuild
+        //    (
+        //        &stradat,   // strategy to build
+        //        straval,    // strategy flags
+        //        agglomSize, // cells per cluster
+        //        1.0,        // weight?
+        //        0.01        // max load imbalance
+        //    ),
+        //    "SCOTCH_stratGraphClusterBuild"
+        //);
     }
 
 
diff --git a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMeshTemplates.C b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMeshTemplates.C
index e68fb735e7049ffdd4e33677393e5350b35af14f..5a341123a2a0f15ecf25550852b45350ab03dca6 100644
--- a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMeshTemplates.C
+++ b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMeshTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -88,22 +88,20 @@ void Foam::distributedTriSurfaceMesh::distributeFields
 {
     typedef DimensionedField<Type, triSurfaceGeoMesh> DimensionedSurfField;
 
-    HashTable<const DimensionedSurfField*> fields
+    HashTable<DimensionedSurfField*> fields
     (
-        objectRegistry::lookupClass
-        <DimensionedSurfField >()
+        objectRegistry::lookupClass<DimensionedSurfField>()
     );
 
     for
     (
-        typename HashTable<const DimensionedSurfField*>::iterator fieldIter =
+        typename HashTable<DimensionedSurfField*>::iterator fieldIter =
             fields.begin();
         fieldIter != fields.end();
         ++fieldIter
     )
     {
-        DimensionedSurfField& field =
-            const_cast<DimensionedSurfField&>(*fieldIter());
+        DimensionedSurfField& field = *fieldIter();
 
         label oldSize = field.size();
 
diff --git a/src/postProcessing/foamCalcFunctions/field/components/writeComponentFields.C b/src/postProcessing/foamCalcFunctions/field/components/writeComponentFields.C
index 23004ce1649068537955543bf858400768a55224..866952afa7d05c290a88bf1bfb523dd97d6b0df3 100644
--- a/src/postProcessing/foamCalcFunctions/field/components/writeComponentFields.C
+++ b/src/postProcessing/foamCalcFunctions/field/components/writeComponentFields.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -23,7 +23,7 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-template <class Type>
+template<class Type>
 void Foam::calcTypes::components::writeComponentFields
 (
     const IOobject& header,
diff --git a/src/postProcessing/foamCalcFunctions/field/randomise/writeRandomField.C b/src/postProcessing/foamCalcFunctions/field/randomise/writeRandomField.C
index 72ebd6e998f1709b5f2faa046404a050e9cd3dbb..0c024aa136e625cba0580f8e2dc02440e57760b5 100644
--- a/src/postProcessing/foamCalcFunctions/field/randomise/writeRandomField.C
+++ b/src/postProcessing/foamCalcFunctions/field/randomise/writeRandomField.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -23,7 +23,7 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-template <class Type>
+template<class Type>
 void Foam::calcTypes::randomise::writeRandomField
 (
     const IOobject& header,
diff --git a/src/postProcessing/functionObjects/Allwmake b/src/postProcessing/functionObjects/Allwmake
index 343d2bafc4e5c46fceab300981f7b2635b0c1d5b..178a1a3cfeac39360210abf8d266135354a5a479 100755
--- a/src/postProcessing/functionObjects/Allwmake
+++ b/src/postProcessing/functionObjects/Allwmake
@@ -6,6 +6,7 @@ set -x
 wmake $makeType cloud
 wmake $makeType field
 wmake $makeType forces
+wmake $makeType fvTools
 wmake $makeType IO
 wmake $makeType jobControl
 wmake $makeType systemCall
diff --git a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C
index 68c4ab2cedf7bbe0db6605acfa27f785ee9813f0..d714747310f6a2fdbdd4fd4ae998fbdf8e3d4b14 100644
--- a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C
+++ b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.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
@@ -167,13 +167,7 @@ void Foam::fieldAverage::calcAverages()
         prevTimeIndex_ = currentTimeIndex;
     }
 
-
     Info<< "Calculating averages" << nl << endl;
-    forAll(faItems_, fieldI)
-    {
-        totalIter_[fieldI]++;
-        totalTime_[fieldI] += obr_.time().deltaTValue();
-    }
 
     addMeanSqrToPrime2Mean<scalar, scalar>
     (
@@ -202,6 +196,12 @@ void Foam::fieldAverage::calcAverages()
         meanVectorFields_,
         prime2MeanSymmTensorFields_
     );
+
+    forAll(faItems_, fieldI)
+    {
+        totalIter_[fieldI]++;
+        totalTime_[fieldI] += obr_.time().deltaTValue();
+    }
 }
 
 
diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C
index cf9fb292364ca523ece7e94f592bdd07271d7409..0e0c93ed1b3ceda489c9fe3cdd842adc553c3acf 100644
--- a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C
+++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C
@@ -26,6 +26,8 @@ License
 #include "fieldValueDelta.H"
 #include "ListOps.H"
 #include "Time.H"
+#include "volFields.H"
+#include "surfaceFields.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -180,8 +182,10 @@ void Foam::fieldValues::fieldValueDelta::write()
         {
             Info<< "    none" << endl;
         }
-
-        Info<< endl;
+        else
+        {
+            Info<< endl;
+        }
     }
 }
 
diff --git a/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C b/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C
index cf1f749baf9418baa27d4da4ee3723223fc7f3b3..ff03f1160b301b2bd87d6681392de80e81649c48 100644
--- a/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C
+++ b/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.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
@@ -21,7 +21,7 @@ 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 "streamLineParticle.H"
 #include "vectorFieldIOField.H"
diff --git a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.C b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.C
index b89cf0e6503717bf7b56aed3af343adcba8c7ed0..f4f8fd5282104d78a1d31ceefeef36f6dfb645ef 100644
--- a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.C
+++ b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.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
@@ -21,7 +21,7 @@ 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 "wallBoundedParticle.H"
 #include "vectorFieldIOField.H"
diff --git a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedParticleTemplates.C b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedParticleTemplates.C
index f79d964c7be03dd594752ea04c613a6c099fddd4..18b1b37a8984928ea29d615f65f71bebfb71ae0b 100644
--- a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedParticleTemplates.C
+++ b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedParticleTemplates.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
@@ -21,7 +21,7 @@ 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 "wallBoundedParticle.H"
 
diff --git a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.C b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.C
index 272d38ce59fd070ae044f24b4bbd844f30e78b41..0bdf7006da3b8914cfd302c40c05e7d79e1f135a 100644
--- a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.C
+++ b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.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
@@ -21,7 +21,7 @@ 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 "wallBoundedStreamLineParticle.H"
 #include "vectorFieldIOField.H"
diff --git a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C
index ce38948089bac61b7ee462eb4ec091c1a8fa0d1e..5a6d8ed4e71760b5e93dfef3a236a94689a147dd 100644
--- a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C
+++ b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.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
@@ -137,8 +137,8 @@ void Foam::forceCoeffs::write()
             scalar Cd = sum(coeffs[1]);
             scalar Cm = sum(coeffs[2]);
 
-            scalar Clf = Cl/2.0 - Cm;
-            scalar Clr = Cl/2.0 + Cm;
+            scalar Clf = Cl/2.0 + Cm;
+            scalar Clr = Cl/2.0 - Cm;
 
             file()
                 << obr_.time().value() << tab
@@ -178,6 +178,17 @@ void Foam::forceCoeffs::write()
                 }
 
                 OFstream osCoeffs(forcesDir/"forceCoeffs_bins");
+
+                if (binCumulative_)
+                {
+                    for (label i = 1; i < coeffs[0].size(); i++)
+                    {
+                        coeffs[0][i] += coeffs[0][i-1];
+                        coeffs[1][i] += coeffs[1][i-1];
+                        coeffs[2][i] += coeffs[2][i-1];
+                    }
+                }
+
                 binWriterPtr->write(axis, fieldNames, coeffs, osCoeffs);
             }
 
diff --git a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H
index 74b129ea45d0abd06b055f8979e6deca37b2f7f2..b8112939b3685d1b0ee8c5cd353d31dbc0f8041b 100644
--- a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H
+++ b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H
@@ -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
@@ -128,12 +128,6 @@ class forceCoeffs
             scalar Aref_;
 
 
-        // Bin information
-
-            //- Writer for bin data
-            autoPtr<writer<scalar> > binWriterPtr_;
-
-
     // Private Member Functions
 
         //- Disallow default bitwise copy construct
diff --git a/src/postProcessing/functionObjects/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C
index 5b944cc2343158d0a7f02f2b87adc278f26997b4..4f272cdb35c2ec73281c5b29896f13fdf24677c7 100644
--- a/src/postProcessing/functionObjects/forces/forces/forces.C
+++ b/src/postProcessing/functionObjects/forces/forces/forces.C
@@ -198,10 +198,10 @@ void Foam::forces::applyBins
 {
     if (nBin_ == 1)
     {
-        force_[0][0] = sum(fN);
-        force_[1][0] = sum(fT);
-        moment_[0][0] = sum(Md ^ fN);
-        moment_[1][0] = sum(Md ^ fT);
+        force_[0][0] += sum(fN);
+        force_[1][0] += sum(fT);
+        moment_[0][0] += sum(Md ^ fN);
+        moment_[1][0] += sum(Md ^ fT);
     }
     else
     {
@@ -241,11 +241,25 @@ void Foam::forces::writeBins() const
 
     wordList fieldNames(IStringStream("(pressure viscous)")());
 
+    List<Field<vector> > f(force_);
+    List<Field<vector> > m(moment_);
+
+    if (binCumulative_)
+    {
+        for (label i = 1; i < f[0].size(); i++)
+        {
+            f[0][i] += f[0][i-1];
+            f[1][i] += f[1][i-1];
+            m[0][i] += m[0][i-1];
+            m[1][i] += m[1][i-1];
+        }
+    }
+
     OFstream osForce(forcesDir/"force_bins");
-    binWriterPtr->write(axis, fieldNames, force_, osForce);
+    binWriterPtr->write(axis, fieldNames, f, osForce);
 
     OFstream osMoment(forcesDir/"moment_bins");
-    binWriterPtr->write(axis, fieldNames, moment_, osMoment);
+    binWriterPtr->write(axis, fieldNames, m, osMoment);
 
 
     if (localSystem_)
@@ -257,6 +271,17 @@ void Foam::forces::writeBins() const
         localMoment[0] = coordSys_.localVector(moment_[0]);
         localMoment[1] = coordSys_.localVector(moment_[1]);
 
+        if (binCumulative_)
+        {
+            for (label i = 1; i < localForce[0].size(); i++)
+            {
+                localForce[0][i] += localForce[0][i-1];
+                localForce[1][i] += localForce[1][i-1];
+                localMoment[0][i] += localMoment[0][i-1];
+                localMoment[1][i] += localMoment[1][i-1];
+            }
+        }
+
         OFstream osLocalForce(forcesDir/"force_local");
         binWriterPtr->write(axis, fieldNames, localForce, osLocalForce);
 
@@ -298,7 +323,8 @@ Foam::forces::forces
     binDx_(0.0),
     binMin_(GREAT),
     binPoints_(),
-    binFormat_("undefined")
+    binFormat_("undefined"),
+    binCumulative_(true)
 {
     // Check if the available mesh is an fvMesh otherise deactivate
     if (!isA<fvMesh>(obr_))
@@ -356,7 +382,8 @@ Foam::forces::forces
     binDx_(0.0),
     binMin_(GREAT),
     binPoints_(),
-    binFormat_("undefined")
+    binFormat_("undefined"),
+    binCumulative_(true)
 {}
 
 
@@ -448,9 +475,11 @@ void Foam::forces::read(const dictionary& dict)
             localSystem_ = true;
         }
 
-        // read bin information if present
-        if (dict.readIfPresent<label>("nBin", nBin_))
+        if (dict.found("binData"))
         {
+            const dictionary& binDict(dict.subDict("binData"));
+            binDict.lookup("nBin") >> nBin_;
+
             if (nBin_ < 0)
             {
                 FatalIOErrorIn
@@ -470,7 +499,7 @@ void Foam::forces::read(const dictionary& dict)
 
             if (nBin_ > 1)
             {
-                dict.lookup("binDir") >> binDir_;
+                binDict.lookup("direction") >> binDir_;
                 binDir_ /= mag(binDir_);
 
                 binMin_ = GREAT;
@@ -499,7 +528,9 @@ void Foam::forces::read(const dictionary& dict)
                     binPoints_[i] = (i + 0.5)*binDir_*binDx_;
                 }
 
-                dict.lookup("binFormat") >> binFormat_;
+                binDict.lookup("format") >> binFormat_;
+
+                binDict.lookup("cumulative") >> binCumulative_;
 
                 // allocate storage for forces and moments
                 forAll(force_, i)
diff --git a/src/postProcessing/functionObjects/forces/forces/forces.H b/src/postProcessing/functionObjects/forces/forces/forces.H
index 12d72f61a69302bfdb0f5bf53c81e56f01cb5434..1f8ff06cb4b70b83a92792bae9e667a768610bcd 100644
--- a/src/postProcessing/functionObjects/forces/forces/forces.H
+++ b/src/postProcessing/functionObjects/forces/forces/forces.H
@@ -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
@@ -209,6 +209,9 @@ protected:
                 //- Write format for bin data
                 word binFormat_;
 
+                //- Should bin data be cumulative?
+                bool binCumulative_;
+
 
     // Protected Member Functions
 
diff --git a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C
index ad2f2d895481a64cf7953194fb3ee3f866ca5d33..cb6d4cbe63e20616c8017fd7e3f59e9095bd2576 100644
--- a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C
+++ b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.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
@@ -15,7 +15,7 @@ License
 
     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 PARTICLUAR PURPOSE.  See the GNU General Public License
+    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
diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.H b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.H
index bbf42c6809a0d833ac23ce6af24eda81b9e32b97..e15f680e644b5c354745c57bc8c96cf4071ca5f8 100644
--- a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.H
+++ b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -55,6 +55,7 @@ namespace Foam
 // Forward declaration of classes
 class objectRegistry;
 class dictionary;
+class polyMesh;
 class mapPolyMesh;
 class dimensionSet;
 
diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.H b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.H
index 7c8b15f499210a5ff881fe13bb66d18aec3ebf10..6822a7bb08492ea551283c2c72f3a54a33126e43 100644
--- a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.H
+++ b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -55,6 +55,7 @@ namespace Foam
 // Forward declaration of classes
 class objectRegistry;
 class dictionary;
+class polyMesh;
 class mapPolyMesh;
 class dimensionSet;
 
diff --git a/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.H b/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.H
index 96fe433d1e599108221032e3f43aca6e3b60e1be..d8a91cc802711f360dc94166cb1561b3584d5d3b 100644
--- a/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.H
+++ b/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -55,6 +55,7 @@ namespace Foam
 // Forward declaration of classes
 class objectRegistry;
 class dictionary;
+class polyMesh;
 class mapPolyMesh;
 class dimensionSet;
 
diff --git a/src/postProcessing/functionObjects/fvTools/doc/fvToolsFunctionObjectsDoc.H b/src/postProcessing/functionObjects/fvTools/doc/fvToolsFunctionObjectsDoc.H
new file mode 100644
index 0000000000000000000000000000000000000000..8d403604a5df338dce3bc44e8dd230c865599a39
--- /dev/null
+++ b/src/postProcessing/functionObjects/fvTools/doc/fvToolsFunctionObjectsDoc.H
@@ -0,0 +1,30 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\defgroup grpFVFunctionObjects Finite volume tools function objects
+@{
+    \ingroup grpFunctionObjects
+    This group contains finite-volume tools-based function objects
+@}
+
+\*---------------------------------------------------------------------------*/
diff --git a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C
index 7fc298e74d8565c5b32ba38e131e05aa3b52a9a7..607d52e5034eb046d30ceedc1803376a120a23ca 100644
--- a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C
+++ b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -39,7 +39,7 @@ defineTypeNameAndDebug(pressureTools, 0);
 
 Foam::word Foam::pressureTools::pName() const
 {
-    word fieldName = "p";
+    word fieldName = pName_;
 
     if (calcTotal_)
     {
diff --git a/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.C b/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.C
index 9a2f655624042f151c2dc57c4e4a4ca30c287df2..ad392c506bdef7e6c6b91aabf992118a9d0683e6 100644
--- a/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.C
+++ b/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.C
@@ -146,6 +146,7 @@ Foam::scalarTransport::scalarTransport
     active_(true),
     phiName_("phi"),
     UName_("U"),
+    rhoName_("rho"),
     DT_(0.0),
     userDT_(false),
     resetOnStartUp_(false),
@@ -192,6 +193,7 @@ void Foam::scalarTransport::read(const dictionary& dict)
 
         phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
         UName_ = dict.lookupOrDefault<word>("UName", "U");
+        rhoName_ = dict.lookupOrDefault<word>("rhoName", "rho");
 
         userDT_ = false;
         if (dict.readIfPresent("DT", DT_))
@@ -237,24 +239,59 @@ void Foam::scalarTransport::execute()
         relaxCoeff = mesh_.equationRelaxationFactor(schemeVar);
     }
 
-    // solve
-    for (label i = 0; i <= nCorr_; i++)
+    if (phi.dimensions() == dimMass/dimTime)
     {
-        fvScalarMatrix TEqn
-        (
-            fvm::ddt(T_)
-          + fvm::div(phi, T_, divScheme)
-          - fvm::laplacian(DT, T_, laplacianScheme)
-         ==
-            fvOptions_(T_)
-        );
+        const volScalarField& rho =
+            mesh_.lookupObject<volScalarField>(rhoName_);
+
+        // solve
+        for (label i = 0; i <= nCorr_; i++)
+        {
+            fvScalarMatrix TEqn
+            (
+                fvm::ddt(rho, T_)
+              + fvm::div(phi, T_, divScheme)
+              - fvm::laplacian(DT, T_, laplacianScheme)
+             ==
+                fvOptions_(rho, T_)
+            );
+
+            TEqn.relax(relaxCoeff);
+
+            fvOptions_.constrain(TEqn);
+
+            TEqn.solve(mesh_.solverDict(schemeVar));
+        }
+    }
+    else if (phi.dimensions() == dimVolume/dimTime)
+    {
+        // solve
+        for (label i = 0; i <= nCorr_; i++)
+        {
+            fvScalarMatrix TEqn
+            (
+                fvm::ddt(T_)
+              + fvm::div(phi, T_, divScheme)
+              - fvm::laplacian(DT, T_, laplacianScheme)
+             ==
+                fvOptions_(T_)
+            );
 
-        TEqn.relax(relaxCoeff);
+            TEqn.relax(relaxCoeff);
 
-        fvOptions_.constrain(TEqn);
+            fvOptions_.constrain(TEqn);
 
-        TEqn.solve(mesh_.solverDict(UName_));
+            TEqn.solve(mesh_.solverDict(schemeVar));
+        }
     }
+    else
+    {
+        FatalErrorIn("void Foam::scalarTransport::execute()")
+            << "Incompatible dimensions for phi: " << phi.dimensions() << nl
+            << "Dimensions should be " << dimMass/dimTime << " or "
+            << dimVolume/dimTime << endl;
+    }
+
 
     Info<< endl;
 }
diff --git a/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H b/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H
index fdeecdf3604e4ce6d6e5f5c035ed8a8e883abd9b..a58ed2268049379831ceaff4c1042434300d6f52 100644
--- a/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H
+++ b/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H
@@ -90,6 +90,9 @@ class scalarTransport
         //- Name of velocity field (optional)
         word UName_;
 
+        //- Name of density field (optional)
+        word rhoName_;
+
         //- Diffusion coefficient (optional)
         scalar DT_;
 
diff --git a/src/postProcessing/postCalc/postCalc.C b/src/postProcessing/postCalc/postCalc.C
index 0dfb6bf95707c0d1fa3482827ee2288f43b6f3b3..9eec208adf276b8e53911baf45483ae2047d0317 100644
--- a/src/postProcessing/postCalc/postCalc.C
+++ b/src/postProcessing/postCalc/postCalc.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
@@ -63,11 +63,6 @@ int main(int argc, char *argv[])
         "noWrite",
         "suppress writing results"
     );
-    Foam::argList::addBoolOption
-    (
-        "noFlow",
-        "suppress creating flow models (execFlowFunctionObjects only)"
-    );
     #include "addDictOption.H"
 
     #include "setRootCase.H"
diff --git a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C
index c54293f22b2295402f77d31dbc28c9183f119380..d09ec8ee554b90a6bd55c857b28ef7776a0c70ef 100644
--- a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C
+++ b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -59,12 +59,13 @@ void Foam::energyRegionCoupledFvPatchScalarField::setMethod() const
 {
     if (method_ == UNDEFINED)
     {
-        if (
-                this->db().foundObject<compressible::turbulenceModel>
-                (
-                    "turbulenceModel"
-                )
-           )
+        if
+        (
+            this->db().foundObject<compressible::turbulenceModel>
+            (
+                "turbulenceModel"
+            )
+        )
         {
             method_ = FLUID;
         }
@@ -105,13 +106,13 @@ kappa() const
     {
         case FLUID:
         {
-            const compressible::turbulenceModel& model =
+            const compressible::turbulenceModel& turbModel =
                 this->db().lookupObject<compressible::turbulenceModel>
                 (
                     "turbulenceModel"
                 );
 
-            return model.kappaEff(patch().index());
+            return turbModel.kappaEff(patch().index());
         }
         break;
 
@@ -212,8 +213,7 @@ energyRegionCoupledFvPatchScalarField
     const DimensionedField<scalar, volMesh>& iF
 )
 :
-    LduInterfaceField<scalar>(refCast<const lduInterface>(p)),
-    fvPatchScalarField(p, iF),
+    coupledFvPatchField<scalar>(p, iF),
     regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)),
     method_(UNDEFINED),
     nbrThermoPtr_(NULL),
@@ -230,8 +230,7 @@ energyRegionCoupledFvPatchScalarField
     const fvPatchFieldMapper& mapper
 )
 :
-    LduInterfaceField<scalar>(refCast<const lduInterface>(p)),
-    fvPatchScalarField(ptf, p, iF, mapper),
+    coupledFvPatchField<scalar>(ptf, p, iF, mapper),
     regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)),
     method_(ptf.method_),
     nbrThermoPtr_(NULL),
@@ -247,8 +246,7 @@ energyRegionCoupledFvPatchScalarField
     const dictionary& dict
 )
 :
-    LduInterfaceField<scalar>(refCast<const lduInterface>(p)),
-    fvPatchScalarField(p, iF, dict),
+    coupledFvPatchField<scalar>(p, iF, dict),
     regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)),
     method_(UNDEFINED),
     nbrThermoPtr_(NULL),
@@ -287,8 +285,7 @@ energyRegionCoupledFvPatchScalarField
     const energyRegionCoupledFvPatchScalarField& ptf
 )
 :
-    LduInterfaceField<scalar>(refCast<const lduInterface>(ptf.patch())),
-    fvPatchScalarField(ptf),
+    coupledFvPatchField<scalar>(ptf),
     regionCoupledPatch_(ptf.regionCoupledPatch_),
     method_(ptf.method_),
     nbrThermoPtr_(NULL),
@@ -303,8 +300,7 @@ energyRegionCoupledFvPatchScalarField
     const DimensionedField<scalar, volMesh>& iF
 )
 :
-    LduInterfaceField<scalar>(refCast<const lduInterface>(ptf.patch())),
-    fvPatchScalarField(ptf, iF),
+    coupledFvPatchField<scalar>(ptf, iF),
     regionCoupledPatch_(ptf.regionCoupledPatch_),
     method_(ptf.method_),
     nbrThermoPtr_(NULL),
@@ -314,24 +310,19 @@ energyRegionCoupledFvPatchScalarField
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-
 Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
 snGrad() const
 {
     return
-    (*this - patchInternalField())*regionCoupledPatch_.patch().deltaCoeffs();
+        regionCoupledPatch_.patch().deltaCoeffs()
+       *(*this - patchInternalField());
 }
 
 
-void Foam::energyRegionCoupledFvPatchScalarField::initEvaluate
-(
-    const Pstream::commsTypes
-)
+Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
+snGrad(const scalarField&) const
 {
-    if (!updated())
-    {
-        updateCoeffs();
-    }
+    return snGrad();
 }
 
 
@@ -365,42 +356,6 @@ void Foam::energyRegionCoupledFvPatchScalarField::evaluate
 }
 
 
-Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
-valueInternalCoeffs
-(
-    const tmp<scalarField>& w
-) const
-{
-    return scalar(pTraits<scalar>::one)*w;
-}
-
-
-Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
-valueBoundaryCoeffs
-(
-    const tmp<scalarField>& w
-) const
-{
-    return scalar(pTraits<scalar>::one)*(1.0 - w);
-}
-
-
-Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
-gradientInternalCoeffs() const
-{
-    return
-        -scalar(pTraits<scalar>::one)
-        *regionCoupledPatch_.patch().deltaCoeffs();
-}
-
-
-Foam::tmp<Foam::scalarField> Foam::energyRegionCoupledFvPatchScalarField::
-gradientBoundaryCoeffs() const
-{
-    return -this->gradientInternalCoeffs();
-}
-
-
 Foam::tmp<Foam::Field<Foam::scalar> >
 Foam::energyRegionCoupledFvPatchScalarField::
 patchNeighbourField() const
@@ -546,6 +501,7 @@ void Foam::energyRegionCoupledFvPatchScalarField::write(Ostream& os) const
     this->writeEntry("value", os);
 }
 
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
diff --git a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H
index 7b0b7df39c39cc18c7285241510d363bb7fbedce..7103f1f1f1224120bff0c8a43d4250e0ed0602bc 100644
--- a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H
+++ b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -43,22 +43,23 @@ SourceFiles
 #include "fvPatchField.H"
 #include "NamedEnum.H"
 #include "basicThermo.H"
+#include "coupledFvPatchField.H"
+
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
 {
 
-
 /*---------------------------------------------------------------------------*\
              Class energyRegionCoupledFvPatchScalarField Declaration
 \*---------------------------------------------------------------------------*/
 
 class energyRegionCoupledFvPatchScalarField
 :
-    public LduInterfaceField<scalar>,
-    public fvPatchScalarField
+    public coupledFvPatchField<scalar>
 {
+
 public:
 
         enum kappaMethodType
@@ -162,12 +163,6 @@ public:
             const DimensionedField<scalar, volMesh>&
         );
 
-
-    //- Destructor
-    virtual ~energyRegionCoupledFvPatchScalarField()
-    {}
-
-
         //- Construct and return a clone setting internal field reference
         virtual tmp<fvPatchField<scalar> > clone
         (
@@ -181,16 +176,14 @@ public:
         }
 
 
-    // Member functions
+    //- Destructor
+    virtual ~energyRegionCoupledFvPatchScalarField()
+    {}
 
 
-        // Access
+    // Member functions
 
-            //- Return true if this patch field is coupled
-            virtual bool coupled() const
-            {
-                return true;
-            }
+        // Access
 
             //- Method to obtain K
             word kappaMethod() const
@@ -207,11 +200,13 @@ public:
             //- Return patch-normal gradient
             virtual tmp<scalarField> snGrad() const;
 
-            //- Initialise the evaluation of the patch field
-            virtual void initEvaluate
+            //- Return patch-normal gradient
+            //  Note: the deltaCoeffs supplied are not used
+            virtual tmp<scalarField> snGrad
             (
-                const Pstream::commsTypes commsType
-            );
+                const scalarField& deltaCoeffs
+            ) const;
+
 
             //- Evaluate the patch field
             virtual void evaluate
@@ -219,28 +214,6 @@ public:
                 const Pstream::commsTypes commsType
             );
 
-            //- Return the matrix diagonal coefficients corresponding to the
-            //  evaluation of the value of this patchField with given weights
-            virtual tmp<scalarField> valueInternalCoeffs
-            (
-                const tmp<scalarField>&
-            ) const;
-
-            //- Return the matrix source coefficients corresponding to the
-            //  evaluation of the value of this patchField with given weights
-            virtual tmp<scalarField> valueBoundaryCoeffs
-            (
-                const tmp<scalarField>&
-            ) const;
-
-            //- Return the matrix diagonal coefficients corresponding to the
-            //  evaluation of the gradient of this patchField
-            virtual tmp<scalarField> gradientInternalCoeffs() const;
-
-            //- Return the matrix source coefficients corresponding to the
-            //  evaluation of the gradient of this patchField
-            virtual tmp<scalarField> gradientBoundaryCoeffs() const;
-
 
         // Coupled interface functionality
 
diff --git a/src/regionModels/Allwclean b/src/regionModels/Allwclean
index def3e82f78c4a4f0aff29439b32bd8a3b239b4b8..f95d816a531fc1f4a94727559b5cf7303cee193f 100755
--- a/src/regionModels/Allwclean
+++ b/src/regionModels/Allwclean
@@ -6,7 +6,7 @@ set -x
 wclean $makeType regionModel
 wclean $makeType pyrolysisModels
 wclean $makeType surfaceFilmModels
-wclean $makeType thermoBaffleModels
+wclean $makeType thermalBaffleModels
 wclean $makeType regionCoupling
 
 
diff --git a/src/regionModels/Allwmake b/src/regionModels/Allwmake
index 5c97cae02b1c15bd910e3547f6c7ae639b82d25e..0ca6e6338a93971b6d30465386179a1f088386e2 100755
--- a/src/regionModels/Allwmake
+++ b/src/regionModels/Allwmake
@@ -6,7 +6,7 @@ set -x
 wmake $makeType regionModel
 wmake $makeType pyrolysisModels
 wmake $makeType surfaceFilmModels
-wmake $makeType thermoBaffleModels
+wmake $makeType thermalBaffleModels
 wmake $makeType regionCoupling
 
 
diff --git a/src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.C b/src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.C
index 794b38514b678c06f43cac967940f707b1bb8342..0c2066f686b0f2e5017a3a6dddf148898d2cbf24 100644
--- a/src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.C
+++ b/src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.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
@@ -49,7 +49,7 @@ void noPyrolysis::constructThermoChemistry()
 {
     solidChemistry_.reset
     (
-        solidChemistryModel::New(regionMesh()).ptr()
+        basicSolidChemistryModel::New(regionMesh()).ptr()
     );
 
     solidThermo_.reset(&solidChemistry_->solidThermo());
diff --git a/src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.H b/src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.H
index 87fbd604c78b27b12b3fc5a96546f15c663e866f..dbbf3e4fa1052c069f2998d1bb80d450eb44a478 100644
--- a/src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.H
+++ b/src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.H
@@ -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
@@ -37,7 +37,7 @@ SourceFiles
 
 #include "pyrolysisModel.H"
 #include "volFieldsFwd.H"
-#include "solidChemistryModel.H"
+#include "basicSolidChemistryModel.H"
 #include "radiationModel.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -82,7 +82,7 @@ protected:
         void constructThermoChemistry();
 
         //- Reference to the solid chemistry model
-        autoPtr<solidChemistryModel> solidChemistry_;
+        autoPtr<basicSolidChemistryModel> solidChemistry_;
 
         //- Reference to solid thermo
         autoPtr<solidReactionThermo> solidThermo_;
diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C
index 84fb91407fedc08693a192807ff640a0bfd5d46b..43e2017b02f953256327b3d2b7e233e681c7a998 100644
--- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C
+++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.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
@@ -303,7 +303,7 @@ void reactingOneDim::calculateMassTransfer()
 reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh)
 :
     pyrolysisModel(modelType, mesh),
-    solidChemistry_(solidChemistryModel::New(regionMesh())),
+    solidChemistry_(basicSolidChemistryModel::New(regionMesh())),
     solidThermo_(solidChemistry_->solidThermo()),
     radiation_(radiation::radiationModel::New(solidThermo_.T())),
     rho_
@@ -386,7 +386,7 @@ reactingOneDim::reactingOneDim
 )
 :
     pyrolysisModel(modelType, mesh, dict),
-    solidChemistry_(solidChemistryModel::New(regionMesh())),
+    solidChemistry_(basicSolidChemistryModel::New(regionMesh())),
     solidThermo_(solidChemistry_->solidThermo()),
     radiation_(radiation::radiationModel::New(solidThermo_.T())),
     rho_
diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H
index 104e56c34e82b1598fa324c66602812601047482..d323f952f505c45f4810e2972f36e9a02591c306 100644
--- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H
+++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H
@@ -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
@@ -36,7 +36,7 @@ SourceFiles
 #define reactingOneDim_H
 
 #include "pyrolysisModel.H"
-#include "solidChemistryModel.H"
+#include "basicSolidChemistryModel.H"
 #include "radiationModel.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -76,7 +76,7 @@ protected:
     // Protected data
 
         //- Reference to the solid chemistry model
-        autoPtr<solidChemistryModel> solidChemistry_;
+        autoPtr<basicSolidChemistryModel> solidChemistry_;
 
         //- Reference to solid thermo
         solidReactionThermo& solidThermo_;
diff --git a/src/regionModels/regionModel/derivedFvPatches/mappedVariableThicknessWall/mappedVariableThicknessWallFvPatch.C b/src/regionModels/regionModel/derivedFvPatches/mappedVariableThicknessWall/mappedVariableThicknessWallFvPatch.C
index 74a4416e2d35bbf7bd7e59871e93b704bfc01731..2bd7a7aebfd20dadf46ac1ec1ca3a5670f964bd7 100644
--- a/src/regionModels/regionModel/derivedFvPatches/mappedVariableThicknessWall/mappedVariableThicknessWallFvPatch.C
+++ b/src/regionModels/regionModel/derivedFvPatches/mappedVariableThicknessWall/mappedVariableThicknessWallFvPatch.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
@@ -54,7 +54,7 @@ makeDeltaCoeffs(scalarField& dc) const
     const modelType& region1D =
         patch().boundaryMesh().mesh().time().lookupObject<modelType>
         (
-            "thermoBaffleProperties"
+            "thermalBaffleProperties"
         );
 
     dc = 2.0/(pp.thickness()/region1D.nLayers());
diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C
index 21d86aa6fa8c2f2c64ef1aac41c607a5317b4d47..fecefcd2e367be8dd1a5ffb064cd8239b0c2d533 100644
--- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C
+++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.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
@@ -282,8 +282,8 @@ void kinematicSingleLayer::updateSurfaceVelocities()
     Uw_ -= nHat()*(Uw_ & nHat());
     Uw_.correctBoundaryConditions();
 
-    // apply quadratic profile to surface velocity
-    Us_ = 2.0*U_;
+    // apply quadratic profile to surface velocity (scale by sqrt(2))
+    Us_ = 1.414*U_;
     Us_.correctBoundaryConditions();
 }
 
@@ -299,8 +299,6 @@ tmp<Foam::fvVectorMatrix> kinematicSingleLayer::solveMomentum
         Info<< "kinematicSingleLayer::solveMomentum()" << endl;
     }
 
-    updateSurfaceVelocities();
-
     // Momentum
     tmp<fvVectorMatrix> tUEqn
     (
@@ -861,8 +859,13 @@ void kinematicSingleLayer::evolveRegion()
         Info<< "kinematicSingleLayer::evolveRegion()" << endl;
     }
 
+    // Update film coverage indicator
     correctAlpha();
 
+    // Update film wall and surface velocities
+    updateSurfaceVelocities();
+
+    // Update sub-models to provide updated source contributions
     updateSubmodels();
 
     // Solve continuity for deltaRho_
@@ -890,9 +893,6 @@ void kinematicSingleLayer::evolveRegion()
     // Update deltaRho_ with new delta_
     deltaRho_ == delta_*rho_;
 
-    // Update film wall and surface velocities
-    updateSurfaceVelocities();
-
     // Reset source terms for next time integration
     resetPrimaryRegionSourceTerms();
 }
diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C
index 2909b23c4a14f6f5669c26668f7756dd14b8e87c..271af50e7bf62848921a68c0aded36e5141e3681 100644
--- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C
+++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C
@@ -96,14 +96,14 @@ contactAngleForce::contactAngleForce
     (
         IOobject
         (
-            typeName + ".contactForceMask",
+            typeName + ":contactForceMask",
             owner_.time().timeName(),
             owner_.regionMesh(),
             IOobject::NO_READ,
             IOobject::NO_WRITE
         ),
         owner_.regionMesh(),
-        dimensionedScalar("mask", dimless, 0.0)
+        dimensionedScalar("mask", dimless, 1.0)
     )
 {
     initialise();
@@ -126,7 +126,7 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U)
         (
             IOobject
             (
-                typeName + ".contactForce",
+                typeName + ":contactForce",
                 owner_.time().timeName(),
                 owner_.regionMesh(),
                 IOobject::NO_READ,
@@ -149,8 +149,6 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U)
 
     volVectorField gradAlpha(fvc::grad(alpha));
 
-    scalarField nHits(owner_.regionMesh().nCells(), 0.0);
-
     forAll(nbr, faceI)
     {
         const label cellO = own[faceI];
@@ -166,14 +164,13 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U)
             cellI = cellN;
         }
 
-        if (cellI != -1 && mask_[cellI] > 0)
+        if (cellI != -1 && mask_[cellI] > 0.5)
         {
-            const scalar dx = owner_.regionMesh().deltaCoeffs()[faceI];
+            const scalar invDx = owner_.regionMesh().deltaCoeffs()[faceI];
             const vector n =
                 gradAlpha[cellI]/(mag(gradAlpha[cellI]) + ROOTVSMALL);
             scalar theta = cos(degToRad(distribution_->sample()));
-            force[cellI] += Ccf_*n*sigma[cellI]*(1.0 - theta)/dx;
-            nHits[cellI]++;
+            force[cellI] += Ccf_*n*sigma[cellI]*(1.0 - theta)/invDx;
         }
     }
 
@@ -183,12 +180,12 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U)
         {
             const fvPatchField<scalar>& alphaf = alpha.boundaryField()[patchI];
             const fvPatchField<scalar>& maskf = mask_.boundaryField()[patchI];
-            const scalarField& dx = alphaf.patch().deltaCoeffs();
+            const scalarField& invDx = alphaf.patch().deltaCoeffs();
             const labelUList& faceCells = alphaf.patch().faceCells();
 
             forAll(alphaf, faceI)
             {
-                if (maskf[faceI] > 0)
+                if (maskf[faceI] > 0.5)
                 {
                     label cellO = faceCells[faceI];
 
@@ -199,16 +196,14 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U)
                            /(mag(gradAlpha[cellO]) + ROOTVSMALL);
                         scalar theta = cos(degToRad(distribution_->sample()));
                         force[cellO] +=
-                            Ccf_*n*sigma[cellO]*(1.0 - theta)/dx[faceI];
-                        nHits[cellO]++;
+                            Ccf_*n*sigma[cellO]*(1.0 - theta)/invDx[faceI];
                     }
                 }
             }
         }
     }
 
-    force /= (max(nHits, scalar(1.0))*magSf);
-    tForce().correctBoundaryConditions();
+    force /= magSf;
 
     if (owner_.regionMesh().time().outputTime())
     {
diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/force.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/force.H
index 24e921da73d122af4ceefe69649c1f75513e7ef0..59389c387bf2cedd499780826436e4252b438f8d 100644
--- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/force.H
+++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/force.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -108,7 +108,7 @@ public:
         (
             const surfaceFilmModel& owner,
             const dictionary& dict,
-            const word& mdoelType
+            const word& modelType
         );
 
 
diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C
index a2c910c412397d0a85ca7b0447af260a3701d298..8089d1fba8489b86d5f003fa83f18d037cd46c25 100644
--- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C
+++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.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
@@ -76,70 +76,11 @@ tmp<fvVectorMatrix> surfaceShearForce::correct(volVectorField& U)
     const volScalarField& delta = film.delta();
     const volVectorField& Up = film.UPrimary();
 
-    // film surface linear coeff to apply to velocity
-    tmp<volScalarField> tCs;
-
-    typedef compressible::turbulenceModel turbModel;
-    if (film.primaryMesh().foundObject<turbModel>("turbulenceModel"))
-    {
-        // local reference to turbulence model
-        const turbModel& turb =
-            film.primaryMesh().lookupObject<turbModel>("turbulenceModel");
-
-        // calculate and store the stress on the primary region
-        const volSymmTensorField primaryReff(turb.devRhoReff());
-
-        // create stress field on film
-        // - note boundary condition types (mapped)
-        // - to map, the field name must be the same as the field on the
-        //   primary region
-        volSymmTensorField Reff
-        (
-            IOobject
-            (
-                primaryReff.name(),
-                film.regionMesh().time().timeName(),
-                film.regionMesh(),
-                IOobject::NO_READ,
-                IOobject::NO_WRITE
-            ),
-            film.regionMesh(),
-            dimensionedSymmTensor
-            (
-                "zero",
-                primaryReff.dimensions(),
-                symmTensor::zero
-            ),
-            film.mappedFieldAndInternalPatchTypes<symmTensor>()
-        );
-
-        // map stress from primary region to film region
-        Reff.correctBoundaryConditions();
-
-        dimensionedScalar U0("SMALL", U.dimensions(), SMALL);
-        volVectorField UHat("UHat", (Up - U)/(mag(Up - U) + U0));
-
-        // shear stress tangential to the film
-        volVectorField tauTan
-        (
-            "tauTan",
-            UHat & (Reff + film.nHat()*(-film.nHat() & Reff))
-        );
-
-        // note: Cf_ 'should' be 1 in this case
-        tCs = Cf_*mag(tauTan)/(mag(Up - U) + U0);
-    }
-    else
-    {
-        // laminar case - employ simple coeff-based model
-        const volScalarField& rhop = film.rhoPrimary();
-        tCs = Cf_*rhop*mag(Up - U);
-    }
+    // laminar case - employ simple coeff-based model
+    const volScalarField& rhop = film.rhoPrimary();
+    volScalarField Cs("Cs", Cf_*rhop*mag(Up - U));
 
     dimensionedScalar d0("SMALL", delta.dimensions(), SMALL);
-
-    // linear coeffs to apply to velocity
-    const volScalarField& Cs = tCs();
     volScalarField Cw("Cw", mu/(0.3333*(delta + d0)));
     Cw.min(5000.0);
 
diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/drippingInjection/drippingInjection.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/drippingInjection/drippingInjection.C
index e271674b10d551e594e5752a71427aca98eae0ba..237e1b243efc3e456dfbebe78aaf8828f3c7f970 100644
--- a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/drippingInjection/drippingInjection.C
+++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/drippingInjection/drippingInjection.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -66,13 +66,8 @@ drippingInjection::drippingInjection
             rndGen_
         )
     ),
-    diameter_(owner.regionMesh().nCells(), 0.0)
-{
-    forAll(diameter_, faceI)
-    {
-        diameter_[faceI] = parcelDistribution_->sample();
-    }
-}
+    diameter_(owner.regionMesh().nCells(), -1.0)
+{}
 
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
@@ -117,27 +112,41 @@ void drippingInjection::correct
 
 
     // Collect the data to be transferred
-    forAll(massToInject, cellI)
+    forAll(massDrip, cellI)
     {
-        scalar rhoc = rho[cellI];
-        scalar diam = diameter_[cellI];
-        scalar minMass = particlesPerParcel_*rhoc*pi/6*pow3(diam);
-
-        if (massDrip[cellI] > minMass)
+        if (massDrip[cellI] > 0)
         {
-            // All drip mass can be injected
-            massToInject[cellI] += massDrip[cellI];
-            availableMass[cellI] -= massDrip[cellI];
-
-            // Set particle diameter
-            diameterToInject[cellI] = diameter_[cellI];
-
-            // Retrieve new particle diameter sample
-            diameter_[cellI] = parcelDistribution_->sample();
+            // set new particle diameter if not already set
+            if (diameter_[cellI] < 0)
+            {
+                diameter_[cellI] = parcelDistribution_->sample();
+            }
+
+            scalar& diam = diameter_[cellI];
+            scalar rhoc = rho[cellI];
+            scalar minMass = particlesPerParcel_*rhoc*pi/6*pow3(diam);
+
+            if (massDrip[cellI] > minMass)
+            {
+                // All drip mass can be injected
+                massToInject[cellI] += massDrip[cellI];
+                availableMass[cellI] -= massDrip[cellI];
+
+                // Set particle diameter
+                diameterToInject[cellI] = diam;
+
+                // Retrieve new particle diameter sample
+                diam = parcelDistribution_->sample();
+            }
+            else
+            {
+                // Particle mass below minimum threshold - cannot be injected
+                massToInject[cellI] = 0.0;
+                diameterToInject[cellI] = 0.0;
+            }
         }
         else
         {
-            // Mass below minimum threshold - cannot be injected
             massToInject[cellI] = 0.0;
             diameterToInject[cellI] = 0.0;
         }
diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C
index f7e1b821432e644d405d2242a825c98596e2c8e3..d10288ea0a24b314af5e8ea9f11c87b0cd685d60 100644
--- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C
+++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -61,7 +61,7 @@ constantRadiation::constantRadiation
     (
         IOobject
         (
-            typeName + "::QrConst",
+            typeName + ":QrConst",
             owner.time().timeName(),
             owner.regionMesh(),
             IOobject::MUST_READ,
@@ -73,7 +73,7 @@ constantRadiation::constantRadiation
     (
         IOobject
         (
-            typeName + "::mask",
+            typeName + ":mask",
             owner.time().timeName(),
             owner.regionMesh(),
             IOobject::READ_IF_PRESENT,
@@ -110,7 +110,7 @@ tmp<volScalarField> constantRadiation::Shs()
         (
             IOobject
             (
-                typeName + "::Shs",
+                typeName + ":Shs",
                 owner().time().timeName(),
                 owner().regionMesh(),
                 IOobject::NO_READ,
diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/noRadiation/noRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/noRadiation/noRadiation.C
index b122b0b1bdcf7f3f7d618f8f96c43d391f8e771b..258323b7da5450973aec95af5c9782b8ed9d0b0e 100644
--- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/noRadiation/noRadiation.C
+++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/noRadiation/noRadiation.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
@@ -82,7 +82,7 @@ tmp<volScalarField> noRadiation::Shs()
         (
             IOobject
             (
-                typeName + ".Shs",
+                typeName + ":Shs",
                 owner().time().timeName(),
                 owner().regionMesh(),
                 IOobject::NO_READ,
diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C
index 2fdccf63f76db32f078bd76d436202119f1d016d..aacef9ce1f153f8b9bb3c2aca930436a2e4f8737 100644
--- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C
+++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -97,7 +97,7 @@ tmp<volScalarField> primaryRadiation::Shs()
         (
             IOobject
             (
-                typeName + "::Shs",
+                typeName + ":Shs",
                 owner().time().timeName(),
                 owner().regionMesh(),
                 IOobject::NO_READ,
diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C
index 1ff32747161d746d71b3b9e8c82f9af7deec74c8..02b5f62f09bb71fdb85d8e8f45c01c49d09ce3ce 100644
--- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C
+++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.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
@@ -113,7 +113,7 @@ tmp<volScalarField> standardRadiation::Shs()
         (
             IOobject
             (
-                typeName + ".Shs",
+                typeName + ":Shs",
                 owner().time().timeName(),
                 owner().regionMesh(),
                 IOobject::NO_READ,
diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C
index 5bf0534819f0404869ee2193d28c5c4725c2d9fd..42d459ce01254a404dbff9ef2863dcf4fbd47cdf 100644
--- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C
+++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.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
@@ -637,8 +637,16 @@ void thermoSingleLayer::evolveRegion()
         Info<< "thermoSingleLayer::evolveRegion()" << endl;
     }
 
+    // Update film coverage indicator
     correctAlpha();
 
+    // Update film wall and surface velocities
+    updateSurfaceVelocities();
+
+    // Update film wall and surface temperatures
+    updateSurfaceTemperatures();
+
+    // Update sub-models to provide updated source contributions
     updateSubmodels();
 
     // Solve continuity for deltaRho_
@@ -672,12 +680,6 @@ void thermoSingleLayer::evolveRegion()
     // Update temperature using latest hs_
     T_ == T(hs_);
 
-    // Update film wall and surface velocities
-    updateSurfaceVelocities();
-
-    // Update film wall and surface temperatures
-    updateSurfaceTemperatures();
-
     // Reset source terms for next time integration
     resetPrimaryRegionSourceTerms();
 }
diff --git a/src/regionModels/thermalBaffleModels/Make/files b/src/regionModels/thermalBaffleModels/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..dd0a6ebada305ee6d374dbbf8c08ec58e7d4d30c
--- /dev/null
+++ b/src/regionModels/thermalBaffleModels/Make/files
@@ -0,0 +1,9 @@
+thermalBaffleModel/thermalBaffleModel.C
+thermalBaffleModel/thermalBaffleModelNew.C
+thermalBaffle/thermalBaffle.C
+noThermo/noThermo.C
+
+derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C
+
+
+LIB = $(FOAM_LIBBIN)/libthermalBaffleModels
diff --git a/src/regionModels/thermoBaffleModels/Make/options b/src/regionModels/thermalBaffleModels/Make/options
similarity index 100%
rename from src/regionModels/thermoBaffleModels/Make/options
rename to src/regionModels/thermalBaffleModels/Make/options
diff --git a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/doc/thermoBaffleBoundaryConditionsDoc.H b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/doc/thermalBaffleBoundaryConditionsDoc.H
similarity index 86%
rename from src/regionModels/thermoBaffleModels/derivedFvPatchFields/doc/thermoBaffleBoundaryConditionsDoc.H
rename to src/regionModels/thermalBaffleModels/derivedFvPatchFields/doc/thermalBaffleBoundaryConditionsDoc.H
index ac1553d10405d66a902a8e9100884f3fd28e8ac6..a2263c83c1815ffccd2d8320674e941a757c9be2 100644
--- a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/doc/thermoBaffleBoundaryConditionsDoc.H
+++ b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/doc/thermalBaffleBoundaryConditionsDoc.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -23,9 +23,9 @@ License
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-\defgroup grpThermoBoundaryConditions Thermo baffle boundary conditions
+\defgroup grpThermoBaffleBoundaryConditions Thermo baffle boundary conditions
 @{
-    \ingroup grpRegionBoundaryConditions
+    \ingroup grpThermoBoundaryConditions
     This group contains thermo baffle model boundary conditions
 @}
 
diff --git a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/thermoBaffle/thermoBaffleFvPatchScalarField.C b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C
similarity index 84%
rename from src/regionModels/thermoBaffleModels/derivedFvPatchFields/thermoBaffle/thermoBaffleFvPatchScalarField.C
rename to src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C
index 471295924eb18851af009eac6e06e15685a64b9f..3d254324b67daed5ee71ff56b3258175552346e5 100644
--- a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/thermoBaffle/thermoBaffleFvPatchScalarField.C
+++ b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.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
@@ -23,7 +23,7 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "thermoBaffleFvPatchScalarField.H"
+#include "thermalBaffleFvPatchScalarField.H"
 #include "addToRunTimeSelectionTable.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -35,8 +35,8 @@ namespace compressible
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-thermoBaffleFvPatchScalarField::
-thermoBaffleFvPatchScalarField
+thermalBaffleFvPatchScalarField::
+thermalBaffleFvPatchScalarField
 (
     const fvPatch& p,
     const DimensionedField<scalar, volMesh>& iF
@@ -49,10 +49,10 @@ thermoBaffleFvPatchScalarField
 {}
 
 
-thermoBaffleFvPatchScalarField::
-thermoBaffleFvPatchScalarField
+thermalBaffleFvPatchScalarField::
+thermalBaffleFvPatchScalarField
 (
-    const thermoBaffleFvPatchScalarField& ptf,
+    const thermalBaffleFvPatchScalarField& ptf,
     const fvPatch& p,
     const DimensionedField<scalar, volMesh>& iF,
     const fvPatchFieldMapper& mapper
@@ -71,8 +71,8 @@ thermoBaffleFvPatchScalarField
 {}
 
 
-thermoBaffleFvPatchScalarField::
-thermoBaffleFvPatchScalarField
+thermalBaffleFvPatchScalarField::
+thermalBaffleFvPatchScalarField
 (
     const fvPatch& p,
     const DimensionedField<scalar, volMesh>& iF,
@@ -88,8 +88,8 @@ thermoBaffleFvPatchScalarField
     {
         FatalErrorIn
         (
-            "thermoBaffleFvPatchScalarField::"
-            "thermoBaffleFvPatchScalarField\n"
+            "thermalBaffleFvPatchScalarField::"
+            "thermalBaffleFvPatchScalarField\n"
             "(\n"
             "    const fvPatch& p,\n"
             "    const DimensionedField<scalar, volMesh>& iF,\n"
@@ -110,7 +110,7 @@ thermoBaffleFvPatchScalarField
 
     const fvMesh& thisMesh = patch().boundaryMesh().mesh();
 
-    typedef regionModels::thermoBaffleModels::thermoBaffleModel baffle;
+    typedef regionModels::thermalBaffleModels::thermalBaffleModel baffle;
 
     if
     (
@@ -127,10 +127,10 @@ thermoBaffleFvPatchScalarField
 }
 
 
-thermoBaffleFvPatchScalarField::
-thermoBaffleFvPatchScalarField
+thermalBaffleFvPatchScalarField::
+thermalBaffleFvPatchScalarField
 (
-    const thermoBaffleFvPatchScalarField& ptf,
+    const thermalBaffleFvPatchScalarField& ptf,
     const DimensionedField<scalar, volMesh>& iF
 )
 :
@@ -144,7 +144,7 @@ thermoBaffleFvPatchScalarField
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 
-void thermoBaffleFvPatchScalarField::autoMap
+void thermalBaffleFvPatchScalarField::autoMap
 (
     const fvPatchFieldMapper& m
 )
@@ -153,7 +153,7 @@ void thermoBaffleFvPatchScalarField::autoMap
 }
 
 
-void thermoBaffleFvPatchScalarField::rmap
+void thermalBaffleFvPatchScalarField::rmap
 (
     const fvPatchScalarField& ptf,
     const labelList& addr
@@ -163,7 +163,7 @@ void thermoBaffleFvPatchScalarField::rmap
 }
 
 
-void thermoBaffleFvPatchScalarField::updateCoeffs()
+void thermalBaffleFvPatchScalarField::updateCoeffs()
 {
     if (this->updated())
     {
@@ -181,7 +181,7 @@ void thermoBaffleFvPatchScalarField::updateCoeffs()
 }
 
 
-void thermoBaffleFvPatchScalarField::write(Ostream& os) const
+void thermalBaffleFvPatchScalarField::write(Ostream& os) const
 {
     turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::write(os);
 
@@ -189,9 +189,9 @@ void thermoBaffleFvPatchScalarField::write(Ostream& os) const
 
     if (thisMesh.name() == polyMesh::defaultRegion && owner_)
     {
-        word thermoModel = dict_.lookup("thermoBaffleModel");
+        word thermoModel = dict_.lookup("thermalBaffleModel");
 
-        os.writeKeyword("thermoBaffleModel")
+        os.writeKeyword("thermalBaffleModel")
             << thermoModel
             << token::END_STATEMENT << nl;
 
@@ -227,7 +227,7 @@ void thermoBaffleFvPatchScalarField::write(Ostream& os) const
 makePatchTypeField
 (
     fvPatchScalarField,
-    thermoBaffleFvPatchScalarField
+    thermalBaffleFvPatchScalarField
 );
 
 
diff --git a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/thermoBaffle/thermoBaffleFvPatchScalarField.H b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.H
similarity index 84%
rename from src/regionModels/thermoBaffleModels/derivedFvPatchFields/thermoBaffle/thermoBaffleFvPatchScalarField.H
rename to src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.H
index a3fa62d442f90db9273606c051a316de2431ac1b..4097f055648b0774ab889a1971bb8388398462e7 100644
--- a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/thermoBaffle/thermoBaffleFvPatchScalarField.H
+++ b/src/regionModels/thermalBaffleModels/derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.H
@@ -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
@@ -22,7 +22,7 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
-    Foam::thermoBaffleFvPatchScalarField
+    Foam::thermalBaffleFvPatchScalarField
 
 Group
     grpThermoBoundaryConditions
@@ -56,11 +56,11 @@ Description
 
 
         // Thermo baffle model
-        thermoBaffleModel   thermoBaffle;
+        thermalBaffleModel   thermalBaffle;
         regionName          baffleRegion;
         infoOutput          yes;
         active              yes;
-        thermoBaffleCoeffs
+        thermalBaffleCoeffs
         {
         }
 
@@ -112,20 +112,20 @@ Description
 
 SeeAlso
     Foam::turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
-    Foam::regionModels::thermoBaffleModels::thermoBaffleModel
+    Foam::regionModels::thermalBaffleModels::thermalBaffleModel
 
 SourceFiles
-    thermoBaffleFvPatchScalarField.C
+    thermalBaffleFvPatchScalarField.C
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef thermoBaffleFvPatchScalarField_H
-#define thermoBaffleFvPatchScalarField_H
+#ifndef thermalBaffleFvPatchScalarField_H
+#define thermalBaffleFvPatchScalarField_H
 
 
 #include "autoPtr.H"
 #include "regionModel.H"
-#include "thermoBaffleModel.H"
+#include "thermalBaffleModel.H"
 #include "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -137,10 +137,10 @@ namespace compressible
 {
 
 /*---------------------------------------------------------------------------*\
-        Class thermoBaffleFvPatchScalarField Declaration
+        Class thermalBaffleFvPatchScalarField Declaration
 \*---------------------------------------------------------------------------*/
 
-class thermoBaffleFvPatchScalarField
+class thermalBaffleFvPatchScalarField
 :
     public turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
 {
@@ -150,7 +150,7 @@ class thermoBaffleFvPatchScalarField
         bool owner_;
 
         //- Thermal baffle
-        autoPtr<regionModels::thermoBaffleModels::thermoBaffleModel> baffle_;
+        autoPtr<regionModels::thermalBaffleModels::thermalBaffleModel> baffle_;
 
         //- Dictionary
         dictionary dict_;
@@ -159,20 +159,20 @@ class thermoBaffleFvPatchScalarField
 public:
 
     //- Runtime type information
-    TypeName("compressible::thermoBaffle");
+    TypeName("compressible::thermalBaffle");
 
 
     // Constructors
 
         //- Construct from patch and internal field
-        thermoBaffleFvPatchScalarField
+        thermalBaffleFvPatchScalarField
         (
             const fvPatch&,
             const DimensionedField<scalar, volMesh>&
         );
 
         //- Construct from patch, internal field and dictionary
-        thermoBaffleFvPatchScalarField
+        thermalBaffleFvPatchScalarField
         (
             const fvPatch&,
             const DimensionedField<scalar, volMesh>&,
@@ -180,10 +180,10 @@ public:
         );
 
         //- Construct by mapping given
-        //  thermoBaffleFvPatchScalarField onto a new patch
-        thermoBaffleFvPatchScalarField
+        //  thermalBaffleFvPatchScalarField onto a new patch
+        thermalBaffleFvPatchScalarField
         (
-            const thermoBaffleFvPatchScalarField&,
+            const thermalBaffleFvPatchScalarField&,
             const fvPatch&,
             const DimensionedField<scalar, volMesh>&,
             const fvPatchFieldMapper&
@@ -195,14 +195,14 @@ public:
         {
             return tmp<fvPatchScalarField>
             (
-                new thermoBaffleFvPatchScalarField(*this)
+                new thermalBaffleFvPatchScalarField(*this)
             );
         }
 
         //- Construct as copy setting internal field reference
-        thermoBaffleFvPatchScalarField
+        thermalBaffleFvPatchScalarField
         (
-            const thermoBaffleFvPatchScalarField&,
+            const thermalBaffleFvPatchScalarField&,
             const DimensionedField<scalar, volMesh>&
         );
 
@@ -214,7 +214,7 @@ public:
         {
             return tmp<fvPatchScalarField>
             (
-                new thermoBaffleFvPatchScalarField(*this, iF)
+                new thermalBaffleFvPatchScalarField(*this, iF)
             );
         }
 
diff --git a/src/regionModels/thermoBaffleModels/noThermo/noThermo.C b/src/regionModels/thermalBaffleModels/noThermo/noThermo.C
similarity index 92%
rename from src/regionModels/thermoBaffleModels/noThermo/noThermo.C
rename to src/regionModels/thermalBaffleModels/noThermo/noThermo.C
index 1175a0d792a605019bfefd4a612d29020a4c94dc..e0511f226ac6870abfae57186b3f5df21599a926 100644
--- a/src/regionModels/thermoBaffleModels/noThermo/noThermo.C
+++ b/src/regionModels/thermalBaffleModels/noThermo/noThermo.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
@@ -33,15 +33,15 @@ namespace Foam
 {
 namespace regionModels
 {
-namespace thermoBaffleModels
+namespace thermalBaffleModels
 {
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 defineTypeNameAndDebug(noThermo, 0);
 
-addToRunTimeSelectionTable(thermoBaffleModel, noThermo, mesh);
-addToRunTimeSelectionTable(thermoBaffleModel, noThermo, dictionary);
+addToRunTimeSelectionTable(thermalBaffleModel, noThermo, mesh);
+addToRunTimeSelectionTable(thermalBaffleModel, noThermo, dictionary);
 
 // * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
 
@@ -55,7 +55,7 @@ bool noThermo::read()
 
 noThermo::noThermo(const word& modelType, const fvMesh& mesh)
 :
-    thermoBaffleModel(mesh)
+    thermalBaffleModel(mesh)
 {}
 
 
@@ -66,7 +66,7 @@ noThermo::noThermo
     const dictionary& dict
 )
 :
-    thermoBaffleModel(modelType, mesh, dict)
+    thermalBaffleModel(modelType, mesh, dict)
 {}
 
 
@@ -157,7 +157,7 @@ const solidThermo& noThermo::thermo() const
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace thermoBaffleModels
+} // End namespace thermalBaffleModels
 } // End namespace regionModels
 } // End namespace Foam
 
diff --git a/src/regionModels/thermoBaffleModels/noThermo/noThermo.H b/src/regionModels/thermalBaffleModels/noThermo/noThermo.H
similarity index 94%
rename from src/regionModels/thermoBaffleModels/noThermo/noThermo.H
rename to src/regionModels/thermalBaffleModels/noThermo/noThermo.H
index 8144dad5863076d2b8b29fcc828ee11baab17c1e..9fed26466a7489dd383411f2ba44603d766d9542 100644
--- a/src/regionModels/thermoBaffleModels/noThermo/noThermo.H
+++ b/src/regionModels/thermalBaffleModels/noThermo/noThermo.H
@@ -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
@@ -35,7 +35,7 @@ SourceFiles
 #ifndef noThermo_H
 #define noThermo_H
 
-#include "thermoBaffleModel.H"
+#include "thermalBaffleModel.H"
 #include "volFieldsFwd.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -44,7 +44,7 @@ namespace Foam
 {
 namespace regionModels
 {
-namespace thermoBaffleModels
+namespace thermalBaffleModels
 {
 
 /*---------------------------------------------------------------------------*\
@@ -53,7 +53,7 @@ namespace thermoBaffleModels
 
 class noThermo
 :
-    public thermoBaffleModel
+    public thermalBaffleModel
 {
 private:
 
@@ -139,7 +139,7 @@ public:
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace thermoBaffleModels
+} // End namespace thermalBaffleModels
 } // End namespace regionModels
 } // End namespace Foam
 
diff --git a/src/regionModels/thermoBaffleModels/thermoBaffle/thermoBaffle.C b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C
similarity index 83%
rename from src/regionModels/thermoBaffleModels/thermoBaffle/thermoBaffle.C
rename to src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C
index 9044f71fa2090ba757e65ded440ebad24a2f27a4..3fbe65e795183d548fd48ffaf240bded1a44b638 100644
--- a/src/regionModels/thermoBaffleModels/thermoBaffle/thermoBaffle.C
+++ b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C
@@ -2,16 +2,16 @@
   =========                 |
   \\      /  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
     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 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
@@ -19,12 +19,11 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 \*---------------------------------------------------------------------------*/
 
-#include "thermoBaffle.H"
+#include "thermalBaffle.H"
 
 #include "fvm.H"
 #include "fvcDiv.H"
@@ -39,37 +38,37 @@ namespace Foam
 {
 namespace regionModels
 {
-namespace thermoBaffleModels
+namespace thermalBaffleModels
 {
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-defineTypeNameAndDebug(thermoBaffle, 0);
+defineTypeNameAndDebug(thermalBaffle, 0);
 
-addToRunTimeSelectionTable(thermoBaffleModel, thermoBaffle, mesh);
-addToRunTimeSelectionTable(thermoBaffleModel, thermoBaffle, dictionary);
+addToRunTimeSelectionTable(thermalBaffleModel, thermalBaffle, mesh);
+addToRunTimeSelectionTable(thermalBaffleModel, thermalBaffle, dictionary);
 
 // * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
 
-bool thermoBaffle::read()
+bool thermalBaffle::read()
 {
     this->solution().lookup("nNonOrthCorr") >> nNonOrthCorr_;
     return regionModel1D::read();
 }
 
 
-bool thermoBaffle::read(const dictionary& dict)
+bool thermalBaffle::read(const dictionary& dict)
 {
     this->solution().lookup("nNonOrthCorr") >> nNonOrthCorr_;
     return regionModel1D::read(dict);
 }
 
 
-void thermoBaffle::solveEnergy()
+void thermalBaffle::solveEnergy()
 {
     if (debug)
     {
-        Info<< "thermoBaffle::solveEnergy()" << endl;
+        Info<< "thermalBaffle::solveEnergy()" << endl;
     }
 
     const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
@@ -157,14 +156,14 @@ void thermoBaffle::solveEnergy()
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-thermoBaffle::thermoBaffle
+thermalBaffle::thermalBaffle
 (
     const word& modelType,
     const fvMesh& mesh,
     const dictionary& dict
 )
 :
-    thermoBaffleModel(modelType, mesh, dict),
+    thermalBaffleModel(modelType, mesh, dict),
     nNonOrthCorr_(readLabel(solution().lookup("nNonOrthCorr"))),
     thermo_(solidThermo::New(regionMesh(), dict)),
     h_(thermo_->he()),
@@ -218,13 +217,13 @@ thermoBaffle::thermoBaffle
 }
 
 
-thermoBaffle::thermoBaffle
+thermalBaffle::thermalBaffle
 (
     const word& modelType,
     const fvMesh& mesh
 )
 :
-    thermoBaffleModel(modelType, mesh),
+    thermalBaffleModel(modelType, mesh),
     nNonOrthCorr_(readLabel(solution().lookup("nNonOrthCorr"))),
     thermo_(solidThermo::New(regionMesh())),
     h_(thermo_->he()),
@@ -279,13 +278,13 @@ thermoBaffle::thermoBaffle
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-thermoBaffle::~thermoBaffle()
+thermalBaffle::~thermalBaffle()
 {}
 
 
 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
 
-void thermoBaffle::init()
+void thermalBaffle::init()
 {
     if (oneD_ && !constantThickness_)
     {
@@ -294,7 +293,7 @@ void thermoBaffle::init()
 
         if (Qsb!= thickness_.size())
         {
-            FatalErrorIn("thermoBaffle::init()")
+            FatalErrorIn("thermalBaffle::init()")
                 << "the boundary field of Qs is "
                 << Qsb << " and " << nl
                 << "the field 'thickness' is " << thickness_.size() << nl
@@ -304,11 +303,11 @@ void thermoBaffle::init()
 }
 
 
-void thermoBaffle::preEvolveRegion()
+void thermalBaffle::preEvolveRegion()
 {}
 
 
-void thermoBaffle::evolveRegion()
+void thermalBaffle::evolveRegion()
 {
     for (int nonOrth=0; nonOrth<=nNonOrthCorr_; nonOrth++)
     {
@@ -317,43 +316,43 @@ void thermoBaffle::evolveRegion()
 }
 
 
-const tmp<volScalarField> thermoBaffle::Cp() const
+const tmp<volScalarField> thermalBaffle::Cp() const
 {
     return thermo_->Cp();
 }
 
 
-const volScalarField& thermoBaffle::kappaRad() const
+const volScalarField& thermalBaffle::kappaRad() const
 {
     return radiation_->absorptionEmission().a();
 }
 
 
-const volScalarField& thermoBaffle::rho() const
+const volScalarField& thermalBaffle::rho() const
 {
     return thermo_->rho();
 }
 
 
-const volScalarField& thermoBaffle::kappa() const
+const volScalarField& thermalBaffle::kappa() const
 {
     return thermo_->kappa();
 }
 
 
-const volScalarField& thermoBaffle::T() const
+const volScalarField& thermalBaffle::T() const
 {
     return thermo_->T();
 }
 
 
-const solidThermo& thermoBaffle::thermo() const
+const solidThermo& thermalBaffle::thermo() const
 {
     return thermo_;
 }
 
 
-void thermoBaffle::info() const
+void thermalBaffle::info() const
 {
     const labelList& coupledPatches = intCoupledPatchIDs();
 
@@ -375,7 +374,7 @@ void thermoBaffle::info() const
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // end namespace thermoBaffleModels
+} // end namespace thermalBaffleModels
 } // end namespace regionModels
 } // end namespace Foam
 
diff --git a/src/regionModels/thermoBaffleModels/thermoBaffle/thermoBaffle.H b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.H
similarity index 87%
rename from src/regionModels/thermoBaffleModels/thermoBaffle/thermoBaffle.H
rename to src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.H
index 93fcf19fd605ec3f8ee822e76f4ce8a99de7eaa7..b8265948a98e0b4d77f4140b4d2ce64396b0376c 100644
--- a/src/regionModels/thermoBaffleModels/thermoBaffle/thermoBaffle.H
+++ b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.H
@@ -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
@@ -22,21 +22,21 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
-    Foam::thermoBaffle
+    Foam::thermalBaffle
 
 Description
     2D thermal baffle
 
 SourceFiles
-    thermoBaffle.C
-    thermoBaffleI.H
+    thermalBaffle.C
+    thermalBaffleI.H
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef thermoBaffle_H
-#define thermoBaffle_H
+#ifndef thermalBaffle_H
+#define thermalBaffle_H
 
-#include "thermoBaffleModel.H"
+#include "thermalBaffleModel.H"
 #include "volFieldsFwd.H"
 
 
@@ -46,29 +46,29 @@ namespace Foam
 {
 namespace regionModels
 {
-namespace thermoBaffleModels
+namespace thermalBaffleModels
 {
 
 
 /*---------------------------------------------------------------------------*\
-                        Class thermoBaffle Declaration
+                        Class thermalBaffle Declaration
 \*---------------------------------------------------------------------------*/
 
-class thermoBaffle
+class thermalBaffle
 :
-    public thermoBaffleModel
+    public thermalBaffleModel
 {
 private:
 
     // Private member functions
 
         //- Disallow default bitwise copy construct
-        thermoBaffle(const thermoBaffle&);
+        thermalBaffle(const thermalBaffle&);
 
         //- Disallow default bitwise assignment
-        void operator=(const thermoBaffle&);
+        void operator=(const thermalBaffle&);
 
-        //- Initialize thermoBaffle
+        //- Initialize thermalBaffle
         void init();
 
 
@@ -124,16 +124,16 @@ protected:
 public:
 
     //- Runtime type information
-    TypeName("thermoBaffle");
+    TypeName("thermalBaffle");
 
 
     // Constructors
 
         //- Construct from components
-        thermoBaffle(const word& modelType, const fvMesh& mesh);
+        thermalBaffle(const word& modelType, const fvMesh& mesh);
 
         //- Construct from components and dict
-        thermoBaffle
+        thermalBaffle
         (
             const word& modelType,
             const fvMesh& mesh,
@@ -142,7 +142,7 @@ public:
 
 
     //- Destructor
-    virtual ~thermoBaffle();
+    virtual ~thermalBaffle();
 
 
     // Member Functions
@@ -205,13 +205,13 @@ public:
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace thermoBaffleModels
+} // End namespace thermalBaffleModels
 } // End namespace regionModels
 } // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#include "thermoBaffleI.H"
+#include "thermalBaffleI.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/regionModels/thermoBaffleModels/thermoBaffle/thermoBaffleI.H b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffleI.H
similarity index 87%
rename from src/regionModels/thermoBaffleModels/thermoBaffle/thermoBaffleI.H
rename to src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffleI.H
index 107274f65e87a0b577bfd81c1c744312afa07b42..afad57dea79f59a491339a776f94af82f96b47e4 100644
--- a/src/regionModels/thermoBaffleModels/thermoBaffle/thermoBaffleI.H
+++ b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffleI.H
@@ -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
@@ -24,7 +24,7 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "thermoBaffle.H"
+#include "thermalBaffle.H"
 #include "zeroGradientFvPatchFields.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -33,12 +33,12 @@ namespace Foam
 {
 namespace regionModels
 {
-namespace thermoBaffleModels
+namespace thermalBaffleModels
 {
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-inline tmp<scalarField> thermoBaffle::he
+inline tmp<scalarField> thermalBaffle::he
 (
     const scalarField& p,
     const scalarField& T,
@@ -49,7 +49,7 @@ inline tmp<scalarField> thermoBaffle::he
 }
 
 
-inline tmp<volScalarField> thermoBaffle::he() const
+inline tmp<volScalarField> thermalBaffle::he() const
 {
     return thermo_->he();
 }
@@ -57,7 +57,7 @@ inline tmp<volScalarField> thermoBaffle::he() const
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace thermoBaffleModels
+} // End namespace thermalBaffleModels
 } // End namespace regionModels
 } // End namespace Foam
 
diff --git a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.C b/src/regionModels/thermalBaffleModels/thermalBaffleModel/thermalBaffleModel.C
similarity index 85%
rename from src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.C
rename to src/regionModels/thermalBaffleModels/thermalBaffleModel/thermalBaffleModel.C
index ff38797a145d4dd9971f1fb12bb4d3c73f1f8ef8..543ea6b9741152422102c0543523c4ecb4a04f23 100644
--- a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.C
+++ b/src/regionModels/thermalBaffleModels/thermalBaffleModel/thermalBaffleModel.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
@@ -23,7 +23,7 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "thermoBaffleModel.H"
+#include "thermalBaffleModel.H"
 #include "fvMesh.H"
 #include "mappedVariableThicknessWallPolyPatch.H"
 #include "wedgePolyPatch.H"
@@ -34,33 +34,33 @@ namespace Foam
 {
 namespace regionModels
 {
-namespace thermoBaffleModels
+namespace thermalBaffleModels
 {
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-defineTypeNameAndDebug(thermoBaffleModel, 0);
-defineRunTimeSelectionTable(thermoBaffleModel, mesh);
-defineRunTimeSelectionTable(thermoBaffleModel, dictionary);
+defineTypeNameAndDebug(thermalBaffleModel, 0);
+defineRunTimeSelectionTable(thermalBaffleModel, mesh);
+defineRunTimeSelectionTable(thermalBaffleModel, dictionary);
 
 
 // * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
 
-bool thermoBaffleModel::read()
+bool thermalBaffleModel::read()
 {
     regionModel1D::read();
     return true;
 }
 
 
-bool thermoBaffleModel::read(const dictionary& dict)
+bool thermalBaffleModel::read(const dictionary& dict)
 {
     regionModel1D::read(dict);
     return true;
 }
 
 
-void thermoBaffleModel::init()
+void thermalBaffleModel::init()
 {
     if (active_)
     {
@@ -116,7 +116,7 @@ void thermoBaffleModel::init()
             {
                 FatalErrorIn
                 (
-                    "thermoBaffleModel::thermoBaffleModel"
+                    "thermalBaffleModel::thermalBaffleModel"
                     "("
                     "   const word&,"
                     "   const fvMesh&"
@@ -133,7 +133,7 @@ void thermoBaffleModel::init()
             {
                 FatalErrorIn
                 (
-                    "thermoBaffleModel::thermoBaffleModel"
+                    "thermalBaffleModel::thermalBaffleModel"
                     "("
                     "   const word&,"
                     "   const fvMesh&"
@@ -164,12 +164,12 @@ void thermoBaffleModel::init()
             {
                 FatalErrorIn
                 (
-                    "thermoBaffleModel::thermoBaffleModel"
+                    "thermalBaffleModel::thermalBaffleModel"
                     "("
                     "   const word&,"
                     "   const fvMesh&"
                     ")"
-                )   << " coupled patches in thermoBaffle are " << nl
+                )   << " coupled patches in thermalBaffle are " << nl
                     << " different sizes from list thickness" << nl
                     << exit(FatalError);
             }
@@ -199,7 +199,7 @@ void thermoBaffleModel::init()
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-thermoBaffleModel::thermoBaffleModel(const fvMesh& mesh)
+thermalBaffleModel::thermalBaffleModel(const fvMesh& mesh)
 :
     regionModel1D(mesh),
     thickness_(),
@@ -209,7 +209,7 @@ thermoBaffleModel::thermoBaffleModel(const fvMesh& mesh)
 {}
 
 
-thermoBaffleModel::thermoBaffleModel
+thermalBaffleModel::thermalBaffleModel
 (
     const word& modelType,
     const fvMesh& mesh,
@@ -217,7 +217,7 @@ thermoBaffleModel::thermoBaffleModel
 
 )
 :
-    regionModel1D(mesh, "thermoBaffle", modelType, dict, true),
+    regionModel1D(mesh, "thermalBaffle", modelType, dict, true),
     thickness_(),
     delta_("delta", dimLength, 0.0),
     oneD_(false),
@@ -227,9 +227,13 @@ thermoBaffleModel::thermoBaffleModel
 }
 
 
-thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh)
+thermalBaffleModel::thermalBaffleModel
+(
+    const word& modelType,
+    const fvMesh& mesh
+)
 :
-    regionModel1D(mesh, "thermoBaffle", modelType),
+    regionModel1D(mesh, "thermalBaffle", modelType),
     thickness_(),
     delta_("delta", dimLength, 0.0),
     oneD_(false),
@@ -241,19 +245,19 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh)
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-thermoBaffleModel::~thermoBaffleModel()
+thermalBaffleModel::~thermalBaffleModel()
 {}
 
 
 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
 
-void thermoBaffleModel::preEvolveRegion()
+void thermalBaffleModel::preEvolveRegion()
 {}
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace thermoBaffleModels
+} // End namespace thermalBaffleModels
 } // End namespace regionModels
 } // End namespace Foam
 
diff --git a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.H b/src/regionModels/thermalBaffleModels/thermalBaffleModel/thermalBaffleModel.H
similarity index 86%
rename from src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.H
rename to src/regionModels/thermalBaffleModels/thermalBaffleModel/thermalBaffleModel.H
index d55d6c5ee9c4309c41b81341e3e7562b054d3222..01c3cbe5595fa8644b8cafc53193160e911cd72c 100644
--- a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.H
+++ b/src/regionModels/thermalBaffleModels/thermalBaffleModel/thermalBaffleModel.H
@@ -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
@@ -22,17 +22,17 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
-    Foam::thermoBaffleModel
+    Foam::thermalBaffleModel
 
 Description
 
 SourceFiles
-    thermoBaffleModel.C
+    thermalBaffleModel.C
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef thermoBaffleModel_H
-#define thermoBaffleModel_H
+#ifndef thermalBaffleModel_H
+#define thermalBaffleModel_H
 
 #include "runTimeSelectionTables.H"
 #include "scalarIOField.H"
@@ -49,14 +49,14 @@ namespace Foam
 {
 namespace regionModels
 {
-namespace thermoBaffleModels
+namespace thermalBaffleModels
 {
 
 /*---------------------------------------------------------------------------*\
-                      Class thermoBaffleModel Declaration
+                      Class thermalBaffleModel Declaration
 \*---------------------------------------------------------------------------*/
 
-class thermoBaffleModel
+class thermalBaffleModel
 :
     public regionModel1D
 {
@@ -65,10 +65,10 @@ private:
     // Private Member Functions
 
         //- Disallow default bitwise copy construct
-        thermoBaffleModel(const thermoBaffleModel&);
+        thermalBaffleModel(const thermalBaffleModel&);
 
         //- Disallow default bitwise assignment
-        void operator=(const thermoBaffleModel&);
+        void operator=(const thermalBaffleModel&);
 
         //- Initialize thermal Baffle
         void init();
@@ -103,7 +103,7 @@ protected:
 public:
 
     //- Runtime type information
-    TypeName("thermoBaffleModel");
+    TypeName("thermalBaffleModel");
 
 
     // Declare runtime constructor selection tables
@@ -111,7 +111,7 @@ public:
          declareRunTimeSelectionTable
          (
              autoPtr,
-             thermoBaffleModel,
+             thermalBaffleModel,
              mesh,
              (
                 const word& modelType,
@@ -123,7 +123,7 @@ public:
          declareRunTimeSelectionTable
          (
              autoPtr,
-             thermoBaffleModel,
+             thermalBaffleModel,
              dictionary,
              (
                 const word& modelType,
@@ -137,13 +137,13 @@ public:
     // Constructors
 
         //- Construct null from mesh
-        thermoBaffleModel(const fvMesh& mesh);
+        thermalBaffleModel(const fvMesh& mesh);
 
         //- Construct from type name and mesh
-        thermoBaffleModel(const word& modelType, const fvMesh& mesh);
+        thermalBaffleModel(const word& modelType, const fvMesh& mesh);
 
         //- Construct from type name and mesh and dict
-        thermoBaffleModel
+        thermalBaffleModel
         (
             const word& modelType,
             const fvMesh& mesh,
@@ -154,10 +154,10 @@ public:
     // Selectors
 
         //- Return a reference to the selected model
-        static autoPtr<thermoBaffleModel> New(const fvMesh& mesh);
+        static autoPtr<thermalBaffleModel> New(const fvMesh& mesh);
 
         //- Return a reference to the selected model using dictionary
-        static autoPtr<thermoBaffleModel> New
+        static autoPtr<thermalBaffleModel> New
         (
             const fvMesh& mesh,
             const dictionary& dict
@@ -165,7 +165,7 @@ public:
 
 
     //- Destructor
-    virtual ~thermoBaffleModel();
+    virtual ~thermalBaffleModel();
 
 
     // Member Functions
@@ -227,7 +227,7 @@ public:
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace thermoBaffleModels
+} // End namespace thermalBaffleModels
 } // End namespace regionModels
 } // End namespace Foam
 
diff --git a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModelNew.C b/src/regionModels/thermalBaffleModels/thermalBaffleModel/thermalBaffleModelNew.C
similarity index 70%
rename from src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModelNew.C
rename to src/regionModels/thermalBaffleModels/thermalBaffleModel/thermalBaffleModelNew.C
index 4261b9f48f7c8da97885b3091e1eb155b2d83ca2..44ae867df78d459f30772ed1cff746b3aa7ca9a1 100644
--- a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModelNew.C
+++ b/src/regionModels/thermalBaffleModels/thermalBaffleModel/thermalBaffleModelNew.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -23,7 +23,7 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "thermoBaffleModel.H"
+#include "thermalBaffleModel.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -31,20 +31,20 @@ namespace Foam
 {
 namespace regionModels
 {
-namespace thermoBaffleModels
+namespace thermalBaffleModels
 {
 
 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
 
-autoPtr<thermoBaffleModel> thermoBaffleModel::New(const fvMesh& mesh)
+autoPtr<thermalBaffleModel> thermalBaffleModel::New(const fvMesh& mesh)
 {
     word modelType;
     {
-        IOdictionary thermoBafflePropertiesDict
+        IOdictionary thermalBafflePropertiesDict
         (
             IOobject
             (
-                "thermoBaffleProperties",
+                "thermalBaffleProperties",
                 mesh.time().constant(),
                 mesh,
                 IOobject::MUST_READ_IF_MODIFIED,
@@ -53,7 +53,7 @@ autoPtr<thermoBaffleModel> thermoBaffleModel::New(const fvMesh& mesh)
             )
         );
 
-        thermoBafflePropertiesDict.lookup("thermoBaffleModel") >> modelType;
+        thermalBafflePropertiesDict.lookup("thermalBaffleModel") >> modelType;
     }
 
     Info<< "Selecting baffle model " << modelType << endl;
@@ -64,25 +64,25 @@ autoPtr<thermoBaffleModel> thermoBaffleModel::New(const fvMesh& mesh)
     if (cstrIter == meshConstructorTablePtr_->end())
     {
 
-        FatalErrorIn("thermoBaffleModel::New(const fvMesh&)")
-            << "Unknown thermoBaffleModel type " << modelType
+        FatalErrorIn("thermalBaffleModel::New(const fvMesh&)")
+            << "Unknown thermalBaffleModel type " << modelType
             << nl << nl
-            <<  "Valid thermoBaffleModel types are:" << nl
+            <<  "Valid thermalBaffleModel types are:" << nl
             << meshConstructorTablePtr_->sortedToc()
             << exit(FatalError);
     }
 
-    return autoPtr<thermoBaffleModel>(cstrIter()(modelType, mesh));
+    return autoPtr<thermalBaffleModel>(cstrIter()(modelType, mesh));
 }
 
 
-autoPtr<thermoBaffleModel> thermoBaffleModel::New
+autoPtr<thermalBaffleModel> thermalBaffleModel::New
 (
     const fvMesh& mesh,
     const dictionary& dict
 )
 {
-    word modelType = dict.lookup("thermoBaffleModel");
+    word modelType = dict.lookup("thermalBaffleModel");
 
     Info<< "Selecting baffle model " << modelType << endl;
 
@@ -92,21 +92,23 @@ autoPtr<thermoBaffleModel> thermoBaffleModel::New
     if (cstrIter == dictionaryConstructorTablePtr_->end())
     {
 
-        FatalErrorIn("thermoBaffleModel::New(const fvMesh&, const dictionary&)")
-            << "Unknown thermoBaffleModel type " << modelType
+        FatalErrorIn
+        (
+            "thermalBaffleModel::New(const fvMesh&, const dictionary&)"
+        )   << "Unknown thermalBaffleModel type " << modelType
             << nl << nl
-            <<  "Valid thermoBaffleModel types are:" << nl
+            <<  "Valid thermalBaffleModel types are:" << nl
             << dictionaryConstructorTablePtr_->sortedToc()
             << exit(FatalError);
     }
 
-    return autoPtr<thermoBaffleModel>(cstrIter()(modelType, mesh, dict));
+    return autoPtr<thermalBaffleModel>(cstrIter()(modelType, mesh, dict));
 }
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace thermoBaffleModels
+} // End namespace thermalBaffleModels
 } // End namespace regionModels
 } // End namespace Foam
 
diff --git a/src/regionModels/thermoBaffleModels/Make/files b/src/regionModels/thermoBaffleModels/Make/files
deleted file mode 100644
index 2799f6460bebca2c19b0e967648f10a6f5985396..0000000000000000000000000000000000000000
--- a/src/regionModels/thermoBaffleModels/Make/files
+++ /dev/null
@@ -1,9 +0,0 @@
-thermoBaffleModel/thermoBaffleModel.C
-thermoBaffleModel/thermoBaffleModelNew.C
-thermoBaffle/thermoBaffle.C
-noThermo/noThermo.C
-
-derivedFvPatchFields/thermoBaffle/thermoBaffleFvPatchScalarField.C
-
-
-LIB = $(FOAM_LIBBIN)/libthermoBaffleModels
diff --git a/src/sampling/Make/files b/src/sampling/Make/files
index 747097a781c5c26d52c5ae82c95b484bed4cd0ae..309cf09d7ab39e79b984b4c0e7e8cce10f873b09 100644
--- a/src/sampling/Make/files
+++ b/src/sampling/Make/files
@@ -60,6 +60,9 @@ $(meshToMesh)/calculateMeshToMeshAddressing.C
 $(meshToMesh)/calculateMeshToMeshWeights.C
 
 meshToMeshNew = meshToMeshInterpolation/meshToMeshNew
+$(meshToMeshNew)/calcDirect.C
+$(meshToMeshNew)/calcMapNearest.C
+$(meshToMeshNew)/calcCellVolumeWeight.C
 $(meshToMeshNew)/meshToMeshNew.C
 $(meshToMeshNew)/meshToMeshNewParallelOps.C
 
diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcCellVolumeWeight.C b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcCellVolumeWeight.C
new file mode 100644
index 0000000000000000000000000000000000000000..9cd8e417f1c497ee21f638702c6d7b56edcd3553
--- /dev/null
+++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcCellVolumeWeight.C
@@ -0,0 +1,301 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012-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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "meshToMeshNew.H"
+#include "tetOverlapVolume.H"
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+void Foam::meshToMeshNew::calcCellVolumeWeight
+(
+    const polyMesh& src,
+    const polyMesh& tgt,
+    const label srcSeedI,
+    const label tgtSeedI,
+    const labelList& srcCellIDs,
+    boolList& mapFlag,
+    label& startSeedI
+)
+{
+    label srcCellI = srcSeedI;
+    label tgtCellI = tgtSeedI;
+
+    List<DynamicList<label> > srcToTgtAddr(src.nCells());
+    List<DynamicList<scalar> > srcToTgtWght(src.nCells());
+
+    List<DynamicList<label> > tgtToSrcAddr(tgt.nCells());
+    List<DynamicList<scalar> > tgtToSrcWght(tgt.nCells());
+
+    // list of tgt cell neighbour cells
+    DynamicList<label> nbrTgtCells(10);
+
+    // list of tgt cells currently visited for srcCellI to avoid multiple hits
+    DynamicList<label> visitedTgtCells(10);
+
+    // list to keep track of tgt cells used to seed src cells
+    labelList seedCells(src.nCells(), -1);
+    seedCells[srcCellI] = tgtCellI;
+
+    const scalarField& srcVol = src.cellVolumes();
+
+    do
+    {
+        nbrTgtCells.clear();
+        visitedTgtCells.clear();
+
+        // append initial target cell and neighbours
+        nbrTgtCells.append(tgtCellI);
+        appendNbrCells(tgtCellI, tgt, visitedTgtCells, nbrTgtCells);
+
+        do
+        {
+            tgtCellI = nbrTgtCells.remove();
+            visitedTgtCells.append(tgtCellI);
+
+            scalar vol = interVol(src, tgt, srcCellI, tgtCellI);
+
+            // accumulate addressing and weights for valid intersection
+            if (vol/srcVol[srcCellI] > tolerance_)
+            {
+                // store src/tgt cell pair
+                srcToTgtAddr[srcCellI].append(tgtCellI);
+                srcToTgtWght[srcCellI].append(vol);
+
+                tgtToSrcAddr[tgtCellI].append(srcCellI);
+                tgtToSrcWght[tgtCellI].append(vol);
+
+                appendNbrCells(tgtCellI, tgt, visitedTgtCells, nbrTgtCells);
+
+                // accumulate intersection volume
+                V_ += vol;
+            }
+        }
+        while (!nbrTgtCells.empty());
+
+        mapFlag[srcCellI] = false;
+
+        // find new source seed cell
+        setNextCells
+        (
+            startSeedI,
+            srcCellI,
+            tgtCellI,
+            src,
+            tgt,
+            srcCellIDs,
+            mapFlag,
+            visitedTgtCells,
+            seedCells
+        );
+    }
+    while (srcCellI != -1);
+
+    // transfer addressing into persistent storage
+    forAll(srcToTgtCellAddr_, i)
+    {
+        srcToTgtCellAddr_[i].transfer(srcToTgtAddr[i]);
+        srcToTgtCellWght_[i].transfer(srcToTgtWght[i]);
+    }
+
+    forAll(tgtToSrcCellAddr_, i)
+    {
+        tgtToSrcCellAddr_[i].transfer(tgtToSrcAddr[i]);
+        tgtToSrcCellWght_[i].transfer(tgtToSrcWght[i]);
+    }
+}
+
+
+void Foam::meshToMeshNew::setNextCells
+(
+    label& startSeedI,
+    label& srcCellI,
+    label& tgtCellI,
+    const polyMesh& src,
+    const polyMesh& tgt,
+    const labelList& srcCellIDs,
+    const boolList& mapFlag,
+    const DynamicList<label>& visitedCells,
+    labelList& seedCells
+) const
+{
+    const labelList& srcNbrCells = src.cellCells()[srcCellI];
+
+    // set possible seeds for later use by querying all src cell neighbours
+    // with all visited target cells
+    bool valuesSet = false;
+    forAll(srcNbrCells, i)
+    {
+        label cellS = srcNbrCells[i];
+
+        if (mapFlag[cellS] && seedCells[cellS] == -1)
+        {
+            forAll(visitedCells, j)
+            {
+                label cellT = visitedCells[j];
+
+                if (intersect(src, tgt, cellS, cellT))
+                {
+                    seedCells[cellS] = cellT;
+
+                    if (!valuesSet)
+                    {
+                        srcCellI = cellS;
+                        tgtCellI = cellT;
+                        valuesSet = true;
+                    }
+                }
+            }
+        }
+    }
+
+    // set next src and tgt cells if not set above
+    if (valuesSet)
+    {
+        return;
+    }
+    else
+    {
+        // try to use existing seed
+        bool foundNextSeed = false;
+        for (label i = startSeedI; i < srcCellIDs.size(); i++)
+        {
+            label cellS = srcCellIDs[i];
+
+            if (mapFlag[cellS])
+            {
+                if (!foundNextSeed)
+                {
+                    startSeedI = i;
+                    foundNextSeed = true;
+                }
+
+                if (seedCells[cellS] != -1)
+                {
+                    srcCellI = cellS;
+                    tgtCellI = seedCells[cellS];
+
+                    return;
+                }
+            }
+        }
+
+        // perform new search to find match
+        if (debug)
+        {
+            Pout<< "Advancing front stalled: searching for new "
+                << "target cell" << endl;
+        }
+
+        bool restart =
+            findInitialSeeds
+            (
+                src,
+                tgt,
+                srcCellIDs,
+                mapFlag,
+                startSeedI,
+                srcCellI,
+                tgtCellI
+            );
+
+        if (restart)
+        {
+            // successfully found new starting seed-pair
+            return;
+        }
+    }
+
+    // if we have got to here, there are no more src/tgt cell intersections
+    srcCellI = -1;
+    tgtCellI = -1;
+}
+
+
+bool Foam::meshToMeshNew::intersect
+(
+    const polyMesh& src,
+    const polyMesh& tgt,
+    const label srcCellI,
+    const label tgtCellI
+) const
+{
+    scalar threshold = tolerance_*src.cellVolumes()[srcCellI];
+
+    tetOverlapVolume overlapEngine;
+
+    treeBoundBox bbTgtCell
+    (
+        pointField
+        (
+            tgt.points(),
+            tgt.cellPoints()[tgtCellI]
+        )
+    );
+
+    return overlapEngine.cellCellOverlapMinDecomp
+    (
+        src,
+        srcCellI,
+        tgt,
+        tgtCellI,
+        bbTgtCell,
+        threshold
+    );
+}
+
+
+Foam::scalar Foam::meshToMeshNew::interVol
+(
+    const polyMesh& src,
+    const polyMesh& tgt,
+    const label srcCellI,
+    const label tgtCellI
+) const
+{
+    tetOverlapVolume overlapEngine;
+
+    treeBoundBox bbTgtCell
+    (
+        pointField
+        (
+            tgt.points(),
+            tgt.cellPoints()[tgtCellI]
+        )
+    );
+
+    scalar vol = overlapEngine.cellCellOverlapVolumeMinDecomp
+    (
+        src,
+        srcCellI,
+        tgt,
+        tgtCellI,
+        bbTgtCell
+    );
+
+    return vol;
+}
+
+
+// ************************************************************************* //
diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcDirect.C b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcDirect.C
new file mode 100644
index 0000000000000000000000000000000000000000..8e6a17511ef590af5f8eddfa339a73994a146109
--- /dev/null
+++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcDirect.C
@@ -0,0 +1,159 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012-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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "meshToMeshNew.H"
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+void Foam::meshToMeshNew::calcDirect
+(
+    const polyMesh& src,
+    const polyMesh& tgt,
+    const label srcSeedI,
+    const label tgtSeedI
+)
+{
+    // store a list of src cells already mapped
+    boolList srcSeedFlag(src.nCells(), true);
+    labelList srcTgtSeed(src.nCells(), -1);
+
+    List<DynamicList<label> > srcToTgt(src.nCells());
+    List<DynamicList<label> > tgtToSrc(tgt.nCells());
+
+    DynamicList<label> srcSeeds;
+
+    const scalarField& srcVc = src.cellVolumes();
+    const scalarField& tgtVc = tgt.cellVolumes();
+
+    label srcCellI = srcSeedI;
+    label tgtCellI = tgtSeedI;
+
+    do
+    {
+        // store src/tgt cell pair
+        srcToTgt[srcCellI].append(tgtCellI);
+        tgtToSrc[tgtCellI].append(srcCellI);
+
+        // mark source cell srcSeedI as matched
+        srcSeedFlag[srcCellI] = false;
+
+        // accumulate intersection volume
+        V_ += srcVc[srcCellI];
+
+        // find new source seed cell
+        appendToDirectSeeds
+        (
+            src,
+            tgt,
+            srcSeedFlag,
+            srcTgtSeed,
+            srcSeeds,
+            srcCellI,
+            tgtCellI
+        );
+    }
+    while (srcCellI >= 0);
+
+    // transfer addressing into persistent storage
+    forAll(srcToTgtCellAddr_, i)
+    {
+        scalar v = srcVc[i];
+        srcToTgtCellAddr_[i].transfer(srcToTgt[i]);
+        srcToTgtCellWght_[i] = scalarList(srcToTgtCellAddr_[i].size(), v);
+    }
+
+    forAll(tgtToSrcCellAddr_, i)
+    {
+        scalar v = tgtVc[i];
+        tgtToSrcCellAddr_[i].transfer(tgtToSrc[i]);
+        tgtToSrcCellWght_[i] = scalarList(tgtToSrcCellAddr_[i].size(), v);
+    }
+}
+
+
+void Foam::meshToMeshNew::appendToDirectSeeds
+(
+    const polyMesh& src,
+    const polyMesh& tgt,
+    boolList& mapFlag,
+    labelList& srcTgtSeed,
+    DynamicList<label>& srcSeeds,
+    label& srcSeedI,
+    label& tgtSeedI
+) const
+{
+    const labelList& srcNbr = src.cellCells()[srcSeedI];
+    const labelList& tgtNbr = tgt.cellCells()[tgtSeedI];
+
+    const vectorField& srcCentre = src.cellCentres();
+
+    forAll(srcNbr, i)
+    {
+        label srcI = srcNbr[i];
+
+        if (mapFlag[srcI] && (srcTgtSeed[srcI] == -1))
+        {
+            // source cell srcI not yet mapped
+
+            // identfy if target cell exists for source cell srcI
+            bool found = false;
+            forAll(tgtNbr, j)
+            {
+                label tgtI = tgtNbr[j];
+
+                if (tgt.pointInCell(srcCentre[srcI], tgtI))
+                {
+                    // new match - append to lists
+                    found = true;
+
+                    srcTgtSeed[srcI] = tgtI;
+                    srcSeeds.append(srcI);
+
+                    break;
+                }
+            }
+
+            if (!found)
+            {
+                // no match available for source cell srcI
+                mapFlag[srcI] = false;
+            }
+        }
+    }
+
+    if (srcSeeds.size())
+    {
+        srcSeedI = srcSeeds.remove();
+        tgtSeedI = srcTgtSeed[srcSeedI];
+    }
+    else
+    {
+        srcSeedI = -1;
+        tgtSeedI = -1;
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMapNearest.C b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMapNearest.C
new file mode 100644
index 0000000000000000000000000000000000000000..0276ee560495f8679eda7c7aa7b7710a41030aa3
--- /dev/null
+++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMapNearest.C
@@ -0,0 +1,265 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012-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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "meshToMeshNew.H"
+#include "ListOps.H"
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+void Foam::meshToMeshNew::calcMapNearest
+(
+    const polyMesh& src,
+    const polyMesh& tgt,
+    const label srcSeedI,
+    const label tgtSeedI,
+    const labelList& srcCellIDs,
+    boolList& mapFlag,
+    label& startSeedI
+)
+{
+    List<DynamicList<label> > srcToTgt(src.nCells());
+    List<DynamicList<label> > tgtToSrc(tgt.nCells());
+
+    const scalarField& srcVc = src.cellVolumes();
+    const scalarField& tgtVc = tgt.cellVolumes();
+
+    label srcCellI = srcSeedI;
+    label tgtCellI = tgtSeedI;
+
+    do
+    {
+        // find nearest tgt cell
+        findNearestCell(src, tgt, srcCellI, tgtCellI);
+
+        // store src/tgt cell pair
+        srcToTgt[srcCellI].append(tgtCellI);
+        tgtToSrc[tgtCellI].append(srcCellI);
+
+        // mark source cell srcCellI and tgtCellI as matched
+        mapFlag[srcCellI] = false;
+
+        // accumulate intersection volume
+        V_ += srcVc[srcCellI];
+
+        // find new source cell
+        setNextNearestCells
+        (
+            startSeedI,
+            srcCellI,
+            tgtCellI,
+            mapFlag,
+            src,
+            tgt,
+            srcCellIDs
+        );
+    }
+    while (srcCellI >= 0);
+
+
+    // for the case of multiple source cells per target cell, select the
+    // nearest source cell only and discard the others
+    const vectorField& srcCc = src.cellCentres();
+    const vectorField& tgtCc = tgt.cellCentres();
+
+    forAll(tgtToSrc, targetCellI)
+    {
+        if (tgtToSrc[targetCellI].size() > 1)
+        {
+            const vector& tgtC = tgtCc[tgtCellI];
+
+            DynamicList<label>& srcCells = tgtToSrc[targetCellI];
+
+            label srcCellI = srcCells[0];
+            scalar d = magSqr(tgtC - srcCc[srcCellI]);
+
+            for (label i = 1; i < srcCells.size(); i++)
+            {
+                label srcI = srcCells[i];
+                scalar dNew = magSqr(tgtC - srcCc[srcI]);
+                if (dNew < d)
+                {
+                    d = dNew;
+                    srcCellI = srcI;
+                }
+            }
+
+            srcCells.clear();
+            srcCells.append(srcCellI);
+        }
+    }
+
+    // If there are more target cells than source cells, some target cells
+    // might not yet be mapped
+    forAll(tgtToSrc, tgtCellI)
+    {
+        if (tgtToSrc[tgtCellI].empty())
+        {
+            label srcCellI = findMappedSrcCell(tgt, tgtCellI, tgtToSrc);
+
+            findNearestCell(tgt, src, tgtCellI, srcCellI);
+
+            tgtToSrc[tgtCellI].append(srcCellI);
+        }
+    }
+
+    // transfer addressing into persistent storage
+    forAll(srcToTgtCellAddr_, i)
+    {
+        scalar v = srcVc[i];
+        srcToTgtCellWght_[i] = scalarList(srcToTgt[i].size(), v);
+        srcToTgtCellAddr_[i].transfer(srcToTgt[i]);
+    }
+
+    forAll(tgtToSrcCellAddr_, i)
+    {
+        scalar v = tgtVc[i];
+        tgtToSrcCellWght_[i] = scalarList(tgtToSrc[i].size(), v);
+        tgtToSrcCellAddr_[i].transfer(tgtToSrc[i]);
+    }
+}
+
+
+void Foam::meshToMeshNew::findNearestCell
+(
+    const polyMesh& src,
+    const polyMesh& tgt,
+    const label srcCellI,
+    label& tgtCellI
+)
+{
+    const vectorField& srcC = src.cellCentres();
+    const vectorField& tgtC = tgt.cellCentres();
+
+    const vector& srcP = srcC[srcCellI];
+
+    DynamicList<label> tgtCells(10);
+    tgtCells.append(tgtCellI);
+
+    DynamicList<label> visitedCells(10);
+
+    scalar d = GREAT;
+
+    do
+    {
+        label tgtI = tgtCells.remove();
+        visitedCells.append(tgtI);
+
+        scalar dTest = magSqr(tgtC[tgtI] - srcP);
+        if (dTest < d)
+        {
+            tgtCellI = tgtI;
+            d = dTest;
+            appendNbrCells(tgtCellI, tgt, visitedCells, tgtCells);
+        }
+
+    } while (tgtCells.size() > 0);
+}
+
+
+void Foam::meshToMeshNew::setNextNearestCells
+(
+    label& startSeedI,
+    label& srcCellI,
+    label& tgtCellI,
+    boolList& mapFlag,
+    const polyMesh& src,
+    const polyMesh& tgt,
+    const labelList& srcCellIDs
+)
+{
+    const labelList& srcNbr = src.cellCells()[srcCellI];
+
+    srcCellI = -1;
+    forAll(srcNbr, i)
+    {
+        label cellI = srcNbr[i];
+        if (mapFlag[cellI])
+        {
+            srcCellI = cellI;
+            startSeedI = cellI + 1;
+
+            return;
+        }
+    }
+
+    (void)findInitialSeeds
+    (
+        src,
+        tgt,
+        srcCellIDs,
+        mapFlag,
+        startSeedI,
+        srcCellI,
+        tgtCellI
+    );
+}
+
+
+Foam::label Foam::meshToMeshNew::findMappedSrcCell
+(
+    const polyMesh& tgt,
+    const label tgtCellI,
+    const List<DynamicList<label> >& tgtToSrc
+) const
+{
+    DynamicList<label> testCells(10);
+    DynamicList<label> visitedCells(10);
+
+    testCells.append(tgtCellI);
+
+    do
+    {
+        // search target tgtCellI neighbours for match with source cell
+        label tgtI = testCells.remove();
+
+        if (findIndex(visitedCells, tgtI) == -1)
+        {
+            visitedCells.append(tgtI);
+
+            if (tgtToSrc[tgtI].size())
+            {
+                return tgtToSrc[tgtI][0];
+            }
+            else
+            {
+                const labelList& nbrCells = tgt.cellCells()[tgtI];
+
+                forAll(nbrCells, i)
+                {
+                    if (findIndex(visitedCells, nbrCells[i]) == -1)
+                    {
+                        testCells.append(nbrCells[i]);
+                    }
+                }
+            }
+        }
+    } while (testCells.size());
+
+    // did not find any match - should not be possible to get here!
+    return -1;
+}
+
+
+// ************************************************************************* //
diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C
index 9ecda6cb4fb537e1cd349501d775e055edccad30..4add751668f357bbc37cbd493660df5ba5820500 100644
--- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C
+++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C
@@ -29,7 +29,6 @@ License
 #include "globalIndex.H"
 #include "mergePoints.H"
 #include "treeBoundBox.H"
-#include "tetOverlapVolume.H"
 #include "indexedOctree.H"
 #include "treeDataCell.H"
 #include "ListOps.H"
@@ -44,14 +43,15 @@ namespace Foam
     const char* Foam::NamedEnum
     <
         Foam::meshToMeshNew::interpolationMethod,
-        2
+        3
     >::names[] =
     {
-        "map",
+        "direct",
+        "mapNearest",
         "cellVolumeWeight"
     };
 
-    const NamedEnum<meshToMeshNew::interpolationMethod, 2>
+    const NamedEnum<meshToMeshNew::interpolationMethod, 3>
         meshToMeshNew::interpolationMethodNames_;
 }
 
@@ -190,130 +190,30 @@ bool Foam::meshToMeshNew::findInitialSeeds
 }
 
 
-void Foam::meshToMeshNew::appendToDirectSeeds
+void Foam::meshToMeshNew::appendNbrCells
 (
-    const polyMesh& src,
-    const polyMesh& tgt,
-    boolList& mapFlag,
-    labelList& srcTgtSeed,
-    DynamicList<label>& srcSeeds,
-    label& srcSeedI,
-    label& tgtSeedI
+    const label cellI,
+    const polyMesh& mesh,
+    const DynamicList<label>& visitedCells,
+    DynamicList<label>& nbrCellIDs
 ) const
 {
-    const labelList& srcNbr = src.cellCells()[srcSeedI];
-    const labelList& tgtNbr = tgt.cellCells()[tgtSeedI];
-
-    const vectorField& srcCentre = src.cellCentres();
+    const labelList& nbrCells = mesh.cellCells()[cellI];
 
-    forAll(srcNbr, i)
+    // filter out cells already visited from cell neighbours
+    forAll(nbrCells, i)
     {
-        label srcI = srcNbr[i];
+        label nbrCellI = nbrCells[i];
 
-        if (mapFlag[srcI] && (srcTgtSeed[srcI] == -1))
+        if
+        (
+            (findIndex(visitedCells, nbrCellI) == -1)
+         && (findIndex(nbrCellIDs, nbrCellI) == -1)
+        )
         {
-            // source cell srcI not yet mapped
-
-            // identfy if target cell exists for source cell srcI
-            bool found = false;
-            forAll(tgtNbr, j)
-            {
-                label tgtI = tgtNbr[j];
-
-                if (tgt.pointInCell(srcCentre[srcI], tgtI))
-                {
-                    // new match - append to lists
-                    found = true;
-
-                    srcTgtSeed[srcI] = tgtI;
-                    srcSeeds.append(srcI);
-
-                    break;
-                }
-            }
-
-            if (!found)
-            {
-                // no match available for source cell srcI
-                mapFlag[srcI] = false;
-            }
+            nbrCellIDs.append(nbrCellI);
         }
     }
-
-    if (srcSeeds.size())
-    {
-        srcSeedI = srcSeeds.remove();
-        tgtSeedI = srcTgtSeed[srcSeedI];
-    }
-    else
-    {
-        srcSeedI = -1;
-        tgtSeedI = -1;
-    }
-}
-
-
-void Foam::meshToMeshNew::calcDirect
-(
-    const polyMesh& src,
-    const polyMesh& tgt,
-    const label srcSeedI,
-    const label tgtSeedI
-)
-{
-    // store a list of src cells already mapped
-    boolList srcSeedFlag(src.nCells(), true);
-    labelList srcTgtSeed(src.nCells(), -1);
-
-    List<DynamicList<label> > srcToTgt(src.nCells());
-    List<DynamicList<label> > tgtToSrc(tgt.nCells());
-
-    DynamicList<label> srcSeeds;
-
-    const scalarField& srcVc = src.cellVolumes();
-
-    label srcCellI = srcSeedI;
-    label tgtCellI = tgtSeedI;
-
-    do
-    {
-        // store src/tgt cell pair
-        srcToTgt[srcCellI].append(tgtCellI);
-        tgtToSrc[tgtCellI].append(srcCellI);
-
-        // mark source cell srcSeedI as matched
-        srcSeedFlag[srcCellI] = false;
-
-        // accumulate intersection volume
-        V_ += srcVc[srcCellI];
-
-        // find new source seed cell
-        appendToDirectSeeds
-        (
-            src,
-            tgt,
-            srcSeedFlag,
-            srcTgtSeed,
-            srcSeeds,
-            srcCellI,
-            tgtCellI
-        );
-
-    }
-    while (srcCellI >= 0);
-
-    // transfer addressing into persistent storage
-    forAll(srcToTgtCellAddr_, i)
-    {
-        srcToTgtCellAddr_[i].transfer(srcToTgt[i]);
-        srcToTgtCellWght_[i] = scalarList(srcToTgtCellAddr_[i].size(), 1.0);
-    }
-
-    forAll(tgtToSrcCellAddr_, i)
-    {
-        tgtToSrcCellAddr_[i].transfer(tgtToSrc[i]);
-        tgtToSrcCellWght_[i] = scalarList(tgtToSrcCellAddr_[i].size(), 1.0);
-    }
 }
 
 
@@ -347,310 +247,13 @@ void Foam::meshToMeshNew::normaliseWeights
             maxW = max(maxW, s/Vc);
         }
 
-        Info<< type() << ": " << descriptor << " weights min/max = "
+        Info<< "    " << descriptor << " weights min/max = "
             << returnReduce(minW, minOp<scalar>()) << ", "
             << returnReduce(maxW, maxOp<scalar>()) << endl;
     }
 }
 
 
-void Foam::meshToMeshNew::appendNbrTgtCells
-(
-    const label tgtCellI,
-    const polyMesh& tgt,
-    const DynamicList<label>& visitedTgtCells,
-    DynamicList<label>& nbrTgtCellIDs
-) const
-{
-    const labelList& nbrCells = tgt.cellCells()[tgtCellI];
-
-    // filter out cells already visited from cell neighbours
-    forAll(nbrCells, i)
-    {
-        label nbrCellI = nbrCells[i];
-
-        if
-        (
-            (findIndex(visitedTgtCells, nbrCellI) == -1)
-         && (findIndex(nbrTgtCellIDs, nbrCellI) == -1)
-        )
-        {
-            nbrTgtCellIDs.append(nbrCellI);
-        }
-    }
-}
-
-
-void Foam::meshToMeshNew::setNextCells
-(
-    label& startSeedI,
-    label& srcCellI,
-    label& tgtCellI,
-    const polyMesh& src,
-    const polyMesh& tgt,
-    const labelList& srcCellIDs,
-    const boolList& mapFlag,
-    const DynamicList<label>& visitedCells,
-    labelList& seedCells
-) const
-{
-    const labelList& srcNbrCells = src.cellCells()[srcCellI];
-
-    // set possible seeds for later use by querying all src cell neighbours
-    // with all visited target cells
-    bool valuesSet = false;
-    forAll(srcNbrCells, i)
-    {
-        label cellS = srcNbrCells[i];
-
-        if (mapFlag[cellS] && seedCells[cellS] == -1)
-        {
-            forAll(visitedCells, j)
-            {
-                label cellT = visitedCells[j];
-
-                if (intersect(src, tgt, cellS, cellT))
-                {
-                    seedCells[cellS] = cellT;
-
-                    if (!valuesSet)
-                    {
-                        srcCellI = cellS;
-                        tgtCellI = cellT;
-                        valuesSet = true;
-                    }
-                }
-            }
-        }
-    }
-
-    // set next src and tgt cells if not set above
-    if (valuesSet)
-    {
-        return;
-    }
-    else
-    {
-        // try to use existing seed
-        bool foundNextSeed = false;
-        for (label i = startSeedI; i < srcCellIDs.size(); i++)
-        {
-            label cellS = srcCellIDs[i];
-
-            if (mapFlag[cellS])
-            {
-                if (!foundNextSeed)
-                {
-                    startSeedI = i;
-                    foundNextSeed = true;
-                }
-
-                if (seedCells[cellS] != -1)
-                {
-                    srcCellI = cellS;
-                    tgtCellI = seedCells[cellS];
-
-                    return;
-                }
-            }
-        }
-
-        // perform new search to find match
-        if (debug)
-        {
-            Pout<< "Advancing front stalled: searching for new "
-                << "target cell" << endl;
-        }
-
-        bool restart =
-            findInitialSeeds
-            (
-                src,
-                tgt,
-                srcCellIDs,
-                mapFlag,
-                startSeedI,
-                srcCellI,
-                tgtCellI
-            );
-
-        if (restart)
-        {
-            // successfully found new starting seed-pair
-            return;
-        }
-    }
-
-    // if we have got to here, there are no more src/tgt cell intersections
-    srcCellI = -1;
-    tgtCellI = -1;
-}
-
-
-bool Foam::meshToMeshNew::intersect
-(
-    const polyMesh& src,
-    const polyMesh& tgt,
-    const label srcCellI,
-    const label tgtCellI
-) const
-{
-    scalar threshold = tolerance_*src.cellVolumes()[srcCellI];
-
-    tetOverlapVolume overlapEngine;
-
-    treeBoundBox bbTgtCell
-    (
-        pointField
-        (
-            tgt.points(),
-            tgt.cellPoints()[tgtCellI]
-        )
-    );
-
-    return overlapEngine.cellCellOverlapMinDecomp
-    (
-        src,
-        srcCellI,
-        tgt,
-        tgtCellI,
-        bbTgtCell,
-        threshold
-    );
-}
-
-
-Foam::scalar Foam::meshToMeshNew::interVol
-(
-    const polyMesh& src,
-    const polyMesh& tgt,
-    const label srcCellI,
-    const label tgtCellI
-) const
-{
-    tetOverlapVolume overlapEngine;
-
-    treeBoundBox bbTgtCell
-    (
-        pointField
-        (
-            tgt.points(),
-            tgt.cellPoints()[tgtCellI]
-        )
-    );
-
-    scalar vol = overlapEngine.cellCellOverlapVolumeMinDecomp
-    (
-        src,
-        srcCellI,
-        tgt,
-        tgtCellI,
-        bbTgtCell
-    );
-
-    return vol;
-}
-
-
-void Foam::meshToMeshNew::calcIndirect
-(
-    const polyMesh& src,
-    const polyMesh& tgt,
-    const label srcSeedI,
-    const label tgtSeedI,
-    const labelList& srcCellIDs,
-    boolList& mapFlag,
-    label& startSeedI
-)
-{
-    label srcCellI = srcSeedI;
-    label tgtCellI = tgtSeedI;
-
-    List<DynamicList<label> > srcToTgtAddr(src.nCells());
-    List<DynamicList<scalar> > srcToTgtWght(src.nCells());
-
-    List<DynamicList<label> > tgtToSrcAddr(tgt.nCells());
-    List<DynamicList<scalar> > tgtToSrcWght(tgt.nCells());
-
-    // list of tgt cell neighbour cells
-    DynamicList<label> nbrTgtCells(10);
-
-    // list of tgt cells currently visited for srcCellI to avoid multiple hits
-    DynamicList<label> visitedTgtCells(10);
-
-    // list to keep track of tgt cells used to seed src cells
-    labelList seedCells(src.nCells(), -1);
-    seedCells[srcCellI] = tgtCellI;
-
-    const scalarField& srcVol = src.cellVolumes();
-
-    do
-    {
-        nbrTgtCells.clear();
-        visitedTgtCells.clear();
-
-        // append initial target cell and neighbours
-        nbrTgtCells.append(tgtCellI);
-        appendNbrTgtCells(tgtCellI, tgt, visitedTgtCells, nbrTgtCells);
-
-        do
-        {
-            tgtCellI = nbrTgtCells.remove();
-            visitedTgtCells.append(tgtCellI);
-
-            scalar vol = interVol(src, tgt, srcCellI, tgtCellI);
-
-            // accumulate addressing and weights for valid intersection
-            if (vol/srcVol[srcCellI] > tolerance_)
-            {
-                // store src/tgt cell pair
-                srcToTgtAddr[srcCellI].append(tgtCellI);
-                srcToTgtWght[srcCellI].append(vol);
-
-                tgtToSrcAddr[tgtCellI].append(srcCellI);
-                tgtToSrcWght[tgtCellI].append(vol);
-
-                appendNbrTgtCells(tgtCellI, tgt, visitedTgtCells, nbrTgtCells);
-
-                // accumulate intersection volume
-                V_ += vol;
-            }
-        }
-        while (!nbrTgtCells.empty());
-
-        mapFlag[srcCellI] = false;
-
-        // find new source seed cell
-        setNextCells
-        (
-            startSeedI,
-            srcCellI,
-            tgtCellI,
-            src,
-            tgt,
-            srcCellIDs,
-            mapFlag,
-            visitedTgtCells,
-            seedCells
-        );
-    }
-    while (srcCellI != -1);
-
-    // transfer addressing into persistent storage
-    forAll(srcToTgtCellAddr_, i)
-    {
-        srcToTgtCellAddr_[i].transfer(srcToTgtAddr[i]);
-        srcToTgtCellWght_[i].transfer(srcToTgtWght[i]);
-    }
-
-    forAll(tgtToSrcCellAddr_, i)
-    {
-        tgtToSrcCellAddr_[i].transfer(tgtToSrcAddr[i]);
-        tgtToSrcCellWght_[i].transfer(tgtToSrcWght[i]);
-    }
-}
-
-
 void Foam::meshToMeshNew::calcAddressing
 (
     const polyMesh& src,
@@ -723,14 +326,28 @@ void Foam::meshToMeshNew::calcAddressing
 
     switch (method_)
     {
-        case imMap:
+        case imDirect:
         {
             calcDirect(src, tgt, srcSeedI, tgtSeedI);
             break;
         }
+        case imMapNearest:
+        {
+            calcMapNearest
+            (
+                src,
+                tgt,
+                srcSeedI,
+                tgtSeedI,
+                srcCellIDs,
+                mapFlag,
+                startSeedI
+            );
+            break;
+        }
         case imCellVolumeWeight:
         {
-            calcIndirect
+            calcCellVolumeWeight
             (
                 src,
                 tgt,
@@ -765,42 +382,24 @@ void Foam::meshToMeshNew::calcAddressing
 }
 
 
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-Foam::meshToMeshNew::meshToMeshNew
-(
-    const polyMesh& src,
-    const polyMesh& tgt,
-    const interpolationMethod& method
-)
-:
-    srcRegionName_(src.name()),
-    tgtRegionName_(tgt.name()),
-    srcToTgtCellAddr_(),
-    tgtToSrcCellAddr_(),
-    srcToTgtCellWght_(),
-    tgtToSrcCellWght_(),
-    method_(method),
-    V_(0.0),
-    singleMeshProc_(-1),
-    srcMapPtr_(NULL),
-    tgtMapPtr_(NULL)
+void Foam::meshToMeshNew::calculate()
 {
-    Info<< "Creating mesh-to-mesh addressing for " << src.name()
-        << " and " << tgt.name() << " regions" << endl;
+    Info<< "Creating mesh-to-mesh addressing for " << srcRegion_.name()
+        << " and " << tgtRegion_.name() << " regions using "
+        << interpolationMethodNames_[method_] << endl;
 
-    singleMeshProc_ = calcDistribution(src, tgt);
+    singleMeshProc_ = calcDistribution(srcRegion_, tgtRegion_);
 
     if (singleMeshProc_ == -1)
     {
         // create global indexing for src and tgt meshes
-        globalIndex globalSrcCells(src.nCells());
-        globalIndex globalTgtCells(tgt.nCells());
+        globalIndex globalSrcCells(srcRegion_.nCells());
+        globalIndex globalTgtCells(tgtRegion_.nCells());
 
         // Create processor map of overlapping cells. This map gets
         // (possibly remote) cells from the tgt mesh such that they (together)
         // cover all of the src mesh
-        autoPtr<mapDistribute> mapPtr = calcProcMap(src, tgt);
+        autoPtr<mapDistribute> mapPtr = calcProcMap(srcRegion_, tgtRegion_);
         const mapDistribute& map = mapPtr();
 
         pointField newTgtPoints;
@@ -812,7 +411,7 @@ Foam::meshToMeshNew::meshToMeshNew
         distributeAndMergeCells
         (
             map,
-            tgt,
+            tgtRegion_,
             globalTgtCells,
             newTgtPoints,
             newTgtFaces,
@@ -827,9 +426,9 @@ Foam::meshToMeshNew::meshToMeshNew
         (
             IOobject
             (
-                "newTgt::" + Foam::name(Pstream::myProcNo()),
-                tgt.time().timeName(),
-                tgt.time(),
+                "newTgt." + Foam::name(Pstream::myProcNo()),
+                tgtRegion_.time().timeName(),
+                tgtRegion_.time(),
                 IOobject::NO_READ
             ),
             xferMove(newTgtPoints),
@@ -862,9 +461,9 @@ Foam::meshToMeshNew::meshToMeshNew
         if (debug)
         {
             Pout<< "Created newTgt mesh:" << nl
-                << " old cells = " << tgt.nCells()
+                << " old cells = " << tgtRegion_.nCells()
                 << ", new cells = " << newTgt.nCells() << nl
-                << " old faces = " << tgt.nFaces()
+                << " old faces = " << tgtRegion_.nFaces()
                 << ", new faces = " << newTgt.nFaces() << endl;
 
             if (debug > 1)
@@ -874,7 +473,7 @@ Foam::meshToMeshNew::meshToMeshNew
             }
         }
 
-        calcAddressing(src, newTgt);
+        calcAddressing(srcRegion_, newTgt);
 
         // per source cell the target cell address in newTgt mesh
         forAll(srcToTgtCellAddr_, i)
@@ -901,7 +500,7 @@ Foam::meshToMeshNew::meshToMeshNew
         (
             Pstream::nonBlocking,
             List<labelPair>(),
-            tgt.nCells(),
+            tgtRegion_.nCells(),
             map.constructMap(),
             map.subMap(),
             tgtToSrcCellAddr_,
@@ -914,7 +513,7 @@ Foam::meshToMeshNew::meshToMeshNew
         (
             Pstream::nonBlocking,
             List<labelPair>(),
-            tgt.nCells(),
+            tgtRegion_.nCells(),
             map.constructMap(),
             map.subMap(),
             tgtToSrcCellWght_,
@@ -926,7 +525,7 @@ Foam::meshToMeshNew::meshToMeshNew
         normaliseWeights
         (
             "source",
-            src.cellVolumes(),
+            srcRegion_.cellVolumes(),
             srcToTgtCellAddr_,
             srcToTgtCellWght_
         );
@@ -934,7 +533,7 @@ Foam::meshToMeshNew::meshToMeshNew
         normaliseWeights
         (
             "target",
-            tgt.cellVolumes(),
+            tgtRegion_.cellVolumes(),
             tgtToSrcCellAddr_,
             tgtToSrcCellWght_
         );
@@ -955,12 +554,12 @@ Foam::meshToMeshNew::meshToMeshNew
     }
     else
     {
-        calcAddressing(src, tgt);
+        calcAddressing(srcRegion_, tgtRegion_);
 
         normaliseWeights
         (
             "source",
-            src.cellVolumes(),
+            srcRegion_.cellVolumes(),
             srcToTgtCellAddr_,
             srcToTgtCellWght_
         );
@@ -968,7 +567,7 @@ Foam::meshToMeshNew::meshToMeshNew
         normaliseWeights
         (
             "target",
-            tgt.cellVolumes(),
+            tgtRegion_.cellVolumes(),
             tgtToSrcCellAddr_,
             tgtToSrcCellWght_
         );
@@ -978,6 +577,162 @@ Foam::meshToMeshNew::meshToMeshNew
 }
 
 
+const Foam::PtrList<Foam::AMIPatchToPatchInterpolation>&
+Foam::meshToMeshNew::patchAMIs() const
+{
+    if (patchAMIs_.empty())
+    {
+        patchAMIs_.setSize(srcPatchID_.size());
+
+        forAll(srcPatchID_, i)
+        {
+            label srcPatchI = srcPatchID_[i];
+            label tgtPatchI = tgtPatchID_[i];
+
+            const polyPatch& srcPP = srcRegion_.boundaryMesh()[srcPatchI];
+            const polyPatch& tgtPP = tgtRegion_.boundaryMesh()[tgtPatchI];
+
+            Info<< "Creating AMI between source patch " << srcPP.name()
+                << " and target patch " << tgtPP.name() << endl;
+
+            Info<< incrIndent;
+
+            patchAMIs_.set
+            (
+                i,
+                new AMIPatchToPatchInterpolation
+                (
+                    srcPP,
+                    tgtPP,
+                    faceAreaIntersect::tmMesh,
+                    true // flip target patch since patch normals are aligned
+                )
+            );
+
+            Info<< decrIndent;
+        }
+    }
+
+    return patchAMIs_;
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::meshToMeshNew::meshToMeshNew
+(
+    const polyMesh& src,
+    const polyMesh& tgt,
+    const interpolationMethod& method,
+    bool interpAllPatches
+)
+:
+    srcRegion_(src),
+    tgtRegion_(tgt),
+    srcPatchID_(),
+    tgtPatchID_(),
+    patchAMIs_(),
+    srcToTgtCellAddr_(),
+    tgtToSrcCellAddr_(),
+    srcToTgtCellWght_(),
+    tgtToSrcCellWght_(),
+    method_(method),
+    V_(0.0),
+    singleMeshProc_(-1),
+    srcMapPtr_(NULL),
+    tgtMapPtr_(NULL)
+{
+    if (interpAllPatches)
+    {
+        const polyBoundaryMesh& srcBM = src.boundaryMesh();
+        const polyBoundaryMesh& tgtBM = tgt.boundaryMesh();
+
+        if (srcBM.size() != tgtBM.size())
+        {
+            FatalErrorIn
+            (
+                "Foam::meshToMeshNew::meshToMeshNew"
+                "("
+                    "const polyMesh&, "
+                    "const polyMesh&, "
+                    "const interpolationMethod&"
+                ")"
+            )   << "Source and target meshes are dissimiar:" << nl
+                << "    Source patches: " << srcBM.size() << nl
+                << "    Target patches: " << tgtBM.size() << exit(FatalError);
+        }
+
+        DynamicList<label> patchID(src.boundaryMesh().size());
+
+        forAll(srcBM, patchI)
+        {
+            const polyPatch& pp = srcBM[patchI];
+            if (!polyPatch::constraintType(pp.type()))
+            {
+                patchID.append(pp.index());
+            }
+        }
+
+        srcPatchID_.transfer(patchID);
+        tgtPatchID_ = srcPatchID_;
+    }
+
+    // calculate volume addressing and weights
+    calculate();
+
+    // calculate patch addressing and weights
+    (void)patchAMIs();
+}
+
+
+Foam::meshToMeshNew::meshToMeshNew
+(
+    const polyMesh& src,
+    const polyMesh& tgt,
+    const interpolationMethod& method,
+    const HashTable<word>& patchMap
+)
+:
+    srcRegion_(src),
+    tgtRegion_(tgt),
+    srcPatchID_(),
+    tgtPatchID_(),
+    patchAMIs_(),
+    srcToTgtCellAddr_(),
+    tgtToSrcCellAddr_(),
+    srcToTgtCellWght_(),
+    tgtToSrcCellWght_(),
+    method_(method),
+    V_(0.0),
+    singleMeshProc_(-1),
+    srcMapPtr_(NULL),
+    tgtMapPtr_(NULL)
+{
+    srcPatchID_.setSize(patchMap.size());
+    tgtPatchID_.setSize(patchMap.size());
+
+    label i = 0;
+    forAllConstIter(HashTable<word>, patchMap, iter)
+    {
+        const word& srcPatchName = iter.key();
+        const word& tgtPatchName = iter();
+
+        const polyPatch& srcPatch = srcRegion_.boundaryMesh()[srcPatchName];
+        const polyPatch& tgtPatch = tgtRegion_.boundaryMesh()[tgtPatchName];
+
+        srcPatchID_[i] = srcPatch.index();
+        tgtPatchID_[i] = tgtPatch.index();
+        i++;
+    }
+
+    // calculate volume addressing and weights
+    calculate();
+
+    // calculate patch addressing and weights
+    (void)patchAMIs();
+}
+
+
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
 Foam::meshToMeshNew::~meshToMeshNew()
diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.H b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.H
index 85f0c1332e9e5857008d54553a6fe38a0b6ff7f8..8404ce7b9fa077ecc07ea02671d4673dfeb6981c 100644
--- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.H
+++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.H
@@ -27,7 +27,19 @@ Class
 Description
     Class to calculate the cell-addressing between two overlapping meshes
 
+    Three methods are currently available:
+    - direct           : 1-to-1 mapping between meshes
+    - mapNearest       : assign nearest cell values without interpolation
+    - cellVolumeWeight : volume consistent mapping
+
+    The \c direct and \c cellVolumeWeight options are volume conservative,
+    whereas mapNearest is non-conservative.
+
+
 SourceFiles
+    calcDirect.C
+    calcMapNearest.C
+    calcCellVolumeWeight.C
     meshToMeshNew.C
     meshToMeshNewTemplates.C
 
@@ -41,6 +53,7 @@ SourceFiles
 #include "mapDistribute.H"
 #include "volFieldsFwd.H"
 #include "NamedEnum.H"
+#include "AMIPatchToPatchInterpolation.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -60,22 +73,32 @@ public:
         //- Enumeration specifying required accuracy
         enum interpolationMethod
         {
-            imMap,
+            imDirect,
+            imMapNearest,
             imCellVolumeWeight
         };
 
-        static const NamedEnum<interpolationMethod, 2>
+        static const NamedEnum<interpolationMethod, 3>
             interpolationMethodNames_;
 
 private:
 
     // Private data
 
-        //- Name of source mesh region
-        const word srcRegionName_;
+        //- Reference to the source mesh
+        const polyMesh& srcRegion_;
+
+        //- Reference to the target mesh
+        const polyMesh& tgtRegion_;
 
-        //- Name of target mesh region
-        const word tgtRegionName_;
+        //- List of target patch IDs per source patch (local index)
+        List<label> srcPatchID_;
+
+        //- List of source patch IDs per target patch (local index)
+        List<label> tgtPatchID_;
+
+        //- List of AMIs between source and target patches
+        mutable PtrList<AMIPatchToPatchInterpolation> patchAMIs_;
 
         //- Source to target cell addressing
         labelListList srcToTgtCellAddr_;
@@ -139,9 +162,36 @@ private:
             label& tgtSeedI
         ) const;
 
+        //- Append target cell neihgbour cells to cellIDs list
+        void appendNbrCells
+        (
+            const label tgtCellI,
+            const polyMesh& tgt,
+            const DynamicList<label>& visitedTgtCells,
+            DynamicList<label>& nbrTgtCellIDs
+        ) const;
+
+        //- Normalise the interpolation weights
+        void normaliseWeights
+        (
+            const word& descriptor,
+            const scalarField& cellVolumes,
+            const labelListList& addr,
+            scalarListList& wght
+        ) const;
+
 
         // Direct (one-to-one) mapping
 
+            //- Main driver routine for direct mapping
+            void calcDirect
+            (
+                const polyMesh& src,
+                const polyMesh& tgt,
+                const label srcSeedI,
+                const label tgtSeedI
+            );
+
             //- Append to list of src mesh seed indices
             void appendToDirectSeeds
             (
@@ -154,35 +204,63 @@ private:
                 label& tgtSeedI
             ) const;
 
-            //- Main driver routine for direct mapping
-            void calcDirect
+        // Nearest (non-conformal) mapping
+
+            //- Main driver routine for nearest-mapping routine
+            void calcMapNearest
             (
                 const polyMesh& src,
                 const polyMesh& tgt,
                 const label srcSeedI,
-                const label tgtSeedI
+                const label tgtSeedI,
+                const labelList& srcCellIDs,
+                boolList& mapFlag,
+                label& startSeedI
             );
 
+            //- Find target cell index of cell closest to source cell
+            void findNearestCell
+            (
+                const polyMesh& src,
+                const polyMesh& tgt,
+                const label srcCellI,
+                label& tgtCellI
+            );
 
-        // Indirect (non-conformal) mapping
+            //- Set the next pair of cells
+            void setNextNearestCells
+            (
+                label& startSeedI,
+                label& srcCellI,
+                label& tgtCellI,
+                boolList& mapFlag,
+                const polyMesh& src,
+                const polyMesh& tgt,
+                const labelList& srcCellIDs
+            );
 
-            //- Normalise the interpolation weights
-            void normaliseWeights
+            //- Find source cell for target cell
+            label findMappedSrcCell
             (
-                const word& descriptor,
-                const scalarField& cellVolumes,
-                const labelListList& addr,
-                scalarListList& wght
+                const polyMesh& tgt,
+                const label tgtCellI,
+                const List<DynamicList<label> >& tgtToSrc
             ) const;
 
-            //- Append target cell neihgbour cells to cellIDs list
-            void appendNbrTgtCells
+
+        // Cell volume weighted (non-conformal) interpolation
+
+            //- Main driver routine for cell volume weighted interpolation
+            void calcCellVolumeWeight
             (
-                const label tgtCellI,
+                const polyMesh& src,
                 const polyMesh& tgt,
-                const DynamicList<label>& visitedTgtCells,
-                DynamicList<label>& nbrTgtCellIDs
-            ) const;
+                const label srcSeedI,
+                const label tgtSeedI,
+                const labelList& srcCellIDs,
+                boolList& mapFlag,
+                label& startSeedI
+            );
 
             //- Set the next cells in the advancing front algorithm
             void setNextCells
@@ -216,23 +294,17 @@ private:
                 const label tgtCellI
             ) const;
 
-            //- Main driver routine for indirect mapping
-            void calcIndirect
-            (
-                const polyMesh& src,
-                const polyMesh& tgt,
-                const label srcSeedI,
-                const label tgtSeedI,
-                const labelList& srcCellIDs,
-                boolList& mapFlag,
-                label& startSeedI
-            );
-
 
         //- Calculate the addressing between overalping regions of src and tgt
-        //  meshes - main driver function
+        //  meshes
         void calcAddressing(const polyMesh& src, const polyMesh& tgt);
 
+        //- Calculate - main driver function
+        void calculate();
+
+        //- Return the list of AMIs between source and target patches
+        const PtrList<AMIPatchToPatchInterpolation>& patchAMIs() const;
+
 
         // Parallel operations
 
@@ -306,7 +378,18 @@ public:
     (
         const polyMesh& src,
         const polyMesh& tgt,
-        const interpolationMethod& method
+        const interpolationMethod& method,
+        const bool interpAllPatches = true
+    );
+
+
+    //- Construct from source and target meshes
+    meshToMeshNew
+    (
+        const polyMesh& src,
+        const polyMesh& tgt,
+        const interpolationMethod& method,
+        const HashTable<word>& patchMap
     );
 
 
@@ -318,6 +401,12 @@ public:
 
         // Access
 
+            //- Return const access to the source mesh
+            inline const polyMesh& srcRegion() const;
+
+            //- Return const access to the target mesh
+            inline const polyMesh& tgtRegion() const;
+
             //- Return const access to the source to target cell addressing
             inline const labelListList& srcToTgtCellAddr() const;
 
@@ -432,60 +521,103 @@ public:
                 ) const;
 
 
-            // Volume field mapping
+            // Source-to-target volume field mapping
 
-                //- Interpolare a field with a defined operation.  Values
+                //- Interpolate a field with a defined operation.  Values
                 //  passed in via 'result' are used to initialise the return
-                //  value.  Optionally interpolate patch values
+                //  value
                 template<class Type, class CombineOp>
-                void interpolate
+                void mapSrcToTgt
                 (
                     const GeometricField<Type, fvPatchField, volMesh>& field,
                     const CombineOp& cop,
-                    GeometricField<Type, fvPatchField, volMesh>& result,
-                    const bool interpPatches = true
+                    GeometricField<Type, fvPatchField, volMesh>& result
                 ) const;
 
-                //- Interpolare a field with a defined operation.  The initial
-                //  values of the result are set to zero.  Optionally
-                //  interpolate patch values
+                //- Interpolate a field with a defined operation.  The initial
+                //  values of the result are set to zero
                 template<class Type, class CombineOp>
-                tmp<GeometricField<Type, fvPatchField, volMesh> > interpolate
+                tmp<GeometricField<Type, fvPatchField, volMesh> > mapSrcToTgt
                 (
                     const GeometricField<Type, fvPatchField, volMesh>& field,
-                    const CombineOp& cop,
-                    const bool interpPatches = true
+                    const CombineOp& cop
                 ) const;
 
-                //- Interpolare a tmp field with a defined operation.  The
-                //  initial values of the result are set to zero.  Optionally
-                //  interpolate patch values
+                //- Interpolate a tmp field with a defined operation.  The
+                //  initial values of the result are set to zero
                 template<class Type, class CombineOp>
-                tmp<GeometricField<Type, fvPatchField, volMesh> > interpolate
+                tmp<GeometricField<Type, fvPatchField, volMesh> > mapSrcToTgt
                 (
                     const tmp<GeometricField<Type, fvPatchField, volMesh> >&
                         tfield,
-                    const CombineOp& cop,
-                    const bool interpPatches = true
+                    const CombineOp& cop
                 ) const;
 
                 //- Convenience function to map a field with a default
-                //  operation (plusEqOp).  Optionally interpolate patch values
+                //  operation (plusEqOp)
                 template<class Type>
-                tmp<GeometricField<Type, fvPatchField, volMesh> > interpolate
+                tmp<GeometricField<Type, fvPatchField, volMesh> > mapSrcToTgt
                 (
-                    const GeometricField<Type, fvPatchField, volMesh>& field,
-                    const bool interpPatches = true
+                    const GeometricField<Type, fvPatchField, volMesh>& field
                 ) const;
 
                 //- Convenience function to map a tmp field with a default
-                //  operation (plusEqOp).  Optionally interpolate patch values
+                //  operation (plusEqOp)
                 template<class Type>
-                tmp<GeometricField<Type, fvPatchField, volMesh> > interpolate
+                tmp<GeometricField<Type, fvPatchField, volMesh> > mapSrcToTgt
+                (
+                    const tmp<GeometricField<Type, fvPatchField, volMesh> >&
+                        tfield
+                ) const;
+
+
+            // Target-to-source volume field mapping
+
+                //- Interpolate a field with a defined operation.  Values
+                //  passed in via 'result' are used to initialise the return
+                //  value
+                template<class Type, class CombineOp>
+                void mapTgtToSrc
+                (
+                    const GeometricField<Type, fvPatchField, volMesh>& field,
+                    const CombineOp& cop,
+                    GeometricField<Type, fvPatchField, volMesh>& result
+                ) const;
+
+                //- Interpolate a field with a defined operation.  The initial
+                //  values of the result are set to zero
+                template<class Type, class CombineOp>
+                tmp<GeometricField<Type, fvPatchField, volMesh> > mapTgtToSrc
+                (
+                    const GeometricField<Type, fvPatchField, volMesh>& field,
+                    const CombineOp& cop
+                ) const;
+
+                //- Interpolate a tmp field with a defined operation.  The
+                //  initial values of the result are set to zero
+                template<class Type, class CombineOp>
+                tmp<GeometricField<Type, fvPatchField, volMesh> > mapTgtToSrc
                 (
                     const tmp<GeometricField<Type, fvPatchField, volMesh> >&
                         tfield,
-                    const bool interpPatches = true
+                    const CombineOp& cop
+                ) const;
+
+                //- Convenience function to map a field with a default
+                //  operation (plusEqOp)
+                template<class Type>
+                tmp<GeometricField<Type, fvPatchField, volMesh> > mapTgtToSrc
+                (
+                    const GeometricField<Type, fvPatchField, volMesh>& field
+                ) const;
+
+                //- Convenience function to map a tmp field with a default
+                //  operation (plusEqOp)
+                template<class Type>
+                tmp<GeometricField<Type, fvPatchField, volMesh> > mapTgtToSrc
+                (
+                    const tmp<GeometricField<Type, fvPatchField, volMesh> >&
+                        tfield
                 ) const;
 };
 
diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewI.H b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewI.H
index 41068e8c455e4e9f5b8d7737acc2fde589df618c..157a9efd653b360d779425dd2cf21a0a855f00cf 100644
--- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewI.H
+++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewI.H
@@ -27,6 +27,18 @@ License
 
 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
 
+inline const Foam::polyMesh& Foam::meshToMeshNew::srcRegion() const
+{
+    return srcRegion_;
+}
+
+
+inline const Foam::polyMesh& Foam::meshToMeshNew::tgtRegion() const
+{
+    return tgtRegion_;
+}
+
+
 inline const Foam::labelListList&
 Foam::meshToMeshNew::srcToTgtCellAddr() const
 {
diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewTemplates.C b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewTemplates.C
index 69bbc69667b466985a055d3c424b925eec0ca38f..dde5218fd485f78e852cde335dafb752eba8082a 100644
--- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewTemplates.C
+++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewTemplates.C
@@ -25,7 +25,6 @@ License
 
 #include "fvMesh.H"
 #include "volFields.H"
-//#include "ops.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -56,31 +55,6 @@ namespace Foam
             }
         }
     };
-
-    //- Combine operator for maps/interpolations
-    template<class Type, class CombineOp>
-    class combineBinaryOp
-    {
-        const CombineOp& cop_;
-
-        public:
-
-            combineBinaryOp(const CombineOp& cop)
-            :
-                cop_(cop)
-            {}
-
-            void operator()
-            (
-                Type& x,
-                const label faceI,
-                const Type& y,
-                const scalar weight
-            ) const
-            {
-                cop_(x, weight*y);
-            }
-    };
 }
 
 
@@ -119,13 +93,13 @@ void Foam::meshToMeshNew::mapSrcToTgt
                 "List<Type>&"
             ") const"
         )   << "Supplied field size is not equal to target mesh size" << nl
-            << "    source mesh   = " << srcToTgtCellAddr_.size() << nl
-            << "    target mesh   = " << tgtToSrcCellAddr_.size() << nl
+            << "    source mesh    = " << srcToTgtCellAddr_.size() << nl
+            << "    target mesh    = " << tgtToSrcCellAddr_.size() << nl
             << "    supplied field = " << result.size()
             << abort(FatalError);
     }
 
-    combineBinaryOp<Type, CombineOp> cbop(cop);
+    multiplyWeightedOp<Type, CombineOp> cbop(cop);
 
     if (singleMeshProc_ == -1)
     {
@@ -247,13 +221,13 @@ void Foam::meshToMeshNew::mapTgtToSrc
                 "List<Type>&"
             ") const"
         )   << "Supplied field size is not equal to source mesh size" << nl
-            << "    source mesh   = " << srcToTgtCellAddr_.size() << nl
-            << "    target mesh   = " << tgtToSrcCellAddr_.size() << nl
+            << "    source mesh    = " << srcToTgtCellAddr_.size() << nl
+            << "    target mesh    = " << tgtToSrcCellAddr_.size() << nl
             << "    supplied field = " << result.size()
             << abort(FatalError);
     }
 
-    combineBinaryOp<Type, CombineOp> cbop(cop);
+    multiplyWeightedOp<Type, CombineOp> cbop(cop);
 
     if (singleMeshProc_ == -1)
     {
@@ -269,7 +243,6 @@ void Foam::meshToMeshNew::mapTgtToSrc
 
             if (tgtAddress.size())
             {
-//                result[cellI] = pTraits<Type>::zero;
                 result[cellI] *= (1.0 - sum(tgtWeight));
                 forAll(tgtAddress, i)
                 {
@@ -289,7 +262,6 @@ void Foam::meshToMeshNew::mapTgtToSrc
 
             if (tgtAddress.size())
             {
-//                result[cellI] = pTraits<Type>::zero;
                 result[cellI] *= (1.0 - sum(tgtWeight));
                 forAll(tgtAddress, i)
                 {
@@ -357,140 +329,181 @@ Foam::tmp<Foam::Field<Type> > Foam::meshToMeshNew::mapTgtToSrc
 
 
 template<class Type, class CombineOp>
-void Foam::meshToMeshNew::interpolate
+void Foam::meshToMeshNew::mapSrcToTgt
 (
     const GeometricField<Type, fvPatchField, volMesh>& field,
     const CombineOp& cop,
-    GeometricField<Type, fvPatchField, volMesh>& result,
-    const bool interpPatches
+    GeometricField<Type, fvPatchField, volMesh>& result
 ) const
 {
-    const fvMesh& mesh = field.mesh();
+    // clear any previously stored values
 
-    if (mesh.name() == srcRegionName_)
-    {
-        mapSrcToTgt(field, cop, result.internalField());
-    }
-    else if (mesh.name() == tgtRegionName_)
+
+    mapSrcToTgt(field, cop, result.internalField());
+
+    const PtrList<AMIPatchToPatchInterpolation>& AMIList = patchAMIs();
+
+    forAll(AMIList, i)
     {
-        mapTgtToSrc(field, cop, result.internalField());
+        label srcPatchI = srcPatchID_[i];
+        label tgtPatchI = tgtPatchID_[i];
+
+        const Field<Type>& srcField = field.boundaryField()[srcPatchI];
+        Field<Type>& tgtField = result.boundaryField()[tgtPatchI];
+
+        tgtField = pTraits<Type>::zero;
+
+        AMIList[i].interpolateToTarget
+        (
+            srcField,
+            multiplyWeightedOp<Type, CombineOp>(cop),
+            tgtField
+        );
     }
-    else
-    {
-        FatalErrorIn
+}
+
+
+template<class Type, class CombineOp>
+Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
+Foam::meshToMeshNew::mapSrcToTgt
+(
+    const GeometricField<Type, fvPatchField, volMesh>& field,
+    const CombineOp& cop
+) const
+{
+    typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
+
+    const fvMesh& tgtMesh = static_cast<const fvMesh&>(tgtRegion_);
+
+    tmp<fieldType> tresult
+    (
+        new fieldType
         (
-            "void Foam::meshToMeshNew::interpolate"
-            "("
-                "const GeometricField<Type, fvPatchField, volMesh>&, "
-                "const CombineOp&, "
-                "GeometricField<Type, fvPatchField, volMesh>&, "
-                "const bool"
-            ") const"
+            IOobject
+            (
+                type() + ".interpolate(" + field.name() + ")",
+                tgtMesh.time().timeName(),
+                tgtMesh,
+                IOobject::NO_READ,
+                IOobject::NO_WRITE
+            ),
+            tgtMesh,
+            dimensioned<Type>
+            (
+                "zero",
+                field.dimensions(),
+                pTraits<Type>::zero
+            )
         )
-            << "Supplied field " << field.name() << " did not originate from "
-            << "either the source or target meshes used to create this "
-            << "interpolation object"
-            << abort(FatalError);
-    }
+    );
 
-    if (interpPatches)
-    {
-        switch (method_)
-        {
-            case imMap:
-            {
-                result.boundaryField() == field.boundaryField();
-                break;
-            }
-            default:
-            {
-                notImplemented
-                (
-                    "void Foam::meshToMeshNew::interpolate"
-                    "("
-                        "const GeometricField<Type, fvPatchField, volMesh>&, "
-                        "const CombineOp&, "
-                        "GeometricField<Type, fvPatchField, volMesh>&, "
-                        "const bool"
-                    ") const - non-conformal patches"
-                )
-
-                // do something...
-            }
-        }
-    }
+    mapSrcToTgt(field, cop, tresult());
+
+    return tresult;
 }
 
 
 template<class Type, class CombineOp>
 Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
-Foam::meshToMeshNew::interpolate
+Foam::meshToMeshNew::mapSrcToTgt
+(
+    const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfield,
+    const CombineOp& cop
+) const
+{
+    return mapSrcToTgt(tfield(), cop);
+}
+
+
+template<class Type>
+Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
+Foam::meshToMeshNew::mapSrcToTgt
+(
+    const GeometricField<Type, fvPatchField, volMesh>& field
+) const
+{
+    return mapSrcToTgt(field, plusEqOp<Type>());
+}
+
+
+template<class Type>
+Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
+Foam::meshToMeshNew::mapSrcToTgt
+(
+    const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfield
+) const
+{
+    return mapSrcToTgt(tfield(), plusEqOp<Type>());
+}
+
+
+template<class Type, class CombineOp>
+void Foam::meshToMeshNew::mapTgtToSrc
 (
     const GeometricField<Type, fvPatchField, volMesh>& field,
     const CombineOp& cop,
-    const bool interpPatches
+    GeometricField<Type, fvPatchField, volMesh>& result
 ) const
 {
-    typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
-
-    const fvMesh& mesh = field.mesh();
+    mapTgtToSrc(field, cop, result.internalField());
 
-    tmp<fieldType> tresult;
+    const PtrList<AMIPatchToPatchInterpolation>& AMIList = patchAMIs();
 
-    if (mesh.name() == srcRegionName_)
+    forAll(AMIList, i)
     {
-        const fvMesh& tgtMesh =
-            mesh.time().lookupObject<fvMesh>(tgtRegionName_);
+        label srcPatchI = srcPatchID_[i];
+        label tgtPatchI = tgtPatchID_[i];
 
-        tresult =
-            new fieldType
-            (
-                IOobject
-                (
-                    type() + "::interpolate(" + field.name() + ")",
-                    tgtMesh.time().timeName(),
-                    tgtMesh,
-                    IOobject::NO_READ,
-                    IOobject::NO_WRITE
-                ),
-                tgtMesh,
-                dimensioned<Type>
-                (
-                    "zero",
-                    field.dimensions(),
-                    pTraits<Type>::zero
-                )
-            );
-
-         interpolate(field, cop, tresult(), interpPatches);
+        Field<Type>& srcField = result.boundaryField()[srcPatchI];
+        const Field<Type>& tgtField = field.boundaryField()[tgtPatchI];
+
+        srcField = pTraits<Type>::zero;
+
+        AMIList[i].interpolateToSource
+        (
+            tgtField,
+            multiplyWeightedOp<Type, CombineOp>(cop),
+            srcField
+        );
     }
-    else if (mesh.name() == tgtRegionName_)
-    {
-        const fvMesh& srcMesh =
-            mesh.time().lookupObject<fvMesh>(srcRegionName_);
+}
+
+
+template<class Type, class CombineOp>
+Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
+Foam::meshToMeshNew::mapTgtToSrc
+(
+    const GeometricField<Type, fvPatchField, volMesh>& field,
+    const CombineOp& cop
+) const
+{
+    typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
 
-        tresult =
-            new fieldType
+    const fvMesh& srcMesh = static_cast<const fvMesh&>(srcRegion_);
+
+    tmp<fieldType> tresult
+    (
+        new fieldType
+        (
+            IOobject
             (
-                IOobject
-                (
-                    type() + "::interpolate(" + field.name() + ")",
-                    srcMesh.time().timeName(),
-                    srcMesh,
-                    IOobject::NO_READ,
-                    IOobject::NO_WRITE
-                ),
+                type() + ".interpolate(" + field.name() + ")",
+                srcMesh.time().timeName(),
                 srcMesh,
-                dimensioned<Type>
-                (
-                    "zero",
-                    field.dimensions(),
-                    pTraits<Type>::zero
-                )
-            );
-
-         interpolate(field, cop, tresult(), interpPatches);
-    }
+                IOobject::NO_READ,
+                IOobject::NO_WRITE
+            ),
+            srcMesh,
+            dimensioned<Type>
+            (
+                "zero",
+                field.dimensions(),
+                pTraits<Type>::zero
+            )
+        )
+    );
+
+    mapTgtToSrc(field, cop, tresult());
 
     return tresult;
 }
@@ -498,44 +511,35 @@ Foam::meshToMeshNew::interpolate
 
 template<class Type, class CombineOp>
 Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
-Foam::meshToMeshNew::interpolate
+Foam::meshToMeshNew::mapTgtToSrc
 (
     const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfield,
-    const CombineOp& cop,
-    const bool interpPatches
+    const CombineOp& cop
 ) const
 {
-    return
-        interpolate
-        (
-            tfield(),
-            combineBinaryOp<Type, CombineOp>(cop),
-            interpPatches
-        );
+    return mapTgtToSrc(tfield(), cop);
 }
 
 
 template<class Type>
 Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
-Foam::meshToMeshNew::interpolate
+Foam::meshToMeshNew::mapTgtToSrc
 (
-    const GeometricField<Type, fvPatchField, volMesh>& field,
-    const bool interpPatches
+    const GeometricField<Type, fvPatchField, volMesh>& field
 ) const
 {
-    return interpolate(field, plusEqOp<Type>(), interpPatches);
+    return mapTgtToSrc(field, plusEqOp<Type>());
 }
 
 
 template<class Type>
 Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
-Foam::meshToMeshNew::interpolate
+Foam::meshToMeshNew::mapTgtToSrc
 (
-    const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfield,
-    const bool interpPatches
+    const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfield
 ) const
 {
-    return interpolate(tfield(), plusEqOp<Type>(), interpPatches);
+    return mapTgtToSrc(tfield(), plusEqOp<Type>());
 }
 
 
diff --git a/src/sampling/probes/patchProbes.H b/src/sampling/probes/patchProbes.H
index 096015f19af006e6e4642314ae1ba110f5095686..972dab79b873e54ad125d4effaeeb85b7f1d0284 100644
--- a/src/sampling/probes/patchProbes.H
+++ b/src/sampling/probes/patchProbes.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -83,7 +83,7 @@ class patchProbes
 
 
         //- Sample and write all the fields of the given type
-        template <class Type>
+        template<class Type>
         void sampleAndWrite(const fieldGroup<Type>&);
 
 
@@ -109,7 +109,7 @@ class patchProbes
 
 
         //- Sample a single field on all sample locations
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > sample(const word& fieldName) const;
 
 
diff --git a/src/sampling/probes/patchProbesTemplates.C b/src/sampling/probes/patchProbesTemplates.C
index 898fdf254c6c2f05f92e28e7fd98d03f636f5a73..8f37e2f07cde46ec8abf4e08cffbfb6decc8d56d 100644
--- a/src/sampling/probes/patchProbesTemplates.C
+++ b/src/sampling/probes/patchProbesTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -78,7 +78,7 @@ void Foam::patchProbes::sampleAndWrite
 }
 
 
-template <class Type>
+template<class Type>
 void Foam::patchProbes::sampleAndWrite
 (
     const fieldGroup<Type>& fields
diff --git a/src/sampling/probes/probes.H b/src/sampling/probes/probes.H
index 85a3928fdcae70f2f149b02e3e2225a7f9cf0b36..80a4037571259f24f62956598cf0b8e5d2ff92d5 100644
--- a/src/sampling/probes/probes.H
+++ b/src/sampling/probes/probes.H
@@ -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
@@ -269,11 +269,11 @@ public:
         ) const;
 
         //- Sample a single vol field on all sample locations
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > sample(const word& fieldName) const;
 
         //- Sample a single scalar field on all sample locations
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > sampleSurfaceFields(const word& fieldName) const;
 
         //- Sample a surface field at all locations
diff --git a/src/sampling/probes/probesTemplates.C b/src/sampling/probes/probesTemplates.C
index 3c03d7dcff60bf8d57f54aad8d57b299b14c4c0b..3a34c1c264f640ff5d5570bbabada9868db502ca 100644
--- a/src/sampling/probes/probesTemplates.C
+++ b/src/sampling/probes/probesTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -111,7 +111,7 @@ void Foam::probes::sampleAndWrite
 }
 
 
-template <class Type>
+template<class Type>
 void Foam::probes::sampleAndWrite(const fieldGroup<Type>& fields)
 {
     forAll(fields, fieldI)
diff --git a/src/sampling/sampledSet/circle/circleSet.C b/src/sampling/sampledSet/circle/circleSet.C
index c77436ab63b8d2fa872e1dd873d438bc9dd4e14e..b94e4962f25b5e8de9a1179eb2dfaebd61e723c7 100644
--- a/src/sampling/sampledSet/circle/circleSet.C
+++ b/src/sampling/sampledSet/circle/circleSet.C
@@ -2,16 +2,16 @@
   =========                 |
   \\      /  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
     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 2 of the License, or (at your
-    option) any later version.
+    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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/sampling/sampledSet/circle/circleSet.H b/src/sampling/sampledSet/circle/circleSet.H
index 05a4c25c2ac5633369736795b0ca596f0af6fe2d..b0e6ed13615234d95977fb22a1609e3665f8aa35 100644
--- a/src/sampling/sampledSet/circle/circleSet.H
+++ b/src/sampling/sampledSet/circle/circleSet.H
@@ -2,16 +2,16 @@
   =========                 |
   \\      /  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
     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 2 of the License, or (at your
-    option) any later version.
+    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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
     Foam::circleSet
diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C
index 803190a4a197337af6907b42681de15a69947eae..44ea1691af47a20f24ad05e298073eb3591f9acd 100644
--- a/src/sampling/sampledSet/sampledSets/sampledSets.C
+++ b/src/sampling/sampledSet/sampledSets/sampledSets.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
@@ -282,10 +282,6 @@ void Foam::sampledSets::correct()
     bool setsFound = dict_.found("sets");
     if (setsFound)
     {
-        // reset interpolation
-        pointMesh::Delete(mesh_);
-        volPointInterpolation::Delete(mesh_);
-
         searchEngine_.correct();
 
         PtrList<sampledSet> newList
diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.H b/src/sampling/sampledSet/sampledSets/sampledSets.H
index 2b4987303d2962f4d9eacc5f55f5c2135147ea92..a2ad2f1418bb438b2cfa305006e60a485733a88f 100644
--- a/src/sampling/sampledSet/sampledSets/sampledSets.H
+++ b/src/sampling/sampledSet/sampledSets/sampledSets.H
@@ -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
@@ -105,7 +105,7 @@ class sampledSets
 
 
         //- Class used for sampling volFields
-        template <class Type>
+        template<class Type>
         class volFieldSampler
         :
             public List<Field<Type> >
diff --git a/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C b/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C
index ab96643d7df0e49899c5a83699dd030f27bcbae9..a646a8c7c3013d522b4b949441f9e67f21b21a46 100644
--- a/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C
+++ b/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -29,7 +29,7 @@ License
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::sampledSets::volFieldSampler<Type>::volFieldSampler
 (
     const word& interpolationScheme,
@@ -76,7 +76,7 @@ Foam::sampledSets::volFieldSampler<Type>::volFieldSampler
 }
 
 
-template <class Type>
+template<class Type>
 Foam::sampledSets::volFieldSampler<Type>::volFieldSampler
 (
     const GeometricField<Type, fvPatchField, volMesh>& field,
@@ -109,7 +109,7 @@ Foam::sampledSets::volFieldSampler<Type>::volFieldSampler
 }
 
 
-template <class Type>
+template<class Type>
 Foam::sampledSets::volFieldSampler<Type>::volFieldSampler
 (
     const List<Field<Type> >& values,
diff --git a/src/sampling/sampledSurface/distanceSurface/distanceSurface.H b/src/sampling/sampledSurface/distanceSurface/distanceSurface.H
index 2b971970872db59f58db19a885ac9d363a0fdd58..da4b8d775e74b323e1f6984b99e4a40c1626b30e 100644
--- a/src/sampling/sampledSurface/distanceSurface/distanceSurface.H
+++ b/src/sampling/sampledSurface/distanceSurface/distanceSurface.H
@@ -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
@@ -104,14 +104,14 @@ class distanceSurface
         void createGeometry();
 
         //- sample field on faces
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > sampleField
         (
             const GeometricField<Type, fvPatchField, volMesh>& vField
         ) const;
 
 
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> >
         interpolateField(const interpolation<Type>&) const;
 
diff --git a/src/sampling/sampledSurface/distanceSurface/distanceSurfaceTemplates.C b/src/sampling/sampledSurface/distanceSurface/distanceSurfaceTemplates.C
index d8871126ea71629c05d62e9a196ca6b7602fdfe8..fb076b86ea1bcea3c1a0d9fae39571c7645ad82f 100644
--- a/src/sampling/sampledSurface/distanceSurface/distanceSurfaceTemplates.C
+++ b/src/sampling/sampledSurface/distanceSurface/distanceSurfaceTemplates.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
@@ -30,7 +30,7 @@ License
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::distanceSurface::sampleField
 (
@@ -54,7 +54,7 @@ Foam::distanceSurface::sampleField
 }
 
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::distanceSurface::interpolateField
 (
diff --git a/src/sampling/sampledSurface/isoSurface/isoSurface.C b/src/sampling/sampledSurface/isoSurface/isoSurface.C
index 7fc707494375e5183bd6df4fa5f60536222e2ebb..63c245e8c87b4fc74d215d79f77daae41da94ef6 100644
--- a/src/sampling/sampledSurface/isoSurface/isoSurface.C
+++ b/src/sampling/sampledSurface/isoSurface/isoSurface.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
@@ -75,18 +75,24 @@ Foam::PackedBoolList Foam::isoSurface::collocatedFaces
     // Initialise to false
     PackedBoolList collocated(pp.size());
 
-    if (isA<processorPolyPatch>(pp) && collocatedPatch(pp))
+    if (isA<processorPolyPatch>(pp))
     {
-        forAll(pp, i)
+        if (collocatedPatch(pp))
         {
-            collocated[i] = 1u;
+            forAll(pp, i)
+            {
+                collocated[i] = 1u;
+            }
         }
     }
-    else if (isA<cyclicPolyPatch>(pp) && collocatedPatch(pp))
+    else if (isA<cyclicPolyPatch>(pp))
     {
-        forAll(pp, i)
+        if (collocatedPatch(pp))
         {
-            collocated[i] = 1u;
+            forAll(pp, i)
+            {
+                collocated[i] = 1u;
+            }
         }
     }
     else
diff --git a/src/sampling/sampledSurface/isoSurface/isoSurface.H b/src/sampling/sampledSurface/isoSurface/isoSurface.H
index 1406ede0e019263c3660f4b2bf98368af90871da..9f6dc7d76e0318abe34e3455c9ffeb9bd0de77b1 100644
--- a/src/sampling/sampledSurface/isoSurface/isoSurface.H
+++ b/src/sampling/sampledSurface/isoSurface/isoSurface.H
@@ -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
@@ -427,7 +427,7 @@ public:
 
         //- Interpolates cCoords,pCoords. Uses the references to the original
         //  fields used to create the iso surface.
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > interpolate
         (
             const GeometricField<Type, fvPatchField, volMesh>& cCoords,
diff --git a/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.H b/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.H
index 8a0b75c1b097aaba6c689336a6b16d6666f527b6..7e12efc7bbead6bdac2d7bc23561734530dfe3ca 100644
--- a/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.H
+++ b/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.H
@@ -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
@@ -357,7 +357,7 @@ public:
 
         //- Interpolates cCoords,pCoords. Takes the original fields
         //  used to create the iso surface.
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > interpolate
         (
             const scalarField& cVals,
@@ -367,7 +367,7 @@ public:
         ) const;
 
         //- Interpolates cCoords,pCoords.
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > interpolate
         (
             const Field<Type>& cCoords,
diff --git a/src/sampling/sampledSurface/isoSurface/isoSurfaceCellTemplates.C b/src/sampling/sampledSurface/isoSurface/isoSurfaceCellTemplates.C
index 8b933f5aab0bac2c78f836a6f7224cfc00c3e680..4a88c3d968ee448aceb8dab32fce37264025ac92 100644
--- a/src/sampling/sampledSurface/isoSurface/isoSurfaceCellTemplates.C
+++ b/src/sampling/sampledSurface/isoSurface/isoSurfaceCellTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -491,7 +491,7 @@ void Foam::isoSurfaceCell::generateTriPoints
 }
 
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::isoSurfaceCell::interpolate
 (
@@ -545,7 +545,7 @@ Foam::isoSurfaceCell::interpolate
 }
 
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::isoSurfaceCell::interpolate
 (
diff --git a/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.C b/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.C
index 5a15bddbf811b62b5f8585397b7fb53c0c88b0d3..6f64c9fe541198ea8524f097b69921702d525264 100644
--- a/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.C
+++ b/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -681,7 +681,7 @@ void Foam::isoSurface::generateTriPoints
 }
 
 
-//template <class Type>
+//template<class Type>
 //Foam::tmp<Foam::Field<Type> >
 //Foam::isoSurface::sample(const Field<Type>& vField) const
 //{
@@ -689,7 +689,7 @@ void Foam::isoSurface::generateTriPoints
 //}
 
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::isoSurface::interpolate
 (
diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H
index cebc201aafdbe66fe6d38013cbc4e75678ba4372..11b7ea025c64160ac50c50dcc91c14411f42bd04 100644
--- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H
+++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -122,14 +122,14 @@ class sampledIsoSurface
         bool updateGeometry() const;
 
         //- sample field on faces
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > sampleField
         (
             const GeometricField<Type, fvPatchField, volMesh>& vField
         ) const;
 
 
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> >
         interpolateField(const interpolation<Type>&) const;
 
diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H
index 6232812975843bd294aa1caa33fc9b1ab1bc443f..ecd6d30e392f563d6e422424fff52298219a2587 100644
--- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H
+++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -91,14 +91,14 @@ class sampledIsoSurfaceCell
         bool updateGeometry() const;
 
         //- sample field on faces
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > sampleField
         (
             const GeometricField<Type, fvPatchField, volMesh>& vField
         ) const;
 
 
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> >
         interpolateField(const interpolation<Type>&) const;
 
diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCellTemplates.C b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCellTemplates.C
index 78ad62954389cd68c9d23da41f221f4e67aa7c44..b0d6eaa6eb02a1c1e03c76c2d0e65ddd0367c794 100644
--- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCellTemplates.C
+++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCellTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -31,7 +31,7 @@ License
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledIsoSurfaceCell::sampleField
 (
@@ -45,7 +45,7 @@ Foam::sampledIsoSurfaceCell::sampleField
 }
 
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledIsoSurfaceCell::interpolateField
 (
diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTemplates.C b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTemplates.C
index c58a665416389e8cd157d424b7b569c1504cae77..513cf2fb5d76202007660c94150acb37f3a8aa96 100644
--- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTemplates.C
+++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -30,7 +30,7 @@ License
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledIsoSurface::sampleField
 (
@@ -44,7 +44,7 @@ Foam::sampledIsoSurface::sampleField
 }
 
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledIsoSurface::interpolateField
 (
diff --git a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H
index e6ba957919c78af64d7cc0a612a687e58eb35d86..ce7182f91c487071325d3240f06981ffe3b856c6 100644
--- a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H
+++ b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -102,14 +102,14 @@ class sampledCuttingPlane
         void createGeometry();
 
         //- sample field on faces
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > sampleField
         (
             const GeometricField<Type, fvPatchField, volMesh>& vField
         ) const;
 
 
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> >
         interpolateField(const interpolation<Type>&) const;
 
diff --git a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlaneTemplates.C b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlaneTemplates.C
index 87950767c021246789c5f552d4f5fabc5fec5111..a188f6ef0f468099b437396d4f5d8ffad2e4e436 100644
--- a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlaneTemplates.C
+++ b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlaneTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -31,7 +31,7 @@ License
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledCuttingPlane::sampleField
 (
@@ -42,7 +42,7 @@ Foam::sampledCuttingPlane::sampleField
 }
 
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledCuttingPlane::interpolateField
 (
diff --git a/src/sampling/sampledSurface/sampledPatch/sampledPatch.H b/src/sampling/sampledSurface/sampledPatch/sampledPatch.H
index 0ec8dbd89fbc77a206ff22c0833d01fc6f382f23..0385f96a633a1345f5ea25b402be875b811adf0f 100644
--- a/src/sampling/sampledSurface/sampledPatch/sampledPatch.H
+++ b/src/sampling/sampledSurface/sampledPatch/sampledPatch.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -81,20 +81,20 @@ class sampledPatch
     // Private Member Functions
 
         //- sample field on faces
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > sampleField
         (
             const GeometricField<Type, fvPatchField, volMesh>& vField
         ) const;
 
         //- sample surface field on faces
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > sampleField
         (
             const GeometricField<Type, fvsPatchField, surfaceMesh>& sField
         ) const;
 
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> >
         interpolateField(const interpolation<Type>&) const;
 
diff --git a/src/sampling/sampledSurface/sampledPatch/sampledPatchTemplates.C b/src/sampling/sampledSurface/sampledPatch/sampledPatchTemplates.C
index 8725f412bea741fd2dbc4252736f50560b1acfff..2ffcb3a010db59786e73ecc5c6d2a6797f0747dd 100644
--- a/src/sampling/sampledSurface/sampledPatch/sampledPatchTemplates.C
+++ b/src/sampling/sampledSurface/sampledPatch/sampledPatchTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledPatch::sampleField
 (
@@ -48,7 +48,7 @@ Foam::sampledPatch::sampleField
 }
 
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledPatch::sampleField
 (
@@ -69,7 +69,7 @@ Foam::sampledPatch::sampleField
 }
 
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledPatch::interpolateField
 (
diff --git a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.H b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.H
index e785c7091ff0c37a9ad9d7ee70f53561993cc06e..f2b3b7c4dc31e493968873b73674b04509641653 100644
--- a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.H
+++ b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -65,13 +65,13 @@ class sampledPatchInternalField
     // Private Member Functions
 
         //- sample field on faces
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > sampleField
         (
             const GeometricField<Type, fvPatchField, volMesh>& vField
         ) const;
 
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > interpolateField(const interpolation<Type>&) const;
 
 public:
diff --git a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalFieldTemplates.C b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalFieldTemplates.C
index 825b154907711f283305cf5d25b0addca5fd9fb4..2d187fa3148768efe1c22e56df6fd88dff933456 100644
--- a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalFieldTemplates.C
+++ b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalFieldTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -29,7 +29,7 @@ License
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledPatchInternalField::sampleField
 (
@@ -64,7 +64,7 @@ Foam::sampledPatchInternalField::sampleField
 }
 
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledPatchInternalField::interpolateField
 (
diff --git a/src/sampling/sampledSurface/sampledPlane/sampledPlane.H b/src/sampling/sampledSurface/sampledPlane/sampledPlane.H
index b555ffdd189cf2f80d0190dab28087c08f84847a..1c6a1b80589129792b26d8ca961335e4a2710315 100644
--- a/src/sampling/sampledSurface/sampledPlane/sampledPlane.H
+++ b/src/sampling/sampledSurface/sampledPlane/sampledPlane.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -66,14 +66,14 @@ class sampledPlane
     // Private Member Functions
 
         //- sample field on faces
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > sampleField
         (
             const GeometricField<Type, fvPatchField, volMesh>& vField
         ) const;
 
 
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> >
         interpolateField(const interpolation<Type>&) const;
 
diff --git a/src/sampling/sampledSurface/sampledPlane/sampledPlaneTemplates.C b/src/sampling/sampledSurface/sampledPlane/sampledPlaneTemplates.C
index e81d3397396db282090853219279fab32219d09b..b5083803766f84facf90be9ad97169003c4cf147 100644
--- a/src/sampling/sampledSurface/sampledPlane/sampledPlaneTemplates.C
+++ b/src/sampling/sampledSurface/sampledPlane/sampledPlaneTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledPlane::sampleField
 (
@@ -38,7 +38,7 @@ Foam::sampledPlane::sampleField
 }
 
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledPlane::interpolateField
 (
diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurface.C b/src/sampling/sampledSurface/sampledSurface/sampledSurface.C
index aaca4f087c8b4c2690b5d98af62aea43568a9703..6d05af02a429b3eb9d0df5e26424917e2f6cb1b4 100644
--- a/src/sampling/sampledSurface/sampledSurface/sampledSurface.C
+++ b/src/sampling/sampledSurface/sampledSurface/sampledSurface.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
@@ -259,6 +259,7 @@ Foam::tmp<Foam::vectorField> Foam::sampledSurface::sample
     return tmp<vectorField>(NULL);
 }
 
+
 Foam::tmp<Foam::sphericalTensorField> Foam::sampledSurface::sample
 (
     const surfaceSphericalTensorField& sField
diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C
index 4a6425105307d82dc35af89b38d70449ffe77c66..34d5bd5b965caf5d835a4cd689af412f92aa27f9 100644
--- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C
+++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.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
diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H
index 5278e850e9d98c28b987bf33c0adf5e56603c0c5..050b2b6e383c1ac2e71789ee48d36055b29d0213 100644
--- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H
+++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H
@@ -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
@@ -89,6 +89,7 @@ class sampledSurfaces
         //- Tolerance for merging points (fraction of mesh bounding box)
         static scalar mergeTol_;
 
+
     // Private data
 
         //- Name of this set of surfaces,
@@ -113,6 +114,7 @@ class sampledSurfaces
             //- Interpolation scheme to use
             word interpolationScheme_;
 
+
         // surfaces
 
             //- Information for merging surfaces
@@ -159,8 +161,7 @@ class sampledSurfaces
         );
 
         //- Sample and write all sampled fields
-        template<class Type>
-        void sampleAndWrite(const IOobjectList&);
+        template<class Type> void sampleAndWrite(const IOobjectList& objects);
 
         //- Disallow default bitwise copy construct and assignment
         sampledSurfaces(const sampledSurfaces&);
@@ -234,7 +235,6 @@ public:
 
         //- Update for changes of mesh due to readUpdate - expires the surfaces
         virtual void readUpdate(const polyMesh::readUpdateState state);
-
 };
 
 
diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C
index 91dad4075214ab9efc1e1b27e6fadfcd2d31a45f..da612afa44d4a5d78ea3019b6889189a3cbdfb0f 100644
--- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C
+++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -166,31 +166,26 @@ void Foam::sampledSurfaces::sampleAndWrite
 
 
 template<class GeoField>
-void Foam::sampledSurfaces::sampleAndWrite(const IOobjectList& allObjects)
+void Foam::sampledSurfaces::sampleAndWrite(const IOobjectList& objects)
 {
-    forAll (fieldSelection_, fieldI)
+    if (loadFromFiles_)
     {
-        const wordRe field = fieldSelection_[fieldI];
-        IOobject* fieldIOPtr = allObjects.lookup(field);
-
-        if
-        (
-            fieldIOPtr != NULL
-         && fieldIOPtr->headerClassName() == GeoField::typeName
-        )
+        IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
+
+        forAll(fieldSelection_, fieldI)
         {
-            if (Pstream::master() && verbose_)
-            {
-                Pout<< "sampleAndWrite: " << field << endl;
-            }
+            const wordRe fieldNameRe = fieldSelection_[fieldI];
+            IOobjectList fieldIO = fieldObjects.lookupRe(fieldNameRe);
 
-            if (loadFromFiles_)
+            forAllConstIter(IOobjectList, fieldIO, iter)
             {
-                const GeoField geoField
+                const word& fieldName = iter()->name();
+
+                const GeoField fld
                 (
                     IOobject
                     (
-                        field,
+                        fieldName,
                         mesh_.time().timeName(),
                         mesh_,
                         IOobject::MUST_READ
@@ -198,13 +193,38 @@ void Foam::sampledSurfaces::sampleAndWrite(const IOobjectList& allObjects)
                     mesh_
                 );
 
-                sampleAndWrite(geoField);
+                if ((Pstream::master()) && verbose_)
+                {
+                    Pout<< "sampleAndWrite: " << fieldName << endl;
+                }
+
+                sampleAndWrite(fld);
             }
-            else
+        }
+    }
+    else
+    {
+        forAll(fieldSelection_, fieldI)
+        {
+            const wordRe& fieldNameRe = fieldSelection_[fieldI];
+
+            const wordList dbFields
+            (
+                mesh_.thisDb().foundObjectRe<GeoField>(fieldNameRe)
+            );
+
+            forAll(dbFields, i)
             {
+                const word& fieldName = dbFields[i];
+
+                if ((Pstream::master()) && verbose_)
+                {
+                    Pout<< "sampleAndWrite: " << fieldName << endl;
+                }
+
                 sampleAndWrite
                 (
-                    mesh_.thisDb().lookupObject<GeoField>(field)
+                    mesh_.thisDb().lookupObject<GeoField>(fieldName)
                 );
             }
         }
diff --git a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H
index 9c8d81d2a109f61f8ef1c8b82af72ab53d0573ed..79272f2dbb22f1ee3681af10277a0a9b56c04127 100644
--- a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H
+++ b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -125,14 +125,14 @@ private:
         const indexedOctree<treeDataFace>& nonCoupledboundaryTree() const;
 
         //- sample field on faces
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > sampleField
         (
             const GeometricField<Type, fvPatchField, volMesh>& vField
         ) const;
 
 
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> >
         interpolateField(const interpolation<Type>&) const;
 
diff --git a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMeshTemplates.C b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMeshTemplates.C
index 5957c36f2d1c47c2a34f0bc6791d00f145585d1d..ca6931ef8745d5c23516627bf8d8504507299bda 100644
--- a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMeshTemplates.C
+++ b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMeshTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,7 +27,7 @@ License
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledTriSurfaceMesh::sampleField
 (
@@ -83,7 +83,7 @@ Foam::sampledTriSurfaceMesh::sampleField
 }
 
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledTriSurfaceMesh::interpolateField
 (
diff --git a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H
index 5cfd076d1edb35782ef39de0ad77ee335d1eed2d..13ef2a3e51f6d20f2f3eda668a76bbff48d2f84d 100644
--- a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H
+++ b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -89,14 +89,14 @@ class sampledThresholdCellFaces
         bool updateGeometry() const;
 
         //- sample field on faces
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> > sampleField
         (
             const GeometricField<Type, fvPatchField, volMesh>& vField
         ) const;
 
 
-        template <class Type>
+        template<class Type>
         tmp<Field<Type> >
         interpolateField(const interpolation<Type>&) const;
 
diff --git a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFacesTemplates.C b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFacesTemplates.C
index 95cfc8e700649f60b255005f6885322d69d25493..ed6b5c3a9f65cb71ecce78584539764027d9e73c 100644
--- a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFacesTemplates.C
+++ b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFacesTemplates.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -32,7 +32,7 @@ License
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledThresholdCellFaces::sampleField
 (
@@ -46,7 +46,7 @@ Foam::sampledThresholdCellFaces::sampleField
 }
 
 
-template <class Type>
+template<class Type>
 Foam::tmp<Foam::Field<Type> >
 Foam::sampledThresholdCellFaces::interpolateField
 (
diff --git a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C
index 86cbb9f5093c675984bfcd25e629ba0812424e49..55fb47b25e0a58840cd360729289540a23eaf8e7 100644
--- a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C
+++ b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.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
@@ -37,7 +37,15 @@ namespace Foam
 
 Foam::SLGThermo::SLGThermo(const fvMesh& mesh, fluidThermo& thermo)
 :
-    MeshObject<fvMesh, SLGThermo>(mesh),
+    regIOobject
+    (
+        IOobject
+        (
+            SLGThermo::typeName,
+            mesh.polyMesh::instance(),
+            mesh
+        )
+    ),
     thermo_(thermo),
     carrier_(NULL),
     liquids_(NULL),
@@ -246,4 +254,3 @@ bool Foam::SLGThermo::hasSolids() const
 
 
 // ************************************************************************* //
-
diff --git a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H
index 22508c38444c24b145c07f1b51a79adfdb891949..e674ad4f325cd4c96deadb434ac482ca5725323c 100644
--- a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H
+++ b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H
@@ -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
@@ -45,7 +45,7 @@ SourceFiles
 #ifndef SLGThermo_H
 #define SLGThermo_H
 
-#include "MeshObject.H"
+#include "regIOobject.H"
 #include "fluidThermo.H"
 #include "basicMultiComponentMixture.H"
 #include "liquidMixtureProperties.H"
@@ -62,7 +62,7 @@ namespace Foam
 
 class SLGThermo
 :
-    public MeshObject<fvMesh, SLGThermo>
+    public regIOobject
 {
     // Private data
 
@@ -145,6 +145,14 @@ public:
 
             //- Thermo database has solid components flag
             bool hasSolids() const;
+
+
+        // IO
+
+            bool writeData(Foam::Ostream&) const
+            {
+                return true;
+            }
 };
 
 
diff --git a/src/thermophysicalModels/basic/Make/files b/src/thermophysicalModels/basic/Make/files
index 5b82c8047663caef5f554a77857d9bb9e6436790..7d10c1c952aa1d0100331a8832804f0decbad48d 100644
--- a/src/thermophysicalModels/basic/Make/files
+++ b/src/thermophysicalModels/basic/Make/files
@@ -14,6 +14,4 @@ derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C
 derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C
 derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C
 
-derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
-
 LIB = $(FOAM_LIBBIN)/libfluidThermophysicalModels
diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C
index e2fc874b5ef6ba930a1c85a745cf2032891c6e86..c3a736df7e611fef0d4ca5beb36bbf923d1e95b6 100644
--- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C
+++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -24,6 +24,14 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "basicThermo.H"
+#include "zeroGradientFvPatchFields.H"
+#include "fixedEnergyFvPatchScalarField.H"
+#include "gradientEnergyFvPatchScalarField.H"
+#include "mixedEnergyFvPatchScalarField.H"
+#include "fixedJumpFvPatchFields.H"
+#include "fixedJumpAMIFvPatchFields.H"
+#include "energyJumpFvPatchScalarField.H"
+#include "energyJumpAMIFvPatchScalarField.H"
 
 
 /* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
@@ -36,6 +44,84 @@ namespace Foam
 
 const Foam::word Foam::basicThermo::dictName("thermophysicalProperties");
 
+
+// * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
+
+Foam::wordList Foam::basicThermo::heBoundaryBaseTypes()
+{
+    const volScalarField::GeometricBoundaryField& tbf =
+        this->T_.boundaryField();
+
+    wordList hbt(tbf.size(), word::null);
+
+    forAll(tbf, patchi)
+    {
+        if (isA<fixedJumpFvPatchScalarField>(tbf[patchi]))
+        {
+            const fixedJumpFvPatchScalarField& pf =
+                dynamic_cast<const fixedJumpFvPatchScalarField&>(tbf[patchi]);
+
+            hbt[patchi] = pf.interfaceFieldType();
+        }
+        else if (isA<fixedJumpAMIFvPatchScalarField>(tbf[patchi]))
+        {
+            const fixedJumpAMIFvPatchScalarField& pf =
+                dynamic_cast<const fixedJumpAMIFvPatchScalarField&>
+                (
+                    tbf[patchi]
+                );
+
+            hbt[patchi] = pf.interfaceFieldType();
+        }
+    }
+
+    return hbt;
+}
+
+
+Foam::wordList Foam::basicThermo::heBoundaryTypes()
+{
+    const volScalarField::GeometricBoundaryField& tbf =
+        this->T_.boundaryField();
+
+    wordList hbt = tbf.types();
+
+    forAll(tbf, patchi)
+    {
+        if (isA<fixedValueFvPatchScalarField>(tbf[patchi]))
+        {
+            hbt[patchi] = fixedEnergyFvPatchScalarField::typeName;
+        }
+        else if
+        (
+            isA<zeroGradientFvPatchScalarField>(tbf[patchi])
+         || isA<fixedGradientFvPatchScalarField>(tbf[patchi])
+        )
+        {
+            hbt[patchi] = gradientEnergyFvPatchScalarField::typeName;
+        }
+        else if (isA<mixedFvPatchScalarField>(tbf[patchi]))
+        {
+            hbt[patchi] = mixedEnergyFvPatchScalarField::typeName;
+        }
+        else if (isA<fixedJumpFvPatchScalarField>(tbf[patchi]))
+        {
+            hbt[patchi] = energyJumpFvPatchScalarField::typeName;
+        }
+        else if (isA<fixedJumpAMIFvPatchScalarField>(tbf[patchi]))
+        {
+            hbt[patchi] = energyJumpAMIFvPatchScalarField::typeName;
+        }
+        else if (tbf[patchi].type() == "energyRegionCoupledFvPatchScalarField")
+        {
+            hbt[patchi] = "energyRegionCoupledFvPatchScalarField";
+        }
+    }
+
+    return hbt;
+}
+
+
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 Foam::volScalarField& Foam::basicThermo::lookupOrConstruct
@@ -395,6 +481,12 @@ const Foam::volScalarField& Foam::basicThermo::T() const
 }
 
 
+Foam::volScalarField& Foam::basicThermo::T()
+{
+    return T_;
+}
+
+
 const Foam::volScalarField& Foam::basicThermo::alpha() const
 {
     return alpha_;
diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H
index e652c30ee6cc3216a0227160a9450e99e5223f78..29ac19aa57b96e2c4c1e1a4e3c8633f04c35e729 100644
--- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H
+++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -77,6 +77,9 @@ protected:
         //- Should the dpdt term be included in the enthalpy equation
         Switch dpdt_;
 
+
+    // Protected Member Functions
+
         //- Construct as copy (not implemented)
         basicThermo(const basicThermo&);
 
@@ -86,6 +89,14 @@ protected:
             const char* name
         ) const;
 
+        //- Return the enthalpy/internal energy field boundary types
+        //  by interrogating the temperature field boundary types
+        wordList heBoundaryTypes();
+
+        //- Return the enthalpy/internal energy field boundary base types
+        //  by interrogating the temperature field boundary types
+        wordList heBoundaryBaseTypes();
+
 
 public:
 
@@ -314,6 +325,10 @@ public:
             //- Temperature [K]
             virtual const volScalarField& T() const;
 
+            //- Temperature [K]
+            //  Non-const access allowed for transport equations
+            virtual volScalarField& T();
+
             //- Heat capacity at constant pressure [J/kg/K]
             virtual tmp<volScalarField> Cp() const = 0;
 
diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.C b/src/thermophysicalModels/basic/heThermo/heThermo.C
index 5f49a4ba752e03e483865019a6f751a273925262..fae178684f225c9db8db54afc233f5b5b632470c 100644
--- a/src/thermophysicalModels/basic/heThermo/heThermo.C
+++ b/src/thermophysicalModels/basic/heThermo/heThermo.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
@@ -24,94 +24,11 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "heThermo.H"
-#include "zeroGradientFvPatchFields.H"
-#include "fixedEnergyFvPatchScalarField.H"
 #include "gradientEnergyFvPatchScalarField.H"
 #include "mixedEnergyFvPatchScalarField.H"
-#include "fixedJumpFvPatchFields.H"
-#include "fixedJumpAMIFvPatchFields.H"
-#include "energyJumpFvPatchScalarField.H"
-#include "energyJumpAMIFvPatchScalarField.H"
 
 // * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
 
-template<class BasicThermo, class MixtureType>
-Foam::wordList Foam::heThermo<BasicThermo, MixtureType>::heBoundaryBaseTypes()
-{
-    const volScalarField::GeometricBoundaryField& tbf =
-        this->T_.boundaryField();
-
-    wordList hbt(tbf.size(), word::null);
-
-    forAll(tbf, patchi)
-    {
-        if (isA<fixedJumpFvPatchScalarField>(tbf[patchi]))
-        {
-            const fixedJumpFvPatchScalarField& pf =
-                dynamic_cast<const fixedJumpFvPatchScalarField&>(tbf[patchi]);
-
-            hbt[patchi] = pf.interfaceFieldType();
-        }
-        else if (isA<fixedJumpAMIFvPatchScalarField>(tbf[patchi]))
-        {
-            const fixedJumpAMIFvPatchScalarField& pf =
-                dynamic_cast<const fixedJumpAMIFvPatchScalarField&>
-                (
-                    tbf[patchi]
-                );
-
-            hbt[patchi] = pf.interfaceFieldType();
-        }
-    }
-
-    return hbt;
-}
-
-
-template<class BasicThermo, class MixtureType>
-Foam::wordList Foam::heThermo<BasicThermo, MixtureType>::heBoundaryTypes()
-{
-    const volScalarField::GeometricBoundaryField& tbf =
-        this->T_.boundaryField();
-
-    wordList hbt = tbf.types();
-
-    forAll(tbf, patchi)
-    {
-        if (isA<fixedValueFvPatchScalarField>(tbf[patchi]))
-        {
-            hbt[patchi] = fixedEnergyFvPatchScalarField::typeName;
-        }
-        else if
-        (
-            isA<zeroGradientFvPatchScalarField>(tbf[patchi])
-         || isA<fixedGradientFvPatchScalarField>(tbf[patchi])
-        )
-        {
-            hbt[patchi] = gradientEnergyFvPatchScalarField::typeName;
-        }
-        else if (isA<mixedFvPatchScalarField>(tbf[patchi]))
-        {
-            hbt[patchi] = mixedEnergyFvPatchScalarField::typeName;
-        }
-        else if (isA<fixedJumpFvPatchScalarField>(tbf[patchi]))
-        {
-            hbt[patchi] = energyJumpFvPatchScalarField::typeName;
-        }
-        else if (isA<fixedJumpAMIFvPatchScalarField>(tbf[patchi]))
-        {
-            hbt[patchi] = energyJumpAMIFvPatchScalarField::typeName;
-        }
-        else if (tbf[patchi].type() == "energyRegionCoupledFvPatchScalarField")
-        {
-            hbt[patchi] = "energyRegionCoupledFvPatchScalarField";
-        }
-    }
-
-    return hbt;
-}
-
-
 template<class BasicThermo, class MixtureType>
 void Foam::heThermo<BasicThermo, MixtureType>::
 heBoundaryCorrection(volScalarField& h)
diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.H b/src/thermophysicalModels/basic/heThermo/heThermo.H
index f77d017e1396afd3840611449829eb89fbc6653a..ce5c732427246900593b85761d80f2418abc83c3 100644
--- a/src/thermophysicalModels/basic/heThermo/heThermo.H
+++ b/src/thermophysicalModels/basic/heThermo/heThermo.H
@@ -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
@@ -64,14 +64,6 @@ protected:
 
         // Enthalpy/Internal energy
 
-            //- Return the enthalpy/internal energy field boundary types
-            //  by interrogating the temperature field boundary types
-            wordList heBoundaryTypes();
-
-            //- Return the enthalpy/internal energy field boundary base types
-            //  by interrogating the temperature field boundary types
-            wordList heBoundaryBaseTypes();
-
             //- Correct the enthalpy/internal energy field boundaries
             void heBoundaryCorrection(volScalarField& he);
 
diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModels.C b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModels.C
index 62e40e215b07b72e1dc4af5168a1d14d7265fc9f..340edb3d1b9ade4fecd850164e8e14e32fd75acf 100644
--- a/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModels.C
+++ b/src/thermophysicalModels/chemistryModel/chemistryModel/psiChemistryModel/psiChemistryModels.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModels.C b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModels.C
index 5ecc84043af7b24e086ddf419da1bd418fc1b85c..c331cd1c7f79e04006baa487cf788d94be241c38 100644
--- a/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModels.C
+++ b/src/thermophysicalModels/chemistryModel/chemistryModel/rhoChemistryModel/rhoChemistryModels.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/makeChemistrySolvers.C b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/makeChemistrySolvers.C
index ed2c8c2ba61b67f098bd8c15f3815115763a63e1..069a782826d8d1a276085d5b1a5b72b4ed9282a8 100644
--- a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/makeChemistrySolvers.C
+++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/makeChemistrySolvers.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/properties/liquidProperties/CH4N2O/CH4N2O.C b/src/thermophysicalModels/properties/liquidProperties/CH4N2O/CH4N2O.C
index f251deeee5c0543a4c0b05ab0b0266bd14774ee8..e011b50d8d248103384a7deda3c8a09899ff1d29 100644
--- a/src/thermophysicalModels/properties/liquidProperties/CH4N2O/CH4N2O.C
+++ b/src/thermophysicalModels/properties/liquidProperties/CH4N2O/CH4N2O.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,8 +21,7 @@ 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 "CH4N2O.H"
 #include "addToRunTimeSelectionTable.H"
diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L
index 678300a172ca945e6da19b0cea0377a753de995e..6db89e7a69e732a957455696770a62f24bfbfc90 100644
--- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L
+++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L
@@ -439,20 +439,25 @@ bool finishReaction = false;
 
 <readThermoSpecieName>{thermoSpecieName} {
         string specieString(foamSpecieString(YYText()));
-        // Old format
-        size_t spacePos = specieString.find(' ');
-        if (spacePos != string::npos)
+        if (newFormat_)
         {
-            currentSpecieName = specieString(0, spacePos);
+            specieString.replaceAll(" ", "_");
+            size_t strEnd = specieString.find_last_not_of('_');
+            currentSpecieName = specieString.substr(0, strEnd + 1);
         }
         else
         {
-            currentSpecieName = specieString;
+            size_t spacePos = specieString.find(' ');
+            if (spacePos != string::npos)
+            {
+                currentSpecieName = specieString(0, spacePos);
+            }
+            else
+            {
+                currentSpecieName = specieString;
+            }
         }
-        // New format
-        // specieString.replaceAll(" ", "_");
-        // size_t strEnd = specieString.find_last_not_of('_');
-        // currentSpecieName = specieString.substr(0, strEnd + 1);
+
         BEGIN(readThermoDate);
     }
 
diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C
index 5ee2a03ac3da93eda3043e7c6ccd96948a99b327..63dd057f3d9f5ea52d3f85b016563e866fec64aa 100644
--- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C
+++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -862,13 +862,15 @@ Foam::chemkinReader::chemkinReader
 (
     const fileName& CHEMKINFileName,
     speciesTable& species,
-    const fileName& thermoFileName
+    const fileName& thermoFileName,
+    const bool newFormat
 )
 :
     lineNo_(1),
     specieNames_(10),
     speciesTable_(species),
-    reactions_(speciesTable_, speciesThermo_)
+    reactions_(speciesTable_, speciesThermo_),
+    newFormat_(newFormat)
 {
     read(CHEMKINFileName, thermoFileName);
 }
@@ -883,8 +885,14 @@ Foam::chemkinReader::chemkinReader
     lineNo_(1),
     specieNames_(10),
     speciesTable_(species),
-    reactions_(speciesTable_, speciesThermo_)
+    reactions_(speciesTable_, speciesThermo_),
+    newFormat_(thermoDict.lookupOrDefault("newFormat", false))
 {
+    if (newFormat_)
+    {
+        Info<< "Reading CHEMKIN thermo data in new file format" << endl;
+    }
+
     fileName chemkinFile(fileName(thermoDict.lookup("CHEMKINFile")).expand());
 
     fileName thermoFile = fileName::null;
diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H
index 4cd84f59a507b93d2aa3fcc5b3f35dfdc213a881..ad1c50abd8589c33190e9f0ffcf9f60d2485ed1f 100644
--- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H
+++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -39,6 +39,7 @@ SourceFiles
 #include "chemistryReader.H"
 #include "fileName.H"
 #include "typeInfo.H"
+#include "Switch.H"
 #include "HashPtrTable.H"
 #include "ReactionList.H"
 #include "DynamicList.H"
@@ -207,6 +208,9 @@ private:
         //- List of the reactions
         ReactionList<gasHThermoPhysics> reactions_;
 
+        //- Flag to indicate that file is in new format
+        Switch newFormat_;
+
 
     // Private Member Functions
 
@@ -319,7 +323,8 @@ public:
         (
             const fileName& chemkinFile,
             speciesTable& species,
-            const fileName& thermoFileName = fileName::null
+            const fileName& thermoFileName = fileName::null,
+            const bool newFormat = false
         );
 
         //- Construct by getting the CHEMKIN III file name from dictionary
diff --git a/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermos.C b/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermos.C
index ed1e0abf8144f27e11ba34b661ae9d9b991fa775..015c0118ed4ba95de8754148b61c27c596a92a01 100644
--- a/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermos.C
+++ b/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermos.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermos.C b/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermos.C
index a6a880ca764bd63d4853a324abbb9adfffd29c8a..27bc73d75f737d5468b34498898f54ee031b3bca 100644
--- a/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermos.C
+++ b/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermos.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/solidChemistryModel/Make/files b/src/thermophysicalModels/solidChemistryModel/Make/files
index 9f2b681e80195e75b51bd32c28a7a3997c039c88..fcef028611e5c17f7e5a6279599130a0d5fd76de 100644
--- a/src/thermophysicalModels/solidChemistryModel/Make/files
+++ b/src/thermophysicalModels/solidChemistryModel/Make/files
@@ -1,7 +1,7 @@
 
-solidChemistryModel/solidChemistryModel.C
-solidChemistryModel/solidChemistryModelNew.C
-solidChemistryModel/solidChemistryModels.C
+basicSolidChemistryModel/basicSolidChemistryModel.C
+basicSolidChemistryModel/basicSolidChemistryModelNew.C
+basicSolidChemistryModel/basicSolidChemistryModels.C
 
 solidChemistrySolver/makeSolidChemistrySolvers.C
 
diff --git a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.C b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.C
new file mode 100644
index 0000000000000000000000000000000000000000..cfff71b9edc4a8393dba6b582ecf546866a3baa8
--- /dev/null
+++ b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.C
@@ -0,0 +1,56 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "basicSolidChemistryModel.H"
+#include "fvMesh.H"
+#include "Time.H"
+
+/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
+
+namespace Foam
+{
+    defineTypeNameAndDebug(basicSolidChemistryModel, 0);
+    defineRunTimeSelectionTable(basicSolidChemistryModel, fvMesh);
+}
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::basicSolidChemistryModel::basicSolidChemistryModel
+(
+    const fvMesh& mesh
+)
+:
+    basicChemistryModel(mesh),
+    solidThermo_(solidReactionThermo::New(mesh))
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::basicSolidChemistryModel::~basicSolidChemistryModel()
+{}
+
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.H b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.H
new file mode 100644
index 0000000000000000000000000000000000000000..2134bffca1a1df8bdfa429f7223f5329c6cf77e8
--- /dev/null
+++ b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.H
@@ -0,0 +1,167 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2013-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/>.
+
+Class
+    Foam::basicSolidChemistryModel
+
+Description
+    Chemistry model for solid thermodynamics
+
+SourceFiles
+    basicSolidChemistryModelI.H
+    basicSolidChemistryModel.C
+    newChemistrySolidModel.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef basicSolidChemistryModel_H
+#define basicSolidChemistryModel_H
+
+#include "basicChemistryModel.H"
+#include "autoPtr.H"
+#include "runTimeSelectionTables.H"
+#include "solidReactionThermo.H"
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward declaration of classes
+class fvMesh;
+
+/*---------------------------------------------------------------------------*\
+                     class basicSolidChemistryModel Declaration
+\*---------------------------------------------------------------------------*/
+
+class basicSolidChemistryModel
+:
+    public basicChemistryModel
+{
+    // Private Member Functions
+
+        //- Construct as copy (not implemented)
+        basicSolidChemistryModel(const basicSolidChemistryModel&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const basicSolidChemistryModel&);
+
+
+protected:
+
+    // Protected data
+
+        //- Solid thermo package
+        autoPtr<solidReactionThermo> solidThermo_;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("basicSolidChemistryModel");
+
+
+    //- Declare run-time constructor selection tables
+    declareRunTimeSelectionTable
+    (
+        autoPtr,
+        basicSolidChemistryModel,
+        fvMesh,
+        (const fvMesh& mesh),
+        (mesh)
+    );
+
+
+    // Constructors
+
+        //- Construct from mesh
+        basicSolidChemistryModel(const fvMesh& mesh);
+
+
+    //- Selector
+    static autoPtr<basicSolidChemistryModel> New(const fvMesh& mesh);
+
+
+    //- Destructor
+    virtual ~basicSolidChemistryModel();
+
+
+    // Member Functions
+
+        //- Return access to the solid thermo package
+        inline solidReactionThermo& solidThermo();
+
+        //- Return const access to the solid thermo package
+        inline const solidReactionThermo& solidThermo() const;
+
+        //- Return total gases mass source term [kg/m3/s]
+        virtual tmp<DimensionedField<scalar, volMesh> > RRg() const = 0;
+
+        //- Return total solids mass source term [kg/m3/s]
+        virtual tmp<DimensionedField<scalar, volMesh> > RRs() const = 0;
+
+        //- Return chemical source terms for solids [kg/m3/s]
+        virtual const DimensionedField<scalar, volMesh>& RRs
+        (
+            const label i
+        ) const = 0;
+
+        //- Return chemical source terms for gases [kg/m3/s]
+        virtual const DimensionedField<scalar, volMesh>& RRg
+        (
+            const label i
+        ) const = 0;
+
+        //- Return sensible enthalpy for gas i [J/Kg]
+        virtual tmp<volScalarField> gasHs
+        (
+            const volScalarField& p,
+            const volScalarField& T,
+            const label i
+        ) const = 0;
+
+        //- Return specie Table for gases
+        virtual const speciesTable& gasTable() const = 0;
+
+        //- Set reacting status of cell, cellI
+        virtual void setCellReacting(const label cellI, const bool active) = 0;
+
+        //- Calculates the reaction rates
+        virtual void calculate() = 0;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "basicSolidChemistryModelI.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelI.H b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelI.H
new file mode 100644
index 0000000000000000000000000000000000000000..48aa40841fb25c617c3fd99af6b522c98462a5da
--- /dev/null
+++ b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelI.H
@@ -0,0 +1,41 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2013-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/>.
+
+\*---------------------------------------------------------------------------*/
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+inline Foam::solidReactionThermo& Foam::basicSolidChemistryModel::solidThermo()
+{
+    return solidThermo_();
+}
+
+
+inline const Foam::solidReactionThermo&
+Foam::basicSolidChemistryModel::solidThermo() const
+{
+    return solidThermo_();
+}
+
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelNew.C b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelNew.C
similarity index 95%
rename from src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelNew.C
rename to src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelNew.C
index ca97c91ace08f757cca74a1afe58c80738c3b271..adf318299f0a6e2243dbc1809c2b36b377e894a1 100644
--- a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelNew.C
+++ b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelNew.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) 2013-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -23,11 +23,12 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "solidChemistryModel.H"
+#include "basicSolidChemistryModel.H"
 
 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
 
-Foam::autoPtr<Foam::solidChemistryModel> Foam::solidChemistryModel::New
+Foam::autoPtr<Foam::basicSolidChemistryModel> Foam::basicSolidChemistryModel::
+New
 (
     const fvMesh& mesh
 )
@@ -160,7 +161,7 @@ Foam::autoPtr<Foam::solidChemistryModel> Foam::solidChemistryModel::New
         FatalError<< exit(FatalError);
     }
 
-    return autoPtr<solidChemistryModel>(cstrIter()(mesh));
+    return autoPtr<basicSolidChemistryModel>(cstrIter()(mesh));
 }
 
 
diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModels.C b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModels.C
similarity index 88%
rename from src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModels.C
rename to src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModels.C
index d51976f196c2c8d74101aabcc844d8f078981463..905f6b17a2b61ac6427c6b676dcf84a52a9ff523 100644
--- a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModels.C
+++ b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModels.C
@@ -22,7 +22,7 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 InClass
-    Foam::solidChemistryModel
+    Foam::basicSolidChemistryModel
 
 Description
     Creates solid chemistry model instances templated on the type of
@@ -32,7 +32,8 @@ Description
 
 #include "makeSolidChemistryModel.H"
 
-#include "ODESolidChemistryModel.H"
+#include "pyrolysisChemistryModel.H"
+#include "basicSolidChemistryModel.H"
 #include "solidChemistryModel.H"
 #include "solidThermoPhysicsTypes.H"
 #include "thermoPhysicsTypes.H"
@@ -43,16 +44,18 @@ namespace Foam
 {
     makeSolidChemistryModel
     (
-        ODESolidChemistryModel,
         solidChemistryModel,
+        pyrolysisChemistryModel,
+        basicSolidChemistryModel,
         hConstSolidThermoPhysics,
         gasHThermoPhysics
     );
 
     makeSolidChemistryModel
     (
-        ODESolidChemistryModel,
         solidChemistryModel,
+        pyrolysisChemistryModel,
+        basicSolidChemistryModel,
         hExponentialSolidThermoPhysics,
         gasHThermoPhysics
     );
diff --git a/src/thermophysicalModels/solidChemistryModel/makeSolidChemistryModel.H b/src/thermophysicalModels/solidChemistryModel/makeSolidChemistryModel.H
index 779418d87b187e0c823d0e9d6ba84bfd2b25794f..510897f541db6c18a6adb5f9f4711027cb195416 100644
--- a/src/thermophysicalModels/solidChemistryModel/makeSolidChemistryModel.H
+++ b/src/thermophysicalModels/solidChemistryModel/makeSolidChemistryModel.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -30,6 +30,7 @@ Description
 #define makeSolidChemistryModel_H
 
 #include "addToRunTimeSelectionTable.H"
+#include "solidChemistryModel.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -38,10 +39,19 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#define makeSolidChemistryModel(SS, Comp, SThermo, GThermo)                   \
+#define makeSolidChemistryModel(sChemistry, SS, Comp, SThermo, GThermo)       \
                                                                               \
     typedef SS<Comp, SThermo, GThermo> SS##Comp##SThermo##GThermo;            \
                                                                               \
+    typedef sChemistry<Comp, SThermo> sChemistryl##Comp##SThermo;             \
+                                                                              \
+    defineTemplateTypeNameAndDebugWithName                                    \
+    (                                                                         \
+        sChemistryl##Comp##SThermo,                                           \
+        (#sChemistry"<"#Comp"," + SThermo::typeName() + ">").c_str(),         \
+        0                                                                     \
+    );                                                                        \
+                                                                              \
     defineTemplateTypeNameAndDebugWithName                                    \
     (                                                                         \
         SS##Comp##SThermo##GThermo,                                           \
diff --git a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.C
similarity index 68%
rename from src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C
rename to src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.C
index f61de4026bd3615833b5b2f8a958c7e935df64ff..e036fc7a1b5bfd878d658be8ead618e5057363a5 100644
--- a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C
+++ b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.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) 2013-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -23,73 +23,33 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "ODESolidChemistryModel.H"
-#include "reactingMixture.H"
+#include "pyrolysisChemistryModel.H"
 #include "solidReaction.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class CompType, class SolidThermo, class GasThermo>
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
-ODESolidChemistryModel
+Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::
+pyrolysisChemistryModel
 (
     const fvMesh& mesh
 )
 :
-    CompType(mesh),
-    ODE(),
-    Ys_(this->solidThermo().composition().Y()),
-    reactions_
-    (
-        dynamic_cast<const reactingMixture<SolidThermo>& >
-        (
-            this->solidThermo()
-        )
-    ),
-    pyrolisisGases_(reactions_[0].gasSpecies()),
-    solidThermo_
-    (
-        dynamic_cast<const reactingMixture<SolidThermo>& >
-        (
-            this->solidThermo()
-        ).speciesData()
-    ),
+    solidChemistryModel<CompType, SolidThermo>(mesh),
+    pyrolisisGases_(this->reactions_[0].gasSpecies()),
     gasThermo_(pyrolisisGases_.size()),
     nGases_(pyrolisisGases_.size()),
-    nSpecie_(Ys_.size() + nGases_),
-    nSolids_(Ys_.size()),
-    nReaction_(reactions_.size()),
-    RRs_(nSolids_),
+    nSpecie_(this->Ys_.size() + nGases_),
     RRg_(nGases_),
-    Ys0_(nSolids_),
-    cellCounter_(0),
-    reactingCells_(mesh.nCells(), true)
+    Ys0_(this->nSolids_),
+    cellCounter_(0)
 {
     // create the fields for the chemistry sources
-    forAll(RRs_, fieldI)
+    forAll(this->RRs_, fieldI)
     {
-        RRs_.set
-        (
-            fieldI,
-            new DimensionedField<scalar, volMesh>
-            (
-                IOobject
-                (
-                    "RRs." + Ys_[fieldI].name(),
-                    mesh.time().timeName(),
-                    mesh,
-                    IOobject::NO_READ,
-                    IOobject::NO_WRITE
-                ),
-                mesh,
-                dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
-            )
-        );
-
-
         IOobject header
         (
-            Ys_[fieldI].name() + "0",
+            this->Ys_[fieldI].name() + "0",
             mesh.time().timeName(),
             mesh,
             IOobject::NO_READ
@@ -105,7 +65,7 @@ ODESolidChemistryModel
                 (
                     IOobject
                     (
-                        Ys_[fieldI].name() + "0",
+                        this->Ys_[fieldI].name() + "0",
                         mesh.time().timeName(),
                         mesh,
                         IOobject::MUST_READ,
@@ -137,7 +97,7 @@ ODESolidChemistryModel
                 (
                     IOobject
                     (
-                        Ys_[fieldI].name() + "0",
+                        this->Ys_[fieldI].name() + "0",
                         mesh.time().timeName(),
                         mesh,
                         IOobject::NO_READ,
@@ -150,9 +110,9 @@ ODESolidChemistryModel
             // Calculate inital values of Ysi0 = rho*delta*Yi
             Ys0_[fieldI].internalField() =
                 this->solidThermo().rho()
-               *max(Ys_[fieldI], scalar(0.001))*mesh.V();
+               *max(this->Ys_[fieldI], scalar(0.001))*mesh.V();
         }
-   }
+    }
 
     forAll(RRg_, fieldI)
     {
@@ -190,23 +150,24 @@ ODESolidChemistryModel
         );
     }
 
-    Info<< "solidChemistryModel: Number of solids = " << nSolids_ << endl;
-
-    Info<< "solidChemistryModel: Number of gases = " << nGases_ << endl;
-
-    forAll(reactions_, i)
+    Info<< "pyrolysisChemistryModel: " << nl;
+    Info<< indent << "Number of solids = " << this->nSolids_ << nl;
+    Info<< indent << "Number of gases = " << nGases_ << nl;
+    forAll(this->reactions_, i)
     {
-        Info<< indent << reactions_[i] << nl;
+        Info<< dynamic_cast<const solidReaction<SolidThermo>& >
+        (
+            this->reactions_[i]
+        ) << nl;
     }
-
 }
 
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
 template<class CompType, class SolidThermo, class GasThermo>
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
-~ODESolidChemistryModel()
+Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::
+~pyrolysisChemistryModel()
 {}
 
 
@@ -214,7 +175,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
 
 template<class CompType, class SolidThermo, class GasThermo>
 Foam::scalarField Foam::
-ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
+pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::omega
 (
     const scalarField& c,
     const scalar T,
@@ -229,9 +190,9 @@ ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
 
     scalarField om(nEqns(), 0.0);
 
-    forAll(reactions_, i)
+    forAll(this->reactions_, i)
     {
-        const Reaction<SolidThermo>& R = reactions_[i];
+        const Reaction<SolidThermo>& R = this->reactions_[i];
 
         scalar omegai = omega
         (
@@ -242,13 +203,13 @@ ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
         {
             label si = R.lhs()[s].index;
             om[si] -= omegai;
-            rhoL = solidThermo_[si].rho(p, T);
+            rhoL = this->solidThermo_[si].rho(p, T);
         }
         scalar sr = 0.0;
         forAll(R.rhs(), s)
         {
             label si = R.rhs()[s].index;
-            scalar rhoR = solidThermo_[si].rho(p, T);
+            scalar rhoR = this->solidThermo_[si].rho(p, T);
             sr = rhoR/rhoL;
             om[si] += sr*omegai;
 
@@ -260,7 +221,7 @@ ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
         forAll(R.grhs(), g)
         {
             label gi = R.grhs()[g].index;
-            om[gi + nSolids_] += (1.0 - sr)*omegai;
+            om[gi + this->nSolids_] += (1.0 - sr)*omegai;
         }
     }
 
@@ -270,7 +231,7 @@ ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
 
 template<class CompType, class SolidThermo, class GasThermo>
 Foam::scalar
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
+Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::omega
 (
     const Reaction<SolidThermo>& R,
     const scalarField& c,
@@ -314,7 +275,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
 
 
 template<class CompType, class SolidThermo, class GasThermo>
-void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
+void Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::
 derivatives
 (
     const scalar time,
@@ -331,19 +292,19 @@ derivatives
 
     //Total mass concentration
     scalar cTot = 0.0;
-    for (label i=0; i<nSolids_; i++)
+    for (label i=0; i<this->nSolids_; i++)
     {
         cTot += c[i];
     }
 
     scalar newCp = 0.0;
     scalar newhi = 0.0;
-    for (label i=0; i<nSolids_; i++)
+    for (label i=0; i<this->nSolids_; i++)
     {
         scalar dYidt = dcdt[i]/cTot;
         scalar Yi = c[i]/cTot;
-        newCp += Yi*solidThermo_[i].Cp(p, T);
-        newhi -= dYidt*solidThermo_[i].Hc();
+        newCp += Yi*this->solidThermo_[i].Cp(p, T);
+        newhi -= dYidt*this->solidThermo_[i].Hc();
     }
 
     scalar dTdt = newhi/newCp;
@@ -356,7 +317,8 @@ derivatives
 
 
 template<class CompType, class SolidThermo, class GasThermo>
-void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::jacobian
+void Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::
+jacobian
 (
     const scalar t,
     const scalarField& c,
@@ -369,7 +331,7 @@ void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::jacobian
 
     scalarField c2(nSpecie_, 0.0);
 
-    for (label i=0; i<nSolids_; i++)
+    for (label i=0; i<this->nSolids_; i++)
     {
         c2[i] = max(c[i], 0.0);
     }
@@ -385,9 +347,9 @@ void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::jacobian
     // length of the first argument must be nSolids
     dcdt = omega(c2, T, p);
 
-    for (label ri=0; ri<reactions_.size(); ri++)
+    for (label ri=0; ri<this->reactions_.size(); ri++)
     {
-        const Reaction<SolidThermo>& R = reactions_[ri];
+        const Reaction<SolidThermo>& R = this->reactions_[ri];
 
         scalar kf0 = R.kf(p, T, c2);
 
@@ -451,96 +413,9 @@ void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::jacobian
 }
 
 
-template<class CompType, class SolidThermo, class GasThermo>
-Foam::tmp<Foam::volScalarField>
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::tc() const
-{
-    notImplemented
-    (
-        "ODESolidChemistryModel::tc()"
-    );
-
-    return volScalarField::null();
-}
-
-
-template<class CompType, class SolidThermo, class GasThermo>
-Foam::tmp<Foam::volScalarField>
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::Sh() const
-{
-    tmp<volScalarField> tSh
-    (
-        new volScalarField
-        (
-            IOobject
-            (
-                "Sh",
-                this->mesh_.time().timeName(),
-                this->mesh_,
-                IOobject::NO_READ,
-                IOobject::AUTO_WRITE,
-                false
-            ),
-            this->mesh_,
-            dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0),
-            zeroGradientFvPatchScalarField::typeName
-        )
-    );
-
-    if (this->chemistry_)
-    {
-        scalarField& Sh = tSh();
-
-        forAll(Ys_, i)
-        {
-            forAll(Sh, cellI)
-            {
-                scalar hf = solidThermo_[i].Hc();
-                Sh[cellI] -= hf*RRs_[i][cellI];
-            }
-        }
-    }
-
-    return tSh;
-}
-
-
-template<class CompType, class SolidThermo, class GasThermo>
-Foam::tmp<Foam::volScalarField>
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::dQ() const
-{
-    tmp<volScalarField> tdQ
-    (
-        new volScalarField
-        (
-            IOobject
-            (
-                "dQ",
-                this->mesh_.time().timeName(),
-                this->mesh_,
-                IOobject::NO_READ,
-                IOobject::NO_WRITE,
-                false
-            ),
-            this->mesh_,
-            dimensionedScalar("dQ", dimEnergy/dimTime, 0.0),
-            zeroGradientFvPatchScalarField::typeName
-        )
-    );
-
-    if (this->chemistry_)
-    {
-        volScalarField& dQ = tdQ();
-        dQ.dimensionedInternalField() = this->mesh_.V()*Sh()();
-    }
-
-    return tdQ;
-}
-
-
 template<class CompType, class SolidThermo, class GasThermo>
 Foam::label Foam::
-ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::nEqns() const
+pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::nEqns() const
 {
     // nEqns = number of solids + gases + temperature + pressure
     return (nSpecie_ + 2);
@@ -548,7 +423,7 @@ ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::nEqns() const
 
 
 template<class CompType, class SolidThermo, class GasThermo>
-void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
+void Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::
 calculate()
 {
     if (!this->chemistry_)
@@ -570,10 +445,11 @@ calculate()
         this->solidThermo().rho()
     );
 
-    forAll(RRs_, i)
+    forAll(this->RRs_, i)
     {
-        RRs_[i].field() = 0.0;
+        this->RRs_[i].field() = 0.0;
     }
+
     forAll(RRg_, i)
     {
         RRg_[i].field() = 0.0;
@@ -585,28 +461,28 @@ calculate()
 
         const scalar delta = this->mesh().V()[celli];
 
-        if (reactingCells_[celli])
+        if (this->reactingCells_[celli])
         {
             scalar rhoi = rho[celli];
             scalar Ti = this->solidThermo().T()[celli];
             scalar pi = this->solidThermo().p()[celli];
 
             scalarField c(nSpecie_, 0.0);
-            for (label i=0; i<nSolids_; i++)
+            for (label i=0; i<this->nSolids_; i++)
             {
-                c[i] = rhoi*Ys_[i][celli]*delta;
+                c[i] = rhoi*this->Ys_[i][celli]*delta;
             }
 
             const scalarField dcdt = omega(c, Ti, pi, true);
 
-            forAll(RRs_, i)
+            forAll(this->RRs_, i)
             {
-                RRs_[i][celli] = dcdt[i]/delta;
+                this->RRs_[i][celli] = dcdt[i]/delta;
             }
 
             forAll(RRg_, i)
             {
-                RRg_[i][celli] = dcdt[nSolids_ + i]/delta;
+                RRg_[i][celli] = dcdt[this->nSolids_ + i]/delta;
             }
         }
     }
@@ -615,7 +491,7 @@ calculate()
 
 template<class CompType, class SolidThermo, class GasThermo>
 Foam::scalar
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
+Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::solve
 (
     const scalar t0,
     const scalar deltaT
@@ -642,9 +518,9 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
         this->solidThermo().rho()
     );
 
-    forAll(RRs_, i)
+    forAll(this->RRs_, i)
     {
-        RRs_[i].field() = 0.0;
+        this->RRs_[i].field() = 0.0;
     }
     forAll(RRg_, i)
     {
@@ -654,7 +530,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
 
     forAll(rho, celli)
     {
-        if (reactingCells_[celli])
+        if (this->reactingCells_[celli])
         {
             cellCounter_ = celli;
 
@@ -668,9 +544,9 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
 
             scalar delta = this->mesh().V()[celli];
 
-            for (label i=0; i<nSolids_; i++)
+            for (label i=0; i<this->nSolids_; i++)
             {
-                c[i] = rhoi*Ys_[i][celli]*delta;
+                c[i] = rhoi*this->Ys_[i][celli]*delta;
             }
 
             c0 = c;
@@ -690,7 +566,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
                 scalar cTot = 0.0;
 
                 //Total mass concentration
-                for (label i=0; i<nSolids_; i++)
+                for (label i=0; i<this->nSolids_; i++)
                 {
                     cTot += c[i];
                 }
@@ -700,13 +576,13 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
                 scalar invRho = 0.0;
                 scalarList dcdt = (c - c0)/dt;
 
-                for (label i=0; i<nSolids_; i++)
+                for (label i=0; i<this->nSolids_; i++)
                 {
                     scalar dYi = dcdt[i]/cTot;
                     scalar Yi = c[i]/cTot;
-                    newCp += Yi*solidThermo_[i].Cp(pi, Ti);
-                    newhi -= dYi*solidThermo_[i].Hc();
-                    invRho += Yi/solidThermo_[i].rho(pi, Ti);
+                    newCp += Yi*this->solidThermo_[i].Cp(pi, Ti);
+                    newhi -= dYi*this->solidThermo_[i].Hc();
+                    invRho += Yi/this->solidThermo_[i].rho(pi, Ti);
                 }
 
                 scalar dTi = (newhi/newCp)*dt;
@@ -722,14 +598,14 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
             deltaTMin = min(tauC, deltaTMin);
             dc = c - c0;
 
-            forAll(RRs_, i)
+            forAll(this->RRs_, i)
             {
-                RRs_[i][celli] = dc[i]/(deltaT*delta);
+                this->RRs_[i][celli] = dc[i]/(deltaT*delta);
             }
 
             forAll(RRg_, i)
             {
-                RRg_[i][celli] = dc[nSolids_ + i]/(deltaT*delta);
+                RRg_[i][celli] = dc[this->nSolids_ + i]/(deltaT*delta);
             }
 
             // Update Ys0_
@@ -746,7 +622,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
 
 template<class CompType, class SolidThermo,class GasThermo>
 Foam::tmp<Foam::volScalarField>
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::gasHs
+Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::gasHs
 (
     const volScalarField& p,
     const volScalarField& T,
@@ -785,9 +661,9 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::gasHs
 }
 
 
-template<class CompType, class SolidThermo,class GasThermo>
+template<class CompType, class SolidThermo, class GasThermo>
 Foam::scalar
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
+Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::solve
 (
     scalarField &c,
     const scalar T,
@@ -798,7 +674,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
 {
     notImplemented
     (
-        "ODESolidChemistryModel::solve"
+        "pyrolysisChemistryModel::solve"
         "("
             "scalarField&, "
             "const scalar, "
@@ -809,14 +685,4 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
     );
     return (0);
 }
-
-
-template<class CompType, class SolidThermo,class GasThermo>
-void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
-setCellReacting(const label cellI, const bool active)
-{
-    reactingCells_[cellI] = active;
-}
-
-
 // ************************************************************************* //
diff --git a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.H b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.H
similarity index 67%
rename from src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.H
rename to src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.H
index 21dc5a5eecfe0b9f7fc7297c5aa08099afe1fe21..6527089c36d127a1cc6027852eaa02a19c7dce94 100644
--- a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.H
+++ b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.H
@@ -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) 2013-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -22,26 +22,24 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
-    Foam::ODESolidChemistryModel
+    Foam::pyrolysisChemistryModel
 
 Description
-    Extends base chemistry model by adding a thermo package, and ODE functions.
-    Introduces chemistry equation system and evaluation of chemical source
-    terms.
+    Pyrolysis chemistry model. It includes gas phase in the solid
+    reaction.
 
 SourceFiles
-    ODESolidChemistryModelI.H
-    ODESolidChemistryModel.C
+    pyrolysisChemistryModelI.H
+    pyrolysisChemistryModel.C
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef ODESolidChemistryModel_H
-#define ODESolidChemistryModel_H
+#ifndef pyrolysisChemistryModel_H
+#define pyrolysisChemistryModel_H
 
-#include "Reaction.H"
-#include "ODE.H"
 #include "volFieldsFwd.H"
 #include "DimensionedField.H"
+#include "solidChemistryModel.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -52,35 +50,25 @@ namespace Foam
 class fvMesh;
 
 /*---------------------------------------------------------------------------*\
-                   Class ODESolidChemistryModel Declaration
+                   Class pyrolysisChemistryModel Declaration
 \*---------------------------------------------------------------------------*/
 
 template<class CompType, class SolidThermo, class GasThermo>
-class ODESolidChemistryModel
+class pyrolysisChemistryModel
 :
-    public CompType,
-    public ODE
+    public solidChemistryModel<CompType, SolidThermo>
 {
     // Private Member Functions
 
         //- Disallow default bitwise assignment
-        void operator=(const ODESolidChemistryModel&);
+        void operator=(const pyrolysisChemistryModel&);
 
 
 protected:
 
-        //- Reference to solid mass fractions
-        PtrList<volScalarField>& Ys_;
-
-        //- Reactions
-        const PtrList<Reaction<SolidThermo> >& reactions_;
-
         //- List of gas species present in reaction system
         speciesTable pyrolisisGases_;
 
-        //- Thermodynamic data of solids
-        const PtrList<SolidThermo>& solidThermo_;
-
         //- Thermodynamic data of gases
         PtrList<GasThermo> gasThermo_;
 
@@ -90,24 +78,12 @@ protected:
         //- Number of components being solved by ODE
         label nSpecie_;
 
-        //- Number of solid components
-        label nSolids_;
-
-        //- Number of solid reactions
-        label nReaction_;
-
-        //- List of reaction rate per solid [kg/m3/s]
-        PtrList<DimensionedField<scalar, volMesh> > RRs_;
-
         //- List of reaction rate per gas [kg/m3/s]
         PtrList<DimensionedField<scalar, volMesh> > RRg_;
 
 
     // Protected Member Functions
 
-        //- Write access to source terms for solids
-        inline PtrList<DimensionedField<scalar, volMesh> >& RRs();
-
         //- Write access to source terms for gases
         inline PtrList<DimensionedField<scalar, volMesh> >& RRg();
 
@@ -120,37 +96,25 @@ private:
         //- Cell counter
         label cellCounter_;
 
-        //- List of active reacting cells
-        List<bool> reactingCells_;
-
-
-        // Private members
-
-            //- Set reacting status of cell, cellI
-            void setCellReacting(const label cellI, const bool active);
-
 
 public:
 
     //- Runtime type information
-    TypeName("ODESolidChemistryModel");
+    TypeName("pyrolysis");
 
 
     // Constructors
 
         //- Construct from mesh
-        ODESolidChemistryModel(const fvMesh& mesh);
+        pyrolysisChemistryModel(const fvMesh& mesh);
 
 
     //- Destructor
-    virtual ~ODESolidChemistryModel();
+    virtual ~pyrolysisChemistryModel();
 
 
     // Member Functions
 
-        //- The reactions
-        inline const PtrList<Reaction<SolidThermo> >& reactions() const;
-
         //- Thermodynamic data of gases
         inline const PtrList<GasThermo>& gasThermo() const;
 
@@ -163,9 +127,6 @@ public:
         //- The number of solids
         inline label nGases() const;
 
-        //- The number of reactions
-        inline label nReaction() const;
-
 
         //- dc/dt = omega, rate of change in concentration, for each species
         virtual scalarField omega
@@ -198,12 +159,6 @@ public:
 
         // Chemistry model functions
 
-            //- Return const access to the chemical source terms for solids
-            inline const DimensionedField<scalar, volMesh>& RRs
-            (
-                const label i
-            ) const;
-
             //- Return const access to the chemical source terms for gases
             inline const DimensionedField<scalar, volMesh>& RRg
             (
@@ -213,15 +168,6 @@ public:
             //- Return total gas source term
             inline tmp<DimensionedField<scalar, volMesh> > RRg() const;
 
-            //- Return total solid source term
-            inline tmp<DimensionedField<scalar, volMesh> > RRs() const;
-
-            //- Return const access to the total source terms
-            inline const DimensionedField<scalar, volMesh>& RR
-            (
-                const label i
-            ) const;
-
             //- Return sensible enthalpy for gas i [J/Kg]
             virtual tmp<volScalarField> gasHs
             (
@@ -232,16 +178,7 @@ public:
 
             //- Solve the reaction system for the given start time and time
             //  step and return the characteristic time
-            virtual scalar solve(const scalar t0, const scalar deltaT);
-
-            //- Return the chemical time scale
-            virtual tmp<volScalarField> tc() const;
-
-            //- Return source for enthalpy equation [kg/m/s3]
-            virtual tmp<volScalarField> Sh() const;
-
-            //- Return the heat release, i.e. enthalpy/sec [m2/s3]
-            virtual tmp<volScalarField> dQ() const;
+            virtual scalar solve(const scalar t0, const scalar deltaT) ;
 
 
         // ODE functions (overriding abstract functions in ODE.H)
@@ -281,12 +218,12 @@ public:
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#   include "ODESolidChemistryModelI.H"
+#   include "pyrolysisChemistryModelI.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 #ifdef NoRepository
-#   include "ODESolidChemistryModel.C"
+#   include "pyrolysisChemistryModel.C"
 #endif
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModelI.H b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModelI.H
similarity index 52%
rename from src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModelI.H
rename to src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModelI.H
index 73a5b03d7dff860ed02cdc4b9eb62e493951b600..b2d8b16e86136de80cf7843476c21ca6198a7f26 100644
--- a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModelI.H
+++ b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModelI.H
@@ -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) 2013-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -24,37 +24,21 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "volFields.H"
-#include "zeroGradientFvPatchFields.H"
 
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-template<class CompType, class SolidThermo, class GasThermo>
-inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs()
-{
-    return RRs_;
-}
 
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class CompType, class SolidThermo, class GasThermo>
 inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg()
+Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::RRg()
 {
     return RRg_;
 }
 
 
-template<class CompType, class SolidThermo, class GasThermo>
-inline const Foam::PtrList<Foam::Reaction<SolidThermo> >&
-Foam::ODESolidChemistryModel<CompType, SolidThermo,GasThermo>::reactions() const
-{
-    return reactions_;
-}
-
-
 template<class CompType, class SolidThermo, class GasThermo>
 inline const Foam::PtrList<GasThermo>&
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
+Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::
 gasThermo() const
 {
     return gasThermo_;
@@ -63,7 +47,8 @@ gasThermo() const
 
 template<class CompType, class SolidThermo, class GasThermo>
 inline const Foam::speciesTable&
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::gasTable() const
+Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::
+gasTable() const
 {
     return pyrolisisGases_;
 }
@@ -71,35 +56,16 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::gasTable() const
 
 template<class CompType, class SolidThermo, class GasThermo>
 inline Foam::label
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::nSpecie() const
+Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::
+nSpecie() const
 {
     return nSpecie_;
 }
 
 
-template<class CompType, class SolidThermo, class GasThermo>
-inline Foam::label
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
-nReaction() const
-{
-    return nReaction_;
-}
-
-
-template<class CompType, class SolidThermo, class GasThermo>
-inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs
-(
-    const label i
-) const
-{
-    return RRs_[i];
-}
-
-
 template<class CompType, class SolidThermo, class GasThermo>
 inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg
+Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::RRg
 (
     const label i
 ) const
@@ -110,7 +76,8 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg
 
 template<class CompType, class SolidThermo, class GasThermo>
 inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg() const
+Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::
+RRg() const
 {
     tmp<DimensionedField<scalar, volMesh> > tRRg
     (
@@ -139,51 +106,4 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg() const
     }
     return tRRg;
 }
-
-
-template<class CompType, class SolidThermo, class GasThermo>
-inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs() const
-{
-    tmp<DimensionedField<scalar, volMesh> > tRRs
-    (
-        new DimensionedField<scalar, volMesh>
-        (
-            IOobject
-            (
-                "RRs",
-                this->time().timeName(),
-                this->mesh(),
-                IOobject::NO_READ,
-                IOobject::NO_WRITE
-            ),
-            this->mesh(),
-            dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
-        )
-    );
-
-    if (this->chemistry_)
-    {
-        DimensionedField<scalar, volMesh>& RRs = tRRs();
-        for (label i=0; i < nSolids_; i++)
-        {
-            RRs += RRs_[i];
-        }
-    }
-    return tRRs;
-}
-
-
-template<class CompType, class SolidThermo, class GasThermo>
-inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
-Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RR
-(
-    const label i
-) const
-{
-    notImplemented("ODESolidChemistryModel::RR(const label)");
-    return (DimensionedField<scalar, volMesh>::null());
-}
-
-
 // ************************************************************************* //
diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.C b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.C
index fc5a7ced8c5fa0637f850a2cd89ce9b53c42ecef..6743b6507a8ca62c2c7583c6cce456ca482ae320 100644
--- a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.C
+++ b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -24,33 +24,193 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "solidChemistryModel.H"
-#include "fvMesh.H"
-#include "Time.H"
-
-/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
-
-namespace Foam
-{
-    defineTypeNameAndDebug(solidChemistryModel, 0);
-    defineRunTimeSelectionTable(solidChemistryModel, fvMesh);
-}
+#include "reactingMixture.H"
+#include "zeroGradientFvPatchFields.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::solidChemistryModel::solidChemistryModel
+template<class CompType, class SolidThermo>
+Foam::solidChemistryModel<CompType, SolidThermo>::
+solidChemistryModel
 (
     const fvMesh& mesh
 )
 :
-    basicChemistryModel(mesh),
-    solidThermo_(solidReactionThermo::New(mesh))
-{}
+    CompType(mesh),
+    ODE(),
+    Ys_(this->solidThermo().composition().Y()),
+    reactions_
+    (
+        dynamic_cast<const reactingMixture<SolidThermo>& >
+        (
+            this->solidThermo()
+        )
+    ),
+    solidThermo_
+    (
+        dynamic_cast<const reactingMixture<SolidThermo>& >
+        (
+            this->solidThermo()
+        ).speciesData()
+    ),
+    nSolids_(Ys_.size()),
+    nReaction_(reactions_.size()),
+    RRs_(nSolids_),
+    reactingCells_(mesh.nCells(), true)
+{
+    // create the fields for the chemistry sources
+    forAll(RRs_, fieldI)
+    {
+        RRs_.set
+        (
+            fieldI,
+            new DimensionedField<scalar, volMesh>
+            (
+                IOobject
+                (
+                    "RRs." + Ys_[fieldI].name(),
+                    mesh.time().timeName(),
+                    mesh,
+                    IOobject::NO_READ,
+                    IOobject::NO_WRITE
+                ),
+                mesh,
+                dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
+            )
+        );
+   }
+}
 
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-Foam::solidChemistryModel::~solidChemistryModel()
+template<class CompType, class SolidThermo>
+Foam::solidChemistryModel<CompType, SolidThermo>::
+~solidChemistryModel()
 {}
 
 
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+template<class CompType, class SolidThermo>
+Foam::tmp<Foam::volScalarField>
+Foam::solidChemistryModel<CompType, SolidThermo>::tc() const
+{
+    notImplemented
+    (
+        "solidChemistryModel::tc()"
+    );
+    return volScalarField::null();
+}
+
+
+template<class CompType, class SolidThermo>
+Foam::tmp<Foam::volScalarField>
+Foam::solidChemistryModel<CompType, SolidThermo>::Sh() const
+{
+    tmp<volScalarField> tSh
+    (
+        new volScalarField
+        (
+            IOobject
+            (
+                "Sh",
+                this->mesh_.time().timeName(),
+                this->mesh_,
+                IOobject::NO_READ,
+                IOobject::AUTO_WRITE,
+                false
+            ),
+            this->mesh_,
+            dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0),
+            zeroGradientFvPatchScalarField::typeName
+        )
+    );
+
+    if (this->chemistry_)
+    {
+        scalarField& Sh = tSh();
+
+        forAll(Ys_, i)
+        {
+            forAll(Sh, cellI)
+            {
+                scalar hf = solidThermo_[i].Hc();
+                Sh[cellI] -= hf*RRs_[i][cellI];
+            }
+        }
+    }
+
+    return tSh;
+}
+
+
+template<class CompType, class SolidThermo>
+Foam::tmp<Foam::volScalarField>
+Foam::solidChemistryModel<CompType, SolidThermo>::dQ() const
+{
+    tmp<volScalarField> tdQ
+    (
+        new volScalarField
+        (
+            IOobject
+            (
+                "dQ",
+                this->mesh_.time().timeName(),
+                this->mesh_,
+                IOobject::NO_READ,
+                IOobject::NO_WRITE,
+                false
+            ),
+            this->mesh_,
+            dimensionedScalar("dQ", dimEnergy/dimTime, 0.0),
+            zeroGradientFvPatchScalarField::typeName
+        )
+    );
+
+    if (this->chemistry_)
+    {
+        volScalarField& dQ = tdQ();
+        dQ.dimensionedInternalField() = this->mesh_.V()*Sh()();
+    }
+
+    return tdQ;
+}
+
+
+template<class CompType, class SolidThermo>
+Foam::scalar Foam::solidChemistryModel<CompType, SolidThermo>::solve
+(
+    scalarField &c,
+    const scalar T,
+    const scalar p,
+    const scalar t0,
+    const scalar dt
+) const
+{
+    notImplemented
+    (
+        "solidChemistryModel::solve"
+        "("
+            "scalarField&, "
+            "const scalar, "
+            "const scalar, "
+            "const scalar, "
+            "const scalar"
+        ") const"
+    );
+    return (0);
+}
+
+
+template<class CompType, class SolidThermo>
+void Foam::solidChemistryModel<CompType, SolidThermo>::setCellReacting
+(
+    const label cellI,
+    const bool active
+)
+{
+    reactingCells_[cellI] = active;
+}
+
 // ************************************************************************* //
diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.H b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.H
index 1cc883c298a1f4b82e72007755e7890cd8fdf3cf..6f7dbe48cedcf57d2b3f952955161d08501f5999 100644
--- a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.H
+++ b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.H
@@ -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
@@ -25,23 +25,24 @@ Class
     Foam::solidChemistryModel
 
 Description
-    Chemistry model for solid thermodynamics
+    Extends base solid chemistry model by adding a thermo package, and ODE
+    functions.
+    Introduces chemistry equation system and evaluation of chemical source
+    terms.
 
 SourceFiles
     solidChemistryModelI.H
     solidChemistryModel.C
-    newChemistrySolidModel.C
 
 \*---------------------------------------------------------------------------*/
 
 #ifndef solidChemistryModel_H
 #define solidChemistryModel_H
 
-#include "basicChemistryModel.H"
-#include "autoPtr.H"
-#include "runTimeSelectionTables.H"
-#include "solidReactionThermo.H"
-
+#include "Reaction.H"
+#include "ODE.H"
+#include "volFieldsFwd.H"
+#include "DimensionedField.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -52,45 +53,57 @@ namespace Foam
 class fvMesh;
 
 /*---------------------------------------------------------------------------*\
-                     class solidChemistryModel Declaration
+                   Class solidChemistryModel Declaration
 \*---------------------------------------------------------------------------*/
 
+template<class CompType, class SolidThermo>
 class solidChemistryModel
 :
-    public basicChemistryModel
+    public CompType,
+    public ODE
 {
     // Private Member Functions
 
-        //- Construct as copy (not implemented)
-        solidChemistryModel(const solidChemistryModel&);
-
         //- Disallow default bitwise assignment
         void operator=(const solidChemistryModel&);
 
 
 protected:
 
-    // Protected data
+        //- Reference to solid mass fractions
+        PtrList<volScalarField>& Ys_;
 
-        //- Solid thermo package
-        autoPtr<solidReactionThermo> solidThermo_;
+        //- Reactions
+        const PtrList<Reaction<SolidThermo> >& reactions_;
 
+        //- Thermodynamic data of solids
+        const PtrList<SolidThermo>& solidThermo_;
 
-public:
+        //- Number of solid components
+        label nSolids_;
 
-    //- Runtime type information
-    TypeName("solid");
+        //- Number of solid reactions
+        label nReaction_;
+
+        //- List of reaction rate per solid [kg/m3/s]
+        PtrList<DimensionedField<scalar, volMesh> > RRs_;
+
+        //- List of active reacting cells
+        List<bool> reactingCells_;
+
+    // Protected Member Functions
+
+        //- Write access to source terms for solids
+        inline PtrList<DimensionedField<scalar, volMesh> >& RRs();
+
+        //- Set reacting status of cell, cellI
+        void setCellReacting(const label cellI, const bool active);
 
 
-    //- Declare run-time constructor selection tables
-    declareRunTimeSelectionTable
-    (
-        autoPtr,
-        solidChemistryModel,
-        fvMesh,
-        (const fvMesh& mesh),
-        (mesh)
-    );
+public:
+
+    //- Runtime type information
+    TypeName("solidChemistryModel");
 
 
     // Constructors
@@ -99,56 +112,108 @@ public:
         solidChemistryModel(const fvMesh& mesh);
 
 
-    //- Selector
-    static autoPtr<solidChemistryModel> New(const fvMesh& mesh);
-
-
     //- Destructor
     virtual ~solidChemistryModel();
 
 
     // Member Functions
 
-        //- Return access to the solid thermo package
-        inline solidReactionThermo& solidThermo();
+        //- The reactions
+        inline const PtrList<Reaction<SolidThermo> >& reactions() const;
 
-        //- Return const access to the solid thermo package
-        inline const solidReactionThermo& solidThermo() const;
+        //- The number of reactions
+        inline label nReaction() const;
 
-        //- Return total gases mass source term [kg/m3/s]
-        virtual tmp<DimensionedField<scalar, volMesh> > RRg() const = 0;
 
-        //- Return total solids mass source term [kg/m3/s]
-        virtual tmp<DimensionedField<scalar, volMesh> > RRs() const = 0;
-
-        //- Return chemical source terms for solids [kg/m3/s]
-        virtual const DimensionedField<scalar, volMesh>& RRs
+        //- dc/dt = omega, rate of change in concentration, for each species
+        virtual scalarField omega
         (
-            const label i
+            const scalarField& c,
+            const scalar T,
+            const scalar p,
+            const bool updateC0 = false
         ) const = 0;
 
-        //- Return chemical source terms for gases [kg/m3/s]
-        virtual const DimensionedField<scalar, volMesh>& RRg
+        //- Return the reaction rate for reaction r and the reference
+        //  species and charateristic times
+        virtual scalar omega
         (
-            const label i
+            const Reaction<SolidThermo>& r,
+            const scalarField& c,
+            const scalar T,
+            const scalar p,
+            scalar& pf,
+            scalar& cf,
+            label& lRef,
+            scalar& pr,
+            scalar& cr,
+            label& rRef
         ) const = 0;
 
-        //- Return sensible enthalpy for gas i [J/Kg]
-        virtual tmp<volScalarField> gasHs
-        (
-            const volScalarField& p,
-            const volScalarField& T,
-            const label i
-        ) const = 0;
+        //- Calculates the reaction rates
+        virtual void calculate() = 0;
 
-        //- Return specie Table for gases
-        virtual const speciesTable& gasTable() const = 0;
 
-        //- Set reacting status of cell, cellI
-        virtual void setCellReacting(const label cellI, const bool active) = 0;
+        // Chemistry model functions
 
-        //- Calculates the reaction rates
-        virtual void calculate() = 0;
+            //- Return const access to the chemical source terms for solids
+            inline const DimensionedField<scalar, volMesh>& RRs
+            (
+                const label i
+            ) const;
+
+            //- Return total solid source term
+            inline tmp<DimensionedField<scalar, volMesh> > RRs() const;
+
+            //- Return const access to the total source terms
+            inline const DimensionedField<scalar, volMesh>& RR
+            (
+                const label i
+            ) const;
+
+
+            //- Solve the reaction system for the given start time and time
+            //  step and return the characteristic time
+            virtual scalar solve(const scalar t0, const scalar deltaT) = 0;
+
+            //- Return the chemical time scale
+            virtual tmp<volScalarField> tc() const;
+
+            //- Return source for enthalpy equation [kg/m/s3]
+            virtual tmp<volScalarField> Sh() const;
+
+            //- Return the heat release, i.e. enthalpy/sec [m2/s3]
+            virtual tmp<volScalarField> dQ() const;
+
+
+        // ODE functions (overriding abstract functions in ODE.H)
+
+            //- Number of ODE's to solve
+            virtual label nEqns() const = 0;
+
+            virtual void derivatives
+            (
+                const scalar t,
+                const scalarField& c,
+                scalarField& dcdt
+            ) const = 0;
+
+            virtual void jacobian
+            (
+                const scalar t,
+                const scalarField& c,
+                scalarField& dcdt,
+                scalarSquareMatrix& dfdc
+            ) const = 0;
+
+            virtual scalar solve
+            (
+                scalarField &c,
+                const scalar T,
+                const scalar p,
+                const scalar t0,
+                const scalar dt
+            ) const = 0;
 };
 
 
@@ -158,7 +223,13 @@ public:
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#include "solidChemistryModelI.H"
+#   include "solidChemistryModelI.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+#   include "solidChemistryModel.C"
+#endif
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelI.H b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelI.H
index 240f9c71180b28dcc56bb2f9fbd49836f4628d75..92b461e11ea93273757627dab8ed36a55a990cf7 100644
--- a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelI.H
+++ b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelI.H
@@ -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
@@ -23,18 +23,87 @@ License
 
 \*---------------------------------------------------------------------------*/
 
+#include "volFields.H"
+
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-inline Foam::solidReactionThermo& Foam::solidChemistryModel::solidThermo()
+template<class CompType, class SolidThermo>
+inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
+Foam::solidChemistryModel<CompType, SolidThermo>::RRs()
 {
-    return solidThermo_();
+    return RRs_;
+}
+
+template<class CompType, class SolidThermo>
+inline const Foam::PtrList<Foam::Reaction<SolidThermo> >&
+Foam::solidChemistryModel<CompType, SolidThermo>::reactions() const
+{
+    return reactions_;
+}
+
+
+template<class CompType, class SolidThermo>
+inline Foam::label
+Foam::solidChemistryModel<CompType, SolidThermo>::
+nReaction() const
+{
+    return nReaction_;
+}
+
+
+template<class CompType, class SolidThermo>
+inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
+Foam::solidChemistryModel<CompType, SolidThermo>::RRs
+(
+    const label i
+) const
+{
+    return RRs_[i];
+}
+
+
+template<class CompType, class SolidThermo>
+inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
+Foam::solidChemistryModel<CompType, SolidThermo>::RRs() const
+{
+    tmp<DimensionedField<scalar, volMesh> > tRRs
+    (
+        new DimensionedField<scalar, volMesh>
+        (
+            IOobject
+            (
+                "RRs",
+                this->time().timeName(),
+                this->mesh(),
+                IOobject::NO_READ,
+                IOobject::NO_WRITE
+            ),
+            this->mesh(),
+            dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
+        )
+    );
+
+    if (this->chemistry_)
+    {
+        DimensionedField<scalar, volMesh>& RRs = tRRs();
+        for (label i=0; i < nSolids_; i++)
+        {
+            RRs += RRs_[i];
+        }
+    }
+    return tRRs;
 }
 
 
-inline const Foam::solidReactionThermo&
-Foam::solidChemistryModel::solidThermo() const
+template<class CompType, class SolidThermo>
+inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
+Foam::solidChemistryModel<CompType, SolidThermo>::RR
+(
+    const label i
+) const
 {
-    return solidThermo_();
+    notImplemented("solidChemistryModel::RR(const label)");
+    return (DimensionedField<scalar, volMesh>::null());
 }
 
 
diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolverType.H b/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolverType.H
index e891cba45b1a4ec2c787ea4430894d52d4d45c4a..3f24e11e4a9cb4f8622dfb687c1e6eee6a50d840 100644
--- a/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolverType.H
+++ b/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolverType.H
@@ -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
@@ -39,23 +39,23 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#define makeSolidChemistrySolverType(SS, Comp, SThermo, GThermo)              \
+#define makeSolidChemistrySolverType(SS, Schem, Comp, SThermo, GThermo)       \
                                                                               \
-    typedef SS<ODESolidChemistryModel<Comp, SThermo, GThermo> >               \
-        SS##Comp##SThermo##GThermo;                                           \
+    typedef SS<Schem<Comp, SThermo, GThermo> >                                \
+        SS##Schem##Comp##SThermo##GThermo;                                    \
                                                                               \
     defineTemplateTypeNameAndDebugWithName                                    \
     (                                                                         \
-        SS##Comp##SThermo##GThermo,                                           \
-        (#SS"<" + word(Comp::typeName_())                                     \
-      + "," + SThermo::typeName() + "," + GThermo::typeName() + ">").c_str(), \
+        SS##Schem##Comp##SThermo##GThermo,                                    \
+        (#SS"<"#Schem"<"#Comp"," + SThermo::typeName() + ","                  \
+      + GThermo::typeName() + ">>").c_str(),                                  \
         0                                                                     \
     );                                                                        \
                                                                               \
     addToRunTimeSelectionTable                                                \
     (                                                                         \
         Comp,                                                                 \
-        SS##Comp##SThermo##GThermo,                                           \
+        SS##Schem##Comp##SThermo##GThermo,                                    \
         fvMesh                                                                \
     );
 
diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolvers.C b/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolvers.C
index 3b6f13f486398a810b1c9bff714b95d5b095ef72..1d16cb506c05cca3e0462e60a1229cb882a6d5e7 100644
--- a/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolvers.C
+++ b/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolvers.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,8 +27,8 @@ License
 #include "solidThermoPhysicsTypes.H"
 #include "thermoPhysicsTypes.H"
 
-#include "ODESolidChemistryModel.H"
-#include "solidChemistryModel.H"
+#include "pyrolysisChemistryModel.H"
+#include "basicSolidChemistryModel.H"
 
 #include "ode.H"
 
@@ -39,7 +39,8 @@ namespace Foam
     makeSolidChemistrySolverType
     (
         ode,
-        solidChemistryModel,
+        pyrolysisChemistryModel,
+        basicSolidChemistryModel,
         hConstSolidThermoPhysics,
         gasHThermoPhysics
     )
@@ -47,7 +48,8 @@ namespace Foam
     makeSolidChemistrySolverType
     (
         ode,
-        solidChemistryModel,
+        pyrolysisChemistryModel,
+        basicSolidChemistryModel,
         hExponentialSolidThermoPhysics,
         gasHThermoPhysics
     )
diff --git a/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.C b/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.C
index 99bb98acb4f82e8acb3c72b0ef2a591a90f733ff..f16d0293526b3a861bb2fb659656c15f6288d875 100644
--- a/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.C
+++ b/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.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
@@ -150,12 +150,18 @@ Foam::string Foam::solidReaction<ReactionThermo>::solidReactionStr
 ) const
 {
     this->reactionStrLeft(reaction);
-    reaction << " + ";
-    solidReactionStrLeft(reaction);
+    if (glhs().size() > 0)
+    {
+        reaction << " + ";
+        solidReactionStrLeft(reaction);
+    }
     reaction << " = ";
     this->reactionStrRight(reaction);
-    reaction << " + ";
-    solidReactionStrRight(reaction);
+    if (grhs().size() > 0)
+    {
+        reaction << " + ";
+        solidReactionStrRight(reaction);
+    }
     return reaction.str();
 
 }
@@ -169,8 +175,6 @@ void Foam::solidReaction<ReactionThermo>::solidReactionStrLeft
 {
     for (label i = 0; i < glhs().size(); ++i)
     {
-        reaction << " + ";
-
         if (i > 0)
         {
             reaction << " + ";
@@ -197,8 +201,6 @@ void Foam::solidReaction<ReactionThermo>::solidReactionStrRight
 
     for (label i = 0; i < grhs().size(); ++i)
     {
-        reaction << " + ";
-
         if (i > 0)
         {
             reaction << " + ";
diff --git a/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransport.H b/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransport.H
index 718f648143354953ad3b02ed04e8b19548e42b06..31af54fe5406b476017f039878e0afd086335ce3 100644
--- a/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransport.H
+++ b/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransport.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.H b/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.H
index fc9cb4438a5d999d22bd58777a512a27f533d75a..d9c47ec44455989d3be7da9e13f2c871f964abdc 100644
--- a/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.H
+++ b/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransport.H b/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransport.H
index 3592626d8045b8846d58a092bde25a53ab74750d..1ea9ffdcac91bb10be54991e00099b741dce293e 100644
--- a/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransport.H
+++ b/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransport.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H
index 146656d69e97a30e7dbebf5a4eb1a86a9b64ff38..a964b3fe53dac4f92c0f52ab61f53b40c5b493a1 100644
--- a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H
+++ b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H
index 774a94308a4a5f45ccf2cc9dc344afdb37f6dee3..85000a3c108f822a722ad1c3553710380981d341 100644
--- a/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H
+++ b/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -82,6 +82,13 @@ defineTemplateTypeNameAndDebugWithName                                        \
                                                                               \
                                                                               \
 addToRunTimeSelectionTable                                                    \
+(                                                                             \
+    basicThermo,                                                              \
+    Cthermo##Mixture##Transport##Type##Thermo##EqnOfState##Specie,            \
+    fvMesh                                                                    \
+);                                                                            \
+                                                                              \
+addToRunTimeSelectionTable                                                    \
 (                                                                             \
     BaseThermo,                                                               \
     Cthermo##Mixture##Transport##Type##Thermo##EqnOfState##Specie,            \
diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H
index 04934ca950cf559da6bdf6fdbb9fc35245fb7e23..e14fba7c8277aae5a79bd803d5cafa66012cc7ab 100644
--- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H
+++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -81,7 +81,7 @@ public:
         (mesh, phaseName)
     );
 
-     // Declare run-time constructor selection tables
+    // Declare run-time constructor selection tables
     declareRunTimeSelectionTable
     (
         autoPtr,
diff --git a/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.C b/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.C
new file mode 100644
index 0000000000000000000000000000000000000000..5d35425ccce01b1c0fdf7af3ceab64902fe78ef3
--- /dev/null
+++ b/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.C
@@ -0,0 +1,102 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "adiabaticPerfectFluid.H"
+#include "IOstreams.H"
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+template<class Specie>
+Foam::adiabaticPerfectFluid<Specie>::adiabaticPerfectFluid(Istream& is)
+:
+    Specie(is),
+    p0_(readScalar(is)),
+    rho0_(readScalar(is)),
+    gamma_(readScalar(is)),
+    B_(readScalar(is))
+{
+    is.check
+    (
+        "adiabaticPerfectFluid<Specie>::adiabaticPerfectFluid(Istream& is)"
+    );
+}
+
+
+template<class Specie>
+Foam::adiabaticPerfectFluid<Specie>::adiabaticPerfectFluid
+(
+    const dictionary& dict
+)
+:
+    Specie(dict),
+    p0_(readScalar(dict.subDict("equationOfState").lookup("p0"))),
+    rho0_(readScalar(dict.subDict("equationOfState").lookup("rho0"))),
+    gamma_(readScalar(dict.subDict("equationOfState").lookup("gamma"))),
+    B_(readScalar(dict.subDict("equationOfState").lookup("B")))
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+template<class Specie>
+void Foam::adiabaticPerfectFluid<Specie>::write(Ostream& os) const
+{
+    Specie::write(os);
+
+    dictionary dict("equationOfState");
+    dict.add("p0", p0_);
+    dict.add("rho0", rho0_);
+    dict.add("gamma", gamma_);
+    dict.add("B", B_);
+
+    os  << indent << dict.dictName() << dict;
+}
+
+
+// * * * * * * * * * * * * * * * Ostream Operator  * * * * * * * * * * * * * //
+
+template<class Specie>
+Foam::Ostream& Foam::operator<<
+(
+    Ostream& os,
+    const adiabaticPerfectFluid<Specie>& pf
+)
+{
+    os  << static_cast<const Specie&>(pf)
+        << token::SPACE << pf.R_
+        << token::SPACE << pf.rho0_
+        << token::SPACE << pf.gamma_
+        << token::SPACE << pf.B_;
+
+    os.check
+    (
+        "Ostream& operator<<(Ostream&, const adiabaticPerfectFluid<Specie>&)"
+    );
+
+    return os;
+}
+
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.H b/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.H
new file mode 100644
index 0000000000000000000000000000000000000000..6ebd728fa8c27ea2c00eb3fb73183eced2e3599d
--- /dev/null
+++ b/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluid.H
@@ -0,0 +1,247 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+Class
+    Foam::adiabaticPerfectFluid
+
+Description
+    AdiabaticPerfect gas equation of state.
+
+SourceFiles
+    adiabaticPerfectFluidI.H
+    adiabaticPerfectFluid.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef adiabaticPerfectFluid_H
+#define adiabaticPerfectFluid_H
+
+#include "autoPtr.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward declaration of friend functions and operators
+
+template<class Specie> class adiabaticPerfectFluid;
+
+template<class Specie>
+inline adiabaticPerfectFluid<Specie> operator+
+(
+    const adiabaticPerfectFluid<Specie>&,
+    const adiabaticPerfectFluid<Specie>&
+);
+
+template<class Specie>
+inline adiabaticPerfectFluid<Specie> operator-
+(
+    const adiabaticPerfectFluid<Specie>&,
+    const adiabaticPerfectFluid<Specie>&
+);
+
+template<class Specie>
+inline adiabaticPerfectFluid<Specie> operator*
+(
+    const scalar,
+    const adiabaticPerfectFluid<Specie>&
+);
+
+template<class Specie>
+inline adiabaticPerfectFluid<Specie> operator==
+(
+    const adiabaticPerfectFluid<Specie>&,
+    const adiabaticPerfectFluid<Specie>&
+);
+
+template<class Specie>
+Ostream& operator<<
+(
+    Ostream&,
+    const adiabaticPerfectFluid<Specie>&
+);
+
+
+/*---------------------------------------------------------------------------*\
+                           Class adiabaticPerfectFluid Declaration
+\*---------------------------------------------------------------------------*/
+
+template<class Specie>
+class adiabaticPerfectFluid
+:
+    public Specie
+{
+    // Private data
+
+        //- Reference pressure
+        scalar p0_;
+
+        //- Reference density
+        scalar rho0_;
+
+        //- The isentropic exponent
+        scalar gamma_;
+
+        //- Pressure offset for a stiffened gas
+        scalar B_;
+
+
+public:
+
+    // Constructors
+
+        //- Construct from components
+        inline adiabaticPerfectFluid
+        (
+            const Specie& sp,
+            const scalar p0,
+            const scalar rho0,
+            const scalar gamma,
+            const scalar B
+        );
+
+        //- Construct from Istream
+        adiabaticPerfectFluid(Istream&);
+
+        //- Construct from dictionary
+        adiabaticPerfectFluid(const dictionary& dict);
+
+        //- Construct as named copy
+        inline adiabaticPerfectFluid
+        (
+            const word& name,
+            const adiabaticPerfectFluid&
+        );
+
+        //- Construct and return a clone
+        inline autoPtr<adiabaticPerfectFluid> clone() const;
+
+        // Selector from Istream
+        inline static autoPtr<adiabaticPerfectFluid> New(Istream& is);
+
+        // Selector from dictionary
+        inline static autoPtr<adiabaticPerfectFluid> New
+        (
+            const dictionary& dict
+        );
+
+
+    // Member functions
+
+        //- Return the instantiated type name
+        static word typeName()
+        {
+            return "adiabaticPerfectFluid<" + word(Specie::typeName_()) + '>';
+        }
+
+
+        // Fundamental properties
+
+            //- Is the equation of state is incompressible i.e. rho != f(p)
+            static const bool incompressible = false;
+
+            //- Is the equation of state is isochoric i.e. rho = const
+            static const bool isochoric = false;
+
+            //- Return density [kg/m^3]
+            inline scalar rho(scalar p, scalar T) const;
+
+            //- Return compressibility rho/p [s^2/m^2]
+            inline scalar psi(scalar p, scalar T) const;
+
+            //- Return compression factor []
+            inline scalar Z(scalar p, scalar T) const;
+
+            //- Return (cp - cv) [J/(kmol K]
+            inline scalar cpMcv(scalar p, scalar T) const;
+
+
+        // IO
+
+            //- Write to Ostream
+            void write(Ostream& os) const;
+
+
+    // Member operators
+
+        inline void operator+=(const adiabaticPerfectFluid&);
+        inline void operator-=(const adiabaticPerfectFluid&);
+
+        inline void operator*=(const scalar);
+
+
+    // Friend operators
+
+        friend adiabaticPerfectFluid operator+ <Specie>
+        (
+            const adiabaticPerfectFluid&,
+            const adiabaticPerfectFluid&
+        );
+
+        friend adiabaticPerfectFluid operator- <Specie>
+        (
+            const adiabaticPerfectFluid&,
+            const adiabaticPerfectFluid&
+        );
+
+        friend adiabaticPerfectFluid operator* <Specie>
+        (
+            const scalar s,
+            const adiabaticPerfectFluid&
+        );
+
+        friend adiabaticPerfectFluid operator== <Specie>
+        (
+            const adiabaticPerfectFluid&,
+            const adiabaticPerfectFluid&
+        );
+
+
+    // Ostream Operator
+
+        friend Ostream& operator<< <Specie>
+        (
+            Ostream&,
+            const adiabaticPerfectFluid&
+        );
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "adiabaticPerfectFluidI.H"
+
+#ifdef NoRepository
+#   include "adiabaticPerfectFluid.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluidI.H b/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluidI.H
new file mode 100644
index 0000000000000000000000000000000000000000..4521e719460ac2409551a0ec99581189302dec45
--- /dev/null
+++ b/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluidI.H
@@ -0,0 +1,271 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "adiabaticPerfectFluid.H"
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+template<class Specie>
+inline Foam::adiabaticPerfectFluid<Specie>::adiabaticPerfectFluid
+(
+    const Specie& sp,
+    const scalar p0,
+    const scalar rho0,
+    const scalar gamma,
+    const scalar B
+)
+:
+    Specie(sp),
+    p0_(p0),
+    rho0_(rho0),
+    gamma_(gamma),
+    B_(B)
+{}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+template<class Specie>
+inline Foam::adiabaticPerfectFluid<Specie>::adiabaticPerfectFluid
+(
+    const word& name,
+    const adiabaticPerfectFluid<Specie>& pf
+)
+:
+    Specie(name, pf),
+    p0_(pf.p0_),
+    rho0_(pf.rho0_),
+    gamma_(pf.gamma_),
+    B_(pf.B_)
+{}
+
+
+template<class Specie>
+inline Foam::autoPtr<Foam::adiabaticPerfectFluid<Specie> >
+Foam::adiabaticPerfectFluid<Specie>::clone() const
+{
+    return autoPtr<adiabaticPerfectFluid<Specie> >
+    (
+        new adiabaticPerfectFluid<Specie>(*this)
+    );
+}
+
+
+template<class Specie>
+inline Foam::autoPtr<Foam::adiabaticPerfectFluid<Specie> >
+Foam::adiabaticPerfectFluid<Specie>::New(Istream& is)
+{
+    return autoPtr<adiabaticPerfectFluid<Specie> >
+    (
+        new adiabaticPerfectFluid<Specie>(is)
+    );
+}
+
+
+template<class Specie>
+inline Foam::autoPtr<Foam::adiabaticPerfectFluid<Specie> >
+Foam::adiabaticPerfectFluid<Specie>::New
+(
+    const dictionary& dict
+)
+{
+    return autoPtr<adiabaticPerfectFluid<Specie> >
+    (
+        new adiabaticPerfectFluid<Specie>(dict)
+    );
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+template<class Specie>
+inline Foam::scalar Foam::adiabaticPerfectFluid<Specie>::rho
+(
+    scalar p,
+    scalar
+) const
+{
+    return rho0_*pow((p + B_)/(p0_ + B_), 1.0/gamma_);
+}
+
+
+template<class Specie>
+inline Foam::scalar Foam::adiabaticPerfectFluid<Specie>::psi
+(
+    scalar p,
+    scalar
+) const
+{
+    return
+        (rho0_/(gamma_*(p0_ + B_)))
+       *pow((p + B_)/(p0_ + B_), 1.0/gamma_ - 1.0);
+}
+
+
+template<class Specie>
+inline Foam::scalar Foam::adiabaticPerfectFluid<Specie>::Z(scalar, scalar) const
+{
+    return 1.0;
+}
+
+
+template<class Specie>
+inline Foam::scalar Foam::adiabaticPerfectFluid<Specie>::cpMcv
+(
+    scalar,
+    scalar
+) const
+{
+    return 0;
+}
+
+
+// * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
+
+template<class Specie>
+inline void Foam::adiabaticPerfectFluid<Specie>::operator+=
+(
+    const adiabaticPerfectFluid<Specie>& pf
+)
+{
+    scalar molr1 = this->nMoles();
+
+    Specie::operator+=(pf);
+
+    molr1 /= this->nMoles();
+    scalar molr2 = pf.nMoles()/this->nMoles();
+
+    p0_ = molr1*p0_ + molr2*pf.p0_;
+    rho0_ = molr1*rho0_ + molr2*pf.rho0_;
+    gamma_ = molr1*gamma_ + molr2*pf.gamma_;
+    B_ = molr1*B_ + molr2*pf.B_;
+}
+
+
+template<class Specie>
+inline void Foam::adiabaticPerfectFluid<Specie>::operator-=
+(
+    const adiabaticPerfectFluid<Specie>& pf
+)
+{
+    scalar molr1 = this->nMoles();
+
+    Specie::operator-=(pf);
+
+    molr1 /= this->nMoles();
+    scalar molr2 = pf.nMoles()/this->nMoles();
+
+    p0_ = molr1*p0_ - molr2*pf.p0_;
+    rho0_ = molr1*rho0_ - molr2*pf.rho0_;
+    gamma_ = molr1*gamma_ - molr2*pf.gamma_;
+    B_ = molr1*B_ - molr2*pf.B_;
+}
+
+
+template<class Specie>
+inline void Foam::adiabaticPerfectFluid<Specie>::operator*=(const scalar s)
+{
+    Specie::operator*=(s);
+}
+
+
+// * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
+
+template<class Specie>
+inline Foam::adiabaticPerfectFluid<Specie> Foam::operator+
+(
+    const adiabaticPerfectFluid<Specie>& pf1,
+    const adiabaticPerfectFluid<Specie>& pf2
+)
+{
+    scalar nMoles = pf1.nMoles() + pf2.nMoles();
+    scalar molr1 = pf1.nMoles()/nMoles;
+    scalar molr2 = pf2.nMoles()/nMoles;
+
+    return rhoConst<Specie>
+    (
+        static_cast<const Specie&>(pf1)
+      + static_cast<const Specie&>(pf2),
+        molr1*pf1.p0_ + molr2*pf2.p0_,
+        molr1*pf1.rho0_ + molr2*pf2.rho0_,
+        molr1*pf1.gamma_ + molr2*pf2.gamma_,
+        molr1*pf1.B_ + molr2*pf2.B_
+    );
+}
+
+
+template<class Specie>
+inline Foam::adiabaticPerfectFluid<Specie> Foam::operator-
+(
+    const adiabaticPerfectFluid<Specie>& pf1,
+    const adiabaticPerfectFluid<Specie>& pf2
+)
+{
+    scalar nMoles = pf1.nMoles() + pf2.nMoles();
+    scalar molr1 = pf1.nMoles()/nMoles;
+    scalar molr2 = pf2.nMoles()/nMoles;
+
+    return rhoConst<Specie>
+    (
+        static_cast<const Specie&>(pf1)
+      - static_cast<const Specie&>(pf2),
+        molr1*pf1.p0_ - molr2*pf2.p0_,
+        molr1*pf1.rho0_ - molr2*pf2.rho0_,
+        molr1*pf1.gamma_ - molr2*pf2.gamma_,
+        molr1*pf1.B_ - molr2*pf2.B_
+    );
+}
+
+
+template<class Specie>
+inline Foam::adiabaticPerfectFluid<Specie> Foam::operator*
+(
+    const scalar s,
+    const adiabaticPerfectFluid<Specie>& pf
+)
+{
+    return adiabaticPerfectFluid<Specie>
+    (
+        s*static_cast<const Specie&>(pf),
+        pf.p0_,
+        pf.rho0_,
+        pf.gamma_,
+        pf.B_
+    );
+}
+
+
+template<class Specie>
+inline Foam::adiabaticPerfectFluid<Specie> Foam::operator==
+(
+    const adiabaticPerfectFluid<Specie>& pf1,
+    const adiabaticPerfectFluid<Specie>& pf2
+)
+{
+    return pf2 - pf1;
+}
+
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.H b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.H
index 566c3c972911bfdb5634ba70ac6699d47833bdcf..a3f21ef797175086ff4dfaa61f42a67384c09167 100644
--- a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.H
+++ b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H
index ff2f3e233dfccfa21d08c5cb150ca4070fa0ff89..0444104e1c5d4dc3305764a5c10f63a35323d49f 100644
--- a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H
+++ b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -121,7 +121,7 @@ inline Foam::scalar Foam::incompressiblePerfectGas<Specie>::psi
     scalar T
 ) const
 {
-    return 1.0/(this->R()*T);
+    return 0.0;
 }
 
 
@@ -132,7 +132,7 @@ inline Foam::scalar Foam::incompressiblePerfectGas<Specie>::Z
     scalar
 ) const
 {
-    return 1.0;
+    return 0.0;
 }
 
 
diff --git a/src/thermophysicalModels/specie/equationOfState/linear/linear.C b/src/thermophysicalModels/specie/equationOfState/linear/linear.C
new file mode 100644
index 0000000000000000000000000000000000000000..562bdecf2bd96838c961d5afff058b9d36b5a9a7
--- /dev/null
+++ b/src/thermophysicalModels/specie/equationOfState/linear/linear.C
@@ -0,0 +1,80 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "linear.H"
+#include "IOstreams.H"
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+template<class Specie>
+Foam::linear<Specie>::linear(Istream& is)
+:
+    Specie(is),
+    psi_(readScalar(is)),
+    rho0_(readScalar(is))
+{
+    is.check("linear<Specie>::linear(Istream& is)");
+}
+
+
+template<class Specie>
+Foam::linear<Specie>::linear(const dictionary& dict)
+:
+    Specie(dict),
+    psi_(readScalar(dict.subDict("equationOfState").lookup("psi"))),
+    rho0_(readScalar(dict.subDict("equationOfState").lookup("rho0")))
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+template<class Specie>
+void Foam::linear<Specie>::write(Ostream& os) const
+{
+    Specie::write(os);
+
+    dictionary dict("equationOfState");
+    dict.add("psi", psi_);
+    dict.add("rho0", rho0_);
+
+    os  << indent << dict.dictName() << dict;
+}
+
+
+// * * * * * * * * * * * * * * * Ostream Operator  * * * * * * * * * * * * * //
+
+template<class Specie>
+Foam::Ostream& Foam::operator<<(Ostream& os, const linear<Specie>& pf)
+{
+    os  << static_cast<const Specie&>(pf)
+        << token::SPACE << pf.psi_
+        << token::SPACE << pf.rho0_;
+
+    os.check("Ostream& operator<<(Ostream&, const linear<Specie>&)");
+    return os;
+}
+
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/specie/equationOfState/linear/linear.H b/src/thermophysicalModels/specie/equationOfState/linear/linear.H
new file mode 100644
index 0000000000000000000000000000000000000000..8876ce3f28d6228f99c992364bdc9670d29021c7
--- /dev/null
+++ b/src/thermophysicalModels/specie/equationOfState/linear/linear.H
@@ -0,0 +1,232 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+Class
+    Foam::linear
+
+Description
+    Perfect gas equation of state.
+
+SourceFiles
+    linearI.H
+    linear.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef linear_H
+#define linear_H
+
+#include "autoPtr.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward declaration of friend functions and operators
+
+template<class Specie> class linear;
+
+template<class Specie>
+inline linear<Specie> operator+
+(
+    const linear<Specie>&,
+    const linear<Specie>&
+);
+
+template<class Specie>
+inline linear<Specie> operator-
+(
+    const linear<Specie>&,
+    const linear<Specie>&
+);
+
+template<class Specie>
+inline linear<Specie> operator*
+(
+    const scalar,
+    const linear<Specie>&
+);
+
+template<class Specie>
+inline linear<Specie> operator==
+(
+    const linear<Specie>&,
+    const linear<Specie>&
+);
+
+template<class Specie>
+Ostream& operator<<
+(
+    Ostream&,
+    const linear<Specie>&
+);
+
+
+/*---------------------------------------------------------------------------*\
+                           Class linear Declaration
+\*---------------------------------------------------------------------------*/
+
+template<class Specie>
+class linear
+:
+    public Specie
+{
+    // Private data
+
+        //- Compressibility
+        scalar psi_;
+
+        //- The reference density
+        scalar rho0_;
+
+
+public:
+
+    // Constructors
+
+        //- Construct from components
+        inline linear
+        (
+            const Specie& sp,
+            const scalar psi,
+            const scalar rho0
+        );
+
+        //- Construct from Istream
+        linear(Istream&);
+
+        //- Construct from dictionary
+        linear(const dictionary& dict);
+
+        //- Construct as named copy
+        inline linear(const word& name, const linear&);
+
+        //- Construct and return a clone
+        inline autoPtr<linear> clone() const;
+
+        // Selector from Istream
+        inline static autoPtr<linear> New(Istream& is);
+
+        // Selector from dictionary
+        inline static autoPtr<linear> New(const dictionary& dict);
+
+
+    // Member functions
+
+        //- Return the instantiated type name
+        static word typeName()
+        {
+            return "linear<" + word(Specie::typeName_()) + '>';
+        }
+
+
+        // Fundamental properties
+
+            //- Is the equation of state is incompressible i.e. rho != f(p)
+            static const bool incompressible = false;
+
+            //- Is the equation of state is isochoric i.e. rho = const
+            static const bool isochoric = false;
+
+            //- Return density [kg/m^3]
+            inline scalar rho(scalar p, scalar T) const;
+
+            //- Return compressibility rho/p [s^2/m^2]
+            inline scalar psi(scalar p, scalar T) const;
+
+            //- Return compression factor []
+            inline scalar Z(scalar p, scalar T) const;
+
+            //- Return (cp - cv) [J/(kmol K]
+            inline scalar cpMcv(scalar p, scalar T) const;
+
+
+        // IO
+
+            //- Write to Ostream
+            void write(Ostream& os) const;
+
+
+    // Member operators
+
+        inline void operator+=(const linear&);
+        inline void operator-=(const linear&);
+
+        inline void operator*=(const scalar);
+
+
+    // Friend operators
+
+        friend linear operator+ <Specie>
+        (
+            const linear&,
+            const linear&
+        );
+
+        friend linear operator- <Specie>
+        (
+            const linear&,
+            const linear&
+        );
+
+        friend linear operator* <Specie>
+        (
+            const scalar s,
+            const linear&
+        );
+
+        friend linear operator== <Specie>
+        (
+            const linear&,
+            const linear&
+        );
+
+
+    // Ostream Operator
+
+        friend Ostream& operator<< <Specie>
+        (
+            Ostream&,
+            const linear&
+        );
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "linearI.H"
+
+#ifdef NoRepository
+#   include "linear.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/specie/equationOfState/linear/linearI.H b/src/thermophysicalModels/specie/equationOfState/linear/linearI.H
new file mode 100644
index 0000000000000000000000000000000000000000..ea05aa6333810aac4a6d140c95d659fceda2e9e5
--- /dev/null
+++ b/src/thermophysicalModels/specie/equationOfState/linear/linearI.H
@@ -0,0 +1,232 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "linear.H"
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+template<class Specie>
+inline Foam::linear<Specie>::linear
+(
+    const Specie& sp,
+    const scalar psi,
+    const scalar rho0
+)
+:
+    Specie(sp),
+    psi_(psi),
+    rho0_(rho0)
+{}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+template<class Specie>
+inline Foam::linear<Specie>::linear
+(
+    const word& name,
+    const linear<Specie>& pf
+)
+:
+    Specie(name, pf),
+    psi_(pf.psi_),
+    rho0_(pf.rho0_)
+{}
+
+
+template<class Specie>
+inline Foam::autoPtr<Foam::linear<Specie> >
+Foam::linear<Specie>::clone() const
+{
+    return autoPtr<linear<Specie> >(new linear<Specie>(*this));
+}
+
+
+template<class Specie>
+inline Foam::autoPtr<Foam::linear<Specie> >
+Foam::linear<Specie>::New(Istream& is)
+{
+    return autoPtr<linear<Specie> >(new linear<Specie>(is));
+}
+
+
+template<class Specie>
+inline Foam::autoPtr<Foam::linear<Specie> >
+Foam::linear<Specie>::New
+(
+    const dictionary& dict
+)
+{
+    return autoPtr<linear<Specie> >(new linear<Specie>(dict));
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+template<class Specie>
+inline Foam::scalar Foam::linear<Specie>::rho(scalar p, scalar T) const
+{
+    return rho0_ + psi_*p;
+}
+
+
+template<class Specie>
+inline Foam::scalar Foam::linear<Specie>::psi(scalar, scalar T) const
+{
+    return psi_;
+}
+
+
+template<class Specie>
+inline Foam::scalar Foam::linear<Specie>::Z(scalar, scalar) const
+{
+    return 1.0;
+}
+
+
+template<class Specie>
+inline Foam::scalar Foam::linear<Specie>::cpMcv(scalar, scalar) const
+{
+    return 0;
+}
+
+
+// * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
+
+template<class Specie>
+inline void Foam::linear<Specie>::operator+=
+(
+    const linear<Specie>& pf
+)
+{
+    scalar molr1 = this->nMoles();
+
+    Specie::operator+=(pf);
+
+    molr1 /= this->nMoles();
+    scalar molr2 = pf.nMoles()/this->nMoles();
+
+    psi_ = molr1*psi_ + molr2*pf.psi_;
+    rho0_ = molr1*rho0_ + molr2*pf.rho0_;
+}
+
+
+template<class Specie>
+inline void Foam::linear<Specie>::operator-=
+(
+    const linear<Specie>& pf
+)
+{
+    scalar molr1 = this->nMoles();
+
+    Specie::operator-=(pf);
+
+    molr1 /= this->nMoles();
+    scalar molr2 = pf.nMoles()/this->nMoles();
+
+    psi_ = molr1*psi_ - molr2*pf.psi_;
+    rho0_ = molr1*rho0_ - molr2*pf.rho0_;
+}
+
+
+template<class Specie>
+inline void Foam::linear<Specie>::operator*=(const scalar s)
+{
+    Specie::operator*=(s);
+}
+
+
+// * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
+
+template<class Specie>
+inline Foam::linear<Specie> Foam::operator+
+(
+    const linear<Specie>& pf1,
+    const linear<Specie>& pf2
+)
+{
+    scalar nMoles = pf1.nMoles() + pf2.nMoles();
+    scalar molr1 = pf1.nMoles()/nMoles;
+    scalar molr2 = pf2.nMoles()/nMoles;
+
+    return rhoConst<Specie>
+    (
+        static_cast<const Specie&>(pf1)
+      + static_cast<const Specie&>(pf2),
+        molr1*pf1.psi_ + molr2*pf2.psi_,
+        molr1*pf1.rho0_ + molr2*pf2.rho0_
+    );
+}
+
+
+template<class Specie>
+inline Foam::linear<Specie> Foam::operator-
+(
+    const linear<Specie>& pf1,
+    const linear<Specie>& pf2
+)
+{
+    scalar nMoles = pf1.nMoles() + pf2.nMoles();
+    scalar molr1 = pf1.nMoles()/nMoles;
+    scalar molr2 = pf2.nMoles()/nMoles;
+
+    return rhoConst<Specie>
+    (
+        static_cast<const Specie&>(pf1)
+      - static_cast<const Specie&>(pf2),
+        molr1*pf1.psi_ - molr2*pf2.psi_,
+        molr1*pf1.rho0_ - molr2*pf2.rho0_
+    );
+}
+
+
+template<class Specie>
+inline Foam::linear<Specie> Foam::operator*
+(
+    const scalar s,
+    const linear<Specie>& pf
+)
+{
+    return linear<Specie>
+    (
+        s*static_cast<const Specie&>(pf),
+        pf.psi_,
+        pf.rho0_
+    );
+}
+
+
+template<class Specie>
+inline Foam::linear<Specie> Foam::operator==
+(
+    const linear<Specie>& pf1,
+    const linear<Specie>& pf2
+)
+{
+    return pf2 - pf1;
+}
+
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.C b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.C
index 844f293e2dd580a904cc9fa93ba877dfd8d0df5a..612fc6f9eb0bab8e4263b3e8746c6a7c20f611d5 100644
--- a/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.C
+++ b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.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
@@ -32,6 +32,7 @@ template<class Specie>
 Foam::perfectFluid<Specie>::perfectFluid(Istream& is)
 :
     Specie(is),
+    R_(readScalar(is)),
     rho0_(readScalar(is))
 {
     is.check("perfectFluid<Specie>::perfectFluid(Istream& is)");
@@ -42,6 +43,7 @@ template<class Specie>
 Foam::perfectFluid<Specie>::perfectFluid(const dictionary& dict)
 :
     Specie(dict),
+    R_(readScalar(dict.subDict("equationOfState").lookup("R"))),
     rho0_(readScalar(dict.subDict("equationOfState").lookup("rho0")))
 {}
 
@@ -54,6 +56,7 @@ void Foam::perfectFluid<Specie>::write(Ostream& os) const
     Specie::write(os);
 
     dictionary dict("equationOfState");
+    dict.add("R", R_);
     dict.add("rho0", rho0_);
 
     os  << indent << dict.dictName() << dict;
@@ -66,6 +69,7 @@ template<class Specie>
 Foam::Ostream& Foam::operator<<(Ostream& os, const perfectFluid<Specie>& pf)
 {
     os  << static_cast<const Specie&>(pf)
+        << token::SPACE << pf.R_
         << token::SPACE << pf.rho0_;
 
     os.check("Ostream& operator<<(Ostream&, const perfectFluid<Specie>&)");
diff --git a/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.H b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.H
index 76cf80c4a8fd504ad52bcef4f0f4a55653c20dda..9229fd34a4111b4f5e73345e6e892e4af0fb8f2c 100644
--- a/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.H
+++ b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -94,15 +94,24 @@ class perfectFluid
 {
     // Private data
 
+        //- Fluid constant
+        scalar R_;
+
         //- The reference density
         scalar rho0_;
 
+
 public:
 
     // Constructors
 
         //- Construct from components
-        inline perfectFluid(const Specie& sp, const scalar rho0);
+        inline perfectFluid
+        (
+            const Specie& sp,
+            const scalar R,
+            const scalar rho0
+        );
 
         //- Construct from Istream
         perfectFluid(Istream&);
@@ -140,6 +149,9 @@ public:
             //- Is the equation of state is isochoric i.e. rho = const
             static const bool isochoric = false;
 
+            //- Return fluid constant [J/(kg K)]
+            inline scalar R() const;
+
             //- Return density [kg/m^3]
             inline scalar rho(scalar p, scalar T) const;
 
diff --git a/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluidI.H b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluidI.H
index 21fc092fe2adca3d3875247001d26cacb61309da..c21d6885f9002e5e7177075a0f2bbedae923f870 100644
--- a/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluidI.H
+++ b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluidI.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -31,10 +31,12 @@ template<class Specie>
 inline Foam::perfectFluid<Specie>::perfectFluid
 (
     const Specie& sp,
+    const scalar R,
     const scalar rho0
 )
 :
     Specie(sp),
+    R_(R),
     rho0_(rho0)
 {}
 
@@ -49,6 +51,7 @@ inline Foam::perfectFluid<Specie>::perfectFluid
 )
 :
     Specie(name, pf),
+    R_(pf.R_),
     rho0_(pf.rho0_)
 {}
 
@@ -82,6 +85,13 @@ Foam::perfectFluid<Specie>::New
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+template<class Specie>
+inline Foam::scalar Foam::perfectFluid<Specie>::R() const
+{
+    return R_;
+}
+
+
 template<class Specie>
 inline Foam::scalar Foam::perfectFluid<Specie>::rho(scalar p, scalar T) const
 {
@@ -106,7 +116,7 @@ inline Foam::scalar Foam::perfectFluid<Specie>::Z(scalar, scalar) const
 template<class Specie>
 inline Foam::scalar Foam::perfectFluid<Specie>::cpMcv(scalar, scalar) const
 {
-    return this->RR;
+    return 0;
 }
 
 
@@ -125,6 +135,7 @@ inline void Foam::perfectFluid<Specie>::operator+=
     molr1 /= this->nMoles();
     scalar molr2 = pf.nMoles()/this->nMoles();
 
+    R_ = 1.0/(molr1/R_ + molr2/pf.R_);
     rho0_ = molr1*rho0_ + molr2*pf.rho0_;
 }
 
@@ -142,6 +153,7 @@ inline void Foam::perfectFluid<Specie>::operator-=
     molr1 /= this->nMoles();
     scalar molr2 = pf.nMoles()/this->nMoles();
 
+    R_ = 1.0/(molr1/R_ - molr2/pf.R_);
     rho0_ = molr1*rho0_ - molr2*pf.rho0_;
 }
 
@@ -170,6 +182,7 @@ inline Foam::perfectFluid<Specie> Foam::operator+
     (
         static_cast<const Specie&>(pf1)
       + static_cast<const Specie&>(pf2),
+        1.0/(molr1/pf1.R_ + molr2/pf2.R_),
         molr1*pf1.rho0_ + molr2*pf2.rho0_
     );
 }
@@ -190,6 +203,7 @@ inline Foam::perfectFluid<Specie> Foam::operator-
     (
         static_cast<const Specie&>(pf1)
       - static_cast<const Specie&>(pf2),
+        1.0/(molr1/pf1.R_ - molr2/pf2.R_),
         molr1*pf1.rho0_ - molr2*pf2.rho0_
     );
 }
@@ -202,7 +216,12 @@ inline Foam::perfectFluid<Specie> Foam::operator*
     const perfectFluid<Specie>& pf
 )
 {
-    return perfectFluid<Specie>(s*static_cast<const Specie&>(pf), pf.rho0_);
+    return perfectFluid<Specie>
+    (
+        s*static_cast<const Specie&>(pf),
+        pf.R_,
+        pf.rho0_
+    );
 }
 
 
diff --git a/src/thermophysicalModels/specie/include/reactionTypes.H b/src/thermophysicalModels/specie/include/reactionTypes.H
index e6af91d8967d473b36fbed027e4211b14f99003c..b58c3098b2eeeb2ea785a31df32512913a5f47dc 100644
--- a/src/thermophysicalModels/specie/include/reactionTypes.H
+++ b/src/thermophysicalModels/specie/include/reactionTypes.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/specie/include/thermoPhysicsTypes.H b/src/thermophysicalModels/specie/include/thermoPhysicsTypes.H
index cb17a56a1419b064ece1a1d6d6e613609832b545..04cecc04cefc02df140b8a4d3952a5ef801aa3c5 100644
--- a/src/thermophysicalModels/specie/include/thermoPhysicsTypes.H
+++ b/src/thermophysicalModels/specie/include/thermoPhysicsTypes.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/specie/reaction/reactions/makeLangmuirHinshelwoodReactions.C b/src/thermophysicalModels/specie/reaction/reactions/makeLangmuirHinshelwoodReactions.C
index b5d8c0ad1d1f5ff0addceb56b4895d23d19f63e6..03817990037925b852ce729c5d998c1841a9c6be 100644
--- a/src/thermophysicalModels/specie/reaction/reactions/makeLangmuirHinshelwoodReactions.C
+++ b/src/thermophysicalModels/specie/reaction/reactions/makeLangmuirHinshelwoodReactions.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/specie/reaction/reactions/makeReactions.C b/src/thermophysicalModels/specie/reaction/reactions/makeReactions.C
index 4dfd73d6a033d9cfdd17a84d8037125187371604..96352b2c9bfb85c97b806674fb1b3bb08f469d4c 100644
--- a/src/thermophysicalModels/specie/reaction/reactions/makeReactions.C
+++ b/src/thermophysicalModels/specie/reaction/reactions/makeReactions.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/thermophysicalModels/specie/transport/const/constTransport.H b/src/thermophysicalModels/specie/transport/const/constTransport.H
index c1e3120000c6a541fec680e8da07e744fddd1276..65cd3c8a418b2c2793a7ec5eb5be23d939319b91 100644
--- a/src/thermophysicalModels/specie/transport/const/constTransport.H
+++ b/src/thermophysicalModels/specie/transport/const/constTransport.H
@@ -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
@@ -161,10 +161,13 @@ public:
 
     // Member operators
 
-        inline constTransport& operator=
-        (
-            const constTransport&
-        );
+        inline constTransport& operator=(const constTransport&);
+
+        inline void operator+=(const constTransport&);
+
+        inline void operator-=(const constTransport&);
+
+        inline void operator*=(const scalar);
 
 
     // Friend operators
diff --git a/src/thermophysicalModels/specie/transport/const/constTransportI.H b/src/thermophysicalModels/specie/transport/const/constTransportI.H
index e58aa79efa95828f2525b1349de8360ae48fcb0b..98ce21d97ec0eb030cb5f74ca2e8852c9f2d8ce2 100644
--- a/src/thermophysicalModels/specie/transport/const/constTransportI.H
+++ b/src/thermophysicalModels/specie/transport/const/constTransportI.H
@@ -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
@@ -143,6 +143,52 @@ inline Foam::constTransport<Thermo>& Foam::constTransport<Thermo>::operator=
 }
 
 
+template<class Thermo>
+inline void Foam::constTransport<Thermo>::operator+=
+(
+    const constTransport<Thermo>& st
+)
+{
+    scalar molr1 = this->nMoles();
+
+    Thermo::operator+=(st);
+
+    molr1 /= this->nMoles();
+    scalar molr2 = st.nMoles()/this->nMoles();
+
+    mu_ = molr1*mu_ + molr2*st.mu_;
+    rPr_ = molr1*rPr_ + molr2*st.rPr_;
+}
+
+
+template<class Thermo>
+inline void Foam::constTransport<Thermo>::operator-=
+(
+    const constTransport<Thermo>& st
+)
+{
+    scalar molr1 = this->nMoles();
+
+    Thermo::operator-=(st);
+
+    molr1 /= this->nMoles();
+    scalar molr2 = st.nMoles()/this->nMoles();
+
+    mu_ = molr1*mu_ - molr2*st.mu_;
+    rPr_ = molr1*rPr_ - molr2*st.rPr_;
+}
+
+
+template<class Thermo>
+inline void Foam::constTransport<Thermo>::operator*=
+(
+    const scalar s
+)
+{
+    Thermo::operator*=(s);
+}
+
+
 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
 
 template<class Thermo>
diff --git a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H
index f8ac0722dd6178efda9d62653d2c218c1b68c1fd..25973ac1dae2f6c47b5a7eb1466739aef0f3aad1 100644
--- a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H
+++ b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H
@@ -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
@@ -180,10 +180,13 @@ public:
 
     // Member operators
 
-        inline sutherlandTransport& operator=
-        (
-            const sutherlandTransport&
-        );
+        inline sutherlandTransport& operator=(const sutherlandTransport&);
+
+        inline void operator+=(const sutherlandTransport&);
+
+        inline void operator-=(const sutherlandTransport&);
+
+        inline void operator*=(const scalar);
 
 
     // Friend operators
diff --git a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H
index ac79418ed34435d4ca2c16857ef03316a5c8d897..7a0845cfb52eaf6280a7df4c7286da00c12a0de5 100644
--- a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H
+++ b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H
@@ -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
@@ -180,6 +180,52 @@ Foam::sutherlandTransport<Thermo>::operator=
 }
 
 
+template<class Thermo>
+inline void Foam::sutherlandTransport<Thermo>::operator+=
+(
+    const sutherlandTransport<Thermo>& st
+)
+{
+    scalar molr1 = this->nMoles();
+
+    Thermo::operator+=(st);
+
+    molr1 /= this->nMoles();
+    scalar molr2 = st.nMoles()/this->nMoles();
+
+    As_ = molr1*As_ + molr2*st.As_;
+    Ts_ = molr1*Ts_ + molr2*st.Ts_;
+}
+
+
+template<class Thermo>
+inline void Foam::sutherlandTransport<Thermo>::operator-=
+(
+    const sutherlandTransport<Thermo>& st
+)
+{
+    scalar molr1 = this->nMoles();
+
+    Thermo::operator-=(st);
+
+    molr1 /= this->nMoles();
+    scalar molr2 = st.nMoles()/this->nMoles();
+
+    As_ = molr1*As_ - molr2*st.As_;
+    Ts_ = molr1*Ts_ - molr2*st.Ts_;
+}
+
+
+template<class Thermo>
+inline void Foam::sutherlandTransport<Thermo>::operator*=
+(
+    const scalar s
+)
+{
+    Thermo::operator*=(s);
+}
+
+
 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
 
 template<class Thermo>
diff --git a/src/transportModels/Allwmake b/src/transportModels/Allwmake
index 21078c07fdf2b36d0bb5935e76376588f5dd714a..120dfae74a90cfd1f3e9e80a52b03c94f8d665e0 100755
--- a/src/transportModels/Allwmake
+++ b/src/transportModels/Allwmake
@@ -3,9 +3,9 @@ cd ${0%/*} || exit 1    # run from this directory
 makeType=${1:-libso}
 set -x
 
-wmake $makeType incompressible
+wmake $makeType twoPhaseMixture
 wmake $makeType interfaceProperties
-wmake $makeType twoPhaseInterfaceProperties
-# wmake $makeType compressible
+wmake $makeType twoPhaseProperties
+wmake $makeType incompressible
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/src/transportModels/incompressible/Make/files b/src/transportModels/incompressible/Make/files
index 898a3c648ced0ae9d42af3f69203343561ca2f0d..76baf5df2415e130c435a2d9fd6f851d7378f140 100644
--- a/src/transportModels/incompressible/Make/files
+++ b/src/transportModels/incompressible/Make/files
@@ -9,6 +9,6 @@ viscosityModels/HerschelBulkley/HerschelBulkley.C
 transportModel/transportModel.C
 singlePhaseTransportModel/singlePhaseTransportModel.C
 
-incompressibleTwoPhaseMixture/twoPhaseMixture.C
+incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C
 
 LIB = $(FOAM_LIBBIN)/libincompressibleTransportModels
diff --git a/src/transportModels/incompressible/Make/options b/src/transportModels/incompressible/Make/options
index a412632ebb87b7a78b4466b6d94fedc04f71922d..82c7568a591e218780169dd539b1a783b6c09e55 100644
--- a/src/transportModels/incompressible/Make/options
+++ b/src/transportModels/incompressible/Make/options
@@ -1,6 +1,8 @@
 EXE_INC = \
     -I.. \
+    -I../twoPhaseMixture/lnInclude \
     -I$(LIB_SRC)/finiteVolume/lnInclude
 
 LIB_LIBS = \
+    -ltwoPhaseMixture \
     -lfiniteVolume
diff --git a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.C b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C
similarity index 82%
rename from src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.C
rename to src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C
index 4ec3ce72f85dc8b19a6392c4111eaf05b0247dfb..98046c9b76f028ba8a65b41fc4f934d0c50760f6 100644
--- a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.C
+++ b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.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
@@ -23,7 +23,7 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "twoPhaseMixture.H"
+#include "incompressibleTwoPhaseMixture.H"
 #include "addToRunTimeSelectionTable.H"
 #include "surfaceFields.H"
 #include "fvc.H"
@@ -32,7 +32,7 @@ License
 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
 
 //- Calculate and return the laminar viscosity
-void Foam::twoPhaseMixture::calcNu()
+void Foam::incompressibleTwoPhaseMixture::calcNu()
 {
     nuModel1_->correct();
     nuModel2_->correct();
@@ -50,24 +50,23 @@ void Foam::twoPhaseMixture::calcNu()
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::twoPhaseMixture::twoPhaseMixture
+Foam::incompressibleTwoPhaseMixture::incompressibleTwoPhaseMixture
 (
     const volVectorField& U,
     const surfaceScalarField& phi,
-    const word& alpha1Name
+    const word& alpha1Name,
+    const word& alpha2Name
 )
 :
     transportModel(U, phi),
-
-    phase1Name_(found("phases") ? wordList(lookup("phases"))[0] : "phase1"),
-    phase2Name_(found("phases") ? wordList(lookup("phases"))[1] : "phase2"),
+    twoPhaseMixture(U.mesh(), *this, alpha1Name, alpha2Name),
 
     nuModel1_
     (
         viscosityModel::New
         (
             "nu1",
-            subDict(phase1Name_),
+            subDict(phase1Name_ == "1" ? "phase1": phase1Name_),
             U,
             phi
         )
@@ -77,7 +76,7 @@ Foam::twoPhaseMixture::twoPhaseMixture
         viscosityModel::New
         (
             "nu2",
-            subDict(phase2Name_),
+            subDict(phase2Name_ == "2" ? "phase2": phase2Name_),
             U,
             phi
         )
@@ -89,19 +88,6 @@ Foam::twoPhaseMixture::twoPhaseMixture
     U_(U),
     phi_(phi),
 
-    alpha1_
-    (
-        IOobject
-        (
-            found("phases") ? word("alpha" + phase1Name_) : alpha1Name,
-            U_.time().timeName(),
-            U_.db(),
-            IOobject::MUST_READ,
-            IOobject::AUTO_WRITE
-        ),
-        U_.mesh()
-    ),
-
     nu_
     (
         IOobject
@@ -121,7 +107,8 @@ Foam::twoPhaseMixture::twoPhaseMixture
 
 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
 
-Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixture::mu() const
+Foam::tmp<Foam::volScalarField>
+Foam::incompressibleTwoPhaseMixture::mu() const
 {
     const volScalarField limitedAlpha1
     (
@@ -140,7 +127,8 @@ Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixture::mu() const
 }
 
 
-Foam::tmp<Foam::surfaceScalarField> Foam::twoPhaseMixture::muf() const
+Foam::tmp<Foam::surfaceScalarField>
+Foam::incompressibleTwoPhaseMixture::muf() const
 {
     const surfaceScalarField alpha1f
     (
@@ -159,7 +147,8 @@ Foam::tmp<Foam::surfaceScalarField> Foam::twoPhaseMixture::muf() const
 }
 
 
-Foam::tmp<Foam::surfaceScalarField> Foam::twoPhaseMixture::nuf() const
+Foam::tmp<Foam::surfaceScalarField>
+Foam::incompressibleTwoPhaseMixture::nuf() const
 {
     const surfaceScalarField alpha1f
     (
@@ -180,7 +169,7 @@ Foam::tmp<Foam::surfaceScalarField> Foam::twoPhaseMixture::nuf() const
 }
 
 
-bool Foam::twoPhaseMixture::read()
+bool Foam::incompressibleTwoPhaseMixture::read()
 {
     if (transportModel::read())
     {
diff --git a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.H b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.H
similarity index 79%
rename from src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.H
rename to src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.H
index 025d95f7011b609c3fd3bb0bc914216b74bdaeb4..8dad6483201d619c4bda92678ab5badd5423a3ca 100644
--- a/src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.H
+++ b/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.H
@@ -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
@@ -22,23 +22,23 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
-    Foam::twoPhaseMixture
+    Foam::incompressibleTwoPhaseMixture
 
 Description
     A two-phase incompressible transportModel
 
 SourceFiles
-    twoPhaseMixture.C
+    incompressibleTwoPhaseMixture.C
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef twoPhaseMixture_H
-#define twoPhaseMixture_H
+#ifndef incompressibleTwoPhaseMixture_H
+#define incompressibleTwoPhaseMixture_H
 
 #include "incompressible/transportModel/transportModel.H"
 #include "incompressible/viscosityModels/viscosityModel/viscosityModel.H"
-#include "dimensionedScalar.H"
-#include "volFields.H"
+#include "twoPhaseMixture.H"
+
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -46,20 +46,18 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                      Class twoPhaseMixture Declaration
+                      Class incompressibleTwoPhaseMixture Declaration
 \*---------------------------------------------------------------------------*/
 
-class twoPhaseMixture
+class incompressibleTwoPhaseMixture
 :
-    public transportModel
+    public transportModel,
+    public twoPhaseMixture
 {
 protected:
 
     // Protected data
 
-        word phase1Name_;
-        word phase2Name_;
-
         autoPtr<viscosityModel> nuModel1_;
         autoPtr<viscosityModel> nuModel2_;
 
@@ -69,8 +67,6 @@ protected:
         const volVectorField& U_;
         const surfaceScalarField& phi_;
 
-        volScalarField alpha1_;
-
         volScalarField nu_;
 
 
@@ -85,43 +81,22 @@ public:
     // Constructors
 
         //- Construct from components
-        twoPhaseMixture
+        incompressibleTwoPhaseMixture
         (
             const volVectorField& U,
             const surfaceScalarField& phi,
-            const word& alpha1Name = "alpha1"
+            const word& alpha1Name = "alpha1",
+            const word& alpha2Name = "alpha2"
         );
 
 
     //- Destructor
-    ~twoPhaseMixture()
+    virtual ~incompressibleTwoPhaseMixture()
     {}
 
 
     // Member Functions
 
-        const word phase1Name() const
-        {
-            return phase1Name_;
-        }
-
-        const word phase2Name() const
-        {
-            return phase2Name_;
-        }
-
-        //- Return the phase-fraction of phase 1
-        const volScalarField& alpha1() const
-        {
-            return alpha1_;
-        }
-
-        //- Return the phase-fraction of phase 1
-        volScalarField& alpha1()
-        {
-            return alpha1_;
-        }
-
         //- Return const-access to phase1 viscosityModel
         const viscosityModel& nuModel1() const
         {
diff --git a/src/transportModels/interfaceProperties/Make/options b/src/transportModels/interfaceProperties/Make/options
index d8c038aad0cd10357720a95d41b13553cffe687d..cc63db7dcc45c854ad4a57862b1b9ad635ec5ce7 100644
--- a/src/transportModels/interfaceProperties/Make/options
+++ b/src/transportModels/interfaceProperties/Make/options
@@ -1,5 +1,8 @@
 EXE_INC = \
-    -I$(LIB_SRC)/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle \
+    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
+    -I$(LIB_SRC)/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle \
     -I$(LIB_SRC)/finiteVolume/lnInclude
 
-LIB_LIBS = -lfiniteVolume
+LIB_LIBS = \
+    -ltwoPhaseMixture \
+    -lfiniteVolume
diff --git a/src/transportModels/twoPhaseMixture/Make/files b/src/transportModels/twoPhaseMixture/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..0854ea148b38cf3c1d0139f09ab9c879d39f4a87
--- /dev/null
+++ b/src/transportModels/twoPhaseMixture/Make/files
@@ -0,0 +1,3 @@
+twoPhaseMixture/twoPhaseMixture.C
+
+LIB = $(FOAM_LIBBIN)/libtwoPhaseMixture
diff --git a/src/transportModels/twoPhaseMixture/Make/options b/src/transportModels/twoPhaseMixture/Make/options
new file mode 100644
index 0000000000000000000000000000000000000000..71b7873964d544eddf96d22aa40f4c3372c23c9c
--- /dev/null
+++ b/src/transportModels/twoPhaseMixture/Make/options
@@ -0,0 +1,5 @@
+EXE_INC = \
+    -I$(LIB_SRC)/finiteVolume/lnInclude
+
+LIB_LIBS = \
+    -lfiniteVolume
diff --git a/src/transportModels/twoPhaseMixture/twoPhaseMixture/twoPhaseMixture.C b/src/transportModels/twoPhaseMixture/twoPhaseMixture/twoPhaseMixture.C
new file mode 100644
index 0000000000000000000000000000000000000000..7b95752f370e941080c937ed016b528c2b66e089
--- /dev/null
+++ b/src/transportModels/twoPhaseMixture/twoPhaseMixture/twoPhaseMixture.C
@@ -0,0 +1,78 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "twoPhaseMixture.H"
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::twoPhaseMixture::twoPhaseMixture
+(
+    const fvMesh& mesh,
+    const dictionary& dict,
+    const word& alpha1Name,
+    const word& alpha2Name
+)
+:
+    phase1Name_
+    (
+        dict.found("phases")
+      ? wordList(dict.lookup("phases"))[0]
+      : "1"
+    ),
+    phase2Name_
+    (
+        dict.found("phases")
+      ? wordList(dict.lookup("phases"))[1]
+      : "2"
+    ),
+
+    alpha1_
+    (
+        IOobject
+        (
+            dict.found("phases") ? word("alpha" + phase1Name_) : alpha1Name,
+            mesh.time().timeName(),
+            mesh,
+            IOobject::MUST_READ,
+            IOobject::AUTO_WRITE
+        ),
+        mesh
+    ),
+
+    alpha2_
+    (
+        IOobject
+        (
+            dict.found("phases") ? word("alpha" + phase2Name_) : alpha2Name,
+            mesh.time().timeName(),
+            mesh
+        ),
+        1.0 - alpha1_
+    )
+{}
+
+
+// ************************************************************************* //
diff --git a/src/transportModels/twoPhaseMixture/twoPhaseMixture/twoPhaseMixture.H b/src/transportModels/twoPhaseMixture/twoPhaseMixture/twoPhaseMixture.H
new file mode 100644
index 0000000000000000000000000000000000000000..668c4f2cfd2161ba1987e2c6f5abfe51f62b354c
--- /dev/null
+++ b/src/transportModels/twoPhaseMixture/twoPhaseMixture/twoPhaseMixture.H
@@ -0,0 +1,127 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  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/>.
+
+Class
+    Foam::twoPhaseMixture
+
+Description
+    A two-phase mixture model
+
+SourceFiles
+    twoPhaseMixture.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef twoPhaseMixture_H
+#define twoPhaseMixture_H
+
+#include "volFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                      Class twoPhaseMixture Declaration
+\*---------------------------------------------------------------------------*/
+
+class twoPhaseMixture
+{
+protected:
+
+    // Protected data
+
+        word phase1Name_;
+        word phase2Name_;
+
+        volScalarField alpha1_;
+        volScalarField alpha2_;
+
+
+public:
+
+    // Constructors
+
+        //- Construct from components
+        twoPhaseMixture
+        (
+            const fvMesh& mesh,
+            const dictionary& dict,
+            const word& alpha1Name = "alpha1",
+            const word& alpha2Name = "alpha2"
+        );
+
+
+    //- Destructor
+    ~twoPhaseMixture()
+    {}
+
+
+    // Member Functions
+
+        const word phase1Name() const
+        {
+            return phase1Name_;
+        }
+
+        const word phase2Name() const
+        {
+            return phase2Name_;
+        }
+
+        //- Return the phase-fraction of phase 1
+        const volScalarField& alpha1() const
+        {
+            return alpha1_;
+        }
+
+        //- Return the phase-fraction of phase 1
+        volScalarField& alpha1()
+        {
+            return alpha1_;
+        }
+
+        //- Return the phase-fraction of phase 2
+        const volScalarField& alpha2() const
+        {
+            return alpha2_;
+        }
+
+        //- Return the phase-fraction of phase 2
+        volScalarField& alpha2()
+        {
+            return alpha2_;
+        }
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/transportModels/twoPhaseInterfaceProperties/Make/files b/src/transportModels/twoPhaseProperties/Make/files
similarity index 88%
rename from src/transportModels/twoPhaseInterfaceProperties/Make/files
rename to src/transportModels/twoPhaseProperties/Make/files
index 647a00e2ba05d7a9b005fe9fcb0f9a917fe00349..5457dcde52ee36829f67325f5ce4cc5f0d735762 100644
--- a/src/transportModels/twoPhaseInterfaceProperties/Make/files
+++ b/src/transportModels/twoPhaseProperties/Make/files
@@ -4,4 +4,4 @@ alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalar
 alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.C
 alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C
 
-LIB = $(FOAM_LIBBIN)/libtwoPhaseInterfaceProperties
+LIB = $(FOAM_LIBBIN)/libtwoPhaseProperties
diff --git a/src/transportModels/twoPhaseInterfaceProperties/Make/options b/src/transportModels/twoPhaseProperties/Make/options
similarity index 67%
rename from src/transportModels/twoPhaseInterfaceProperties/Make/options
rename to src/transportModels/twoPhaseProperties/Make/options
index 95f34b2845f31aade5b2f758d49704934b1afde4..32ce36b9594d8e970ba45526b49fce90d0d9fef0 100644
--- a/src/transportModels/twoPhaseInterfaceProperties/Make/options
+++ b/src/transportModels/twoPhaseProperties/Make/options
@@ -1,7 +1,9 @@
 EXE_INC = \
+    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
     -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
     -I$(LIB_SRC)/finiteVolume/lnInclude
 
 LIB_LIBS = \
+    -ltwoPhaseMixture \
     -linterfaceProperties \
     -lfiniteVolume
diff --git a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C b/src/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C
similarity index 98%
rename from src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C
rename to src/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C
index 73c962d77f85de6bd9ea6c53af21e41048cc65f5..f183641e461fe1495c87ae07fd0e361a5c813c43 100644
--- a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C
+++ b/src/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.H b/src/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.H
similarity index 98%
rename from src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.H
rename to src/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.H
index 6d1f65fe73f0c42feabea6a470be8093302116b8..95f51483fca0ea909b10347cc46be656209a68a9 100644
--- a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.H
+++ b/src/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.H
@@ -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
diff --git a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.C b/src/transportModels/twoPhaseProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.C
similarity index 98%
rename from src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.C
rename to src/transportModels/twoPhaseProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.C
index 9c84ba823a8499e657f74485d73ddde89f1a3db0..ea35d3999cfc23af7cd1d7d1ab1ae94f0726acec 100644
--- a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.C
+++ b/src/transportModels/twoPhaseProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.H b/src/transportModels/twoPhaseProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.H
similarity index 98%
rename from src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.H
rename to src/transportModels/twoPhaseProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.H
index 70fcd6ed8c59c2cc5e06067bdb4c1bc10c0b4bbb..02eaf6b352cf30b024c26a9057561693539b64f2 100644
--- a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.H
+++ b/src/transportModels/twoPhaseProperties/alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.C b/src/transportModels/twoPhaseProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.C
similarity index 98%
rename from src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.C
rename to src/transportModels/twoPhaseProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.C
index ee0d3b9aafca6d72d5996898318285c303de6218..b4a9db0062ae45939796add46cf81e95353f9c5a 100644
--- a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.C
+++ b/src/transportModels/twoPhaseProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.H b/src/transportModels/twoPhaseProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.H
similarity index 98%
rename from src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.H
rename to src/transportModels/twoPhaseProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.H
index b3768be38bcee8974d0b9a8b8bcfc97e91def854..488a7ed93af28bdd45b4c76e5c42f77aab7f6f97 100644
--- a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.H
+++ b/src/transportModels/twoPhaseProperties/alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.C b/src/transportModels/twoPhaseProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.C
similarity index 98%
rename from src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.C
rename to src/transportModels/twoPhaseProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.C
index 265f235e44abaa3fcd928e1a22f3cb1bf1b37b91..d014b1c6fcd997b8f44814186f88da599d7f7fc0 100644
--- a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.C
+++ b/src/transportModels/twoPhaseProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.H b/src/transportModels/twoPhaseProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.H
similarity index 98%
rename from src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.H
rename to src/transportModels/twoPhaseProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.H
index d52f4c821e706d28a79c5f1e97a666cf621cd1c6..de96a69eea1c2defeaf000a3438dcc75d45a79a8 100644
--- a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.H
+++ b/src/transportModels/twoPhaseProperties/alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/transportModels/twoPhaseInterfaceProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C b/src/transportModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C
similarity index 98%
rename from src/transportModels/twoPhaseInterfaceProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C
rename to src/transportModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C
index 61bd4d09c10bc48cbb9d06c85689f908bdb2ca00..e6e6ea2c10612c0c1a3a82c39c51fd484f9e1535 100644
--- a/src/transportModels/twoPhaseInterfaceProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C
+++ b/src/transportModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/transportModels/twoPhaseInterfaceProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.H b/src/transportModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.H
similarity index 98%
rename from src/transportModels/twoPhaseInterfaceProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.H
rename to src/transportModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.H
index 6186c621925d5685d482584ffc33feffb0086d77..2b9c00c0c1efed654c33bdbf5e686a883493b035 100644
--- a/src/transportModels/twoPhaseInterfaceProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.H
+++ b/src/transportModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L b/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L
index ddefb95a8542ba170526c11a022e23bf3bc5def3..3c732c1a8d7088097fa6f6b2945cc46c4e411d08 100644
--- a/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L
+++ b/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L
@@ -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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDeltaDeltaDataI.H b/src/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDeltaDeltaDataI.H
index b394efc1e5f4c53f942d8df2dbe3aa9373203b92..16fbd8b519f3fbe3827ea7469a63058c1571bf59 100644
--- a/src/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDeltaDeltaDataI.H
+++ b/src/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDeltaDeltaDataI.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-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -189,7 +189,7 @@ inline bool smoothDelta::deltaData::updateFace
 }
 
 
-template <class TrackingData>
+template<class TrackingData>
 inline bool smoothDelta::deltaData::equal
 (
     const deltaData& rhs,
diff --git a/src/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.C b/src/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.C
index 060ed5bda3c37385932ff2f3d66c33661056d263..08ce6197c6543cd4a14c4fc32790b4475091290b 100644
--- a/src/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.C
+++ b/src/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.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
@@ -66,8 +66,12 @@ Foam::anisotropicFilter::anisotropicFilter
         coeff_.internalField().replace
         (
             d,
-            (2.0/widthCoeff_)*mesh.V()
-           /fvc::surfaceSum(mag(mesh.Sf().component(d)))().internalField()
+            (1/widthCoeff_)*
+            sqr
+            (
+                2.0*mesh.V()
+               /fvc::surfaceSum(mag(mesh.Sf().component(d)))().internalField()
+            )
         );
     }
 }
@@ -99,8 +103,12 @@ Foam::anisotropicFilter::anisotropicFilter
         coeff_.internalField().replace
         (
             d,
-            (2.0/widthCoeff_)*mesh.V()
-            /fvc::surfaceSum(mag(mesh.Sf().component(d)))().internalField()
+            (1/widthCoeff_)*
+            sqr
+            (
+                2.0*mesh.V()
+               /fvc::surfaceSum(mag(mesh.Sf().component(d)))().internalField()
+            )
         );
     }
 }
diff --git a/src/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.C b/src/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.C
index 231ae2737fa9023a643ef57b2f8606652ba21343..24db120ffa99b37c454e06e473b8780f30c29ffc 100644
--- a/src/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.C
+++ b/src/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -57,7 +57,7 @@ Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, scalar widthCoeff)
         calculatedFvPatchScalarField::typeName
     )
 {
-    coeff_.internalField() = pow(mesh.V(), 2.0/3.0)/widthCoeff_;
+    coeff_.dimensionedInternalField() = pow(mesh.V(), 2.0/3.0)/widthCoeff_;
 }
 
 
@@ -78,7 +78,7 @@ Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, const dictionary& bd)
         calculatedFvPatchScalarField::typeName
     )
 {
-    coeff_.internalField() = pow(mesh.V(), 2.0/3.0)/widthCoeff_;
+    coeff_.dimensionedInternalField() = pow(mesh.V(), 2.0/3.0)/widthCoeff_;
 }
 
 
diff --git a/src/turbulenceModels/compressible/LES/DESModel/DESModel.H b/src/turbulenceModels/compressible/LES/DESModel/DESModel.H
index 9832c4de389aec12ac2926edf54423fe7624c952..bf0532e03ae92b55893677b668a47179ceb3876f 100644
--- a/src/turbulenceModels/compressible/LES/DESModel/DESModel.H
+++ b/src/turbulenceModels/compressible/LES/DESModel/DESModel.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,12 +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/>.
 
-Group
-    grpCmpDESTurbulence
-
 Class
     Foam::compressible::DESModel
 
+Group
+    grpCmpDESTurbulence
+
 Description
     Extension of LES models to provide an interface for Detached Eddy
     Simulation turbulence models
diff --git a/src/turbulenceModels/compressible/LES/homogeneousDynOneEqEddy/homogeneousDynOneEqEddy.C b/src/turbulenceModels/compressible/LES/homogeneousDynOneEqEddy/homogeneousDynOneEqEddy.C
index df84d4fe8984113ce67418817a21d43a8f1dfe14..7b146b89a1053549968b116a23ec262ec6ae80f8 100644
--- a/src/turbulenceModels/compressible/LES/homogeneousDynOneEqEddy/homogeneousDynOneEqEddy.C
+++ b/src/turbulenceModels/compressible/LES/homogeneousDynOneEqEddy/homogeneousDynOneEqEddy.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
@@ -145,7 +145,7 @@ void homogeneousDynOneEqEddy::correct(const tmp<volTensorField>& tgradU)
 
     volSymmTensorField D(dev(symm(gradU)));
     volScalarField divU(fvc::div(phi()/fvc::interpolate(rho())));
-    volScalarField G(type() + ".G", 2*muSgs_*(gradU && D));
+    volScalarField G(GName(), 2*muSgs_*(gradU && D));
 
     tmp<fvScalarMatrix> kEqn
     (
diff --git a/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.C b/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.C
index c811874e73dd12f165345959ad0b3631b93ac47e..704daaa48987c0e90d02a798a4fe28d150296770 100644
--- a/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.C
+++ b/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.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
@@ -118,7 +118,7 @@ void lowReOneEqEddy::correct(const tmp<volTensorField>& tgradU)
     GenEddyVisc::correct(gradU);
 
     volScalarField divU(fvc::div(phi()/fvc::interpolate(rho())));
-    volScalarField G(type() + ".G", 2*muSgs_*(gradU && dev(symm(gradU))));
+    volScalarField G(GName(), 2*muSgs_*(gradU && dev(symm(gradU))));
 
     tmp<fvScalarMatrix> kEqn
     (
diff --git a/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.C b/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.C
index 9b2f0319f67a6d1cfac998f74d96a758c857b1a3..537e98ecf76522a1142749a9c005125516a9ed79 100644
--- a/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.C
+++ b/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.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
@@ -105,7 +105,7 @@ void oneEqEddy::correct(const tmp<volTensorField>& tgradU)
     GenEddyVisc::correct(gradU);
 
     volScalarField divU(fvc::div(phi()/fvc::interpolate(rho())));
-    volScalarField G(type() + ".G", 2*muSgs_*(gradU && dev(symm(gradU))));
+    volScalarField G(GName(), 2*muSgs_*(gradU && dev(symm(gradU))));
 
     tmp<fvScalarMatrix> kEqn
     (
diff --git a/src/turbulenceModels/compressible/RAS/LRR/LRR.C b/src/turbulenceModels/compressible/RAS/LRR/LRR.C
index 0a36879bc463eccf04655830a091d8b5610783a3..e17052df0e04eed077a6bbd53d8f70c601aaf56e 100644
--- a/src/turbulenceModels/compressible/RAS/LRR/LRR.C
+++ b/src/turbulenceModels/compressible/RAS/LRR/LRR.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
@@ -342,7 +342,7 @@ void LRR::correct()
     RASModel::correct();
 
     volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_)));
-    volScalarField G(type() + ".G", 0.5*mag(tr(P)));
+    volScalarField G(GName(), 0.5*mag(tr(P)));
 
     // Update epsilon and G at the wall
     epsilon_.boundaryField().updateCoeffs();
diff --git a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C
index dafa58ebb3a01f0ece2dc059639d47bcec3e9c13..7c6bfb41d372e48ca7b76fc14852d6aca5482390 100644
--- a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C
+++ b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.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
@@ -379,7 +379,7 @@ void LaunderGibsonRSTM::correct()
     }
 
     volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_)));
-    volScalarField G(type() + ".G", 0.5*mag(tr(P)));
+    volScalarField G(GName(), 0.5*mag(tr(P)));
 
     // Update epsilon and G at the wall
     epsilon_.boundaryField().updateCoeffs();
diff --git a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C
index 8a1073e354a84152a11c04cf95781ec6801bd86e..6a7d0a1abd9ec3961d082fd51d48e426ff3ba9ba 100644
--- a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C
+++ b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.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
@@ -304,7 +304,7 @@ void LaunderSharmaKE::correct()
     }
 
     tmp<volTensorField> tgradU = fvc::grad(U_);
-    volScalarField G(type() + ".G", mut_*(tgradU() && dev(twoSymm(tgradU()))));
+    volScalarField G(GName(), mut_*(tgradU() && dev(twoSymm(tgradU()))));
     tgradU.clear();
 
 
diff --git a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H
index 8bfa031882b1cdb9c1834f7ed15ac56483b69780..6780860b8719a6ba1bd71cda939aa704e5d9d782 100644
--- a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H
+++ b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H
@@ -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
@@ -233,8 +233,7 @@ public:
         //- Return the effective turbulent temperature diffusivity for a patch
         virtual tmp<scalarField> kappaEff(const label patchI) const
         {
-            return
-                thermo().kappaEff(alphat()().boundaryField()[patchI], patchI);
+            return thermo().kappaEff(alphat(patchI), patchI);
         }
 
         //- Return the effective turbulent thermal diffusivity
@@ -246,8 +245,7 @@ public:
         //- Return the effective turbulent thermal diffusivity for a patch
         virtual tmp<scalarField> alphaEff(const label patchI) const
         {
-            return
-                thermo().alphaEff(alphat()().boundaryField()[patchI], patchI);
+            return thermo().alphaEff(alphat(patchI), patchI);
         }
 
         //- Solve the turbulence equations and correct the turbulence viscosity
diff --git a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C
index 56192780098ec1ee47e4eeed497bb4712c116235..58ad1f571e2a1c83c1269a5f433d37291eea79f3 100644
--- a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C
+++ b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.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
@@ -303,7 +303,7 @@ void RNGkEpsilon::correct()
     volScalarField S2((tgradU() && dev(twoSymm(tgradU()))));
     tgradU.clear();
 
-    volScalarField G(type() + ".G", mut_*S2);
+    volScalarField G(GName(), mut_*S2);
 
     volScalarField eta(sqrt(mag(S2))*k_/epsilon_);
     volScalarField eta3(eta*sqr(eta));
diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C
index 279897e833d0376e4abb090cc4a40ce317626b43..84762e6beb400c93c25feae964dba067d2198489 100644
--- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C
+++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -139,7 +139,7 @@ void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs()
         (
             db().lookupObject<volScalarField>
             (
-                turbulence.type() + ".G"
+                turbulence.GName()
             )
         );
 
diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C
index 88b91c0513923c12d5cbf0d96fcc62fb62fa021d..dc6296f2ed64ad746fb3cc2e68fbaaff2312ecbf 100644
--- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C
+++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.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
@@ -165,7 +165,7 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
         (
             db().lookupObject<volScalarField>
             (
-                turbulence.type() + ".G"
+                turbulence.GName()
             )
         );
 
diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C
index e95a4d9bf7b92e61eda664157df89c901d9bcd6c..a826fdf5e3bc76bb9b013b03b4cfec6f63c367e6 100644
--- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C
+++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.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
@@ -175,7 +175,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
         (
             db().lookupObject<volScalarField>
             (
-                turbulence.type() + ".G"
+                turbulence.GName()
             )
         );
 
diff --git a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C
index 93e902cfe406c029932c460dc201d45f42783bc4..a4089610ce35f89784bb2ee74d6f16ad84306b68 100644
--- a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C
+++ b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.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
@@ -281,7 +281,7 @@ void kEpsilon::correct()
     }
 
     tmp<volTensorField> tgradU = fvc::grad(U_);
-    volScalarField G(type() + ".G", mut_*(tgradU() && dev(twoSymm(tgradU()))));
+    volScalarField G(GName(), mut_*(tgradU() && dev(twoSymm(tgradU()))));
     tgradU.clear();
 
     // Update epsilon and G at the wall
diff --git a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C
index 321c07443b1297f776ac6b0d4580ef8e09b4baa2..134b05852b1db86e1b2bc66bdb4f14df3b804f59 100644
--- a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C
+++ b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.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
@@ -437,7 +437,7 @@ void kOmegaSST::correct()
     tmp<volTensorField> tgradU = fvc::grad(U_);
     volScalarField S2(2*magSqr(symm(tgradU())));
     volScalarField GbyMu((tgradU() && dev(twoSymm(tgradU()))));
-    volScalarField G(type() + ".G", mut_*GbyMu);
+    volScalarField G(GName(), mut_*GbyMu);
     tgradU.clear();
 
     // Update omega and G at the wall
diff --git a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C
index 4d3e8cf94b9afdee89c537b25528cf473d37176b..c9b5c36742c27716f170bb14ac3f22587e1a318d 100644
--- a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C
+++ b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.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
@@ -321,7 +321,7 @@ void realizableKE::correct()
     volScalarField eta(magS*k_/epsilon_);
     volScalarField C1(max(eta/(scalar(5) + eta), scalar(0.43)));
 
-    volScalarField G(type() + ".G", mut_*(gradU && dev(twoSymm(gradU))));
+    volScalarField G(GName(), mut_*(gradU && dev(twoSymm(gradU))));
 
     // Update epsilon and G at the wall
     epsilon_.boundaryField().updateCoeffs();
diff --git a/src/turbulenceModels/compressible/RAS/v2f/v2f.C b/src/turbulenceModels/compressible/RAS/v2f/v2f.C
index 36e04932d713adff2b5f5b1d5e7d33c9c8415bcf..ec0c37363ddb6b511b0728d31a9d4480df523ba5 100644
--- a/src/turbulenceModels/compressible/RAS/v2f/v2f.C
+++ b/src/turbulenceModels/compressible/RAS/v2f/v2f.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) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -398,7 +398,7 @@ void v2f::correct()
     const volTensorField gradU(fvc::grad(U_));
     const volScalarField S2(2*magSqr(dev(symm(gradU))));
 
-    const volScalarField G(type() + ".G", mut_*S2);
+    const volScalarField G(GName(), mut_*S2);
     const volScalarField T(Ts());
     const volScalarField L2("v2f.L2", sqr(Ls()));
     const volScalarField alpha
@@ -406,9 +406,11 @@ void v2f::correct()
         "v2f::alpha",
         1.0/T*((C1_ - N)*v2_ - 2.0/3.0*k_*(C1_ - 1.0))
     );
-
-    tmp<volScalarField> Ceps1 =
-        1.4*(1.0 + 0.05*min(sqrt(k_/v2_), scalar(100.0)));
+    const volScalarField Ceps1
+    (
+        "Ceps1",
+        1.4*(1.0 + 0.05*min(sqrt(k_/v2_), scalar(100.0)))
+    );
 
     // Update epsilon (and possibly G) at the wall
     epsilon_.boundaryField().updateCoeffs();
@@ -420,7 +422,7 @@ void v2f::correct()
       + fvm::div(phi_, epsilon_)
       - fvm::laplacian(DepsilonEff(), epsilon_)
      ==
-        Ceps1()*G/T
+        Ceps1*G/T
       - fvm::SuSp(((2.0/3.0)*Ceps1 + Ceps3_)*rho_*divU, epsilon_)
       - fvm::Sp(Ceps2_*rho_/T, epsilon_)
     );
diff --git a/src/turbulenceModels/compressible/RAS/v2f/v2f.H b/src/turbulenceModels/compressible/RAS/v2f/v2f.H
index 5b68a605d9c1b73046e5c2cee7ddd6b478882a03..ce53c248b8cd354244da21c370f580b892ef01fc 100644
--- a/src/turbulenceModels/compressible/RAS/v2f/v2f.H
+++ b/src/turbulenceModels/compressible/RAS/v2f/v2f.H
@@ -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) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -39,7 +39,7 @@ Description
 
         k       = kLowReWallFunction
         epsilon = epsilonLowReWallFunction
-        v2      = v2WalLFunction
+        v2      = v2WallFunction
         f       = fWallFunction
 
     These are applicable to both low- and high-Reynolds number flows.
diff --git a/src/turbulenceModels/compressible/turbulenceModel/Make/files b/src/turbulenceModels/compressible/turbulenceModel/Make/files
index e089735210054addf0e20ed8016f93eb256c6d8c..412045016a7b70f6f4f8dc5e1913e5eaed45fa0a 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/Make/files
+++ b/src/turbulenceModels/compressible/turbulenceModel/Make/files
@@ -4,10 +4,12 @@ laminar/laminar.C
 derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C
 derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C
 derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C
-derivedFvPatchFields/thermoBaffle1D/thermoBaffle1DFvPatchScalarFields.C
+derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.C
 derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C
 derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C
 derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C
+derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
 
+derivedFvPatchFields/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C
 
 LIB = $(FOAM_LIBBIN)/libcompressibleTurbulenceModel
diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C
new file mode 100644
index 0000000000000000000000000000000000000000..0b656b20ac001ce6ccb1f748933492ff9758f0d7
--- /dev/null
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C
@@ -0,0 +1,263 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "externalCoupledTemperatureMixedFvPatchScalarField.H"
+#include "addToRunTimeSelectionTable.H"
+#include "fvPatchFieldMapper.H"
+#include "volFields.H"
+#include "OFstream.H"
+#include "turbulenceModel.H"
+
+// * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
+
+void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeHeader
+(
+    OFstream& os
+) const
+{
+    os  << "# Values: magSf value qDot htc" << endl;
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::externalCoupledTemperatureMixedFvPatchScalarField::
+externalCoupledTemperatureMixedFvPatchScalarField
+(
+    const fvPatch& p,
+    const DimensionedField<scalar, volMesh>& iF
+)
+:
+    externalCoupledMixedFvPatchField<scalar>(p, iF)
+{}
+
+
+Foam::externalCoupledTemperatureMixedFvPatchScalarField::
+externalCoupledTemperatureMixedFvPatchScalarField
+(
+    const externalCoupledTemperatureMixedFvPatchScalarField& ptf,
+    const fvPatch& p,
+    const DimensionedField<scalar, volMesh>& iF,
+    const fvPatchFieldMapper& mapper
+)
+:
+    externalCoupledMixedFvPatchField<scalar>(ptf, p, iF, mapper)
+{}
+
+
+Foam::externalCoupledTemperatureMixedFvPatchScalarField::
+externalCoupledTemperatureMixedFvPatchScalarField
+(
+    const fvPatch& p,
+    const DimensionedField<scalar, volMesh>& iF,
+    const dictionary& dict
+)
+:
+    externalCoupledMixedFvPatchField<scalar>(p, iF, dict)
+{}
+
+
+Foam::externalCoupledTemperatureMixedFvPatchScalarField::
+externalCoupledTemperatureMixedFvPatchScalarField
+(
+    const externalCoupledTemperatureMixedFvPatchScalarField& ecmpf
+)
+:
+    externalCoupledMixedFvPatchField<scalar>(ecmpf)
+{}
+
+
+Foam::externalCoupledTemperatureMixedFvPatchScalarField::
+externalCoupledTemperatureMixedFvPatchScalarField
+(
+    const externalCoupledTemperatureMixedFvPatchScalarField& ecmpf,
+    const DimensionedField<scalar, volMesh>& iF
+)
+:
+    externalCoupledMixedFvPatchField<scalar>(ecmpf, iF)
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::externalCoupledTemperatureMixedFvPatchScalarField::
+~externalCoupledTemperatureMixedFvPatchScalarField()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::externalCoupledTemperatureMixedFvPatchScalarField::transferData
+(
+    OFstream& os
+) const
+{
+    if (log())
+    {
+        Info<< type() << ": writing data to " << os.name() << endl;
+    }
+
+    const label patchI = patch().index();
+
+    // heat flux [W/m2]
+    scalarField qDot(this->patch().size(), 0.0);
+
+    typedef compressible::turbulenceModel cmpTurbModelType;
+    static word turbName("turbulenceModel");
+    static word thermoName("thermophysicalProperties");
+
+    if (db().foundObject<cmpTurbModelType>(turbName))
+    {
+        const cmpTurbModelType& turbModel =
+            db().lookupObject<cmpTurbModelType>(turbName);
+
+        const basicThermo& thermo = turbModel.thermo();
+
+        const fvPatchScalarField& hep = thermo.he().boundaryField()[patchI];
+
+        qDot = turbModel.alphaEff(patchI)*hep.snGrad();
+    }
+    else if (db().foundObject<basicThermo>(thermoName))
+    {
+        const basicThermo& thermo = db().lookupObject<basicThermo>(thermoName);
+
+        const fvPatchScalarField& hep = thermo.he().boundaryField()[patchI];
+
+        qDot = thermo.alpha().boundaryField()[patchI]*hep.snGrad();
+    }
+    else
+    {
+        FatalErrorIn
+        (
+            "void Foam::externalCoupledTemperatureMixedFvPatchScalarField::"
+            "writeData"
+            "("
+                "const fileName& transferFile"
+            ") const"
+        )   << "Condition requires either compressibke turbulence and/or "
+            << "thermo model to be available" << exit(FatalError);
+    }
+
+    // patch temperature [K]
+    const scalarField Tp(*this);
+
+    // near wall cell temperature [K]
+    const scalarField Tc(patchInternalField());
+
+    // heat transfer coefficient [W/m2/K]
+    const scalarField htc(qDot/(Tp - Tc + ROOTVSMALL));
+
+    if (Pstream::parRun())
+    {
+        int tag = Pstream::msgType() + 1;
+
+        List<Field<scalar> > magSfs(Pstream::nProcs());
+        magSfs[Pstream::myProcNo()].setSize(this->patch().size());
+        magSfs[Pstream::myProcNo()] = this->patch().magSf();
+        Pstream::gatherList(magSfs, tag);
+
+        List<Field<scalar> > values(Pstream::nProcs());
+        values[Pstream::myProcNo()].setSize(this->patch().size());
+        values[Pstream::myProcNo()] = Tp;
+        Pstream::gatherList(values, tag);
+
+        List<Field<scalar> > qDots(Pstream::nProcs());
+        qDots[Pstream::myProcNo()].setSize(this->patch().size());
+        qDots[Pstream::myProcNo()] = qDot;
+        Pstream::gatherList(qDots, tag);
+
+        List<Field<scalar> > htcs(Pstream::nProcs());
+        htcs[Pstream::myProcNo()].setSize(this->patch().size());
+        htcs[Pstream::myProcNo()] = htc;
+        Pstream::gatherList(htcs, tag);
+
+        if (Pstream::master())
+        {
+            forAll(values, procI)
+            {
+                const Field<scalar>& magSf = magSfs[procI];
+                const Field<scalar>& value = values[procI];
+                const Field& qDot = qDots[procI];
+                const Field& htc = htcs[procI];
+
+                forAll(magSf, faceI)
+                {
+                    os  << magSf[faceI] << token::SPACE
+                        << value[faceI] << token::SPACE
+                        << qDot[faceI] << token::SPACE
+                        << htc[faceI] << token::SPACE
+                        << nl;
+                }
+            }
+
+            os.flush();
+        }
+    }
+    else
+    {
+        const Field<scalar>& magSf(this->patch().magSf());
+
+        forAll(patch(), faceI)
+        {
+            os  << magSf[faceI] << token::SPACE
+                << Tp[faceI] << token::SPACE
+                << qDot[faceI] << token::SPACE
+                << htc[faceI] << token::SPACE
+                << nl;
+        }
+
+        os.flush();
+    }
+}
+
+
+void Foam::externalCoupledTemperatureMixedFvPatchScalarField::updateCoeffs()
+{
+    externalCoupledMixedFvPatchField<scalar>::updateCoeffs();
+}
+
+
+void Foam::externalCoupledTemperatureMixedFvPatchScalarField::write
+(
+    Ostream& os
+) const
+{
+    externalCoupledMixedFvPatchField<scalar>::write(os);
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    makePatchTypeField
+    (
+        fvPatchScalarField,
+        externalCoupledTemperatureMixedFvPatchScalarField
+    );
+}
+
+
+// ************************************************************************* //
diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.H
new file mode 100644
index 0000000000000000000000000000000000000000..906f878ed831dc47be49c53047e407a5a5f9e575
--- /dev/null
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.H
@@ -0,0 +1,243 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 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/>.
+
+Class
+    Foam::externalCoupledTemperatureMixedFvPatchScalarField
+
+Group
+    grpCoupledBoundaryConditions
+
+Description
+    This boundary condition provides a temperatue interface to an external
+    application.  Values are transferred as plain text files, where OperFOAM
+    data is written as:
+
+        # Patch: <patch name>
+        <magSf1> <value1> <qDot1> <htc1>
+        <magSf2> <value2> <qDot2> <htc2>
+        <magSf3> <value3> <qDot3> <htc2>
+        ...
+        <magSfN> <valueN> <qDotN> <htcN>
+
+    and received as the constituent pieces of the `mixed' condition, i.e.
+
+        # Patch: <patch name>
+        <value1> <gradient1> <valueFracion1>
+        <value2> <gradient2> <valueFracion2>
+        <value3> <gradient3> <valueFracion3>
+        ...
+        <valueN> <gradientN> <valueFracionN>
+
+    Data is either sent/received as one file per patch, or as a single file
+    for all patches, based on the \c collate flag.  In the former case, the
+    folder used for communications is:
+
+        $FOAM_CASE/<commsDir>/patchName
+
+    and when using the \c collate option:
+
+        $FOAM_CASE/<commsDir>
+
+    At start-up, the boundary creates a lock file, i.e..
+
+        OpenFOAM.lock
+
+    ... to signal the external source to wait.  During the boundary condition
+    update, boundary values are written to file, e.g.
+
+        <fileName>.out
+
+    The lock file is then removed, instructing the external source to take
+    control of the program execution.  When ready, the external program
+    should create the return values, e.g. to file
+
+        <fileName>.in
+
+    ... and then re-instate the lock file.  The boundary condition will then
+    read the return values, and pass program execution back to OpenFOAM.
+
+
+    \heading Patch usage
+
+    \table
+        Property     | Description             | Required    | Default value
+        commsDir     | communications folder   | yes         |
+        fileName     | transfer file name      | yes         |
+        collate      | collate all patch data into single file | yes |
+        waitInterval | interval [s] between file checks | no | 1
+        timeOut      | time after which error invoked [s] |no |100*waitInterval
+        calcFrequency | calculation frequency  | no          | 1
+        log          | log program control     | no          | no
+    \endtable
+
+    Example of the boundary condition specification:
+    \verbatim
+    myPatch
+    {
+        type            externalCoupledTemperature;
+        commsDir        "$FOAM_CASE/comms";
+        fileName        data;
+        collate         yes;
+        calcFrequency   1;
+    }
+    \endverbatim
+
+SeeAlso
+    mixedFvPatchField
+    externalCoupledMixedFvPatchField
+
+SourceFiles
+    externalCoupledTemperatureMixedFvPatchScalarField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef externalCoupledTemperatureMixedFvPatchScalarField_H
+#define externalCoupledTemperatureMixedFvPatchScalarField_H
+
+#include "externalCoupledMixedFvPatchFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+class IFstream;
+
+/*---------------------------------------------------------------------------*\
+     Class externalCoupledTemperatureMixedFvPatchScalarField Declaration
+\*---------------------------------------------------------------------------*/
+
+class externalCoupledTemperatureMixedFvPatchScalarField
+:
+    public externalCoupledMixedFvPatchField<scalar>
+{
+
+protected:
+
+    // Protected Member Functions
+
+        //- Write header to transfer file
+        virtual void writeHeader(OFstream& os) const;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("externalCoupledTemperature");
+
+
+    // Constructors
+
+        //- Construct from patch and internal field
+        externalCoupledTemperatureMixedFvPatchScalarField
+        (
+            const fvPatch&,
+            const DimensionedField<scalar, volMesh>&
+        );
+
+        //- Construct from patch, internal field and dictionary
+        externalCoupledTemperatureMixedFvPatchScalarField
+        (
+            const fvPatch&,
+            const DimensionedField<scalar, volMesh>&,
+            const dictionary&
+        );
+
+        //- Construct by mapping given
+        //  externalCoupledTemperatureMixedFvPatchScalarField onto a new patch
+        externalCoupledTemperatureMixedFvPatchScalarField
+        (
+            const externalCoupledTemperatureMixedFvPatchScalarField&,
+            const fvPatch&,
+            const DimensionedField<scalar, volMesh>&,
+            const fvPatchFieldMapper&
+        );
+
+        //- Construct as copy
+        externalCoupledTemperatureMixedFvPatchScalarField
+        (
+            const externalCoupledTemperatureMixedFvPatchScalarField&
+        );
+
+        //- Construct and return a clone
+        virtual tmp<fvPatchField<scalar> > clone() const
+        {
+            return tmp<fvPatchField<scalar> >
+            (
+                new externalCoupledTemperatureMixedFvPatchScalarField(*this)
+            );
+        }
+
+        //- Construct as copy setting internal field reference
+        externalCoupledTemperatureMixedFvPatchScalarField
+        (
+            const externalCoupledTemperatureMixedFvPatchScalarField&,
+            const DimensionedField<scalar, volMesh>&
+        );
+
+        //- Construct and return a clone setting internal field reference
+        virtual tmp<fvPatchField<scalar> > clone
+        (
+            const DimensionedField<scalar, volMesh>& iF
+        ) const
+        {
+            return tmp<fvPatchField<scalar> >
+            (
+                new externalCoupledTemperatureMixedFvPatchScalarField
+                (
+                    *this,
+                    iF
+                )
+            );
+        }
+
+
+    //- Destructor
+    virtual ~externalCoupledTemperatureMixedFvPatchScalarField();
+
+
+    // Member functions
+
+        // Evaluation functions
+
+            //- Update the coefficients associated with the patch field
+            virtual void updateCoeffs();
+
+            //- Transfer data for external source
+            virtual void transferData(OFstream& os) const;
+
+
+        //- Write
+        virtual void write(Ostream&) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C
index ba9416b6ed4a958e8c7b4705965464e48f5df1f4..8446d56e1bd756bb5ee1881bc253200b8554e0ad 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.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
@@ -65,7 +65,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
 :
     mixedFvPatchScalarField(p, iF),
     temperatureCoupledBase(patch(), "undefined", "undefined-K"),
-    oldMode_(unknown),
+    mode_(unknown),
     q_(p.size(), 0.0),
     h_(p.size(), 0.0),
     Ta_(p.size(), 0.0)
@@ -87,7 +87,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
 :
     mixedFvPatchScalarField(ptf, p, iF, mapper),
     temperatureCoupledBase(patch(), ptf.KMethod(), ptf.kappaName()),
-    oldMode_(ptf.oldMode_),
+    mode_(ptf.mode_),
     q_(ptf.q_, mapper),
     h_(ptf.h_, mapper),
     Ta_(ptf.Ta_, mapper)
@@ -104,19 +104,19 @@ externalWallHeatFluxTemperatureFvPatchScalarField
 :
     mixedFvPatchScalarField(p, iF),
     temperatureCoupledBase(patch(), dict),
-    oldMode_(unknown),
+    mode_(unknown),
     q_(p.size(), 0.0),
     h_(p.size(), 0.0),
     Ta_(p.size(), 0.0)
 {
     if (dict.found("q") && !dict.found("h") && !dict.found("Ta"))
     {
-        oldMode_ = fixedHeatFlux;
+        mode_ = fixedHeatFlux;
         q_ = scalarField("q", dict, p.size());
     }
     else if (dict.found("h") && dict.found("Ta") && !dict.found("q"))
     {
-        oldMode_ = fixedHeatTransferCoeff;
+        mode_ = fixedHeatTransferCoeff;
         h_ = scalarField("h", dict, p.size());
         Ta_ = scalarField("Ta", dict, p.size());
     }
@@ -166,7 +166,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
 :
     mixedFvPatchScalarField(tppsf),
     temperatureCoupledBase(tppsf),
-    oldMode_(tppsf.oldMode_),
+    mode_(tppsf.mode_),
     q_(tppsf.q_),
     h_(tppsf.h_),
     Ta_(tppsf.Ta_)
@@ -182,7 +182,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
 :
     mixedFvPatchScalarField(tppsf, iF),
     temperatureCoupledBase(patch(), tppsf.KMethod(), tppsf.kappaName()),
-    oldMode_(tppsf.oldMode_),
+    mode_(tppsf.mode_),
     q_(tppsf.q_),
     h_(tppsf.h_),
     Ta_(tppsf.Ta_)
@@ -191,6 +191,35 @@ externalWallHeatFluxTemperatureFvPatchScalarField
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::autoMap
+(
+    const fvPatchFieldMapper& m
+)
+{
+    mixedFvPatchScalarField::autoMap(m);
+    q_.autoMap(m);
+    h_.autoMap(m);
+    Ta_.autoMap(m);
+}
+
+
+void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::rmap
+(
+    const fvPatchScalarField& ptf,
+    const labelList& addr
+)
+{
+    mixedFvPatchScalarField::rmap(ptf, addr);
+
+    const externalWallHeatFluxTemperatureFvPatchScalarField& tiptf =
+        refCast<const externalWallHeatFluxTemperatureFvPatchScalarField>(ptf);
+
+    q_.rmap(tiptf.q_, addr);
+    h_.rmap(tiptf.h_, addr);
+    Ta_.rmap(tiptf.Ta_, addr);
+}
+
+
 void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
 {
     if (updated())
@@ -199,39 +228,45 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
     }
 
     scalarField q(size(), 0.0);
-    scalarField KWall(kappa(*this));
-    scalarField KDelta(KWall*patch().deltaCoeffs());
+    const scalarField Tc(patchInternalField());
+    const scalarField KWall(kappa(*this));
+    const scalarField KDelta(KWall*patch().deltaCoeffs());
 
-    if (oldMode_ == fixedHeatFlux)
+    switch (mode_)
     {
-        q = q_;
-    }
-    else if (oldMode_ == fixedHeatTransferCoeff)
-    {
-        q = (Ta_ - *this)*h_;
-    }
-    else
-    {
-        FatalErrorIn
-        (
-            "externalWallHeatFluxTemperatureFvPatchScalarField"
-            "::updateCoeffs()"
-        )   << "Illegal heat flux mode " << operationModeNames[oldMode_]
-            << exit(FatalError);
+        case fixedHeatFlux:
+        {
+            q = q_;
+            break;
+        }
+        case fixedHeatTransferCoeff:
+        {
+            q = (Ta_ - Tc)*h_;
+            break;
+        }
+        default:
+        {
+            FatalErrorIn
+            (
+                "externalWallHeatFluxTemperatureFvPatchScalarField"
+                "::updateCoeffs()"
+            )   << "Illegal heat flux mode " << operationModeNames[mode_]
+                << exit(FatalError);
+        }
     }
 
-    forAll (*this, i)
+    forAll(*this, i)
     {
         if (q[i] > 0) //in
         {
-            this->refGrad()[i] = q[i]/kappa(*this)()[i];
+            this->refGrad()[i] = q[i]/KWall[i];
             this->refValue()[i] = 0.0;
             this->valueFraction()[i] = 0.0;
         }
         else //out
         {
             this->refGrad()[i] = 0.0;
-            this->refValue()[i] = q[i]/KDelta[i] + patchInternalField()()[i];
+            this->refValue()[i] = q[i]/KDelta[i] + Tc[i];
             this->valueFraction()[i] = 1.0;
         }
     }
@@ -262,7 +297,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write
 {
     mixedFvPatchScalarField::write(os);
     temperatureCoupledBase::write(os);
-    switch (oldMode_)
+    switch (mode_)
     {
         case fixedHeatFlux:
         {
@@ -283,7 +318,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write
                 "("
                     "Ostream& os"
                 ") const"
-            )   << "Illegal heat flux mode " << operationModeNames[oldMode_]
+            )   << "Illegal heat flux mode " << operationModeNames[mode_]
                 << abort(FatalError);
         }
     }
diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H
index 44e96635bacdf6056c9b724dff868e8660977e9a..109a94a2062ac7b66ee3891e2f60465b1387339d 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H
@@ -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
@@ -102,7 +102,7 @@ private:
     // Private data
 
         //- Operation mode
-        operationMode oldMode_;
+        operationMode mode_;
 
         //- Heat flux / [W/m2]
         scalarField q_;
@@ -185,6 +185,22 @@ public:
 
     // Member functions
 
+        // Mapping functions
+
+            //- Map (and resize as needed) from self given a mapping object
+            virtual void autoMap
+            (
+                const fvPatchFieldMapper&
+            );
+
+            //- Reverse map the given fvPatchField onto this fvPatchField
+            virtual void rmap
+            (
+                const fvPatchScalarField&,
+                const labelList&
+            );
+
+
         // Evaluation functions
 
             //- Update the coefficients associated with the patch field
diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C
index 14448ca71c8da21e63bc17d3348041afb45f48b6..81528a07ded6e505eb0562d51e1df542c59e540e 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C
@@ -1,8 +1,8 @@
-/*---------------------------------------------------------------------------*\
+ /*---------------------------------------------------------------------------*\
   =========                 |
   \\      /  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
@@ -25,9 +25,9 @@ License
 
 #include "temperatureCoupledBase.H"
 #include "volFields.H"
+#include "fluidThermo.H"
 #include "solidThermo.H"
 #include "turbulenceModel.H"
-#include "fluidThermo.H"
 
 // * * * * * * * * * * * * * Static Member Data  * * * * * * * * * * * * * * //
 
@@ -90,19 +90,39 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
 
     switch (method_)
     {
-        case BASICTHERMO:
+        case mtFluidThermo:
         {
-            const compressible::turbulenceModel& model =
-                mesh.lookupObject<compressible::turbulenceModel>
+            typedef compressible::turbulenceModel turbulenceModel;
+
+            if (mesh.foundObject<turbulenceModel>("turbulenceModel"))
+            {
+                const turbulenceModel& turbModel =
+                    mesh.lookupObject<turbulenceModel>("turbulenceModel");
+
+                return turbModel.kappaEff(patch_.index());
+            }
+            else if (mesh.foundObject<fluidThermo>("thermophysicalProperties"))
+            {
+                const fluidThermo& thermo =
+                    mesh.lookupObject<fluidThermo>("thermophysicalProperties");
+
+                return thermo.kappa(patch_.index());
+            }
+            else
+            {
+                FatalErrorIn
                 (
-                    "turbulenceModel"
-                );
+                    "temperatureCoupledBase::kappa(const scalarField&) const"
+                )
+                    << "Kappa defined to employ " << KMethodTypeNames_[method_]
+                    << " method, but thermo package not available"
+                    << exit(FatalError);
+            }
 
-            return model.kappaEff(patch_.index());
             break;
         }
 
-        case SOLIDTHERMO:
+        case mtSolidThermo:
         {
             const solidThermo& thermo =
                 mesh.lookupObject<solidThermo>("thermophysicalProperties");
@@ -111,7 +131,7 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
             break;
         }
 
-        case DIRECTIONALSOLIDTHERMO:
+        case mtDirectionalSolidThermo:
         {
             const solidThermo& thermo =
                 mesh.lookupObject<solidThermo>("thermophysicalProperties");
@@ -129,22 +149,16 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
             break;
         }
 
-        case LOOKUP:
+        case mtLookup:
         {
-            if (mesh.objectRegistry::foundObject<volScalarField>(kappaName_))
+            if (mesh.foundObject<volScalarField>(kappaName_))
             {
                 return patch_.lookupPatchField<volScalarField, scalar>
                 (
                     kappaName_
                 );
             }
-            else if
-            (
-                mesh.objectRegistry::foundObject<volSymmTensorField>
-                (
-                    kappaName_
-                )
-            )
+            else if (mesh.foundObject<volSymmTensorField>(kappaName_))
             {
                 const symmTensorField& KWall =
                     patch_.lookupPatchField<volSymmTensorField, scalar>
@@ -164,15 +178,14 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
                 )
                     << "Did not find field " << kappaName_
                     << " on mesh " << mesh.name() << " patch " << patch_.name()
-                    << endl
+                    << nl
                     << "Please set 'kappa' to one of "
                     << KMethodTypeNames_.toc()
                     << " and 'kappaName' to the name of the volScalar"
                     << " or volSymmTensor field (if kappa=lookup)"
                     << exit(FatalError);
-
-                return scalarField(0);
             }
+
             break;
         }
 
@@ -182,14 +195,14 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
             (
                 "temperatureCoupledBase::kappa(const scalarField&) const"
             )
-                << "Unimplemented method " << method_ << nl
+                << "Unimplemented method " << KMethodTypeNames_[method_] << nl
                 << "Please set 'kappa' to one of " << KMethodTypeNames_.toc()
                 << " and 'kappaName' to the name of the volScalar"
                 << " or volSymmTensor field (if kappa=lookup)"
                 << exit(FatalError);
         }
-        break;
     }
+
     return scalarField(0);
 }
 
diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H
index c0abdb8ef9b1e1992292d9a8b09f5d97bbab3b64..575d6bc1ed2376565e1309088e63155491cf0a83 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H
@@ -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
@@ -54,21 +54,25 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-        Class temperatureCoupledBase Declaration
+                   Class temperatureCoupledBase Declaration
 \*---------------------------------------------------------------------------*/
 
 class temperatureCoupledBase
 {
 public:
+
+    // Public enumerations
+
         //- Type of supplied Kappa
         enum KMethodType
         {
-            BASICTHERMO,
-            SOLIDTHERMO,
-            DIRECTIONALSOLIDTHERMO,
-            LOOKUP
+            mtFluidThermo,
+            mtSolidThermo,
+            mtDirectionalSolidThermo,
+            mtLookup
         };
 
+
 private:
 
     // Private data
diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermoBaffle1D/thermoBaffle1DFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C
similarity index 83%
rename from src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermoBaffle1D/thermoBaffle1DFvPatchScalarField.C
rename to src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C
index 2d4f331e20200e85dd442001d659367956c505c7..05370cbc441a7134731e0905c6aaa8b20168e332 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermoBaffle1D/thermoBaffle1DFvPatchScalarField.C
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.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
@@ -39,8 +39,8 @@ namespace compressible
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class solidType>
-thermoBaffle1DFvPatchScalarField<solidType>::
-thermoBaffle1DFvPatchScalarField
+thermalBaffle1DFvPatchScalarField<solidType>::
+thermalBaffle1DFvPatchScalarField
 (
     const fvPatch& p,
     const DimensionedField<scalar, volMesh>& iF
@@ -56,10 +56,10 @@ thermoBaffle1DFvPatchScalarField
 
 
 template<class solidType>
-thermoBaffle1DFvPatchScalarField<solidType>::
-thermoBaffle1DFvPatchScalarField
+thermalBaffle1DFvPatchScalarField<solidType>::
+thermalBaffle1DFvPatchScalarField
 (
-    const thermoBaffle1DFvPatchScalarField& ptf,
+    const thermalBaffle1DFvPatchScalarField& ptf,
     const fvPatch& p,
     const DimensionedField<scalar, volMesh>& iF,
     const fvPatchFieldMapper& mapper
@@ -75,8 +75,8 @@ thermoBaffle1DFvPatchScalarField
 
 
 template<class solidType>
-thermoBaffle1DFvPatchScalarField<solidType>::
-thermoBaffle1DFvPatchScalarField
+thermalBaffle1DFvPatchScalarField<solidType>::
+thermalBaffle1DFvPatchScalarField
 (
     const fvPatch& p,
     const DimensionedField<scalar, volMesh>& iF,
@@ -94,8 +94,8 @@ thermoBaffle1DFvPatchScalarField
     {
         FatalErrorIn
         (
-            "thermoBaffle1DFvPatchScalarField::"
-            "thermoBaffle1DFvPatchScalarField"
+            "thermalBaffle1DFvPatchScalarField::"
+            "thermalBaffle1DFvPatchScalarField"
             "("
                 "const fvPatch&,\n"
                 "const DimensionedField<scalar, volMesh>&, "
@@ -130,10 +130,10 @@ thermoBaffle1DFvPatchScalarField
 
 
 template<class solidType>
-thermoBaffle1DFvPatchScalarField<solidType>::
-thermoBaffle1DFvPatchScalarField
+thermalBaffle1DFvPatchScalarField<solidType>::
+thermalBaffle1DFvPatchScalarField
 (
-    const thermoBaffle1DFvPatchScalarField& ptf
+    const thermalBaffle1DFvPatchScalarField& ptf
 )
 :
     mixedFvPatchScalarField(ptf),
@@ -146,10 +146,10 @@ thermoBaffle1DFvPatchScalarField
 
 
 template<class solidType>
-thermoBaffle1DFvPatchScalarField<solidType>::
-thermoBaffle1DFvPatchScalarField
+thermalBaffle1DFvPatchScalarField<solidType>::
+thermalBaffle1DFvPatchScalarField
 (
-    const thermoBaffle1DFvPatchScalarField& ptf,
+    const thermalBaffle1DFvPatchScalarField& ptf,
     const DimensionedField<scalar, volMesh>& iF
 )
 :
@@ -165,7 +165,7 @@ thermoBaffle1DFvPatchScalarField
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class solidType>
-void thermoBaffle1DFvPatchScalarField<solidType>::autoMap
+void thermalBaffle1DFvPatchScalarField<solidType>::autoMap
 (
     const fvPatchFieldMapper& m
 )
@@ -174,7 +174,7 @@ void thermoBaffle1DFvPatchScalarField<solidType>::autoMap
 }
 
 template<class solidType>
-void thermoBaffle1DFvPatchScalarField<solidType>::rmap
+void thermalBaffle1DFvPatchScalarField<solidType>::rmap
 (
     const fvPatchScalarField& ptf,
     const labelList& addr
@@ -185,7 +185,7 @@ void thermoBaffle1DFvPatchScalarField<solidType>::rmap
 
 
 template<class solidType>
-void thermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
+void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
 {
     if (updated())
     {
@@ -200,23 +200,23 @@ void thermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
     const mappedPatchBase& mpp =
         refCast<const mappedPatchBase>(patch().patch());
 
-    const label patchI = patch().index();
+    const label patchi = patch().index();
 
-    const label nbrPatchI = mpp.samplePolyPatch().index();
+    const label nbrPatchi = mpp.samplePolyPatch().index();
 
     if (baffleActivated_)
     {
-        const fvPatch& nbrPatch = patch().boundaryMesh()[nbrPatchI];
+        const fvPatch& nbrPatch = patch().boundaryMesh()[nbrPatchi];
 
-        const compressible::turbulenceModel& model =
+        const compressible::turbulenceModel& turbModel =
             db().template lookupObject<compressible::turbulenceModel>
             (
                 "turbulenceModel"
             );
 
-
         // local properties
-        const scalarField kappaw = model.kappaEff()().boundaryField()[patchI];
+
+        const scalarField kappaw(turbModel.kappaEff(patchi));
 
         const fvPatchScalarField& Tp =
             patch().template lookupPatchField<volScalarField, scalar>(TName_);
@@ -229,21 +229,16 @@ void thermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
 
         // nbr properties
 
-        scalarField nbrKappaw =
-            model.kappaEff()().boundaryField()[nbrPatchI];
-        mpp.map().distribute(nbrKappaw);
+        const scalarField nbrKappaw(turbModel.kappaEff(nbrPatchi));
 
         const fvPatchScalarField& nbrTw =
-            model.thermo().T().boundaryField()[nbrPatchI];
+            turbModel.thermo().T().boundaryField()[nbrPatchi];
 
-        scalarField nbrQDot
-        (
-            model.kappaEff()().boundaryField()[nbrPatchI]*nbrTw.snGrad()
-        );
+        scalarField nbrQDot(nbrKappaw*nbrTw.snGrad());
         mpp.map().distribute(nbrQDot);
 
-        const thermoBaffle1DFvPatchScalarField& nbrField =
-        refCast<const thermoBaffle1DFvPatchScalarField>
+        const thermalBaffle1DFvPatchScalarField& nbrField =
+        refCast<const thermalBaffle1DFvPatchScalarField>
         (
             nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_)
         );
@@ -255,11 +250,7 @@ void thermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
            nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_);
         mpp.map().distribute(nbrTp);
 
-        scalarField nbrh
-        (
-            nbrPatch.deltaCoeffs()
-           *model.kappaEff()().boundaryField()[nbrPatchI]
-        );
+        scalarField nbrh(nbrPatch.deltaCoeffs()*nbrKappaw);
         mpp.map().distribute(nbrh);
 
 
@@ -346,8 +337,8 @@ void thermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
     mixedFvPatchScalarField::updateCoeffs();
 }
 
-template <class solidType>
-void thermoBaffle1DFvPatchScalarField<solidType>::
+template<class solidType>
+void thermalBaffle1DFvPatchScalarField<solidType>::
 write(Ostream& os) const
 {
     mixedFvPatchScalarField::write(os);
diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermoBaffle1D/thermoBaffle1DFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H
similarity index 81%
rename from src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermoBaffle1D/thermoBaffle1DFvPatchScalarField.H
rename to src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H
index 33a26f39fd924a34e90e74b42a2f471419add414..c2b209cb16421226b0907bbf8b881445a907dca3 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermoBaffle1D/thermoBaffle1DFvPatchScalarField.H
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.H
@@ -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
@@ -22,19 +22,19 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
-    Foam::thermoBaffle1DFvPatchScalarField
+    Foam::thermalBaffle1DFvPatchScalarField
 
 Description
     Boundary which solves the 1D steady state heat transfer equation
     through a baffle.
 
 SourceFiles
-    thermoBaffle1DFvPatchScalarField.C
+    thermalBaffle1DFvPatchScalarField.C
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef thermoBaffle1DFvPatchScalarField_H
-#define thermoBaffle1DFvPatchScalarField_H
+#ifndef thermalBaffle1DFvPatchScalarField_H
+#define thermalBaffle1DFvPatchScalarField_H
 
 #include "mixedFvPatchFields.H"
 #include "autoPtr.H"
@@ -48,11 +48,11 @@ namespace compressible
 {
 
 /*---------------------------------------------------------------------------*\
-            Class thermoBaffle1DFvPatchScalarField Declaration
+            Class thermalBaffle1DFvPatchScalarField Declaration
 \*---------------------------------------------------------------------------*/
 
 template<class solidType>
-class thermoBaffle1DFvPatchScalarField
+class thermalBaffle1DFvPatchScalarField
 :
     public mixedFvPatchScalarField
 {
@@ -77,20 +77,20 @@ class thermoBaffle1DFvPatchScalarField
 public:
 
     //- Runtime type information
-    TypeName("compressible::thermoBaffle1D");
+    TypeName("compressible::thermalBaffle1D");
 
 
     // Constructors
 
         //- Construct from patch and internal field
-        thermoBaffle1DFvPatchScalarField
+        thermalBaffle1DFvPatchScalarField
         (
             const fvPatch&,
             const DimensionedField<scalar, volMesh>&
         );
 
         //- Construct from patch, internal field and dictionary
-        thermoBaffle1DFvPatchScalarField
+        thermalBaffle1DFvPatchScalarField
         (
             const fvPatch&,
             const DimensionedField<scalar, volMesh>&,
@@ -98,19 +98,19 @@ public:
         );
 
         //- Construct by mapping given
-        //  thermoBaffle1DFvPatchScalarField onto a new patch
-        thermoBaffle1DFvPatchScalarField
+        //  thermalBaffle1DFvPatchScalarField onto a new patch
+        thermalBaffle1DFvPatchScalarField
         (
-            const thermoBaffle1DFvPatchScalarField&,
+            const thermalBaffle1DFvPatchScalarField&,
             const fvPatch&,
             const DimensionedField<scalar, volMesh>&,
             const fvPatchFieldMapper&
         );
 
         //- Construct as copy
-        thermoBaffle1DFvPatchScalarField
+        thermalBaffle1DFvPatchScalarField
         (
-            const thermoBaffle1DFvPatchScalarField&
+            const thermalBaffle1DFvPatchScalarField&
         );
 
         //- Construct and return a clone
@@ -118,14 +118,14 @@ public:
         {
             return tmp<fvPatchScalarField>
             (
-                new thermoBaffle1DFvPatchScalarField(*this)
+                new thermalBaffle1DFvPatchScalarField(*this)
             );
         }
 
         //- Construct as copy setting internal field reference
-        thermoBaffle1DFvPatchScalarField
+        thermalBaffle1DFvPatchScalarField
         (
-            const thermoBaffle1DFvPatchScalarField&,
+            const thermalBaffle1DFvPatchScalarField&,
             const DimensionedField<scalar, volMesh>&
         );
 
@@ -137,7 +137,7 @@ public:
         {
             return tmp<fvPatchScalarField>
             (
-                new thermoBaffle1DFvPatchScalarField(*this, iF)
+                new thermalBaffle1DFvPatchScalarField(*this, iF)
             );
         }
 
@@ -176,7 +176,7 @@ public:
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 #ifdef NoRepository
-#   include "thermoBaffle1DFvPatchScalarField.C"
+#   include "thermalBaffle1DFvPatchScalarField.C"
 #endif
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermoBaffle1D/thermoBaffle1DFvPatchScalarFields.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.C
similarity index 80%
rename from src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermoBaffle1D/thermoBaffle1DFvPatchScalarFields.C
rename to src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.C
index 2e180238f49c2ef735362b42ea90ce1bfb1c196c..ca3f232992d2101e7876768bb09b442b055039a0 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermoBaffle1D/thermoBaffle1DFvPatchScalarFields.C
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.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
@@ -23,7 +23,7 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "thermoBaffle1DFvPatchScalarFields.H"
+#include "thermalBaffle1DFvPatchScalarFields.H"
 #include "addToRunTimeSelectionTable.H"
 
 
@@ -38,28 +38,28 @@ namespace compressible
 
 defineTemplateTypeNameAndDebugWithName
 (
-    constSolid_thermoBaffle1DFvPatchScalarField,
-    "compressible::thermoBaffle1D<hConstSolidThermoPhysics>",
+    constSolid_thermalBaffle1DFvPatchScalarField,
+    "compressible::thermalBaffle1D<hConstSolidThermoPhysics>",
     0
 );
 
 addToPatchFieldRunTimeSelection
 (
     fvPatchScalarField,
-    constSolid_thermoBaffle1DFvPatchScalarField
+    constSolid_thermalBaffle1DFvPatchScalarField
 );
 
 defineTemplateTypeNameAndDebugWithName
 (
-    expoSolid_thermoBaffle1DFvPatchScalarField,
-    "compressible::thermoBaffle1D<hExponentialSolidThermoPhysics>",
+    expoSolid_thermalBaffle1DFvPatchScalarField,
+    "compressible::thermalBaffle1D<hExponentialSolidThermoPhysics>",
     0
 );
 
 addToPatchFieldRunTimeSelection
 (
     fvPatchScalarField,
-    expoSolid_thermoBaffle1DFvPatchScalarField
+    expoSolid_thermalBaffle1DFvPatchScalarField
 );
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermoBaffle1D/thermoBaffle1DFvPatchScalarFields.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.H
similarity index 81%
rename from src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermoBaffle1D/thermoBaffle1DFvPatchScalarFields.H
rename to src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.H
index 931aeaae0705ce1896bcc0e0224a4facdb618300..db7dcf0c9fc1ecd64572cff16cb68e64b7e4ae5c 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermoBaffle1D/thermoBaffle1DFvPatchScalarFields.H
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.H
@@ -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
@@ -23,10 +23,10 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef thermoBaffle1DFvPatchScalarFields_H
-#define thermoBaffle1DFvPatchScalarFields_H
+#ifndef thermalBaffle1DFvPatchScalarFields_H
+#define thermalBaffle1DFvPatchScalarFields_H
 
-#include "thermoBaffle1DFvPatchScalarField.H"
+#include "thermalBaffle1DFvPatchScalarField.H"
 #include "solidThermoPhysicsTypes.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -38,15 +38,15 @@ namespace compressible
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-    typedef thermoBaffle1DFvPatchScalarField
+    typedef thermalBaffle1DFvPatchScalarField
     <
         hConstSolidThermoPhysics
-    >constSolid_thermoBaffle1DFvPatchScalarField;
+    >constSolid_thermalBaffle1DFvPatchScalarField;
 
-    typedef thermoBaffle1DFvPatchScalarField
+    typedef thermalBaffle1DFvPatchScalarField
     <
         hExponentialSolidThermoPhysics
-    >expoSolid_thermoBaffle1DFvPatchScalarField;
+    >expoSolid_thermalBaffle1DFvPatchScalarField;
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
similarity index 90%
rename from src/thermophysicalModels/basic/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
rename to src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
index da9ff9b2bbda41af7728d06317b2eb92c211880d..2efdccde5e1f2fa37b09ab2ead23c80902639058 100644
--- a/src/thermophysicalModels/basic/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.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
@@ -26,8 +26,7 @@ License
 #include "wallHeatTransferFvPatchScalarField.H"
 #include "addToRunTimeSelectionTable.H"
 #include "fvPatchFieldMapper.H"
-#include "volFields.H"
-#include "basicThermo.H"
+#include "turbulenceModel.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
@@ -149,19 +148,19 @@ void Foam::wallHeatTransferFvPatchScalarField::updateCoeffs()
         return;
     }
 
-    const basicThermo& thermo = basicThermo::lookupThermo(*this);
-    const label patchi = patch().index();
+    const compressible::turbulenceModel& turbModel =
+        db().lookupObject<compressible::turbulenceModel>
+        (
+            "turbulenceModel"
+        );
 
-    const scalarField& pw = thermo.p().boundaryField()[patchi];
-    const scalarField& Tw = thermo.T().boundaryField()[patchi];
-    const scalarField Cpw(thermo.Cp(pw, Tw, patchi));
+    const label patchi = patch().index();
 
     valueFraction() =
         1.0/
         (
             1.0
-          + Cpw*thermo.alpha().boundaryField()[patchi]
-           *patch().deltaCoeffs()/alphaWall_
+          + turbModel.kappaEff(patchi)*patch().deltaCoeffs()/alphaWall_
         );
 
     mixedFvPatchScalarField::updateCoeffs();
diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.H
similarity index 98%
rename from src/thermophysicalModels/basic/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.H
rename to src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.H
index da2ab661efd19dd253456865cb9a9bfa240a9a67..a33ce4e472977a06f7d3f9c040629208a4b001b5 100644
--- a/src/thermophysicalModels/basic/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.H
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.H
@@ -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
@@ -44,7 +44,7 @@ Description
     myPatch
     {
         type            wallHeatTransfer;
-        Tif             uniform 500;
+        Tinf            uniform 500;
         alphaWall       uniform 1;
     }
     \endverbatim
diff --git a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H
index 87d283b29ab8d318cb625269052367e219f5a3a2..b7e9195c5519fbb6c8362532c67cb4f90d971393 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H
+++ b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H
@@ -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
@@ -161,6 +161,12 @@ public:
         //- Const access to the coefficients dictionary
         virtual const dictionary& coeffDict() const = 0;
 
+        //- Helper function to return the nam eof the turbulence G field
+        inline word GName() const
+        {
+            return word(type() + ":G");
+        }
+
         //- Access function to density field
         const volScalarField& rho() const
         {
@@ -212,6 +218,12 @@ public:
         //- Return the turbulence thermal diffusivity
         virtual tmp<volScalarField> alphat() const = 0;
 
+        //- Return the turbulence thermal diffusivity for a patch
+        virtual tmp<scalarField> alphat(const label patchI) const
+        {
+            return alphat()().boundaryField()[patchI];
+        }
+
         //- Return the effective turbulence temperature diffusivity
         virtual tmp<volScalarField> kappaEff() const = 0;
 
diff --git a/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C b/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C
index 7afc74c400d527e2072fc6abdd008ea2dc326b40..587ad9678d253f485934d97bff2faf3c873b92e6 100644
--- a/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C
+++ b/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C
@@ -2,16 +2,16 @@
   =========                 |
   \\      /  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
     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 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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.H b/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.H
index d1ad27977f37dfbad72012823b1158ee1d0d8522..a399ff07eb2d87ce8bb956a2e8406442d23ebd19 100644
--- a/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.H
+++ b/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.H
@@ -2,16 +2,16 @@
   =========                 |
   \\      /  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
     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 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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
     Foam::fixedShearStressFvPatchVectorField
diff --git a/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.C b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.C
index 7207e3d7ac02ac7b3c1a812fce39925e5da72db5..08855fa7fb85c32612e5bfbf8f6903f6be39bb6f 100644
--- a/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.C
+++ b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -70,25 +70,25 @@ void Foam::porousBafflePressureFvPatchField<Foam::scalar>::updateCoeffs()
 
     if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
     {
-        const incompressible::turbulenceModel& model =
+        const incompressible::turbulenceModel& turbModel =
             db().lookupObject<incompressible::turbulenceModel>
             (
                 "turbulenceModel"
             );
 
-        const scalarField nuEffw = model.nuEff()().boundaryField()[patchI];
+        const scalarField nuEffw = turbModel.nuEff()().boundaryField()[patchI];
 
         jump_ = -sign(Un)*(I_*nuEffw + D_*0.5*magUn*length_)*magUn;
     }
     else
     {
-        const compressible::turbulenceModel& model =
+        const compressible::turbulenceModel& turbModel =
             db().lookupObject<compressible::turbulenceModel>
             (
                 "turbulenceModel"
             );
 
-        const scalarField muEffw = model.muEff()().boundaryField()[patchI];
+        const scalarField muEffw = turbModel.muEff()().boundaryField()[patchI];
 
         const scalarField rhow =
             patch().lookupPatchField<volScalarField, scalar>("rho");
diff --git a/src/turbulenceModels/incompressible/LES/DESModel/DESModel.H b/src/turbulenceModels/incompressible/LES/DESModel/DESModel.H
index 5f73e0d156841f39a60ee8bcbb576f7b86669d18..07f0c5c1c99a981c13fe06a4c8e3e78485b0f180 100644
--- a/src/turbulenceModels/incompressible/LES/DESModel/DESModel.H
+++ b/src/turbulenceModels/incompressible/LES/DESModel/DESModel.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -21,12 +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/>.
 
-Group
-    grpIcoDESTurbulence
-
 Class
     Foam::incompressible::DESModel
 
+Group
+    grpIcoDESTurbulence
+
 Description
     Extension of LES models to provide an interface for Detached Eddy
     Simulation turbulence models
diff --git a/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/IDDESDelta/IDDESDelta.C b/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/IDDESDelta/IDDESDelta.C
index 5a680bc56b1750898eaade8a238b10d82b297be5..376ec44ad1d528ce988b6ba742e0f738f7c7ee4c 100644
--- a/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/IDDESDelta/IDDESDelta.C
+++ b/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/IDDESDelta/IDDESDelta.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.C b/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.C
index 47f2d136e608aadb6d2a9af2ba4d4642fa02843d..32d23f4eab9caa2b93364f192d30317d829584a9 100644
--- a/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.C
+++ b/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.C
@@ -2,16 +2,16 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    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 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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/turbulenceModels/incompressible/LES/dynOneEqEddy/dynOneEqEddy.C b/src/turbulenceModels/incompressible/LES/dynOneEqEddy/dynOneEqEddy.C
index 40c4deaf33a3d1f7b052b93fc2ba5d7844cf83ea..5e125d53108ff57fc8c63829997f440aa9bb2e1a 100644
--- a/src/turbulenceModels/incompressible/LES/dynOneEqEddy/dynOneEqEddy.C
+++ b/src/turbulenceModels/incompressible/LES/dynOneEqEddy/dynOneEqEddy.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) 2011-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -66,7 +66,7 @@ volScalarField dynOneEqEddy::ck
 
     const volSymmTensorField MM
     (
-        simpleFilter_(-2.0*delta()*pow(KK, 0.5)*filter_(D))
+        simpleFilter_(-2.0*delta()*sqrt(KK)*filter_(D))
     );
 
     const volScalarField ck
diff --git a/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C b/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C
index acb34537c7fca816f3d6324a8d2ba4236b817e1e..141d7236130e23a6e1e6fd6d760f27d30a9634bd 100644
--- a/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C
+++ b/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.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
@@ -353,7 +353,7 @@ void kOmegaSSTSAS::correct(const tmp<volTensorField>& gradU)
     volScalarField L(sqrt(k_)/(pow025(Cmu_)*omega_));
     volScalarField CDkOmega((2.0*alphaOmega2_)*(gradK & gradOmega)/omega_);
     volScalarField F1(this->F1(CDkOmega));
-    volScalarField G(type() + ".G", nuSgs_*S2);
+    volScalarField G(GName(), nuSgs_*S2);
 
     // Turbulent kinetic energy equation
     {
diff --git a/src/turbulenceModels/incompressible/LES/oneEqEddy/oneEqEddy.C b/src/turbulenceModels/incompressible/LES/oneEqEddy/oneEqEddy.C
index e0c891584677d490c1469f4ce86e0fda86d6da7e..e31d5e1a4de1747cca8c3fb8b53ab4e28fe6c97e 100644
--- a/src/turbulenceModels/incompressible/LES/oneEqEddy/oneEqEddy.C
+++ b/src/turbulenceModels/incompressible/LES/oneEqEddy/oneEqEddy.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
@@ -101,7 +101,7 @@ void oneEqEddy::correct(const tmp<volTensorField>& gradU)
 {
     GenEddyVisc::correct(gradU);
 
-    volScalarField G(type() + ".G", 2.0*nuSgs_*magSqr(symm(gradU)));
+    volScalarField G(GName(), 2.0*nuSgs_*magSqr(symm(gradU)));
 
     tmp<fvScalarMatrix> kEqn
     (
diff --git a/src/turbulenceModels/incompressible/RAS/LRR/LRR.C b/src/turbulenceModels/incompressible/RAS/LRR/LRR.C
index 49b0bd0a17b6192d4a8745b384b2c83d4b30c11f..bcb4417d6638d2edb9f9490b6f5e9a8e1fa05eab 100644
--- a/src/turbulenceModels/incompressible/RAS/LRR/LRR.C
+++ b/src/turbulenceModels/incompressible/RAS/LRR/LRR.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
@@ -339,7 +339,7 @@ void LRR::correct()
     }
 
     volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_)));
-    volScalarField G(type() + ".G", 0.5*mag(tr(P)));
+    volScalarField G(GName(), 0.5*mag(tr(P)));
 
     // Update epsilon and G at the wall
     epsilon_.boundaryField().updateCoeffs();
diff --git a/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C b/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C
index 576d830421908a8e32e83065d09e5bc0787418c1..cf07d2b2c0e34560337391950293a1837bbb9095 100644
--- a/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C
+++ b/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.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
@@ -252,7 +252,7 @@ void LamBremhorstKE::correct()
         y_.correct();
     }
 
-    volScalarField G(type() + ".G", nut_*2*magSqr(symm(fvc::grad(U_))));
+    volScalarField G(GName(), nut_*2*magSqr(symm(fvc::grad(U_))));
 
 
     // Calculate parameters and coefficients for low-Reynolds number model
diff --git a/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C b/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C
index 2f8ff3b7ea0af39c5c2c35be8e160726be142dce..15d032f65494694c0c8af2acdbd08f46a69023f3 100644
--- a/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C
+++ b/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.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
@@ -386,7 +386,7 @@ void LaunderGibsonRSTM::correct()
     }
 
     volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_)));
-    volScalarField G(type() + ".G", 0.5*mag(tr(P)));
+    volScalarField G(GName(), 0.5*mag(tr(P)));
 
     // Update epsilon and G at the wall
     epsilon_.boundaryField().updateCoeffs();
diff --git a/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C b/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C
index c6854e7cba2f0c8a199ed0b7fea4a98b93390ed3..ee2027180de9d3ab07ca36d9a9b4a576d1ebd9db 100644
--- a/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C
+++ b/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.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
@@ -255,7 +255,7 @@ void LaunderSharmaKE::correct()
 
     tmp<volScalarField> S2 = 2*magSqr(symm(fvc::grad(U_)));
 
-    volScalarField G(type() + ".G", nut_*S2);
+    volScalarField G(GName(), nut_*S2);
 
     const volScalarField E(2.0*nu()*nut_*fvc::magSqrGradGrad(U_));
     const volScalarField D(2.0*nu()*magSqr(fvc::grad(sqrt(k_))));
diff --git a/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.C b/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.C
index dbecdb2dc83602b917d5588005c6dc327b985844..e346ccd831b172db71f27cb1e0cfbb68d52d3be4 100644
--- a/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.C
+++ b/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.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
@@ -356,7 +356,7 @@ void LienCubicKE::correct()
 
     volScalarField G
     (
-        type() + ".G",
+        GName(),
         Cmu_*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU)
     );
 
diff --git a/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.C b/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.C
index 9c5d561998dc45c2256f5f92e0aeebcb694cc13c..b2517f1a40378617b8a31370e3fdf51933b29230 100644
--- a/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.C
+++ b/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.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
@@ -446,7 +446,7 @@ void LienCubicKELowRe::correct()
 
     volScalarField G
     (
-        type() + ".G",
+        GName(),
         Cmu_*fMu*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU)
     );
 
diff --git a/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C b/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C
index faf5c125e4f4a84e44e65124fc6753aa1c7b6580..8401f3eed74597863baf7c2039a083503c1fcd06 100644
--- a/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C
+++ b/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.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
@@ -319,7 +319,7 @@ void LienLeschzinerLowRe::correct()
 
     const volScalarField f2(scalar(1) - 0.3*exp(-sqr(Rt)));
 
-    volScalarField G(type() + ".G", Cmu_*fMu*sqr(k_)/epsilon_*S2);
+    volScalarField G(GName(), Cmu_*fMu*sqr(k_)/epsilon_*S2);
 
 
     // Dissipation equation
diff --git a/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C b/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C
index b33c0cd3a863b39f70876d86664e17b077ff94af..68fb68c0c63a6598d36d3b51ebe2b8a5528b0b05 100644
--- a/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C
+++ b/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.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
@@ -348,7 +348,7 @@ void NonlinearKEShih::correct()
 
     volScalarField G
     (
-        type() + ".G",
+        GName(),
         Cmu_*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU)
     );
 
diff --git a/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.C b/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.C
index b82719f22189c2add52274d42141aea85ee45cf0..1cca2780aab17ac0a1ef70c65481f147e9583a49 100644
--- a/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.C
+++ b/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.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
@@ -267,7 +267,7 @@ void RNGkEpsilon::correct()
     }
 
     const volScalarField S2(2*magSqr(symm(fvc::grad(U_))));
-    volScalarField G(type() + ".G", nut_*S2);
+    volScalarField G(GName(), nut_*S2);
 
     const volScalarField eta(sqrt(S2)*k_/epsilon_);
     volScalarField R
diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C
index 80aa64362a9650a281e100402a737c1135e4a1a6..916c34146d9ce7721568b8363798f14caed8142d 100644
--- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C
+++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C
@@ -2,16 +2,16 @@
   =========                 |
   \\      /  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
     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 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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C
index e41c3904faab3366160e67e89fc972b7c5e2521a..1935c29bc1dfd33959437ac5f8bda641f45e4f2d 100644
--- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C
+++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C
@@ -2,16 +2,16 @@
   =========                 |
   \\      /  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
     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 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
@@ -19,8 +19,7 @@ License
     for more details.
 
     You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C
index df52c7373e8ffac02c03ecbc016d179e97fe75cc..0191a90a8ccd02b814d1a3b4d704c0672a4ec7cf 100644
--- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C
+++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -139,7 +139,7 @@ void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs()
         (
             db().lookupObject<volScalarField>
             (
-                turbulence.type() + ".G"
+                turbulence.GName()
             )
         );
 
diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C
index 518bb38f471a8f97818deab85d043275d3d25757..9435962e6abdfa8d3d670a60760ceb2fe2644938 100644
--- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C
+++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.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
@@ -165,7 +165,7 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
         (
             db().lookupObject<volScalarField>
             (
-                turbulence.type() + ".G"
+                turbulence.GName()
             )
         );
 
diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H
index d4e0af5dd8728469b06aa08b5059e12028bc4e72..6f2beff4404f1372fc46c4cb26cd3354618e0266 100644
--- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H
+++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H
@@ -2,24 +2,24 @@
   =========                 |
   \\      /  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
     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 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.
+    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/>.
+    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::incompressible::kappatJayatillekeWallFunctionFvPatchScalarField
diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C
index 83444c5d407156cee0655377d13e75d9a5cd80cf..a78e0bdb84ed3c9d046dec62bb596c24cd4bc144 100644
--- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C
+++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.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
@@ -175,7 +175,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
         (
             db().lookupObject<volScalarField>
             (
-                turbulence.type() + ".G"
+                turbulence.GName()
             )
         );
 
diff --git a/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C b/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C
index 48ccd699c74bd230a63f70af181411996ad1ec50..e662da52ba3939812ee803a241767c2bc2cdaff8 100644
--- a/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C
+++ b/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.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
@@ -235,7 +235,7 @@ void kEpsilon::correct()
         return;
     }
 
-    volScalarField G(type() + ".G", nut_*2*magSqr(symm(fvc::grad(U_))));
+    volScalarField G(GName(), nut_*2*magSqr(symm(fvc::grad(U_))));
 
     // Update epsilon and G at the wall
     epsilon_.boundaryField().updateCoeffs();
diff --git a/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.C b/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.C
index 497fbed7c6914eb53572a52af6c02ed8b09483b3..26dc7160805df2d390be406a6893ca49fed1cd78 100644
--- a/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.C
+++ b/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.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
@@ -244,7 +244,7 @@ void kOmega::correct()
         return;
     }
 
-    volScalarField G(type() + ".G", nut_*2*magSqr(symm(fvc::grad(U_))));
+    volScalarField G(GName(), nut_*2*magSqr(symm(fvc::grad(U_))));
 
     // Update omega and G at the wall
     omega_.boundaryField().updateCoeffs();
diff --git a/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C b/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C
index 290a4c73a862c3b4cdb22f6ae76928472b444c53..ec0c631f290bcbc4dd6d262ab2133f308e95bae4 100644
--- a/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C
+++ b/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.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
@@ -410,7 +410,7 @@ void kOmegaSST::correct()
     }
 
     const volScalarField S2(2*magSqr(symm(fvc::grad(U_))));
-    volScalarField G(type() + ".G", nut_*S2);
+    volScalarField G(GName(), nut_*S2);
 
     // Update omega and G at the wall
     omega_.boundaryField().updateCoeffs();
diff --git a/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.C b/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.C
index 8803807bbee7c4d89f5c5ace959c0b0aaa7cf882..44d39008431e08bd96279e0dcffd415bf3704ff5 100644
--- a/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.C
+++ b/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.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
@@ -311,7 +311,7 @@ void qZeta::correct()
 
     tmp<volScalarField> S2 = 2*magSqr(symm(fvc::grad(U_)));
 
-    volScalarField G(type() + ".G", nut_/(2.0*q_)*S2);
+    volScalarField G(GName(), nut_/(2.0*q_)*S2);
     const volScalarField E(nu()*nut_/q_*fvc::magSqrGradGrad(U_));
 
 
diff --git a/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.C b/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.C
index d106180142072934341fe6040083f7e33a4fb444..959fca9dc3aa5e38a829cd1bb458fabb28f55f8b 100644
--- a/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.C
+++ b/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.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
@@ -297,7 +297,7 @@ void realizableKE::correct()
     const volScalarField eta(magS*k_/epsilon_);
     tmp<volScalarField> C1 = max(eta/(scalar(5) + eta), scalar(0.43));
 
-    volScalarField G(type() + ".G", nut_*S2);
+    volScalarField G(GName(), nut_*S2);
 
     // Update epsilon and G at the wall
     epsilon_.boundaryField().updateCoeffs();
diff --git a/src/turbulenceModels/incompressible/RAS/v2f/v2f.C b/src/turbulenceModels/incompressible/RAS/v2f/v2f.C
index 642dc819bfcfc7782fd39afbd83358e9171b8993..ec67161758f8b045b88ed00c894e48d355656e9d 100644
--- a/src/turbulenceModels/incompressible/RAS/v2f/v2f.C
+++ b/src/turbulenceModels/incompressible/RAS/v2f/v2f.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -364,7 +364,7 @@ void v2f::correct()
     const volTensorField gradU(fvc::grad(U_));
     const volScalarField S2(2*magSqr(dev(symm(gradU))));
 
-    const volScalarField G(type() + ".G", nut_*S2);
+    const volScalarField G(GName(), nut_*S2);
     const volScalarField T(Ts());
     const volScalarField L2(type() + ".L2", sqr(Ls()));
     const volScalarField alpha
diff --git a/src/turbulenceModels/incompressible/RAS/v2f/v2f.H b/src/turbulenceModels/incompressible/RAS/v2f/v2f.H
index 0aff2182b95bdd968c6bab74e69268e2b0804209..c426984b08b356ff752c6db61b75f25ac84cfb7c 100644
--- a/src/turbulenceModels/incompressible/RAS/v2f/v2f.H
+++ b/src/turbulenceModels/incompressible/RAS/v2f/v2f.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -39,7 +39,7 @@ Description
 
         k       = kLowReWallFunction
         epsilon = epsilonLowReWallFunction
-        v2      = v2WalLFunction
+        v2      = v2WallFunction
         f       = fWallFunction
 
     These are applicable to both low- and high-Reynolds number flows.
diff --git a/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.C b/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.C
index afcc8096d04717d2954a67a13abaf0cddb88a645..9de75af54f08895986976a87754a8b01978cf04c 100644
--- a/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.C
+++ b/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.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
@@ -35,7 +35,7 @@ namespace Foam
 namespace incompressible
 {
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 defineTypeNameAndDebug(turbulenceModel, 0);
 defineRunTimeSelectionTable(turbulenceModel, turbulenceModel);
diff --git a/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H b/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H
index 91eef14ad78ce3f5cb62e9c556b28586e3325ee1..f4eeba47e94c3d92efb66c805d7d3dc3c6747fe3 100644
--- a/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H
+++ b/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H
@@ -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
@@ -156,6 +156,12 @@ public:
         //- Const access to the coefficients dictionary
         virtual const dictionary& coeffDict() const = 0;
 
+        //- Helper function to return the nam eof the turbulence G field
+        inline word GName() const
+        {
+            return word(type() + ":G");
+        }
+
         //- Access function to velocity field
         inline const volVectorField& U() const
         {
diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/chemistryProperties b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/chemistryProperties
index 929ed127f856a9ee1fc6177576d65b1886e2172c..9f8ecdd196e68ec48372f8e6325f33d56c43f38f 100644
--- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/chemistryProperties
+++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/chemistryProperties
@@ -18,7 +18,7 @@ FoamFile
 chemistryType
 {
     chemistrySolver   ode;
-    chemistryThermo   solid;
+    chemistryThermo   pyrolysis;
 }
 
 chemistry           on;
diff --git a/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/system/fvOptions b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/system/fvOptions
index 2fd3242b6db2cfa6261812c3bf26be434dad3c45..b8256633c4649e8e4403a1e52494d53682b3681d 100644
--- a/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/system/fvOptions
+++ b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/system/fvOptions
@@ -47,4 +47,4 @@ porosity1
 }
 
 
-//************************************************************************* //
+// ************************************************************************* //
diff --git a/tutorials/compressible/rhoPimplecFoam/angledDuct/system/fvOptions b/tutorials/compressible/rhoPimplecFoam/angledDuct/system/fvOptions
index b150d51b8f0bd76a38f2c675609965072624ec03..66a2b807520ffe5ac1c89c4d752d42c2f0638ac2 100644
--- a/tutorials/compressible/rhoPimplecFoam/angledDuct/system/fvOptions
+++ b/tutorials/compressible/rhoPimplecFoam/angledDuct/system/fvOptions
@@ -33,8 +33,14 @@ porosity1
 
             coordinateSystem
             {
-                e1  (0.70710678 0.70710678 0);
-                e3  (0 0 1);
+                type    cartesian;
+                origin  (0 0 0);
+                coordinateRotation
+                {
+                    type    axesRotation;
+                    e1  (0.70710678 0.70710678 0);
+                    e3  (0 0 1);
+                }
             }
         }
     }
diff --git a/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvOptions b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvOptions
index 43b573b7a90e2e90e0f3d2b85648dbfe00d4f4ba..8f9340b8e529f84012e6fa49aebe4b13b4c72865 100644
--- a/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvOptions
+++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvOptions
@@ -65,4 +65,4 @@ porosity1
 }
 
 
-//***************************************************************************//
+// ************************************************************************* //
diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/snappyHexMeshDict b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/snappyHexMeshDict
index c5e80f8d1a3715a2600d25caa26d4fb32be862cf..a6e206d5256b2bd365ca802844aaedffd1c81b50 100644
--- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/snappyHexMeshDict
+++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/snappyHexMeshDict
@@ -54,10 +54,17 @@ geometry
             scale (1.0 1.0 2.1);
             transform
             {
-                type    cartesian;
-                origin  (2 2 0);
-                e1      (1 0 0);
-                e3      (0 0 1);
+                coordinateSystem
+                {
+                    type    cartesian;
+                    origin  (2 2 0);
+                    coordinateRotation
+                    {
+                        type    axesRotation;
+                        e1      (1 0 0);
+                        e3      (0 0 1);
+                    }
+                }
             }
         }
         herring
@@ -66,10 +73,17 @@ geometry
             scale (1.0 1.0 2.1);
             transform
             {
-                type    cartesian;
-                origin  (3.5 3 0);
-                e1      (1 0 0);
-                e3      (0 0 1);
+                coordinateSystem
+                {
+                    type    cartesian;
+                    origin  (3.5 3 0);
+                    coordinateRotation
+                    {
+                        type    axesRotation;
+                        e1      (1 0 0);
+                        e3      (0 0 1);
+                    }
+                }
             }
         }
     }
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/constant/thermophysicalProperties b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/constant/thermophysicalProperties
index 5ba8a553e166d823df34a7093c9c7523fce744f0..95579e34cb51bd580ceb7debb125ff47a8c7a6aa 100644
--- a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/constant/thermophysicalProperties
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/constant/thermophysicalProperties
@@ -17,7 +17,7 @@ FoamFile
 
 thermoType
 {
-    type            hePsiThermo;
+    type            heRhoThermo;
     mixture         pureMixture;
     transport       const;
     thermo          hConst;
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/system/fvSolution b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/system/fvSolution
index d30cdf20b496e354128a273418811f504df1abed..b19527e0cecdb50be8f3a026bb41a7b4ba686900 100644
--- a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/system/fvSolution
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/system/fvSolution
@@ -42,16 +42,16 @@ solvers
 
 SIMPLE
 {
-    momentumPredictor yes;
+    momentumPredictor no;
     nNonOrthogonalCorrectors 0;
     pRefCell        0;
     pRefValue       0;
 
     residualControl
     {
-        p_rgh           1e-2;
-        U               1e-3;
-        h               1e-3;
+        p_rgh           1e-4;
+        U               1e-4;
+        h               1e-4;
 
         // possibly check turbulence fields
         "(k|epsilon|omega)" 1e-3;
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs
index 4baed11dace892bc45de05403d70465d7bbd90fe..d176101331549e10dde2294873a55606d8e47532 100755
--- a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs
@@ -3,7 +3,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #-------------------------------------------------------------------------------
 # License
@@ -83,7 +83,7 @@ type -P gnuplot &>/dev/null || {
     exit 1
 }
 
-SETSDIR="../sets"
+SETSDIR="../postProcessing/sets"
 
 if [ ! -d $SETSDIR ]
 then
@@ -93,7 +93,7 @@ fi
 
 # paths to data
 LATESTTIME=`ls $SETSDIR`
-OFDATAROOT=../sets/$LATESTTIME
+OFDATAROOT=$SETSDIR/$LATESTTIME
 
 EXPTDATAROOT=./exptData
 
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/constant/thermoBaffleProperties b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/constant/thermalBaffleProperties
similarity index 91%
rename from tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/constant/thermoBaffleProperties
rename to tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/constant/thermalBaffleProperties
index acabb40438089d19f6ad5839a27658f47686e44e..9a2dade638e5cab17c6e9b4faf0c0cf5cf9d0dda 100644
--- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/constant/thermoBaffleProperties
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/constant/thermalBaffleProperties
@@ -11,17 +11,17 @@ FoamFile
     format      ascii;
     class       dictionary;
     location    "constant";
-    object      thermoBaffleProperties;
+    object      thermalBaffleProperties;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-thermoBaffleModel  none;
+thermalBaffleModel  none;
 
 active          no;
 
 regionName      none;
 
-thermoBaffleCoeffs
+thermalBaffleCoeffs
 {
 }
 
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/constant/thermophysicalProperties b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/constant/thermophysicalProperties
index 5ba8a553e166d823df34a7093c9c7523fce744f0..95579e34cb51bd580ceb7debb125ff47a8c7a6aa 100644
--- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/constant/thermophysicalProperties
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/constant/thermophysicalProperties
@@ -17,7 +17,7 @@ FoamFile
 
 thermoType
 {
-    type            hePsiThermo;
+    type            heRhoThermo;
     mixture         pureMixture;
     transport       const;
     thermo          hConst;
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/baffleRegion/changeDictionaryDict b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/baffleRegion/changeDictionaryDict
index 1931c502a6651751c53662583940d9fa2288860a..c325fcd6999b17982c408d26ea7d22c552563ce9 100644
--- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/baffleRegion/changeDictionaryDict
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/baffleRegion/changeDictionaryDict
@@ -22,7 +22,7 @@ dictionaryReplacement
         {
             "region0_to.*"
             {
-                type                compressible::thermoBaffle;
+                type                compressible::thermalBaffle;
                 neighbourFieldName  T;
                 kappa               solidThermo;
                 kappaName           none;
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict
index 6146edeb2b4e31f407a9f35aa33175b0b03db2dc..0674354a506bc0e24deb32cc2a01b2de72d4416d 100644
--- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict
@@ -88,7 +88,7 @@ dictionaryReplacement
         {
             "baffle.*"
             {
-                type        compressible::thermoBaffle1D<hConstSolidThermoPhysics>;
+                type        compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
                 baffleActivated yes;
                 thickness       uniform 0.005;  // thickness [m]
                 Qs              uniform 100;    // heat flux [W/m2]
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffle b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffle
index d2933855c572bd3905f6492bf15262190aa09d5d..1df570730cc50022f4f6765261c07fe0b6d24ca1 100644
--- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffle
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffle
@@ -88,7 +88,7 @@ dictionaryReplacement
         {
             "baffle1Wall.*"
             {
-                type   compressible::thermoBaffle1D<hConstSolidThermoPhysics>;
+                type   compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
                 baffleActivated yes;
                 thickness       uniform 0.005;  // thickness [m]
                 Qs              uniform 100;    // heat flux [W/m2]
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffleRegion b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffleRegion
index 1cbf29f10c6a875fde7c0af7161fc6d80d682be4..dae4c6fe77a8eb7a30b8ba02a66dc87ccf315c6d 100644
--- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffleRegion
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffleRegion
@@ -91,7 +91,7 @@ dictionaryReplacement
 
             "region0_to.*"
             {
-                type                compressible::thermoBaffle;
+                type                compressible::thermalBaffle;
 
                 // Coupled BC.
                 neighbourFieldName  T;
@@ -99,11 +99,11 @@ dictionaryReplacement
                 kappaName           none;
 
                 // Thermo baffle model
-                thermoBaffleModel   thermoBaffle;
+                thermalBaffleModel   thermalBaffle;
                 regionName          baffleRegion;
                 infoOutput          no;
                 active              yes;
-                thermoBaffleCoeffs
+                thermalBaffleCoeffs
                 {
                 }
 
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/controlDict b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/controlDict
index acd337d87733d98406a88afc1b08b05124efa50f..f35c15f101f989ea0db7c5697a90cee2b16aaaf5 100644
--- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/controlDict
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/controlDict
@@ -44,6 +44,6 @@ timePrecision   6;
 
 runTimeModifiable true;
 
-libs ("libthermoBaffleModels.so" "libcompressibleRASModels.so");
+libs ("libthermalBaffleModels.so" "libcompressibleRASModels.so");
 
 // ************************************************************************* //
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/createBafflesDict b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/createBafflesDict
index bc1ec594fd62af581207933a1c55e8505ab839ff..310a64bd7f8b86f2a11d883411ef40b6b6925e2e 100644
--- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/createBafflesDict
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/createBafflesDict
@@ -52,7 +52,7 @@ baffles
                 {
                     T
                     {
-                        type   compressible::thermoBaffle1D<hConstSolidThermoPhysics>;
+                        type   compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
                         baffleActivated yes;
                         thickness       uniform 0.005;  // thickness [m]
                         Qs              uniform 100;    // heat flux [W/m2]
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/thermophysicalProperties b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/thermophysicalProperties
index 7964a240aea24312d6d4b1a1e7957de22fe8e85b..ab678e4d8862b1080531600e7fc902e2144afbc4 100644
--- a/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/thermophysicalProperties
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/thermophysicalProperties
@@ -17,7 +17,7 @@ FoamFile
 
 thermoType
 {
-    type            hePsiThermo;
+    type            heRhoThermo;
     mixture         pureMixture;
     transport       const;
     thermo          hConst;
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/thermophysicalProperties b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/thermophysicalProperties
index 7964a240aea24312d6d4b1a1e7957de22fe8e85b..ab678e4d8862b1080531600e7fc902e2144afbc4 100644
--- a/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/thermophysicalProperties
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/thermophysicalProperties
@@ -17,7 +17,7 @@ FoamFile
 
 thermoType
 {
-    type            hePsiThermo;
+    type            heRhoThermo;
     mixture         pureMixture;
     transport       const;
     thermo          hConst;
diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/constant/thermophysicalProperties b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/constant/thermophysicalProperties
index 4c4cce2da77acfd5f526551b39ace115ed1f1917..55b50fd4b41f02830fd3438ff782ce59ec709996 100644
--- a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/constant/thermophysicalProperties
+++ b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/constant/thermophysicalProperties
@@ -15,11 +15,9 @@ FoamFile
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// thermoType hePsiThermo<pureMixture<const<hConst<perfectGas<specie>>,sensibleEnthalpy>>>;
-
 thermoType
 {
-    type                hePsiThermo;
+    type                heRhoThermo;
     mixture             pureMixture;
     transport           const;
     thermo              hConst;
diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvOptions b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvOptions
index 475ac8e04026f46bd037d6bde5a6ece872345137..e0562a385109a6b6e25313a6189c55ea842a4723 100644
--- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvOptions
+++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvOptions
@@ -51,8 +51,14 @@ porosityBlockage
 
             coordinateSystem
             {
-                e1  (0 1 0);
-                e2  (0 0 1);
+                type    cartesian;
+                origin  (0 0 0);
+                coordinateRotation
+                {
+                    type    axesRotation;
+                    e1      (0 1 0);
+                    e2      (0 0 1);
+                }
             }
         }
     }
diff --git a/tutorials/incompressible/pimpleDyMFoam/movingCone/system/controlDict b/tutorials/incompressible/pimpleDyMFoam/movingCone/system/controlDict
index d30e569e91c1d7948b74ee4a78d850b3773e3774..9b931e305a584b4c9da6a5ba3f1b698fd943b211 100644
--- a/tutorials/incompressible/pimpleDyMFoam/movingCone/system/controlDict
+++ b/tutorials/incompressible/pimpleDyMFoam/movingCone/system/controlDict
@@ -49,5 +49,9 @@ adjustTimeStep  no;
 
 maxCo           0.2;
 
+functions
+{
+    #include "cuttingPlane"
+}
 
 // ************************************************************************* //
diff --git a/tutorials/incompressible/pimpleDyMFoam/movingCone/system/cuttingPlane b/tutorials/incompressible/pimpleDyMFoam/movingCone/system/cuttingPlane
new file mode 100644
index 0000000000000000000000000000000000000000..29b42ee98325da2a54a7563e7abdb2ebb7d4c927
--- /dev/null
+++ b/tutorials/incompressible/pimpleDyMFoam/movingCone/system/cuttingPlane
@@ -0,0 +1,38 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+
+cuttingPlane
+{
+    type            surfaces;
+    functionObjectLibs ("libsampling.so");
+
+    outputControl   outputTime;
+
+    surfaceFormat   vtk;
+    fields          ( p U );
+
+    interpolationScheme cellPoint;
+
+    surfaces
+    (
+        zNormal
+        {
+            type            cuttingPlane;
+            planeType       pointAndNormal;
+            pointAndNormalDict
+            {
+                basePoint       (0 0 0);
+                normalVector    (0 0 1);
+            }
+            interpolate     true;
+        }
+    );
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/system/fvSolution b/tutorials/incompressible/pimpleDyMFoam/propeller/system/fvSolution
index d9be29118014c17abc18029fbcf46f680f125284..567d4f5a40b7544580b7e597c2545a8be54fbd3d 100644
--- a/tutorials/incompressible/pimpleDyMFoam/propeller/system/fvSolution
+++ b/tutorials/incompressible/pimpleDyMFoam/propeller/system/fvSolution
@@ -63,7 +63,7 @@ solvers
 PIMPLE
 {
     correctPhi          no;
-    nOuterCorrectors    3;
+    nOuterCorrectors    2;
     nCorrectors         1;
     nNonOrthogonalCorrectors 0;
 }
diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/system/createBafflesDict b/tutorials/incompressible/pimpleFoam/TJunctionFan/system/createBafflesDict
index 544288617fb6712ce5406f73102526af3e589111..1ee58bdb3e6049364e4dcefdc221f66701d298fb 100644
--- a/tutorials/incompressible/pimpleFoam/TJunctionFan/system/createBafflesDict
+++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/system/createBafflesDict
@@ -41,14 +41,16 @@ baffles
                 name            baffles;
                 type            wall;
 
+                    XXX 9.8;
                 patchFields
                 {
+
                     epsilon
                     {
                         type            epsilonWallFunction;
                         Cmu             0.09;
                         kappa           0.41;
-                        E               9.8;
+                        E               $Cmu; // XXX; //9.8;
                         value           uniform 0;
                     }
                     k
@@ -81,11 +83,8 @@ baffles
             }
             slave
             {
-                //- Slave side patch
-                name            baffles;
-                type            wall;
-
-                ${..master.patchFields}
+                // Reuse master data
+                ${..master}
             }
         }
     }
diff --git a/tutorials/incompressible/simpleFoam/motorBike/Allrun b/tutorials/incompressible/simpleFoam/motorBike/Allrun
index d3466dcfab58f9900044d93201fad9910d88d874..5275ea56bf3ad82f99374148f8d3f0ab8af319b4 100755
--- a/tutorials/incompressible/simpleFoam/motorBike/Allrun
+++ b/tutorials/incompressible/simpleFoam/motorBike/Allrun
@@ -22,6 +22,9 @@ ls -d processor* | xargs -i cp -r 0.org ./{}/0 $1
 
 runParallel patchSummary 6
 runParallel potentialFoam 6 -noFunctionObjects -writep
-runParallel `getApplication` 6
+runParallel $(getApplication) 6
+
+runApplication reconstructParMesh -constant
+runApplication reconstructPar -latestTime
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict
index f075505d6870afcaed85cdfe23a65e4b7e1aca33..553c603b445da3b5b018fb13da13561d256fb82c 100644
--- a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict
+++ b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict
@@ -40,17 +40,17 @@ writeInterval   100;
 purgeWrite      0;
 
 
-//- Have regular restart files
-secondaryWriteControl    cpuTime;
-secondaryWriteInterval   120;
-secondaryPurgeWrite      1;
+//- Uncomment to have regular (every 2 hours of run time) restart files
+//secondaryWriteControl    cpuTime; // runtime
+//secondaryWriteInterval   7200;    // seconds
+//secondaryPurgeWrite      1;       // keep all but last dump
 
 
-writeFormat     ascii;
+writeFormat     binary;
 
 writePrecision  6;
 
-writeCompression compressed;
+writeCompression uncompressed;
 
 timeFormat      general;
 
diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs b/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs
index 7ecdf6047874fcd47b307c4fbd469df4bf7e2bcc..e4977a21d67e8fc508c98229db21659e0d4876cf 100644
--- a/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs
+++ b/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs
@@ -9,8 +9,12 @@
 forceCoeffs1
 {
     type        forceCoeffs;
+
     functionObjectLibs ( "libforces.so" );
-    outputControl outputTime;
+
+    outputControl   timeStep;
+    outputInterval  1;
+
     log         yes;
 
     patches     ( "motorBike.*" );
@@ -27,9 +31,13 @@ forceCoeffs1
     lRef        1.42;        // Wheelbase length
     Aref        0.75;        // Estimated
 
-    nBin        20;          // output data into bins
-    binDir      (1 0 0);     // bin direction
-    binFormat   gnuplot;
+    binData
+    {
+        nBin        20;          // output data into 20 bins
+        direction   (1 0 0);     // bin direction
+        format      gnuplot;
+        cumulative  yes;
+    }
 }
 
 
diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/thermophysicalProperties b/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/thermophysicalProperties
index 9b63bc18b377f17d1f016206567f66bcbe76470f..c2a5aa1eb714500078dbda1babe184712eb8de1c 100644
--- a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/thermophysicalProperties
+++ b/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/thermophysicalProperties
@@ -47,5 +47,7 @@ solids
     // none
 }
 
+// de-activate the pressure-work term when running local time-stepping
+dpdt            no;
 
 // ************************************************************************* //
diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/system/fvOptions b/tutorials/lagrangian/reactingParcelFoam/filter/system/fvOptions
index a6fa8898ba577ffbd6af1c575adf5d43f08ac45c..ea198445a4b91941c3e04500cb7e7f2a4a59f8ea 100644
--- a/tutorials/lagrangian/reactingParcelFoam/filter/system/fvOptions
+++ b/tutorials/lagrangian/reactingParcelFoam/filter/system/fvOptions
@@ -33,8 +33,14 @@ filter1
 
             coordinateSystem
             {
-                e1  (1 0 0);
-                e2  (0 1 0);
+                type    cartesian;
+                origin  (0 0 0);
+                coordinateRotation
+                {
+                    type    axesRotation;
+                    e1  (1 0 0);
+                    e2  (0 1 0);
+                }
             }
         }
     }
diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/chemkin/therm.dat b/tutorials/lagrangian/sprayFoam/aachenBomb/chemkin/therm.dat
new file mode 100644
index 0000000000000000000000000000000000000000..acd597870e7648990693276b3be087eb79769e10
--- /dev/null
+++ b/tutorials/lagrangian/sprayFoam/aachenBomb/chemkin/therm.dat
@@ -0,0 +1,23 @@
+THERMO ALL
+   200.000  1000.000  6000.000
+C7H16             P10/85C  7.H 16.   0.   0.G   200.000  6000.000 1000.        1
+ 2.04565203E+01 3.48575357E-02-1.09226846E-05 1.67201776E-09-9.81024850E-14    2
+-3.25556365E+04-8.04405017E+01 1.11532994E+01-9.49419773E-03 1.95572075E-04    3
+-2.49753662E-07 9.84877715E-11-2.67688904E+04-1.59096837E+01-2.25846141E+04    4
+O2                ATcT06O  2.   0.   0.   0.G   200.000  6000.000 1000.        1
+ 3.45852381E+00 1.04045351E-03-2.79664041E-07 3.11439672E-11-8.55656058E-16    2
+ 1.02229063E+04 4.15264119E+00 3.78535371E+00-3.21928540E-03 1.12323443E-05    3
+-1.17254068E-08 4.17659585E-12 1.02922572E+04 3.27320239E+00 1.13558105E+04    4
+N2                G 8/02N  2.   0.   0.   0.G   200.000  6000.000 1000.        1
+ 2.95257637E+00 1.39690040E-03-4.92631603E-07 7.86010195E-11-4.60755204E-15    2
+-9.23948688E+02 5.87188762E+00 3.53100528E+00-1.23660988E-04-5.02999433E-07    3
+ 2.43530612E-09-1.40881235E-12-1.04697628E+03 2.96747038E+00 0.00000000E+00    4
+CO2               L 7/88C   1O   2    0    0G   200.000  6000.000 1000.        1
+ 0.46365111E+01 0.27414569E-02-0.99589759E-06 0.16038666E-09-0.91619857E-14    2
+-0.49024904E+05-0.19348955E+01 0.23568130E+01 0.89841299E-02-0.71220632E-05    3
+ 0.24573008E-08-0.14288548E-12-0.48371971E+05 0.99009035E+01-0.47328105E+05    4
+H2O               L 5/89H   2O   1    0    0G   200.000  6000.000 1000.        1
+ 0.26770389E+01 0.29731816E-02-0.77376889E-06 0.94433514E-10-0.42689991E-14    2
+-0.29885894E+05 0.68825500E+01 0.41986352E+01-0.20364017E-02 0.65203416E-05    3
+-0.54879269E-08 0.17719680E-11-0.30293726E+05-0.84900901E+00-0.29084817E+05    4
+END
diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/chemistryProperties b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/chemistryProperties
index deb5491013c05aed54633d71e45a00b846466bd8..ea16d954f1b6ac9f838e400fb3c901e68d253a6e 100644
--- a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/chemistryProperties
+++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/chemistryProperties
@@ -21,7 +21,7 @@ chemistryType
     chemistryThermo   psi;
 }
 
-chemistry       off;
+chemistry       on;
 
 initialChemicalTimeStep 1e-07;
 
diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/combustionProperties b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/combustionProperties
index 8f326f366756a02663e3cfeaed1ea4a0f4e5ce2d..f7b1cae9b7e231c48821bf9f85a80971d1bc85a9 100644
--- a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/combustionProperties
+++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/combustionProperties
@@ -15,9 +15,9 @@ FoamFile
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-combustionModel  PaSR<psiChemistryCombustion>;
+combustionModel PaSR<psiChemistryCombustion>;
 
-active  false;
+active          yes;
 
 PaSRCoeffs
 {
diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/thermophysicalProperties b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/thermophysicalProperties
index b0ac29548bc09dd4224d2bb7dadbb7c0552f65e2..ebae047d0b2c937d4449fb44388eb763070cec25 100644
--- a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/thermophysicalProperties
+++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/thermophysicalProperties
@@ -28,7 +28,9 @@ thermoType
 
 CHEMKINFile     "$FOAM_CASE/chemkin/chem.inp";
 
-CHEMKINThermoFile "~OpenFOAM/thermoData/therm.dat";
+CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat";
+
+newFormat       yes;
 
 inertSpecie     N2;
 
diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/system/controlDict b/tutorials/lagrangian/sprayFoam/aachenBomb/system/controlDict
index 89dc909c58b7dc17c22478a8b6de6c2b35a0d03c..7c512bc41b8db80e2d80b87af07e7c6fa7150838 100644
--- a/tutorials/lagrangian/sprayFoam/aachenBomb/system/controlDict
+++ b/tutorials/lagrangian/sprayFoam/aachenBomb/system/controlDict
@@ -8,7 +8,7 @@
 FoamFile
 {
     version     2.0;
-    format      binary;
+    format      ascii;
     class       dictionary;
     location    "system";
     object      controlDict;
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/0/T.org b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/0/T.org
similarity index 97%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/0/T.org
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/0/T.org
index e5ac2eeb27e347dab629027bf93918e211179ee3..ce47bfaefcfa1a98ef1d8e640c3e1ac012478a14 100644
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/0/T.org
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/0/T.org
@@ -10,7 +10,7 @@ FoamFile
     version     2.0;
     format      ascii;
     class       volScalarField;
-    object      alpha1;
+    object      T;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/0/U b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/0/U
similarity index 100%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/0/U
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/0/U
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/0/alphawater.org b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/0/alphawater.org
similarity index 100%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/0/alphawater.org
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/0/alphawater.org
diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/0/p.org b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/0/p.org
new file mode 100644
index 0000000000000000000000000000000000000000..1e603613afa78464d8eb6271352e9887d5615e39
--- /dev/null
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/0/p.org
@@ -0,0 +1,35 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       volScalarField;
+    object      p;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+dimensions      [1 -1 -2 0 0 0 0];
+
+internalField   uniform 1e5;
+
+boundaryField
+{
+    walls
+    {
+        type            calculated;
+        value           uniform 1e5;
+    }
+
+    defaultFaces
+    {
+        type            empty;
+    }
+}
+
+// ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/0/p_rgh.org b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/0/p_rgh.org
similarity index 100%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/0/p_rgh.org
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/0/p_rgh.org
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/Allclean b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/Allclean
similarity index 67%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/Allclean
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/Allclean
index d6e8dce5df4d6bb1480f3d9a86ae4abb36ea0fff..8821d7e1cc12328cac82fd5fbcfeb2cd2198e4ef 100755
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/Allclean
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/Allclean
@@ -3,4 +3,4 @@ cd ${0%/*} || exit 1    # run from this directory
 
 foamCleanTutorials cases
 rm -rf processor*
-rm -rf 0/p_rgh.gz 0/alphawater.gz 0/T.gz
+rm -rf 0/p_rgh.gz 0/p.gz 0/alphawater.gz 0/T*.gz
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/Allrun b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/Allrun
similarity index 96%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/Allrun
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/Allrun
index 76547516b77f0ec8beb17b5b56f9419008d1c5b2..ac803d715f9a0b56c58f68b1c496093fbee21d3d 100755
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/Allrun
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/Allrun
@@ -10,6 +10,7 @@ application=`getApplication`
 runApplication blockMesh
 cp 0/alphawater.org 0/alphawater
 cp 0/p_rgh.org 0/p_rgh
+cp 0/p.org 0/p
 cp 0/T.org 0/T
 runApplication setFields
 runApplication $application
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/LESProperties b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/LESProperties
similarity index 100%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/LESProperties
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/LESProperties
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/g b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/g
similarity index 100%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/g
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/g
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/polyMesh/blockMeshDict b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/polyMesh/blockMeshDict
similarity index 100%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/polyMesh/blockMeshDict
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/polyMesh/blockMeshDict
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/polyMesh/boundary b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/polyMesh/boundary
similarity index 100%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/polyMesh/boundary
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/polyMesh/boundary
diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalProperties b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalProperties
new file mode 100644
index 0000000000000000000000000000000000000000..9c14314414d80ca417142445651da9b4b1b5ce69
--- /dev/null
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalProperties
@@ -0,0 +1,24 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "constant";
+    object      thermophysicalProperties;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+phases (water air);
+
+pMin            pMin [ 1 -1 -2 0 0 0 0 ] 10000;
+
+sigma           sigma [ 1 0 -2 0 0 0 0 ] 0.07;
+
+// ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalPropertiesair b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalPropertiesair
new file mode 100644
index 0000000000000000000000000000000000000000..e61009c10be927d2af1b6981cc75ad368e85d5c3
--- /dev/null
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalPropertiesair
@@ -0,0 +1,49 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "constant";
+    object      thermophysicalProperties;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+thermoType
+{
+    type            heRhoThermo;
+    mixture         pureMixture;
+    transport       const;
+    thermo          hConst;
+    equationOfState perfectGas;
+    specie          specie;
+    energy          sensibleInternalEnergy;
+}
+
+mixture
+{
+    specie
+    {
+        nMoles      1;
+        molWeight   28.9;
+    }
+    thermodynamics
+    {
+        Cp          1007;
+        Hf          0;
+    }
+    transport
+    {
+        mu          1.84e-05;
+        Pr          0.7;
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalPropertieswater b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalPropertieswater
new file mode 100644
index 0000000000000000000000000000000000000000..1ffcbddad7b44c5aecf0266ac4d48835674b0344
--- /dev/null
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalPropertieswater
@@ -0,0 +1,54 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "constant";
+    object      thermophysicalProperties;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+thermoType
+{
+    type            heRhoThermo;
+    mixture         pureMixture;
+    transport       const;
+    thermo          hConst;
+    equationOfState perfectFluid;
+    specie          specie;
+    energy          sensibleInternalEnergy;
+}
+
+mixture
+{
+    specie
+    {
+        nMoles      1;
+        molWeight   18.0;
+    }
+    equationOfState
+    {
+        R           3000;
+        rho0        1027;
+    }
+    thermodynamics
+    {
+        Cp          4195;
+        Hf          0;
+    }
+    transport
+    {
+        mu          3.645e-4;
+        Pr          2.289;
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/turbulenceProperties b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/turbulenceProperties
similarity index 97%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/turbulenceProperties
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/turbulenceProperties
index a925d3cc2b28640b5aebf7779f6a9008e77b09fc..c2c3b28a1b4e8f4a2cae55f58bd61f9b1a67b488 100644
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/turbulenceProperties
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/turbulenceProperties
@@ -15,7 +15,7 @@ FoamFile
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-simulationType  LESModel;
+simulationType  laminar;
 
 
 // ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/controlDict b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/controlDict
similarity index 100%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/controlDict
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/controlDict
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/fvSchemes b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/fvSchemes
similarity index 85%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/fvSchemes
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/fvSchemes
index 903d94d30c6e6ac6ecc85e0d048a668f7d3cb220..3582eeafa1a910f67c7fc1e7194b8aee21994754 100644
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/fvSchemes
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/fvSchemes
@@ -27,14 +27,18 @@ gradSchemes
 
 divSchemes
 {
-    div(rho*phi,U)  Gauss upwind;
     div(phi,alpha)  Gauss vanLeer;
     div(phirb,alpha) Gauss interfaceCompression 1;
-    div(phid1,p_rgh) Gauss upwind;
-    div(phid2,p_rgh) Gauss upwind;
+
+    div(rho*phi,U)  Gauss upwind;
+    div(phi,thermo:rhowater) Gauss upwind;
+    div(phi,thermo:rhoair) Gauss upwind;
     div(rho*phi,T)  Gauss upwind;
-    div(phi,k)      Gauss vanLeer;
-    div((muEff*dev(T(grad(U))))) Gauss linear;
+    div(rho*phi,K)  Gauss upwind;
+    div(phi,p)      Gauss upwind;
+    div(phi,k)      Gauss upwind;
+
+    div((muEff*dev2(T(grad(U))))) Gauss linear;
 }
 
 laplacianSchemes
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/fvSolution b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/fvSolution
similarity index 96%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/fvSolution
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/fvSolution
index 461897454640df6743233c416536bbb89b0fa6a0..7577b94f2117c0747b8af59a35a1d46738d3b7ab 100644
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/fvSolution
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/fvSolution
@@ -39,7 +39,7 @@ solvers
         maxIter         100;
     }
 
-    "(rho|rhoFinal)"
+    ".*(rho|rhoFinal)"
     {
         solver          diagonal;
     }
@@ -103,9 +103,9 @@ solvers
 PIMPLE
 {
     momentumPredictor no;
-    transSonic      no;
-    nOuterCorrectors 3;
-    nCorrectors     1;
+    transonic       no;
+    nOuterCorrectors 1;
+    nCorrectors     2;
     nNonOrthogonalCorrectors 0;
     nAlphaCorr      1;
     nAlphaSubCycles 1;
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/setFieldsDict b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/setFieldsDict
similarity index 95%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/setFieldsDict
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/setFieldsDict
index 88198a4d2492d2a3aea2da05522422006700024a..f312b4e9725624b24c148066d9685f03d42e2a9f 100644
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/setFieldsDict
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/system/setFieldsDict
@@ -19,6 +19,7 @@ defaultFieldValues
 (
     volScalarFieldValue alphawater 1
     volScalarFieldValue p_rgh 1e5
+    volScalarFieldValue p 1e5
     volScalarFieldValue T 300
 );
 
@@ -32,6 +33,7 @@ regions
         (
             volScalarFieldValue alphawater 0
             volScalarFieldValue p_rgh 1e6
+            volScalarFieldValue p 1e6
             volScalarFieldValue T 578
         );
     }
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/0/T.org b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/0/T.org
similarity index 92%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/0/T.org
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/0/T.org
index b40cb08478605737ff4cac5ebc6bf0cef6004ac7..ce47bfaefcfa1a98ef1d8e640c3e1ac012478a14 100644
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/0/T.org
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/0/T.org
@@ -10,7 +10,7 @@ FoamFile
     version     2.0;
     format      ascii;
     class       volScalarField;
-    object      alpha1;
+    object      T;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -24,6 +24,11 @@ boundaryField
     {
         type            zeroGradient;
     }
+
+    defaultFaces
+    {
+        type            empty;
+    }
 }
 
 // ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/0/U b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/0/U
similarity index 94%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/0/U
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/0/U
index d37b2aea30e93c01cec35a4a5e005d7cc6e151ab..f267a870fcbaa90279da2fa20989a83329804a6a 100644
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/0/U
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/0/U
@@ -25,6 +25,10 @@ boundaryField
         type            fixedValue;
         value           uniform (0 0 0);
     }
+    frontAndBack
+    {
+        type            empty;
+    }
 }
 
 // ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/0/alphawater.org b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/0/alphawater.org
similarity index 94%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/0/alphawater.org
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/0/alphawater.org
index 62be61f403a247c589ce0dfd45bc84e54eaeb536..d90b720092af3d27f74cf6ca3cb23723735c73da 100644
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/0/alphawater.org
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/0/alphawater.org
@@ -24,6 +24,11 @@ boundaryField
     {
         type            zeroGradient;
     }
+
+    defaultFaces
+    {
+        type            empty;
+    }
 }
 
 // ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/0/p.org b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/0/p.org
new file mode 100644
index 0000000000000000000000000000000000000000..1e603613afa78464d8eb6271352e9887d5615e39
--- /dev/null
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/0/p.org
@@ -0,0 +1,35 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       volScalarField;
+    object      p;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+dimensions      [1 -1 -2 0 0 0 0];
+
+internalField   uniform 1e5;
+
+boundaryField
+{
+    walls
+    {
+        type            calculated;
+        value           uniform 1e5;
+    }
+
+    defaultFaces
+    {
+        type            empty;
+    }
+}
+
+// ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/0/p_rgh.org b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/0/p_rgh.org
similarity index 94%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/0/p_rgh.org
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/0/p_rgh.org
index 0394387374d5ef9bb77528165e097f872381d9a4..396d380daddd7bc4e4a3c9d427a5226c6c3f44af 100644
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/0/p_rgh.org
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/0/p_rgh.org
@@ -25,6 +25,11 @@ boundaryField
         type            fixedFluxPressure;
         value           uniform 1e5;
     }
+
+    defaultFaces
+    {
+        type            empty;
+    }
 }
 
 // ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/Allclean b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/Allclean
similarity index 74%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/Allclean
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/Allclean
index 539c7721669d0975387894caa2ffcd81d6927fae..3ec07f62c5ce06923cbfba8158a68fa1c3cdc6f1 100755
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/Allclean
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/Allclean
@@ -3,6 +3,6 @@ cd ${0%/*} || exit 1    # run from this directory
 
 foamCleanTutorials cases
 rm -rf processor*
-rm -rf 0/p_rgh 0/p_rgh.gz 0/alphawater 0/alphawater.gz 0/T.gz
+rm -rf 0/p_rgh.gz 0/p.gz 0/alphawater.gz 0/T.gz
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/Allrun b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/Allrun
similarity index 96%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/Allrun
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/Allrun
index 0941ac4aa1aaff404b79022685eec6717e2ed8aa..11b84a3251a97ea8539fe65034448bf77d3ebb6a 100755
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/Allrun
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/Allrun
@@ -10,6 +10,7 @@ application=`getApplication`
 runApplication blockMesh
 cp 0/alphawater.org 0/alphawater
 cp 0/p_rgh.org 0/p_rgh
+cp 0/p.org 0/p
 cp 0/T.org 0/T
 runApplication setFields
 runApplication decomposePar
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/LESProperties b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/LESProperties
similarity index 100%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/LESProperties
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/LESProperties
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/g b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/g
similarity index 100%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/g
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/g
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/polyMesh/blockMeshDict b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/polyMesh/blockMeshDict
similarity index 100%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/polyMesh/blockMeshDict
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/polyMesh/blockMeshDict
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/polyMesh/boundary b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/polyMesh/boundary
similarity index 100%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/polyMesh/boundary
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/polyMesh/boundary
diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/thermophysicalProperties b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/thermophysicalProperties
new file mode 100644
index 0000000000000000000000000000000000000000..9c14314414d80ca417142445651da9b4b1b5ce69
--- /dev/null
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/thermophysicalProperties
@@ -0,0 +1,24 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "constant";
+    object      thermophysicalProperties;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+phases (water air);
+
+pMin            pMin [ 1 -1 -2 0 0 0 0 ] 10000;
+
+sigma           sigma [ 1 0 -2 0 0 0 0 ] 0.07;
+
+// ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/thermophysicalPropertiesair b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/thermophysicalPropertiesair
new file mode 100644
index 0000000000000000000000000000000000000000..e61009c10be927d2af1b6981cc75ad368e85d5c3
--- /dev/null
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/thermophysicalPropertiesair
@@ -0,0 +1,49 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "constant";
+    object      thermophysicalProperties;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+thermoType
+{
+    type            heRhoThermo;
+    mixture         pureMixture;
+    transport       const;
+    thermo          hConst;
+    equationOfState perfectGas;
+    specie          specie;
+    energy          sensibleInternalEnergy;
+}
+
+mixture
+{
+    specie
+    {
+        nMoles      1;
+        molWeight   28.9;
+    }
+    thermodynamics
+    {
+        Cp          1007;
+        Hf          0;
+    }
+    transport
+    {
+        mu          1.84e-05;
+        Pr          0.7;
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/thermophysicalPropertieswater b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/thermophysicalPropertieswater
new file mode 100644
index 0000000000000000000000000000000000000000..1ffcbddad7b44c5aecf0266ac4d48835674b0344
--- /dev/null
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/thermophysicalPropertieswater
@@ -0,0 +1,54 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "constant";
+    object      thermophysicalProperties;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+thermoType
+{
+    type            heRhoThermo;
+    mixture         pureMixture;
+    transport       const;
+    thermo          hConst;
+    equationOfState perfectFluid;
+    specie          specie;
+    energy          sensibleInternalEnergy;
+}
+
+mixture
+{
+    specie
+    {
+        nMoles      1;
+        molWeight   18.0;
+    }
+    equationOfState
+    {
+        R           3000;
+        rho0        1027;
+    }
+    thermodynamics
+    {
+        Cp          4195;
+        Hf          0;
+    }
+    transport
+    {
+        mu          3.645e-4;
+        Pr          2.289;
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/turbulenceProperties b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/turbulenceProperties
similarity index 97%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/turbulenceProperties
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/turbulenceProperties
index a925d3cc2b28640b5aebf7779f6a9008e77b09fc..c2c3b28a1b4e8f4a2cae55f58bd61f9b1a67b488 100644
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/turbulenceProperties
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/turbulenceProperties
@@ -15,7 +15,7 @@ FoamFile
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-simulationType  LESModel;
+simulationType  laminar;
 
 
 // ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/controlDict b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/controlDict
similarity index 100%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/controlDict
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/controlDict
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/decomposeParDict b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/decomposeParDict
similarity index 100%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/decomposeParDict
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/decomposeParDict
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSchemes b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/fvSchemes
similarity index 85%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSchemes
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/fvSchemes
index 903d94d30c6e6ac6ecc85e0d048a668f7d3cb220..3582eeafa1a910f67c7fc1e7194b8aee21994754 100644
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSchemes
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/fvSchemes
@@ -27,14 +27,18 @@ gradSchemes
 
 divSchemes
 {
-    div(rho*phi,U)  Gauss upwind;
     div(phi,alpha)  Gauss vanLeer;
     div(phirb,alpha) Gauss interfaceCompression 1;
-    div(phid1,p_rgh) Gauss upwind;
-    div(phid2,p_rgh) Gauss upwind;
+
+    div(rho*phi,U)  Gauss upwind;
+    div(phi,thermo:rhowater) Gauss upwind;
+    div(phi,thermo:rhoair) Gauss upwind;
     div(rho*phi,T)  Gauss upwind;
-    div(phi,k)      Gauss vanLeer;
-    div((muEff*dev(T(grad(U))))) Gauss linear;
+    div(rho*phi,K)  Gauss upwind;
+    div(phi,p)      Gauss upwind;
+    div(phi,k)      Gauss upwind;
+
+    div((muEff*dev2(T(grad(U))))) Gauss linear;
 }
 
 laplacianSchemes
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSolution b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/fvSolution
similarity index 96%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSolution
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/fvSolution
index 461897454640df6743233c416536bbb89b0fa6a0..7577b94f2117c0747b8af59a35a1d46738d3b7ab 100644
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSolution
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/fvSolution
@@ -39,7 +39,7 @@ solvers
         maxIter         100;
     }
 
-    "(rho|rhoFinal)"
+    ".*(rho|rhoFinal)"
     {
         solver          diagonal;
     }
@@ -103,9 +103,9 @@ solvers
 PIMPLE
 {
     momentumPredictor no;
-    transSonic      no;
-    nOuterCorrectors 3;
-    nCorrectors     1;
+    transonic       no;
+    nOuterCorrectors 1;
+    nCorrectors     2;
     nNonOrthogonalCorrectors 0;
     nAlphaCorr      1;
     nAlphaSubCycles 1;
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/setFieldsDict b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/setFieldsDict
similarity index 95%
rename from tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/setFieldsDict
rename to tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/setFieldsDict
index ec31deae034f52a0bcee92507698a43d1acd06de..dc90a362c06eab75ce1c892c6f693f67b817d413 100644
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/setFieldsDict
+++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/system/setFieldsDict
@@ -19,6 +19,7 @@ defaultFieldValues
 (
     volScalarFieldValue alphawater 1
     volScalarFieldValue p_rgh 1e5
+    volScalarFieldValue p 1e5
     volScalarFieldValue T 300
 );
 
@@ -32,6 +33,7 @@ regions
         (
             volScalarFieldValue alphawater 0
             volScalarFieldValue p_rgh 1e6
+            volScalarFieldValue p 1e6
             volScalarFieldValue T 578
         );
     }
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/transportProperties b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/transportProperties
deleted file mode 100644
index 564df56f2083c586a247b9a7276aba1b90d3a4f2..0000000000000000000000000000000000000000
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/constant/transportProperties
+++ /dev/null
@@ -1,59 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
-|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       dictionary;
-    location    "constant";
-    object      transportProperties;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-phases (water air);
-
-water
-{
-    transportModel  Newtonian;
-    nu              1e-06;
-    rho             1000;
-    k               0; // 0.613;
-    Cv              4179;
-
-    equationOfState
-    {
-        type            perfectFluid;
-
-        rho0            1000;
-        R               3000;
-    }
-}
-
-air
-{
-    transportModel  Newtonian;
-    nu              1.589e-05;
-    rho             1;
-    k               0; // 2.63e-2;
-    Cv              721;
-
-    equationOfState
-    {
-        type            perfectFluid;
-
-        rho0            0;
-        R               287;
-    }
-}
-
-pMin            pMin [ 1 -1 -2 0 0 0 0 ] 10000;
-
-sigma           sigma [ 1 0 -2 0 0 0 0 ] 0.07;
-
-
-// ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/transportProperties b/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/transportProperties
deleted file mode 100644
index 564df56f2083c586a247b9a7276aba1b90d3a4f2..0000000000000000000000000000000000000000
--- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/constant/transportProperties
+++ /dev/null
@@ -1,59 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
-|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       dictionary;
-    location    "constant";
-    object      transportProperties;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-phases (water air);
-
-water
-{
-    transportModel  Newtonian;
-    nu              1e-06;
-    rho             1000;
-    k               0; // 0.613;
-    Cv              4179;
-
-    equationOfState
-    {
-        type            perfectFluid;
-
-        rho0            1000;
-        R               3000;
-    }
-}
-
-air
-{
-    transportModel  Newtonian;
-    nu              1.589e-05;
-    rho             1;
-    k               0; // 2.63e-2;
-    Cv              721;
-
-    equationOfState
-    {
-        type            perfectFluid;
-
-        rho0            0;
-        R               287;
-    }
-}
-
-pMin            pMin [ 1 -1 -2 0 0 0 0 ] 10000;
-
-sigma           sigma [ 1 0 -2 0 0 0 0 ] 0.07;
-
-
-// ************************************************************************* //
diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/epsilon b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/epsilon
index d5ee15eb79d080246921e64270bf55a4d1541884..bb5b3e0a73f083f93109b40e0d3659f5f1466b6d 100644
--- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/epsilon
+++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/epsilon
@@ -29,6 +29,7 @@ boundaryField
     outlet
     {
         type            inletOutlet;
+        phi             phiwater;
         inletValue      uniform 0.1;
         value           uniform 0.1;
     }
diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/k b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/k
index a791cb824f67debc5017f8efa4da5b3e4349556d..9701bd625c5d07a6522baa8bdfbbc7b42ba0db3c 100644
--- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/k
+++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/k
@@ -29,6 +29,7 @@ boundaryField
     outlet
     {
         type            inletOutlet;
+        phi             phiwater;
         inletValue      uniform 1e-8;
         value           uniform 1e-8;
     }
diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/thermophysicalPropertieswater b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/thermophysicalPropertieswater
index 672b24a98b365f170f3f2567723294befd79a06e..789f0427d7c9bd5d4d833f44b0f39359e8ab8bbf 100644
--- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/thermophysicalPropertieswater
+++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/thermophysicalPropertieswater
@@ -35,6 +35,7 @@ mixture
     }
     equationOfState
     {
+        R           3000;
         rho0        1027;
     }
     thermodynamics
diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSchemes b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSchemes
index 1851801037164e3c374b26e9660cfdfb6b1d0699..c0ea375341437d614a1cad16c12827f45ec79cdd 100644
--- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSchemes
+++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSchemes
@@ -35,10 +35,10 @@ divSchemes
     "div\(alphaPhi.*,U.*\)" Gauss limitedLinearV 1;
     "div\(phi.*,U.*\)"      Gauss limitedLinearV 1;
     "div\(\(alpha.*Rc\)\)"  Gauss linear;
-    "div\(phid.*,p\)"       Gauss upwind;
+    "div\(phi.*,.*rho.*\)"  Gauss linear;
 
     "div\(alphaPhi.*,h.*\)" Gauss limitedLinear 1;
-    "div\(phi.*,K.*\)"      Gauss limitedLinear 1;
+    "div\(alphaPhi.*,K.*\)" Gauss limitedLinear 1;
 
     "div\(alphaPhi.*,(k|epsilon)\)"  Gauss limitedLinear 1;
 }
diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/epsilon b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/epsilon
index ee84cd44265e7dcde3de56307d9e9d6f7d737883..69b3e74c838b2f693281b70c870742448faeb9b8 100644
--- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/epsilon
+++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/epsilon
@@ -31,6 +31,7 @@ boundaryField
     outlet
     {
         type               inletOutlet;
+        phi                phi2;
         inletValue         uniform 10.0;
         value              uniform 10.0;
     }
diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/k b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/k
index 45302e2a18f632b4bcc79ff4bd9535e971dbbf5f..1ae05e468e21b3ba28c4aecccfafa12962e30bce 100644
--- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/k
+++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/k
@@ -31,6 +31,7 @@ boundaryField
     outlet
     {
         type               inletOutlet;
+        phi                phi2;
         inletValue         uniform 1.0;
         value              uniform 1.0;
     }
diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/thermophysicalProperties1 b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/thermophysicalProperties1
index 94e852ea580142d8e4056c0453e562fb16c4ddcd..0ac5f83a42bcfee041ee23060a2d9ba85d476fab 100644
--- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/thermophysicalProperties1
+++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/thermophysicalProperties1
@@ -23,7 +23,7 @@ thermoType
     thermo          hConst;
     equationOfState rhoConst;
     specie          specie;
-    energy          sensibleEnthalpy;
+    energy          sensibleInternalEnergy;
 }
 
 mixture
diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/thermophysicalProperties2 b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/thermophysicalProperties2
index 11c033af59bbfbf08d2b11244e50f0fd00c1542f..e61009c10be927d2af1b6981cc75ad368e85d5c3 100644
--- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/thermophysicalProperties2
+++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/thermophysicalProperties2
@@ -23,7 +23,7 @@ thermoType
     thermo          hConst;
     equationOfState perfectGas;
     specie          specie;
-    energy          sensibleEnthalpy;
+    energy          sensibleInternalEnergy;
 }
 
 mixture
diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/system/fvSchemes b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/system/fvSchemes
index 8799476cc7e664f2c61971b499d754a70597b8c8..6cbee38f7871c73a58663948be4905135d9e649e 100644
--- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/system/fvSchemes
+++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/system/fvSchemes
@@ -35,10 +35,10 @@ divSchemes
     "div\(alphaPhi.,U.\)"   Gauss limitedLinearV 1;
     "div\(phi.,U.\)"        Gauss limitedLinearV 1;
     "div\(\(alpha.*Rc\)\)"  Gauss linear;
-    "div\(phid.,p\)"        Gauss upwind;
+    "div\(phi.*,.*rho.*\)"  Gauss linear;
 
-    "div\(alphaPhi.,h.\)"   Gauss limitedLinear 1;
-    "div\(phi.,K.\)"        Gauss limitedLinear 1;
+    "div\(alphaPhi.,(h|e).\)"   Gauss limitedLinear 1;
+    "div\(alphaPhi.,(K.|p)\)"   Gauss limitedLinear 1;
 
     div(alphaPhi2,k)        Gauss limitedLinear 1;
     div(alphaPhi2,epsilon)  Gauss limitedLinear 1;
diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/system/fvSolution b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/system/fvSolution
index 1c5fdb8117442a664283f6e9e5255f9b72fec896..a2906e9722b1ed3183c4eb5484fd25c103863e38 100644
--- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/system/fvSolution
+++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/system/fvSolution
@@ -47,7 +47,7 @@ solvers
         relTol          0;
     }
 
-    "h.*"
+    "(h|e).*"
     {
         solver          PBiCG;
         preconditioner  DILU;
diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/thermophysicalProperties2 b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/thermophysicalProperties2
index 672b24a98b365f170f3f2567723294befd79a06e..789f0427d7c9bd5d4d833f44b0f39359e8ab8bbf 100644
--- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/thermophysicalProperties2
+++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/thermophysicalProperties2
@@ -35,6 +35,7 @@ mixture
     }
     equationOfState
     {
+        R           3000;
         rho0        1027;
     }
     thermodynamics
diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/system/fvSchemes b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/system/fvSchemes
index c88d130244546a1ff2e35b56f4b493207bc956ff..275907488b4c204290759f85a7003bb66f553902 100644
--- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/system/fvSchemes
+++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/system/fvSchemes
@@ -35,10 +35,10 @@ divSchemes
     "div\(alphaPhi.,U.\)"   Gauss limitedLinearV 1;
     "div\(phi.,U.\)"        Gauss limitedLinearV 1;
     "div\(\(alpha.*Rc\)\)"  Gauss linear;
-    "div\(phid.,p\)"        Gauss linear;
+    "div\(phi.*,.*rho.*\)"  Gauss linear;
 
     "div\(alphaPhi.,h.\)"   Gauss limitedLinear 1;
-    "div\(phi.,K.\)"        Gauss linear;
+    "div\(alphaPhi.,K.\)"   Gauss limitedLinear 1;
 
     "div\(alphaPhi.,(k|epsilon)\)"  Gauss limitedLinear 1;
 }
diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed/0/Theta b/tutorials/multiphase/twoPhaseEulerFoam/bed/0/Theta
index 3a4a3b6744614cd730f8805ad21820c9e99117e8..2ac308e7d1ce434b094e84b917904db8fd356bb7 100644
--- a/tutorials/multiphase/twoPhaseEulerFoam/bed/0/Theta
+++ b/tutorials/multiphase/twoPhaseEulerFoam/bed/0/Theta
@@ -30,6 +30,7 @@ boundaryField
     top
     {
         type                inletOutlet;
+        phi                 phi1;
         inletValue          uniform 1.0e-8;
     }
 
diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed/0/epsilon b/tutorials/multiphase/twoPhaseEulerFoam/bed/0/epsilon
index 79b3e97bad66442ae9f9dda9d0eeaaa0edfa2ad3..79fe0eda3fb27eb2a2c43092f0df67f3bb7f12e4 100644
--- a/tutorials/multiphase/twoPhaseEulerFoam/bed/0/epsilon
+++ b/tutorials/multiphase/twoPhaseEulerFoam/bed/0/epsilon
@@ -29,6 +29,7 @@ boundaryField
     top
     {
         type               inletOutlet;
+        phi                phi2;
         inletValue         uniform 10.0;
         value              uniform 10.0;
     }
diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed/0/k b/tutorials/multiphase/twoPhaseEulerFoam/bed/0/k
index ebc748ced17d51773bdff65585a2e0a278dcd022..188184e8b4dbf16123ec79623d9d19789baa973f 100644
--- a/tutorials/multiphase/twoPhaseEulerFoam/bed/0/k
+++ b/tutorials/multiphase/twoPhaseEulerFoam/bed/0/k
@@ -29,6 +29,7 @@ boundaryField
     top
     {
         type               inletOutlet;
+        phi                phi2;
         inletValue         uniform 1.0;
         value              uniform 1.0;
     }
diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/epsilon b/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/epsilon
index ee88570d3991e180c4cc884e4202b4c61309d80f..4ff943aac34460251e6bdbe47cc276215d1f766e 100644
--- a/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/epsilon
+++ b/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/epsilon
@@ -27,6 +27,7 @@ boundaryField
     outlet
     {
         type               inletOutlet;
+        phi                phi2;
         inletValue         uniform 10.0;
         value              uniform 10.0;
     }
diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/k b/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/k
index 0d6e80afbab447df5016caddee63f112c9ce03b5..6b3ddf98cffd1674871f61e8f5f47d38d23fcbc8 100644
--- a/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/k
+++ b/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/k
@@ -27,6 +27,7 @@ boundaryField
     outlet
     {
         type               inletOutlet;
+        phi                phi2;
         inletValue         uniform 1.0;
         value              uniform 1.0;
     }
diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/Theta b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/Theta
index e45304b83464ea6a9568531b35b570abae0d768f..523be90f325771799ebe37548e2fb4e5e8b460e9 100644
--- a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/Theta
+++ b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/Theta
@@ -29,6 +29,7 @@ boundaryField
     outlet
     {
         type            inletOutlet;
+        phi             phi1;
         inletValue      uniform 1.0e-7;
         value           uniform 1.0e-7;
     }
diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/epsilon b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/epsilon
index d5ee15eb79d080246921e64270bf55a4d1541884..d54d0a402bae4eb3e2e8f7916d06fb9de239be57 100644
--- a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/epsilon
+++ b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/epsilon
@@ -29,6 +29,7 @@ boundaryField
     outlet
     {
         type            inletOutlet;
+        phi             phi2;
         inletValue      uniform 0.1;
         value           uniform 0.1;
     }
diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/k b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/k
index a791cb824f67debc5017f8efa4da5b3e4349556d..bf8d7cc467cd6a46871954606b86a3132f02972a 100644
--- a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/k
+++ b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/k
@@ -29,6 +29,7 @@ boundaryField
     outlet
     {
         type            inletOutlet;
+        phi             phi2;
         inletValue      uniform 1e-8;
         value           uniform 1e-8;
     }
diff --git a/wmake/rules/linux64Icc/c++Opt b/wmake/rules/linux64Icc/c++Opt
index 66638ffe984a81a2145ace8c5e44491fdb8fe2ae..2e2380eee2363254a7642b3a6472a04a446a18cc 100644
--- a/wmake/rules/linux64Icc/c++Opt
+++ b/wmake/rules/linux64Icc/c++Opt
@@ -1,2 +1,2 @@
 c++DBUG     =
-c++OPT      = -xSSE3 -O2 -no-prec-div
+c++OPT      = -xHost -O2 -no-prec-div
diff --git a/wmake/rules/linuxIcc/c++Opt b/wmake/rules/linuxIcc/c++Opt
index 66638ffe984a81a2145ace8c5e44491fdb8fe2ae..2e2380eee2363254a7642b3a6472a04a446a18cc 100644
--- a/wmake/rules/linuxIcc/c++Opt
+++ b/wmake/rules/linuxIcc/c++Opt
@@ -1,2 +1,2 @@
 c++DBUG     =
-c++OPT      = -xSSE3 -O2 -no-prec-div
+c++OPT      = -xHost -O2 -no-prec-div