From 55c16e8662103f6839fd746b7a23cc59c5623dc0 Mon Sep 17 00:00:00 2001
From: Ned Coltman <edward.coltman@iws.uni-stuttgart.de>
Date: Mon, 9 Mar 2020 17:12:31 +0100
Subject: [PATCH] [maxwellstefan] Add documentation for the maxwellstefan
 container

---
 .../maxwellstefandiffusioncoefficients.hh     | 29 +++++++++++++++++--
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/dumux/flux/maxwellstefandiffusioncoefficients.hh b/dumux/flux/maxwellstefandiffusioncoefficients.hh
index 6d9a8d08ad..53b8e0687c 100644
--- a/dumux/flux/maxwellstefandiffusioncoefficients.hh
+++ b/dumux/flux/maxwellstefandiffusioncoefficients.hh
@@ -19,8 +19,9 @@
 /*!
  * \file
  * \ingroup Flux
- * \brief Container storing the diffusion coefficients required by Fick's law.
- *        Uses the minimal possible container size and provides unified access.
+ * \brief Container storing the diffusion coefficients required by the Maxwell-
+ *        Stefan diffusion law. Uses the minimal possible container size and
+ *        provides unified access.
  */
 #ifndef DUMUX_DISCRETIZATION_MAXWELLSTEFAN_DIFFUSION_COEFFICIENTS_HH
 #define DUMUX_DISCRETIZATION_MAXWELLSTEFAN_DIFFUSION_COEFFICIENTS_HH
@@ -60,7 +61,29 @@ public:
     }
 
 private:
-    std::array<Scalar, (numPhases * ((numComponents * numComponents - numComponents)/2))> diffCoeff_;
+    /*!
+     * \brief Maxwell Stefan diffusion coefficient container.
+     *        This container is sized to hold all required diffusion coefficients.
+     *
+     *        For each phase "(numPhases * ("
+     *        We have a square coefficient matrix sized by
+     *        the number of components "((numComponents * numComponents)".
+     *        The diagonal is not used and removed " - numComponents)".
+     *        The matrix is symmetrical, but only the upper triangle is required " / 2))".
+     */
+    std::array<Scalar, (numPhases * (((numComponents * numComponents) - numComponents)/2))> diffCoeff_;
+
+    /*!
+     * \brief Index logic for collecting the correct diffusion coefficient from the container.
+     *
+     *        First, we advance our index to the correct phase coefficient matrix:
+     *        " phaseIdx * ((numComponents * numComponents - numComponents) / 2) ".
+     *        The individual index within each phase matrix is then calculated using
+     *        " i*n - (i^2+i)/2 + j-(i+1) ".
+     *
+     *        This index calculation can be reduced from the following:
+     *        https://stackoverflow.com/questions/27086195/
+     */
     const int getIndex_(int phaseIdx, int compIIdx, int compJIdx) const
     {
         return phaseIdx * ((numComponents * numComponents - numComponents) / 2)
-- 
GitLab