version 3.8
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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
14#ifndef DUMUX_COMPOSITIONAL_MINERALIZATION_LOCAL_RESIDUAL_HH
15#define DUMUX_COMPOSITIONAL_MINERALIZATION_LOCAL_RESIDUAL_HH
16
19
20namespace Dumux
21{
27template<class TypeTag>
29{
30 using ParentType = CompositionalLocalResidual<TypeTag>;
32 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
33 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
38
39 static constexpr int numPhases = ModelTraits::numFluidPhases();
40 static constexpr int numSolidComps = ModelTraits::numSolidComps();
41 static constexpr int numInertSolidComps = ModelTraits::numInertSolidComps();
42 static constexpr int numComponents = ModelTraits::numFluidComponents();
43 static constexpr bool useMoles = getPropValue<TypeTag, Properties::UseMoles>();
44
45public:
46 using ParentType::ParentType;
47
62 NumEqVector computeStorage(const Problem& problem,
63 const SubControlVolume& scv,
64 const VolumeVariables& volVars) const
65 {
66 auto storage = ParentType::computeStorage(problem, scv, volVars);
67
68 const auto massOrMoleSolidDensity = [](const auto& volVars, const int sCompIdx)
69 { return useMoles ? volVars.solidComponentMolarDensity(sCompIdx) : volVars.solidComponentDensity(sCompIdx); };
70
71 // compute storage term of all solid components
72 for (int sCompIdx = 0; sCompIdx < numSolidComps-numInertSolidComps; ++sCompIdx)
73 {
74 auto eqIdx = Indices::conti0EqIdx + numComponents + sCompIdx;
75 storage[eqIdx] += volVars.solidVolumeFraction(sCompIdx)
76 * massOrMoleSolidDensity(volVars, sCompIdx);
77 }
78
79 return storage;
80 }
81};
82
83} // end namespace Dumux
84
85#endif
Element-wise calculation of the local residual for problems using compositional fully implicit model.
Definition: porousmediumflow/compositional/localresidual.hh:33
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:77
Element-wise calculation of the local residual for problems using a one/two-phase n-component mineral...
Definition: porousmediumflow/mineralization/localresidual.hh:29
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:62
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:34
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
Definition: adapt.hh:17
A helper to deduce a vector with the same size as numbers of equations.
Element-wise calculation of the local residual for problems using compositional fully implicit model.