22 params.
addRequiredParam<UserObjectName>(
"brine_fp",
"The name of the user object for brine");
23 params.
addRequiredParam<UserObjectName>(
"co2_fp",
"The name of the user object for CO2");
24 params.
addParam<
unsigned int>(
"salt_component", 2,
"The component number of salt");
31 _salt_component(getParam<unsigned
int>(
"salt_component")),
34 _Mh2o(_brine_fp.molarMassH2O()),
35 _invMh2o(1.0 / _Mh2o),
36 _Mco2(_co2_fp.molarMass()),
37 _Mnacl(_brine_fp.molarMassNaCl()),
42 _co2_henry(_co2_fp.henryCoefficients())
46 paramError(
"co2_fp",
"A valid CO2 FluidProperties UserObject must be provided");
49 paramError(
"brine_fp",
"A valid Brine FluidProperties UserObject must be provided");
60 "This value is larger than the possible number of phases ",
66 "This value is larger than the possible number of fluid components",
73 "The value provided must be different from the value entered in liquid_fluid_component");
78 "The value provided is larger than the possible number of fluid components",
96 std::vector<FluidStateProperties> & fsp)
const
113 const ADReal & temperature,
117 std::vector<FluidStateProperties> & fsp)
const
129 massFractions(pressure, temperature, Xnacl, Z, phase_state, fsp);
172 const ADReal & temperature,
176 std::vector<FluidStateProperties> & fsp)
const
187 if (Z.value() <
_Zmin)
198 phaseState(Z.value(), Xco2.value(), Yco2.value(), phase_state);
243 const ADReal & temperature,
244 std::vector<FluidStateProperties> & fsp)
const
250 ADReal co2_density, co2_viscosity;
257 mooseAssert(gas.
density.value() > 0.0,
"Gas density must be greater than zero");
268 const ADReal & temperature,
270 std::vector<FluidStateProperties> & fsp)
const
283 const ADReal liquid_density = 1.0 / (Xco2 / co2_partial_density + (1.0 - Xco2) / brine_density);
289 liquid.
density = liquid_density;
292 mooseAssert(liquid.
density.value() > 0.0,
"Liquid density must be greater than zero");
300 const ADReal co2_enthalpy =
_co2_fp.h_from_p_T(pressure, temperature);
305 liquid.
enthalpy = (1.0 - Xco2) * brine_enthalpy + Xco2 * (co2_enthalpy + hdis);
314 const ADReal & temperature,
317 std::vector<FluidStateProperties> & fsp)
const
329 const ADReal gas_density =
_co2_fp.rho_from_p_T(pressure, temperature);
340 const ADReal liquid_density = 1.0 / (Xco2 / co2_partial_density + (1.0 - Xco2) / brine_density);
345 const ADReal K0 = Yco2 / Xco2;
346 const ADReal K1 = (1.0 - Yco2) / (1.0 - Xco2);
351 (gas_density + vapor_mass_fraction * (liquid_density - gas_density));
358 const ADReal & temperature,
362 std::vector<FluidStateProperties> & fsp)
const
370 gas.saturation =
saturation(pressure, temperature, Xnacl, Z, fsp);
379 const ADReal & temperature,
396 const ADReal mco2 = xco2 * (2.0 * mnacl +
_invMh2o) / (1.0 - xco2);
399 Xco2 = mco2 *
_Mco2 / denominator;
404 const ADReal & temperature,
405 const ADReal & co2_density,
409 using std::log, std::exp, std::pow;
411 if (temperature.value() > 373.15)
413 ": fugacityCoefficientsLowTemp() is not valid for T > 373.15K. Use "
414 "fugacityCoefficientsHighTemp() instead");
417 const ADReal pbar = pressure * 1.0e-5;
423 const ADReal aCO2 = 7.54e7 - 4.13e4 * temperature;
424 const Real bCO2 = 27.8;
425 const Real aCO2H2O = 7.89e7;
426 const Real bH2O = 18.18;
428 const ADReal t15 =
pow(temperature, 1.5);
433 return log(V / (V - bCO2)) +
b / (V - bCO2) -
434 2.0 *
a / (
_Rbar * t15 * bCO2) * log((V + bCO2) / V) +
435 aCO2 *
b / (
_Rbar * t15 * bCO2 * bCO2) * (log((V + bCO2) / V) - bCO2 / (V + bCO2));
438 const ADReal lnPhiH2O = lnPhi(aCO2H2O, bH2O) - log(pbar * V / (
_Rbar * temperature));
439 const ADReal lnPhiCO2 = lnPhi(aCO2, bCO2) - log(pbar * V / (
_Rbar * temperature));
441 fh2o = exp(lnPhiH2O);
442 fco2 = exp(lnPhiCO2);
447 const ADReal & temperature,
448 const ADReal & co2_density,
454 if (temperature.value() <= 373.15)
456 ": fugacityCoefficientsHighTemp() is not valid for T <= 373.15K. Use "
457 "fugacityCoefficientsLowTemp() instead");
465 const ADReal & temperature,
466 const ADReal & co2_density,
468 const ADReal & yh2o)
const
470 using std::sqrt, std::pow, std::log, std::exp;
473 const ADReal pbar = pressure * 1.0e-5;
478 const ADReal yco2 = 1.0 - yh2o;
479 const ADReal xh2o = 1.0 - xco2;
481 const ADReal aCO2 = 8.008e7 - 4.984e4 * temperature;
482 const ADReal aH2O = 1.337e8 - 1.4e4 * temperature;
483 const Real bCO2 = 28.25;
484 const Real bH2O = 15.7;
485 const ADReal KH2OCO2 = 1.427e-2 - 4.037e-4 * temperature;
486 const ADReal KCO2H2O = 0.4228 - 7.422e-4 * temperature;
487 const ADReal kH2OCO2 = KH2OCO2 * yh2o + KCO2H2O * yco2;
488 const ADReal kCO2H2O = KCO2H2O * yh2o + KH2OCO2 * yco2;
490 const ADReal aH2OCO2 = sqrt(aCO2 * aH2O) * (1.0 - kH2OCO2);
491 const ADReal aCO2H2O = sqrt(aCO2 * aH2O) * (1.0 - kCO2H2O);
493 const ADReal amix = yh2o * yh2o * aH2O + yh2o * yco2 * (aH2OCO2 + aCO2H2O) + yco2 * yco2 * aCO2;
494 const ADReal bmix = yh2o * bH2O + yco2 * bCO2;
496 const ADReal t15 =
pow(temperature, 1.5);
498 ADReal lnPhiH2O = bH2O / bmix * (pbar * V / (
_Rbar * temperature) - 1.0) -
499 log(pbar * (V - bmix) / (
_Rbar * temperature));
500 ADReal term3 = (2.0 * yh2o * aH2O + yco2 * (aH2OCO2 + aCO2H2O) -
501 yh2o * yco2 * sqrt(aH2O * aCO2) * (kH2OCO2 - kCO2H2O) * (yh2o - yco2) +
502 xh2o * xco2 * sqrt(aH2O * aCO2) * (kH2OCO2 - kCO2H2O)) /
504 term3 -= bH2O / bmix;
505 term3 *= amix / (bmix *
_Rbar * t15) * log(V / (V + bmix));
508 return exp(lnPhiH2O);
513 const ADReal & temperature,
514 const ADReal & co2_density,
516 const ADReal & yh2o)
const
518 using std::sqrt, std::pow, std::log, std::exp;
521 const ADReal pbar = pressure * 1.0e-5;
526 const ADReal yco2 = 1.0 - yh2o;
527 const ADReal xh2o = 1.0 - xco2;
529 const ADReal aCO2 = 8.008e7 - 4.984e4 * temperature;
530 const ADReal aH2O = 1.337e8 - 1.4e4 * temperature;
531 const Real bCO2 = 28.25;
532 const Real bH2O = 15.7;
533 const ADReal KH2OCO2 = 1.427e-2 - 4.037e-4 * temperature;
534 const ADReal KCO2H2O = 0.4228 - 7.422e-4 * temperature;
535 const ADReal kH2OCO2 = KH2OCO2 * yh2o + KCO2H2O * yco2;
536 const ADReal kCO2H2O = KCO2H2O * yh2o + KH2OCO2 * yco2;
538 const ADReal aH2OCO2 = sqrt(aCO2 * aH2O) * (1.0 - kH2OCO2);
539 const ADReal aCO2H2O = sqrt(aCO2 * aH2O) * (1.0 - kCO2H2O);
541 const ADReal amix = yh2o * yh2o * aH2O + yh2o * yco2 * (aH2OCO2 + aCO2H2O) + yco2 * yco2 * aCO2;
542 const ADReal bmix = yh2o * bH2O + yco2 * bCO2;
544 const ADReal t15 =
pow(temperature, 1.5);
546 ADReal lnPhiCO2 = bCO2 / bmix * (pbar * V / (
_Rbar * temperature) - 1.0) -
547 log(pbar * (V - bmix) / (
_Rbar * temperature));
549 ADReal term3 = (2.0 * yco2 * aCO2 + yh2o * (aH2OCO2 + aCO2H2O) -
550 yh2o * yco2 * sqrt(aH2O * aCO2) * (kH2OCO2 - kCO2H2O) * (yh2o - yco2) +
551 xh2o * xco2 * sqrt(aH2O * aCO2) * (kCO2H2O - kH2OCO2)) /
554 lnPhiCO2 += (term3 - bCO2 / bmix) * amix / (bmix *
_Rbar * t15) * log(V / (V + bmix));
556 return exp(lnPhiCO2);
564 if (temperature.value() <= 373.15)
568 const ADReal Tref = temperature - 373.15;
569 const ADReal xh2o = 1.0 - xco2;
570 const ADReal Am = -3.084e-2 * Tref + 1.927e-5 * Tref * Tref;
572 return exp((Am - 2.0 * Am * xh2o) * xco2 * xco2);
581 if (temperature.value() <= 373.15)
585 const ADReal Tref = temperature - 373.15;
586 const ADReal xh2o = 1.0 - xco2;
587 const ADReal Am = -3.084e-2 * Tref + 1.927e-5 * Tref * Tref;
589 return exp(2.0 * Am * xco2 * xh2o * xh2o);
595 const ADReal & temperature,
596 const ADReal & Xnacl)
const
598 using std::log, std::exp;
601 const ADReal pbar = pressure * 1.0e-5;
605 const ADReal lambda = -0.411370585 + 6.07632013e-4 * temperature + 97.5347708 / temperature -
606 0.0237622469 * pbar / temperature +
607 0.0170656236 * pbar / (630.0 - temperature) +
608 1.41335834e-5 * temperature * log(pbar);
610 const ADReal xi = 3.36389723e-4 - 1.9829898e-5 * temperature +
611 2.12220830e-3 * pbar / temperature -
612 5.24873303e-3 * pbar / (630.0 - temperature);
614 return exp(2.0 * lambda * mnacl +
xi * mnacl * mnacl);
619 const ADReal & Xnacl)
const
626 const ADReal T2 = temperature * temperature;
627 const ADReal T3 = temperature * T2;
629 const ADReal lambda = 2.217e-4 * temperature + 1.074 / temperature + 2648.0 / T2;
630 const ADReal xi = 1.3e-5 * temperature - 20.12 / temperature + 5259.0 / T2;
632 return (1.0 - mnacl /
_invMh2o) * exp(2.0 * lambda * mnacl +
xi * mnacl * mnacl);
642 const ADReal Tc2 = Tc * Tc;
643 const ADReal Tc3 = Tc2 * Tc;
644 const ADReal Tc4 = Tc3 * Tc;
649 logK0H2O = -2.209 + 3.097e-2 * Tc - 1.098e-4 * Tc2 + 2.048e-7 * Tc3;
651 else if (Tc > 99.0 && Tc < 109.0)
653 const ADReal Tint = (Tc - 99.0) / 10.0;
654 const ADReal Tint2 = Tint * Tint;
655 logK0H2O = -0.0204026 + 0.0152513 * Tint + 0.417565 * Tint2 - 0.278636 * Tint * Tint2;
659 logK0H2O = -2.1077 + 2.8127e-2 * Tc - 8.4298e-5 * Tc2 + 1.4969e-7 * Tc3 - 1.1812e-10 * Tc4;
661 return pow(10.0, logK0H2O);
671 const ADReal Tc2 = Tc * Tc;
672 const ADReal Tc3 = Tc2 * Tc;
677 logK0CO2 = 1.189 + 1.304e-2 * Tc - 5.446e-5 * Tc2;
679 else if (Tc > 99.0 && Tc < 109.0)
681 const ADReal Tint = (Tc - 99.0) / 10.0;
682 const ADReal Tint2 = Tint * Tint;
683 logK0CO2 = 1.9462 + 2.25692e-2 * Tint - 9.49577e-3 * Tint2 - 6.77721e-3 * Tint * Tint2;
687 logK0CO2 = 1.668 + 3.992e-3 * Tc - 1.156e-5 * Tc2 + 1.593e-9 * Tc3;
689 return pow(10.0, logK0CO2);
694 const ADReal & temperature,
699 if (temperature.value() <=
_Tlower)
703 else if (temperature.value() >
_Tlower && temperature.value() <
_Tupper)
706 const Real Tint = (temperature.value() -
_Tlower) / 10.0;
712 ADReal xco2_lower, yh2o_lower;
715 const Real dxco2_dT_lower = xco2_lower.derivatives()[
_Tidx];
716 const Real dyh2o_dT_lower = yh2o_lower.derivatives()[
_Tidx];
719 Real xco2_upper, yh2o_upper;
720 Real co2_density_upper =
_co2_fp.rho_from_p_T(pressure.value(),
_Tupper);
723 pressure.value(),
_Tupper, Xnacl.value(), co2_density_upper, xco2_upper, yh2o_upper);
725 Real
A, dA_dp, dA_dT,
B, dB_dp, dB_dT, dB_dX;
740 const Real dyh2o_dT_upper =
741 ((1.0 -
B) * dA_dT + (
A - 1.0) *
A * dB_dT) / (1.0 -
A *
B) / (1.0 -
A *
B);
742 const Real dxco2_dT_upper = dB_dT * (1.0 - yh2o_upper) -
B * dyh2o_dT_upper;
745 Real xco2r, yh2or, dxco2_dT, dyh2o_dT;
747 Tint, xco2_lower.value(), dxco2_dT_lower, xco2_upper, dxco2_dT_upper, xco2r, dxco2_dT);
749 Tint, yh2o_lower.value(), dyh2o_dT_lower, yh2o_upper, dyh2o_dT_upper, yh2or, dyh2o_dT);
764 const Real co2_density =
_co2_fp.rho_from_p_T(pressure.value(), temperature.value());
769 pressure.value(), temperature.value(), Xnacl.value(), co2_density, xco2r, yh2or);
772 Real
A, dA_dp, dA_dT,
B, dB_dp, dB_dT, dB_dX;
787 const Real dyh2o_dp =
788 ((1.0 -
B) * dA_dp + (
A - 1.0) *
A * dB_dp) / (1.0 -
A *
B) / (1.0 -
A *
B);
789 const Real dxco2_dp = dB_dp * (1.0 - yh2or) -
B * dyh2o_dp;
791 const Real dyh2o_dT =
792 ((1.0 -
B) * dA_dT + (
A - 1.0) *
A * dB_dT) / (1.0 -
A *
B) / (1.0 -
A *
B);
793 const Real dxco2_dT = dB_dT * (1.0 - yh2or) -
B * dyh2o_dT;
795 const Real dyh2o_dX = ((
A - 1.0) *
A * dB_dX) / (1.0 -
A *
B) / (1.0 -
A *
B);
796 const Real dxco2_dX = dB_dX * (1.0 - yh2or) -
B * dyh2o_dX;
812 const ADReal & temperature,
817 if (temperature.value() > 373.15)
819 ": equilibriumMoleFractionsLowTemp() is not valid for T > 373.15K. Use "
820 "equilibriumMoleFractions() instead");
823 const ADReal co2_density =
_co2_fp.rho_from_p_T(pressure, temperature);
833 const ADReal yh2ow = (1.0 -
B) / (1.0 /
A -
B);
834 const ADReal xco2w =
B * (1.0 - yh2ow);
840 const ADReal mco2 = mco2w / gamma;
847 xco2 = mco2 / total_moles;
848 yh2o =
A * (1.0 - xco2 - 2.0 * mnacl / total_moles);
853 const ADReal & temperature,
854 const ADReal & co2_density,
860 if (temperature.value() > 373.15)
862 ": funcABLowTemp() is not valid for T > 373.15K. Use funcABHighTemp() instead");
865 const ADReal pbar = pressure * 1.0e-5;
868 const Real pref = 1.0;
869 const Real vCO2 = 32.6;
870 const Real vH2O = 18.1;
872 const ADReal delta_pbar = pbar - pref;
883 A = K0H2O / (phiH2O * pbar) * exp(delta_pbar * vH2O / Rt);
884 B = phiCO2 * pbar / (
_invMh2o * K0CO2) * exp(-delta_pbar * vCO2 / Rt);
899 if (temperature <= 373.15)
901 ": funcABHighTemp() is not valid for T <= 373.15K. Use funcABLowTemp() instead");
904 const Real pbar = pressure * 1.0e-5;
906 const Real Tc = temperature -
_T_c2k;
909 const Real pref = -1.9906e-1 + 2.0471e-3 * Tc + 1.0152e-4 * Tc * Tc - 1.4234e-6 * Tc * Tc * Tc +
910 1.4168e-8 * Tc * Tc * Tc * Tc;
911 const Real vCO2 = 32.6 + 3.413e-2 * (Tc - 100.0);
912 const Real vH2O = 18.1 + 3.137e-2 * (Tc - 100.0);
914 const Real delta_pbar = pbar - pref;
915 const Real Rt =
_Rbar * temperature;
926 const ADReal rhoco2 = co2_density;
942 A = K0H2O * gammaH2O / (phiH2O.value() * pbar) * exp(delta_pbar * vH2O / Rt);
943 B = phiCO2.value() * pbar / (
_invMh2o * K0CO2 * gamma * gammaCO2) * exp(-delta_pbar * vCO2 / Rt);
961 funcABHighTemp(pressure, temperature, Xnacl, co2_density, xco2, yh2o,
A,
B);
964 const Real dp = 1.0e-2;
965 const Real dT = 1.0e-6;
966 const Real dX = 1.0e-8;
969 funcABHighTemp(pressure + dp, temperature, Xnacl, co2_density, xco2, yh2o,
A2, B2);
970 dA_dp = (
A2 -
A) / dp;
971 dB_dp = (B2 -
B) / dp;
973 funcABHighTemp(pressure, temperature + dT, Xnacl, co2_density, xco2, yh2o,
A2, B2);
974 dA_dT = (
A2 -
A) / dT;
975 dB_dT = (B2 -
B) / dT;
977 funcABHighTemp(pressure, temperature, Xnacl + dX, co2_density, xco2, yh2o,
A2, B2);
978 dB_dX = (B2 -
B) / dX;
983 Real pressure, Real temperature, Real Xnacl, Real co2_density, Real & xco2, Real & yh2o)
const
990 const Real mnacl = Xnacl / (1.0 - Xnacl) /
_Mnacl;
1001 auto fy = [mnacl,
this](Real
y, Real
A, Real
B)
1008 auto dfy = [mnacl,
this](Real
A, Real
B, Real dA, Real dB)
1010 const Real denominator = (1.0 /
A -
B) * (2.0 * mnacl +
_invMh2o) + 2.0 * mnacl *
B;
1011 return 1.0 +
_invMh2o * dB / denominator +
1013 (2.0 * mnacl * dB - (2.0 * mnacl +
_invMh2o) * (dB + dA /
A /
A)) / denominator /
1019 const Real dy = 1.0e-8;
1022 unsigned int iter = 0;
1023 const Real
tol = 1.0e-12;
1024 const unsigned int max_its = 10;
1027 while (std::abs(fy(
y,
A,
B)) >
tol)
1031 funcABHighTemp(pressure, temperature, Xnacl, co2_density,
x,
y + dy, dA, dB);
1035 y =
y - fy(
y,
A,
B) / dfy(
A,
B, dA, dB);
1055 const ADReal V = 37.51 - 9.585e-2 * Tc + 8.74e-4 * Tc * Tc - 5.044e-7 * Tc * Tc * Tc;
1057 return 1.0e6 *
_Mco2 / V;
1062 Real pressure, Real temperature, Real Xnacl, Real saturation,
unsigned int qp)
const
1082 const ADReal Yco2 = 1.0 - Yh2o;
1112 const std::vector<Real>
b{1.19784e-1, -7.17823e-4, 4.93854e-6, -1.03826e-8, 1.08233e-11};
1118 for (
unsigned int i = 0; i <
b.size(); ++i)
1119 kb +=
b[i] *
pow(Tc, i);
1125 return Kh_h2o *
pow(10.0, xmol * kb);
1134 ADReal hdis = -
_R * temperature * temperature * Kh.derivatives()[
_Tidx] / Kh /
_Mco2;
1138 const Real dT = temperature.value() * 1.0e-8;
1139 const ADReal T2 = temperature + dT;
1142 const Real dhdis_dT =
1143 (-
_R * T2 * T2 * Kh2.derivatives()[
_Tidx] / Kh2 /
_Mco2 - hdis).value() / dT;
1145 const Real dX = Xnacl.value() * 1.0e-8;
1146 const ADReal X2 = Xnacl + dX;
1149 const Real dhdis_dX =
1150 (-
_R * temperature * temperature * Kh3.derivatives()[
_Tidx] / Kh3 /
_Mco2 - hdis).value() /
1153 hdis.derivatives() = temperature.derivatives() * dhdis_dT + Xnacl.derivatives() * dhdis_dX;
1162 const ADReal delta_h = -58.3533 + 0.134519 * temperature;
1165 return delta_h * 1000.0 /
_Mco2;
1170 Real temperature, Real f0, Real df0, Real f1, Real df1, Real & value, Real & deriv)
const
1176 const Real
b = df0 * dT;
1177 const Real
c = 3.0 * (f1 - f0) - (2.0 * df0 + df1) * dT;
1178 const Real
d = 2.0 * (f0 - f1) + (df0 + df1) * dT;
1180 const Real t2 = temperature * temperature;
1181 const Real t3 = temperature * t2;
1183 value =
a +
b * temperature +
c * t2 +
d * t3;
1184 deriv =
b + 2.0 *
c * temperature + 3.0 *
d * t2;
1192 if (temperature < 285.15 || temperature > 573.15)
1194 " is outside range 285.15 K <= T <= 573.15 K");
1196 if (pressure > 6.0e7)
1198 " must be less than 60 MPa");
DualNumber< Real, DNDerivativeType, true > ADReal
const std::vector< double > y
const std::vector< double > x
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
registerMooseObject("PorousFlowApp", PorousFlowBrineCO2)
FluidStatePhaseEnum
Phase state enum.
void ErrorVector unsigned int
Brine (NaCl in H2O) fluid properties as a function of pressure (Pa), temperature (K) and NaCl mass fr...
virtual Real mu_from_p_T_X(Real pressure, Real temperature, Real xnacl) const override
virtual Real rho_from_p_T_X(Real pressure, Real temperature, Real xnacl) const override
FPADReal h_from_p_T_X(const FPADReal &pressure, const FPADReal &temperature, const FPADReal &xnacl) const
Real vaporPressure(Real temperature, Real xnacl) const
Brine vapour pressure From Haas, Physical properties of the coexisting phases and thermochemical prop...
Real henryConstant(Real temperature, const std::vector< Real > &coeffs) const
IAPWS formulation of Henry's law constant for dissolution in water (implemented in water FluidPropert...
virtual std::string fluidName() const override
Fluid name.
void paramError(const std::string ¶m, Args... args) const
void mooseError(Args &&... args) const
Specialized class for brine and CO2 including calculation of mutual solubility of the two fluids usin...
void liquidProperties(const ADReal &pressure, const ADReal &temperature, const ADReal &Xnacl, std::vector< FluidStateProperties > &fsp) const
Thermophysical properties of the liquid state.
void funcABLowTemp(const ADReal &pressure, const ADReal &temperature, const ADReal &co2_density, ADReal &A, ADReal &B) const
ADReal saturation(const ADReal &pressure, const ADReal &temperature, const ADReal &Xnacl, const ADReal &Z, std::vector< FluidStateProperties > &fsp) const
Gas saturation in the two-phase region.
ADReal fugacityCoefficientCO2HighTemp(const ADReal &pressure, const ADReal &temperature, const ADReal &co2_density, const ADReal &xco2, const ADReal &yh2o) const
ADReal henryConstant(const ADReal &temperature, const ADReal &Xnacl) const
Henry's constant of dissolution of gas phase CO2 in brine.
const Real _Tlower
Temperature below which the Spycher, Pruess & Ennis-King (2003) model is used (K)
void gasProperties(const ADReal &pressure, const ADReal &temperature, std::vector< FluidStateProperties > &fsp) const
Thermophysical properties of the gaseous state.
const Real _Tupper
Temperature above which the Spycher & Pruess (2010) model is used (K)
const Real _invMh2o
Inverse of molar mass of H2O (mol/kg)
ADReal enthalpyOfDissolutionGas(const ADReal &temperature, const ADReal &Xnacl) const
Enthalpy of dissolution of gas phase CO2 in brine calculated using Henry's constant From Himmelblau,...
virtual void checkVariables(Real pressure, Real temperature) const
Check the input variables.
ADReal fugacityCoefficientH2OHighTemp(const ADReal &pressure, const ADReal &temperature, const ADReal &co2_density, const ADReal &xco2, const ADReal &yh2o) const
ADReal partialDensityCO2(const ADReal &temperature) const
Partial density of dissolved CO2 From Garcia, Density of aqueous solutions of CO2,...
const Real _Rbar
Molar gas constant in bar cm^3 /(K mol)
void fugacityCoefficientsHighTemp(const ADReal &pressure, const ADReal &temperature, const ADReal &co2_density, const ADReal &xco2, const ADReal &yh2o, ADReal &fco2, ADReal &fh2o) const
Fugacity coefficients for H2O and CO2 at elevated temperatures (100C < T <= 300C).
ADReal activityCoefficientHighTemp(const ADReal &temperature, const ADReal &Xnacl) const
Activity coefficient for CO2 in brine used in the elevated temperature formulation.
void solveEquilibriumMoleFractionHighTemp(Real pressure, Real temperature, Real Xnacl, Real co2_density, Real &xco2, Real &yh2o) const
Function to solve for yh2o and xco2 iteratively in the elevated temperature regime (T > 100C)
const Real _Mco2
Molar mass of CO2 (kg/mol)
void massFractions(const ADReal &pressure, const ADReal &temperature, const ADReal &Xnacl, const ADReal &Z, FluidStatePhaseEnum &phase_state, std::vector< FluidStateProperties > &fsp) const
Mass fractions of CO2 and H2O in both phases, as well as derivatives wrt PorousFlow variables.
void smoothCubicInterpolation(Real temperature, Real f0, Real df0, Real f1, Real df1, Real &value, Real &deriv) const
Cubic function to smoothly interpolate between the low temperature and elevated temperature models fo...
void funcABHighTemp(Real pressure, Real temperature, Real Xnacl, Real co2_density, Real xco2, Real yh2o, Real &A, Real &B) const
The function A (Eq.
const Real _Zmin
Minimum Z - below this value all CO2 will be dissolved.
const std::vector< Real > _co2_henry
Henry's coefficeients for CO2.
virtual std::string fluidStateName() const override
Name of FluidState.
void equilibriumMoleFractionsLowTemp(const ADReal &pressure, const ADReal &temperature, const ADReal &Xnacl, ADReal &xco2, ADReal &yh2o) const
Mole fractions of CO2 in brine and water vapor in CO2 at equilibrium in the low temperature regime (T...
const BrineFluidProperties & _brine_fp
Fluid properties UserObject for water.
void equilibriumMoleFractions(const ADReal &pressure, const ADReal &temperature, const ADReal &Xnacl, ADReal &xco2, ADReal &yh2o) const
Mole fractions of CO2 in brine and water vapor in CO2 at equilibrium.
PorousFlowBrineCO2(const InputParameters ¶meters)
virtual Real totalMassFraction(Real pressure, Real temperature, Real Xnacl, Real saturation, unsigned int qp) const override
Total mass fraction of fluid component summed over all phases in the two-phase state for a specified ...
void equilibriumMassFractions(const ADReal &pressure, const ADReal &temperature, const ADReal &Xnacl, ADReal &Xco2, ADReal &Yh2o) const
Mass fractions of CO2 in brine and water vapor in CO2 at equilibrium.
ADReal equilibriumConstantCO2(const ADReal &temperature) const
Equilibrium constant for CO2 For temperatures 12C <= T <= 99C, uses Spycher, Pruess and Ennis-King (2...
void twoPhaseProperties(const ADReal &pressure, const ADReal &temperature, const ADReal &Xnacl, const ADReal &Z, unsigned int qp, std::vector< FluidStateProperties > &fsp) const
Gas and liquid properties in the two-phase region.
ADReal activityCoefficient(const ADReal &pressure, const ADReal &temperature, const ADReal &Xnacl) const
Activity coefficient for CO2 in brine.
const Real _Mh2o
Molar mass of water (kg/mol)
static InputParameters validParams()
const unsigned int _salt_component
Salt component index.
ADReal activityCoefficientCO2(const ADReal &temperature, const ADReal &xco2) const
Activity coefficient of CO2 Eq.
void fugacityCoefficientsLowTemp(const ADReal &pressure, const ADReal &temperature, const ADReal &co2_density, ADReal &fco2, ADReal &fh2o) const
Fugacity coefficients for H2O and CO2 for T <= 100C Eq.
const SinglePhaseFluidProperties & _co2_fp
Fluid properties UserObject for the CO2.
ADReal enthalpyOfDissolution(const ADReal &temperature) const
Enthalpy of dissolution of CO2 in brine calculated using linear fit to model of Duan and Sun,...
ADReal activityCoefficientH2O(const ADReal &temperature, const ADReal &xco2) const
Activity coefficient of H2O Eq.
void thermophysicalProperties(Real pressure, Real temperature, Real Xnacl, Real Z, unsigned int qp, std::vector< FluidStateProperties > &fsp) const override
Determines the complete thermophysical state of the system for a given set of primary variables.
ADReal equilibriumConstantH2O(const ADReal &temperature) const
Equilibrium constant for H2O For temperatures 12C <= T <= 99C, uses Spycher, Pruess and Ennis-King (2...
const Real _Mnacl
Molar mass of NaCL.
virtual Real capillaryPressure(Real saturation, unsigned qp=0) const
Capillary pressure is calculated as a function of true saturation.
unsigned int _num_components
Number of components.
const PorousFlowCapillaryPressure & _pc
Capillary pressure UserObject.
unsigned int _gas_phase_number
Phase number of the gas phase.
const Real _R
Universal gas constant (J/mol/K)
const unsigned int _aqueous_phase_number
Phase number of the aqueous phase.
FluidStateProperties _empty_fsp
Empty FluidStateProperties object.
const Real _T_c2k
Conversion from C to K.
void clearFluidStateProperties(std::vector< FluidStateProperties > &fsp) const
Clears the contents of the FluidStateProperties data structure.
unsigned int _num_phases
Number of phases.
Real vaporMassFraction(Real Z0, Real K0, Real K1) const
Solves Rachford-Rice equation to provide vapor mass fraction.
Compositional flash routines for miscible multiphase flow classes with multiple fluid components.
const unsigned int _Xidx
Index of derivative wrt salt mass fraction X.
unsigned int _gas_fluid_component
Fluid component number of the gas phase.
const bool _compute_enthalpy
Whether to compute the enthalpy of each phase.
const bool _compute_internal_energy
Whether to compute the internal energy of each phase.
const unsigned int _pidx
Index of derivative wrt pressure.
const unsigned int _Tidx
Index of derivative wrt temperature.
const unsigned int _Zidx
Index of derivative wrt total mass fraction Z.
static InputParameters validParams()
const unsigned int _aqueous_fluid_component
Fluid component number of the aqueous component.
void phaseState(Real Zi, Real Xi, Real Yi, FluidStatePhaseEnum &phase_state) const
Determines the phase state gven the total mass fraction and equilibrium mass fractions.
Common class for single phase fluid properties.
e e e e s T T T T T rho v v T e p T T virtual T std::string fluidName() const
Fluid name.
virtual void rho_mu_from_p_T(Real p, Real T, Real &rho, Real &mu) const
Combined methods.
std::string stringify(const T &t)
void derivInsert(SemiDynamicSparseNumberArray< Real, libMesh::dof_id_type, NWrapper< N > > &derivs, libMesh::dof_id_type index, Real value)
AD data structure to pass calculated thermophysical properties.
std::vector< ADReal > mass_fraction