diff --git a/opm/autodiff/StandardWellsDense.hpp b/opm/autodiff/StandardWellsDense.hpp index 8a7368977..50285c64e 100644 --- a/opm/autodiff/StandardWellsDense.hpp +++ b/opm/autodiff/StandardWellsDense.hpp @@ -310,6 +310,9 @@ enum WellVariablePositions { EvalWell wellVolumeFractionScaled(const int wellIdx, const int phaseIdx) const; + // Q_p / (Q_w + Q_g + Q_o) for three phase cases. + EvalWell wellSurfaceVolumeFraction(const int well_index, const int phase) const; + bool checkRateEconLimits(const WellEconProductionLimits& econ_production_limits, const WellState& well_state, const int well_number) const; diff --git a/opm/autodiff/StandardWellsDense_impl.hpp b/opm/autodiff/StandardWellsDense_impl.hpp index 6a7fb2133..f5f8c65e8 100644 --- a/opm/autodiff/StandardWellsDense_impl.hpp +++ b/opm/autodiff/StandardWellsDense_impl.hpp @@ -2076,6 +2076,26 @@ namespace Opm { + template + typename StandardWellsDense::EvalWell + StandardWellsDense:: + wellSurfaceVolumeFraction(const int well_index, const int phase) const + { + EvalWell sum_volume_fraction_scaled = 0.; + const int np = wells().number_of_phases; + for (int p = 0; p < np; ++p) { + sum_volume_fraction_scaled += wellVolumeFractionScaled(well_index, p); + } + + assert(sum_volume_fraction_scaled.value() != 0.); + + return wellVolumeFractionScaled(well_index, phase) / sum_volume_fraction_scaled; + } + + + + + template bool StandardWellsDense::