fix molar weights

This commit is contained in:
Tor Harald Sandve 2021-01-18 14:08:25 +01:00
parent 570ec20598
commit f406ecd914
2 changed files with 24 additions and 9 deletions

View File

@ -246,6 +246,17 @@ public:
// set default molarMass and mappings
initEnd();
// use molarMass of CO2 and Brine as default
// when we are using the the CO2STORE option
// NB the oil component is used internally for
// brine
if (eclState.runspec().co2Storage()) {
for (unsigned regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
molarMass_[regionIdx][oilCompIdx] = BrineCo2Pvt<Scalar>::Brine::molarMass();
molarMass_[regionIdx][gasCompIdx] = BrineCo2Pvt<Scalar>::CO2::molarMass();
}
}
setEnableDiffusion(eclState.getSimulationConfig().isDiffusive());
if(enableDiffusion()) {
const auto& diffCoeffTables = eclState.getTableManager().getDiffusionCoefficientTable();
@ -256,8 +267,11 @@ public:
assert(diffCoeffTable.size() == numRegions);
for (unsigned regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
const auto& diffCoeffTable = diffCoeffTables[regionIdx];
molarMass_[regionIdx][oilCompIdx] = diffCoeffTable.oil_mw;
molarMass_[regionIdx][gasCompIdx] = diffCoeffTable.gas_mw;
// if molar weights are not provided in the deck we use the default values
if(diffCoeffTable.oil_mw > 0)
molarMass_[regionIdx][oilCompIdx] = diffCoeffTable.oil_mw;
if(diffCoeffTable.gas_mw > 0)
molarMass_[regionIdx][gasCompIdx] = diffCoeffTable.gas_mw;
setDiffusionCoefficient(diffCoeffTable.gas_in_gas, gasCompIdx, gasPhaseIdx, regionIdx);
setDiffusionCoefficient(diffCoeffTable.oil_in_gas, oilCompIdx, gasPhaseIdx, regionIdx);
setDiffusionCoefficient(diffCoeffTable.gas_in_oil, gasCompIdx, oilPhaseIdx, regionIdx);

View File

@ -57,8 +57,6 @@ template <class Scalar>
class BrineCo2Pvt
{
typedef std::vector<std::pair<Scalar, Scalar> > SamplingPoints;
typedef Opm::SimpleHuDuanH2O<Scalar> H2O;
typedef Opm::Brine<Scalar, H2O> Brine;
//typedef Opm::H2O<Scalar> H2O_IAPWS;
//typedef Opm::Brine<Scalar, H2O_IAPWS> Brine_IAPWS;
@ -68,9 +66,12 @@ class BrineCo2Pvt
//typedef H2O_Tabulated H2O;
//typedef Brine_Tabulated Brine;
typedef Opm::CO2<Scalar, CO2Tables> CO2;
public:
typedef Opm::SimpleHuDuanH2O<Scalar> H2O;
typedef Opm::Brine<Scalar, H2O> Brine;
typedef Opm::CO2<Scalar, CO2Tables> CO2;
typedef Opm::Tabulated1DFunction<Scalar> TabulatedOneDFunction;
//! The binary coefficients for brine and CO2 used by this fluid system
@ -380,8 +381,8 @@ private:
LhsEval convertXoGToxoG_(const LhsEval& XoG) const
{
Scalar M_CO2 = CO2::molarMass();
Scalar M_H2O = H2O::molarMass();
return XoG*M_H2O / (M_CO2*(1 - XoG) + XoG*M_H2O);
Scalar M_Brine = Brine::molarMass();
return XoG*M_Brine / (M_CO2*(1 - XoG) + XoG*M_Brine);
}
@ -392,9 +393,9 @@ private:
LhsEval convertxoGToXoG(const LhsEval& xoG) const
{
Scalar M_CO2 = CO2::molarMass();
Scalar M_H2O = H2O::molarMass();
Scalar M_Brine = Brine::molarMass();
return xoG*M_CO2 / (xoG*(M_CO2 - M_H2O) + M_H2O);
return xoG*M_CO2 / (xoG*(M_CO2 - M_Brine) + M_Brine);
}