diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C
index 4e97af7a7a7583dea1535bae83092571ea12bbb0..7ca688a113a88106a744bf3f75c67793cc80669f 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C
@@ -240,9 +240,9 @@ void Foam::conformalVoronoiMesh::insertPoints
     {
         label preDistributionSize(points.size());
 
-        DynamicList<Foam::point> transferPoints;
+        DynamicList<Foam::point> transferPoints(points.size()/2);
 
-        List<Point> pointsOnProcessor;
+        DynamicList<Point> pointsOnProcessor(points.size()/2);
 
         for
         (
@@ -393,6 +393,30 @@ void Foam::conformalVoronoiMesh::insertPoints
         // Info<< returnReduce(pts.size(), sumOp<label>())
         //     << " points in total" << endl;
     }
+//
+//    forAll(pts, pI)
+//    {
+//        // creation of points and indices is done assuming that it will be
+//        // relative to the instantaneous number_of_vertices() at insertion.
+//
+//        label type = types[pI];
+//
+//        if (type > Vb::vtFar)
+//        {
+//            // This is a member of a point pair, don't use the type directly
+//            // (note that this routine never gets called for referredPoints
+//            //  so type will never be -procI)
+//            type += number_of_vertices();
+//        }
+//
+//        insertPoint
+//        (
+//            pts[pI],
+//            indices[pI] + number_of_vertices(),
+//            type
+//        );
+//    }
+
 
     rangeInsertWithInfo
     (
@@ -402,6 +426,8 @@ void Foam::conformalVoronoiMesh::insertPoints
         indices,
         types
     );
+
+    Pout<< pts.size() << " " << indices.size() << " " << types.size() << endl;
 }
 
 
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H
index 4ee0b2a42d6ab720f3a3b81d46fecf4119cb6140..d29cf85295d2925d3a18566d2fc9c735e0b737f5 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H
@@ -970,8 +970,8 @@ private:
             labelList& owner,
             labelList& patchSizes,
             labelList& patchStarts,
-            List<DynamicList<face> >& patchFaces,
-            List<DynamicList<label> >& patchOwners
+            const List<DynamicList<face> >& patchFaces,
+            const List<DynamicList<label> >& patchOwners
         ) const;
 
         //- Remove points that are no longer used by any faces
@@ -1165,6 +1165,11 @@ public:
             //  protrude out of the surface beyond a tolerance.
             void findRemainingProtrusionSet(const fvMesh& mesh) const;
 
+            void writeProcessorInterface
+            (
+                const fileName& fName,
+                const faceList& faces
+            ) const;
 
             //- Function inserting points into a triangulation and setting the
             //  index and type data of the point in the correct order. This is
@@ -1226,23 +1231,35 @@ public:
 
                     c = T.locate(*(p->first), lt, li, lj, hint);
 
+                    const size_t checkInsertion = T.number_of_vertices();
+
                     typename Triangulation::Vertex_handle v
                         = T.insert(*(p->first), lt, c, li, lj);
 
-                    label oldIndex = p->second;
-
-                    label type = types[oldIndex];
-
-                    if (type > Vb::vtFar)
+                    if (checkInsertion != T.number_of_vertices() - 1)
                     {
-                        // This is a member of a point pair, don't use the type
-                        // directly (note that this routine never gets called
-                        // for referredPoints so type will never be -procI)
-                        type += T.number_of_vertices() - 1;
+                        Pout<< "Failed to insert point "
+                            << topoint(*(p->first)) << endl;
+                    }
+                    else
+                    {
+                        label oldIndex = p->second;
+
+                        label type = types[oldIndex];
+
+                        if (type > Vb::vtFar)
+                        {
+                            // This is a member of a point pair, don't use the
+                            // type directly (note that this routine never gets
+                            // called for referredPoints so type will never be
+                            // -procI
+                            type += T.number_of_vertices() - 1;
+                        }
+
+                        v->index() = indices[oldIndex]
+                                   + T.number_of_vertices() - 1;
+                        v->type() = type;
                     }
