From a9dcc20786667ef6433c5f26e6815ba78fe9472d Mon Sep 17 00:00:00 2001
From: Katharina Heck <katharina.heck@iws.uni-stuttgart.de>
Date: Fri, 2 Feb 2018 15:59:29 +0100
Subject: [PATCH] [cleanup] use the misciblemultiphase constraintsolver for the
 equilibrium mole fractions

---
 .../nonequilibrium/volumevariables.hh                 |  7 ++-----
 .../mpnc/implicit/evaporationatmosphereproblem.hh     | 11 +++++++++--
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/dumux/porousmediumflow/nonequilibrium/volumevariables.hh b/dumux/porousmediumflow/nonequilibrium/volumevariables.hh
index 09c4f656be..16cae68b46 100644
--- a/dumux/porousmediumflow/nonequilibrium/volumevariables.hh
+++ b/dumux/porousmediumflow/nonequilibrium/volumevariables.hh
@@ -34,8 +34,6 @@
 #include <dumux/porousmediumflow/volumevariables.hh>
 
 #include <dumux/material/fluidstates/nonequilibrium.hh>
-#include <dumux/material/constraintsolvers/fluidsystemcomputefromreferencephase.hh>
-#include <dumux/material/constraintsolvers/fluidsystemconstraintsolver.hh>
 #include <dumux/material/constraintsolvers/misciblemultiphasecomposition.hh>
 
 namespace Dumux
@@ -304,8 +302,7 @@ class NonEquilibriumVolumeVariablesImplementation<TypeTag, true/*enableChemicalN
     using AwnSurfaceParams = typename  AwnSurface::Params;
 
     using DimLessNum = DimensionlessNumbers<Scalar>;
-    //TODO: write a good constraint solver which does that right
-    using ConstraintSolver = FluidSystemConstraintSolver<Scalar, FluidSystem>;
+    using ConstraintSolver = MiscibleMultiPhaseComposition<Scalar, FluidSystem>;
 public:
     /*!
      * \brief Updates the volume specific interfacial area [m^2 / m^3] between the phases.
@@ -533,7 +530,7 @@ class NonEquilibriumVolumeVariablesImplementation<TypeTag, true/*enableChemicalN
     using AnsSurface = typename GET_PROP_TYPE(TypeTag, AnsSurface);
     using AnsSurfaceParams = typename  AnsSurface::Params;
 
-    using ConstraintSolver = Dumux::FluidSystemConstraintSolver<Scalar, FluidSystem>;
+    using ConstraintSolver = MiscibleMultiPhaseComposition<Scalar, FluidSystem>;
 
 
 public:
diff --git a/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh b/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh
index 6205c76f09..67ed1aed79 100644
--- a/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh
+++ b/test/porousmediumflow/mpnc/implicit/evaporationatmosphereproblem.hh
@@ -132,6 +132,7 @@ class EvaporationAtmosphereProblem: public PorousMediumFlowProblem<TypeTag>
     enum { numEnergyEqSolid = GET_PROP_VALUE(TypeTag, NumEnergyEqSolid)};
 
     static constexpr bool enableChemicalNonEquilibrium = GET_PROP_VALUE(TypeTag, EnableChemicalNonEquilibrium);
+    using ConstraintSolver = MiscibleMultiPhaseComposition<Scalar, FluidSystem>;
 
     // formulations
     enum {
@@ -268,7 +269,10 @@ public:
         fluidState.setTemperature(wPhaseIdx, TInitial_ ); // this value is a good one, TInject does not work
 
         // This solves the system of equations defining x=x(p,T)
-        FluidSystem::calculateEquilibriumMoleFractions(fluidState, dummyCache) ;
+        ConstraintSolver::solve(fluidState,
+                                dummyCache,
+                                /*setViscosity=*/false,
+                                /*setEnthalpy=*/false) ;
 
         // Now let's make the air phase less than fully saturated with water
         fluidState.setMoleFraction(nPhaseIdx, wCompIdx, fluidState.moleFraction(nPhaseIdx, wCompIdx)*percentOfEquil_ ) ;
@@ -417,7 +421,10 @@ private:
 
          // This solves the system of equations defining x=x(p,T)
         ParameterCache dummyCache;
-        FluidSystem::calculateEquilibriumMoleFractions(equilibriumFluidState, dummyCache) ;
+        ConstraintSolver::solve(equilibriumFluidState,
+                                dummyCache,
+                                /*setViscosity=*/false,
+                                /*setEnthalpy=*/false) ;
 
         FluidState dryFluidState(equilibriumFluidState);
         // Now let's make the air phase less than fully saturated with vapor
-- 
GitLab