version 3.8
compositionalsolidphase.hh
Go to the documentation of this file.
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//
12#ifndef DUMUX_SOLIDSYSTEMS_COMPOSITIONAL_SOLID_PHASE_HH
13#define DUMUX_SOLIDSYSTEMS_COMPOSITIONAL_SOLID_PHASE_HH
14
15#include <string>
16#include <dune/common/exceptions.hh>
17
18namespace Dumux {
19namespace SolidSystems {
20
28template <class Scalar, class Component1, class Component2, int numInert = 0>
30{
31public:
32 using ComponentOne = Component1;
33 using ComponentTwo = Component2;
34
35
36 /****************************************
37 * Solid phase related static parameters
38 ****************************************/
39 static constexpr int numComponents = 2;
40 static constexpr int numInertComponents = numInert;
41 static constexpr int comp0Idx = 0;
42 static constexpr int comp1Idx = 1;
43
44
50 static std::string componentName(int compIdx)
51 {
52 switch (compIdx)
53 {
54 case comp0Idx: return ComponentOne::name();
55 case comp1Idx: return ComponentTwo::name();
56 default: DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx);
57 }
58 }
59
63 static std::string name()
64 { return "s"; }
65
69 static constexpr bool isCompressible(int compIdx)
70 { return false; }
71
75 static constexpr bool isInert()
76 { return (numComponents == numInertComponents); }
77
81 static Scalar molarMass(int compIdx)
82 {
83 switch (compIdx)
84 {
85 case comp0Idx: return ComponentOne::molarMass();
86 case comp1Idx: return ComponentTwo::molarMass();
87 default: DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx);
88 }
89 }
90
94 template <class SolidState>
95 static Scalar density(const SolidState& solidState)
96 {
97 Scalar rho1 = ComponentOne::solidDensity(solidState.temperature());
98 Scalar rho2 = ComponentTwo::solidDensity(solidState.temperature());
99 Scalar volFrac1 = solidState.volumeFraction(comp0Idx);
100 Scalar volFrac2 = solidState.volumeFraction(comp1Idx);
101
102 return (rho1*volFrac1+
103 rho2*volFrac2)/(volFrac1+volFrac2);
104 }
105
109 template <class SolidState>
110 static Scalar density(const SolidState& solidState, const int compIdx)
111 {
112 switch (compIdx)
113 {
114 case comp0Idx: return ComponentOne::solidDensity(solidState.temperature());
115 case comp1Idx: return ComponentTwo::solidDensity(solidState.temperature());
116 default: DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx);
117 }
118 }
119
123 template <class SolidState>
124 static Scalar molarDensity(const SolidState& solidState, const int compIdx)
125 {
126 switch (compIdx)
127 {
128 case comp0Idx: return ComponentOne::solidDensity(solidState.temperature())/ComponentOne::molarMass();
129 case comp1Idx: return ComponentTwo::solidDensity(solidState.temperature())/ComponentTwo::molarMass();
130 default: DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx);
131 }
132 }
133
137 template <class SolidState>
138 static Scalar thermalConductivity(const SolidState &solidState)
139 {
140 Scalar lambda1 = ComponentOne::solidThermalConductivity(solidState.temperature());
141 Scalar lambda2 = ComponentTwo::solidThermalConductivity(solidState.temperature());
142 Scalar volFrac1 = solidState.volumeFraction(comp0Idx);
143 Scalar volFrac2 = solidState.volumeFraction(comp1Idx);
144
145 return (lambda1*volFrac1+
146 lambda2*volFrac2)/(volFrac1+volFrac2);
147 }
148
152 template <class SolidState>
153 static Scalar heatCapacity(const SolidState &solidState)
154 {
155 Scalar c1 = ComponentOne::solidHeatCapacity(solidState.temperature());
156 Scalar c2 = ComponentTwo::solidHeatCapacity(solidState.temperature());
157 Scalar volFrac1 = solidState.volumeFraction(comp0Idx);
158 Scalar volFrac2 = solidState.volumeFraction(comp1Idx);
159
160 return (c1*volFrac1+
161 c2*volFrac2)/(volFrac1+volFrac2);
162 }
163
164};
165
166} // end namespace SolidSystems
167} // end namespace Dumux
168
169#endif
A solid phase consisting of multiple inert solid components.
Definition: compositionalsolidphase.hh:30
static Scalar molarMass(int compIdx)
The molar mass in of the component.
Definition: compositionalsolidphase.hh:81
static Scalar thermalConductivity(const SolidState &solidState)
Thermal conductivity of the solid .
Definition: compositionalsolidphase.hh:138
static constexpr int comp1Idx
Definition: compositionalsolidphase.hh:42
static std::string name()
A human readable name for the solid system.
Definition: compositionalsolidphase.hh:63
static constexpr bool isInert()
Returns whether the component is inert (doesn't react)
Definition: compositionalsolidphase.hh:75
static Scalar density(const SolidState &solidState, const int compIdx)
The density of the solid phase at a given pressure and temperature.
Definition: compositionalsolidphase.hh:110
static Scalar heatCapacity(const SolidState &solidState)
Specific isobaric heat capacity of the pure solids .
Definition: compositionalsolidphase.hh:153
static constexpr int comp0Idx
Definition: compositionalsolidphase.hh:41
Component2 ComponentTwo
Definition: compositionalsolidphase.hh:33
Component1 ComponentOne
Definition: compositionalsolidphase.hh:32
static constexpr int numInertComponents
Definition: compositionalsolidphase.hh:40
static constexpr bool isCompressible(int compIdx)
Returns whether the phase is incompressible.
Definition: compositionalsolidphase.hh:69
static constexpr int numComponents
Definition: compositionalsolidphase.hh:39
static std::string componentName(int compIdx)
Return the human readable name of a solid phase.
Definition: compositionalsolidphase.hh:50
static Scalar molarDensity(const SolidState &solidState, const int compIdx)
The molar density of the solid phase at a given pressure and temperature.
Definition: compositionalsolidphase.hh:124
static Scalar density(const SolidState &solidState)
The density of the solid phase at a given pressure and temperature.
Definition: compositionalsolidphase.hh:95
Definition: adapt.hh:17