From 05f5a293bc9fd97954c72b2757b5ac56b9f5627a Mon Sep 17 00:00:00 2001
From: Henry Weller <http://openfoam.org>
Date: Sat, 10 Feb 2018 22:46:17 +0000
Subject: [PATCH] ENH: MRF: Remove ddtCorr from MRF regions

MRFZone: Filter-out excluded patches from ddtCorr
---
 .../combustion/XiFoam/XiEngineFoam/pEqn.H     |  7 +-
 .../solvers/combustion/fireFoam/pEqn.H        |  2 +-
 .../solvers/combustion/reactingFoam/pEqn.H    |  7 +-
 .../solvers/combustion/reactingFoam/pcEqn.H   |  9 ++-
 .../rhoReactingBuoyantFoam/pEqn.H             |  2 +-
 .../solvers/compressible/rhoPimpleFoam/pEqn.H |  2 +-
 .../compressible/rhoPimpleFoam/pcEqn.H        |  5 +-
 .../solvers/compressible/sonicFoam/pEqn.H     |  2 +-
 .../buoyantBoussinesqPimpleFoam/pEqn.H        |  2 +-
 .../heatTransfer/buoyantPimpleFoam/pEqn.H     |  2 +-
 .../chtMultiRegionFoam/fluid/pEqn.H           |  2 +-
 .../solvers/incompressible/pimpleFoam/pEqn.H  |  2 +-
 .../solvers/incompressible/pisoFoam/pEqn.H    |  2 +-
 .../lagrangian/coalChemistryFoam/pEqn.H       |  7 +-
 .../lagrangian/reactingParcelFoam/pEqn.H      |  2 +-
 .../solvers/lagrangian/sprayFoam/pEqn.H       |  5 +-
 .../lagrangian/sprayFoam/sprayDyMFoam/pEqn.H  |  7 +-
 .../compressibleInterDyMFoam/pEqn.H           |  2 +-
 .../compressibleInterFilmFoam/pEqn.H          |  2 +-
 .../multiphase/compressibleInterFoam/pEqn.H   |  2 +-
 .../solvers/multiphase/driftFluxFoam/pEqn.H   |  2 +-
 .../solvers/multiphase/interFoam/pEqn.H       |  2 +-
 .../multiphase/multiphaseEulerFoam/pEqn.H     |  5 +-
 .../potentialFreeSurfaceFoam/pEqn.H           |  2 +-
 .../potentialFreeSurfaceDyMFoam/pEqn.H        |  2 +-
 .../cfdTools/general/MRF/MRFZone.H            |  6 +-
 .../cfdTools/general/MRF/MRFZoneList.H        | 16 ++++-
 .../general/MRF/MRFZoneListTemplates.C        | 64 +++++++++++++++++++
 .../cfdTools/general/MRF/MRFZoneTemplates.C   | 41 +++++++++++-
 29 files changed, 179 insertions(+), 34 deletions(-)
 create mode 100644 src/finiteVolume/cfdTools/general/MRF/MRFZoneListTemplates.C

diff --git a/applications/solvers/combustion/XiFoam/XiEngineFoam/pEqn.H b/applications/solvers/combustion/XiFoam/XiEngineFoam/pEqn.H
index aca8c2c11a3..fedaea71067 100644
--- a/applications/solvers/combustion/XiFoam/XiEngineFoam/pEqn.H
+++ b/applications/solvers/combustion/XiFoam/XiEngineFoam/pEqn.H
@@ -13,7 +13,10 @@ if (pimple.transonic())
        *(
             (
                 fvc::flux(HbyA)
-              + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho)
+              + MRF.zeroFilter
+                (
+                    rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho)
+                )
             )
         )
     );
@@ -47,7 +50,7 @@ else
         "phiHbyA",
         (
             fvc::flux(rho*HbyA)
-          + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
+          + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, rhoUf))
         )
     );
 
