version 3.8
brineco2.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_BRINE_CO2_FLUID_SYSTEM_HH
13#define DUMUX_BRINE_CO2_FLUID_SYSTEM_HH
14
15#include <type_traits>
16
17#include <dune/common/exceptions.hh>
18
24
28
30
31#include <dumux/io/name.hh>
32
34
42 template<bool useConstantSalinity>
44
50 template<>
51 struct BrineCO2Indices<true>
52 {
53 static constexpr int BrineIdx = 0;
54 };
55
61 template<>
62 struct BrineCO2Indices<false>
63 {
64 static constexpr int H2OIdx = 0;
65 static constexpr int NaClIdx = 2;
66 static constexpr int comp2Idx = 2;
67 };
68
69} // end namespace Dumux::FluidSystems::Detail
70
71
72namespace Dumux::FluidSystems {
73
78template<bool salinityIsConstant, bool fastButSimplifiedRelations = false>
80{
81 static constexpr bool useConstantSalinity() { return salinityIsConstant; }
82 static constexpr bool useCO2GasDensityAsGasMixtureDensity() { return fastButSimplifiedRelations; }
83};
84
95template< class Scalar,
96 class CO2Component,
98 class Policy = BrineCO2DefaultPolicy</*constantSalinity?*/true> >
100: public Base<Scalar, BrineCO2<Scalar, CO2Component, H2OType, Policy>>
101, public Detail::BrineCO2Indices<Policy::useConstantSalinity()>
102{
104 // binary coefficients
106
107 // use constant salinity brine?
108 static constexpr bool useConstantSalinity = Policy::useConstantSalinity();
109
110 // The possible brine types
113 using BrineType = typename std::conditional_t< useConstantSalinity,
116
125 static constexpr int BrineOrH2OIdx = 0;
127 static constexpr int NaClIdx = 2;
128
129public:
131
132 using H2O = H2OType;
133 using Brine = BrineType;
134 using CO2 = CO2Component;
135
136 static constexpr int numComponents = useConstantSalinity ? 2 : 3;
137 static constexpr int numPhases = 2;
138
139 static constexpr int liquidPhaseIdx = 0;
140 static constexpr int gasPhaseIdx = 1;
141 static constexpr int phase0Idx = liquidPhaseIdx;
142 static constexpr int phase1Idx = gasPhaseIdx;
143
144 static constexpr int comp0Idx = 0;
145 static constexpr int comp1Idx = 1;
146
147 // CO2 is always the second component
148 static constexpr int CO2Idx = comp1Idx;
149
150private:
151
152 // Adapter policy for the fluid state corresponding to the brine fluid system
153 struct BrineAdapterPolicy
154 {
155 using FluidSystem = VariableSalinityBrine;
156
157 static constexpr int phaseIdx(int brinePhaseIdx) { return liquidPhaseIdx; }
158 static constexpr int compIdx(int brineCompIdx)
159 {
160 assert(brineCompIdx == VariableSalinityBrine::H2OIdx || brineCompIdx == VariableSalinityBrine::NaClIdx);
161 switch (brineCompIdx)
162 {
163 case VariableSalinityBrine::H2OIdx: return BrineOrH2OIdx;
164 case VariableSalinityBrine::NaClIdx: return NaClIdx;
165 default: return 0; // this will never be reached, only needed to suppress compiler warning
166 }
167 }
168 };
169
170 template<class FluidState>
172
173public:
174
179 static std::string phaseName(int phaseIdx)
180 {
181 switch (phaseIdx)
182 {
183 case liquidPhaseIdx: return IOName::liquidPhase();
184 case gasPhaseIdx: return IOName::gaseousPhase();
185 }
186 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx);
187 }
188
192 static constexpr bool isMiscible()
193 { return true; }
194
200 static constexpr bool isGas(int phaseIdx)
201 {
202 assert(0 <= phaseIdx && phaseIdx < numPhases);
203
204 return phaseIdx == gasPhaseIdx;
205 }
206
212 static constexpr bool isIdealGas(int phaseIdx)
213 {
214 assert(0 <= phaseIdx && phaseIdx < numPhases);
215 // let the fluids decide
216 if (phaseIdx == gasPhaseIdx)
217 return useConstantSalinity ? (ConstantSalinityBrine::gasIsIdeal() && CO2::gasIsIdeal())
218 : (H2O::gasIsIdeal() && CO2::gasIsIdeal());
219 return false; // not a gas
220 }
221
236 static bool isIdealMixture(int phaseIdx)
237 {
238 assert(0 <= phaseIdx && phaseIdx < numPhases);
239 if (phaseIdx == liquidPhaseIdx)
240 return false;
241 return true;
242 }
243
253 static constexpr bool isCompressible(int phaseIdx)
254 {
255 assert(0 <= phaseIdx && phaseIdx < numPhases);
256 if (phaseIdx == liquidPhaseIdx)
257 return useConstantSalinity ? ConstantSalinityBrine::liquidIsCompressible()
259 return true;
260 }
261
266 static std::string componentName(int compIdx)
267 {
268 assert(0 <= compIdx && compIdx < numComponents);
269 if (useConstantSalinity)
270 {
271 static std::string name[] = { ConstantSalinityBrine::name(), CO2::name() };
272 return name[compIdx];
273 }
274 else
275 {
277 CO2::name(),
279 return name[compIdx];
280 }
281 }
282
287 static Scalar molarMass(int compIdx)
288 {
289 assert(0 <= compIdx && compIdx < numComponents);
290 if (useConstantSalinity)
291 {
292 static const Scalar M[] = { ConstantSalinityBrine::molarMass(), CO2::molarMass() };
293 return M[compIdx];
294 }
295 else
296 {
298 CO2::molarMass(),
300 return M[compIdx];
301 }
302 }
303
304 /****************************************
305 * thermodynamic relations
306 ****************************************/
307
308 // Initializing with salinity and default tables
309 static void init()
310 {
311 init(/*startTemp=*/273.15, /*endTemp=*/623.15, /*tempSteps=*/100,
312 /*startPressure=*/1e4, /*endPressure=*/40e6, /*pressureSteps=*/200);
313 }
314
315 // Initializing with custom tables
316 static void init(Scalar startTemp, Scalar endTemp, int tempSteps,
317 Scalar startPressure, Scalar endPressure, int pressureSteps)
318 {
319 std::cout << "The Brine-CO2 fluid system was configured with the following policy:\n";
320 std::cout << " - use constant salinity: " << std::boolalpha << Policy::useConstantSalinity() << "\n";
321 std::cout << " - use CO2 gas density as gas mixture density: " << std::boolalpha << Policy::useCO2GasDensityAsGasMixtureDensity() << std::endl;
322
323 if (H2O::isTabulated)
324 H2O::init(startTemp, endTemp, tempSteps, startPressure, endPressure, pressureSteps);
325 }
326
336 template <class FluidState>
337 static Scalar density(const FluidState& fluidState, int phaseIdx)
338 {
339 Scalar T = fluidState.temperature(phaseIdx);
340 if (phaseIdx == liquidPhaseIdx)
341 return liquidDensityMixture_(fluidState);
342
343 else if (phaseIdx == gasPhaseIdx)
344 {
345 if (Policy::useCO2GasDensityAsGasMixtureDensity())
346 // use the CO2 gas density only and neglect compositional effects
347 return CO2::gasDensity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
348 else
349 {
350 // assume ideal mixture: steam and CO2 don't "see" each other
351 Scalar rho_gH2O = H2O::gasDensity(T, fluidState.partialPressure(gasPhaseIdx, BrineOrH2OIdx));
352 Scalar rho_gCO2 = CO2::gasDensity(T, fluidState.partialPressure(gasPhaseIdx, CO2Idx));
353 return (rho_gH2O + rho_gCO2);
354 }
355 }
356
357 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
358 }
359
362 template <class FluidState>
363 static Scalar molarDensity(const FluidState& fluidState, int phaseIdx)
364 {
365 Scalar T = fluidState.temperature(phaseIdx);
366 if (phaseIdx == liquidPhaseIdx)
367 return density(fluidState, phaseIdx)/fluidState.averageMolarMass(phaseIdx);
368 else if (phaseIdx == gasPhaseIdx)
369 {
370 if (Policy::useCO2GasDensityAsGasMixtureDensity())
371 return CO2::gasMolarDensity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
372 else
373 {
374 // assume ideal mixture: steam and CO2 don't "see" each other
375 Scalar rhoMolar_gH2O = H2O::gasMolarDensity(T, fluidState.partialPressure(gasPhaseIdx, BrineOrH2OIdx));
376 Scalar rhoMolar_gCO2 = CO2::gasMolarDensity(T, fluidState.partialPressure(gasPhaseIdx, CO2Idx));
377 return rhoMolar_gH2O + rhoMolar_gCO2;
378 }
379 }
380 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
381 }
382
394 template <class FluidState>
395 static Scalar viscosity(const FluidState& fluidState, int phaseIdx)
396 {
397 Scalar T = fluidState.temperature(phaseIdx);
398 Scalar p = fluidState.pressure(phaseIdx);
399
400 if (phaseIdx == liquidPhaseIdx)
401 return useConstantSalinity ? ConstantSalinityBrine::liquidViscosity(T, p)
404 else if (phaseIdx == gasPhaseIdx)
405 return CO2::gasViscosity(T, p);
406
407 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
408 }
409
412 template <class FluidState>
413 static Scalar fugacityCoefficient(const FluidState& fluidState,
414 int phaseIdx,
415 int compIdx)
416 {
417 assert(0 <= compIdx && compIdx < numComponents);
418
419 if (phaseIdx == gasPhaseIdx)
420 // use the fugacity coefficients of an ideal gas. the
421 // actual value of the fugacity is not relevant, as long
422 // as the relative fluid compositions are observed,
423 return 1.0;
424
425 else if (phaseIdx == liquidPhaseIdx)
426 {
427 Scalar T = fluidState.temperature(phaseIdx);
428 Scalar pl = fluidState.pressure(liquidPhaseIdx);
429 Scalar pg = fluidState.pressure(gasPhaseIdx);
430
431 assert(T > 0);
432 assert(pl > 0 && pg > 0);
433
434 // calculate the equilibrium composition for given T & p
435 Scalar xlH2O, xgH2O;
436 Scalar xlCO2, xgCO2;
437 const Scalar salinity = useConstantSalinity ? ConstantSalinityBrine::salinity()
438 : fluidState.massFraction(liquidPhaseIdx, NaClIdx);
439 Brine_CO2::calculateMoleFractions(T, pl, salinity, /*knownGasPhaseIdx=*/-1, xlCO2, xgH2O);
440
441 // normalize the phase compositions
442 using std::min;
443 using std::max;
444 xlCO2 = max(0.0, min(1.0, xlCO2));
445 xgH2O = max(0.0, min(1.0, xgH2O));
446 xlH2O = 1.0 - xlCO2;
447 xgCO2 = 1.0 - xgH2O;
448
449 if (compIdx == BrineOrH2OIdx)
450 return (xgH2O/xlH2O)*(pg/pl);
451
452 else if (compIdx == CO2Idx)
453 return (xgCO2/xlCO2)*(pg/pl);
454
455 // NaCl is assumed to stay in the liquid!
456 else if (!useConstantSalinity && compIdx == NaClIdx)
457 return 0.0;
458
459 DUNE_THROW(Dune::InvalidStateException, "Invalid component index.");
460 }
461
462 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
463 }
464
471 template <class FluidState>
472 static Scalar equilibriumMoleFraction(const FluidState& fluidState,
473 const ParameterCache& paramCache,
474 int phaseIdx)
475 {
476 Scalar T = fluidState.temperature(phaseIdx);
477 Scalar p = fluidState.pressure(phaseIdx);
478
479 assert(T > 0);
480 assert(p > 0);
481
482 Scalar xgH2O;
483 Scalar xlCO2;
484
485 // calculate the equilibrium composition for given T & p
486 const Scalar salinity = useConstantSalinity ? ConstantSalinityBrine::salinity()
487 : fluidState.massFraction(liquidPhaseIdx, NaClIdx);
488 Brine_CO2::calculateMoleFractions(T, p, salinity, /*knowgasPhaseIdx=*/-1, xlCO2, xgH2O);
489
490 if (phaseIdx == gasPhaseIdx)
491 return xgH2O;
492 else if (phaseIdx == liquidPhaseIdx)
493 return xlCO2;
494
495 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
496 }
497
498
525 template <class FluidState>
526 static Scalar diffusionCoefficient(const FluidState& fluidState, int phaseIdx, int compIdx)
527 { DUNE_THROW(Dune::NotImplemented, "Diffusion coefficients"); }
528
530 // \copydoc Base<Scalar,ThisType>::binaryDiffusionCoefficient(const FluidState&,int,int,int)
531 template <class FluidState>
532 static Scalar binaryDiffusionCoefficient(const FluidState& fluidState,
533 int phaseIdx,
534 int compIIdx,
535 int compJIdx)
536 {
537 assert(0 <= compIIdx && compIIdx < numComponents);
538 assert(0 <= compJIdx && compJIdx < numComponents);
539
540 if (compIIdx > compJIdx)
541 {
542 using std::swap;
543 swap(compIIdx, compJIdx);
544 }
545
546 Scalar T = fluidState.temperature(phaseIdx);
547 Scalar p = fluidState.pressure(phaseIdx);
548 if (phaseIdx == liquidPhaseIdx)
549 {
550 if (compIIdx == BrineOrH2OIdx && compJIdx == CO2Idx)
551 return Brine_CO2::liquidDiffCoeff(T, p);
552 if (!useConstantSalinity && compIIdx == BrineOrH2OIdx && compJIdx == NaClIdx)
557
558 DUNE_THROW(Dune::NotImplemented, "Binary diffusion coefficient of components " <<
559 compIIdx << " and " << compJIdx << " in phase " << phaseIdx);
560 }
561 else if (phaseIdx == gasPhaseIdx)
562 {
563 if (compIIdx == BrineOrH2OIdx && compJIdx == CO2Idx)
564 return Brine_CO2::gasDiffCoeff(T, p);
565
566 // NaCl is expected to never be present in the gas phase. we need to
567 // return a diffusion coefficient that does not case numerical problems.
568 // We choose a very small value here.
569 else if (!useConstantSalinity && compIIdx == CO2Idx && compJIdx == NaClIdx)
570 return 1e-12;
571
572 DUNE_THROW(Dune::NotImplemented, "Binary diffusion coefficient of components " <<
573 compIIdx << " and " << compJIdx << " in phase " << phaseIdx);
574 }
575
576 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
577 }
578
580 // \copydoc Base<Scalar,ThisType>::enthalpy(const FluidState&,int)
581 template <class FluidState>
582 static Scalar enthalpy(const FluidState& fluidState, int phaseIdx)
583 {
584 Scalar T = fluidState.temperature(phaseIdx);
585 Scalar p = fluidState.pressure(phaseIdx);
586
587 if (phaseIdx == liquidPhaseIdx)
588 {
589 // Convert J/kg to kJ/kg
590 const Scalar h_ls1 = useConstantSalinity ? ConstantSalinityBrine::liquidEnthalpy(T, p)/1e3
593
594 // mass fraction of CO2 in Brine
595 const Scalar X_CO2_w = fluidState.massFraction(liquidPhaseIdx, CO2Idx);
596
597 // heat of dissolution for CO2 according to Fig. 6 in Duan and Sun 2003. (kJ/kg)
598 // In the relevant temperature ranges CO2 dissolution is exothermal
599 const Scalar delta_hCO2 = (-57.4375 + T * 0.1325) * 1000/44;
600
601 // enthalpy contribution of water and CO2 (kJ/kg)
602 const Scalar hw = H2O::liquidEnthalpy(T, p)/1e3;
603 const Scalar hg = CO2::liquidEnthalpy(T, p)/1e3 + delta_hCO2;
604
605 // Enthalpy of brine with dissolved CO2 (kJ/kg)
606 return (h_ls1 - X_CO2_w*hw + hg*X_CO2_w)*1e3;
607 }
608 else if (phaseIdx == gasPhaseIdx)
609 {
610 // we assume NaCl to not enter the gas phase, only consider H2O and CO2
611 return H2O::gasEnthalpy(T, p)*fluidState.massFraction(gasPhaseIdx, BrineOrH2OIdx)
612 + CO2::gasEnthalpy(T, p) *fluidState.massFraction(gasPhaseIdx, CO2Idx);
613 }
614
615 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
616 }
617
624 template <class FluidState>
625 static Scalar componentEnthalpy(const FluidState& fluidState, int phaseIdx, int componentIdx)
626 {
627 const Scalar T = fluidState.temperature(phaseIdx);
628 const Scalar p = fluidState.pressure(phaseIdx);
629
630 if (phaseIdx == liquidPhaseIdx)
631 {
632 if (componentIdx == BrineOrH2OIdx)
633 return H2O::liquidEnthalpy(T, p);
634 else if (componentIdx == CO2Idx)
635 return CO2::liquidEnthalpy(T, p);
636 else if (componentIdx == NaClIdx)
637 DUNE_THROW(Dune::NotImplemented, "The component enthalpy for NaCl is not implemented.");
638 DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << componentIdx);
639 }
640 else if (phaseIdx == gasPhaseIdx)
641 {
642 if (componentIdx == BrineOrH2OIdx)
643 return H2O::gasEnthalpy(T, p);
644 else if (componentIdx == CO2Idx)
645 return CO2::gasEnthalpy(T, p);
646 else if (componentIdx == NaClIdx)
647 DUNE_THROW(Dune::InvalidStateException, "Implementation assumes NaCl not to be present in gas phase");
648 DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << componentIdx);
649 }
650 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx);
651 }
652
663 template <class FluidState>
664 static Scalar thermalConductivity(const FluidState& fluidState, int phaseIdx)
665 {
666 if (phaseIdx == liquidPhaseIdx)
667 return useConstantSalinity ? ConstantSalinityBrine::liquidThermalConductivity( fluidState.temperature(phaseIdx),
668 fluidState.pressure(phaseIdx) )
671 else if (phaseIdx == gasPhaseIdx)
672 return CO2::gasThermalConductivity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
673
674 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
675 }
676
688 template <class FluidState>
689 static Scalar heatCapacity(const FluidState &fluidState,
690 int phaseIdx)
691 {
692 if(phaseIdx == liquidPhaseIdx)
693 return useConstantSalinity ? ConstantSalinityBrine::liquidHeatCapacity( fluidState.temperature(phaseIdx),
694 fluidState.pressure(phaseIdx) )
697 else if (phaseIdx == gasPhaseIdx)
698 return CO2::liquidHeatCapacity(fluidState.temperature(phaseIdx),
699 fluidState.pressure(phaseIdx));
700
701 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
702 }
703
704private:
705
712 template<class FluidState>
713 static Scalar liquidDensityMixture_(const FluidState& fluidState)
714 {
715 const auto T = fluidState.temperature(liquidPhaseIdx);
716 const auto p = fluidState.pressure(liquidPhaseIdx);
717
718 if (T < 273.15)
719 DUNE_THROW(NumericalProblem, "Liquid density for Brine and CO2 is only "
720 "defined above 273.15K (T = " << T << ")");
721
722 if (p >= 2.5e8)
723 DUNE_THROW(NumericalProblem, "Liquid density for Brine and CO2 is only "
724 "defined below 250MPa (p = " << p << ")");
725
726 // density of pure water
727 Scalar rho_pure = H2O::liquidDensity(T, p);
728
729 // density of water with dissolved CO2 (neglect NaCl)
730 Scalar rho_lCO2;
731 if (useConstantSalinity)
732 {
733 // use normalized composition for to calculate the density
734 // (the relations don't seem to take non-normalized compositions too well...)
735 // TODO Do we really need this normalization???
736 using std::min;
737 using std::max;
738 Scalar xlBrine = min(1.0, max(0.0, fluidState.moleFraction(liquidPhaseIdx, BrineOrH2OIdx)));
739 Scalar xlCO2 = min(1.0, max(0.0, fluidState.moleFraction(liquidPhaseIdx, CO2Idx)));
740 Scalar sumx = xlBrine + xlCO2;
741 xlBrine /= sumx;
742 xlCO2 /= sumx;
743
744 rho_lCO2 = liquidDensityWaterCO2_(T, p, xlBrine, xlCO2);
745 }
746 else
747 {
748 // rescale mole fractions
749 auto xlH2O = fluidState.moleFraction(liquidPhaseIdx, BrineOrH2OIdx);
750 auto xlCO2 = fluidState.moleFraction(liquidPhaseIdx, NaClIdx);
751 const auto sumMoleFrac = xlH2O + xlCO2;
752 xlH2O = xlH2O/sumMoleFrac;
753 xlCO2 = xlCO2/sumMoleFrac;
754 rho_lCO2 = liquidDensityWaterCO2_(T, p, xlH2O, xlCO2);
755 }
756
757 // density of brine (water with nacl)
758 Scalar rho_brine = useConstantSalinity ? ConstantSalinityBrine::liquidDensity(T, p)
759 : VariableSalinityBrine::density( BrineAdapter<FluidState>(fluidState),
760 VariableSalinityBrine::liquidPhaseIdx );
761
762 // contribution of co2 to the density
763 Scalar contribCO2 = rho_lCO2 - rho_pure;
764
765 // Total brine density with dissolved CO2
766 // rho_{b, CO2} = rho_pure + contribution(salt) + contribution(CO2)
767 return rho_brine + contribCO2;
768 }
769
770
781 static Scalar liquidDensityWaterCO2_(Scalar temperature,
782 Scalar pl,
783 Scalar xlH2O,
784 Scalar xlCO2)
785 {
786 const Scalar M_CO2 = CO2::molarMass();
787 const Scalar M_H2O = H2O::molarMass();
788
789 const Scalar tempC = temperature - 273.15; /* tempC : temperature in °C */
790 const Scalar rho_pure = H2O::liquidDensity(temperature, pl);
791
792 // xlH2O is available, but in case of a pure gas phase
793 // the value of M_T for the virtual liquid phase can become very large
794 xlH2O = 1.0 - xlCO2;
795 const Scalar M_T = M_H2O * xlH2O + M_CO2 * xlCO2;
796 const Scalar V_phi = (37.51 +
797 tempC*(-9.585e-2 +
798 tempC*(8.74e-4 -
799 tempC*5.044e-7))) / 1.0e6;
800 return 1/(xlCO2 * V_phi/M_T + M_H2O * xlH2O / (rho_pure * M_T));
801 }
802};
803
804} // end namespace Dumux::FluidSystems
805
806#endif
Adapter class for fluid states with different indices.
Binary coefficients for CO2 and brine.
Binary coefficients for brine and CO2.
Definition: brine_co2.hh:32
static void calculateMoleFractions(const Scalar temperature, const Scalar pg, const Scalar salinity, const int knownPhaseIdx, Scalar &xlCO2, Scalar &ygH2O)
Returns the mol (!) fraction of CO2 in the liquid phase and the mol (!) fraction of H2O in the gas ph...
Definition: brine_co2.hh:102
static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure)
Binary diffusion coefficient of CO2 in the brine phase.
Definition: brine_co2.hh:72
static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
Binary diffusion coefficient of water in the CO2 phase.
Definition: brine_co2.hh:46
A class for the brine fluid properties.
Definition: components/brine.hh:44
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of pure brine.
Definition: components/brine.hh:407
static const Scalar liquidEnthalpy(Scalar T, Scalar p)
Specific enthalpy of liquid brine .
Definition: components/brine.hh:149
static Scalar molarMass()
The molar mass in of brine. This assumes that the salt is pure NaCl.
Definition: components/brine.hh:71
static Scalar salinity()
Return the constant salinity.
Definition: components/brine.hh:61
static Scalar liquidThermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of a brine .
Definition: components/brine.hh:431
static const Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of brine .
Definition: components/brine.hh:208
static constexpr bool liquidIsCompressible()
Returns true if the liquid phase is assumed to be compressible.
Definition: components/brine.hh:291
static std::string name()
A human readable name for the brine.
Definition: components/brine.hh:55
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: components/brine.hh:279
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
The density of pure brine at a given pressure and temperature .
Definition: components/brine.hh:306
static std::string name()
A human readable name for the NaCl.
Definition: nacl.hh:40
Tabulates all thermodynamic properties of a given component.
Definition: tabulatedcomponent.hh:672
Adapter class for fluid states with different indices.
Definition: adapter.hh:32
Fluid system base class.
Definition: fluidsystems/base.hh:33
A compositional fluid with brine (H2O & NaCl) and carbon dioxide as components in both the liquid and...
Definition: brineco2.hh:102
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: brineco2.hh:395
static constexpr int comp1Idx
Definition: brineco2.hh:145
static constexpr int liquidPhaseIdx
index of the liquid phase
Definition: brineco2.hh:139
CO2Component CO2
Definition: brineco2.hh:134
static constexpr int phase1Idx
index of the second phase
Definition: brineco2.hh:142
static Scalar equilibriumMoleFraction(const FluidState &fluidState, const ParameterCache &paramCache, int phaseIdx)
Returns the equilibrium mole fraction of the dissolved component in a phase.
Definition: brineco2.hh:472
static constexpr int numComponents
Definition: brineco2.hh:136
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: brineco2.hh:664
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: brineco2.hh:689
static void init(Scalar startTemp, Scalar endTemp, int tempSteps, Scalar startPressure, Scalar endPressure, int pressureSteps)
Definition: brineco2.hh:316
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: brineco2.hh:192
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Definition: brineco2.hh:582
H2OType H2O
Definition: brineco2.hh:132
static Scalar componentEnthalpy(const FluidState &fluidState, int phaseIdx, int componentIdx)
Returns the specific enthalpy of a component in a specific phase.
Definition: brineco2.hh:625
static constexpr bool isGas(int phaseIdx)
Return whether a phase is gaseous.
Definition: brineco2.hh:200
static Scalar density(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature, pressure, and the partial pressures of all components,...
Definition: brineco2.hh:337
static constexpr bool isCompressible(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: brineco2.hh:253
static void init()
Definition: brineco2.hh:309
static constexpr int CO2Idx
Definition: brineco2.hh:148
static std::string phaseName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: brineco2.hh:179
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIIdx, int compJIdx)
Definition: brineco2.hh:532
static constexpr bool isIdealGas(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: brineco2.hh:212
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition: brineco2.hh:266
static bool isIdealMixture(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: brineco2.hh:236
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the fugacity coefficient of an individual component in a fluid phase.
Definition: brineco2.hh:413
static constexpr int comp0Idx
Definition: brineco2.hh:144
static Scalar molarMass(int compIdx)
Return the molar mass of a component in .
Definition: brineco2.hh:287
static constexpr int numPhases
Definition: brineco2.hh:137
BrineType Brine
Definition: brineco2.hh:133
static Scalar diffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Calculate the molecular diffusion coefficient for a component in a fluid phase .
Definition: brineco2.hh:526
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: brineco2.hh:363
static constexpr int phase0Idx
index of the first phase
Definition: brineco2.hh:141
static constexpr int gasPhaseIdx
index of the gas phase
Definition: brineco2.hh:140
A compositional single phase fluid system consisting of two components, which are H2O and NaCl.
Definition: fluidsystems/brine.hh:35
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: fluidsystems/brine.hh:435
static Scalar viscosity(const FluidState &fluidState, int phaseIdx=liquidPhaseIdx)
Return the viscosity of the phase.
Definition: fluidsystems/brine.hh:276
static constexpr int H2OIdx
index of the water component
Definition: fluidsystems/brine.hh:49
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: fluidsystems/brine.hh:451
static Scalar molarMass(int compIdx)
Return the molar mass of a component in .
Definition: fluidsystems/brine.hh:153
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature and pressure, return its specific enthalpy .
Definition: fluidsystems/brine.hh:336
static constexpr int NaClIdx
index of the NaCl component
Definition: fluidsystems/brine.hh:50
static constexpr int liquidPhaseIdx
The one considered phase is liquid.
Definition: fluidsystems/brine.hh:47
static bool isCompressible(int phaseIdx=liquidPhaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: fluidsystems/brine.hh:112
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition: fluidsystems/brine.hh:139
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/brine.hh:402
The a parameter cache which does nothing.
Definition: nullparametercache.hh:22
Exception thrown if a fixable numerical problem occurs.
Definition: exceptions.hh:27
A class for the CO2 fluid properties.
A class for the brine fluid properties,.
Fluid system base class.
A fluid system for brine, i.e. H2O with dissolved NaCl.
Relations valid for an ideal gas.
A collection of input/output field names for common physical quantities.
Definition: h2o.hh:902
Definition: h2o.hh:902
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:39
std::string gaseousPhase() noexcept
I/O name of gaseous phase.
Definition: name.hh:111
std::string liquidPhase() noexcept
I/O name of liquid phase.
Definition: name.hh:107
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Default policy for the Brine-CO2 fluid system.
Definition: brineco2.hh:80
static constexpr bool useCO2GasDensityAsGasMixtureDensity()
Definition: brineco2.hh:82
static constexpr bool useConstantSalinity()
Definition: brineco2.hh:81
Class that exports some indices that should be provided by the BrineCO2 fluid system....
Definition: brineco2.hh:43
Tabulates all thermodynamic properties of a given untabulated chemical species.