Merge pull request #499 from totto82/co2brinepvt_refPR
Co2brinepvt ref pr
This commit is contained in:
@@ -44,10 +44,11 @@ double densityGas(const Co2Pvt& co2Pvt, const double p, const double T, const do
|
||||
template <class BrinePvt>
|
||||
double densityBrine(const BrinePvt& brinePvt, const double p, const double T, const double Rs)
|
||||
{
|
||||
return brinePvt.inverseFormationVolumeFactor(/*regionIdx=*/0,
|
||||
double bo = brinePvt.inverseFormationVolumeFactor(/*regionIdx=*/0,
|
||||
T,
|
||||
p,
|
||||
Rs) * brinePvt.oilReferenceDensity(0);
|
||||
Rs);
|
||||
return bo * (brinePvt.oilReferenceDensity(0) + Rs * brinePvt.gasReferenceDensity(0));
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@@ -62,7 +63,7 @@ int main(int argc, char **argv)
|
||||
if (argc < 5 || help) {
|
||||
std::cout << "USAGE:" << std::endl;
|
||||
std::cout << "co2brinepvt <prop> <phase> <p> <T> <salinity> <rs> "<< std::endl;
|
||||
std::cout << "prop = {density, invB, viscosity, rsSat}" << std::endl;
|
||||
std::cout << "prop = {density, invB, B, viscosity, rsSat, diffusionCoefficient}" << std::endl;
|
||||
std::cout << "phase = {CO2, brine}" << std::endl;
|
||||
std::cout << "p: pressure in pascal" << std::endl;
|
||||
std::cout << "T: temperature in kelvin" << std::endl;
|
||||
@@ -72,7 +73,7 @@ int main(int argc, char **argv)
|
||||
std::cout << "--h/--help Print help and exit." << std::endl;
|
||||
std::cout << "DESCRIPTION:" << std::endl;
|
||||
std::cout << "co2brinepvt computes PVT properties of a brine/co2 system " << std::endl;
|
||||
std::cout << "for a given phase (oil or brine), pressure, temperature, salinity) and rs." << std::endl;
|
||||
std::cout << "for a given phase (oil or brine), pressure, temperature, salinity and rs." << std::endl;
|
||||
std::cout << "The properties support are: density, the inverse phase formation volume factor (invB), viscosity, " << std::endl;
|
||||
std::cout << "saturated dissolution factor (rsSat) " << std::endl;
|
||||
std::cout << "See CO2STORE in the OPM manual for more details." << std::endl;
|
||||
@@ -91,19 +92,16 @@ int main(int argc, char **argv)
|
||||
if (argc > 6)
|
||||
rs = atof(argv[6]);
|
||||
|
||||
//double p_ref = 101325;
|
||||
//double T_ref = 298; // 25C
|
||||
std::vector<double> ref_den_co2 = {1.80914};
|
||||
std::vector<double> ref_den_water = {996.206};
|
||||
|
||||
Opm::Co2GasPvt<double> co2Pvt(ref_den_co2);
|
||||
size_t num_regions = 1;
|
||||
Opm::Co2GasPvt<double> co2Pvt(num_regions);
|
||||
|
||||
const double MmNaCl = 58e-3; // molar mass of NaCl [kg/mol]
|
||||
// convert to mass fraction
|
||||
std::vector<double> salinity = {0.0};
|
||||
if (molality > 0.0)
|
||||
salinity[0] = 1 / ( 1 + 1 / (molality*MmNaCl));
|
||||
Opm::BrineCo2Pvt<double> brineCo2Pvt(ref_den_water, ref_den_co2, salinity);
|
||||
Opm::BrineCo2Pvt<double> brineCo2Pvt(salinity);
|
||||
|
||||
double value;
|
||||
if (prop == "density") {
|
||||
if (phase == "CO2") {
|
||||
@@ -113,7 +111,7 @@ int main(int argc, char **argv)
|
||||
} else {
|
||||
throw std::runtime_error("phase " + phase + " not recognized. Use either CO2 or brine");
|
||||
}
|
||||
} else if (prop == "invB") {
|
||||
} else if (prop == "invB" || prop == "B") {
|
||||
if (phase == "CO2") {
|
||||
value = co2Pvt.inverseFormationVolumeFactor(/*regionIdx=*/0,
|
||||
T,
|
||||
@@ -127,6 +125,9 @@ int main(int argc, char **argv)
|
||||
} else {
|
||||
throw std::runtime_error("phase " + phase + " not recognized. Use either CO2 or brine");
|
||||
}
|
||||
if (prop == "B")
|
||||
value = 1 / value;
|
||||
|
||||
} else if (prop == "viscosity") {
|
||||
if (phase == "CO2") {
|
||||
value = co2Pvt.viscosity(/*regionIdx=*/0,
|
||||
@@ -145,9 +146,18 @@ int main(int argc, char **argv)
|
||||
value = brineCo2Pvt.saturatedGasDissolutionFactor(/*regionIdx=*/0,
|
||||
T,
|
||||
p);
|
||||
} else if (prop == "diffusionCoefficient") {
|
||||
size_t comp_idx = 0; // not used
|
||||
if (phase == "CO2") {
|
||||
value = co2Pvt.diffusionCoefficient(T,p, comp_idx);
|
||||
} else if (phase == "brine") {
|
||||
value = brineCo2Pvt.diffusionCoefficient(T,p, comp_idx);
|
||||
} else {
|
||||
throw std::runtime_error("phase " + phase + " not recognized. Use either CO2 or brine");
|
||||
}
|
||||
} else {
|
||||
throw std::runtime_error("prop " + prop + " not recognized. "
|
||||
+ "Use either density, visosity or invB");
|
||||
+ "Use either density, visosity, invB, B or diffusionCoefficient");
|
||||
}
|
||||
|
||||
std::cout << value << std::endl;
|
||||
|
||||
@@ -87,6 +87,21 @@ public:
|
||||
{
|
||||
Brine::salinity = salinity[0];
|
||||
}
|
||||
|
||||
BrineCo2Pvt(const std::vector<Scalar>& salinity,
|
||||
Scalar T_ref = 288.71, //(273.15 + 15.56)
|
||||
Scalar P_ref = 101325)
|
||||
: salinity_(salinity)
|
||||
{
|
||||
int num_regions = salinity_.size();
|
||||
co2ReferenceDensity_.resize(num_regions);
|
||||
brineReferenceDensity_.resize(num_regions);
|
||||
for (int i = 0; i < num_regions; ++i) {
|
||||
co2ReferenceDensity_[i] = CO2::gasDensity(T_ref, P_ref, true);
|
||||
brineReferenceDensity_[i] = Brine::liquidDensity(T_ref, P_ref, true);
|
||||
}
|
||||
Brine::salinity = salinity[0];
|
||||
}
|
||||
#if HAVE_ECL_INPUT
|
||||
/*!
|
||||
* \brief Initialize the parameters for Brine-CO2 system using an ECL deck.
|
||||
|
||||
@@ -68,6 +68,16 @@ public:
|
||||
: gasReferenceDensity_(gasReferenceDensity)
|
||||
{
|
||||
}
|
||||
|
||||
Co2GasPvt(size_t numRegions,
|
||||
Scalar T_ref = 288.71, //(273.15 + 15.56)
|
||||
Scalar P_ref = 101325)
|
||||
{
|
||||
setNumRegions(numRegions);
|
||||
for (size_t i = 0; i < numRegions; ++i) {
|
||||
gasReferenceDensity_[i] = CO2::gasDensity(T_ref, P_ref, true);
|
||||
}
|
||||
}
|
||||
#if HAVE_ECL_INPUT
|
||||
/*!
|
||||
* \brief Initialize the parameters for co2 gas using an ECL deck.
|
||||
|
||||
Reference in New Issue
Block a user