diff --git a/applications/solvers/combustion/fireFoam/pEqn.H b/applications/solvers/combustion/fireFoam/pEqn.H
index 0d42787fff0..19cafee7cea 100644
--- a/applications/solvers/combustion/fireFoam/pEqn.H
+++ b/applications/solvers/combustion/fireFoam/pEqn.H
@@ -11,7 +11,7 @@ surfaceScalarField phiHbyA
     "phiHbyA",
     (
         fvc::flux(rho*HbyA)
-      + rhorAUf*fvc::ddtCorr(rho, U, phi)
+      + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
     )
   + phig
 );
diff --git a/applications/solvers/combustion/reactingFoam/pEqn.H b/applications/solvers/combustion/reactingFoam/pEqn.H
index 36f3e777530..f4ff96931bd 100644
--- a/applications/solvers/combustion/reactingFoam/pEqn.H
+++ b/applications/solvers/combustion/reactingFoam/pEqn.H
@@ -17,7 +17,10 @@ if (pimple.transonic())
         fvc::interpolate(psi)
        *(
             fvc::flux(HbyA)
-          + rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
+          + MRF.zeroFilter
+            (
+                rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
+            )
         )
     );
 
@@ -49,7 +52,7 @@ else
         "phiHbyA",
         (
             fvc::flux(rho*HbyA)
-          + rhorAUf*fvc::ddtCorr(rho, U, phi)
+          + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
         )
     );
 
diff --git a/applications/solvers/combustion/reactingFoam/pcEqn.H b/applications/solvers/combustion/reactingFoam/pcEqn.H
index a1564b0f204..5ca9b4adca1 100644
--- a/applications/solvers/combustion/reactingFoam/pcEqn.H
+++ b/applications/solvers/combustion/reactingFoam/pcEqn.H
@@ -17,8 +17,11 @@ if (pimple.transonic())
         fvc::interpolate(psi)
        *(
             fvc::flux(HbyA)
-          + fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
-           /fvc::interpolate(rho)
+          + MRF.zeroFilter
+            (
+                fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
+               /fvc::interpolate(rho)
+            )
         )
     );
 
@@ -61,7 +64,7 @@ else
         "phiHbyA",
         (
             fvc::flux(rho*HbyA)
-          + fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
+          + MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi))
         )
     );
 
diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/pEqn.H b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/pEqn.H
index 04296ddfc2c..d5feab6e538 100644
--- a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/pEqn.H
+++ b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/pEqn.H
@@ -15,7 +15,7 @@ surfaceScalarField phiHbyA
     "phiHbyA",
     (
         fvc::flux(rho*HbyA)
-      + rhorAUf*fvc::ddtCorr(rho, U, phi)
+      + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
     )
   + phig
 );
diff --git a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H
index f54376ffadf..f2f2c5c71c7 100644
--- a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H
+++ b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H
@@ -20,7 +20,7 @@ surfaceScalarField phiHbyA
 (
     "phiHbyA",
     fvc::interpolate(rho)*fvc::flux(HbyA)
-  + rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf)
+  + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf))
 );
 
 fvc::makeRelative(phiHbyA, rho, U);
diff --git a/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H
index 7ac95a9c5bf..86812465538 100644
--- a/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H
+++ b/applications/solvers/compressible/rhoPimpleFoam/pcEqn.H
@@ -21,7 +21,10 @@ surfaceScalarField phiHbyA
     "phiHbyA",
     (
         fvc::interpolate(rho)*fvc::flux(HbyA)
-      + fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi, rhoUf)
+      + MRF.zeroFilter
+        (
+            fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi, rhoUf)
+        )
     )
 );
 
diff --git a/applications/solvers/compressible/sonicFoam/pEqn.H b/applications/solvers/compressible/sonicFoam/pEqn.H
index bd553928b16..50a9ff240dc 100644
--- a/applications/solvers/compressible/sonicFoam/pEqn.H
+++ b/applications/solvers/compressible/sonicFoam/pEqn.H
@@ -9,7 +9,7 @@ surfaceScalarField phid
     fvc::interpolate(psi)
    *(
         fvc::flux(HbyA)
-      + rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
+      + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho))
     )
 );
 
diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H
index 51d9461c87c..0eeb6e15a3f 100644
--- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H
+++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/pEqn.H
@@ -9,7 +9,7 @@
     (
         "phiHbyA",
         fvc::flux(HbyA)
-      + rAUf*fvc::ddtCorr(U, phi)
+      + MRF.zeroFilter(rAUf*fvc::ddtCorr(U, phi))
       + phig
     );
 
diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H
index 677fabffd56..9a2553a7e98 100644
--- a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H
+++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H
@@ -19,7 +19,7 @@ surfaceScalarField phiHbyA
     "phiHbyA",
     (
         fvc::flux(rho*HbyA)
-      + rhorAUf*fvc::ddtCorr(rho, U, phi)
+      + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
     )
   + phig
 );
diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H
index dc67ab09e20..9bc978b2540 100644
--- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H
+++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H
@@ -19,7 +19,7 @@ surfaceScalarField phiHbyA
     "phiHbyA",
     (
         fvc::flux(rho*HbyA)
-      + rhorAUf*fvc::ddtCorr(rho, U, phi)
+      + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
     )
   + phig
 );
diff --git a/applications/solvers/incompressible/pimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pEqn.H
index df19741c508..e3c61fe37da 100644
--- a/applications/solvers/incompressible/pimpleFoam/pEqn.H
+++ b/applications/solvers/incompressible/pimpleFoam/pEqn.H
@@ -4,7 +4,7 @@ surfaceScalarField phiHbyA
 (
     "phiHbyA",
     fvc::flux(HbyA)
-  + fvc::interpolate(rAU)*fvc::ddtCorr(U, phi, Uf)
+  + MRF.zeroFilter(fvc::interpolate(rAU)*fvc::ddtCorr(U, phi, Uf))
 );
 
 MRF.makeRelative(phiHbyA);
diff --git a/applications/solvers/incompressible/pisoFoam/pEqn.H b/applications/solvers/incompressible/pisoFoam/pEqn.H
index 05c34376ece..866d84e9457 100644
--- a/applications/solvers/incompressible/pisoFoam/pEqn.H
+++ b/applications/solvers/incompressible/pisoFoam/pEqn.H
@@ -4,7 +4,7 @@ surfaceScalarField phiHbyA
 (
     "phiHbyA",
     fvc::flux(HbyA)
-  + fvc::interpolate(rAU)*fvc::ddtCorr(U, phi)
+  + MRF.zeroFilter(fvc::interpolate(rAU)*fvc::ddtCorr(U, phi))
 );
 
 MRF.makeRelative(phiHbyA);
diff --git a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H
index 4f6eaf3550c..0182e453ba1 100644
--- a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H
+++ b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H
@@ -12,7 +12,10 @@ if (pimple.transonic())
         fvc::interpolate(psi)
        *(
             fvc::flux(HbyA)
-          + rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
+          + MRF.zeroFilter
+            (
+                rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
+            )
         )
     );
 
@@ -45,7 +48,7 @@ else
         "phiHbyA",
         (
             fvc::flux(rho*HbyA)
-          + rhorAUf*fvc::ddtCorr(rho, U, phi)
+          + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
         )
     );
 
diff --git a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H
index 588273cf543..b6854000777 100644
--- a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H
+++ b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H
@@ -18,7 +18,7 @@ surfaceScalarField phiHbyA
     "phiHbyA",
     (
         fvc::flux(rho*HbyA)
-      + rhorAUf*fvc::ddtCorr(rho, U, phi)
+      + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi))
     )
   + phig
 );
diff --git a/applications/solvers/lagrangian/sprayFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/pEqn.H
index b15fb81e13b..10c49d18117 100644
--- a/applications/solvers/lagrangian/sprayFoam/pEqn.H
+++ b/applications/solvers/lagrangian/sprayFoam/pEqn.H
@@ -20,7 +20,10 @@ if (pimple.transonic())
         fvc::interpolate(psi)
        *(
             fvc::flux(HbyA)
-          + rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
+          + MRF.zeroFilter
+            (
+                rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
+            )
         )
     );
 
