/*! * \brief Initialize the phase viscosity for oil saturated gas * * The gas viscosity is a function of \f$(p_g, X_g^O)\f$, but this method only * requires the viscosity of oil-saturated gas (which only depends on pressure) while * there is assumed to be no dependence on the gas mass fraction... */ void setSaturatedGasViscosity(int regionIdx, const SamplingPoints &samplePoints ) { auto& oilVaporizationFactor = oilVaporizationFactorTable_[regionIdx]; Scalar RvMin = 0.0; Scalar RvMax = oilVaporizationFactor.eval(oilVaporizationFactorTable_[regionIdx].xMax(), /*extrapolate=*/true); Scalar poMin = samplePoints.front().first; Scalar poMax = samplePoints.back().first; size_t nRv = 20; size_t nP = samplePoints.size()*2; Spline mugSpline; mugSpline.setContainerOfTuples(samplePoints, /*type=*/Spline::Monotonic); // calculate a table of estimated densities depending on pressure and gas mass // fraction for (size_t RvIdx = 0; RvIdx < nRv; ++RvIdx) { Scalar Rv = RvMin + (RvMax - RvMin)*RvIdx/nRv; gasMu_[regionIdx].appendXPos(Rv); for (size_t pIdx = 0; pIdx < nP; ++pIdx) { Scalar pg = poMin + (poMax - poMin)*pIdx/nP; Scalar mug = mugSpline.eval(pg, /*extrapolate=*/true); gasMu_[regionIdx].appendSamplePoint(RvIdx, pg, mug); } } }
/*! * \brief Initialize the function for the gas formation volume factor * * The gas formation volume factor \f$B_g\f$ is a function of \f$(p_g, X_g^O)\f$ and * represents the partial density of the oil component in the gas phase at a given * pressure. This method only requires the volume factor of oil-saturated gas (which * only depends on pressure) while the dependence on the oil mass fraction is * guesstimated... */ void setSaturatedGasFormationVolumeFactor(int regionIdx, const SamplingPoints &samplePoints) { auto& invGasB = inverseGasB_[regionIdx]; auto &Rv = oilVaporizationFactorTable_[regionIdx]; Scalar T = BlackOilFluidSystem::surfaceTemperature; Scalar RvMin = 0.0; Scalar RvMax = Rv.eval(oilVaporizationFactorTable_[regionIdx].xMax(), /*extrapolate=*/true); Scalar poMin = samplePoints.front().first; Scalar poMax = samplePoints.back().first; size_t nRv = 20; size_t nP = samplePoints.size()*2; Scalar rhogRef = BlackOilFluidSystem::referenceDensity(gasPhaseIdx, regionIdx); Scalar rhooRef = BlackOilFluidSystem::referenceDensity(oilPhaseIdx, regionIdx); Spline gasFormationVolumeFactorSpline; gasFormationVolumeFactorSpline.setContainerOfTuples(samplePoints, /*type=*/Spline::Monotonic); updateSaturationPressureSpline_(regionIdx); // calculate a table of estimated densities depending on pressure and gas mass // fraction for (size_t RvIdx = 0; RvIdx < nRv; ++RvIdx) { Scalar Rv = RvMin + (RvMax - RvMin)*RvIdx/nRv; Scalar XgO = Rv/(rhooRef/rhogRef + Rv); invGasB.appendXPos(Rv); for (size_t pIdx = 0; pIdx < nP; ++pIdx) { Scalar pg = poMin + (poMax - poMin)*pIdx/nP; Scalar poSat = gasSaturationPressure(regionIdx, T, XgO); Scalar BgSat = gasFormationVolumeFactorSpline.eval(poSat, /*extrapolate=*/true); Scalar drhoo_dp = (1.1200 - 1.1189)/((5000 - 4000)*6894.76); Scalar rhoo = BlackOilFluidSystem::referenceDensity(oilPhaseIdx, regionIdx)/BgSat*(1 + drhoo_dp*(pg - poSat)); Scalar Bg = BlackOilFluidSystem::referenceDensity(oilPhaseIdx, regionIdx)/rhoo; invGasB.appendSamplePoint(RvIdx, pg, 1.0/Bg); } } }