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 inert solid system. | ||
11 | */ | ||
12 | #ifndef DUMUX_INERT_SOLID_STATE_HH | ||
13 | #define DUMUX_INERT_SOLID_STATE_HH | ||
14 | |||
15 | namespace Dumux { | ||
16 | |||
17 | /*! | ||
18 | * \ingroup SolidStates | ||
19 | * \brief Represents all relevant thermodynamic quantities of a inert solid system. | ||
20 | */ | ||
21 | template <class Scalar, class SolidSystemType> | ||
22 | 8200 | class InertSolidState | |
23 | { | ||
24 | public: | ||
25 | using SolidSystem = SolidSystemType; | ||
26 | |||
27 | enum | ||
28 | { | ||
29 | numComponents = SolidSystem::numComponents, | ||
30 | numInertComponents = SolidSystem::numInertComponents, | ||
31 | }; | ||
32 | |||
33 | /*! | ||
34 | * \brief Allows compile-time evaluation of if the solid system | ||
35 | * is inert or takes part in any kind of reactions. | ||
36 | */ | ||
37 | static constexpr bool isInert() | ||
38 | { | ||
39 | static_assert(SolidSystem::isInert(), "Only inert solid systems are allowed with the InertSolidState"); | ||
40 | return true; | ||
41 | } | ||
42 | |||
43 | /*! | ||
44 | * \brief The average molar mass \f$\overline M_\alpha\f$ of phase \f$\alpha\f$ in \f$\mathrm{[kg/mol]}\f$ | ||
45 | * | ||
46 | * Since this is an inert InertSolidState we simply consider the molarMass of the | ||
47 | * pure component/phase. | ||
48 | */ | ||
49 | Scalar averageMolarMass() const | ||
50 | { return SolidSystem::molarMass(); } | ||
51 | |||
52 | /*! | ||
53 | * \brief The porosity of the porous medium | ||
54 | */ | ||
55 | Scalar porosity() const | ||
56 | { | ||
57 | 3736197770 | Scalar sumVolumeFraction = 0.0; | |
58 | 7473699844 | for (int compIdx =0; compIdx < numComponents; ++compIdx) | |
59 | 3736849922 | sumVolumeFraction += volumeFraction(compIdx); | |
60 |
6/8✓ Branch 0 taken 1327275 times.
✓ Branch 1 taken 6698002 times.
✓ Branch 2 taken 76163837 times.
✓ Branch 3 taken 102484378 times.
✓ Branch 4 taken 700000 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 20244000 times.
✗ Branch 8 not taken.
|
3391295400 | Scalar porosity = 1-sumVolumeFraction; |
61 | return porosity; | ||
62 | } | ||
63 | |||
64 | //! The mass density of the solid phase in \f$\mathrm{[kg/m^3]}\f$ | ||
65 | ✗ | Scalar density() const { return density_; } | |
66 | |||
67 | //! The heat capacity of the solid phase in \f$\mathrm{[J/(kg*K)}\f$ | ||
68 | ✗ | Scalar heatCapacity() const { return heatCapacity_; } | |
69 | |||
70 | //! The thermal conductivity of the solid phase in \f$\mathrm{[[W/(m*K)]}\f$ | ||
71 | ✗ | Scalar thermalConductivity() const { return thermalConducivity_; } | |
72 | |||
73 | //! The temperature of the solid phase in \f$\mathrm{[K]}\f$ | ||
74 | ✗ | Scalar temperature() const { return temperature_; } | |
75 | |||
76 | //! The volume fraction of a solid component within the solid phase | ||
77 | ✗ | Scalar volumeFraction(const int compIdx) const { return volumeFraction_[compIdx]; } | |
78 | |||
79 | |||
80 | /*! | ||
81 | * \brief The molar density \f$\rho_{mol,\alpha}\f$ | ||
82 | * of a solid phase \f$\alpha\f$ in \f$\mathrm{[mol/m^3]}\f$ | ||
83 | * | ||
84 | * The molar density is defined by the mass density \f$\rho_\alpha\f$ and the mean molar mass \f$\overline M_\alpha\f$: | ||
85 | * | ||
86 | * \f[\rho_{mol,\alpha} = \frac{\rho_\alpha}{\overline M_\alpha} \;.\f] | ||
87 | */ | ||
88 | Scalar molarDensity() const | ||
89 | { return density_/averageMolarMass(); } | ||
90 | |||
91 | /***************************************************** | ||
92 | * Setter methods. Note that these are not part of the | ||
93 | * generic InertSolidState interface but specific for each | ||
94 | * implementation... | ||
95 | *****************************************************/ | ||
96 | |||
97 | /*! | ||
98 | * \brief Retrieve all parameters from an arbitrary solid state. | ||
99 | * \param sst The inert solid state | ||
100 | * | ||
101 | * \note If the other solid state object is inconsistent with the | ||
102 | * thermodynamic equilibrium, the result of this method is | ||
103 | * undefined. | ||
104 | */ | ||
105 | template <class SolidState> | ||
106 | void assign(const SolidState &sst) | ||
107 | { | ||
108 | temperature_ = sst.temperature(); | ||
109 | density_ = sst.density(); | ||
110 | thermalConducivity_ = sst.thermalConductivity(); | ||
111 | heatCapacity_ = sst.heatCapacity(); | ||
112 | for (int compIdx = 0; compIdx < numComponents; ++compIdx) | ||
113 | volumeFraction_[compIdx] = sst.volumeFraction(compIdx); | ||
114 | } | ||
115 | |||
116 | /*! | ||
117 | * \brief Set the temperature \f$\mathrm{[K]}\f$ of the solid phase | ||
118 | */ | ||
119 | ✗ | void setTemperature(Scalar value) | |
120 |
6/8✓ Branch 0 taken 10090413 times.
✓ Branch 1 taken 91110493 times.
✓ Branch 2 taken 2940 times.
✓ Branch 3 taken 792000 times.
✓ Branch 4 taken 450 times.
✓ Branch 5 taken 3854578 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
273800592 | { temperature_ = value; } |
121 | |||
122 | /*! | ||
123 | * \brief Set the density of the solid phase | ||
124 | */ | ||
125 | ✗ | void setDensity(Scalar value) | |
126 | 225840 | { density_ = value; } | |
127 | |||
128 | /*! | ||
129 | * \brief Set the heat capacity of the solid phase | ||
130 | */ | ||
131 | ✗ | void setThermalConductivity(Scalar value) | |
132 | ✗ | { thermalConducivity_ = value; } | |
133 | |||
134 | /*! | ||
135 | * \brief Set the thermal conductivity of the solid phase | ||
136 | */ | ||
137 | ✗ | void setHeatCapacity(Scalar value) | |
138 | ✗ | { heatCapacity_ = value; } | |
139 | |||
140 | /*! | ||
141 | * \brief Set the volume fraction of a solid component | ||
142 | */ | ||
143 | ✗ | void setVolumeFraction(const int compIdx, Scalar value) | |
144 |
16/20✓ Branch 0 taken 41439638 times.
✓ Branch 1 taken 10814440 times.
✓ Branch 2 taken 2940 times.
✓ Branch 3 taken 793709 times.
✓ Branch 4 taken 1322 times.
✓ Branch 5 taken 6126 times.
✓ Branch 6 taken 528 times.
✓ Branch 7 taken 5638 times.
✓ Branch 8 taken 528 times.
✓ Branch 9 taken 5029 times.
✓ Branch 10 taken 12 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 477999 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1170 times.
✓ Branch 17 taken 24 times.
✓ Branch 18 taken 3384 times.
✓ Branch 19 taken 528 times.
✗ Branch 20 not taken.
|
287413567 | { volumeFraction_[compIdx] = value; } |
145 | |||
146 | protected: | ||
147 | Scalar density_; | ||
148 | Scalar temperature_; | ||
149 | Scalar volumeFraction_[numComponents]; | ||
150 | Scalar heatCapacity_; | ||
151 | Scalar thermalConducivity_; | ||
152 | }; | ||
153 | |||
154 | } // end namespace Dumux | ||
155 | |||
156 | #endif | ||
157 |