From 3e7ac93a81e2897f7e6da0aa4158f97b9f2d0be7 Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Mon, 30 Mar 2020 13:42:09 +0200
Subject: [PATCH] [fluidstates] Add wettingPhase in immiscible fluid states

---
 dumux/material/fluidstates/compositional.hh        |  6 ++----
 dumux/material/fluidstates/immiscible.hh           | 14 ++++++++++++++
 dumux/material/fluidstates/isothermalimmiscible.hh | 14 ++++++++++++++
 3 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/dumux/material/fluidstates/compositional.hh b/dumux/material/fluidstates/compositional.hh
index 91bf96b5c7..5cb672441e 100644
--- a/dumux/material/fluidstates/compositional.hh
+++ b/dumux/material/fluidstates/compositional.hh
@@ -71,7 +71,7 @@ public:
      * on thermodynamic equilibrium required)
      *****************************************************/
     /*!
-     * \brief Returns the index of the wetting phase in the
+     * \brief Returns the index of the most wetting phase in the
      *        fluid-solid configuration (for porous medium systems).
      */
     int wettingPhase() const { return wPhaseIdx_; }
@@ -441,7 +441,7 @@ public:
     { viscosity_[phaseIdx] = value; }
 
     /*!
-     * \brief Set the index of the wetting phase
+     * \brief Set the index of the most wetting phase
      */
     void setWettingPhase(int phaseIdx)
     { wPhaseIdx_ = phaseIdx; }
@@ -460,8 +460,6 @@ protected:
     std::array<Scalar, numPhases> viscosity_ = {};
     std::array<Scalar, numPhases> temperature_ = {};
 
-    // For porous medium flow models, here we ... the index of the wetting
-    // phase (needed for vapor pressure evaluation if kelvin equation is used)
     int wPhaseIdx_{0};
 };
 
diff --git a/dumux/material/fluidstates/immiscible.hh b/dumux/material/fluidstates/immiscible.hh
index c84cb2ea6d..451b054ef0 100644
--- a/dumux/material/fluidstates/immiscible.hh
+++ b/dumux/material/fluidstates/immiscible.hh
@@ -66,6 +66,12 @@ public:
      * on thermodynamic equilibrium required)
      *****************************************************/
 
+    /*!
+     * \brief Returns the index of the most wetting phase in the
+     *        fluid-solid configuration (for porous medium systems).
+     */
+    int wettingPhase() const { return wPhaseIdx_; }
+
     /*!
      * \brief Returns the saturation \f$S_\alpha\f$ of a fluid phase \f$\alpha\f$ in \f$\mathrm{[-]}\f$.
      *
@@ -333,6 +339,12 @@ public:
      */
     void setViscosity(int phaseIdx, Scalar value)
     { viscosity_[phaseIdx] = value; }
+
+    /*!
+     * \brief Set the index of the most wetting phase
+     */
+    void setWettingPhase(int phaseIdx)
+    { wPhaseIdx_ = phaseIdx; }
 protected:
     //! zero-initialize all data members with braces syntax
     Scalar pressure_[numPhases] = {};
@@ -342,6 +354,8 @@ protected:
     Scalar enthalpy_[numPhases] = {};
     Scalar viscosity_[numPhases] = {};
     Scalar temperature_[numPhases] = {};
+
+    int wPhaseIdx_{0};
 };
 
 } // end namespace Dumux
diff --git a/dumux/material/fluidstates/isothermalimmiscible.hh b/dumux/material/fluidstates/isothermalimmiscible.hh
index bfa2425b57..88e7feaec8 100644
--- a/dumux/material/fluidstates/isothermalimmiscible.hh
+++ b/dumux/material/fluidstates/isothermalimmiscible.hh
@@ -64,6 +64,13 @@ public:
     /*****************************************************
      * Generic access to fluid properties
      *****************************************************/
+
+    /*!
+     * \brief Returns the index of the most wetting phase in the
+     *        fluid-solid configuration (for porous medium systems).
+     */
+    int wettingPhase() const { return wPhaseIdx_; }
+
     /*!
      * \brief Returns the saturation \f$S_\alpha\f$ of a fluid phase \f$\alpha\f$ in \f$\mathrm{[-]}\f$.
      *
@@ -276,6 +283,11 @@ public:
     void setViscosity(int phaseIdx, Scalar value)
     { viscosity_[phaseIdx] = value; }
 
+    /*!
+     * \brief Set the index of the most wetting phase
+     */
+    void setWettingPhase(int phaseIdx)
+    { wPhaseIdx_ = phaseIdx; }
 protected:
     Scalar pressure_[numPhases] = {};
     Scalar saturation_[numPhases] = {};
@@ -283,6 +295,8 @@ protected:
     Scalar molarDensity_[numPhases] = {};
     Scalar viscosity_[numPhases] = {};
     Scalar temperature_ = 0.0;
+
+    int wPhaseIdx_{0};
 };
 
 } // end namespace Dumux
-- 
GitLab