From b12a2d0e41fabee7602868158be67953e8b5cdab Mon Sep 17 00:00:00 2001
From: Gabi Seitz <gabriele.seitz@iws.uni-stuttgart.de>
Date: Thu, 21 Dec 2017 09:00:09 +0100
Subject: [PATCH] [material] add calculation of effective solid properties

---
 .../fluidmatrixinteractions/CMakeLists.txt    |  1 +
 .../mineralization/CMakeLists.txt             |  6 ++
 .../mineralization/effectivesoliddensity.hh   | 90 +++++++++++++++++++
 .../effectivesolidheatcapacity.hh             | 90 +++++++++++++++++++
 .../porosityreactivebed.hh                    |  5 +-
 5 files changed, 189 insertions(+), 3 deletions(-)
 create mode 100644 dumux/material/fluidmatrixinteractions/mineralization/CMakeLists.txt
 create mode 100644 dumux/material/fluidmatrixinteractions/mineralization/effectivesoliddensity.hh
 create mode 100644 dumux/material/fluidmatrixinteractions/mineralization/effectivesolidheatcapacity.hh

diff --git a/dumux/material/fluidmatrixinteractions/CMakeLists.txt b/dumux/material/fluidmatrixinteractions/CMakeLists.txt
index 027b7691e6..07a9487406 100644
--- a/dumux/material/fluidmatrixinteractions/CMakeLists.txt
+++ b/dumux/material/fluidmatrixinteractions/CMakeLists.txt
@@ -3,6 +3,7 @@ add_subdirectory("2p")
 add_subdirectory("2pia")
 add_subdirectory("3p")
 add_subdirectory("mp")
