From d8e07baccac2717de8fc1208819315c7abbf320b Mon Sep 17 00:00:00 2001
From: Katharina Heck <katharina.heck@iws.uni-stuttgart.de>
Date: Thu, 8 Nov 2018 15:57:48 +0100
Subject: [PATCH] [1pnc] make compatible with maxwellstefan

---
 dumux/material/fluidsystems/brine.hh          |  5 +++++
 .../porousmediumflow/1pnc/volumevariables.hh  | 22 ++++++++++++++-----
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/dumux/material/fluidsystems/brine.hh b/dumux/material/fluidsystems/brine.hh
index 67685a187e..77d3d3adb7 100644
--- a/dumux/material/fluidsystems/brine.hh
+++ b/dumux/material/fluidsystems/brine.hh
@@ -423,6 +423,11 @@ public:
     {
         if (phaseIdx == liquidPhaseIdx)
         {
+            if (compIIdx > compJIdx)
+            {
+                using std::swap;
+                swap(compIIdx, compJIdx);
+            }
             //! \todo TODO implement binary coefficients
             // http://webserver.dmt.upm.es/~isidoro/dat1/Mass%20diffusivity%20data.htm
             // The link above was given as a reference in brine_air fluid system.
diff --git a/dumux/porousmediumflow/1pnc/volumevariables.hh b/dumux/porousmediumflow/1pnc/volumevariables.hh
index f3a67cb668..a098d5499e 100644
--- a/dumux/porousmediumflow/1pnc/volumevariables.hh
+++ b/dumux/porousmediumflow/1pnc/volumevariables.hh
@@ -99,11 +99,21 @@ public:
         // Could be avoided if diffusion coefficients also
         // became part of the fluid state.
         typename FluidSystem::ParameterCache paramCache;
+
         paramCache.updatePhase(fluidState_, 0);
 
-        diffCoeff_[0] = 0.0; // the main component with itself doesn't have a binary diffusion coefficient
-        for (unsigned int compJIdx = 1; compJIdx < numFluidComps; ++compJIdx)
-            diffCoeff_[compJIdx] = FluidSystem::binaryDiffusionCoefficient(fluidState_, paramCache, 0, 0, compJIdx);
+        for (unsigned int compIIdx = 0; compIIdx < numFluidComps; ++compIIdx)
+        {
+            for (unsigned int compJIdx = 0; compJIdx < numFluidComps; ++compJIdx)
+            {
+                if(compIIdx != compJIdx)
+                    diffCoeff_[compIIdx][compJIdx] = FluidSystem::binaryDiffusionCoefficient(fluidState_,
+                                                                                paramCache,
+                                                                                0,
+                                                                                compIIdx,
+                                                                                compJIdx);
+            }
+        }
     }
 
     /*!
@@ -294,7 +304,7 @@ public:
     Scalar diffusionCoefficient(int phaseIdx, int compIdx) const
     {
         assert(compIdx < numFluidComps);
-        return diffCoeff_[compIdx];
+        return diffCoeff_[phaseIdx][compIdx];
     }
 
     /*!
@@ -330,8 +340,8 @@ protected:
     SolidState solidState_;
 
 private:
-    PermeabilityType permeability_; //!< Effective permeability within the control volume
-    Dune::FieldVector<Scalar, numFluidComps> diffCoeff_; //!< Binary diffusion coefficients
+    PermeabilityType permeability_;
+    std::array<std::array<Scalar, numFluidComps>, numFluidComps> diffCoeff_;
 };
 
 } // end namespace Dumux
-- 
GitLab