3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
h2on2.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_H2O_N2_FLUID_SYSTEM_HH
25#define DUMUX_H2O_N2_FLUID_SYSTEM_HH
26
27#include <cassert>
28#include <iomanip>
29
32
34
39
40#include <dumux/io/name.hh>
41
42#include "base.hh"
43
44namespace Dumux {
45namespace FluidSystems {
50template<bool fastButSimplifiedRelations = false>
52{
53 static constexpr bool useH2ODensityAsLiquidMixtureDensity() { return fastButSimplifiedRelations; }
54 static constexpr bool useIdealGasDensity() { return fastButSimplifiedRelations; }
55 static constexpr bool useN2ViscosityAsGasMixtureViscosity() { return fastButSimplifiedRelations; }
56 static constexpr bool useN2HeatConductivityAsGasMixtureHeatConductivity() { return fastButSimplifiedRelations; }
57 static constexpr bool useIdealGasHeatCapacities() { return fastButSimplifiedRelations; }
58};
59
66template <class Scalar, class Policy = H2ON2DefaultPolicy<>>
67class H2ON2
68 : public Base<Scalar, H2ON2<Scalar, Policy> >
69{
72
73 // convenience using declarations
77
78public:
79 using H2O = TabulatedH2O;
80 using N2 = SimpleN2;
81
82 static constexpr int numPhases = 2;
83 static constexpr int numComponents = 2;
84
85 static constexpr int liquidPhaseIdx = 0;
86 static constexpr int gasPhaseIdx = 1;
87 static constexpr int phase0Idx = liquidPhaseIdx;
88 static constexpr int phase1Idx = gasPhaseIdx;
89
90 static constexpr int H2OIdx = 0;
91 static constexpr int N2Idx = 1;
92 static constexpr int comp0Idx = H2OIdx;
93 static constexpr int comp1Idx = N2Idx;
94 static constexpr int liquidCompIdx = H2OIdx;
95 static constexpr int gasCompIdx = N2Idx;
96
97 /****************************************
98 * Fluid phase related static parameters
99 ****************************************/
105 static std::string phaseName(int phaseIdx)
106 {
107 assert(0 <= phaseIdx && phaseIdx < numPhases);
108 switch (phaseIdx)
109 {
110 case liquidPhaseIdx: return IOName::liquidPhase();
111 case gasPhaseIdx: return IOName::gaseousPhase();
112 }
113 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx);
114 }
115
119 static constexpr bool isMiscible()
120 { return true; }
121
127 static constexpr bool isGas(int phaseIdx)
128 {
129 assert(0 <= phaseIdx && phaseIdx < numPhases);
130 return phaseIdx == gasPhaseIdx;
131 }
132
147 static bool isIdealMixture(int phaseIdx)
148 {
149 assert(0 <= phaseIdx && phaseIdx < numPhases);
150 // we assume Henry's and Raoult's laws for the water phase and
151 // and no interaction between gas molecules of different
152 // components, so all phases are ideal mixtures!
153 return true;
154 }
155
165 static constexpr bool isCompressible(int phaseIdx)
166 {
167 assert(0 <= phaseIdx && phaseIdx < numPhases);
168 // gases are always compressible
169 if (phaseIdx == gasPhaseIdx)
170 return true;
171 // the water component decides for the liquid phase...
173 }
174
181 static bool isIdealGas(int phaseIdx)
182 {
183 assert(0 <= phaseIdx && phaseIdx < numPhases);
184
185 if (phaseIdx == gasPhaseIdx)
186 // let the components decide
187 return H2O::gasIsIdeal() && N2::gasIsIdeal();
188 return false; // not a gas
189 }
190
191 /****************************************
192 * Component related static parameters
193 ****************************************/
199 static std::string componentName(int compIdx)
200 {
201 switch (compIdx)
202 {
203 case H2OIdx: return H2O::name();
204 case N2Idx: return N2::name();
205 }
206
207 DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << compIdx);
208 }
209
215 static Scalar molarMass(int compIdx)
216 {
217 static const Scalar M[] = {
220 };
221
222 assert(0 <= compIdx && compIdx < numComponents);
223 return M[compIdx];
224 }
225
231 static Scalar criticalTemperature(int compIdx)
232 {
233 static const Scalar Tcrit[] = {
236 };
237
238 assert(0 <= compIdx && compIdx < numComponents);
239 return Tcrit[compIdx];
240 }
241
247 static Scalar criticalPressure(int compIdx)
248 {
249 static const Scalar pcrit[] = {
252 };
253
254 assert(0 <= compIdx && compIdx < numComponents);
255 return pcrit[compIdx];
256 }
257
267 template <class FluidState>
268 static Scalar kelvinVaporPressure(const FluidState &fluidState,
269 const int phaseIdx,
270 const int compIdx)
271 {
272 assert(compIdx == H2OIdx && phaseIdx == liquidPhaseIdx);
273
274 using std::exp;
275 return fugacityCoefficient(fluidState, phaseIdx, compIdx)
276 * fluidState.pressure(phaseIdx)
277 * exp(-(fluidState.pressure(gasPhaseIdx)-fluidState.pressure(liquidPhaseIdx))
278 / density(fluidState, phaseIdx)
280 / fluidState.temperature());
281 }
282
288 static Scalar criticalMolarVolume(int compIdx)
289 {
290 DUNE_THROW(Dune::NotImplemented,
291 "H2ON2FluidSystem::criticalMolarVolume()");
292 }
293
299 static Scalar acentricFactor(int compIdx)
300 {
301 static const Scalar accFac[] = {
302 H2O::acentricFactor(),
303 N2::acentricFactor()
304 };
305
306 assert(0 <= compIdx && compIdx < numComponents);
307 return accFac[compIdx];
308 }
309
310 /****************************************
311 * thermodynamic relations
312 ****************************************/
313
320 static void init()
321 {
322 init(/*tempMin=*/273.15,
323 /*tempMax=*/623.15,
324 /*numTemp=*/100,
325 /*pMin=*/0.0,
326 /*pMax=*/20e6,
327 /*numP=*/200);
328 }
329
341 static void init(Scalar tempMin, Scalar tempMax, unsigned nTemp,
342 Scalar pressMin, Scalar pressMax, unsigned nPress)
343 {
344 std::cout << "The H2O-N2 fluid system was configured with the following policy:\n";
345 std::cout << " - use H2O density as liquid mixture density: " << std::boolalpha << Policy::useH2ODensityAsLiquidMixtureDensity() << "\n";
346 std::cout << " - use ideal gas density: " << std::boolalpha << Policy::useIdealGasDensity() << "\n";
347 std::cout << " - use N2 viscosity as gas mixture viscosity: " << std::boolalpha << Policy::useN2ViscosityAsGasMixtureViscosity() << "\n";
348 std::cout << " - use N2 heat conductivity as gas mixture heat conductivity: " << std::boolalpha << Policy::useN2HeatConductivityAsGasMixtureHeatConductivity() << "\n";
349 std::cout << " - use ideal gas heat capacities: " << std::boolalpha << Policy::useIdealGasHeatCapacities() << std::endl;
350
352 {
353 TabulatedH2O::init(tempMin, tempMax, nTemp,
354 pressMin, pressMax, nPress);
355 }
356 }
357
358 using Base::density;
371 template <class FluidState>
372 static Scalar density(const FluidState &fluidState,
373 int phaseIdx)
374 {
375 assert(0 <= phaseIdx && phaseIdx < numPhases);
376
377 Scalar T = fluidState.temperature(phaseIdx);
378 Scalar p = fluidState.pressure(phaseIdx);
379
380 // liquid phase
381 if (phaseIdx == liquidPhaseIdx) {
382 if (Policy::useH2ODensityAsLiquidMixtureDensity())
383 // assume pure water
384 return H2O::liquidDensity(T, p);
385 else
386 {
387 // See: Eq. (7) in Class et al. (2002a)
388 // This assumes each gas molecule displaces exactly one
389 // molecule in the liquid.
390 return H2O::liquidMolarDensity(T, p)
391 * (H2O::molarMass()*fluidState.moleFraction(liquidPhaseIdx, H2OIdx)
392 + N2::molarMass()*fluidState.moleFraction(liquidPhaseIdx, N2Idx));
393 }
394 }
395
396 // gas phase
397 using std::max;
398 if (Policy::useIdealGasDensity())
399 // for the gas phase assume an ideal gas
400 {
401 const Scalar averageMolarMass = fluidState.averageMolarMass(gasPhaseIdx);
402 return IdealGas::density(averageMolarMass, T, p);
403 }
404
405 // assume ideal mixture: steam and nitrogen don't "see" each other
406 Scalar rho_gH2O = H2O::gasDensity(T, fluidState.partialPressure(gasPhaseIdx, H2OIdx));
407 Scalar rho_gN2 = N2::gasDensity(T, fluidState.partialPressure(gasPhaseIdx, N2Idx));
408 return (rho_gH2O + rho_gN2);
409 }
410
411 using Base::molarDensity;
424 template <class FluidState>
425 static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
426 {
427 assert(0 <= phaseIdx && phaseIdx < numPhases);
428
429 Scalar T = fluidState.temperature(phaseIdx);
430 Scalar p = fluidState.pressure(phaseIdx);
431
432 // liquid phase
433 if (phaseIdx == liquidPhaseIdx)
434 {
435 // assume pure water or that each gas molecule displaces exactly one
436 // molecule in the liquid.
437 return H2O::liquidMolarDensity(T, p);
438 }
439
440 // gas phase
441 using std::max;
442 if (Policy::useIdealGasDensity())
443 // for the gas phase assume an ideal gas
444 {
445 return IdealGas::molarDensity(T, p);
446 }
447
448 // assume ideal mixture: steam and nitrogen don't "see" each other
449 Scalar rho_gH2O = H2O::gasMolarDensity(T, fluidState.partialPressure(gasPhaseIdx, H2OIdx));
450 Scalar rho_gN2 = N2::gasMolarDensity(T, fluidState.partialPressure(gasPhaseIdx, N2Idx));
451 return rho_gH2O + rho_gN2;
452 }
453
454 using Base::viscosity;
467 template <class FluidState>
468 static Scalar viscosity(const FluidState &fluidState,
469 int phaseIdx)
470 {
471 assert(0 <= phaseIdx && phaseIdx < numPhases);
472
473 Scalar T = fluidState.temperature(phaseIdx);
474 Scalar p = fluidState.pressure(phaseIdx);
475
476 // liquid phase
477 if (phaseIdx == liquidPhaseIdx) {
478 // assume pure water for the liquid phase
479 return H2O::liquidViscosity(T, p);
480 }
481
482 // gas phase
483 if (Policy::useN2ViscosityAsGasMixtureViscosity())
484 {
485 // assume pure nitrogen for the gas phase
486 return N2::gasViscosity(T, p);
487 }
488 else
489 {
490 // Wilke method (Reid et al.):
491 Scalar muResult = 0;
492 const Scalar mu[numComponents] = {
494 N2::gasViscosity(T, p)
495 };
496
497 Scalar sumx = 0.0;
498 using std::max;
499 for (int compIdx = 0; compIdx < numComponents; ++compIdx)
500 sumx += fluidState.moleFraction(phaseIdx, compIdx);
501 sumx = max(1e-10, sumx);
502
503 for (int i = 0; i < numComponents; ++i) {
504 Scalar divisor = 0;
505// using std::sqrt;
506// using std::pow;
507 for (int j = 0; j < numComponents; ++j) {
508 Scalar phiIJ = 1 + sqrt(mu[i]/mu[j]) * pow(molarMass(j)/molarMass(i), 1/4.0);
509 phiIJ *= phiIJ;
510 phiIJ /= sqrt(8*(1 + molarMass(i)/molarMass(j)));
511 divisor += fluidState.moleFraction(phaseIdx, j)/sumx * phiIJ;
512 }
513 muResult += fluidState.moleFraction(phaseIdx, i)/sumx * mu[i] / divisor;
514 }
515
516 return muResult;
517 }
518 }
519
548 template <class FluidState>
549 static Scalar fugacityCoefficient(const FluidState &fluidState,
550 int phaseIdx,
551 int compIdx)
552 {
553 assert(0 <= phaseIdx && phaseIdx < numPhases);
554 assert(0 <= compIdx && compIdx < numComponents);
555
556 Scalar T = fluidState.temperature(phaseIdx);
557 Scalar p = fluidState.pressure(phaseIdx);
558
559 // liquid phase
560 if (phaseIdx == liquidPhaseIdx) {
561 if (compIdx == H2OIdx)
562 return H2O::vaporPressure(T)/p;
563 return BinaryCoeff::H2O_N2::henry(T)/p;
564 }
565
566 // for the gas phase, assume an ideal gas when it comes to
567 // fugacity (-> fugacity == partial pressure)
568 return 1.0;
569 }
570
595 template <class FluidState>
596 static Scalar diffusionCoefficient(const FluidState &fluidState,
597 int phaseIdx,
598 int compIdx)
599 {
600 DUNE_THROW(Dune::NotImplemented, "Diffusion coefficients");
601 }
602
614 template <class FluidState>
615 static Scalar binaryDiffusionCoefficient(const FluidState &fluidState,
616 int phaseIdx,
617 int compIIdx,
618 int compJIdx)
619
620 {
621 static Scalar undefined(1e10);
622 Valgrind::SetUndefined(undefined);
623
624 if (compIIdx > compJIdx)
625 {
626 using std::swap;
627 swap(compIIdx, compJIdx);
628 }
629
630#ifndef NDEBUG
631 if (compIIdx == compJIdx ||
632 phaseIdx > numPhases - 1 ||
633 compJIdx > numComponents - 1)
634 {
635 DUNE_THROW(Dune::InvalidStateException,
636 "Binary diffusion coefficient of components "
637 << compIIdx << " and " << compJIdx
638 << " in phase " << phaseIdx << " is undefined!\n");
639 }
640#endif
641
642 Scalar T = fluidState.temperature(phaseIdx);
643 Scalar p = fluidState.pressure(phaseIdx);
644
645 // liquid phase
646 if (phaseIdx == liquidPhaseIdx) {
647 if (compIIdx == H2OIdx && compJIdx == N2Idx)
649 return undefined;
650 }
651
652 // gas phase
653 if (compIIdx == H2OIdx && compJIdx == N2Idx)
655 return undefined;
656 }
657
658 using Base::enthalpy;
671 template <class FluidState>
672 static Scalar enthalpy(const FluidState &fluidState,
673 int phaseIdx)
674 {
675 Scalar T = fluidState.temperature(phaseIdx);
676 Scalar p = fluidState.pressure(phaseIdx);
679
680 // liquid phase
681 if (phaseIdx == liquidPhaseIdx) {
682 return H2O::liquidEnthalpy(T, p);
683 }
684 // gas phase
685 else {
686 // assume ideal mixture: which means
687 // that the total specific enthalpy is the sum of the
688 // "partial specific enthalpies" of the components.
689 Scalar hH2O =
690 fluidState.massFraction(gasPhaseIdx, H2OIdx)
691 * H2O::gasEnthalpy(T, p);
692 Scalar hN2 =
693 fluidState.massFraction(gasPhaseIdx, N2Idx)
694 * N2::gasEnthalpy(T, p);
695 return hH2O + hN2;
696 }
697 }
698
705 template <class FluidState>
706 static Scalar componentEnthalpy(const FluidState &fluidState,
707 int phaseIdx,
708 int componentIdx)
709 {
710 const Scalar T = fluidState.temperature(phaseIdx);
711 const Scalar p = fluidState.pressure(phaseIdx);
712
713 if (phaseIdx == liquidPhaseIdx)
714 {
715 if (componentIdx == H2OIdx)
716 return H2O::liquidEnthalpy(T, p);
717 else if (componentIdx == N2Idx)
718 DUNE_THROW(Dune::NotImplemented, "Component enthalpy of nitrogen in liquid phase");
719 else
720 DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << componentIdx);
721 }
722 else if (phaseIdx == gasPhaseIdx)
723 {
724 if (componentIdx == H2OIdx)
725 return H2O::gasEnthalpy(T, p);
726 else if (componentIdx == N2Idx)
727 return N2::gasEnthalpy(T, p);
728 else
729 DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << componentIdx);
730 }
731 else
732 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx);
733 }
734
744 template <class FluidState>
745 static Scalar thermalConductivity(const FluidState &fluidState,
746 const int phaseIdx)
747 {
748 assert(0 <= phaseIdx && phaseIdx < numPhases);
749
750 const Scalar temperature = fluidState.temperature(phaseIdx) ;
751 const Scalar pressure = fluidState.pressure(phaseIdx);
752 if (phaseIdx == liquidPhaseIdx)
753 {
755 }
756 else
757 {
759 if (!Policy::useN2HeatConductivityAsGasMixtureHeatConductivity())
760 {
761 Scalar xN2 = fluidState.moleFraction(phaseIdx, N2Idx);
762 Scalar xH2O = fluidState.moleFraction(phaseIdx, H2OIdx);
763 Scalar lambdaN2 = xN2 * lambdaPureN2;
764 Scalar partialPressure = pressure * xH2O;
765 Scalar lambdaH2O = xH2O * H2O::gasThermalConductivity(temperature, partialPressure);
766 return lambdaN2 + lambdaH2O;
767 }
768 else
769 return lambdaPureN2;
770 }
771 }
772
773 using Base::heatCapacity;
781 template <class FluidState>
782 static Scalar heatCapacity(const FluidState &fluidState,
783 int phaseIdx)
784 {
785 if (phaseIdx == liquidPhaseIdx) {
786 return H2O::liquidHeatCapacity(fluidState.temperature(phaseIdx),
787 fluidState.pressure(phaseIdx));
788 }
789
790 // for the gas phase, assume ideal mixture
791 Scalar c_pN2;
792 Scalar c_pH2O;
793 // let the water and nitrogen components do things their own way
794 if (!Policy::useIdealGasHeatCapacities()) {
795 c_pN2 = N2::gasHeatCapacity(fluidState.temperature(phaseIdx),
796 fluidState.pressure(phaseIdx)
797 * fluidState.moleFraction(phaseIdx, N2Idx));
798
799 c_pH2O = H2O::gasHeatCapacity(fluidState.temperature(phaseIdx),
800 fluidState.pressure(phaseIdx)
801 * fluidState.moleFraction(phaseIdx, H2OIdx));
802 }
803 else {
804 // assume an ideal gas for both components. See:
805 // http://en.wikipedia.org/wiki/Heat_capacity
806 Scalar c_vN2molar = Constants<Scalar>::R*2.39;
807 Scalar c_pN2molar = Constants<Scalar>::R + c_vN2molar;
808
809 Scalar c_vH2Omolar = Constants<Scalar>::R*3.37; // <- correct??
810 Scalar c_pH2Omolar = Constants<Scalar>::R + c_vH2Omolar;
811
812 c_pN2 = c_pN2molar/molarMass(N2Idx);
813 c_pH2O = c_pH2Omolar/molarMass(H2OIdx);
814 }
815
816 // mangle both components together
817 return c_pH2O*fluidState.massFraction(gasPhaseIdx, H2OIdx)
818 + c_pN2*fluidState.massFraction(gasPhaseIdx, N2Idx);
819 }
820};
821
822} // end namespace FluidSystems
823
824} // end namespace Dumux
825
826#endif
Some exceptions thrown in DuMux
Some templates to wrap the valgrind macros.
A collection of input/output field names for common physical quantities.
Binary coefficients for water and nitrogen.
Material properties of pure water .
Properties of pure molecular nitrogen .
Tabulates all thermodynamic properties of a given untabulated chemical species.
Relations valid for an ideal gas.
bool CheckDefined(const T &value)
Make valgrind complain if the object occupied by an object is undefined.
Definition: valgrind.hh:72
void SetUndefined(const T &value)
Make the memory on which an object resides undefined.
Definition: valgrind.hh:102
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
std::string gaseousPhase() noexcept
I/O name of gaseous phase.
Definition: name.hh:123
std::string liquidPhase() noexcept
I/O name of liquid phase.
Definition: name.hh:119
std::string pressure(int phaseIdx) noexcept
I/O name of pressure for multiphase systems.
Definition: name.hh:34
static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure)
Diffusion coefficient for molecular nitrogen in liquid water.
Definition: h2o_n2.hh:97
static Scalar henry(Scalar temperature)
Henry coefficient for molecular nitrogen in liquid water.
Definition: h2o_n2.hh:48
static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
Binary diffusion coefficient for molecular water and nitrogen.
Definition: h2o_n2.hh:66
Properties of pure molecular nitrogen .
Definition: n2.hh:47
static Scalar criticalTemperature()
Returns the critical temperature of molecular nitrogen.
Definition: n2.hh:66
static Scalar criticalPressure()
Returns the critical pressure of molecular nitrogen.
Definition: n2.hh:72
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of at a given pressure and temperature.
Definition: n2.hh:243
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
The molar density of gas in at a given pressure and temperature.
Definition: n2.hh:143
static std::string name()
A human readable name for nitrogen.
Definition: n2.hh:54
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density of gas at a given pressure and temperature.
Definition: n2.hh:130
static constexpr Scalar molarMass()
The molar mass in of molecular nitrogen.
Definition: n2.hh:60
static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of nitrogen.
Definition: n2.hh:281
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: n2.hh:155
static const Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of pure nitrogen gas.
Definition: n2.hh:176
static const Scalar gasHeatCapacity(Scalar T, Scalar pressure)
Specific isobaric heat capacity of pure nitrogen gas.
Definition: n2.hh:213
Tabulates all thermodynamic properties of a given untabulated chemical species.
Definition: tabulatedcomponent.hh:82
static const Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of the gas .
Definition: tabulatedcomponent.hh:238
static Scalar criticalTemperature()
Returns the critical temperature in of the component.
Definition: tabulatedcomponent.hh:184
static const Scalar gasHeatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of the gas .
Definition: tabulatedcomponent.hh:292
static std::string name()
A human readable name for the component.
Definition: tabulatedcomponent.hh:172
static Scalar liquidThermalConductivity(Scalar temperature, Scalar pressure)
The thermal conductivity of liquid water .
Definition: tabulatedcomponent.hh:619
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density of gas at a given pressure and temperature .
Definition: tabulatedcomponent.hh:456
static const Scalar liquidEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of the liquid .
Definition: tabulatedcomponent.hh:265
static Scalar criticalPressure()
Returns the critical pressure in of the component.
Definition: tabulatedcomponent.hh:190
static Scalar liquidMolarDensity(Scalar temperature, Scalar pressure)
The molar density of liquid in at a given pressure and temperature.
Definition: tabulatedcomponent.hh:529
static constexpr Scalar molarMass()
The molar mass in of the component.
Definition: tabulatedcomponent.hh:178
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of liquid.
Definition: tabulatedcomponent.hh:565
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of gas.
Definition: tabulatedcomponent.hh:538
static constexpr bool liquidIsCompressible()
Returns true if the liquid phase is assumed to be compressible.
Definition: tabulatedcomponent.hh:439
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
The density of liquid at a given pressure and temperature .
Definition: tabulatedcomponent.hh:495
static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
The thermal conductivity of gaseous water .
Definition: tabulatedcomponent.hh:592
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
The molar density of gas in at a given pressure and temperature.
Definition: tabulatedcomponent.hh:485
static constexpr bool isTabulated
state that we are tabulated
Definition: tabulatedcomponent.hh:88
static Scalar vaporPressure(Scalar T)
The vapor pressure in of the component at a given temperature.
Definition: tabulatedcomponent.hh:211
static void init(Scalar tempMin, Scalar tempMax, std::size_t nTemp, Scalar pressMin, Scalar pressMax, std::size_t nPress)
Initialize the tables.
Definition: tabulatedcomponent.hh:100
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: tabulatedcomponent.hh:445
static const Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of the liquid .
Definition: tabulatedcomponent.hh:319
A central place for various physical constants occuring in some equations.
Definition: constants.hh:39
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 thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: fluidsystems/base.hh:390
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient of an individual component in a fluid phase.
Definition: fluidsystems/base.hh:197
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the binary molecular diffusion coefficient for a component in a fluid phase .
Definition: fluidsystems/base.hh:278
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 enthalpy(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy .
Definition: fluidsystems/base.hh:363
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
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: fluidsystems/base.hh:424
Policy for the H2O-N2 fluid system.
Definition: h2on2.hh:52
static constexpr bool useIdealGasHeatCapacities()
Definition: h2on2.hh:57
static constexpr bool useN2HeatConductivityAsGasMixtureHeatConductivity()
Definition: h2on2.hh:56
static constexpr bool useIdealGasDensity()
Definition: h2on2.hh:54
static constexpr bool useH2ODensityAsLiquidMixtureDensity()
Definition: h2on2.hh:53
static constexpr bool useN2ViscosityAsGasMixtureViscosity()
Definition: h2on2.hh:55
A two-phase fluid system with two components water Nitrogen for non-equilibrium models.
Definition: h2on2.hh:69
static constexpr bool isGas(int phaseIdx)
Return whether a phase is gaseous.
Definition: h2on2.hh:127
static constexpr int liquidPhaseIdx
index of the liquid phase
Definition: h2on2.hh:85
static bool isIdealMixture(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: h2on2.hh:147
static Scalar molarMass(int compIdx)
Return the molar mass of a component in .
Definition: h2on2.hh:215
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase. .
Definition: h2on2.hh:782
static Scalar thermalConductivity(const FluidState &fluidState, const int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: h2on2.hh:745
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: h2on2.hh:615
static constexpr int phase1Idx
index of the second phase
Definition: h2on2.hh:88
static constexpr int liquidCompIdx
index of the liquid component
Definition: h2on2.hh:94
static Scalar criticalMolarVolume(int compIdx)
Molar volume of a component at the critical point .
Definition: h2on2.hh:288
static constexpr int N2Idx
Definition: h2on2.hh:91
static constexpr bool isCompressible(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: h2on2.hh:165
static constexpr int comp1Idx
index of the second component
Definition: h2on2.hh:93
static constexpr int gasPhaseIdx
index of the gas phase
Definition: h2on2.hh:86
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition: h2on2.hh:199
static constexpr int H2OIdx
Definition: h2on2.hh:90
static void init(Scalar tempMin, Scalar tempMax, unsigned nTemp, Scalar pressMin, Scalar pressMax, unsigned nPress)
Initialize the fluid system's static parameters using problem specific temperature and pressure range...
Definition: h2on2.hh:341
static void init()
Initialize the fluid system's static parameters generically.
Definition: h2on2.hh:320
static constexpr int comp0Idx
index of the first component
Definition: h2on2.hh:92
static Scalar componentEnthalpy(const FluidState &fluidState, int phaseIdx, int componentIdx)
Returns the specific enthalpy of a component in the specified phase.
Definition: h2on2.hh:706
static Scalar acentricFactor(int compIdx)
The acentric factor of a component .
Definition: h2on2.hh:299
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient of an individual component in a fluid phase.
Definition: h2on2.hh:549
static constexpr int phase0Idx
index of the first phase
Definition: h2on2.hh:87
static Scalar density(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature, pressure, and the partial pressures of all components,...
Definition: h2on2.hh:372
static Scalar kelvinVaporPressure(const FluidState &fluidState, const int phaseIdx, const int compIdx)
Vapor pressure including the Kelvin equation in .
Definition: h2on2.hh:268
static Scalar criticalPressure(int compIdx)
Critical pressure of a component .
Definition: h2on2.hh:247
static constexpr int numComponents
Number of components in the fluid system.
Definition: h2on2.hh:83
static constexpr int numPhases
Number of phases in the fluid system.
Definition: h2on2.hh:82
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: h2on2.hh:119
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
The molar density of a fluid phase in .
Definition: h2on2.hh:425
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy .
Definition: h2on2.hh:672
static constexpr int gasCompIdx
index of the gas component
Definition: h2on2.hh:95
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the molecular diffusion coefficient for a component in a fluid phase .
Definition: h2on2.hh:596
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: h2on2.hh:468
static bool isIdealGas(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: h2on2.hh:181
static Scalar criticalTemperature(int compIdx)
Critical temperature of a component .
Definition: h2on2.hh:231
static std::string phaseName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: h2on2.hh:105
Relations valid for an ideal gas.
Definition: idealgas.hh:37
static constexpr Scalar density(Scalar avgMolarMass, Scalar temperature, Scalar pressure)
The density of the gas in , depending on pressure, temperature and average molar mass of the gas.
Definition: idealgas.hh:49
static constexpr Scalar molarDensity(Scalar temperature, Scalar pressure)
The molar density of the gas , depending on pressure and temperature.
Definition: idealgas.hh:70
Fluid system base class.