GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/material/solidstates/compositionalsolidstate.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 9 22 40.9%
Functions: 0 32 0.0%
Branches: 27 32 84.4%

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
20/24
✓ Branch 0 taken 506519808 times.
✓ Branch 1 taken 180183936 times.
✓ Branch 2 taken 46211328 times.
✓ Branch 3 taken 21075776 times.
✓ Branch 4 taken 11570064 times.
✓ Branch 5 taken 5783968 times.
✓ Branch 6 taken 126222096 times.
✓ Branch 7 taken 42344872 times.
✓ Branch 8 taken 20931096 times.
✓ Branch 9 taken 10465548 times.
✓ Branch 10 taken 763920 times.
✓ Branch 11 taken 381960 times.
✓ Branch 12 taken 364424 times.
✓ Branch 13 taken 182212 times.
✓ Branch 14 taken 53964 times.
✓ Branch 15 taken 26982 times.
✓ Branch 16 taken 175064 times.
✓ Branch 17 taken 87532 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 690528 times.
✓ Branch 21 taken 345264 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
974380342 for (int compIdx =0; compIdx < numComponents; ++compIdx)
53 1427004584 sumVolumeFraction += volumeFraction(compIdx);
54
3/4
✗ Branch 1 not taken.
✓ Branch 2 taken 41534804 times.
✓ Branch 3 taken 9700392 times.
✓ Branch 4 taken 345264 times.
260326348 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 4196114 times.
756800949 { 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 5132327 { 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 12860426 { 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