From 8fc3d158ffbc9cfb34937842066e61a91b02b634 Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Sat, 27 Jun 2015 17:42:59 +0100
Subject: [PATCH] rhoSimpleFoam: Added "consistent" option to replace
 rhoSimplecFoam See tutorials/compressible/rhoSimpleFoam/squareBend

SIMPLE
{
    nNonOrthogonalCorrectors 0;
    rhoMin          0.1;
    rhoMax          1.0;
    transonic       yes;
    consistent      yes;

    residualControl
    {
        p               1e-3;
        U               1e-4;
        e               1e-3;

        // possibly check turbulence fields
        "(k|epsilon|omega)" 1e-3;
    }
}

relaxationFactors
{
    fields
    {
        p               1;
        rho             1;
    }
    equations
    {
        p               1;
        U               0.9;
        e               0.9;
        k               0.9;
        epsilon         0.9;
    }
}
---
 .../{rhoSimplecFoam/pEqn.H => pcEqn.H}        |  0
 .../rhoSimpleFoam/rhoSimpleFoam.C             | 10 ++-
 .../rhoSimpleFoam/rhoSimplecFoam/Make/files   |  3 -
 .../rhoSimpleFoam/rhoSimplecFoam/Make/options | 22 -----
 .../rhoSimplecFoam/rhoSimplecFoam.C           | 86 -------------------
 .../squareBend/0/T                            |  0
 .../squareBend/0/U                            |  0
 .../squareBend/0/alphat                       |  0
 .../squareBend/0/epsilon                      |  0
 .../squareBend/0/k                            |  0
 .../squareBend/0/nut                          |  0
 .../squareBend/0/p                            |  0
 .../squareBend/constant/polyMesh/boundary     | 41 +++++++++
 .../constant/thermophysicalProperties         |  0
 .../squareBend/constant/turbulenceProperties  |  0
 .../squareBend/system/blockMeshDict           |  0
 .../squareBend/system/controlDict             |  0
 .../squareBend/system/decomposeParDict        |  0
 .../squareBend/system/fvSchemes               |  0
 .../squareBend/system/fvSolution              |  1 +
 20 files changed, 50 insertions(+), 113 deletions(-)
 rename applications/solvers/compressible/rhoSimpleFoam/{rhoSimplecFoam/pEqn.H => pcEqn.H} (100%)
 delete mode 100644 applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/Make/files
 delete mode 100644 applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/Make/options
 delete mode 100644 applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/rhoSimplecFoam.C
 rename tutorials/compressible/{rhoSimplecFoam => rhoSimpleFoam}/squareBend/0/T (100%)
 rename tutorials/compressible/{rhoSimplecFoam => rhoSimpleFoam}/squareBend/0/U (100%)
 rename tutorials/compressible/{rhoSimplecFoam => rhoSimpleFoam}/squareBend/0/alphat (100%)
 rename tutorials/compressible/{rhoSimplecFoam => rhoSimpleFoam}/squareBend/0/epsilon (100%)
 rename tutorials/compressible/{rhoSimplecFoam => rhoSimpleFoam}/squareBend/0/k (100%)
 rename tutorials/compressible/{rhoSimplecFoam => rhoSimpleFoam}/squareBend/0/nut (100%)
 rename tutorials/compressible/{rhoSimplecFoam => rhoSimpleFoam}/squareBend/0/p (100%)
 create mode 100644 tutorials/compressible/rhoSimpleFoam/squareBend/constant/polyMesh/boundary
 rename tutorials/compressible/{rhoSimplecFoam => rhoSimpleFoam}/squareBend/constant/thermophysicalProperties (100%)
 rename tutorials/compressible/{rhoSimplecFoam => rhoSimpleFoam}/squareBend/constant/turbulenceProperties (100%)
 rename tutorials/compressible/{rhoSimplecFoam => rhoSimpleFoam}/squareBend/system/blockMeshDict (100%)
 rename tutorials/compressible/{rhoSimplecFoam => rhoSimpleFoam}/squareBend/system/controlDict (100%)
 rename tutorials/compressible/{rhoSimplecFoam => rhoSimpleFoam}/squareBend/system/decomposeParDict (100%)
 rename tutorials/compressible/{rhoSimplecFoam => rhoSimpleFoam}/squareBend/system/fvSchemes (100%)
 rename tutorials/compressible/{rhoSimplecFoam => rhoSimpleFoam}/squareBend/system/fvSolution (98%)

diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pcEqn.H
similarity index 100%
rename from applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/pEqn.H
rename to applications/solvers/compressible/rhoSimpleFoam/pcEqn.H
diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C
index ae4f28af77b..d554931e628 100644
--- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C
+++ b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C
@@ -60,9 +60,15 @@ int main(int argc, char *argv[])
         Info<< "Time = " << runTime.timeName() << nl << endl;
 
         // Pressure-velocity SIMPLE corrector
+        #include "UEqn.H"
+        #include "EEqn.H"
+
+        if (simple.consistent())
+        {
+            #include "pcEqn.H"
+        }
+        else
         {
-            #include "UEqn.H"
-            #include "EEqn.H"
             #include "pEqn.H"
         }
 
diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/Make/files b/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/Make/files
deleted file mode 100644
index 6637e49aa3b..00000000000
--- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/Make/files
+++ /dev/null
@@ -1,3 +0,0 @@
-rhoSimplecFoam.C
-
-EXE = $(FOAM_APPBIN)/rhoSimplecFoam
diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/Make/options b/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/Make/options
deleted file mode 100644
index ee0ed0de421..00000000000
--- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/Make/options
+++ /dev/null
@@ -1,22 +0,0 @@
-EXE_INC = \
-    -I.. \
-    -I$(LIB_SRC)/transportModels/compressible/lnInclude \
-    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-    -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-    -I$(LIB_SRC)/finiteVolume/cfdTools \
-    -I$(LIB_SRC)/finiteVolume/lnInclude \
-    -I$(LIB_SRC)/sampling/lnInclude \
-    -I$(LIB_SRC)/meshTools/lnInclude \
-    -I$(LIB_SRC)/fvOptions/lnInclude
-
-EXE_LIBS = \
-    -lcompressibleTransportModels \
-    -lfluidThermophysicalModels \
-    -lspecie \
-    -lturbulenceModels \
-    -lcompressibleTurbulenceModels \
-    -lfiniteVolume \
-    -lsampling \
-    -lmeshTools \
-    -lfvOptions
diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/rhoSimplecFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/rhoSimplecFoam.C
deleted file mode 100644
index af8e917ee68..00000000000
--- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/rhoSimplecFoam.C
+++ /dev/null
@@ -1,86 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2015 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/>.
-
-Application
-    rhoSimplecFoam
-
-Description
-    Steady-state SIMPLEC solver for laminar or turbulent RANS flow of
-    compressible fluids.
-
-\*---------------------------------------------------------------------------*/
-
-#include "fvCFD.H"
-#include "psiThermo.H"
-#include "turbulentFluidThermoModel.H"
-#include "mixedFvPatchFields.H"
-#include "bound.H"
-#include "simpleControl.H"
-#include "fvIOoptionList.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-int main(int argc, char *argv[])
-{
-    #include "setRootCase.H"
-    #include "createTime.H"
-    #include "createMesh.H"
-
-    simpleControl simple(mesh);
-
-    #include "createFields.H"
-    #include "createMRF.H"
-    #include "createFvOptions.H"
-    #include "initContinuityErrs.H"
-
-    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-    Info<< "\nStarting time loop\n" << endl;
-
-    while (simple.loop())
-    {
-        Info<< "Time = " << runTime.timeName() << nl << endl;
-
-        // Velocity-pressure-enthalpy SIMPLEC corrector
-        {
-            #include "UEqn.H"
-            #include "EEqn.H"
-            #include "pEqn.H"
-        }
-
-        turbulence->correct();
-
-        runTime.write();
-
-        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
-            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
-            << nl << endl;
-    }
-
-    Info<< "End\n" << endl;
-
-    return 0;
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/0/T b/tutorials/compressible/rhoSimpleFoam/squareBend/0/T
similarity index 100%
rename from tutorials/compressible/rhoSimplecFoam/squareBend/0/T
rename to tutorials/compressible/rhoSimpleFoam/squareBend/0/T
diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/0/U b/tutorials/compressible/rhoSimpleFoam/squareBend/0/U
similarity index 100%
rename from tutorials/compressible/rhoSimplecFoam/squareBend/0/U
rename to tutorials/compressible/rhoSimpleFoam/squareBend/0/U
diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/0/alphat b/tutorials/compressible/rhoSimpleFoam/squareBend/0/alphat
similarity index 100%
rename from tutorials/compressible/rhoSimplecFoam/squareBend/0/alphat
rename to tutorials/compressible/rhoSimpleFoam/squareBend/0/alphat
diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/0/epsilon b/tutorials/compressible/rhoSimpleFoam/squareBend/0/epsilon
similarity index 100%
rename from tutorials/compressible/rhoSimplecFoam/squareBend/0/epsilon
rename to tutorials/compressible/rhoSimpleFoam/squareBend/0/epsilon
diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/0/k b/tutorials/compressible/rhoSimpleFoam/squareBend/0/k
similarity index 100%
rename from tutorials/compressible/rhoSimplecFoam/squareBend/0/k
rename to tutorials/compressible/rhoSimpleFoam/squareBend/0/k
diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/0/nut b/tutorials/compressible/rhoSimpleFoam/squareBend/0/nut
similarity index 100%
rename from tutorials/compressible/rhoSimplecFoam/squareBend/0/nut
rename to tutorials/compressible/rhoSimpleFoam/squareBend/0/nut
diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/0/p b/tutorials/compressible/rhoSimpleFoam/squareBend/0/p
similarity index 100%
rename from tutorials/compressible/rhoSimplecFoam/squareBend/0/p
rename to tutorials/compressible/rhoSimpleFoam/squareBend/0/p
diff --git a/tutorials/compressible/rhoSimpleFoam/squareBend/constant/polyMesh/boundary b/tutorials/compressible/rhoSimpleFoam/squareBend/constant/polyMesh/boundary
new file mode 100644
index 00000000000..72f6b668ca9
--- /dev/null
+++ b/tutorials/compressible/rhoSimpleFoam/squareBend/constant/polyMesh/boundary
@@ -0,0 +1,41 @@
+/*--------------------------------*- 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;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+3
+(
+    Default_Boundary_Region
+    {
+        type            wall;
+        inGroups        1(wall);
+        nFaces          22400;
+        startFace       324400;
+    }
+    inlet
+    {
+        type            patch;
+        nFaces          400;
+        startFace       346800;
+    }
+    outlet
+    {
+        type            patch;
+        nFaces          400;
+        startFace       347200;
+    }
+)
+
+// ************************************************************************* //
diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/constant/thermophysicalProperties b/tutorials/compressible/rhoSimpleFoam/squareBend/constant/thermophysicalProperties
similarity index 100%
rename from tutorials/compressible/rhoSimplecFoam/squareBend/constant/thermophysicalProperties
rename to tutorials/compressible/rhoSimpleFoam/squareBend/constant/thermophysicalProperties
diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/constant/turbulenceProperties b/tutorials/compressible/rhoSimpleFoam/squareBend/constant/turbulenceProperties
similarity index 100%
rename from tutorials/compressible/rhoSimplecFoam/squareBend/constant/turbulenceProperties
rename to tutorials/compressible/rhoSimpleFoam/squareBend/constant/turbulenceProperties
diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/system/blockMeshDict b/tutorials/compressible/rhoSimpleFoam/squareBend/system/blockMeshDict
similarity index 100%
rename from tutorials/compressible/rhoSimplecFoam/squareBend/system/blockMeshDict
rename to tutorials/compressible/rhoSimpleFoam/squareBend/system/blockMeshDict
diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/system/controlDict b/tutorials/compressible/rhoSimpleFoam/squareBend/system/controlDict
similarity index 100%
rename from tutorials/compressible/rhoSimplecFoam/squareBend/system/controlDict
rename to tutorials/compressible/rhoSimpleFoam/squareBend/system/controlDict
diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/system/decomposeParDict b/tutorials/compressible/rhoSimpleFoam/squareBend/system/decomposeParDict
similarity index 100%
rename from tutorials/compressible/rhoSimplecFoam/squareBend/system/decomposeParDict
rename to tutorials/compressible/rhoSimpleFoam/squareBend/system/decomposeParDict
diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSchemes b/tutorials/compressible/rhoSimpleFoam/squareBend/system/fvSchemes
similarity index 100%
rename from tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSchemes
rename to tutorials/compressible/rhoSimpleFoam/squareBend/system/fvSchemes
diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSolution b/tutorials/compressible/rhoSimpleFoam/squareBend/system/fvSolution
similarity index 98%
rename from tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSolution
rename to tutorials/compressible/rhoSimpleFoam/squareBend/system/fvSolution
index 7392a59f272..8fe57aeb781 100644
--- a/tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSolution
+++ b/tutorials/compressible/rhoSimpleFoam/squareBend/system/fvSolution
@@ -54,6 +54,7 @@ SIMPLE
     rhoMin          0.1;
     rhoMax          1.0;
     transonic       yes;
+    consistent      yes;
 
     residualControl
     {
-- 
GitLab