3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porousmediumflow/mineralization/localresidual.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*****************************************************************************
4 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
26#ifndef DUMUX_COMPOSITIONAL_MINERALIZATION_LOCAL_RESIDUAL_HH
27#define DUMUX_COMPOSITIONAL_MINERALIZATION_LOCAL_RESIDUAL_HH
28
31
32namespace Dumux
33{
39template<class TypeTag>
41{
42 using ParentType = CompositionalLocalResidual<TypeTag>;
44 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
45 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
50
51 static constexpr int numPhases = ModelTraits::numFluidPhases();
52 static constexpr int numSolidComps = ModelTraits::numSolidComps();
53 static constexpr int numInertSolidComps = ModelTraits::numInertSolidComps();
54 static constexpr int numComponents = ModelTraits::numFluidComponents();
55 static constexpr bool useMoles = getPropValue<TypeTag, Properties::UseMoles>();
56
57public:
58 using ParentType::ParentType;
59
74 NumEqVector computeStorage(const Problem& problem,
75 const SubControlVolume& scv,
76 const VolumeVariables& volVars) const
77 {
78 auto storage = ParentType::computeStorage(problem, scv, volVars);
79
80 const auto massOrMoleSolidDensity = [](const auto& volVars, const int sCompIdx)
81 { return useMoles ? volVars.solidComponentMolarDensity(sCompIdx) : volVars.solidComponentDensity(sCompIdx); };
82
83 // compute storage term of all solid components
84 for (int sCompIdx = 0; sCompIdx < numSolidComps-numInertSolidComps; ++sCompIdx)
85 {
86 auto eqIdx = Indices::conti0EqIdx + numComponents + sCompIdx;
87 storage[eqIdx] += volVars.solidVolumeFraction(sCompIdx)
88 * massOrMoleSolidDensity(volVars, sCompIdx);
89 }
90
91 return storage;
92 }
93};
94
95} // end namespace Dumux
96
97#endif
A helper to deduce a vector with the same size as numbers of equations.
typename NumEqVectorTraits< PrimaryVariables >::type NumEqVector
A vector with the same size as numbers of equations This is the default implementation and has to be ...
Definition: numeqvector.hh:46
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
Element-wise calculation of the local residual for problems using compositional fully implicit model.
Definition: porousmediumflow/compositional/localresidual.hh:46
NumEqVector computeStorage(const Problem &problem, const SubControlVolume &scv, const VolumeVariables &volVars) const
Evaluates the amount of all conservation quantities (e.g. phase mass) within a sub-control volume.
Definition: porousmediumflow/compositional/localresidual.hh:90
Element-wise calculation of the local residual for problems using a one/two-phase n-component mineral...
Definition: porousmediumflow/mineralization/localresidual.hh:41
NumEqVector computeStorage(const Problem &problem, const SubControlVolume &scv, const VolumeVariables &volVars) const
Evaluates the amount of all conservation quantities (e.g. phase mass) within a sub-control volume.
Definition: porousmediumflow/mineralization/localresidual.hh:74
Element-wise calculation of the local residual for problems using compositional fully implicit model.