diff --git a/dumux/porousmediumflow/1pncmin/CMakeLists.txt b/dumux/porousmediumflow/1pncmin/CMakeLists.txt index ba8341c614f1a2c797c95f5402f602025f1087b1..ab30ea48ad5fc66344119e28c62702c46398beac 100644 --- a/dumux/porousmediumflow/1pncmin/CMakeLists.txt +++ b/dumux/porousmediumflow/1pncmin/CMakeLists.txt @@ -1 +1,4 @@ -add_subdirectory("implicit") +#install headers +install(FILES +model.hh +DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/porousmediumflow/1pncmin) diff --git a/dumux/porousmediumflow/1pncmin/implicit/CMakeLists.txt b/dumux/porousmediumflow/1pncmin/implicit/CMakeLists.txt deleted file mode 100644 index 92b891fb7b3bb441e5aa3782a82906e0b3855431..0000000000000000000000000000000000000000 --- a/dumux/porousmediumflow/1pncmin/implicit/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ - -#install headers -install(FILES -indices.hh -localresidual.hh -model.hh -properties.hh -propertydefaults.hh -volumevariables.hh -DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/porousmediumflow/1pncmin/implicit) diff --git a/dumux/porousmediumflow/1pncmin/implicit/indices.hh b/dumux/porousmediumflow/1pncmin/implicit/indices.hh deleted file mode 100644 index 8894bfef03ed936dcccad47de43a123b2b8cc932..0000000000000000000000000000000000000000 --- a/dumux/porousmediumflow/1pncmin/implicit/indices.hh +++ /dev/null @@ -1,46 +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 Defines the indices required for the one-phase n-component mineralization - * fully implicit model. - */ -#ifndef DUMUX_1PNCMIN_INDICES_HH -#define DUMUX_1PNCMIN_INDICES_HH - -#include <dumux/porousmediumflow/1pnc/indices.hh> - -namespace Dumux -{ -/*! - * \ingroup OnePNCMinModel - * \ingroup ImplicitIndices - * \brief The indices for the isothermal one-phase n-component mineralization model. - * - * \tparam PVOffset The first index in a primary variable vector. - */ -template <class TypeTag, int PVOffset = 0> - class OnePNCMinIndices: public OnePNCIndices<TypeTag, PVOffset> -{ -}; - -} - -#endif diff --git a/dumux/porousmediumflow/1pncmin/implicit/localresidual.hh b/dumux/porousmediumflow/1pncmin/implicit/localresidual.hh deleted file mode 100644 index a42f7cae9e72eb8d47e582e7e4b26e7a68a950a6..0000000000000000000000000000000000000000 --- a/dumux/porousmediumflow/1pncmin/implicit/localresidual.hh +++ /dev/null @@ -1,102 +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 Jacobian matrix for problems - * using the one-phase n-component mineralisation model. - */ - -#ifndef DUMUX_1PNCMIN_LOCAL_RESIDUAL_BASE_HH -#define DUMUX_1PNCMIN_LOCAL_RESIDUAL_BASE_HH - -#include "properties.hh" -#include <dumux/porousmediumflow/compositional/localresidual.hh> - -namespace Dumux -{ -/*! - * \ingroup OnePNCMinModel - * \ingroup ImplicitLocalResidual - * \brief Element-wise calculation of the Jacobian matrix for problems - * using the one-phase n-component mineralization fully implicit model. - * - * This class is used to fill the gaps in ImplicitLocalResidual for the one-phase n-component flow. - */ -template<class TypeTag> -class OnePNCMinLocalResidual: public CompositionalLocalResidual<TypeTag> -{ -protected: - using ParentType = CompositionalLocalResidual<TypeTag>; - using ThisType = OnePNCMinLocalResidual<TypeTag>; - using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); - using Indices = typename GET_PROP_TYPE(TypeTag, Indices); - - using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); - using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - - enum - { - numEq = GET_PROP_VALUE(TypeTag, NumEq), - numPhases = GET_PROP_VALUE(TypeTag, NumPhases), - numSPhases = GET_PROP_VALUE(TypeTag, NumSPhases), - numComponents = GET_PROP_VALUE(TypeTag, NumComponents), - - pressureIdx = Indices::pressureIdx, - firstMoleFracIdx = Indices::firstMoleFracIdx, - - phaseIdx = Indices::phaseIdx, - sPhaseIdx = 1, // don't use the sPhaseIdx of the fluidsystem - - conti0EqIdx = Indices::conti0EqIdx, - }; - - -public: - /*! - * \brief Evaluate the amount 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 1pnc model, here, the storage of solid phases is included too. - * - * \param scv the SCV (sub-control-volume) - * \param volVars The volume variables of the right time step - */ - PrimaryVariables computeStorage(const SubControlVolume& scv, - const VolumeVariables& volVars) const - { - //call parenttype function - auto storage = ParentType::computeStorage(scv, volVars); - - // Compute storage term of all solid (precipitated) phases (excluding the non-reactive matrix) - for (int Idx = sPhaseIdx; Idx < numPhases + numSPhases; ++Idx) - { - auto eqIdx = conti0EqIdx + numComponents-numPhases + Idx; - storage[eqIdx] += volVars.precipitateVolumeFraction(Idx)*volVars.molarDensity(Idx); - } - - return storage; - } -}; - -} // end namespace Dumux - -#endif diff --git a/dumux/porousmediumflow/1pncmin/implicit/model.hh b/dumux/porousmediumflow/1pncmin/implicit/model.hh deleted file mode 100644 index 481a07110c1d6ea218dcc696fe4963123e030582..0000000000000000000000000000000000000000 --- a/dumux/porousmediumflow/1pncmin/implicit/model.hh +++ /dev/null @@ -1,215 +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 Adaption of the fully implicit box scheme to the two-phase n-component flow model. -*/ - -#ifndef DUMUX_1PNCMIN_MODEL_HH -#define DUMUX_1PNCMIN_MODEL_HH - -#include "properties.hh" -#include "indices.hh" -#include "localresidual.hh" - -#include <dumux/porousmediumflow/1pnc/model.hh> - -namespace Dumux -{ -/*! - * \ingroup OnePNCMinModel - * \brief Adaption of the fully implicit scheme to the - * one-phase n-component fully implicit model with additional solid/mineral phases. - * - * This model implements one-phase n-component flow of a compressible fluid composed of - * the n components \f$\kappa \f$ in combination with mineral precipitation and dissolution - * of the solid phases. The standard multiphase Darcy - * approach is used as the equation for the conservation of momentum: - * \f[ - v = - \frac{k_{r}}{\mu} \mbox{\bf K} - \left(\text{grad}\, p - \varrho_{f} \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 ( \varrho_f X^\kappa \phi )} - {\partial t} - \text{div} \left\{ \varrho_f X^\kappa - \frac{k_{r}}{\mu} \mbox{\bf K} - (\text{grad}\, p - \varrho_{f} \mbox{\bf g}) \right\} - \nonumber \\ \nonumber \\ - &-& \text{div} \left\{{\bf D_{pm}^\kappa} \varrho_{f} \text{grad}\, X^\kappa \right\} - - q_\kappa = 0 \qquad \kappa \in \{w, a,\cdots \} - \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. - * - * The primary variables are the pressure \f$p\f$ and the mole fractions of the - * dissolved components \f$x^k\f$. 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. - */ - -template<class TypeTag> -class OnePNCMinModel: public OnePNCModel<TypeTag> -{ - using ThisType = Dumux::OnePNCMinModel<TypeTag>; - using ParentType = Dumux::OnePNCModel<TypeTag>; - - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using Indices = typename GET_PROP_TYPE(TypeTag, Indices); - - 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), - numSComponents = FluidSystem::numSComponents, - - pressureIdx = Indices::pressureIdx, - firstMoleFracIdx = Indices::firstMoleFracIdx, - - phaseIdx = Indices::phaseIdx, - }; - - using Element = typename GridView::template Codim<0>::Entity; - using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; - using CoordScalar = typename GridView::ctype; - using Tensor = Dune::FieldMatrix<CoordScalar, dimWorld, dimWorld>; - - enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) }; - enum { dofCodim = isBox ? dim : 0 }; - -public: - - /*! - * \brief Apply the initial conditions to the model. - * - * \param problem The object representing the problem which needs to - * be simulated. - */ - void init(Problem& problem) - { - ParentType::init(problem); - - // register standardized vtk output fields - auto& vtkOutputModule = problem.vtkOutputModule(); - - vtkOutputModule.addSecondaryVariable("Kxx", - [this](const VolumeVariables& v){ return this->perm_(v.permeability())[0][0]; }); - if (dim >= 2) - vtkOutputModule.addSecondaryVariable("Kyy", - [this](const VolumeVariables& v){ return this->perm_(v.permeability())[1][1]; }); - if (dim >= 3) - vtkOutputModule.addSecondaryVariable("Kzz", - [this](const VolumeVariables& v){ return this->perm_(v.permeability())[2][2]; }); - - vtkOutputModule.addSecondaryVariable("permeabilityFactor", [](const VolumeVariables& v) - { return v.permeabilityFactor(); }); - - - for (int sPhaseIdx = 0; sPhaseIdx < numSPhases; ++sPhaseIdx) - vtkOutputModule.addSecondaryVariable("precipitateVolumeFraction_" + FluidSystem::phaseName(numPhases + sPhaseIdx), - [sPhaseIdx](const VolumeVariables& v) - { return v.precipitateVolumeFraction(numPhases + sPhaseIdx); }); - } - - - /*! - * \brief Write the current solution to a restart file. - * - * \param outStream The output stream of one entity for the restart file - * \param entity The entity, either a vertex or an element - */ - template<class Entity> - void serializeEntity(std::ostream &outStream, const Entity &entity) - { - // write primary variables - ParentType::serializeEntity(outStream, entity); - - int dofIdxGlobal = this->dofMapper().index(entity); - - if (!outStream.good()) - DUNE_THROW(Dune::IOError, "Could not serialize entity " << dofIdxGlobal); - - } - - /*! - * \brief Reads the current solution from a restart file. - * - * \param inStream The input stream of one entity from the restart file - * \param entity The entity, either a vertex or an element - */ - template<class Entity> - void deserializeEntity(std::istream &inStream, const Entity &entity) - { - // read primary variables - ParentType::deserializeEntity(inStream, entity); - - // read phase presence - int dofIdxGlobal = this->dofMapper().index(entity); - - if (!inStream.good()) - DUNE_THROW(Dune::IOError, "Could not deserialize entity " << dofIdxGlobal); - } - -private: - - Tensor perm_(Scalar perm) const - { - Tensor K(0.0); - - for(int i=0; i<dimWorld; i++) - K[i][i] = perm; - - return K; - } - - const Tensor& perm_(const Tensor& perm) const - { - return perm; - } -}; - -} // end namespace Dumux - -#include "propertydefaults.hh" - -#endif diff --git a/dumux/porousmediumflow/1pncmin/implicit/properties.hh b/dumux/porousmediumflow/1pncmin/implicit/properties.hh deleted file mode 100644 index 5c71e80313d5830c083c60ba30511bc0bb31f83c..0000000000000000000000000000000000000000 --- a/dumux/porousmediumflow/1pncmin/implicit/properties.hh +++ /dev/null @@ -1,67 +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/>. * - *****************************************************************************/ -/*! - * \ingroup Properties - * \ingroup ImplicitProperties - * \ingroup OnePNCMinModel - * - * \file - * - * \brief Defines the properties required for the one-phase n-component mineralization - * fully implicit model. - */ -#ifndef DUMUX_1PNCMIN_PROPERTIES_HH -#define DUMUX_1PNCMIN_PROPERTIES_HH - -#include <dumux/porousmediumflow/1pnc/model.hh> - -namespace Dumux { -namespace Properties { - -////////////////////////////////////////////////////////////////// -// Type tags -////////////////////////////////////////////////////////////////// - -//! The type tag for the isothermal two phase n component mineralisation problems -NEW_TYPE_TAG(OnePNCMin, INHERITS_FROM(OnePNC)); -NEW_TYPE_TAG(BoxOnePNCMin, INHERITS_FROM(BoxModel, OnePNCMin)); -NEW_TYPE_TAG(CCOnePNCMin, INHERITS_FROM(CCModel, OnePNCMin)); - -//! The type tags for the corresponding non-isothermal problems -NEW_TYPE_TAG(OnePNCMinNI, INHERITS_FROM(OnePNCMin, NonIsothermal)); -NEW_TYPE_TAG(BoxOnePNCMinNI, INHERITS_FROM(BoxModel, OnePNCMinNI)); -NEW_TYPE_TAG(CCOnePNCMinNI, INHERITS_FROM(CCModel, OnePNCMinNI)); - -////////////////////////////////////////////////////////////////// -// Property tags -////////////////////////////////////////////////////////////////// - -NEW_PROP_TAG(NumSPhases); //!< Number of solid phases in the system -NEW_PROP_TAG(NumFSPhases); //!< Number of fluid and solid phases in the system -NEW_PROP_TAG(NumSComponents); //!< Number of solid components in the system -NEW_PROP_TAG(NumPSComponents); //!< Number of fluid and solid components in the system -NEW_PROP_TAG(NumTraceComponents); //!< Number of trace fluid components which are not considered in the calculation of the phase density -NEW_PROP_TAG(NumSecComponents); //!< Number of secondary components which are not primary variables -NEW_PROP_TAG(OnePNCMinIndices); //!< Enumerations for the 2pncMin models -NEW_PROP_TAG(SpatialParamsForchCoeff); //!< Property for the forchheimer coefficient - -} -} - -#endif diff --git a/dumux/porousmediumflow/1pncmin/implicit/propertydefaults.hh b/dumux/porousmediumflow/1pncmin/implicit/propertydefaults.hh deleted file mode 100644 index ae1f2456db19fd49505fb757ebcd775bb2ce6485..0000000000000000000000000000000000000000 --- a/dumux/porousmediumflow/1pncmin/implicit/propertydefaults.hh +++ /dev/null @@ -1,158 +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/>. * - *****************************************************************************/ -/*! - * \ingroup Properties - * \ingroup ImplicitProperties - * \ingroup OnePNCMinModel - * \file - * - * \brief Defines default values for most properties required by the - * two-phase n-component mineralization fully implicit model. - */ -#ifndef DUMUX_1PNCMIN_PROPERTY_DEFAULTS_HH -#define DUMUX_1PNCMIN_PROPERTY_DEFAULTS_HH - -#include "model.hh" -#include "indices.hh" -#include "volumevariables.hh" -#include "properties.hh" - -#include <dumux/porousmediumflow/nonisothermal/model.hh> -#include <dumux/porousmediumflow/implicit/darcyfluxvariables.hh> -#include <dumux/material/spatialparams/fv1p.hh> -#include <dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh> - -namespace Dumux -{ - -namespace Properties { -////////////////////////////////////////////////////////////////// -// Property values -////////////////////////////////////////////////////////////////// - - -SET_PROP(OnePNCMin, NumSComponents) -{ -private: - using FluidSystem = typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)); -public: - static const int value = FluidSystem::numSComponents; -}; -/*! - * \brief Set the property for the number of solid phases, excluding the non-reactive matrix. - * - * We just forward the number from the fluid system - * - */ -SET_PROP(OnePNCMin, NumSPhases) -{ -private: - using FluidSystem = typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)); - -public: - static const int value = FluidSystem::numSPhases; -}; - -/*! - * \brief 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(OnePNCMin, NumEq) -{ -private: - using FluidSystem = typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)); - -public: - static const int value = FluidSystem::numComponents + FluidSystem::numSComponents; //steamaircao2h2 has 2 components in the fluidphase -}; - -/*! - * \brief The fluid state which is used by the volume variables to - * store the thermodynamic state. This should be chosen - * appropriately for the model ((non-)isothermal, equilibrium, ...). - * This can be done in the problem. - */ -SET_PROP(OnePNCMin, FluidState){ - private: - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); - public: - using type = CompositionalFluidState<Scalar, FluidSystem>; -}; - -//! Use the 2pncmin local residual operator -SET_TYPE_PROP(OnePNCMin, - LocalResidual, - OnePNCMinLocalResidual<TypeTag>); - -//! the Model property -SET_TYPE_PROP(OnePNCMin, Model, OnePNCMinModel<TypeTag>); - -//! the VolumeVariables property -SET_TYPE_PROP(OnePNCMin, VolumeVariables, OnePNCMinVolumeVariables<TypeTag>); - -//! The indices required by the isothermal 2pNcMin model -SET_TYPE_PROP(OnePNCMin, Indices, OnePNCMinIndices <TypeTag, /*PVOffset=*/0>); - -//set isothermal VolumeVariables -SET_TYPE_PROP(OnePNCMin, IsothermalVolumeVariables, OnePNCMinVolumeVariables<TypeTag>); - -//! Somerton is used as default model to compute the effective thermal heat conductivity -SET_PROP(OnePNCMinNI, ThermalConductivityModel) -{ -private: - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using Indices = typename GET_PROP_TYPE(TypeTag, Indices); -public: - using type = ThermalConductivityAverage<Scalar>; -}; - - -SET_BOOL_PROP(OnePNCMinNI, NiOutputLevel, 0); - -////////////////////////////////////////////////////////////////// -// Property values for isothermal model required for the general non-isothermal model -////////////////////////////////////////////////////////////////// - -// set isothermal Model -SET_TYPE_PROP(OnePNCMinNI, IsothermalModel, OnePNCMinModel<TypeTag>); - -//set isothermal VolumeVariables -SET_TYPE_PROP(OnePNCMinNI, IsothermalVolumeVariables, OnePNCMinVolumeVariables<TypeTag>); - -//set isothermal LocalResidual -SET_TYPE_PROP(OnePNCMinNI, IsothermalLocalResidual, OnePNCMinLocalResidual<TypeTag>); - -//set isothermal Indices -SET_TYPE_PROP(OnePNCMinNI, IsothermalIndices, OnePNCMinIndices<TypeTag, /*PVOffset=*/0>); - -//set isothermal NumEq -SET_PROP(OnePNCMinNI, IsothermalNumEq) -{ -private: - using FluidSystem = typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)); - -public: - static const int value = FluidSystem::numComponents +FluidSystem::numSComponents;// in NonIsothermal 1 is substracted by default -}; -} -} - -#endif diff --git a/dumux/porousmediumflow/1pncmin/implicit/volumevariables.hh b/dumux/porousmediumflow/1pncmin/implicit/volumevariables.hh deleted file mode 100644 index 2a978b36918c48331943d37a570dd23d55aa1586..0000000000000000000000000000000000000000 --- a/dumux/porousmediumflow/1pncmin/implicit/volumevariables.hh +++ /dev/null @@ -1,326 +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 Contains the quantities which are constant within a - * finite volume in the two-phase, n-component mineralization model. - */ -#ifndef DUMUX_1PNCMIN_VOLUME_VARIABLES_HH -#define DUMUX_1PNCMIN_VOLUME_VARIABLES_HH - - -#include <dumux/common/math.hh> -#include <dumux/implicit/model.hh> -#include <dumux/material/fluidstates/compositional.hh> -#include <dumux/porousmediumflow/1pnc/volumevariables.hh> - -#include "properties.hh" -#include "indices.hh" - -namespace Dumux -{ - -/*! - * \ingroup OnePNCMinModel - * \ingroup ImplicitVolumeVariables - * \brief Contains the quantities which are are constant within a - * finite volume in the two-phase, n-component model. - */ -template <class TypeTag> -class OnePNCMinVolumeVariables : public OnePNCVolumeVariables<TypeTag> -{ - // base type is used for energy related quantites - using BaseType = ImplicitVolumeVariables<TypeTag>; - - using ParentType = OnePNCVolumeVariables<TypeTag>; - using Implementation = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - 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 Indices = typename GET_PROP_TYPE(TypeTag, Indices); - - 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), - numSComponents = GET_PROP_VALUE(TypeTag, NumSComponents), //if there is more than 1 component in the solid phase - - phaseCompIdx = Indices::phaseCompIdx, - - // phase indices - phaseIdx = FluidSystem::gPhaseIdx, - cPhaseIdx = Indices::phaseIdx +1, - hPhaseIdx = Indices::phaseIdx +2, - - // primary variable indices - pressureIdx = Indices::pressureIdx, - firstMoleFracIdx = Indices::firstMoleFracIdx, - - }; - - using Element = typename GridView::template Codim<0>::Entity; - using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; - using CoordScalar = typename Grid::ctype; - - enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) }; - enum { dofCodim = isBox ? dim : 0 }; - -public: - - using FluidState = typename GET_PROP_TYPE(TypeTag, FluidState); - - /*! - * \copydoc ImplicitVolumeVariables::update - */ - void update(const ElementSolutionVector &elemSol, - const Problem &problem, - const Element &element, - const SubControlVolume& scv) - { - ParentType::update(elemSol, problem, element, scv); - - // calculate the remaining quantities - auto&& priVars = isBox ? elemSol[scv.index()] : elemSol[0]; - - // porosity evaluation - initialPorosity_ = problem.spatialParams().initialPorosity(element, scv); - - sumPrecipitates_ = 0.0; - for(int sPhaseIdx = 0; sPhaseIdx < numSPhases; ++sPhaseIdx) - { - precipitateVolumeFraction_[sPhaseIdx] = priVars[numComponents + sPhaseIdx]; - sumPrecipitates_+= precipitateVolumeFraction_[sPhaseIdx]; - - } - - // energy related quantities not contained in the fluid state - asImp_().updateEnergy_(elemSol, problem, element, scv); - } - - /*! - * \copydoc ImplicitModel::completeFluidState - * \param isOldSol Specifies whether this is the previous solution or the current one - */ - static void completeFluidState(const ElementSolutionVector& elemSol, - const Problem& problem, - const Element& element, - const SubControlVolume& scv, - FluidState& fluidState) - - { - Scalar t = BaseType::temperature(elemSol, problem, element, scv); - fluidState.setTemperature(t); - - // set the saturations - fluidState.setSaturation(phaseIdx, 1.0 ); - - // set the pressures of the fluid phase - const auto& priVars = ParentType::extractDofPriVars(elemSol, scv); - fluidState.setPressure(phaseIdx, priVars[pressureIdx]); - - // calculate the phase compositions - typename FluidSystem::ParameterCache paramCache; - - Dune::FieldVector<Scalar, numComponents> moleFrac; - - Scalar sumMoleFracNotWater = 0; - for (int compIdx=firstMoleFracIdx; compIdx<numComponents; ++compIdx) - { - moleFrac[compIdx] = priVars[compIdx]; - sumMoleFracNotWater+=moleFrac[compIdx]; - } - - moleFrac[0] = 1 -sumMoleFracNotWater; - - // convert mass to mole fractions and set the fluid state - for (int compIdx=0; compIdx<numComponents; ++compIdx) - { - fluidState.setMoleFraction(phaseIdx, compIdx, moleFrac[compIdx]); - } - - paramCache.updateAll(fluidState); - - Scalar h = BaseType::enthalpy(fluidState, paramCache, phaseIdx); - fluidState.setEnthalpy(phaseIdx, h); - } - /*! - * \brief Returns the volume fraction of the precipitate (solid phase) - * for the given phaseIdx - * - * \param phaseIdx the index of the solid phase - */ - Scalar precipitateVolumeFraction(int phaseIdx) const - { - return precipitateVolumeFraction_[phaseIdx - numPhases]; - } - - /*! - * \brief Returns the inital porosity of the - * pure, precipitate-free porous medium - */ - Scalar initialPorosity() const - { return initialPorosity_;} - - /*! - * \brief Returns the inital permeability of the - * pure, precipitate-free porous medium - */ - Scalar initialPermeability() const - { return initialPermeability_;} - - /*! - * \brief Returns the factor for the reduction of the initial permeability - * due precipitates in the porous medium - */ - Scalar permeabilityFactor() const - { return permeabilityFactor_; } - - /*! - * \brief Returns the density of the phase for all fluid and solid phases - * - * \param phaseIdx the index of the fluid phase - */ - Scalar density(int phaseIdx) const - { - if (phaseIdx <= numPhases) - return this->fluidState_.density(phaseIdx); - else if (phaseIdx > numPhases) - return FluidSystem::precipitateDensity(phaseIdx); - else - DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx); - } - /*! - * \brief Returns the mass density of a given phase within the - * control volume. - * - * \param phaseIdx The phase index - */ - Scalar molarDensity(int phaseIdx) const - { - if (phaseIdx < 1) - return this->fluidState_.molarDensity(phaseIdx); - else if (phaseIdx >= 1){ - //Attention: sPhaseIdx of the fluidsystem and the model can be different. - return FluidSystem::precipitateMolarDensity(phaseIdx); - } - else - DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx); - } - - /*! - * \brief Returns the molality of a component in the phase - * - * \param phaseIdx the index of the fluid phase - * \param compIdx the index of the component - * \f$\mathrm{molality}=\frac{n_\mathrm{component}}{m_\mathrm{solvent}} - * =\frac{n_\mathrm{component}}{n_\mathrm{solvent}*M_\mathrm{solvent}}\f$ - * compIdx of the main component (solvent) in the - * phase is equal to the phaseIdx - */ - Scalar molality(int phaseIdx, int compIdx) const // [moles/Kg] - { return this->fluidState_.moleFraction(phaseIdx, compIdx) - /(this->fluidState_.moleFraction(phaseIdx, phaseIdx) - * FluidSystem::molarMass(phaseIdx));} - - /*! - * Circumvents the inheritance architecture of the nonisothermal model - */ - static Scalar callProtectedTemperature(const ElementSolutionVector& elemSol, - const Problem& problem, - const Element& element, - const SubControlVolume& scv) - { - return BaseType::temperature(elemSol, problem, element, scv); - } - - /*! - * Circumvents the inheritance architecture of the ninisothermal model - */ - void callProtectedUpdateEnergy(const ElementSolutionVector& elemSol, - const Problem& problem, - const Element& element, - const SubControlVolume& scv) - { - asImp_().updateEnergy_(elemSol, problem, element, scv); - }; - -protected: - friend class OnePNCVolumeVariables<TypeTag>; - static Scalar temperature_(const ElementSolutionVector& elemSol, - const Problem& problem, - const Element& element, - const SubControlVolume& scv) - { - return problem.temperatureAtPos(scv); - } - - template<class ParameterCache> - static Scalar enthalpy_(const FluidState& fluidState, - const ParameterCache& paramCache, - int phaseIdx) - { - return 0; - } - - /*! - * \brief Update all quantities for a given control volume. - * - * \param priVars The solution primary variables - * \param problem The problem - * \param element The element - * \param fvGeometry Evaluate function with solution of current or previous time step - * \param scvIdx The local index of the SCV (sub-control volume) - * \param isOldSol Evaluate function with solution of current or previous time step - */ - void updateEnergy_(const ElementSolutionVector& elemSol, - const Problem& problem, - const Element& element, - const SubControlVolume& scv) - { }; - - Scalar precipitateVolumeFraction_[numSPhases]; - Scalar permeabilityFactor_; - Scalar initialPorosity_; - Scalar initialPermeability_; - Scalar minimumPorosity_; - Scalar maximumPorosity_; - Scalar sumPrecipitates_; - - -private: - Implementation &asImp_() - { return *static_cast<Implementation*>(this); } - - const Implementation &asImp_() const - { return *static_cast<const Implementation*>(this); } -}; - -} // end namespace - -#endif diff --git a/dumux/porousmediumflow/1pncmin/model.hh b/dumux/porousmediumflow/1pncmin/model.hh new file mode 100644 index 0000000000000000000000000000000000000000..072e7b09fd09e0815c9ff1757f32868bb2de054a --- /dev/null +++ b/dumux/porousmediumflow/1pncmin/model.hh @@ -0,0 +1,112 @@ +// -*- 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 +* \ingroup OnePNCMinModel +* \brief A single-phase, multi-component model considering mineralization processes. +* +* This model implements one-phase n-component flow of a compressible fluid composed of +* the n components \f$\kappa \f$ in combination with mineral precipitation and dissolution +* of the solid phases. The standard multiphase Darcy +* approach is used as the equation for the conservation of momentum: +* \f[ +v = - \frac{k_{r}}{\mu} \mbox{\bf K} +\left(\text{grad}\, p - \varrho_{f} \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[ + \frac{\partial ( \varrho_f X^\kappa \phi )} +{\partial t} - \text{div} \left\{ \varrho_f X^\kappa +\frac{k_{r}}{\mu} \mbox{\bf K} +(\text{grad}\, p - \varrho_{f} \mbox{\bf g}) \right\} +- \text{div} \left\{{\bf D_{pm}^\kappa} \varrho_{f} \text{grad}\, X^\kappa \right\} +- q_\kappa = 0 \qquad \kappa \in \{w, a,\cdots \} +* \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. +* +* The primary variables are the pressure \f$p\f$ and the mole fractions of the +* dissolved components \f$x^k\f$. 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_1PNCMIN_MODEL_HH +#define DUMUX_1PNCMIN_MODEL_HH + +#include <dumux/porousmediumflow/1pnc/model.hh> +#include <dumux/porousmediumflow/mineralization/model.hh> +#include <dumux/material/fluidmatrixinteractions/1p/thermalconductivityaverage.hh> + +namespace Dumux +{ +namespace Properties +{ +////////////////////////////////////////////////////////////////// +// Type tags +////////////////////////////////////////////////////////////////// +NEW_TYPE_TAG(OnePNCMin, INHERITS_FROM(OnePNC, Mineralization)); +NEW_TYPE_TAG(OnePNCMinNI, INHERITS_FROM(OnePNCMin, NonIsothermal)); + +////////////////////////////////////////////////////////////////// +// Property tags for the isothermal 2pncmin model +////////////////////////////////////////////////////////////////// +SET_TYPE_PROP(OnePNCMin, NonMineralizationVolumeVariables, OnePNCVolumeVariables<TypeTag>); //!< the VolumeVariables property +SET_TYPE_PROP(OnePNCMin, NonMineralizationVtkOutputFields, OnePNCVtkOutputFields<TypeTag>); //!< Set the vtk output fields specific to the TwoPNCMin model + +////////////////////////////////////////////////////////////////// +// Properties for the non-isothermal 2pncmin model +////////////////////////////////////////////////////////////////// +SET_TYPE_PROP(OnePNCMinNI, IsothermalVolumeVariables, MineralizationVolumeVariables<TypeTag>); //!< set isothermal VolumeVariables +SET_TYPE_PROP(OnePNCMinNI, IsothermalVtkOutputFields, MineralizationVtkOutputFields<TypeTag>); //!< set isothermal output fields +SET_TYPE_PROP(OnePNCMinNI, IsothermalLocalResidual, MineralizationLocalResidual<TypeTag>); //!< set isothermal output fields +SET_TYPE_PROP(OnePNCMinNI, IsothermalIndices, OnePNCIndices <TypeTag, /*PVOffset=*/0>); //!< use 1pnc indices for the isothermal indices + +SET_TYPE_PROP(OnePNCMinNI, + ThermalConductivityModel, + ThermalConductivityAverage<typename GET_PROP_TYPE(TypeTag, Scalar)>); //!< Use the average for effective conductivities + +SET_PROP(OnePNCMinNI, IsothermalNumEq) { +private: + using FluidSystem = typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)); +public: + static const int value = FluidSystem::numComponents + FluidSystem::numSPhases; +}; + +} // end namespace Properties +} // end namespace Dumux + +#endif