From 14bc7a84b3701488611486fc14ee663b87df61c6 Mon Sep 17 00:00:00 2001
From: vishal jambhekar <vishal.jambhekar@iws.uni-stuttgart.de>
Date: Thu, 30 Jul 2015 09:44:26 +0000
Subject: [PATCH] git-svn-id:
 svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@15193
 2fb0f335-1f38-0410-981e-8018bf24f1b0

---
 dumux/implicit/2pncmin/2pncminproperties.hh   |  4 +-
 .../2pncmin/2pncminpropertydefaults.hh        | 18 +++----
 .../2pncmin/2pncminvolumevariables.hh         | 53 ++++++++-----------
 3 files changed, 35 insertions(+), 40 deletions(-)

diff --git a/dumux/implicit/2pncmin/2pncminproperties.hh b/dumux/implicit/2pncmin/2pncminproperties.hh
index 18e6c866e6..f89c1538ad 100644
--- a/dumux/implicit/2pncmin/2pncminproperties.hh
+++ b/dumux/implicit/2pncmin/2pncminproperties.hh
@@ -41,7 +41,9 @@ namespace Properties
 //////////////////////////////////////////////////////////////////
 
 //! The type tag for the isothermal two phase n component mineralisation problems
-NEW_TYPE_TAG(BoxTwoPNCMin, INHERITS_FROM(BoxTwoPNC));
+NEW_TYPE_TAG(TwoPNCMin, INHERITS_FROM(TwoPNC));
+NEW_TYPE_TAG(BoxTwoPNCMin, INHERITS_FROM(BoxModel, TwoPNCMin));
+NEW_TYPE_TAG(CCTwoPNCMin, INHERITS_FROM(CCModel, TwoPNCMin));
 
 //////////////////////////////////////////////////////////////////
 // Property tags
diff --git a/dumux/implicit/2pncmin/2pncminpropertydefaults.hh b/dumux/implicit/2pncmin/2pncminpropertydefaults.hh
index 516ee45bc6..10eaa8ce1b 100644
--- a/dumux/implicit/2pncmin/2pncminpropertydefaults.hh
+++ b/dumux/implicit/2pncmin/2pncminpropertydefaults.hh
@@ -56,7 +56,7 @@ namespace Properties {
  * We just forward the number from the fluid system
  *
  */
-SET_PROP(BoxTwoPNCMin, NumSecComponents)
+SET_PROP(TwoPNCMin, NumSecComponents)
 {
 private:
     typedef typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)) FluidSystem;
@@ -71,7 +71,7 @@ public:
  * We just forward the number from the fluid system
  *
  */
-SET_PROP(BoxTwoPNCMin, NumSPhases)
+SET_PROP(TwoPNCMin, NumSPhases)
 {
 private:
     typedef typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)) FluidSystem;
@@ -85,7 +85,7 @@ public:
  * For each component and each precipitated mineral/solid phase one equation has to
  * be solved.
  */
-SET_PROP(BoxTwoPNCMin, NumEq)
+SET_PROP(TwoPNCMin, NumEq)
 {
 private:
     typedef typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)) FluidSystem;
@@ -95,24 +95,24 @@ public:
 };
 
 //! Use the 2pncmin local residual operator
-SET_TYPE_PROP(BoxTwoPNCMin,
+SET_TYPE_PROP(TwoPNCMin,
               LocalResidual,
               TwoPNCMinLocalResidual<TypeTag>);
 
 //! the Model property
-SET_TYPE_PROP(BoxTwoPNCMin, Model, TwoPNCMinModel<TypeTag>);
+SET_TYPE_PROP(TwoPNCMin, Model, TwoPNCMinModel<TypeTag>);
 
 //! the VolumeVariables property
-SET_TYPE_PROP(BoxTwoPNCMin, VolumeVariables, TwoPNCMinVolumeVariables<TypeTag>);
+SET_TYPE_PROP(TwoPNCMin, VolumeVariables, TwoPNCMinVolumeVariables<TypeTag>);
 
 //! the FluxVariables property
-SET_TYPE_PROP(BoxTwoPNCMin, FluxVariables, TwoPNCMinFluxVariables<TypeTag>);
+SET_TYPE_PROP(TwoPNCMin, FluxVariables, TwoPNCMinFluxVariables<TypeTag>);
 
 //! The indices required by the isothermal 2pNcMin model
-SET_TYPE_PROP(BoxTwoPNCMin, Indices, TwoPNCMinIndices <TypeTag, /*PVOffset=*/0>);
+SET_TYPE_PROP(TwoPNCMin, Indices, TwoPNCMinIndices <TypeTag, /*PVOffset=*/0>);
 
 //! disable useSalinity for the calculation of osmotic pressure by default
-SET_BOOL_PROP(BoxTwoPNCMin, useSalinity, false);
+SET_BOOL_PROP(TwoPNCMin, useSalinity, false);
 
 
 //! default value for the forchheimer coefficient
diff --git a/dumux/implicit/2pncmin/2pncminvolumevariables.hh b/dumux/implicit/2pncmin/2pncminvolumevariables.hh
index ed332aff27..97e583ab57 100644
--- a/dumux/implicit/2pncmin/2pncminvolumevariables.hh
+++ b/dumux/implicit/2pncmin/2pncminvolumevariables.hh
@@ -34,7 +34,7 @@
 
 #include "2pncminproperties.hh"
 #include "2pncminindices.hh"
-#include <dumux/material/constraintsolvers/computefromreferencephase2pnc.hh>
+#include <dumux/material/constraintsolvers/computefromreferencephase2pncmin.hh>
 #include <dumux/material/constraintsolvers/miscible2pnccomposition.hh>
 #include <dumux/implicit/2pnc/2pncvolumevariables.hh>
 
@@ -63,9 +63,9 @@ class TwoPNCMinVolumeVariables : public TwoPNCVolumeVariables<TypeTag>
     typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
     typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
     typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
-//     typedef typename GET_PROP_TYPE(TypeTag, Chemistry) Chemistry;
 
-    enum {
+    enum 
+    {
         dim = GridView::dimension,
         dimWorld=GridView::dimensionworld,
 
@@ -102,8 +102,8 @@ class TwoPNCMinVolumeVariables : public TwoPNCVolumeVariables<TypeTag>
     typedef typename GridView::template Codim<0>::Entity Element;
     typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition;
     typedef typename Grid::ctype CoordScalar;
-    typedef Dumux::Miscible2pNcComposition<Scalar, FluidSystem> Miscible2pNcComposition;
-    typedef Dumux::ComputeFromReferencePhase2pNc<Scalar, FluidSystem> ComputeFromReferencePhase2pNc;
+    typedef Dumux::miscible2pncComposition<Scalar, FluidSystem> miscible2pncComposition;
+    typedef Dumux::computeFromReferencePhase2pncmin<Scalar, FluidSystem> computeFromReferencePhase2pncmin;
 
     enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) };
     enum { dofCodim = isBox ? dim : 0 };
@@ -136,6 +136,8 @@ public:
 
     // porosity evaluation
     initialPorosity_ = problem.spatialParams().porosity(element, fvGeometry, scvIdx);
+    minimumPorosity_ = problem.spatialParams().porosityMin(element, fvGeometry, scvIdx);
+
 
     sumPrecipitates_ = 0.0;
     for(int sPhaseIdx = 0; sPhaseIdx < numSPhases; ++sPhaseIdx)
@@ -157,7 +159,7 @@ public:
 
 //      this->porosity_ = initialPorosity_ - sumPrecipitates_;
 
-   this->porosity_ = std::max(0.1, std::max(0.0, initialPorosity_ - sumPrecipitates_));
+     this->porosity_ = std::max(minimumPorosity_, std::max(0.0, initialPorosity_ - sumPrecipitates_));
 
    salinity_= 0.0;
    moleFractionSalinity_ = 0.0;
@@ -289,7 +291,7 @@ public:
             	fluidState.setMoleFraction(wPhaseIdx, compIdx, priVars[compIdx]);
             }
 
