From 5dc1c259d43b9a7bab0738bea1c24250337b7956 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Fri, 21 Sep 2012 12:03:08 +0100
Subject: [PATCH] ENH: verticalChannel: updated for fowRateInletVelocity

---
 .../changeDictionary/changeDictionary.C       | 150 +++++++++++++-----
 .../verticalChannel/0.org/U                   |   6 +-
 .../verticalChannel/0/H2O                     |  54 -------
 .../verticalChannel/0/T                       |  54 -------
 .../verticalChannel/0/U                       |  57 -------
 .../verticalChannel/0/air                     |  54 -------
 .../verticalChannel/0/alphat                  |  56 -------
 .../verticalChannel/0/k                       |  57 -------
 .../verticalChannel/0/mut                     |  58 -------
 .../verticalChannel/0/omega                   |  62 --------
 .../verticalChannel/Allclean                  |   4 -
 .../verticalChannel/Allrun                    |   6 +
 .../constant/polyMesh/boundary                |  58 -------
 .../{0/p => system/changeDictionaryDict}      |  49 ++----
 14 files changed, 134 insertions(+), 591 deletions(-)
 delete mode 100644 tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/H2O
 delete mode 100644 tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/T
 delete mode 100644 tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/U
 delete mode 100644 tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/air
 delete mode 100644 tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/alphat
 delete mode 100644 tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/k
 delete mode 100644 tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/mut
 delete mode 100644 tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/omega
 delete mode 100644 tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/polyMesh/boundary
 rename tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/{0/p => system/changeDictionaryDict} (58%)

diff --git a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C
index ad178b765cb..3c664cfc3b2 100644
--- a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C
+++ b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C
@@ -52,6 +52,7 @@ Description
         }
     }
     \endverbatim
+    Replacement entries starting with '~' will remove the entry.
 
 Usage
 
@@ -172,6 +173,46 @@ bool addEntry
 }
 
 
+
+// List of indices into thisKeys
+labelList findMatches
+(
+    const HashTable<wordList, word>& shortcuts,
+    const wordList& shortcutNames,
+    const wordList& thisKeys,
+    const keyType& key
+)
+{
+    labelList matches;
+
+    if (key.isPattern())
+    {
+        // Wildcard match
+        matches = findStrings(key, thisKeys);
+
+    }
+    else if (shortcuts.size())
+    {
+        // See if patchGroups expand to valid thisKeys
+        labelList indices = findStrings(key, shortcutNames);
+        forAll(indices, i)
+        {
+            const word& name = shortcutNames[indices[i]];
+            const wordList& keys = shortcuts[name];
+            forAll(keys, j)
+            {
+                label index = findIndex(thisKeys, keys[j]);
+                if (index != -1)
+                {
+                    matches.append(index);
+                }
+            }
+        }
+    }
+    return matches;
+}
+
+
 // Dictionary merging/editing.
 // literalRE:
 // - true: behave like dictionary::merge, i.e. add regexps just like
