mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move updateWellStateWithTHPTargetProd to WellInterface
to share implementation between STW and MSW
This commit is contained in:
parent
06e9247887
commit
01c4aa1927
@ -249,7 +249,7 @@ namespace Opm
|
||||
std::vector<double>& well_flux,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
virtual void computeWellRatesWithBhp(const Simulator& ebosSimulator,
|
||||
void computeWellRatesWithBhp(const Simulator& ebosSimulator,
|
||||
const double& bhp,
|
||||
std::vector<double>& well_flux,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
@ -257,17 +257,13 @@ namespace Opm
|
||||
void computeWellRatesWithBhpIterations(const Simulator& ebosSimulator,
|
||||
const Scalar& bhp,
|
||||
std::vector<double>& well_flux,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
std::vector<double> computeWellPotentialWithTHP(
|
||||
const WellState& well_state,
|
||||
const Simulator& ebos_simulator,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
bool updateWellStateWithTHPTargetProd(const Simulator& ebos_simulator,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
virtual double getRefDensity() const override;
|
||||
|
||||
virtual bool iterateWellEqWithControl(const Simulator& ebosSimulator,
|
||||
|
@ -92,6 +92,7 @@ namespace Opm
|
||||
OPM_THROW(std::runtime_error, "water + gas case not supported by multisegment well yet");
|
||||
}
|
||||
|
||||
this->thp_update_iterations = true;
|
||||
}
|
||||
|
||||
|
||||
@ -1946,34 +1947,6 @@ namespace Opm
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
bool
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateWellStateWithTHPTargetProd(const Simulator& ebos_simulator,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
const auto& summary_state = ebos_simulator.vanguard().summaryState();
|
||||
|
||||
auto bhp_at_thp_limit = computeBhpAtThpLimitProdWithAlq(
|
||||
ebos_simulator, summary_state, this->getALQ(well_state), deferred_logger);
|
||||
if (bhp_at_thp_limit) {
|
||||
std::vector<double> rates(this->number_of_phases_, 0.0);
|
||||
computeWellRatesWithBhpIterations(ebos_simulator, *bhp_at_thp_limit, rates, deferred_logger);
|
||||
auto& ws = well_state.well(this->name());
|
||||
ws.surface_rates = rates;
|
||||
ws.bhp = *bhp_at_thp_limit;
|
||||
ws.thp = this->getTHPConstraint(summary_state);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename TypeTag>
|
||||
std::vector<double>
|
||||
MultisegmentWell<TypeTag>::
|
||||
@ -2008,5 +1981,4 @@ namespace Opm
|
||||
return num_seg * num_eq;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -322,17 +322,13 @@ namespace Opm
|
||||
void computeWellRatesWithBhpIterations(const Simulator& ebosSimulator,
|
||||
const double& bhp,
|
||||
std::vector<double>& well_flux,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
std::vector<double> computeWellPotentialWithTHP(
|
||||
const Simulator& ebosSimulator,
|
||||
DeferredLogger& deferred_logger,
|
||||
const WellState &well_state) const;
|
||||
|
||||
bool updateWellStateWithTHPTargetProd(const Simulator& ebos_simulator,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
virtual double getRefDensity() const override;
|
||||
|
||||
// get the mobility for specific perforation
|
||||
|
@ -1707,32 +1707,6 @@ namespace Opm
|
||||
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
bool
|
||||
StandardWell<TypeTag>::
|
||||
updateWellStateWithTHPTargetProd(const Simulator& ebos_simulator,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
const auto& summary_state = ebos_simulator.vanguard().summaryState();
|
||||
|
||||
auto bhp_at_thp_limit = computeBhpAtThpLimitProdWithAlq(
|
||||
ebos_simulator, summary_state, this->getALQ(well_state), deferred_logger);
|
||||
if (bhp_at_thp_limit) {
|
||||
std::vector<double> rates(this->number_of_phases_, 0.0);
|
||||
computeWellRatesWithBhp(ebos_simulator, *bhp_at_thp_limit, rates, deferred_logger);
|
||||
auto& ws = well_state.well(this->name());
|
||||
ws.surface_rates = rates;
|
||||
ws.bhp = *bhp_at_thp_limit;
|
||||
ws.thp = this->getTHPConstraint(summary_state);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
double
|
||||
StandardWell<TypeTag>::
|
||||
|
@ -222,10 +222,15 @@ public:
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
virtual bool updateWellStateWithTHPTargetProd(const Simulator& ebos_simulator,
|
||||
WellState& well_state,
|
||||
virtual void computeWellRatesWithBhpIterations(const Simulator& ebosSimulator,
|
||||
const Scalar& bhp,
|
||||
std::vector<double>& well_flux,
|
||||
DeferredLogger& deferred_logger) const = 0;
|
||||
|
||||
bool updateWellStateWithTHPTargetProd(const Simulator& ebos_simulator,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
enum class IndividualOrGroup { Individual, Group, Both };
|
||||
bool updateWellControl(const Simulator& ebos_simulator,
|
||||
const IndividualOrGroup iog,
|
||||
@ -344,6 +349,7 @@ protected:
|
||||
std::vector<RateVector> connectionRates_;
|
||||
std::vector< Scalar > B_avg_;
|
||||
bool changed_to_stopped_this_step_ = false;
|
||||
bool thp_update_iterations = false;
|
||||
|
||||
double wpolymer() const;
|
||||
|
||||
|
@ -1191,6 +1191,7 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
typename WellInterface<TypeTag>::Eval
|
||||
WellInterface<TypeTag>::getPerfCellPressure(const typename WellInterface<TypeTag>::FluidState& fs) const
|
||||
@ -1268,4 +1269,35 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
bool
|
||||
WellInterface<TypeTag>::
|
||||
updateWellStateWithTHPTargetProd(const Simulator& ebos_simulator,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
const auto& summary_state = ebos_simulator.vanguard().summaryState();
|
||||
|
||||
auto bhp_at_thp_limit = computeBhpAtThpLimitProdWithAlq(
|
||||
ebos_simulator, summary_state, this->getALQ(well_state), deferred_logger);
|
||||
if (bhp_at_thp_limit) {
|
||||
std::vector<double> rates(this->number_of_phases_, 0.0);
|
||||
if (thp_update_iterations) {
|
||||
computeWellRatesWithBhpIterations(ebos_simulator, *bhp_at_thp_limit,
|
||||
rates, deferred_logger);
|
||||
} else {
|
||||
computeWellRatesWithBhp(ebos_simulator, *bhp_at_thp_limit,
|
||||
rates, deferred_logger);
|
||||
}
|
||||
auto& ws = well_state.well(this->name());
|
||||
ws.surface_rates = rates;
|
||||
ws.bhp = *bhp_at_thp_limit;
|
||||
ws.thp = this->getTHPConstraint(summary_state);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
|
Loading…
Reference in New Issue
Block a user