diff --git a/opm/simulators/wells/MultisegmentWellEval.cpp b/opm/simulators/wells/MultisegmentWellEval.cpp index faae8cf09..898a65331 100644 --- a/opm/simulators/wells/MultisegmentWellEval.cpp +++ b/opm/simulators/wells/MultisegmentWellEval.cpp @@ -264,6 +264,7 @@ MultisegmentWellEval:: assembleICDPressureEq(const int seg, const UnitSystem& unit_system, WellState& well_state, + const SummaryState& summary_state, const bool use_average_density, DeferredLogger& deferred_logger) { @@ -306,9 +307,9 @@ assembleICDPressureEq(const int seg, } break; case Segment::SegmentType::VALVE : - icd_pressure_drop = segments_.pressureDropValve(seg); + icd_pressure_drop = segments_.pressureDropValve(seg, summary_state); if (reverseFlow){ - extra_derivatives = -segments_.pressureDropValve(seg, /*extra_reverse_flow_derivatives*/ true); + extra_derivatives = -segments_.pressureDropValve(seg, summary_state, /*extra_reverse_flow_derivatives*/ true); } break; default: { @@ -380,6 +381,7 @@ MultisegmentWellEval:: assemblePressureEq(const int seg, const UnitSystem& unit_system, WellState& well_state, + const SummaryState& summary_state, const bool use_average_density, DeferredLogger& deferred_logger) { @@ -387,7 +389,7 @@ assemblePressureEq(const int seg, case Segment::SegmentType::SICD : case Segment::SegmentType::AICD : case Segment::SegmentType::VALVE : { - assembleICDPressureEq(seg, unit_system, well_state, use_average_density, deferred_logger); + assembleICDPressureEq(seg, unit_system, well_state, summary_state, use_average_density, deferred_logger); break; } default : diff --git a/opm/simulators/wells/MultisegmentWellEval.hpp b/opm/simulators/wells/MultisegmentWellEval.hpp index ddc4d8d95..464b02f43 100644 --- a/opm/simulators/wells/MultisegmentWellEval.hpp +++ b/opm/simulators/wells/MultisegmentWellEval.hpp @@ -41,6 +41,8 @@ class ConvergenceReport; class GroupState; class Schedule; class WellContributions; +class SummaryState; + template class WellInterfaceIndices; class WellState; @@ -83,6 +85,7 @@ protected: void assembleICDPressureEq(const int seg, const UnitSystem& unit_system, WellState& well_state, + const SummaryState& summary_state, const bool use_average_density, DeferredLogger& deferred_logger); @@ -94,6 +97,7 @@ protected: void assemblePressureEq(const int seg, const UnitSystem& unit_system, WellState& well_state, + const SummaryState& summary_state, const bool use_average_density, DeferredLogger& deferred_logger); diff --git a/opm/simulators/wells/MultisegmentWellSegments.cpp b/opm/simulators/wells/MultisegmentWellSegments.cpp index 965077fe8..08dcf9d11 100644 --- a/opm/simulators/wells/MultisegmentWellSegments.cpp +++ b/opm/simulators/wells/MultisegmentWellSegments.cpp @@ -769,10 +769,11 @@ template typename MultisegmentWellSegments::EvalWell MultisegmentWellSegments:: pressureDropValve(const int seg, + const SummaryState& summary_state, const bool extra_reverse_flow_derivatives /*false*/) const { - const auto& segment_set = well_.wellEcl().getSegments(); - const Valve& valve = segment_set[seg].valve(); + Opm::WellSegments& segment_set = well_.wellEcl().getSegments(); + Valve& valve = segment_set[seg].valve(); EvalWell mass_rate = mass_rates_[seg]; const int seg_upwind = upwinding_segments_[seg]; @@ -814,7 +815,9 @@ pressureDropValve(const int seg, const EvalWell friction_pressure_loss = mswellhelpers::frictionPressureLoss(additional_length, diameter, area, roughness, density, mass_rate, visc); - const double area_con = valve.conCrossArea(); + const double udq_default = 0.0; // TODO: Get this from UDQPARAMS + ValveUDAEval uda_eval {summary_state, this->well_.name(), seg, udq_default}; + const double area_con = valve.conCrossArea(uda_eval); const double cv = valve.conFlowCoefficient(); const EvalWell constriction_pressure_loss = diff --git a/opm/simulators/wells/MultisegmentWellSegments.hpp b/opm/simulators/wells/MultisegmentWellSegments.hpp index d61182b49..6144bea12 100644 --- a/opm/simulators/wells/MultisegmentWellSegments.hpp +++ b/opm/simulators/wells/MultisegmentWellSegments.hpp @@ -34,6 +34,7 @@ namespace Opm { class SegmentState; class UnitSystem; class WellInterfaceGeneric; + class SummaryState; } // namespace Opm @@ -85,8 +86,8 @@ public: // pressure drop for sub-critical valve (WSEGVALV) EvalWell pressureDropValve(const int seg, + const SummaryState& st, const bool extra_reverse_flow_derivatives = false) const; - // pressure loss due to acceleration EvalWell accelerationPressureLoss(const int seg) const; @@ -162,7 +163,7 @@ private: std::vector> phase_fractions_; std::vector> phase_viscosities_; - const WellInterfaceGeneric& well_; + WellInterfaceGeneric& well_; void copyPhaseDensities(const unsigned phaseIdx, const std::size_t stride, diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index 7acd70cdc..4d3d50675 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -1907,7 +1907,8 @@ namespace Opm deferred_logger); } else { const UnitSystem& unit_system = ebosSimulator.vanguard().eclState().getDeckUnitSystem(); - this->assemblePressureEq(seg, unit_system, well_state, this->param_.use_average_density_ms_wells_, deferred_logger); + const auto& summary_state = ebosSimulator.vanguard().summaryState(); + this->assemblePressureEq(seg, unit_system, well_state, summary_state, this->param_.use_average_density_ms_wells_, deferred_logger); } } diff --git a/opm/simulators/wells/WellInterfaceGeneric.cpp b/opm/simulators/wells/WellInterfaceGeneric.cpp index 947a33c89..a9e37b5d7 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.cpp +++ b/opm/simulators/wells/WellInterfaceGeneric.cpp @@ -174,6 +174,11 @@ const Well& WellInterfaceGeneric::wellEcl() const return well_ecl_; } +Well& WellInterfaceGeneric::wellEcl() +{ + return well_ecl_; +} + const PhaseUsage& WellInterfaceGeneric::phaseUsage() const { assert(phase_usage_ != nullptr); diff --git a/opm/simulators/wells/WellInterfaceGeneric.hpp b/opm/simulators/wells/WellInterfaceGeneric.hpp index ca38a1352..c1daaab75 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.hpp +++ b/opm/simulators/wells/WellInterfaceGeneric.hpp @@ -80,6 +80,7 @@ public: void adaptRatesForVFP(std::vector& rates) const; const Well& wellEcl() const; + Well& wellEcl(); const PhaseUsage& phaseUsage() const; /// Returns true if the well is currently in prediction mode (i.e. not history mode).