From 713818adf9df7d27b2ad541df07915454950afd7 Mon Sep 17 00:00:00 2001
From: Philipp Nuske <philipp.nuske@mailbox.org>
Date: Wed, 11 Jan 2012 09:58:20 +0000
Subject: [PATCH] - heat conduction in MpNc switched off - Coordscalar ->
 Scalar: this makes switching all Scalars to quad   possible - some code in
 MpNclocalresidual that makes it possible to sum up the   individual energy
 equation in the case of kinetic consideration - debugging code in the
 nonequilibriumfluidstate

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@7333 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/boxmodels/MpNc/MpNcfluxvariables.hh     |  6 +--
 dumux/boxmodels/MpNc/MpNclocalresidual.hh     | 17 +++++++-
 .../MpNc/energy/MpNclocalresidualenergy.hh    |  3 ++
 .../fluidstates/nonequilibriumfluidstate.hh   | 43 ++++++++++++++++++-
 4 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/dumux/boxmodels/MpNc/MpNcfluxvariables.hh b/dumux/boxmodels/MpNc/MpNcfluxvariables.hh
index 825e18e0d2..cca3bbb521 100644
--- a/dumux/boxmodels/MpNc/MpNcfluxvariables.hh
+++ b/dumux/boxmodels/MpNc/MpNcfluxvariables.hh
@@ -71,12 +71,12 @@ class MPNCFluxVariables
         enableEnergy = GET_PROP_VALUE(TypeTag, EnableEnergy),
         enableKinetic = GET_PROP_VALUE(TypeTag, EnableKinetic),
         enableKineticEnergy = GET_PROP_VALUE(TypeTag, EnableKineticEnergy),
-        enableGravity = GET_PROP_VALUE(TypeTag, EnableGravity)
+        enableGravity = GET_PROP_VALUE(TypeTag, EnableGravity),
     };
 
     typedef typename GridView::ctype CoordScalar;
-    typedef Dune::FieldVector<CoordScalar, dimWorld> Vector;
-    typedef Dune::FieldMatrix<CoordScalar, dimWorld, dimWorld> Tensor;
+    typedef Dune::FieldVector<Scalar, dimWorld> Vector;
+    typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> Tensor;
 
     typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
     typedef typename FVElementGeometry::SubControlVolume SCV;
diff --git a/dumux/boxmodels/MpNc/MpNclocalresidual.hh b/dumux/boxmodels/MpNc/MpNclocalresidual.hh
index 4c63795d57..ee24916038 100644
--- a/dumux/boxmodels/MpNc/MpNclocalresidual.hh
+++ b/dumux/boxmodels/MpNc/MpNclocalresidual.hh
@@ -75,7 +75,12 @@ protected:
 
         phase0NcpIdx = Indices::phase0NcpIdx
     };
-
+#if SUMMED_UP
+    enum { energyEq0Idx     = Indices::energyEq0Idx };
+    enum { wPhaseIdx        = FluidSystem::lPhaseIdx};
+    enum { nPhaseIdx        = FluidSystem::gPhaseIdx};
+    enum { sPhaseIdx        = FluidSystem::sPhaseIdx};
+#endif
 
     typedef typename GridView::template Codim<0>::Entity Element;
     typedef typename GridView::template Codim<0>::Iterator ElementIterator;
@@ -262,6 +267,16 @@ public:
                         this->curVolVars_(i).phaseNcp(phaseIdx);
                 }
             }
+
+#if SUMMED_UP
+            this->residual_[i][energyEq0Idx + wPhaseIdx] +=  this->residual_[i][energyEq0Idx + nPhaseIdx]
+                                                           + this->residual_[i][energyEq0Idx + sPhaseIdx];
+            this->residual_[i][energyEq0Idx + nPhaseIdx] = this->curVolVars_(i).temperature(wPhaseIdx)
+                                                         - this->curVolVars_(i).temperature(nPhaseIdx);
+            this->residual_[i][energyEq0Idx + sPhaseIdx] = this->curVolVars_(i).temperature(wPhaseIdx)
+                                                         - this->curVolVars_(i).temperature(sPhaseIdx);
+#endif
+
         }
     }
 