+add_subdirectory("mineralization")
 
 #install headers
 install(FILES
diff --git a/dumux/material/fluidmatrixinteractions/mineralization/CMakeLists.txt b/dumux/material/fluidmatrixinteractions/mineralization/CMakeLists.txt
new file mode 100644
index 0000000000..6034e22bf8
--- /dev/null
+++ b/dumux/material/fluidmatrixinteractions/mineralization/CMakeLists.txt
@@ -0,0 +1,6 @@
+
+#install headers
+install(FILES
+effectivesoliddensity.hh
+effectivesolidheatcapacity.hh
+DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/material/fluidmatrixinteractions/mineralization)
diff --git a/dumux/material/fluidmatrixinteractions/mineralization/effectivesoliddensity.hh b/dumux/material/fluidmatrixinteractions/mineralization/effectivesoliddensity.hh
new file mode 100644
index 0000000000..54eeb92c41
--- /dev/null
+++ b/dumux/material/fluidmatrixinteractions/mineralization/effectivesoliddensity.hh
@@ -0,0 +1,90 @@
+// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+// vi: set et ts=4 sw=4 sts=4:
+/*****************************************************************************
+ *   See the file COPYING for full copying permissions.                      *
+ *                                                                           *
+ *   This program is free software: you can redistribute it and/or modify    *
+ *   it under the terms of the GNU General Public License as published by    *
+ *   the Free Software Foundation, either version 2 of the License, or       *
+ *   (at your option) any later version.                                     *
+ *                                                                           *
+ *   This program is distributed in the hope that it will be useful,         *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
+ *   GNU General Public License for more details.                            *
+ *                                                                           *
+ *   You should have received a copy of the GNU General Public License       *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
+ *****************************************************************************/
+/*!
+ * \file
+ *
+ * \brief Class for the evaluation of the porosity subject to precipitation.
+ */
+#ifndef DUMUX_EFFECTIVE_SOLID_DENSITY_HH
+#define DUMUX_EFFECTIVE_SOLID_DENSITY_HH
+
+#include <dumux/discretization/evalsolution.hh>
+
+namespace Dumux
+{
+
+/*!
+ * \ingroup Fluidmatrixinteractions
+ */
+
+/**
+ * \brief Calculates the effective solid density
+ */
+template<class TypeTag>
+class EffectiveSolidDensity
+{
+    using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
+    using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
+    using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
+    using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
+    using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
+    using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
+
+    static const int dim = GridView::dimension;
+    static const int dimWorld = GridView::dimensionworld;
+    static const int numComponents = GET_PROP_VALUE(TypeTag, NumComponents);
+    static const int numSolidPhases = GET_PROP_VALUE(TypeTag, NumSPhases);
+
+    using Element = typename GridView::template Codim<0>:: Entity;
+
+public:
+    void init(const SpatialParams& spatialParams)
+    {
+        spatialParamsPtr_ = &spatialParams;
+    }
+
+    // calculates the effective solid density of multiple solid phases according to
+    // their volume fractions
+    Scalar effectiveSolidDensity(const Element& element,
+                            const SubControlVolume& scv,
+                            const ElementSolution& elemSol) const
+    {
+        auto priVars = evalSolution(element, element.geometry(), elemSol, scv.center());
+
+        Scalar sumPrecipitates = 0.0;
+        Scalar effRhoS = 0.0;
+        for (unsigned int solidPhaseIdx = 0; solidPhaseIdx < numSolidPhases; ++solidPhaseIdx)
+        {
+            sumPrecipitates += priVars[numComponents + solidPhaseIdx];
+            effRhoS += priVars[numComponents + solidPhaseIdx]*spatialParams_().solidPhaseDensity(element, scv, elemSol, solidPhaseIdx);
+        }
+
+        return effRhoS/sumPrecipitates;
+    }
+
+private:
+    const SpatialParams& spatialParams_() const
+    { return *spatialParamsPtr_; }
+
+    const SpatialParams* spatialParamsPtr_;
+};
+
+} // namespace Dumux
+
+#endif
diff --git a/dumux/material/fluidmatrixinteractions/mineralization/effectivesolidheatcapacity.hh b/dumux/material/fluidmatrixinteractions/mineralization/effectivesolidheatcapacity.hh
new file mode 100644
index 0000000000..d3ec1d493a
--- /dev/null
+++ b/dumux/material/fluidmatrixinteractions/mineralization/effectivesolidheatcapacity.hh
@@ -0,0 +1,90 @@
+// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+// vi: set et ts=4 sw=4 sts=4:
+/*****************************************************************************
+ *   See the file COPYING for full copying permissions.                      *
+ *                                                                           *
+ *   This program is free software: you can redistribute it and/or modify    *
+ *   it under the terms of the GNU General Public License as published by    *
+ *   the Free Software Foundation, either version 2 of the License, or       *
+ *   (at your option) any later version.                                     *
+ *                                                                           *
+ *   This program is distributed in the hope that it will be useful,         *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
+ *   GNU General Public License for more details.                            *
+ *                                                                           *
+ *   You should have received a copy of the GNU General Public License       *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
+ *****************************************************************************/
+/*!
+ * \file
+ *
+ * \brief Class for the evaluation of the porosity subject to precipitation.
+ */
+#ifndef DUMUX_EFFECTIVE_SOLID_HEATCAPACITY_HH
+#define DUMUX_EFFECTIVE_SOLID_HEATCAPACITY_HH
+
+#include <dumux/discretization/evalsolution.hh>
+
+namespace Dumux
+{
+
+/*!
+ * \ingroup Fluidmatrixinteractions
+ */
+
+/**
+ * \brief Calculates the effective solid heat capacity
+ */
+template<class TypeTag>
+class EffectiveSolidHeatCapacity
+{
+    using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
+    using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
+    using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
+    using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
+    using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
+    using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
+
+    static const int dim = GridView::dimension;
+    static const int dimWorld = GridView::dimensionworld;
+    static const int numComponents = GET_PROP_VALUE(TypeTag, NumComponents);
+    static const int numSolidPhases = GET_PROP_VALUE(TypeTag, NumSPhases);
+
+    using Element = typename GridView::template Codim<0>:: Entity;
+
+public:
+    void init(const SpatialParams& spatialParams)
+    {
+        spatialParamsPtr_ = &spatialParams;
+    }
+
+    // calculates the effective solid heat capacity of multiple solid phases accordin to
+    // their volume fractions
+    Scalar effectiveSolidHeatCapacity(const Element& element,
+                            const SubControlVolume& scv,
+                            const ElementSolution& elemSol) const
+    {
+        auto priVars = evalSolution(element, element.geometry(), elemSol, scv.center());
+
+        Scalar sumPrecipitates = 0.0;
+        Scalar effCp = 0.0;
+        for (unsigned int solidPhaseIdx = 0; solidPhaseIdx < numSolidPhases; ++solidPhaseIdx)
+        {
+            sumPrecipitates += priVars[numComponents + solidPhaseIdx];
+            effCp += priVars[numComponents + solidPhaseIdx]*spatialParams_().solidPhaseHeatCapacity(element, scv, elemSol, solidPhaseIdx);
+        }
+
+        return effCp/sumPrecipitates;
+    }
+
+private:
+    const SpatialParams& spatialParams_() const
+    { return *spatialParamsPtr_; }
+
+    const SpatialParams* spatialParamsPtr_;
+};
+
+} // namespace Dumux
+
+#endif
diff --git a/dumux/material/fluidmatrixinteractions/porosityreactivebed.hh b/dumux/material/fluidmatrixinteractions/porosityreactivebed.hh
index fd0dac0d6a..f9df5f6feb 100644
--- a/dumux/material/fluidmatrixinteractions/porosityreactivebed.hh
+++ b/dumux/material/fluidmatrixinteractions/porosityreactivebed.hh
@@ -24,7 +24,7 @@
 #ifndef DUMUX_POROSITY_REACTIVE_BED_HH
 #define DUMUX_POROSITY_REACTIVE_BED_HH
 
-#include <dumux/discretization/scvoperator.hh>
+#include <dumux/discretization/evalsolution.hh>
 
 namespace Dumux
 {
@@ -42,7 +42,6 @@ class PorosityReactiveBed
     using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
     using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
     using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
-    using ScvOperator = SubControlVolumeOperator<TypeTag>;
 
     static const int dim = GridView::dimension;
     static const int dimWorld = GridView::dimensionworld;
@@ -68,7 +67,7 @@ public:
                             const SubControlVolume& scv,
                             const ElementSolution& elemSol) const
     {
-        auto priVars = ScvOperator::evaluateSolution(element, scv, elemSol);
+        auto priVars = evalSolution(element, element.geometry(), elemSol, scv.center());
 
         Scalar sumPrecipitates = 0.0;
         for (unsigned int solidPhaseIdx = 0; solidPhaseIdx < numSolidPhases; ++solidPhaseIdx)
-- 
GitLab