From 88423b2a6fddd19ee23ffc7f1410c089daef40b6 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Fri, 8 Dec 2017 16:06:30 +0000
Subject: [PATCH] TUT: snappyMultiRegionHeater with redistributePar

---
 .../multiRegionHeater/{0 => 0.orig}/T         |  0
 .../multiRegionHeater/{0 => 0.orig}/U         |  0
 .../multiRegionHeater/{0 => 0.orig}/epsilon   |  0
 .../multiRegionHeater/{0 => 0.orig}/k         |  0
 .../multiRegionHeater/{0 => 0.orig}/p         |  0
 .../multiRegionHeater/{0 => 0.orig}/p_rgh     |  0
 .../multiRegionHeater/Allclean                |  8 +--
 .../multiRegionHeater/Allmesh                 | 16 +++---
 .../multiRegionHeater/system/decomposeParDict |  3 +-
 .../snappyMultiRegionHeater/{0 => 0.orig}/T   |  6 +-
 .../snappyMultiRegionHeater/{0 => 0.orig}/U   |  6 +-
 .../{0 => 0.orig}/alphat                      |  7 ++-
 .../{0 => 0.orig}/epsilon                     |  7 ++-
 .../snappyMultiRegionHeater/{0 => 0.orig}/k   |  7 ++-
 .../snappyMultiRegionHeater/{0 => 0.orig}/p   |  6 +-
 .../{0 => 0.orig}/p_rgh                       |  4 +-
 .../snappyMultiRegionHeater/{0 => 0.orig}/rho |  6 +-
 .../snappyMultiRegionHeater/Allclean          |  8 +--
 .../snappyMultiRegionHeater/Allrun            | 46 +---------------
 .../snappyMultiRegionHeater/Allrun-parallel   | 55 +++++++++++++++++++
 .../snappyMultiRegionHeater/Allrun-serial     | 36 ++++++++++++
 .../system/bottomAir/changeDictionaryDict     | 25 +++++++++
 .../system/bottomAir/decomposeParDict         | 49 +----------------
 .../system/decomposeParDict                   | 33 +++++------
 .../system/heater/changeDictionaryDict        |  4 ++
 .../system/heater/decomposeParDict            | 50 +----------------
 .../system/leftSolid/changeDictionaryDict     |  4 ++
 .../system/rightSolid/changeDictionaryDict    |  4 ++
 .../system/topAir/changeDictionaryDict        | 24 ++++++++
 29 files changed, 212 insertions(+), 202 deletions(-)
 rename tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/{0 => 0.orig}/T (100%)
 rename tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/{0 => 0.orig}/U (100%)
 rename tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/{0 => 0.orig}/epsilon (100%)
 rename tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/{0 => 0.orig}/k (100%)
 rename tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/{0 => 0.orig}/p (100%)
 rename tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/{0 => 0.orig}/p_rgh (100%)
 rename tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/{0 => 0.orig}/T (89%)
 rename tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/{0 => 0.orig}/U (89%)
 rename tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/{0 => 0.orig}/alphat (89%)
 rename tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/{0 => 0.orig}/epsilon (89%)
 rename tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/{0 => 0.orig}/k (89%)
 rename tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/{0 => 0.orig}/p (89%)
 rename tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/{0 => 0.orig}/p_rgh (91%)
 rename tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/{0 => 0.orig}/rho (89%)
 mode change 100755 => 120000 tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun
 create mode 100755 tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun-parallel
 create mode 100755 tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun-serial
 mode change 100644 => 120000 tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/decomposeParDict
 mode change 100644 => 120000 tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/decomposeParDict

diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/T b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0.orig/T
similarity index 100%
rename from tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/T
rename to tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0.orig/T
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/U b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0.orig/U
similarity index 100%
rename from tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/U
rename to tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0.orig/U
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/epsilon b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0.orig/epsilon
similarity index 100%
rename from tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/epsilon
rename to tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0.orig/epsilon
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/k b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0.orig/k
similarity index 100%
rename from tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/k
rename to tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0.orig/k
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/p b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0.orig/p
similarity index 100%
rename from tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/p
rename to tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0.orig/p
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/p_rgh b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0.orig/p_rgh
similarity index 100%
rename from tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/p_rgh
rename to tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0.orig/p_rgh
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allclean b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allclean
index fad685f8abf..696cfb7f54c 100755
--- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allclean
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allclean
@@ -2,16 +2,10 @@
 cd ${0%/*} || exit 1                        # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/CleanFunctions  # Tutorial clean functions
 
-cleanCase
+cleanCase0
 
 rm -rf VTK
 rm -rf constant/cellToRegion
-rm -f 0/cellToRegion
-rm -rf 0/bottomWater
-rm -rf 0/topAir
-rm -rf 0/heater
-rm -rf 0/leftSolid
-rm -rf 0/rightSolid
 
 rm -rf constant/bottomWater/polyMesh
 rm -rf constant/topAir/polyMesh
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allmesh b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allmesh
index a579c1f4b60..44fa7da1372 100755
--- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allmesh
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allmesh
@@ -4,23 +4,25 @@ cd ${0%/*} || exit 1                        # Run from this directory
 
 runApplication blockMesh
 runApplication topoSet
+
+# Restore initial fields
+restore0Dir
+
 runApplication splitMeshRegions -cellZones -overwrite
 
 # Remove fluid fields from solid regions (important for post-processing)
-for i in $(foamListRegions solid)
+for region in $(foamListRegions solid)
 do
-   rm -f 0*/$i/{nut,alphat,epsilon,k,U,p_rgh}
+    rm -f 0/$region/{nut,alphat,epsilon,k,U,p_rgh}
 done
 
-for i in $(foamListRegions)
+for region in $(foamListRegions)
 do
-   runApplication -s $i changeDictionary -region $i
+    runApplication -s $region changeDictionary -region $region
 done
 
-
 echo
-echo "Creating files for paraview post-processing"
+echo "Use paraFoam -touch-all to create files for paraview post-processing"
 echo
-paraFoam -touchAll
 
 #------------------------------------------------------------------------------
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/decomposeParDict
index e630d521198..c8c7edc63d4 100644
--- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/decomposeParDict
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/decomposeParDict
@@ -30,12 +30,11 @@ regions
     heater
     {
         numberOfSubdomains  1;
-        method          none;
+        method          simple; // none;
 
         coeffs
         {
             n       (1 1 1);
-            delta   0.001;
         }
     }
 }
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/T b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/T
similarity index 89%
rename from tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/T
rename to tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/T
index d28373b3da5..fda1ac90bb0 100644
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/T
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/T
@@ -20,10 +20,12 @@ internalField   uniform 300;
 
 boundaryField
 {
+    #includeEtc "caseDicts/setConstraintTypes"
+
     ".*"
     {
-        type            calculated;
-        value           uniform 300;
+        type    calculated;
+        value   $internalField;
     }
 }
 
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/U b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/U
similarity index 89%
rename from tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/U
rename to tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/U
index 7ec4f2907c0..1e82313ce1e 100644
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/U
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/U
@@ -20,10 +20,12 @@ internalField   uniform (0.01 0 0);
 
 boundaryField
 {
+    #includeEtc "caseDicts/setConstraintTypes"
+
     ".*"
     {
-        type            calculated;
-        value           uniform (0.01 0 0);
+        type    calculated;
+        value   $internalField;
     }
 }
 
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/alphat b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/alphat
similarity index 89%
rename from tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/alphat
rename to tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/alphat
index 222501d30ec..579aa2a63ed 100644
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/alphat
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/alphat
@@ -20,12 +20,13 @@ internalField   uniform 0;
 
 boundaryField
 {
+    #includeEtc "caseDicts/setConstraintTypes"
+
     ".*"
     {
-        type            calculated;
-        value           uniform 0;
+        type    calculated;
+        value   $internalField;
     }
 }
 
-
 // ************************************************************************* //
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/epsilon b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/epsilon
similarity index 89%
rename from tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/epsilon
rename to tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/epsilon
index ee4ec0c64b5..5c3cd8d259b 100644
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/epsilon
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/epsilon
@@ -20,12 +20,13 @@ internalField   uniform 0.01;
 
 boundaryField
 {
+    #includeEtc "caseDicts/setConstraintTypes"
+
     ".*"
     {
-        type            calculated;
-        value           uniform 0.01;
+        type    calculated;
+        value   $internalField;
     }
 }
 
-
 // ************************************************************************* //
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/k b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/k
similarity index 89%
rename from tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/k
rename to tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/k
index a2aae944737..cb92af63c97 100644
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/k
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/k
@@ -20,12 +20,13 @@ internalField   uniform 0.1;
 
 boundaryField
 {
+    #includeEtc "caseDicts/setConstraintTypes"
+
     ".*"
     {
-        type            calculated;
-        value           uniform 0.1;
+        type    calculated;
+        value   $internalField;
     }
 }
 