-
-                    v->index() = indices[oldIndex] + T.number_of_vertices() - 1;
-                    v->type() = type;
                 }
             }
 };
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C
index 025d530db6610cbea221814a3020ac3dbeb6f9e5..0a79cd620d13ed3b5efead94e80bb5e8e0c20f01 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C
@@ -82,28 +82,28 @@ void Foam::conformalVoronoiMesh::calcDualMesh
 // REMOVED BECAUSE THIS CODE STOPS ALL FACES NEAR ANY BOUNDARY (PROC OR REAL)
 // FROM BEING FILTERED.
 //
-//    for
-//    (
-//        Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
-//        vit != finite_vertices_end();
-//        vit++
-//    )
-//    {
-//        std::list<Cell_handle> cells;
-//        incident_cells(vit, std::back_inserter(cells));
-//
-//        bool hasProcPt = false;
-//
-//        for
-//        (
-//            std::list<Cell_handle>::iterator cit = cells.begin();
-//            cit != cells.end();
-//            ++cit
-//        )
-//        {
-//            // Allow filtering if any vertices are far points. Otherwise faces
-//            // with boundary points attached to a cell with a far point will
-//            // not be filtered.
+    for
+    (
+        Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
+        vit != finite_vertices_end();
+        vit++
+    )
+    {
+        std::list<Cell_handle> cells;
+        incident_cells(vit, std::back_inserter(cells));
+
+        bool hasProcPt = false;
+
+        for
+        (
+            std::list<Cell_handle>::iterator cit = cells.begin();
+            cit != cells.end();
+            ++cit
+        )
+        {
+            // Allow filtering if any vertices are far points. Otherwise faces
+            // with boundary points attached to a cell with a far point will
+            // not be filtered.
 //            if
 //            (
 //                (!(*cit)->vertex(0)->real() && !(*cit)->vertex(0)->farPoint())
@@ -111,27 +111,34 @@ void Foam::conformalVoronoiMesh::calcDualMesh
 //             || (!(*cit)->vertex(2)->real() && !(*cit)->vertex(2)->farPoint())
 //             || (!(*cit)->vertex(3)->real() && !(*cit)->vertex(3)->farPoint())
 //            )
-//            {
-//                hasProcPt = true;
-//
-//                break;
-//            }
-//        }
-//
-//        if (hasProcPt)
-//        {
-//            for
-//            (
-//                std::list<Cell_handle>::iterator cit = cells.begin();
-//                cit != cells.end();
-//                ++cit
-//            )
-//            {
-//                (*cit)->filterCount() =
-//                     cvMeshControls().filterCountSkipThreshold() + 1;
-//            }
-//        }
-//    }
+            if
+            (
+                (!(*cit)->vertex(0)->real())
+             || (!(*cit)->vertex(1)->real())
+             || (!(*cit)->vertex(2)->real())
+             || (!(*cit)->vertex(3)->real())
+            )
+            {
+                hasProcPt = true;
+
+                break;
+            }
+        }
+
+        if (hasProcPt)
+        {
+            for
+            (
+                std::list<Cell_handle>::iterator cit = cells.begin();
+                cit != cells.end();
+                ++cit
+            )
+            {
+                (*cit)->filterCount() =
+                     cvMeshControls().filterCountSkipThreshold() + 1;
+            }
+        }
+    }
 
     PackedBoolList boundaryPts(number_of_cells(), false);
 
@@ -2157,9 +2164,9 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
                         // Did not find a surface patch between
                         // between Dv pair, finding nearest patch
 
-                        // Pout<< "Did not find a surface patch between "
-                        //     << "for face, finding nearest patch to"
-                        //     << 0.5*(ptA + ptB) << endl;
+//                         Pout<< "Did not find a surface patch between "
+//                             << "for face, finding nearest patch to"
+//                             << 0.5*(ptA + ptB) << endl;
 
                         patchIndex = geometryToConformTo_.findPatch
                         (
@@ -2240,6 +2247,37 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
     {
         patchPointPairSlaves[patchI].transfer(patchPPSlaves[patchI]);
     }
+
+    if (cvMeshControls().objOutput())
+    {
+        forAll(procNeighbours, nbI)
+        {
+            if (patchFaces[nbI].size() > 0)
+            {
+                const label neighbour = procNeighbours[nbI];
+
+                if (neighbour != -1)
+                {
+                    word fName =
+                        "processor_"
+                      + name(Pstream::myProcNo())
+                      + "_to_"
+                      + name(neighbour)
+                      + "_interface.obj";
+
+                    writeProcessorInterface
+                    (
+                        fName,
+                        patchFaces[nbI]
+                    );
+                }
+            }
+        }
+
+        Pout<< "Patch Names:     " << patchNames << endl;
+        Pout<< "Patch Sizes:     " << patchSizes << endl;
+        Pout<< "Proc Neighbours: " << procNeighbours << endl;
+    }
 }
 
 
