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 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 | 1640 | 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 | 3812936371 | Scalar porosity() const | |
56 | { | ||
57 | Scalar sumVolumeFraction = 0.0; | ||
58 | 3812936371 | for (int compIdx =0; compIdx < numComponents; ++compIdx) | |
59 | 3821002441 | sumVolumeFraction += volumeFraction(compIdx); | |
60 | 3812936371 | 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 |
1/2✓ Branch 1 taken 661 times.
✗ Branch 2 not taken.
|
289321121 | Scalar density() const { return density_; } |
66 | |||
67 | //! The heat capacity of the solid phase in \f$\mathrm{[J/(kg*K)}\f$ | ||
68 |
1/2✓ Branch 1 taken 661 times.
✗ Branch 2 not taken.
|
288971937 | Scalar heatCapacity() const { return heatCapacity_; } |
69 | |||
70 | //! The thermal conductivity of the solid phase in \f$\mathrm{[[W/(m*K)]}\f$ | ||
71 |
5/5✓ Branch 3 taken 1 times.
✓ Branch 4 taken 75275 times.
✓ Branch 0 taken 5642400 times.
✓ Branch 1 taken 16000 times.
✓ Branch 2 taken 3168000 times.
|
93658168 | Scalar thermalConductivity() const { return thermalConducivity_; } |
72 | |||
73 | //! The temperature of the solid phase in \f$\mathrm{[K]}\f$ | ||
74 |
7/12✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 16000 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 0 taken 3168000 times.
✗ Branch 6 not taken.
|
126684901 | Scalar temperature() const { return temperature_; } |
75 | |||
76 | //! The volume fraction of a solid component within the solid phase | ||
77 |
5/5✓ Branch 0 taken 7495443 times.
✓ Branch 1 taken 16619532 times.
✓ Branch 2 taken 171912453 times.
✓ Branch 3 taken 93455699 times.
✓ Branch 4 taken 538662 times.
|
2875612523 | 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 | 317445487 | void setTemperature(Scalar value) | |
120 |
5/7✓ Branch 1 taken 99113510 times.
✓ Branch 2 taken 3262 times.
✓ Branch 4 taken 450 times.
✓ Branch 5 taken 5037645 times.
✓ Branch 0 taken 9794413 times.
✗ Branch 3 not taken.
✗ Branch 6 not taken.
|
317043703 | { temperature_ = value; } |
121 | |||
122 | /*! | ||
123 | * \brief Set the density of the solid phase | ||
124 | */ | ||
125 | 95489402 | void setDensity(Scalar value) | |
126 | 95489402 | { density_ = value; } | |
127 | |||
128 | /*! | ||
129 | * \brief Set the heat capacity of the solid phase | ||
130 | */ | ||
131 | 95260362 | void setThermalConductivity(Scalar value) | |
132 | 95260362 | { thermalConducivity_ = value; } | |
133 | |||
134 | /*! | ||
135 | * \brief Set the thermal conductivity of the solid phase | ||
136 | */ | ||
137 | 95260362 | void setHeatCapacity(Scalar value) | |
138 | 95260362 | { heatCapacity_ = value; } | |
139 | |||
140 | /*! | ||
141 | * \brief Set the volume fraction of a solid component | ||
142 | */ | ||
143 | 374071148 | void setVolumeFraction(const int compIdx, Scalar value) | |
144 |
5/7✓ Branch 1 taken 10636238 times.
✓ Branch 2 taken 3262 times.
✓ Branch 4 taken 80 times.
✓ Branch 5 taken 644 times.
✗ Branch 3 not taken.
✗ Branch 6 not taken.
✓ Branch 0 taken 37212214 times.
|
370701133 | { 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 |