From 29f9f790216002b3722dd7ad98b958da2dfbee00 Mon Sep 17 00:00:00 2001
From: Ned Coltman <edward.coltman@iws.uni-stuttgart.de>
Date: Wed, 25 Mar 2020 15:58:20 +0100
Subject: [PATCH] [fluidmatrixinterations] clean up simple fluid lumping law

---
 .../thermalconductivitysimplefluidlumping.hh  | 37 +++++--------------
 dumux/porousmediumflow/2p2c/model.hh          | 14 +++----
 dumux/porousmediumflow/mpnc/model.hh          | 16 ++------
 3 files changed, 17 insertions(+), 50 deletions(-)

diff --git a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh
index e71d0839ca..b24dbc2a9e 100644
--- a/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh
+++ b/dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh
@@ -32,19 +32,16 @@ namespace Dumux {
 /*!
  * \ingroup Fluidmatrixinteractions
  * \brief   Relation for the saturation-dependent effective thermal conductivity
- * \todo This shouldn't depend on TypeTag!!
  */
-template<class Scalar, int numEnergyEquationsFluid>
+template<class Scalar>
 class ThermalConductivitySimpleFluidLumping
 {
-
 public:
     /*!
      * \brief Effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$
      *
      * \param volVars volume variables
      * \return effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$
-     * \todo TODO: Fix this law for changing wettability
      */
     template<class VolumeVariables>
     static Scalar effectiveThermalConductivity(const VolumeVariables& volVars)
@@ -56,9 +53,10 @@ public:
         const Scalar lambdaSolid = volVars.solidThermalConductivity();
         const Scalar porosity = volVars.porosity();
 
-        return effectiveThermalConductivity(sw, lambdaW, lambdaN, lambdaSolid, porosity);
+        return effectiveThermalConductivity_(sw, lambdaW, lambdaN, lambdaSolid, porosity);
     }
 
+private:
     /*!
      * \brief Returns the effective thermal conductivity \f$\mathrm{[W/(m K)]}\f$.
      *
@@ -67,36 +65,19 @@ public:
      * \param lambdaN The thermal conductivity of the non-wetting phase in \f$\mathrm{[W/(m K)]}\f$
      * \param lambdaSolid The thermal conductivity of the solid phase in \f$\mathrm{[W/(m K)]}\f$
      * \param porosity The porosity
-     * \param rhoSolid The density of the solid phase in \f$\mathrm{[kg/m^3]}\f$
      *
      * \return Effective thermal conductivity of the fluid phases
      */
-    static Scalar effectiveThermalConductivity(const Scalar sw,
-                                               const Scalar lambdaW,
-                                               const Scalar lambdaN,
-                                               const Scalar lambdaSolid,
-                                               const Scalar porosity,
-                                               const Scalar rhoSolid = 0.0 /*unused*/)
+    static Scalar effectiveThermalConductivity_(const Scalar sw,
+                                                const Scalar lambdaW,
+                                                const Scalar lambdaN,
+                                                const Scalar lambdaSolid,
+                                                const Scalar porosity)
     {
-        assert(numEnergyEquationsFluid != 2) ;
-
         // Franz Lindner / Shi & Wang 2011
         using std::max;
         const Scalar satW = max<Scalar>(0.0, sw);
-
-        const Scalar kfeff = porosity *((1.-satW)*lambdaN + satW*lambdaW) ; // arithmetic
-
-        Scalar keff ;
-
-        if (numEnergyEquationsFluid == 1){ // solid dealed with individually (extra balance equation)
-            keff = kfeff ;
-        }
-        else {
-            const Scalar kseff = (1.0-porosity)  * lambdaSolid ;
-            keff = kfeff  + kseff;
-        }
-
-        return keff ;
+        return porosity * ( (1. - satW) * lambdaN + satW * lambdaW ) + (1.0 - porosity) * lambdaSolid ; ; // arithmetic
     }
 };
 } // end namespace Dumux
diff --git a/dumux/porousmediumflow/2p2c/model.hh b/dumux/porousmediumflow/2p2c/model.hh
index 54b9574b0f..e3adc42815 100644
--- a/dumux/porousmediumflow/2p2c/model.hh
+++ b/dumux/porousmediumflow/2p2c/model.hh
@@ -92,7 +92,6 @@
 #include <dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh>
 #include <dumux/material/fluidmatrixinteractions/2p/thermalconductivitysimplefluidlumping.hh>
 