@@ -2527,8 +2565,8 @@ void Foam::conformalVoronoiMesh::addPatches
     labelList& owner,
     labelList& patchSizes,
     labelList& patchStarts,
-    List<DynamicList<face> >& patchFaces,
-    List<DynamicList<label> >& patchOwners
+    const List<DynamicList<face> >& patchFaces,
+    const List<DynamicList<label> >& patchOwners
 ) const
 {
     label nPatches = patchFaces.size();
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C
index bc9d04dfb1e79ca32216f53185c7443267f9996d..fc860a3b59d975e9e22894a821b0356696c11218 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C
@@ -220,6 +220,37 @@ void Foam::conformalVoronoiMesh::writePoints
 }
 
 
+void Foam::conformalVoronoiMesh::writeProcessorInterface
+(
+    const fileName& fName,
+    const faceList& faces
+) const
+{
+    OFstream str(runTime_.path()/fName);
+
+    Pout<< "Writing processor interface" << endl;
+
+    pointField points(number_of_cells(), point::max);
+
+    for
+    (
+        Delaunay::Finite_cells_iterator cit = finite_cells_begin();
+        cit != finite_cells_end();
+        ++cit
+    )
+    {
+        if (!cit->farCell())
+        {
+            points[cit->cellIndex()] = topoint(dual(cit));
+        }
+    }
+
+    meshTools::writeOBJ(str, faces, points);
+
+    Pout<< "Written processor interface" << endl;
+}
+
+
 void Foam::conformalVoronoiMesh::writeInternalDelaunayVertices
 (
     const fileName& instance
diff --git a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C
index 34c595f8acf5919638501f42ce87abe6977f6607..c9c8ba3f654d32009dfd8119afa0cd4c0582096c 100644
--- a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C
@@ -31,8 +31,11 @@ License
 namespace Foam
 {
     defineTypeNameAndDebug(polynomial, 0);
+    DataEntry<scalar>::adddictionaryConstructorToTable<polynomial>
+        addpolynomialConstructorToTable_;
 }
 
+
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 Foam::polynomial::polynomial(const word& entryName, const dictionary& dict)
@@ -48,7 +51,7 @@ Foam::polynomial::polynomial(const word& entryName, const dictionary& dict)
 
     if (!coeffs_.size())
     {
-        FatalErrorIn("Foam::polynomial::polynomial(const word&, Istream&)")
+        FatalErrorIn("Foam::polynomial::polynomial(const word&, dictionary&)")
             << "polynomial coefficients for entry " << this->name_
             << " are invalid (empty)" << nl << exit(FatalError);
     }
@@ -66,7 +69,7 @@ Foam::polynomial::polynomial(const word& entryName, const dictionary& dict)
     {
         if (!canIntegrate_)
         {
-            WarningIn("Foam::polynomial::polynomial(const word&, Istream&)")
+            WarningIn("Foam::polynomial::polynomial(const word&, dictionary&)")
                 << "Polynomial " << this->name_ << " cannot be integrated"
                 << endl;
         }
@@ -74,6 +77,50 @@ Foam::polynomial::polynomial(const word& entryName, const dictionary& dict)
 }
 
 
+Foam::polynomial::polynomial
+(
+    const word& entryName,
+    const List<Tuple2<scalar, scalar> >& coeffs
+)
+:
+    DataEntry<scalar>(entryName),
+    coeffs_(coeffs),
+    canIntegrate_(true)
+{
+    if (!coeffs_.size())
+    {
+        FatalErrorIn
+        (
+            "Foam::polynomial::polynomial"
+            "(const word&, const List<Tuple2<scalar, scalar> >&&)"
+        )   << "polynomial coefficients for entry " << this->name_
+            << " are invalid (empty)" << nl << exit(FatalError);
+    }
+
+    forAll(coeffs_, i)
+    {
+        if (mag(coeffs_[i].second() + 1) < ROOTVSMALL)
+        {
+            canIntegrate_ = false;
+            break;
+        }
+    }
+
+    if (debug)
+    {
+        if (!canIntegrate_)
+        {
+            WarningIn
+            (
+                "Foam::polynomial::polynomial"
+                "(const word&, const List<Tuple2<scalar, scalar> >&&)"
+            )   << "Polynomial " << this->name_ << " cannot be integrated"
+                << endl;
+        }
+    }
+}
+
+
 Foam::polynomial::polynomial(const polynomial& poly)
 :
     DataEntry<scalar>(poly),
diff --git a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H
index 2ed38a9f32221e9f91ee6dba3ca7522455278877..2c2cbcb30fc76314b0a2dd036dfbeb57b2d74be1 100644
--- a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H
+++ b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H
@@ -96,6 +96,9 @@ public:
 
         polynomial(const word& entryName, const dictionary& dict);
 
+        //- Construct from components
+        polynomial(const word& entryName, const List<Tuple2<scalar, scalar> >&);
+
         //- Copy constructor
         polynomial(const polynomial& poly);
 
diff --git a/src/fieldSources/basicSource/basicSource/basicSource.C b/src/fieldSources/basicSource/basicSource/basicSource.C
index 355073b33a2a190399d585d66684596d6096cbec..2d218de752afdf67cd63e169d01a2e714924edd3 100644
--- a/src/fieldSources/basicSource/basicSource/basicSource.C
+++ b/src/fieldSources/basicSource/basicSource/basicSource.C
@@ -167,8 +167,10 @@ void Foam::basicSource::setCellSet()
                 Info<< indent << "- selecting inter region mapping" << endl;
                 const fvMesh& secondaryMesh =
                     mesh_.time().lookupObject<fvMesh>(mapRegionName_);
-                const boundBox primaryBB = mesh_.bounds();
-                const boundBox secondaryBB = secondaryMesh.bounds();
+
+                boundBox primaryBB(mesh_.points(), false);
+                boundBox secondaryBB(secondaryMesh.points(), false);
+
                 if (secondaryBB.overlaps(primaryBB))
                 {
                     // Dummy patches
diff --git a/src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C b/src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C
index 24c0f612dd0b93dd45a6ca0438b541723ce90c88..772f26094a701c8b125cd1f9c6f36f178bfecb6b 100644
--- a/src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C
+++ b/src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C
@@ -137,100 +137,103 @@ void Foam::interRegionHeatTransferModel::addSup
     const label fieldI
 )
 {
-    if (firstIter_)
+    if (secondaryToPrimaryInterpPtr_.valid())
     {
-        check();
-        firstIter_ = false;
-    }
+        if (firstIter_)
+        {
+            check();
+            firstIter_ = false;
+        }
 
-    const volScalarField& h = eEqn.psi();
+        const volScalarField& h = eEqn.psi();
 
-    tmp<volScalarField> tTmapped
-    (
-        new volScalarField
+        tmp<volScalarField> tTmapped
         (
-            IOobject
+            new volScalarField
             (
-                "Tmapped" + mesh_.name(),
-                mesh_.time().timeName(),
+                IOobject
+                (
+                    "Tmapped" + mesh_.name(),
+                    mesh_.time().timeName(),
+                    mesh_,
+                    IOobject::NO_READ,
+                    IOobject::NO_WRITE
+                ),
                 mesh_,
-                IOobject::NO_READ,
-                IOobject::NO_WRITE
-            ),
-            mesh_,
-            dimensionedScalar("T", dimTemperature, 0.0)
-        )
-    );
-
-    volScalarField& Tmapped = tTmapped();
+                dimensionedScalar("T", dimTemperature, 0.0)
+            )
+        );
 
