From b73fe0d4c316b954efe23827fcfb8d58f71abffa Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Wed, 24 Jun 2015 10:44:02 +0100
Subject: [PATCH] utilities/postProcessing: Automate the selection of
 incompressible/compressible modes

---
 .../utilities/postProcessing/turbulence/R/R.C | 24 ++++++++++--------
 .../wall/wallShearStress/wallShearStress.C    | 25 +++++++++----------
 .../postProcessing/wall/yPlus/yPlus.C         | 25 +++++++++----------
 3 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/applications/utilities/postProcessing/turbulence/R/R.C b/applications/utilities/postProcessing/turbulence/R/R.C
index f487a13e548..490ae2eeb9b 100644
--- a/applications/utilities/postProcessing/turbulence/R/R.C
+++ b/applications/utilities/postProcessing/turbulence/R/R.C
@@ -27,6 +27,10 @@ Application
 Description
     Calculates and writes the Reynolds stress R for the current time step.
 
+    Compressible modes is automatically selected based on the existence of the
+    "thermophysicalProperties" dictionary required to construct the
+    thermodynamics package.
+
 \*---------------------------------------------------------------------------*/
 
 #include "fvCFD.H"
@@ -108,22 +112,12 @@ void calcCompressibleR
 int main(int argc, char *argv[])
 {
     timeSelector::addOptions();
-
     #include "addRegionOption.H"
-
-    argList::addBoolOption
-    (
-        "compressible",
-        "calculate compressible R"
-    );
-
     #include "setRootCase.H"
     #include "createTime.H"
     instantList timeDirs = timeSelector::select0(runTime, args);
     #include "createNamedMesh.H"
 
-    const bool compressible = args.optionFound("compressible");
-
     forAll(timeDirs, timeI)
     {
         runTime.setTime(timeDirs[timeI], timeI);
@@ -143,7 +137,15 @@ int main(int argc, char *argv[])
             Info<< "Reading field " << UHeader.name() << nl << endl;
             volVectorField U(UHeader, mesh);
 
-            if (compressible)
+            if
+            (
+                IOobject
+                (
+                    basicThermo::dictName,
+                    runTime.constant(),
+                    mesh
+                ).headerOk()
+            )
             {
                 calcCompressibleR(mesh, runTime, U);
             }
diff --git a/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C b/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C
index 3cf944ea4ca..958bfdc48c8 100644
--- a/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C
+++ b/applications/utilities/postProcessing/wall/wallShearStress/wallShearStress.C
@@ -28,8 +28,9 @@ Description
     Calculates and reports wall shear stress for all patches, for the
     specified times when using RAS turbulence models.
 
-    Default behaviour assumes operating in incompressible mode.
-    Use the -compressible option for compressible RAS cases.
+    Compressible modes is automatically selected based on the existence of the
+    "thermophysicalProperties" dictionary required to construct the
+    thermodynamics package.
 
 \*---------------------------------------------------------------------------*/
 
@@ -128,22 +129,12 @@ void calcCompressible
 int main(int argc, char *argv[])
 {
     timeSelector::addOptions();
-
     #include "addRegionOption.H"
-
-    argList::addBoolOption
-    (
-        "compressible",
-        "calculate compressible wall shear stress"
-    );
-
     #include "setRootCase.H"
     #include "createTime.H"
     instantList timeDirs = timeSelector::select0(runTime, args);
     #include "createNamedMesh.H"
 
-    const bool compressible = args.optionFound("compressible");
-
     forAll(timeDirs, timeI)
     {
         runTime.setTime(timeDirs[timeI], timeI);
@@ -183,7 +174,15 @@ int main(int argc, char *argv[])
             Info<< "Reading field U\n" << endl;
             volVectorField U(UHeader, mesh);
 
-            if (compressible)
+            if
+            (
+                IOobject
+                (
+                    basicThermo::dictName,
+                    runTime.constant(),
+                    mesh
+                ).headerOk()
+            )
             {
                 calcCompressible(mesh, runTime, U, wallShearStress);
             }
diff --git a/applications/utilities/postProcessing/wall/yPlus/yPlus.C b/applications/utilities/postProcessing/wall/yPlus/yPlus.C
index 5adf65869f8..f2815ef8955 100644
--- a/applications/utilities/postProcessing/wall/yPlus/yPlus.C
+++ b/applications/utilities/postProcessing/wall/yPlus/yPlus.C
@@ -32,8 +32,9 @@ Description
     the y+ values otherwise they are obtained directly from the near-wall
     velocity gradient and effective and laminar viscosities.
 
-    Default behaviour assumes operating in incompressible mode.
-    Use the -compressible option for compressible cases.
+    Compressible modes is automatically selected based on the existence of the
+    "thermophysicalProperties" dictionary required to construct the
+    thermodynamics package.
 
 \*---------------------------------------------------------------------------*/
 
@@ -180,22 +181,12 @@ void calcCompressibleYPlus
 int main(int argc, char *argv[])
 {
     timeSelector::addOptions();
-
     #include "addRegionOption.H"
-
-    argList::addBoolOption
-    (
-        "compressible",
-        "calculate compressible y+"
-    );
-
     #include "setRootCase.H"
     #include "createTime.H"
     instantList timeDirs = timeSelector::select(runTime, args, "yPlus");
     #include "createNamedMesh.H"
 
-    const bool compressible = args.optionFound("compressible");
-
     forAll(timeDirs, timeI)
     {
         runTime.setTime(timeDirs[timeI], timeI);
@@ -230,7 +221,15 @@ int main(int argc, char *argv[])
             Info<< "Reading field U\n" << endl;
             volVectorField U(UHeader, mesh);
 
-            if (compressible)
+            if
+            (
+                IOobject
+                (
+                    basicThermo::dictName,
+                    runTime.constant(),
+                    mesh
+                ).headerOk()
+            )
             {
                 calcCompressibleYPlus(mesh, runTime, U, yPlus);
             }
-- 
GitLab