From d95ed189ae352c76a9399410198aeeb3e0e41dd9 Mon Sep 17 00:00:00 2001
From: Beatrix Becker <beatrix.becker@iws.uni-stuttgart.de>
Date: Wed, 25 Jul 2018 16:09:15 +0200
Subject: [PATCH] [fluidsystems] remove isLiquid in favor of isGas Also replace
 all calls to isLiquid by equivalent calls to isGas

---
 .../2p/thermalconductivitysomerton.hh              |  6 +++---
 dumux/material/fluidsystems/1padapter.hh           |  6 +++---
 dumux/material/fluidsystems/1pgas.hh               |  6 +++---
 dumux/material/fluidsystems/1pliquid.hh            |  4 ++--
 dumux/material/fluidsystems/2p1c.hh                |  6 +++---
 dumux/material/fluidsystems/2pimmiscible.hh        | 10 +++++-----
 dumux/material/fluidsystems/3pimmiscible.hh        | 14 +++++++-------
 dumux/material/fluidsystems/brine.hh               |  6 +++---
 dumux/material/fluidsystems/brineair.hh            | 10 ----------
 dumux/material/fluidsystems/brineco2.hh            |  6 +++---
 dumux/material/fluidsystems/h2oair.hh              | 11 -----------
 dumux/material/fluidsystems/h2oairmesitylene.hh    | 11 -----------
 dumux/material/fluidsystems/h2oairxylene.hh        | 11 -----------
 dumux/material/fluidsystems/h2oheavyoil.hh         | 11 -----------
 dumux/material/fluidsystems/h2on2.hh               | 11 -----------
 dumux/material/fluidsystems/h2on2o2.hh             | 11 -----------
 dumux/material/fluidsystems/liquidphase2c.hh       |  6 +++---
 dumux/material/fluidsystems/spe5.hh                |  6 +++---
 dumux/porousmediumflow/2p2c/volumevariables.hh     |  2 +-
 test/material/fluidsystems/checkfluidsystem.hh     |  4 ++--
 .../mpnc/implicit/combustionfluidsystem.hh         |  6 +++---
 21 files changed, 44 insertions(+), 120 deletions(-)

