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-FileCopyrightText: 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 Fluidmatrixinteractions | ||
10 | * \brief Class for the evaluation of the porosity subject to precipitation. | ||
11 | */ | ||
12 | #ifndef DUMUX_POROSITY_PRECIPITATION_HH | ||
13 | #define DUMUX_POROSITY_PRECIPITATION_HH | ||
14 | |||
15 | #include <dumux/discretization/evalsolution.hh> | ||
16 | |||
17 | namespace Dumux { | ||
18 | |||
19 | /*! | ||
20 | * \ingroup Fluidmatrixinteractions | ||
21 | * \brief Calculates the porosity depending on the volume fractions of precipitated minerals. | ||
22 | * | ||
23 | * \tparam Scalar The type used for scalar values | ||
24 | * \param numComp The number of components in the fluid phases | ||
25 | * \param numSolidPhases The number of precipitating solid phases | ||
26 | */ | ||
27 | template<class Scalar, int numComp, int numSolidPhases> | ||
28 | class PorosityPrecipitation | ||
29 | { | ||
30 | public: | ||
31 | /*! | ||
32 | * \brief Calculates the porosity in a sub-control volume | ||
33 | * \param element Element | ||
34 | * \param elemSol The element solution | ||
35 | * \param scv Sub control volume | ||
36 | * \param refPoro The solid matrix porosity without precipitates | ||
37 | * \param minPoro A minimum porosity value | ||
38 | */ | ||
39 | template<class Element, class SubControlVolume, class ElemSol> | ||
40 | 2595772 | Scalar evaluatePorosity(const Element& element, | |
41 | const SubControlVolume& scv, | ||
42 | const ElemSol& elemSol, | ||
43 | Scalar refPoro, | ||
44 | Scalar minPoro = 0.0) const | ||
45 | { | ||
46 | 2595772 | auto priVars = evalSolution(element, element.geometry(), elemSol, scv.center()); | |
47 | |||
48 | 2595772 | Scalar sumPrecipitates = 0.0; | |
49 |
2/2✓ Branch 0 taken 5191544 times.
✓ Branch 1 taken 2595772 times.
|
7787316 | for (unsigned int solidPhaseIdx = 0; solidPhaseIdx < numSolidPhases; ++solidPhaseIdx) |
50 | 5191544 | sumPrecipitates += priVars[numComp + solidPhaseIdx]; | |
51 | |||
52 | using std::max; | ||
53 |
1/2✓ Branch 0 taken 2595772 times.
✗ Branch 1 not taken.
|
2595772 | return max(minPoro, refPoro - sumPrecipitates); |
54 | } | ||
55 | }; | ||
56 | |||
57 | } // namespace Dumux | ||
58 | |||
59 | #endif | ||
60 |