3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 * 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_BRINE_CO2_FLUID_SYSTEM_HH
25#define DUMUX_BRINE_CO2_FLUID_SYSTEM_HH
26
27#include <type_traits>
28
29#include <dune/common/exceptions.hh>
30
36
41
43
44#include <dumux/io/name.hh>
45
46namespace Dumux {
47
48// include the default tables for CO2
49#ifndef DOXYGEN // hide tables from doxygen
50#include <dumux/material/components/co2tables.inc>
51#endif
52
53namespace FluidSystems {
54namespace Detail {
55
63 template<bool useConstantSalinity>
65
71 template<>
72 struct BrineCO2Indices<true>
73 {
74 static constexpr int BrineIdx = 0;
75 };
76
82 template<>
83 struct BrineCO2Indices<false>
84 {
85 static constexpr int H2OIdx = 0;
86 static constexpr int NaClIdx = 2;
87 static constexpr int comp2Idx = 2;
88 };
89} // end namespace Detail
90
95template<bool salinityIsConstant, bool fastButSimplifiedRelations = false>
97{
98 static constexpr bool useConstantSalinity() { return salinityIsConstant; }
99 static constexpr bool useCO2GasDensityAsGasMixtureDensity() { return fastButSimplifiedRelations; }
100};
101
112template< class Scalar,
113 class CO2Table,
115 class Policy = BrineCO2DefaultPolicy</*constantSalinity?*/true> >
117: public Base<Scalar, BrineCO2<Scalar, CO2Table, H2OType, Policy>>
118, public Detail::BrineCO2Indices<Policy::useConstantSalinity()>
119{
122
123 // binary coefficients
125
126 // use constant salinity brine?
127 static constexpr bool useConstantSalinity = Policy::useConstantSalinity();
128
129 // The possible brine types
132 using BrineType = typename std::conditional_t< useConstantSalinity,
135
144 static constexpr int BrineOrH2OIdx = 0;
146 static constexpr int NaClIdx = 2;
147
148public:
150
151 using H2O = H2OType;
152 using Brine = BrineType;
154
155 static constexpr int numComponents = useConstantSalinity ? 2 : 3;
156 static constexpr int numPhases = 2;
157
158 static constexpr int liquidPhaseIdx = 0;
159 static constexpr int gasPhaseIdx = 1;
160 static constexpr int phase0Idx = liquidPhaseIdx;
161 static constexpr int phase1Idx = gasPhaseIdx;
162
163 static constexpr int comp0Idx = 0;
164 static constexpr int comp1Idx = 1;
165
166 // CO2 is always the second component
167 static constexpr int CO2Idx = comp1Idx;
168
169private:
170
171 // Adapter policy for the fluid state corresponding to the brine fluid system
172 struct BrineAdapterPolicy
173 {
174 using FluidSystem = VariableSalinityBrine;
175
176 static constexpr int phaseIdx(int brinePhaseIdx) { return liquidPhaseIdx; }
177 static constexpr int compIdx(int brineCompIdx)
178 {
179 switch (brineCompIdx)
180 {
181 assert(brineCompIdx == VariableSalinityBrine::H2OIdx || brineCompIdx == VariableSalinityBrine::NaClIdx);
182 case VariableSalinityBrine::H2OIdx: return BrineOrH2OIdx;
183 case VariableSalinityBrine::NaClIdx: return NaClIdx;
184 default: return 0; // this will never be reached, only needed to suppress compiler warning
185 }
186 }
187 };
188
189 template<class FluidState>
191
192public:
193
198 static std::string phaseName(int phaseIdx)
199 {
200 switch (phaseIdx)
201 {
202 case liquidPhaseIdx: return IOName::liquidPhase();
203 case gasPhaseIdx: return IOName::gaseousPhase();
204 }
205 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx);
206 }
207
211 static constexpr bool isMiscible()
212 { return true; }
213
219 static constexpr bool isGas(int phaseIdx)
220 {
221 assert(0 <= phaseIdx && phaseIdx < numPhases);
222
223 return phaseIdx == gasPhaseIdx;
224 }
225
231 static constexpr bool isIdealGas(int phaseIdx)
232 {
233 assert(0 <= phaseIdx && phaseIdx < numPhases);
234 // let the fluids decide
235 if (phaseIdx == gasPhaseIdx)
236 return useConstantSalinity ? (ConstantSalinityBrine::gasIsIdeal() && CO2::gasIsIdeal())
237 : (H2O::gasIsIdeal() && CO2::gasIsIdeal());
238 return false; // not a gas
239 }
240
255 static bool isIdealMixture(int phaseIdx)
256 {
257 assert(0 <= phaseIdx && phaseIdx < numPhases);
258 if (phaseIdx == liquidPhaseIdx)
259 return false;
260 return true;
261 }
262
272 static constexpr bool isCompressible(int phaseIdx)
273 {
274 assert(0 <= phaseIdx && phaseIdx < numPhases);
275 if (phaseIdx == liquidPhaseIdx)
276 return useConstantSalinity ? ConstantSalinityBrine::liquidIsCompressible()
278 return true;
279 }
280
285 static std::string componentName(int compIdx)
286 {
287 assert(0 <= compIdx && compIdx < numComponents);
288 if (useConstantSalinity)
289 {
290 static std::string name[] = { ConstantSalinityBrine::name(), CO2::name() };
291 return name[compIdx];
292 }
293 else
294 {
296 CO2::name(),
298 return name[compIdx];
299 }
300 }
301
306 static Scalar molarMass(int compIdx)
307 {
308 assert(0 <= compIdx && compIdx < numComponents);
309 if (useConstantSalinity)
310 {
311 static const Scalar M[] = { ConstantSalinityBrine::molarMass(), CO2::molarMass() };
312 return M[compIdx];
313 }
314 else
315 {
319 return M[compIdx];
320 }
321 }
322
323 /****************************************
324 * thermodynamic relations
325 ****************************************/
326
327 // Initializing with salinity and default tables
328 static void init()
329 {
330 init(/*startTemp=*/273.15, /*endTemp=*/623.15, /*tempSteps=*/100,
331 /*startPressure=*/1e4, /*endPressure=*/40e6, /*pressureSteps=*/200);
332 }
333
334 // Initializing with custom tables
335 static void init(Scalar startTemp, Scalar endTemp, int tempSteps,
336 Scalar startPressure, Scalar endPressure, int pressureSteps)
337 {
338 std::cout << "The Brine-CO2 fluid system was configured with the following policy:\n";
339 std::cout << " - use constant salinity: " << std::boolalpha << Policy::useConstantSalinity() << "\n";
340 std::cout << " - use CO2 gas density as gas mixture density: " << std::boolalpha << Policy::useCO2GasDensityAsGasMixtureDensity() << std::endl;
341
342 if (H2O::isTabulated)
343 H2O::init(startTemp, endTemp, tempSteps, startPressure, endPressure, pressureSteps);
344 }
345
346 using Base::density;
355 template <class FluidState>
356 static Scalar density(const FluidState& fluidState, int phaseIdx)
357 {
358 Scalar T = fluidState.temperature(phaseIdx);
359 if (phaseIdx == liquidPhaseIdx)
360 return liquidDensityMixture_(fluidState);
361
362 else if (phaseIdx == gasPhaseIdx)
363 {
364 if (Policy::useCO2GasDensityAsGasMixtureDensity())
365 // use the CO2 gas density only and neglect compositional effects
366 return CO2::gasDensity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
367 else
368 {
369 // assume ideal mixture: steam and CO2 don't "see" each other
370 Scalar rho_gH2O = H2O::gasDensity(T, fluidState.partialPressure(gasPhaseIdx, BrineOrH2OIdx));
371 Scalar rho_gCO2 = CO2::gasDensity(T, fluidState.partialPressure(gasPhaseIdx, CO2Idx));
372 return (rho_gH2O + rho_gCO2);
373 }
374 }
375
376 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
377 }
378
379 using Base::molarDensity;
389 template <class FluidState>
390 static Scalar molarDensity(const FluidState& fluidState, int phaseIdx)
391 {
392 Scalar T = fluidState.temperature(phaseIdx);
393 if (phaseIdx == liquidPhaseIdx)
394 return density(fluidState, phaseIdx)/fluidState.averageMolarMass(phaseIdx);
395 else if (phaseIdx == gasPhaseIdx)
396 {
397 if (Policy::useCO2GasDensityAsGasMixtureDensity())
398 return CO2::gasMolarDensity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
399 else
400 {
401 // assume ideal mixture: steam and CO2 don't "see" each other
402 Scalar rhoMolar_gH2O = H2O::gasMolarDensity(T, fluidState.partialPressure(gasPhaseIdx, BrineOrH2OIdx));
403 Scalar rhoMolar_gCO2 = CO2::gasMolarDensity(T, fluidState.partialPressure(gasPhaseIdx, CO2Idx));
404 return rhoMolar_gH2O + rhoMolar_gCO2;
405 }
406 }
407 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
408 }
409
410 using Base::viscosity;
421 template <class FluidState>
422 static Scalar viscosity(const FluidState& fluidState, int phaseIdx)
423 {
424 Scalar T = fluidState.temperature(phaseIdx);
425 Scalar p = fluidState.pressure(phaseIdx);
426
427 if (phaseIdx == liquidPhaseIdx)
428 return useConstantSalinity ? ConstantSalinityBrine::liquidViscosity(T, p)
431 else if (phaseIdx == gasPhaseIdx)
432 return CO2::gasViscosity(T, p);
433
434 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
435 }
436
464 template <class FluidState>
465 static Scalar fugacityCoefficient(const FluidState& fluidState,
466 int phaseIdx,
467 int compIdx)
468 {
469 assert(0 <= compIdx && compIdx < numComponents);
470
471 if (phaseIdx == gasPhaseIdx)
472 // use the fugacity coefficients of an ideal gas. the
473 // actual value of the fugacity is not relevant, as long
474 // as the relative fluid compositions are observed,
475 return 1.0;
476
477 else if (phaseIdx == liquidPhaseIdx)
478 {
479 Scalar T = fluidState.temperature(phaseIdx);
480 Scalar pl = fluidState.pressure(liquidPhaseIdx);
481 Scalar pg = fluidState.pressure(gasPhaseIdx);
482
483 assert(T > 0);
484 assert(pl > 0 && pg > 0);
485
486 // calulate the equilibrium composition for given T & p
487 Scalar xlH2O, xgH2O;
488 Scalar xlCO2, xgCO2;
489 const Scalar salinity = useConstantSalinity ? ConstantSalinityBrine::salinity()
490 : fluidState.massFraction(liquidPhaseIdx, NaClIdx);
491 Brine_CO2::calculateMoleFractions(T, pl, salinity, /*knownGasPhaseIdx=*/-1, xlCO2, xgH2O);
492
493 // normalize the phase compositions
494 using std::min;
495 using std::max;
496 xlCO2 = max(0.0, min(1.0, xlCO2));
497 xgH2O = max(0.0, min(1.0, xgH2O));
498 xlH2O = 1.0 - xlCO2;
499 xgCO2 = 1.0 - xgH2O;
500
501 if (compIdx == BrineOrH2OIdx)
502 return (xgH2O/xlH2O)*(pg/pl);
503
504 else if (compIdx == CO2Idx)
505 return (xgCO2/xlCO2)*(pg/pl);
506
507 // NaCl is assumed to stay in the liquid!
508 else if (!useConstantSalinity && compIdx == NaClIdx)
509 return 0.0;
510
511 DUNE_THROW(Dune::InvalidStateException, "Invalid component index.");
512 }
513
514 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
515 }
516
524 template <class FluidState>
525 static Scalar equilibriumMoleFraction(const FluidState& fluidState,
526 const ParameterCache& paramCache,
527 int phaseIdx)
528 {
529 Scalar T = fluidState.temperature(phaseIdx);
530 Scalar p = fluidState.pressure(phaseIdx);
531
532 assert(T > 0);
533 assert(p > 0);
534
535 Scalar xgH2O;
536 Scalar xlCO2;
537
538 // calulate the equilibrium composition for given T & p
539 const Scalar salinity = useConstantSalinity ? ConstantSalinityBrine::salinity()
540 : fluidState.massFraction(liquidPhaseIdx, NaClIdx);
541 Brine_CO2::calculateMoleFractions(T, p, salinity, /*knowgasPhaseIdx=*/-1, xlCO2, xgH2O);
542
543 if (phaseIdx == gasPhaseIdx)
544 return xgH2O;
545 else if (phaseIdx == liquidPhaseIdx)
546 return xlCO2;
547
548 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
549 }
550
551
578 template <class FluidState>
579 static Scalar diffusionCoefficient(const FluidState& fluidState, int phaseIdx, int compIdx)
580 { DUNE_THROW(Dune::NotImplemented, "Diffusion coefficients"); }
581
591 template <class FluidState>
592 static Scalar binaryDiffusionCoefficient(const FluidState& fluidState,
593 int phaseIdx,
594 int compIIdx,
595 int compJIdx)
596 {
597 assert(0 <= compIIdx && compIIdx < numComponents);
598 assert(0 <= compJIdx && compJIdx < numComponents);
599
600 if (compIIdx > compJIdx)
601 {
602 using std::swap;
603 swap(compIIdx, compJIdx);
604 }
605
606 Scalar T = fluidState.temperature(phaseIdx);
607 Scalar p = fluidState.pressure(phaseIdx);
608 if (phaseIdx == liquidPhaseIdx)
609 {
610 if (compIIdx == BrineOrH2OIdx && compJIdx == CO2Idx)
611 return Brine_CO2::liquidDiffCoeff(T, p);
612 if (!useConstantSalinity && compIIdx == BrineOrH2OIdx && compJIdx == NaClIdx)
617
618 DUNE_THROW(Dune::NotImplemented, "Binary diffusion coefficient of components " <<
619 compIIdx << " and " << compJIdx << " in phase " << phaseIdx);
620 }
621 else if (phaseIdx == gasPhaseIdx)
622 {
623 if (compIIdx == BrineOrH2OIdx && compJIdx == CO2Idx)
624 return Brine_CO2::gasDiffCoeff(T, p);
625
626 // NaCl is expected to never be present in the gas phase. we need to
627 // return a diffusion coefficient that does not case numerical problems.
628 // We choose a very small value here.
629 else if (!useConstantSalinity && compIIdx == CO2Idx && compJIdx == NaClIdx)
630 return 1e-12;
631
632 DUNE_THROW(Dune::NotImplemented, "Binary diffusion coefficient of components " <<
633 compIIdx << " and " << compJIdx << " in phase " << phaseIdx);
634 }
635
636 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
637 }
638
639 using Base::enthalpy;
646 template <class FluidState>
647 static Scalar enthalpy(const FluidState& fluidState, int phaseIdx)
648 {
649 Scalar T = fluidState.temperature(phaseIdx);
650 Scalar p = fluidState.pressure(phaseIdx);
651
652 if (phaseIdx == liquidPhaseIdx)
653 {
654 // Convert J/kg to kJ/kg
655 const Scalar h_ls1 = useConstantSalinity ? ConstantSalinityBrine::liquidEnthalpy(T, p)/1e3
658
659 // mass fraction of CO2 in Brine
660 const Scalar X_CO2_w = fluidState.massFraction(liquidPhaseIdx, CO2Idx);
661
662 // heat of dissolution for CO2 according to Fig. 6 in Duan and Sun 2003. (kJ/kg)
663 // In the relevant temperature ranges CO2 dissolution is exothermal
664 const Scalar delta_hCO2 = (-57.4375 + T * 0.1325) * 1000/44;
665
666 // enthalpy contribution of water and CO2 (kJ/kg)
667 const Scalar hw = H2O::liquidEnthalpy(T, p)/1e3;
668 const Scalar hg = CO2::liquidEnthalpy(T, p)/1e3 + delta_hCO2;
669
670 // Enthalpy of brine with dissolved CO2 (kJ/kg)
671 return (h_ls1 - X_CO2_w*hw + hg*X_CO2_w)*1e3;
672 }
673 else if (phaseIdx == gasPhaseIdx)
674 {
675 Scalar result = 0;
676 // we assume NaCl to not enter the gas phase, only consider H2O and CO2
677 result += H2O::gasEnthalpy(T, p)*fluidState.massFraction(gasPhaseIdx, BrineOrH2OIdx);
678 result += CO2::gasEnthalpy(T, p) *fluidState.massFraction(gasPhaseIdx, CO2Idx);
680 return result;
681 }
682
683 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
684 }
685
692 template <class FluidState>
693 static Scalar componentEnthalpy(const FluidState& fluidState, int phaseIdx, int componentIdx)
694 {
695 const Scalar T = fluidState.temperature(phaseIdx);
696 const Scalar p = fluidState.pressure(phaseIdx);
697
698 if (phaseIdx == liquidPhaseIdx)
699 {
700 if (componentIdx == BrineOrH2OIdx)
701 return H2O::liquidEnthalpy(T, p);
702 else if (componentIdx == CO2Idx)
703 return CO2::liquidEnthalpy(T, p);
704 else if (componentIdx == NaClIdx)
705 DUNE_THROW(Dune::NotImplemented, "The component enthalpy for NaCl is not implemented.");
706 DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << componentIdx);
707 }
708 else if (phaseIdx == gasPhaseIdx)
709 {
710 if (componentIdx == BrineOrH2OIdx)
711 return H2O::gasEnthalpy(T, p);
712 else if (componentIdx == CO2Idx)
713 return CO2::gasEnthalpy(T, p);
714 else if (componentIdx == NaClIdx)
715 DUNE_THROW(Dune::InvalidStateException, "Implementation assumes NaCl not to be present in gas phase");
716 DUNE_THROW(Dune::InvalidStateException, "Invalid component index " << componentIdx);
717 }
718 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx);
719 }
720
731 template <class FluidState>
732 static Scalar thermalConductivity(const FluidState& fluidState, int phaseIdx)
733 {
734 if (phaseIdx == liquidPhaseIdx)
735 return useConstantSalinity ? ConstantSalinityBrine::liquidThermalConductivity( fluidState.temperature(phaseIdx),
736 fluidState.pressure(phaseIdx) )
739 else if (phaseIdx == gasPhaseIdx)
740 return CO2::gasThermalConductivity(fluidState.temperature(phaseIdx), fluidState.pressure(phaseIdx));
741
742 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
743 }
744
745 using Base::heatCapacity;
756 template <class FluidState>
757 static Scalar heatCapacity(const FluidState &fluidState,
758 int phaseIdx)
759 {
760 if(phaseIdx == liquidPhaseIdx)
761 return useConstantSalinity ? ConstantSalinityBrine::liquidHeatCapacity( fluidState.temperature(phaseIdx),
762 fluidState.pressure(phaseIdx) )
765 else if (phaseIdx == gasPhaseIdx)
766 return CO2::liquidHeatCapacity(fluidState.temperature(phaseIdx),
767 fluidState.pressure(phaseIdx));
768
769 DUNE_THROW(Dune::InvalidStateException, "Invalid phase index.");
770 }
771
772private:
773
780 template<class FluidState>
781 static Scalar liquidDensityMixture_(const FluidState& fluidState)
782 {
783 const auto T = fluidState.temperature(liquidPhaseIdx);
784 const auto p = fluidState.pressure(liquidPhaseIdx);
785
788
789 if (T < 273.15)
790 DUNE_THROW(NumericalProblem, "Liquid density for Brine and CO2 is only "
791 "defined above 273.15K (T = " << T << ")");
792
793 if (p >= 2.5e8)
794 DUNE_THROW(NumericalProblem, "Liquid density for Brine and CO2 is only "
795 "defined below 250MPa (p = " << p << ")");
796
797 // density of pure water
798 Scalar rho_pure = H2O::liquidDensity(T, p);
799
800 // density of water with dissolved CO2 (neglect NaCl)
801 Scalar rho_lCO2;
802 if (useConstantSalinity)
803 {
804 // use normalized composition for to calculate the density
805 // (the relations don't seem to take non-normalized compositions too well...)
806 // TODO Do we really need this normalization???
807 using std::min;
808 using std::max;
809 Scalar xlBrine = min(1.0, max(0.0, fluidState.moleFraction(liquidPhaseIdx, BrineOrH2OIdx)));
810 Scalar xlCO2 = min(1.0, max(0.0, fluidState.moleFraction(liquidPhaseIdx, CO2Idx)));
811 Scalar sumx = xlBrine + xlCO2;
812 xlBrine /= sumx;
813 xlCO2 /= sumx;
814
815 rho_lCO2 = liquidDensityWaterCO2_(T, p, xlBrine, xlCO2);
816 }
817 else
818 {
819 // rescale mole fractions
820 auto xlH2O = fluidState.moleFraction(liquidPhaseIdx, BrineOrH2OIdx);
821 auto xlCO2 = fluidState.moleFraction(liquidPhaseIdx, NaClIdx);
822 const auto sumMoleFrac = xlH2O + xlCO2;
823 xlH2O = xlH2O/sumMoleFrac;
824 xlCO2 = xlCO2/sumMoleFrac;
825 rho_lCO2 = liquidDensityWaterCO2_(T, p, xlH2O, xlCO2);
826 }
827
828 // density of brine (water with nacl)
829 Scalar rho_brine = useConstantSalinity ? ConstantSalinityBrine::liquidDensity(T, p)
830 : VariableSalinityBrine::density( BrineAdapter<FluidState>(fluidState),
831 VariableSalinityBrine::liquidPhaseIdx );
832
833 // contribution of co2 to the density
834 Scalar contribCO2 = rho_lCO2 - rho_pure;
835
836 // Total brine density with dissolved CO2
837 // rho_{b, CO2} = rho_pure + contribution(salt) + contribution(CO2)
838 return rho_brine + contribCO2;
839 }
840
841
852 static Scalar liquidDensityWaterCO2_(Scalar temperature,
853 Scalar pl,
854 Scalar xlH2O,
855 Scalar xlCO2)
856 {
857 const Scalar M_CO2 = CO2::molarMass();
858 const Scalar M_H2O = H2O::molarMass();
859
860 const Scalar tempC = temperature - 273.15; /* tempC : temperature in °C */
861 const Scalar rho_pure = H2O::liquidDensity(temperature, pl);
862
863 // xlH2O is available, but in case of a pure gas phase
864 // the value of M_T for the virtual liquid phase can become very large
865 xlH2O = 1.0 - xlCO2;
866 const Scalar M_T = M_H2O * xlH2O + M_CO2 * xlCO2;
867 const Scalar V_phi = (37.51 +
868 tempC*(-9.585e-2 +
869 tempC*(8.74e-4 -
870 tempC*5.044e-7))) / 1.0e6;
871 return 1/(xlCO2 * V_phi/M_T + M_H2O * xlH2O / (rho_pure * M_T));
872 }
873};
874
875} // end namespace FluidSystems
876} // end namespace Dumux
877
878#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
A collection of input/output field names for common physical quantities.
Binary coefficients for CO2 and brine.
A class for the CO2 fluid properties.
A generic template for tabulated material laws that depend on two parameters.
Tabulates all thermodynamic properties of a given untabulated chemical species.
Adapter class for fluid states with different indices.
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
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
Exception thrown if a fixable numerical problem occurs.
Definition: exceptions.hh:39
Binary coefficients for brine and CO2.
Definition: brine_co2.hh:40
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:76
static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
Binary diffusion coefficient of water in the CO2 phase.
Definition: brine_co2.hh:55
A class for the brine fluid properties.
Definition: components/brine.hh:57
static Scalar liquidViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of pure brine.
Definition: components/brine.hh:410
static const Scalar liquidEnthalpy(Scalar T, Scalar p)
Specific enthalpy of liquid brine .
Definition: components/brine.hh:156
static Scalar molarMass()
The molar mass in of brine. This assumes that the salt is pure NaCl.
Definition: components/brine.hh:84
static Scalar salinity()
Return the constant salinity.
Definition: components/brine.hh:74
static Scalar liquidThermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of a brine .
Definition: components/brine.hh:435
static const Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of brine .
Definition: components/brine.hh:215
static constexpr bool liquidIsCompressible()
Returns true if the liquid phase is assumed to be compressible.
Definition: components/brine.hh:298
static std::string name()
A human readable name for the brine.
Definition: components/brine.hh:68
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: components/brine.hh:286
static Scalar liquidDensity(Scalar temperature, Scalar pressure)
The density of pure brine at a given pressure and temperature .
Definition: components/brine.hh:311
A class for the CO2 fluid properties.
Definition: co2.hh:56
static Scalar gasThermalConductivity(Scalar temperature, Scalar pressure)
Thermal conductivity of CO2.
Definition: co2.hh:398
static Scalar liquidEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of liquid CO2 .
Definition: co2.hh:179
static constexpr Scalar molarMass()
The mass in of one mole of CO2.
Definition: co2.hh:71
static Scalar gasMolarDensity(Scalar temperature, Scalar pressure)
The molar density of CO2 gas in at a given pressure and temperature.
Definition: co2.hh:243
static Scalar gasDensity(Scalar temperature, Scalar pressure)
The density of CO2 at a given pressure and temperature .
Definition: co2.hh:225
static constexpr bool gasIsIdeal()
Returns true if the gas phase is assumed to be ideal.
Definition: co2.hh:125
static std::string name()
A human readable name for the CO2.
Definition: co2.hh:65
static Scalar gasViscosity(Scalar temperature, Scalar pressure)
The dynamic viscosity of CO2. Equations given in: - Vesovic et al., 1990.
Definition: co2.hh:326
static Scalar liquidHeatCapacity(Scalar temperature, Scalar pressure)
Specific isobaric heat capacity of the component as a liquid. USE WITH CAUTION! Exploits enthalpy fu...
Definition: co2.hh:303
static Scalar gasEnthalpy(Scalar temperature, Scalar pressure)
Specific enthalpy of gaseous CO2 .
Definition: co2.hh:161
static std::string name()
A human readable name for the NaCl.
Definition: nacl.hh:52
Tabulates all thermodynamic properties of a given untabulated chemical species.
Definition: tabulatedcomponent.hh:82
Adapter class for fluid states with different indices.
Definition: adapter.hh:44
Fluid system base class.
Definition: fluidsystems/base.hh:45
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
A compositional single phase fluid system consisting of two components, which are H2O and NaCl.
Definition: fluidsystems/brine.hh:48
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: fluidsystems/brine.hh:483
static Scalar viscosity(const FluidState &fluidState, int phaseIdx=liquidPhaseIdx)
Return the viscosity of the phase.
Definition: fluidsystems/brine.hh:282
static constexpr int H2OIdx
index of the water component
Definition: fluidsystems/brine.hh:63
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase. .
Definition: fluidsystems/brine.hh:501
static Scalar molarMass(int compIdx)
Return the molar mass of a component in .
Definition: fluidsystems/brine.hh:167
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Given a phase's composition, temperature and pressure, return its specific enthalpy .
Definition: fluidsystems/brine.hh:337
static constexpr int NaClIdx
index of the NaCl component
Definition: fluidsystems/brine.hh:64
static constexpr int liquidPhaseIdx
The one considered phase is liquid.
Definition: fluidsystems/brine.hh:61
static bool isCompressible(int phaseIdx=liquidPhaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: fluidsystems/brine.hh:126
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition: fluidsystems/brine.hh:153
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:445
Class that exports some indices that should be provided by the BrineAir fluid system....
Definition: brineco2.hh:64
Default policy for the Brine-CO2 fluid system.
Definition: brineco2.hh:97
static constexpr bool useCO2GasDensityAsGasMixtureDensity()
Definition: brineco2.hh:99
static constexpr bool useConstantSalinity()
Definition: brineco2.hh:98
A compositional fluid with brine (H2O & NaCl) and carbon dioxide as components in both the liquid and...
Definition: brineco2.hh:119
static constexpr int CO2Idx
Definition: brineco2.hh:167
static constexpr int numComponents
Definition: brineco2.hh:155
static Scalar enthalpy(const FluidState &fluidState, int phaseIdx)
Given the phase composition, return the specific phase enthalpy .
Definition: brineco2.hh:647
static constexpr bool isCompressible(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: brineco2.hh:272
static constexpr int phase0Idx
index of the first phase
Definition: brineco2.hh:160
static constexpr int comp0Idx
Definition: brineco2.hh:163
H2OType H2O
Definition: brineco2.hh:151
static Scalar molarMass(int compIdx)
Return the molar mass of a component in .
Definition: brineco2.hh:306
static constexpr int numPhases
Definition: brineco2.hh:156
static Scalar heatCapacity(const FluidState &fluidState, int phaseIdx)
Specific isobaric heat capacity of a fluid phase .
Definition: brineco2.hh:757
static std::string componentName(int compIdx)
Return the human readable name of a component.
Definition: brineco2.hh:285
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState, int phaseIdx, int compIIdx, int compJIdx)
Given the phase compositions, return the binary diffusion coefficient of two components in a phase.
Definition: brineco2.hh:592
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:356
static Scalar viscosity(const FluidState &fluidState, int phaseIdx)
Calculate the dynamic viscosity of a fluid phase .
Definition: brineco2.hh:422
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:579
static void init()
Definition: brineco2.hh:328
static constexpr bool isGas(int phaseIdx)
Return whether a phase is gaseous.
Definition: brineco2.hh:219
static constexpr int phase1Idx
index of the second phase
Definition: brineco2.hh:161
static constexpr int gasPhaseIdx
index of the gas phase
Definition: brineco2.hh:159
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:231
static std::string phaseName(int phaseIdx)
Return the human readable name of a fluid phase.
Definition: brineco2.hh:198
static Scalar thermalConductivity(const FluidState &fluidState, int phaseIdx)
Thermal conductivity of a fluid phase .
Definition: brineco2.hh:732
static constexpr int liquidPhaseIdx
index of the liquid phase
Definition: brineco2.hh:158
static Scalar fugacityCoefficient(const FluidState &fluidState, int phaseIdx, int compIdx)
Returns the fugacity coefficient of a component in a phase.
Definition: brineco2.hh:465
static constexpr bool isMiscible()
Returns whether the fluids are miscible.
Definition: brineco2.hh:211
BrineType Brine
Definition: brineco2.hh:152
static void init(Scalar startTemp, Scalar endTemp, int tempSteps, Scalar startPressure, Scalar endPressure, int pressureSteps)
Definition: brineco2.hh:335
static constexpr int comp1Idx
Definition: brineco2.hh:164
static Scalar componentEnthalpy(const FluidState &fluidState, int phaseIdx, int componentIdx)
Returns the specific enthalpy of a component in a specific phase.
Definition: brineco2.hh:693
static bool isIdealMixture(int phaseIdx)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: brineco2.hh:255
static Scalar equilibriumMoleFraction(const FluidState &fluidState, const ParameterCache &paramCache, int phaseIdx)
Returns the equilibrium concentration of the dissolved component in a phase.
Definition: brineco2.hh:525
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
The molar density of a fluid phase in .
Definition: brineco2.hh:390
The a parameter cache which does nothing.
Definition: nullparametercache.hh:34
Fluid system base class.
A class for the brine fluid properties,.
A fluid system for brine, i.e. H2O with dissolved NaCl.