-    const fvMesh& secondaryMesh =
-        mesh_.time().lookupObject<fvMesh>(mapRegionName_);
+        volScalarField& Tmapped = tTmapped();
 
-    const volScalarField& Tsecondary =
-        secondaryMesh.lookupObject<volScalarField>("T");
+        const fvMesh& secondaryMesh =
+            mesh_.time().lookupObject<fvMesh>(mapRegionName_);
 
-    secondaryToPrimaryInterpPtr_->interpolateInternalField
-    (
-        Tmapped,
-        Tsecondary,
-        meshToMesh::MAP,
-        eqOp<scalar>()
-    );
+        const volScalarField& Tsecondary =
+            secondaryMesh.lookupObject<volScalarField>("T");
 
-    if (!master_)
-    {
         secondaryToPrimaryInterpPtr_->interpolateInternalField
         (
-            htc_,
-            secIrht_->calculateHtc(),
-            meshToMesh::CELL_VOLUME_WEIGHT,
+            Tmapped,
+            Tsecondary,
+            meshToMesh::MAP,
             eqOp<scalar>()
         );
-    }
-
-    if (debug)
-    {
-        Info<< " Volumetric integral of htc : "
-            << fvc::domainIntegrate(htc_).value()
-            << endl;
-    }
-
-    //SAF: temporarily output
-    if (mesh_.time().outputTime())
-    {
-        Tmapped.write();
-        htc_.write();
-    }
-
-    if (h.dimensions() == dimEnergy/dimMass)
-    {
-        const basicThermo& primaryThermo =
-            mesh_.lookupObject<basicThermo>("thermophysicalProperties");
 
-        eEqn += htc_*Tmapped - fvm::Sp(htc_/primaryThermo.Cp(), h);
+        if (!master_)
+        {
+            secondaryToPrimaryInterpPtr_->interpolateInternalField
+            (
+                htc_,
+                secIrht_->calculateHtc(),
+                meshToMesh::CELL_VOLUME_WEIGHT,
+                eqOp<scalar>()
+            );
+        }
 
         if (debug)
         {
-            Info<< " Energy exchange from region " << secondaryMesh.name()
-                << " To " << mesh_.name() << " : "
-                <<  fvc::domainIntegrate
-                    (
-                        htc_*(h/primaryThermo.Cp() - Tmapped)
-                    ).value()
+            Info<< " Volumetric integral of htc : "
+                << fvc::domainIntegrate(htc_).value()
                 << endl;
         }
-    }
-    else if(h.dimensions() == dimTemperature)
-    {
-        eEqn += htc_*Tmapped - fvm::Sp(htc_, h);
 
-        if (debug)
+        //SAF: temporarily output
+        if (mesh_.time().outputTime())
         {
-            Info<< " Enegy exchange from region " << secondaryMesh.name()
-                << " To " << mesh_.name() << " : "
-                <<  fvc::domainIntegrate(htc_*(h - Tmapped)).value()
-                << endl;
+            Tmapped.write();
+            htc_.write();
+        }
+
+        if (h.dimensions() == dimEnergy/dimMass)
+        {
+            const basicThermo& primaryThermo =
+                mesh_.lookupObject<basicThermo>("thermophysicalProperties");
+
+            eEqn += htc_*Tmapped - fvm::Sp(htc_/primaryThermo.Cp(), h);
+
+            if (debug)
+            {
+                Info<< " Energy exchange from region " << secondaryMesh.name()
+                    << " To " << mesh_.name() << " : "
+                    <<  fvc::domainIntegrate
+                        (
+                            htc_*(h/primaryThermo.Cp() - Tmapped)
+                        ).value()
+                    << endl;
+            }
+        }
+        else if(h.dimensions() == dimTemperature)
+        {
+            eEqn += htc_*Tmapped - fvm::Sp(htc_, h);
+
+            if (debug)
+            {
+                Info<< " Enegy exchange from region " << secondaryMesh.name()
+                    << " To " << mesh_.name() << " : "
+                    <<  fvc::domainIntegrate(htc_*(h - Tmapped)).value()
+                    << endl;
+            }
         }
     }
 }
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C
index 0261efd54e644325dd3a556a50801d0c2cc653cc..477b242b76a0973b587c158780c0b199fda55568 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.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-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -24,7 +24,6 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "fanFvPatchField.H"
-#include "IOmanip.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
@@ -36,7 +35,7 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
 )
 :
     fixedJumpFvPatchField<Type>(p, iF),
