BlackOilFluidSystem: remove interpolation between saturated and unsaturated quantities
this causes problems with things like DRSDT where "isSaturated(oilPhasIdx)" is not necessarily related to the presence of the gas phase. (analogous for DRVDT.) The impact of performance seems to be negligible: ``` Total time (seconds): 550.185 Solver time (seconds): 534.769 Assembly time (seconds): 251.509 (Failed: 4.51604; 1.79558%) Linear solve time (seconds): 263.03 (Failed: 5.78332; 2.19873%) Update time (seconds): 11.0526 (Failed: 0.220144; 1.99177%) Output write time (seconds): 18.1411 Overall Well Iterations: 902 (Failed: 7; 0.776053%) Overall Linearizations: 1890 (Failed: 33; 1.74603%) Overall Newton Iterations: 1553 (Failed: 33; 2.12492%) Overall Linear Iterations: 23525 (Failed: 511; 2.17216%) ``` before and ``` Total time (seconds): 556.463 Solver time (seconds): 541.06 Assembly time (seconds): 253.165 (Failed: 4.42903; 1.74946%) Linear solve time (seconds): 267.343 (Failed: 4.52042; 1.69087%) Update time (seconds): 11.334 (Failed: 0.214721; 1.89449%) Output write time (seconds): 18.0694 Overall Well Iterations: 903 (Failed: 8; 0.885936%) Overall Linearizations: 1909 (Failed: 33; 1.72865%) Overall Newton Iterations: 1572 (Failed: 33; 2.09924%) Overall Linear Iterations: 23866 (Failed: 391; 1.63831%) ``` after this patch, i.e., on my machine the runtime for Norne went from 550 to 556 seconds due to slightly larger number of non-linear and linear iterations. Note that this also happens if the 1e-4 threshold value is changed instead of the case distinction being removed. (This hints on the into the direction that the performance difference is just numerical noise.)
This commit is contained in:
parent
1f0be92300
commit
5f650785a9
@ -651,17 +651,6 @@ public:
|
||||
case oilPhaseIdx: {
|
||||
if (enableDissolvedGas()) {
|
||||
if (fluidState.phaseIsPresent(gasPhaseIdx)) {
|
||||
if (fluidState.saturation(gasPhaseIdx) < 1e-4) {
|
||||
// here comes the relatively expensive case: first calculate and then
|
||||
// interpolate between the saturated and undersaturated quantities to
|
||||
// avoid a discontinuity
|
||||
const auto& Rs = Opm::BlackOil::template getRs_<ThisType, LhsEval, FluidState>(fluidState, regionIdx);
|
||||
const auto& alpha = Opm::decay<LhsEval>(fluidState.saturation(gasPhaseIdx))/1e-4;
|
||||
const auto& bSat = oilPvt_->saturatedInverseFormationVolumeFactor(regionIdx, T, p);
|
||||
const auto& bUndersat = oilPvt_->inverseFormationVolumeFactor(regionIdx, T, p, Rs);
|
||||
return alpha*bSat + (1.0 - alpha)*bUndersat;
|
||||
}
|
||||
|
||||
return oilPvt_->saturatedInverseFormationVolumeFactor(regionIdx, T, p);
|
||||
}
|
||||
|
||||
@ -675,17 +664,6 @@ public:
|
||||
case gasPhaseIdx: {
|
||||
if (enableVaporizedOil()) {
|
||||
if (fluidState.phaseIsPresent(oilPhaseIdx)) {
|
||||
if (fluidState.saturation(oilPhaseIdx) < 1e-4) {
|
||||
// here comes the relatively expensive case: first calculate and then
|
||||
// interpolate between the saturated and undersaturated quantities to
|
||||
// avoid a discontinuity
|
||||
const auto& Rv = Opm::BlackOil::template getRv_<ThisType, LhsEval, FluidState>(fluidState, regionIdx);
|
||||
const auto& alpha = Opm::decay<LhsEval>(fluidState.saturation(oilPhaseIdx))/1e-4;
|
||||
const auto& bSat = gasPvt_->saturatedInverseFormationVolumeFactor(regionIdx, T, p);
|
||||
const auto& bUndersat = gasPvt_->inverseFormationVolumeFactor(regionIdx, T, p, Rv);
|
||||
return alpha*bSat + (1.0 - alpha)*bUndersat;
|
||||
}
|
||||
|
||||
return gasPvt_->saturatedInverseFormationVolumeFactor(regionIdx, T, p);
|
||||
}
|
||||
|
||||
@ -870,17 +848,6 @@ public:
|
||||
case oilPhaseIdx: {
|
||||
if (enableDissolvedGas()) {
|
||||
if (fluidState.phaseIsPresent(gasPhaseIdx)) {
|
||||
if (fluidState.saturation(gasPhaseIdx) < 1e-4) {
|
||||
// here comes the relatively expensive case: first calculate and then
|
||||
// interpolate between the saturated and undersaturated quantities to
|
||||
// avoid a discontinuity
|
||||
const auto& Rs = Opm::BlackOil::template getRs_<ThisType, LhsEval, FluidState>(fluidState, regionIdx);
|
||||
const auto& alpha = Opm::decay<LhsEval>(fluidState.saturation(gasPhaseIdx))/1e-4;
|
||||
const auto& muSat = oilPvt_->saturatedViscosity(regionIdx, T, p);
|
||||
const auto& muUndersat = oilPvt_->viscosity(regionIdx, T, p, Rs);
|
||||
return alpha*muSat + (1.0 - alpha)*muUndersat;
|
||||
}
|
||||
|
||||
return oilPvt_->saturatedViscosity(regionIdx, T, p);
|
||||
}
|
||||
|
||||
@ -895,17 +862,6 @@ public:
|
||||
case gasPhaseIdx: {
|
||||
if (enableVaporizedOil()) {
|
||||
if (fluidState.phaseIsPresent(oilPhaseIdx)) {
|
||||
if (fluidState.saturation(oilPhaseIdx) < 1e-4) {
|
||||
// here comes the relatively expensive case: first calculate and then
|
||||
// interpolate between the saturated and undersaturated quantities to
|
||||
// avoid a discontinuity
|
||||
const auto& Rv = Opm::BlackOil::template getRv_<ThisType, LhsEval, FluidState>(fluidState, regionIdx);
|
||||
const auto& alpha = Opm::decay<LhsEval>(fluidState.saturation(oilPhaseIdx))/1e-4;
|
||||
const auto& muSat = gasPvt_->saturatedViscosity(regionIdx, T, p);
|
||||
const auto& muUndersat = gasPvt_->viscosity(regionIdx, T, p, Rv);
|
||||
return alpha*muSat + (1.0 - alpha)*muUndersat;
|
||||
}
|
||||
|
||||
return gasPvt_->saturatedViscosity(regionIdx, T, p);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user