3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_SOLIDSYSTEMS_COMPOSITIONAL_SOLID_PHASE_HH
25#define DUMUX_SOLIDSYSTEMS_COMPOSITIONAL_SOLID_PHASE_HH
26
27#include <string>
28#include <dune/common/exceptions.hh>
29
30namespace Dumux {
31namespace SolidSystems {
32
40template <class Scalar, class Component1, class Component2, int numInert = 0>
42{
43public:
44 using ComponentOne = Component1;
45 using ComponentTwo = Component2;
46
47
48 /****************************************
49 * Solid phase related static parameters
50 ****************************************/
51 static constexpr int numComponents = 2;
52 static constexpr int numInertComponents = numInert;
53 static constexpr int comp0Idx = 0;
54 static constexpr int comp1Idx = 1;
55
56
62 static std::string componentName(int compIdx)
63 {
64 switch (compIdx)
65 {
66 case comp0Idx: return ComponentOne::name();
67 case comp1Idx: return ComponentTwo::name();
68 default: DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx);
69 }
70 }
71
75 static std::string name()
76 { return "s"; }
77
81 static constexpr bool isCompressible(int compIdx)
82 { return false; }
83
87 static constexpr bool isInert()
88 { return (numComponents == numInertComponents); }
89
93 static Scalar molarMass(int compIdx)
94 {
95 switch (compIdx)
96 {
97 case comp0Idx: return ComponentOne::molarMass();
98 case comp1Idx: return ComponentTwo::molarMass();
99 default: DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx);
100 }
101 }
102
106 template <class SolidState>
107 static Scalar density(const SolidState& solidState)
108 {
109 Scalar rho1 = ComponentOne::solidDensity(solidState.temperature());
110 Scalar rho2 = ComponentTwo::solidDensity(solidState.temperature());
111 Scalar volFrac1 = solidState.volumeFraction(comp0Idx);
112 Scalar volFrac2 = solidState.volumeFraction(comp1Idx);
113
114 return (rho1*volFrac1+
115 rho2*volFrac2)/(volFrac1+volFrac2);
116 }
117
121 template <class SolidState>
122 static Scalar density(const SolidState& solidState, const int compIdx)
123 {
124 switch (compIdx)
125 {
126 case comp0Idx: return ComponentOne::solidDensity(solidState.temperature());
127 case comp1Idx: return ComponentTwo::solidDensity(solidState.temperature());
128 default: DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx);
129 }
130 }
131
135 template <class SolidState>
136 static Scalar molarDensity(const SolidState& solidState, const int compIdx)
137 {
138 switch (compIdx)
139 {
140 case comp0Idx: return ComponentOne::solidDensity(solidState.temperature())/ComponentOne::molarMass();
141 case comp1Idx: return ComponentTwo::solidDensity(solidState.temperature())/ComponentTwo::molarMass();
142 default: DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx);
143 }
144 }
145
149 template <class SolidState>
150 static Scalar thermalConductivity(const SolidState &solidState)
151 {
152 Scalar lambda1 = ComponentOne::solidThermalConductivity(solidState.temperature());
153 Scalar lambda2 = ComponentTwo::solidThermalConductivity(solidState.temperature());
154 Scalar volFrac1 = solidState.volumeFraction(comp0Idx);
155 Scalar volFrac2 = solidState.volumeFraction(comp1Idx);
156
157 return (lambda1*volFrac1+
158 lambda2*volFrac2)/(volFrac1+volFrac2);
159 }
160
164 template <class SolidState>
165 static Scalar heatCapacity(const SolidState &solidState)
166 {
167 Scalar c1 = ComponentOne::solidHeatCapacity(solidState.temperature());
168 Scalar c2 = ComponentTwo::solidHeatCapacity(solidState.temperature());
169 Scalar volFrac1 = solidState.volumeFraction(comp0Idx);
170 Scalar volFrac2 = solidState.volumeFraction(comp1Idx);
171
172 return (c1*volFrac1+
173 c2*volFrac2)/(volFrac1+volFrac2);
174 }
175
176};
177
178} // end namespace SolidSystems
179} // end namespace Dumux
180
181#endif
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
A solid phase consisting of multiple inert solid components.
Definition: compositionalsolidphase.hh:42
static Scalar molarMass(int compIdx)
The molar mass in of the component.
Definition: compositionalsolidphase.hh:93
static Scalar thermalConductivity(const SolidState &solidState)
Thermal conductivity of the solid .
Definition: compositionalsolidphase.hh:150
static constexpr int comp1Idx
Definition: compositionalsolidphase.hh:54
static std::string name()
A human readable name for the solid system.
Definition: compositionalsolidphase.hh:75
static constexpr bool isInert()
Returns whether the component is inert (doesn't react)
Definition: compositionalsolidphase.hh:87
static Scalar density(const SolidState &solidState, const int compIdx)
The density of the solid phase at a given pressure and temperature.
Definition: compositionalsolidphase.hh:122
static Scalar heatCapacity(const SolidState &solidState)
Specific isobaric heat capacity of the pure solids .
Definition: compositionalsolidphase.hh:165
static constexpr int comp0Idx
Definition: compositionalsolidphase.hh:53
Component2 ComponentTwo
Definition: compositionalsolidphase.hh:45
Component1 ComponentOne
Definition: compositionalsolidphase.hh:44
static constexpr int numInertComponents
Definition: compositionalsolidphase.hh:52
static constexpr bool isCompressible(int compIdx)
Returns whether the phase is incompressible.
Definition: compositionalsolidphase.hh:81
static constexpr int numComponents
Definition: compositionalsolidphase.hh:51
static std::string componentName(int compIdx)
Return the human readable name of a solid phase.
Definition: compositionalsolidphase.hh:62
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:136
static Scalar density(const SolidState &solidState)
The density of the solid phase at a given pressure and temperature.
Definition: compositionalsolidphase.hh:107