diff --git a/dumux/common/properties.hh b/dumux/common/properties.hh index ee752d7c6987be2550cbcd0fbd06135a60bf0b98..e67b9a5770fc2af62599aad65be8ba21c6ded0ff 100644 --- a/dumux/common/properties.hh +++ b/dumux/common/properties.hh @@ -68,7 +68,6 @@ NEW_PROP_TAG(LocalResidual); //! TODO: Remove this property as soon as the decoupled models are integrated NEW_PROP_TAG(LinearSolver); - //////////////////////////////////////////////// // Basic properties regarding balance equations ///////////////////////////////////////////////// @@ -77,7 +76,6 @@ NEW_PROP_TAG(UseMoles); //! Property whether to use moles or kg as NEW_PROP_TAG(ReplaceCompEqIdx); //! The component balance index that should be replaced by the total mass/mole balance NEW_PROP_TAG(BalanceEqOpts); //! A class that collects options for the evaluation of the balance equations - ///////////////////////////////////////////// // Properties used by finite volume schemes: ///////////////////////////////////////////// @@ -102,7 +100,6 @@ NEW_PROP_TAG(GlobalFluxVariablesCache); //! The global vector of flux NEW_PROP_TAG(EnableGlobalFluxVariablesCache); //! specifies if data on flux vars should be saved (faster, but more memory consuming) NEW_PROP_TAG(GridVariables); //! The grid variables object managing variable data on the grid (volvars/fluxvars cache) - ///////////////////////////////////////////////////////////////// // Additional properties used by the cell-centered mpfa schemes: ///////////////////////////////////////////////////////////////// @@ -146,10 +143,12 @@ NEW_PROP_TAG(Formulation); //! The formulation of the mo NEW_PROP_TAG(UseConstraintSolver); //! Whether to use a contraint solver for computing the secondary variables NEW_PROP_TAG(UseKelvinEquation); //! If we use Kelvin equation to lower the vapor pressure as a function of capillary pressure, temperature -///////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// // Properties used by models involving mineralization: -///////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// NEW_PROP_TAG(NumSPhases); +NEW_PROP_TAG(NonMineralizationVtkOutputFields); +NEW_PROP_TAG(NonMineralizationVolumeVariables); ///////////////////////////////////////////////////////////// // non-isothermal porous medium flow models @@ -164,7 +163,6 @@ NEW_PROP_TAG(IsothermalNumEq); // or at the scvf center for analytical permeability fields (e.g. convergence studies) NEW_PROP_TAG(EvaluatePermeabilityAtScvfIP); - ////////////////////////////////////////////////////////////// // Additional properties used by the 2pnc and 2pncmin models: ////////////////////////////////////////////////////////////// diff --git a/dumux/porousmediumflow/2pncmin/implicit/CMakeLists.txt b/dumux/porousmediumflow/2pncmin/implicit/CMakeLists.txt index cab7236a264ce428c76e2f4f3455effe392f29f9..46ffae2a1db5dcce92b47a1e9c2a41e672af0e5d 100644 --- a/dumux/porousmediumflow/2pncmin/implicit/CMakeLists.txt +++ b/dumux/porousmediumflow/2pncmin/implicit/CMakeLists.txt @@ -1,11 +1,5 @@ #install headers install(FILES -fluxvariables.hh -indices.hh -localresidual.hh model.hh -properties.hh -propertydefaults.hh -volumevariables.hh DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/porousmediumflow/2pncmin/implicit) diff --git a/dumux/porousmediumflow/2pncmin/implicit/model.hh b/dumux/porousmediumflow/2pncmin/implicit/model.hh index ba8733e74536bd9143bdf7656cc7e8ef0c4c051a..62baac3d5d405d60a05bd7582b9159aec496f41a 100644 --- a/dumux/porousmediumflow/2pncmin/implicit/model.hh +++ b/dumux/porousmediumflow/2pncmin/implicit/model.hh @@ -17,14 +17,106 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ /*! -* \file -* -* \brief Adaption of the fully implicit box scheme to the two-phase n-component flow model. -*/ - + * \file + * + * \ingroup TwoPNCMinModel, Mineralization + * \brief Adaption of the fully implicit scheme to the + * two-phase n-component fully implicit model with additional solid/mineral phases. + * + * This model implements two-phase n-component flow of two compressible and + * partially miscible fluids \f$\alpha \in \{ w, n \}\f$ composed of the n components + * \f$\kappa \in \{ w, n,\cdots \}\f$ in combination with mineral precipitation and dissolution. + * The solid phases. The standard multiphase Darcy + * approach is used as the equation for the conservation of momentum: + * \f[ + v_\alpha = - \frac{k_{r\alpha}}{\mu_\alpha} \mbox{\bf K} + \left(\text{grad}\, p_\alpha - \varrho_{\alpha} \mbox{\bf g} \right) + * \f] + * + * By inserting this into the equations for the conservation of the + * components, one gets one transport equation for each component + * \f{eqnarray} + && \frac{\partial (\sum_\alpha \varrho_\alpha X_\alpha^\kappa \phi S_\alpha )} + {\partial t} + - \sum_\alpha \text{div} \left\{ \varrho_\alpha X_\alpha^\kappa + \frac{k_{r\alpha}}{\mu_\alpha} \mbox{\bf K} + (\text{grad}\, p_\alpha - \varrho_{\alpha} \mbox{\bf g}) \right\} + \nonumber \\ \nonumber \\ + &-& \sum_\alpha \text{div} \left\{{\bf D_{\alpha, pm}^\kappa} \varrho_{\alpha} \text{grad}\, X^\kappa_{\alpha} \right\} + - \sum_\alpha q_\alpha^\kappa = 0 \qquad \kappa \in \{w, a,\cdots \} \, , + \alpha \in \{w, g\} + \f} + * + * The solid or mineral phases are assumed to consist of a single component. + * Their mass balance consist only of a storage and a source term: + * \f$\frac{\partial \varrho_\lambda \phi_\lambda )} {\partial t} + * = q_\lambda\f$ + * + * All equations are discretized using a vertex-centered finite volume (box) + * or cell-centered finite volume scheme as spatial and + * the implicit Euler method as time discretization. + * + * By using constitutive relations for the capillary pressure \f$p_c = + * p_n - p_w\f$ and relative permeability \f$k_{r\alpha}\f$ and taking + * advantage of the fact that \f$S_w + S_n = 1\f$ and \f$X^\kappa_w + X^\kappa_n = 1\f$, the number of + * unknowns can be reduced to number of components. + * + * The used primary variables are, like in the two-phase model, either \f$p_w\f$ and \f$S_n\f$ + * or \f$p_n\f$ and \f$S_w\f$. The formulation which ought to be used can be + * specified by setting the <tt>Formulation</tt> property to either + * TwoPTwoCIndices::pWsN or TwoPTwoCIndices::pNsW. By + * default, the model uses \f$p_w\f$ and \f$S_n\f$. + * + * Moreover, the second primary variable depends on the phase state, since a + * primary variable switch is included. The phase state is stored for all nodes + * of the system. The model is uses mole fractions. + * Following cases can be distinguished: + * <ul> + * <li> Both phases are present: The saturation is used (either \f$S_n\f$ or \f$S_w\f$, dependent on the chosen <tt>Formulation</tt>), + * as long as \f$ 0 < S_\alpha < 1\f$</li>. + * <li> Only wetting phase is present: The mole fraction of, e.g., air in the wetting phase \f$x^a_w\f$ is used, + * as long as the maximum mole fraction is not exceeded (\f$x^a_w<x^a_{w,max}\f$)</li> + * <li> Only non-wetting phase is present: The mole fraction of, e.g., water in the non-wetting phase, \f$x^w_n\f$, is used, + * as long as the maximum mole fraction is not exceeded (\f$x^w_n<x^w_{n,max}\f$)</li> + * </ul> + * + * For the other components, the mole fraction \f$x^\kappa_w\f$ is the primary variable. + * The primary variable of the solid phases is the volume fraction \f$\phi_\lambda = \frac{V_\lambda}{V_{total}}\f$. + * + * The source an sink terms link the mass balances of the n-transported component to the solid phases. + * The porosity \f$\phi\f$ is updated according to the reduction of the initial (or solid-phase-free porous medium) porosity \f$\phi_0\f$ + * by the accumulated volume fractions of the solid phases: + * \f$ \phi = \phi_0 - \sum (\phi_\lambda)\f$ + * Additionally, the permeability is updated depending on the current porosity. + */ #ifndef DUMUX_2PNCMIN_MODEL_HH #define DUMUX_2PNCMIN_MODEL_HH -#include "properties.hh" +#include <dumux/porousmediumflow/2pnc/implicit/properties.hh> +#include <dumux/porousmediumflow/mineralization/model.hh> + +namespace Dumux +{ +namespace Properties +{ +////////////////////////////////////////////////////////////////// +// Type tags +////////////////////////////////////////////////////////////////// +NEW_TYPE_TAG(TwoPNCMin, INHERITS_FROM(TwoPNC, Mineralization)); +NEW_TYPE_TAG(TwoPNCMinNI, INHERITS_FROM(TwoPNCMin, NonIsothermal)); + +////////////////////////////////////////////////////////////////// +// Property tags for the isothermal 2pncmin model +////////////////////////////////////////////////////////////////// +SET_TYPE_PROP(TwoPNCMin, NonMineralizationVolumeVariables, TwoPNCVolumeVariables<TypeTag>); //! the VolumeVariables property +SET_TYPE_PROP(TwoPNCMin, NonMineralizationVtkOutputFields, TwoPNCVtkOutputFields<TypeTag>); //! Set the vtk output fields specific to the TwoPNCMin model + +////////////////////////////////////////////////////////////////// +// Properties for the non-isothermal 2pncmin model +////////////////////////////////////////////////////////////////// +SET_TYPE_PROP(TwoPNCMinNI, IsothermalVolumeVariables, MineralizationVolumeVariables<TypeTag>); //! set isothermal VolumeVariables +SET_TYPE_PROP(TwoPNCMinNI, IsothermalVtkOutputFields, MineralizationVtkOutputFields<TypeTag>); //! set isothermal output fields +} // end namespace Properties +} // end namespace Dumux #endif diff --git a/dumux/porousmediumflow/CMakeLists.txt b/dumux/porousmediumflow/CMakeLists.txt index 33c612c76acfa27cc9f2afaba16c086cf75abfaf..602b161d2cd7cea9d5835beb6a9ed6c3ee36d2ea 100644 --- a/dumux/porousmediumflow/CMakeLists.txt +++ b/dumux/porousmediumflow/CMakeLists.txt @@ -12,6 +12,7 @@ add_subdirectory("co2") add_subdirectory("compositional") add_subdirectory("immiscible") add_subdirectory("implicit") +add_subdirectory("mineralization") add_subdirectory("mpnc") add_subdirectory("nonisothermal") add_subdirectory("richards") diff --git a/dumux/porousmediumflow/compositional/localresidualmin.hh b/dumux/porousmediumflow/compositional/localresidualmin.hh deleted file mode 100644 index 000241d26f4d70474dbaffbc2a4719ee0a6e3cea..0000000000000000000000000000000000000000 --- a/dumux/porousmediumflow/compositional/localresidualmin.hh +++ /dev/null @@ -1,127 +0,0 @@ -// -*- 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 Element-wise calculation of the local residual for problems - * using compositional fully implicit model that also considers solid phases. - */ -#ifndef DUMUX_COMPOSITIONAL_LOCAL_RESIDUAL_MINERAL_HH -#define DUMUX_COMPOSITIONAL_LOCAL_RESIDUAL_MINERAL_HH - -namespace Dumux -{ - -namespace Properties -{ -NEW_PROP_TAG(ReplaceCompEqIdx); -} // end namespace Properties - -/*! - * \ingroup Implicit - * \ingroup ImplicitLocalResidual - * \brief Element-wise calculation of the local residual for problems - * using compositional fully implicit model. - * - */ -template<class TypeTag> -class CompositionalMinLocalResidual: public GET_PROP_TYPE(TypeTag, CompositionalLocalResidual) -{ - using ParentType = typename GET_PROP_TYPE(TypeTag, CompositionalLocalResidual); - using Implementation = typename GET_PROP_TYPE(TypeTag, LocalResidual); - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); - using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); - using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); - using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); - using Indices = typename GET_PROP_TYPE(TypeTag, Indices); - using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using Element = typename GridView::template Codim<0>::Entity; - using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using EnergyLocalResidual = typename GET_PROP_TYPE(TypeTag, EnergyLocalResidual); - using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); - using MolecularDiffusionType = typename GET_PROP_TYPE(TypeTag, MolecularDiffusionType); - - static constexpr int numPhases = GET_PROP_VALUE(TypeTag, NumPhases); - static constexpr int numSPhases = GET_PROP_VALUE(TypeTag, NumSPhases); - static constexpr int numComponents = GET_PROP_VALUE(TypeTag, NumComponents); - static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles); - - enum { conti0EqIdx = Indices::conti0EqIdx }; - - //! The index of the component balance equation that gets replaced with the total mass balance - static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx); - static constexpr bool useTotalMoleOrMassBalance = replaceCompEqIdx < numComponents; - -public: - using ParentType::ParentType; - - /*! - * \brief Evaluate the amount of all conservation quantities - * (e.g. phase mass) within a sub-control volume. - * - * The result should be averaged over the volume (e.g. phase mass - * inside a sub control volume divided by the volume) - * - * \param storage The mass of the component within the sub-control volume - * \param scvIdx The SCV (sub-control-volume) index - * \param usePrevSol Evaluate function with solution of current or previous time step - */ - ResidualVector computeStorage(const Problem& problem, - const SubControlVolume& scv, - const VolumeVariables& volVars) const - { - ResidualVector storage(0.0); - - const auto massOrMoleDensity = [](const auto& volVars, const int phaseIdx) - { return useMoles ? volVars.molarDensity(phaseIdx) : volVars.density(phaseIdx); }; - - const auto massOrMoleFraction= [](const auto& volVars, const int phaseIdx, const int compIdx) - { return useMoles ? volVars.moleFraction(phaseIdx, compIdx) : volVars.massFraction(phaseIdx, compIdx); }; - - // compute storage term of all components within all fluid phases - - ParentType::computeStorage(problem, scv, volVars); - for (int phaseIdx = numPhases; phaseIdx < numPhases + numSPhases; ++phaseIdx) - { - auto eqIdx = conti0EqIdx + numComponents-numPhases + phaseIdx; - storage[eqIdx] += volVars.precipitateVolumeFraction(phaseIdx) - * massOrMoleDensity(volVars, phaseIdx); - } - - return storage; - } - -protected: - Implementation *asImp_() - { return static_cast<Implementation *> (this); } - - const Implementation *asImp_() const - { return static_cast<const Implementation *> (this); } -}; - -} // end namespace Dumux - -#endif diff --git a/dumux/porousmediumflow/mineralization/CMakeLists.txt b/dumux/porousmediumflow/mineralization/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..783fba4a28003d783a5cbfcf732c6acf30a827f6 --- /dev/null +++ b/dumux/porousmediumflow/mineralization/CMakeLists.txt @@ -0,0 +1,7 @@ +#install headers +install(FILES +localresidual.hh +model.hh +volumevariables.hh +vtkoutputfields.hh +DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/porousmediumflow/mineralization) \ No newline at end of file diff --git a/dumux/porousmediumflow/2pncmin/implicit/localresidual.hh b/dumux/porousmediumflow/mineralization/localresidual.hh similarity index 60% rename from dumux/porousmediumflow/2pncmin/implicit/localresidual.hh rename to dumux/porousmediumflow/mineralization/localresidual.hh index 01dce822d5b0c0c439ce2d452ffb5685e92a3025..af85e08c67e8fdc85595081212da7b7eb7aae4ed 100644 --- a/dumux/porousmediumflow/2pncmin/implicit/localresidual.hh +++ b/dumux/porousmediumflow/mineralization/localresidual.hh @@ -19,71 +19,68 @@ /*! * \file * - * \brief Element-wise calculation of the local residual for problems - * using the two-phase n-component mineralisation box model. + * \brief Element-wise calculation of the local residual for problems using a + * compositional fully implicit model that also considers solid phases. */ +#ifndef DUMUX_COMPOSITIONAL_MINERALIZATION_LOCAL_RESIDUAL_HH +#define DUMUX_COMPOSITIONAL_MINERALIZATION_LOCAL_RESIDUAL_HH -#ifndef DUMUX_2PNCMIN_LOCAL_RESIDUAL_HH -#define DUMUX_2PNCMIN_LOCAL_RESIDUAL_HH - -#include "properties.hh" #include <dumux/porousmediumflow/compositional/localresidual.hh> namespace Dumux { /*! - * \ingroup TwoPNCMinModel - * \ingroup ImplicitLocalResidual + * \ingroup Mineralization + * \ingroup LocalResidual * \brief Element-wise calculation of the local residual for problems - * using the two-phase n-component mineralization fully implicit model. - * - * This class is used to fill the gaps in ImplicitLocalResidual for the two-phase n-component flow. + * using a one/two-phase n-component mineralization fully implicit model. */ template<class TypeTag> -class TwoPNCMinLocalResidual : public CompositionalLocalResidual<TypeTag> +class MineralizationLocalResidual: public CompositionalLocalResidual<TypeTag> { using ParentType = CompositionalLocalResidual<TypeTag>; - using ThisType = TwoPNCMinLocalResidual<TypeTag>; - using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); + using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using Indices = typename GET_PROP_TYPE(TypeTag, Indices); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - enum - { - numPhases = GET_PROP_VALUE(TypeTag, NumPhases), - numSPhases = GET_PROP_VALUE(TypeTag, NumSPhases), - numComponents = GET_PROP_VALUE(TypeTag, NumComponents), + static constexpr int numPhases = GET_PROP_VALUE(TypeTag, NumPhases); + static constexpr int numSPhases = GET_PROP_VALUE(TypeTag, NumSPhases); + static constexpr int numComponents = GET_PROP_VALUE(TypeTag, NumComponents); + static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles); - conti0EqIdx = Indices::conti0EqIdx - }; + enum { conti0EqIdx = Indices::conti0EqIdx }; public: using ParentType::ParentType; + /*! - * \brief Evaluate the amount all conservation quantities + * \brief Evaluate the amount of all conservation quantities * (e.g. phase mass) within a sub-control volume. * * The result should be averaged over the volume (e.g. phase mass - * inside a sub control volume divided by the volume). - * In contrast to the 2pnc model, here, the storage of solid phases is included too. + * inside a sub control volume divided by the volume) * - * \param scv the SCV (sub-control-volume) - * \param volVars The volume variables of the right time step + * \param storage The mass of the component within the sub-control volume + * \param scvIdx The SCV (sub-control-volume) index + * \param usePrevSol Evaluate function with solution of current or previous time step */ - PrimaryVariables computeStorage(const Problem& problem, - const SubControlVolume& scv, - const VolumeVariables& volVars) const + ResidualVector computeStorage(const Problem& problem, + const SubControlVolume& scv, + const VolumeVariables& volVars) const { - // call parenttype function auto storage = ParentType::computeStorage(problem, scv, volVars); - // Compute storage term of all solid (precipitated) phases (excluding the non-reactive matrix) + const auto massOrMoleDensity = [](const auto& volVars, const int phaseIdx) + { return useMoles ? volVars.molarDensity(phaseIdx) : volVars.density(phaseIdx); }; + + // compute storage term of all components within all fluid phases for (int phaseIdx = numPhases; phaseIdx < numPhases + numSPhases; ++phaseIdx) { auto eqIdx = conti0EqIdx + numComponents-numPhases + phaseIdx; - storage[eqIdx] += volVars.precipitateVolumeFraction(phaseIdx)*volVars.molarDensity(phaseIdx); + storage[eqIdx] += volVars.precipitateVolumeFraction(phaseIdx) + * massOrMoleDensity(volVars, phaseIdx); } return storage; diff --git a/dumux/porousmediumflow/2pncmin/implicit/properties.hh b/dumux/porousmediumflow/mineralization/model.hh similarity index 56% rename from dumux/porousmediumflow/2pncmin/implicit/properties.hh rename to dumux/porousmediumflow/mineralization/model.hh index 49ebff63c3c27f5771bffdd9f1e3d254d462072c..6ec7775ac48bb21a6d29bebc569b2f78e3e457ea 100644 --- a/dumux/porousmediumflow/2pncmin/implicit/properties.hh +++ b/dumux/porousmediumflow/mineralization/model.hh @@ -1,4 +1,4 @@ -// -**- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// -*- 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. * @@ -17,71 +17,57 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ /*! - * \ingroup Properties - * \ingroup ImplicitProperties - * \ingroup TwoPNCMinModel - * + * \ingroup Mineralization * \file * - * \brief Defines the properties required for the two-phase n-component mineralization - * fully implicit model. + * \brief Defines the properties required for the + * implicit mineralization models. */ -#ifndef DUMUX_2PNCMIN_PROPERTIES_HH -#define DUMUX_2PNCMIN_PROPERTIES_HH -#include <dumux/porousmediumflow/2pnc/implicit/properties.hh> +#ifndef DUMUX_MINERALIZATION_MODEL_HH +#define DUMUX_MINERALIZATION_MODEL_HH +#include <dumux/common/properties.hh> +#include "localresidual.hh" #include "volumevariables.hh" #include "vtkoutputfields.hh" -#include "localresidual.hh" -namespace Dumux -{ - -namespace Properties -{ +namespace Dumux { +namespace Properties { ////////////////////////////////////////////////////////////////// // Type tags ////////////////////////////////////////////////////////////////// -NEW_TYPE_TAG(TwoPNCMin, INHERITS_FROM(TwoPNC)); -NEW_TYPE_TAG(TwoPNCMinNI, INHERITS_FROM(TwoPNCMin, TwoPNCNI, NonIsothermal)); +NEW_TYPE_TAG(Mineralization); -////////////////////////////////////////////////////////////////// -// Property tags for the isothermal 2pncmin model -////////////////////////////////////////////////////////////////// +//! Set the general mineralization volume variables +SET_TYPE_PROP(Mineralization, VolumeVariables, MineralizationVolumeVariables<TypeTag>); + +//! Set the general mineralization compositional local residual +SET_TYPE_PROP(Mineralization, LocalResidual, MineralizationLocalResidual<TypeTag>); -SET_TYPE_PROP(TwoPNCMin, VolumeVariables, TwoPNCMinVolumeVariables<TypeTag>); //! the VolumeVariables property -SET_TYPE_PROP(TwoPNCMin, VtkOutputFields, TwoPNCMinVtkOutputFields<TypeTag>); //! Set the vtk output fields specific to the TwoPNCMin model -SET_TYPE_PROP(TwoPNCMin, LocalResidual, TwoPNCMinLocalResidual<TypeTag>); //! Use the compositional local residual +//! VTK outputs for mineralization models +SET_TYPE_PROP(Mineralization, VtkOutputFields, MineralizationVtkOutputFields<TypeTag>); //! Set the property for the number of solid phases, excluding the non-reactive matrix. -SET_PROP(TwoPNCMin, NumSPhases) +SET_PROP(Mineralization, NumSPhases) { private: using FluidSystem = typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)); - public: static const int value = FluidSystem::numSPhases; }; //! Set the property for the number of equations. For each component and each //precipitated mineral/solid phase one equation has to be solved. - -SET_PROP(TwoPNCMin, NumEq) +SET_PROP(Mineralization, NumEq) { private: using FluidSystem = typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)); - public: static const int value = FluidSystem::numComponents + FluidSystem::numSPhases; }; -///////////////////////////////////////////////// -// Properties for the non-isothermal 2pncmin model -///////////////////////////////////////////////// -SET_TYPE_PROP(TwoPNCMinNI, IsothermalVolumeVariables, TwoPNCMinVolumeVariables<TypeTag>); //! set isothermal VolumeVariables -SET_TYPE_PROP(TwoPNCMinNI, IsothermalVtkOutputFields, TwoPNCMinVtkOutputFields<TypeTag>); //! set isothermal output fields -} -} +} // end namespace Properties +} // end namespace Dumux #endif diff --git a/dumux/porousmediumflow/2pncmin/implicit/volumevariables.hh b/dumux/porousmediumflow/mineralization/volumevariables.hh similarity index 71% rename from dumux/porousmediumflow/2pncmin/implicit/volumevariables.hh rename to dumux/porousmediumflow/mineralization/volumevariables.hh index 2a6bc33a3a6dc1c7ec86be78bd61aa9e6836d0f0..adc516930a43f36476a968be7bab12c9998a3a6c 100644 --- a/dumux/porousmediumflow/2pncmin/implicit/volumevariables.hh +++ b/dumux/porousmediumflow/mineralization/volumevariables.hh @@ -22,88 +22,48 @@ * \brief Contains the quantities which are constant within a * finite volume in the two-phase, n-component mineralization model. */ -#ifndef DUMUX_2PNCMIN_VOLUME_VARIABLES_HH -#define DUMUX_2PNCMIN_VOLUME_VARIABLES_HH +#ifndef DUMUX_MINERALIZATION_VOLUME_VARIABLES_HH +#define DUMUX_MINERALIZATION_VOLUME_VARIABLES_HH #include <dumux/common/math.hh> #include <dumux/material/fluidstates/compositional.hh> #include <dumux/discretization/volumevariables.hh> -#include <dumux/porousmediumflow/2pnc/implicit/volumevariables.hh> -#include "properties.hh" +#include "model.hh" namespace Dumux { /*! - * \ingroup TwoPNCMinModel + * \ingroup Mineralization * \ingroup ImplicitVolumeVariables * \brief Contains the quantities which are are constant within a - * finite volume in the two-phase, n-component model. + * finite volume in a mineralization n-component model. */ template <class TypeTag> -class TwoPNCMinVolumeVariables : public TwoPNCVolumeVariables<TypeTag> +class MineralizationVolumeVariables : public GET_PROP_TYPE(TypeTag, NonMineralizationVolumeVariables) { - // base type is used for energy related quantities - using BaseType = ImplicitVolumeVariables<TypeTag>; - - using ParentType = TwoPNCVolumeVariables<TypeTag>; - using Implementation = typename GET_PROP_TYPE(TypeTag, VolumeVariables); + using ParentType = typename GET_PROP_TYPE(TypeTag, NonMineralizationVolumeVariables); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); - using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); using MaterialLawParams = typename GET_PROP_TYPE(TypeTag, MaterialLaw)::Params; - using Indices = typename GET_PROP_TYPE(TypeTag, Indices); + using Element = typename GridView::template Codim<0>::Entity; enum { - dim = GridView::dimension, dimWorld=GridView::dimensionworld, numPhases = GET_PROP_VALUE(TypeTag, NumPhases), numSPhases = GET_PROP_VALUE(TypeTag, NumSPhases), numComponents = GET_PROP_VALUE(TypeTag, NumComponents), - numMajorComponents = GET_PROP_VALUE(TypeTag, NumMajorComponents), - - // formulations - formulation = GET_PROP_VALUE(TypeTag, Formulation), - pwsn = TwoPNCFormulation::pwsn, - pnsw = TwoPNCFormulation::pnsw, - - // phase indices - wPhaseIdx = FluidSystem::wPhaseIdx, - nPhaseIdx = FluidSystem::nPhaseIdx, - - // component indices - wCompIdx = FluidSystem::wCompIdx, - nCompIdx = FluidSystem::nCompIdx, - - // phase presence enums - nPhaseOnly = Indices::nPhaseOnly, - wPhaseOnly = Indices::wPhaseOnly, - bothPhases = Indices::bothPhases, - - // primary variable indices - pressureIdx = Indices::pressureIdx, - switchIdx = Indices::switchIdx, - }; - using Element = typename GridView::template Codim<0>::Entity; - using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; - using CoordScalar = typename Grid::ctype; - using Miscible2pNCComposition = Dumux::Miscible2pNCComposition<Scalar, FluidSystem>; - using ComputeFromReferencePhase = Dumux::ComputeFromReferencePhase<Scalar, FluidSystem>; - public: - using FluidState = typename GET_PROP_TYPE(TypeTag, FluidState); /*! @@ -151,6 +111,7 @@ public: else return FluidSystem::precipitateDensity(phaseIdx); } + /*! * \brief Returns the mass density of a given phase within the * control volume. @@ -183,18 +144,9 @@ public: } protected: - Scalar precipitateVolumeFraction_[numSPhases]; Scalar sumPrecipitates_; - -private: - Implementation &asImp_() - { return *static_cast<Implementation*>(this); } - - const Implementation &asImp_() const - { return *static_cast<const Implementation*>(this); } }; - -} // end namespace +} // end namespace Dumux #endif diff --git a/dumux/porousmediumflow/2pncmin/implicit/vtkoutputfields.hh b/dumux/porousmediumflow/mineralization/vtkoutputfields.hh similarity index 82% rename from dumux/porousmediumflow/2pncmin/implicit/vtkoutputfields.hh rename to dumux/porousmediumflow/mineralization/vtkoutputfields.hh index c0f7e9ba4ff20b514d04b108b31c41712bfd5e28..70e7a2acf59115a6d72e5d978f60b4500d947d54 100644 --- a/dumux/porousmediumflow/2pncmin/implicit/vtkoutputfields.hh +++ b/dumux/porousmediumflow/mineralization/vtkoutputfields.hh @@ -20,21 +20,22 @@ * \file * \brief Adds vtk output fields specific to the twop-nc-min model */ -#ifndef DUMUX_TWOP_NC_MIN_VTK_OUTPUT_FIELDS_HH -#define DUMUX_TWOP_NC_MIN_VTK_OUTPUT_FIELDS_HH +#ifndef DUMUX_MINERALIZATION_VTK_OUTPUT_FIELDS_HH +#define DUMUX_MINERALIZATION_VTK_OUTPUT_FIELDS_HH -#include <dumux/porousmediumflow/2pnc/implicit/vtkoutputfields.hh> +#include <dumux/common/properties.hh> namespace Dumux { /*! - * \ingroup TwoPNCMin, InputOutput - * \brief Adds vtk output fields specific to the TwoPNCMin model + * \ingroup Mineralization, InputOutput + * \brief Adds vtk output fields specific to the a NCMin model */ template<class TypeTag> -class TwoPNCMinVtkOutputFields +class MineralizationVtkOutputFields { + using NonMineralizationVtkOutputFields = typename GET_PROP_TYPE(TypeTag, NonMineralizationVtkOutputFields); using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); @@ -45,10 +46,9 @@ public: template <class VtkOutputModule> static void init(VtkOutputModule& vtk) { - // use default fields from the 2pnc model - TwoPNCVtkOutputFields<TypeTag>::init(vtk); + NonMineralizationVtkOutputFields::init(vtk); - //output additional to TwoPNC output: + //additional output for (int i = 0; i < numSPhases; ++i) { vtk.addVolumeVariable([i](const VolumeVariables& v){ return v.precipitateVolumeFraction(numPhases + i); },"precipVolFrac_"+ FluidSystem::phaseName(numPhases + i));