-            Miscible2pNcComposition::solve(fluidState,
+            miscible2pncComposition::solve(fluidState,
                                             paramCache,
                                             wPhaseIdx,	//known phaseIdx
                                             /*setViscosity=*/true,
@@ -338,11 +340,12 @@ public:
             // calculate the composition of the remaining phases (as
             // well as the densities of all phases). this is the job
             // of the "ComputeFromReferencePhase2pNc" constraint solver
-            ComputeFromReferencePhase2pNc::solve(fluidState,
-                                             paramCache,
-                                             nPhaseIdx,
-                                             /*setViscosity=*/true,
-                                             /*setInternalEnergy=*/false);
+            computeFromReferencePhase2pncmin::solve(fluidState,
+                                                    paramCache,
+                                                    nPhaseIdx,
+                                                    nPhaseOnly,
+                                                    /*setViscosity=*/true,
+                                                    /*setInternalEnergy=*/false);
 
             }
         else if (phasePresence == wPhaseOnly){
@@ -374,11 +377,12 @@ public:
 //             calculate the composition of the remaining phases (as
 //             well as the densities of all phases). this is the job
 //             of the "ComputeFromReferencePhase2pNc" constraint solver
-            ComputeFromReferencePhase2pNc::solve(fluidState,
-                                             paramCache,
-                                             wPhaseIdx,
-                                             /*setViscosity=*/true,
-                                             /*setInternalEnergy=*/false);
+            computeFromReferencePhase2pncmin::solve(fluidState,
+                                                    paramCache,
+                                                    wPhaseIdx,
+                                                    wPhaseOnly,
+                                                    /*setViscosity=*/true,
+                                                    /*setInternalEnergy=*/false);
         }
         paramCache.updateAll(fluidState);
         for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
@@ -453,21 +457,11 @@ public:
     {
         if (phaseIdx < numPhases)
             return this->fluidState_.density(phaseIdx);
-#if SALINIZATION
         else if (phaseIdx >= numPhases)
-        return FluidSystem::precipitateDensity(phaseIdx);
-#endif
+            return FluidSystem::precipitateDensity(phaseIdx);
         else
             DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx);
     }
-    /*!
-        * \brief Returns the liquid vapor pressure within the control volume.
-        */
-#if SALINIZATION
-    Scalar vaporPressure() const
-    { return FluidSystem::vaporPressure(this->fluidState_.temperature(/*phaseIdx=*/0),this->fluidState_.moleFraction(wPhaseIdx, FluidSystem::NaClIdx)); }
-#endif
-
     /*!
      * \brief Returns the mass density of a given phase within the
      *        control volume.
@@ -478,10 +472,8 @@ public:
     {
         if (phaseIdx < numPhases)
             return this->fluidState_.molarDensity(phaseIdx);
-#if SALINIZATION
         else if (phaseIdx >= numPhases)
             return FluidSystem::precipitateMolarDensity(phaseIdx);
-#endif
         else
             DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx);
     }
@@ -537,6 +529,7 @@ protected:
     Scalar permeabilityFactor_;
     Scalar initialPorosity_;
     Scalar InitialPermeability_;
+    Scalar minimumPorosity_;
     Scalar sumPrecipitates_;
     Scalar salinity_;
     Scalar moleFractionSalinity_;
-- 
GitLab