@@ -185,6 +226,8 @@ bool merge
     const HashTable<wordList, word>& shortcuts
 )
 {
+    const wordList shortcutNames(shortcuts.toc());
+
     bool changed = false;
 
     // Save current (non-wildcard) keys before adding items.
@@ -203,7 +246,18 @@ bool merge
     {
         const keyType& key = mergeIter().keyword();
 
-        if (literalRE || !(key.isPattern() || shortcuts.found(key)))
+        if (key[0] == '~')
+        {
+            word eraseKey = key(1, key.size()-1);
+            if (thisDict.remove(eraseKey))
+            {
+                // Mark thisDict entry as having been match for wildcard
+                // handling later on.
+                thisKeysSet.erase(eraseKey);
+            }
+            changed = true;
+        }
+        else if (literalRE || !(key.isPattern() || shortcuts.found(key)))
         {
             entry* entryPtr = thisDict.lookupEntryPtr
             (
@@ -255,59 +309,69 @@ bool merge
         {
             const keyType& key = mergeIter().keyword();
 
-            // List of indices into thisKeys
-            labelList matches;
-
-            if (key.isPattern())
+            if (key[0] == '~')
             {
-                // Wildcard match
-                matches = findStrings(key, thisKeys);
+                word eraseKey = key(1, key.size()-1);
 
-            }
-            else if (shortcuts.size())
-            {
-                // See if patchGroups expand to valid thisKeys
-                const wordList shortcutNames = shortcuts.toc();
-                labelList indices = findStrings(key, shortcutNames);
-                forAll(indices, i)
+                // List of indices into thisKeys
+                labelList matches
+                (
+                    findMatches
+                    (
+                        shortcuts,
+                        shortcutNames,
+                        thisKeys,
+                        eraseKey
+                    )
+                );
+
+                // Remove all matches
+                forAll(matches, i)
                 {
-                    const word& name = shortcutNames[indices[i]];
-                    const wordList& keys = shortcuts[name];
-                    forAll(keys, j)
-                    {
-                        label index = findIndex(thisKeys, keys[j]);
-                        if (index != -1)
-                        {
-                            matches.append(index);
-                        }
-                    }
+                    const word& thisKey = thisKeys[matches[i]];
+                    thisKeysSet.erase(thisKey);
                 }
+                changed = true;
             }
-
-            // Add all matches
-            forAll(matches, i)
+            else
             {
-                const word& thisKey = thisKeys[matches[i]];
-
-                entry& thisEntry = const_cast<entry&>
+                // List of indices into thisKeys
+                labelList matches
                 (
-                    thisDict.lookupEntry(thisKey, false, false)
+                    findMatches
+                    (
+                        shortcuts,
+                        shortcutNames,
+                        thisKeys,
+                        key
+                    )
                 );
 
-                if
-                (
-                    addEntry
+                // Add all matches
+                forAll(matches, i)
+                {
+                    const word& thisKey = thisKeys[matches[i]];
+
+                    entry& thisEntry = const_cast<entry&>
                     (
-                        thisDict,
-                        thisEntry,
-                        mergeIter(),
-                        literalRE,
-                        HashTable<wordList, word>(0)    // no shortcuts
-                                                        // at deeper levels
+                        thisDict.lookupEntry(thisKey, false, false)
+                    );
+
+                    if
+                    (
+                        addEntry
+                        (
+                            thisDict,
+                            thisEntry,
+                            mergeIter(),
+                            literalRE,
+                            HashTable<wordList, word>(0)    // no shortcuts
+                                                            // at deeper levels
+                        )
                     )
-                )
-                {
-                    changed = true;
+                    {
+                        changed = true;
+                    }
                 }
             }
         }
diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0.org/U b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0.org/U
index 7f8c434997d..029e4cce0a2 100644
--- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0.org/U
+++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0.org/U
@@ -32,13 +32,15 @@ boundaryField
     inletCentral
     {
         type            flowRateInletVelocity;
-        massFlowRate    constant 0.00379;
+        //massFlowRate    constant 0.00379;
+        volumetricFlowRate    constant 0.00379;
         value           uniform (0 14.68 0);
     }
     inletSides
     {
         type            flowRateInletVelocity;
-        massFlowRate    constant 0.00832;
+        //massFlowRate  constant 0.00832;
+        volumetricFlowRate  constant 0.00832;
         value           uniform (0 17.79 0);
     }
     outlet
diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/H2O b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/H2O
deleted file mode 100644
index baa8dd21524..00000000000
--- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/H2O
+++ /dev/null
@@ -1,54 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
-|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      H2O;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 0 0 0 0 0 0];
-
-internalField   uniform 0.01;
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    walls
-    {
-        type            zeroGradient;
-    }
-    outlet
-    {
-        type            inletOutlet;
-        inletValue      uniform 0.0;
-    }
-    inletSides
-    {
-        type            fixedValue;
-        value           uniform 0.01;
-    }
-    inletCentral
-    {
-        type            fixedValue;
-        value           uniform 0.01;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/T b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/T
deleted file mode 100644
index df744edb03e..00000000000
--- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/T
+++ /dev/null
@@ -1,54 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
-|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      T;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 0 0 1 0 0 0];
-
-internalField   uniform 473.0;
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    walls
-    {
-        type            zeroGradient;
-    }
-    outlet
-    {
-        type            inletOutlet;
-        inletValue      uniform 473.0;
-    }
-    inletSides
-    {
-        type            fixedValue;
-        value           uniform 473.0;
-    }
-    inletCentral
-    {
-        type            fixedValue;
-        value           uniform 573.0;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/U b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/U
deleted file mode 100644
index 7f8c434997d..00000000000
--- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/U
+++ /dev/null
@@ -1,57 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
-|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volVectorField;
-    location    "0";
-    object      U;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 1 -1 0 0 0 0];
-
-internalField   uniform (0 0 0);
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    inletCentral
-    {
-        type            flowRateInletVelocity;
-        massFlowRate    constant 0.00379;
-        value           uniform (0 14.68 0);
-    }
-    inletSides
-    {
-        type            flowRateInletVelocity;
-        massFlowRate    constant 0.00832;
-        value           uniform (0 17.79 0);
-    }
-    outlet
-    {
-        type            inletOutlet;
-        inletValue      uniform (0 0 0);
-    }
-    walls
-    {
-        type            fixedValue;
-        value           uniform (0 0 0);
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/air b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/air
deleted file mode 100644
index 81541afef9b..00000000000
--- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/air
+++ /dev/null
@@ -1,54 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
-|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      air;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 0 0 0 0 0 0];
-
-internalField   uniform 0.99;
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    walls
-    {
-        type            zeroGradient;
-    }
-    outlet
-    {
-        type            inletOutlet;
-        inletValue      uniform 1.0;
-    }
-    inletSides
-    {
-        type            fixedValue;
-        value           uniform 0.99;
-    }
-    inletCentral
-    {
-        type            fixedValue;
-        value           uniform 0.99;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/alphat b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/alphat
deleted file mode 100644
index 33d260bf7c0..00000000000
--- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/alphat
+++ /dev/null
@@ -1,56 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
-|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      alphat;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [1 -1 -1 0 0 0 0];
-
-internalField   uniform 0;
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    inletCentral
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    inletSides
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    outlet
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    walls
-    {
-        type            alphatWallFunction;
-        Prt             0.85;
-        value           uniform 0;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/k b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/k
deleted file mode 100644
index 2a769368937..00000000000
--- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/k
+++ /dev/null
@@ -1,57 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
-|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      k;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 2 -2 0 0 0 0];
-
-internalField   uniform 3.75e-9;
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    inletCentral
-    {
-        type            turbulentIntensityKineticEnergyInlet;
-        intensity       0.15;
-        value           uniform 3.75e-9;
-    }
-    inletSides
-    {
-        type            turbulentIntensityKineticEnergyInlet;
-        intensity       0.16;
-        value           uniform 3.75e-9;
-    }
-    outlet
-    {
-        type            inletOutlet;
-        inletValue      uniform 3.75e-9;
-    }
-    walls
-    {
-        type            compressible::kqRWallFunction;
-        value           uniform 0;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/mut b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/mut
deleted file mode 100644
index 7cfeaae133d..00000000000
--- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/mut
+++ /dev/null
@@ -1,58 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
-|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      mut;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [1 -1 -1 0 0 0 0];
-
-internalField   uniform 0;
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    inletCentral
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    inletSides
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    outlet
-    {
-        type            calculated;
-        value           uniform 0;
-    }
-    walls
-    {
-        type            mutkWallFunction;
-        Cmu             0.09;
-        kappa           0.41;
-        E               9.8;
-        value           uniform 0;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/omega b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/omega
deleted file mode 100644
index efd2924775d..00000000000
--- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/omega
+++ /dev/null
@@ -1,62 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
-|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      omega;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dimensions      [0 0 -1 0 0 0 0];
-
-internalField   uniform 4.5e-3;
-
-boundaryField
-{
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
-    {
-        type            symmetryPlane;
-    }
-    inletCentral
-    {
-        type            compressible::turbulentMixingLengthFrequencyInlet;
-        mixingLength    0.007;
-        k               k;
-        value           uniform 4.5e-3;
-    }
-    inletSides
-    {
-        type            compressible::turbulentMixingLengthFrequencyInlet;
-        mixingLength    0.007;
-        k               k;
-        value           uniform 4.5e-3;
-    }
-    outlet
-    {
-        type            inletOutlet;
-        inletValue      uniform 4.5e-3;
-    }
-    walls
-    {
-        type            compressible::omegaWallFunction;
-        Cmu             0.09;
-        kappa           0.41;
-        E               9.8;
-        value           uniform 0;
-    }
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/Allclean b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/Allclean
index 6ac02e9eab6..b0a57810b30 100755
--- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/Allclean
+++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/Allclean
@@ -7,10 +7,6 @@ cd ${0%/*} || exit 1    # run from this directory
 # remove old time and post-processing folders
 rm -rf 0 *[1-9]* processor* postProcessing
 
-
-# copy 0.org to 0
-cp -r 0.org 0
-
 cleanCase
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/Allrun b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/Allrun
index 8d4cb3681e9..babec860ab7 100755
--- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/Allrun
+++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/Allrun
@@ -7,10 +7,16 @@ cd ${0%/*} || exit 1    # run from this directory
 # create mesh
 runApplication blockMesh
 
+cp -r 0.org 0
+
 # initialise with potentialFoam solution
 runApplication potentialFoam
+
 rm -f 0/phi
 
+# change flowRateInletVelocity to massFlowRate
+runApplication changeDictionary
+
 # run the solver
 runApplication `getApplication`
 
diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/polyMesh/boundary b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/polyMesh/boundary
deleted file mode 100644
index e8088bf7bdd..00000000000
--- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/polyMesh/boundary
+++ /dev/null
@@ -1,58 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
-|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       polyBoundaryMesh;
-    location    "constant/polyMesh";
-    object      boundary;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-6
-(
-    back
-    {
-        type            symmetryPlane;
-        nFaces          9340;
-        startFace       265900;
-    }
-    front
-    {
-        type            symmetryPlane;
-        nFaces          9340;
-        startFace       275240;
-    }
-    inletCentral
-    {
-        type            patch;
-        nFaces          100;
-        startFace       284580;
-    }
-    inletSides
-    {
-        type            patch;
-        nFaces          200;
-        startFace       284680;
-    }
-    outlet
-    {
-        type            patch;
-        nFaces          300;
-        startFace       284880;
-    }
-    walls
-    {
-        type            wall;
-        nFaces          9320;
-        startFace       285180;
-    }
-)
-
-// ************************************************************************* //
diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/p b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/system/changeDictionaryDict
similarity index 58%
rename from tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/p
rename to tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/system/changeDictionaryDict
index 921f06d7a14..e70391b71f7 100644
--- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/p
+++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/system/changeDictionaryDict
@@ -9,44 +9,29 @@ FoamFile
 {
     version     2.0;
     format      ascii;
-    class       volScalarField;
-    location    "0";
-    object      p;
+    class       dictionary;
+    object      changeDictionaryDict;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-dimensions      [1 -1 -2 0 0 0 0];
-
-internalField   uniform 100000;
-
-boundaryField
+dictionaryReplacement
 {
-    back
-    {
-        type            symmetryPlane;
-    }
-    front
+    U
     {
-        type            symmetryPlane;
-    }
-    inletCentral
-    {
-        type            zeroGradient;
-    }
-    inletSides
-    {
-        type            zeroGradient;
-    }
-    outlet
-    {
-        type            fixedValue;
-        value           uniform 100000;
-    }
-    walls
-    {
-        type            zeroGradient;
+        boundaryField
+        {
+            inletCentral
+            {
+                ~volumetricFlowRate;
+                massFlowRate    constant 0.00379;
+            }
+            inletSides
+            {
+                ~volumetricFlowRate;
+                massFlowRate  constant 0.00832;
+            }
+        }
     }
 }
 
-
 // ************************************************************************* //
-- 
GitLab