version 3.7
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
25
29
31
32#include <dumux/io/name.hh>
33
35
43 template<bool useConstantSalinity>
45
51 template<>
52 struct BrineCO2Indices<true>
53 {
54 static constexpr int BrineIdx = 0;
55 };
56
62 template<>
63 struct BrineCO2Indices<false>
64 {
65 static constexpr int H2OIdx = 0;
66 static constexpr int NaClIdx = 2;
67 static constexpr int comp2Idx = 2;
68 };
69
70} // end namespace Dumux::FluidSystems::Detail
71
72
73namespace Dumux::FluidSystems {
74
79template<bool salinityIsConstant, bool fastButSimplifiedRelations = false>
81{
82 static constexpr bool useConstantSalinity() { return salinityIsConstant; }
83 static constexpr bool useCO2GasDensityAsGasMixtureDensity() { return fastButSimplifiedRelations; }
84};
85
96template< class Scalar,
97 class CO2Impl,
99 class Policy = BrineCO2DefaultPolicy</*constantSalinity?*/true> >
101: public Base<Scalar, BrineCO2<Scalar, CO2Impl, H2OType, Policy>>
102, public Detail::BrineCO2Indices<Policy::useConstantSalinity()>
103{
105
106 static constexpr bool rawCO2Table = Deprecated::BrineCO2Helper<CO2Impl>::isRawTable();
107
108 using CO2Component = typename std::conditional_t< rawCO2Table,
110 CO2Impl >;
111
112 // binary coefficients
114
115 // use constant salinity brine?
116 static constexpr bool useConstantSalinity = Policy::useConstantSalinity();
117
118 // The possible brine types
121 using BrineType = typename std::conditional_t< useConstantSalinity,
124
133 static constexpr int BrineOrH2OIdx = 0;
135 static constexpr int NaClIdx = 2;
136
137public:
139
140 using H2O = H2OType;
141 using Brine = BrineType;
142 using CO2 = CO2Component;
143
144 static constexpr int numComponents = useConstantSalinity ? 2 : 3;
145 static constexpr int numPhases = 2;
146
147 static constexpr int liquidPhaseIdx = 0;
148 static constexpr int gasPhaseIdx = 1;
149 static constexpr int phase0Idx = liquidPhaseIdx;
150 static constexpr int phase1Idx = gasPhaseIdx;
151
152 static constexpr int comp0Idx = 0;
153 static constexpr int comp1Idx = 1;
154
155 // CO2 is always the second component
156 static constexpr int CO2Idx = comp1Idx;
157
158private:
159
160 // Adapter policy for the fluid state corresponding to the brine fluid system
161 struct BrineAdapterPolicy
162 {
163 using FluidSystem = VariableSalinityBrine;
164
165 static constexpr int phaseIdx(int brinePhaseIdx) { return liquidPhaseIdx; }
166 static constexpr int compIdx(int brineCompIdx)
167 {
168 assert(brineCompIdx == VariableSalinityBrine::H2OIdx || brineCompIdx == VariableSalinityBrine::NaClIdx);
169 switch (brineCompIdx)
170 {
171 case VariableSalinityBrine::H2OIdx: return BrineOrH2OIdx;
172 case VariableSalinityBrine::NaClIdx: return NaClIdx;
173 default: return 0; // this will never be reached, only needed to suppress compiler warning
174 }
175 }
176 };
177
178 template<class FluidState>
180
181public:
182
187 static std::string phaseName(int phaseIdx)
188 {
189 switch (phaseIdx)
190 {
191 case liquidPhaseIdx: return IOName::liquidPhase();
192 case gasPhaseIdx: return IOName::gaseousPhase();
193 }
194 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx);
195 }
196
200 static constexpr bool isMiscible()
201 { return true; }
202
208 static constexpr bool isGas(int phaseIdx)
209 {
210 assert(0 <= phaseIdx && phaseIdx < numPhases);
211
212 return phaseIdx == gasPhaseIdx;
213 }
214
220 static constexpr bool isIdealGas(int phaseIdx)
221 {
222 assert(0 <= phaseIdx && phaseIdx < numPhases);
223 // let the fluids decide
224 if (phaseIdx == gasPhaseIdx)
225 return useConstantSalinity ? (ConstantSalinityBrine::gasIsIdeal() && CO2::gasIsIdeal())
226 : (H2O::gasIsIdeal() && CO2::gasIsIdeal());
227 return false; // not a gas
228 }
229
244 static bool isIdealMixture(int phaseIdx)
245 {
246 assert(0 <= phaseIdx && phaseIdx < numPhases);
247 if (phaseIdx == liquidPhaseIdx)
248 return false;
249 return true;
250 }
251
261 static constexpr bool isCompressible(int phaseIdx)
262 {
263 assert(0 <= phaseIdx && phaseIdx < numPhases);
264 if (phaseIdx == liquidPhaseIdx)
265 return useConstantSalinity ? ConstantSalinityBrine::liquidIsCompressible()
267 return true;
268 }
269
274 static std::string componentName(int compIdx)
275 {
276 assert(0 <= compIdx && compIdx < numComponents);
277 if (useConstantSalinity)
278 {
279 static std::string name[] = { ConstantSalinityBrine::name(), CO2::name() };
280 return name[compIdx];
281 }
282 else
283 {
285 CO2::name(),
287 return name[compIdx];
288 }
289 }
290
295 static Scalar molarMass(int compIdx)
296 {
297 assert(0 <= compIdx && compIdx < numComponents);
298 if (useConstantSalinity)
299 {
300 static const Scalar M[] = { ConstantSalinityBrine::molarMass(), CO2::molarMass() };
301 return M[compIdx];
302 }
303 else
304 {
306 CO2::molarMass(),
308 return M[compIdx];
309 }
310 }
311
312 /****************************************
313 * thermodynamic relations
314 ****************************************/
315
316 // Initializing with salinity and default tables
317 static void init()
318 {
319 init(/*startTemp=*/273.15, /*endTemp=*/623.15, /*tempSteps=*/100,
320 /*startPressure=*/1e4, /*endPressure=*/40e6, /*pressureSteps=*/200);
321 }
322
323 // Initializing with custom tables
324 static void init(Scalar startTemp, Scalar endTemp, int tempSteps,
325 Scalar startPressure, Scalar endPressure, int pressureSteps)
326 {
327 std::cout << "The Brine-CO2 fluid system was configured with the following policy:\n";
328 std::cout << " - use constant salinity: " << std::boolalpha << Policy::useConstantSalinity() << "\n";
329 std::cout << " - use CO2 gas density as gas mixture density: " << std::boolalpha << Policy::useCO2GasDensityAsGasMixtureDensity() << std::endl;
330
331 if (H2O::isTabulated)
332 H2O::init(startTemp, endTemp, tempSteps, startPressure, endPressure, pressureSteps);
333 }
334
344 template <class FluidState>
345 static Scalar density(const FluidState& fluidState, int phaseIdx)
346 {
347 Scalar T = fluidState.temperature(phaseIdx);
348 if (phaseIdx == liquidPhaseIdx)
349 return liquidDensityMixture_(fluidState);
350
351 else if (phaseIdx == gasPhaseIdx)
352 {
353 if (Policy::useCO2GasDensityAsGasMixtureDensity())
354 // use the CO2 gas density only and neglect compositional effects
355 return CO2::gasDensity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
356 else
357 {
358 // assume ideal mixture: steam and CO2 don't "see" each other
359 Scalar rho_gH2O = H2O::gasDensity(T, fluidState.partialPressure(gasPhaseIdx, BrineOrH2OIdx));
360 Scalar rho_gCO2 = CO2::gasDensity(T, fluidState.partialPressure(gasPhaseIdx, CO2Idx));
361 return (rho_gH2O + rho_gCO2);
362 }
363 }
364
365 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
366 }
367
370 template <class FluidState>
371 static Scalar molarDensity(const FluidState& fluidState, int phaseIdx)
372 {
373 Scalar T = fluidState.temperature(phaseIdx);
374 if (phaseIdx == liquidPhaseIdx)
375 return density(fluidState, phaseIdx)/fluidState.averageMolarMass(phaseIdx);
376 else if (phaseIdx == gasPhaseIdx)
377 {
378 if (Policy::useCO2GasDensityAsGasMixtureDensity())
379 return CO2::gasMolarDensity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
380 else
381 {
382 // assume ideal mixture: steam and CO2 don't "see" each other
383 Scalar rhoMolar_gH2O = H2O::gasMolarDensity(T, fluidState.partialPressure(gasPhaseIdx, BrineOrH2OIdx));
384 Scalar rhoMolar_gCO2 = CO2::gasMolarDensity(T, fluidState.partialPressure(gasPhaseIdx, CO2Idx));
385 return rhoMolar_gH2O + rhoMolar_gCO2;
386 }
387 }
388 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
389 }
390
402 template <class FluidState>
403 static Scalar viscosity(const FluidState& fluidState, int phaseIdx)
404 {
405 Scalar T = fluidState.temperature(phaseIdx);
406 Scalar p = fluidState.pressure(phaseIdx);
407
408 if (phaseIdx == liquidPhaseIdx)
409 return useConstantSalinity ? ConstantSalinityBrine::liquidViscosity(T, p)
412 else if (phaseIdx == gasPhaseIdx)
413 return CO2::gasViscosity(T, p);
414
415 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
416 }
417
420 template <class FluidState>
421 static Scalar fugacityCoefficient(const FluidState& fluidState,
422 int phaseIdx,
423 int compIdx)
424 {
425 assert(0 <= compIdx && compIdx < numComponents);
426
427 if (phaseIdx == gasPhaseIdx)
428 // use the fugacity coefficients of an ideal gas. the
429 // actual value of the fugacity is not relevant, as long
430 // as the relative fluid compositions are observed,
431 return 1.0;
432
433 else if (phaseIdx == liquidPhaseIdx)
434 {
435 Scalar T = fluidState.temperature(phaseIdx);
436 Scalar pl = fluidState.pressure(liquidPhaseIdx);
437 Scalar pg = fluidState.pressure(gasPhaseIdx);
438
439 assert(T > 0);
440 assert(pl > 0 && pg > 0);
441
442 // calculate the equilibrium composition for given T & p
443 Scalar xlH2O, xgH2O;
444 Scalar xlCO2, xgCO2;
445 const Scalar salinity = useConstantSalinity ? ConstantSalinityBrine::salinity()
446 : fluidState.massFraction(liquidPhaseIdx, NaClIdx);
447 Brine_CO2::calculateMoleFractions(T, pl, salinity, /*knownGasPhaseIdx=*/-1, xlCO2, xgH2O);
448
449 // normalize the phase compositions
450 using std::min;
451 using std::max;
452 xlCO2 = max(0.0, min(1.0, xlCO2));
453 xgH2O = max(0.0, min(1.0, xgH2O));
454 xlH2O = 1.0 - xlCO2;
455 xgCO2 = 1.0 - xgH2O;
456
457 if (compIdx == BrineOrH2OIdx)
458 return (xgH2O/xlH2O)*(pg/pl);
459
460 else if (compIdx == CO2Idx)
461 return (xgCO2/xlCO2)*(pg/pl);
462
463 // NaCl is assumed to stay in the liquid!
464 else if (!useConstantSalinity && compIdx == NaClIdx)
465 return 0.0;
466
467 DUNE_THROW(Dune::InvalidStateException, "Invalid component index.");
468 }
469
470 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
471 }
472
479 template <class FluidState>
480 static Scalar equilibriumMoleFraction(const FluidState& fluidState,
481 const ParameterCache& paramCache,
482 int phaseIdx)
483 {
484 Scalar T = fluidState.temperature(phaseIdx);
485 Scalar p = fluidState.pressure(phaseIdx);
486
487 assert(T > 0);
488 assert(p > 0);
489
490 Scalar xgH2O;
491 Scalar xlCO2;
492
493 // calculate the equilibrium composition for given T & p
494 const Scalar salinity = useConstantSalinity ? ConstantSalinityBrine::salinity()
495 : fluidState.massFraction(liquidPhaseIdx, NaClIdx);
496 Brine_CO2::calculateMoleFractions(T, p, salinity, /*knowgasPhaseIdx=*/-1, xlCO2, xgH2O);
497
498 if (phaseIdx == gasPhaseIdx)
499 return xgH2O;
500 else if (phaseIdx == liquidPhaseIdx)
501 return xlCO2;
502
503 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
504 }
505
506
533 template <class FluidState>
534 static Scalar diffusionCoefficient(const FluidState& fluidState, int phaseIdx, int compIdx)
535 { DUNE_THROW(Dune::NotImplemented, "Diffusion coefficients"); }
536
538 // \copydoc Base<Scalar,ThisType>::binaryDiffusionCoefficient(const FluidState&,int,int,int)
539 template <class FluidState>
540 static Scalar binaryDiffusionCoefficient(const FluidState& fluidState,
541 int phaseIdx,
542 int compIIdx,
543 int compJIdx)
544 {
545 assert(0 <= compIIdx && compIIdx < numComponents);
546 assert(0 <= compJIdx && compJIdx < numComponents);
547
548 if (compIIdx > compJIdx)
549 {
550 using std::swap;
551 swap(compIIdx, compJIdx);
552 }
553
554 Scalar T = fluidState.temperature(phaseIdx);
555 Scalar p = fluidState.pressure(phaseIdx);
556 if (phaseIdx == liquidPhaseIdx)
557 {
558 if (compIIdx == BrineOrH2OIdx && compJIdx == CO2Idx)
559 return Brine_CO2::liquidDiffCoeff(T, p);
560 if (!useConstantSalinity && compIIdx == BrineOrH2OIdx && compJIdx == NaClIdx)
565
566 DUNE_THROW(Dune::NotImplemented, "Binary diffusion coefficient of components " <<
567 compIIdx << " and " << compJIdx << " in phase " << phaseIdx);
568 }
569 else if (phaseIdx == gasPhaseIdx)
570 {
571 if (compIIdx == BrineOrH2OIdx && compJIdx == CO2Idx)
572 return Brine_CO2::gasDiffCoeff(T, p);
573
574 // NaCl is expected to never be present in the gas phase. we need to
575 // return a diffusion coefficient that does not case numerical problems.
576 // We choose a very small value here.
577 else if (!useConstantSalinity && compIIdx == CO2Idx && compJIdx == NaClIdx)
578 return 1e-12;
579
580 DUNE_THROW(Dune::NotImplemented, "Binary diffusion coefficient of components " <<
581 compIIdx << " and " << compJIdx << " in phase " << phaseIdx);
582 }
583
584 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
585 }
586
588 // \copydoc Base<Scalar,ThisType>::enthalpy(const FluidState&,int)
589 template <class FluidState>
590 static Scalar enthalpy(const FluidState& fluidState, int phaseIdx)
591 {
592 Scalar T = fluidState.temperature(phaseIdx);
593 Scalar p = fluidState.pressure(phaseIdx);
594
595 if (phaseIdx == liquidPhaseIdx)
596 {
597 // Convert J/kg to kJ/kg
598 const Scalar h_ls1 = useConstantSalinity ? ConstantSalinityBrine::liquidEnthalpy(T, p)/1e3
601
602 // mass fraction of CO2 in Brine
603 const Scalar X_CO2_w = fluidState.massFraction(liquidPhaseIdx, CO2Idx);
604
605 // heat of dissolution for CO2 according to Fig. 6 in Duan and Sun 2003. (kJ/kg)
606 // In the relevant temperature ranges CO2 dissolution is exothermal
607 const Scalar delta_hCO2 = (-57.4375 + T * 0.1325) * 1000/44;
608
609 // enthalpy contribution of water and CO2 (kJ/kg)
610 const Scalar hw = H2O::liquidEnthalpy(T, p)/1e3;
611 const Scalar hg = CO2::liquidEnthalpy(T, p)/1e3 + delta_hCO2;
612
613 // Enthalpy of brine with dissolved CO2 (kJ/kg)
614 return (h_ls1 - X_CO2_w*hw + hg*X_CO2_w)*1e3;
615 }
616 else if (phaseIdx == gasPhaseIdx)
617 {
618 // we assume NaCl to not enter the gas phase, only consider H2O and CO2
619 return H2O::gasEnthalpy(T, p)*fluidState.massFraction(gasPhaseIdx, BrineOrH2OIdx)
620 + CO2::gasEnthalpy(T, p) *fluidState.massFraction(gasPhaseIdx, CO2Idx);
621 }
622
623 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
624 }
625
632 template <class FluidState>
633 static Scalar componentEnthalpy(const FluidState& fluidState, int phaseIdx, int componentIdx)
634 {
635 const Scalar T = fluidState.temperature(phaseIdx);
636 const Scalar p = fluidState.pressure(phaseIdx);
637
638 if (phaseIdx == liquidPhaseIdx)
639 {
640 if (componentIdx == BrineOrH2OIdx)
641 return H2O::liquidEnthalpy(T, p);
642 else if (componentIdx == CO2Idx)
643 return CO2::liquidEnthalpy(T, p);
644 else if (componentIdx == NaClIdx)
645 DUNE_THROW(Dune::NotImplemented, "The component enthalpy for NaCl is not implemented.");
646 DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << componentIdx);
647 }
648 else if (phaseIdx == gasPhaseIdx)
649 {
650 if (componentIdx == BrineOrH2OIdx)
651 return H2O::gasEnthalpy(T, p);
652 else if (componentIdx == CO2Idx)
653 return CO2::gasEnthalpy(T, p);
654 else if (componentIdx == NaClIdx)
655 DUNE_THROW(Dune::InvalidStateException, "Implementation assumes NaCl not to be present in gas phase");
656 DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << componentIdx);
657 }
658 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx);
659 }
660
671 template <class FluidState>
672 static Scalar thermalConductivity(const FluidState& fluidState, int phaseIdx)
673 {
674 if (phaseIdx == liquidPhaseIdx)
675 return useConstantSalinity ? ConstantSalinityBrine::liquidThermalConductivity( fluidState.temperature(phaseIdx),
676 fluidState.pressure(phaseIdx) )
679 else if (phaseIdx == gasPhaseIdx)
680 return CO2::gasThermalConductivity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
681
682 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
683 }
684
696 template <class FluidState>
697 static Scalar heatCapacity(const FluidState &fluidState,
698 int phaseIdx)
699 {
700 if(phaseIdx == liquidPhaseIdx)
701 return useConstantSalinity ? ConstantSalinityBrine::liquidHeatCapacity( fluidState.temperature(phaseIdx),
702 fluidState.pressure(phaseIdx) )
705 else if (phaseIdx == gasPhaseIdx)
706 return CO2::liquidHeatCapacity(fluidState.temperature(phaseIdx),
707 fluidState.pressure(phaseIdx));
708
709 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
710 }
711
712private:
713
720 template<class FluidState>
721 static Scalar liquidDensityMixture_(const FluidState& fluidState)
722 {
723 const auto T = fluidState.temperature(liquidPhaseIdx);
724 const auto p = fluidState.pressure(liquidPhaseIdx);
725
726 if (T < 273.15)
727 DUNE_THROW(NumericalProblem, "Liquid density for Brine and CO2 is only "
728 "defined above 273.15K (T = " << T << ")");
729
730 if (p >= 2.5e8)
731 DUNE_THROW(NumericalProblem, "Liquid density for Brine and CO2 is only "
732 "defined below 250MPa (p = " << p << ")");
733
734 // density of pure water
735 Scalar rho_pure = H2O::liquidDensity(T, p);
736
737 // density of water with dissolved CO2 (neglect NaCl)
738 Scalar rho_lCO2;
739 if (useConstantSalinity)
740 {
741 // use normalized composition for to calculate the density
742 // (the relations don't seem to take non-normalized compositions too well...)
743 // TODO Do we really need this normalization???
744 using std::min;
745 using std::max;
746 Scalar xlBrine = min(1.0, max(0.0, fluidState.moleFraction(liquidPhaseIdx, BrineOrH2OIdx)));
747 Scalar xlCO2 = min(1.0, max(0.0, fluidState.moleFraction(liquidPhaseIdx, CO2Idx)));
748 Scalar sumx = xlBrine + xlCO2;
749 xlBrine /= sumx;
750 xlCO2 /= sumx;
751
752 rho_lCO2 = liquidDensityWaterCO2_(T, p, xlBrine, xlCO2);
753 }
754 else
755 {
756 // rescale mole fractions
757 auto xlH2O = fluidState.moleFraction(liquidPhaseIdx, BrineOrH2OIdx);
758 auto xlCO2 = fluidState.moleFraction(liquidPhaseIdx, NaClIdx);
759 const auto sumMoleFrac = xlH2O + xlCO2;
760 xlH2O = xlH2O/sumMoleFrac;
761 xlCO2 = xlCO2/sumMoleFrac;
762 rho_lCO2 = liquidDensityWaterCO2_(T, p, xlH2O, xlCO2);
763 }
764
765 // density of brine (water with nacl)
766 Scalar rho_brine = useConstantSalinity ? ConstantSalinityBrine::liquidDensity(T, p)
767 : VariableSalinityBrine::density( BrineAdapter<FluidState>(fluidState),
768 VariableSalinityBrine::liquidPhaseIdx );
769
770 // contribution of co2 to the density
771 Scalar contribCO2 = rho_lCO2 - rho_pure;
772
773 // Total brine density with dissolved CO2
774 // rho_{b, CO2} = rho_pure + contribution(salt) + contribution(CO2)
775 return rho_brine + contribCO2;
776 }
777
778
789 static Scalar liquidDensityWaterCO2_(Scalar temperature,
790 Scalar pl,
791 Scalar xlH2O,
792 Scalar xlCO2)
793 {
794 const Scalar M_CO2 = CO2::molarMass();
795 const Scalar M_H2O = H2O::molarMass();
796
797 const Scalar tempC = temperature - 273.15; /* tempC : temperature in °C */
798 const Scalar rho_pure = H2O::liquidDensity(temperature, pl);
799
800 // xlH2O is available, but in case of a pure gas phase
801 // the value of M_T for the virtual liquid phase can become very large
802 xlH2O = 1.0 - xlCO2;
803 const Scalar M_T = M_H2O * xlH2O + M_CO2 * xlCO2;
804 const Scalar V_phi = (37.51 +
805 tempC*(-9.585e-2 +
806 tempC*(8.74e-4 -
807 tempC*5.044e-7))) / 1.0e6;
808 return 1/(xlCO2 * V_phi/M_T + M_H2O * xlH2O / (rho_pure * M_T));
809 }
810};
811
812} // end namespace Dumux::FluidSystems
813
814#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:33
static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure)
Binary diffusion coefficient of CO2 in the brine phase.
Definition: brine_co2.hh:79
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:109
static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
Binary diffusion coefficient of water in the CO2 phase.
Definition: brine_co2.hh:53
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
A class for the CO2 fluid properties.
Definition: co2.hh:45
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:103
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: brineco2.hh:697
static constexpr int numComponents
Definition: brineco2.hh:144
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
Calculate the molar density of a fluid phase.
Definition: brineco2.hh:371
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: brineco2.hh:403
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: brineco2.hh:672
static constexpr bool isCompressible(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: brineco2.hh:261
static constexpr int comp0Idx
Definition: brineco2.hh:152
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:534
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:480
static Scalar molarMass(int compIdx)
Return the molar mass of a component in .
Definition: brineco2.hh:295
static constexpr int numPhases
Definition: brineco2.hh:145
static std::string phaseName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: brineco2.hh:187
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:220
H2OType H2O
Definition: brineco2.hh:140
CO2Component CO2
Definition: brineco2.hh:142
static constexpr int liquidPhaseIdx
index of the liquid phase
Definition: brineco2.hh:147
static void init()
Definition: brineco2.hh:317
static Scalar componentEnthalpy(const FluidState &fluidState, int phaseIdx, int componentIdx)
Returns the specific enthalpy of a component in a specific phase.
Definition: brineco2.hh:633
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIIdx, int compJIdx)
Definition: brineco2.hh:540
static constexpr int gasPhaseIdx
index of the gas phase
Definition: brineco2.hh:148
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition: brineco2.hh:274
static bool isIdealMixture(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: brineco2.hh:244
static constexpr int phase0Idx
index of the first phase
Definition: brineco2.hh:149
BrineType Brine
Definition: brineco2.hh:141
static void init(Scalar startTemp, Scalar endTemp, int tempSteps, Scalar startPressure, Scalar endPressure, int pressureSteps)
Definition: brineco2.hh:324
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Definition: brineco2.hh:590
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:345
static constexpr int phase1Idx
index of the second phase
Definition: brineco2.hh:150
static constexpr int comp1Idx
Definition: brineco2.hh:153
static constexpr int CO2Idx
Definition: brineco2.hh:156
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:421
static constexpr bool isGas(int phaseIdx)
Return whether a phase is gaseous.
Definition: brineco2.hh:208
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: brineco2.hh:200
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,.
Helpers for deprecation.
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:81
static constexpr bool useCO2GasDensityAsGasMixtureDensity()
Definition: brineco2.hh:83
static constexpr bool useConstantSalinity()
Definition: brineco2.hh:82
Class that exports some indices that should be provided by the BrineCO2 fluid system....
Definition: brineco2.hh:44
Tabulates all thermodynamic properties of a given untabulated chemical species.