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 SolidStates | ||
10 | * \brief Represents all relevant thermodynamic quantities of a | ||
11 | * compositional solid system. | ||
12 | */ | ||
13 | #ifndef DUMUX_SOLID_STATE_COMPOSITIONAL_HH | ||
14 | #define DUMUX_SOLID_STATE_COMPOSITIONAL_HH | ||
15 | |||
16 | namespace Dumux { | ||
17 | |||
18 | /*! | ||
19 | * \ingroup SolidStates | ||
20 | * \brief Represents all relevant thermodynamic quantities of a | ||
21 | * compositional solid system | ||
22 | */ | ||
23 | template <class Scalar, class SolidSystemType> | ||
24 | class CompositionalSolidState | ||
25 | { | ||
26 | public: | ||
27 | using SolidSystem = SolidSystemType; | ||
28 | |||
29 | enum | ||
30 | { | ||
31 | numComponents = SolidSystem::numComponents, | ||
32 | numInertComponents = SolidSystem::numInertComponents, | ||
33 | }; | ||
34 | |||
35 | static constexpr bool isInert() { return SolidSystem::isInert(); } | ||
36 | |||
37 | /*! | ||
38 | * \brief The average molar mass \f$\overline M_\alpha\f$ of phase \f$\alpha\f$ in \f$\mathrm{[kg/mol]}\f$ | ||
39 | * | ||
40 | * Since this is an inert CompositionalSolidState we simply consider the molarMass of the | ||
41 | * pure component/phase. | ||
42 | */ | ||
43 | Scalar averageMolarMass() const | ||
44 | { return SolidSystem::molarMass(); } | ||
45 | |||
46 | /*! | ||
47 | * \brief The porosity of the porous medium | ||
48 | */ | ||
49 | Scalar porosity() const | ||
50 | { | ||
51 | ✗ | Scalar sumVolumeFraction = 0.0; | |
52 |
18/24✓ Branch 0 taken 499121408 times.
✓ Branch 1 taken 176484736 times.
✓ Branch 2 taken 44039968 times.
✓ Branch 3 taken 19990096 times.
✓ Branch 4 taken 10645264 times.
✓ Branch 5 taken 5321568 times.
✓ Branch 6 taken 126212496 times.
✓ Branch 7 taken 42340072 times.
✓ Branch 8 taken 18501368 times.
✓ Branch 9 taken 9250684 times.
✓ Branch 10 taken 364424 times.
✓ Branch 11 taken 182212 times.
✓ Branch 12 taken 53964 times.
✓ Branch 13 taken 26982 times.
✓ Branch 14 taken 175064 times.
✓ Branch 15 taken 87532 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✓ Branch 18 taken 690528 times.
✓ Branch 19 taken 345264 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
|
953833630 | for (int compIdx =0; compIdx < numComponents; ++compIdx) |
53 | 1399608968 | sumVolumeFraction += volumeFraction(compIdx); | |
54 |
3/5✗ Branch 1 not taken.
✓ Branch 2 taken 41534716 times.
✓ Branch 3 taken 8867576 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 345264 times.
|
252718324 | Scalar porosity = 1-sumVolumeFraction; |
55 | return porosity; | ||
56 | } | ||
57 | |||
58 | //! The mass density of the solid phase in \f$\mathrm{[kg/m^3]}\f$ | ||
59 | ✗ | Scalar density() const | |
60 | ✗ | { return density_; } | |
61 | |||
62 | //! The heat capacity of the solid phase in \f$\mathrm{[J/(kg*K)}\f$ | ||
63 | ✗ | Scalar heatCapacity() const | |
64 | ✗ | { return heatCapacity_; } | |
65 | |||
66 | //! The heat capacity of the solid phase in \f$\mathrm{[J/(kg*K)}\f$ | ||
67 | ✗ | Scalar thermalConductivity() const | |
68 | ✗ | { return thermalConducivity_; } | |
69 | |||
70 | /*! | ||
71 | * \brief The molar density \f$\rho_{mol,\alpha}\f$ | ||
72 | * of a solid phase \f$\alpha\f$ in \f$\mathrm{[mol/m^3]}\f$ | ||
73 | * | ||
74 | * The molar density is defined by the mass density \f$\rho_\alpha\f$ and the mean molar mass \f$\overline M_\alpha\f$: | ||
75 | * | ||
76 | * \f[\rho_{mol,\alpha} = \frac{\rho_\alpha}{\overline M_\alpha} \;.\f] | ||
77 | */ | ||
78 | Scalar molarDensity() const | ||
79 | { return density_/averageMolarMass(); } | ||
80 | |||
81 | //! The temperature of the solid phase in \f$\mathrm{[K]}\f$ | ||
82 | ✗ | Scalar temperature() const | |
83 | ✗ | { return temperature_; } | |
84 | |||
85 | //! The volume fraction of a solid component within the solid phase | ||
86 | Scalar volumeFraction(const int compIdx) const | ||
87 |
4/4✓ Branch 1 taken 293728 times.
✓ Branch 2 taken 3766048 times.
✓ Branch 3 taken 4275042 times.
✓ Branch 4 taken 3733714 times.
|
741180985 | { return volumeFraction_[compIdx]; } |
88 | |||
89 | /***************************************************** | ||
90 | * Setter methods. Note that these are not part of the | ||
91 | * generic CompositionalSolidState interface but specific for each | ||
92 | * implementation... | ||
93 | *****************************************************/ | ||
94 | |||
95 | /*! | ||
96 | * \brief Retrieve all parameters from an arbitrary solid | ||
97 | * state. | ||
98 | * \param sst CompositionalSolidState | ||
99 | * | ||
100 | * \note If the other solid state object is inconsistent with the | ||
101 | * thermodynamic equilibrium, the result of this method is | ||
102 | * undefined. | ||
103 | */ | ||
104 | template <class SolidState> | ||
105 | void assign(const SolidState &sst) | ||
106 | { | ||
107 | temperature_ = sst.temperature(); | ||
108 | density_ = sst.density(); | ||
109 | thermalConducivity_ = sst.thermalConductivity(); | ||
110 | heatCapacity_ = sst.heatCapacity(); | ||
111 | for (int compIdx = 0; compIdx < numComponents; ++compIdx) | ||
112 | volumeFraction_[compIdx] = sst.volumeFraction(compIdx); | ||
113 | } | ||
114 | |||
115 | /*! | ||
116 | * \brief Set the temperature \f$\mathrm{[K]}\f$ of the solid phase | ||
117 | */ | ||
118 | ✗ | void setTemperature(Scalar value) | |
119 | 4924101 | { temperature_ = value; } | |
120 | |||
121 | /*! | ||
122 | * \brief Set the density of the solid phase | ||
123 | */ | ||
124 | ✗ | void setDensity(Scalar value) | |
125 | 111148 | { density_ = value; } | |
126 | |||
127 | /*! | ||
128 | * \brief Set the heat capacity of the solid phase | ||
129 | */ | ||
130 | ✗ | void setThermalConductivity(Scalar value) | |
131 | 111148 | { thermalConducivity_ = value; } | |
132 | |||
133 | /*! | ||
134 | * \brief Set the thermal conductivity of the solid phase | ||
135 | */ | ||
136 | ✗ | void setHeatCapacity(Scalar value) | |
137 | 111148 | { heatCapacity_ = value; } | |
138 | |||
139 | /*! | ||
140 | * \brief Set the volume fraction of a solid component | ||
141 | */ | ||
142 | void setVolumeFraction(const int compIdx, Scalar value) | ||
143 | 12443974 | { volumeFraction_[compIdx] = value; } | |
144 | |||
145 | protected: | ||
146 | Scalar density_; | ||
147 | Scalar temperature_; | ||
148 | Scalar volumeFraction_[numComponents]; | ||
149 | Scalar heatCapacity_; | ||
150 | Scalar thermalConducivity_; | ||
151 | }; | ||
152 | |||
153 | } // end namespace Dumux | ||
154 | |||
155 | #endif | ||
156 |