-
 #include "volumevariables.hh"
 
 namespace Dumux {
@@ -281,15 +280,11 @@ public:
     using type = TwoPTwoCUnconstrainedModelTraits<EquilibriumTraits>;
 };
 
-//! In case we do not assume full thermal non-equilibrium (e.g. only an energy balance for the solid phase and a fluid mixture) one needs a law for calculating the thermal conductivity of the fluid mixture
+//! In case we do not assume full thermal non-equilibrium (e.g. only an energy balance for the solid phase and a fluid mixture)
+//! one needs a law for calculating the thermal conductivity of the fluid mixture
 template<class TypeTag>
 struct ThermalConductivityModel<TypeTag, TTag::TwoPTwoCNonEquil>
-{
-private:
-    using Scalar = GetPropType<TypeTag, Properties::Scalar>;
-public:
-    using type = ThermalConductivitySimpleFluidLumping<Scalar, getPropValue<TypeTag, Properties::NumEnergyEqFluid>()>;
-};
+{ using type = ThermalConductivitySimpleFluidLumping<GetPropType<TypeTag, Properties::Scalar>>; };
 
 //! Use the nonequilibrium volume variables together with the 2p2c vol vars
 template<class TypeTag>
@@ -398,7 +393,8 @@ public:
 
 //! Somerton is used as default model to compute the effective thermal heat conductivity
 template<class TypeTag>
-struct ThermalConductivityModel<TypeTag, TTag::TwoPTwoCNINonEquil> { using type = ThermalConductivitySomerton<GetPropType<TypeTag, Properties::Scalar>>; };
+struct ThermalConductivityModel<TypeTag, TTag::TwoPTwoCNINonEquil>
+{ using type = ThermalConductivitySomerton<GetPropType<TypeTag, Properties::Scalar>>; };
 
 } // end namespace Properties
 } // end namespace Dumux
diff --git a/dumux/porousmediumflow/mpnc/model.hh b/dumux/porousmediumflow/mpnc/model.hh
index e95bcc83f9..4d2ed7d63e 100644
--- a/dumux/porousmediumflow/mpnc/model.hh
+++ b/dumux/porousmediumflow/mpnc/model.hh
@@ -328,7 +328,7 @@ private:
     using EDM = GetPropType<TypeTag, Properties::EffectiveDiffusivityModel>;
     using BaseTraits = MPNCVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, DT, EDM>;
 
-    using ETCM = GetPropType< TypeTag, Properties:: ThermalConductivityModel>;
+    using ETCM = GetPropType< TypeTag, Properties::ThermalConductivityModel>;
     template<class BaseTraits, class ETCM>
     struct NITraits : public BaseTraits { using EffectiveThermalConductivityModel = ETCM; };
 public:
@@ -338,12 +338,7 @@ public:
 //! Somerton is used as default model to compute the effective thermal heat conductivity
 template<class TypeTag>
 struct ThermalConductivityModel<TypeTag, TTag::MPNCNI>
-{
-private:
-    using Scalar = GetPropType<TypeTag, Properties::Scalar>;
-public:
-    using type = ThermalConductivitySomerton<Scalar>;
-};
+{ using type = ThermalConductivitySomerton<GetPropType<TypeTag, Properties::Scalar>>; };
 
 /////////////////////////////////////////////////
 // Properties for the non-equilibrium mpnc model
@@ -392,12 +387,7 @@ public:
 //! in case we do not assume full non-equilibrium one needs a thermal conductivity
 template<class TypeTag>
 struct ThermalConductivityModel<TypeTag, TTag::MPNCNonequil>
-{
-private:
-    using Scalar = GetPropType<TypeTag, Properties::Scalar>;
-public:
-    using type = ThermalConductivitySimpleFluidLumping<Scalar, getPropValue<TypeTag, Properties::NumEnergyEqFluid>()>;
-};
+{ using type = ThermalConductivitySimpleFluidLumping<GetPropType<TypeTag, Properties::Scalar>>; };
 
 //! use the mineralization volume variables together with the 2pnc vol vars
 template<class TypeTag>
-- 
GitLab