diff --git a/dumux/boxmodels/MpNc/energy/MpNclocalresidualenergy.hh b/dumux/boxmodels/MpNc/energy/MpNclocalresidualenergy.hh
index 1a5bb1f4c7..c15717d955 100644
--- a/dumux/boxmodels/MpNc/energy/MpNclocalresidualenergy.hh
+++ b/dumux/boxmodels/MpNc/energy/MpNclocalresidualenergy.hh
@@ -180,10 +180,13 @@ public:
                                 phaseIdx,
                                 molarPhaseComponentValuesMassTransport[phaseIdx]);
 
+#warning HEAT CONDUCTION OFF
+#if 0
         //conduction is treated lumped in this model
         computeHeatConduction(flux,
                              fluxVars,
                              volVars);
+#endif
     }
 
     static void computePhaseEnthalpyFlux(PrimaryVariables & result,
diff --git a/dumux/material/fluidstates/nonequilibriumfluidstate.hh b/dumux/material/fluidstates/nonequilibriumfluidstate.hh
index dfeb73ddea..6dd06b0f8c 100644
--- a/dumux/material/fluidstates/nonequilibriumfluidstate.hh
+++ b/dumux/material/fluidstates/nonequilibriumfluidstate.hh
@@ -31,6 +31,9 @@
 
 #include <dumux/common/valgrind.hh>
 
+#include <dumux/material/idealgas.hh>
+
+
 #include <cmath>
 #include <algorithm>
 
@@ -167,7 +170,35 @@ public:
      * \brief The specific internal energy of a fluid phase [J/kg]
      */
     Scalar internalEnergy(int phaseIdx) const
-    { return enthalpy_[phaseIdx] - pressure(phaseIdx)/density(phaseIdx); }
+    {
+
+        int wPhaseIdx = FluidSystem::lPhaseIdx;
+        int nPhaseIdx = FluidSystem::gPhaseIdx;
+        int sPhaseIdx = FluidSystem::sPhaseIdx;
+
+//        typedef Dumux::IdealGas<Scalar> IdealGas;
+//        Scalar result =enthalpy_[phaseIdx] - pressure(phaseIdx)/density(phaseIdx);
+//        Scalar p = pressure(phaseIdx) ;
+//        Scalar rho = density(phaseIdx);
+//        if (phaseIdx == wPhaseIdx){
+            return enthalpy_[phaseIdx]
+                             - pressure(phaseIdx)/density(phaseIdx);
+//#warning changed in nonequilibriumfluidstate
+//        return enthalpy_[phaseIdx]-
+//                1/averageMolarMass_[phaseIdx]* // conversion from [J/(mol K)] to [J/(kg K)]
+//                IdealGas::R*temperature(phaseIdx); // = pressue * spec. volume for an ideal gas
+//        }
+//        else if (phaseIdx == nPhaseIdx){
+//            #warning NIST DATA STUPID INTERPOLATION
+//            Scalar T = temperature(phaseIdx);
+//            Scalar T2 = 300.;
+//            Scalar T1 = 285.;
+//            Scalar u2 = 222170. ;
+//            Scalar u1 = 211010. ;
+//            Scalar u = u1 + (u2-u1) / (T2-T1) * (T-T1);
+//            return u ;
+//        }
+    }
 
     /*!
      * \brief The dynamic viscosity of a fluid phase [Pa s]
@@ -215,6 +246,14 @@ public:
             
             sumMoleFractions_[phaseIdx] += delta;
             averageMolarMass_[phaseIdx] += delta*FluidSystem::molarMass(compIdx);
+//            std::cout<<"In Nonequilibriumfluidstate: sumMoleFractions_["
+//                    <<phaseIdx
+//                    <<"]= "
+//                     << sumMoleFractions_[phaseIdx]
+//                     <<", averageMolarMass_["
+//                     <<phaseIdx
+//                     <<"]= "
+//                     << averageMolarMass_[phaseIdx]<< "\n";
         }
         else { 
             moleFraction_[phaseIdx][compIdx] = value;
@@ -300,7 +339,7 @@ public:
             Valgrind::CheckDefined(saturation_[i]);
             Valgrind::CheckDefined(density_[i]);
             Valgrind::CheckDefined(temperature_[i]);
-            //Valgrind::CheckDefined(internalEnergy_[i]);
+            Valgrind::CheckDefined(enthalpy_[i]);
             Valgrind::CheckDefined(viscosity_[i]);
         }
 #endif // HAVE_VALGRIND
-- 
GitLab