Line | Branch | Exec | Source |
---|---|---|---|
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 | // | ||
7 | /*! | ||
8 | * \file | ||
9 | * \ingroup MineralizationModel | ||
10 | * \brief Element-wise calculation of the local residual for problems using a | ||
11 | * compositional model that also considers mineralization of solid phases. | ||
12 | */ | ||
13 | |||
14 | #ifndef DUMUX_COMPOSITIONAL_MINERALIZATION_LOCAL_RESIDUAL_HH | ||
15 | #define DUMUX_COMPOSITIONAL_MINERALIZATION_LOCAL_RESIDUAL_HH | ||
16 | |||
17 | #include <dumux/common/numeqvector.hh> | ||
18 | #include <dumux/porousmediumflow/compositional/localresidual.hh> | ||
19 | |||
20 | namespace Dumux | ||
21 | { | ||
22 | /*! | ||
23 | * \ingroup MineralizationModel | ||
24 | * \brief Element-wise calculation of the local residual for problems | ||
25 | * using a one/two-phase n-component mineralization model. | ||
26 | */ | ||
27 | template<class TypeTag> | ||
28 | class MineralizationLocalResidual: public CompositionalLocalResidual<TypeTag> | ||
29 | { | ||
30 | using ParentType = CompositionalLocalResidual<TypeTag>; | ||
31 | using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>; | ||
32 | using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; | ||
33 | using SubControlVolume = typename FVElementGeometry::SubControlVolume; | ||
34 | using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>; | ||
35 | using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; | ||
36 | using Problem = GetPropType<TypeTag, Properties::Problem>; | ||
37 | using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>; | ||
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 | |||
45 | public: | ||
46 |
2/4✓ Branch 1 taken 193136 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 193136 times.
✗ Branch 5 not taken.
|
386272 | using ParentType::ParentType; |
47 | |||
48 | /*! | ||
49 | * \brief Evaluates the amount of all conservation quantities | ||
50 | * (e.g. phase mass) within a sub-control volume. | ||
51 | * | ||
52 | * We consider the volume-average here (e.g. phase mass inside a | ||
53 | * sub control volume divided by the volume). The volume is multiplied | ||
54 | * onto it afterwards in the local residual of the respective spatial | ||
55 | * discretization scheme. | ||
56 | * | ||
57 | * \param problem The problem (Initial/Boundary conditions...) to be solved | ||
58 | * \param scv The sub-control volume of the finite volume grid | ||
59 | * \param volVars The volume variables (primary/secondary variables) in the scv | ||
60 | * \return Amount per volume of the conserved quantities | ||
61 | */ | ||
62 | 16151912 | NumEqVector computeStorage(const Problem& problem, | |
63 | const SubControlVolume& scv, | ||
64 | const VolumeVariables& volVars) const | ||
65 | { | ||
66 | 16151912 | 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 |
3/3✓ Branch 0 taken 24137064 times.
✓ Branch 1 taken 16286312 times.
✓ Branch 2 taken 134400 times.
|
40557776 | for (int sCompIdx = 0; sCompIdx < numSolidComps-numInertSolidComps; ++sCompIdx) |
73 | { | ||
74 | 24405864 | auto eqIdx = Indices::conti0EqIdx + numComponents + sCompIdx; | |
75 | 24405864 | storage[eqIdx] += volVars.solidVolumeFraction(sCompIdx) | |
76 | 48811728 | * massOrMoleSolidDensity(volVars, sCompIdx); | |
77 | } | ||
78 | |||
79 | 16151912 | return storage; | |
80 | } | ||
81 | }; | ||
82 | |||
83 | } // end namespace Dumux | ||
84 | |||
85 | #endif | ||
86 |