From 92958ad53b4d3f6ac50096986cca1beaf20fbf0d Mon Sep 17 00:00:00 2001
From: Christoph Grueninger <christoph.grueninger@iws.uni-stuttgart.de>
Date: Tue, 20 Nov 2012 09:13:21 +0000
Subject: [PATCH] [Stokes, Stokes2c] Move (deprecate & add) molarDensity from
 Stokes to Stokes2c where it belongs. After the release, despite removing the
 deprecated code the member in StokesFluxVariables must be un-commented and
 the "this->" must be removed, too. (reviewed by klaus)

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@9594 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/freeflow/stokes/stokesfluxvariables.hh       |  5 ++++-
 dumux/freeflow/stokes/stokesvolumevariables.hh     |  3 +++
 dumux/freeflow/stokes2c/stokes2cfluxvariables.hh   | 10 ++++++++++
 dumux/freeflow/stokes2c/stokes2cvolumevariables.hh |  7 +++++++
 4 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/dumux/freeflow/stokes/stokesfluxvariables.hh b/dumux/freeflow/stokes/stokesfluxvariables.hh
index 0420fb04a2..cc9bca4f69 100644
--- a/dumux/freeflow/stokes/stokesfluxvariables.hh
+++ b/dumux/freeflow/stokes/stokesfluxvariables.hh
@@ -195,7 +195,10 @@ public:
 
     /*!
      * \brief Return the molar density \f$ \mathrm{[mol/m^3]} \f$ at the integration point.
+     * \deprecated Use molarDensity() from Stokes2c model because it does not belong
+     *             to this model.
      */
+    DUNE_DEPRECATED_MSG("Use molarDensity() from Stokes2c model")
     const Scalar molarDensity() const
     { return molarDensity_; }
 
@@ -271,7 +274,7 @@ protected:
 
     // values at the integration point
     Scalar density_;
-    Scalar molarDensity_;
+    Scalar molarDensity_;  //!< \deprecated Does not belong to this model but to Stokes2c
     Scalar viscosity_;
     Scalar pressure_;
     Scalar normalvelocity_;
diff --git a/dumux/freeflow/stokes/stokesvolumevariables.hh b/dumux/freeflow/stokes/stokesvolumevariables.hh
index 95f38ba7e8..89e9115845 100644
--- a/dumux/freeflow/stokes/stokesvolumevariables.hh
+++ b/dumux/freeflow/stokes/stokesvolumevariables.hh
@@ -147,7 +147,10 @@ public:
     /*!
      * \brief Returns the molar density \f$\mathrm{[mol/m^3]}\f$ of the fluid within the
      *        sub-control volume.
+     * \deprecated Use molarDensity() from Stokes2c model because it does not belong
+     *             to this model.
      */
+    DUNE_DEPRECATED_MSG("Use molarDensity() from Stokes2c model")
     Scalar molarDensity() const
     { return fluidState_.density(phaseIdx) / fluidState_.averageMolarMass(phaseIdx); }
 
diff --git a/dumux/freeflow/stokes2c/stokes2cfluxvariables.hh b/dumux/freeflow/stokes2c/stokes2cfluxvariables.hh
index 263e665d48..286fd7cb3d 100644
--- a/dumux/freeflow/stokes2c/stokes2cfluxvariables.hh
+++ b/dumux/freeflow/stokes2c/stokes2cfluxvariables.hh
@@ -80,6 +80,12 @@ public:
         calculateValues_(problem, element, elemVolVars);
     }
 
+    /*!
+     * \brief Return the molar density \f$ \mathrm{[mol/m^3]} \f$ at the integration point.
+     */
+    const Scalar molarDensity() const
+    { return this->molarDensity_; }
+
     /*!
      * \brief Return the mass fraction of the transported component at the integration point.
      */
@@ -110,6 +116,7 @@ protected:
                           const Element &element,
                           const ElementVolumeVariables &elemVolVars)
     {
+        this->molarDensity_ = Scalar(0);  
         massFraction_ = Scalar(0);
         diffusionCoeff_ = Scalar(0);
         moleFractionGrad_ = Scalar(0);
@@ -119,6 +126,8 @@ protected:
              idx < this->fvGeometry_.numVertices;
              idx++) // loop over vertices of the element
         {
+            this->molarDensity_ += elemVolVars[idx].molarDensity()*
+                this->face().shapeValue[idx];
             massFraction_ += elemVolVars[idx].fluidState().massFraction(phaseIdx, transportCompIdx) *
                 this->face().shapeValue[idx];
             diffusionCoeff_ += elemVolVars[idx].diffusionCoeff() *
@@ -138,6 +147,7 @@ protected:
         Valgrind::CheckDefined(moleFractionGrad_);
     }
 
+    // Scalar molarDensity_; //Use this variable after the deprecated one from StokesFluxVariables is removed +  remove this-> before uses of molarDensity_ in this file
     Scalar massFraction_;
     Scalar diffusionCoeff_;
     DimVector moleFractionGrad_;
diff --git a/dumux/freeflow/stokes2c/stokes2cvolumevariables.hh b/dumux/freeflow/stokes2c/stokes2cvolumevariables.hh
index 25d9d3b02a..e3258b268a 100644
--- a/dumux/freeflow/stokes2c/stokes2cvolumevariables.hh
+++ b/dumux/freeflow/stokes2c/stokes2cvolumevariables.hh
@@ -126,6 +126,13 @@ public:
         fluidState.setMoleFraction(phaseIdx, phaseCompIdx, massFraction[phaseCompIdx]*avgMolarMass/M2);
     }
 
+    /*!
+     * \brief Returns the molar density \f$\mathrm{[mol/m^3]}\f$ of the fluid within the
+     *        sub-control volume.
+     */
+    Scalar molarDensity() const
+    { return this->fluidState_.density(phaseIdx) / this->fluidState_.averageMolarMass(phaseIdx); }
+
     /*!
      * \brief Returns the binary (mass) diffusion coefficient
      */
-- 
GitLab