3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
h2n2co2fluidsystem.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 *****************************************************************************/
25#ifndef DUMUX_THREE_GAS_COMPONENT_FLUID_SYSTEM_HH
26#define DUMUX_THREE_GAS_COMPONENT_FLUID_SYSTEM_HH
27
29
30namespace Dumux {
31namespace FluidSystems {
36template<class Scalar>
37class H2N2CO2FluidSystem: public Base<Scalar, H2N2CO2FluidSystem<Scalar>>
38
39{
42
43public:
45 static constexpr int numPhases = 1;
46 static constexpr int numComponents = 3;
47
48 static constexpr int H2Idx = 0;//first major component
49 static constexpr int N2Idx = 1;//second major component
50 static constexpr int CO2Idx = 2;//secondary component
51
53 static std::string componentName(int compIdx)
54 {
55 switch (compIdx)
56 {
57 case H2Idx: return "H2";
58 case N2Idx: return "N2";
59 case CO2Idx: return "CO2";
60 }
61 DUNE_THROW(Dune::InvalidStateException, "Invalid compIdx index " << compIdx);
62 }
63
65 static std::string phaseName(int phaseIdx = 0)
66 { return "Gas"; }
67
69 static Scalar molarMass(unsigned int compIdx)
70 { return 0.02896; }
71
72
84 template <class FluidState>
85 static Scalar binaryDiffusionCoefficient(const FluidState &fluidState,
86 int phaseIdx,
87 int compIIdx,
88 int compJIdx)
89 {
90 if (compIIdx > compJIdx)
91 {
92 using std::swap;
93 swap(compIIdx, compJIdx);
94 }
95
96 if (compIIdx == H2Idx && compJIdx == N2Idx)
97 return 83.3e-6;
98 if (compIIdx == H2Idx && compJIdx == CO2Idx)
99 return 68.0e-6;
100 if (compIIdx == N2Idx && compJIdx == CO2Idx)
101 return 16.8e-6;
102 DUNE_THROW(Dune::InvalidStateException,
103 "Binary diffusion coefficient of components "
104 << compIIdx << " and " << compJIdx << " is undefined!\n");
105 }
106 using Base::density;
115 template <class FluidState>
116 static Scalar density(const FluidState &fluidState,
117 const int phaseIdx)
118 {
119 return 1;
120 }
121
122 using Base::viscosity;
129 template <class FluidState>
130 static Scalar viscosity(const FluidState &fluidState,
131 int phaseIdx)
132 {
133 return 1e-6;
134 }
135
136 using Base::molarDensity;
146 template <class FluidState>
147 static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
148 {
149 return density(fluidState, phaseIdx)/molarMass(0);
150 }
151};
152
153} // end namespace FluidSystems
154} // end namespace Dumux
155
156
157#endif
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Fluid system base class.
Definition: fluidsystems/base.hh:45
Scalar Scalar
export the scalar type
Definition: fluidsystems/base.hh:48
static Scalar density(const FluidState &fluidState, int phaseIdx)
Calculate the density of a fluid phase.
Definition: fluidsystems/base.hh:134
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIIdx, int compJIdx)
Given a phase's composition, temperature and pressure, return the binary diffusion coefficient for c...
Definition: fluidsystems/base.hh:326
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: fluidsystems/base.hh:160
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: fluidsystems/base.hh:236
A simple fluid system with one Maxwell-Stefan component.
Definition: h2n2co2fluidsystem.hh:39
static std::string componentName(int compIdx)
Human readable component name (index compIdx) (for vtk output)
Definition: h2n2co2fluidsystem.hh:53
static constexpr int numPhases
The number of phases.
Definition: h2n2co2fluidsystem.hh:45
static constexpr int CO2Idx
Definition: h2n2co2fluidsystem.hh:50
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIIdx, int compJIdx)
Given a phase's composition, temperature and pressure, returns the binary diffusion coefficient for ...
Definition: h2n2co2fluidsystem.hh:85
static constexpr int numComponents
Definition: h2n2co2fluidsystem.hh:46
static std::string phaseName(int phaseIdx=0)
Human readable phase name (index phaseIdx) (for velocity vtk output)
Definition: h2n2co2fluidsystem.hh:65
static constexpr int N2Idx
Definition: h2n2co2fluidsystem.hh:49
static Scalar density(const FluidState &fluidState, const int phaseIdx)
Given a phase's composition, temperature, pressure, and the partial pressures of all components,...
Definition: h2n2co2fluidsystem.hh:116
static constexpr int H2Idx
Definition: h2n2co2fluidsystem.hh:48
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculates the dynamic viscosity of a fluid phase .
Definition: h2n2co2fluidsystem.hh:130
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
The molar density of a fluid phase in .
Definition: h2n2co2fluidsystem.hh:147
static Scalar molarMass(unsigned int compIdx)
Molar mass in kg/mol of the component with index compIdx.
Definition: h2n2co2fluidsystem.hh:69
Fluid system base class.