diff --git a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H
index 90033814d33..a08bcf9fd10 100644
--- a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H
+++ b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H
@@ -20,7 +20,10 @@ if (pimple.transonic())
         fvc::interpolate(psi)
        *(
             fvc::flux(HbyA)
-          + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho)
+          + MRF.zeroFilter
+            (
+                rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho)
+            )
         )
     );
 
@@ -53,7 +56,7 @@ else
     (
         "phiHbyA",
         fvc::flux(rho*HbyA)
-      + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
+      + MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, rhoUf))
     );
 
     fvc::makeRelative(phiHbyA, rho, U);
diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H
index c34676157a8..d4c0f41aab8 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H
+++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/pEqn.H
@@ -6,7 +6,7 @@
     (
         "phiHbyA",
         fvc::flux(HbyA)
-      + fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, Uf)
+      + MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, Uf))
     );
     MRF.makeRelative(phiHbyA);
 
diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/pEqn.H
index 7867727f869..5cdd9737d0c 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/pEqn.H
+++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/pEqn.H
@@ -6,7 +6,7 @@
     (
         "phiHbyA",
         fvc::flux(HbyA)
-      + fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi)
+      + MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi))
     );
     MRF.makeRelative(phiHbyA);
 
diff --git a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H
index e7f00b91a1a..5854748e99b 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H
+++ b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H
@@ -6,7 +6,7 @@
     (
         "phiHbyA",
         fvc::flux(HbyA)
-      + fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi)
+      + MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi))
     );
     MRF.makeRelative(phiHbyA);
 
diff --git a/applications/solvers/multiphase/driftFluxFoam/pEqn.H b/applications/solvers/multiphase/driftFluxFoam/pEqn.H
index 6797c44ccb6..7a2be2efd05 100644
--- a/applications/solvers/multiphase/driftFluxFoam/pEqn.H
+++ b/applications/solvers/multiphase/driftFluxFoam/pEqn.H
@@ -6,7 +6,7 @@
     (
         "phiHbyA",
         fvc::flux(HbyA)
-      + fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi)
+      + MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi))
     );
     MRF.makeRelative(phiHbyA);
     adjustPhi(phiHbyA, U, p_rgh);
diff --git a/applications/solvers/multiphase/interFoam/pEqn.H b/applications/solvers/multiphase/interFoam/pEqn.H
index 5aecb2df273..e443f269848 100644
--- a/applications/solvers/multiphase/interFoam/pEqn.H
+++ b/applications/solvers/multiphase/interFoam/pEqn.H
@@ -14,7 +14,7 @@
     (
         "phiHbyA",
         fvc::flux(HbyA)
-      + fvc::interpolate(rho*rAU())*fvc::ddtCorr(U, phi, Uf)
+      + MRF.zeroFilter(fvc::interpolate(rho*rAU())*fvc::ddtCorr(U, phi, Uf))
     );
     MRF.makeRelative(phiHbyA);
 
diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H
index ad92a797183..6c2612b2319 100644
--- a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H
+++ b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H
@@ -98,7 +98,10 @@
         phiHbyAs[phasei] =
         (
             fvc::flux(HbyAs[phasei])
-          + rAlphaAUfs[phasei]*fvc::ddtCorr(phase.U(), phase.phi())
+          + MRF.zeroFilter
+            (
+                rAlphaAUfs[phasei]*fvc::ddtCorr(phase.U(), phase.phi())
+            )
         );
         MRF.makeRelative(phiHbyAs[phasei]);
         MRF.makeRelative(phase.phi().oldTime());
diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H b/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H
index 76a44bd1348..0e259d88092 100644
--- a/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H
+++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/pEqn.H
@@ -11,7 +11,7 @@ surfaceScalarField phiHbyA
 (
     "phiHbyA",
     fvc::flux(HbyA)
-  + rAUf*fvc::ddtCorr(U, phi)
+  + MRF.zeroFilter(rAUf*fvc::ddtCorr(U, phi))
 );
 
 MRF.makeRelative(phiHbyA);
diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/pEqn.H b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/pEqn.H
index dac95a19746..9f7da03a11c 100644
--- a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/pEqn.H
+++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceDyMFoam/pEqn.H
@@ -12,7 +12,7 @@
     (
         "phiHbyA",
         fvc::flux(HbyA)
-      + rAUf*fvc::ddtCorr(U, Uf)
+      + MRF.zeroFilter(rAUf*fvc::ddtCorr(U, Uf))
     );
 
     MRF.makeRelative(phiHbyA);
diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H
index 2a1f0a86786..a50733afcc9 100644
--- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H
+++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2017 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2018 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -257,6 +257,10 @@ public:
         //- Correct the boundary velocity for the rotation of the MRF region
         void correctBoundaryVelocity(volVectorField& U) const;
 
+        //- Zero the MRF region of the given field
+        template<class Type>
+        void zero(GeometricField<Type, fvsPatchField, surfaceMesh>& phi) const;
+
         //- Update MRFZone faces if the mesh topology changes
         void update();
 
diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.H b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.H
index 4c0fffbe2f8..7d9866261e2 100644
--- a/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.H
+++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012-2017 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012-2018 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -184,6 +184,14 @@ public:
             surfaceScalarField& phi
         ) const;
 
+        //- Filter-out the MRF region contribution from the given field
+        // setting the corresponding values to zero
+        template<class Type>
+        tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> zeroFilter
+        (
+            const tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>& tphi
+        ) const;
+
         //- Update MRFZone faces if the mesh topology changes
         void update();
 
@@ -210,6 +218,12 @@ public:
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+#ifdef NoRepository
+    #include "MRFZoneListTemplates.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
 #endif
 
 // ************************************************************************* //
diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZoneListTemplates.C b/src/finiteVolume/cfdTools/general/MRF/MRFZoneListTemplates.C
new file mode 100644
index 00000000000..28a7662ed5a
--- /dev/null
+++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneListTemplates.C
@@ -0,0 +1,64 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2018 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 "MRFZoneList.H"
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+template<class Type>
+Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>>
+Foam::MRFZoneList::zeroFilter
+(
+    const tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>& tphi
+) const
+{
+    if (size())
+    {
+        tmp<surfaceScalarField> zphi
+        (
+            New
+            (
+                tphi,
+                "zeroFilter(" + tphi().name() + ')',
+                tphi().dimensions(),
+                true
+            )
+        );
+
+        forAll(*this, i)
+        {
+            operator[](i).zero(zphi.ref());
+        }
+
+        return zphi;
+    }
+    else
+    {
+        return tmp<surfaceScalarField>(tphi, true);
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C b/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C
index 0a591035d6d..30df24cf8f5 100644
--- a/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C
+++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2018 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -207,4 +207,43 @@ void Foam::MRFZone::makeAbsoluteRhoFlux
 }
 
 
+template<class Type>
+void Foam::MRFZone::zero
+(
+    GeometricField<Type, fvsPatchField, surfaceMesh>& phi
+) const
+{
+    if (!active_)
+    {
+        return;
+    }
+
+    Field<Type>& phii = phi.primitiveFieldRef();
+
+    forAll(internalFaces_, i)
+    {
+        phii[internalFaces_[i]] = Zero;
+    }
+
+    typename GeometricField<Type, fvsPatchField, surfaceMesh>::Boundary& phibf =
+        phi.boundaryFieldRef();
+
+    forAll(includedFaces_, patchi)
+    {
+        forAll(includedFaces_[patchi], i)
+        {
+            phibf[patchi][includedFaces_[patchi][i]] = Zero;
+        }
+    }
+
+    forAll(excludedFaces_, patchi)
+    {
+        forAll(excludedFaces_[patchi], i)
+        {
+            phibf[patchi][excludedFaces_[patchi][i]] = Zero;
+        }
+    }
+}
+
+
 // ************************************************************************* //
-- 
GitLab