-    f_(0)
+    jumpTable_(0)
 {}
 
 
@@ -50,7 +49,7 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
 )
 :
     fixedJumpFvPatchField<Type>(ptf, p, iF, mapper),
-    f_(ptf.f_)
+    jumpTable_(ptf.jumpTable_().clone().ptr())
 {}
 
 
@@ -63,28 +62,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
 )
 :
     fixedJumpFvPatchField<Type>(p, iF),
-    f_()
-{
-    {
-        Istream& is = dict.lookup("f");
-        is.format(IOstream::ASCII);
-        is >> f_;
-
-        // Check that f_ table is same on both sides.?
-    }
-
-    if (dict.found("value"))
-    {
-        fvPatchField<Type>::operator=
-        (
-            Field<Type>("value", dict, p.size())
-        );
-    }
-    else
-    {
-        this->evaluate(Pstream::blocking);
-    }
-}
+    jumpTable_(DataEntry<Type>::New("jumpTable", dict))
+{}
 
 
 template<class Type>
@@ -95,7 +74,7 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
 :
     cyclicLduInterfaceField(),
     fixedJumpFvPatchField<Type>(ptf),
-    f_(ptf.f_)
+    jumpTable_(ptf.jumpTable_().clone().ptr())
 {}
 
 
@@ -107,7 +86,7 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
 )
 :
     fixedJumpFvPatchField<Type>(ptf, iF),
