From 4cadea65370bbbdfeccb86a073bc4c6218f01249 Mon Sep 17 00:00:00 2001
From: Bernd Flemisch <bernd@iws.uni-stuttgart.de>
Date: Thu, 5 Sep 2019 11:38:24 +0200
Subject: [PATCH] [material][fluidsystems] specialize getMainComponent for
 H2OHeavyOil

The base-class default simply returns the phase index. Specialize and
return a valid component index also for the gas phase.
---
 dumux/material/fluidsystems/h2oheavyoil.hh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/dumux/material/fluidsystems/h2oheavyoil.hh b/dumux/material/fluidsystems/h2oheavyoil.hh
index a907ca2088..0990acac34 100644
--- a/dumux/material/fluidsystems/h2oheavyoil.hh
+++ b/dumux/material/fluidsystems/h2oheavyoil.hh
@@ -109,6 +109,22 @@ public:
         }
     }
 
+    /*!
+     * \brief Get the main component of a given phase
+     * \param phaseIdx The index of the fluid phase to consider
+     */
+    static constexpr int getMainComponent(int phaseIdx)
+    {
+        // For the gas phase, choosing a main component appears to be
+        // rather arbitrary. Motivated by the fact that the thermal conductivity
+        // of the gas phase is set to the thermal conductivity of pure water,
+        // water is chosen for now.
+        if (phaseIdx == nPhaseIdx)
+            return nCompIdx;
+        else
+            return wCompIdx;
+    }
+
     /*!
      * \brief Returns whether the fluids are miscible
      */
-- 
GitLab