mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-27 09:40:59 -06:00
Merge pull request #5291 from akva2/template_scalar_well_stats
Template Scalar type for well state related classes
This commit is contained in:
commit
cff4e4b514
@ -62,7 +62,7 @@ struct Setup
|
||||
|
||||
const int step = 0;
|
||||
const auto& sched_state = schedule->operator[](step);
|
||||
WellState well_state(phaseUsage(runspec.phases()));
|
||||
WellState<double> well_state(phaseUsage(runspec.phases()));
|
||||
vfp_properties = std::make_unique<VFPProperties>(sched_state.vfpinj(), sched_state.vfpprod(), well_state);
|
||||
};
|
||||
};
|
||||
|
@ -80,8 +80,6 @@ struct NewtonRelaxationType<TypeTag, TTag::FlowNonLinearSolver> {
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class WellState;
|
||||
|
||||
// Available relaxation scheme types.
|
||||
enum class NonlinearRelaxType {
|
||||
Dampen,
|
||||
@ -167,9 +165,6 @@ void stabilizeNonlinearUpdate(BVector& dx, BVector& dxOld,
|
||||
|
||||
};
|
||||
|
||||
// Forwarding types from PhysicalModel.
|
||||
//typedef typename PhysicalModel::WellState WellState;
|
||||
|
||||
// --------- Public methods ---------
|
||||
|
||||
/// Construct solver for a given model.
|
||||
@ -180,7 +175,7 @@ void stabilizeNonlinearUpdate(BVector& dx, BVector& dxOld,
|
||||
/// \param[in] param parameters controlling nonlinear process
|
||||
/// \param[in, out] model physical simulation model.
|
||||
NonlinearSolver(const SolverParameters& param,
|
||||
std::unique_ptr<PhysicalModel> model)
|
||||
std::unique_ptr<PhysicalModel> model)
|
||||
: param_(param)
|
||||
, model_(std::move(model))
|
||||
, linearizations_(0)
|
||||
|
@ -28,7 +28,8 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
ALQState ALQState::serializationTestObject()
|
||||
template<class Scalar>
|
||||
ALQState<Scalar> ALQState<Scalar>::serializationTestObject()
|
||||
{
|
||||
ALQState result;
|
||||
result.current_alq_ = {{"test1", 1.0}};
|
||||
@ -40,7 +41,9 @@ ALQState ALQState::serializationTestObject()
|
||||
return result;
|
||||
}
|
||||
|
||||
double ALQState::get(const std::string& wname) const {
|
||||
template<class Scalar>
|
||||
Scalar ALQState<Scalar>::get(const std::string& wname) const
|
||||
{
|
||||
auto iter = this->current_alq_.find(wname);
|
||||
if (iter != this->current_alq_.end())
|
||||
return iter->second;
|
||||
@ -52,7 +55,9 @@ double ALQState::get(const std::string& wname) const {
|
||||
throw std::logic_error("No ALQ value registered for well: " + wname);
|
||||
}
|
||||
|
||||
void ALQState::update_default(const std::string& wname, double value) {
|
||||
template<class Scalar>
|
||||
void ALQState<Scalar>::update_default(const std::string& wname, Scalar value)
|
||||
{
|
||||
auto default_iter = this->default_alq_.find(wname);
|
||||
if (default_iter == this->default_alq_.end() || default_iter->second != value) {
|
||||
this->default_alq_.insert_or_assign(wname, value);
|
||||
@ -60,20 +65,28 @@ void ALQState::update_default(const std::string& wname, double value) {
|
||||
}
|
||||
}
|
||||
|
||||
void ALQState::set(const std::string& wname, double value) {
|
||||
template<class Scalar>
|
||||
void ALQState<Scalar>::set(const std::string& wname, Scalar value)
|
||||
{
|
||||
this->current_alq_[wname] = value;
|
||||
}
|
||||
|
||||
int ALQState::get_debug_counter() {
|
||||
template<class Scalar>
|
||||
int ALQState<Scalar>::get_debug_counter()
|
||||
{
|
||||
return this->debug_counter_;
|
||||
}
|
||||
|
||||
int ALQState::update_debug_counter() {
|
||||
template<class Scalar>
|
||||
int ALQState<Scalar>::update_debug_counter()
|
||||
{
|
||||
this->debug_counter_++;
|
||||
return this->debug_counter_;
|
||||
}
|
||||
|
||||
void ALQState::set_debug_counter(int value) {
|
||||
template<class Scalar>
|
||||
void ALQState<Scalar>::set_debug_counter(int value)
|
||||
{
|
||||
this->debug_counter_ = value;
|
||||
}
|
||||
|
||||
@ -88,7 +101,9 @@ int get_counter(const std::map<std::string, int>& count_map, const std::string&
|
||||
|
||||
}
|
||||
|
||||
bool ALQState::oscillation(const std::string& wname) const {
|
||||
template<class Scalar>
|
||||
bool ALQState<Scalar>::oscillation(const std::string& wname) const
|
||||
{
|
||||
auto inc_count = get_counter(this->alq_increase_count_, wname);
|
||||
if (inc_count == 0)
|
||||
return false;
|
||||
@ -97,35 +112,43 @@ bool ALQState::oscillation(const std::string& wname) const {
|
||||
return dec_count >= 1;
|
||||
}
|
||||
|
||||
|
||||
void ALQState::update_count(const std::string& wname, bool increase) {
|
||||
template<class Scalar>
|
||||
void ALQState<Scalar>::update_count(const std::string& wname, bool increase)
|
||||
{
|
||||
if (increase)
|
||||
this->alq_increase_count_[wname] += 1;
|
||||
else
|
||||
this->alq_decrease_count_[wname] += 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ALQState::reset_count() {
|
||||
template<class Scalar>
|
||||
void ALQState<Scalar>::reset_count()
|
||||
{
|
||||
this->alq_decrease_count_.clear();
|
||||
this->alq_increase_count_.clear();
|
||||
}
|
||||
|
||||
|
||||
int ALQState::get_increment_count(const std::string& wname) const {
|
||||
template<class Scalar>
|
||||
int ALQState<Scalar>::get_increment_count(const std::string& wname) const
|
||||
{
|
||||
return get_counter(this->alq_increase_count_, wname);
|
||||
}
|
||||
|
||||
int ALQState::get_decrement_count(const std::string& wname) const {
|
||||
template<class Scalar>
|
||||
int ALQState<Scalar>::get_decrement_count(const std::string& wname) const
|
||||
{
|
||||
return get_counter(this->alq_decrease_count_, wname);
|
||||
}
|
||||
|
||||
std::size_t ALQState::pack_size() const {
|
||||
template<class Scalar>
|
||||
std::size_t ALQState<Scalar>::pack_size() const
|
||||
{
|
||||
return this->current_alq_.size();
|
||||
}
|
||||
|
||||
std::size_t ALQState::pack_data(double * data) const {
|
||||
template<class Scalar>
|
||||
std::size_t ALQState<Scalar>::pack_data(Scalar* data) const
|
||||
{
|
||||
std::size_t index = 0;
|
||||
for (const auto& [_, value] : this->current_alq_) {
|
||||
(void)_;
|
||||
@ -134,7 +157,9 @@ std::size_t ALQState::pack_data(double * data) const {
|
||||
return index;
|
||||
}
|
||||
|
||||
std::size_t ALQState::unpack_data(const double * data) {
|
||||
template<class Scalar>
|
||||
std::size_t ALQState<Scalar>::unpack_data(const Scalar* data)
|
||||
{
|
||||
std::size_t index = 0;
|
||||
for (auto& [_, value] : this->current_alq_) {
|
||||
(void)_;
|
||||
@ -143,7 +168,8 @@ std::size_t ALQState::unpack_data(const double * data) {
|
||||
return index;
|
||||
}
|
||||
|
||||
bool ALQState::operator==(const ALQState& rhs) const
|
||||
template<class Scalar>
|
||||
bool ALQState<Scalar>::operator==(const ALQState& rhs) const
|
||||
{
|
||||
return this->current_alq_ == rhs.current_alq_ &&
|
||||
this->default_alq_ == rhs.default_alq_ &&
|
||||
@ -152,7 +178,6 @@ bool ALQState::operator==(const ALQState& rhs) const
|
||||
this->debug_counter_ == rhs.debug_counter_;
|
||||
}
|
||||
|
||||
template class ALQState<double>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -22,22 +22,22 @@
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class ALQState {
|
||||
template<class Scalar>
|
||||
class ALQState
|
||||
{
|
||||
public:
|
||||
static ALQState serializationTestObject();
|
||||
|
||||
std::size_t pack_size() const;
|
||||
std::size_t unpack_data(const double * data);
|
||||
std::size_t pack_data(double * data) const;
|
||||
std::size_t unpack_data(const Scalar* data);
|
||||
std::size_t pack_data(Scalar* data) const;
|
||||
|
||||
double get(const std::string& wname) const;
|
||||
void update_default(const std::string& wname, double value);
|
||||
void set(const std::string& wname, double value);
|
||||
Scalar get(const std::string& wname) const;
|
||||
void update_default(const std::string& wname, Scalar value);
|
||||
void set(const std::string& wname, Scalar value);
|
||||
bool oscillation(const std::string& wname) const;
|
||||
void update_count(const std::string& wname, bool increase);
|
||||
void reset_count();
|
||||
@ -60,14 +60,13 @@ public:
|
||||
bool operator==(const ALQState&) const;
|
||||
|
||||
private:
|
||||
std::map<std::string, double> current_alq_;
|
||||
std::map<std::string, double> default_alq_;
|
||||
std::map<std::string, Scalar> current_alq_;
|
||||
std::map<std::string, Scalar> default_alq_;
|
||||
std::map<std::string, int> alq_increase_count_;
|
||||
std::map<std::string, int> alq_decrease_count_;
|
||||
int debug_counter_ = 0;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -489,7 +489,7 @@ namespace Opm {
|
||||
void updateAverageFormationFactor();
|
||||
|
||||
void computePotentials(const std::size_t widx,
|
||||
const WellState& well_state_copy,
|
||||
const WellState<Scalar>& well_state_copy,
|
||||
std::string& exc_msg,
|
||||
ExceptionType::ExcEnum& exc_type,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
@ -382,7 +382,7 @@ void BlackoilWellModelConstraints::
|
||||
actionOnBrokenConstraints(const Group& group,
|
||||
const Group::InjectionCMode& newControl,
|
||||
const Phase& controlPhase,
|
||||
GroupState& group_state,
|
||||
GroupState<double>& group_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
auto oldControl = wellModel_.groupState().injection_control(group.name(), controlPhase);
|
||||
@ -405,9 +405,9 @@ actionOnBrokenConstraints(const Group& group,
|
||||
const int reportStepIdx,
|
||||
const Group::GroupLimitAction group_limit_action,
|
||||
const Group::ProductionCMode& newControl,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
std::optional<std::string>& worst_offending_well,
|
||||
GroupState& group_state,
|
||||
GroupState<double>& group_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
|
||||
@ -499,8 +499,8 @@ updateGroupIndividualControl(const Group& group,
|
||||
std::map<std::pair<std::string,Opm::Phase>,std::string>& switched_inj,
|
||||
std::map<std::string, std::string>& switched_prod,
|
||||
std::map<std::string, std::pair<std::string, std::string>>& closed_offending_wells,
|
||||
GroupState& group_state,
|
||||
WellState& well_state,
|
||||
GroupState<double>& group_state,
|
||||
WellState<double>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
bool changed = false;
|
||||
|
@ -31,9 +31,9 @@ namespace Opm {
|
||||
|
||||
class BlackoilWellModelGeneric;
|
||||
class DeferredLogger;
|
||||
class GroupState;
|
||||
template<class Scalar> class GroupState;
|
||||
class SummaryState;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
/// Class for handling constraints for the blackoil well model.
|
||||
class BlackoilWellModelConstraints
|
||||
@ -56,7 +56,7 @@ public:
|
||||
void actionOnBrokenConstraints(const Group& group,
|
||||
const Group::InjectionCMode& newControl,
|
||||
const Phase& controlPhase,
|
||||
GroupState& group_state,
|
||||
GroupState<double>& group_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
//! \brief Execute action on broken constraint for a production well group. Return true if a group control is changed
|
||||
@ -64,9 +64,9 @@ public:
|
||||
const int reportStepIdx,
|
||||
const Group::GroupLimitAction group_limit_action,
|
||||
const Group::ProductionCMode& newControl,
|
||||
const WellState& well_state,
|
||||
const WellState<double>& well_state,
|
||||
std::optional<std::string>& worst_offending_well,
|
||||
GroupState& group_state,
|
||||
GroupState<double>& group_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
//! \brief Update the individual controls for wells in a group. Return true if a group control is changed
|
||||
@ -75,8 +75,8 @@ public:
|
||||
std::map<std::pair<std::string,Opm::Phase>,std::string>& switched_inj,
|
||||
std::map<std::string, std::string>& switched_prod,
|
||||
std::map<std::string, std::pair<std::string, std::string>>& closed_offending_wells,
|
||||
GroupState& group_state,
|
||||
WellState& well_state,
|
||||
GroupState<double>& group_state,
|
||||
WellState<double>& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
private:
|
||||
|
@ -407,7 +407,7 @@ checkGEconLimits(
|
||||
return;
|
||||
}
|
||||
|
||||
GroupEconomicLimitsChecker checker {
|
||||
GroupEconomicLimitsChecker<double> checker {
|
||||
*this, wellTestState(), group, simulation_time, report_step_idx, deferred_logger
|
||||
};
|
||||
if (checker.minOilRate() || checker.minGasRate()) {
|
||||
@ -426,7 +426,7 @@ checkGEconLimits(
|
||||
void
|
||||
BlackoilWellModelGeneric::
|
||||
checkGconsaleLimits(const Group& group,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
const int reportStepIdx,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -793,7 +793,7 @@ void
|
||||
BlackoilWellModelGeneric::
|
||||
updateWsolvent(const Group& group,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState)
|
||||
const WellState<double>& wellState)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
const Group& groupTmp = schedule_.getGroup(groupName, reportStepIdx);
|
||||
@ -1206,7 +1206,7 @@ updateNetworkPressures(const int reportStepIdx)
|
||||
// set the dynamic THP constraint of the well accordingly.
|
||||
const double new_limit = it->second;
|
||||
well->setDynamicThpLimit(new_limit);
|
||||
SingleWellState& ws = this->wellState()[well->indexOfWell()];
|
||||
SingleWellState<double>& ws = this->wellState()[well->indexOfWell()];
|
||||
const bool thp_is_limit = ws.production_cmode == Well::ProducerCMode::THP;
|
||||
// TODO: not sure why the thp is NOT updated properly elsewhere
|
||||
if (thp_is_limit) {
|
||||
|
@ -66,7 +66,7 @@ namespace Opm {
|
||||
class SummaryConfig;
|
||||
class VFPProperties;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
} // namespace Opm
|
||||
|
||||
namespace Opm { namespace data {
|
||||
@ -114,14 +114,14 @@ public:
|
||||
std::vector<Well> getLocalWells(const int timeStepIdx) const;
|
||||
const Schedule& schedule() const { return schedule_; }
|
||||
const PhaseUsage& phaseUsage() const { return phase_usage_; }
|
||||
const GroupState& groupState() const { return this->active_wgstate_.group_state; }
|
||||
const GroupState<double>& groupState() const { return this->active_wgstate_.group_state; }
|
||||
std::vector<const WellInterfaceGeneric*> genericWells() const
|
||||
{ return {well_container_generic_.begin(), well_container_generic_.end()}; }
|
||||
|
||||
/*
|
||||
Immutable version of the currently active wellstate.
|
||||
*/
|
||||
const WellState& wellState() const
|
||||
const WellState<double>& wellState() const
|
||||
{
|
||||
return this->active_wgstate_.well_state;
|
||||
}
|
||||
@ -129,7 +129,7 @@ public:
|
||||
/*
|
||||
Mutable version of the currently active wellstate.
|
||||
*/
|
||||
WellState& wellState()
|
||||
WellState<double>& wellState()
|
||||
{
|
||||
return this->active_wgstate_.well_state;
|
||||
}
|
||||
@ -138,11 +138,11 @@ public:
|
||||
Will return the currently active nupcolWellState; must initialize
|
||||
the internal nupcol wellstate with initNupcolWellState() first.
|
||||
*/
|
||||
const WellState& nupcolWellState() const
|
||||
const WellState<double>& nupcolWellState() const
|
||||
{
|
||||
return this->nupcol_wgstate_.well_state;
|
||||
}
|
||||
GroupState& groupState() { return this->active_wgstate_.group_state; }
|
||||
GroupState<double>& groupState() { return this->active_wgstate_.group_state; }
|
||||
|
||||
WellTestState& wellTestState() { return this->active_wgstate_.well_test_state; }
|
||||
|
||||
@ -283,13 +283,13 @@ protected:
|
||||
prevWellState() must have been stored with the commitWellState()
|
||||
function first.
|
||||
*/
|
||||
const WellState& prevWellState() const
|
||||
const WellState<double>& prevWellState() const
|
||||
{
|
||||
return this->last_valid_wgstate_.well_state;
|
||||
}
|
||||
|
||||
|
||||
const WGState& prevWGState() const
|
||||
const WGState<double>& prevWGState() const
|
||||
{
|
||||
return this->last_valid_wgstate_;
|
||||
}
|
||||
@ -301,7 +301,7 @@ protected:
|
||||
last_valid_well_state_ member, that state can then be recovered
|
||||
with a subsequent call to resetWellState().
|
||||
*/
|
||||
void commitWGState(WGState wgstate)
|
||||
void commitWGState(WGState<double> wgstate)
|
||||
{
|
||||
this->last_valid_wgstate_ = std::move(wgstate);
|
||||
}
|
||||
@ -339,7 +339,7 @@ protected:
|
||||
|
||||
void updateWsolvent(const Group& group,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState);
|
||||
const WellState<double>& wellState);
|
||||
void setWsolvent(const Group& group,
|
||||
const int reportStepIdx,
|
||||
double wsolvent);
|
||||
@ -362,7 +362,7 @@ protected:
|
||||
void calculateEfficiencyFactors(const int reportStepIdx);
|
||||
|
||||
void checkGconsaleLimits(const Group& group,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
const int reportStepIdx,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
@ -395,7 +395,7 @@ protected:
|
||||
const int episodeIndex);
|
||||
|
||||
virtual void computePotentials(const std::size_t widx,
|
||||
const WellState& well_state_copy,
|
||||
const WellState<double>& well_state_copy,
|
||||
std::string& exc_msg,
|
||||
ExceptionType::ExcEnum& exc_type,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
@ -567,7 +567,7 @@ protected:
|
||||
std::unordered_map<std::string, std::vector<double>> prev_inj_multipliers_;
|
||||
|
||||
// Handling for filter cake injection multipliers
|
||||
std::unordered_map<std::string, WellFilterCake> filter_cake_;
|
||||
std::unordered_map<std::string, WellFilterCake<double>> filter_cake_;
|
||||
|
||||
/*
|
||||
The various wellState members should be accessed and modified
|
||||
@ -575,9 +575,9 @@ protected:
|
||||
commitWellState(), resetWellState(), nupcolWellState() and
|
||||
updateNupcolWellState().
|
||||
*/
|
||||
WGState active_wgstate_;
|
||||
WGState last_valid_wgstate_;
|
||||
WGState nupcol_wgstate_;
|
||||
WGState<double> active_wgstate_;
|
||||
WGState<double> last_valid_wgstate_;
|
||||
WGState<double> nupcol_wgstate_;
|
||||
|
||||
bool glift_debug = false;
|
||||
|
||||
|
@ -71,7 +71,7 @@ void BlackoilWellModelRestart::
|
||||
loadRestartConnectionData(const std::vector<data::Rates::opt>& phs,
|
||||
const data::Well& rst_well,
|
||||
const std::vector<PerforationData>& old_perf_data,
|
||||
SingleWellState& ws) const
|
||||
SingleWellState<double>& ws) const
|
||||
{
|
||||
auto& perf_data = ws.perf_data;
|
||||
auto perf_pressure = perf_data.pressure.begin();
|
||||
@ -95,7 +95,7 @@ void BlackoilWellModelRestart::
|
||||
loadRestartSegmentData(const std::string& well_name,
|
||||
const std::vector<data::Rates::opt>& phs,
|
||||
const data::Well& rst_well,
|
||||
SingleWellState& ws) const
|
||||
SingleWellState<double>& ws) const
|
||||
{
|
||||
const auto& segment_set = wellModel_.getWellEcl(well_name).getSegments();
|
||||
const auto& rst_segments = rst_well.segments;
|
||||
@ -128,7 +128,7 @@ loadRestartWellData(const std::string& well_name,
|
||||
const std::vector<data::Rates::opt>& phs,
|
||||
const data::Well& rst_well,
|
||||
const std::vector<PerforationData>& old_perf_data,
|
||||
SingleWellState& ws) const
|
||||
SingleWellState<double>& ws) const
|
||||
{
|
||||
const auto np = phs.size();
|
||||
|
||||
@ -158,7 +158,7 @@ loadRestartWellData(const std::string& well_name,
|
||||
void BlackoilWellModelRestart::
|
||||
loadRestartGroupData(const std::string& group,
|
||||
const data::GroupData& value,
|
||||
GroupState& grpState) const
|
||||
GroupState<double>& grpState) const
|
||||
{
|
||||
using GPMode = Group::ProductionCMode;
|
||||
using GIMode = Group::InjectionCMode;
|
||||
@ -223,8 +223,8 @@ void BlackoilWellModelRestart::
|
||||
loadRestartData(const data::Wells& rst_wells,
|
||||
const data::GroupAndNetworkValues& grpNwrkValues,
|
||||
const bool handle_ms_well,
|
||||
WellState& well_state,
|
||||
GroupState& grpState) const
|
||||
WellState<double>& well_state,
|
||||
GroupState<double>& grpState) const
|
||||
{
|
||||
using rt = data::Rates::opt;
|
||||
const auto& phases = wellModel_.phaseUsage();
|
||||
|
@ -35,13 +35,13 @@ namespace data {
|
||||
struct GroupData;
|
||||
class GroupAndNetworkValues;
|
||||
}
|
||||
class GroupState;
|
||||
template<class Scalar> class GroupState;
|
||||
class GuideRate;
|
||||
class GuideRateConfig;
|
||||
struct PerforationData;
|
||||
struct PhaseUsage;
|
||||
class SingleWellState;
|
||||
class WellState;
|
||||
template<class Scalar> class SingleWellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
/// Class for restarting the blackoil well model.
|
||||
class BlackoilWellModelRestart
|
||||
@ -68,21 +68,21 @@ public:
|
||||
void loadRestartData(const data::Wells& rst_wells,
|
||||
const data::GroupAndNetworkValues& grpNwrkValues,
|
||||
const bool handle_ms_well,
|
||||
WellState& well_state,
|
||||
GroupState& grpState) const;
|
||||
WellState<double>& well_state,
|
||||
GroupState<double>& grpState) const;
|
||||
|
||||
private:
|
||||
//! \brief Loads per-connection data from restart structures.
|
||||
void loadRestartConnectionData(const std::vector<data::Rates::opt>& phs,
|
||||
const data::Well& rst_well,
|
||||
const std::vector<PerforationData>& old_perf_data,
|
||||
SingleWellState& ws) const;
|
||||
SingleWellState<double>& ws) const;
|
||||
|
||||
//! \brief Loads per-segment data from restart structures.
|
||||
void loadRestartSegmentData(const std::string& well_name,
|
||||
const std::vector<data::Rates::opt>& phs,
|
||||
const data::Well& rst_well,
|
||||
SingleWellState& ws) const;
|
||||
SingleWellState<double>& ws) const;
|
||||
|
||||
//! \brief Loads per-well data from restart structures.
|
||||
void loadRestartWellData(const std::string& well_name,
|
||||
@ -90,12 +90,12 @@ private:
|
||||
const std::vector<data::Rates::opt>& phs,
|
||||
const data::Well& rst_well,
|
||||
const std::vector<PerforationData>& old_perf_data,
|
||||
SingleWellState& ws) const;
|
||||
SingleWellState<double>& ws) const;
|
||||
|
||||
//! \brief Loads per-group data from restart structures.
|
||||
void loadRestartGroupData(const std::string& group,
|
||||
const data::GroupData& value,
|
||||
GroupState& grpState) const;
|
||||
GroupState<double>& grpState) const;
|
||||
|
||||
const BlackoilWellModelGeneric& wellModel_; //!< Reference to well model
|
||||
};
|
||||
|
@ -2206,7 +2206,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::computePotentials(const std::size_t widx,
|
||||
const WellState& well_state_copy,
|
||||
const WellState<Scalar>& well_state_copy,
|
||||
std::string& exc_msg,
|
||||
ExceptionType::ExcEnum& exc_type,
|
||||
DeferredLogger& deferred_logger)
|
||||
@ -2311,14 +2311,14 @@ namespace Opm {
|
||||
|
||||
for (const auto& well : well_container_) {
|
||||
auto& events = this->wellState().well(well->indexOfWell()).events;
|
||||
if (events.hasEvent(WellState::event_mask)) {
|
||||
if (events.hasEvent(WellState<Scalar>::event_mask)) {
|
||||
well->updateWellStateWithTarget(simulator_, this->groupState(), this->wellState(), deferred_logger);
|
||||
const auto& summary_state = simulator_.vanguard().summaryState();
|
||||
well->updatePrimaryVariables(summary_state, this->wellState(), deferred_logger);
|
||||
well->initPrimaryVariablesEvaluation();
|
||||
// There is no new well control change input within a report step,
|
||||
// so next time step, the well does not consider to have effective events anymore.
|
||||
events.clearEvent(WellState::event_mask);
|
||||
events.clearEvent(WellState<Scalar>::event_mask);
|
||||
}
|
||||
// these events only work for the first time step within the report step
|
||||
if (events.hasEvent(ScheduleEvents::REQUEST_OPEN_WELL)) {
|
||||
|
@ -26,40 +26,48 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void ConnFiltrateData::resize(std::size_t num_perf) {
|
||||
this->rates.resize(num_perf);
|
||||
this->total.resize(num_perf);
|
||||
this->skin_factor.resize(num_perf);
|
||||
this->thickness.resize(num_perf);
|
||||
this->perm.resize(num_perf);
|
||||
this->poro.resize(num_perf);
|
||||
this->radius.resize(num_perf);
|
||||
this->area_of_flow.resize(num_perf);
|
||||
}
|
||||
template<class Scalar>
|
||||
void ConnFiltrateData<Scalar>::resize(std::size_t num_perf)
|
||||
{
|
||||
this->rates.resize(num_perf);
|
||||
this->total.resize(num_perf);
|
||||
this->skin_factor.resize(num_perf);
|
||||
this->thickness.resize(num_perf);
|
||||
this->perm.resize(num_perf);
|
||||
this->poro.resize(num_perf);
|
||||
this->radius.resize(num_perf);
|
||||
this->area_of_flow.resize(num_perf);
|
||||
}
|
||||
|
||||
ConnFiltrateData ConnFiltrateData::serializationTestObject()
|
||||
{
|
||||
ConnFiltrateData result;
|
||||
result.rates = {8.};
|
||||
result.total = {100.};
|
||||
result.skin_factor = {0.5};
|
||||
result.thickness = {0.05};
|
||||
result.perm = {0.00001};
|
||||
result.poro = {0.3};
|
||||
result.radius = {0.05};
|
||||
result.area_of_flow = {0.7};
|
||||
return result;
|
||||
}
|
||||
template<class Scalar>
|
||||
ConnFiltrateData<Scalar>
|
||||
ConnFiltrateData<Scalar>::serializationTestObject()
|
||||
{
|
||||
ConnFiltrateData result;
|
||||
result.rates = {8.};
|
||||
result.total = {100.};
|
||||
result.skin_factor = {0.5};
|
||||
result.thickness = {0.05};
|
||||
result.perm = {0.00001};
|
||||
result.poro = {0.3};
|
||||
result.radius = {0.05};
|
||||
result.area_of_flow = {0.7};
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ConnFiltrateData::operator==(const ConnFiltrateData& rhs) const
|
||||
{
|
||||
return this->rates == rhs.rates &&
|
||||
this->total == rhs.total &&
|
||||
this->skin_factor == rhs.skin_factor &&
|
||||
this->thickness == rhs.thickness &&
|
||||
this->perm == rhs.perm &&
|
||||
this->poro == rhs.poro &&
|
||||
this->radius == rhs.radius &&
|
||||
this->area_of_flow == rhs.area_of_flow;
|
||||
}
|
||||
}
|
||||
template<class Scalar>
|
||||
bool ConnFiltrateData<Scalar>::operator==(const ConnFiltrateData& rhs) const
|
||||
{
|
||||
return this->rates == rhs.rates &&
|
||||
this->total == rhs.total &&
|
||||
this->skin_factor == rhs.skin_factor &&
|
||||
this->thickness == rhs.thickness &&
|
||||
this->perm == rhs.perm &&
|
||||
this->poro == rhs.poro &&
|
||||
this->radius == rhs.radius &&
|
||||
this->area_of_flow == rhs.area_of_flow;
|
||||
}
|
||||
|
||||
template struct ConnFiltrateData<double>;
|
||||
|
||||
}
|
||||
|
@ -24,37 +24,38 @@
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
struct ConnFiltrateData {
|
||||
|
||||
ConnFiltrateData() = default;
|
||||
template<class Scalar>
|
||||
struct ConnFiltrateData {
|
||||
|
||||
void resize(std::size_t num_perf);
|
||||
void resize(std::size_t num_perf);
|
||||
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer) {
|
||||
serializer(rates);
|
||||
serializer(total);
|
||||
serializer(skin_factor);
|
||||
serializer(thickness);
|
||||
serializer(perm);
|
||||
serializer(poro);
|
||||
serializer(radius);
|
||||
serializer(area_of_flow);
|
||||
}
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer) {
|
||||
serializer(rates);
|
||||
serializer(total);
|
||||
serializer(skin_factor);
|
||||
serializer(thickness);
|
||||
serializer(perm);
|
||||
serializer(poro);
|
||||
serializer(radius);
|
||||
serializer(area_of_flow);
|
||||
}
|
||||
|
||||
static ConnFiltrateData serializationTestObject();
|
||||
static ConnFiltrateData serializationTestObject();
|
||||
|
||||
bool operator==(const ConnFiltrateData& rhs) const;
|
||||
bool operator==(const ConnFiltrateData& rhs) const;
|
||||
|
||||
std::vector<Scalar> rates;
|
||||
std::vector<Scalar> total;
|
||||
std::vector<Scalar> skin_factor;
|
||||
std::vector<Scalar> thickness;
|
||||
std::vector<Scalar> perm;
|
||||
std::vector<Scalar> poro;
|
||||
std::vector<Scalar> radius;
|
||||
std::vector<Scalar> area_of_flow;
|
||||
};
|
||||
|
||||
std::vector<double> rates;
|
||||
std::vector<double> total;
|
||||
std::vector<double> skin_factor;
|
||||
std::vector<double> thickness;
|
||||
std::vector<double> perm;
|
||||
std::vector<double> poro;
|
||||
std::vector<double> radius;
|
||||
std::vector<double> area_of_flow;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPM_CONNFILTRATEDATA_HPP
|
||||
#endif // OPM_CONNFILTRATEDATA_HPP
|
||||
|
@ -33,8 +33,8 @@
|
||||
namespace Opm::WellGroupHelpers {
|
||||
|
||||
FractionCalculator::FractionCalculator(const Schedule& schedule,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const int report_step,
|
||||
const GuideRate* guide_rate,
|
||||
const GuideRateModel::Target target,
|
||||
|
@ -26,10 +26,10 @@
|
||||
#include <string>
|
||||
|
||||
namespace Opm {
|
||||
class GroupState;
|
||||
template<class Scalar> class GroupState;
|
||||
struct PhaseUsage;
|
||||
class Schedule;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
}
|
||||
|
||||
namespace Opm::WellGroupHelpers {
|
||||
@ -38,8 +38,8 @@ class FractionCalculator
|
||||
{
|
||||
public:
|
||||
FractionCalculator(const Schedule& schedule,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const int report_step,
|
||||
const GuideRate* guide_rate,
|
||||
const GuideRateModel::Target target,
|
||||
@ -62,8 +62,8 @@ private:
|
||||
const std::string& always_included_child);
|
||||
GuideRate::RateVector getGroupRateVector(const std::string& group_name);
|
||||
const Schedule& schedule_;
|
||||
const WellState& well_state_;
|
||||
const GroupState& group_state_;
|
||||
const WellState<double>& well_state_;
|
||||
const GroupState<double>& group_state_;
|
||||
int report_step_;
|
||||
const GuideRate* guide_rate_;
|
||||
GuideRateModel::Target target_;
|
||||
|
@ -30,8 +30,8 @@ namespace Opm {
|
||||
|
||||
GasLiftCommon::
|
||||
GasLiftCommon(
|
||||
WellState &well_state,
|
||||
const GroupState &group_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
DeferredLogger &deferred_logger,
|
||||
const Parallel::Communication& comm,
|
||||
bool glift_debug
|
||||
|
@ -28,8 +28,8 @@ namespace Opm
|
||||
{
|
||||
|
||||
class DeferredLogger;
|
||||
class GroupState;
|
||||
class WellState;
|
||||
template<class Scalar> class GroupState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
class GasLiftCommon
|
||||
{
|
||||
@ -38,8 +38,8 @@ public:
|
||||
|
||||
protected:
|
||||
GasLiftCommon(
|
||||
WellState &well_state,
|
||||
const GroupState &group_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
DeferredLogger &deferred_logger,
|
||||
const Parallel::Communication& comm,
|
||||
bool debug
|
||||
@ -54,8 +54,8 @@ protected:
|
||||
const std::string& msg,
|
||||
MessageType msg_type = MessageType::INFO) const;
|
||||
|
||||
WellState &well_state_;
|
||||
const GroupState& group_state_;
|
||||
WellState<double>& well_state_;
|
||||
const GroupState<double>& group_state_;
|
||||
DeferredLogger &deferred_logger_;
|
||||
const Parallel::Communication& comm_;
|
||||
bool debug;
|
||||
|
@ -41,8 +41,8 @@ GasLiftGroupInfo(
|
||||
const int iteration_idx,
|
||||
const PhaseUsage &phase_usage,
|
||||
DeferredLogger &deferred_logger,
|
||||
WellState &well_state,
|
||||
const GroupState &group_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Communication &comm,
|
||||
bool glift_debug
|
||||
) :
|
||||
|
@ -35,11 +35,11 @@ namespace Opm
|
||||
class DeferredLogger;
|
||||
class GasLiftOpt;
|
||||
class Group;
|
||||
class GroupState;
|
||||
template<class Scalar> class GroupState;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
class Well;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
class GasLiftGroupInfo : public GasLiftCommon
|
||||
{
|
||||
@ -74,8 +74,8 @@ public:
|
||||
const int iteration_idx,
|
||||
const PhaseUsage& phase_usage,
|
||||
DeferredLogger& deferred_logger,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Parallel::Communication& comm,
|
||||
bool glift_debug
|
||||
);
|
||||
|
@ -36,6 +36,7 @@ namespace Opm
|
||||
template<class TypeTag>
|
||||
class GasLiftSingleWell : public GasLiftSingleWellGeneric
|
||||
{
|
||||
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
|
||||
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
||||
using GLiftSyncGroups = typename GasLiftSingleWellGeneric::GLiftSyncGroups;
|
||||
|
||||
@ -45,8 +46,8 @@ namespace Opm
|
||||
const Simulator& simulator,
|
||||
const SummaryState &summary_state,
|
||||
DeferredLogger &deferred_logger,
|
||||
WellState &well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
GasLiftGroupInfo &group_info,
|
||||
GLiftSyncGroups &sync_groups,
|
||||
const Parallel::Communication& comm,
|
||||
|
@ -38,8 +38,8 @@ namespace Opm
|
||||
{
|
||||
|
||||
GasLiftSingleWellGeneric::GasLiftSingleWellGeneric(DeferredLogger& deferred_logger,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Well& ecl_well,
|
||||
const SummaryState& summary_state,
|
||||
GasLiftGroupInfo& group_info,
|
||||
|
@ -42,8 +42,8 @@ class GasLiftWellState;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
class GroupState;
|
||||
template<class Scalar> class WellState;
|
||||
template<class Scalar> class GroupState;
|
||||
|
||||
class GasLiftSingleWellGeneric : public GasLiftCommon
|
||||
{
|
||||
@ -104,8 +104,8 @@ public:
|
||||
protected:
|
||||
GasLiftSingleWellGeneric(
|
||||
DeferredLogger& deferred_logger,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Well& ecl_well,
|
||||
const SummaryState& summary_state,
|
||||
GasLiftGroupInfo& group_info,
|
||||
|
@ -28,8 +28,8 @@ GasLiftSingleWell(const WellInterface<TypeTag> &well,
|
||||
const Simulator& simulator,
|
||||
const SummaryState &summary_state,
|
||||
DeferredLogger &deferred_logger,
|
||||
WellState &well_state,
|
||||
const GroupState &group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
GasLiftGroupInfo &group_info,
|
||||
GLiftSyncGroups &sync_groups,
|
||||
const Parallel::Communication& comm,
|
||||
|
@ -45,8 +45,8 @@ GasLiftStage2::GasLiftStage2(
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger &deferred_logger,
|
||||
WellState &well_state,
|
||||
const GroupState &group_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
GLiftProdWells &prod_wells,
|
||||
GLiftOptWells &glift_wells,
|
||||
GasLiftGroupInfo& group_info,
|
||||
|
@ -37,10 +37,10 @@ class DeferredLogger;
|
||||
class GasLiftOpt;
|
||||
class GasLiftWellState;
|
||||
class Group;
|
||||
class GroupState;
|
||||
template<class Scalar> class GroupState;
|
||||
class Schedule;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
class GasLiftStage2 : public GasLiftCommon {
|
||||
using GasLiftSingleWell = GasLiftSingleWellGeneric;
|
||||
@ -62,8 +62,8 @@ public:
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
GLiftProdWells& prod_wells,
|
||||
GLiftOptWells& glift_wells,
|
||||
GasLiftGroupInfo& group_info,
|
||||
|
@ -40,7 +40,8 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
std::string simTimeToString(const std::time_t start_time, const double sim_time) {
|
||||
std::string simTimeToString(const std::time_t start_time, const double sim_time)
|
||||
{
|
||||
const auto start_timep = std::chrono::system_clock::from_time_t(start_time);
|
||||
const auto sim_duration = std::chrono::duration_cast<std::chrono::system_clock::duration>(
|
||||
std::chrono::duration<double>(sim_time)
|
||||
@ -51,33 +52,32 @@ std::string simTimeToString(const std::time_t start_time, const double sim_time)
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
GroupEconomicLimitsChecker::
|
||||
GroupEconomicLimitsChecker(
|
||||
const BlackoilWellModelGeneric &well_model,
|
||||
WellTestState &well_test_state,
|
||||
const Group &group,
|
||||
const double simulation_time,
|
||||
const int report_step_idx,
|
||||
DeferredLogger &deferred_logger
|
||||
) :
|
||||
well_model_{well_model}
|
||||
, group_{group}
|
||||
, simulation_time_{simulation_time}
|
||||
, report_step_idx_{report_step_idx}
|
||||
, deferred_logger_{deferred_logger}
|
||||
, date_string_{simTimeToString(well_model.schedule().getStartTime(),simulation_time)}
|
||||
, unit_system_{well_model.eclipseState().getUnits()}
|
||||
, well_state_{well_model.wellState()}
|
||||
, well_test_state_{well_test_state}
|
||||
, schedule_{well_model.schedule()}
|
||||
, gecon_props_{schedule_[report_step_idx_].gecon().get_group_prop(
|
||||
schedule_, well_model_.summaryState(), group_.name())}
|
||||
template<class Scalar>
|
||||
GroupEconomicLimitsChecker<Scalar>::
|
||||
GroupEconomicLimitsChecker(const BlackoilWellModelGeneric& well_model,
|
||||
WellTestState& well_test_state,
|
||||
const Group& group,
|
||||
const double simulation_time,
|
||||
const int report_step_idx,
|
||||
DeferredLogger& deferred_logger)
|
||||
: well_model_{well_model}
|
||||
, group_{group}
|
||||
, simulation_time_{simulation_time}
|
||||
, report_step_idx_{report_step_idx}
|
||||
, deferred_logger_{deferred_logger}
|
||||
, date_string_{simTimeToString(well_model.schedule().getStartTime(),simulation_time)}
|
||||
, unit_system_{well_model.eclipseState().getUnits()}
|
||||
, well_state_{well_model.wellState()}
|
||||
, well_test_state_{well_test_state}
|
||||
, schedule_{well_model.schedule()}
|
||||
, gecon_props_{schedule_[report_step_idx_].gecon().get_group_prop(
|
||||
schedule_, well_model_.summaryState(), group_.name())}
|
||||
{
|
||||
for (std::size_t i = 0; i < this->phase_idx_map_.size(); i++) {
|
||||
auto phase_idx = this->phase_idx_map_[i];
|
||||
this->phase_idx_reverse_map_[phase_idx] = static_cast<int>(i);
|
||||
auto phase_pos = this->well_model_.phaseUsage().phase_pos[phase_idx];
|
||||
double production_rate = WellGroupHelpers::sumWellSurfaceRates(
|
||||
Scalar production_rate = WellGroupHelpers::sumWellSurfaceRates(
|
||||
this->group_, this->schedule_, this->well_state_,
|
||||
this->report_step_idx_, phase_pos, /*isInjector*/false);
|
||||
this->production_rates_[i] = this->well_model_.comm().sum(production_rate);
|
||||
@ -88,22 +88,22 @@ GroupEconomicLimitsChecker(
|
||||
* Public methods in alphabetical order
|
||||
****************************************/
|
||||
|
||||
void
|
||||
GroupEconomicLimitsChecker::
|
||||
template<class Scalar>
|
||||
void GroupEconomicLimitsChecker<Scalar>::
|
||||
activateEndRun()
|
||||
{
|
||||
displayDebugMessage("activate end run");
|
||||
}
|
||||
|
||||
void
|
||||
GroupEconomicLimitsChecker::
|
||||
template<class Scalar>
|
||||
void GroupEconomicLimitsChecker<Scalar>::
|
||||
closeWells()
|
||||
{
|
||||
closeWellsRecursive(this->group_);
|
||||
}
|
||||
|
||||
void
|
||||
GroupEconomicLimitsChecker::
|
||||
template<class Scalar>
|
||||
void GroupEconomicLimitsChecker<Scalar>::
|
||||
doWorkOver()
|
||||
{
|
||||
if (this->gecon_props_.workover() != GroupEconProductionLimits::EconWorkover::NONE) {
|
||||
@ -111,8 +111,8 @@ doWorkOver()
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
GroupEconomicLimitsChecker::
|
||||
template<class Scalar>
|
||||
bool GroupEconomicLimitsChecker<Scalar>::
|
||||
endRun()
|
||||
{
|
||||
if (this->gecon_props_.endRun()) {
|
||||
@ -121,15 +121,15 @@ endRun()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
GroupEconomicLimitsChecker::
|
||||
template<class Scalar>
|
||||
bool GroupEconomicLimitsChecker<Scalar>::
|
||||
GOR()
|
||||
{
|
||||
auto oil_phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Liquid];
|
||||
auto gas_phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Vapour];
|
||||
auto oil_rate = this->production_rates_[oil_phase_idx];
|
||||
auto gas_rate = this->production_rates_[gas_phase_idx];
|
||||
double gor;
|
||||
Scalar gor;
|
||||
if (gas_rate <= 0.0) {
|
||||
gor = 0.0;
|
||||
}
|
||||
@ -155,8 +155,8 @@ GOR()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
GroupEconomicLimitsChecker::
|
||||
template<class Scalar>
|
||||
bool GroupEconomicLimitsChecker<Scalar>::
|
||||
minGasRate()
|
||||
{
|
||||
auto phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Vapour];
|
||||
@ -182,8 +182,8 @@ minGasRate()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
GroupEconomicLimitsChecker::
|
||||
template<class Scalar>
|
||||
bool GroupEconomicLimitsChecker<Scalar>::
|
||||
minOilRate()
|
||||
{
|
||||
auto phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Liquid];
|
||||
@ -209,22 +209,22 @@ minOilRate()
|
||||
return false;
|
||||
}
|
||||
|
||||
int
|
||||
GroupEconomicLimitsChecker::
|
||||
template<class Scalar>
|
||||
int GroupEconomicLimitsChecker<Scalar>::
|
||||
numProducersOpen()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
GroupEconomicLimitsChecker::
|
||||
template<class Scalar>
|
||||
int GroupEconomicLimitsChecker<Scalar>::
|
||||
numProducersOpenInitially()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool
|
||||
GroupEconomicLimitsChecker::
|
||||
template<class Scalar>
|
||||
bool GroupEconomicLimitsChecker<Scalar>::
|
||||
waterCut()
|
||||
{
|
||||
auto oil_phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Liquid];
|
||||
@ -232,7 +232,7 @@ waterCut()
|
||||
auto oil_rate = this->production_rates_[oil_phase_idx];
|
||||
auto water_rate = this->production_rates_[water_phase_idx];
|
||||
auto liquid_rate = oil_rate + water_rate;
|
||||
double water_cut;
|
||||
Scalar water_cut;
|
||||
if (liquid_rate == 0.0) {
|
||||
water_cut = 0.0;
|
||||
}
|
||||
@ -263,15 +263,15 @@ waterCut()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
GroupEconomicLimitsChecker::
|
||||
template<class Scalar>
|
||||
bool GroupEconomicLimitsChecker<Scalar>::
|
||||
WGR()
|
||||
{
|
||||
auto water_phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Aqua];
|
||||
auto gas_phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Vapour];
|
||||
auto water_rate = this->production_rates_[water_phase_idx];
|
||||
auto gas_rate = this->production_rates_[gas_phase_idx];
|
||||
double wgr;
|
||||
Scalar wgr;
|
||||
if (water_rate <= 0.0) {
|
||||
wgr = 0.0;
|
||||
}
|
||||
@ -301,9 +301,9 @@ WGR()
|
||||
* Private methods in alphabetical order
|
||||
****************************************/
|
||||
|
||||
void
|
||||
GroupEconomicLimitsChecker::
|
||||
displayDebugMessage(const std::string &msg) const
|
||||
template<class Scalar>
|
||||
void GroupEconomicLimitsChecker<Scalar>::
|
||||
displayDebugMessage(const std::string& msg) const
|
||||
{
|
||||
if (this->debug_) {
|
||||
const std::string msg2 = fmt::format(
|
||||
@ -312,9 +312,12 @@ displayDebugMessage(const std::string &msg) const
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GroupEconomicLimitsChecker::
|
||||
addPrintMessage(const std::string &msg, const double value, const double limit, const UnitSystem::measure measure)
|
||||
template<class Scalar>
|
||||
void GroupEconomicLimitsChecker<Scalar>::
|
||||
addPrintMessage(const std::string& msg,
|
||||
const Scalar value,
|
||||
const Scalar limit,
|
||||
const UnitSystem::measure measure)
|
||||
{
|
||||
const std::string header = fmt::format(
|
||||
"{}\nAt time = {:.2f} {} (date = {}): Group {} will close because: \n", this->message_separator(),
|
||||
@ -332,8 +335,8 @@ addPrintMessage(const std::string &msg, const double value, const double limit,
|
||||
this->message_ += message;
|
||||
}
|
||||
|
||||
bool
|
||||
GroupEconomicLimitsChecker::
|
||||
template<class Scalar>
|
||||
bool GroupEconomicLimitsChecker<Scalar>::
|
||||
closeWellsRecursive(const Group& group, int level)
|
||||
{
|
||||
bool wells_closed = false;
|
||||
@ -390,11 +393,14 @@ closeWellsRecursive(const Group& group, int level)
|
||||
return wells_closed;
|
||||
}
|
||||
|
||||
void
|
||||
GroupEconomicLimitsChecker::
|
||||
throwNotImplementedError(const std::string &error) const
|
||||
template<class Scalar>
|
||||
void GroupEconomicLimitsChecker<Scalar>::
|
||||
throwNotImplementedError(const std::string& error) const
|
||||
{
|
||||
const std::string msg = fmt::format("Group: {} : GECON : {} not implemented", this->group_.name(), error);
|
||||
OPM_DEFLOG_THROW(std::runtime_error, msg, this->deferred_logger_);
|
||||
}
|
||||
|
||||
template class GroupEconomicLimitsChecker<double>;
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -34,59 +34,66 @@ namespace Opm
|
||||
class BlackoilWellModelGeneric;
|
||||
class DeferredLogger;
|
||||
class Group;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
class WellTestState;
|
||||
|
||||
class GroupEconomicLimitsChecker
|
||||
{
|
||||
public:
|
||||
GroupEconomicLimitsChecker(
|
||||
const BlackoilWellModelGeneric &well_model,
|
||||
WellTestState &well_test_state,
|
||||
const Group &group,
|
||||
const double simulation_time,
|
||||
const int report_step_idx,
|
||||
DeferredLogger &deferred_logger
|
||||
);
|
||||
void closeWells();
|
||||
bool minGasRate();
|
||||
bool minOilRate();
|
||||
bool waterCut();
|
||||
bool GOR();
|
||||
bool WGR();
|
||||
void doWorkOver();
|
||||
bool endRun();
|
||||
int numProducersOpenInitially();
|
||||
int numProducersOpen();
|
||||
void activateEndRun();
|
||||
std::string message_separator(const char sep_char='*', const size_t sep_length=110) const { return std::string(sep_length, sep_char); }
|
||||
template<class Scalar>
|
||||
class GroupEconomicLimitsChecker
|
||||
{
|
||||
public:
|
||||
GroupEconomicLimitsChecker(const BlackoilWellModelGeneric& well_model,
|
||||
WellTestState& well_test_state,
|
||||
const Group& group,
|
||||
const double simulation_time,
|
||||
const int report_step_idx,
|
||||
DeferredLogger& deferred_logger);
|
||||
void closeWells();
|
||||
bool minGasRate();
|
||||
bool minOilRate();
|
||||
bool waterCut();
|
||||
bool GOR();
|
||||
bool WGR();
|
||||
void doWorkOver();
|
||||
bool endRun();
|
||||
int numProducersOpenInitially();
|
||||
int numProducersOpen();
|
||||
void activateEndRun();
|
||||
std::string message_separator(const char sep_char = '*',
|
||||
const size_t sep_length = 110) const
|
||||
{ return std::string(sep_length, sep_char); }
|
||||
|
||||
static constexpr int NUM_PHASES = 3;
|
||||
private:
|
||||
void displayDebugMessage(const std::string &msg) const;
|
||||
void addPrintMessage(const std::string &msg, const double value, const double limit, const UnitSystem::measure measure);
|
||||
bool closeWellsRecursive(const Group& group, int level = 0);
|
||||
void throwNotImplementedError(const std::string &error) const;
|
||||
const BlackoilWellModelGeneric &well_model_;
|
||||
const Group &group_;
|
||||
const double simulation_time_;
|
||||
const int report_step_idx_;
|
||||
DeferredLogger &deferred_logger_;
|
||||
const std::string date_string_;
|
||||
const UnitSystem& unit_system_;
|
||||
const WellState &well_state_;
|
||||
WellTestState &well_test_state_;
|
||||
const Schedule &schedule_;
|
||||
GroupEconProductionLimits::GEconGroupProp gecon_props_;
|
||||
bool debug_ = true;
|
||||
std::array<double,NUM_PHASES> production_rates_;
|
||||
std::map<int, BlackoilPhases::PhaseIndex> phase_idx_map_ = {
|
||||
{0, BlackoilPhases::Liquid},
|
||||
{1, BlackoilPhases::Vapour},
|
||||
{2, BlackoilPhases::Aqua}};
|
||||
std::map<BlackoilPhases::PhaseIndex, int> phase_idx_reverse_map_;
|
||||
std::string message_;
|
||||
static constexpr int NUM_PHASES = 3;
|
||||
|
||||
private:
|
||||
void displayDebugMessage(const std::string& msg) const;
|
||||
void addPrintMessage(const std::string& msg,
|
||||
const Scalar value,
|
||||
const Scalar limit,
|
||||
const UnitSystem::measure measure);
|
||||
bool closeWellsRecursive(const Group& group, int level = 0);
|
||||
void throwNotImplementedError(const std::string& error) const;
|
||||
|
||||
const BlackoilWellModelGeneric& well_model_;
|
||||
const Group& group_;
|
||||
const double simulation_time_;
|
||||
const int report_step_idx_;
|
||||
DeferredLogger& deferred_logger_;
|
||||
const std::string date_string_;
|
||||
const UnitSystem& unit_system_;
|
||||
const WellState<Scalar>& well_state_;
|
||||
WellTestState& well_test_state_;
|
||||
const Schedule& schedule_;
|
||||
GroupEconProductionLimits::GEconGroupProp gecon_props_;
|
||||
bool debug_ = true;
|
||||
std::array<Scalar,NUM_PHASES> production_rates_;
|
||||
std::map<int, BlackoilPhases::PhaseIndex> phase_idx_map_ = {
|
||||
{0, BlackoilPhases::Liquid},
|
||||
{1, BlackoilPhases::Vapour},
|
||||
{2, BlackoilPhases::Aqua}
|
||||
};
|
||||
std::map<BlackoilPhases::PhaseIndex, int> phase_idx_reverse_map_;
|
||||
std::string message_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
|
@ -29,11 +29,13 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
GroupState::GroupState(std::size_t np) :
|
||||
template<class Scalar>
|
||||
GroupState<Scalar>::GroupState(std::size_t np) :
|
||||
num_phases(np)
|
||||
{}
|
||||
|
||||
GroupState GroupState::serializationTestObject()
|
||||
template<class Scalar>
|
||||
GroupState<Scalar> GroupState<Scalar>::serializationTestObject()
|
||||
{
|
||||
GroupState result(3);
|
||||
result.m_production_rates = {{"test1", {1.0, 2.0}}};
|
||||
@ -52,7 +54,9 @@ GroupState GroupState::serializationTestObject()
|
||||
return result;
|
||||
}
|
||||
|
||||
bool GroupState::operator==(const GroupState& other) const {
|
||||
template<class Scalar>
|
||||
bool GroupState<Scalar>::operator==(const GroupState& other) const
|
||||
{
|
||||
return this->m_production_rates == other.m_production_rates &&
|
||||
this->production_controls == other.production_controls &&
|
||||
this->prod_red_rates == other.prod_red_rates &&
|
||||
@ -68,19 +72,27 @@ bool GroupState::operator==(const GroupState& other) const {
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
bool GroupState::has_production_rates(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
bool GroupState<Scalar>::has_production_rates(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->m_production_rates.find(gname);
|
||||
return (group_iter != this->m_production_rates.end());
|
||||
}
|
||||
|
||||
void GroupState::update_production_rates(const std::string& gname, const std::vector<double>& rates) {
|
||||
template<class Scalar>
|
||||
void GroupState<Scalar>::update_production_rates(const std::string& gname,
|
||||
const std::vector<Scalar>& rates)
|
||||
{
|
||||
if (rates.size() != this->num_phases)
|
||||
throw std::logic_error("Wrong number of phases");
|
||||
|
||||
this->m_production_rates[gname] = rates;
|
||||
}
|
||||
|
||||
const std::vector<double>& GroupState::production_rates(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
const std::vector<Scalar>&
|
||||
GroupState<Scalar>::production_rates(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->m_production_rates.find(gname);
|
||||
if (group_iter == this->m_production_rates.end())
|
||||
throw std::logic_error("No such group");
|
||||
@ -90,19 +102,29 @@ const std::vector<double>& GroupState::production_rates(const std::string& gname
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
bool GroupState::has_production_reduction_rates(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
bool GroupState<Scalar>::
|
||||
has_production_reduction_rates(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->prod_red_rates.find(gname);
|
||||
return (group_iter != this->prod_red_rates.end());
|
||||
}
|
||||
|
||||
void GroupState::update_production_reduction_rates(const std::string& gname, const std::vector<double>& rates) {
|
||||
template<class Scalar>
|
||||
void GroupState<Scalar>::
|
||||
update_production_reduction_rates(const std::string& gname,
|
||||
const std::vector<Scalar>& rates)
|
||||
{
|
||||
if (rates.size() != this->num_phases)
|
||||
throw std::logic_error("Wrong number of phases");
|
||||
|
||||
this->prod_red_rates[gname] = rates;
|
||||
}
|
||||
|
||||
const std::vector<double>& GroupState::production_reduction_rates(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
const std::vector<Scalar>&
|
||||
GroupState<Scalar>::production_reduction_rates(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->prod_red_rates.find(gname);
|
||||
if (group_iter == this->prod_red_rates.end())
|
||||
throw std::logic_error("No such group");
|
||||
@ -112,19 +134,29 @@ const std::vector<double>& GroupState::production_reduction_rates(const std::str
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
bool GroupState::has_injection_reduction_rates(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
bool GroupState<Scalar>::
|
||||
has_injection_reduction_rates(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->inj_red_rates.find(gname);
|
||||
return (group_iter != this->inj_red_rates.end());
|
||||
}
|
||||
|
||||
void GroupState::update_injection_reduction_rates(const std::string& gname, const std::vector<double>& rates) {
|
||||
template<class Scalar>
|
||||
void GroupState<Scalar>::
|
||||
update_injection_reduction_rates(const std::string& gname,
|
||||
const std::vector<Scalar>& rates)
|
||||
{
|
||||
if (rates.size() != this->num_phases)
|
||||
throw std::logic_error("Wrong number of phases");
|
||||
|
||||
this->inj_red_rates[gname] = rates;
|
||||
}
|
||||
|
||||
const std::vector<double>& GroupState::injection_reduction_rates(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
const std::vector<Scalar>&
|
||||
GroupState<Scalar>::injection_reduction_rates(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->inj_red_rates.find(gname);
|
||||
if (group_iter == this->inj_red_rates.end())
|
||||
throw std::logic_error("No such group");
|
||||
@ -133,19 +165,30 @@ const std::vector<double>& GroupState::injection_reduction_rates(const std::stri
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
bool GroupState::has_injection_surface_rates(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
bool GroupState<Scalar>::
|
||||
has_injection_surface_rates(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->inj_surface_rates.find(gname);
|
||||
return (group_iter != this->inj_surface_rates.end());
|
||||
}
|
||||
|
||||
void GroupState::update_injection_surface_rates(const std::string& gname, const std::vector<double>& rates) {
|
||||
template<class Scalar>
|
||||
void GroupState<Scalar>::
|
||||
update_injection_surface_rates(const std::string& gname,
|
||||
const std::vector<Scalar>& rates)
|
||||
{
|
||||
if (rates.size() != this->num_phases)
|
||||
throw std::logic_error("Wrong number of phases");
|
||||
|
||||
this->inj_surface_rates[gname] = rates;
|
||||
}
|
||||
|
||||
const std::vector<double>& GroupState::injection_surface_rates(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
const std::vector<Scalar>&
|
||||
GroupState<Scalar>::
|
||||
injection_surface_rates(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->inj_surface_rates.find(gname);
|
||||
if (group_iter == this->inj_surface_rates.end())
|
||||
throw std::logic_error("No such group");
|
||||
@ -155,19 +198,29 @@ const std::vector<double>& GroupState::injection_surface_rates(const std::string
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
bool GroupState::has_injection_reservoir_rates(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
bool GroupState<Scalar>::
|
||||
has_injection_reservoir_rates(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->inj_resv_rates.find(gname);
|
||||
return (group_iter != this->inj_resv_rates.end());
|
||||
}
|
||||
|
||||
void GroupState::update_injection_reservoir_rates(const std::string& gname, const std::vector<double>& rates) {
|
||||
template<class Scalar>
|
||||
void GroupState<Scalar>::
|
||||
update_injection_reservoir_rates(const std::string& gname,
|
||||
const std::vector<Scalar>& rates)
|
||||
{
|
||||
if (rates.size() != this->num_phases)
|
||||
throw std::logic_error("Wrong number of phases");
|
||||
|
||||
this->inj_resv_rates[gname] = rates;
|
||||
}
|
||||
|
||||
const std::vector<double>& GroupState::injection_reservoir_rates(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
const std::vector<Scalar>&
|
||||
GroupState<Scalar>::injection_reservoir_rates(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->inj_resv_rates.find(gname);
|
||||
if (group_iter == this->inj_resv_rates.end())
|
||||
throw std::logic_error("No such group");
|
||||
@ -177,14 +230,22 @@ const std::vector<double>& GroupState::injection_reservoir_rates(const std::stri
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void GroupState::update_injection_rein_rates(const std::string& gname, const std::vector<double>& rates) {
|
||||
template<class Scalar>
|
||||
void GroupState<Scalar>::
|
||||
update_injection_rein_rates(const std::string& gname,
|
||||
const std::vector<Scalar>& rates)
|
||||
{
|
||||
if (rates.size() != this->num_phases)
|
||||
throw std::logic_error("Wrong number of phases");
|
||||
|
||||
this->inj_rein_rates[gname] = rates;
|
||||
}
|
||||
|
||||
const std::vector<double>& GroupState::injection_rein_rates(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
const std::vector<Scalar>&
|
||||
GroupState<Scalar>::
|
||||
injection_rein_rates(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->inj_rein_rates.find(gname);
|
||||
if (group_iter == this->inj_rein_rates.end())
|
||||
throw std::logic_error("No such group");
|
||||
@ -194,11 +255,17 @@ const std::vector<double>& GroupState::injection_rein_rates(const std::string& g
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void GroupState::update_injection_vrep_rate(const std::string& gname, double rate) {
|
||||
template<class Scalar>
|
||||
void GroupState<Scalar>::
|
||||
update_injection_vrep_rate(const std::string& gname, Scalar rate)
|
||||
{
|
||||
this->inj_vrep_rate[gname] = rate;
|
||||
}
|
||||
|
||||
double GroupState::injection_vrep_rate(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
Scalar GroupState<Scalar>::
|
||||
injection_vrep_rate(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->inj_vrep_rate.find(gname);
|
||||
if (group_iter == this->inj_vrep_rate.end())
|
||||
throw std::logic_error("No such group");
|
||||
@ -208,11 +275,17 @@ double GroupState::injection_vrep_rate(const std::string& gname) const {
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void GroupState::update_grat_sales_target(const std::string& gname, double target) {
|
||||
template<class Scalar>
|
||||
void GroupState<Scalar>::
|
||||
update_grat_sales_target(const std::string& gname, Scalar target)
|
||||
{
|
||||
this->m_grat_sales_target[gname] = target;
|
||||
}
|
||||
|
||||
double GroupState::grat_sales_target(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
Scalar GroupState<Scalar>::
|
||||
grat_sales_target(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->m_grat_sales_target.find(gname);
|
||||
if (group_iter == this->m_grat_sales_target.end())
|
||||
throw std::logic_error("No such group");
|
||||
@ -220,13 +293,19 @@ double GroupState::grat_sales_target(const std::string& gname) const {
|
||||
return group_iter->second;
|
||||
}
|
||||
|
||||
bool GroupState::has_grat_sales_target(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
bool GroupState<Scalar>::
|
||||
has_grat_sales_target(const std::string& gname) const
|
||||
{
|
||||
return (this->m_grat_sales_target.count(gname) > 0);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
bool GroupState::has_production_control(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
bool GroupState<Scalar>::
|
||||
has_production_control(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->production_controls.find(gname);
|
||||
if (group_iter == this->production_controls.end())
|
||||
return false;
|
||||
@ -234,11 +313,18 @@ bool GroupState::has_production_control(const std::string& gname) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void GroupState::production_control(const std::string& gname, Group::ProductionCMode cmode) {
|
||||
template<class Scalar>
|
||||
void GroupState<Scalar>::
|
||||
production_control(const std::string& gname,
|
||||
Group::ProductionCMode cmode)
|
||||
{
|
||||
this->production_controls[gname] = cmode;
|
||||
}
|
||||
|
||||
Group::ProductionCMode GroupState::production_control(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
Group::ProductionCMode
|
||||
GroupState<Scalar>::production_control(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->production_controls.find(gname);
|
||||
if (group_iter == this->production_controls.end())
|
||||
throw std::logic_error("Could not find any control for production group: " + gname);
|
||||
@ -248,15 +334,26 @@ Group::ProductionCMode GroupState::production_control(const std::string& gname)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
bool GroupState::has_injection_control(const std::string& gname, Phase phase) const {
|
||||
template<class Scalar>
|
||||
bool GroupState<Scalar>::
|
||||
has_injection_control(const std::string& gname, Phase phase) const
|
||||
{
|
||||
return this->injection_controls.count(std::make_pair(phase, gname)) > 0;
|
||||
}
|
||||
|
||||
void GroupState::injection_control(const std::string& gname, Phase phase, Group::InjectionCMode cmode) {
|
||||
template<class Scalar>
|
||||
void GroupState<Scalar>::
|
||||
injection_control(const std::string& gname,
|
||||
Phase phase, Group::InjectionCMode cmode)
|
||||
{
|
||||
this->injection_controls[ std::make_pair(phase, gname) ] = cmode;
|
||||
}
|
||||
|
||||
Group::InjectionCMode GroupState::injection_control(const std::string& gname, Phase phase) const {
|
||||
template<class Scalar>
|
||||
Group::InjectionCMode
|
||||
GroupState<Scalar>::
|
||||
injection_control(const std::string& gname, Phase phase) const
|
||||
{
|
||||
auto key = std::make_pair(phase, gname);
|
||||
auto group_iter = this->injection_controls.find( key );
|
||||
if (group_iter == this->injection_controls.end())
|
||||
@ -267,7 +364,9 @@ Group::InjectionCMode GroupState::injection_control(const std::string& gname, Ph
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
GPMaint::State& GroupState::gpmaint(const std::string& gname) {
|
||||
template<class Scalar>
|
||||
GPMaint::State& GroupState<Scalar>::gpmaint(const std::string& gname)
|
||||
{
|
||||
if (!this->gpmaint_state.has(gname))
|
||||
this->gpmaint_state.add(gname, GPMaint::State{});
|
||||
return this->gpmaint_state[gname];
|
||||
@ -276,11 +375,16 @@ GPMaint::State& GroupState::gpmaint(const std::string& gname) {
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void GroupState::update_gpmaint_target(const std::string& gname, double target) {
|
||||
template<class Scalar>
|
||||
void GroupState<Scalar>::
|
||||
update_gpmaint_target(const std::string& gname, Scalar target)
|
||||
{
|
||||
this->m_gpmaint_target[gname] = target;
|
||||
}
|
||||
|
||||
double GroupState::gpmaint_target(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
Scalar GroupState<Scalar>::gpmaint_target(const std::string& gname) const
|
||||
{
|
||||
auto group_iter = this->m_gpmaint_target.find(gname);
|
||||
if (group_iter == this->m_gpmaint_target.end())
|
||||
throw std::logic_error("No such group");
|
||||
@ -288,8 +392,13 @@ double GroupState::gpmaint_target(const std::string& gname) const {
|
||||
return group_iter->second;
|
||||
}
|
||||
|
||||
bool GroupState::has_gpmaint_target(const std::string& gname) const {
|
||||
template<class Scalar>
|
||||
bool GroupState<Scalar>::
|
||||
has_gpmaint_target(const std::string& gname) const
|
||||
{
|
||||
return (this->m_gpmaint_target.count(gname) > 0);
|
||||
}
|
||||
|
||||
template class GroupState<double>;
|
||||
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template<class Scalar>
|
||||
class GroupState {
|
||||
public:
|
||||
GroupState() = default;
|
||||
@ -41,38 +42,43 @@ public:
|
||||
bool operator==(const GroupState& other) const;
|
||||
|
||||
bool has_production_rates(const std::string& gname) const;
|
||||
void update_production_rates(const std::string& gname, const std::vector<double>& rates);
|
||||
const std::vector<double>& production_rates(const std::string& gname) const;
|
||||
void update_production_rates(const std::string& gname,
|
||||
const std::vector<Scalar>& rates);
|
||||
const std::vector<Scalar>& production_rates(const std::string& gname) const;
|
||||
|
||||
bool has_production_reduction_rates(const std::string& gname) const;
|
||||
void update_production_reduction_rates(const std::string& gname, const std::vector<double>& rates);
|
||||
const std::vector<double>& production_reduction_rates(const std::string& gname) const;
|
||||
void update_production_reduction_rates(const std::string& gname,
|
||||
const std::vector<Scalar>& rates);
|
||||
const std::vector<Scalar>& production_reduction_rates(const std::string& gname) const;
|
||||
|
||||
bool has_injection_reduction_rates(const std::string& gname) const;
|
||||
void update_injection_reduction_rates(const std::string& gname, const std::vector<double>& rates);
|
||||
const std::vector<double>& injection_reduction_rates(const std::string& gname) const;
|
||||
void update_injection_reduction_rates(const std::string& gname,
|
||||
const std::vector<Scalar>& rates);
|
||||
const std::vector<Scalar>& injection_reduction_rates(const std::string& gname) const;
|
||||
|
||||
bool has_injection_reservoir_rates(const std::string& gname) const;
|
||||
void update_injection_reservoir_rates(const std::string& gname, const std::vector<double>& rates);
|
||||
const std::vector<double>& injection_reservoir_rates(const std::string& gname) const;
|
||||
void update_injection_reservoir_rates(const std::string& gname,
|
||||
const std::vector<Scalar>& rates);
|
||||
const std::vector<Scalar>& injection_reservoir_rates(const std::string& gname) const;
|
||||
|
||||
bool has_injection_surface_rates(const std::string& gname) const;
|
||||
void update_injection_surface_rates(const std::string& gname, const std::vector<double>& rates);
|
||||
const std::vector<double>& injection_surface_rates(const std::string& gname) const;
|
||||
void update_injection_surface_rates(const std::string& gname,
|
||||
const std::vector<Scalar>& rates);
|
||||
const std::vector<Scalar>& injection_surface_rates(const std::string& gname) const;
|
||||
|
||||
void update_injection_rein_rates(const std::string& gname,
|
||||
const std::vector<Scalar>& rates);
|
||||
const std::vector<Scalar>& injection_rein_rates(const std::string& gname) const;
|
||||
|
||||
void update_injection_rein_rates(const std::string& gname, const std::vector<double>& rates);
|
||||
const std::vector<double>& injection_rein_rates(const std::string& gname) const;
|
||||
void update_injection_vrep_rate(const std::string& gname, Scalar rate);
|
||||
Scalar injection_vrep_rate(const std::string& gname) const;
|
||||
|
||||
void update_injection_vrep_rate(const std::string& gname, double rate);
|
||||
double injection_vrep_rate(const std::string& gname) const;
|
||||
|
||||
void update_grat_sales_target(const std::string& gname, double target);
|
||||
double grat_sales_target(const std::string& gname) const;
|
||||
void update_grat_sales_target(const std::string& gname, Scalar target);
|
||||
Scalar grat_sales_target(const std::string& gname) const;
|
||||
bool has_grat_sales_target(const std::string& gname) const;
|
||||
|
||||
void update_gpmaint_target(const std::string& gname, double target);
|
||||
double gpmaint_target(const std::string& gname) const;
|
||||
void update_gpmaint_target(const std::string& gname, Scalar target);
|
||||
Scalar gpmaint_target(const std::string& gname) const;
|
||||
bool has_gpmaint_target(const std::string& gname) const;
|
||||
|
||||
bool has_production_control(const std::string& gname) const;
|
||||
@ -84,12 +90,11 @@ public:
|
||||
Group::InjectionCMode injection_control(const std::string& gname, Phase phase) const;
|
||||
|
||||
std::size_t data_size() const;
|
||||
std::size_t collect(double * data) const;
|
||||
std::size_t distribute(const double * data);
|
||||
std::size_t collect(Scalar* data) const;
|
||||
std::size_t distribute(const Scalar* data);
|
||||
|
||||
GPMaint::State& gpmaint(const std::string& gname);
|
||||
|
||||
|
||||
template<class Comm>
|
||||
void communicate_rates(const Comm& comm)
|
||||
{
|
||||
@ -125,11 +130,9 @@ public:
|
||||
sz += this->inj_vrep_rate.size();
|
||||
|
||||
// Make a vector and collect all data into it.
|
||||
std::vector<double> data(sz);
|
||||
std::vector<Scalar> data(sz);
|
||||
std::size_t pos = 0;
|
||||
|
||||
|
||||
|
||||
// That the collect function mutates the vector v is an artifact for
|
||||
// testing.
|
||||
auto collect = [&data, &pos](auto& v) {
|
||||
@ -183,17 +186,16 @@ public:
|
||||
|
||||
private:
|
||||
std::size_t num_phases{};
|
||||
std::map<std::string, std::vector<double>> m_production_rates;
|
||||
std::map<std::string, std::vector<Scalar>> m_production_rates;
|
||||
std::map<std::string, Group::ProductionCMode> production_controls;
|
||||
std::map<std::string, std::vector<double>> prod_red_rates;
|
||||
std::map<std::string, std::vector<double>> inj_red_rates;
|
||||
std::map<std::string, std::vector<double>> inj_surface_rates;
|
||||
std::map<std::string, std::vector<double>> inj_resv_rates;
|
||||
std::map<std::string, std::vector<double>> inj_rein_rates;
|
||||
std::map<std::string, double> inj_vrep_rate;
|
||||
std::map<std::string, double> m_grat_sales_target;
|
||||
std::map<std::string, double> m_gpmaint_target;
|
||||
|
||||
std::map<std::string, std::vector<Scalar>> prod_red_rates;
|
||||
std::map<std::string, std::vector<Scalar>> inj_red_rates;
|
||||
std::map<std::string, std::vector<Scalar>> inj_surface_rates;
|
||||
std::map<std::string, std::vector<Scalar>> inj_resv_rates;
|
||||
std::map<std::string, std::vector<Scalar>> inj_rein_rates;
|
||||
std::map<std::string, Scalar> inj_vrep_rate;
|
||||
std::map<std::string, Scalar> m_grat_sales_target;
|
||||
std::map<std::string, Scalar> m_gpmaint_target;
|
||||
|
||||
std::map<std::pair<Phase, std::string>, Group::InjectionCMode> injection_controls;
|
||||
WellContainer<GPMaint::State> gpmaint_state;
|
||||
|
@ -78,66 +78,66 @@ namespace Opm
|
||||
const int index_of_well,
|
||||
const std::vector<PerforationData>& perf_data);
|
||||
|
||||
virtual void init(const PhaseUsage* phase_usage_arg,
|
||||
const std::vector<double>& depth_arg,
|
||||
const double gravity_arg,
|
||||
const int num_cells,
|
||||
const std::vector< Scalar >& B_avg,
|
||||
const bool changed_to_open_this_step) override;
|
||||
void init(const PhaseUsage* phase_usage_arg,
|
||||
const std::vector<double>& depth_arg,
|
||||
const double gravity_arg,
|
||||
const int num_cells,
|
||||
const std::vector<Scalar>& B_avg,
|
||||
const bool changed_to_open_this_step) override;
|
||||
|
||||
void initPrimaryVariablesEvaluation() override;
|
||||
|
||||
/// updating the well state based the current control mode
|
||||
virtual void updateWellStateWithTarget(const Simulator& simulator,
|
||||
const GroupState& group_state,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
void updateWellStateWithTarget(const Simulator& simulator,
|
||||
const GroupState<Scalar>& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
/// check whether the well equations get converged for this well
|
||||
virtual ConvergenceReport getWellConvergence(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool relax_tolerance) const override;
|
||||
ConvergenceReport getWellConvergence(const SummaryState& summary_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool relax_tolerance) const override;
|
||||
|
||||
/// Ax = Ax - C D^-1 B x
|
||||
virtual void apply(const BVector& x, BVector& Ax) const override;
|
||||
void apply(const BVector& x, BVector& Ax) const override;
|
||||
/// r = r - C D^-1 Rw
|
||||
virtual void apply(BVector& r) const override;
|
||||
void apply(BVector& r) const override;
|
||||
|
||||
/// using the solution x to recover the solution xw for wells and applying
|
||||
/// xw to update Well State
|
||||
void recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
||||
const BVector& x,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
/// computing the well potentials for group control
|
||||
virtual void computeWellPotentials(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
void computeWellPotentials(const Simulator& simulator,
|
||||
const WellState<Scalar>& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
void updatePrimaryVariables(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) override; // const?
|
||||
void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override; // const?
|
||||
|
||||
virtual void calculateExplicitQuantities(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
DeferredLogger& deferred_logger) override; // should be const?
|
||||
void calculateExplicitQuantities(const Simulator& simulator,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override; // should be const?
|
||||
|
||||
void updateIPRImplicit(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual void updateProductivityIndex(const Simulator& simulator,
|
||||
const WellProdIndexCalculator& wellPICalc,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
void updateProductivityIndex(const Simulator& simulator,
|
||||
const WellProdIndexCalculator& wellPICalc,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
double connectionDensity(const int globalConnIdx,
|
||||
const int openConnIdx) const override;
|
||||
@ -148,7 +148,7 @@ namespace Opm
|
||||
const BVector& x,
|
||||
const int pressureVarIndex,
|
||||
const bool use_well_weights,
|
||||
const WellState& well_state) const override;
|
||||
const WellState<Scalar>& well_state) const override;
|
||||
|
||||
std::vector<double> computeCurrentWellRates(const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
@ -176,7 +176,7 @@ namespace Opm
|
||||
// updating the well_state based on well solution dwells
|
||||
void updateWellState(const SummaryState& summary_state,
|
||||
const BVectorWell& dwells,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
const double relaxation_factor = 1.0);
|
||||
|
||||
@ -243,10 +243,10 @@ namespace Opm
|
||||
std::vector<double>& well_flux,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
std::vector<double> computeWellPotentialWithTHP(
|
||||
const WellState& well_state,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
std::vector<double>
|
||||
computeWellPotentialWithTHP(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
bool computeWellPotentialsImplicit(const Simulator& simulator,
|
||||
std::vector<double>& well_potentials,
|
||||
@ -258,16 +258,16 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual bool iterateWellEqWithSwitching(const Simulator& simulator,
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool fixed_control = false,
|
||||
const bool fixed_status = false) override;
|
||||
@ -276,11 +276,11 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual void updateWaterThroughput(const double dt, WellState& well_state) const override;
|
||||
virtual void updateWaterThroughput(const double dt, WellState<Scalar>& well_state) const override;
|
||||
|
||||
EvalWell getSegmentSurfaceVolume(const Simulator& simulator, const int seg_idx) const;
|
||||
|
||||
@ -297,30 +297,31 @@ namespace Opm
|
||||
|
||||
|
||||
|
||||
std::optional<double> computeBhpAtThpLimitProd(
|
||||
const WellState& well_state,
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
std::optional<double>
|
||||
computeBhpAtThpLimitProd(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
std::optional<double> computeBhpAtThpLimitInj(const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
std::optional<double>
|
||||
computeBhpAtThpLimitInj(const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
double maxPerfPress(const Simulator& simulator) const;
|
||||
|
||||
// check whether the well is operable under BHP limit with current reservoir condition
|
||||
void checkOperabilityUnderBHPLimit(const WellState& well_state,
|
||||
const Simulator& simulator,
|
||||
void checkOperabilityUnderBHPLimit(const WellState<Scalar>& well_state,
|
||||
const Simulator& ebos_simulator,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
// check whether the well is operable under THP limit with current reservoir condition
|
||||
void checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
void checkOperabilityUnderTHPLimit(const Simulator& ebos_simulator,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
// updating the inflow based on the current reservoir condition
|
||||
void updateIPR(const Simulator& simulator,
|
||||
void updateIPR(const Simulator& ebos_simulator,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
};
|
||||
|
||||
|
@ -83,8 +83,8 @@ private:
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void MultisegmentWellAssemble<FluidSystem,Indices>::
|
||||
assembleControlEq(const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
assembleControlEq(const WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
|
@ -30,13 +30,13 @@ namespace Opm
|
||||
{
|
||||
|
||||
class DeferredLogger;
|
||||
class GroupState;
|
||||
template<class Scalar> class GroupState;
|
||||
template<class Scalar, int numWellEq, int numEq> class MultisegmentWellEquations;
|
||||
template<class FluidSystem, class Indices> class MultisegmentWellPrimaryVariables;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
//! \brief Class handling assemble of the equation system for MultisegmentWell.
|
||||
template<class FluidSystem, class Indices>
|
||||
@ -70,8 +70,8 @@ public:
|
||||
{}
|
||||
|
||||
//! \brief Assemble control equation.
|
||||
void assembleControlEq(const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
void assembleControlEq(const WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
|
@ -313,7 +313,7 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
|
||||
const bool /*use_well_weights*/,
|
||||
const WellInterfaceGeneric& well,
|
||||
const int seg_pressure_var_ind,
|
||||
const WellState& well_state) const
|
||||
const WellState<Scalar>& well_state) const
|
||||
{
|
||||
// Add the pressure contribution to the cpr system for the well
|
||||
|
||||
@ -397,7 +397,7 @@ template void MultisegmentWellEquations<double,numWellEq,numEq>:: \
|
||||
const bool, \
|
||||
const WellInterfaceGeneric&, \
|
||||
const int, \
|
||||
const WellState&) const;
|
||||
const WellState<double>&) const;
|
||||
|
||||
INSTANCE(2,1)
|
||||
INSTANCE(2,2)
|
||||
|
@ -42,7 +42,7 @@ template<class Scalar> class MultisegmentWellGeneric;
|
||||
class WellContributions;
|
||||
#endif
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template<class Scalar, int numWellEq, int numEq>
|
||||
class MultisegmentWellEquations
|
||||
@ -120,7 +120,7 @@ public:
|
||||
const bool /*use_well_weights*/,
|
||||
const WellInterfaceGeneric& well,
|
||||
const int seg_pressure_var_ind,
|
||||
const WellState& well_state) const;
|
||||
const WellState<Scalar>& well_state) const;
|
||||
|
||||
//! \brief Returns a const reference to the residual.
|
||||
const BVectorWell& residual() const
|
||||
|
@ -78,7 +78,7 @@ initMatrixAndVectors(const int num_cells)
|
||||
template<typename FluidSystem, typename Indices>
|
||||
ConvergenceReport
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
getWellConvergence(const WellState& well_state,
|
||||
getWellConvergence(const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
DeferredLogger& deferred_logger,
|
||||
const double max_residual_allowed,
|
||||
@ -199,7 +199,7 @@ template<typename FluidSystem, typename Indices>
|
||||
void
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
assembleAccelerationPressureLoss(const int seg,
|
||||
WellState& well_state)
|
||||
WellState<Scalar>& well_state)
|
||||
{
|
||||
// Computes and assembles p-drop due to acceleration
|
||||
assert(seg != 0); // top segment can not enter here
|
||||
@ -246,7 +246,7 @@ template<typename FluidSystem, typename Indices>
|
||||
void
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
assembleDefaultPressureEq(const int seg,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const bool use_average_density)
|
||||
{
|
||||
assert(seg != 0); // not top segment
|
||||
@ -293,7 +293,7 @@ void
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
assembleICDPressureEq(const int seg,
|
||||
const UnitSystem& unit_system,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
const bool use_average_density,
|
||||
DeferredLogger& deferred_logger)
|
||||
@ -377,7 +377,7 @@ template<typename FluidSystem, typename Indices>
|
||||
void
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
assembleAccelerationAndHydroPressureLosses(const int seg,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const bool use_average_density)
|
||||
{
|
||||
if (this->accelerationalPressureLossConsidered()) {
|
||||
@ -409,7 +409,7 @@ void
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
assemblePressureEq(const int seg,
|
||||
const UnitSystem& unit_system,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
const bool use_average_density,
|
||||
DeferredLogger& deferred_logger)
|
||||
@ -473,7 +473,7 @@ getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
|
||||
template<typename FluidSystem, typename Indices>
|
||||
double
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
getControlTolerance(const WellState& well_state,
|
||||
getControlTolerance(const WellState<Scalar>& well_state,
|
||||
const double tolerance_wells,
|
||||
const double tolerance_pressure_ms_wells,
|
||||
DeferredLogger& deferred_logger) const
|
||||
@ -540,7 +540,7 @@ getControlTolerance(const WellState& well_state,
|
||||
template<typename FluidSystem, typename Indices>
|
||||
double
|
||||
MultisegmentWellEval<FluidSystem,Indices>::
|
||||
getResidualMeasureValue(const WellState& well_state,
|
||||
getResidualMeasureValue(const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& residuals,
|
||||
const double tolerance_wells,
|
||||
const double tolerance_pressure_ms_wells,
|
||||
|
@ -38,13 +38,12 @@ namespace Opm
|
||||
{
|
||||
|
||||
class ConvergenceReport;
|
||||
class GroupState;
|
||||
class Schedule;
|
||||
class WellContributions;
|
||||
class SummaryState;
|
||||
|
||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template<typename FluidSystem, typename Indices>
|
||||
class MultisegmentWellEval : public MultisegmentWellGeneric<typename FluidSystem::Scalar>
|
||||
@ -79,31 +78,31 @@ protected:
|
||||
void initMatrixAndVectors(const int num_cells);
|
||||
|
||||
void assembleDefaultPressureEq(const int seg,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const bool use_average_density);
|
||||
|
||||
// assemble pressure equation for ICD segments
|
||||
void assembleICDPressureEq(const int seg,
|
||||
const UnitSystem& unit_system,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
const bool use_average_density,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void assembleAccelerationAndHydroPressureLosses(const int seg,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const bool use_average_density);
|
||||
|
||||
|
||||
void assemblePressureEq(const int seg,
|
||||
const UnitSystem& unit_system,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
const bool use_average_density,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
/// check whether the well equations get converged for this well
|
||||
ConvergenceReport getWellConvergence(const WellState& well_state,
|
||||
ConvergenceReport getWellConvergence(const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
DeferredLogger& deferred_logger,
|
||||
const double max_residual_allowed,
|
||||
@ -118,19 +117,19 @@ protected:
|
||||
getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
double getControlTolerance(const WellState& well_state,
|
||||
double getControlTolerance(const WellState<Scalar>& well_state,
|
||||
const double tolerance_wells,
|
||||
const double tolerance_pressure_ms_wells,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
double getResidualMeasureValue(const WellState& well_state,
|
||||
double getResidualMeasureValue(const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& residuals,
|
||||
const double tolerance_wells,
|
||||
const double tolerance_pressure_ms_wells,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void assembleAccelerationPressureLoss(const int seg,
|
||||
WellState& well_state);
|
||||
WellState<Scalar>& well_state);
|
||||
|
||||
EvalWell pressureDropAutoICD(const int seg,
|
||||
const UnitSystem& unit_system) const;
|
||||
|
@ -55,7 +55,7 @@ void
|
||||
MultisegmentWellGeneric<Scalar>::
|
||||
scaleSegmentRatesWithWellRates(const std::vector<std::vector<int>>& segment_inlets,
|
||||
const std::vector<std::vector<int>>& segment_perforations,
|
||||
WellState& well_state) const
|
||||
WellState<Scalar>& well_state) const
|
||||
{
|
||||
auto& ws = well_state.well(baseif_.indexOfWell());
|
||||
auto& segments = ws.segments;
|
||||
@ -84,10 +84,10 @@ scaleSegmentRatesWithWellRates(const std::vector<std::vector<int>>& segment_inle
|
||||
}
|
||||
|
||||
std::vector<double> rates;
|
||||
WellState::calculateSegmentRates(segment_inlets,
|
||||
segment_perforations,
|
||||
perforation_rates,
|
||||
num_single_phase, 0, rates);
|
||||
WellState<Scalar>::calculateSegmentRates(segment_inlets,
|
||||
segment_perforations,
|
||||
perforation_rates,
|
||||
num_single_phase, 0, rates);
|
||||
for (int seg = 0; seg < numberOfSegments(); ++seg) {
|
||||
segment_rates[baseif_.numPhases() * seg + phase] = rates[seg];
|
||||
}
|
||||
@ -98,7 +98,7 @@ scaleSegmentRatesWithWellRates(const std::vector<std::vector<int>>& segment_inle
|
||||
template <typename Scalar>
|
||||
void
|
||||
MultisegmentWellGeneric<Scalar>::
|
||||
scaleSegmentPressuresWithBhp(WellState& well_state) const
|
||||
scaleSegmentPressuresWithBhp(WellState<Scalar>& well_state) const
|
||||
{
|
||||
auto& ws = well_state.well(baseif_.indexOfWell());
|
||||
auto& segments = ws.segments;
|
||||
|
@ -35,7 +35,7 @@ class SummaryState;
|
||||
class WellInterfaceGeneric;
|
||||
enum class WellSegmentCompPressureDrop;
|
||||
class WellSegments;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template <typename Scalar>
|
||||
class MultisegmentWellGeneric
|
||||
@ -57,8 +57,8 @@ protected:
|
||||
// scale the segment rates and pressure based on well rates and bhp
|
||||
void scaleSegmentRatesWithWellRates(const std::vector<std::vector<int>>& segment_inlets,
|
||||
const std::vector<std::vector<int>>& segment_perforations,
|
||||
WellState& well_state) const;
|
||||
void scaleSegmentPressuresWithBhp(WellState& well_state) const;
|
||||
WellState<Scalar>& well_state) const;
|
||||
void scaleSegmentPressuresWithBhp(WellState<Scalar>& well_state) const;
|
||||
|
||||
// components of the pressure drop to be included
|
||||
WellSegmentCompPressureDrop compPressureDrop() const;
|
||||
|
@ -67,7 +67,8 @@ init()
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
|
||||
update(const WellState& well_state, const bool stop_or_zero_rate_target)
|
||||
update(const WellState<Scalar>& well_state,
|
||||
const bool stop_or_zero_rate_target)
|
||||
{
|
||||
static constexpr int Water = BlackoilPhases::Aqua;
|
||||
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||
@ -214,7 +215,7 @@ void MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
|
||||
copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
||||
const double rho,
|
||||
const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ namespace Opm
|
||||
class DeferredLogger;
|
||||
template<class Scalar> class MultisegmentWellGeneric;
|
||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
class MultisegmentWellPrimaryVariables
|
||||
@ -92,7 +92,8 @@ public:
|
||||
void init();
|
||||
|
||||
//! \brief Copy values from well state.
|
||||
void update(const WellState& well_state, const bool stop_or_zero_rate_target);
|
||||
void update(const WellState<Scalar>& well_state,
|
||||
const bool stop_or_zero_rate_target);
|
||||
|
||||
//! \brief Update values from newton update vector.
|
||||
void updateNewton(const BVectorWell& dwells,
|
||||
@ -105,7 +106,7 @@ public:
|
||||
void copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
||||
const double rho,
|
||||
const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
|
@ -864,7 +864,7 @@ accelerationPressureLossContribution(const int seg,
|
||||
template <class FluidSystem, class Indices>
|
||||
void
|
||||
MultisegmentWellSegments<FluidSystem,Indices>::
|
||||
copyPhaseDensities(const PhaseUsage& pu, SegmentState& segSol) const
|
||||
copyPhaseDensities(const PhaseUsage& pu, SegmentState<Scalar>& segSol) const
|
||||
{
|
||||
auto* rho = segSol.phase_density.data();
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace Opm {
|
||||
|
||||
class AutoICD;
|
||||
struct PhaseUsage;
|
||||
class SegmentState;
|
||||
template<class Scalar> class SegmentState;
|
||||
class UnitSystem;
|
||||
class WellInterfaceGeneric;
|
||||
class SummaryState;
|
||||
@ -131,7 +131,7 @@ public:
|
||||
}
|
||||
|
||||
void copyPhaseDensities(const PhaseUsage& pu,
|
||||
SegmentState& segSol) const;
|
||||
SegmentState<Scalar>& segSol) const;
|
||||
|
||||
private:
|
||||
// TODO: trying to use the information from the Well opm-parser as much
|
||||
@ -141,8 +141,8 @@ private:
|
||||
// the completions's ids are their index in the vector well_index_, well_cell_
|
||||
// This is also assuming the order of the completions in Well is the same with
|
||||
// the order of the completions in wells.
|
||||
// it is for convinience reason. we can just calcuate the inforation for segment once then using it for all the perofrations
|
||||
// belonging to this segment
|
||||
// it is for convenience reason. we can just calculate the information for segment once
|
||||
// then using it for all the perforations belonging to this segment
|
||||
std::vector<std::vector<int>> perforations_;
|
||||
|
||||
// depth difference between the segment and the perforation
|
||||
|
@ -156,7 +156,7 @@ namespace Opm
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
updatePrimaryVariables(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& /* deferred_logger */)
|
||||
{
|
||||
const bool stop_or_zero_rate_target = this->stopppedOrZeroRateTarget(summary_state, well_state);
|
||||
@ -172,8 +172,8 @@ namespace Opm
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateWellStateWithTarget(const Simulator& simulator,
|
||||
const GroupState& group_state,
|
||||
WellState& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
Base::updateWellStateWithTarget(simulator, group_state, well_state, deferred_logger);
|
||||
@ -193,7 +193,7 @@ namespace Opm
|
||||
ConvergenceReport
|
||||
MultisegmentWell<TypeTag>::
|
||||
getWellConvergence(const SummaryState& /* summary_state */,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool relax_tolerance) const
|
||||
@ -255,7 +255,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
||||
const BVector& x,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) {
|
||||
@ -275,7 +275,7 @@ namespace Opm
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
computeWellPotentials(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -346,7 +346,7 @@ namespace Opm
|
||||
well_flux.resize(np, 0.0);
|
||||
const bool allow_cf = this->getAllowCrossFlow();
|
||||
const int nseg = this->numberOfSegments();
|
||||
const WellState& well_state = simulator.problem().wellModel().wellState();
|
||||
const WellState<Scalar>& well_state = simulator.problem().wellModel().wellState();
|
||||
const auto& ws = well_state.well(this->indexOfWell());
|
||||
auto segments_copy = ws.segments;
|
||||
segments_copy.scale_pressure(bhp);
|
||||
@ -391,7 +391,7 @@ namespace Opm
|
||||
well_copy.debug_cost_counter_ = 0;
|
||||
|
||||
// store a copy of the well state, we don't want to update the real well state
|
||||
WellState well_state_copy = simulator.problem().wellModel().wellState();
|
||||
WellState<Scalar> well_state_copy = simulator.problem().wellModel().wellState();
|
||||
const auto& group_state = simulator.problem().wellModel().groupState();
|
||||
auto& ws = well_state_copy.well(this->index_of_well_);
|
||||
|
||||
@ -452,10 +452,9 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
std::vector<double>
|
||||
MultisegmentWell<TypeTag>::
|
||||
computeWellPotentialWithTHP(
|
||||
const WellState& well_state,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) const
|
||||
computeWellPotentialWithTHP(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
std::vector<double> potentials(this->number_of_phases_, 0.0);
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
@ -513,7 +512,7 @@ namespace Opm
|
||||
well_copy.debug_cost_counter_ = 0;
|
||||
|
||||
// store a copy of the well state, we don't want to update the real well state
|
||||
WellState well_state_copy = simulator.problem().wellModel().wellState();
|
||||
WellState<Scalar> well_state_copy = simulator.problem().wellModel().wellState();
|
||||
const auto& group_state = simulator.problem().wellModel().groupState();
|
||||
auto& ws = well_state_copy.well(this->index_of_well_);
|
||||
|
||||
@ -572,7 +571,7 @@ namespace Opm
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||
@ -676,7 +675,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateWellState(const SummaryState& summary_state,
|
||||
const BVectorWell& dwells,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
const double relaxation_factor)
|
||||
{
|
||||
@ -710,7 +709,7 @@ namespace Opm
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
calculateExplicitQuantities(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
@ -729,7 +728,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateProductivityIndex(const Simulator& simulator,
|
||||
const WellProdIndexCalculator& wellPICalc,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
auto fluidState = [&simulator, this](const int perf)
|
||||
@ -834,7 +833,7 @@ namespace Opm
|
||||
const BVector& weights,
|
||||
const int pressureVarIndex,
|
||||
const bool use_well_weights,
|
||||
const WellState& well_state) const
|
||||
const WellState<Scalar>& well_state) const
|
||||
{
|
||||
// Add the pressure contribution to the cpr system for the well
|
||||
this->linSys_.extractCPRPressureMatrix(jacobian,
|
||||
@ -1150,7 +1149,9 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
checkOperabilityUnderBHPLimit(const WellState& /*well_state*/, const Simulator& simulator, DeferredLogger& deferred_logger)
|
||||
checkOperabilityUnderBHPLimit(const WellState<Scalar>& /*well_state*/,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summaryState = simulator.vanguard().summaryState();
|
||||
const double bhp_limit = WellBhpThpCalculator(*this).mostStrictBhpFromBhpLimits(summaryState);
|
||||
@ -1308,7 +1309,9 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateIPRImplicit(const Simulator& simulator, WellState& well_state, DeferredLogger& deferred_logger)
|
||||
updateIPRImplicit(const Simulator& simulator,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// Compute IPR based on *converged* well-equation:
|
||||
// For a component rate r the derivative dr/dbhp is obtained by
|
||||
@ -1375,10 +1378,9 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
checkOperabilityUnderTHPLimit(
|
||||
const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summaryState = simulator.vanguard().summaryState();
|
||||
const auto obtain_bhp = this->isProducer()
|
||||
@ -1432,8 +1434,8 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return true;
|
||||
@ -1584,8 +1586,8 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool fixed_control /*false*/,
|
||||
const bool fixed_status /*false*/)
|
||||
@ -1775,8 +1777,8 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||
@ -1978,7 +1980,7 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
MultisegmentWell<TypeTag>::
|
||||
updateWaterThroughput(const double /*dt*/, WellState& /*well_state*/) const
|
||||
updateWaterThroughput(const double /*dt*/, WellState<Scalar>& /*well_state*/) const
|
||||
{
|
||||
}
|
||||
|
||||
@ -2016,7 +2018,7 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
std::optional<double>
|
||||
MultisegmentWell<TypeTag>::
|
||||
computeBhpAtThpLimitProd(const WellState& well_state,
|
||||
computeBhpAtThpLimitProd(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
|
@ -21,16 +21,17 @@
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
#include <opm/simulators/wells/PerfData.hpp>
|
||||
|
||||
#include <opm/simulators/wells/ConnFiltrateData.hpp>
|
||||
#include <opm/simulators/wells/PerfData.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
PerfData::PerfData(const std::size_t num_perf,
|
||||
const double pressure_first_connection_,
|
||||
const bool injector_,
|
||||
const std::size_t num_phases)
|
||||
template<class Scalar>
|
||||
PerfData<Scalar>::PerfData(const std::size_t num_perf,
|
||||
const Scalar pressure_first_connection_,
|
||||
const bool injector_,
|
||||
const std::size_t num_phases)
|
||||
: injector(injector_)
|
||||
, pressure_first_connection(pressure_first_connection_)
|
||||
, pressure(num_perf)
|
||||
@ -57,7 +58,8 @@ PerfData::PerfData(const std::size_t num_perf,
|
||||
}
|
||||
}
|
||||
|
||||
PerfData PerfData::serializationTestObject()
|
||||
template<class Scalar>
|
||||
PerfData<Scalar> PerfData<Scalar>::serializationTestObject()
|
||||
{
|
||||
PerfData result;
|
||||
result.pressure_first_connection = 1.0;
|
||||
@ -79,22 +81,25 @@ PerfData PerfData::serializationTestObject()
|
||||
result.water_throughput = {25.0, 26.0};
|
||||
result.skin_pressure = {27.0, 28.0};
|
||||
result.water_velocity = {29.0, 30.0};
|
||||
result.filtrate_data = ConnFiltrateData::serializationTestObject();
|
||||
result.filtrate_data = ConnFiltrateData<Scalar>::serializationTestObject();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::size_t PerfData::size() const
|
||||
template<class Scalar>
|
||||
std::size_t PerfData<Scalar>::size() const
|
||||
{
|
||||
return this->pressure.size();
|
||||
}
|
||||
|
||||
bool PerfData::empty() const
|
||||
template<class Scalar>
|
||||
bool PerfData<Scalar>::empty() const
|
||||
{
|
||||
return this->pressure.empty();
|
||||
}
|
||||
|
||||
bool PerfData::try_assign(const PerfData& other)
|
||||
template<class Scalar>
|
||||
bool PerfData<Scalar>::try_assign(const PerfData& other)
|
||||
{
|
||||
if (this->size() != other.size()) {
|
||||
return false;
|
||||
@ -122,7 +127,8 @@ bool PerfData::try_assign(const PerfData& other)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PerfData::operator==(const PerfData& rhs) const
|
||||
template<class Scalar>
|
||||
bool PerfData<Scalar>::operator==(const PerfData& rhs) const
|
||||
{
|
||||
return (this->pressure_first_connection == rhs.pressure_first_connection)
|
||||
&& (this->pressure == rhs.pressure)
|
||||
@ -147,4 +153,6 @@ bool PerfData::operator==(const PerfData& rhs) const
|
||||
;
|
||||
}
|
||||
|
||||
template class PerfData<double>;
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template<class Scalar>
|
||||
class PerfData
|
||||
{
|
||||
private:
|
||||
@ -36,7 +37,7 @@ private:
|
||||
public:
|
||||
PerfData() = default;
|
||||
PerfData(std::size_t num_perf,
|
||||
double pressure_first_connection_,
|
||||
Scalar pressure_first_connection_,
|
||||
bool injector_,
|
||||
std::size_t num_phases);
|
||||
|
||||
@ -79,30 +80,30 @@ public:
|
||||
// if you're adding a new member representing a dynamically calculated
|
||||
// result, e.g., a flow rate, then please update try_assign() as well.
|
||||
|
||||
double pressure_first_connection{};
|
||||
std::vector<double> pressure{};
|
||||
std::vector<double> rates{};
|
||||
std::vector<double> phase_rates{};
|
||||
std::vector<std::array<double,4>> phase_mixing_rates{};
|
||||
std::vector<double> solvent_rates{};
|
||||
std::vector<double> polymer_rates{};
|
||||
std::vector<double> brine_rates{};
|
||||
std::vector<double> prod_index{};
|
||||
std::vector<double> micp_rates{};
|
||||
Scalar pressure_first_connection{};
|
||||
std::vector<Scalar> pressure{};
|
||||
std::vector<Scalar> rates{};
|
||||
std::vector<Scalar> phase_rates{};
|
||||
std::vector<std::array<Scalar,4>> phase_mixing_rates{};
|
||||
std::vector<Scalar> solvent_rates{};
|
||||
std::vector<Scalar> polymer_rates{};
|
||||
std::vector<Scalar> brine_rates{};
|
||||
std::vector<Scalar> prod_index{};
|
||||
std::vector<Scalar> micp_rates{};
|
||||
std::vector<std::size_t> cell_index{};
|
||||
std::vector<double> connection_transmissibility_factor{};
|
||||
std::vector<double> connection_d_factor{};
|
||||
std::vector<double> connection_compaction_tmult{};
|
||||
std::vector<Scalar> connection_transmissibility_factor{};
|
||||
std::vector<Scalar> connection_d_factor{};
|
||||
std::vector<Scalar> connection_compaction_tmult{};
|
||||
std::vector<int> satnum_id{};
|
||||
std::vector<std::size_t> ecl_index{};
|
||||
|
||||
// The water_throughput, skin_pressure and water_velocity variables are
|
||||
// only used for injectors to check the injectivity.
|
||||
std::vector<double> water_throughput{};
|
||||
std::vector<double> skin_pressure{};
|
||||
std::vector<double> water_velocity{};
|
||||
std::vector<Scalar> water_throughput{};
|
||||
std::vector<Scalar> skin_pressure{};
|
||||
std::vector<Scalar> water_velocity{};
|
||||
|
||||
ConnFiltrateData filtrate_data{};
|
||||
ConnFiltrateData<Scalar> filtrate_data{};
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -50,10 +50,10 @@ std::vector<int> make_segment_number(const Opm::WellSegments& segments)
|
||||
|
||||
} // Anonymous namespace
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
namespace Opm {
|
||||
|
||||
SegmentState::SegmentState(int num_phases, const WellSegments& segments)
|
||||
template<class Scalar>
|
||||
SegmentState<Scalar>::SegmentState(int num_phases, const WellSegments& segments)
|
||||
: rates (segments.size() * num_phases)
|
||||
, dissolved_gas_rate (segments.size())
|
||||
, vaporized_oil_rate (segments.size())
|
||||
@ -69,7 +69,8 @@ SegmentState::SegmentState(int num_phases, const WellSegments& segments)
|
||||
, m_segment_number (make_segment_number(segments))
|
||||
{}
|
||||
|
||||
SegmentState SegmentState::serializationTestObject()
|
||||
template<class Scalar>
|
||||
SegmentState<Scalar> SegmentState<Scalar>::serializationTestObject()
|
||||
{
|
||||
SegmentState result;
|
||||
result.rates = {1.0, 2.0};
|
||||
@ -89,19 +90,27 @@ SegmentState SegmentState::serializationTestObject()
|
||||
return result;
|
||||
}
|
||||
|
||||
double SegmentState::pressure_drop(std::size_t index) const {
|
||||
template<class Scalar>
|
||||
Scalar SegmentState<Scalar>::pressure_drop(std::size_t index) const
|
||||
{
|
||||
return this->pressure_drop_friction[index] + this->pressure_drop_hydrostatic[index] + this->pressure_drop_accel[index];
|
||||
}
|
||||
|
||||
bool SegmentState::empty() const {
|
||||
template<class Scalar>
|
||||
bool SegmentState<Scalar>::empty() const
|
||||
{
|
||||
return this->rates.empty();
|
||||
}
|
||||
|
||||
std::size_t SegmentState::size() const {
|
||||
template<class Scalar>
|
||||
std::size_t SegmentState<Scalar>::size() const
|
||||
{
|
||||
return this->pressure.size();
|
||||
}
|
||||
|
||||
void SegmentState::scale_pressure(const double bhp) {
|
||||
template<class Scalar>
|
||||
void SegmentState<Scalar>::scale_pressure(const Scalar bhp)
|
||||
{
|
||||
if (this->empty())
|
||||
throw std::logic_error("Tried to pressure scale empty SegmentState");
|
||||
|
||||
@ -110,14 +119,18 @@ void SegmentState::scale_pressure(const double bhp) {
|
||||
std::transform(this->pressure.begin(),
|
||||
this->pressure.end(),
|
||||
this->pressure.begin(),
|
||||
[pressure_change] (const double& p) { return p + pressure_change;});
|
||||
[pressure_change] (const Scalar& p) { return p + pressure_change;});
|
||||
}
|
||||
|
||||
const std::vector<int>& SegmentState::segment_number() const {
|
||||
template<class Scalar>
|
||||
const std::vector<int>&
|
||||
SegmentState<Scalar>::segment_number() const
|
||||
{
|
||||
return this->m_segment_number;
|
||||
}
|
||||
|
||||
bool SegmentState::operator==(const SegmentState& rhs) const
|
||||
template<class Scalar>
|
||||
bool SegmentState<Scalar>::operator==(const SegmentState& rhs) const
|
||||
{
|
||||
return this->rates == rhs.rates &&
|
||||
this->dissolved_gas_rate == rhs.dissolved_gas_rate &&
|
||||
@ -134,4 +147,6 @@ bool SegmentState::operator==(const SegmentState& rhs) const
|
||||
this->m_segment_number == rhs.m_segment_number;
|
||||
}
|
||||
|
||||
template class SegmentState<double>;
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -23,14 +23,13 @@
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
namespace Opm {
|
||||
class WellSegments;
|
||||
} // namespace Opm
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
namespace Opm {
|
||||
|
||||
template<class Scalar>
|
||||
class SegmentState
|
||||
{
|
||||
public:
|
||||
@ -39,9 +38,9 @@ public:
|
||||
|
||||
static SegmentState serializationTestObject();
|
||||
|
||||
double pressure_drop(std::size_t index) const;
|
||||
Scalar pressure_drop(std::size_t index) const;
|
||||
bool empty() const;
|
||||
void scale_pressure(double bhp);
|
||||
void scale_pressure(Scalar bhp);
|
||||
|
||||
const std::vector<int>& segment_number() const;
|
||||
std::size_t size() const;
|
||||
@ -66,21 +65,21 @@ public:
|
||||
|
||||
bool operator==(const SegmentState&) const;
|
||||
|
||||
std::vector<double> rates;
|
||||
std::vector<double> dissolved_gas_rate;
|
||||
std::vector<double> vaporized_oil_rate;
|
||||
std::vector<Scalar> rates;
|
||||
std::vector<Scalar> dissolved_gas_rate;
|
||||
std::vector<Scalar> vaporized_oil_rate;
|
||||
|
||||
/// Segment condition volume flow rates through segment (per phase)
|
||||
std::vector<double> phase_resv_rates;
|
||||
std::vector<Scalar> phase_resv_rates;
|
||||
|
||||
/// Segment condition flow velocity through segment (per phase)
|
||||
std::vector<double> phase_velocity;
|
||||
std::vector<Scalar> phase_velocity;
|
||||
|
||||
/// Segment condition holdup fractions through segment (per phase)
|
||||
std::vector<double> phase_holdup;
|
||||
std::vector<Scalar> phase_holdup;
|
||||
|
||||
/// Segment condition phase viscosities.
|
||||
std::vector<double> phase_viscosity;
|
||||
std::vector<Scalar> phase_viscosity;
|
||||
|
||||
/// Segment condition phase densities.
|
||||
///
|
||||
@ -98,12 +97,12 @@ public:
|
||||
/// { p0, p1, ..., (np - 1), mixture, mixture_with_exponents },
|
||||
/// ...
|
||||
/// { p0, p1, ..., (np - 1), mixture, mixture_with_exponents }]
|
||||
std::vector<double> phase_density;
|
||||
std::vector<Scalar> phase_density;
|
||||
|
||||
std::vector<double> pressure;
|
||||
std::vector<double> pressure_drop_friction;
|
||||
std::vector<double> pressure_drop_hydrostatic;
|
||||
std::vector<double> pressure_drop_accel;
|
||||
std::vector<Scalar> pressure;
|
||||
std::vector<Scalar> pressure_drop_friction;
|
||||
std::vector<Scalar> pressure_drop_hydrostatic;
|
||||
std::vector<Scalar> pressure_drop_accel;
|
||||
|
||||
private:
|
||||
std::vector<int> m_segment_number;
|
||||
|
@ -28,13 +28,15 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
SingleWellState::SingleWellState(const std::string& name_,
|
||||
const ParallelWellInfo& pinfo,
|
||||
bool is_producer,
|
||||
double pressure_first_connection,
|
||||
const std::vector<PerforationData>& perf_input,
|
||||
const PhaseUsage& pu_,
|
||||
double temp)
|
||||
template<class Scalar>
|
||||
SingleWellState<Scalar>::
|
||||
SingleWellState(const std::string& name_,
|
||||
const ParallelWellInfo& pinfo,
|
||||
bool is_producer,
|
||||
Scalar pressure_first_connection,
|
||||
const std::vector<PerforationData>& perf_input,
|
||||
const PhaseUsage& pu_,
|
||||
Scalar temp)
|
||||
: name(name_)
|
||||
, parallel_info(pinfo)
|
||||
, producer(is_producer)
|
||||
@ -59,15 +61,19 @@ SingleWellState::SingleWellState(const std::string& name_,
|
||||
}
|
||||
}
|
||||
|
||||
SingleWellState SingleWellState::serializationTestObject(const ParallelWellInfo& pinfo)
|
||||
template<class Scalar>
|
||||
SingleWellState<Scalar> SingleWellState<Scalar>::
|
||||
serializationTestObject(const ParallelWellInfo& pinfo)
|
||||
{
|
||||
SingleWellState result("testing", pinfo, true, 1.0, {}, PhaseUsage{}, 2.0);
|
||||
result.perf_data = PerfData::serializationTestObject();
|
||||
result.perf_data = PerfData<Scalar>::serializationTestObject();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void SingleWellState::init_timestep(const SingleWellState& other) {
|
||||
template<class Scalar>
|
||||
void SingleWellState<Scalar>::init_timestep(const SingleWellState& other)
|
||||
{
|
||||
if (this->producer != other.producer)
|
||||
return;
|
||||
|
||||
@ -82,8 +88,9 @@ void SingleWellState::init_timestep(const SingleWellState& other) {
|
||||
this->temperature = other.temperature;
|
||||
}
|
||||
|
||||
|
||||
void SingleWellState::shut() {
|
||||
template<class Scalar>
|
||||
void SingleWellState<Scalar>::shut()
|
||||
{
|
||||
this->bhp = 0;
|
||||
this->thp = 0;
|
||||
this->status = Well::Status::SHUT;
|
||||
@ -98,16 +105,22 @@ void SingleWellState::shut() {
|
||||
connpi.assign(connpi.size(), 0);
|
||||
}
|
||||
|
||||
void SingleWellState::stop() {
|
||||
template<class Scalar>
|
||||
void SingleWellState<Scalar>::stop()
|
||||
{
|
||||
this->thp = 0;
|
||||
this->status = Well::Status::STOP;
|
||||
}
|
||||
|
||||
void SingleWellState::open() {
|
||||
template<class Scalar>
|
||||
void SingleWellState<Scalar>::open()
|
||||
{
|
||||
this->status = Well::Status::OPEN;
|
||||
}
|
||||
|
||||
void SingleWellState::updateStatus(Well::Status new_status) {
|
||||
template<class Scalar>
|
||||
void SingleWellState<Scalar>::updateStatus(Well::Status new_status)
|
||||
{
|
||||
switch (new_status) {
|
||||
case Well::Status::OPEN:
|
||||
this->open();
|
||||
@ -123,8 +136,11 @@ void SingleWellState::updateStatus(Well::Status new_status) {
|
||||
}
|
||||
}
|
||||
|
||||
void SingleWellState::reset_connection_factors(const std::vector<PerforationData>& new_perf_data) {
|
||||
if (this->perf_data.size() != new_perf_data.size()) {
|
||||
template<class Scalar>
|
||||
void SingleWellState<Scalar>::
|
||||
reset_connection_factors(const std::vector<PerforationData>& new_perf_data)
|
||||
{
|
||||
if (this->perf_data.size() != new_perf_data.size()) {
|
||||
throw std::invalid_argument {
|
||||
"Size mismatch for perforation data in well " + this->name
|
||||
};
|
||||
@ -152,39 +168,52 @@ void SingleWellState::reset_connection_factors(const std::vector<PerforationData
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double SingleWellState::sum_connection_rates(const std::vector<double>& connection_rates) const {
|
||||
template<class Scalar>
|
||||
Scalar SingleWellState<Scalar>::
|
||||
sum_connection_rates(const std::vector<Scalar>& connection_rates) const
|
||||
{
|
||||
return this->parallel_info.get().sumPerfValues(connection_rates.begin(), connection_rates.end());
|
||||
}
|
||||
|
||||
double SingleWellState::sum_brine_rates() const {
|
||||
template<class Scalar>
|
||||
Scalar SingleWellState<Scalar>::sum_brine_rates() const
|
||||
{
|
||||
return this->sum_connection_rates(this->perf_data.brine_rates);
|
||||
}
|
||||
|
||||
|
||||
double SingleWellState::sum_polymer_rates() const {
|
||||
template<class Scalar>
|
||||
Scalar SingleWellState<Scalar>::sum_polymer_rates() const
|
||||
{
|
||||
return this->sum_connection_rates(this->perf_data.polymer_rates);
|
||||
}
|
||||
|
||||
|
||||
double SingleWellState::sum_solvent_rates() const {
|
||||
template<class Scalar>
|
||||
Scalar SingleWellState<Scalar>::sum_solvent_rates() const
|
||||
{
|
||||
return this->sum_connection_rates(this->perf_data.solvent_rates);
|
||||
}
|
||||
|
||||
double SingleWellState::sum_filtrate_rate() const {
|
||||
template<class Scalar>
|
||||
Scalar SingleWellState<Scalar>::sum_filtrate_rate() const
|
||||
{
|
||||
if (this->producer) return 0.;
|
||||
|
||||
return this->sum_connection_rates(this->perf_data.filtrate_data.rates);
|
||||
}
|
||||
|
||||
double SingleWellState::sum_filtrate_total() const {
|
||||
template<class Scalar>
|
||||
Scalar SingleWellState<Scalar>::sum_filtrate_total() const
|
||||
{
|
||||
if (this->producer) return 0.;
|
||||
|
||||
return this->sum_connection_rates(this->perf_data.filtrate_data.total);
|
||||
}
|
||||
|
||||
void SingleWellState::update_producer_targets(const Well& ecl_well, const SummaryState& st) {
|
||||
const double bhp_safety_factor = 0.99;
|
||||
template<class Scalar>
|
||||
void SingleWellState<Scalar>::
|
||||
update_producer_targets(const Well& ecl_well, const SummaryState& st)
|
||||
{
|
||||
constexpr Scalar bhp_safety_factor = 0.99;
|
||||
const auto& prod_controls = ecl_well.productionControls(st);
|
||||
|
||||
auto cmode_is_bhp = (prod_controls.cmode == Well::ProducerCMode::BHP);
|
||||
@ -239,11 +268,13 @@ void SingleWellState::update_producer_targets(const Well& ecl_well, const Summar
|
||||
this->bhp = bhp_limit;
|
||||
else
|
||||
this->bhp = this->perf_data.pressure_first_connection * bhp_safety_factor;
|
||||
|
||||
}
|
||||
|
||||
void SingleWellState::update_injector_targets(const Well& ecl_well, const SummaryState& st) {
|
||||
const double bhp_safety_factor = 1.01;
|
||||
template<class Scalar>
|
||||
void SingleWellState<Scalar>::
|
||||
update_injector_targets(const Well& ecl_well, const SummaryState& st)
|
||||
{
|
||||
const Scalar bhp_safety_factor = 1.01;
|
||||
const auto& inj_controls = ecl_well.injectionControls(st);
|
||||
|
||||
if (inj_controls.hasControl(Well::InjectorCMode::THP))
|
||||
@ -262,7 +293,7 @@ void SingleWellState::update_injector_targets(const Well& ecl_well, const Summar
|
||||
}
|
||||
|
||||
// we initialize all open wells with a rate to avoid singularities
|
||||
double inj_surf_rate = 10.0 * Opm::unit::cubic(Opm::unit::meter) / Opm::unit::day;
|
||||
Scalar inj_surf_rate = 10.0 * Opm::unit::cubic(Opm::unit::meter) / Opm::unit::day;
|
||||
if (inj_controls.cmode == Well::InjectorCMode::RATE) {
|
||||
inj_surf_rate = inj_controls.surface_rate;
|
||||
}
|
||||
@ -291,14 +322,18 @@ void SingleWellState::update_injector_targets(const Well& ecl_well, const Summar
|
||||
this->bhp = this->perf_data.pressure_first_connection * bhp_safety_factor;
|
||||
}
|
||||
|
||||
void SingleWellState::update_targets(const Well& ecl_well, const SummaryState& st) {
|
||||
template<class Scalar>
|
||||
void SingleWellState<Scalar>::
|
||||
update_targets(const Well& ecl_well, const SummaryState& st)
|
||||
{
|
||||
if (this->producer)
|
||||
this->update_producer_targets(ecl_well, st);
|
||||
else
|
||||
this->update_injector_targets(ecl_well, st);
|
||||
}
|
||||
|
||||
bool SingleWellState::operator==(const SingleWellState& rhs) const
|
||||
template<class Scalar>
|
||||
bool SingleWellState<Scalar>::operator==(const SingleWellState& rhs) const
|
||||
{
|
||||
return this->name == rhs.name &&
|
||||
this->status == rhs.status &&
|
||||
@ -323,4 +358,6 @@ bool SingleWellState::operator==(const SingleWellState& rhs) const
|
||||
this->production_cmode == rhs.production_cmode;
|
||||
}
|
||||
|
||||
template class SingleWellState<double>;
|
||||
|
||||
}
|
||||
|
@ -37,15 +37,16 @@ struct PerforationData;
|
||||
class SummaryState;
|
||||
class Well;
|
||||
|
||||
template<class Scalar>
|
||||
class SingleWellState {
|
||||
public:
|
||||
SingleWellState(const std::string& name,
|
||||
const ParallelWellInfo& pinfo,
|
||||
bool is_producer,
|
||||
double presssure_first_connection,
|
||||
Scalar presssure_first_connection,
|
||||
const std::vector<PerforationData>& perf_input,
|
||||
const PhaseUsage& pu,
|
||||
double temp);
|
||||
Scalar temp);
|
||||
|
||||
static SingleWellState serializationTestObject(const ParallelWellInfo& pinfo);
|
||||
|
||||
@ -83,14 +84,14 @@ public:
|
||||
WellStatus status{WellStatus::OPEN};
|
||||
bool producer;
|
||||
PhaseUsage pu;
|
||||
double bhp{0};
|
||||
double thp{0};
|
||||
double temperature{0};
|
||||
Scalar bhp{0};
|
||||
Scalar thp{0};
|
||||
Scalar temperature{0};
|
||||
|
||||
// filtration injection concentration
|
||||
double filtrate_conc{0};
|
||||
Scalar filtrate_conc{0};
|
||||
|
||||
std::array<double,4> phase_mixing_rates{};
|
||||
std::array<Scalar,4> phase_mixing_rates{};
|
||||
enum RateIndices {
|
||||
dissolved_gas = 0,
|
||||
dissolved_gas_in_water = 1,
|
||||
@ -98,16 +99,16 @@ public:
|
||||
vaporized_water = 3
|
||||
};
|
||||
|
||||
std::vector<double> well_potentials;
|
||||
std::vector<double> productivity_index;
|
||||
std::vector<double> implicit_ipr_a;
|
||||
std::vector<double> implicit_ipr_b;
|
||||
std::vector<double> surface_rates;
|
||||
std::vector<double> reservoir_rates;
|
||||
std::vector<double> prev_surface_rates;
|
||||
PerfData perf_data;
|
||||
std::vector<Scalar> well_potentials;
|
||||
std::vector<Scalar> productivity_index;
|
||||
std::vector<Scalar> implicit_ipr_a;
|
||||
std::vector<Scalar> implicit_ipr_b;
|
||||
std::vector<Scalar> surface_rates;
|
||||
std::vector<Scalar> reservoir_rates;
|
||||
std::vector<Scalar> prev_surface_rates;
|
||||
PerfData<Scalar> perf_data;
|
||||
bool trivial_target;
|
||||
SegmentState segments;
|
||||
SegmentState<Scalar> segments;
|
||||
Events events;
|
||||
WellInjectorCMode injection_cmode{WellInjectorCMode::CMODE_UNDEFINED};
|
||||
WellProducerCMode production_cmode{WellProducerCMode::CMODE_UNDEFINED};
|
||||
@ -132,20 +133,17 @@ public:
|
||||
// The sum_xxx_rates() functions sum over all connection rates of pertinent
|
||||
// types. In the case of distributed wells this involves an MPI
|
||||
// communication.
|
||||
double sum_solvent_rates() const;
|
||||
double sum_polymer_rates() const;
|
||||
double sum_brine_rates() const;
|
||||
Scalar sum_solvent_rates() const;
|
||||
Scalar sum_polymer_rates() const;
|
||||
Scalar sum_brine_rates() const;
|
||||
|
||||
double sum_filtrate_rate() const;
|
||||
double sum_filtrate_total() const;
|
||||
Scalar sum_filtrate_rate() const;
|
||||
Scalar sum_filtrate_total() const;
|
||||
|
||||
private:
|
||||
double sum_connection_rates(const std::vector<double>& connection_rates) const;
|
||||
Scalar sum_connection_rates(const std::vector<Scalar>& connection_rates) const;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -143,7 +143,7 @@ namespace Opm
|
||||
|
||||
/// check whether the well equations get converged for this well
|
||||
virtual ConvergenceReport getWellConvergence(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool relax_tolerance) const override;
|
||||
@ -157,50 +157,50 @@ namespace Opm
|
||||
/// xw to update Well State
|
||||
void recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
||||
const BVector& x,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
/// computing the well potentials for group control
|
||||
virtual void computeWellPotentials(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger) /* const */ override;
|
||||
void computeWellPotentials(const Simulator& simulator,
|
||||
const WellState<Scalar>& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger) /* const */ override;
|
||||
|
||||
void updatePrimaryVariables(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual void calculateExplicitQuantities(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
DeferredLogger& deferred_logger) override; // should be const?
|
||||
void calculateExplicitQuantities(const Simulator& simulator,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override; // should be const?
|
||||
|
||||
virtual void updateProductivityIndex(const Simulator& simulator,
|
||||
const WellProdIndexCalculator& wellPICalc,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
void updateProductivityIndex(const Simulator& simulator,
|
||||
const WellProdIndexCalculator& wellPICalc,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
virtual double connectionDensity(const int globalConnIdx,
|
||||
const int openConnIdx) const override;
|
||||
double connectionDensity(const int globalConnIdx,
|
||||
const int openConnIdx) const override;
|
||||
|
||||
virtual void addWellContributions(SparseMatrixAdapter& mat) const override;
|
||||
void addWellContributions(SparseMatrixAdapter& mat) const override;
|
||||
|
||||
virtual void addWellPressureEquations(PressureMatrix& mat,
|
||||
const BVector& x,
|
||||
const int pressureVarIndex,
|
||||
const bool use_well_weights,
|
||||
const WellState& well_state) const override;
|
||||
void addWellPressureEquations(PressureMatrix& mat,
|
||||
const BVector& x,
|
||||
const int pressureVarIndex,
|
||||
const bool use_well_weights,
|
||||
const WellState<Scalar>& well_state) const override;
|
||||
|
||||
// iterate well equations with the specified control until converged
|
||||
bool iterateWellEqWithControl(const Simulator& simulator,
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
// iterate well equations including control switching
|
||||
@ -208,14 +208,14 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool fixed_control = false,
|
||||
const bool fixed_status = false) override;
|
||||
|
||||
/// \brief Wether the Jacobian will also have well contributions in it.
|
||||
virtual bool jacobianContainsWellContributions() const override
|
||||
bool jacobianContainsWellContributions() const override
|
||||
{
|
||||
return this->param_.matrix_add_well_contributions_;
|
||||
}
|
||||
@ -227,28 +227,26 @@ namespace Opm
|
||||
std::vector<double>& potentials,
|
||||
double alq) const;
|
||||
|
||||
void computeWellRatesWithThpAlqProd(
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
std::vector<double>& potentials,
|
||||
double alq) const;
|
||||
void computeWellRatesWithThpAlqProd(const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
std::vector<double>& potentials,
|
||||
double alq) const;
|
||||
|
||||
std::optional<double> computeBhpAtThpLimitProdWithAlq(
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
const double alq_value,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
std::optional<double>
|
||||
computeBhpAtThpLimitProdWithAlq(const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
const double alq_value,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
void updateIPRImplicit(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
virtual void computeWellRatesWithBhp(
|
||||
const Simulator& simulator,
|
||||
const double& bhp,
|
||||
std::vector<double>& well_flux,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
void computeWellRatesWithBhp(const Simulator& simulator,
|
||||
const double& bhp,
|
||||
std::vector<double>& well_flux,
|
||||
DeferredLogger& deferred_logger) const override;
|
||||
|
||||
// NOTE: These cannot be protected since they are used by GasLiftRuntime
|
||||
using Base::phaseUsage;
|
||||
@ -267,23 +265,23 @@ namespace Opm
|
||||
// updating the well_state based on well solution dwells
|
||||
void updateWellState(const SummaryState& summary_state,
|
||||
const BVectorWell& dwells,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
// calculate the properties for the well connections
|
||||
// to calulate the pressure difference between well connections.
|
||||
using WellConnectionProps = typename StdWellEval::StdWellConnections::Properties;
|
||||
void computePropertiesForWellConnectionPressures(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
WellConnectionProps& props) const;
|
||||
|
||||
void computeWellConnectionDensitesPressures(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const WellConnectionProps& props,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void computeWellConnectionPressures(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
template<class Value>
|
||||
@ -323,13 +321,13 @@ namespace Opm
|
||||
std::vector<double> computeWellPotentialWithTHP(
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger,
|
||||
const WellState &well_state) const;
|
||||
const WellState<Scalar>& well_state) const;
|
||||
|
||||
bool computeWellPotentialsImplicit(const Simulator& simulator,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
virtual double getRefDensity() const override;
|
||||
double getRefDensity() const override;
|
||||
|
||||
// get the mobility for specific perforation
|
||||
template<class Value>
|
||||
@ -348,29 +346,29 @@ namespace Opm
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
virtual void assembleWellEqWithoutIteration(const Simulator& simulator,
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
void assembleWellEqWithoutIteration(const Simulator& simulator,
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
void assembleWellEqWithoutIterationImpl(const Simulator& simulator,
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void calculateSinglePerf(const Simulator& simulator,
|
||||
const int perf,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
std::vector<RateVector>& connectionRates,
|
||||
std::vector<EvalWell>& cq_s,
|
||||
EvalWell& water_flux_s,
|
||||
@ -378,13 +376,13 @@ namespace Opm
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
// check whether the well is operable under BHP limit with current reservoir condition
|
||||
void checkOperabilityUnderBHPLimit(const WellState& well_state,
|
||||
void checkOperabilityUnderBHPLimit(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
// check whether the well is operable under THP limit with current reservoir condition
|
||||
void checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) override;
|
||||
|
||||
// updating the inflow based on the current reservoir condition
|
||||
@ -397,7 +395,7 @@ namespace Opm
|
||||
|
||||
// whether the well can produce / inject based on the current well state (bhp)
|
||||
bool canProduceInjectWithCurrentBhp(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
// turn on crossflow to avoid singular well equations
|
||||
@ -433,12 +431,13 @@ namespace Opm
|
||||
|
||||
// handle the extra equations for polymer injectivity study
|
||||
void handleInjectivityEquations(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const int perf,
|
||||
const EvalWell& water_flux_s,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
virtual void updateWaterThroughput(const double dt, WellState& well_state) const override;
|
||||
void updateWaterThroughput(const double dt,
|
||||
WellState<Scalar>& well_state) const override;
|
||||
|
||||
// checking convergence of extra equations, if there are any
|
||||
void checkConvergenceExtraEqs(const std::vector<double>& res,
|
||||
@ -447,20 +446,22 @@ namespace Opm
|
||||
// updating the connectionRates_ related polymer molecular weight
|
||||
void updateConnectionRatePolyMW(const EvalWell& cq_s_poly,
|
||||
const IntensiveQuantities& int_quants,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const int perf,
|
||||
std::vector<RateVector>& connectionRates,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
|
||||
std::optional<double> computeBhpAtThpLimitProd(const WellState& well_state,
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
std::optional<double>
|
||||
computeBhpAtThpLimitProd(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
std::optional<double> computeBhpAtThpLimitInj(const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
std::optional<double>
|
||||
computeBhpAtThpLimitInj(const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
private:
|
||||
Eval connectionRateEnergy(const double maxOilSaturation,
|
||||
|
@ -84,8 +84,8 @@ private:
|
||||
template<class FluidSystem, class Indices>
|
||||
void
|
||||
StandardWellAssemble<FluidSystem,Indices>::
|
||||
assembleControlEq(const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
assembleControlEq(const WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
|
@ -29,13 +29,13 @@ namespace Opm
|
||||
{
|
||||
|
||||
class DeferredLogger;
|
||||
class GroupState;
|
||||
template<class Scalar> class GroupState;
|
||||
class Schedule;
|
||||
template<class Scalar, int numEq> class StandardWellEquations;
|
||||
template<class FluidSystem, class Indices> class StandardWellPrimaryVariables;
|
||||
class SummaryState;
|
||||
template<class FluidSystem> class WellInterfaceFluidSystem;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
//! \brief Class handling assemble of the equation system for StandardWell.
|
||||
template<class FluidSystem, class Indices>
|
||||
@ -52,8 +52,8 @@ public:
|
||||
{}
|
||||
|
||||
//! \brief Assemble control equation.
|
||||
void assembleControlEq(const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
void assembleControlEq(const WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
|
@ -287,7 +287,7 @@ computeDensities(const std::vector<Scalar>& perfComponentRates,
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void StandardWellConnections<FluidSystem,Indices>::
|
||||
computePropertiesForPressures(const WellState& well_state,
|
||||
computePropertiesForPressures(const WellState<Scalar>& well_state,
|
||||
const std::function<Scalar(int,int)>& getTemperature,
|
||||
const std::function<Scalar(int)>& getSaltConcentration,
|
||||
const std::function<int(int)>& pvtRegionIdx,
|
||||
@ -421,7 +421,7 @@ computePropertiesForPressures(const WellState& well_state,
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void StandardWellConnections<FluidSystem,Indices>::
|
||||
computeProperties(const WellState& well_state,
|
||||
computeProperties(const WellState<Scalar>& well_state,
|
||||
const std::function<Scalar(int,int)>& invB,
|
||||
const std::function<Scalar(int,int)>& mobility,
|
||||
const std::function<Scalar(int)>& solventInverseFormationVolumeFactor,
|
||||
|
@ -35,7 +35,7 @@ namespace Opm
|
||||
class DeferredLogger;
|
||||
enum class Phase;
|
||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
class StandardWellConnections
|
||||
@ -54,7 +54,7 @@ public:
|
||||
std::vector<Scalar> surf_dens_perf;
|
||||
};
|
||||
|
||||
void computePropertiesForPressures(const WellState& well_state,
|
||||
void computePropertiesForPressures(const WellState<Scalar>& well_state,
|
||||
const std::function<Scalar(int,int)>& getTemperature,
|
||||
const std::function<Scalar(int)>& getSaltConcentration,
|
||||
const std::function<int(int)>& pvtRegionIdx,
|
||||
@ -63,7 +63,7 @@ public:
|
||||
Properties& props) const;
|
||||
|
||||
//! \brief Compute connection properties (densities, pressure drop, ...)
|
||||
void computeProperties(const WellState& well_state,
|
||||
void computeProperties(const WellState<Scalar>& well_state,
|
||||
const std::function<Scalar(int,int)>& invB,
|
||||
const std::function<Scalar(int,int)>& mobility,
|
||||
const std::function<Scalar(int)>& solventInverseFormationVolumeFactor,
|
||||
|
@ -293,7 +293,7 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
|
||||
const bool use_well_weights,
|
||||
const WellInterfaceGeneric& well,
|
||||
const int bhp_var_index,
|
||||
const WellState& well_state) const
|
||||
const WellState<Scalar>& well_state) const
|
||||
{
|
||||
// This adds pressure quation for cpr
|
||||
// For use_well_weights=true
|
||||
@ -415,7 +415,7 @@ template void StandardWellEquations<double,N>:: \
|
||||
const bool, \
|
||||
const WellInterfaceGeneric&, \
|
||||
const int, \
|
||||
const WellState&) const;
|
||||
const WellState<double>&) const;
|
||||
|
||||
INSTANCE(1)
|
||||
INSTANCE(2)
|
||||
|
@ -40,7 +40,7 @@ template<class Scalar, int numEq> class StandardWellEquationAccess;
|
||||
class WellContributions;
|
||||
#endif
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template<class Scalar, int numEq>
|
||||
class StandardWellEquations
|
||||
@ -117,7 +117,7 @@ public:
|
||||
const bool use_well_weights,
|
||||
const WellInterfaceGeneric& well,
|
||||
const int bhp_var_index,
|
||||
const WellState& well_state) const;
|
||||
const WellState<Scalar>& well_state) const;
|
||||
|
||||
//! \brief Get the number of blocks of the C and B matrices.
|
||||
unsigned int getNumBlocks() const;
|
||||
|
@ -70,7 +70,7 @@ template<class FluidSystem, class Indices>
|
||||
void
|
||||
StandardWellEval<FluidSystem,Indices>::
|
||||
updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
@ -99,7 +99,7 @@ computeAccumWell()
|
||||
template<class FluidSystem, class Indices>
|
||||
ConvergenceReport
|
||||
StandardWellEval<FluidSystem,Indices>::
|
||||
getWellConvergence(const WellState& well_state,
|
||||
getWellConvergence(const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
const double maxResidualAllowed,
|
||||
const double tol_wells,
|
||||
|
@ -36,12 +36,11 @@ namespace Opm
|
||||
|
||||
class ConvergenceReport;
|
||||
class DeferredLogger;
|
||||
class GroupState;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
class WellContributions;
|
||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
class StandardWellEval
|
||||
@ -79,7 +78,7 @@ protected:
|
||||
// computing the accumulation term for later use in well mass equations
|
||||
void computeAccumWell();
|
||||
|
||||
ConvergenceReport getWellConvergence(const WellState& well_state,
|
||||
ConvergenceReport getWellConvergence(const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
const double maxResidualAllowed,
|
||||
const double tol_wells,
|
||||
@ -95,7 +94,7 @@ protected:
|
||||
const bool has_polymermw);
|
||||
|
||||
void updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
|
@ -119,7 +119,7 @@ resize(const int numWellEq)
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
||||
update(const WellState& well_state,
|
||||
update(const WellState<Scalar>& well_state,
|
||||
const bool stop_or_zero_rate_target,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -227,7 +227,7 @@ update(const WellState& well_state,
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
||||
updatePolyMW(const WellState& well_state)
|
||||
updatePolyMW(const WellState<Scalar>& well_state)
|
||||
{
|
||||
if (well_.isInjector()) {
|
||||
const auto& ws = well_state.well(well_.indexOfWell());
|
||||
@ -324,7 +324,7 @@ updateNewtonPolyMW(const BVectorWell& dwells)
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
||||
copyToWellState(WellState& well_state,
|
||||
copyToWellState(WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
static constexpr int Water = BlackoilPhases::Aqua;
|
||||
@ -429,7 +429,7 @@ copyToWellState(WellState& well_state,
|
||||
|
||||
template<class FluidSystem, class Indices>
|
||||
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
||||
copyToWellStatePolyMW(WellState& well_state) const
|
||||
copyToWellStatePolyMW(WellState<Scalar>& well_state) const
|
||||
{
|
||||
if (well_.isInjector()) {
|
||||
auto& ws = well_state.well(well_.indexOfWell());
|
||||
|
@ -34,7 +34,7 @@ namespace Opm
|
||||
|
||||
class DeferredLogger;
|
||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
//! \brief Class holding primary variables for StandardWell.
|
||||
template<class FluidSystem, class Indices>
|
||||
@ -102,12 +102,12 @@ public:
|
||||
int numWellEq() const { return numWellEq_; }
|
||||
|
||||
//! \brief Copy values from well state.
|
||||
void update(const WellState& well_state,
|
||||
void update(const WellState<Scalar>& well_state,
|
||||
const bool stop_or_zero_rate_target,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
//! \brief Copy polymer molecular weigt values from well state.
|
||||
void updatePolyMW(const WellState& well_state);
|
||||
void updatePolyMW(const WellState<Scalar>& well_state);
|
||||
|
||||
//! \brief Update values from newton update vector.
|
||||
void updateNewton(const BVectorWell& dwells,
|
||||
@ -123,10 +123,11 @@ public:
|
||||
void checkFinite(DeferredLogger& deferred_logger) const;
|
||||
|
||||
//! \brief Copy values to well state.
|
||||
void copyToWellState(WellState& well_state, DeferredLogger& deferred_logger) const;
|
||||
void copyToWellState(WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
//! \brief Copy polymer molecular weight values to well state.
|
||||
void copyToWellStatePolyMW(WellState& well_state) const;
|
||||
void copyToWellStatePolyMW(WellState<Scalar>& well_state) const;
|
||||
|
||||
//! \brief Returns scaled volume fraction for a component.
|
||||
EvalWell volumeFractionScaled(const int compIdx) const;
|
||||
|
@ -332,8 +332,8 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// TODO: only_wells should be put back to save some computation
|
||||
@ -358,8 +358,8 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// try to regularize equation if the well does not converge
|
||||
@ -481,7 +481,7 @@ namespace Opm
|
||||
StandardWell<TypeTag>::
|
||||
calculateSinglePerf(const Simulator& simulator,
|
||||
const int perf,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
std::vector<RateVector>& connectionRates,
|
||||
std::vector<EvalWell>& cq_s,
|
||||
EvalWell& water_flux_s,
|
||||
@ -687,7 +687,7 @@ namespace Opm
|
||||
StandardWell<TypeTag>::
|
||||
updateWellState(const SummaryState& summary_state,
|
||||
const BVectorWell& dwells,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||
@ -730,7 +730,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
@ -840,7 +840,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
updateIPRImplicit(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// Compute IPR based on *converged* well-equation:
|
||||
@ -915,7 +915,7 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
checkOperabilityUnderBHPLimit(const WellState& well_state,
|
||||
checkOperabilityUnderBHPLimit(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -985,7 +985,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summaryState = simulator.vanguard().summaryState();
|
||||
@ -1076,7 +1076,7 @@ namespace Opm
|
||||
bool
|
||||
StandardWell<TypeTag>::
|
||||
canProduceInjectWithCurrentBhp(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const double bhp = well_state.well(this->index_of_well_).bhp;
|
||||
@ -1123,7 +1123,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
computePropertiesForWellConnectionPressures(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
WellConnectionProps& props) const
|
||||
{
|
||||
std::function<Scalar(int,int)> getTemperature =
|
||||
@ -1169,7 +1169,7 @@ namespace Opm
|
||||
ConvergenceReport
|
||||
StandardWell<TypeTag>::
|
||||
getWellConvergence(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool relax_tolerance) const
|
||||
@ -1214,7 +1214,7 @@ namespace Opm
|
||||
StandardWell<TypeTag>::
|
||||
updateProductivityIndex(const Simulator& simulator,
|
||||
const WellProdIndexCalculator& wellPICalc,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
auto fluidState = [&simulator, this](const int perf)
|
||||
@ -1289,7 +1289,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
computeWellConnectionDensitesPressures(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const WellConnectionProps& props,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -1331,7 +1331,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
computeWellConnectionPressures(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// 1. Compute properties required by computePressureDelta().
|
||||
@ -1351,7 +1351,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||
@ -1373,7 +1373,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
calculateExplicitQuantities(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
@ -1422,7 +1422,7 @@ namespace Opm
|
||||
StandardWell<TypeTag>::
|
||||
recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
||||
const BVector& x,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||
@ -1498,7 +1498,7 @@ namespace Opm
|
||||
// iterate to get a more accurate well density
|
||||
// create a copy of the well_state to use. If the operability checking is sucessful, we use this one
|
||||
// to replace the original one
|
||||
WellState well_state_copy = simulator.problem().wellModel().wellState();
|
||||
WellState<Scalar> well_state_copy = simulator.problem().wellModel().wellState();
|
||||
const auto& group_state = simulator.problem().wellModel().groupState();
|
||||
|
||||
// Get the current controls.
|
||||
@ -1553,7 +1553,7 @@ namespace Opm
|
||||
StandardWell<TypeTag>::
|
||||
computeWellPotentialWithTHP(const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger,
|
||||
const WellState &well_state) const
|
||||
const WellState<Scalar>& well_state) const
|
||||
{
|
||||
std::vector<double> potentials(this->number_of_phases_, 0.0);
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
@ -1595,7 +1595,7 @@ namespace Opm
|
||||
StandardWell<TypeTag> well_copy(*this);
|
||||
|
||||
// store a copy of the well state, we don't want to update the real well state
|
||||
WellState well_state_copy = simulator.problem().wellModel().wellState();
|
||||
WellState<Scalar> well_state_copy = simulator.problem().wellModel().wellState();
|
||||
const auto& group_state = simulator.problem().wellModel().groupState();
|
||||
auto& ws = well_state_copy.well(this->index_of_well_);
|
||||
|
||||
@ -1694,7 +1694,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
computeWellPotentials(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger) // const
|
||||
{
|
||||
@ -1766,7 +1766,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
updatePrimaryVariables(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||
@ -1875,7 +1875,7 @@ namespace Opm
|
||||
const BVector& weights,
|
||||
const int pressureVarIndex,
|
||||
const bool use_well_weights,
|
||||
const WellState& well_state) const
|
||||
const WellState<Scalar>& well_state) const
|
||||
{
|
||||
this->linSys_.extractCPRPressureMatrix(jacobian,
|
||||
weights,
|
||||
@ -1997,7 +1997,7 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
updateWaterThroughput(const double dt, WellState &well_state) const
|
||||
updateWaterThroughput(const double dt, WellState<Scalar>& well_state) const
|
||||
{
|
||||
if constexpr (Base::has_polymermw) {
|
||||
if (this->isInjector()) {
|
||||
@ -2045,7 +2045,7 @@ namespace Opm
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
handleInjectivityEquations(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const int perf,
|
||||
const EvalWell& water_flux_s,
|
||||
DeferredLogger& deferred_logger)
|
||||
@ -2113,7 +2113,7 @@ namespace Opm
|
||||
StandardWell<TypeTag>::
|
||||
updateConnectionRatePolyMW(const EvalWell& cq_s_poly,
|
||||
const IntensiveQuantities& int_quants,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const int perf,
|
||||
std::vector<RateVector>& connectionRates,
|
||||
DeferredLogger& deferred_logger) const
|
||||
@ -2154,7 +2154,7 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
std::optional<double>
|
||||
StandardWell<TypeTag>::
|
||||
computeBhpAtThpLimitProd(const WellState& well_state,
|
||||
computeBhpAtThpLimitProd(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
@ -2282,8 +2282,8 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const int max_iter = this->param_.max_inner_iter_wells_;
|
||||
@ -2329,8 +2329,8 @@ namespace Opm
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool fixed_control /*false*/,
|
||||
const bool fixed_status /*false*/)
|
||||
|
@ -42,7 +42,7 @@ TargetCalculator::TargetCalculator(const Group::ProductionCMode cmode,
|
||||
const std::vector<double>& resv_coeff,
|
||||
const double group_grat_target_from_sales,
|
||||
const std::string& group_name,
|
||||
const GroupState& group_state,
|
||||
const GroupState<double>& group_state,
|
||||
const bool use_gpmaint)
|
||||
: cmode_(cmode)
|
||||
, pu_(pu)
|
||||
@ -157,7 +157,7 @@ InjectionTargetCalculator::InjectionTargetCalculator(const Group::InjectionCMode
|
||||
const std::vector<double>& resv_coeff,
|
||||
const std::string& group_name,
|
||||
const double sales_target,
|
||||
const GroupState& group_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Phase& injection_phase,
|
||||
const bool use_gpmaint,
|
||||
DeferredLogger& deferred_logger)
|
||||
|
@ -32,7 +32,7 @@ namespace Opm
|
||||
{
|
||||
|
||||
class DeferredLogger;
|
||||
class GroupState;
|
||||
template<class Scalar> class GroupState;
|
||||
struct PhaseUsage;
|
||||
|
||||
namespace WellGroupHelpers
|
||||
@ -48,7 +48,7 @@ namespace WellGroupHelpers
|
||||
const std::vector<double>& resv_coeff,
|
||||
const double group_grat_target_from_sales,
|
||||
const std::string& group_name,
|
||||
const GroupState& group_state,
|
||||
const GroupState<double>& group_state,
|
||||
const bool use_gpmaint);
|
||||
|
||||
template <typename RateType>
|
||||
@ -70,7 +70,7 @@ namespace WellGroupHelpers
|
||||
const std::vector<double>& resv_coeff_;
|
||||
const double group_grat_target_from_sales_;
|
||||
const std::string& group_name_;
|
||||
const GroupState& group_state_;
|
||||
const GroupState<double>& group_state_;
|
||||
bool use_gpmaint_;
|
||||
};
|
||||
|
||||
@ -84,7 +84,7 @@ namespace WellGroupHelpers
|
||||
const std::vector<double>& resv_coeff,
|
||||
const std::string& group_name,
|
||||
const double sales_target,
|
||||
const GroupState& group_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Phase& injection_phase,
|
||||
const bool use_gpmaint,
|
||||
DeferredLogger& deferred_logger);
|
||||
@ -105,7 +105,7 @@ namespace WellGroupHelpers
|
||||
const std::vector<double>& resv_coeff_;
|
||||
const std::string& group_name_;
|
||||
double sales_target_;
|
||||
const GroupState& group_state_;
|
||||
const GroupState<double>& group_state_;
|
||||
bool use_gpmaint_;
|
||||
int pos_;
|
||||
GuideRateModel::Target target_;
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
|
||||
VFPProperties(const std::vector<std::reference_wrapper<const VFPInjTable>>& inj_tables,
|
||||
const std::vector<std::reference_wrapper<const VFPProdTable>>& prod_tables,
|
||||
const WellState& well_state)
|
||||
const WellState<double>& well_state)
|
||||
:well_state_(well_state)
|
||||
{
|
||||
for (const auto& vfpinj : inj_tables)
|
||||
@ -95,7 +95,7 @@ public:
|
||||
private:
|
||||
VFPInjProperties m_inj;
|
||||
VFPProdProperties m_prod;
|
||||
const WellState& well_state_;
|
||||
const WellState<double>& well_state_;
|
||||
|
||||
};
|
||||
|
||||
|
@ -26,33 +26,40 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
WGState::WGState(const PhaseUsage& pu) :
|
||||
template<class Scalar>
|
||||
WGState<Scalar>::WGState(const PhaseUsage& pu) :
|
||||
well_state(pu),
|
||||
group_state(pu.num_phases),
|
||||
well_test_state{}
|
||||
{}
|
||||
|
||||
WGState WGState::serializationTestObject(const ParallelWellInfo& pinfo)
|
||||
template<class Scalar>
|
||||
WGState<Scalar> WGState<Scalar>::
|
||||
serializationTestObject(const ParallelWellInfo& pinfo)
|
||||
{
|
||||
WGState result(PhaseUsage{});
|
||||
result.well_state = WellState::serializationTestObject(pinfo);
|
||||
result.group_state = GroupState::serializationTestObject();
|
||||
result.well_state = WellState<Scalar>::serializationTestObject(pinfo);
|
||||
result.group_state = GroupState<Scalar>::serializationTestObject();
|
||||
result.well_test_state = WellTestState::serializationTestObject();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void WGState::wtest_state(WellTestState wtest_state)
|
||||
template<class Scalar>
|
||||
void WGState<Scalar>::wtest_state(WellTestState wtest_state)
|
||||
{
|
||||
wtest_state.filter_wells( this->well_state.wells() );
|
||||
this->well_test_state = std::move(wtest_state);
|
||||
}
|
||||
|
||||
bool WGState::operator==(const WGState& rhs) const
|
||||
template<class Scalar>
|
||||
bool WGState<Scalar>::operator==(const WGState& rhs) const
|
||||
{
|
||||
return this->well_state == rhs.well_state &&
|
||||
this->group_state == rhs.group_state &&
|
||||
this->well_test_state == rhs.well_test_state;
|
||||
}
|
||||
|
||||
template struct WGState<double>;
|
||||
|
||||
}
|
||||
|
@ -34,15 +34,17 @@ class ParallelWellInfo;
|
||||
|
||||
struct PhaseUsage;
|
||||
|
||||
struct WGState {
|
||||
template<class Scalar>
|
||||
struct WGState
|
||||
{
|
||||
WGState(const PhaseUsage& pu);
|
||||
|
||||
static WGState serializationTestObject(const ParallelWellInfo& pinfo);
|
||||
|
||||
void wtest_state(WellTestState wtest_state);
|
||||
|
||||
WellState well_state;
|
||||
GroupState group_state;
|
||||
WellState<Scalar> well_state;
|
||||
GroupState<Scalar> group_state;
|
||||
WellTestState well_test_state;
|
||||
|
||||
bool operator==(const WGState&) const;
|
||||
|
@ -53,8 +53,8 @@ template<class FluidSystem>
|
||||
template<class EvalWell>
|
||||
void
|
||||
WellAssemble<FluidSystem>::
|
||||
assembleControlEqProd(const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
assembleControlEqProd(const WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const Well::ProductionControls& controls,
|
||||
@ -189,8 +189,8 @@ template<class FluidSystem>
|
||||
template<class EvalWell>
|
||||
void
|
||||
WellAssemble<FluidSystem>::
|
||||
assembleControlEqInj(const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
assembleControlEqInj(const WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const Well::InjectionControls& controls,
|
||||
@ -277,8 +277,8 @@ assembleControlEqInj(const WellState& well_state,
|
||||
|
||||
#define INSTANCE_METHODS(A,...) \
|
||||
template void WellAssemble<A>:: \
|
||||
assembleControlEqProd<__VA_ARGS__>(const WellState&, \
|
||||
const GroupState&, \
|
||||
assembleControlEqProd<__VA_ARGS__>(const WellState<typename A::Scalar>&, \
|
||||
const GroupState<typename A::Scalar>&, \
|
||||
const Schedule&, \
|
||||
const SummaryState&, \
|
||||
const Well::ProductionControls&, \
|
||||
@ -288,8 +288,8 @@ assembleControlEqProd<__VA_ARGS__>(const WellState&, \
|
||||
__VA_ARGS__&, \
|
||||
DeferredLogger&) const; \
|
||||
template void WellAssemble<A>:: \
|
||||
assembleControlEqInj<__VA_ARGS__>(const WellState&, \
|
||||
const GroupState&, \
|
||||
assembleControlEqInj<__VA_ARGS__>(const WellState<typename A::Scalar>&, \
|
||||
const GroupState<typename A::Scalar>&, \
|
||||
const Schedule&, \
|
||||
const SummaryState&, \
|
||||
const Well::InjectionControls&, \
|
||||
|
@ -36,11 +36,11 @@ namespace Opm
|
||||
|
||||
class DeferredLogger;
|
||||
class Group;
|
||||
class GroupState;
|
||||
template<class Scalar> class GroupState;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
template<class FluidSystem> class WellInterfaceFluidSystem;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
struct WellInjectionControls;
|
||||
struct WellProductionControls;
|
||||
|
||||
@ -49,13 +49,14 @@ class WellAssemble {
|
||||
static constexpr int Water = BlackoilPhases::Aqua;
|
||||
static constexpr int Oil = BlackoilPhases::Liquid;
|
||||
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||
using Scalar = typename FluidSystem::Scalar;
|
||||
|
||||
public:
|
||||
WellAssemble(const WellInterfaceFluidSystem<FluidSystem>& well);
|
||||
|
||||
template<class EvalWell>
|
||||
void assembleControlEqProd(const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
void assembleControlEqProd(const WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const WellProductionControls& controls,
|
||||
@ -66,8 +67,8 @@ public:
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
template<class EvalWell>
|
||||
void assembleControlEqInj(const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
void assembleControlEqInj(const WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const WellInjectionControls& controls,
|
||||
|
@ -286,7 +286,7 @@ void WellBhpThpCalculator::updateThp(const double rho,
|
||||
const bool stop_or_zero_rate_target,
|
||||
const std::function<double()>& alq_value,
|
||||
const std::array<unsigned,3>& active,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
@ -327,7 +327,7 @@ void WellBhpThpCalculator::updateThp(const double rho,
|
||||
|
||||
template<class EvalWell>
|
||||
EvalWell WellBhpThpCalculator::
|
||||
calculateBhpFromThp(const WellState& well_state,
|
||||
calculateBhpFromThp(const WellState<double>& well_state,
|
||||
const std::vector<EvalWell>& rates,
|
||||
const Well& well,
|
||||
const SummaryState& summaryState,
|
||||
@ -390,7 +390,7 @@ calculateBhpFromThp(const WellState& well_state,
|
||||
|
||||
double
|
||||
WellBhpThpCalculator::
|
||||
calculateMinimumBhpFromThp(const WellState& well_state,
|
||||
calculateMinimumBhpFromThp(const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const SummaryState& summaryState,
|
||||
const double rho) const
|
||||
@ -867,7 +867,7 @@ bruteForceBracket(const std::function<double(const double)>& eq,
|
||||
}
|
||||
|
||||
bool WellBhpThpCalculator::
|
||||
isStableSolution(const WellState& well_state,
|
||||
isStableSolution(const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const std::vector<double>& rates,
|
||||
const SummaryState& summaryState) const
|
||||
@ -902,7 +902,7 @@ isStableSolution(const WellState& well_state,
|
||||
}
|
||||
|
||||
std::optional<double> WellBhpThpCalculator::
|
||||
estimateStableBhp(const WellState& well_state,
|
||||
estimateStableBhp(const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const std::vector<double>& rates,
|
||||
const double rho,
|
||||
@ -945,7 +945,7 @@ estimateStableBhp(const WellState& well_state,
|
||||
}
|
||||
|
||||
std::pair<double, double> WellBhpThpCalculator::
|
||||
getFloIPR(const WellState& well_state,
|
||||
getFloIPR(const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const SummaryState& summary_state) const
|
||||
{
|
||||
@ -969,7 +969,7 @@ getFloIPR(const WellState& well_state,
|
||||
|
||||
#define INSTANCE(...) \
|
||||
template __VA_ARGS__ WellBhpThpCalculator:: \
|
||||
calculateBhpFromThp<__VA_ARGS__>(const WellState&, \
|
||||
calculateBhpFromThp<__VA_ARGS__>(const WellState<double>&, \
|
||||
const std::vector<__VA_ARGS__>&, \
|
||||
const Well&, \
|
||||
const SummaryState&, \
|
||||
|
@ -36,7 +36,7 @@ class DeferredLogger;
|
||||
class SummaryState;
|
||||
class Well;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
//! \brief Class for computing BHP limits.
|
||||
class WellBhpThpCalculator {
|
||||
@ -86,37 +86,37 @@ public:
|
||||
const bool stop_or_zero_rate_target,
|
||||
const std::function<double()>& alq_value,
|
||||
const std::array<unsigned,3>& active,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
template<class EvalWell>
|
||||
EvalWell calculateBhpFromThp(const WellState& well_state,
|
||||
const std::vector<EvalWell>& rates,
|
||||
const Well& well,
|
||||
const SummaryState& summaryState,
|
||||
const double rho,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
template<class EvalWell>
|
||||
EvalWell calculateBhpFromThp(const WellState<double>& well_state,
|
||||
const std::vector<EvalWell>& rates,
|
||||
const Well& well,
|
||||
const SummaryState& summaryState,
|
||||
const double rho,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
double calculateMinimumBhpFromThp(const WellState& well_state,
|
||||
double calculateMinimumBhpFromThp(const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const SummaryState& summaryState,
|
||||
const double rho) const;
|
||||
const double rho) const;
|
||||
|
||||
bool isStableSolution(const WellState& well_state,
|
||||
bool isStableSolution(const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const std::vector<double>& rates,
|
||||
const SummaryState& summaryState) const;
|
||||
|
||||
std::optional<double>
|
||||
estimateStableBhp (const WellState& well_state,
|
||||
estimateStableBhp (const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const std::vector<double>& rates,
|
||||
const double rho,
|
||||
const SummaryState& summaryState) const;
|
||||
|
||||
std::pair<double, double>
|
||||
getFloIPR(const WellState& well_state,
|
||||
getFloIPR(const WellState<double>& well_state,
|
||||
const Well& well,
|
||||
const SummaryState& summary_state) const;
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace Opm
|
||||
{
|
||||
|
||||
bool WellConstraints::
|
||||
checkIndividualConstraints(SingleWellState& ws,
|
||||
checkIndividualConstraints(SingleWellState<double>& ws,
|
||||
const SummaryState& summaryState,
|
||||
const RateConvFunc& calcReservoirVoidageRates,
|
||||
bool& thp_limit_violated_but_not_switched,
|
||||
@ -70,7 +70,7 @@ checkIndividualConstraints(SingleWellState& ws,
|
||||
}
|
||||
|
||||
Well::InjectorCMode WellConstraints::
|
||||
activeInjectionConstraint(const SingleWellState& ws,
|
||||
activeInjectionConstraint(const SingleWellState<double>& ws,
|
||||
const SummaryState& summaryState,
|
||||
bool& thp_limit_violated_but_not_switched,
|
||||
DeferredLogger& deferred_logger,
|
||||
@ -167,7 +167,7 @@ activeInjectionConstraint(const SingleWellState& ws,
|
||||
}
|
||||
|
||||
Well::ProducerCMode WellConstraints::
|
||||
activeProductionConstraint(const SingleWellState& ws,
|
||||
activeProductionConstraint(const SingleWellState<double>& ws,
|
||||
const SummaryState& summaryState,
|
||||
const RateConvFunc& calcReservoirVoidageRates,
|
||||
bool& thp_limit_violated_but_not_switched,
|
||||
|
@ -37,7 +37,7 @@ namespace Opm
|
||||
class DeferredLogger;
|
||||
using RegionId = int;
|
||||
class Rates;
|
||||
class SingleWellState;
|
||||
template<class Scalar> class SingleWellState;
|
||||
class SummaryState;
|
||||
class WellInterfaceGeneric;
|
||||
enum class WellInjectorCMode;
|
||||
@ -54,7 +54,7 @@ public:
|
||||
std::vector<double>&)>;
|
||||
|
||||
bool
|
||||
checkIndividualConstraints(SingleWellState& ws,
|
||||
checkIndividualConstraints(SingleWellState<double>& ws,
|
||||
const SummaryState& summaryState,
|
||||
const RateConvFunc& calcReservoirVoidageRates,
|
||||
bool& thp_limit_violated_but_not_switched,
|
||||
@ -64,14 +64,14 @@ public:
|
||||
|
||||
private:
|
||||
WellInjectorCMode
|
||||
activeInjectionConstraint(const SingleWellState& ws,
|
||||
activeInjectionConstraint(const SingleWellState<double>& ws,
|
||||
const SummaryState& summaryState,
|
||||
bool& thp_limit_violated_but_not_switched,
|
||||
DeferredLogger& deferred_logger,
|
||||
const std::optional<Well::InjectionControls>& inj_controls = std::nullopt) const;
|
||||
|
||||
WellProducerCMode
|
||||
activeProductionConstraint(const SingleWellState& ws,
|
||||
activeProductionConstraint(const SingleWellState<double>& ws,
|
||||
const SummaryState& summaryState,
|
||||
const RateConvFunc& calcReservoirVoidageRates,
|
||||
bool& thp_limit_violated_but_not_switched,
|
||||
|
@ -34,7 +34,7 @@ namespace Opm
|
||||
{
|
||||
|
||||
void WellConvergence::
|
||||
checkConvergenceControlEq(const WellState& well_state,
|
||||
checkConvergenceControlEq(const WellState<double>& well_state,
|
||||
const Tolerances& tolerances,
|
||||
const double well_control_residual,
|
||||
const bool well_is_stopped,
|
||||
|
@ -31,7 +31,7 @@ namespace Opm
|
||||
class ConvergenceReport;
|
||||
class DeferredLogger;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
class WellConvergence
|
||||
{
|
||||
@ -49,7 +49,7 @@ public:
|
||||
};
|
||||
|
||||
// checking the convergence of the well control equations
|
||||
void checkConvergenceControlEq(const WellState& well_state,
|
||||
void checkConvergenceControlEq(const WellState<double>& well_state,
|
||||
const Tolerances& tolerances,
|
||||
const double well_control_residual,
|
||||
const bool well_is_stopped,
|
||||
|
@ -34,12 +34,13 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
void WellFilterCake::
|
||||
template<class Scalar>
|
||||
void WellFilterCake<Scalar>::
|
||||
updateFiltrationParticleVolume(const WellInterfaceGeneric& well,
|
||||
const double dt,
|
||||
const double conc,
|
||||
const Scalar conc,
|
||||
const std::size_t water_index,
|
||||
WellState& well_state)
|
||||
WellState<Scalar>& well_state)
|
||||
{
|
||||
if (!well.isInjector()) {
|
||||
return;
|
||||
@ -67,17 +68,18 @@ updateFiltrationParticleVolume(const WellInterfaceGeneric& well,
|
||||
const std::size_t np = well_state.numPhases();
|
||||
for (int perf = 0; perf < well.numPerfs(); ++perf) {
|
||||
// not considering the production water
|
||||
const double water_rates = std::max(0., connection_rates[perf * np + water_index]);
|
||||
const double filtrate_rate = water_rates * conc;
|
||||
const Scalar water_rates = std::max(0., connection_rates[perf * np + water_index]);
|
||||
const Scalar filtrate_rate = water_rates * conc;
|
||||
filtration_particle_volume_[perf] += filtrate_rate * dt;
|
||||
ws.perf_data.filtrate_data.rates[perf] = filtrate_rate;
|
||||
ws.perf_data.filtrate_data.total[perf] = filtration_particle_volume_[perf];
|
||||
}
|
||||
}
|
||||
|
||||
void WellFilterCake::
|
||||
template<class Scalar>
|
||||
void WellFilterCake<Scalar>::
|
||||
updateInjFCMult(const WellInterfaceGeneric& well,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (inj_fc_multiplier_.empty()) {
|
||||
@ -92,14 +94,14 @@ updateInjFCMult(const WellInterfaceGeneric& well,
|
||||
const auto& connection = connections[perf_ecl_index];
|
||||
if (well.isInjector() && connection.filterCakeActive()) {
|
||||
const auto& filter_cake = connection.getFilterCake();
|
||||
const double area = connection.getFilterCakeArea();
|
||||
const double poro = filter_cake.poro;
|
||||
const double perm = filter_cake.perm;
|
||||
const double rw = connection.getFilterCakeRadius();
|
||||
const double K = connection.Kh() / connection.connectionLength();
|
||||
const double factor = filter_cake.sf_multiplier;
|
||||
const Scalar area = connection.getFilterCakeArea();
|
||||
const Scalar poro = filter_cake.poro;
|
||||
const Scalar perm = filter_cake.perm;
|
||||
const Scalar rw = connection.getFilterCakeRadius();
|
||||
const Scalar K = connection.Kh() / connection.connectionLength();
|
||||
const Scalar factor = filter_cake.sf_multiplier;
|
||||
// the thickness of the filtration cake
|
||||
const double thickness = filtration_particle_volume_[perf] / (area * (1. - poro));
|
||||
const Scalar thickness = filtration_particle_volume_[perf] / (area * (1. - poro));
|
||||
auto& filtrate_data = perf_data.filtrate_data;
|
||||
filtrate_data.thickness[perf] = thickness;
|
||||
filtrate_data.poro[perf] = poro;
|
||||
@ -107,14 +109,14 @@ updateInjFCMult(const WellInterfaceGeneric& well,
|
||||
filtrate_data.radius[perf] = connection.getFilterCakeRadius();
|
||||
filtrate_data.area_of_flow[perf] = connection.getFilterCakeArea();
|
||||
|
||||
double skin_factor = 0.;
|
||||
Scalar skin_factor = 0.;
|
||||
switch (filter_cake.geometry) {
|
||||
case FilterCake::FilterCakeGeometry::LINEAR: {
|
||||
skin_factor = thickness / rw * K / perm * factor;
|
||||
break;
|
||||
}
|
||||
case FilterCake::FilterCakeGeometry::RADIAL: {
|
||||
const double rc = std::sqrt(rw * rw + 2. * rw * thickness);
|
||||
const Scalar rc = std::sqrt(rw * rw + 2. * rw * thickness);
|
||||
skin_factor = K / perm * std::log(rc / rw) * factor;
|
||||
break;
|
||||
}
|
||||
@ -137,4 +139,6 @@ updateInjFCMult(const WellInterfaceGeneric& well,
|
||||
}
|
||||
}
|
||||
|
||||
template class WellFilterCake<double>;
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -27,33 +27,34 @@ namespace Opm {
|
||||
|
||||
class DeferredLogger;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
//! \brief Class for well calculations related to filter cakes.
|
||||
template<class Scalar>
|
||||
class WellFilterCake {
|
||||
public:
|
||||
//! \brief Update the water injection volume.
|
||||
//! \details Used for calculation related to cake filtration due to injection activity.
|
||||
void updateFiltrationParticleVolume(const WellInterfaceGeneric& well,
|
||||
const double dt,
|
||||
const double conc,
|
||||
const Scalar conc,
|
||||
const std::size_t water_index,
|
||||
WellState& well_state);
|
||||
WellState<Scalar>& well_state);
|
||||
|
||||
//! \brief Update the multiplier for well transmissbility due to cake filtration.
|
||||
void updateInjFCMult(const WellInterfaceGeneric& well,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
//! \brief Returns a const-ref to multipliers.
|
||||
const std::vector<double>& multipliers() const
|
||||
const std::vector<Scalar>& multipliers() const
|
||||
{
|
||||
return inj_fc_multiplier_;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<double> filtration_particle_volume_; //!<// Volume of filtration particles during water injection
|
||||
std::vector<double> inj_fc_multiplier_; //!< Multiplier due to injection filtration cake
|
||||
std::vector<Scalar> filtration_particle_volume_; //!<// Volume of filtration particles during water injection
|
||||
std::vector<Scalar> inj_fc_multiplier_; //!< Multiplier due to injection filtration cake
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -36,8 +36,8 @@ namespace Opm
|
||||
std::pair<bool, double>
|
||||
WellGroupConstraints::
|
||||
checkGroupConstraintsInj(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const double efficiencyFactor,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -94,8 +94,8 @@ checkGroupConstraintsInj(const Group& group,
|
||||
std::pair<bool, double>
|
||||
WellGroupConstraints::
|
||||
checkGroupConstraintsProd(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const double efficiencyFactor,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -124,8 +124,8 @@ checkGroupConstraintsProd(const Group& group,
|
||||
}
|
||||
|
||||
bool WellGroupConstraints::
|
||||
checkGroupConstraints(WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
checkGroupConstraints(WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const RateConvFunc& rateConverter,
|
||||
|
@ -35,13 +35,13 @@ namespace Opm
|
||||
|
||||
class DeferredLogger;
|
||||
class Group;
|
||||
class GroupState;
|
||||
template<class Scalar> class GroupState;
|
||||
enum class InjectorType;
|
||||
using RegionId = int;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
//! \brief Class for computing well group constraints.
|
||||
class WellGroupConstraints {
|
||||
@ -51,8 +51,8 @@ public:
|
||||
|
||||
using RateConvFunc = std::function<void(const RegionId, const int, const std::optional<std::string>&, std::vector<double>&)>;
|
||||
|
||||
bool checkGroupConstraints(WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
bool checkGroupConstraints(WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const RateConvFunc& rateConverter,
|
||||
@ -61,8 +61,8 @@ public:
|
||||
private:
|
||||
std::pair<bool, double>
|
||||
checkGroupConstraintsInj(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const double efficiencyFactor,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
@ -71,8 +71,8 @@ private:
|
||||
|
||||
std::pair<bool, double>
|
||||
checkGroupConstraintsProd(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const double efficiencyFactor,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
|
@ -47,8 +47,8 @@ namespace Opm
|
||||
template<class EvalWell>
|
||||
void WellGroupControls::
|
||||
getGroupInjectionControl(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const InjectorType& injectorType,
|
||||
@ -187,8 +187,8 @@ getGroupInjectionControl(const Group& group,
|
||||
std::optional<double>
|
||||
WellGroupControls::
|
||||
getGroupInjectionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const InjectorType& injectorType,
|
||||
@ -302,8 +302,8 @@ getGroupInjectionTargetRate(const Group& group,
|
||||
|
||||
template<class EvalWell>
|
||||
void WellGroupControls::getGroupProductionControl(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const EvalWell& bhp,
|
||||
@ -409,8 +409,8 @@ void WellGroupControls::getGroupProductionControl(const Group& group,
|
||||
|
||||
double WellGroupControls::
|
||||
getGroupProductionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const RateConvFunc& rateConverter,
|
||||
@ -505,8 +505,8 @@ getGroupProductionTargetRate(const Group& group,
|
||||
#define INSTANCE(...) \
|
||||
template void WellGroupControls:: \
|
||||
getGroupInjectionControl<__VA_ARGS__>(const Group&, \
|
||||
const WellState&, \
|
||||
const GroupState&, \
|
||||
const WellState<double>&, \
|
||||
const GroupState<double>&, \
|
||||
const Schedule&, \
|
||||
const SummaryState&, \
|
||||
const InjectorType&, \
|
||||
@ -518,8 +518,8 @@ getGroupInjectionControl<__VA_ARGS__>(const Group&, \
|
||||
DeferredLogger& deferred_logger) const; \
|
||||
template void WellGroupControls:: \
|
||||
getGroupProductionControl<__VA_ARGS__>(const Group&, \
|
||||
const WellState&, \
|
||||
const GroupState&, \
|
||||
const WellState<double>&, \
|
||||
const GroupState<double>&, \
|
||||
const Schedule&, \
|
||||
const SummaryState&, \
|
||||
const __VA_ARGS__& bhp, \
|
||||
|
@ -34,13 +34,13 @@ namespace Opm
|
||||
|
||||
class DeferredLogger;
|
||||
class Group;
|
||||
class GroupState;
|
||||
template<class Scalar> class GroupState;
|
||||
enum class InjectorType;
|
||||
using RegionId = int;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
class WellInterfaceGeneric;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
//! \brief Class for computing well group controls.
|
||||
class WellGroupControls {
|
||||
@ -52,8 +52,8 @@ public:
|
||||
|
||||
template<class EvalWell>
|
||||
void getGroupInjectionControl(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const InjectorType& injectorType,
|
||||
@ -66,8 +66,8 @@ public:
|
||||
|
||||
std::optional<double>
|
||||
getGroupInjectionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const InjectorType& injectorType,
|
||||
@ -77,8 +77,8 @@ public:
|
||||
|
||||
template<class EvalWell>
|
||||
void getGroupProductionControl(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const EvalWell& bhp,
|
||||
@ -89,8 +89,8 @@ public:
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
double getGroupProductionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const RateConvFunc& rateConverter,
|
||||
|
@ -73,7 +73,7 @@ namespace {
|
||||
double sumWellPhaseRates(bool res_rates,
|
||||
const Opm::Group& group,
|
||||
const Opm::Schedule& schedule,
|
||||
const Opm::WellState& wellState,
|
||||
const Opm::WellState<double>& wellState,
|
||||
const int reportStepIdx,
|
||||
const int phasePos,
|
||||
const bool injector)
|
||||
@ -136,7 +136,7 @@ namespace WellGroupHelpers
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const int reportStepIdx,
|
||||
GroupState& group_state)
|
||||
GroupState<double>& group_state)
|
||||
{
|
||||
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
@ -204,7 +204,7 @@ namespace WellGroupHelpers
|
||||
|
||||
double sumWellSurfaceRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const int reportStepIdx,
|
||||
const int phasePos,
|
||||
const bool injector)
|
||||
@ -214,7 +214,7 @@ namespace WellGroupHelpers
|
||||
|
||||
double sumWellResRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const int reportStepIdx,
|
||||
const int phasePos,
|
||||
const bool injector)
|
||||
@ -224,7 +224,7 @@ namespace WellGroupHelpers
|
||||
|
||||
double sumSolventRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const int reportStepIdx,
|
||||
const bool injector)
|
||||
{
|
||||
@ -269,8 +269,8 @@ namespace WellGroupHelpers
|
||||
const SummaryState& summaryState,
|
||||
const Opm::PhaseUsage& pu,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState<double>& group_state,
|
||||
GuideRate* guideRate,
|
||||
Opm::DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -330,8 +330,8 @@ namespace WellGroupHelpers
|
||||
const bool isInjector,
|
||||
const PhaseUsage& pu,
|
||||
const GuideRate& guide_rate,
|
||||
const WellState& wellState,
|
||||
GroupState& group_state,
|
||||
const WellState<double>& wellState,
|
||||
GroupState<double>& group_state,
|
||||
std::vector<double>& groupTargetReduction)
|
||||
{
|
||||
const int np = wellState.numPhases();
|
||||
@ -467,8 +467,8 @@ namespace WellGroupHelpers
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
bool isInjector,
|
||||
const GroupState& group_state,
|
||||
WellState& wellState) {
|
||||
const GroupState<double>& group_state,
|
||||
WellState<double>& wellState) {
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
bool individual_control = false;
|
||||
if (isInjector) {
|
||||
@ -534,8 +534,8 @@ namespace WellGroupHelpers
|
||||
void updateVREPForGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
GroupState& group_state)
|
||||
const WellState<double>& wellState,
|
||||
GroupState<double>& group_state)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||
@ -558,8 +558,8 @@ namespace WellGroupHelpers
|
||||
void updateReservoirRatesInjectionGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
GroupState& group_state)
|
||||
const WellState<double>& wellState,
|
||||
GroupState<double>& group_state)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||
@ -582,8 +582,8 @@ namespace WellGroupHelpers
|
||||
void updateSurfaceRatesInjectionGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
GroupState& group_state)
|
||||
const WellState<double>& wellState,
|
||||
GroupState<double>& group_state)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||
@ -606,8 +606,8 @@ namespace WellGroupHelpers
|
||||
void updateWellRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellStateNupcol,
|
||||
WellState& wellState)
|
||||
const WellState<double>& wellStateNupcol,
|
||||
WellState<double>& wellState)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||
@ -636,8 +636,8 @@ namespace WellGroupHelpers
|
||||
void updateGroupProductionRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
GroupState& group_state)
|
||||
const WellState<double>& wellState,
|
||||
GroupState<double>& group_state)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||
@ -657,8 +657,8 @@ namespace WellGroupHelpers
|
||||
const int reportStepIdx,
|
||||
const PhaseUsage& pu,
|
||||
const SummaryState& st,
|
||||
const WellState& wellState,
|
||||
GroupState& group_state,
|
||||
const WellState<double>& wellState,
|
||||
GroupState<double>& group_state,
|
||||
bool sum_rank)
|
||||
{
|
||||
const int np = wellState.numPhases();
|
||||
@ -693,8 +693,8 @@ namespace WellGroupHelpers
|
||||
const RegionalValues& regional_values,
|
||||
const int reportStepIdx,
|
||||
const double dt,
|
||||
const WellState& well_state,
|
||||
GroupState& group_state)
|
||||
const WellState<double>& well_state,
|
||||
GroupState<double>& group_state)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||
@ -779,8 +779,8 @@ namespace WellGroupHelpers
|
||||
|
||||
std::map<std::string, double>
|
||||
computeNetworkPressures(const Opm::Network::ExtNetwork& network,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const VFPProdProperties& vfp_prod_props,
|
||||
const Schedule& schedule,
|
||||
const int report_time_step)
|
||||
@ -917,21 +917,25 @@ namespace WellGroupHelpers
|
||||
|
||||
|
||||
GuideRate::RateVector
|
||||
getWellRateVector(const WellState& well_state, const PhaseUsage& pu, const std::string& name)
|
||||
getWellRateVector(const WellState<double>& well_state,
|
||||
const PhaseUsage& pu,
|
||||
const std::string& name)
|
||||
{
|
||||
return getGuideRateVector(well_state.currentWellRates(name), pu);
|
||||
}
|
||||
|
||||
GuideRate::RateVector
|
||||
getProductionGroupRateVector(const GroupState& group_state, const PhaseUsage& pu, const std::string& group_name)
|
||||
getProductionGroupRateVector(const GroupState<double>& group_state,
|
||||
const PhaseUsage& pu,
|
||||
const std::string& group_name)
|
||||
{
|
||||
return getGuideRateVector(group_state.production_rates(group_name), pu);
|
||||
}
|
||||
|
||||
double getGuideRate(const std::string& name,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState<double>& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
const GuideRateModel::Target target,
|
||||
@ -984,8 +988,8 @@ namespace WellGroupHelpers
|
||||
|
||||
double getGuideRateInj(const std::string& name,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState<double>& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
const GuideRateModel::Target target,
|
||||
@ -1035,8 +1039,8 @@ namespace WellGroupHelpers
|
||||
|
||||
|
||||
int groupControlledWells(const Schedule& schedule,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const int report_step,
|
||||
const std::string& group_name,
|
||||
const std::string& always_included_child,
|
||||
@ -1107,8 +1111,8 @@ namespace WellGroupHelpers
|
||||
std::pair<bool, double> checkGroupConstraintsProd(const std::string& name,
|
||||
const std::string& parent,
|
||||
const Group& group,
|
||||
const WellState& wellState,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState<double>& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
const double* rates,
|
||||
@ -1253,8 +1257,8 @@ namespace WellGroupHelpers
|
||||
std::pair<bool, double> checkGroupConstraintsInj(const std::string& name,
|
||||
const std::string& parent,
|
||||
const Group& group,
|
||||
const WellState& wellState,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState<double>& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
const double* rates,
|
||||
@ -1407,7 +1411,7 @@ namespace WellGroupHelpers
|
||||
const Group::ProductionCMode& offendedControl,
|
||||
const PhaseUsage& pu,
|
||||
const Parallel::Communication& comm,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
std::pair<std::optional<std::string>, double> offending_well {std::nullopt, 0.0};
|
||||
@ -1531,8 +1535,8 @@ namespace WellGroupHelpers
|
||||
const PhaseUsage& pu,
|
||||
const int report_step,
|
||||
const double sim_time,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Parallel::Communication& comm,
|
||||
GuideRate* guide_rate,
|
||||
std::vector<double>& pot,
|
||||
@ -1549,8 +1553,8 @@ namespace WellGroupHelpers
|
||||
const PhaseUsage& pu,
|
||||
const int reportStepIdx,
|
||||
const double& simTime,
|
||||
WellState& wellState,
|
||||
const GroupState& group_state,
|
||||
WellState<double>& wellState,
|
||||
const GroupState<double>& group_state,
|
||||
const Parallel::Communication& comm,
|
||||
GuideRate* guideRate,
|
||||
std::vector<double>& pot)
|
||||
@ -1626,7 +1630,7 @@ namespace WellGroupHelpers
|
||||
const PhaseUsage& pu,
|
||||
const int reportStepIdx,
|
||||
const double& simTime,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const Parallel::Communication& comm,
|
||||
GuideRate* guideRate)
|
||||
{
|
||||
@ -1665,8 +1669,8 @@ namespace WellGroupHelpers
|
||||
const AvgPMap&,
|
||||
int,
|
||||
double,
|
||||
const WellState&,
|
||||
GroupState&);
|
||||
const WellState<double>&,
|
||||
GroupState<double>&);
|
||||
template void WellGroupHelpers::setRegionAveragePressureCalculator<AvgP>(const Group&,
|
||||
const Schedule&,
|
||||
const int,
|
||||
|
@ -34,12 +34,12 @@ namespace Opm
|
||||
|
||||
class DeferredLogger;
|
||||
class Group;
|
||||
class GroupState;
|
||||
template<class Scalar> class GroupState;
|
||||
namespace Network { class ExtNetwork; }
|
||||
struct PhaseUsage;
|
||||
class Schedule;
|
||||
class VFPProdProperties;
|
||||
class WellState;
|
||||
template<class Scalar> class WellState;
|
||||
class FieldPropsManager;
|
||||
|
||||
namespace Network { class ExtNetwork; }
|
||||
@ -53,7 +53,7 @@ namespace WellGroupHelpers
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const int reportStepIdx,
|
||||
GroupState& group_state);
|
||||
GroupState<double>& group_state);
|
||||
|
||||
void accumulateGroupEfficiencyFactor(const Group& group,
|
||||
const Schedule& schedule,
|
||||
@ -62,21 +62,21 @@ namespace WellGroupHelpers
|
||||
|
||||
double sumWellSurfaceRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const int reportStepIdx,
|
||||
const int phasePos,
|
||||
const bool injector);
|
||||
|
||||
double sumWellResRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const int reportStepIdx,
|
||||
const int phasePos,
|
||||
const bool injector);
|
||||
|
||||
double sumSolventRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const int reportStepIdx,
|
||||
const bool injector);
|
||||
|
||||
@ -86,8 +86,8 @@ namespace WellGroupHelpers
|
||||
const bool isInjector,
|
||||
const PhaseUsage& pu,
|
||||
const GuideRate& guide_rate,
|
||||
const WellState& wellState,
|
||||
GroupState& group_state,
|
||||
const WellState<double>& wellState,
|
||||
GroupState<double>& group_state,
|
||||
std::vector<double>& groupTargetReduction);
|
||||
|
||||
void updateGuideRates(const Group& group,
|
||||
@ -96,8 +96,8 @@ namespace WellGroupHelpers
|
||||
const PhaseUsage& pu,
|
||||
int report_step,
|
||||
double sim_time,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Parallel::Communication& comm,
|
||||
GuideRate* guide_rate,
|
||||
std::vector<double>& pot,
|
||||
@ -108,8 +108,8 @@ namespace WellGroupHelpers
|
||||
const PhaseUsage& pu,
|
||||
const int reportStepIdx,
|
||||
const double& simTime,
|
||||
WellState& wellState,
|
||||
const GroupState& group_state,
|
||||
WellState<double>& wellState,
|
||||
const GroupState<double>& group_state,
|
||||
const Parallel::Communication& comm,
|
||||
GuideRate* guideRate,
|
||||
std::vector<double>& pot);
|
||||
@ -118,7 +118,7 @@ namespace WellGroupHelpers
|
||||
const PhaseUsage& pu,
|
||||
const int reportStepIdx,
|
||||
const double& simTime,
|
||||
const WellState& wellState,
|
||||
const WellState<double>& wellState,
|
||||
const Parallel::Communication& comm,
|
||||
GuideRate* guideRate);
|
||||
|
||||
@ -127,69 +127,70 @@ namespace WellGroupHelpers
|
||||
const SummaryState& summaryState,
|
||||
const Opm::PhaseUsage& pu,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState<double>& group_state,
|
||||
GuideRate* guideRate,
|
||||
Opm::DeferredLogger& deferred_logger);
|
||||
|
||||
void updateVREPForGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
GroupState& group_state);
|
||||
const WellState<double>& wellState,
|
||||
GroupState<double>& group_state);
|
||||
|
||||
void updateReservoirRatesInjectionGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
GroupState& group_state);
|
||||
const WellState<double>& wellState,
|
||||
GroupState<double>& group_state);
|
||||
|
||||
void updateSurfaceRatesInjectionGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
GroupState& group_state);
|
||||
const WellState<double>& wellState,
|
||||
GroupState<double>& group_state);
|
||||
|
||||
void updateWellRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellStateNupcol,
|
||||
WellState& wellState);
|
||||
const WellState<double>& wellStateNupcol,
|
||||
WellState<double>& wellState);
|
||||
|
||||
void updateGroupProductionRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState,
|
||||
GroupState& group_state);
|
||||
const WellState<double>& wellState,
|
||||
GroupState<double>& group_state);
|
||||
|
||||
void updateWellRatesFromGroupTargetScale(const double scale,
|
||||
const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
bool isInjector,
|
||||
const GroupState& group_state,
|
||||
WellState& wellState);
|
||||
const GroupState<double>& group_state,
|
||||
WellState<double>& wellState);
|
||||
|
||||
void updateREINForGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const PhaseUsage& pu,
|
||||
const SummaryState& st,
|
||||
const WellState& wellState,
|
||||
GroupState& group_state,
|
||||
const WellState<double>& wellState,
|
||||
GroupState<double>& group_state,
|
||||
bool sum_rank);
|
||||
|
||||
|
||||
/// Returns the name of the worst offending well and its fraction (i.e. violated_phase / preferred_phase)
|
||||
std::pair<std::optional<std::string>, double> worstOffendingWell(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const Group::ProductionCMode& offendedControl,
|
||||
const PhaseUsage& pu,
|
||||
const Parallel::Communication& comm,
|
||||
const WellState& wellState,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
/// Returns the name of the worst offending well and its fraction
|
||||
/// (i.e. violated_phase / preferred_phase)
|
||||
std::pair<std::optional<std::string>, double>
|
||||
worstOffendingWell(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const Group::ProductionCMode& offendedControl,
|
||||
const PhaseUsage& pu,
|
||||
const Parallel::Communication& comm,
|
||||
const WellState<double>& wellState,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
template <class RegionalValues>
|
||||
void updateGpMaintTargetForGroups(const Group& group,
|
||||
@ -197,27 +198,31 @@ namespace WellGroupHelpers
|
||||
const RegionalValues& regional_values,
|
||||
const int reportStepIdx,
|
||||
const double dt,
|
||||
const WellState& well_state,
|
||||
GroupState& group_state);
|
||||
const WellState<double>& well_state,
|
||||
GroupState<double>& group_state);
|
||||
|
||||
std::map<std::string, double>
|
||||
computeNetworkPressures(const Opm::Network::ExtNetwork& network,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const VFPProdProperties& vfp_prod_props,
|
||||
const Schedule& schedule,
|
||||
const int report_time_step);
|
||||
|
||||
GuideRate::RateVector
|
||||
getWellRateVector(const WellState& well_state, const PhaseUsage& pu, const std::string& name);
|
||||
getWellRateVector(const WellState<double>& well_state,
|
||||
const PhaseUsage& pu,
|
||||
const std::string& name);
|
||||
|
||||
GuideRate::RateVector
|
||||
getProductionGroupRateVector(const GroupState& group_state, const PhaseUsage& pu, const std::string& group_name);
|
||||
getProductionGroupRateVector(const GroupState<double>& group_state,
|
||||
const PhaseUsage& pu,
|
||||
const std::string& group_name);
|
||||
|
||||
double getGuideRate(const std::string& name,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState<double>& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
const GuideRateModel::Target target,
|
||||
@ -226,8 +231,8 @@ namespace WellGroupHelpers
|
||||
|
||||
double getGuideRateInj(const std::string& name,
|
||||
const Schedule& schedule,
|
||||
const WellState& wellState,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState<double>& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
const GuideRateModel::Target target,
|
||||
@ -235,8 +240,8 @@ namespace WellGroupHelpers
|
||||
const PhaseUsage& pu);
|
||||
|
||||
int groupControlledWells(const Schedule& schedule,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const int report_step,
|
||||
const std::string& group_name,
|
||||
const std::string& always_included_child,
|
||||
@ -247,8 +252,8 @@ namespace WellGroupHelpers
|
||||
std::pair<bool, double> checkGroupConstraintsInj(const std::string& name,
|
||||
const std::string& parent,
|
||||
const Group& group,
|
||||
const WellState& wellState,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState<double>& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
const double* rates,
|
||||
@ -276,8 +281,8 @@ namespace WellGroupHelpers
|
||||
std::pair<bool, double> checkGroupConstraintsProd(const std::string& name,
|
||||
const std::string& parent,
|
||||
const Group& group,
|
||||
const WellState& wellState,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& wellState,
|
||||
const GroupState<double>& group_state,
|
||||
const int reportStepIdx,
|
||||
const GuideRate* guideRate,
|
||||
const double* rates,
|
||||
|
@ -158,32 +158,32 @@ public:
|
||||
virtual void initPrimaryVariablesEvaluation() = 0;
|
||||
|
||||
virtual ConvergenceReport getWellConvergence(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
const std::vector<double>& B_avg,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool relax_tolerance) const = 0;
|
||||
|
||||
virtual void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
void assembleWellEq(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void assembleWellEqWithoutIteration(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
// TODO: better name or further refactoring the function to make it more clear
|
||||
void prepareWellBeforeAssembling(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
|
||||
@ -205,7 +205,7 @@ public:
|
||||
/// xw to update Well State
|
||||
virtual void recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
||||
const BVector& x,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
/// Ax = Ax - C D^-1 B x
|
||||
@ -216,13 +216,13 @@ public:
|
||||
|
||||
// TODO: before we decide to put more information under mutable, this function is not const
|
||||
virtual void computeWellPotentials(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
std::vector<double>& well_potentials,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
virtual void updateWellStateWithTarget(const Simulator& simulator,
|
||||
const GroupState& group_state,
|
||||
WellState& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
virtual void computeWellRatesWithBhpIterations(const Simulator& simulator,
|
||||
@ -231,19 +231,19 @@ public:
|
||||
DeferredLogger& deferred_logger) const = 0;
|
||||
|
||||
bool updateWellStateWithTHPTargetProd(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
enum class IndividualOrGroup { Individual, Group, Both };
|
||||
bool updateWellControl(const Simulator& simulator,
|
||||
const IndividualOrGroup iog,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger) /* const */;
|
||||
|
||||
bool updateWellControlAndStatusLocalIteration(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
const double WQTotal,
|
||||
@ -252,16 +252,16 @@ public:
|
||||
const bool fixed_status = false);
|
||||
|
||||
virtual void updatePrimaryVariables(const SummaryState& summary_state,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
virtual void calculateExplicitQuantities(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) = 0; // should be const?
|
||||
|
||||
virtual void updateProductivityIndex(const Simulator& simulator,
|
||||
const WellProdIndexCalculator& wellPICalc,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const = 0;
|
||||
|
||||
virtual double connectionDensity(const int globalConnIdx,
|
||||
@ -280,7 +280,7 @@ public:
|
||||
const BVector& x,
|
||||
const int pressureVarIndex,
|
||||
const bool use_well_weights,
|
||||
const WellState& well_state) const = 0;
|
||||
const WellState<Scalar>& well_state) const = 0;
|
||||
|
||||
void addCellRates(RateVector& rates, int cellIdx) const;
|
||||
|
||||
@ -290,36 +290,39 @@ public:
|
||||
// Simulator is not const is because that assembleWellEq is non-const Simulator
|
||||
void wellTesting(const Simulator& simulator,
|
||||
const double simulation_time,
|
||||
/* const */ WellState& well_state, const GroupState& group_state, WellTestState& welltest_state,
|
||||
/* const */ WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
WellTestState& welltest_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void checkWellOperability(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
bool gliftBeginTimeStepWellTestIterateWellEquations(
|
||||
const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
const GroupState &group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void gliftBeginTimeStepWellTestUpdateALQ(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
// check whether the well is operable under the current reservoir condition
|
||||
// mostly related to BHP limit and THP limit
|
||||
void updateWellOperability(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
bool updateWellOperabilityFromWellEq(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
// update perforation water throughput based on solved water rate
|
||||
virtual void updateWaterThroughput(const double dt, WellState& well_state) const = 0;
|
||||
virtual void updateWaterThroughput(const double dt,
|
||||
WellState<Scalar>& well_state) const = 0;
|
||||
|
||||
/// Compute well rates based on current reservoir conditions and well variables.
|
||||
/// Used in updateWellStateRates().
|
||||
@ -330,12 +333,12 @@ public:
|
||||
/// If so, that rate is kept as is, but the others are set proportionally
|
||||
/// to the rates returned by computeCurrentWellRates().
|
||||
void updateWellStateRates(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void solveWellEquation(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
const std::vector<RateVector>& connectionRates() const
|
||||
@ -353,11 +356,16 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<double> wellIndex(const int perf, const IntensiveQuantities& intQuants, const double trans_mult, const SingleWellState& ws) const;
|
||||
std::vector<double> wellIndex(const int perf,
|
||||
const IntensiveQuantities& intQuants,
|
||||
const double trans_mult,
|
||||
const SingleWellState<double>& ws) const;
|
||||
|
||||
void updateConnectionDFactor(const Simulator& simulator, SingleWellState& ws) const;
|
||||
void updateConnectionDFactor(const Simulator& simulator,
|
||||
SingleWellState<double>& ws) const;
|
||||
|
||||
void updateConnectionTransmissibilityFactor(const Simulator& simulator, SingleWellState& ws) const;
|
||||
void updateConnectionTransmissibilityFactor(const Simulator& simulator,
|
||||
SingleWellState<double>& ws) const;
|
||||
|
||||
|
||||
protected:
|
||||
@ -386,27 +394,27 @@ protected:
|
||||
const std::vector<double>& compFrac() const;
|
||||
|
||||
std::vector<double> initialWellRateFractions(const Simulator& simulator,
|
||||
const WellState& well_state) const;
|
||||
const WellState<Scalar>& well_state) const;
|
||||
|
||||
// check whether the well is operable under BHP limit with current reservoir condition
|
||||
virtual void checkOperabilityUnderBHPLimit(const WellState& well_state,
|
||||
virtual void checkOperabilityUnderBHPLimit(const WellState<Scalar>& well_state,
|
||||
const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
// check whether the well is operable under THP limit with current reservoir condition
|
||||
virtual void checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
virtual void updateIPR(const Simulator& simulator,
|
||||
DeferredLogger& deferred_logger) const=0;
|
||||
DeferredLogger& deferred_logger) const = 0;
|
||||
|
||||
virtual void assembleWellEqWithoutIteration(const Simulator& simulator,
|
||||
const double dt,
|
||||
const WellInjectionControls& inj_controls,
|
||||
const WellProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
// iterate well equations with the specified control until converged
|
||||
@ -414,58 +422,58 @@ protected:
|
||||
const double dt,
|
||||
const WellInjectionControls& inj_controls,
|
||||
const WellProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
virtual bool iterateWellEqWithSwitching(const Simulator& simulator,
|
||||
const double dt,
|
||||
const WellInjectionControls& inj_controls,
|
||||
const WellProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger,
|
||||
const bool fixed_control = false,
|
||||
const bool fixed_status = false) = 0;
|
||||
|
||||
virtual void updateIPRImplicit(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) = 0;
|
||||
|
||||
bool iterateWellEquations(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
bool solveWellWithTHPConstraint(const Simulator& simulator,
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
std::optional<double> estimateOperableBhp(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
bool solveWellWithBhp(const Simulator& simulator,
|
||||
const double dt,
|
||||
const double bhp,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
bool solveWellWithZeroRate(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
bool solveWellForTesting(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
Eval getPerfCellPressure(const FluidState& fs) const;
|
||||
@ -492,7 +500,7 @@ protected:
|
||||
|
||||
double computeConnectionDFactor(const int perf,
|
||||
const IntensiveQuantities& intQuants,
|
||||
const SingleWellState& ws) const;
|
||||
const SingleWellState<double>& ws) const;
|
||||
|
||||
};
|
||||
|
||||
|
@ -40,9 +40,6 @@
|
||||
#include <opm/simulators/wells/WellGroupHelpers.hpp>
|
||||
#include <opm/simulators/wells/WellState.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
@ -67,7 +64,7 @@ WellInterfaceFluidSystem(const Well& well,
|
||||
template <typename FluidSystem>
|
||||
void
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
calculateReservoirRates(SingleWellState& ws) const
|
||||
calculateReservoirRates(SingleWellState<double>& ws) const
|
||||
{
|
||||
const int np = number_of_phases_;
|
||||
const auto& pu = this->phaseUsage();
|
||||
@ -156,7 +153,7 @@ calculateReservoirRates(SingleWellState& ws) const
|
||||
template <typename FluidSystem>
|
||||
bool
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
checkIndividualConstraints(SingleWellState& ws,
|
||||
checkIndividualConstraints(SingleWellState<double>& ws,
|
||||
const SummaryState& summaryState,
|
||||
DeferredLogger& deferred_logger,
|
||||
const std::optional<Well::InjectionControls>& inj_controls,
|
||||
@ -180,8 +177,8 @@ checkIndividualConstraints(SingleWellState& ws,
|
||||
template <typename FluidSystem>
|
||||
bool
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
checkGroupConstraints(WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
checkGroupConstraints(WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
DeferredLogger& deferred_logger) const
|
||||
@ -207,8 +204,8 @@ checkGroupConstraints(WellState& well_state,
|
||||
template <typename FluidSystem>
|
||||
bool
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
checkConstraints(WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
checkConstraints(WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
DeferredLogger& deferred_logger) const
|
||||
@ -242,8 +239,8 @@ template<typename FluidSystem>
|
||||
std::optional<double>
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
getGroupInjectionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const InjectorType& injectorType,
|
||||
@ -270,12 +267,12 @@ template<typename FluidSystem>
|
||||
double
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
getGroupProductionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
double efficiencyFactor,
|
||||
DeferredLogger& deferred_logger) const
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
double efficiencyFactor,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
auto rCoeff = [this, &group_state](const RegionId id, const int region, const std::optional<std::string>& prod_gname, std::vector<double>& coeff)
|
||||
{
|
||||
|
@ -37,11 +37,11 @@ namespace RateConverter
|
||||
}
|
||||
|
||||
class Group;
|
||||
class GroupState;
|
||||
template<class Scalar> class GroupState;
|
||||
class Schedule;
|
||||
struct RatioLimitCheckReport;
|
||||
class SingleWellState;
|
||||
class WellState;
|
||||
template<class Scalar> class SingleWellState;
|
||||
template<class Scalar> class WellState;
|
||||
|
||||
template<class FluidSystem>
|
||||
class WellInterfaceFluidSystem : public WellInterfaceGeneric {
|
||||
@ -75,30 +75,30 @@ protected:
|
||||
const std::vector<PerforationData>& perf_data);
|
||||
|
||||
// updating the voidage rates in well_state when requested
|
||||
void calculateReservoirRates(SingleWellState& ws) const;
|
||||
void calculateReservoirRates(SingleWellState<double>& ws) const;
|
||||
|
||||
bool checkIndividualConstraints(SingleWellState& ws,
|
||||
bool checkIndividualConstraints(SingleWellState<double>& ws,
|
||||
const SummaryState& summaryState,
|
||||
DeferredLogger& deferred_logger,
|
||||
const std::optional<Well::InjectionControls>& inj_controls = std::nullopt,
|
||||
const std::optional<Well::ProductionControls>& prod_controls = std::nullopt) const;
|
||||
|
||||
bool checkGroupConstraints(WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
bool checkGroupConstraints(WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
bool checkConstraints(WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
bool checkConstraints(WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
std::optional<double>
|
||||
getGroupInjectionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
const InjectorType& injectorType,
|
||||
@ -107,8 +107,8 @@ protected:
|
||||
|
||||
double
|
||||
getGroupProductionTargetRate(const Group& group,
|
||||
const WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const WellState<double>& well_state,
|
||||
const GroupState<double>& group_state,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& summaryState,
|
||||
double efficiencyFactor,
|
||||
|
@ -272,7 +272,7 @@ bool WellInterfaceGeneric::wellHasTHPConstraints(const SummaryState& summaryStat
|
||||
return WellBhpThpCalculator(*this).wellHasTHPConstraints(summaryState);
|
||||
}
|
||||
|
||||
void WellInterfaceGeneric::updateWellTestState(const SingleWellState& ws,
|
||||
void WellInterfaceGeneric::updateWellTestState(const SingleWellState<double>& ws,
|
||||
const double& simulationTime,
|
||||
const bool& writeMessageToOPMLog,
|
||||
WellTestState& wellTestState,
|
||||
@ -349,8 +349,8 @@ void WellInterfaceGeneric::setVFPProperties(const VFPProperties* vfp_properties_
|
||||
vfp_properties_ = vfp_properties_arg;
|
||||
}
|
||||
|
||||
void WellInterfaceGeneric::setPrevSurfaceRates(WellState& well_state,
|
||||
const WellState& prev_well_state) const
|
||||
void WellInterfaceGeneric::setPrevSurfaceRates(WellState<double>& well_state,
|
||||
const WellState<double>& prev_well_state) const
|
||||
{
|
||||
auto& ws = well_state.well(this->index_of_well_);
|
||||
auto& ws_prev = prev_well_state.well(this->index_of_well_);
|
||||
@ -505,7 +505,7 @@ bool WellInterfaceGeneric::thpLimitViolatedButNotSwitched() const
|
||||
return operability_status_.thp_limit_violated_but_not_switched;
|
||||
}
|
||||
|
||||
double WellInterfaceGeneric::getALQ(const WellState& well_state) const
|
||||
double WellInterfaceGeneric::getALQ(const WellState<double>& well_state) const
|
||||
{
|
||||
// no alq for injectors.
|
||||
if (isInjector())
|
||||
@ -514,7 +514,8 @@ double WellInterfaceGeneric::getALQ(const WellState& well_state) const
|
||||
return well_state.getALQ(name());
|
||||
}
|
||||
|
||||
void WellInterfaceGeneric::reportWellSwitching(const SingleWellState& ws, DeferredLogger& deferred_logger) const
|
||||
void WellInterfaceGeneric::reportWellSwitching(const SingleWellState<double> &ws,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
if (well_control_log_.empty())
|
||||
return;
|
||||
@ -533,7 +534,7 @@ void WellInterfaceGeneric::reportWellSwitching(const SingleWellState& ws, Deferr
|
||||
}
|
||||
}
|
||||
|
||||
bool WellInterfaceGeneric::isPressureControlled(const WellState& well_state) const
|
||||
bool WellInterfaceGeneric::isPressureControlled(const WellState<double>& well_state) const
|
||||
{
|
||||
const auto& ws = well_state.well(this->index_of_well_);
|
||||
if (this->isInjector()) {
|
||||
@ -550,7 +551,7 @@ bool WellInterfaceGeneric::isPressureControlled(const WellState& well_state) con
|
||||
|
||||
|
||||
bool WellInterfaceGeneric::wellUnderZeroRateTarget(const SummaryState& summary_state,
|
||||
const WellState& well_state) const
|
||||
const WellState<double>& well_state) const
|
||||
{
|
||||
if (this->isProducer()) { // producers
|
||||
const auto prod_controls = this->well_ecl_.productionControls(summary_state);
|
||||
@ -564,7 +565,7 @@ bool WellInterfaceGeneric::wellUnderZeroRateTarget(const SummaryState& summary_s
|
||||
}
|
||||
|
||||
bool WellInterfaceGeneric::stopppedOrZeroRateTarget(const SummaryState& summary_state,
|
||||
const WellState& well_state) const
|
||||
const WellState<double>& well_state) const
|
||||
{
|
||||
return (this->wellIsStopped() || this->wellUnderZeroRateTarget(summary_state, well_state));
|
||||
|
||||
@ -674,7 +675,7 @@ int WellInterfaceGeneric::polymerInjTable_() const
|
||||
|
||||
std::pair<bool,bool> WellInterfaceGeneric::
|
||||
computeWellPotentials(std::vector<double>& well_potentials,
|
||||
const WellState& well_state)
|
||||
const WellState<double>& well_state)
|
||||
{
|
||||
const int np = this->number_of_phases_;
|
||||
well_potentials.resize(np, 0.0);
|
||||
@ -751,7 +752,7 @@ checkNegativeWellPotentials(std::vector<double>& well_potentials,
|
||||
|
||||
void WellInterfaceGeneric::
|
||||
prepareForPotentialCalculations(const SummaryState& summary_state,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
Well::InjectionControls& inj_controls,
|
||||
Well::ProductionControls& prod_controls) const
|
||||
{
|
||||
|
@ -42,9 +42,8 @@ struct PhaseUsage;
|
||||
class SummaryState;
|
||||
class VFPProperties;
|
||||
class WellTestState;
|
||||
class WellState;
|
||||
class SingleWellState;
|
||||
class GroupState;
|
||||
template<class Scalar> class WellState;
|
||||
template<class Scalar> class SingleWellState;
|
||||
class Group;
|
||||
class Schedule;
|
||||
|
||||
@ -95,7 +94,8 @@ public:
|
||||
void closeCompletions(const WellTestState& wellTestState);
|
||||
|
||||
void setVFPProperties(const VFPProperties* vfp_properties_arg);
|
||||
void setPrevSurfaceRates(WellState& well_state, const WellState& prev_well_state) const;
|
||||
void setPrevSurfaceRates(WellState<double>& well_state,
|
||||
const WellState<double>& prev_well_state) const;
|
||||
void setGuideRate(const GuideRate* guide_rate_arg);
|
||||
void setWellEfficiencyFactor(const double efficiency_factor);
|
||||
void setRepRadiusPerfLength();
|
||||
@ -176,7 +176,7 @@ public:
|
||||
}
|
||||
|
||||
double getTHPConstraint(const SummaryState& summaryState) const;
|
||||
double getALQ(const WellState& well_state) const;
|
||||
double getALQ(const WellState<double>& well_state) const;
|
||||
double wsolvent() const;
|
||||
double rsRvInj() const;
|
||||
|
||||
@ -193,22 +193,22 @@ public:
|
||||
// whether a well is specified with a non-zero and valid VFP table number
|
||||
bool isVFPActive(DeferredLogger& deferred_logger) const;
|
||||
|
||||
void reportWellSwitching(const SingleWellState& ws, DeferredLogger& deferred_logger) const;
|
||||
void reportWellSwitching(const SingleWellState<double>& ws, DeferredLogger& deferred_logger) const;
|
||||
|
||||
bool changedToOpenThisStep() const {
|
||||
return this->changed_to_open_this_step_;
|
||||
}
|
||||
|
||||
void updateWellTestState(const SingleWellState& ws,
|
||||
void updateWellTestState(const SingleWellState<double>& ws,
|
||||
const double& simulationTime,
|
||||
const bool& writeMessageToOPMLog,
|
||||
WellTestState& wellTestState,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
bool isPressureControlled(const WellState& well_state) const;
|
||||
bool isPressureControlled(const WellState<double>& well_state) const;
|
||||
|
||||
bool stopppedOrZeroRateTarget(const SummaryState& summary_state,
|
||||
const WellState& well_state) const;
|
||||
const WellState<double>& well_state) const;
|
||||
|
||||
double wellEfficiencyFactor() const
|
||||
{ return well_efficiency_factor_; }
|
||||
@ -236,18 +236,18 @@ protected:
|
||||
int polymerWaterTable_() const;
|
||||
|
||||
bool wellUnderZeroRateTarget(const SummaryState& summary_state,
|
||||
const WellState& well_state) const;
|
||||
const WellState<double>& well_state) const;
|
||||
|
||||
std::pair<bool,bool>
|
||||
computeWellPotentials(std::vector<double>& well_potentials,
|
||||
const WellState& well_state);
|
||||
const WellState<double>& well_state);
|
||||
|
||||
void checkNegativeWellPotentials(std::vector<double>& well_potentials,
|
||||
const bool checkOperability,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
void prepareForPotentialCalculations(const SummaryState& summary_state,
|
||||
WellState& well_state,
|
||||
WellState<double>& well_state,
|
||||
Well::InjectionControls& inj_controls,
|
||||
Well::ProductionControls& prod_controls) const;
|
||||
|
||||
|
@ -186,8 +186,8 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
updateWellControl(const Simulator& simulator,
|
||||
const IndividualOrGroup iog,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger) /* const */
|
||||
{
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
@ -262,8 +262,8 @@ namespace Opm
|
||||
bool
|
||||
WellInterface<TypeTag>::
|
||||
updateWellControlAndStatusLocalIteration(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
const double wqTotal,
|
||||
@ -347,14 +347,14 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
wellTesting(const Simulator& simulator,
|
||||
const double simulation_time,
|
||||
/* const */ WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
/* const */ WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
WellTestState& well_test_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
deferred_logger.info(" well " + this->name() + " is being tested");
|
||||
|
||||
WellState well_state_copy = well_state;
|
||||
WellState<Scalar> well_state_copy = well_state;
|
||||
auto& ws = well_state_copy.well(this->indexOfWell());
|
||||
|
||||
updateWellStateWithTarget(simulator, group_state, well_state_copy, deferred_logger);
|
||||
@ -445,8 +445,8 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
iterateWellEquations(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
@ -479,9 +479,9 @@ namespace Opm
|
||||
solveWellWithTHPConstraint(const Simulator& simulator,
|
||||
const double dt,
|
||||
const Well::InjectionControls& inj_controls,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
const Well::ProductionControls& prod_controls,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
@ -568,7 +568,7 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
estimateOperableBhp(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const SummaryState& summary_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
@ -592,11 +592,11 @@ namespace Opm
|
||||
solveWellWithBhp(const Simulator& simulator,
|
||||
const double dt,
|
||||
const double bhp,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// Solve a well using single bhp-constraint (but close if not operable under this)
|
||||
auto group_state = GroupState(); // empty group
|
||||
// Solve a well using single bhp-constraint (but close if not operable under this)
|
||||
auto group_state = GroupState<Scalar>(); // empty group
|
||||
auto inj_controls = Well::InjectionControls(0);
|
||||
auto prod_controls = Well::ProductionControls(0);
|
||||
auto& ws = well_state.well(this->index_of_well_);
|
||||
@ -627,14 +627,14 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
solveWellWithZeroRate(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// Solve a well as stopped
|
||||
const auto well_status_orig = this->wellStatus_;
|
||||
this->stopWell();
|
||||
|
||||
auto group_state = GroupState(); // empty group
|
||||
auto group_state = GroupState<Scalar>(); // empty group
|
||||
auto inj_controls = Well::InjectionControls(0);
|
||||
auto prod_controls = Well::ProductionControls(0);
|
||||
const bool converged = this->iterateWellEqWithSwitching(simulator, dt, inj_controls, prod_controls, well_state, group_state, deferred_logger, /*fixed_control*/true, /*fixed_status*/ true);
|
||||
@ -645,11 +645,13 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
bool
|
||||
WellInterface<TypeTag>::
|
||||
solveWellForTesting(const Simulator& simulator, WellState& well_state, const GroupState& group_state,
|
||||
solveWellForTesting(const Simulator& simulator,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// keep a copy of the original well state
|
||||
const WellState well_state0 = well_state;
|
||||
const WellState<Scalar> well_state0 = well_state;
|
||||
const double dt = simulator.timeStepSize();
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
const bool has_thp_limit = this->wellHasTHPConstraints(summary_state);
|
||||
@ -679,15 +681,15 @@ namespace Opm
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
solveWellEquation(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped())
|
||||
return;
|
||||
|
||||
// keep a copy of the original well state
|
||||
const WellState well_state0 = well_state;
|
||||
const WellState<Scalar> well_state0 = well_state;
|
||||
const double dt = simulator.timeStepSize();
|
||||
bool converged = iterateWellEquations(simulator, dt, well_state, group_state, deferred_logger);
|
||||
|
||||
@ -737,8 +739,8 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
assembleWellEq(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
|
||||
@ -754,8 +756,8 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
assembleWellEqWithoutIteration(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
@ -773,8 +775,8 @@ namespace Opm
|
||||
WellInterface<TypeTag>::
|
||||
prepareWellBeforeAssembling(const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
const GroupState& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const bool old_well_operable = this->operability_status_.isOperableAndSolvable();
|
||||
@ -863,7 +865,7 @@ namespace Opm
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
checkWellOperability(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
|
||||
@ -890,8 +892,8 @@ namespace Opm
|
||||
gliftBeginTimeStepWellTestIterateWellEquations(
|
||||
const Simulator& simulator,
|
||||
const double dt,
|
||||
WellState& well_state,
|
||||
const GroupState &group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& well_name = this->name();
|
||||
@ -923,7 +925,7 @@ namespace Opm
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
gliftBeginTimeStepWellTestUpdateALQ(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
@ -967,7 +969,7 @@ namespace Opm
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
updateWellOperability(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (this->param_.local_well_solver_control_switching_) {
|
||||
@ -1003,13 +1005,13 @@ namespace Opm
|
||||
bool
|
||||
WellInterface<TypeTag>::
|
||||
updateWellOperabilityFromWellEq(const Simulator& simulator,
|
||||
const WellState& well_state,
|
||||
const WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// only makes sense if we're using this parameter is true
|
||||
assert(this->param_.local_well_solver_control_switching_);
|
||||
this->operability_status_.resetOperability();
|
||||
WellState well_state_copy = well_state;
|
||||
WellState<Scalar> well_state_copy = well_state;
|
||||
const auto& group_state = simulator.problem().wellModel().groupState();
|
||||
const double dt = simulator.timeStepSize();
|
||||
// equations should be converged at this stage, so only one it is needed
|
||||
@ -1021,8 +1023,8 @@ namespace Opm
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
updateWellStateWithTarget(const Simulator& simulator,
|
||||
const GroupState& group_state,
|
||||
WellState& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
|
||||
@ -1399,7 +1401,8 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
std::vector<double>
|
||||
WellInterface<TypeTag>::
|
||||
initialWellRateFractions(const Simulator& simulator, const WellState& well_state) const
|
||||
initialWellRateFractions(const Simulator& simulator,
|
||||
const WellState<Scalar>& well_state) const
|
||||
{
|
||||
const int np = this->number_of_phases_;
|
||||
std::vector<double> scaling_factor(np);
|
||||
@ -1446,7 +1449,7 @@ namespace Opm
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
updateWellStateRates(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
// Check if the rates of this well only are single-phase, do nothing
|
||||
@ -1494,10 +1497,10 @@ namespace Opm
|
||||
template <typename TypeTag>
|
||||
std::vector<double>
|
||||
WellInterface<TypeTag>::
|
||||
wellIndex(const int perf,
|
||||
const IntensiveQuantities& intQuants,
|
||||
const double trans_mult,
|
||||
const SingleWellState& ws) const
|
||||
wellIndex(const int perf,
|
||||
const IntensiveQuantities& intQuants,
|
||||
const double trans_mult,
|
||||
const SingleWellState<double>& ws) const
|
||||
{
|
||||
// Add a Forchheimer term to the gas phase CTF if the run uses
|
||||
// either of the WDFAC or the WDFACCOR keywords.
|
||||
@ -1572,7 +1575,8 @@ namespace Opm
|
||||
template <typename TypeTag>
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
updateConnectionDFactor(const Simulator& simulator, SingleWellState& ws) const
|
||||
updateConnectionDFactor(const Simulator& simulator,
|
||||
SingleWellState<double>& ws) const
|
||||
{
|
||||
if (! this->well_ecl_.getWDFAC().useDFactor()) {
|
||||
return;
|
||||
@ -1591,9 +1595,9 @@ namespace Opm
|
||||
template <typename TypeTag>
|
||||
double
|
||||
WellInterface<TypeTag>::
|
||||
computeConnectionDFactor(const int perf,
|
||||
const IntensiveQuantities& intQuants,
|
||||
const SingleWellState& ws) const
|
||||
computeConnectionDFactor(const int perf,
|
||||
const IntensiveQuantities& intQuants,
|
||||
const SingleWellState<double>& ws) const
|
||||
{
|
||||
auto rhoGS = [regIdx = this->pvtRegionIdx()]() {
|
||||
return FluidSystem::referenceDensity(FluidSystem::gasPhaseIdx, regIdx);
|
||||
@ -1633,7 +1637,8 @@ namespace Opm
|
||||
template <typename TypeTag>
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
updateConnectionTransmissibilityFactor(const Simulator& simulator, SingleWellState& ws) const
|
||||
updateConnectionTransmissibilityFactor(const Simulator& simulator,
|
||||
SingleWellState<double>& ws) const
|
||||
{
|
||||
auto connCF = [&connIx = std::as_const(ws.perf_data.ecl_index),
|
||||
&conns = this->well_ecl_.getConnections()]
|
||||
@ -1752,7 +1757,7 @@ namespace Opm
|
||||
bool
|
||||
WellInterface<TypeTag>::
|
||||
updateWellStateWithTHPTargetProd(const Simulator& simulator,
|
||||
WellState& well_state,
|
||||
WellState<Scalar>& well_state,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
const auto& summary_state = simulator.vanguard().summaryState();
|
||||
|
@ -126,28 +126,32 @@ void PackUnpackXConn::unpack([[maybe_unused]] const int link,
|
||||
|
||||
namespace Opm {
|
||||
|
||||
WellState::WellState(const ParallelWellInfo& pinfo)
|
||||
template<class Scalar>
|
||||
WellState<Scalar>::WellState(const ParallelWellInfo& pinfo)
|
||||
: phase_usage_{}
|
||||
{
|
||||
wells_.add("test4",
|
||||
SingleWellState{"dummy", pinfo, false, 0.0, {}, phase_usage_, 0.0});
|
||||
SingleWellState<Scalar>{"dummy", pinfo, false, 0.0, {}, phase_usage_, 0.0});
|
||||
}
|
||||
|
||||
WellState WellState::serializationTestObject(const ParallelWellInfo& pinfo)
|
||||
template<class Scalar>
|
||||
WellState<Scalar> WellState<Scalar>::
|
||||
serializationTestObject(const ParallelWellInfo& pinfo)
|
||||
{
|
||||
WellState result(PhaseUsage{});
|
||||
result.alq_state = ALQState::serializationTestObject();
|
||||
result.alq_state = ALQState<Scalar>::serializationTestObject();
|
||||
result.well_rates = {{"test2", {true, {1.0}}}, {"test3", {false, {2.0}}}};
|
||||
result.wells_.add("test4", SingleWellState::serializationTestObject(pinfo));
|
||||
result.wells_.add("test4", SingleWellState<Scalar>::serializationTestObject(pinfo));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void WellState::base_init(const std::vector<double>& cellPressures,
|
||||
const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::base_init(const std::vector<Scalar>& cellPressures,
|
||||
const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
{
|
||||
// clear old name mapping
|
||||
this->wells_.clear();
|
||||
@ -164,13 +168,15 @@ void WellState::base_init(const std::vector<double>& cellPressures,
|
||||
}
|
||||
}
|
||||
|
||||
void WellState::initSingleProducer(const Well& well,
|
||||
const ParallelWellInfo& well_info,
|
||||
double pressure_first_connection,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const SummaryState& summary_state) {
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::initSingleProducer(const Well& well,
|
||||
const ParallelWellInfo& well_info,
|
||||
Scalar pressure_first_connection,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
{
|
||||
const auto& pu = this->phase_usage_;
|
||||
const double temp = 273.15 + 15.56;
|
||||
const Scalar temp = 273.15 + 15.56;
|
||||
|
||||
auto& ws = this->wells_.add(well.name(),
|
||||
SingleWellState{well.name(),
|
||||
@ -191,22 +197,23 @@ void WellState::initSingleProducer(const Well& well,
|
||||
ws.update_producer_targets(well, summary_state);
|
||||
}
|
||||
|
||||
void WellState::initSingleInjector(const Well& well,
|
||||
const ParallelWellInfo& well_info,
|
||||
double pressure_first_connection,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const SummaryState& summary_state) {
|
||||
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::initSingleInjector(const Well& well,
|
||||
const ParallelWellInfo& well_info,
|
||||
Scalar pressure_first_connection,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
{
|
||||
const auto& pu = this->phase_usage_;
|
||||
const double temp = well.temperature();
|
||||
const Scalar temp = well.temperature();
|
||||
|
||||
auto& ws = this->wells_.add(well.name(), SingleWellState{well.name(),
|
||||
well_info,
|
||||
false,
|
||||
pressure_first_connection,
|
||||
well_perf_data,
|
||||
pu,
|
||||
temp});
|
||||
auto& ws = this->wells_.add(well.name(), SingleWellState<Scalar>{well.name(),
|
||||
well_info,
|
||||
false,
|
||||
pressure_first_connection,
|
||||
well_perf_data,
|
||||
pu,
|
||||
temp});
|
||||
|
||||
// the rest of the code needs to executed even if ws.perf_data is empty
|
||||
// as this does not say anything for the whole well if it is distributed.
|
||||
@ -218,13 +225,14 @@ void WellState::initSingleInjector(const Well& well,
|
||||
ws.update_injector_targets(well, summary_state);
|
||||
}
|
||||
|
||||
void WellState::initSingleWell(const std::vector<double>& cellPressures,
|
||||
const Well& well,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const ParallelWellInfo& well_info,
|
||||
const SummaryState& summary_state)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::initSingleWell(const std::vector<Scalar>& cellPressures,
|
||||
const Well& well,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const ParallelWellInfo& well_info,
|
||||
const SummaryState& summary_state)
|
||||
{
|
||||
double pressure_first_connection = -1;
|
||||
Scalar pressure_first_connection = -1;
|
||||
if (!well_perf_data.empty())
|
||||
pressure_first_connection = cellPressures[well_perf_data[0].cell_index];
|
||||
pressure_first_connection = well_info.broadcastFirstPerforationValue(pressure_first_connection);
|
||||
@ -238,14 +246,15 @@ void WellState::initSingleWell(const std::vector<double>& cellPressures,
|
||||
}
|
||||
}
|
||||
|
||||
void WellState::init(const std::vector<double>& cellPressures,
|
||||
const Schedule& schedule,
|
||||
const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
const int report_step,
|
||||
const WellState* prevState,
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::init(const std::vector<Scalar>& cellPressures,
|
||||
const Schedule& schedule,
|
||||
const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
const int report_step,
|
||||
const WellState* prevState,
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
{
|
||||
// call init on base class
|
||||
this->base_init(cellPressures, wells_ecl, parallel_well_info,
|
||||
@ -255,7 +264,7 @@ void WellState::init(const std::vector<double>& cellPressures,
|
||||
wells_ecl);
|
||||
for (const auto& wname : schedule.wellNames(report_step))
|
||||
{
|
||||
well_rates.insert({wname, std::make_pair(false, std::vector<double>(this->numPhases()))});
|
||||
well_rates.insert({wname, std::make_pair(false, std::vector<Scalar>(this->numPhases()))});
|
||||
}
|
||||
for (const auto& winfo: parallel_well_info)
|
||||
{
|
||||
@ -291,7 +300,7 @@ void WellState::init(const std::vector<double>& cellPressures,
|
||||
for (int perf = 0; perf < num_perf_this_well; ++perf) {
|
||||
if (wells_ecl[w].getStatus() == Well::Status::OPEN) {
|
||||
for (int p = 0; p < this->numPhases(); ++p) {
|
||||
perf_data.phase_rates[this->numPhases()*perf + p] = ws.surface_rates[p] / double(global_num_perf_this_well);
|
||||
perf_data.phase_rates[this->numPhases()*perf + p] = ws.surface_rates[p] / Scalar(global_num_perf_this_well);
|
||||
}
|
||||
}
|
||||
perf_data.pressure[perf] = cellPressures[well_perf_data[w][perf].cell_index];
|
||||
@ -318,7 +327,6 @@ void WellState::init(const std::vector<double>& cellPressures,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int w = 0; w < nw; ++w) {
|
||||
switch (wells_ecl[w].getStatus()) {
|
||||
case Well::Status::SHUT:
|
||||
@ -390,7 +398,7 @@ void WellState::init(const std::vector<double>& cellPressures,
|
||||
auto& target_rates = perf_data.phase_rates;
|
||||
for (int perf_index = 0; perf_index < num_perf_this_well; perf_index++) {
|
||||
for (int p = 0; p < np; ++p) {
|
||||
target_rates[perf_index*np + p] = new_well.surface_rates[p] / double(global_num_perf_this_well);
|
||||
target_rates[perf_index*np + p] = new_well.surface_rates[p] / Scalar(global_num_perf_this_well);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -406,19 +414,19 @@ void WellState::init(const std::vector<double>& cellPressures,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
updateWellsDefaultALQ(wells_ecl, summary_state);
|
||||
}
|
||||
|
||||
void WellState::resize(const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
const Schedule& schedule,
|
||||
const bool handle_ms_well,
|
||||
const std::size_t numCells,
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::resize(const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
const Schedule& schedule,
|
||||
const bool handle_ms_well,
|
||||
const std::size_t numCells,
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
{
|
||||
const std::vector<double> tmp(numCells, 0.0); // <- UGLY HACK to pass the size
|
||||
const std::vector<Scalar> tmp(numCells, 0.0); // <- UGLY HACK to pass the size
|
||||
init(tmp, schedule, wells_ecl, parallel_well_info, 0, nullptr, well_perf_data, summary_state);
|
||||
|
||||
if (handle_ms_well) {
|
||||
@ -426,8 +434,9 @@ void WellState::resize(const std::vector<Well>& wells_ecl,
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<double>&
|
||||
WellState::currentWellRates(const std::string& wellName) const
|
||||
template<class Scalar>
|
||||
const std::vector<Scalar>&
|
||||
WellState<Scalar>::currentWellRates(const std::string& wellName) const
|
||||
{
|
||||
auto it = well_rates.find(wellName);
|
||||
|
||||
@ -438,7 +447,8 @@ WellState::currentWellRates(const std::string& wellName) const
|
||||
return it->second.second;
|
||||
}
|
||||
|
||||
void WellState::
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::
|
||||
gatherVectorsOnRoot(const std::vector<data::Connection>& from_connections,
|
||||
std::vector<data::Connection>& to_connections,
|
||||
const Parallel::Communication& comm) const
|
||||
@ -463,9 +473,10 @@ gatherVectorsOnRoot(const std::vector<data::Connection>& from_connections,
|
||||
toOwnerComm.exchange(lineariser);
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
data::Wells
|
||||
WellState::report(const int* globalCellIdxMap,
|
||||
const std::function<bool(const int)>& wasDynamicallyClosed) const
|
||||
WellState<Scalar>::report(const int* globalCellIdxMap,
|
||||
const std::function<bool(const int)>& wasDynamicallyClosed) const
|
||||
{
|
||||
if (this->numWells() == 0) {
|
||||
return {};
|
||||
@ -573,10 +584,11 @@ WellState::report(const int* globalCellIdxMap,
|
||||
return res;
|
||||
}
|
||||
|
||||
void WellState::reportConnections(std::vector<data::Connection>& connections,
|
||||
const PhaseUsage &pu,
|
||||
std::size_t well_index,
|
||||
const int* globalCellIdxMap) const
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::reportConnections(std::vector<data::Connection>& connections,
|
||||
const PhaseUsage &pu,
|
||||
std::size_t well_index,
|
||||
const int* globalCellIdxMap) const
|
||||
{
|
||||
using rt = data::Rates::opt;
|
||||
const auto& ws = this->well(well_index);
|
||||
@ -655,8 +667,9 @@ void WellState::reportConnections(std::vector<data::Connection>& connections,
|
||||
}
|
||||
}
|
||||
|
||||
void WellState::initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||
const WellState* prev_well_state)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||
const WellState* prev_well_state)
|
||||
{
|
||||
// still using the order in wells
|
||||
const int nw = wells_ecl.size();
|
||||
@ -677,7 +690,7 @@ void WellState::initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||
// assuming the order of the perforations in well_ecl is the same with Wells
|
||||
const WellConnections& completion_set = well_ecl.getConnections();
|
||||
// number of segment for this single well
|
||||
ws.segments = SegmentState{np, segment_set};
|
||||
ws.segments = SegmentState<Scalar>{np, segment_set};
|
||||
const int well_nseg = segment_set.size();
|
||||
int n_activeperf = 0;
|
||||
|
||||
@ -728,7 +741,7 @@ void WellState::initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||
}
|
||||
|
||||
const auto& perf_rates = perf_data.phase_rates;
|
||||
std::vector<double> perforation_rates(perf_rates.begin(), perf_rates.end());
|
||||
std::vector<Scalar> perforation_rates(perf_rates.begin(), perf_rates.end());
|
||||
|
||||
calculateSegmentRates(segment_inlets, segment_perforations, perforation_rates, np, 0 /* top segment */, ws.segments.rates);
|
||||
// for the segment pressure, the segment pressure is the same with the first perforation belongs to the segment
|
||||
@ -784,12 +797,13 @@ void WellState::initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WellState::calculateSegmentRates(const std::vector<std::vector<int>>& segment_inlets,
|
||||
const std::vector<std::vector<int>>& segment_perforations,
|
||||
const std::vector<double>& perforation_rates,
|
||||
const int np, const int segment,
|
||||
std::vector<double>& segment_rates)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::
|
||||
calculateSegmentRates(const std::vector<std::vector<int>>& segment_inlets,
|
||||
const std::vector<std::vector<int>>& segment_perforations,
|
||||
const std::vector<Scalar>& perforation_rates,
|
||||
const int np, const int segment,
|
||||
std::vector<Scalar>& segment_rates)
|
||||
{
|
||||
// the rate of the segment equals to the sum of the contribution from the perforations and inlet segment rates.
|
||||
// the first segment is always the top segment, its rates should be equal to the well rates.
|
||||
@ -812,31 +826,36 @@ WellState::calculateSegmentRates(const std::vector<std::vector<int>>& segment_in
|
||||
}
|
||||
}
|
||||
|
||||
void WellState::stopWell(int well_index)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::stopWell(int well_index)
|
||||
{
|
||||
auto& ws = this->well(well_index);
|
||||
ws.stop();
|
||||
}
|
||||
|
||||
void WellState::openWell(int well_index)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::openWell(int well_index)
|
||||
{
|
||||
auto& ws = this->well(well_index);
|
||||
ws.open();
|
||||
}
|
||||
|
||||
void WellState::shutWell(int well_index)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::shutWell(int well_index)
|
||||
{
|
||||
auto& ws = this->well(well_index);
|
||||
ws.shut();
|
||||
}
|
||||
|
||||
void WellState::updateStatus(int well_index, WellStatus status)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::updateStatus(int well_index, WellStatus status)
|
||||
{
|
||||
auto& ws = this->well(well_index);
|
||||
ws.updateStatus(status);
|
||||
}
|
||||
|
||||
void WellState::communicateGroupRates(const Parallel::Communication& comm)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::communicateGroupRates(const Parallel::Communication& comm)
|
||||
{
|
||||
// Compute the size of the data.
|
||||
std::size_t sz = 0;
|
||||
@ -848,9 +867,8 @@ void WellState::communicateGroupRates(const Parallel::Communication& comm)
|
||||
}
|
||||
sz += this->alq_state.pack_size();
|
||||
|
||||
|
||||
// Make a vector and collect all data into it.
|
||||
std::vector<double> data(sz);
|
||||
std::vector<Scalar> data(sz);
|
||||
std::size_t pos = 0;
|
||||
for (const auto& [_, owner_rates] : this->well_rates) {
|
||||
(void)_;
|
||||
@ -884,7 +902,8 @@ void WellState::communicateGroupRates(const Parallel::Communication& comm)
|
||||
assert(pos == sz);
|
||||
}
|
||||
|
||||
void WellState::updateGlobalIsGrup(const Parallel::Communication& comm)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::updateGlobalIsGrup(const Parallel::Communication& comm)
|
||||
{
|
||||
this->global_well_info.value().clear();
|
||||
for (std::size_t well_index = 0; well_index < this->size(); well_index++) {
|
||||
@ -897,10 +916,11 @@ void WellState::updateGlobalIsGrup(const Parallel::Communication& comm)
|
||||
this->global_well_info.value().communicate(comm);
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
data::Segment
|
||||
WellState::reportSegmentResults(const int well_id,
|
||||
const int seg_ix,
|
||||
const int seg_no) const
|
||||
WellState<Scalar>::reportSegmentResults(const int well_id,
|
||||
const int seg_ix,
|
||||
const int seg_no) const
|
||||
{
|
||||
using PhaseQuant = data::SegmentPhaseQuantity::Item;
|
||||
using PhaseDensity = data::SegmentPhaseDensity::Item;
|
||||
@ -976,8 +996,9 @@ WellState::reportSegmentResults(const int well_id,
|
||||
return seg_res;
|
||||
}
|
||||
|
||||
bool WellState::wellIsOwned(std::size_t well_index,
|
||||
[[maybe_unused]] const std::string& wellName) const
|
||||
template<class Scalar>
|
||||
bool WellState<Scalar>::wellIsOwned(std::size_t well_index,
|
||||
[[maybe_unused]] const std::string& wellName) const
|
||||
{
|
||||
const auto& well_info = this->parallelWellInfo(well_index);
|
||||
assert(well_info.name() == wellName);
|
||||
@ -985,7 +1006,8 @@ bool WellState::wellIsOwned(std::size_t well_index,
|
||||
return well_info.isOwner();
|
||||
}
|
||||
|
||||
bool WellState::wellIsOwned(const std::string& wellName) const
|
||||
template<class Scalar>
|
||||
bool WellState<Scalar>::wellIsOwned(const std::string& wellName) const
|
||||
{
|
||||
const auto& well_index = this->index(wellName);
|
||||
if (!well_index.has_value()) {
|
||||
@ -996,7 +1018,10 @@ bool WellState::wellIsOwned(const std::string& wellName) const
|
||||
return wellIsOwned(well_index.value(), wellName);
|
||||
}
|
||||
|
||||
void WellState::updateWellsDefaultALQ(const std::vector<Well>& wells_ecl, const SummaryState& summary_state)
|
||||
template<class Scalar>
|
||||
void WellState<Scalar>::
|
||||
updateWellsDefaultALQ(const std::vector<Well>& wells_ecl,
|
||||
const SummaryState& summary_state)
|
||||
{
|
||||
const int nw = wells_ecl.size();
|
||||
for (int i = 0; i<nw; i++) {
|
||||
@ -1009,18 +1034,23 @@ void WellState::updateWellsDefaultALQ(const std::vector<Well>& wells_ecl, const
|
||||
}
|
||||
}
|
||||
|
||||
bool WellState::operator==(const WellState& rhs) const
|
||||
template<class Scalar>
|
||||
bool WellState<Scalar>::operator==(const WellState& rhs) const
|
||||
{
|
||||
return this->alq_state == rhs.alq_state &&
|
||||
this->well_rates == rhs.well_rates &&
|
||||
this->wells_ == rhs.wells_;
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
const ParallelWellInfo&
|
||||
WellState::parallelWellInfo(std::size_t well_index) const
|
||||
WellState<Scalar>::parallelWellInfo(std::size_t well_index) const
|
||||
{
|
||||
const auto& ws = this->well(well_index);
|
||||
return ws.parallel_info;
|
||||
}
|
||||
|
||||
|
||||
template class WellState<double>;
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -57,6 +57,7 @@ enum class WellStatus;
|
||||
|
||||
/// The state of a set of wells, tailored for use by the fully
|
||||
/// implicit blackoil simulator.
|
||||
template<class Scalar>
|
||||
class WellState
|
||||
{
|
||||
public:
|
||||
@ -75,15 +76,16 @@ public:
|
||||
|
||||
static WellState serializationTestObject(const ParallelWellInfo& pinfo);
|
||||
|
||||
std::size_t size() const {
|
||||
std::size_t size() const
|
||||
{
|
||||
return this->wells_.size();
|
||||
}
|
||||
|
||||
std::vector<std::string> wells() const {
|
||||
std::vector<std::string> wells() const
|
||||
{
|
||||
return this->wells_.wells();
|
||||
}
|
||||
|
||||
|
||||
int numWells() const
|
||||
{
|
||||
return this->size();
|
||||
@ -91,12 +93,10 @@ public:
|
||||
|
||||
const ParallelWellInfo& parallelWellInfo(std::size_t well_index) const;
|
||||
|
||||
|
||||
|
||||
/// Allocate and initialize if wells is non-null. Also tries
|
||||
/// to give useful initial values to the bhp(), wellRates()
|
||||
/// and perfPhaseRatesORG() fields, depending on controls
|
||||
void init(const std::vector<double>& cellPressures,
|
||||
void init(const std::vector<Scalar>& cellPressures,
|
||||
const Schedule& schedule,
|
||||
const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
@ -113,15 +113,18 @@ public:
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state);
|
||||
|
||||
void setCurrentWellRates(const std::string& wellName, const std::vector<double>& new_rates ) {
|
||||
void setCurrentWellRates(const std::string& wellName,
|
||||
const std::vector<Scalar>& new_rates)
|
||||
{
|
||||
auto& [owner, rates] = this->well_rates.at(wellName);
|
||||
if (owner)
|
||||
rates = new_rates;
|
||||
}
|
||||
|
||||
const std::vector<double>& currentWellRates(const std::string& wellName) const;
|
||||
const std::vector<Scalar>& currentWellRates(const std::string& wellName) const;
|
||||
|
||||
bool hasWellRates(const std::string& wellName) const {
|
||||
bool hasWellRates(const std::string& wellName) const
|
||||
{
|
||||
return this->well_rates.find(wellName) != this->well_rates.end();
|
||||
}
|
||||
|
||||
@ -130,15 +133,16 @@ public:
|
||||
this->well_rates.clear();
|
||||
}
|
||||
|
||||
void gatherVectorsOnRoot(const std::vector< data::Connection >& from_connections,
|
||||
std::vector< data::Connection >& to_connections,
|
||||
void gatherVectorsOnRoot(const std::vector<data::Connection>& from_connections,
|
||||
std::vector<data::Connection>& to_connections,
|
||||
const Parallel::Communication& comm) const;
|
||||
|
||||
data::Wells
|
||||
report(const int* globalCellIdxMap,
|
||||
const std::function<bool(const int)>& wasDynamicallyClosed) const;
|
||||
|
||||
void reportConnections(std::vector<data::Connection>& connections, const PhaseUsage &pu,
|
||||
void reportConnections(std::vector<data::Connection>& connections,
|
||||
const PhaseUsage &pu,
|
||||
std::size_t well_index,
|
||||
const int* globalCellIdxMap) const;
|
||||
|
||||
@ -146,61 +150,75 @@ public:
|
||||
void initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||
const WellState* prev_well_state);
|
||||
|
||||
static void calculateSegmentRates(const std::vector<std::vector<int>>& segment_inlets, const std::vector<std::vector<int>>&segment_perforations,
|
||||
const std::vector<double>& perforation_rates, const int np, const int segment, std::vector<double>& segment_rates);
|
||||
static void calculateSegmentRates(const std::vector<std::vector<int>>& segment_inlets, const
|
||||
std::vector<std::vector<int>>& segment_perforations,
|
||||
const std::vector<Scalar>& perforation_rates,
|
||||
const int np,
|
||||
const int segment,
|
||||
std::vector<Scalar>& segment_rates);
|
||||
|
||||
|
||||
void communicateGroupRates(const Parallel::Communication& comm);
|
||||
|
||||
void updateGlobalIsGrup(const Parallel::Communication& comm);
|
||||
|
||||
bool isInjectionGrup(const std::string& name) const {
|
||||
bool isInjectionGrup(const std::string& name) const
|
||||
{
|
||||
return this->global_well_info.value().in_injecting_group(name);
|
||||
}
|
||||
|
||||
bool isProductionGrup(const std::string& name) const {
|
||||
bool isProductionGrup(const std::string& name) const
|
||||
{
|
||||
return this->global_well_info.value().in_producing_group(name);
|
||||
}
|
||||
|
||||
double getALQ( const std::string& name) const
|
||||
Scalar getALQ(const std::string& name) const
|
||||
{
|
||||
return this->alq_state.get(name);
|
||||
}
|
||||
|
||||
void setALQ( const std::string& name, double value)
|
||||
void setALQ(const std::string& name, Scalar value)
|
||||
{
|
||||
this->alq_state.set(name, value);
|
||||
}
|
||||
|
||||
int gliftGetDebugCounter() {
|
||||
int gliftGetDebugCounter()
|
||||
{
|
||||
return this->alq_state.get_debug_counter();
|
||||
}
|
||||
|
||||
void gliftSetDebugCounter(int value) {
|
||||
void gliftSetDebugCounter(int value)
|
||||
{
|
||||
return this->alq_state.set_debug_counter(value);
|
||||
}
|
||||
|
||||
int gliftUpdateDebugCounter() {
|
||||
int gliftUpdateDebugCounter()
|
||||
{
|
||||
return this->alq_state.update_debug_counter();
|
||||
}
|
||||
|
||||
bool gliftCheckAlqOscillation(const std::string &name) const {
|
||||
bool gliftCheckAlqOscillation(const std::string &name) const
|
||||
{
|
||||
return this->alq_state.oscillation(name);
|
||||
}
|
||||
|
||||
int gliftGetAlqDecreaseCount(const std::string &name) {
|
||||
int gliftGetAlqDecreaseCount(const std::string &name)
|
||||
{
|
||||
return this->alq_state.get_decrement_count(name);
|
||||
}
|
||||
|
||||
int gliftGetAlqIncreaseCount(const std::string &name) {
|
||||
int gliftGetAlqIncreaseCount(const std::string &name)
|
||||
{
|
||||
return this->alq_state.get_increment_count(name);
|
||||
}
|
||||
|
||||
void gliftUpdateAlqIncreaseCount(const std::string &name, bool increase) {
|
||||
void gliftUpdateAlqIncreaseCount(const std::string &name, bool increase)
|
||||
{
|
||||
this->alq_state.update_count(name, increase);
|
||||
}
|
||||
|
||||
void gliftTimeStepInit() {
|
||||
void gliftTimeStepInit()
|
||||
{
|
||||
this->alq_state.reset_count();
|
||||
}
|
||||
|
||||
@ -208,13 +226,16 @@ public:
|
||||
// reset current_alq and update default_alq. ALQ is used for
|
||||
// constant lift gas injection and for gas lift optimization
|
||||
// (THP controlled wells).
|
||||
void updateWellsDefaultALQ(const std::vector<Well>& wells_ecl, const SummaryState& summary_state);
|
||||
void updateWellsDefaultALQ(const std::vector<Well>& wells_ecl,
|
||||
const SummaryState& summary_state);
|
||||
|
||||
int wellNameToGlobalIdx(const std::string &name) {
|
||||
int wellNameToGlobalIdx(const std::string& name)
|
||||
{
|
||||
return this->global_well_info.value().well_index(name);
|
||||
}
|
||||
|
||||
std::string globalIdxToWellName(const int index) {
|
||||
std::string globalIdxToWellName(const int index)
|
||||
{
|
||||
return this->global_well_info.value().well_name(index);
|
||||
}
|
||||
|
||||
@ -235,55 +256,69 @@ public:
|
||||
return this->phase_usage_.num_phases;
|
||||
}
|
||||
|
||||
const PhaseUsage& phaseUsage() const {
|
||||
const PhaseUsage& phaseUsage() const
|
||||
{
|
||||
return this->phase_usage_;
|
||||
}
|
||||
|
||||
/// One rate per well and phase.
|
||||
std::vector<double>& wellRates(std::size_t well_index) { return this->wells_[well_index].surface_rates; }
|
||||
const std::vector<double>& wellRates(std::size_t well_index) const { return this->wells_[well_index].surface_rates; }
|
||||
std::vector<Scalar>& wellRates(std::size_t well_index)
|
||||
{ return this->wells_[well_index].surface_rates; }
|
||||
const std::vector<Scalar>& wellRates(std::size_t well_index) const
|
||||
{ return this->wells_[well_index].surface_rates; }
|
||||
|
||||
const std::string& name(std::size_t well_index) const {
|
||||
const std::string& name(std::size_t well_index) const
|
||||
{
|
||||
return this->wells_.well_name(well_index);
|
||||
}
|
||||
|
||||
std::optional<std::size_t> index(const std::string& well_name) const {
|
||||
std::optional<std::size_t> index(const std::string& well_name) const
|
||||
{
|
||||
return this->wells_.well_index(well_name);
|
||||
}
|
||||
|
||||
const SingleWellState& operator[](std::size_t well_index) const {
|
||||
const SingleWellState<Scalar>& operator[](std::size_t well_index) const
|
||||
{
|
||||
return this->wells_[well_index];
|
||||
}
|
||||
|
||||
const SingleWellState& operator[](const std::string& well_name) const {
|
||||
const SingleWellState<Scalar>& operator[](const std::string& well_name) const
|
||||
{
|
||||
return this->wells_[well_name];
|
||||
}
|
||||
|
||||
SingleWellState& operator[](std::size_t well_index) {
|
||||
SingleWellState<Scalar>& operator[](std::size_t well_index)
|
||||
{
|
||||
return this->wells_[well_index];
|
||||
}
|
||||
|
||||
SingleWellState& operator[](const std::string& well_name) {
|
||||
SingleWellState<Scalar>& operator[](const std::string& well_name)
|
||||
{
|
||||
return this->wells_[well_name];
|
||||
}
|
||||
|
||||
const SingleWellState& well(std::size_t well_index) const {
|
||||
const SingleWellState<Scalar>& well(std::size_t well_index) const
|
||||
{
|
||||
return this->operator[](well_index);
|
||||
}
|
||||
|
||||
const SingleWellState& well(const std::string& well_name) const {
|
||||
const SingleWellState<Scalar>& well(const std::string& well_name) const
|
||||
{
|
||||
return this->operator[](well_name);
|
||||
}
|
||||
|
||||
SingleWellState& well(std::size_t well_index) {
|
||||
SingleWellState<Scalar>& well(std::size_t well_index)
|
||||
{
|
||||
return this->operator[](well_index);
|
||||
}
|
||||
|
||||
SingleWellState& well(const std::string& well_name) {
|
||||
SingleWellState<Scalar>& well(const std::string& well_name)
|
||||
{
|
||||
return this->operator[](well_name);
|
||||
}
|
||||
|
||||
bool has(const std::string& well_name) const {
|
||||
bool has(const std::string& well_name) const
|
||||
{
|
||||
return this->wells_.has(well_name);
|
||||
}
|
||||
|
||||
@ -314,7 +349,7 @@ private:
|
||||
// The wells_ variable is essentially a map of all the wells on the current
|
||||
// process. Observe that since a well can be split over several processes a
|
||||
// well might appear in the WellContainer on different processes.
|
||||
WellContainer<SingleWellState> wells_;
|
||||
WellContainer<SingleWellState<Scalar>> wells_;
|
||||
|
||||
// The members alq_state, global_well_info and well_rates are map like
|
||||
// structures which will have entries for *all* the wells in the system.
|
||||
@ -323,12 +358,12 @@ private:
|
||||
// WellStateFullyImplicitBlackoil class should be default constructible,
|
||||
// whereas the GlobalWellInfo is not.
|
||||
std::optional<GlobalWellInfo> global_well_info;
|
||||
ALQState alq_state;
|
||||
ALQState<Scalar> alq_state;
|
||||
|
||||
// The well_rates variable is defined for all wells on all processors. The
|
||||
// bool in the value pair is whether the current process owns the well or
|
||||
// not.
|
||||
std::map<std::string, std::pair<bool, std::vector<double>>> well_rates;
|
||||
std::map<std::string, std::pair<bool, std::vector<Scalar>>> well_rates;
|
||||
|
||||
data::Segment
|
||||
reportSegmentResults(const int well_id,
|
||||
@ -341,13 +376,13 @@ private:
|
||||
/// wellRates() fields, depending on controls. The
|
||||
/// perfRates() field is filled with zero, and perfPress()
|
||||
/// with -1e100.
|
||||
void base_init(const std::vector<double>& cellPressures,
|
||||
void base_init(const std::vector<Scalar>& cellPressures,
|
||||
const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||
const SummaryState& summary_state);
|
||||
|
||||
void initSingleWell(const std::vector<double>& cellPressures,
|
||||
void initSingleWell(const std::vector<Scalar>& cellPressures,
|
||||
const Well& well,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const ParallelWellInfo& well_info,
|
||||
@ -355,19 +390,17 @@ private:
|
||||
|
||||
void initSingleProducer(const Well& well,
|
||||
const ParallelWellInfo& well_info,
|
||||
double pressure_first_connection,
|
||||
Scalar pressure_first_connection,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const SummaryState& summary_state);
|
||||
|
||||
void initSingleInjector(const Well& well,
|
||||
const ParallelWellInfo& well_info,
|
||||
double pressure_first_connection,
|
||||
Scalar pressure_first_connection,
|
||||
const std::vector<PerforationData>& well_perf_data,
|
||||
const SummaryState& summary_state);
|
||||
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
|
||||
#endif // OPM_WELLSTATEFULLYIMPLICITBLACKOIL_HEADER_INCLUDED
|
||||
|
@ -36,7 +36,7 @@ namespace Opm
|
||||
{
|
||||
|
||||
template<class RatioFunc>
|
||||
bool WellTest::checkMaxRatioLimitWell(const SingleWellState& ws,
|
||||
bool WellTest::checkMaxRatioLimitWell(const SingleWellState<double>& ws,
|
||||
const double max_ratio_limit,
|
||||
const RatioFunc& ratioFunc) const
|
||||
{
|
||||
@ -52,7 +52,7 @@ bool WellTest::checkMaxRatioLimitWell(const SingleWellState& ws,
|
||||
}
|
||||
|
||||
template<class RatioFunc>
|
||||
void WellTest::checkMaxRatioLimitCompletions(const SingleWellState& ws,
|
||||
void WellTest::checkMaxRatioLimitCompletions(const SingleWellState<double>& ws,
|
||||
const double max_ratio_limit,
|
||||
const RatioFunc& ratioFunc,
|
||||
RatioLimitCheckReport& report) const
|
||||
@ -97,7 +97,7 @@ void WellTest::checkMaxRatioLimitCompletions(const SingleWellState& ws,
|
||||
}
|
||||
|
||||
void WellTest::checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
const SingleWellState<double>& ws,
|
||||
RatioLimitCheckReport& report) const
|
||||
{
|
||||
static constexpr int Oil = BlackoilPhases::Liquid;
|
||||
@ -128,7 +128,7 @@ void WellTest::checkMaxGORLimit(const WellEconProductionLimits& econ_production_
|
||||
}
|
||||
|
||||
void WellTest::checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
const SingleWellState<double>& ws,
|
||||
RatioLimitCheckReport& report) const
|
||||
{
|
||||
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||
@ -160,7 +160,7 @@ void WellTest::checkMaxWGRLimit(const WellEconProductionLimits& econ_production_
|
||||
}
|
||||
|
||||
void WellTest::checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
const SingleWellState<double>& ws,
|
||||
RatioLimitCheckReport& report) const
|
||||
{
|
||||
static constexpr int Oil = BlackoilPhases::Liquid;
|
||||
@ -241,7 +241,7 @@ bool WellTest::checkRateEconLimits(const WellEconProductionLimits& econ_producti
|
||||
|
||||
WellTest::RatioLimitCheckReport WellTest::
|
||||
checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
const SingleWellState<double>& ws,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
// TODO: not sure how to define the worst-offending completion when more than one
|
||||
@ -289,7 +289,7 @@ checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||
return report;
|
||||
}
|
||||
|
||||
void WellTest::updateWellTestStateEconomic(const SingleWellState& ws,
|
||||
void WellTest::updateWellTestStateEconomic(const SingleWellState<double>& ws,
|
||||
const double simulation_time,
|
||||
const bool write_message_to_opmlog,
|
||||
WellTestState& well_test_state,
|
||||
|
@ -32,7 +32,7 @@ namespace Opm
|
||||
|
||||
class DeferredLogger;
|
||||
struct PhaseUsage;
|
||||
class SingleWellState;
|
||||
template<class Scalar> class SingleWellState;
|
||||
class WellEconProductionLimits;
|
||||
class WellInterfaceGeneric;
|
||||
class WellTestState;
|
||||
@ -43,7 +43,7 @@ public:
|
||||
//! \brief Constructor sets reference to well.
|
||||
WellTest(const WellInterfaceGeneric& well) : well_(well) {}
|
||||
|
||||
void updateWellTestStateEconomic(const SingleWellState& ws,
|
||||
void updateWellTestStateEconomic(const SingleWellState<double>& ws,
|
||||
const double simulation_time,
|
||||
const bool write_message_to_opmlog,
|
||||
WellTestState& well_test_state,
|
||||
@ -63,24 +63,24 @@ private:
|
||||
};
|
||||
|
||||
void checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
const SingleWellState<double>& ws,
|
||||
RatioLimitCheckReport& report) const;
|
||||
|
||||
void checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
const SingleWellState<double>& ws,
|
||||
RatioLimitCheckReport& report) const;
|
||||
|
||||
void checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
const SingleWellState<double>& ws,
|
||||
RatioLimitCheckReport& report) const;
|
||||
|
||||
template<class RatioFunc>
|
||||
bool checkMaxRatioLimitWell(const SingleWellState& ws,
|
||||
bool checkMaxRatioLimitWell(const SingleWellState<double>& ws,
|
||||
const double max_ratio_limit,
|
||||
const RatioFunc& ratioFunc) const;
|
||||
|
||||
template<class RatioFunc>
|
||||
void checkMaxRatioLimitCompletions(const SingleWellState& ws,
|
||||
void checkMaxRatioLimitCompletions(const SingleWellState<double>& ws,
|
||||
const double max_ratio_limit,
|
||||
const RatioFunc& ratioFunc,
|
||||
RatioLimitCheckReport& report) const;
|
||||
@ -91,7 +91,7 @@ private:
|
||||
|
||||
RatioLimitCheckReport
|
||||
checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
const SingleWellState<double>& ws,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
|
||||
|
@ -21,20 +21,17 @@
|
||||
#include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#include <stdexcept>
|
||||
#include <exception>
|
||||
#include <opm/simulators/wells/ALQState.hpp>
|
||||
|
||||
|
||||
#define BOOST_TEST_MODULE GroupStateTest
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ALQStateCreate) {
|
||||
ALQState alq_state;
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ALQStateCreate)
|
||||
{
|
||||
ALQState<double> alq_state;
|
||||
|
||||
alq_state.update_default("W1", 100);
|
||||
alq_state.update_default("W2", 200);
|
||||
|
@ -39,9 +39,10 @@ public:
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(GroupStateCreate) {
|
||||
BOOST_AUTO_TEST_CASE(GroupStateCreate)
|
||||
{
|
||||
std::size_t num_phases{3};
|
||||
GroupState gs(num_phases);
|
||||
GroupState<double> gs(num_phases);
|
||||
|
||||
BOOST_CHECK(!gs.has_production_rates("AGROUP"));
|
||||
BOOST_CHECK_THROW( gs.update_production_rates("AGROUP", {0}), std::exception);
|
||||
|
@ -101,14 +101,18 @@ BOOST_AUTO_TEST_CASE(NAME) \
|
||||
#define TEST_FOR_TYPE(TYPE) \
|
||||
TEST_FOR_TYPE_NAMED(TYPE, TYPE)
|
||||
|
||||
TEST_FOR_TYPE(ALQState)
|
||||
TEST_FOR_TYPE(GroupState)
|
||||
namespace Opm { using ALQS = ALQState<double>; }
|
||||
TEST_FOR_TYPE_NAMED(ALQS, ALQState)
|
||||
namespace Opm { using GroupS = GroupState<double>; }
|
||||
TEST_FOR_TYPE_NAMED(GroupS, GroupState)
|
||||
TEST_FOR_TYPE(HardcodedTimeStepControl)
|
||||
TEST_FOR_TYPE(Inplace)
|
||||
TEST_FOR_TYPE(PerfData)
|
||||
namespace Opm { using PerfD = PerfData<double>; }
|
||||
TEST_FOR_TYPE_NAMED(PerfD, PerfData)
|
||||
TEST_FOR_TYPE(PIDAndIterationCountTimeStepControl)
|
||||
TEST_FOR_TYPE(PIDTimeStepControl)
|
||||
TEST_FOR_TYPE(SegmentState)
|
||||
namespace Opm { using SegmState = SegmentState<double>; }
|
||||
TEST_FOR_TYPE_NAMED(SegmState, SegmentState)
|
||||
TEST_FOR_TYPE(SimpleIterationCountTimeStepControl)
|
||||
TEST_FOR_TYPE(SimulatorReport)
|
||||
TEST_FOR_TYPE(SimulatorReportSingle)
|
||||
@ -146,7 +150,7 @@ TEST_FOR_TYPE_NAMED(BVec, BlockVectorWrapper)
|
||||
BOOST_AUTO_TEST_CASE(SingleWellState)
|
||||
{
|
||||
Opm::ParallelWellInfo dummy;
|
||||
auto data_out = Opm::SingleWellState::serializationTestObject(dummy);
|
||||
auto data_out = Opm::SingleWellState<double>::serializationTestObject(dummy);
|
||||
Opm::Serialization::MemPacker packer;
|
||||
Opm::Serializer ser(packer);
|
||||
ser.pack(data_out);
|
||||
@ -175,7 +179,7 @@ BOOST_AUTO_TEST_CASE(WellContainer)
|
||||
BOOST_AUTO_TEST_CASE(WellState)
|
||||
{
|
||||
Opm::ParallelWellInfo dummy;
|
||||
auto data_out = Opm::WellState::serializationTestObject(dummy);
|
||||
auto data_out = Opm::WellState<double>::serializationTestObject(dummy);
|
||||
Opm::Serialization::MemPacker packer;
|
||||
Opm::Serializer ser(packer);
|
||||
ser.pack(data_out);
|
||||
@ -190,13 +194,13 @@ BOOST_AUTO_TEST_CASE(WellState)
|
||||
BOOST_AUTO_TEST_CASE(WGState)
|
||||
{
|
||||
Opm::ParallelWellInfo dummy;
|
||||
auto data_out = Opm::WGState::serializationTestObject(dummy);
|
||||
auto data_out = Opm::WGState<double>::serializationTestObject(dummy);
|
||||
Opm::Serialization::MemPacker packer;
|
||||
Opm::Serializer ser(packer);
|
||||
ser.pack(data_out);
|
||||
const size_t pos1 = ser.position();
|
||||
decltype(data_out) data_in(Opm::PhaseUsage{});
|
||||
data_in.well_state = Opm::WellState(dummy);
|
||||
data_in.well_state = Opm::WellState<double>(dummy);
|
||||
ser.unpack(data_in);
|
||||
const size_t pos2 = ser.position();
|
||||
BOOST_CHECK_MESSAGE(pos1 == pos2, "Packed size differ from unpack size for WGState");
|
||||
@ -268,9 +272,9 @@ public:
|
||||
eclState, phase_usage, comm)
|
||||
{
|
||||
if (deserialize) {
|
||||
active_wgstate_.well_state = WellState(dummy);
|
||||
last_valid_wgstate_.well_state = WellState(dummy);
|
||||
nupcol_wgstate_.well_state = WellState(dummy);
|
||||
active_wgstate_.well_state = WellState<double>(dummy);
|
||||
last_valid_wgstate_.well_state = WellState<double>(dummy);
|
||||
nupcol_wgstate_.well_state = WellState<double>(dummy);
|
||||
}
|
||||
}
|
||||
|
||||
@ -283,9 +287,9 @@ public:
|
||||
closed_this_step_ = {"test1", "test2"};
|
||||
guideRate_.setSerializationTestData();
|
||||
node_pressures_ = {{"test3", 4.0}};
|
||||
active_wgstate_ = WGState::serializationTestObject(dummy);
|
||||
last_valid_wgstate_ = WGState::serializationTestObject(dummy);
|
||||
nupcol_wgstate_ = WGState::serializationTestObject(dummy);
|
||||
active_wgstate_ = WGState<double>::serializationTestObject(dummy);
|
||||
last_valid_wgstate_ = WGState<double>::serializationTestObject(dummy);
|
||||
nupcol_wgstate_ = WGState<double>::serializationTestObject(dummy);
|
||||
last_glift_opt_time_ = 5.0;
|
||||
switched_prod_groups_ = {{"test4", "test5"}};
|
||||
switched_inj_groups_ = {{{"test4", Phase::SOLVENT}, "test5"}};
|
||||
@ -299,7 +303,7 @@ public:
|
||||
{}
|
||||
|
||||
void computePotentials(const std::size_t,
|
||||
const WellState&,
|
||||
const WellState<double>&,
|
||||
std::string&,
|
||||
ExceptionType::ExcEnum&,
|
||||
DeferredLogger&) override
|
||||
|
@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE(G1)
|
||||
//using EclProblem = Opm::EclProblem<TypeTag>;
|
||||
//using EclWellModel = typename EclProblem::EclWellModel;
|
||||
using WellModel = Opm::BlackoilWellModel<TypeTag>;
|
||||
using WellState = Opm::WellState;
|
||||
using WellState = Opm::WellState<double>;
|
||||
using StdWell = Opm::StandardWell<TypeTag>;
|
||||
using GasLiftSingleWell = Opm::GasLiftSingleWell<TypeTag>;
|
||||
using GasLiftGroupInfo = Opm::GasLiftGroupInfo;
|
||||
|
@ -136,11 +136,11 @@ struct Setup
|
||||
};
|
||||
|
||||
namespace {
|
||||
Opm::WellState
|
||||
Opm::WellState<double>
|
||||
buildWellState(const Setup& setup, const std::size_t timeStep,
|
||||
std::vector<Opm::ParallelWellInfo>& pinfos)
|
||||
{
|
||||
auto state = Opm::WellState{setup.pu};
|
||||
auto state = Opm::WellState<double>{setup.pu};
|
||||
|
||||
const auto cpress =
|
||||
std::vector<double>(setup.grid.c_grid()->number_of_cells,
|
||||
@ -171,7 +171,7 @@ namespace {
|
||||
|
||||
|
||||
void setSegPress(const std::vector<Opm::Well>& wells,
|
||||
Opm::WellState& wstate)
|
||||
Opm::WellState<double>& wstate)
|
||||
{
|
||||
const auto nWell = wells.size();
|
||||
|
||||
@ -200,8 +200,8 @@ namespace {
|
||||
|
||||
|
||||
void setSegRates(const std::vector<Opm::Well>& wells,
|
||||
const Opm::PhaseUsage& pu,
|
||||
Opm::WellState& wstate)
|
||||
const Opm::PhaseUsage& pu,
|
||||
Opm::WellState<double>& wstate)
|
||||
{
|
||||
const auto wat = pu.phase_used[Opm::BlackoilPhases::Aqua];
|
||||
const auto iw = wat ? pu.phase_pos[Opm::BlackoilPhases::Aqua] : -1;
|
||||
@ -511,8 +511,8 @@ BOOST_AUTO_TEST_CASE(TESTSegmentState) {
|
||||
const Setup setup{ "msw.data" };
|
||||
const auto& well = setup.sched.getWell("PROD01", 0);
|
||||
const auto& segments = well.getSegments();
|
||||
Opm::SegmentState ss1(3, segments);
|
||||
Opm::SegmentState ss2;
|
||||
Opm::SegmentState<double> ss1(3, segments);
|
||||
Opm::SegmentState<double> ss2;
|
||||
|
||||
|
||||
ss1.pressure_drop_hydrostatic[0] = 1;
|
||||
@ -553,10 +553,10 @@ BOOST_AUTO_TEST_CASE(TESTSegmentState2) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(TESTPerfData) {
|
||||
Opm::PerfData pd1(3, 100, true, 3);
|
||||
Opm::PerfData pd2(3, 100, true, 3);
|
||||
Opm::PerfData pd3(2, 100, true, 3);
|
||||
Opm::PerfData pd4(3, 100, false, 3);
|
||||
Opm::PerfData pd1(3, 100.0, true, 3);
|
||||
Opm::PerfData pd2(3, 100.0, true, 3);
|
||||
Opm::PerfData pd3(2, 100.0, true, 3);
|
||||
Opm::PerfData pd4(3, 100.0, false, 3);
|
||||
|
||||
|
||||
for (std::size_t i = 0; i < 3; i++) {
|
||||
@ -587,9 +587,9 @@ BOOST_AUTO_TEST_CASE(TestSingleWellState) {
|
||||
// This is totally bonkers, but the pu needs a complete deck to initialize properly
|
||||
pu.num_phases = 3;
|
||||
|
||||
Opm::SingleWellState ws1("W1", pinfo, true, 100, connections, pu, 1);
|
||||
Opm::SingleWellState ws2("W2", pinfo, true, 100, connections, pu, 2);
|
||||
Opm::SingleWellState ws3("W3", pinfo, false, 100, connections, pu, 3);
|
||||
Opm::SingleWellState ws1("W1", pinfo, true, 100.0, connections, pu, 1.0);
|
||||
Opm::SingleWellState ws2("W2", pinfo, true, 100.0, connections, pu, 2.0);
|
||||
Opm::SingleWellState ws3("W3", pinfo, false, 100.0, connections, pu, 3.0);
|
||||
|
||||
ws1.bhp = 100;
|
||||
ws1.thp = 200;
|
||||
|
Loading…
Reference in New Issue
Block a user