Merge pull request #970 from andlaus/fix_R_in_viscosity
BlackoilPropertiesFromDeck: properly calculate the Rs and Rv values for viscosity
This commit is contained in:
commit
bd91cf6e72
@ -242,6 +242,7 @@ namespace Opm
|
|||||||
double* dmudp) const
|
double* dmudp) const
|
||||||
{
|
{
|
||||||
const auto& pu = phaseUsage();
|
const auto& pu = phaseUsage();
|
||||||
|
const int np = numPhases();
|
||||||
|
|
||||||
enum PressureEvalTag {};
|
enum PressureEvalTag {};
|
||||||
typedef Opm::LocalAd::Evaluation<double, PressureEvalTag, /*size=*/1> LadEval;
|
typedef Opm::LocalAd::Evaluation<double, PressureEvalTag, /*size=*/1> LadEval;
|
||||||
@ -254,6 +255,9 @@ namespace Opm
|
|||||||
|
|
||||||
pLad.derivatives[0] = 1.0;
|
pLad.derivatives[0] = 1.0;
|
||||||
|
|
||||||
|
R_.resize(n*np);
|
||||||
|
this->compute_R_(n, p, T, z, cells, &R_[0]);
|
||||||
|
|
||||||
for (int i = 0; i < n; ++ i) {
|
for (int i = 0; i < n; ++ i) {
|
||||||
int cellIdx = cells[i];
|
int cellIdx = cells[i];
|
||||||
int pvtRegionIdx = cellPvtRegionIdx_[cellIdx];
|
int pvtRegionIdx = cellPvtRegionIdx_[cellIdx];
|
||||||
@ -268,6 +272,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pu.phase_used[BlackoilPhases::Liquid]) {
|
if (pu.phase_used[BlackoilPhases::Liquid]) {
|
||||||
|
RsLad.value = R_[i*np + pu.phase_pos[BlackoilPhases::Liquid]];
|
||||||
muLad = oilPvt_.viscosity(pvtRegionIdx, TLad, pLad, RsLad);
|
muLad = oilPvt_.viscosity(pvtRegionIdx, TLad, pLad, RsLad);
|
||||||
int offset = pu.num_phases*cellIdx + pu.phase_pos[BlackoilPhases::Liquid];
|
int offset = pu.num_phases*cellIdx + pu.phase_pos[BlackoilPhases::Liquid];
|
||||||
mu[offset] = muLad.value;
|
mu[offset] = muLad.value;
|
||||||
@ -275,6 +280,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pu.phase_used[BlackoilPhases::Vapour]) {
|
if (pu.phase_used[BlackoilPhases::Vapour]) {
|
||||||
|
RvLad.value = R_[i*np + pu.phase_pos[BlackoilPhases::Vapour]];
|
||||||
muLad = gasPvt_.viscosity(pvtRegionIdx, TLad, pLad, RvLad);
|
muLad = gasPvt_.viscosity(pvtRegionIdx, TLad, pLad, RvLad);
|
||||||
int offset = pu.num_phases*cellIdx + pu.phase_pos[BlackoilPhases::Vapour];
|
int offset = pu.num_phases*cellIdx + pu.phase_pos[BlackoilPhases::Vapour];
|
||||||
mu[offset] = muLad.value;
|
mu[offset] = muLad.value;
|
||||||
|
Loading…
Reference in New Issue
Block a user