-
 // ************************************************************************* //
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/p b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/p
similarity index 89%
rename from tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/p
rename to tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/p
index e54b106a156..3e0414647bb 100644
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/p
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/p
@@ -20,10 +20,12 @@ internalField   uniform 1e5;
 
 boundaryField
 {
+    #includeEtc "caseDicts/setConstraintTypes"
+
     ".*"
     {
-        type            calculated;
-        value           uniform 1e5;
+        type    calculated;
+        value   $internalField;
     }
 }
 
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/p_rgh b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/p_rgh
similarity index 91%
rename from tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/p_rgh
rename to tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/p_rgh
index a9074ce903d..ed32bb409dc 100644
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/p_rgh
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/p_rgh
@@ -20,10 +20,12 @@ internalField   uniform 1e5;
 
 boundaryField
 {
+    #includeEtc "caseDicts/setConstraintTypes"
+
     ".*"
     {
         type            calculated;
-        value           uniform 1e5;
+        value           $internalField;
     }
 }
 
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/rho b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/rho
similarity index 89%
rename from tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/rho
rename to tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/rho
index f5c3908bd2e..aa67e89d52f 100644
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/rho
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0.orig/rho
@@ -20,10 +20,12 @@ internalField   uniform 8000;
 
 boundaryField
 {
+    #includeEtc "caseDicts/setConstraintTypes"
+
     ".*"
     {
-        type            calculated;
-        value           uniform 8000;
+        type    calculated;
+        value   $internalField;
     }
 }
 
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allclean b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allclean
index 0ad9dc9eb83..e6134ad5564 100755
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allclean
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allclean
@@ -2,19 +2,13 @@
 cd ${0%/*} || exit 1                        # Run from this directory
 . $WM_PROJECT_DIR/bin/tools/CleanFunctions  # Tutorial clean functions
 
-cleanCase
+cleanCase0
 
 rm -rf constant/extendedFeatureEdgeMesh > /dev/null 2>&1
 rm -f constant/triSurface/*.eMesh > /dev/null 2>&1
 
 rm -rf VTK
 rm -rf constant/cellToRegion
-rm -rf 0/bottomAir
-rm -rf 0/topAir
-rm -rf 0/heater
-rm -rf 0/leftSolid
-rm -rf 0/rightSolid
-rm -f 0/cellToRegion
 
 rm -rf constant/bottomAir/polyMesh
 rm -rf constant/topAir/polyMesh
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun
deleted file mode 100755
index 6f11ca80be8..00000000000
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/sh
-cd ${0%/*} || exit 1                        # Run from this directory
-. $WM_PROJECT_DIR/bin/tools/RunFunctions    # Tutorial run functions
-
-rm -rf constant/polyMesh/sets
-
-runApplication blockMesh
-runApplication surfaceFeatureExtract
-
-runApplication snappyHexMesh -overwrite
-runApplication splitMeshRegions -cellZones -overwrite
-
-# remove fluid fields from solid regions (important for post-processing)
-for i in $(foamListRegions solid)
-do
-   rm -f 0*/$i/{nut,alphat,epsilon,k,U,p_rgh}
-done
-
-
-for i in $(foamListRegions)
-do
-   runApplication -s $i changeDictionary -region $i
-done
-
-
-#-- Run on single processor
-runApplication $(getApplication)
-
-
-## Decompose
-#runApplication decomposePar -allRegions
-#
-## Run
-#runParallel $(getApplication)
-#
-## Reconstruct
-#runApplication reconstructPar -allRegions
-
-
-echo
-echo "creating files for paraview post-processing"
-echo
-paraFoam -touchAll
-
-#------------------------------------------------------------------------------
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun
new file mode 120000
index 00000000000..f8f6fb52273
--- /dev/null
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun
@@ -0,0 +1 @@
+Allrun-parallel
\ No newline at end of file
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun-parallel b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun-parallel
new file mode 100755
index 00000000000..5e3d4522758
--- /dev/null
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun-parallel
@@ -0,0 +1,55 @@
+#!/bin/sh
+cd ${0%/*} || exit 1                        # Run from this directory
+. $WM_PROJECT_DIR/bin/tools/RunFunctions    # Tutorial run functions
+
+rm -rf constant/polyMesh/sets
+
+# For meshing only
+decompDict="-decomposeParDict system/decomposeParDict.6"
+
+runApplication blockMesh
+runApplication surfaceFeatureExtract
+
+runApplication $decompDict decomposePar
+
+runParallel $decompDict snappyHexMesh -overwrite
+
+# Restore initial fields
+restore0Dir -processor
+
+runParallel $decompDict splitMeshRegions -cellZones -overwrite
+
+# Remove fluid fields from solid regions (important for post-processing)
+for region in $(foamListRegions solid)
+do
+    rm -f 0/$region/{nut,alphat,epsilon,k,U,p_rgh}
+    rm -f processor*/0/$region/{nut,alphat,epsilon,k,U,p_rgh}
+done
+
+for region in $(foamListRegions)
+do
+    runParallel $decompDict -s $region changeDictionary -region $region
+done
+
+# Redistribute onto fewer processors, with special treatment for heater
+for region in $(foamListRegions)
+do
+    runParallel -np 6 -s redist-$region \
+        redistributePar -overwrite -region $region
+done
+
+#-- Run in parallel
+runParallel $(getApplication)
+
+# Reconstruct
+for region in $(foamListRegions)
+do
+    runParallel -s reconstruct-$region \
+        redistributePar -reconstruct -region $region
+done
+
+echo
+echo "Use paraFoam -touch-all to create files for paraview post-processing"
+echo
+
+#------------------------------------------------------------------------------
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun-serial b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun-serial
new file mode 100755
index 00000000000..87936c17507
--- /dev/null
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun-serial
@@ -0,0 +1,36 @@
+#!/bin/sh
+cd ${0%/*} || exit 1                        # Run from this directory
+. $WM_PROJECT_DIR/bin/tools/RunFunctions    # Tutorial run functions
+
+rm -rf constant/polyMesh/sets
+
+runApplication blockMesh
+runApplication surfaceFeatureExtract
+
+runApplication snappyHexMesh -overwrite
+
+# Restore initial fields
+restore0Dir
+
+runApplication splitMeshRegions -cellZones -overwrite
+
+# Remove fluid fields from solid regions (important for post-processing)
+for region in $(foamListRegions solid)
+do
+    rm -f 0/$region/{nut,alphat,epsilon,k,U,p_rgh}
+done
+
+for region in $(foamListRegions)
+do
+    runApplication -s $region changeDictionary -region $region
+done
+
+
+# Run on single processor
+runApplication $(getApplication)
+
+echo
+echo "Use paraFoam -touch-all to create files for paraview post-processing"
+echo
+
+#------------------------------------------------------------------------------
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/changeDictionaryDict
index 498816d58e4..03a7a9094ce 100644
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/changeDictionaryDict
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/changeDictionaryDict
@@ -37,6 +37,10 @@ U
             type            fixedValue;
             value           uniform (0 0 0);
         }
+        "procBoundary.*"
+        {
+            type            processor;
+        }
     }
 }
 
@@ -51,6 +55,11 @@ T
             type            zeroGradient;
         }
 
+        "procBoundary.*"
+        {
+            type            processor;
+        }
+
         "bottomAir_to_.*"
         {
             type            compressible::turbulentTemperatureCoupledBaffleMixed;
@@ -74,6 +83,10 @@ epsilon
             type            epsilonWallFunction;
             value           uniform 0.01;
         }
+        "procBoundary.*"
+        {
+            type            processor;
+        }
     }
 }
 
@@ -88,6 +101,10 @@ k
             type            kqRWallFunction;
             value           uniform 0.1;
         }
+        "procBoundary.*"
+        {
+            type            processor;
+        }
     }
 }
 
@@ -102,6 +119,10 @@ p_rgh
             type            fixedFluxPressure;
             value           uniform 1e5;
         }
+        "procBoundary.*"
+        {
+            type            processor;
+        }
     }
 }
 
@@ -116,6 +137,10 @@ p
             type            calculated;
             value           uniform 1e5;
         }
+        "procBoundary.*"
+        {
+            type            processor;
+        }
     }
 }
 
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/decomposeParDict
deleted file mode 100644
index 7263dc66d4a..00000000000
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/decomposeParDict
+++ /dev/null
@@ -1,48 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       dictionary;
-    object      decomposeParDict;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-numberOfSubdomains  4;
-
-//- Keep owner and neighbour on same processor for faces in zones:
-// preserveFaceZones (heater solid1 solid3);
-
-method          scotch;
-// method          hierarchical;
-// method          simple;
-// method          manual;
-
-coeffs
-{
-    n           (2 2 1);
-    //delta       0.001; // default=0.001
-    //order       xyz;   // default=xzy
-    dataFile    "decompositionData";
-}
-
-scotchCoeffs
-{
-    //processorWeights
-    //(
-    //    1
-    //    1
-    //    1
-    //    1
-    //);
-    //writeGraph  true;
-    //strategy "b";
-}
-
-// ************************************************************************* //
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/decomposeParDict
new file mode 120000
index 00000000000..46638e60f61
--- /dev/null
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/decomposeParDict
@@ -0,0 +1 @@
+../decomposeParDict
\ No newline at end of file
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/decomposeParDict
index 747b5114b73..ce005bfbda0 100644
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/decomposeParDict
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/decomposeParDict
@@ -19,30 +19,25 @@ numberOfSubdomains  4;
 //- Keep owner and neighbour on same processor for faces in zones:
 // preserveFaceZones (heater solid1 solid3);
 
-// method          scotch;
-method          hierarchical;
-// method          simple;
-// method          manual;
+method          scotch;
 
-coeffs
+regions
 {
-    n           (2 2 1);
-    //delta       0.001; // default=0.001
-    //order       xyz;   // default=xzy
-    dataFile    "decompositionData";
+    heater
+    {
+        numberOfSubdomains  1;
+        method          simple;
+
+        coeffs
+        {
+            n       (1 1 1);
+        }
+    }
 }
 
-scotchCoeffs
+coeffs
 {
-    //processorWeights
-    //(
-    //    1
-    //    1
-    //    1
-    //    1
-    //);
-    //writeGraph  true;
-    //strategy "b";
+    n       (2 2 1);
 }
 
 // ************************************************************************* //
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict
index c4321a17982..94498b92f7b 100644
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict
@@ -41,6 +41,10 @@ T
             type            zeroGradient;
             value           uniform 300;
         }
+        "procBoundary.*"
+        {
+            type            processor;
+        }
         "heater_to_.*"
         {
             type            compressible::turbulentTemperatureCoupledBaffleMixed;
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/decomposeParDict
deleted file mode 100644
index 6f60341487a..00000000000
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/decomposeParDict
+++ /dev/null
@@ -1,49 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  plus                                  |
-|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       dictionary;
-    object      decomposeParDict;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-numberOfSubdomains  4;
-
-//- Keep owner and neighbour on same processor for faces in zones:
-// preserveFaceZones (heater solid1 solid3);
-
-method          scotch;
-// method          hierarchical;
-// method          simple;
-// method          manual;
-
-coeffs
-{
-    n           (2 2 1);
-    //delta       0.001; // default=0.001
-    //order       xyz;   // default=xzy
-    dataFile    "decompositionData";
-}
-
-scotchCoeffs
-{
-    //processorWeights
-    //(
-    //    1
-    //    1
-    //    1
-    //    1
-    //);
-    //writeGraph  true;
-    //strategy "b";
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/decomposeParDict
new file mode 120000
index 00000000000..46638e60f61
--- /dev/null
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/decomposeParDict
@@ -0,0 +1 @@
+../decomposeParDict
\ No newline at end of file
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict
index 2984030dad0..ef614f46206 100644
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict
@@ -37,6 +37,10 @@ T
             type            zeroGradient;
             value           uniform 300;
         }
+        "procBoundary.*"
+        {
+            type            processor;
+        }
         "leftSolid_to_.*"
         {
             type            compressible::turbulentTemperatureCoupledBaffleMixed;
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict
index 184cf95c4e8..75655492b8d 100644
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict
@@ -37,6 +37,10 @@ T
             type            zeroGradient;
             value           uniform 300;
         }
+        "procBoundary.*"
+        {
+            type            processor;
+        }
         "rightSolid_to_.*"
         {
             type            compressible::turbulentTemperatureCoupledBaffleMixed;
diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/changeDictionaryDict
index 43e06d9940b..15b0c768561 100644
--- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/changeDictionaryDict
+++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/changeDictionaryDict
@@ -25,6 +25,10 @@ U
             type            fixedValue;
             value           uniform (0 0 0);
         }
+        "procBoundary.*"
+        {
+            type            processor;
+        }
         minX
         {
             type            fixedValue;
@@ -49,6 +53,10 @@ T
         {
             type            zeroGradient;
         }
+        "procBoundary.*"
+        {
+            type            processor;
+        }
 
         minX
         {
@@ -83,6 +91,10 @@ epsilon
             type            epsilonWallFunction;
             value           uniform 0.01;
         }
+        "procBoundary.*"
+        {
+            type            processor;
+        }
 
         minX
         {
@@ -109,6 +121,10 @@ k
             type            kqRWallFunction;
             value           uniform 0.1;
         }
+        "procBoundary.*"
+        {
+            type            processor;
+        }
 
         minX
         {
@@ -135,6 +151,10 @@ p_rgh
             type            fixedFluxPressure;
             value           uniform 1e5;
         }
+        "procBoundary.*"
+        {
+            type            processor;
+        }
 
         maxX
         {
@@ -155,6 +175,10 @@ p
             type            calculated;
             value           uniform 1e5;
         }
+        "procBoundary.*"
+        {
+            type            processor;
+        }
 
         maxX
         {
-- 
GitLab