-    f_(ptf.f_)
+    jumpTable_(ptf.jumpTable_().clone().ptr())
 {}
 
 
@@ -119,11 +98,10 @@ void Foam::fanFvPatchField<Type>::write(Ostream& os) const
 {
 
     fixedJumpFvPatchField<Type>::write(os);
-
-    IOstream::streamFormat fmt0 = os.format(IOstream::ASCII);
-    os.writeKeyword("f") << f_ << token::END_STATEMENT << nl;
-    os.format(fmt0);
-
+    if (this->cyclicPatch().owner())
+    {
+        jumpTable_->writeData(os);
+    }
     this->writeEntry("value", os);
 }
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H
index e93b69797767c0c32bdd6cc805acdd06ca880152..b3799c2bd9bc2486294d2c107ad77e72309bfde6 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.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-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,7 +25,43 @@ Class
     Foam::fanFvPatchField
 
 Description
-    Foam::fanFvPatchField
+    Jump boundary condition. Operates on cyclic. Jump specified as a DataEntry.
+    (table, fileTable, csv etc.)
+
+    Example of the boundary condition specification:
+    \verbatim
+        fan_half0
+        {
+            type            fan;
+            patchType       cyclic;
+            jump            uniform 0;
+            jumpTable       csvFile;
+            csvFileCoeffs
+            {
+                hasHeaderLine   1;
+                refColumn       0;
+                componentColumns 1(1);
+                separator       ",";
+                fileName        "$FOAM_CASE/constant/pressureVsU";
+            }
+            value           uniform 0;
+        }
+    \endverbatim
+
+
+    Backwards compatibility: if the 'f' keyword is detected it assumes
+    it is a power of the flowrate.
+
+    \verbatim
+        fan_half0
+        {
+            type            fan;
+            patchType       cyclic;
+            jump            uniform 0;
+            f               2(100 -0.1);
+            value           uniform 0;
+        }
+    \endverbatim
 
 SourceFiles
     fanFvPatchField.C
@@ -36,6 +72,7 @@ SourceFiles
 #define fanFvPatchField_H
 
 #include "fixedJumpFvPatchField.H"