diff --git a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh
index 7fb5c87731..b7128ad24d 100644
--- a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh
+++ b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh
@@ -85,10 +85,10 @@ public:
     {
         using FluidSystem = typename VolumeVariables::FluidSystem;
         static_assert(FluidSystem::numPhases == 2, "ThermalConductivitySomerton only works for two-phase fluid systems!");
-        static_assert(!FluidSystem::isLiquid(0) || !FluidSystem::isLiquid(1), "ThermalConductivitySomerton only works if one phase is gaseous and one is liquid!");
+        static_assert(FluidSystem::isGas(0) || FluidSystem::isGas(1), "ThermalConductivitySomerton only works if one phase is gaseous and one is liquid!");
 
-        constexpr int liquidPhaseIdx = FluidSystem::isLiquid(0) ? 0 : 1;
-        constexpr int gasPhaseIdx = FluidSystem::isLiquid(0) ? 1 : 0;
+        constexpr int liquidPhaseIdx = FluidSystem::isGas(0) ? 1 : 0;
+        constexpr int gasPhaseIdx = FluidSystem::isGas(0) ? 0 : 1;
 
         const Scalar satLiquid = volVars.saturation(liquidPhaseIdx);
         const Scalar lambdaLiquid = volVars.fluidThermalConductivity(liquidPhaseIdx);
diff --git a/dumux/material/fluidsystems/1padapter.hh b/dumux/material/fluidsystems/1padapter.hh
index b9e46cb9f3..80b213e1e9 100644
--- a/dumux/material/fluidsystems/1padapter.hh
+++ b/dumux/material/fluidsystems/1padapter.hh
@@ -136,10 +136,10 @@ public:
     { return false; }
 
     /*!
-     * \brief Returns whether the fluid is a liquid
+     * \brief Returns whether the fluid is gaseous
      */
-    static constexpr bool isLiquid(int phaseIdx = 0)
-    { return MultiPhaseFluidSystem::isLiquid(phase); }
+    static constexpr bool isGas(int phaseIdx = 0)
+    { return MultiPhaseFluidSystem::isGas(phase); }
 
     /*!
      * \brief Returns true if and only if a fluid phase is assumed to
diff --git a/dumux/material/fluidsystems/1pgas.hh b/dumux/material/fluidsystems/1pgas.hh
index 39086ca859..34ce4dd55f 100644
--- a/dumux/material/fluidsystems/1pgas.hh
+++ b/dumux/material/fluidsystems/1pgas.hh
@@ -96,10 +96,10 @@ public:
     { return false; }
 
     /*!
-     * \brief Returns whether the fluid is a liquid
+     * \brief Returns whether the fluid is gaseous
      */
-    static constexpr bool isLiquid(int phaseIdx = 0)
-    { return false; }
+    static constexpr bool isGas(int phaseIdx = 0)
+    { return true; }
 
     /*!
      * \brief Returns true if and only if a fluid phase is assumed to
diff --git a/dumux/material/fluidsystems/1pliquid.hh b/dumux/material/fluidsystems/1pliquid.hh
index e828093dc2..25f8f994ed 100644
--- a/dumux/material/fluidsystems/1pliquid.hh
+++ b/dumux/material/fluidsystems/1pliquid.hh
@@ -98,8 +98,8 @@ public:
     /*!
      * \brief Returns whether the fluid is a liquid
      */
-    static constexpr bool isLiquid(int phaseIdx = 0)
-    { return true; }
+    static constexpr bool isGas(int phaseIdx = 0)
+    { return false; }
 
     /*!
      * \brief Returns true if and only if a fluid phase is assumed to
diff --git a/dumux/material/fluidsystems/2p1c.hh b/dumux/material/fluidsystems/2p1c.hh
index 06f369f5d3..66d9a3ebc1 100644
--- a/dumux/material/fluidsystems/2p1c.hh
+++ b/dumux/material/fluidsystems/2p1c.hh
@@ -83,14 +83,14 @@ public:
     { return false; }
 
     /*!
-     * \brief Return whether a phase is liquid
+     * \brief Return whether a phase is gaseous
      *
      * \param phaseIdx The index of the fluid phase to consider
      */
-    static constexpr bool isLiquid(int phaseIdx)
+    static constexpr bool isGas(int phaseIdx)
     {
         assert(0 <= phaseIdx && phaseIdx < numPhases);
-        return phaseIdx == liquidPhaseIdx;
+        return phaseIdx == gasPhaseIdx;
     }
 
     /*!
diff --git a/dumux/material/fluidsystems/2pimmiscible.hh b/dumux/material/fluidsystems/2pimmiscible.hh
index e65823f8d8..4851aa99c1 100644
--- a/dumux/material/fluidsystems/2pimmiscible.hh
+++ b/dumux/material/fluidsystems/2pimmiscible.hh
@@ -60,7 +60,7 @@ class TwoPImmiscible
     static_assert((Fluid0::numComponents == 1), "Fluid0 has more than one component");
     static_assert((Fluid1::numComponents == 1), "Fluid1 has more than one component");
     // two gaseous phases at once do not make sense physically! (but two liquids are fine)
-    static_assert(Fluid0::isLiquid() || Fluid1::isLiquid(), "One phase has to be a liquid!");
+    static_assert(!Fluid0::isGas() || !Fluid1::isGas(), "One phase has to be a liquid!");
 
     using ThisType = TwoPImmiscible<Scalar, Fluid0, Fluid1>;
     using Base = BaseFluidSystem<Scalar, ThisType>;
@@ -98,16 +98,16 @@ public:
     { return false; }
 
     /*!
-     * \brief Return whether a phase is liquid
+     * \brief Return whether a phase is gaseous
      * \param phaseIdx The index of the fluid phase to consider
      */
-    static constexpr bool isLiquid(int phaseIdx)
+    static constexpr bool isGas(int phaseIdx)
     {
         assert(0 <= phaseIdx && phaseIdx < numPhases);
 
         if (phaseIdx == phase0Idx)
-            return Fluid0::isLiquid();
-        return Fluid1::isLiquid();
+            return Fluid0::isGas();
+        return Fluid1::isGas();
     }
 
     /*!
diff --git a/dumux/material/fluidsystems/3pimmiscible.hh b/dumux/material/fluidsystems/3pimmiscible.hh
index 4cb1e876db..3d0fc2c71f 100644
--- a/dumux/material/fluidsystems/3pimmiscible.hh
+++ b/dumux/material/fluidsystems/3pimmiscible.hh
@@ -105,18 +105,18 @@ public:
     { return false; }
 
     /*!
-     * \brief Return whether a phase is liquid
+     * \brief Return whether a phase is gaseous
      * \param phaseIdx The index of the fluid phase to consider
      */
-    static constexpr bool isLiquid(int phaseIdx)
+    static constexpr bool isGas(int phaseIdx)
     {
         assert(0 <= phaseIdx && phaseIdx < numPhases);
 
         switch (phaseIdx)
         {
-            case wPhaseIdx: return WettingFluid::isLiquid(); break;
-            case nPhaseIdx: return NonwettingFluid::isLiquid(); break;
-            case gPhaseIdx: return Gas::isLiquid(); break;
+            case wPhaseIdx: return WettingFluid::isGas(); break;
+            case nPhaseIdx: return NonwettingFluid::isGas(); break;
+            case gPhaseIdx: return Gas::isGas(); break;
         }
     }
 
@@ -288,7 +288,7 @@ public:
     {
         // two gaseous phases at once do not make sense physically!
         // (But two liquids are fine)
-        static_assert(WettingFluid::isLiquid() && NonwettingFluid::isLiquid() && !Gas::isLiquid(), "There can only be one gaseous phase!");
+        static_assert(!WettingFluid::isGas() && !NonwettingFluid::isGas() && Gas::isGas(), "There can only be one gaseous phase!");
     }
 
     /*!
@@ -306,7 +306,7 @@ public:
                      Scalar pressMin, Scalar pressMax, unsigned nPress)
     {
         // two gaseous phases at once do not make sense physically!
-        static_assert(WettingFluid::isLiquid() && NonwettingFluid::isLiquid() && !Gas::isLiquid(), "There can only be one gaseous phase!");
+        static_assert(!WettingFluid::isGas() && !NonwettingFluid::isGas() && Gas::isGas(), "There can only be one gaseous phase!");
 
         if (WettingFluid::Component::isTabulated)
         {
diff --git a/dumux/material/fluidsystems/brine.hh b/dumux/material/fluidsystems/brine.hh
index 2ac1d7ae96..29497d6399 100644
--- a/dumux/material/fluidsystems/brine.hh
+++ b/dumux/material/fluidsystems/brine.hh
@@ -82,13 +82,13 @@ public:
     }
 
     /*!
-     * \brief Return whether a phase is liquid
+     * \brief Return whether a phase is gaseous
      * \param phaseIdx The index of the fluid phase to consider
      */
-    static constexpr bool isLiquid(int phaseIdx = liquidPhaseIdx)
+    static constexpr bool isGas(int phaseIdx = liquidPhaseIdx)
     {
         assert(phaseIdx == liquidPhaseIdx);
-        return true;
+        return false;
     }
 
     /*!
diff --git a/dumux/material/fluidsystems/brineair.hh b/dumux/material/fluidsystems/brineair.hh
index 640df7d37b..e6a8ed9de1 100644
--- a/dumux/material/fluidsystems/brineair.hh
+++ b/dumux/material/fluidsystems/brineair.hh
@@ -161,16 +161,6 @@ public:
     static constexpr bool isMiscible()
     { return true; }
 
-    /*!
-     * \brief Return whether a phase is liquid
-     * \param phaseIdx The index of the fluid phase to consider
-     */
-    static bool isLiquid(int phaseIdx)
-    {
-        assert(0 <= phaseIdx && phaseIdx < numPhases);
-        return phaseIdx != gasPhaseIdx;
-    }
-
     /*!
      * \brief Return whether a phase is gaseous
      * \param phaseIdx The index of the fluid phase to consider
diff --git a/dumux/material/fluidsystems/brineco2.hh b/dumux/material/fluidsystems/brineco2.hh
index 1bed0e4cef..708837a0e3 100644
--- a/dumux/material/fluidsystems/brineco2.hh
+++ b/dumux/material/fluidsystems/brineco2.hh
@@ -103,15 +103,15 @@ public:
     { return true; }
 
     /*!
-     * \brief Return whether a phase is liquid
+     * \brief Return whether a phase is gaseous
      *
      * \param phaseIdx The index of the fluid phase to consider
      */
-    static constexpr bool isLiquid(int phaseIdx)
+    static constexpr bool isGas(int phaseIdx)
     {
         assert(0 <= phaseIdx && phaseIdx < numPhases);
 
-        return phaseIdx != gasPhaseIdx;
+        return phaseIdx == gasPhaseIdx;
     }
 
     /*!
diff --git a/dumux/material/fluidsystems/h2oair.hh b/dumux/material/fluidsystems/h2oair.hh
index 1adae56100..d88edd7b00 100644
--- a/dumux/material/fluidsystems/h2oair.hh
+++ b/dumux/material/fluidsystems/h2oair.hh
@@ -115,17 +115,6 @@ public:
     static constexpr bool isMiscible()
     { return true; }
 
-    /*!
-     * \brief Return whether a phase is liquid
-     *
-     * \param phaseIdx The index of the fluid phase to consider
-     */
-    static constexpr bool isLiquid(int phaseIdx)
-    {
-        assert(0 <= phaseIdx && phaseIdx < numPhases);
-        return phaseIdx != gasPhaseIdx;
-    }
-
     /*!
      * \brief Return whether a phase is gaseous
      *
diff --git a/dumux/material/fluidsystems/h2oairmesitylene.hh b/dumux/material/fluidsystems/h2oairmesitylene.hh
index e725bc6fe9..555b4a972c 100644
--- a/dumux/material/fluidsystems/h2oairmesitylene.hh
+++ b/dumux/material/fluidsystems/h2oairmesitylene.hh
@@ -123,17 +123,6 @@ public:
     static constexpr bool isMiscible()
     { return true; }
 
-    /*!
-     * \brief Return whether a phase is liquid
-     *
-     * \param phaseIdx The index of the fluid phase to consider
-     */
-    static bool isLiquid(int phaseIdx)
-    {
-        assert(0 <= phaseIdx && phaseIdx < numPhases);
-        return phaseIdx != gPhaseIdx;
-    }
-
     /*!
      * \brief Return whether a phase is gaseous
      *
diff --git a/dumux/material/fluidsystems/h2oairxylene.hh b/dumux/material/fluidsystems/h2oairxylene.hh
index bd48994c5f..ffd95a0767 100644
--- a/dumux/material/fluidsystems/h2oairxylene.hh
+++ b/dumux/material/fluidsystems/h2oairxylene.hh
@@ -123,17 +123,6 @@ public:
     static constexpr bool isMiscible()
     { return true; }
 
-    /*!
-     * \brief Return whether a phase is liquid
-     *
-     * \param phaseIdx The index of the fluid phase to consider
-     */
-    static bool isLiquid(int phaseIdx)
-    {
-        assert(0 <= phaseIdx && phaseIdx < numPhases);
-        return phaseIdx != gPhaseIdx;
-    }
-
     /*!
      * \brief Return whether a phase is gaseous
      *
diff --git a/dumux/material/fluidsystems/h2oheavyoil.hh b/dumux/material/fluidsystems/h2oheavyoil.hh
index 4b697d02f8..43520fc492 100644
--- a/dumux/material/fluidsystems/h2oheavyoil.hh
+++ b/dumux/material/fluidsystems/h2oheavyoil.hh
@@ -113,17 +113,6 @@ public:
     static constexpr bool isMiscible()
     { return true; }
 
-    /*!
-     * \brief Return whether a phase is liquid
-     *
-     * \param phaseIdx The index of the fluid phase to consider
-     */
-    static bool isLiquid(int phaseIdx)
-    {
-        assert(0 <= phaseIdx && phaseIdx < numPhases);
-        return phaseIdx != gPhaseIdx;
-    }
-
     /*!
      * \brief Return whether a phase is gaseous
      *
diff --git a/dumux/material/fluidsystems/h2on2.hh b/dumux/material/fluidsystems/h2on2.hh
index 7322dd7915..ca2a1310d0 100644
--- a/dumux/material/fluidsystems/h2on2.hh
+++ b/dumux/material/fluidsystems/h2on2.hh
@@ -113,17 +113,6 @@ public:
     static constexpr bool isMiscible()
     { return true; }
 
-    /*!
-     * \brief Return whether a phase is liquid
-     *
-     * \param phaseIdx The index of the fluid phase to consider
-     */
-    static constexpr bool isLiquid(int phaseIdx)
-    {
-        assert(0 <= phaseIdx && phaseIdx < numPhases);
-        return phaseIdx != gasPhaseIdx;
-    }
-
     /*!
      * \brief Return whether a phase is gaseous
      *
diff --git a/dumux/material/fluidsystems/h2on2o2.hh b/dumux/material/fluidsystems/h2on2o2.hh
index f0a8582dad..6156b7b182 100644
--- a/dumux/material/fluidsystems/h2on2o2.hh
+++ b/dumux/material/fluidsystems/h2on2o2.hh
@@ -130,17 +130,6 @@ public:
         return name[phaseIdx];
     }
 
-    /*!
-     * \brief Return whether a phase is liquid
-     *
-     * \param phaseIdx The index of the fluid phase to consider
-     */
-    static bool isLiquid(int phaseIdx)
-    {
-        assert(0 <= phaseIdx && phaseIdx < numPhases);
-        return phaseIdx != gasPhaseIdx;
-    }
-
     /*!
      * \brief Return whether a phase is gaseous
      *
diff --git a/dumux/material/fluidsystems/liquidphase2c.hh b/dumux/material/fluidsystems/liquidphase2c.hh
index 6e3065e7df..334d20eabf 100644
--- a/dumux/material/fluidsystems/liquidphase2c.hh
+++ b/dumux/material/fluidsystems/liquidphase2c.hh
@@ -99,10 +99,10 @@ public:
     { return "LiquidPhaseTwoC"; }
 
     /*!
-     * \brief Returns whether the fluid is a liquid
+     * \brief Returns whether the fluid is gaseous
      */
-    static bool isLiquid(int phaseIdx = 0)
-    { return true; }
+    static constexpr bool isGas(int phaseIdx = 0)
+    { return false; }
 
     /*!
      * \brief Returns true if and only if a fluid phase is assumed to
diff --git a/dumux/material/fluidsystems/spe5.hh b/dumux/material/fluidsystems/spe5.hh
index 09d4f7ae46..bfdbef98bd 100644
--- a/dumux/material/fluidsystems/spe5.hh
+++ b/dumux/material/fluidsystems/spe5.hh
@@ -103,13 +103,13 @@ public:
     { return true; }
 
     /*!
-     * \brief Return whether a phase is liquid
+     * \brief Return whether a phase is gaseous
      * \param phaseIdx The index of the fluid phase to consider
      */
-    static bool isLiquid(int phaseIdx)
+    static constexpr bool isGas(int phaseIdx)
     {
         assert(0 <= phaseIdx && phaseIdx < numPhases);
-        return phaseIdx != gPhaseIdx;
+        return phaseIdx == gPhaseIdx;
     }
 
     /*!
diff --git a/dumux/porousmediumflow/2p2c/volumevariables.hh b/dumux/porousmediumflow/2p2c/volumevariables.hh
index 56e169ab67..05c0d41e63 100644
--- a/dumux/porousmediumflow/2p2c/volumevariables.hh
+++ b/dumux/porousmediumflow/2p2c/volumevariables.hh
@@ -110,7 +110,7 @@ public:
 
     // The computations in the explicit composition update most probably assume a liquid-gas interface with
     // liquid as first phase. TODO: is this really needed? The constraint solver does the job anyway, doesn't it?
-    static_assert(useConstraintSolver || (FluidSystem::isLiquid(phase0Idx) && !FluidSystem::isLiquid(phase1Idx)),
+    static_assert(useConstraintSolver || (!FluidSystem::isGas(phase0Idx) && FluidSystem::isGas(phase1Idx)),
                    "Explicit composition calculation has to be re-checked for NON-liquid-gas equilibria");
 
     /*!
diff --git a/test/material/fluidsystems/checkfluidsystem.hh b/test/material/fluidsystems/checkfluidsystem.hh
index 4643fa5a2e..857ed16982 100644
--- a/test/material/fluidsystems/checkfluidsystem.hh
+++ b/test/material/fluidsystems/checkfluidsystem.hh
@@ -623,13 +623,13 @@ int checkFluidSystem()
         }
     }
 
-    // test for phaseName(), isLiquid() and isIdealGas()
+    // test for phaseName(), isGas() and isIdealGas()
     for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
     {
         std::string
         DUNE_UNUSED name = FluidSystem::phaseName(phaseIdx);
         bool DUNE_UNUSED
-        bVal = FluidSystem::isLiquid(phaseIdx);
+        bVal = FluidSystem::isGas(phaseIdx);
         bVal = FluidSystem::isIdealGas(phaseIdx);
     }
 
diff --git a/test/porousmediumflow/mpnc/implicit/combustionfluidsystem.hh b/test/porousmediumflow/mpnc/implicit/combustionfluidsystem.hh
index dbb01a8c16..064582ab54 100644
--- a/test/porousmediumflow/mpnc/implicit/combustionfluidsystem.hh
+++ b/test/porousmediumflow/mpnc/implicit/combustionfluidsystem.hh
@@ -97,14 +97,14 @@ public:
     }
 
     /*!
-     * \brief Return whether a phase is liquid
+     * \brief Return whether a phase is gaseous
      *
      * \param phaseIdx The index of the fluid phase to consider
      */
-    static bool isLiquid(int phaseIdx)
+    static constexpr bool isGas(int phaseIdx)
     {
         assert(0 <= phaseIdx && phaseIdx < numPhases);
-        return phaseIdx != nPhaseIdx;
+        return phaseIdx == nPhaseIdx;
     }
 
     /*!
-- 
GitLab