From 9b27f2636241860bf555406003b3d4b4ca07a439 Mon Sep 17 00:00:00 2001
From: Bernd Flemisch <bernd@iws.uni-stuttgart.de>
Date: Tue, 10 Feb 2015 09:33:07 +0000
Subject: [PATCH] [mpnc] retrieve run-time parameter values instead of
 compile-time property values

Several values steering the output as well as the Newton have been
handled inconsistently. While they have been obtained as run-time values
from the parameter tree in other models or parts of the mpnc model, the
compile-time property values have been taken at certain locations. Thus,
despite "advertised" as being run-time, it was not possible to actually
set them run-time. This was also due to the fact that those values have
been set as (private) enums. In order to reach consistency, these values
are member variables now and retrieved run-time.

Reviewed by gruenich.



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@14228 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 .../mpnc/energy/mpncvtkwriterenergykinetic.hh | 32 ++++++++++++-------
 dumux/implicit/mpnc/mpncmodel.hh              | 26 ++++++++++-----
 dumux/implicit/mpnc/mpncmodelkinetic.hh       |  4 ---
 3 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/dumux/implicit/mpnc/energy/mpncvtkwriterenergykinetic.hh b/dumux/implicit/mpnc/energy/mpncvtkwriterenergykinetic.hh
index f929f5430d..a5f2d04776 100644
--- a/dumux/implicit/mpnc/energy/mpncvtkwriterenergykinetic.hh
+++ b/dumux/implicit/mpnc/energy/mpncvtkwriterenergykinetic.hh
@@ -63,9 +63,6 @@ class MPNCVtkWriterEnergy<TypeTag, /*enableEnergy = */ true, /* numEnergyEquatio
     enum { numEnergyEqs = Indices::numPrimaryEnergyVars};
     enum { velocityAveragingInModel = GET_PROP_VALUE(TypeTag, VelocityAveragingInModel) };
 
-    enum { temperatureOutput    = GET_PROP_VALUE(TypeTag, VtkAddTemperatures) };
-    enum { enthalpyOutput       = GET_PROP_VALUE(TypeTag, VtkAddEnthalpies) };
-    enum { internalEnergyOutput = GET_PROP_VALUE(TypeTag, VtkAddInternalEnergies) };
     enum { reynoldsOutput       = GET_PROP_VALUE(TypeTag, VtkAddReynolds) };
     enum { prandtlOutput        = GET_PROP_VALUE(TypeTag, VtkAddPrandtl) };
     enum { nusseltOutput        = GET_PROP_VALUE(TypeTag, VtkAddNusselt) };
@@ -86,6 +83,9 @@ public:
     MPNCVtkWriterEnergy(const Problem &problem)
         : ParentType(problem)
     {
+        temperatureOutput_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Vtk, AddTemperatures);
+        enthalpyOutput_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Vtk, AddEnthalpies);
+        internalEnergyOutput_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Vtk, AddInternalEnergies);
     }
 
     /*!
@@ -189,15 +189,15 @@ public:
             this->commitScalarBuffer_(writer, "ans" , ans_);
         }
 
-        if (temperatureOutput){
+        if (temperatureOutput_){
             this->commitTemperaturesBuffer_(writer, "T_%s", temperature_);
             this->commitScalarBuffer_(writer, "TwMinusTn" , TwMinusTn_);
             this->commitScalarBuffer_(writer, "TnMinusTs" , TnMinusTs_);
         }
 
-        if (enthalpyOutput)
+        if (enthalpyOutput_)
             this->commitPhaseBuffer_(writer, "h_%s", enthalpy_);
-        if (internalEnergyOutput)
+        if (internalEnergyOutput_)
             this->commitPhaseBuffer_(writer, "u_%s", internalEnergy_);
         if (reynoldsOutput)
             this->commitPhaseBuffer_(writer, "reynoldsNumber_%s", reynoldsNumber_);
@@ -272,6 +272,10 @@ private:
     ScalarVector awn_;
     ScalarVector aws_;
     ScalarVector ans_;
+
+    bool temperatureOutput_;
+    bool enthalpyOutput_;
+    bool internalEnergyOutput_;
 };
 
 /*!
@@ -308,9 +312,6 @@ class MPNCVtkWriterEnergy<TypeTag, /*enableEnergy = */ true, /* numEnergyEquatio
     enum { numEnergyEqs = Indices::numPrimaryEnergyVars};
     enum { velocityAveragingInModel = GET_PROP_VALUE(TypeTag, VelocityAveragingInModel) };
 
-    enum { temperatureOutput    = GET_PROP_VALUE(TypeTag, VtkAddTemperatures) };
-    enum { enthalpyOutput       = GET_PROP_VALUE(TypeTag, VtkAddEnthalpies) };
-    enum { internalEnergyOutput = GET_PROP_VALUE(TypeTag, VtkAddInternalEnergies) };
     enum { reynoldsOutput       = GET_PROP_VALUE(TypeTag, VtkAddReynolds) };
     enum { prandtlOutput        = GET_PROP_VALUE(TypeTag, VtkAddPrandtl) };
     enum { nusseltOutput        = GET_PROP_VALUE(TypeTag, VtkAddNusselt) };
@@ -331,6 +332,9 @@ public:
     MPNCVtkWriterEnergy(const Problem &problem)
         : ParentType(problem)
     {
+        temperatureOutput_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Vtk, AddTemperatures);
+        enthalpyOutput_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Vtk, AddEnthalpies);
+        internalEnergyOutput_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Vtk, AddInternalEnergies);
     }
 
     /*!
@@ -416,7 +420,7 @@ public:
     void commitBuffers(MultiWriter & writer)
     {
 
-        if (temperatureOutput){
+        if (temperatureOutput_){
             this->commitTemperaturesBuffer_(writer, "T_%s", temperature_);
         }
 
@@ -424,9 +428,9 @@ public:
         this->commitScalarBuffer_(writer, "qsf", qsf_);
 
 
-        if (enthalpyOutput)
+        if (enthalpyOutput_)
             this->commitPhaseBuffer_(writer, "h_%s", enthalpy_);
-        if (internalEnergyOutput)
+        if (internalEnergyOutput_)
             this->commitPhaseBuffer_(writer, "u_%s", internalEnergy_);
         if (reynoldsOutput)
             this->commitPhaseBuffer_(writer, "reynoldsNumber_%s", reynoldsNumber_);
@@ -511,6 +515,10 @@ private:
     ScalarVector qBoil_ ;
     ScalarVector qsf_ ;
     PhaseDimWorldField  velocity_;
+
+    bool temperatureOutput_;
+    bool enthalpyOutput_;
+    bool internalEnergyOutput_;
 };
 
 
diff --git a/dumux/implicit/mpnc/mpncmodel.hh b/dumux/implicit/mpnc/mpncmodel.hh
index 244a8bb693..cd2956f0b5 100644
--- a/dumux/implicit/mpnc/mpncmodel.hh
+++ b/dumux/implicit/mpnc/mpncmodel.hh
@@ -129,10 +129,6 @@ class MPNCModel : public GET_PROP_TYPE(TypeTag, BaseModel)
     enum {enableDiffusion = GET_PROP_VALUE(TypeTag, EnableDiffusion)};
     enum {enableKinetic = GET_PROP_VALUE(TypeTag, EnableKinetic)};
     enum {numEnergyEquations = GET_PROP_VALUE(TypeTag, NumEnergyEquations)};
-    enum {enableSmoothUpwinding = GET_PROP_VALUE(TypeTag, ImplicitEnableSmoothUpwinding)};
-    enum {enablePartialReassemble = GET_PROP_VALUE(TypeTag, ImplicitEnablePartialReassemble)};
-    enum {enableJacobianRecycling = GET_PROP_VALUE(TypeTag, ImplicitEnableJacobianRecycling)};
-    enum {numDiffMethod = GET_PROP_VALUE(TypeTag, ImplicitNumericDifferenceMethod)};
     enum {numPhases = GET_PROP_VALUE(TypeTag, NumPhases)};
     enum {numComponents = GET_PROP_VALUE(TypeTag, NumComponents)};
     enum {numEq = GET_PROP_VALUE(TypeTag, NumEq)};
@@ -144,6 +140,14 @@ class MPNCModel : public GET_PROP_TYPE(TypeTag, BaseModel)
 
 
 public:
+    MPNCModel()
+    {
+        enableSmoothUpwinding_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Implicit, EnableSmoothUpwinding);
+        enablePartialReassemble_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Implicit, EnablePartialReassemble);
+        enableJacobianRecycling_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Implicit, EnableJacobianRecycling);
+        numDiffMethod_ = GET_PARAM_FROM_GROUP(TypeTag, int, Implicit, NumericDifferenceMethod);
+    }
+
     void init(Problem &problem)
     {
         ParentType::init(problem);
@@ -159,10 +163,10 @@ public:
                 << "    number of energy equations: " << numEnergyEquations<< "\n"
                 << "    diffusion: " << enableDiffusion << "\n"
                 << "    energy equation: " << enableEnergy << "\n"
-                << "    smooth upwinding: " << enableSmoothUpwinding << "\n"
-                << "    partial jacobian reassembly: " << enablePartialReassemble << "\n"
-                << "    numeric differentiation method: " << numDiffMethod << " (-1: backward, 0: central, +1 forward)\n"
-                << "    jacobian recycling: " << enableJacobianRecycling << "\n";
+                << "    smooth upwinding: " << enableSmoothUpwinding_ << "\n"
+                << "    partial jacobian reassembly: " << enablePartialReassemble_ << "\n"
+                << "    numeric differentiation method: " << numDiffMethod_ << " (-1: backward, 0: central, +1 forward)\n"
+                << "    jacobian recycling: " << enableJacobianRecycling_ << "\n";
     }
 
     /*!
@@ -197,6 +201,12 @@ public:
     }
 
     Dune::shared_ptr<MPNCVtkWriter> vtkWriter_;
+
+private:
+    bool enableSmoothUpwinding_;
+    bool enablePartialReassemble_;
+    bool enableJacobianRecycling_;
+    int numDiffMethod_;
 };
 
 }
diff --git a/dumux/implicit/mpnc/mpncmodelkinetic.hh b/dumux/implicit/mpnc/mpncmodelkinetic.hh
index 46eda87f36..c012877b9c 100644
--- a/dumux/implicit/mpnc/mpncmodelkinetic.hh
+++ b/dumux/implicit/mpnc/mpncmodelkinetic.hh
@@ -65,10 +65,6 @@ class MPNCModelKinetic : public MPNCModel<TypeTag>
     enum { enableDiffusion = GET_PROP_VALUE(TypeTag, EnableDiffusion)};
     enum { enableKinetic = GET_PROP_VALUE(TypeTag, EnableKinetic)};
     enum { numEnergyEquations = GET_PROP_VALUE(TypeTag, NumEnergyEquations)};
-    enum { enableSmoothUpwinding = GET_PROP_VALUE(TypeTag, ImplicitEnableSmoothUpwinding)};
-    enum { enablePartialReassemble = GET_PROP_VALUE(TypeTag, ImplicitEnablePartialReassemble)};
-    enum { enableJacobianRecycling = GET_PROP_VALUE(TypeTag, ImplicitEnableJacobianRecycling)};
-    enum { numDiffMethod = GET_PROP_VALUE(TypeTag, ImplicitNumericDifferenceMethod)};
     enum { numPhases = GET_PROP_VALUE(TypeTag, NumPhases)};
     enum { numComponents = GET_PROP_VALUE(TypeTag, NumComponents)};
     enum { numEq = GET_PROP_VALUE(TypeTag, NumEq)};
-- 
GitLab