From b4a2ed5938c63528a6d453827c7fe0b4dc386a1a Mon Sep 17 00:00:00 2001
From: Katharina Heck <katharina.heck@iws.uni-stuttgart.de>
Date: Fri, 4 May 2018 13:20:48 +0200
Subject: [PATCH] [cleanup] use temperatureFluid to make it more obvious which
 temperature is meant for thermal nonequilibrium

---
 .../discretization/box/fourierslawnonequilibrium.hh  |  2 +-
 dumux/porousmediumflow/mpnc/volumevariables.hh       |  7 +------
 .../porousmediumflow/nonequilibrium/localresidual.hh |  2 +-
 .../nonequilibrium/thermal/localresidual.hh          |  6 +++---
 .../nonequilibrium/volumevariables.hh                | 12 ++++++------
 .../nonequilibrium/vtkoutputfields.hh                |  2 +-
 .../nonisothermal/volumevariables.hh                 |  9 +++++++++
 7 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/dumux/discretization/box/fourierslawnonequilibrium.hh b/dumux/discretization/box/fourierslawnonequilibrium.hh
index 3f113527be..6741fe57c2 100644
--- a/dumux/discretization/box/fourierslawnonequilibrium.hh
+++ b/dumux/discretization/box/fourierslawnonequilibrium.hh
@@ -121,7 +121,7 @@ public:
         {
             // compute the temperature gradient with the shape functions
             if (phaseIdx < numEnergyEqFluid)
-                gradTemp.axpy(elemVolVars[scv].temperature(phaseIdx), fluxVarsCache.gradN(scv.indexInElement()));
+                gradTemp.axpy(elemVolVars[scv].temperatureFluid(phaseIdx), fluxVarsCache.gradN(scv.indexInElement()));
             else
                gradTemp.axpy(elemVolVars[scv].temperatureSolid(), fluxVarsCache.gradN(scv.indexInElement()));
         }
diff --git a/dumux/porousmediumflow/mpnc/volumevariables.hh b/dumux/porousmediumflow/mpnc/volumevariables.hh
index 7859a5c76e..af27b0712a 100644
--- a/dumux/porousmediumflow/mpnc/volumevariables.hh
+++ b/dumux/porousmediumflow/mpnc/volumevariables.hh
@@ -852,12 +852,7 @@ public:
      * identical.
      */
     Scalar temperature() const