+#include "DataEntry.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -53,8 +90,8 @@ class fanFvPatchField
 {
     // Private data
 
-        //- Fan pressure rise polynomial coefficients
-        List<scalar> f_;
+        //- Interpolation table
+        autoPtr<DataEntry<Type> > jumpTable_;
 
 
 public:
@@ -126,15 +163,6 @@ public:
 
     // Member functions
 
-        // Access
-
-            //- Return the polynomial coefficients
-            const List<scalar>& f() const
-            {
-                return f_;
-            }
-
-
         // Evaluation functions
 
             //- Update the coefficients associated with the patch field
@@ -148,6 +176,13 @@ public:
 
 //- Specialisation of the jump-condition for the pressure
 template<>
+fanFvPatchField<scalar>::fanFvPatchField
+(
+    const fvPatch&,
+    const DimensionedField<scalar, volMesh>&,
+    const dictionary&
+);
+template<>
 void fanFvPatchField<scalar>::updateCoeffs();
 
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C
index b3af1d2245458cd2543cdedd6f40535b48752072..1b291d500cc548e71adc183e198c97c364b2822e 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.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-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,6 +27,8 @@ License
 #include "addToRunTimeSelectionTable.H"
 #include "volFields.H"
 #include "surfaceFields.H"
+#include "Tuple2.H"
+#include "polynomial.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -41,24 +43,85 @@ makeTemplatePatchTypeField
     fanFvPatchScalarField
 );
 
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+template<>
+Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField
+(
+    const fvPatch& p,
+    const DimensionedField<scalar, volMesh>& iF,
+    const dictionary& dict
+)
+:
+    fixedJumpFvPatchField<scalar>(p, iF),
+    jumpTable_(new DataEntry<scalar>("jumpTable"))
+{
+    if (this->cyclicPatch().owner())
+    {
+        if (dict.found("f"))
+        {
+            // Backwards compatibility
+            Istream& is = dict.lookup("f");
+            is.format(IOstream::ASCII);
+            scalarList f(is);
+
+            label nPows = 0;
+            forAll(f, powI)
+            {
+                if (mag(f[powI]) > VSMALL)
+                {
+                    nPows++;
+                }
+            }
+            List<Tuple2<scalar, scalar> > coeffs(nPows);
+            nPows = 0;
+            forAll(f, powI)
+            {
+                if (mag(f[powI]) > VSMALL)
+                {
+                    coeffs[nPows++] = Tuple2<scalar, scalar>(f[powI], powI);
+                }
+            }
+
+            jumpTable_.reset
+            (
+                new polynomial("jumpTable", coeffs)
+            );
+        }
+        else
+        {
+            // Generic input constructed from dictionary
+            jumpTable_ = DataEntry<scalar>::New("jumpTable", dict);
+        }
+    }
+
+
+    if (dict.found("value"))
+    {
+        fvPatchScalarField::operator=
+        (
+            scalarField("value", dict, p.size())
+        );
+    }
+    else
+    {
+        this->evaluate(Pstream::blocking);
+    }
+}
+
+
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 //- Specialisation of the jump-condition for the pressure
 template<>
 void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs()
 {
-    if (updated())
+    if (this->updated())
     {
         return;
     }
 
-    // Note that the neighbour side jump_ data is never actually used; the
-    // jump() function just calls the owner side jump().
-
-    // Constant
-    jump_ = f_[0];
-
-    if (f_.size() > 1)
+    if (this->cyclicPatch().owner())
     {
         const surfaceScalarField& phi =
             db().lookupObject<surfaceScalarField>("phi");
@@ -73,12 +136,7 @@ void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs()
             Un /= patch().lookupPatchField<volScalarField, scalar>("rho");
         }
 
-        for (label i=1; i<f_.size(); i++)
-        {
-            jump_ += f_[i]*pow(Un, i);
-        }
-
-        jump_ = max(jump_, scalar(0));
+        jump_ = jumpTable_->value(Un);
     }
 
     fixedJumpFvPatchField<scalar>::updateCoeffs();
diff --git a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C
index cf339acd54d1273eebc7aa9cfdbb520db70dc17a..af07a07057d2d9856ef93763cec560caa3ddbf7b 100644
--- a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C
+++ b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C
@@ -107,6 +107,11 @@ temperatureThermoBaffleFvPatchScalarField
             << exit(FatalError);
     }
 
+    const mappedPatchBase& mpp =
+        refCast<const mappedPatchBase>(patch().patch());
+
+    const word nbrMesh = mpp.sampleRegion();
+
     const fvMesh& thisMesh = patch().boundaryMesh().mesh();
 
     typedef regionModels::thermoBaffleModels::thermoBaffleModel baffle;
@@ -114,14 +119,15 @@ temperatureThermoBaffleFvPatchScalarField
     if
     (
         thisMesh.name() == polyMesh::defaultRegion
-     && !thisMesh.foundObject<baffle>("thermoBaffle")
+     && !thisMesh.foundObject<baffle>(nbrMesh)
      && !owner_
     )
     {
-        Info << "Creating thermal baffle..." << endl;
+        Info << "Creating thermal baffle..." <<  nbrMesh << endl;
         baffle_.reset(baffle::New(thisMesh, dict).ptr());
         owner_ = true;
         dict.lookup("thermoType") >> solidThermoType_;
+        baffle_->rename(nbrMesh);
     }
 }