3.1-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
30
31namespace Dumux
32{
38template<class TypeTag>
40{
41 using ParentType = CompositionalLocalResidual<TypeTag>;
43 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
44 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
49
50 static constexpr int numPhases = ModelTraits::numFluidPhases();
51 static constexpr int numSolidComps = ModelTraits::numSolidComps();
52 static constexpr int numInertSolidComps = ModelTraits::numInertSolidComps();
53 static constexpr int numComponents = ModelTraits::numFluidComponents();
54 static constexpr bool useMoles = getPropValue<TypeTag, Properties::UseMoles>();
55
56public:
57 using ParentType::ParentType;
58
73 NumEqVector computeStorage(const Problem& problem,
74 const SubControlVolume& scv,
75 const VolumeVariables& volVars) const
76 {
77 auto storage = ParentType::computeStorage(problem, scv, volVars);
78
79 const auto massOrMoleDensity = [](const auto& volVars, const int phaseIdx)
80 { return useMoles ? volVars.solidComponentMolarDensity(phaseIdx) : volVars.solidComponentDensity(phaseIdx); };
81
82 // compute storage term of all components within all fluid phases
83 for (int phaseIdx = 0; phaseIdx < numSolidComps-numInertSolidComps; ++phaseIdx)
84 {
85 auto eqIdx = Indices::conti0EqIdx + numComponents + phaseIdx;
86 storage[eqIdx] += volVars.solidVolumeFraction(phaseIdx)
87 * massOrMoleDensity(volVars, phaseIdx);
88 }
89
90 return storage;
91 }
92};
93
94} // end namespace Dumux
95
96#endif
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
Element-wise calculation of the local residual for problems using compositional fully implicit model.
Definition: porousmediumflow/compositional/localresidual.hh:43
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:87
Element-wise calculation of the local residual for problems using a one/two-phase n-component mineral...
Definition: porousmediumflow/mineralization/localresidual.hh:40
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:73
Element-wise calculation of the local residual for problems using compositional fully implicit model.