From e450e8048b1c16c785dceb8634ee44a4768ac06e Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Mon, 9 May 2016 15:23:07 +0100
Subject: [PATCH] applications/solvers/discreteMethods: Added -postProcess
 option See also commit cc455173ffc914470a830c46ae51fabbba8dfdb0

---
 .../dsmc/dsmcFoam/createFields.H              |  2 +
 .../discreteMethods/dsmc/dsmcFoam/dsmcFoam.C  |  8 +--
 .../molecularDynamics/mdFoam/createFields.H   | 64 ++++---------------
 .../molecularDynamics/mdFoam/mdFoam.C         | 28 ++------
 4 files changed, 26 insertions(+), 76 deletions(-)
 create mode 100644 applications/solvers/discreteMethods/dsmc/dsmcFoam/createFields.H

diff --git a/applications/solvers/discreteMethods/dsmc/dsmcFoam/createFields.H b/applications/solvers/discreteMethods/dsmc/dsmcFoam/createFields.H
new file mode 100644
index 00000000000..015afc73b28
--- /dev/null
+++ b/applications/solvers/discreteMethods/dsmc/dsmcFoam/createFields.H
@@ -0,0 +1,2 @@
+Info<< nl << "Constructing dsmcCloud " << endl;
+dsmcCloud dsmc("dsmc", mesh);
diff --git a/applications/solvers/discreteMethods/dsmc/dsmcFoam/dsmcFoam.C b/applications/solvers/discreteMethods/dsmc/dsmcFoam/dsmcFoam.C
index a5e0562155e..b5e3b1b222a 100644
--- a/applications/solvers/discreteMethods/dsmc/dsmcFoam/dsmcFoam.C
+++ b/applications/solvers/discreteMethods/dsmc/dsmcFoam/dsmcFoam.C
@@ -37,16 +37,16 @@ Description
 
 int main(int argc, char *argv[])
 {
+    #define NO_CONTROL
+    #include "postProcess.H"
+
     #include "setRootCase.H"
     #include "createTime.H"
     #include "createMesh.H"
+    #include "createFields.H"
 
     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-    Info<< nl << "Constructing dsmcCloud " << endl;
-
-    dsmcCloud dsmc("dsmc", mesh);
-
     Info<< "\nStarting time loop\n" << endl;
 
     while (runTime.loop())
diff --git a/applications/solvers/discreteMethods/molecularDynamics/mdFoam/createFields.H b/applications/solvers/discreteMethods/molecularDynamics/mdFoam/createFields.H
index d5ea5ef8b69..ce72e51d2bd 100644
--- a/applications/solvers/discreteMethods/molecularDynamics/mdFoam/createFields.H
+++ b/applications/solvers/discreteMethods/molecularDynamics/mdFoam/createFields.H
@@ -1,55 +1,17 @@
-    Info<< "\nReading field U\n" << endl;
-    volVectorField U
-    (
-        IOobject
-        (
-            "U",
-            runTime.timeName(),
-            mesh,
-            IOobject::MUST_READ,
-            IOobject::AUTO_WRITE
-        ),
-        mesh
-    );
-
-    word polyatomicCloudName("polyatomicCloud");
-
-    potential polyPot
+Info<< "\nReading field U\n" << endl;
+volVectorField U
+(
+    IOobject
     (
+        "U",
+        runTime.timeName(),
         mesh,
-        IOdictionary
-        (
-            IOobject
-            (
-                polyatomicCloudName +  "Properties",
-                mesh.time().constant(),
-                mesh,
-                IOobject::MUST_READ_IF_MODIFIED,
-                IOobject::NO_WRITE,
-                false
-            )
-        )
-    );
-
-    polyatomicCloud polyatomics(polyatomicCloudName, mesh, polyPot);
+        IOobject::MUST_READ,
+        IOobject::AUTO_WRITE
+    ),
+    mesh
+);
 
-    word monoatomicCloudName("monoatomicCloud");
-
-    potential monoPot
-    (
-        mesh,
-        IOdictionary
-        (
-            IOobject
-            (
-                monoatomicCloudName +  "Properties",
-                mesh.time().constant(),
-                mesh,
-                IOobject::MUST_READ_IF_MODIFIED,
-                IOobject::NO_WRITE,
-                false
-            )
-        )
-    );
+potential pot(mesh);
 
-    monoatomicCloud monoatomics(monoatomicCloudName, mesh, monoPot);
+moleculeCloud molecules(mesh, pot);
diff --git a/applications/solvers/discreteMethods/molecularDynamics/mdFoam/mdFoam.C b/applications/solvers/discreteMethods/molecularDynamics/mdFoam/mdFoam.C
index 68f6530c95f..a7998ef30ab 100644
--- a/applications/solvers/discreteMethods/molecularDynamics/mdFoam/mdFoam.C
+++ b/applications/solvers/discreteMethods/molecularDynamics/mdFoam/mdFoam.C
@@ -32,34 +32,21 @@ Description
 #include "fvCFD.H"
 #include "md.H"
 
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
 int main(int argc, char *argv[])
 {
+    #define NO_CONTROL
+    #include "postProcess.H"
+
     #include "setRootCase.H"
     #include "createTime.H"
     #include "createMesh.H"
+    #include "createFields.H"
+    #include "temperatureAndPressureVariables.H"
 
     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-    Info<< "\nReading field U\n" << endl;
-    volVectorField U
-    (
-        IOobject
-        (
-            "U",
-            runTime.timeName(),
-            mesh,
-            IOobject::MUST_READ,
-            IOobject::AUTO_WRITE
-        ),
-        mesh
-    );
-
-    potential pot(mesh);
-
-    moleculeCloud molecules(mesh, pot);
-
-    #include "temperatureAndPressureVariables.H"
-
     label nAveragingSteps = 0;
 
     Info<< "\nStarting time loop\n" << endl;
@@ -73,7 +60,6 @@ int main(int argc, char *argv[])
         molecules.evolve();
 
         #include "meanMomentumEnergyAndNMols.H"
-
         #include "temperatureAndPressure.H"
 
         runTime.write();
-- 
GitLab