-    {
-        return fluidState_.temperature(0/* phaseIdx*/);
-    }
-
-    Scalar temperature(const int phaseIdx) const
-    { return fluidState_.temperature(phaseIdx); }
+    { return fluidState_.temperature(0/* phaseIdx*/); }
 
     /*!
      * \brief Return enthalpy \f$\mathrm{[kg/m^3]}\f$ the of the fluid phase.
diff --git a/dumux/porousmediumflow/nonequilibrium/localresidual.hh b/dumux/porousmediumflow/nonequilibrium/localresidual.hh
index bca6937aa1..cedc6c02a2 100644
--- a/dumux/porousmediumflow/nonequilibrium/localresidual.hh
+++ b/dumux/porousmediumflow/nonequilibrium/localresidual.hh
@@ -296,7 +296,7 @@ public:
         Valgrind::CheckDefined(mu_nPhaseWComp);
 
         const Scalar characteristicLength   = volVars.characteristicLength()  ;
-        const Scalar temperature            = volVars.temperature(phase0Idx);
+        const Scalar temperature            = volVars.temperatureFluid(phase0Idx);
         const Scalar pn                     = volVars.pressure(phase1Idx);
         const Scalar henry                  = FluidSystem::henry(temperature) ;
         const Scalar gradNinWApprox  = ( mu_wPhaseNComp - mu_nPhaseNCompEquil) / characteristicLength;    // very 2p2c // 1. / henry *
diff --git a/dumux/porousmediumflow/nonequilibrium/thermal/localresidual.hh b/dumux/porousmediumflow/nonequilibrium/thermal/localresidual.hh
index 06820f4deb..71de498dc6 100644
--- a/dumux/porousmediumflow/nonequilibrium/thermal/localresidual.hh
+++ b/dumux/porousmediumflow/nonequilibrium/thermal/localresidual.hh
@@ -174,7 +174,7 @@ public:
         const Scalar as = 6.0 * (1.0-volVars.porosity()) / characteristicLength ;
 
         //temperature fluid is the same for both fluids
-        const Scalar TFluid     = volVars.temperature(0);
+        const Scalar TFluid     = volVars.temperatureFluid(0);
         const Scalar TSolid     = volVars.temperatureSolid();
 
         const Scalar satW       = fs.saturation(phase0Idx) ;
@@ -424,8 +424,8 @@ public:
         const Scalar aws = volVars.interfacialArea(phase0Idx, sPhaseIdx);
         const Scalar ans = volVars.interfacialArea(phase1Idx, sPhaseIdx);
 
-        const Scalar Tw = volVars.temperature(phase0Idx);
-        const Scalar Tn = volVars.temperature(phase1Idx);
+        const Scalar Tw = volVars.temperatureFluid(phase0Idx);
+        const Scalar Tn = volVars.temperatureFluid(phase1Idx);
         const Scalar Ts = volVars.temperatureSolid();
 
         const  Scalar lambdaWetting     = volVars.fluidThermalConductivity(phase0Idx);
diff --git a/dumux/porousmediumflow/nonequilibrium/volumevariables.hh b/dumux/porousmediumflow/nonequilibrium/volumevariables.hh
index aeb2ea2942..f72e8317a9 100644
--- a/dumux/porousmediumflow/nonequilibrium/volumevariables.hh
+++ b/dumux/porousmediumflow/nonequilibrium/volumevariables.hh
@@ -94,8 +94,8 @@ public:
         ParentType::update(elemSol, problem, element, scv);
 
         ParameterCache paramCache;
-        paramCache.updateAll(this->fluidState_);
-        updateInterfacialArea(elemSol, this->fluidState_, paramCache, problem, element, scv);
+        paramCache.updateAll(this->fluidState());
+        updateInterfacialArea(elemSol, this->fluidState(), paramCache, problem, element, scv);
     }
 
     /*!
@@ -213,8 +213,8 @@ public:
         ParentType::update(elemSol, problem, element, scv);
 
         ParameterCache paramCache;
-        paramCache.updateAll(this->fluidState_);
-        updateInterfacialArea(elemSol, this->fluidState_, paramCache, problem, element, scv);
+        paramCache.updateAll(this->fluidState());
+        updateInterfacialArea(elemSol, this->fluidState(), paramCache, problem, element, scv);
     }
 
     /*!
@@ -354,8 +354,8 @@ public:
         ParentType::update(elemSol, problem, element, scv);
 
         ParameterCache paramCache;
-        paramCache.updateAll(this->fluidState_);
-        updateInterfacialArea(elemSol, this->fluidState_, paramCache, problem, element, scv);
+        paramCache.updateAll(this->fluidState());
+        updateInterfacialArea(elemSol, this->fluidState(), paramCache, problem, element, scv);
     }
 
     /*!
diff --git a/dumux/porousmediumflow/nonequilibrium/vtkoutputfields.hh b/dumux/porousmediumflow/nonequilibrium/vtkoutputfields.hh
index 63384a4854..0b67945792 100644
--- a/dumux/porousmediumflow/nonequilibrium/vtkoutputfields.hh
+++ b/dumux/porousmediumflow/nonequilibrium/vtkoutputfields.hh
@@ -41,7 +41,7 @@ public:
 
         EquilibriumVtkOutputFields::init(vtk);
         for (int i = 0; i < ModelTraits::numEnergyEqFluid(); ++i)
-            vtk.addVolumeVariable( [i](const auto& v){ return v.temperature(i); }, "T_" + FluidSystem::phaseName(i) );
+            vtk.addVolumeVariable( [i](const auto& v){ return v.temperatureFluid(i); }, "T_" + FluidSystem::phaseName(i) );
         for (int i = 0; i < ModelTraits::numEnergyEqSolid(); ++i)
             vtk.addVolumeVariable( [i](const auto& v){ return v.temperatureSolid(); }, "T_solid" );
         for (int i = 0; i < ModelTraits::numPhases(); ++i){
diff --git a/dumux/porousmediumflow/nonisothermal/volumevariables.hh b/dumux/porousmediumflow/nonisothermal/volumevariables.hh
index cb9c3709c0..75845b4ff2 100644
--- a/dumux/porousmediumflow/nonisothermal/volumevariables.hh
+++ b/dumux/porousmediumflow/nonisothermal/volumevariables.hh
@@ -191,6 +191,15 @@ public:
     Scalar temperatureSolid() const
     { return asImp_().solidState().temperature(); }
 
+
+    /*!
+     * \brief Returns the temperature of a fluid phase assuming thermal nonequilibrium
+     *        the sub-control volume.
+     * \param phaseIdx The local index of the phases
+     */
+    Scalar temperatureFluid(const int phaseIdx) const
+    { return asImp_().fluidState().temperature(phaseIdx); }
+
     /*!
      * \brief Returns the total heat capacity \f$\mathrm{[J/(kg K)]}\f$ of the rock matrix in
      *        the sub-control volume.
-- 
GitLab