mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -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 int step = 0;
|
||||||
const auto& sched_state = schedule->operator[](step);
|
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);
|
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 {
|
namespace Opm {
|
||||||
|
|
||||||
class WellState;
|
|
||||||
|
|
||||||
// Available relaxation scheme types.
|
// Available relaxation scheme types.
|
||||||
enum class NonlinearRelaxType {
|
enum class NonlinearRelaxType {
|
||||||
Dampen,
|
Dampen,
|
||||||
@ -167,9 +165,6 @@ void stabilizeNonlinearUpdate(BVector& dx, BVector& dxOld,
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Forwarding types from PhysicalModel.
|
|
||||||
//typedef typename PhysicalModel::WellState WellState;
|
|
||||||
|
|
||||||
// --------- Public methods ---------
|
// --------- Public methods ---------
|
||||||
|
|
||||||
/// Construct solver for a given model.
|
/// 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] param parameters controlling nonlinear process
|
||||||
/// \param[in, out] model physical simulation model.
|
/// \param[in, out] model physical simulation model.
|
||||||
NonlinearSolver(const SolverParameters& param,
|
NonlinearSolver(const SolverParameters& param,
|
||||||
std::unique_ptr<PhysicalModel> model)
|
std::unique_ptr<PhysicalModel> model)
|
||||||
: param_(param)
|
: param_(param)
|
||||||
, model_(std::move(model))
|
, model_(std::move(model))
|
||||||
, linearizations_(0)
|
, linearizations_(0)
|
||||||
|
@ -28,7 +28,8 @@
|
|||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
ALQState ALQState::serializationTestObject()
|
template<class Scalar>
|
||||||
|
ALQState<Scalar> ALQState<Scalar>::serializationTestObject()
|
||||||
{
|
{
|
||||||
ALQState result;
|
ALQState result;
|
||||||
result.current_alq_ = {{"test1", 1.0}};
|
result.current_alq_ = {{"test1", 1.0}};
|
||||||
@ -40,7 +41,9 @@ ALQState ALQState::serializationTestObject()
|
|||||||
return result;
|
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);
|
auto iter = this->current_alq_.find(wname);
|
||||||
if (iter != this->current_alq_.end())
|
if (iter != this->current_alq_.end())
|
||||||
return iter->second;
|
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);
|
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);
|
auto default_iter = this->default_alq_.find(wname);
|
||||||
if (default_iter == this->default_alq_.end() || default_iter->second != value) {
|
if (default_iter == this->default_alq_.end() || default_iter->second != value) {
|
||||||
this->default_alq_.insert_or_assign(wname, 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;
|
this->current_alq_[wname] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ALQState::get_debug_counter() {
|
template<class Scalar>
|
||||||
|
int ALQState<Scalar>::get_debug_counter()
|
||||||
|
{
|
||||||
return this->debug_counter_;
|
return this->debug_counter_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ALQState::update_debug_counter() {
|
template<class Scalar>
|
||||||
|
int ALQState<Scalar>::update_debug_counter()
|
||||||
|
{
|
||||||
this->debug_counter_++;
|
this->debug_counter_++;
|
||||||
return 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;
|
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);
|
auto inc_count = get_counter(this->alq_increase_count_, wname);
|
||||||
if (inc_count == 0)
|
if (inc_count == 0)
|
||||||
return false;
|
return false;
|
||||||
@ -97,35 +112,43 @@ bool ALQState::oscillation(const std::string& wname) const {
|
|||||||
return dec_count >= 1;
|
return dec_count >= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
void ALQState::update_count(const std::string& wname, bool increase) {
|
void ALQState<Scalar>::update_count(const std::string& wname, bool increase)
|
||||||
|
{
|
||||||
if (increase)
|
if (increase)
|
||||||
this->alq_increase_count_[wname] += 1;
|
this->alq_increase_count_[wname] += 1;
|
||||||
else
|
else
|
||||||
this->alq_decrease_count_[wname] += 1;
|
this->alq_decrease_count_[wname] += 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
void ALQState::reset_count() {
|
void ALQState<Scalar>::reset_count()
|
||||||
|
{
|
||||||
this->alq_decrease_count_.clear();
|
this->alq_decrease_count_.clear();
|
||||||
this->alq_increase_count_.clear();
|
this->alq_increase_count_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
int ALQState::get_increment_count(const std::string& wname) const {
|
int ALQState<Scalar>::get_increment_count(const std::string& wname) const
|
||||||
|
{
|
||||||
return get_counter(this->alq_increase_count_, wname);
|
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);
|
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();
|
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;
|
std::size_t index = 0;
|
||||||
for (const auto& [_, value] : this->current_alq_) {
|
for (const auto& [_, value] : this->current_alq_) {
|
||||||
(void)_;
|
(void)_;
|
||||||
@ -134,7 +157,9 @@ std::size_t ALQState::pack_data(double * data) const {
|
|||||||
return index;
|
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;
|
std::size_t index = 0;
|
||||||
for (auto& [_, value] : this->current_alq_) {
|
for (auto& [_, value] : this->current_alq_) {
|
||||||
(void)_;
|
(void)_;
|
||||||
@ -143,7 +168,8 @@ std::size_t ALQState::unpack_data(const double * data) {
|
|||||||
return index;
|
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_ &&
|
return this->current_alq_ == rhs.current_alq_ &&
|
||||||
this->default_alq_ == rhs.default_alq_ &&
|
this->default_alq_ == rhs.default_alq_ &&
|
||||||
@ -152,7 +178,6 @@ bool ALQState::operator==(const ALQState& rhs) const
|
|||||||
this->debug_counter_ == rhs.debug_counter_;
|
this->debug_counter_ == rhs.debug_counter_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template class ALQState<double>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,22 +22,22 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
class ALQState {
|
template<class Scalar>
|
||||||
|
class ALQState
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
static ALQState serializationTestObject();
|
static ALQState serializationTestObject();
|
||||||
|
|
||||||
std::size_t pack_size() const;
|
std::size_t pack_size() const;
|
||||||
std::size_t unpack_data(const double * data);
|
std::size_t unpack_data(const Scalar* data);
|
||||||
std::size_t pack_data(double * data) const;
|
std::size_t pack_data(Scalar* data) const;
|
||||||
|
|
||||||
double get(const std::string& wname) const;
|
Scalar get(const std::string& wname) const;
|
||||||
void update_default(const std::string& wname, double value);
|
void update_default(const std::string& wname, Scalar value);
|
||||||
void set(const std::string& wname, double value);
|
void set(const std::string& wname, Scalar value);
|
||||||
bool oscillation(const std::string& wname) const;
|
bool oscillation(const std::string& wname) const;
|
||||||
void update_count(const std::string& wname, bool increase);
|
void update_count(const std::string& wname, bool increase);
|
||||||
void reset_count();
|
void reset_count();
|
||||||
@ -60,14 +60,13 @@ public:
|
|||||||
bool operator==(const ALQState&) const;
|
bool operator==(const ALQState&) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<std::string, double> current_alq_;
|
std::map<std::string, Scalar> current_alq_;
|
||||||
std::map<std::string, double> default_alq_;
|
std::map<std::string, Scalar> default_alq_;
|
||||||
std::map<std::string, int> alq_increase_count_;
|
std::map<std::string, int> alq_increase_count_;
|
||||||
std::map<std::string, int> alq_decrease_count_;
|
std::map<std::string, int> alq_decrease_count_;
|
||||||
int debug_counter_ = 0;
|
int debug_counter_ = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -489,7 +489,7 @@ namespace Opm {
|
|||||||
void updateAverageFormationFactor();
|
void updateAverageFormationFactor();
|
||||||
|
|
||||||
void computePotentials(const std::size_t widx,
|
void computePotentials(const std::size_t widx,
|
||||||
const WellState& well_state_copy,
|
const WellState<Scalar>& well_state_copy,
|
||||||
std::string& exc_msg,
|
std::string& exc_msg,
|
||||||
ExceptionType::ExcEnum& exc_type,
|
ExceptionType::ExcEnum& exc_type,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
@ -382,7 +382,7 @@ void BlackoilWellModelConstraints::
|
|||||||
actionOnBrokenConstraints(const Group& group,
|
actionOnBrokenConstraints(const Group& group,
|
||||||
const Group::InjectionCMode& newControl,
|
const Group::InjectionCMode& newControl,
|
||||||
const Phase& controlPhase,
|
const Phase& controlPhase,
|
||||||
GroupState& group_state,
|
GroupState<double>& group_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
auto oldControl = wellModel_.groupState().injection_control(group.name(), controlPhase);
|
auto oldControl = wellModel_.groupState().injection_control(group.name(), controlPhase);
|
||||||
@ -405,9 +405,9 @@ actionOnBrokenConstraints(const Group& group,
|
|||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const Group::GroupLimitAction group_limit_action,
|
const Group::GroupLimitAction group_limit_action,
|
||||||
const Group::ProductionCMode& newControl,
|
const Group::ProductionCMode& newControl,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
std::optional<std::string>& worst_offending_well,
|
std::optional<std::string>& worst_offending_well,
|
||||||
GroupState& group_state,
|
GroupState<double>& group_state,
|
||||||
DeferredLogger& deferred_logger) const
|
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::pair<std::string,Opm::Phase>,std::string>& switched_inj,
|
||||||
std::map<std::string, std::string>& switched_prod,
|
std::map<std::string, std::string>& switched_prod,
|
||||||
std::map<std::string, std::pair<std::string, std::string>>& closed_offending_wells,
|
std::map<std::string, std::pair<std::string, std::string>>& closed_offending_wells,
|
||||||
GroupState& group_state,
|
GroupState<double>& group_state,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
@ -31,9 +31,9 @@ namespace Opm {
|
|||||||
|
|
||||||
class BlackoilWellModelGeneric;
|
class BlackoilWellModelGeneric;
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
class GroupState;
|
template<class Scalar> class GroupState;
|
||||||
class SummaryState;
|
class SummaryState;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
/// Class for handling constraints for the blackoil well model.
|
/// Class for handling constraints for the blackoil well model.
|
||||||
class BlackoilWellModelConstraints
|
class BlackoilWellModelConstraints
|
||||||
@ -56,7 +56,7 @@ public:
|
|||||||
void actionOnBrokenConstraints(const Group& group,
|
void actionOnBrokenConstraints(const Group& group,
|
||||||
const Group::InjectionCMode& newControl,
|
const Group::InjectionCMode& newControl,
|
||||||
const Phase& controlPhase,
|
const Phase& controlPhase,
|
||||||
GroupState& group_state,
|
GroupState<double>& group_state,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
//! \brief Execute action on broken constraint for a production well group. Return true if a group control is changed
|
//! \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 int reportStepIdx,
|
||||||
const Group::GroupLimitAction group_limit_action,
|
const Group::GroupLimitAction group_limit_action,
|
||||||
const Group::ProductionCMode& newControl,
|
const Group::ProductionCMode& newControl,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
std::optional<std::string>& worst_offending_well,
|
std::optional<std::string>& worst_offending_well,
|
||||||
GroupState& group_state,
|
GroupState<double>& group_state,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
//! \brief Update the individual controls for wells in a group. Return true if a group control is changed
|
//! \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::pair<std::string,Opm::Phase>,std::string>& switched_inj,
|
||||||
std::map<std::string, std::string>& switched_prod,
|
std::map<std::string, std::string>& switched_prod,
|
||||||
std::map<std::string, std::pair<std::string, std::string>>& closed_offending_wells,
|
std::map<std::string, std::pair<std::string, std::string>>& closed_offending_wells,
|
||||||
GroupState& group_state,
|
GroupState<double>& group_state,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -407,7 +407,7 @@ checkGEconLimits(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupEconomicLimitsChecker checker {
|
GroupEconomicLimitsChecker<double> checker {
|
||||||
*this, wellTestState(), group, simulation_time, report_step_idx, deferred_logger
|
*this, wellTestState(), group, simulation_time, report_step_idx, deferred_logger
|
||||||
};
|
};
|
||||||
if (checker.minOilRate() || checker.minGasRate()) {
|
if (checker.minOilRate() || checker.minGasRate()) {
|
||||||
@ -426,7 +426,7 @@ checkGEconLimits(
|
|||||||
void
|
void
|
||||||
BlackoilWellModelGeneric::
|
BlackoilWellModelGeneric::
|
||||||
checkGconsaleLimits(const Group& group,
|
checkGconsaleLimits(const Group& group,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
@ -793,7 +793,7 @@ void
|
|||||||
BlackoilWellModelGeneric::
|
BlackoilWellModelGeneric::
|
||||||
updateWsolvent(const Group& group,
|
updateWsolvent(const Group& group,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const WellState& wellState)
|
const WellState<double>& wellState)
|
||||||
{
|
{
|
||||||
for (const std::string& groupName : group.groups()) {
|
for (const std::string& groupName : group.groups()) {
|
||||||
const Group& groupTmp = schedule_.getGroup(groupName, reportStepIdx);
|
const Group& groupTmp = schedule_.getGroup(groupName, reportStepIdx);
|
||||||
@ -1206,7 +1206,7 @@ updateNetworkPressures(const int reportStepIdx)
|
|||||||
// set the dynamic THP constraint of the well accordingly.
|
// set the dynamic THP constraint of the well accordingly.
|
||||||
const double new_limit = it->second;
|
const double new_limit = it->second;
|
||||||
well->setDynamicThpLimit(new_limit);
|
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;
|
const bool thp_is_limit = ws.production_cmode == Well::ProducerCMode::THP;
|
||||||
// TODO: not sure why the thp is NOT updated properly elsewhere
|
// TODO: not sure why the thp is NOT updated properly elsewhere
|
||||||
if (thp_is_limit) {
|
if (thp_is_limit) {
|
||||||
|
@ -66,7 +66,7 @@ namespace Opm {
|
|||||||
class SummaryConfig;
|
class SummaryConfig;
|
||||||
class VFPProperties;
|
class VFPProperties;
|
||||||
class WellInterfaceGeneric;
|
class WellInterfaceGeneric;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
|
||||||
namespace Opm { namespace data {
|
namespace Opm { namespace data {
|
||||||
@ -114,14 +114,14 @@ public:
|
|||||||
std::vector<Well> getLocalWells(const int timeStepIdx) const;
|
std::vector<Well> getLocalWells(const int timeStepIdx) const;
|
||||||
const Schedule& schedule() const { return schedule_; }
|
const Schedule& schedule() const { return schedule_; }
|
||||||
const PhaseUsage& phaseUsage() const { return phase_usage_; }
|
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
|
std::vector<const WellInterfaceGeneric*> genericWells() const
|
||||||
{ return {well_container_generic_.begin(), well_container_generic_.end()}; }
|
{ return {well_container_generic_.begin(), well_container_generic_.end()}; }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Immutable version of the currently active wellstate.
|
Immutable version of the currently active wellstate.
|
||||||
*/
|
*/
|
||||||
const WellState& wellState() const
|
const WellState<double>& wellState() const
|
||||||
{
|
{
|
||||||
return this->active_wgstate_.well_state;
|
return this->active_wgstate_.well_state;
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ public:
|
|||||||
/*
|
/*
|
||||||
Mutable version of the currently active wellstate.
|
Mutable version of the currently active wellstate.
|
||||||
*/
|
*/
|
||||||
WellState& wellState()
|
WellState<double>& wellState()
|
||||||
{
|
{
|
||||||
return this->active_wgstate_.well_state;
|
return this->active_wgstate_.well_state;
|
||||||
}
|
}
|
||||||
@ -138,11 +138,11 @@ public:
|
|||||||
Will return the currently active nupcolWellState; must initialize
|
Will return the currently active nupcolWellState; must initialize
|
||||||
the internal nupcol wellstate with initNupcolWellState() first.
|
the internal nupcol wellstate with initNupcolWellState() first.
|
||||||
*/
|
*/
|
||||||
const WellState& nupcolWellState() const
|
const WellState<double>& nupcolWellState() const
|
||||||
{
|
{
|
||||||
return this->nupcol_wgstate_.well_state;
|
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; }
|
WellTestState& wellTestState() { return this->active_wgstate_.well_test_state; }
|
||||||
|
|
||||||
@ -283,13 +283,13 @@ protected:
|
|||||||
prevWellState() must have been stored with the commitWellState()
|
prevWellState() must have been stored with the commitWellState()
|
||||||
function first.
|
function first.
|
||||||
*/
|
*/
|
||||||
const WellState& prevWellState() const
|
const WellState<double>& prevWellState() const
|
||||||
{
|
{
|
||||||
return this->last_valid_wgstate_.well_state;
|
return this->last_valid_wgstate_.well_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const WGState& prevWGState() const
|
const WGState<double>& prevWGState() const
|
||||||
{
|
{
|
||||||
return this->last_valid_wgstate_;
|
return this->last_valid_wgstate_;
|
||||||
}
|
}
|
||||||
@ -301,7 +301,7 @@ protected:
|
|||||||
last_valid_well_state_ member, that state can then be recovered
|
last_valid_well_state_ member, that state can then be recovered
|
||||||
with a subsequent call to resetWellState().
|
with a subsequent call to resetWellState().
|
||||||
*/
|
*/
|
||||||
void commitWGState(WGState wgstate)
|
void commitWGState(WGState<double> wgstate)
|
||||||
{
|
{
|
||||||
this->last_valid_wgstate_ = std::move(wgstate);
|
this->last_valid_wgstate_ = std::move(wgstate);
|
||||||
}
|
}
|
||||||
@ -339,7 +339,7 @@ protected:
|
|||||||
|
|
||||||
void updateWsolvent(const Group& group,
|
void updateWsolvent(const Group& group,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const WellState& wellState);
|
const WellState<double>& wellState);
|
||||||
void setWsolvent(const Group& group,
|
void setWsolvent(const Group& group,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
double wsolvent);
|
double wsolvent);
|
||||||
@ -362,7 +362,7 @@ protected:
|
|||||||
void calculateEfficiencyFactors(const int reportStepIdx);
|
void calculateEfficiencyFactors(const int reportStepIdx);
|
||||||
|
|
||||||
void checkGconsaleLimits(const Group& group,
|
void checkGconsaleLimits(const Group& group,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ protected:
|
|||||||
const int episodeIndex);
|
const int episodeIndex);
|
||||||
|
|
||||||
virtual void computePotentials(const std::size_t widx,
|
virtual void computePotentials(const std::size_t widx,
|
||||||
const WellState& well_state_copy,
|
const WellState<double>& well_state_copy,
|
||||||
std::string& exc_msg,
|
std::string& exc_msg,
|
||||||
ExceptionType::ExcEnum& exc_type,
|
ExceptionType::ExcEnum& exc_type,
|
||||||
DeferredLogger& deferred_logger) = 0;
|
DeferredLogger& deferred_logger) = 0;
|
||||||
@ -567,7 +567,7 @@ protected:
|
|||||||
std::unordered_map<std::string, std::vector<double>> prev_inj_multipliers_;
|
std::unordered_map<std::string, std::vector<double>> prev_inj_multipliers_;
|
||||||
|
|
||||||
// Handling for filter cake injection 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
|
The various wellState members should be accessed and modified
|
||||||
@ -575,9 +575,9 @@ protected:
|
|||||||
commitWellState(), resetWellState(), nupcolWellState() and
|
commitWellState(), resetWellState(), nupcolWellState() and
|
||||||
updateNupcolWellState().
|
updateNupcolWellState().
|
||||||
*/
|
*/
|
||||||
WGState active_wgstate_;
|
WGState<double> active_wgstate_;
|
||||||
WGState last_valid_wgstate_;
|
WGState<double> last_valid_wgstate_;
|
||||||
WGState nupcol_wgstate_;
|
WGState<double> nupcol_wgstate_;
|
||||||
|
|
||||||
bool glift_debug = false;
|
bool glift_debug = false;
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ void BlackoilWellModelRestart::
|
|||||||
loadRestartConnectionData(const std::vector<data::Rates::opt>& phs,
|
loadRestartConnectionData(const std::vector<data::Rates::opt>& phs,
|
||||||
const data::Well& rst_well,
|
const data::Well& rst_well,
|
||||||
const std::vector<PerforationData>& old_perf_data,
|
const std::vector<PerforationData>& old_perf_data,
|
||||||
SingleWellState& ws) const
|
SingleWellState<double>& ws) const
|
||||||
{
|
{
|
||||||
auto& perf_data = ws.perf_data;
|
auto& perf_data = ws.perf_data;
|
||||||
auto perf_pressure = perf_data.pressure.begin();
|
auto perf_pressure = perf_data.pressure.begin();
|
||||||
@ -95,7 +95,7 @@ void BlackoilWellModelRestart::
|
|||||||
loadRestartSegmentData(const std::string& well_name,
|
loadRestartSegmentData(const std::string& well_name,
|
||||||
const std::vector<data::Rates::opt>& phs,
|
const std::vector<data::Rates::opt>& phs,
|
||||||
const data::Well& rst_well,
|
const data::Well& rst_well,
|
||||||
SingleWellState& ws) const
|
SingleWellState<double>& ws) const
|
||||||
{
|
{
|
||||||
const auto& segment_set = wellModel_.getWellEcl(well_name).getSegments();
|
const auto& segment_set = wellModel_.getWellEcl(well_name).getSegments();
|
||||||
const auto& rst_segments = rst_well.segments;
|
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 std::vector<data::Rates::opt>& phs,
|
||||||
const data::Well& rst_well,
|
const data::Well& rst_well,
|
||||||
const std::vector<PerforationData>& old_perf_data,
|
const std::vector<PerforationData>& old_perf_data,
|
||||||
SingleWellState& ws) const
|
SingleWellState<double>& ws) const
|
||||||
{
|
{
|
||||||
const auto np = phs.size();
|
const auto np = phs.size();
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ loadRestartWellData(const std::string& well_name,
|
|||||||
void BlackoilWellModelRestart::
|
void BlackoilWellModelRestart::
|
||||||
loadRestartGroupData(const std::string& group,
|
loadRestartGroupData(const std::string& group,
|
||||||
const data::GroupData& value,
|
const data::GroupData& value,
|
||||||
GroupState& grpState) const
|
GroupState<double>& grpState) const
|
||||||
{
|
{
|
||||||
using GPMode = Group::ProductionCMode;
|
using GPMode = Group::ProductionCMode;
|
||||||
using GIMode = Group::InjectionCMode;
|
using GIMode = Group::InjectionCMode;
|
||||||
@ -223,8 +223,8 @@ void BlackoilWellModelRestart::
|
|||||||
loadRestartData(const data::Wells& rst_wells,
|
loadRestartData(const data::Wells& rst_wells,
|
||||||
const data::GroupAndNetworkValues& grpNwrkValues,
|
const data::GroupAndNetworkValues& grpNwrkValues,
|
||||||
const bool handle_ms_well,
|
const bool handle_ms_well,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
GroupState& grpState) const
|
GroupState<double>& grpState) const
|
||||||
{
|
{
|
||||||
using rt = data::Rates::opt;
|
using rt = data::Rates::opt;
|
||||||
const auto& phases = wellModel_.phaseUsage();
|
const auto& phases = wellModel_.phaseUsage();
|
||||||
|
@ -35,13 +35,13 @@ namespace data {
|
|||||||
struct GroupData;
|
struct GroupData;
|
||||||
class GroupAndNetworkValues;
|
class GroupAndNetworkValues;
|
||||||
}
|
}
|
||||||
class GroupState;
|
template<class Scalar> class GroupState;
|
||||||
class GuideRate;
|
class GuideRate;
|
||||||
class GuideRateConfig;
|
class GuideRateConfig;
|
||||||
struct PerforationData;
|
struct PerforationData;
|
||||||
struct PhaseUsage;
|
struct PhaseUsage;
|
||||||
class SingleWellState;
|
template<class Scalar> class SingleWellState;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
/// Class for restarting the blackoil well model.
|
/// Class for restarting the blackoil well model.
|
||||||
class BlackoilWellModelRestart
|
class BlackoilWellModelRestart
|
||||||
@ -68,21 +68,21 @@ public:
|
|||||||
void loadRestartData(const data::Wells& rst_wells,
|
void loadRestartData(const data::Wells& rst_wells,
|
||||||
const data::GroupAndNetworkValues& grpNwrkValues,
|
const data::GroupAndNetworkValues& grpNwrkValues,
|
||||||
const bool handle_ms_well,
|
const bool handle_ms_well,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
GroupState& grpState) const;
|
GroupState<double>& grpState) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! \brief Loads per-connection data from restart structures.
|
//! \brief Loads per-connection data from restart structures.
|
||||||
void loadRestartConnectionData(const std::vector<data::Rates::opt>& phs,
|
void loadRestartConnectionData(const std::vector<data::Rates::opt>& phs,
|
||||||
const data::Well& rst_well,
|
const data::Well& rst_well,
|
||||||
const std::vector<PerforationData>& old_perf_data,
|
const std::vector<PerforationData>& old_perf_data,
|
||||||
SingleWellState& ws) const;
|
SingleWellState<double>& ws) const;
|
||||||
|
|
||||||
//! \brief Loads per-segment data from restart structures.
|
//! \brief Loads per-segment data from restart structures.
|
||||||
void loadRestartSegmentData(const std::string& well_name,
|
void loadRestartSegmentData(const std::string& well_name,
|
||||||
const std::vector<data::Rates::opt>& phs,
|
const std::vector<data::Rates::opt>& phs,
|
||||||
const data::Well& rst_well,
|
const data::Well& rst_well,
|
||||||
SingleWellState& ws) const;
|
SingleWellState<double>& ws) const;
|
||||||
|
|
||||||
//! \brief Loads per-well data from restart structures.
|
//! \brief Loads per-well data from restart structures.
|
||||||
void loadRestartWellData(const std::string& well_name,
|
void loadRestartWellData(const std::string& well_name,
|
||||||
@ -90,12 +90,12 @@ private:
|
|||||||
const std::vector<data::Rates::opt>& phs,
|
const std::vector<data::Rates::opt>& phs,
|
||||||
const data::Well& rst_well,
|
const data::Well& rst_well,
|
||||||
const std::vector<PerforationData>& old_perf_data,
|
const std::vector<PerforationData>& old_perf_data,
|
||||||
SingleWellState& ws) const;
|
SingleWellState<double>& ws) const;
|
||||||
|
|
||||||
//! \brief Loads per-group data from restart structures.
|
//! \brief Loads per-group data from restart structures.
|
||||||
void loadRestartGroupData(const std::string& group,
|
void loadRestartGroupData(const std::string& group,
|
||||||
const data::GroupData& value,
|
const data::GroupData& value,
|
||||||
GroupState& grpState) const;
|
GroupState<double>& grpState) const;
|
||||||
|
|
||||||
const BlackoilWellModelGeneric& wellModel_; //!< Reference to well model
|
const BlackoilWellModelGeneric& wellModel_; //!< Reference to well model
|
||||||
};
|
};
|
||||||
|
@ -2206,7 +2206,7 @@ namespace Opm {
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
void
|
||||||
BlackoilWellModel<TypeTag>::computePotentials(const std::size_t widx,
|
BlackoilWellModel<TypeTag>::computePotentials(const std::size_t widx,
|
||||||
const WellState& well_state_copy,
|
const WellState<Scalar>& well_state_copy,
|
||||||
std::string& exc_msg,
|
std::string& exc_msg,
|
||||||
ExceptionType::ExcEnum& exc_type,
|
ExceptionType::ExcEnum& exc_type,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
@ -2311,14 +2311,14 @@ namespace Opm {
|
|||||||
|
|
||||||
for (const auto& well : well_container_) {
|
for (const auto& well : well_container_) {
|
||||||
auto& events = this->wellState().well(well->indexOfWell()).events;
|
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);
|
well->updateWellStateWithTarget(simulator_, this->groupState(), this->wellState(), deferred_logger);
|
||||||
const auto& summary_state = simulator_.vanguard().summaryState();
|
const auto& summary_state = simulator_.vanguard().summaryState();
|
||||||
well->updatePrimaryVariables(summary_state, this->wellState(), deferred_logger);
|
well->updatePrimaryVariables(summary_state, this->wellState(), deferred_logger);
|
||||||
well->initPrimaryVariablesEvaluation();
|
well->initPrimaryVariablesEvaluation();
|
||||||
// There is no new well control change input within a report step,
|
// 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.
|
// 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
|
// these events only work for the first time step within the report step
|
||||||
if (events.hasEvent(ScheduleEvents::REQUEST_OPEN_WELL)) {
|
if (events.hasEvent(ScheduleEvents::REQUEST_OPEN_WELL)) {
|
||||||
|
@ -26,40 +26,48 @@
|
|||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
void ConnFiltrateData::resize(std::size_t num_perf) {
|
template<class Scalar>
|
||||||
this->rates.resize(num_perf);
|
void ConnFiltrateData<Scalar>::resize(std::size_t num_perf)
|
||||||
this->total.resize(num_perf);
|
{
|
||||||
this->skin_factor.resize(num_perf);
|
this->rates.resize(num_perf);
|
||||||
this->thickness.resize(num_perf);
|
this->total.resize(num_perf);
|
||||||
this->perm.resize(num_perf);
|
this->skin_factor.resize(num_perf);
|
||||||
this->poro.resize(num_perf);
|
this->thickness.resize(num_perf);
|
||||||
this->radius.resize(num_perf);
|
this->perm.resize(num_perf);
|
||||||
this->area_of_flow.resize(num_perf);
|
this->poro.resize(num_perf);
|
||||||
}
|
this->radius.resize(num_perf);
|
||||||
|
this->area_of_flow.resize(num_perf);
|
||||||
|
}
|
||||||
|
|
||||||
ConnFiltrateData ConnFiltrateData::serializationTestObject()
|
template<class Scalar>
|
||||||
{
|
ConnFiltrateData<Scalar>
|
||||||
ConnFiltrateData result;
|
ConnFiltrateData<Scalar>::serializationTestObject()
|
||||||
result.rates = {8.};
|
{
|
||||||
result.total = {100.};
|
ConnFiltrateData result;
|
||||||
result.skin_factor = {0.5};
|
result.rates = {8.};
|
||||||
result.thickness = {0.05};
|
result.total = {100.};
|
||||||
result.perm = {0.00001};
|
result.skin_factor = {0.5};
|
||||||
result.poro = {0.3};
|
result.thickness = {0.05};
|
||||||
result.radius = {0.05};
|
result.perm = {0.00001};
|
||||||
result.area_of_flow = {0.7};
|
result.poro = {0.3};
|
||||||
return result;
|
result.radius = {0.05};
|
||||||
}
|
result.area_of_flow = {0.7};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
bool ConnFiltrateData::operator==(const ConnFiltrateData& rhs) const
|
template<class Scalar>
|
||||||
{
|
bool ConnFiltrateData<Scalar>::operator==(const ConnFiltrateData& rhs) const
|
||||||
return this->rates == rhs.rates &&
|
{
|
||||||
this->total == rhs.total &&
|
return this->rates == rhs.rates &&
|
||||||
this->skin_factor == rhs.skin_factor &&
|
this->total == rhs.total &&
|
||||||
this->thickness == rhs.thickness &&
|
this->skin_factor == rhs.skin_factor &&
|
||||||
this->perm == rhs.perm &&
|
this->thickness == rhs.thickness &&
|
||||||
this->poro == rhs.poro &&
|
this->perm == rhs.perm &&
|
||||||
this->radius == rhs.radius &&
|
this->poro == rhs.poro &&
|
||||||
this->area_of_flow == rhs.area_of_flow;
|
this->radius == rhs.radius &&
|
||||||
}
|
this->area_of_flow == rhs.area_of_flow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template struct ConnFiltrateData<double>;
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -24,37 +24,38 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace Opm {
|
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>
|
template<class Serializer>
|
||||||
void serializeOp(Serializer& serializer) {
|
void serializeOp(Serializer& serializer) {
|
||||||
serializer(rates);
|
serializer(rates);
|
||||||
serializer(total);
|
serializer(total);
|
||||||
serializer(skin_factor);
|
serializer(skin_factor);
|
||||||
serializer(thickness);
|
serializer(thickness);
|
||||||
serializer(perm);
|
serializer(perm);
|
||||||
serializer(poro);
|
serializer(poro);
|
||||||
serializer(radius);
|
serializer(radius);
|
||||||
serializer(area_of_flow);
|
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 {
|
namespace Opm::WellGroupHelpers {
|
||||||
|
|
||||||
FractionCalculator::FractionCalculator(const Schedule& schedule,
|
FractionCalculator::FractionCalculator(const Schedule& schedule,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const int report_step,
|
const int report_step,
|
||||||
const GuideRate* guide_rate,
|
const GuideRate* guide_rate,
|
||||||
const GuideRateModel::Target target,
|
const GuideRateModel::Target target,
|
||||||
|
@ -26,10 +26,10 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
class GroupState;
|
template<class Scalar> class GroupState;
|
||||||
struct PhaseUsage;
|
struct PhaseUsage;
|
||||||
class Schedule;
|
class Schedule;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Opm::WellGroupHelpers {
|
namespace Opm::WellGroupHelpers {
|
||||||
@ -38,8 +38,8 @@ class FractionCalculator
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FractionCalculator(const Schedule& schedule,
|
FractionCalculator(const Schedule& schedule,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const int report_step,
|
const int report_step,
|
||||||
const GuideRate* guide_rate,
|
const GuideRate* guide_rate,
|
||||||
const GuideRateModel::Target target,
|
const GuideRateModel::Target target,
|
||||||
@ -62,8 +62,8 @@ private:
|
|||||||
const std::string& always_included_child);
|
const std::string& always_included_child);
|
||||||
GuideRate::RateVector getGroupRateVector(const std::string& group_name);
|
GuideRate::RateVector getGroupRateVector(const std::string& group_name);
|
||||||
const Schedule& schedule_;
|
const Schedule& schedule_;
|
||||||
const WellState& well_state_;
|
const WellState<double>& well_state_;
|
||||||
const GroupState& group_state_;
|
const GroupState<double>& group_state_;
|
||||||
int report_step_;
|
int report_step_;
|
||||||
const GuideRate* guide_rate_;
|
const GuideRate* guide_rate_;
|
||||||
GuideRateModel::Target target_;
|
GuideRateModel::Target target_;
|
||||||
|
@ -30,8 +30,8 @@ namespace Opm {
|
|||||||
|
|
||||||
GasLiftCommon::
|
GasLiftCommon::
|
||||||
GasLiftCommon(
|
GasLiftCommon(
|
||||||
WellState &well_state,
|
WellState<double>& well_state,
|
||||||
const GroupState &group_state,
|
const GroupState<double>& group_state,
|
||||||
DeferredLogger &deferred_logger,
|
DeferredLogger &deferred_logger,
|
||||||
const Parallel::Communication& comm,
|
const Parallel::Communication& comm,
|
||||||
bool glift_debug
|
bool glift_debug
|
||||||
|
@ -28,8 +28,8 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
|
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
class GroupState;
|
template<class Scalar> class GroupState;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
class GasLiftCommon
|
class GasLiftCommon
|
||||||
{
|
{
|
||||||
@ -38,8 +38,8 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
GasLiftCommon(
|
GasLiftCommon(
|
||||||
WellState &well_state,
|
WellState<double>& well_state,
|
||||||
const GroupState &group_state,
|
const GroupState<double>& group_state,
|
||||||
DeferredLogger &deferred_logger,
|
DeferredLogger &deferred_logger,
|
||||||
const Parallel::Communication& comm,
|
const Parallel::Communication& comm,
|
||||||
bool debug
|
bool debug
|
||||||
@ -54,8 +54,8 @@ protected:
|
|||||||
const std::string& msg,
|
const std::string& msg,
|
||||||
MessageType msg_type = MessageType::INFO) const;
|
MessageType msg_type = MessageType::INFO) const;
|
||||||
|
|
||||||
WellState &well_state_;
|
WellState<double>& well_state_;
|
||||||
const GroupState& group_state_;
|
const GroupState<double>& group_state_;
|
||||||
DeferredLogger &deferred_logger_;
|
DeferredLogger &deferred_logger_;
|
||||||
const Parallel::Communication& comm_;
|
const Parallel::Communication& comm_;
|
||||||
bool debug;
|
bool debug;
|
||||||
|
@ -41,8 +41,8 @@ GasLiftGroupInfo(
|
|||||||
const int iteration_idx,
|
const int iteration_idx,
|
||||||
const PhaseUsage &phase_usage,
|
const PhaseUsage &phase_usage,
|
||||||
DeferredLogger &deferred_logger,
|
DeferredLogger &deferred_logger,
|
||||||
WellState &well_state,
|
WellState<double>& well_state,
|
||||||
const GroupState &group_state,
|
const GroupState<double>& group_state,
|
||||||
const Communication &comm,
|
const Communication &comm,
|
||||||
bool glift_debug
|
bool glift_debug
|
||||||
) :
|
) :
|
||||||
|
@ -35,11 +35,11 @@ namespace Opm
|
|||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
class GasLiftOpt;
|
class GasLiftOpt;
|
||||||
class Group;
|
class Group;
|
||||||
class GroupState;
|
template<class Scalar> class GroupState;
|
||||||
class Schedule;
|
class Schedule;
|
||||||
class SummaryState;
|
class SummaryState;
|
||||||
class Well;
|
class Well;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
class GasLiftGroupInfo : public GasLiftCommon
|
class GasLiftGroupInfo : public GasLiftCommon
|
||||||
{
|
{
|
||||||
@ -74,8 +74,8 @@ public:
|
|||||||
const int iteration_idx,
|
const int iteration_idx,
|
||||||
const PhaseUsage& phase_usage,
|
const PhaseUsage& phase_usage,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Parallel::Communication& comm,
|
const Parallel::Communication& comm,
|
||||||
bool glift_debug
|
bool glift_debug
|
||||||
);
|
);
|
||||||
|
@ -36,6 +36,7 @@ namespace Opm
|
|||||||
template<class TypeTag>
|
template<class TypeTag>
|
||||||
class GasLiftSingleWell : public GasLiftSingleWellGeneric
|
class GasLiftSingleWell : public GasLiftSingleWellGeneric
|
||||||
{
|
{
|
||||||
|
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
|
||||||
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
||||||
using GLiftSyncGroups = typename GasLiftSingleWellGeneric::GLiftSyncGroups;
|
using GLiftSyncGroups = typename GasLiftSingleWellGeneric::GLiftSyncGroups;
|
||||||
|
|
||||||
@ -45,8 +46,8 @@ namespace Opm
|
|||||||
const Simulator& simulator,
|
const Simulator& simulator,
|
||||||
const SummaryState &summary_state,
|
const SummaryState &summary_state,
|
||||||
DeferredLogger &deferred_logger,
|
DeferredLogger &deferred_logger,
|
||||||
WellState &well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
GasLiftGroupInfo &group_info,
|
GasLiftGroupInfo &group_info,
|
||||||
GLiftSyncGroups &sync_groups,
|
GLiftSyncGroups &sync_groups,
|
||||||
const Parallel::Communication& comm,
|
const Parallel::Communication& comm,
|
||||||
|
@ -38,8 +38,8 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
|
|
||||||
GasLiftSingleWellGeneric::GasLiftSingleWellGeneric(DeferredLogger& deferred_logger,
|
GasLiftSingleWellGeneric::GasLiftSingleWellGeneric(DeferredLogger& deferred_logger,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Well& ecl_well,
|
const Well& ecl_well,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
GasLiftGroupInfo& group_info,
|
GasLiftGroupInfo& group_info,
|
||||||
|
@ -42,8 +42,8 @@ class GasLiftWellState;
|
|||||||
class Schedule;
|
class Schedule;
|
||||||
class SummaryState;
|
class SummaryState;
|
||||||
class WellInterfaceGeneric;
|
class WellInterfaceGeneric;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
class GroupState;
|
template<class Scalar> class GroupState;
|
||||||
|
|
||||||
class GasLiftSingleWellGeneric : public GasLiftCommon
|
class GasLiftSingleWellGeneric : public GasLiftCommon
|
||||||
{
|
{
|
||||||
@ -104,8 +104,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
GasLiftSingleWellGeneric(
|
GasLiftSingleWellGeneric(
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Well& ecl_well,
|
const Well& ecl_well,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
GasLiftGroupInfo& group_info,
|
GasLiftGroupInfo& group_info,
|
||||||
|
@ -28,8 +28,8 @@ GasLiftSingleWell(const WellInterface<TypeTag> &well,
|
|||||||
const Simulator& simulator,
|
const Simulator& simulator,
|
||||||
const SummaryState &summary_state,
|
const SummaryState &summary_state,
|
||||||
DeferredLogger &deferred_logger,
|
DeferredLogger &deferred_logger,
|
||||||
WellState &well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState &group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
GasLiftGroupInfo &group_info,
|
GasLiftGroupInfo &group_info,
|
||||||
GLiftSyncGroups &sync_groups,
|
GLiftSyncGroups &sync_groups,
|
||||||
const Parallel::Communication& comm,
|
const Parallel::Communication& comm,
|
||||||
|
@ -45,8 +45,8 @@ GasLiftStage2::GasLiftStage2(
|
|||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
DeferredLogger &deferred_logger,
|
DeferredLogger &deferred_logger,
|
||||||
WellState &well_state,
|
WellState<double>& well_state,
|
||||||
const GroupState &group_state,
|
const GroupState<double>& group_state,
|
||||||
GLiftProdWells &prod_wells,
|
GLiftProdWells &prod_wells,
|
||||||
GLiftOptWells &glift_wells,
|
GLiftOptWells &glift_wells,
|
||||||
GasLiftGroupInfo& group_info,
|
GasLiftGroupInfo& group_info,
|
||||||
|
@ -37,10 +37,10 @@ class DeferredLogger;
|
|||||||
class GasLiftOpt;
|
class GasLiftOpt;
|
||||||
class GasLiftWellState;
|
class GasLiftWellState;
|
||||||
class Group;
|
class Group;
|
||||||
class GroupState;
|
template<class Scalar> class GroupState;
|
||||||
class Schedule;
|
class Schedule;
|
||||||
class WellInterfaceGeneric;
|
class WellInterfaceGeneric;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
class GasLiftStage2 : public GasLiftCommon {
|
class GasLiftStage2 : public GasLiftCommon {
|
||||||
using GasLiftSingleWell = GasLiftSingleWellGeneric;
|
using GasLiftSingleWell = GasLiftSingleWellGeneric;
|
||||||
@ -62,8 +62,8 @@ public:
|
|||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
GLiftProdWells& prod_wells,
|
GLiftProdWells& prod_wells,
|
||||||
GLiftOptWells& glift_wells,
|
GLiftOptWells& glift_wells,
|
||||||
GasLiftGroupInfo& group_info,
|
GasLiftGroupInfo& group_info,
|
||||||
|
@ -40,7 +40,8 @@
|
|||||||
|
|
||||||
namespace Opm {
|
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 start_timep = std::chrono::system_clock::from_time_t(start_time);
|
||||||
const auto sim_duration = std::chrono::duration_cast<std::chrono::system_clock::duration>(
|
const auto sim_duration = std::chrono::duration_cast<std::chrono::system_clock::duration>(
|
||||||
std::chrono::duration<double>(sim_time)
|
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();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupEconomicLimitsChecker::
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker(
|
GroupEconomicLimitsChecker<Scalar>::
|
||||||
const BlackoilWellModelGeneric &well_model,
|
GroupEconomicLimitsChecker(const BlackoilWellModelGeneric& well_model,
|
||||||
WellTestState &well_test_state,
|
WellTestState& well_test_state,
|
||||||
const Group &group,
|
const Group& group,
|
||||||
const double simulation_time,
|
const double simulation_time,
|
||||||
const int report_step_idx,
|
const int report_step_idx,
|
||||||
DeferredLogger &deferred_logger
|
DeferredLogger& deferred_logger)
|
||||||
) :
|
: well_model_{well_model}
|
||||||
well_model_{well_model}
|
, group_{group}
|
||||||
, group_{group}
|
, simulation_time_{simulation_time}
|
||||||
, simulation_time_{simulation_time}
|
, report_step_idx_{report_step_idx}
|
||||||
, report_step_idx_{report_step_idx}
|
, deferred_logger_{deferred_logger}
|
||||||
, deferred_logger_{deferred_logger}
|
, date_string_{simTimeToString(well_model.schedule().getStartTime(),simulation_time)}
|
||||||
, date_string_{simTimeToString(well_model.schedule().getStartTime(),simulation_time)}
|
, unit_system_{well_model.eclipseState().getUnits()}
|
||||||
, unit_system_{well_model.eclipseState().getUnits()}
|
, well_state_{well_model.wellState()}
|
||||||
, well_state_{well_model.wellState()}
|
, well_test_state_{well_test_state}
|
||||||
, well_test_state_{well_test_state}
|
, schedule_{well_model.schedule()}
|
||||||
, schedule_{well_model.schedule()}
|
, gecon_props_{schedule_[report_step_idx_].gecon().get_group_prop(
|
||||||
, gecon_props_{schedule_[report_step_idx_].gecon().get_group_prop(
|
schedule_, well_model_.summaryState(), group_.name())}
|
||||||
schedule_, well_model_.summaryState(), group_.name())}
|
|
||||||
{
|
{
|
||||||
for (std::size_t i = 0; i < this->phase_idx_map_.size(); i++) {
|
for (std::size_t i = 0; i < this->phase_idx_map_.size(); i++) {
|
||||||
auto phase_idx = this->phase_idx_map_[i];
|
auto phase_idx = this->phase_idx_map_[i];
|
||||||
this->phase_idx_reverse_map_[phase_idx] = static_cast<int>(i);
|
this->phase_idx_reverse_map_[phase_idx] = static_cast<int>(i);
|
||||||
auto phase_pos = this->well_model_.phaseUsage().phase_pos[phase_idx];
|
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->group_, this->schedule_, this->well_state_,
|
||||||
this->report_step_idx_, phase_pos, /*isInjector*/false);
|
this->report_step_idx_, phase_pos, /*isInjector*/false);
|
||||||
this->production_rates_[i] = this->well_model_.comm().sum(production_rate);
|
this->production_rates_[i] = this->well_model_.comm().sum(production_rate);
|
||||||
@ -88,22 +88,22 @@ GroupEconomicLimitsChecker(
|
|||||||
* Public methods in alphabetical order
|
* Public methods in alphabetical order
|
||||||
****************************************/
|
****************************************/
|
||||||
|
|
||||||
void
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker::
|
void GroupEconomicLimitsChecker<Scalar>::
|
||||||
activateEndRun()
|
activateEndRun()
|
||||||
{
|
{
|
||||||
displayDebugMessage("activate end run");
|
displayDebugMessage("activate end run");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker::
|
void GroupEconomicLimitsChecker<Scalar>::
|
||||||
closeWells()
|
closeWells()
|
||||||
{
|
{
|
||||||
closeWellsRecursive(this->group_);
|
closeWellsRecursive(this->group_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker::
|
void GroupEconomicLimitsChecker<Scalar>::
|
||||||
doWorkOver()
|
doWorkOver()
|
||||||
{
|
{
|
||||||
if (this->gecon_props_.workover() != GroupEconProductionLimits::EconWorkover::NONE) {
|
if (this->gecon_props_.workover() != GroupEconProductionLimits::EconWorkover::NONE) {
|
||||||
@ -111,8 +111,8 @@ doWorkOver()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker::
|
bool GroupEconomicLimitsChecker<Scalar>::
|
||||||
endRun()
|
endRun()
|
||||||
{
|
{
|
||||||
if (this->gecon_props_.endRun()) {
|
if (this->gecon_props_.endRun()) {
|
||||||
@ -121,15 +121,15 @@ endRun()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker::
|
bool GroupEconomicLimitsChecker<Scalar>::
|
||||||
GOR()
|
GOR()
|
||||||
{
|
{
|
||||||
auto oil_phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Liquid];
|
auto oil_phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Liquid];
|
||||||
auto gas_phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Vapour];
|
auto gas_phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Vapour];
|
||||||
auto oil_rate = this->production_rates_[oil_phase_idx];
|
auto oil_rate = this->production_rates_[oil_phase_idx];
|
||||||
auto gas_rate = this->production_rates_[gas_phase_idx];
|
auto gas_rate = this->production_rates_[gas_phase_idx];
|
||||||
double gor;
|
Scalar gor;
|
||||||
if (gas_rate <= 0.0) {
|
if (gas_rate <= 0.0) {
|
||||||
gor = 0.0;
|
gor = 0.0;
|
||||||
}
|
}
|
||||||
@ -155,8 +155,8 @@ GOR()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker::
|
bool GroupEconomicLimitsChecker<Scalar>::
|
||||||
minGasRate()
|
minGasRate()
|
||||||
{
|
{
|
||||||
auto phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Vapour];
|
auto phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Vapour];
|
||||||
@ -182,8 +182,8 @@ minGasRate()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker::
|
bool GroupEconomicLimitsChecker<Scalar>::
|
||||||
minOilRate()
|
minOilRate()
|
||||||
{
|
{
|
||||||
auto phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Liquid];
|
auto phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Liquid];
|
||||||
@ -209,22 +209,22 @@ minOilRate()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker::
|
int GroupEconomicLimitsChecker<Scalar>::
|
||||||
numProducersOpen()
|
numProducersOpen()
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker::
|
int GroupEconomicLimitsChecker<Scalar>::
|
||||||
numProducersOpenInitially()
|
numProducersOpenInitially()
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker::
|
bool GroupEconomicLimitsChecker<Scalar>::
|
||||||
waterCut()
|
waterCut()
|
||||||
{
|
{
|
||||||
auto oil_phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Liquid];
|
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 oil_rate = this->production_rates_[oil_phase_idx];
|
||||||
auto water_rate = this->production_rates_[water_phase_idx];
|
auto water_rate = this->production_rates_[water_phase_idx];
|
||||||
auto liquid_rate = oil_rate + water_rate;
|
auto liquid_rate = oil_rate + water_rate;
|
||||||
double water_cut;
|
Scalar water_cut;
|
||||||
if (liquid_rate == 0.0) {
|
if (liquid_rate == 0.0) {
|
||||||
water_cut = 0.0;
|
water_cut = 0.0;
|
||||||
}
|
}
|
||||||
@ -263,15 +263,15 @@ waterCut()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker::
|
bool GroupEconomicLimitsChecker<Scalar>::
|
||||||
WGR()
|
WGR()
|
||||||
{
|
{
|
||||||
auto water_phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Aqua];
|
auto water_phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Aqua];
|
||||||
auto gas_phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Vapour];
|
auto gas_phase_idx = this->phase_idx_reverse_map_[BlackoilPhases::Vapour];
|
||||||
auto water_rate = this->production_rates_[water_phase_idx];
|
auto water_rate = this->production_rates_[water_phase_idx];
|
||||||
auto gas_rate = this->production_rates_[gas_phase_idx];
|
auto gas_rate = this->production_rates_[gas_phase_idx];
|
||||||
double wgr;
|
Scalar wgr;
|
||||||
if (water_rate <= 0.0) {
|
if (water_rate <= 0.0) {
|
||||||
wgr = 0.0;
|
wgr = 0.0;
|
||||||
}
|
}
|
||||||
@ -301,9 +301,9 @@ WGR()
|
|||||||
* Private methods in alphabetical order
|
* Private methods in alphabetical order
|
||||||
****************************************/
|
****************************************/
|
||||||
|
|
||||||
void
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker::
|
void GroupEconomicLimitsChecker<Scalar>::
|
||||||
displayDebugMessage(const std::string &msg) const
|
displayDebugMessage(const std::string& msg) const
|
||||||
{
|
{
|
||||||
if (this->debug_) {
|
if (this->debug_) {
|
||||||
const std::string msg2 = fmt::format(
|
const std::string msg2 = fmt::format(
|
||||||
@ -312,9 +312,12 @@ displayDebugMessage(const std::string &msg) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker::
|
void GroupEconomicLimitsChecker<Scalar>::
|
||||||
addPrintMessage(const std::string &msg, const double value, const double limit, const UnitSystem::measure measure)
|
addPrintMessage(const std::string& msg,
|
||||||
|
const Scalar value,
|
||||||
|
const Scalar limit,
|
||||||
|
const UnitSystem::measure measure)
|
||||||
{
|
{
|
||||||
const std::string header = fmt::format(
|
const std::string header = fmt::format(
|
||||||
"{}\nAt time = {:.2f} {} (date = {}): Group {} will close because: \n", this->message_separator(),
|
"{}\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;
|
this->message_ += message;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker::
|
bool GroupEconomicLimitsChecker<Scalar>::
|
||||||
closeWellsRecursive(const Group& group, int level)
|
closeWellsRecursive(const Group& group, int level)
|
||||||
{
|
{
|
||||||
bool wells_closed = false;
|
bool wells_closed = false;
|
||||||
@ -390,11 +393,14 @@ closeWellsRecursive(const Group& group, int level)
|
|||||||
return wells_closed;
|
return wells_closed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
template<class Scalar>
|
||||||
GroupEconomicLimitsChecker::
|
void GroupEconomicLimitsChecker<Scalar>::
|
||||||
throwNotImplementedError(const std::string &error) const
|
throwNotImplementedError(const std::string& error) const
|
||||||
{
|
{
|
||||||
const std::string msg = fmt::format("Group: {} : GECON : {} not implemented", this->group_.name(), error);
|
const std::string msg = fmt::format("Group: {} : GECON : {} not implemented", this->group_.name(), error);
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, msg, this->deferred_logger_);
|
OPM_DEFLOG_THROW(std::runtime_error, msg, this->deferred_logger_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template class GroupEconomicLimitsChecker<double>;
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -34,59 +34,66 @@ namespace Opm
|
|||||||
class BlackoilWellModelGeneric;
|
class BlackoilWellModelGeneric;
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
class Group;
|
class Group;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
class WellTestState;
|
class WellTestState;
|
||||||
|
|
||||||
class GroupEconomicLimitsChecker
|
template<class Scalar>
|
||||||
{
|
class GroupEconomicLimitsChecker
|
||||||
public:
|
{
|
||||||
GroupEconomicLimitsChecker(
|
public:
|
||||||
const BlackoilWellModelGeneric &well_model,
|
GroupEconomicLimitsChecker(const BlackoilWellModelGeneric& well_model,
|
||||||
WellTestState &well_test_state,
|
WellTestState& well_test_state,
|
||||||
const Group &group,
|
const Group& group,
|
||||||
const double simulation_time,
|
const double simulation_time,
|
||||||
const int report_step_idx,
|
const int report_step_idx,
|
||||||
DeferredLogger &deferred_logger
|
DeferredLogger& deferred_logger);
|
||||||
);
|
void closeWells();
|
||||||
void closeWells();
|
bool minGasRate();
|
||||||
bool minGasRate();
|
bool minOilRate();
|
||||||
bool minOilRate();
|
bool waterCut();
|
||||||
bool waterCut();
|
bool GOR();
|
||||||
bool GOR();
|
bool WGR();
|
||||||
bool WGR();
|
void doWorkOver();
|
||||||
void doWorkOver();
|
bool endRun();
|
||||||
bool endRun();
|
int numProducersOpenInitially();
|
||||||
int numProducersOpenInitially();
|
int numProducersOpen();
|
||||||
int numProducersOpen();
|
void activateEndRun();
|
||||||
void activateEndRun();
|
std::string message_separator(const char sep_char = '*',
|
||||||
std::string message_separator(const char sep_char='*', const size_t sep_length=110) const { return std::string(sep_length, sep_char); }
|
const size_t sep_length = 110) const
|
||||||
|
{ return std::string(sep_length, sep_char); }
|
||||||
|
|
||||||
static constexpr int NUM_PHASES = 3;
|
static constexpr int NUM_PHASES = 3;
|
||||||
private:
|
|
||||||
void displayDebugMessage(const std::string &msg) const;
|
private:
|
||||||
void addPrintMessage(const std::string &msg, const double value, const double limit, const UnitSystem::measure measure);
|
void displayDebugMessage(const std::string& msg) const;
|
||||||
bool closeWellsRecursive(const Group& group, int level = 0);
|
void addPrintMessage(const std::string& msg,
|
||||||
void throwNotImplementedError(const std::string &error) const;
|
const Scalar value,
|
||||||
const BlackoilWellModelGeneric &well_model_;
|
const Scalar limit,
|
||||||
const Group &group_;
|
const UnitSystem::measure measure);
|
||||||
const double simulation_time_;
|
bool closeWellsRecursive(const Group& group, int level = 0);
|
||||||
const int report_step_idx_;
|
void throwNotImplementedError(const std::string& error) const;
|
||||||
DeferredLogger &deferred_logger_;
|
|
||||||
const std::string date_string_;
|
const BlackoilWellModelGeneric& well_model_;
|
||||||
const UnitSystem& unit_system_;
|
const Group& group_;
|
||||||
const WellState &well_state_;
|
const double simulation_time_;
|
||||||
WellTestState &well_test_state_;
|
const int report_step_idx_;
|
||||||
const Schedule &schedule_;
|
DeferredLogger& deferred_logger_;
|
||||||
GroupEconProductionLimits::GEconGroupProp gecon_props_;
|
const std::string date_string_;
|
||||||
bool debug_ = true;
|
const UnitSystem& unit_system_;
|
||||||
std::array<double,NUM_PHASES> production_rates_;
|
const WellState<Scalar>& well_state_;
|
||||||
std::map<int, BlackoilPhases::PhaseIndex> phase_idx_map_ = {
|
WellTestState& well_test_state_;
|
||||||
{0, BlackoilPhases::Liquid},
|
const Schedule& schedule_;
|
||||||
{1, BlackoilPhases::Vapour},
|
GroupEconProductionLimits::GEconGroupProp gecon_props_;
|
||||||
{2, BlackoilPhases::Aqua}};
|
bool debug_ = true;
|
||||||
std::map<BlackoilPhases::PhaseIndex, int> phase_idx_reverse_map_;
|
std::array<Scalar,NUM_PHASES> production_rates_;
|
||||||
std::string message_;
|
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
|
} // namespace Opm
|
||||||
|
|
||||||
|
@ -29,11 +29,13 @@
|
|||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
GroupState::GroupState(std::size_t np) :
|
template<class Scalar>
|
||||||
|
GroupState<Scalar>::GroupState(std::size_t np) :
|
||||||
num_phases(np)
|
num_phases(np)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
GroupState GroupState::serializationTestObject()
|
template<class Scalar>
|
||||||
|
GroupState<Scalar> GroupState<Scalar>::serializationTestObject()
|
||||||
{
|
{
|
||||||
GroupState result(3);
|
GroupState result(3);
|
||||||
result.m_production_rates = {{"test1", {1.0, 2.0}}};
|
result.m_production_rates = {{"test1", {1.0, 2.0}}};
|
||||||
@ -52,7 +54,9 @@ GroupState GroupState::serializationTestObject()
|
|||||||
return result;
|
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 &&
|
return this->m_production_rates == other.m_production_rates &&
|
||||||
this->production_controls == other.production_controls &&
|
this->production_controls == other.production_controls &&
|
||||||
this->prod_red_rates == other.prod_red_rates &&
|
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);
|
auto group_iter = this->m_production_rates.find(gname);
|
||||||
return (group_iter != this->m_production_rates.end());
|
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)
|
if (rates.size() != this->num_phases)
|
||||||
throw std::logic_error("Wrong number of phases");
|
throw std::logic_error("Wrong number of phases");
|
||||||
|
|
||||||
this->m_production_rates[gname] = rates;
|
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);
|
auto group_iter = this->m_production_rates.find(gname);
|
||||||
if (group_iter == this->m_production_rates.end())
|
if (group_iter == this->m_production_rates.end())
|
||||||
throw std::logic_error("No such group");
|
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);
|
auto group_iter = this->prod_red_rates.find(gname);
|
||||||
return (group_iter != this->prod_red_rates.end());
|
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)
|
if (rates.size() != this->num_phases)
|
||||||
throw std::logic_error("Wrong number of phases");
|
throw std::logic_error("Wrong number of phases");
|
||||||
|
|
||||||
this->prod_red_rates[gname] = rates;
|
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);
|
auto group_iter = this->prod_red_rates.find(gname);
|
||||||
if (group_iter == this->prod_red_rates.end())
|
if (group_iter == this->prod_red_rates.end())
|
||||||
throw std::logic_error("No such group");
|
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);
|
auto group_iter = this->inj_red_rates.find(gname);
|
||||||
return (group_iter != this->inj_red_rates.end());
|
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)
|
if (rates.size() != this->num_phases)
|
||||||
throw std::logic_error("Wrong number of phases");
|
throw std::logic_error("Wrong number of phases");
|
||||||
|
|
||||||
this->inj_red_rates[gname] = rates;
|
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);
|
auto group_iter = this->inj_red_rates.find(gname);
|
||||||
if (group_iter == this->inj_red_rates.end())
|
if (group_iter == this->inj_red_rates.end())
|
||||||
throw std::logic_error("No such group");
|
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);
|
auto group_iter = this->inj_surface_rates.find(gname);
|
||||||
return (group_iter != this->inj_surface_rates.end());
|
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)
|
if (rates.size() != this->num_phases)
|
||||||
throw std::logic_error("Wrong number of phases");
|
throw std::logic_error("Wrong number of phases");
|
||||||
|
|
||||||
this->inj_surface_rates[gname] = rates;
|
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);
|
auto group_iter = this->inj_surface_rates.find(gname);
|
||||||
if (group_iter == this->inj_surface_rates.end())
|
if (group_iter == this->inj_surface_rates.end())
|
||||||
throw std::logic_error("No such group");
|
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);
|
auto group_iter = this->inj_resv_rates.find(gname);
|
||||||
return (group_iter != this->inj_resv_rates.end());
|
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)
|
if (rates.size() != this->num_phases)
|
||||||
throw std::logic_error("Wrong number of phases");
|
throw std::logic_error("Wrong number of phases");
|
||||||
|
|
||||||
this->inj_resv_rates[gname] = rates;
|
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);
|
auto group_iter = this->inj_resv_rates.find(gname);
|
||||||
if (group_iter == this->inj_resv_rates.end())
|
if (group_iter == this->inj_resv_rates.end())
|
||||||
throw std::logic_error("No such group");
|
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)
|
if (rates.size() != this->num_phases)
|
||||||
throw std::logic_error("Wrong number of phases");
|
throw std::logic_error("Wrong number of phases");
|
||||||
|
|
||||||
this->inj_rein_rates[gname] = rates;
|
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);
|
auto group_iter = this->inj_rein_rates.find(gname);
|
||||||
if (group_iter == this->inj_rein_rates.end())
|
if (group_iter == this->inj_rein_rates.end())
|
||||||
throw std::logic_error("No such group");
|
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;
|
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);
|
auto group_iter = this->inj_vrep_rate.find(gname);
|
||||||
if (group_iter == this->inj_vrep_rate.end())
|
if (group_iter == this->inj_vrep_rate.end())
|
||||||
throw std::logic_error("No such group");
|
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;
|
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);
|
auto group_iter = this->m_grat_sales_target.find(gname);
|
||||||
if (group_iter == this->m_grat_sales_target.end())
|
if (group_iter == this->m_grat_sales_target.end())
|
||||||
throw std::logic_error("No such group");
|
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;
|
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);
|
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);
|
auto group_iter = this->production_controls.find(gname);
|
||||||
if (group_iter == this->production_controls.end())
|
if (group_iter == this->production_controls.end())
|
||||||
return false;
|
return false;
|
||||||
@ -234,11 +313,18 @@ bool GroupState::has_production_control(const std::string& gname) const {
|
|||||||
return true;
|
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;
|
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);
|
auto group_iter = this->production_controls.find(gname);
|
||||||
if (group_iter == this->production_controls.end())
|
if (group_iter == this->production_controls.end())
|
||||||
throw std::logic_error("Could not find any control for production group: " + gname);
|
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;
|
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;
|
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 key = std::make_pair(phase, gname);
|
||||||
auto group_iter = this->injection_controls.find( key );
|
auto group_iter = this->injection_controls.find( key );
|
||||||
if (group_iter == this->injection_controls.end())
|
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))
|
if (!this->gpmaint_state.has(gname))
|
||||||
this->gpmaint_state.add(gname, GPMaint::State{});
|
this->gpmaint_state.add(gname, GPMaint::State{});
|
||||||
return this->gpmaint_state[gname];
|
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;
|
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);
|
auto group_iter = this->m_gpmaint_target.find(gname);
|
||||||
if (group_iter == this->m_gpmaint_target.end())
|
if (group_iter == this->m_gpmaint_target.end())
|
||||||
throw std::logic_error("No such group");
|
throw std::logic_error("No such group");
|
||||||
@ -288,8 +392,13 @@ double GroupState::gpmaint_target(const std::string& gname) const {
|
|||||||
return group_iter->second;
|
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);
|
return (this->m_gpmaint_target.count(gname) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template class GroupState<double>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
class GroupState {
|
class GroupState {
|
||||||
public:
|
public:
|
||||||
GroupState() = default;
|
GroupState() = default;
|
||||||
@ -41,38 +42,43 @@ public:
|
|||||||
bool operator==(const GroupState& other) const;
|
bool operator==(const GroupState& other) const;
|
||||||
|
|
||||||
bool has_production_rates(const std::string& gname) const;
|
bool has_production_rates(const std::string& gname) const;
|
||||||
void update_production_rates(const std::string& gname, const std::vector<double>& rates);
|
void update_production_rates(const std::string& gname,
|
||||||
const std::vector<double>& production_rates(const std::string& gname) const;
|
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;
|
bool has_production_reduction_rates(const std::string& gname) const;
|
||||||
void update_production_reduction_rates(const std::string& gname, const std::vector<double>& rates);
|
void update_production_reduction_rates(const std::string& gname,
|
||||||
const std::vector<double>& production_reduction_rates(const std::string& gname) const;
|
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;
|
bool has_injection_reduction_rates(const std::string& gname) const;
|
||||||
void update_injection_reduction_rates(const std::string& gname, const std::vector<double>& rates);
|
void update_injection_reduction_rates(const std::string& gname,
|
||||||
const std::vector<double>& injection_reduction_rates(const std::string& gname) const;
|
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;
|
bool has_injection_reservoir_rates(const std::string& gname) const;
|
||||||
void update_injection_reservoir_rates(const std::string& gname, const std::vector<double>& rates);
|
void update_injection_reservoir_rates(const std::string& gname,
|
||||||
const std::vector<double>& injection_reservoir_rates(const std::string& gname) const;
|
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;
|
bool has_injection_surface_rates(const std::string& gname) const;
|
||||||
void update_injection_surface_rates(const std::string& gname, const std::vector<double>& rates);
|
void update_injection_surface_rates(const std::string& gname,
|
||||||
const std::vector<double>& injection_surface_rates(const std::string& gname) const;
|
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);
|
void update_injection_vrep_rate(const std::string& gname, Scalar rate);
|
||||||
const std::vector<double>& injection_rein_rates(const std::string& gname) const;
|
Scalar injection_vrep_rate(const std::string& gname) const;
|
||||||
|
|
||||||
void update_injection_vrep_rate(const std::string& gname, double rate);
|
void update_grat_sales_target(const std::string& gname, Scalar target);
|
||||||
double injection_vrep_rate(const std::string& gname) const;
|
Scalar grat_sales_target(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;
|
|
||||||
bool has_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);
|
void update_gpmaint_target(const std::string& gname, Scalar target);
|
||||||
double gpmaint_target(const std::string& gname) const;
|
Scalar gpmaint_target(const std::string& gname) const;
|
||||||
bool has_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;
|
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;
|
Group::InjectionCMode injection_control(const std::string& gname, Phase phase) const;
|
||||||
|
|
||||||
std::size_t data_size() const;
|
std::size_t data_size() const;
|
||||||
std::size_t collect(double * data) const;
|
std::size_t collect(Scalar* data) const;
|
||||||
std::size_t distribute(const double * data);
|
std::size_t distribute(const Scalar* data);
|
||||||
|
|
||||||
GPMaint::State& gpmaint(const std::string& gname);
|
GPMaint::State& gpmaint(const std::string& gname);
|
||||||
|
|
||||||
|
|
||||||
template<class Comm>
|
template<class Comm>
|
||||||
void communicate_rates(const Comm& comm)
|
void communicate_rates(const Comm& comm)
|
||||||
{
|
{
|
||||||
@ -125,11 +130,9 @@ public:
|
|||||||
sz += this->inj_vrep_rate.size();
|
sz += this->inj_vrep_rate.size();
|
||||||
|
|
||||||
// Make a vector and collect all data into it.
|
// Make a vector and collect all data into it.
|
||||||
std::vector<double> data(sz);
|
std::vector<Scalar> data(sz);
|
||||||
std::size_t pos = 0;
|
std::size_t pos = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// That the collect function mutates the vector v is an artifact for
|
// That the collect function mutates the vector v is an artifact for
|
||||||
// testing.
|
// testing.
|
||||||
auto collect = [&data, &pos](auto& v) {
|
auto collect = [&data, &pos](auto& v) {
|
||||||
@ -183,17 +186,16 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::size_t num_phases{};
|
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, Group::ProductionCMode> production_controls;
|
||||||
std::map<std::string, std::vector<double>> prod_red_rates;
|
std::map<std::string, std::vector<Scalar>> prod_red_rates;
|
||||||
std::map<std::string, std::vector<double>> inj_red_rates;
|
std::map<std::string, std::vector<Scalar>> inj_red_rates;
|
||||||
std::map<std::string, std::vector<double>> inj_surface_rates;
|
std::map<std::string, std::vector<Scalar>> inj_surface_rates;
|
||||||
std::map<std::string, std::vector<double>> inj_resv_rates;
|
std::map<std::string, std::vector<Scalar>> inj_resv_rates;
|
||||||
std::map<std::string, std::vector<double>> inj_rein_rates;
|
std::map<std::string, std::vector<Scalar>> inj_rein_rates;
|
||||||
std::map<std::string, double> inj_vrep_rate;
|
std::map<std::string, Scalar> inj_vrep_rate;
|
||||||
std::map<std::string, double> m_grat_sales_target;
|
std::map<std::string, Scalar> m_grat_sales_target;
|
||||||
std::map<std::string, double> m_gpmaint_target;
|
std::map<std::string, Scalar> m_gpmaint_target;
|
||||||
|
|
||||||
|
|
||||||
std::map<std::pair<Phase, std::string>, Group::InjectionCMode> injection_controls;
|
std::map<std::pair<Phase, std::string>, Group::InjectionCMode> injection_controls;
|
||||||
WellContainer<GPMaint::State> gpmaint_state;
|
WellContainer<GPMaint::State> gpmaint_state;
|
||||||
|
@ -78,66 +78,66 @@ namespace Opm
|
|||||||
const int index_of_well,
|
const int index_of_well,
|
||||||
const std::vector<PerforationData>& perf_data);
|
const std::vector<PerforationData>& perf_data);
|
||||||
|
|
||||||
virtual void init(const PhaseUsage* phase_usage_arg,
|
void init(const PhaseUsage* phase_usage_arg,
|
||||||
const std::vector<double>& depth_arg,
|
const std::vector<double>& depth_arg,
|
||||||
const double gravity_arg,
|
const double gravity_arg,
|
||||||
const int num_cells,
|
const int num_cells,
|
||||||
const std::vector< Scalar >& B_avg,
|
const std::vector<Scalar>& B_avg,
|
||||||
const bool changed_to_open_this_step) override;
|
const bool changed_to_open_this_step) override;
|
||||||
|
|
||||||
void initPrimaryVariablesEvaluation() override;
|
void initPrimaryVariablesEvaluation() override;
|
||||||
|
|
||||||
/// updating the well state based the current control mode
|
/// updating the well state based the current control mode
|
||||||
virtual void updateWellStateWithTarget(const Simulator& simulator,
|
void updateWellStateWithTarget(const Simulator& simulator,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) const override;
|
DeferredLogger& deferred_logger) const override;
|
||||||
|
|
||||||
/// check whether the well equations get converged for this well
|
/// check whether the well equations get converged for this well
|
||||||
virtual ConvergenceReport getWellConvergence(const SummaryState& summary_state,
|
ConvergenceReport getWellConvergence(const SummaryState& summary_state,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
const std::vector<double>& B_avg,
|
const std::vector<double>& B_avg,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const bool relax_tolerance) const override;
|
const bool relax_tolerance) const override;
|
||||||
|
|
||||||
/// Ax = Ax - C D^-1 B x
|
/// 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
|
/// 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
|
/// using the solution x to recover the solution xw for wells and applying
|
||||||
/// xw to update Well State
|
/// xw to update Well State
|
||||||
void recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
void recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
||||||
const BVector& x,
|
const BVector& x,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
/// computing the well potentials for group control
|
/// computing the well potentials for group control
|
||||||
virtual void computeWellPotentials(const Simulator& simulator,
|
void computeWellPotentials(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
std::vector<double>& well_potentials,
|
std::vector<double>& well_potentials,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
void updatePrimaryVariables(const SummaryState& summary_state,
|
void updatePrimaryVariables(const SummaryState& summary_state,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
virtual void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) override; // const?
|
DeferredLogger& deferred_logger) override; // const?
|
||||||
|
|
||||||
virtual void calculateExplicitQuantities(const Simulator& simulator,
|
void calculateExplicitQuantities(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) override; // should be const?
|
DeferredLogger& deferred_logger) override; // should be const?
|
||||||
|
|
||||||
void updateIPRImplicit(const Simulator& simulator,
|
void updateIPRImplicit(const Simulator& simulator,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
virtual void updateProductivityIndex(const Simulator& simulator,
|
void updateProductivityIndex(const Simulator& simulator,
|
||||||
const WellProdIndexCalculator& wellPICalc,
|
const WellProdIndexCalculator& wellPICalc,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) const override;
|
DeferredLogger& deferred_logger) const override;
|
||||||
|
|
||||||
double connectionDensity(const int globalConnIdx,
|
double connectionDensity(const int globalConnIdx,
|
||||||
const int openConnIdx) const override;
|
const int openConnIdx) const override;
|
||||||
@ -148,7 +148,7 @@ namespace Opm
|
|||||||
const BVector& x,
|
const BVector& x,
|
||||||
const int pressureVarIndex,
|
const int pressureVarIndex,
|
||||||
const bool use_well_weights,
|
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,
|
std::vector<double> computeCurrentWellRates(const Simulator& simulator,
|
||||||
DeferredLogger& deferred_logger) const override;
|
DeferredLogger& deferred_logger) const override;
|
||||||
@ -176,7 +176,7 @@ namespace Opm
|
|||||||
// updating the well_state based on well solution dwells
|
// updating the well_state based on well solution dwells
|
||||||
void updateWellState(const SummaryState& summary_state,
|
void updateWellState(const SummaryState& summary_state,
|
||||||
const BVectorWell& dwells,
|
const BVectorWell& dwells,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const double relaxation_factor = 1.0);
|
const double relaxation_factor = 1.0);
|
||||||
|
|
||||||
@ -243,10 +243,10 @@ namespace Opm
|
|||||||
std::vector<double>& well_flux,
|
std::vector<double>& well_flux,
|
||||||
DeferredLogger& deferred_logger) const override;
|
DeferredLogger& deferred_logger) const override;
|
||||||
|
|
||||||
std::vector<double> computeWellPotentialWithTHP(
|
std::vector<double>
|
||||||
const WellState& well_state,
|
computeWellPotentialWithTHP(const WellState<Scalar>& well_state,
|
||||||
const Simulator& simulator,
|
const Simulator& simulator,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
bool computeWellPotentialsImplicit(const Simulator& simulator,
|
bool computeWellPotentialsImplicit(const Simulator& simulator,
|
||||||
std::vector<double>& well_potentials,
|
std::vector<double>& well_potentials,
|
||||||
@ -258,16 +258,16 @@ namespace Opm
|
|||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
virtual bool iterateWellEqWithSwitching(const Simulator& simulator,
|
virtual bool iterateWellEqWithSwitching(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const bool fixed_control = false,
|
const bool fixed_control = false,
|
||||||
const bool fixed_status = false) override;
|
const bool fixed_status = false) override;
|
||||||
@ -276,11 +276,11 @@ namespace Opm
|
|||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger) override;
|
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;
|
EvalWell getSegmentSurfaceVolume(const Simulator& simulator, const int seg_idx) const;
|
||||||
|
|
||||||
@ -297,30 +297,31 @@ namespace Opm
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::optional<double> computeBhpAtThpLimitProd(
|
std::optional<double>
|
||||||
const WellState& well_state,
|
computeBhpAtThpLimitProd(const WellState<Scalar>& well_state,
|
||||||
const Simulator& simulator,
|
const Simulator& simulator,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
std::optional<double> computeBhpAtThpLimitInj(const Simulator& simulator,
|
std::optional<double>
|
||||||
const SummaryState& summary_state,
|
computeBhpAtThpLimitInj(const Simulator& simulator,
|
||||||
DeferredLogger& deferred_logger) const;
|
const SummaryState& summary_state,
|
||||||
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
double maxPerfPress(const Simulator& simulator) const;
|
double maxPerfPress(const Simulator& simulator) const;
|
||||||
|
|
||||||
// check whether the well is operable under BHP limit with current reservoir condition
|
// 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,
|
const Simulator& ebos_simulator,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
// check whether the well is operable under THP limit with current reservoir condition
|
// check whether the well is operable under THP limit with current reservoir condition
|
||||||
void checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
void checkOperabilityUnderTHPLimit(const Simulator& ebos_simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
// updating the inflow based on the current reservoir condition
|
// 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;
|
DeferredLogger& deferred_logger) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -83,8 +83,8 @@ private:
|
|||||||
|
|
||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
void MultisegmentWellAssemble<FluidSystem,Indices>::
|
void MultisegmentWellAssemble<FluidSystem,Indices>::
|
||||||
assembleControlEq(const WellState& well_state,
|
assembleControlEq(const WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
|
@ -30,13 +30,13 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
|
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
class GroupState;
|
template<class Scalar> class GroupState;
|
||||||
template<class Scalar, int numWellEq, int numEq> class MultisegmentWellEquations;
|
template<class Scalar, int numWellEq, int numEq> class MultisegmentWellEquations;
|
||||||
template<class FluidSystem, class Indices> class MultisegmentWellPrimaryVariables;
|
template<class FluidSystem, class Indices> class MultisegmentWellPrimaryVariables;
|
||||||
class Schedule;
|
class Schedule;
|
||||||
class SummaryState;
|
class SummaryState;
|
||||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
//! \brief Class handling assemble of the equation system for MultisegmentWell.
|
//! \brief Class handling assemble of the equation system for MultisegmentWell.
|
||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
@ -70,8 +70,8 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
//! \brief Assemble control equation.
|
//! \brief Assemble control equation.
|
||||||
void assembleControlEq(const WellState& well_state,
|
void assembleControlEq(const WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
|
@ -313,7 +313,7 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
|
|||||||
const bool /*use_well_weights*/,
|
const bool /*use_well_weights*/,
|
||||||
const WellInterfaceGeneric& well,
|
const WellInterfaceGeneric& well,
|
||||||
const int seg_pressure_var_ind,
|
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
|
// Add the pressure contribution to the cpr system for the well
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ template void MultisegmentWellEquations<double,numWellEq,numEq>:: \
|
|||||||
const bool, \
|
const bool, \
|
||||||
const WellInterfaceGeneric&, \
|
const WellInterfaceGeneric&, \
|
||||||
const int, \
|
const int, \
|
||||||
const WellState&) const;
|
const WellState<double>&) const;
|
||||||
|
|
||||||
INSTANCE(2,1)
|
INSTANCE(2,1)
|
||||||
INSTANCE(2,2)
|
INSTANCE(2,2)
|
||||||
|
@ -42,7 +42,7 @@ template<class Scalar> class MultisegmentWellGeneric;
|
|||||||
class WellContributions;
|
class WellContributions;
|
||||||
#endif
|
#endif
|
||||||
class WellInterfaceGeneric;
|
class WellInterfaceGeneric;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
template<class Scalar, int numWellEq, int numEq>
|
template<class Scalar, int numWellEq, int numEq>
|
||||||
class MultisegmentWellEquations
|
class MultisegmentWellEquations
|
||||||
@ -120,7 +120,7 @@ public:
|
|||||||
const bool /*use_well_weights*/,
|
const bool /*use_well_weights*/,
|
||||||
const WellInterfaceGeneric& well,
|
const WellInterfaceGeneric& well,
|
||||||
const int seg_pressure_var_ind,
|
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.
|
//! \brief Returns a const reference to the residual.
|
||||||
const BVectorWell& residual() const
|
const BVectorWell& residual() const
|
||||||
|
@ -78,7 +78,7 @@ initMatrixAndVectors(const int num_cells)
|
|||||||
template<typename FluidSystem, typename Indices>
|
template<typename FluidSystem, typename Indices>
|
||||||
ConvergenceReport
|
ConvergenceReport
|
||||||
MultisegmentWellEval<FluidSystem,Indices>::
|
MultisegmentWellEval<FluidSystem,Indices>::
|
||||||
getWellConvergence(const WellState& well_state,
|
getWellConvergence(const WellState<Scalar>& well_state,
|
||||||
const std::vector<double>& B_avg,
|
const std::vector<double>& B_avg,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const double max_residual_allowed,
|
const double max_residual_allowed,
|
||||||
@ -199,7 +199,7 @@ template<typename FluidSystem, typename Indices>
|
|||||||
void
|
void
|
||||||
MultisegmentWellEval<FluidSystem,Indices>::
|
MultisegmentWellEval<FluidSystem,Indices>::
|
||||||
assembleAccelerationPressureLoss(const int seg,
|
assembleAccelerationPressureLoss(const int seg,
|
||||||
WellState& well_state)
|
WellState<Scalar>& well_state)
|
||||||
{
|
{
|
||||||
// Computes and assembles p-drop due to acceleration
|
// Computes and assembles p-drop due to acceleration
|
||||||
assert(seg != 0); // top segment can not enter here
|
assert(seg != 0); // top segment can not enter here
|
||||||
@ -246,7 +246,7 @@ template<typename FluidSystem, typename Indices>
|
|||||||
void
|
void
|
||||||
MultisegmentWellEval<FluidSystem,Indices>::
|
MultisegmentWellEval<FluidSystem,Indices>::
|
||||||
assembleDefaultPressureEq(const int seg,
|
assembleDefaultPressureEq(const int seg,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const bool use_average_density)
|
const bool use_average_density)
|
||||||
{
|
{
|
||||||
assert(seg != 0); // not top segment
|
assert(seg != 0); // not top segment
|
||||||
@ -293,7 +293,7 @@ void
|
|||||||
MultisegmentWellEval<FluidSystem,Indices>::
|
MultisegmentWellEval<FluidSystem,Indices>::
|
||||||
assembleICDPressureEq(const int seg,
|
assembleICDPressureEq(const int seg,
|
||||||
const UnitSystem& unit_system,
|
const UnitSystem& unit_system,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
const bool use_average_density,
|
const bool use_average_density,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
@ -377,7 +377,7 @@ template<typename FluidSystem, typename Indices>
|
|||||||
void
|
void
|
||||||
MultisegmentWellEval<FluidSystem,Indices>::
|
MultisegmentWellEval<FluidSystem,Indices>::
|
||||||
assembleAccelerationAndHydroPressureLosses(const int seg,
|
assembleAccelerationAndHydroPressureLosses(const int seg,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const bool use_average_density)
|
const bool use_average_density)
|
||||||
{
|
{
|
||||||
if (this->accelerationalPressureLossConsidered()) {
|
if (this->accelerationalPressureLossConsidered()) {
|
||||||
@ -409,7 +409,7 @@ void
|
|||||||
MultisegmentWellEval<FluidSystem,Indices>::
|
MultisegmentWellEval<FluidSystem,Indices>::
|
||||||
assemblePressureEq(const int seg,
|
assemblePressureEq(const int seg,
|
||||||
const UnitSystem& unit_system,
|
const UnitSystem& unit_system,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
const bool use_average_density,
|
const bool use_average_density,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
@ -473,7 +473,7 @@ getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
|
|||||||
template<typename FluidSystem, typename Indices>
|
template<typename FluidSystem, typename Indices>
|
||||||
double
|
double
|
||||||
MultisegmentWellEval<FluidSystem,Indices>::
|
MultisegmentWellEval<FluidSystem,Indices>::
|
||||||
getControlTolerance(const WellState& well_state,
|
getControlTolerance(const WellState<Scalar>& well_state,
|
||||||
const double tolerance_wells,
|
const double tolerance_wells,
|
||||||
const double tolerance_pressure_ms_wells,
|
const double tolerance_pressure_ms_wells,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
@ -540,7 +540,7 @@ getControlTolerance(const WellState& well_state,
|
|||||||
template<typename FluidSystem, typename Indices>
|
template<typename FluidSystem, typename Indices>
|
||||||
double
|
double
|
||||||
MultisegmentWellEval<FluidSystem,Indices>::
|
MultisegmentWellEval<FluidSystem,Indices>::
|
||||||
getResidualMeasureValue(const WellState& well_state,
|
getResidualMeasureValue(const WellState<Scalar>& well_state,
|
||||||
const std::vector<double>& residuals,
|
const std::vector<double>& residuals,
|
||||||
const double tolerance_wells,
|
const double tolerance_wells,
|
||||||
const double tolerance_pressure_ms_wells,
|
const double tolerance_pressure_ms_wells,
|
||||||
|
@ -38,13 +38,12 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
|
|
||||||
class ConvergenceReport;
|
class ConvergenceReport;
|
||||||
class GroupState;
|
|
||||||
class Schedule;
|
class Schedule;
|
||||||
class WellContributions;
|
class WellContributions;
|
||||||
class SummaryState;
|
class SummaryState;
|
||||||
|
|
||||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
template<typename FluidSystem, typename Indices>
|
template<typename FluidSystem, typename Indices>
|
||||||
class MultisegmentWellEval : public MultisegmentWellGeneric<typename FluidSystem::Scalar>
|
class MultisegmentWellEval : public MultisegmentWellGeneric<typename FluidSystem::Scalar>
|
||||||
@ -79,31 +78,31 @@ protected:
|
|||||||
void initMatrixAndVectors(const int num_cells);
|
void initMatrixAndVectors(const int num_cells);
|
||||||
|
|
||||||
void assembleDefaultPressureEq(const int seg,
|
void assembleDefaultPressureEq(const int seg,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const bool use_average_density);
|
const bool use_average_density);
|
||||||
|
|
||||||
// assemble pressure equation for ICD segments
|
// assemble pressure equation for ICD segments
|
||||||
void assembleICDPressureEq(const int seg,
|
void assembleICDPressureEq(const int seg,
|
||||||
const UnitSystem& unit_system,
|
const UnitSystem& unit_system,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
const bool use_average_density,
|
const bool use_average_density,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
void assembleAccelerationAndHydroPressureLosses(const int seg,
|
void assembleAccelerationAndHydroPressureLosses(const int seg,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const bool use_average_density);
|
const bool use_average_density);
|
||||||
|
|
||||||
|
|
||||||
void assemblePressureEq(const int seg,
|
void assemblePressureEq(const int seg,
|
||||||
const UnitSystem& unit_system,
|
const UnitSystem& unit_system,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
const bool use_average_density,
|
const bool use_average_density,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
/// check whether the well equations get converged for this well
|
/// 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,
|
const std::vector<double>& B_avg,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const double max_residual_allowed,
|
const double max_residual_allowed,
|
||||||
@ -118,19 +117,19 @@ protected:
|
|||||||
getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
|
getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
double getControlTolerance(const WellState& well_state,
|
double getControlTolerance(const WellState<Scalar>& well_state,
|
||||||
const double tolerance_wells,
|
const double tolerance_wells,
|
||||||
const double tolerance_pressure_ms_wells,
|
const double tolerance_pressure_ms_wells,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
double getResidualMeasureValue(const WellState& well_state,
|
double getResidualMeasureValue(const WellState<Scalar>& well_state,
|
||||||
const std::vector<double>& residuals,
|
const std::vector<double>& residuals,
|
||||||
const double tolerance_wells,
|
const double tolerance_wells,
|
||||||
const double tolerance_pressure_ms_wells,
|
const double tolerance_pressure_ms_wells,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
void assembleAccelerationPressureLoss(const int seg,
|
void assembleAccelerationPressureLoss(const int seg,
|
||||||
WellState& well_state);
|
WellState<Scalar>& well_state);
|
||||||
|
|
||||||
EvalWell pressureDropAutoICD(const int seg,
|
EvalWell pressureDropAutoICD(const int seg,
|
||||||
const UnitSystem& unit_system) const;
|
const UnitSystem& unit_system) const;
|
||||||
|
@ -55,7 +55,7 @@ void
|
|||||||
MultisegmentWellGeneric<Scalar>::
|
MultisegmentWellGeneric<Scalar>::
|
||||||
scaleSegmentRatesWithWellRates(const std::vector<std::vector<int>>& segment_inlets,
|
scaleSegmentRatesWithWellRates(const std::vector<std::vector<int>>& segment_inlets,
|
||||||
const std::vector<std::vector<int>>& segment_perforations,
|
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& ws = well_state.well(baseif_.indexOfWell());
|
||||||
auto& segments = ws.segments;
|
auto& segments = ws.segments;
|
||||||
@ -84,10 +84,10 @@ scaleSegmentRatesWithWellRates(const std::vector<std::vector<int>>& segment_inle
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<double> rates;
|
std::vector<double> rates;
|
||||||
WellState::calculateSegmentRates(segment_inlets,
|
WellState<Scalar>::calculateSegmentRates(segment_inlets,
|
||||||
segment_perforations,
|
segment_perforations,
|
||||||
perforation_rates,
|
perforation_rates,
|
||||||
num_single_phase, 0, rates);
|
num_single_phase, 0, rates);
|
||||||
for (int seg = 0; seg < numberOfSegments(); ++seg) {
|
for (int seg = 0; seg < numberOfSegments(); ++seg) {
|
||||||
segment_rates[baseif_.numPhases() * seg + phase] = rates[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>
|
template <typename Scalar>
|
||||||
void
|
void
|
||||||
MultisegmentWellGeneric<Scalar>::
|
MultisegmentWellGeneric<Scalar>::
|
||||||
scaleSegmentPressuresWithBhp(WellState& well_state) const
|
scaleSegmentPressuresWithBhp(WellState<Scalar>& well_state) const
|
||||||
{
|
{
|
||||||
auto& ws = well_state.well(baseif_.indexOfWell());
|
auto& ws = well_state.well(baseif_.indexOfWell());
|
||||||
auto& segments = ws.segments;
|
auto& segments = ws.segments;
|
||||||
|
@ -35,7 +35,7 @@ class SummaryState;
|
|||||||
class WellInterfaceGeneric;
|
class WellInterfaceGeneric;
|
||||||
enum class WellSegmentCompPressureDrop;
|
enum class WellSegmentCompPressureDrop;
|
||||||
class WellSegments;
|
class WellSegments;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
template <typename Scalar>
|
template <typename Scalar>
|
||||||
class MultisegmentWellGeneric
|
class MultisegmentWellGeneric
|
||||||
@ -57,8 +57,8 @@ protected:
|
|||||||
// scale the segment rates and pressure based on well rates and bhp
|
// scale the segment rates and pressure based on well rates and bhp
|
||||||
void scaleSegmentRatesWithWellRates(const std::vector<std::vector<int>>& segment_inlets,
|
void scaleSegmentRatesWithWellRates(const std::vector<std::vector<int>>& segment_inlets,
|
||||||
const std::vector<std::vector<int>>& segment_perforations,
|
const std::vector<std::vector<int>>& segment_perforations,
|
||||||
WellState& well_state) const;
|
WellState<Scalar>& well_state) const;
|
||||||
void scaleSegmentPressuresWithBhp(WellState& well_state) const;
|
void scaleSegmentPressuresWithBhp(WellState<Scalar>& well_state) const;
|
||||||
|
|
||||||
// components of the pressure drop to be included
|
// components of the pressure drop to be included
|
||||||
WellSegmentCompPressureDrop compPressureDrop() const;
|
WellSegmentCompPressureDrop compPressureDrop() const;
|
||||||
|
@ -67,7 +67,8 @@ init()
|
|||||||
|
|
||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
void MultisegmentWellPrimaryVariables<FluidSystem,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 Water = BlackoilPhases::Aqua;
|
||||||
static constexpr int Gas = BlackoilPhases::Vapour;
|
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||||
@ -214,7 +215,7 @@ void MultisegmentWellPrimaryVariables<FluidSystem,Indices>::
|
|||||||
copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
||||||
const double rho,
|
const double rho,
|
||||||
const bool stop_or_zero_rate_target,
|
const bool stop_or_zero_rate_target,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ namespace Opm
|
|||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
template<class Scalar> class MultisegmentWellGeneric;
|
template<class Scalar> class MultisegmentWellGeneric;
|
||||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
class MultisegmentWellPrimaryVariables
|
class MultisegmentWellPrimaryVariables
|
||||||
@ -92,7 +92,8 @@ public:
|
|||||||
void init();
|
void init();
|
||||||
|
|
||||||
//! \brief Copy values from well state.
|
//! \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.
|
//! \brief Update values from newton update vector.
|
||||||
void updateNewton(const BVectorWell& dwells,
|
void updateNewton(const BVectorWell& dwells,
|
||||||
@ -105,7 +106,7 @@ public:
|
|||||||
void copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
void copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
||||||
const double rho,
|
const double rho,
|
||||||
const bool stop_or_zero_rate_target,
|
const bool stop_or_zero_rate_target,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
|
@ -864,7 +864,7 @@ accelerationPressureLossContribution(const int seg,
|
|||||||
template <class FluidSystem, class Indices>
|
template <class FluidSystem, class Indices>
|
||||||
void
|
void
|
||||||
MultisegmentWellSegments<FluidSystem,Indices>::
|
MultisegmentWellSegments<FluidSystem,Indices>::
|
||||||
copyPhaseDensities(const PhaseUsage& pu, SegmentState& segSol) const
|
copyPhaseDensities(const PhaseUsage& pu, SegmentState<Scalar>& segSol) const
|
||||||
{
|
{
|
||||||
auto* rho = segSol.phase_density.data();
|
auto* rho = segSol.phase_density.data();
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ namespace Opm {
|
|||||||
|
|
||||||
class AutoICD;
|
class AutoICD;
|
||||||
struct PhaseUsage;
|
struct PhaseUsage;
|
||||||
class SegmentState;
|
template<class Scalar> class SegmentState;
|
||||||
class UnitSystem;
|
class UnitSystem;
|
||||||
class WellInterfaceGeneric;
|
class WellInterfaceGeneric;
|
||||||
class SummaryState;
|
class SummaryState;
|
||||||
@ -131,7 +131,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void copyPhaseDensities(const PhaseUsage& pu,
|
void copyPhaseDensities(const PhaseUsage& pu,
|
||||||
SegmentState& segSol) const;
|
SegmentState<Scalar>& segSol) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// TODO: trying to use the information from the Well opm-parser as much
|
// 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_
|
// 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
|
// This is also assuming the order of the completions in Well is the same with
|
||||||
// the order of the completions in wells.
|
// 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
|
// it is for convenience reason. we can just calculate the information for segment once
|
||||||
// belonging to this segment
|
// then using it for all the perforations belonging to this segment
|
||||||
std::vector<std::vector<int>> perforations_;
|
std::vector<std::vector<int>> perforations_;
|
||||||
|
|
||||||
// depth difference between the segment and the perforation
|
// depth difference between the segment and the perforation
|
||||||
|
@ -156,7 +156,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
updatePrimaryVariables(const SummaryState& summary_state,
|
updatePrimaryVariables(const SummaryState& summary_state,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& /* deferred_logger */)
|
DeferredLogger& /* deferred_logger */)
|
||||||
{
|
{
|
||||||
const bool stop_or_zero_rate_target = this->stopppedOrZeroRateTarget(summary_state, well_state);
|
const bool stop_or_zero_rate_target = this->stopppedOrZeroRateTarget(summary_state, well_state);
|
||||||
@ -172,8 +172,8 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
updateWellStateWithTarget(const Simulator& simulator,
|
updateWellStateWithTarget(const Simulator& simulator,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
Base::updateWellStateWithTarget(simulator, group_state, well_state, deferred_logger);
|
Base::updateWellStateWithTarget(simulator, group_state, well_state, deferred_logger);
|
||||||
@ -193,7 +193,7 @@ namespace Opm
|
|||||||
ConvergenceReport
|
ConvergenceReport
|
||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
getWellConvergence(const SummaryState& /* summary_state */,
|
getWellConvergence(const SummaryState& /* summary_state */,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
const std::vector<double>& B_avg,
|
const std::vector<double>& B_avg,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const bool relax_tolerance) const
|
const bool relax_tolerance) const
|
||||||
@ -255,7 +255,7 @@ namespace Opm
|
|||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
||||||
const BVector& x,
|
const BVector& x,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) {
|
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) {
|
||||||
@ -275,7 +275,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
computeWellPotentials(const Simulator& simulator,
|
computeWellPotentials(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
std::vector<double>& well_potentials,
|
std::vector<double>& well_potentials,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
@ -346,7 +346,7 @@ namespace Opm
|
|||||||
well_flux.resize(np, 0.0);
|
well_flux.resize(np, 0.0);
|
||||||
const bool allow_cf = this->getAllowCrossFlow();
|
const bool allow_cf = this->getAllowCrossFlow();
|
||||||
const int nseg = this->numberOfSegments();
|
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());
|
const auto& ws = well_state.well(this->indexOfWell());
|
||||||
auto segments_copy = ws.segments;
|
auto segments_copy = ws.segments;
|
||||||
segments_copy.scale_pressure(bhp);
|
segments_copy.scale_pressure(bhp);
|
||||||
@ -391,7 +391,7 @@ namespace Opm
|
|||||||
well_copy.debug_cost_counter_ = 0;
|
well_copy.debug_cost_counter_ = 0;
|
||||||
|
|
||||||
// store a copy of the well state, we don't want to update the real well state
|
// 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();
|
const auto& group_state = simulator.problem().wellModel().groupState();
|
||||||
auto& ws = well_state_copy.well(this->index_of_well_);
|
auto& ws = well_state_copy.well(this->index_of_well_);
|
||||||
|
|
||||||
@ -452,10 +452,9 @@ namespace Opm
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
std::vector<double>
|
std::vector<double>
|
||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
computeWellPotentialWithTHP(
|
computeWellPotentialWithTHP(const WellState<Scalar>& well_state,
|
||||||
const WellState& well_state,
|
const Simulator& simulator,
|
||||||
const Simulator& simulator,
|
DeferredLogger& deferred_logger) const
|
||||||
DeferredLogger& deferred_logger) const
|
|
||||||
{
|
{
|
||||||
std::vector<double> potentials(this->number_of_phases_, 0.0);
|
std::vector<double> potentials(this->number_of_phases_, 0.0);
|
||||||
const auto& summary_state = simulator.vanguard().summaryState();
|
const auto& summary_state = simulator.vanguard().summaryState();
|
||||||
@ -513,7 +512,7 @@ namespace Opm
|
|||||||
well_copy.debug_cost_counter_ = 0;
|
well_copy.debug_cost_counter_ = 0;
|
||||||
|
|
||||||
// store a copy of the well state, we don't want to update the real well state
|
// 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();
|
const auto& group_state = simulator.problem().wellModel().groupState();
|
||||||
auto& ws = well_state_copy.well(this->index_of_well_);
|
auto& ws = well_state_copy.well(this->index_of_well_);
|
||||||
|
|
||||||
@ -572,7 +571,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
solveEqAndUpdateWellState(const SummaryState& summary_state,
|
solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||||
@ -676,7 +675,7 @@ namespace Opm
|
|||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
updateWellState(const SummaryState& summary_state,
|
updateWellState(const SummaryState& summary_state,
|
||||||
const BVectorWell& dwells,
|
const BVectorWell& dwells,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const double relaxation_factor)
|
const double relaxation_factor)
|
||||||
{
|
{
|
||||||
@ -710,7 +709,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
calculateExplicitQuantities(const Simulator& simulator,
|
calculateExplicitQuantities(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
const auto& summary_state = simulator.vanguard().summaryState();
|
const auto& summary_state = simulator.vanguard().summaryState();
|
||||||
@ -729,7 +728,7 @@ namespace Opm
|
|||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
updateProductivityIndex(const Simulator& simulator,
|
updateProductivityIndex(const Simulator& simulator,
|
||||||
const WellProdIndexCalculator& wellPICalc,
|
const WellProdIndexCalculator& wellPICalc,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
auto fluidState = [&simulator, this](const int perf)
|
auto fluidState = [&simulator, this](const int perf)
|
||||||
@ -834,7 +833,7 @@ namespace Opm
|
|||||||
const BVector& weights,
|
const BVector& weights,
|
||||||
const int pressureVarIndex,
|
const int pressureVarIndex,
|
||||||
const bool use_well_weights,
|
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
|
// Add the pressure contribution to the cpr system for the well
|
||||||
this->linSys_.extractCPRPressureMatrix(jacobian,
|
this->linSys_.extractCPRPressureMatrix(jacobian,
|
||||||
@ -1150,7 +1149,9 @@ namespace Opm
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
void
|
||||||
MultisegmentWell<TypeTag>::
|
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 auto& summaryState = simulator.vanguard().summaryState();
|
||||||
const double bhp_limit = WellBhpThpCalculator(*this).mostStrictBhpFromBhpLimits(summaryState);
|
const double bhp_limit = WellBhpThpCalculator(*this).mostStrictBhpFromBhpLimits(summaryState);
|
||||||
@ -1308,7 +1309,9 @@ namespace Opm
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
void
|
||||||
MultisegmentWell<TypeTag>::
|
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:
|
// Compute IPR based on *converged* well-equation:
|
||||||
// For a component rate r the derivative dr/dbhp is obtained by
|
// For a component rate r the derivative dr/dbhp is obtained by
|
||||||
@ -1375,10 +1378,9 @@ namespace Opm
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
void
|
||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
checkOperabilityUnderTHPLimit(
|
checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
||||||
const Simulator& simulator,
|
const WellState<Scalar>& well_state,
|
||||||
const WellState& well_state,
|
DeferredLogger& deferred_logger)
|
||||||
DeferredLogger& deferred_logger)
|
|
||||||
{
|
{
|
||||||
const auto& summaryState = simulator.vanguard().summaryState();
|
const auto& summaryState = simulator.vanguard().summaryState();
|
||||||
const auto obtain_bhp = this->isProducer()
|
const auto obtain_bhp = this->isProducer()
|
||||||
@ -1432,8 +1434,8 @@ namespace Opm
|
|||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return true;
|
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return true;
|
||||||
@ -1584,8 +1586,8 @@ namespace Opm
|
|||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const bool fixed_control /*false*/,
|
const bool fixed_control /*false*/,
|
||||||
const bool fixed_status /*false*/)
|
const bool fixed_status /*false*/)
|
||||||
@ -1775,8 +1777,8 @@ namespace Opm
|
|||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||||
@ -1978,7 +1980,7 @@ namespace Opm
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
void
|
||||||
MultisegmentWell<TypeTag>::
|
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>
|
template<typename TypeTag>
|
||||||
std::optional<double>
|
std::optional<double>
|
||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
computeBhpAtThpLimitProd(const WellState& well_state,
|
computeBhpAtThpLimitProd(const WellState<Scalar>& well_state,
|
||||||
const Simulator& simulator,
|
const Simulator& simulator,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
|
@ -21,16 +21,17 @@
|
|||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
#include <opm/simulators/wells/PerfData.hpp>
|
||||||
|
|
||||||
#include <opm/simulators/wells/ConnFiltrateData.hpp>
|
#include <opm/simulators/wells/ConnFiltrateData.hpp>
|
||||||
#include <opm/simulators/wells/PerfData.hpp>
|
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
PerfData::PerfData(const std::size_t num_perf,
|
template<class Scalar>
|
||||||
const double pressure_first_connection_,
|
PerfData<Scalar>::PerfData(const std::size_t num_perf,
|
||||||
const bool injector_,
|
const Scalar pressure_first_connection_,
|
||||||
const std::size_t num_phases)
|
const bool injector_,
|
||||||
|
const std::size_t num_phases)
|
||||||
: injector(injector_)
|
: injector(injector_)
|
||||||
, pressure_first_connection(pressure_first_connection_)
|
, pressure_first_connection(pressure_first_connection_)
|
||||||
, pressure(num_perf)
|
, 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;
|
PerfData result;
|
||||||
result.pressure_first_connection = 1.0;
|
result.pressure_first_connection = 1.0;
|
||||||
@ -79,22 +81,25 @@ PerfData PerfData::serializationTestObject()
|
|||||||
result.water_throughput = {25.0, 26.0};
|
result.water_throughput = {25.0, 26.0};
|
||||||
result.skin_pressure = {27.0, 28.0};
|
result.skin_pressure = {27.0, 28.0};
|
||||||
result.water_velocity = {29.0, 30.0};
|
result.water_velocity = {29.0, 30.0};
|
||||||
result.filtrate_data = ConnFiltrateData::serializationTestObject();
|
result.filtrate_data = ConnFiltrateData<Scalar>::serializationTestObject();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t PerfData::size() const
|
template<class Scalar>
|
||||||
|
std::size_t PerfData<Scalar>::size() const
|
||||||
{
|
{
|
||||||
return this->pressure.size();
|
return this->pressure.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PerfData::empty() const
|
template<class Scalar>
|
||||||
|
bool PerfData<Scalar>::empty() const
|
||||||
{
|
{
|
||||||
return this->pressure.empty();
|
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()) {
|
if (this->size() != other.size()) {
|
||||||
return false;
|
return false;
|
||||||
@ -122,7 +127,8 @@ bool PerfData::try_assign(const PerfData& other)
|
|||||||
return true;
|
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)
|
return (this->pressure_first_connection == rhs.pressure_first_connection)
|
||||||
&& (this->pressure == rhs.pressure)
|
&& (this->pressure == rhs.pressure)
|
||||||
@ -147,4 +153,6 @@ bool PerfData::operator==(const PerfData& rhs) const
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template class PerfData<double>;
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
class PerfData
|
class PerfData
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -36,7 +37,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
PerfData() = default;
|
PerfData() = default;
|
||||||
PerfData(std::size_t num_perf,
|
PerfData(std::size_t num_perf,
|
||||||
double pressure_first_connection_,
|
Scalar pressure_first_connection_,
|
||||||
bool injector_,
|
bool injector_,
|
||||||
std::size_t num_phases);
|
std::size_t num_phases);
|
||||||
|
|
||||||
@ -79,30 +80,30 @@ public:
|
|||||||
// if you're adding a new member representing a dynamically calculated
|
// if you're adding a new member representing a dynamically calculated
|
||||||
// result, e.g., a flow rate, then please update try_assign() as well.
|
// result, e.g., a flow rate, then please update try_assign() as well.
|
||||||
|
|
||||||
double pressure_first_connection{};
|
Scalar pressure_first_connection{};
|
||||||
std::vector<double> pressure{};
|
std::vector<Scalar> pressure{};
|
||||||
std::vector<double> rates{};
|
std::vector<Scalar> rates{};
|
||||||
std::vector<double> phase_rates{};
|
std::vector<Scalar> phase_rates{};
|
||||||
std::vector<std::array<double,4>> phase_mixing_rates{};
|
std::vector<std::array<Scalar,4>> phase_mixing_rates{};
|
||||||
std::vector<double> solvent_rates{};
|
std::vector<Scalar> solvent_rates{};
|
||||||
std::vector<double> polymer_rates{};
|
std::vector<Scalar> polymer_rates{};
|
||||||
std::vector<double> brine_rates{};
|
std::vector<Scalar> brine_rates{};
|
||||||
std::vector<double> prod_index{};
|
std::vector<Scalar> prod_index{};
|
||||||
std::vector<double> micp_rates{};
|
std::vector<Scalar> micp_rates{};
|
||||||
std::vector<std::size_t> cell_index{};
|
std::vector<std::size_t> cell_index{};
|
||||||
std::vector<double> connection_transmissibility_factor{};
|
std::vector<Scalar> connection_transmissibility_factor{};
|
||||||
std::vector<double> connection_d_factor{};
|
std::vector<Scalar> connection_d_factor{};
|
||||||
std::vector<double> connection_compaction_tmult{};
|
std::vector<Scalar> connection_compaction_tmult{};
|
||||||
std::vector<int> satnum_id{};
|
std::vector<int> satnum_id{};
|
||||||
std::vector<std::size_t> ecl_index{};
|
std::vector<std::size_t> ecl_index{};
|
||||||
|
|
||||||
// The water_throughput, skin_pressure and water_velocity variables are
|
// The water_throughput, skin_pressure and water_velocity variables are
|
||||||
// only used for injectors to check the injectivity.
|
// only used for injectors to check the injectivity.
|
||||||
std::vector<double> water_throughput{};
|
std::vector<Scalar> water_throughput{};
|
||||||
std::vector<double> skin_pressure{};
|
std::vector<Scalar> skin_pressure{};
|
||||||
std::vector<double> water_velocity{};
|
std::vector<Scalar> water_velocity{};
|
||||||
|
|
||||||
ConnFiltrateData filtrate_data{};
|
ConnFiltrateData<Scalar> filtrate_data{};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -50,10 +50,10 @@ std::vector<int> make_segment_number(const Opm::WellSegments& segments)
|
|||||||
|
|
||||||
} // Anonymous namespace
|
} // 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)
|
: rates (segments.size() * num_phases)
|
||||||
, dissolved_gas_rate (segments.size())
|
, dissolved_gas_rate (segments.size())
|
||||||
, vaporized_oil_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))
|
, m_segment_number (make_segment_number(segments))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
SegmentState SegmentState::serializationTestObject()
|
template<class Scalar>
|
||||||
|
SegmentState<Scalar> SegmentState<Scalar>::serializationTestObject()
|
||||||
{
|
{
|
||||||
SegmentState result;
|
SegmentState result;
|
||||||
result.rates = {1.0, 2.0};
|
result.rates = {1.0, 2.0};
|
||||||
@ -89,19 +90,27 @@ SegmentState SegmentState::serializationTestObject()
|
|||||||
return result;
|
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];
|
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();
|
return this->rates.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t SegmentState::size() const {
|
template<class Scalar>
|
||||||
|
std::size_t SegmentState<Scalar>::size() const
|
||||||
|
{
|
||||||
return this->pressure.size();
|
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())
|
if (this->empty())
|
||||||
throw std::logic_error("Tried to pressure scale empty SegmentState");
|
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(),
|
std::transform(this->pressure.begin(),
|
||||||
this->pressure.end(),
|
this->pressure.end(),
|
||||||
this->pressure.begin(),
|
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;
|
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 &&
|
return this->rates == rhs.rates &&
|
||||||
this->dissolved_gas_rate == rhs.dissolved_gas_rate &&
|
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;
|
this->m_segment_number == rhs.m_segment_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template class SegmentState<double>;
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -23,14 +23,13 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm {
|
||||||
{
|
|
||||||
class WellSegments;
|
class WellSegments;
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm {
|
||||||
{
|
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
class SegmentState
|
class SegmentState
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -39,9 +38,9 @@ public:
|
|||||||
|
|
||||||
static SegmentState serializationTestObject();
|
static SegmentState serializationTestObject();
|
||||||
|
|
||||||
double pressure_drop(std::size_t index) const;
|
Scalar pressure_drop(std::size_t index) const;
|
||||||
bool empty() const;
|
bool empty() const;
|
||||||
void scale_pressure(double bhp);
|
void scale_pressure(Scalar bhp);
|
||||||
|
|
||||||
const std::vector<int>& segment_number() const;
|
const std::vector<int>& segment_number() const;
|
||||||
std::size_t size() const;
|
std::size_t size() const;
|
||||||
@ -66,21 +65,21 @@ public:
|
|||||||
|
|
||||||
bool operator==(const SegmentState&) const;
|
bool operator==(const SegmentState&) const;
|
||||||
|
|
||||||
std::vector<double> rates;
|
std::vector<Scalar> rates;
|
||||||
std::vector<double> dissolved_gas_rate;
|
std::vector<Scalar> dissolved_gas_rate;
|
||||||
std::vector<double> vaporized_oil_rate;
|
std::vector<Scalar> vaporized_oil_rate;
|
||||||
|
|
||||||
/// Segment condition volume flow rates through segment (per phase)
|
/// 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)
|
/// 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)
|
/// Segment condition holdup fractions through segment (per phase)
|
||||||
std::vector<double> phase_holdup;
|
std::vector<Scalar> phase_holdup;
|
||||||
|
|
||||||
/// Segment condition phase viscosities.
|
/// Segment condition phase viscosities.
|
||||||
std::vector<double> phase_viscosity;
|
std::vector<Scalar> phase_viscosity;
|
||||||
|
|
||||||
/// Segment condition phase densities.
|
/// 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 },
|
||||||
/// ...
|
/// ...
|
||||||
/// { 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<Scalar> pressure;
|
||||||
std::vector<double> pressure_drop_friction;
|
std::vector<Scalar> pressure_drop_friction;
|
||||||
std::vector<double> pressure_drop_hydrostatic;
|
std::vector<Scalar> pressure_drop_hydrostatic;
|
||||||
std::vector<double> pressure_drop_accel;
|
std::vector<Scalar> pressure_drop_accel;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<int> m_segment_number;
|
std::vector<int> m_segment_number;
|
||||||
|
@ -28,13 +28,15 @@
|
|||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
SingleWellState::SingleWellState(const std::string& name_,
|
template<class Scalar>
|
||||||
const ParallelWellInfo& pinfo,
|
SingleWellState<Scalar>::
|
||||||
bool is_producer,
|
SingleWellState(const std::string& name_,
|
||||||
double pressure_first_connection,
|
const ParallelWellInfo& pinfo,
|
||||||
const std::vector<PerforationData>& perf_input,
|
bool is_producer,
|
||||||
const PhaseUsage& pu_,
|
Scalar pressure_first_connection,
|
||||||
double temp)
|
const std::vector<PerforationData>& perf_input,
|
||||||
|
const PhaseUsage& pu_,
|
||||||
|
Scalar temp)
|
||||||
: name(name_)
|
: name(name_)
|
||||||
, parallel_info(pinfo)
|
, parallel_info(pinfo)
|
||||||
, producer(is_producer)
|
, 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);
|
SingleWellState result("testing", pinfo, true, 1.0, {}, PhaseUsage{}, 2.0);
|
||||||
result.perf_data = PerfData::serializationTestObject();
|
result.perf_data = PerfData<Scalar>::serializationTestObject();
|
||||||
|
|
||||||
return result;
|
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)
|
if (this->producer != other.producer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -82,8 +88,9 @@ void SingleWellState::init_timestep(const SingleWellState& other) {
|
|||||||
this->temperature = other.temperature;
|
this->temperature = other.temperature;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
void SingleWellState::shut() {
|
void SingleWellState<Scalar>::shut()
|
||||||
|
{
|
||||||
this->bhp = 0;
|
this->bhp = 0;
|
||||||
this->thp = 0;
|
this->thp = 0;
|
||||||
this->status = Well::Status::SHUT;
|
this->status = Well::Status::SHUT;
|
||||||
@ -98,16 +105,22 @@ void SingleWellState::shut() {
|
|||||||
connpi.assign(connpi.size(), 0);
|
connpi.assign(connpi.size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleWellState::stop() {
|
template<class Scalar>
|
||||||
|
void SingleWellState<Scalar>::stop()
|
||||||
|
{
|
||||||
this->thp = 0;
|
this->thp = 0;
|
||||||
this->status = Well::Status::STOP;
|
this->status = Well::Status::STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleWellState::open() {
|
template<class Scalar>
|
||||||
|
void SingleWellState<Scalar>::open()
|
||||||
|
{
|
||||||
this->status = Well::Status::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) {
|
switch (new_status) {
|
||||||
case Well::Status::OPEN:
|
case Well::Status::OPEN:
|
||||||
this->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) {
|
template<class Scalar>
|
||||||
if (this->perf_data.size() != new_perf_data.size()) {
|
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 {
|
throw std::invalid_argument {
|
||||||
"Size mismatch for perforation data in well " + this->name
|
"Size mismatch for perforation data in well " + this->name
|
||||||
};
|
};
|
||||||
@ -152,39 +168,52 @@ void SingleWellState::reset_connection_factors(const std::vector<PerforationData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
double SingleWellState::sum_connection_rates(const std::vector<double>& connection_rates) const {
|
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());
|
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);
|
return this->sum_connection_rates(this->perf_data.brine_rates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
double SingleWellState::sum_polymer_rates() const {
|
Scalar SingleWellState<Scalar>::sum_polymer_rates() const
|
||||||
|
{
|
||||||
return this->sum_connection_rates(this->perf_data.polymer_rates);
|
return this->sum_connection_rates(this->perf_data.polymer_rates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
double SingleWellState::sum_solvent_rates() const {
|
Scalar SingleWellState<Scalar>::sum_solvent_rates() const
|
||||||
|
{
|
||||||
return this->sum_connection_rates(this->perf_data.solvent_rates);
|
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.;
|
if (this->producer) return 0.;
|
||||||
|
|
||||||
return this->sum_connection_rates(this->perf_data.filtrate_data.rates);
|
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.;
|
if (this->producer) return 0.;
|
||||||
|
|
||||||
return this->sum_connection_rates(this->perf_data.filtrate_data.total);
|
return this->sum_connection_rates(this->perf_data.filtrate_data.total);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleWellState::update_producer_targets(const Well& ecl_well, const SummaryState& st) {
|
template<class Scalar>
|
||||||
const double bhp_safety_factor = 0.99;
|
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);
|
const auto& prod_controls = ecl_well.productionControls(st);
|
||||||
|
|
||||||
auto cmode_is_bhp = (prod_controls.cmode == Well::ProducerCMode::BHP);
|
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;
|
this->bhp = bhp_limit;
|
||||||
else
|
else
|
||||||
this->bhp = this->perf_data.pressure_first_connection * bhp_safety_factor;
|
this->bhp = this->perf_data.pressure_first_connection * bhp_safety_factor;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleWellState::update_injector_targets(const Well& ecl_well, const SummaryState& st) {
|
template<class Scalar>
|
||||||
const double bhp_safety_factor = 1.01;
|
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);
|
const auto& inj_controls = ecl_well.injectionControls(st);
|
||||||
|
|
||||||
if (inj_controls.hasControl(Well::InjectorCMode::THP))
|
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
|
// 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) {
|
if (inj_controls.cmode == Well::InjectorCMode::RATE) {
|
||||||
inj_surf_rate = inj_controls.surface_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;
|
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)
|
if (this->producer)
|
||||||
this->update_producer_targets(ecl_well, st);
|
this->update_producer_targets(ecl_well, st);
|
||||||
else
|
else
|
||||||
this->update_injector_targets(ecl_well, st);
|
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 &&
|
return this->name == rhs.name &&
|
||||||
this->status == rhs.status &&
|
this->status == rhs.status &&
|
||||||
@ -323,4 +358,6 @@ bool SingleWellState::operator==(const SingleWellState& rhs) const
|
|||||||
this->production_cmode == rhs.production_cmode;
|
this->production_cmode == rhs.production_cmode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template class SingleWellState<double>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,15 +37,16 @@ struct PerforationData;
|
|||||||
class SummaryState;
|
class SummaryState;
|
||||||
class Well;
|
class Well;
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
class SingleWellState {
|
class SingleWellState {
|
||||||
public:
|
public:
|
||||||
SingleWellState(const std::string& name,
|
SingleWellState(const std::string& name,
|
||||||
const ParallelWellInfo& pinfo,
|
const ParallelWellInfo& pinfo,
|
||||||
bool is_producer,
|
bool is_producer,
|
||||||
double presssure_first_connection,
|
Scalar presssure_first_connection,
|
||||||
const std::vector<PerforationData>& perf_input,
|
const std::vector<PerforationData>& perf_input,
|
||||||
const PhaseUsage& pu,
|
const PhaseUsage& pu,
|
||||||
double temp);
|
Scalar temp);
|
||||||
|
|
||||||
static SingleWellState serializationTestObject(const ParallelWellInfo& pinfo);
|
static SingleWellState serializationTestObject(const ParallelWellInfo& pinfo);
|
||||||
|
|
||||||
@ -83,14 +84,14 @@ public:
|
|||||||
WellStatus status{WellStatus::OPEN};
|
WellStatus status{WellStatus::OPEN};
|
||||||
bool producer;
|
bool producer;
|
||||||
PhaseUsage pu;
|
PhaseUsage pu;
|
||||||
double bhp{0};
|
Scalar bhp{0};
|
||||||
double thp{0};
|
Scalar thp{0};
|
||||||
double temperature{0};
|
Scalar temperature{0};
|
||||||
|
|
||||||
// filtration injection concentration
|
// 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 {
|
enum RateIndices {
|
||||||
dissolved_gas = 0,
|
dissolved_gas = 0,
|
||||||
dissolved_gas_in_water = 1,
|
dissolved_gas_in_water = 1,
|
||||||
@ -98,16 +99,16 @@ public:
|
|||||||
vaporized_water = 3
|
vaporized_water = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<double> well_potentials;
|
std::vector<Scalar> well_potentials;
|
||||||
std::vector<double> productivity_index;
|
std::vector<Scalar> productivity_index;
|
||||||
std::vector<double> implicit_ipr_a;
|
std::vector<Scalar> implicit_ipr_a;
|
||||||
std::vector<double> implicit_ipr_b;
|
std::vector<Scalar> implicit_ipr_b;
|
||||||
std::vector<double> surface_rates;
|
std::vector<Scalar> surface_rates;
|
||||||
std::vector<double> reservoir_rates;
|
std::vector<Scalar> reservoir_rates;
|
||||||
std::vector<double> prev_surface_rates;
|
std::vector<Scalar> prev_surface_rates;
|
||||||
PerfData perf_data;
|
PerfData<Scalar> perf_data;
|
||||||
bool trivial_target;
|
bool trivial_target;
|
||||||
SegmentState segments;
|
SegmentState<Scalar> segments;
|
||||||
Events events;
|
Events events;
|
||||||
WellInjectorCMode injection_cmode{WellInjectorCMode::CMODE_UNDEFINED};
|
WellInjectorCMode injection_cmode{WellInjectorCMode::CMODE_UNDEFINED};
|
||||||
WellProducerCMode production_cmode{WellProducerCMode::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
|
// The sum_xxx_rates() functions sum over all connection rates of pertinent
|
||||||
// types. In the case of distributed wells this involves an MPI
|
// types. In the case of distributed wells this involves an MPI
|
||||||
// communication.
|
// communication.
|
||||||
double sum_solvent_rates() const;
|
Scalar sum_solvent_rates() const;
|
||||||
double sum_polymer_rates() const;
|
Scalar sum_polymer_rates() const;
|
||||||
double sum_brine_rates() const;
|
Scalar sum_brine_rates() const;
|
||||||
|
|
||||||
double sum_filtrate_rate() const;
|
Scalar sum_filtrate_rate() const;
|
||||||
double sum_filtrate_total() const;
|
Scalar sum_filtrate_total() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double sum_connection_rates(const std::vector<double>& connection_rates) const;
|
Scalar sum_connection_rates(const std::vector<Scalar>& connection_rates) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -143,7 +143,7 @@ namespace Opm
|
|||||||
|
|
||||||
/// check whether the well equations get converged for this well
|
/// check whether the well equations get converged for this well
|
||||||
virtual ConvergenceReport getWellConvergence(const SummaryState& summary_state,
|
virtual ConvergenceReport getWellConvergence(const SummaryState& summary_state,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
const std::vector<double>& B_avg,
|
const std::vector<double>& B_avg,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const bool relax_tolerance) const override;
|
const bool relax_tolerance) const override;
|
||||||
@ -157,50 +157,50 @@ namespace Opm
|
|||||||
/// xw to update Well State
|
/// xw to update Well State
|
||||||
void recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
void recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
||||||
const BVector& x,
|
const BVector& x,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
/// computing the well potentials for group control
|
/// computing the well potentials for group control
|
||||||
virtual void computeWellPotentials(const Simulator& simulator,
|
void computeWellPotentials(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
std::vector<double>& well_potentials,
|
std::vector<double>& well_potentials,
|
||||||
DeferredLogger& deferred_logger) /* const */ override;
|
DeferredLogger& deferred_logger) /* const */ override;
|
||||||
|
|
||||||
void updatePrimaryVariables(const SummaryState& summary_state,
|
void updatePrimaryVariables(const SummaryState& summary_state,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
virtual void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
virtual void calculateExplicitQuantities(const Simulator& simulator,
|
void calculateExplicitQuantities(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) override; // should be const?
|
DeferredLogger& deferred_logger) override; // should be const?
|
||||||
|
|
||||||
virtual void updateProductivityIndex(const Simulator& simulator,
|
void updateProductivityIndex(const Simulator& simulator,
|
||||||
const WellProdIndexCalculator& wellPICalc,
|
const WellProdIndexCalculator& wellPICalc,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) const override;
|
DeferredLogger& deferred_logger) const override;
|
||||||
|
|
||||||
virtual double connectionDensity(const int globalConnIdx,
|
double connectionDensity(const int globalConnIdx,
|
||||||
const int openConnIdx) const override;
|
const int openConnIdx) const override;
|
||||||
|
|
||||||
virtual void addWellContributions(SparseMatrixAdapter& mat) const override;
|
void addWellContributions(SparseMatrixAdapter& mat) const override;
|
||||||
|
|
||||||
virtual void addWellPressureEquations(PressureMatrix& mat,
|
void addWellPressureEquations(PressureMatrix& mat,
|
||||||
const BVector& x,
|
const BVector& x,
|
||||||
const int pressureVarIndex,
|
const int pressureVarIndex,
|
||||||
const bool use_well_weights,
|
const bool use_well_weights,
|
||||||
const WellState& well_state) const override;
|
const WellState<Scalar>& well_state) const override;
|
||||||
|
|
||||||
// iterate well equations with the specified control until converged
|
// iterate well equations with the specified control until converged
|
||||||
bool iterateWellEqWithControl(const Simulator& simulator,
|
bool iterateWellEqWithControl(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
// iterate well equations including control switching
|
// iterate well equations including control switching
|
||||||
@ -208,14 +208,14 @@ namespace Opm
|
|||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const bool fixed_control = false,
|
const bool fixed_control = false,
|
||||||
const bool fixed_status = false) override;
|
const bool fixed_status = false) override;
|
||||||
|
|
||||||
/// \brief Wether the Jacobian will also have well contributions in it.
|
/// \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_;
|
return this->param_.matrix_add_well_contributions_;
|
||||||
}
|
}
|
||||||
@ -227,28 +227,26 @@ namespace Opm
|
|||||||
std::vector<double>& potentials,
|
std::vector<double>& potentials,
|
||||||
double alq) const;
|
double alq) const;
|
||||||
|
|
||||||
void computeWellRatesWithThpAlqProd(
|
void computeWellRatesWithThpAlqProd(const Simulator& simulator,
|
||||||
const Simulator& simulator,
|
const SummaryState& summary_state,
|
||||||
const SummaryState& summary_state,
|
DeferredLogger& deferred_logger,
|
||||||
DeferredLogger& deferred_logger,
|
std::vector<double>& potentials,
|
||||||
std::vector<double>& potentials,
|
double alq) const;
|
||||||
double alq) const;
|
|
||||||
|
|
||||||
std::optional<double> computeBhpAtThpLimitProdWithAlq(
|
std::optional<double>
|
||||||
const Simulator& simulator,
|
computeBhpAtThpLimitProdWithAlq(const Simulator& simulator,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
const double alq_value,
|
const double alq_value,
|
||||||
DeferredLogger& deferred_logger) const override;
|
DeferredLogger& deferred_logger) const override;
|
||||||
|
|
||||||
void updateIPRImplicit(const Simulator& simulator,
|
void updateIPRImplicit(const Simulator& simulator,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
virtual void computeWellRatesWithBhp(
|
void computeWellRatesWithBhp(const Simulator& simulator,
|
||||||
const Simulator& simulator,
|
const double& bhp,
|
||||||
const double& bhp,
|
std::vector<double>& well_flux,
|
||||||
std::vector<double>& well_flux,
|
DeferredLogger& deferred_logger) const override;
|
||||||
DeferredLogger& deferred_logger) const override;
|
|
||||||
|
|
||||||
// NOTE: These cannot be protected since they are used by GasLiftRuntime
|
// NOTE: These cannot be protected since they are used by GasLiftRuntime
|
||||||
using Base::phaseUsage;
|
using Base::phaseUsage;
|
||||||
@ -267,23 +265,23 @@ namespace Opm
|
|||||||
// updating the well_state based on well solution dwells
|
// updating the well_state based on well solution dwells
|
||||||
void updateWellState(const SummaryState& summary_state,
|
void updateWellState(const SummaryState& summary_state,
|
||||||
const BVectorWell& dwells,
|
const BVectorWell& dwells,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
// calculate the properties for the well connections
|
// calculate the properties for the well connections
|
||||||
// to calulate the pressure difference between well connections.
|
// to calulate the pressure difference between well connections.
|
||||||
using WellConnectionProps = typename StdWellEval::StdWellConnections::Properties;
|
using WellConnectionProps = typename StdWellEval::StdWellConnections::Properties;
|
||||||
void computePropertiesForWellConnectionPressures(const Simulator& simulator,
|
void computePropertiesForWellConnectionPressures(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
WellConnectionProps& props) const;
|
WellConnectionProps& props) const;
|
||||||
|
|
||||||
void computeWellConnectionDensitesPressures(const Simulator& simulator,
|
void computeWellConnectionDensitesPressures(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
const WellConnectionProps& props,
|
const WellConnectionProps& props,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
void computeWellConnectionPressures(const Simulator& simulator,
|
void computeWellConnectionPressures(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
template<class Value>
|
template<class Value>
|
||||||
@ -323,13 +321,13 @@ namespace Opm
|
|||||||
std::vector<double> computeWellPotentialWithTHP(
|
std::vector<double> computeWellPotentialWithTHP(
|
||||||
const Simulator& simulator,
|
const Simulator& simulator,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const WellState &well_state) const;
|
const WellState<Scalar>& well_state) const;
|
||||||
|
|
||||||
bool computeWellPotentialsImplicit(const Simulator& simulator,
|
bool computeWellPotentialsImplicit(const Simulator& simulator,
|
||||||
std::vector<double>& well_potentials,
|
std::vector<double>& well_potentials,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
virtual double getRefDensity() const override;
|
double getRefDensity() const override;
|
||||||
|
|
||||||
// get the mobility for specific perforation
|
// get the mobility for specific perforation
|
||||||
template<class Value>
|
template<class Value>
|
||||||
@ -348,29 +346,29 @@ namespace Opm
|
|||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
void updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
void updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
virtual void assembleWellEqWithoutIteration(const Simulator& simulator,
|
void assembleWellEqWithoutIteration(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
void assembleWellEqWithoutIterationImpl(const Simulator& simulator,
|
void assembleWellEqWithoutIterationImpl(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
void calculateSinglePerf(const Simulator& simulator,
|
void calculateSinglePerf(const Simulator& simulator,
|
||||||
const int perf,
|
const int perf,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
std::vector<RateVector>& connectionRates,
|
std::vector<RateVector>& connectionRates,
|
||||||
std::vector<EvalWell>& cq_s,
|
std::vector<EvalWell>& cq_s,
|
||||||
EvalWell& water_flux_s,
|
EvalWell& water_flux_s,
|
||||||
@ -378,13 +376,13 @@ namespace Opm
|
|||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
// check whether the well is operable under BHP limit with current reservoir condition
|
// 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,
|
const Simulator& simulator,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
// check whether the well is operable under THP limit with current reservoir condition
|
// check whether the well is operable under THP limit with current reservoir condition
|
||||||
void checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
void checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) override;
|
DeferredLogger& deferred_logger) override;
|
||||||
|
|
||||||
// updating the inflow based on the current reservoir condition
|
// 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)
|
// whether the well can produce / inject based on the current well state (bhp)
|
||||||
bool canProduceInjectWithCurrentBhp(const Simulator& simulator,
|
bool canProduceInjectWithCurrentBhp(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
// turn on crossflow to avoid singular well equations
|
// turn on crossflow to avoid singular well equations
|
||||||
@ -433,12 +431,13 @@ namespace Opm
|
|||||||
|
|
||||||
// handle the extra equations for polymer injectivity study
|
// handle the extra equations for polymer injectivity study
|
||||||
void handleInjectivityEquations(const Simulator& simulator,
|
void handleInjectivityEquations(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
const int perf,
|
const int perf,
|
||||||
const EvalWell& water_flux_s,
|
const EvalWell& water_flux_s,
|
||||||
DeferredLogger& deferred_logger);
|
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
|
// checking convergence of extra equations, if there are any
|
||||||
void checkConvergenceExtraEqs(const std::vector<double>& res,
|
void checkConvergenceExtraEqs(const std::vector<double>& res,
|
||||||
@ -447,20 +446,22 @@ namespace Opm
|
|||||||
// updating the connectionRates_ related polymer molecular weight
|
// updating the connectionRates_ related polymer molecular weight
|
||||||
void updateConnectionRatePolyMW(const EvalWell& cq_s_poly,
|
void updateConnectionRatePolyMW(const EvalWell& cq_s_poly,
|
||||||
const IntensiveQuantities& int_quants,
|
const IntensiveQuantities& int_quants,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
const int perf,
|
const int perf,
|
||||||
std::vector<RateVector>& connectionRates,
|
std::vector<RateVector>& connectionRates,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
|
|
||||||
std::optional<double> computeBhpAtThpLimitProd(const WellState& well_state,
|
std::optional<double>
|
||||||
const Simulator& simulator,
|
computeBhpAtThpLimitProd(const WellState<Scalar>& well_state,
|
||||||
const SummaryState& summary_state,
|
const Simulator& simulator,
|
||||||
DeferredLogger& deferred_logger) const;
|
const SummaryState& summary_state,
|
||||||
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
std::optional<double> computeBhpAtThpLimitInj(const Simulator& simulator,
|
std::optional<double>
|
||||||
const SummaryState& summary_state,
|
computeBhpAtThpLimitInj(const Simulator& simulator,
|
||||||
DeferredLogger& deferred_logger) const;
|
const SummaryState& summary_state,
|
||||||
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Eval connectionRateEnergy(const double maxOilSaturation,
|
Eval connectionRateEnergy(const double maxOilSaturation,
|
||||||
|
@ -84,8 +84,8 @@ private:
|
|||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
void
|
void
|
||||||
StandardWellAssemble<FluidSystem,Indices>::
|
StandardWellAssemble<FluidSystem,Indices>::
|
||||||
assembleControlEq(const WellState& well_state,
|
assembleControlEq(const WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
|
@ -29,13 +29,13 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
|
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
class GroupState;
|
template<class Scalar> class GroupState;
|
||||||
class Schedule;
|
class Schedule;
|
||||||
template<class Scalar, int numEq> class StandardWellEquations;
|
template<class Scalar, int numEq> class StandardWellEquations;
|
||||||
template<class FluidSystem, class Indices> class StandardWellPrimaryVariables;
|
template<class FluidSystem, class Indices> class StandardWellPrimaryVariables;
|
||||||
class SummaryState;
|
class SummaryState;
|
||||||
template<class FluidSystem> class WellInterfaceFluidSystem;
|
template<class FluidSystem> class WellInterfaceFluidSystem;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
//! \brief Class handling assemble of the equation system for StandardWell.
|
//! \brief Class handling assemble of the equation system for StandardWell.
|
||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
@ -52,8 +52,8 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
//! \brief Assemble control equation.
|
//! \brief Assemble control equation.
|
||||||
void assembleControlEq(const WellState& well_state,
|
void assembleControlEq(const WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
|
@ -287,7 +287,7 @@ computeDensities(const std::vector<Scalar>& perfComponentRates,
|
|||||||
|
|
||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
void StandardWellConnections<FluidSystem,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,int)>& getTemperature,
|
||||||
const std::function<Scalar(int)>& getSaltConcentration,
|
const std::function<Scalar(int)>& getSaltConcentration,
|
||||||
const std::function<int(int)>& pvtRegionIdx,
|
const std::function<int(int)>& pvtRegionIdx,
|
||||||
@ -421,7 +421,7 @@ computePropertiesForPressures(const WellState& well_state,
|
|||||||
|
|
||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
void StandardWellConnections<FluidSystem,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)>& invB,
|
||||||
const std::function<Scalar(int,int)>& mobility,
|
const std::function<Scalar(int,int)>& mobility,
|
||||||
const std::function<Scalar(int)>& solventInverseFormationVolumeFactor,
|
const std::function<Scalar(int)>& solventInverseFormationVolumeFactor,
|
||||||
|
@ -35,7 +35,7 @@ namespace Opm
|
|||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
enum class Phase;
|
enum class Phase;
|
||||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
class StandardWellConnections
|
class StandardWellConnections
|
||||||
@ -54,7 +54,7 @@ public:
|
|||||||
std::vector<Scalar> surf_dens_perf;
|
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,int)>& getTemperature,
|
||||||
const std::function<Scalar(int)>& getSaltConcentration,
|
const std::function<Scalar(int)>& getSaltConcentration,
|
||||||
const std::function<int(int)>& pvtRegionIdx,
|
const std::function<int(int)>& pvtRegionIdx,
|
||||||
@ -63,7 +63,7 @@ public:
|
|||||||
Properties& props) const;
|
Properties& props) const;
|
||||||
|
|
||||||
//! \brief Compute connection properties (densities, pressure drop, ...)
|
//! \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)>& invB,
|
||||||
const std::function<Scalar(int,int)>& mobility,
|
const std::function<Scalar(int,int)>& mobility,
|
||||||
const std::function<Scalar(int)>& solventInverseFormationVolumeFactor,
|
const std::function<Scalar(int)>& solventInverseFormationVolumeFactor,
|
||||||
|
@ -293,7 +293,7 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
|
|||||||
const bool use_well_weights,
|
const bool use_well_weights,
|
||||||
const WellInterfaceGeneric& well,
|
const WellInterfaceGeneric& well,
|
||||||
const int bhp_var_index,
|
const int bhp_var_index,
|
||||||
const WellState& well_state) const
|
const WellState<Scalar>& well_state) const
|
||||||
{
|
{
|
||||||
// This adds pressure quation for cpr
|
// This adds pressure quation for cpr
|
||||||
// For use_well_weights=true
|
// For use_well_weights=true
|
||||||
@ -415,7 +415,7 @@ template void StandardWellEquations<double,N>:: \
|
|||||||
const bool, \
|
const bool, \
|
||||||
const WellInterfaceGeneric&, \
|
const WellInterfaceGeneric&, \
|
||||||
const int, \
|
const int, \
|
||||||
const WellState&) const;
|
const WellState<double>&) const;
|
||||||
|
|
||||||
INSTANCE(1)
|
INSTANCE(1)
|
||||||
INSTANCE(2)
|
INSTANCE(2)
|
||||||
|
@ -40,7 +40,7 @@ template<class Scalar, int numEq> class StandardWellEquationAccess;
|
|||||||
class WellContributions;
|
class WellContributions;
|
||||||
#endif
|
#endif
|
||||||
class WellInterfaceGeneric;
|
class WellInterfaceGeneric;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
template<class Scalar, int numEq>
|
template<class Scalar, int numEq>
|
||||||
class StandardWellEquations
|
class StandardWellEquations
|
||||||
@ -117,7 +117,7 @@ public:
|
|||||||
const bool use_well_weights,
|
const bool use_well_weights,
|
||||||
const WellInterfaceGeneric& well,
|
const WellInterfaceGeneric& well,
|
||||||
const int bhp_var_index,
|
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.
|
//! \brief Get the number of blocks of the C and B matrices.
|
||||||
unsigned int getNumBlocks() const;
|
unsigned int getNumBlocks() const;
|
||||||
|
@ -70,7 +70,7 @@ template<class FluidSystem, class Indices>
|
|||||||
void
|
void
|
||||||
StandardWellEval<FluidSystem,Indices>::
|
StandardWellEval<FluidSystem,Indices>::
|
||||||
updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
@ -99,7 +99,7 @@ computeAccumWell()
|
|||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
ConvergenceReport
|
ConvergenceReport
|
||||||
StandardWellEval<FluidSystem,Indices>::
|
StandardWellEval<FluidSystem,Indices>::
|
||||||
getWellConvergence(const WellState& well_state,
|
getWellConvergence(const WellState<Scalar>& well_state,
|
||||||
const std::vector<double>& B_avg,
|
const std::vector<double>& B_avg,
|
||||||
const double maxResidualAllowed,
|
const double maxResidualAllowed,
|
||||||
const double tol_wells,
|
const double tol_wells,
|
||||||
|
@ -36,12 +36,11 @@ namespace Opm
|
|||||||
|
|
||||||
class ConvergenceReport;
|
class ConvergenceReport;
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
class GroupState;
|
|
||||||
class Schedule;
|
class Schedule;
|
||||||
class SummaryState;
|
class SummaryState;
|
||||||
class WellContributions;
|
class WellContributions;
|
||||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
class StandardWellEval
|
class StandardWellEval
|
||||||
@ -79,7 +78,7 @@ protected:
|
|||||||
// computing the accumulation term for later use in well mass equations
|
// computing the accumulation term for later use in well mass equations
|
||||||
void computeAccumWell();
|
void computeAccumWell();
|
||||||
|
|
||||||
ConvergenceReport getWellConvergence(const WellState& well_state,
|
ConvergenceReport getWellConvergence(const WellState<Scalar>& well_state,
|
||||||
const std::vector<double>& B_avg,
|
const std::vector<double>& B_avg,
|
||||||
const double maxResidualAllowed,
|
const double maxResidualAllowed,
|
||||||
const double tol_wells,
|
const double tol_wells,
|
||||||
@ -95,7 +94,7 @@ protected:
|
|||||||
const bool has_polymermw);
|
const bool has_polymermw);
|
||||||
|
|
||||||
void updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
void updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ resize(const int numWellEq)
|
|||||||
|
|
||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
||||||
update(const WellState& well_state,
|
update(const WellState<Scalar>& well_state,
|
||||||
const bool stop_or_zero_rate_target,
|
const bool stop_or_zero_rate_target,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
@ -227,7 +227,7 @@ update(const WellState& well_state,
|
|||||||
|
|
||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
||||||
updatePolyMW(const WellState& well_state)
|
updatePolyMW(const WellState<Scalar>& well_state)
|
||||||
{
|
{
|
||||||
if (well_.isInjector()) {
|
if (well_.isInjector()) {
|
||||||
const auto& ws = well_state.well(well_.indexOfWell());
|
const auto& ws = well_state.well(well_.indexOfWell());
|
||||||
@ -324,7 +324,7 @@ updateNewtonPolyMW(const BVectorWell& dwells)
|
|||||||
|
|
||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
||||||
copyToWellState(WellState& well_state,
|
copyToWellState(WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
static constexpr int Water = BlackoilPhases::Aqua;
|
static constexpr int Water = BlackoilPhases::Aqua;
|
||||||
@ -429,7 +429,7 @@ copyToWellState(WellState& well_state,
|
|||||||
|
|
||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
void StandardWellPrimaryVariables<FluidSystem,Indices>::
|
||||||
copyToWellStatePolyMW(WellState& well_state) const
|
copyToWellStatePolyMW(WellState<Scalar>& well_state) const
|
||||||
{
|
{
|
||||||
if (well_.isInjector()) {
|
if (well_.isInjector()) {
|
||||||
auto& ws = well_state.well(well_.indexOfWell());
|
auto& ws = well_state.well(well_.indexOfWell());
|
||||||
|
@ -34,7 +34,7 @@ namespace Opm
|
|||||||
|
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
template<class FluidSystem, class Indices> class WellInterfaceIndices;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
//! \brief Class holding primary variables for StandardWell.
|
//! \brief Class holding primary variables for StandardWell.
|
||||||
template<class FluidSystem, class Indices>
|
template<class FluidSystem, class Indices>
|
||||||
@ -102,12 +102,12 @@ public:
|
|||||||
int numWellEq() const { return numWellEq_; }
|
int numWellEq() const { return numWellEq_; }
|
||||||
|
|
||||||
//! \brief Copy values from well state.
|
//! \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,
|
const bool stop_or_zero_rate_target,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
//! \brief Copy polymer molecular weigt values from well state.
|
//! \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.
|
//! \brief Update values from newton update vector.
|
||||||
void updateNewton(const BVectorWell& dwells,
|
void updateNewton(const BVectorWell& dwells,
|
||||||
@ -123,10 +123,11 @@ public:
|
|||||||
void checkFinite(DeferredLogger& deferred_logger) const;
|
void checkFinite(DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
//! \brief Copy values to well state.
|
//! \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.
|
//! \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.
|
//! \brief Returns scaled volume fraction for a component.
|
||||||
EvalWell volumeFractionScaled(const int compIdx) const;
|
EvalWell volumeFractionScaled(const int compIdx) const;
|
||||||
|
@ -332,8 +332,8 @@ namespace Opm
|
|||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
// TODO: only_wells should be put back to save some computation
|
// TODO: only_wells should be put back to save some computation
|
||||||
@ -358,8 +358,8 @@ namespace Opm
|
|||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
// try to regularize equation if the well does not converge
|
// try to regularize equation if the well does not converge
|
||||||
@ -481,7 +481,7 @@ namespace Opm
|
|||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
calculateSinglePerf(const Simulator& simulator,
|
calculateSinglePerf(const Simulator& simulator,
|
||||||
const int perf,
|
const int perf,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
std::vector<RateVector>& connectionRates,
|
std::vector<RateVector>& connectionRates,
|
||||||
std::vector<EvalWell>& cq_s,
|
std::vector<EvalWell>& cq_s,
|
||||||
EvalWell& water_flux_s,
|
EvalWell& water_flux_s,
|
||||||
@ -687,7 +687,7 @@ namespace Opm
|
|||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
updateWellState(const SummaryState& summary_state,
|
updateWellState(const SummaryState& summary_state,
|
||||||
const BVectorWell& dwells,
|
const BVectorWell& dwells,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||||
@ -730,7 +730,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
updateWellStateFromPrimaryVariables(const bool stop_or_zero_rate_target,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
@ -840,7 +840,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
updateIPRImplicit(const Simulator& simulator,
|
updateIPRImplicit(const Simulator& simulator,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
// Compute IPR based on *converged* well-equation:
|
// Compute IPR based on *converged* well-equation:
|
||||||
@ -915,7 +915,7 @@ namespace Opm
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
checkOperabilityUnderBHPLimit(const WellState& well_state,
|
checkOperabilityUnderBHPLimit(const WellState<Scalar>& well_state,
|
||||||
const Simulator& simulator,
|
const Simulator& simulator,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
@ -985,7 +985,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
const auto& summaryState = simulator.vanguard().summaryState();
|
const auto& summaryState = simulator.vanguard().summaryState();
|
||||||
@ -1076,7 +1076,7 @@ namespace Opm
|
|||||||
bool
|
bool
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
canProduceInjectWithCurrentBhp(const Simulator& simulator,
|
canProduceInjectWithCurrentBhp(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
const double bhp = well_state.well(this->index_of_well_).bhp;
|
const double bhp = well_state.well(this->index_of_well_).bhp;
|
||||||
@ -1123,7 +1123,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
computePropertiesForWellConnectionPressures(const Simulator& simulator,
|
computePropertiesForWellConnectionPressures(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
WellConnectionProps& props) const
|
WellConnectionProps& props) const
|
||||||
{
|
{
|
||||||
std::function<Scalar(int,int)> getTemperature =
|
std::function<Scalar(int,int)> getTemperature =
|
||||||
@ -1169,7 +1169,7 @@ namespace Opm
|
|||||||
ConvergenceReport
|
ConvergenceReport
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
getWellConvergence(const SummaryState& summary_state,
|
getWellConvergence(const SummaryState& summary_state,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
const std::vector<double>& B_avg,
|
const std::vector<double>& B_avg,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const bool relax_tolerance) const
|
const bool relax_tolerance) const
|
||||||
@ -1214,7 +1214,7 @@ namespace Opm
|
|||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
updateProductivityIndex(const Simulator& simulator,
|
updateProductivityIndex(const Simulator& simulator,
|
||||||
const WellProdIndexCalculator& wellPICalc,
|
const WellProdIndexCalculator& wellPICalc,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
auto fluidState = [&simulator, this](const int perf)
|
auto fluidState = [&simulator, this](const int perf)
|
||||||
@ -1289,7 +1289,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
computeWellConnectionDensitesPressures(const Simulator& simulator,
|
computeWellConnectionDensitesPressures(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
const WellConnectionProps& props,
|
const WellConnectionProps& props,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
@ -1331,7 +1331,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
computeWellConnectionPressures(const Simulator& simulator,
|
computeWellConnectionPressures(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
// 1. Compute properties required by computePressureDelta().
|
// 1. Compute properties required by computePressureDelta().
|
||||||
@ -1351,7 +1351,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
solveEqAndUpdateWellState(const SummaryState& summary_state,
|
solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||||
@ -1373,7 +1373,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
calculateExplicitQuantities(const Simulator& simulator,
|
calculateExplicitQuantities(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
const auto& summary_state = simulator.vanguard().summaryState();
|
const auto& summary_state = simulator.vanguard().summaryState();
|
||||||
@ -1422,7 +1422,7 @@ namespace Opm
|
|||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
||||||
const BVector& x,
|
const BVector& x,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||||
@ -1498,7 +1498,7 @@ namespace Opm
|
|||||||
// iterate to get a more accurate well density
|
// 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
|
// create a copy of the well_state to use. If the operability checking is sucessful, we use this one
|
||||||
// to replace the original 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();
|
const auto& group_state = simulator.problem().wellModel().groupState();
|
||||||
|
|
||||||
// Get the current controls.
|
// Get the current controls.
|
||||||
@ -1553,7 +1553,7 @@ namespace Opm
|
|||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
computeWellPotentialWithTHP(const Simulator& simulator,
|
computeWellPotentialWithTHP(const Simulator& simulator,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const WellState &well_state) const
|
const WellState<Scalar>& well_state) const
|
||||||
{
|
{
|
||||||
std::vector<double> potentials(this->number_of_phases_, 0.0);
|
std::vector<double> potentials(this->number_of_phases_, 0.0);
|
||||||
const auto& summary_state = simulator.vanguard().summaryState();
|
const auto& summary_state = simulator.vanguard().summaryState();
|
||||||
@ -1595,7 +1595,7 @@ namespace Opm
|
|||||||
StandardWell<TypeTag> well_copy(*this);
|
StandardWell<TypeTag> well_copy(*this);
|
||||||
|
|
||||||
// store a copy of the well state, we don't want to update the real well state
|
// 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();
|
const auto& group_state = simulator.problem().wellModel().groupState();
|
||||||
auto& ws = well_state_copy.well(this->index_of_well_);
|
auto& ws = well_state_copy.well(this->index_of_well_);
|
||||||
|
|
||||||
@ -1694,7 +1694,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
computeWellPotentials(const Simulator& simulator,
|
computeWellPotentials(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
std::vector<double>& well_potentials,
|
std::vector<double>& well_potentials,
|
||||||
DeferredLogger& deferred_logger) // const
|
DeferredLogger& deferred_logger) // const
|
||||||
{
|
{
|
||||||
@ -1766,7 +1766,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
updatePrimaryVariables(const SummaryState& summary_state,
|
updatePrimaryVariables(const SummaryState& summary_state,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
|
||||||
@ -1875,7 +1875,7 @@ namespace Opm
|
|||||||
const BVector& weights,
|
const BVector& weights,
|
||||||
const int pressureVarIndex,
|
const int pressureVarIndex,
|
||||||
const bool use_well_weights,
|
const bool use_well_weights,
|
||||||
const WellState& well_state) const
|
const WellState<Scalar>& well_state) const
|
||||||
{
|
{
|
||||||
this->linSys_.extractCPRPressureMatrix(jacobian,
|
this->linSys_.extractCPRPressureMatrix(jacobian,
|
||||||
weights,
|
weights,
|
||||||
@ -1997,7 +1997,7 @@ namespace Opm
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
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 constexpr (Base::has_polymermw) {
|
||||||
if (this->isInjector()) {
|
if (this->isInjector()) {
|
||||||
@ -2045,7 +2045,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
handleInjectivityEquations(const Simulator& simulator,
|
handleInjectivityEquations(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
const int perf,
|
const int perf,
|
||||||
const EvalWell& water_flux_s,
|
const EvalWell& water_flux_s,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
@ -2113,7 +2113,7 @@ namespace Opm
|
|||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
updateConnectionRatePolyMW(const EvalWell& cq_s_poly,
|
updateConnectionRatePolyMW(const EvalWell& cq_s_poly,
|
||||||
const IntensiveQuantities& int_quants,
|
const IntensiveQuantities& int_quants,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
const int perf,
|
const int perf,
|
||||||
std::vector<RateVector>& connectionRates,
|
std::vector<RateVector>& connectionRates,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
@ -2154,7 +2154,7 @@ namespace Opm
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
std::optional<double>
|
std::optional<double>
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
computeBhpAtThpLimitProd(const WellState& well_state,
|
computeBhpAtThpLimitProd(const WellState<Scalar>& well_state,
|
||||||
const Simulator& simulator,
|
const Simulator& simulator,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
@ -2282,8 +2282,8 @@ namespace Opm
|
|||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
const int max_iter = this->param_.max_inner_iter_wells_;
|
const int max_iter = this->param_.max_inner_iter_wells_;
|
||||||
@ -2329,8 +2329,8 @@ namespace Opm
|
|||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const bool fixed_control /*false*/,
|
const bool fixed_control /*false*/,
|
||||||
const bool fixed_status /*false*/)
|
const bool fixed_status /*false*/)
|
||||||
|
@ -42,7 +42,7 @@ TargetCalculator::TargetCalculator(const Group::ProductionCMode cmode,
|
|||||||
const std::vector<double>& resv_coeff,
|
const std::vector<double>& resv_coeff,
|
||||||
const double group_grat_target_from_sales,
|
const double group_grat_target_from_sales,
|
||||||
const std::string& group_name,
|
const std::string& group_name,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const bool use_gpmaint)
|
const bool use_gpmaint)
|
||||||
: cmode_(cmode)
|
: cmode_(cmode)
|
||||||
, pu_(pu)
|
, pu_(pu)
|
||||||
@ -157,7 +157,7 @@ InjectionTargetCalculator::InjectionTargetCalculator(const Group::InjectionCMode
|
|||||||
const std::vector<double>& resv_coeff,
|
const std::vector<double>& resv_coeff,
|
||||||
const std::string& group_name,
|
const std::string& group_name,
|
||||||
const double sales_target,
|
const double sales_target,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Phase& injection_phase,
|
const Phase& injection_phase,
|
||||||
const bool use_gpmaint,
|
const bool use_gpmaint,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
|
@ -32,7 +32,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
|
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
class GroupState;
|
template<class Scalar> class GroupState;
|
||||||
struct PhaseUsage;
|
struct PhaseUsage;
|
||||||
|
|
||||||
namespace WellGroupHelpers
|
namespace WellGroupHelpers
|
||||||
@ -48,7 +48,7 @@ namespace WellGroupHelpers
|
|||||||
const std::vector<double>& resv_coeff,
|
const std::vector<double>& resv_coeff,
|
||||||
const double group_grat_target_from_sales,
|
const double group_grat_target_from_sales,
|
||||||
const std::string& group_name,
|
const std::string& group_name,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const bool use_gpmaint);
|
const bool use_gpmaint);
|
||||||
|
|
||||||
template <typename RateType>
|
template <typename RateType>
|
||||||
@ -70,7 +70,7 @@ namespace WellGroupHelpers
|
|||||||
const std::vector<double>& resv_coeff_;
|
const std::vector<double>& resv_coeff_;
|
||||||
const double group_grat_target_from_sales_;
|
const double group_grat_target_from_sales_;
|
||||||
const std::string& group_name_;
|
const std::string& group_name_;
|
||||||
const GroupState& group_state_;
|
const GroupState<double>& group_state_;
|
||||||
bool use_gpmaint_;
|
bool use_gpmaint_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ namespace WellGroupHelpers
|
|||||||
const std::vector<double>& resv_coeff,
|
const std::vector<double>& resv_coeff,
|
||||||
const std::string& group_name,
|
const std::string& group_name,
|
||||||
const double sales_target,
|
const double sales_target,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Phase& injection_phase,
|
const Phase& injection_phase,
|
||||||
const bool use_gpmaint,
|
const bool use_gpmaint,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
@ -105,7 +105,7 @@ namespace WellGroupHelpers
|
|||||||
const std::vector<double>& resv_coeff_;
|
const std::vector<double>& resv_coeff_;
|
||||||
const std::string& group_name_;
|
const std::string& group_name_;
|
||||||
double sales_target_;
|
double sales_target_;
|
||||||
const GroupState& group_state_;
|
const GroupState<double>& group_state_;
|
||||||
bool use_gpmaint_;
|
bool use_gpmaint_;
|
||||||
int pos_;
|
int pos_;
|
||||||
GuideRateModel::Target target_;
|
GuideRateModel::Target target_;
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
|
|
||||||
VFPProperties(const std::vector<std::reference_wrapper<const VFPInjTable>>& inj_tables,
|
VFPProperties(const std::vector<std::reference_wrapper<const VFPInjTable>>& inj_tables,
|
||||||
const std::vector<std::reference_wrapper<const VFPProdTable>>& prod_tables,
|
const std::vector<std::reference_wrapper<const VFPProdTable>>& prod_tables,
|
||||||
const WellState& well_state)
|
const WellState<double>& well_state)
|
||||||
:well_state_(well_state)
|
:well_state_(well_state)
|
||||||
{
|
{
|
||||||
for (const auto& vfpinj : inj_tables)
|
for (const auto& vfpinj : inj_tables)
|
||||||
@ -95,7 +95,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
VFPInjProperties m_inj;
|
VFPInjProperties m_inj;
|
||||||
VFPProdProperties m_prod;
|
VFPProdProperties m_prod;
|
||||||
const WellState& well_state_;
|
const WellState<double>& well_state_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,33 +26,40 @@
|
|||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
WGState::WGState(const PhaseUsage& pu) :
|
template<class Scalar>
|
||||||
|
WGState<Scalar>::WGState(const PhaseUsage& pu) :
|
||||||
well_state(pu),
|
well_state(pu),
|
||||||
group_state(pu.num_phases),
|
group_state(pu.num_phases),
|
||||||
well_test_state{}
|
well_test_state{}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
WGState WGState::serializationTestObject(const ParallelWellInfo& pinfo)
|
template<class Scalar>
|
||||||
|
WGState<Scalar> WGState<Scalar>::
|
||||||
|
serializationTestObject(const ParallelWellInfo& pinfo)
|
||||||
{
|
{
|
||||||
WGState result(PhaseUsage{});
|
WGState result(PhaseUsage{});
|
||||||
result.well_state = WellState::serializationTestObject(pinfo);
|
result.well_state = WellState<Scalar>::serializationTestObject(pinfo);
|
||||||
result.group_state = GroupState::serializationTestObject();
|
result.group_state = GroupState<Scalar>::serializationTestObject();
|
||||||
result.well_test_state = WellTestState::serializationTestObject();
|
result.well_test_state = WellTestState::serializationTestObject();
|
||||||
|
|
||||||
return result;
|
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() );
|
wtest_state.filter_wells( this->well_state.wells() );
|
||||||
this->well_test_state = std::move(wtest_state);
|
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 &&
|
return this->well_state == rhs.well_state &&
|
||||||
this->group_state == rhs.group_state &&
|
this->group_state == rhs.group_state &&
|
||||||
this->well_test_state == rhs.well_test_state;
|
this->well_test_state == rhs.well_test_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template struct WGState<double>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,15 +34,17 @@ class ParallelWellInfo;
|
|||||||
|
|
||||||
struct PhaseUsage;
|
struct PhaseUsage;
|
||||||
|
|
||||||
struct WGState {
|
template<class Scalar>
|
||||||
|
struct WGState
|
||||||
|
{
|
||||||
WGState(const PhaseUsage& pu);
|
WGState(const PhaseUsage& pu);
|
||||||
|
|
||||||
static WGState serializationTestObject(const ParallelWellInfo& pinfo);
|
static WGState serializationTestObject(const ParallelWellInfo& pinfo);
|
||||||
|
|
||||||
void wtest_state(WellTestState wtest_state);
|
void wtest_state(WellTestState wtest_state);
|
||||||
|
|
||||||
WellState well_state;
|
WellState<Scalar> well_state;
|
||||||
GroupState group_state;
|
GroupState<Scalar> group_state;
|
||||||
WellTestState well_test_state;
|
WellTestState well_test_state;
|
||||||
|
|
||||||
bool operator==(const WGState&) const;
|
bool operator==(const WGState&) const;
|
||||||
|
@ -53,8 +53,8 @@ template<class FluidSystem>
|
|||||||
template<class EvalWell>
|
template<class EvalWell>
|
||||||
void
|
void
|
||||||
WellAssemble<FluidSystem>::
|
WellAssemble<FluidSystem>::
|
||||||
assembleControlEqProd(const WellState& well_state,
|
assembleControlEqProd(const WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const Well::ProductionControls& controls,
|
const Well::ProductionControls& controls,
|
||||||
@ -189,8 +189,8 @@ template<class FluidSystem>
|
|||||||
template<class EvalWell>
|
template<class EvalWell>
|
||||||
void
|
void
|
||||||
WellAssemble<FluidSystem>::
|
WellAssemble<FluidSystem>::
|
||||||
assembleControlEqInj(const WellState& well_state,
|
assembleControlEqInj(const WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const Well::InjectionControls& controls,
|
const Well::InjectionControls& controls,
|
||||||
@ -277,8 +277,8 @@ assembleControlEqInj(const WellState& well_state,
|
|||||||
|
|
||||||
#define INSTANCE_METHODS(A,...) \
|
#define INSTANCE_METHODS(A,...) \
|
||||||
template void WellAssemble<A>:: \
|
template void WellAssemble<A>:: \
|
||||||
assembleControlEqProd<__VA_ARGS__>(const WellState&, \
|
assembleControlEqProd<__VA_ARGS__>(const WellState<typename A::Scalar>&, \
|
||||||
const GroupState&, \
|
const GroupState<typename A::Scalar>&, \
|
||||||
const Schedule&, \
|
const Schedule&, \
|
||||||
const SummaryState&, \
|
const SummaryState&, \
|
||||||
const Well::ProductionControls&, \
|
const Well::ProductionControls&, \
|
||||||
@ -288,8 +288,8 @@ assembleControlEqProd<__VA_ARGS__>(const WellState&, \
|
|||||||
__VA_ARGS__&, \
|
__VA_ARGS__&, \
|
||||||
DeferredLogger&) const; \
|
DeferredLogger&) const; \
|
||||||
template void WellAssemble<A>:: \
|
template void WellAssemble<A>:: \
|
||||||
assembleControlEqInj<__VA_ARGS__>(const WellState&, \
|
assembleControlEqInj<__VA_ARGS__>(const WellState<typename A::Scalar>&, \
|
||||||
const GroupState&, \
|
const GroupState<typename A::Scalar>&, \
|
||||||
const Schedule&, \
|
const Schedule&, \
|
||||||
const SummaryState&, \
|
const SummaryState&, \
|
||||||
const Well::InjectionControls&, \
|
const Well::InjectionControls&, \
|
||||||
|
@ -36,11 +36,11 @@ namespace Opm
|
|||||||
|
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
class Group;
|
class Group;
|
||||||
class GroupState;
|
template<class Scalar> class GroupState;
|
||||||
class Schedule;
|
class Schedule;
|
||||||
class SummaryState;
|
class SummaryState;
|
||||||
template<class FluidSystem> class WellInterfaceFluidSystem;
|
template<class FluidSystem> class WellInterfaceFluidSystem;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
struct WellInjectionControls;
|
struct WellInjectionControls;
|
||||||
struct WellProductionControls;
|
struct WellProductionControls;
|
||||||
|
|
||||||
@ -49,13 +49,14 @@ class WellAssemble {
|
|||||||
static constexpr int Water = BlackoilPhases::Aqua;
|
static constexpr int Water = BlackoilPhases::Aqua;
|
||||||
static constexpr int Oil = BlackoilPhases::Liquid;
|
static constexpr int Oil = BlackoilPhases::Liquid;
|
||||||
static constexpr int Gas = BlackoilPhases::Vapour;
|
static constexpr int Gas = BlackoilPhases::Vapour;
|
||||||
|
using Scalar = typename FluidSystem::Scalar;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WellAssemble(const WellInterfaceFluidSystem<FluidSystem>& well);
|
WellAssemble(const WellInterfaceFluidSystem<FluidSystem>& well);
|
||||||
|
|
||||||
template<class EvalWell>
|
template<class EvalWell>
|
||||||
void assembleControlEqProd(const WellState& well_state,
|
void assembleControlEqProd(const WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const WellProductionControls& controls,
|
const WellProductionControls& controls,
|
||||||
@ -66,8 +67,8 @@ public:
|
|||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
template<class EvalWell>
|
template<class EvalWell>
|
||||||
void assembleControlEqInj(const WellState& well_state,
|
void assembleControlEqInj(const WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const WellInjectionControls& controls,
|
const WellInjectionControls& controls,
|
||||||
|
@ -286,7 +286,7 @@ void WellBhpThpCalculator::updateThp(const double rho,
|
|||||||
const bool stop_or_zero_rate_target,
|
const bool stop_or_zero_rate_target,
|
||||||
const std::function<double()>& alq_value,
|
const std::function<double()>& alq_value,
|
||||||
const std::array<unsigned,3>& active,
|
const std::array<unsigned,3>& active,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
@ -327,7 +327,7 @@ void WellBhpThpCalculator::updateThp(const double rho,
|
|||||||
|
|
||||||
template<class EvalWell>
|
template<class EvalWell>
|
||||||
EvalWell WellBhpThpCalculator::
|
EvalWell WellBhpThpCalculator::
|
||||||
calculateBhpFromThp(const WellState& well_state,
|
calculateBhpFromThp(const WellState<double>& well_state,
|
||||||
const std::vector<EvalWell>& rates,
|
const std::vector<EvalWell>& rates,
|
||||||
const Well& well,
|
const Well& well,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
@ -390,7 +390,7 @@ calculateBhpFromThp(const WellState& well_state,
|
|||||||
|
|
||||||
double
|
double
|
||||||
WellBhpThpCalculator::
|
WellBhpThpCalculator::
|
||||||
calculateMinimumBhpFromThp(const WellState& well_state,
|
calculateMinimumBhpFromThp(const WellState<double>& well_state,
|
||||||
const Well& well,
|
const Well& well,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const double rho) const
|
const double rho) const
|
||||||
@ -867,7 +867,7 @@ bruteForceBracket(const std::function<double(const double)>& eq,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool WellBhpThpCalculator::
|
bool WellBhpThpCalculator::
|
||||||
isStableSolution(const WellState& well_state,
|
isStableSolution(const WellState<double>& well_state,
|
||||||
const Well& well,
|
const Well& well,
|
||||||
const std::vector<double>& rates,
|
const std::vector<double>& rates,
|
||||||
const SummaryState& summaryState) const
|
const SummaryState& summaryState) const
|
||||||
@ -902,7 +902,7 @@ isStableSolution(const WellState& well_state,
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::optional<double> WellBhpThpCalculator::
|
std::optional<double> WellBhpThpCalculator::
|
||||||
estimateStableBhp(const WellState& well_state,
|
estimateStableBhp(const WellState<double>& well_state,
|
||||||
const Well& well,
|
const Well& well,
|
||||||
const std::vector<double>& rates,
|
const std::vector<double>& rates,
|
||||||
const double rho,
|
const double rho,
|
||||||
@ -945,7 +945,7 @@ estimateStableBhp(const WellState& well_state,
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::pair<double, double> WellBhpThpCalculator::
|
std::pair<double, double> WellBhpThpCalculator::
|
||||||
getFloIPR(const WellState& well_state,
|
getFloIPR(const WellState<double>& well_state,
|
||||||
const Well& well,
|
const Well& well,
|
||||||
const SummaryState& summary_state) const
|
const SummaryState& summary_state) const
|
||||||
{
|
{
|
||||||
@ -969,7 +969,7 @@ getFloIPR(const WellState& well_state,
|
|||||||
|
|
||||||
#define INSTANCE(...) \
|
#define INSTANCE(...) \
|
||||||
template __VA_ARGS__ WellBhpThpCalculator:: \
|
template __VA_ARGS__ WellBhpThpCalculator:: \
|
||||||
calculateBhpFromThp<__VA_ARGS__>(const WellState&, \
|
calculateBhpFromThp<__VA_ARGS__>(const WellState<double>&, \
|
||||||
const std::vector<__VA_ARGS__>&, \
|
const std::vector<__VA_ARGS__>&, \
|
||||||
const Well&, \
|
const Well&, \
|
||||||
const SummaryState&, \
|
const SummaryState&, \
|
||||||
|
@ -36,7 +36,7 @@ class DeferredLogger;
|
|||||||
class SummaryState;
|
class SummaryState;
|
||||||
class Well;
|
class Well;
|
||||||
class WellInterfaceGeneric;
|
class WellInterfaceGeneric;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
//! \brief Class for computing BHP limits.
|
//! \brief Class for computing BHP limits.
|
||||||
class WellBhpThpCalculator {
|
class WellBhpThpCalculator {
|
||||||
@ -86,37 +86,37 @@ public:
|
|||||||
const bool stop_or_zero_rate_target,
|
const bool stop_or_zero_rate_target,
|
||||||
const std::function<double()>& alq_value,
|
const std::function<double()>& alq_value,
|
||||||
const std::array<unsigned,3>& active,
|
const std::array<unsigned,3>& active,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
template<class EvalWell>
|
template<class EvalWell>
|
||||||
EvalWell calculateBhpFromThp(const WellState& well_state,
|
EvalWell calculateBhpFromThp(const WellState<double>& well_state,
|
||||||
const std::vector<EvalWell>& rates,
|
const std::vector<EvalWell>& rates,
|
||||||
const Well& well,
|
const Well& well,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const double rho,
|
const double rho,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
double calculateMinimumBhpFromThp(const WellState& well_state,
|
double calculateMinimumBhpFromThp(const WellState<double>& well_state,
|
||||||
const Well& well,
|
const Well& well,
|
||||||
const SummaryState& summaryState,
|
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 Well& well,
|
||||||
const std::vector<double>& rates,
|
const std::vector<double>& rates,
|
||||||
const SummaryState& summaryState) const;
|
const SummaryState& summaryState) const;
|
||||||
|
|
||||||
std::optional<double>
|
std::optional<double>
|
||||||
estimateStableBhp (const WellState& well_state,
|
estimateStableBhp (const WellState<double>& well_state,
|
||||||
const Well& well,
|
const Well& well,
|
||||||
const std::vector<double>& rates,
|
const std::vector<double>& rates,
|
||||||
const double rho,
|
const double rho,
|
||||||
const SummaryState& summaryState) const;
|
const SummaryState& summaryState) const;
|
||||||
|
|
||||||
std::pair<double, double>
|
std::pair<double, double>
|
||||||
getFloIPR(const WellState& well_state,
|
getFloIPR(const WellState<double>& well_state,
|
||||||
const Well& well,
|
const Well& well,
|
||||||
const SummaryState& summary_state) const;
|
const SummaryState& summary_state) const;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
|
|
||||||
bool WellConstraints::
|
bool WellConstraints::
|
||||||
checkIndividualConstraints(SingleWellState& ws,
|
checkIndividualConstraints(SingleWellState<double>& ws,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const RateConvFunc& calcReservoirVoidageRates,
|
const RateConvFunc& calcReservoirVoidageRates,
|
||||||
bool& thp_limit_violated_but_not_switched,
|
bool& thp_limit_violated_but_not_switched,
|
||||||
@ -70,7 +70,7 @@ checkIndividualConstraints(SingleWellState& ws,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Well::InjectorCMode WellConstraints::
|
Well::InjectorCMode WellConstraints::
|
||||||
activeInjectionConstraint(const SingleWellState& ws,
|
activeInjectionConstraint(const SingleWellState<double>& ws,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
bool& thp_limit_violated_but_not_switched,
|
bool& thp_limit_violated_but_not_switched,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
@ -167,7 +167,7 @@ activeInjectionConstraint(const SingleWellState& ws,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Well::ProducerCMode WellConstraints::
|
Well::ProducerCMode WellConstraints::
|
||||||
activeProductionConstraint(const SingleWellState& ws,
|
activeProductionConstraint(const SingleWellState<double>& ws,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const RateConvFunc& calcReservoirVoidageRates,
|
const RateConvFunc& calcReservoirVoidageRates,
|
||||||
bool& thp_limit_violated_but_not_switched,
|
bool& thp_limit_violated_but_not_switched,
|
||||||
|
@ -37,7 +37,7 @@ namespace Opm
|
|||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
using RegionId = int;
|
using RegionId = int;
|
||||||
class Rates;
|
class Rates;
|
||||||
class SingleWellState;
|
template<class Scalar> class SingleWellState;
|
||||||
class SummaryState;
|
class SummaryState;
|
||||||
class WellInterfaceGeneric;
|
class WellInterfaceGeneric;
|
||||||
enum class WellInjectorCMode;
|
enum class WellInjectorCMode;
|
||||||
@ -54,7 +54,7 @@ public:
|
|||||||
std::vector<double>&)>;
|
std::vector<double>&)>;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
checkIndividualConstraints(SingleWellState& ws,
|
checkIndividualConstraints(SingleWellState<double>& ws,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const RateConvFunc& calcReservoirVoidageRates,
|
const RateConvFunc& calcReservoirVoidageRates,
|
||||||
bool& thp_limit_violated_but_not_switched,
|
bool& thp_limit_violated_but_not_switched,
|
||||||
@ -64,14 +64,14 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
WellInjectorCMode
|
WellInjectorCMode
|
||||||
activeInjectionConstraint(const SingleWellState& ws,
|
activeInjectionConstraint(const SingleWellState<double>& ws,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
bool& thp_limit_violated_but_not_switched,
|
bool& thp_limit_violated_but_not_switched,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const std::optional<Well::InjectionControls>& inj_controls = std::nullopt) const;
|
const std::optional<Well::InjectionControls>& inj_controls = std::nullopt) const;
|
||||||
|
|
||||||
WellProducerCMode
|
WellProducerCMode
|
||||||
activeProductionConstraint(const SingleWellState& ws,
|
activeProductionConstraint(const SingleWellState<double>& ws,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const RateConvFunc& calcReservoirVoidageRates,
|
const RateConvFunc& calcReservoirVoidageRates,
|
||||||
bool& thp_limit_violated_but_not_switched,
|
bool& thp_limit_violated_but_not_switched,
|
||||||
|
@ -34,7 +34,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
|
|
||||||
void WellConvergence::
|
void WellConvergence::
|
||||||
checkConvergenceControlEq(const WellState& well_state,
|
checkConvergenceControlEq(const WellState<double>& well_state,
|
||||||
const Tolerances& tolerances,
|
const Tolerances& tolerances,
|
||||||
const double well_control_residual,
|
const double well_control_residual,
|
||||||
const bool well_is_stopped,
|
const bool well_is_stopped,
|
||||||
|
@ -31,7 +31,7 @@ namespace Opm
|
|||||||
class ConvergenceReport;
|
class ConvergenceReport;
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
class WellInterfaceGeneric;
|
class WellInterfaceGeneric;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
class WellConvergence
|
class WellConvergence
|
||||||
{
|
{
|
||||||
@ -49,7 +49,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// checking the convergence of the well control equations
|
// 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 Tolerances& tolerances,
|
||||||
const double well_control_residual,
|
const double well_control_residual,
|
||||||
const bool well_is_stopped,
|
const bool well_is_stopped,
|
||||||
|
@ -34,12 +34,13 @@
|
|||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
void WellFilterCake::
|
template<class Scalar>
|
||||||
|
void WellFilterCake<Scalar>::
|
||||||
updateFiltrationParticleVolume(const WellInterfaceGeneric& well,
|
updateFiltrationParticleVolume(const WellInterfaceGeneric& well,
|
||||||
const double dt,
|
const double dt,
|
||||||
const double conc,
|
const Scalar conc,
|
||||||
const std::size_t water_index,
|
const std::size_t water_index,
|
||||||
WellState& well_state)
|
WellState<Scalar>& well_state)
|
||||||
{
|
{
|
||||||
if (!well.isInjector()) {
|
if (!well.isInjector()) {
|
||||||
return;
|
return;
|
||||||
@ -67,17 +68,18 @@ updateFiltrationParticleVolume(const WellInterfaceGeneric& well,
|
|||||||
const std::size_t np = well_state.numPhases();
|
const std::size_t np = well_state.numPhases();
|
||||||
for (int perf = 0; perf < well.numPerfs(); ++perf) {
|
for (int perf = 0; perf < well.numPerfs(); ++perf) {
|
||||||
// not considering the production water
|
// not considering the production water
|
||||||
const double water_rates = std::max(0., connection_rates[perf * np + water_index]);
|
const Scalar water_rates = std::max(0., connection_rates[perf * np + water_index]);
|
||||||
const double filtrate_rate = water_rates * conc;
|
const Scalar filtrate_rate = water_rates * conc;
|
||||||
filtration_particle_volume_[perf] += filtrate_rate * dt;
|
filtration_particle_volume_[perf] += filtrate_rate * dt;
|
||||||
ws.perf_data.filtrate_data.rates[perf] = filtrate_rate;
|
ws.perf_data.filtrate_data.rates[perf] = filtrate_rate;
|
||||||
ws.perf_data.filtrate_data.total[perf] = filtration_particle_volume_[perf];
|
ws.perf_data.filtrate_data.total[perf] = filtration_particle_volume_[perf];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellFilterCake::
|
template<class Scalar>
|
||||||
|
void WellFilterCake<Scalar>::
|
||||||
updateInjFCMult(const WellInterfaceGeneric& well,
|
updateInjFCMult(const WellInterfaceGeneric& well,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
if (inj_fc_multiplier_.empty()) {
|
if (inj_fc_multiplier_.empty()) {
|
||||||
@ -92,14 +94,14 @@ updateInjFCMult(const WellInterfaceGeneric& well,
|
|||||||
const auto& connection = connections[perf_ecl_index];
|
const auto& connection = connections[perf_ecl_index];
|
||||||
if (well.isInjector() && connection.filterCakeActive()) {
|
if (well.isInjector() && connection.filterCakeActive()) {
|
||||||
const auto& filter_cake = connection.getFilterCake();
|
const auto& filter_cake = connection.getFilterCake();
|
||||||
const double area = connection.getFilterCakeArea();
|
const Scalar area = connection.getFilterCakeArea();
|
||||||
const double poro = filter_cake.poro;
|
const Scalar poro = filter_cake.poro;
|
||||||
const double perm = filter_cake.perm;
|
const Scalar perm = filter_cake.perm;
|
||||||
const double rw = connection.getFilterCakeRadius();
|
const Scalar rw = connection.getFilterCakeRadius();
|
||||||
const double K = connection.Kh() / connection.connectionLength();
|
const Scalar K = connection.Kh() / connection.connectionLength();
|
||||||
const double factor = filter_cake.sf_multiplier;
|
const Scalar factor = filter_cake.sf_multiplier;
|
||||||
// the thickness of the filtration cake
|
// 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;
|
auto& filtrate_data = perf_data.filtrate_data;
|
||||||
filtrate_data.thickness[perf] = thickness;
|
filtrate_data.thickness[perf] = thickness;
|
||||||
filtrate_data.poro[perf] = poro;
|
filtrate_data.poro[perf] = poro;
|
||||||
@ -107,14 +109,14 @@ updateInjFCMult(const WellInterfaceGeneric& well,
|
|||||||
filtrate_data.radius[perf] = connection.getFilterCakeRadius();
|
filtrate_data.radius[perf] = connection.getFilterCakeRadius();
|
||||||
filtrate_data.area_of_flow[perf] = connection.getFilterCakeArea();
|
filtrate_data.area_of_flow[perf] = connection.getFilterCakeArea();
|
||||||
|
|
||||||
double skin_factor = 0.;
|
Scalar skin_factor = 0.;
|
||||||
switch (filter_cake.geometry) {
|
switch (filter_cake.geometry) {
|
||||||
case FilterCake::FilterCakeGeometry::LINEAR: {
|
case FilterCake::FilterCakeGeometry::LINEAR: {
|
||||||
skin_factor = thickness / rw * K / perm * factor;
|
skin_factor = thickness / rw * K / perm * factor;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FilterCake::FilterCakeGeometry::RADIAL: {
|
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;
|
skin_factor = K / perm * std::log(rc / rw) * factor;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -137,4 +139,6 @@ updateInjFCMult(const WellInterfaceGeneric& well,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template class WellFilterCake<double>;
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -27,33 +27,34 @@ namespace Opm {
|
|||||||
|
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
class WellInterfaceGeneric;
|
class WellInterfaceGeneric;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
//! \brief Class for well calculations related to filter cakes.
|
//! \brief Class for well calculations related to filter cakes.
|
||||||
|
template<class Scalar>
|
||||||
class WellFilterCake {
|
class WellFilterCake {
|
||||||
public:
|
public:
|
||||||
//! \brief Update the water injection volume.
|
//! \brief Update the water injection volume.
|
||||||
//! \details Used for calculation related to cake filtration due to injection activity.
|
//! \details Used for calculation related to cake filtration due to injection activity.
|
||||||
void updateFiltrationParticleVolume(const WellInterfaceGeneric& well,
|
void updateFiltrationParticleVolume(const WellInterfaceGeneric& well,
|
||||||
const double dt,
|
const double dt,
|
||||||
const double conc,
|
const Scalar conc,
|
||||||
const std::size_t water_index,
|
const std::size_t water_index,
|
||||||
WellState& well_state);
|
WellState<Scalar>& well_state);
|
||||||
|
|
||||||
//! \brief Update the multiplier for well transmissbility due to cake filtration.
|
//! \brief Update the multiplier for well transmissbility due to cake filtration.
|
||||||
void updateInjFCMult(const WellInterfaceGeneric& well,
|
void updateInjFCMult(const WellInterfaceGeneric& well,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
//! \brief Returns a const-ref to multipliers.
|
//! \brief Returns a const-ref to multipliers.
|
||||||
const std::vector<double>& multipliers() const
|
const std::vector<Scalar>& multipliers() const
|
||||||
{
|
{
|
||||||
return inj_fc_multiplier_;
|
return inj_fc_multiplier_;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<double> filtration_particle_volume_; //!<// Volume of filtration particles during water injection
|
std::vector<Scalar> 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> inj_fc_multiplier_; //!< Multiplier due to injection filtration cake
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,8 @@ namespace Opm
|
|||||||
std::pair<bool, double>
|
std::pair<bool, double>
|
||||||
WellGroupConstraints::
|
WellGroupConstraints::
|
||||||
checkGroupConstraintsInj(const Group& group,
|
checkGroupConstraintsInj(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const double efficiencyFactor,
|
const double efficiencyFactor,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
@ -94,8 +94,8 @@ checkGroupConstraintsInj(const Group& group,
|
|||||||
std::pair<bool, double>
|
std::pair<bool, double>
|
||||||
WellGroupConstraints::
|
WellGroupConstraints::
|
||||||
checkGroupConstraintsProd(const Group& group,
|
checkGroupConstraintsProd(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const double efficiencyFactor,
|
const double efficiencyFactor,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
@ -124,8 +124,8 @@ checkGroupConstraintsProd(const Group& group,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool WellGroupConstraints::
|
bool WellGroupConstraints::
|
||||||
checkGroupConstraints(WellState& well_state,
|
checkGroupConstraints(WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const RateConvFunc& rateConverter,
|
const RateConvFunc& rateConverter,
|
||||||
|
@ -35,13 +35,13 @@ namespace Opm
|
|||||||
|
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
class Group;
|
class Group;
|
||||||
class GroupState;
|
template<class Scalar> class GroupState;
|
||||||
enum class InjectorType;
|
enum class InjectorType;
|
||||||
using RegionId = int;
|
using RegionId = int;
|
||||||
class Schedule;
|
class Schedule;
|
||||||
class SummaryState;
|
class SummaryState;
|
||||||
class WellInterfaceGeneric;
|
class WellInterfaceGeneric;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
//! \brief Class for computing well group constraints.
|
//! \brief Class for computing well group constraints.
|
||||||
class WellGroupConstraints {
|
class WellGroupConstraints {
|
||||||
@ -51,8 +51,8 @@ public:
|
|||||||
|
|
||||||
using RateConvFunc = std::function<void(const RegionId, const int, const std::optional<std::string>&, std::vector<double>&)>;
|
using RateConvFunc = std::function<void(const RegionId, const int, const std::optional<std::string>&, std::vector<double>&)>;
|
||||||
|
|
||||||
bool checkGroupConstraints(WellState& well_state,
|
bool checkGroupConstraints(WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const RateConvFunc& rateConverter,
|
const RateConvFunc& rateConverter,
|
||||||
@ -61,8 +61,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::pair<bool, double>
|
std::pair<bool, double>
|
||||||
checkGroupConstraintsInj(const Group& group,
|
checkGroupConstraintsInj(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const double efficiencyFactor,
|
const double efficiencyFactor,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
@ -71,8 +71,8 @@ private:
|
|||||||
|
|
||||||
std::pair<bool, double>
|
std::pair<bool, double>
|
||||||
checkGroupConstraintsProd(const Group& group,
|
checkGroupConstraintsProd(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const double efficiencyFactor,
|
const double efficiencyFactor,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
|
@ -47,8 +47,8 @@ namespace Opm
|
|||||||
template<class EvalWell>
|
template<class EvalWell>
|
||||||
void WellGroupControls::
|
void WellGroupControls::
|
||||||
getGroupInjectionControl(const Group& group,
|
getGroupInjectionControl(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const InjectorType& injectorType,
|
const InjectorType& injectorType,
|
||||||
@ -187,8 +187,8 @@ getGroupInjectionControl(const Group& group,
|
|||||||
std::optional<double>
|
std::optional<double>
|
||||||
WellGroupControls::
|
WellGroupControls::
|
||||||
getGroupInjectionTargetRate(const Group& group,
|
getGroupInjectionTargetRate(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const InjectorType& injectorType,
|
const InjectorType& injectorType,
|
||||||
@ -302,8 +302,8 @@ getGroupInjectionTargetRate(const Group& group,
|
|||||||
|
|
||||||
template<class EvalWell>
|
template<class EvalWell>
|
||||||
void WellGroupControls::getGroupProductionControl(const Group& group,
|
void WellGroupControls::getGroupProductionControl(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const EvalWell& bhp,
|
const EvalWell& bhp,
|
||||||
@ -409,8 +409,8 @@ void WellGroupControls::getGroupProductionControl(const Group& group,
|
|||||||
|
|
||||||
double WellGroupControls::
|
double WellGroupControls::
|
||||||
getGroupProductionTargetRate(const Group& group,
|
getGroupProductionTargetRate(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const RateConvFunc& rateConverter,
|
const RateConvFunc& rateConverter,
|
||||||
@ -505,8 +505,8 @@ getGroupProductionTargetRate(const Group& group,
|
|||||||
#define INSTANCE(...) \
|
#define INSTANCE(...) \
|
||||||
template void WellGroupControls:: \
|
template void WellGroupControls:: \
|
||||||
getGroupInjectionControl<__VA_ARGS__>(const Group&, \
|
getGroupInjectionControl<__VA_ARGS__>(const Group&, \
|
||||||
const WellState&, \
|
const WellState<double>&, \
|
||||||
const GroupState&, \
|
const GroupState<double>&, \
|
||||||
const Schedule&, \
|
const Schedule&, \
|
||||||
const SummaryState&, \
|
const SummaryState&, \
|
||||||
const InjectorType&, \
|
const InjectorType&, \
|
||||||
@ -518,8 +518,8 @@ getGroupInjectionControl<__VA_ARGS__>(const Group&, \
|
|||||||
DeferredLogger& deferred_logger) const; \
|
DeferredLogger& deferred_logger) const; \
|
||||||
template void WellGroupControls:: \
|
template void WellGroupControls:: \
|
||||||
getGroupProductionControl<__VA_ARGS__>(const Group&, \
|
getGroupProductionControl<__VA_ARGS__>(const Group&, \
|
||||||
const WellState&, \
|
const WellState<double>&, \
|
||||||
const GroupState&, \
|
const GroupState<double>&, \
|
||||||
const Schedule&, \
|
const Schedule&, \
|
||||||
const SummaryState&, \
|
const SummaryState&, \
|
||||||
const __VA_ARGS__& bhp, \
|
const __VA_ARGS__& bhp, \
|
||||||
|
@ -34,13 +34,13 @@ namespace Opm
|
|||||||
|
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
class Group;
|
class Group;
|
||||||
class GroupState;
|
template<class Scalar> class GroupState;
|
||||||
enum class InjectorType;
|
enum class InjectorType;
|
||||||
using RegionId = int;
|
using RegionId = int;
|
||||||
class Schedule;
|
class Schedule;
|
||||||
class SummaryState;
|
class SummaryState;
|
||||||
class WellInterfaceGeneric;
|
class WellInterfaceGeneric;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
//! \brief Class for computing well group controls.
|
//! \brief Class for computing well group controls.
|
||||||
class WellGroupControls {
|
class WellGroupControls {
|
||||||
@ -52,8 +52,8 @@ public:
|
|||||||
|
|
||||||
template<class EvalWell>
|
template<class EvalWell>
|
||||||
void getGroupInjectionControl(const Group& group,
|
void getGroupInjectionControl(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const InjectorType& injectorType,
|
const InjectorType& injectorType,
|
||||||
@ -66,8 +66,8 @@ public:
|
|||||||
|
|
||||||
std::optional<double>
|
std::optional<double>
|
||||||
getGroupInjectionTargetRate(const Group& group,
|
getGroupInjectionTargetRate(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const InjectorType& injectorType,
|
const InjectorType& injectorType,
|
||||||
@ -77,8 +77,8 @@ public:
|
|||||||
|
|
||||||
template<class EvalWell>
|
template<class EvalWell>
|
||||||
void getGroupProductionControl(const Group& group,
|
void getGroupProductionControl(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const EvalWell& bhp,
|
const EvalWell& bhp,
|
||||||
@ -89,8 +89,8 @@ public:
|
|||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
double getGroupProductionTargetRate(const Group& group,
|
double getGroupProductionTargetRate(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const RateConvFunc& rateConverter,
|
const RateConvFunc& rateConverter,
|
||||||
|
@ -73,7 +73,7 @@ namespace {
|
|||||||
double sumWellPhaseRates(bool res_rates,
|
double sumWellPhaseRates(bool res_rates,
|
||||||
const Opm::Group& group,
|
const Opm::Group& group,
|
||||||
const Opm::Schedule& schedule,
|
const Opm::Schedule& schedule,
|
||||||
const Opm::WellState& wellState,
|
const Opm::WellState<double>& wellState,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const int phasePos,
|
const int phasePos,
|
||||||
const bool injector)
|
const bool injector)
|
||||||
@ -136,7 +136,7 @@ namespace WellGroupHelpers
|
|||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
GroupState& group_state)
|
GroupState<double>& group_state)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (const std::string& groupName : group.groups()) {
|
for (const std::string& groupName : group.groups()) {
|
||||||
@ -204,7 +204,7 @@ namespace WellGroupHelpers
|
|||||||
|
|
||||||
double sumWellSurfaceRates(const Group& group,
|
double sumWellSurfaceRates(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const int phasePos,
|
const int phasePos,
|
||||||
const bool injector)
|
const bool injector)
|
||||||
@ -214,7 +214,7 @@ namespace WellGroupHelpers
|
|||||||
|
|
||||||
double sumWellResRates(const Group& group,
|
double sumWellResRates(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const int phasePos,
|
const int phasePos,
|
||||||
const bool injector)
|
const bool injector)
|
||||||
@ -224,7 +224,7 @@ namespace WellGroupHelpers
|
|||||||
|
|
||||||
double sumSolventRates(const Group& group,
|
double sumSolventRates(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const bool injector)
|
const bool injector)
|
||||||
{
|
{
|
||||||
@ -269,8 +269,8 @@ namespace WellGroupHelpers
|
|||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const Opm::PhaseUsage& pu,
|
const Opm::PhaseUsage& pu,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
GuideRate* guideRate,
|
GuideRate* guideRate,
|
||||||
Opm::DeferredLogger& deferred_logger)
|
Opm::DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
@ -330,8 +330,8 @@ namespace WellGroupHelpers
|
|||||||
const bool isInjector,
|
const bool isInjector,
|
||||||
const PhaseUsage& pu,
|
const PhaseUsage& pu,
|
||||||
const GuideRate& guide_rate,
|
const GuideRate& guide_rate,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
GroupState& group_state,
|
GroupState<double>& group_state,
|
||||||
std::vector<double>& groupTargetReduction)
|
std::vector<double>& groupTargetReduction)
|
||||||
{
|
{
|
||||||
const int np = wellState.numPhases();
|
const int np = wellState.numPhases();
|
||||||
@ -467,8 +467,8 @@ namespace WellGroupHelpers
|
|||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
bool isInjector,
|
bool isInjector,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
WellState& wellState) {
|
WellState<double>& wellState) {
|
||||||
for (const std::string& groupName : group.groups()) {
|
for (const std::string& groupName : group.groups()) {
|
||||||
bool individual_control = false;
|
bool individual_control = false;
|
||||||
if (isInjector) {
|
if (isInjector) {
|
||||||
@ -534,8 +534,8 @@ namespace WellGroupHelpers
|
|||||||
void updateVREPForGroups(const Group& group,
|
void updateVREPForGroups(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
GroupState& group_state)
|
GroupState<double>& group_state)
|
||||||
{
|
{
|
||||||
for (const std::string& groupName : group.groups()) {
|
for (const std::string& groupName : group.groups()) {
|
||||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||||
@ -558,8 +558,8 @@ namespace WellGroupHelpers
|
|||||||
void updateReservoirRatesInjectionGroups(const Group& group,
|
void updateReservoirRatesInjectionGroups(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
GroupState& group_state)
|
GroupState<double>& group_state)
|
||||||
{
|
{
|
||||||
for (const std::string& groupName : group.groups()) {
|
for (const std::string& groupName : group.groups()) {
|
||||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||||
@ -582,8 +582,8 @@ namespace WellGroupHelpers
|
|||||||
void updateSurfaceRatesInjectionGroups(const Group& group,
|
void updateSurfaceRatesInjectionGroups(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
GroupState& group_state)
|
GroupState<double>& group_state)
|
||||||
{
|
{
|
||||||
for (const std::string& groupName : group.groups()) {
|
for (const std::string& groupName : group.groups()) {
|
||||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||||
@ -606,8 +606,8 @@ namespace WellGroupHelpers
|
|||||||
void updateWellRates(const Group& group,
|
void updateWellRates(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const WellState& wellStateNupcol,
|
const WellState<double>& wellStateNupcol,
|
||||||
WellState& wellState)
|
WellState<double>& wellState)
|
||||||
{
|
{
|
||||||
for (const std::string& groupName : group.groups()) {
|
for (const std::string& groupName : group.groups()) {
|
||||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||||
@ -636,8 +636,8 @@ namespace WellGroupHelpers
|
|||||||
void updateGroupProductionRates(const Group& group,
|
void updateGroupProductionRates(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
GroupState& group_state)
|
GroupState<double>& group_state)
|
||||||
{
|
{
|
||||||
for (const std::string& groupName : group.groups()) {
|
for (const std::string& groupName : group.groups()) {
|
||||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||||
@ -657,8 +657,8 @@ namespace WellGroupHelpers
|
|||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const PhaseUsage& pu,
|
const PhaseUsage& pu,
|
||||||
const SummaryState& st,
|
const SummaryState& st,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
GroupState& group_state,
|
GroupState<double>& group_state,
|
||||||
bool sum_rank)
|
bool sum_rank)
|
||||||
{
|
{
|
||||||
const int np = wellState.numPhases();
|
const int np = wellState.numPhases();
|
||||||
@ -693,8 +693,8 @@ namespace WellGroupHelpers
|
|||||||
const RegionalValues& regional_values,
|
const RegionalValues& regional_values,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const double dt,
|
const double dt,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
GroupState& group_state)
|
GroupState<double>& group_state)
|
||||||
{
|
{
|
||||||
for (const std::string& groupName : group.groups()) {
|
for (const std::string& groupName : group.groups()) {
|
||||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||||
@ -779,8 +779,8 @@ namespace WellGroupHelpers
|
|||||||
|
|
||||||
std::map<std::string, double>
|
std::map<std::string, double>
|
||||||
computeNetworkPressures(const Opm::Network::ExtNetwork& network,
|
computeNetworkPressures(const Opm::Network::ExtNetwork& network,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const VFPProdProperties& vfp_prod_props,
|
const VFPProdProperties& vfp_prod_props,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const int report_time_step)
|
const int report_time_step)
|
||||||
@ -917,21 +917,25 @@ namespace WellGroupHelpers
|
|||||||
|
|
||||||
|
|
||||||
GuideRate::RateVector
|
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);
|
return getGuideRateVector(well_state.currentWellRates(name), pu);
|
||||||
}
|
}
|
||||||
|
|
||||||
GuideRate::RateVector
|
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);
|
return getGuideRateVector(group_state.production_rates(group_name), pu);
|
||||||
}
|
}
|
||||||
|
|
||||||
double getGuideRate(const std::string& name,
|
double getGuideRate(const std::string& name,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const GuideRate* guideRate,
|
const GuideRate* guideRate,
|
||||||
const GuideRateModel::Target target,
|
const GuideRateModel::Target target,
|
||||||
@ -984,8 +988,8 @@ namespace WellGroupHelpers
|
|||||||
|
|
||||||
double getGuideRateInj(const std::string& name,
|
double getGuideRateInj(const std::string& name,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const GuideRate* guideRate,
|
const GuideRate* guideRate,
|
||||||
const GuideRateModel::Target target,
|
const GuideRateModel::Target target,
|
||||||
@ -1035,8 +1039,8 @@ namespace WellGroupHelpers
|
|||||||
|
|
||||||
|
|
||||||
int groupControlledWells(const Schedule& schedule,
|
int groupControlledWells(const Schedule& schedule,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const int report_step,
|
const int report_step,
|
||||||
const std::string& group_name,
|
const std::string& group_name,
|
||||||
const std::string& always_included_child,
|
const std::string& always_included_child,
|
||||||
@ -1107,8 +1111,8 @@ namespace WellGroupHelpers
|
|||||||
std::pair<bool, double> checkGroupConstraintsProd(const std::string& name,
|
std::pair<bool, double> checkGroupConstraintsProd(const std::string& name,
|
||||||
const std::string& parent,
|
const std::string& parent,
|
||||||
const Group& group,
|
const Group& group,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const GuideRate* guideRate,
|
const GuideRate* guideRate,
|
||||||
const double* rates,
|
const double* rates,
|
||||||
@ -1253,8 +1257,8 @@ namespace WellGroupHelpers
|
|||||||
std::pair<bool, double> checkGroupConstraintsInj(const std::string& name,
|
std::pair<bool, double> checkGroupConstraintsInj(const std::string& name,
|
||||||
const std::string& parent,
|
const std::string& parent,
|
||||||
const Group& group,
|
const Group& group,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const GuideRate* guideRate,
|
const GuideRate* guideRate,
|
||||||
const double* rates,
|
const double* rates,
|
||||||
@ -1407,7 +1411,7 @@ namespace WellGroupHelpers
|
|||||||
const Group::ProductionCMode& offendedControl,
|
const Group::ProductionCMode& offendedControl,
|
||||||
const PhaseUsage& pu,
|
const PhaseUsage& pu,
|
||||||
const Parallel::Communication& comm,
|
const Parallel::Communication& comm,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
std::pair<std::optional<std::string>, double> offending_well {std::nullopt, 0.0};
|
std::pair<std::optional<std::string>, double> offending_well {std::nullopt, 0.0};
|
||||||
@ -1531,8 +1535,8 @@ namespace WellGroupHelpers
|
|||||||
const PhaseUsage& pu,
|
const PhaseUsage& pu,
|
||||||
const int report_step,
|
const int report_step,
|
||||||
const double sim_time,
|
const double sim_time,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Parallel::Communication& comm,
|
const Parallel::Communication& comm,
|
||||||
GuideRate* guide_rate,
|
GuideRate* guide_rate,
|
||||||
std::vector<double>& pot,
|
std::vector<double>& pot,
|
||||||
@ -1549,8 +1553,8 @@ namespace WellGroupHelpers
|
|||||||
const PhaseUsage& pu,
|
const PhaseUsage& pu,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const double& simTime,
|
const double& simTime,
|
||||||
WellState& wellState,
|
WellState<double>& wellState,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Parallel::Communication& comm,
|
const Parallel::Communication& comm,
|
||||||
GuideRate* guideRate,
|
GuideRate* guideRate,
|
||||||
std::vector<double>& pot)
|
std::vector<double>& pot)
|
||||||
@ -1626,7 +1630,7 @@ namespace WellGroupHelpers
|
|||||||
const PhaseUsage& pu,
|
const PhaseUsage& pu,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const double& simTime,
|
const double& simTime,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const Parallel::Communication& comm,
|
const Parallel::Communication& comm,
|
||||||
GuideRate* guideRate)
|
GuideRate* guideRate)
|
||||||
{
|
{
|
||||||
@ -1665,8 +1669,8 @@ namespace WellGroupHelpers
|
|||||||
const AvgPMap&,
|
const AvgPMap&,
|
||||||
int,
|
int,
|
||||||
double,
|
double,
|
||||||
const WellState&,
|
const WellState<double>&,
|
||||||
GroupState&);
|
GroupState<double>&);
|
||||||
template void WellGroupHelpers::setRegionAveragePressureCalculator<AvgP>(const Group&,
|
template void WellGroupHelpers::setRegionAveragePressureCalculator<AvgP>(const Group&,
|
||||||
const Schedule&,
|
const Schedule&,
|
||||||
const int,
|
const int,
|
||||||
|
@ -34,12 +34,12 @@ namespace Opm
|
|||||||
|
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
class Group;
|
class Group;
|
||||||
class GroupState;
|
template<class Scalar> class GroupState;
|
||||||
namespace Network { class ExtNetwork; }
|
namespace Network { class ExtNetwork; }
|
||||||
struct PhaseUsage;
|
struct PhaseUsage;
|
||||||
class Schedule;
|
class Schedule;
|
||||||
class VFPProdProperties;
|
class VFPProdProperties;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
class FieldPropsManager;
|
class FieldPropsManager;
|
||||||
|
|
||||||
namespace Network { class ExtNetwork; }
|
namespace Network { class ExtNetwork; }
|
||||||
@ -53,7 +53,7 @@ namespace WellGroupHelpers
|
|||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
GroupState& group_state);
|
GroupState<double>& group_state);
|
||||||
|
|
||||||
void accumulateGroupEfficiencyFactor(const Group& group,
|
void accumulateGroupEfficiencyFactor(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
@ -62,21 +62,21 @@ namespace WellGroupHelpers
|
|||||||
|
|
||||||
double sumWellSurfaceRates(const Group& group,
|
double sumWellSurfaceRates(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const int phasePos,
|
const int phasePos,
|
||||||
const bool injector);
|
const bool injector);
|
||||||
|
|
||||||
double sumWellResRates(const Group& group,
|
double sumWellResRates(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const int phasePos,
|
const int phasePos,
|
||||||
const bool injector);
|
const bool injector);
|
||||||
|
|
||||||
double sumSolventRates(const Group& group,
|
double sumSolventRates(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const bool injector);
|
const bool injector);
|
||||||
|
|
||||||
@ -86,8 +86,8 @@ namespace WellGroupHelpers
|
|||||||
const bool isInjector,
|
const bool isInjector,
|
||||||
const PhaseUsage& pu,
|
const PhaseUsage& pu,
|
||||||
const GuideRate& guide_rate,
|
const GuideRate& guide_rate,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
GroupState& group_state,
|
GroupState<double>& group_state,
|
||||||
std::vector<double>& groupTargetReduction);
|
std::vector<double>& groupTargetReduction);
|
||||||
|
|
||||||
void updateGuideRates(const Group& group,
|
void updateGuideRates(const Group& group,
|
||||||
@ -96,8 +96,8 @@ namespace WellGroupHelpers
|
|||||||
const PhaseUsage& pu,
|
const PhaseUsage& pu,
|
||||||
int report_step,
|
int report_step,
|
||||||
double sim_time,
|
double sim_time,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Parallel::Communication& comm,
|
const Parallel::Communication& comm,
|
||||||
GuideRate* guide_rate,
|
GuideRate* guide_rate,
|
||||||
std::vector<double>& pot,
|
std::vector<double>& pot,
|
||||||
@ -108,8 +108,8 @@ namespace WellGroupHelpers
|
|||||||
const PhaseUsage& pu,
|
const PhaseUsage& pu,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const double& simTime,
|
const double& simTime,
|
||||||
WellState& wellState,
|
WellState<double>& wellState,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Parallel::Communication& comm,
|
const Parallel::Communication& comm,
|
||||||
GuideRate* guideRate,
|
GuideRate* guideRate,
|
||||||
std::vector<double>& pot);
|
std::vector<double>& pot);
|
||||||
@ -118,7 +118,7 @@ namespace WellGroupHelpers
|
|||||||
const PhaseUsage& pu,
|
const PhaseUsage& pu,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const double& simTime,
|
const double& simTime,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const Parallel::Communication& comm,
|
const Parallel::Communication& comm,
|
||||||
GuideRate* guideRate);
|
GuideRate* guideRate);
|
||||||
|
|
||||||
@ -127,69 +127,70 @@ namespace WellGroupHelpers
|
|||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const Opm::PhaseUsage& pu,
|
const Opm::PhaseUsage& pu,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
GuideRate* guideRate,
|
GuideRate* guideRate,
|
||||||
Opm::DeferredLogger& deferred_logger);
|
Opm::DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
void updateVREPForGroups(const Group& group,
|
void updateVREPForGroups(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
GroupState& group_state);
|
GroupState<double>& group_state);
|
||||||
|
|
||||||
void updateReservoirRatesInjectionGroups(const Group& group,
|
void updateReservoirRatesInjectionGroups(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
GroupState& group_state);
|
GroupState<double>& group_state);
|
||||||
|
|
||||||
void updateSurfaceRatesInjectionGroups(const Group& group,
|
void updateSurfaceRatesInjectionGroups(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
GroupState& group_state);
|
GroupState<double>& group_state);
|
||||||
|
|
||||||
void updateWellRates(const Group& group,
|
void updateWellRates(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const WellState& wellStateNupcol,
|
const WellState<double>& wellStateNupcol,
|
||||||
WellState& wellState);
|
WellState<double>& wellState);
|
||||||
|
|
||||||
void updateGroupProductionRates(const Group& group,
|
void updateGroupProductionRates(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
GroupState& group_state);
|
GroupState<double>& group_state);
|
||||||
|
|
||||||
void updateWellRatesFromGroupTargetScale(const double scale,
|
void updateWellRatesFromGroupTargetScale(const double scale,
|
||||||
const Group& group,
|
const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
bool isInjector,
|
bool isInjector,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
WellState& wellState);
|
WellState<double>& wellState);
|
||||||
|
|
||||||
void updateREINForGroups(const Group& group,
|
void updateREINForGroups(const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const PhaseUsage& pu,
|
const PhaseUsage& pu,
|
||||||
const SummaryState& st,
|
const SummaryState& st,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
GroupState& group_state,
|
GroupState<double>& group_state,
|
||||||
bool sum_rank);
|
bool sum_rank);
|
||||||
|
|
||||||
|
|
||||||
/// Returns the name of the worst offending well and its fraction (i.e. violated_phase / preferred_phase)
|
/// Returns the name of the worst offending well and its fraction
|
||||||
std::pair<std::optional<std::string>, double> worstOffendingWell(const Group& group,
|
/// (i.e. violated_phase / preferred_phase)
|
||||||
const Schedule& schedule,
|
std::pair<std::optional<std::string>, double>
|
||||||
const int reportStepIdx,
|
worstOffendingWell(const Group& group,
|
||||||
const Group::ProductionCMode& offendedControl,
|
const Schedule& schedule,
|
||||||
const PhaseUsage& pu,
|
const int reportStepIdx,
|
||||||
const Parallel::Communication& comm,
|
const Group::ProductionCMode& offendedControl,
|
||||||
const WellState& wellState,
|
const PhaseUsage& pu,
|
||||||
DeferredLogger& deferred_logger);
|
const Parallel::Communication& comm,
|
||||||
|
const WellState<double>& wellState,
|
||||||
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
template <class RegionalValues>
|
template <class RegionalValues>
|
||||||
void updateGpMaintTargetForGroups(const Group& group,
|
void updateGpMaintTargetForGroups(const Group& group,
|
||||||
@ -197,27 +198,31 @@ namespace WellGroupHelpers
|
|||||||
const RegionalValues& regional_values,
|
const RegionalValues& regional_values,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const double dt,
|
const double dt,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
GroupState& group_state);
|
GroupState<double>& group_state);
|
||||||
|
|
||||||
std::map<std::string, double>
|
std::map<std::string, double>
|
||||||
computeNetworkPressures(const Opm::Network::ExtNetwork& network,
|
computeNetworkPressures(const Opm::Network::ExtNetwork& network,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const VFPProdProperties& vfp_prod_props,
|
const VFPProdProperties& vfp_prod_props,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const int report_time_step);
|
const int report_time_step);
|
||||||
|
|
||||||
GuideRate::RateVector
|
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
|
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,
|
double getGuideRate(const std::string& name,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const GuideRate* guideRate,
|
const GuideRate* guideRate,
|
||||||
const GuideRateModel::Target target,
|
const GuideRateModel::Target target,
|
||||||
@ -226,8 +231,8 @@ namespace WellGroupHelpers
|
|||||||
|
|
||||||
double getGuideRateInj(const std::string& name,
|
double getGuideRateInj(const std::string& name,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const GuideRate* guideRate,
|
const GuideRate* guideRate,
|
||||||
const GuideRateModel::Target target,
|
const GuideRateModel::Target target,
|
||||||
@ -235,8 +240,8 @@ namespace WellGroupHelpers
|
|||||||
const PhaseUsage& pu);
|
const PhaseUsage& pu);
|
||||||
|
|
||||||
int groupControlledWells(const Schedule& schedule,
|
int groupControlledWells(const Schedule& schedule,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const int report_step,
|
const int report_step,
|
||||||
const std::string& group_name,
|
const std::string& group_name,
|
||||||
const std::string& always_included_child,
|
const std::string& always_included_child,
|
||||||
@ -247,8 +252,8 @@ namespace WellGroupHelpers
|
|||||||
std::pair<bool, double> checkGroupConstraintsInj(const std::string& name,
|
std::pair<bool, double> checkGroupConstraintsInj(const std::string& name,
|
||||||
const std::string& parent,
|
const std::string& parent,
|
||||||
const Group& group,
|
const Group& group,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const GuideRate* guideRate,
|
const GuideRate* guideRate,
|
||||||
const double* rates,
|
const double* rates,
|
||||||
@ -276,8 +281,8 @@ namespace WellGroupHelpers
|
|||||||
std::pair<bool, double> checkGroupConstraintsProd(const std::string& name,
|
std::pair<bool, double> checkGroupConstraintsProd(const std::string& name,
|
||||||
const std::string& parent,
|
const std::string& parent,
|
||||||
const Group& group,
|
const Group& group,
|
||||||
const WellState& wellState,
|
const WellState<double>& wellState,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const int reportStepIdx,
|
const int reportStepIdx,
|
||||||
const GuideRate* guideRate,
|
const GuideRate* guideRate,
|
||||||
const double* rates,
|
const double* rates,
|
||||||
|
@ -158,32 +158,32 @@ public:
|
|||||||
virtual void initPrimaryVariablesEvaluation() = 0;
|
virtual void initPrimaryVariablesEvaluation() = 0;
|
||||||
|
|
||||||
virtual ConvergenceReport getWellConvergence(const SummaryState& summary_state,
|
virtual ConvergenceReport getWellConvergence(const SummaryState& summary_state,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
const std::vector<double>& B_avg,
|
const std::vector<double>& B_avg,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const bool relax_tolerance) const = 0;
|
const bool relax_tolerance) const = 0;
|
||||||
|
|
||||||
virtual void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
virtual void solveEqAndUpdateWellState(const SummaryState& summary_state,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) = 0;
|
DeferredLogger& deferred_logger) = 0;
|
||||||
|
|
||||||
void assembleWellEq(const Simulator& simulator,
|
void assembleWellEq(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
void assembleWellEqWithoutIteration(const Simulator& simulator,
|
void assembleWellEqWithoutIteration(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
// TODO: better name or further refactoring the function to make it more clear
|
// TODO: better name or further refactoring the function to make it more clear
|
||||||
void prepareWellBeforeAssembling(const Simulator& simulator,
|
void prepareWellBeforeAssembling(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ public:
|
|||||||
/// xw to update Well State
|
/// xw to update Well State
|
||||||
virtual void recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
virtual void recoverWellSolutionAndUpdateWellState(const SummaryState& summary_state,
|
||||||
const BVector& x,
|
const BVector& x,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) = 0;
|
DeferredLogger& deferred_logger) = 0;
|
||||||
|
|
||||||
/// Ax = Ax - C D^-1 B x
|
/// 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
|
// TODO: before we decide to put more information under mutable, this function is not const
|
||||||
virtual void computeWellPotentials(const Simulator& simulator,
|
virtual void computeWellPotentials(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
std::vector<double>& well_potentials,
|
std::vector<double>& well_potentials,
|
||||||
DeferredLogger& deferred_logger) = 0;
|
DeferredLogger& deferred_logger) = 0;
|
||||||
|
|
||||||
virtual void updateWellStateWithTarget(const Simulator& simulator,
|
virtual void updateWellStateWithTarget(const Simulator& simulator,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
virtual void computeWellRatesWithBhpIterations(const Simulator& simulator,
|
virtual void computeWellRatesWithBhpIterations(const Simulator& simulator,
|
||||||
@ -231,19 +231,19 @@ public:
|
|||||||
DeferredLogger& deferred_logger) const = 0;
|
DeferredLogger& deferred_logger) const = 0;
|
||||||
|
|
||||||
bool updateWellStateWithTHPTargetProd(const Simulator& simulator,
|
bool updateWellStateWithTHPTargetProd(const Simulator& simulator,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
enum class IndividualOrGroup { Individual, Group, Both };
|
enum class IndividualOrGroup { Individual, Group, Both };
|
||||||
bool updateWellControl(const Simulator& simulator,
|
bool updateWellControl(const Simulator& simulator,
|
||||||
const IndividualOrGroup iog,
|
const IndividualOrGroup iog,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger) /* const */;
|
DeferredLogger& deferred_logger) /* const */;
|
||||||
|
|
||||||
bool updateWellControlAndStatusLocalIteration(const Simulator& simulator,
|
bool updateWellControlAndStatusLocalIteration(const Simulator& simulator,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
const double WQTotal,
|
const double WQTotal,
|
||||||
@ -252,16 +252,16 @@ public:
|
|||||||
const bool fixed_status = false);
|
const bool fixed_status = false);
|
||||||
|
|
||||||
virtual void updatePrimaryVariables(const SummaryState& summary_state,
|
virtual void updatePrimaryVariables(const SummaryState& summary_state,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) = 0;
|
DeferredLogger& deferred_logger) = 0;
|
||||||
|
|
||||||
virtual void calculateExplicitQuantities(const Simulator& simulator,
|
virtual void calculateExplicitQuantities(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) = 0; // should be const?
|
DeferredLogger& deferred_logger) = 0; // should be const?
|
||||||
|
|
||||||
virtual void updateProductivityIndex(const Simulator& simulator,
|
virtual void updateProductivityIndex(const Simulator& simulator,
|
||||||
const WellProdIndexCalculator& wellPICalc,
|
const WellProdIndexCalculator& wellPICalc,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) const = 0;
|
DeferredLogger& deferred_logger) const = 0;
|
||||||
|
|
||||||
virtual double connectionDensity(const int globalConnIdx,
|
virtual double connectionDensity(const int globalConnIdx,
|
||||||
@ -280,7 +280,7 @@ public:
|
|||||||
const BVector& x,
|
const BVector& x,
|
||||||
const int pressureVarIndex,
|
const int pressureVarIndex,
|
||||||
const bool use_well_weights,
|
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;
|
void addCellRates(RateVector& rates, int cellIdx) const;
|
||||||
|
|
||||||
@ -290,36 +290,39 @@ public:
|
|||||||
// Simulator is not const is because that assembleWellEq is non-const Simulator
|
// Simulator is not const is because that assembleWellEq is non-const Simulator
|
||||||
void wellTesting(const Simulator& simulator,
|
void wellTesting(const Simulator& simulator,
|
||||||
const double simulation_time,
|
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);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
void checkWellOperability(const Simulator& simulator,
|
void checkWellOperability(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
bool gliftBeginTimeStepWellTestIterateWellEquations(
|
bool gliftBeginTimeStepWellTestIterateWellEquations(
|
||||||
const Simulator& simulator,
|
const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState &group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
void gliftBeginTimeStepWellTestUpdateALQ(const Simulator& simulator,
|
void gliftBeginTimeStepWellTestUpdateALQ(const Simulator& simulator,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
// check whether the well is operable under the current reservoir condition
|
// check whether the well is operable under the current reservoir condition
|
||||||
// mostly related to BHP limit and THP limit
|
// mostly related to BHP limit and THP limit
|
||||||
void updateWellOperability(const Simulator& simulator,
|
void updateWellOperability(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
bool updateWellOperabilityFromWellEq(const Simulator& simulator,
|
bool updateWellOperabilityFromWellEq(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
// update perforation water throughput based on solved water rate
|
// 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.
|
/// Compute well rates based on current reservoir conditions and well variables.
|
||||||
/// Used in updateWellStateRates().
|
/// Used in updateWellStateRates().
|
||||||
@ -330,12 +333,12 @@ public:
|
|||||||
/// If so, that rate is kept as is, but the others are set proportionally
|
/// If so, that rate is kept as is, but the others are set proportionally
|
||||||
/// to the rates returned by computeCurrentWellRates().
|
/// to the rates returned by computeCurrentWellRates().
|
||||||
void updateWellStateRates(const Simulator& simulator,
|
void updateWellStateRates(const Simulator& simulator,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
void solveWellEquation(const Simulator& simulator,
|
void solveWellEquation(const Simulator& simulator,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
const std::vector<RateVector>& connectionRates() const
|
const std::vector<RateVector>& connectionRates() const
|
||||||
@ -353,11 +356,16 @@ public:
|
|||||||
return 0;
|
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:
|
protected:
|
||||||
@ -386,27 +394,27 @@ protected:
|
|||||||
const std::vector<double>& compFrac() const;
|
const std::vector<double>& compFrac() const;
|
||||||
|
|
||||||
std::vector<double> initialWellRateFractions(const Simulator& simulator,
|
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
|
// 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,
|
const Simulator& simulator,
|
||||||
DeferredLogger& deferred_logger) = 0;
|
DeferredLogger& deferred_logger) = 0;
|
||||||
|
|
||||||
// check whether the well is operable under THP limit with current reservoir condition
|
// check whether the well is operable under THP limit with current reservoir condition
|
||||||
virtual void checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
virtual void checkOperabilityUnderTHPLimit(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) = 0;
|
DeferredLogger& deferred_logger) = 0;
|
||||||
|
|
||||||
virtual void updateIPR(const Simulator& simulator,
|
virtual void updateIPR(const Simulator& simulator,
|
||||||
DeferredLogger& deferred_logger) const=0;
|
DeferredLogger& deferred_logger) const = 0;
|
||||||
|
|
||||||
virtual void assembleWellEqWithoutIteration(const Simulator& simulator,
|
virtual void assembleWellEqWithoutIteration(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
const WellInjectionControls& inj_controls,
|
const WellInjectionControls& inj_controls,
|
||||||
const WellProductionControls& prod_controls,
|
const WellProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger) = 0;
|
DeferredLogger& deferred_logger) = 0;
|
||||||
|
|
||||||
// iterate well equations with the specified control until converged
|
// iterate well equations with the specified control until converged
|
||||||
@ -414,58 +422,58 @@ protected:
|
|||||||
const double dt,
|
const double dt,
|
||||||
const WellInjectionControls& inj_controls,
|
const WellInjectionControls& inj_controls,
|
||||||
const WellProductionControls& prod_controls,
|
const WellProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger) = 0;
|
DeferredLogger& deferred_logger) = 0;
|
||||||
|
|
||||||
virtual bool iterateWellEqWithSwitching(const Simulator& simulator,
|
virtual bool iterateWellEqWithSwitching(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
const WellInjectionControls& inj_controls,
|
const WellInjectionControls& inj_controls,
|
||||||
const WellProductionControls& prod_controls,
|
const WellProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const bool fixed_control = false,
|
const bool fixed_control = false,
|
||||||
const bool fixed_status = false) = 0;
|
const bool fixed_status = false) = 0;
|
||||||
|
|
||||||
virtual void updateIPRImplicit(const Simulator& simulator,
|
virtual void updateIPRImplicit(const Simulator& simulator,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) = 0;
|
DeferredLogger& deferred_logger) = 0;
|
||||||
|
|
||||||
bool iterateWellEquations(const Simulator& simulator,
|
bool iterateWellEquations(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
bool solveWellWithTHPConstraint(const Simulator& simulator,
|
bool solveWellWithTHPConstraint(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
std::optional<double> estimateOperableBhp(const Simulator& simulator,
|
std::optional<double> estimateOperableBhp(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
bool solveWellWithBhp(const Simulator& simulator,
|
bool solveWellWithBhp(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
const double bhp,
|
const double bhp,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
bool solveWellWithZeroRate(const Simulator& simulator,
|
bool solveWellWithZeroRate(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
bool solveWellForTesting(const Simulator& simulator,
|
bool solveWellForTesting(const Simulator& simulator,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
Eval getPerfCellPressure(const FluidState& fs) const;
|
Eval getPerfCellPressure(const FluidState& fs) const;
|
||||||
@ -492,7 +500,7 @@ protected:
|
|||||||
|
|
||||||
double computeConnectionDFactor(const int perf,
|
double computeConnectionDFactor(const int perf,
|
||||||
const IntensiveQuantities& intQuants,
|
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/WellGroupHelpers.hpp>
|
||||||
#include <opm/simulators/wells/WellState.hpp>
|
#include <opm/simulators/wells/WellState.hpp>
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -67,7 +64,7 @@ WellInterfaceFluidSystem(const Well& well,
|
|||||||
template <typename FluidSystem>
|
template <typename FluidSystem>
|
||||||
void
|
void
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
calculateReservoirRates(SingleWellState& ws) const
|
calculateReservoirRates(SingleWellState<double>& ws) const
|
||||||
{
|
{
|
||||||
const int np = number_of_phases_;
|
const int np = number_of_phases_;
|
||||||
const auto& pu = this->phaseUsage();
|
const auto& pu = this->phaseUsage();
|
||||||
@ -156,7 +153,7 @@ calculateReservoirRates(SingleWellState& ws) const
|
|||||||
template <typename FluidSystem>
|
template <typename FluidSystem>
|
||||||
bool
|
bool
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
checkIndividualConstraints(SingleWellState& ws,
|
checkIndividualConstraints(SingleWellState<double>& ws,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const std::optional<Well::InjectionControls>& inj_controls,
|
const std::optional<Well::InjectionControls>& inj_controls,
|
||||||
@ -180,8 +177,8 @@ checkIndividualConstraints(SingleWellState& ws,
|
|||||||
template <typename FluidSystem>
|
template <typename FluidSystem>
|
||||||
bool
|
bool
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
checkGroupConstraints(WellState& well_state,
|
checkGroupConstraints(WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
@ -207,8 +204,8 @@ checkGroupConstraints(WellState& well_state,
|
|||||||
template <typename FluidSystem>
|
template <typename FluidSystem>
|
||||||
bool
|
bool
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
checkConstraints(WellState& well_state,
|
checkConstraints(WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
@ -242,8 +239,8 @@ template<typename FluidSystem>
|
|||||||
std::optional<double>
|
std::optional<double>
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
getGroupInjectionTargetRate(const Group& group,
|
getGroupInjectionTargetRate(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const InjectorType& injectorType,
|
const InjectorType& injectorType,
|
||||||
@ -270,12 +267,12 @@ template<typename FluidSystem>
|
|||||||
double
|
double
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
getGroupProductionTargetRate(const Group& group,
|
getGroupProductionTargetRate(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
double efficiencyFactor,
|
double efficiencyFactor,
|
||||||
DeferredLogger& deferred_logger) const
|
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)
|
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 Group;
|
||||||
class GroupState;
|
template<class Scalar> class GroupState;
|
||||||
class Schedule;
|
class Schedule;
|
||||||
struct RatioLimitCheckReport;
|
struct RatioLimitCheckReport;
|
||||||
class SingleWellState;
|
template<class Scalar> class SingleWellState;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
|
|
||||||
template<class FluidSystem>
|
template<class FluidSystem>
|
||||||
class WellInterfaceFluidSystem : public WellInterfaceGeneric {
|
class WellInterfaceFluidSystem : public WellInterfaceGeneric {
|
||||||
@ -75,30 +75,30 @@ protected:
|
|||||||
const std::vector<PerforationData>& perf_data);
|
const std::vector<PerforationData>& perf_data);
|
||||||
|
|
||||||
// updating the voidage rates in well_state when requested
|
// 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,
|
const SummaryState& summaryState,
|
||||||
DeferredLogger& deferred_logger,
|
DeferredLogger& deferred_logger,
|
||||||
const std::optional<Well::InjectionControls>& inj_controls = std::nullopt,
|
const std::optional<Well::InjectionControls>& inj_controls = std::nullopt,
|
||||||
const std::optional<Well::ProductionControls>& prod_controls = std::nullopt) const;
|
const std::optional<Well::ProductionControls>& prod_controls = std::nullopt) const;
|
||||||
|
|
||||||
bool checkGroupConstraints(WellState& well_state,
|
bool checkGroupConstraints(WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
bool checkConstraints(WellState& well_state,
|
bool checkConstraints(WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
std::optional<double>
|
std::optional<double>
|
||||||
getGroupInjectionTargetRate(const Group& group,
|
getGroupInjectionTargetRate(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
const InjectorType& injectorType,
|
const InjectorType& injectorType,
|
||||||
@ -107,8 +107,8 @@ protected:
|
|||||||
|
|
||||||
double
|
double
|
||||||
getGroupProductionTargetRate(const Group& group,
|
getGroupProductionTargetRate(const Group& group,
|
||||||
const WellState& well_state,
|
const WellState<double>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<double>& group_state,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
double efficiencyFactor,
|
double efficiencyFactor,
|
||||||
|
@ -272,7 +272,7 @@ bool WellInterfaceGeneric::wellHasTHPConstraints(const SummaryState& summaryStat
|
|||||||
return WellBhpThpCalculator(*this).wellHasTHPConstraints(summaryState);
|
return WellBhpThpCalculator(*this).wellHasTHPConstraints(summaryState);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellInterfaceGeneric::updateWellTestState(const SingleWellState& ws,
|
void WellInterfaceGeneric::updateWellTestState(const SingleWellState<double>& ws,
|
||||||
const double& simulationTime,
|
const double& simulationTime,
|
||||||
const bool& writeMessageToOPMLog,
|
const bool& writeMessageToOPMLog,
|
||||||
WellTestState& wellTestState,
|
WellTestState& wellTestState,
|
||||||
@ -349,8 +349,8 @@ void WellInterfaceGeneric::setVFPProperties(const VFPProperties* vfp_properties_
|
|||||||
vfp_properties_ = vfp_properties_arg;
|
vfp_properties_ = vfp_properties_arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellInterfaceGeneric::setPrevSurfaceRates(WellState& well_state,
|
void WellInterfaceGeneric::setPrevSurfaceRates(WellState<double>& well_state,
|
||||||
const WellState& prev_well_state) const
|
const WellState<double>& prev_well_state) const
|
||||||
{
|
{
|
||||||
auto& ws = well_state.well(this->index_of_well_);
|
auto& ws = well_state.well(this->index_of_well_);
|
||||||
auto& ws_prev = prev_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;
|
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.
|
// no alq for injectors.
|
||||||
if (isInjector())
|
if (isInjector())
|
||||||
@ -514,7 +514,8 @@ double WellInterfaceGeneric::getALQ(const WellState& well_state) const
|
|||||||
return well_state.getALQ(name());
|
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())
|
if (well_control_log_.empty())
|
||||||
return;
|
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_);
|
const auto& ws = well_state.well(this->index_of_well_);
|
||||||
if (this->isInjector()) {
|
if (this->isInjector()) {
|
||||||
@ -550,7 +551,7 @@ bool WellInterfaceGeneric::isPressureControlled(const WellState& well_state) con
|
|||||||
|
|
||||||
|
|
||||||
bool WellInterfaceGeneric::wellUnderZeroRateTarget(const SummaryState& summary_state,
|
bool WellInterfaceGeneric::wellUnderZeroRateTarget(const SummaryState& summary_state,
|
||||||
const WellState& well_state) const
|
const WellState<double>& well_state) const
|
||||||
{
|
{
|
||||||
if (this->isProducer()) { // producers
|
if (this->isProducer()) { // producers
|
||||||
const auto prod_controls = this->well_ecl_.productionControls(summary_state);
|
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,
|
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));
|
return (this->wellIsStopped() || this->wellUnderZeroRateTarget(summary_state, well_state));
|
||||||
|
|
||||||
@ -674,7 +675,7 @@ int WellInterfaceGeneric::polymerInjTable_() const
|
|||||||
|
|
||||||
std::pair<bool,bool> WellInterfaceGeneric::
|
std::pair<bool,bool> WellInterfaceGeneric::
|
||||||
computeWellPotentials(std::vector<double>& well_potentials,
|
computeWellPotentials(std::vector<double>& well_potentials,
|
||||||
const WellState& well_state)
|
const WellState<double>& well_state)
|
||||||
{
|
{
|
||||||
const int np = this->number_of_phases_;
|
const int np = this->number_of_phases_;
|
||||||
well_potentials.resize(np, 0.0);
|
well_potentials.resize(np, 0.0);
|
||||||
@ -751,7 +752,7 @@ checkNegativeWellPotentials(std::vector<double>& well_potentials,
|
|||||||
|
|
||||||
void WellInterfaceGeneric::
|
void WellInterfaceGeneric::
|
||||||
prepareForPotentialCalculations(const SummaryState& summary_state,
|
prepareForPotentialCalculations(const SummaryState& summary_state,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
Well::InjectionControls& inj_controls,
|
Well::InjectionControls& inj_controls,
|
||||||
Well::ProductionControls& prod_controls) const
|
Well::ProductionControls& prod_controls) const
|
||||||
{
|
{
|
||||||
|
@ -42,9 +42,8 @@ struct PhaseUsage;
|
|||||||
class SummaryState;
|
class SummaryState;
|
||||||
class VFPProperties;
|
class VFPProperties;
|
||||||
class WellTestState;
|
class WellTestState;
|
||||||
class WellState;
|
template<class Scalar> class WellState;
|
||||||
class SingleWellState;
|
template<class Scalar> class SingleWellState;
|
||||||
class GroupState;
|
|
||||||
class Group;
|
class Group;
|
||||||
class Schedule;
|
class Schedule;
|
||||||
|
|
||||||
@ -95,7 +94,8 @@ public:
|
|||||||
void closeCompletions(const WellTestState& wellTestState);
|
void closeCompletions(const WellTestState& wellTestState);
|
||||||
|
|
||||||
void setVFPProperties(const VFPProperties* vfp_properties_arg);
|
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 setGuideRate(const GuideRate* guide_rate_arg);
|
||||||
void setWellEfficiencyFactor(const double efficiency_factor);
|
void setWellEfficiencyFactor(const double efficiency_factor);
|
||||||
void setRepRadiusPerfLength();
|
void setRepRadiusPerfLength();
|
||||||
@ -176,7 +176,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
double getTHPConstraint(const SummaryState& summaryState) const;
|
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 wsolvent() const;
|
||||||
double rsRvInj() const;
|
double rsRvInj() const;
|
||||||
|
|
||||||
@ -193,22 +193,22 @@ public:
|
|||||||
// whether a well is specified with a non-zero and valid VFP table number
|
// whether a well is specified with a non-zero and valid VFP table number
|
||||||
bool isVFPActive(DeferredLogger& deferred_logger) const;
|
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 {
|
bool changedToOpenThisStep() const {
|
||||||
return this->changed_to_open_this_step_;
|
return this->changed_to_open_this_step_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateWellTestState(const SingleWellState& ws,
|
void updateWellTestState(const SingleWellState<double>& ws,
|
||||||
const double& simulationTime,
|
const double& simulationTime,
|
||||||
const bool& writeMessageToOPMLog,
|
const bool& writeMessageToOPMLog,
|
||||||
WellTestState& wellTestState,
|
WellTestState& wellTestState,
|
||||||
DeferredLogger& deferred_logger) const;
|
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,
|
bool stopppedOrZeroRateTarget(const SummaryState& summary_state,
|
||||||
const WellState& well_state) const;
|
const WellState<double>& well_state) const;
|
||||||
|
|
||||||
double wellEfficiencyFactor() const
|
double wellEfficiencyFactor() const
|
||||||
{ return well_efficiency_factor_; }
|
{ return well_efficiency_factor_; }
|
||||||
@ -236,18 +236,18 @@ protected:
|
|||||||
int polymerWaterTable_() const;
|
int polymerWaterTable_() const;
|
||||||
|
|
||||||
bool wellUnderZeroRateTarget(const SummaryState& summary_state,
|
bool wellUnderZeroRateTarget(const SummaryState& summary_state,
|
||||||
const WellState& well_state) const;
|
const WellState<double>& well_state) const;
|
||||||
|
|
||||||
std::pair<bool,bool>
|
std::pair<bool,bool>
|
||||||
computeWellPotentials(std::vector<double>& well_potentials,
|
computeWellPotentials(std::vector<double>& well_potentials,
|
||||||
const WellState& well_state);
|
const WellState<double>& well_state);
|
||||||
|
|
||||||
void checkNegativeWellPotentials(std::vector<double>& well_potentials,
|
void checkNegativeWellPotentials(std::vector<double>& well_potentials,
|
||||||
const bool checkOperability,
|
const bool checkOperability,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
void prepareForPotentialCalculations(const SummaryState& summary_state,
|
void prepareForPotentialCalculations(const SummaryState& summary_state,
|
||||||
WellState& well_state,
|
WellState<double>& well_state,
|
||||||
Well::InjectionControls& inj_controls,
|
Well::InjectionControls& inj_controls,
|
||||||
Well::ProductionControls& prod_controls) const;
|
Well::ProductionControls& prod_controls) const;
|
||||||
|
|
||||||
|
@ -186,8 +186,8 @@ namespace Opm
|
|||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
updateWellControl(const Simulator& simulator,
|
updateWellControl(const Simulator& simulator,
|
||||||
const IndividualOrGroup iog,
|
const IndividualOrGroup iog,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger) /* const */
|
DeferredLogger& deferred_logger) /* const */
|
||||||
{
|
{
|
||||||
const auto& summary_state = simulator.vanguard().summaryState();
|
const auto& summary_state = simulator.vanguard().summaryState();
|
||||||
@ -262,8 +262,8 @@ namespace Opm
|
|||||||
bool
|
bool
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
updateWellControlAndStatusLocalIteration(const Simulator& simulator,
|
updateWellControlAndStatusLocalIteration(const Simulator& simulator,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
const double wqTotal,
|
const double wqTotal,
|
||||||
@ -347,14 +347,14 @@ namespace Opm
|
|||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
wellTesting(const Simulator& simulator,
|
wellTesting(const Simulator& simulator,
|
||||||
const double simulation_time,
|
const double simulation_time,
|
||||||
/* const */ WellState& well_state,
|
/* const */ WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
WellTestState& well_test_state,
|
WellTestState& well_test_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
deferred_logger.info(" well " + this->name() + " is being tested");
|
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());
|
auto& ws = well_state_copy.well(this->indexOfWell());
|
||||||
|
|
||||||
updateWellStateWithTarget(simulator, group_state, well_state_copy, deferred_logger);
|
updateWellStateWithTarget(simulator, group_state, well_state_copy, deferred_logger);
|
||||||
@ -445,8 +445,8 @@ namespace Opm
|
|||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
iterateWellEquations(const Simulator& simulator,
|
iterateWellEquations(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
const auto& summary_state = simulator.vanguard().summaryState();
|
const auto& summary_state = simulator.vanguard().summaryState();
|
||||||
@ -479,9 +479,9 @@ namespace Opm
|
|||||||
solveWellWithTHPConstraint(const Simulator& simulator,
|
solveWellWithTHPConstraint(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
const Well::InjectionControls& inj_controls,
|
const Well::InjectionControls& inj_controls,
|
||||||
const Well::ProductionControls& prod_controls,
|
const Well::ProductionControls& prod_controls,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
const auto& summary_state = simulator.vanguard().summaryState();
|
const auto& summary_state = simulator.vanguard().summaryState();
|
||||||
@ -568,7 +568,7 @@ namespace Opm
|
|||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
estimateOperableBhp(const Simulator& simulator,
|
estimateOperableBhp(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
@ -592,11 +592,11 @@ namespace Opm
|
|||||||
solveWellWithBhp(const Simulator& simulator,
|
solveWellWithBhp(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
const double bhp,
|
const double bhp,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
// Solve a well using single bhp-constraint (but close if not operable under this)
|
// Solve a well using single bhp-constraint (but close if not operable under this)
|
||||||
auto group_state = GroupState(); // empty group
|
auto group_state = GroupState<Scalar>(); // empty group
|
||||||
auto inj_controls = Well::InjectionControls(0);
|
auto inj_controls = Well::InjectionControls(0);
|
||||||
auto prod_controls = Well::ProductionControls(0);
|
auto prod_controls = Well::ProductionControls(0);
|
||||||
auto& ws = well_state.well(this->index_of_well_);
|
auto& ws = well_state.well(this->index_of_well_);
|
||||||
@ -627,14 +627,14 @@ namespace Opm
|
|||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
solveWellWithZeroRate(const Simulator& simulator,
|
solveWellWithZeroRate(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
// Solve a well as stopped
|
// Solve a well as stopped
|
||||||
const auto well_status_orig = this->wellStatus_;
|
const auto well_status_orig = this->wellStatus_;
|
||||||
this->stopWell();
|
this->stopWell();
|
||||||
|
|
||||||
auto group_state = GroupState(); // empty group
|
auto group_state = GroupState<Scalar>(); // empty group
|
||||||
auto inj_controls = Well::InjectionControls(0);
|
auto inj_controls = Well::InjectionControls(0);
|
||||||
auto prod_controls = Well::ProductionControls(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);
|
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>
|
template<typename TypeTag>
|
||||||
bool
|
bool
|
||||||
WellInterface<TypeTag>::
|
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)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
// keep a copy of the original well state
|
// 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 double dt = simulator.timeStepSize();
|
||||||
const auto& summary_state = simulator.vanguard().summaryState();
|
const auto& summary_state = simulator.vanguard().summaryState();
|
||||||
const bool has_thp_limit = this->wellHasTHPConstraints(summary_state);
|
const bool has_thp_limit = this->wellHasTHPConstraints(summary_state);
|
||||||
@ -679,15 +681,15 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
solveWellEquation(const Simulator& simulator,
|
solveWellEquation(const Simulator& simulator,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
if (!this->isOperableAndSolvable() && !this->wellIsStopped())
|
if (!this->isOperableAndSolvable() && !this->wellIsStopped())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// keep a copy of the original well state
|
// 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 double dt = simulator.timeStepSize();
|
||||||
bool converged = iterateWellEquations(simulator, dt, well_state, group_state, deferred_logger);
|
bool converged = iterateWellEquations(simulator, dt, well_state, group_state, deferred_logger);
|
||||||
|
|
||||||
@ -737,8 +739,8 @@ namespace Opm
|
|||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
assembleWellEq(const Simulator& simulator,
|
assembleWellEq(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -754,8 +756,8 @@ namespace Opm
|
|||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
assembleWellEqWithoutIteration(const Simulator& simulator,
|
assembleWellEqWithoutIteration(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
const auto& summary_state = simulator.vanguard().summaryState();
|
const auto& summary_state = simulator.vanguard().summaryState();
|
||||||
@ -773,8 +775,8 @@ namespace Opm
|
|||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
prepareWellBeforeAssembling(const Simulator& simulator,
|
prepareWellBeforeAssembling(const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
const bool old_well_operable = this->operability_status_.isOperableAndSolvable();
|
const bool old_well_operable = this->operability_status_.isOperableAndSolvable();
|
||||||
@ -863,7 +865,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
checkWellOperability(const Simulator& simulator,
|
checkWellOperability(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -890,8 +892,8 @@ namespace Opm
|
|||||||
gliftBeginTimeStepWellTestIterateWellEquations(
|
gliftBeginTimeStepWellTestIterateWellEquations(
|
||||||
const Simulator& simulator,
|
const Simulator& simulator,
|
||||||
const double dt,
|
const double dt,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
const GroupState &group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
const auto& well_name = this->name();
|
const auto& well_name = this->name();
|
||||||
@ -923,7 +925,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
gliftBeginTimeStepWellTestUpdateALQ(const Simulator& simulator,
|
gliftBeginTimeStepWellTestUpdateALQ(const Simulator& simulator,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
const auto& summary_state = simulator.vanguard().summaryState();
|
const auto& summary_state = simulator.vanguard().summaryState();
|
||||||
@ -967,7 +969,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
updateWellOperability(const Simulator& simulator,
|
updateWellOperability(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
if (this->param_.local_well_solver_control_switching_) {
|
if (this->param_.local_well_solver_control_switching_) {
|
||||||
@ -1003,13 +1005,13 @@ namespace Opm
|
|||||||
bool
|
bool
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
updateWellOperabilityFromWellEq(const Simulator& simulator,
|
updateWellOperabilityFromWellEq(const Simulator& simulator,
|
||||||
const WellState& well_state,
|
const WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger)
|
DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
// only makes sense if we're using this parameter is true
|
// only makes sense if we're using this parameter is true
|
||||||
assert(this->param_.local_well_solver_control_switching_);
|
assert(this->param_.local_well_solver_control_switching_);
|
||||||
this->operability_status_.resetOperability();
|
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 auto& group_state = simulator.problem().wellModel().groupState();
|
||||||
const double dt = simulator.timeStepSize();
|
const double dt = simulator.timeStepSize();
|
||||||
// equations should be converged at this stage, so only one it is needed
|
// equations should be converged at this stage, so only one it is needed
|
||||||
@ -1021,8 +1023,8 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
updateWellStateWithTarget(const Simulator& simulator,
|
updateWellStateWithTarget(const Simulator& simulator,
|
||||||
const GroupState& group_state,
|
const GroupState<Scalar>& group_state,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1399,7 +1401,8 @@ namespace Opm
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
std::vector<double>
|
std::vector<double>
|
||||||
WellInterface<TypeTag>::
|
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_;
|
const int np = this->number_of_phases_;
|
||||||
std::vector<double> scaling_factor(np);
|
std::vector<double> scaling_factor(np);
|
||||||
@ -1446,7 +1449,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
updateWellStateRates(const Simulator& simulator,
|
updateWellStateRates(const Simulator& simulator,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
// Check if the rates of this well only are single-phase, do nothing
|
// Check if the rates of this well only are single-phase, do nothing
|
||||||
@ -1494,10 +1497,10 @@ namespace Opm
|
|||||||
template <typename TypeTag>
|
template <typename TypeTag>
|
||||||
std::vector<double>
|
std::vector<double>
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
wellIndex(const int perf,
|
wellIndex(const int perf,
|
||||||
const IntensiveQuantities& intQuants,
|
const IntensiveQuantities& intQuants,
|
||||||
const double trans_mult,
|
const double trans_mult,
|
||||||
const SingleWellState& ws) const
|
const SingleWellState<double>& ws) const
|
||||||
{
|
{
|
||||||
// Add a Forchheimer term to the gas phase CTF if the run uses
|
// Add a Forchheimer term to the gas phase CTF if the run uses
|
||||||
// either of the WDFAC or the WDFACCOR keywords.
|
// either of the WDFAC or the WDFACCOR keywords.
|
||||||
@ -1572,7 +1575,8 @@ namespace Opm
|
|||||||
template <typename TypeTag>
|
template <typename TypeTag>
|
||||||
void
|
void
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
updateConnectionDFactor(const Simulator& simulator, SingleWellState& ws) const
|
updateConnectionDFactor(const Simulator& simulator,
|
||||||
|
SingleWellState<double>& ws) const
|
||||||
{
|
{
|
||||||
if (! this->well_ecl_.getWDFAC().useDFactor()) {
|
if (! this->well_ecl_.getWDFAC().useDFactor()) {
|
||||||
return;
|
return;
|
||||||
@ -1591,9 +1595,9 @@ namespace Opm
|
|||||||
template <typename TypeTag>
|
template <typename TypeTag>
|
||||||
double
|
double
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
computeConnectionDFactor(const int perf,
|
computeConnectionDFactor(const int perf,
|
||||||
const IntensiveQuantities& intQuants,
|
const IntensiveQuantities& intQuants,
|
||||||
const SingleWellState& ws) const
|
const SingleWellState<double>& ws) const
|
||||||
{
|
{
|
||||||
auto rhoGS = [regIdx = this->pvtRegionIdx()]() {
|
auto rhoGS = [regIdx = this->pvtRegionIdx()]() {
|
||||||
return FluidSystem::referenceDensity(FluidSystem::gasPhaseIdx, regIdx);
|
return FluidSystem::referenceDensity(FluidSystem::gasPhaseIdx, regIdx);
|
||||||
@ -1633,7 +1637,8 @@ namespace Opm
|
|||||||
template <typename TypeTag>
|
template <typename TypeTag>
|
||||||
void
|
void
|
||||||
WellInterface<TypeTag>::
|
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),
|
auto connCF = [&connIx = std::as_const(ws.perf_data.ecl_index),
|
||||||
&conns = this->well_ecl_.getConnections()]
|
&conns = this->well_ecl_.getConnections()]
|
||||||
@ -1752,7 +1757,7 @@ namespace Opm
|
|||||||
bool
|
bool
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
updateWellStateWithTHPTargetProd(const Simulator& simulator,
|
updateWellStateWithTHPTargetProd(const Simulator& simulator,
|
||||||
WellState& well_state,
|
WellState<Scalar>& well_state,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
const auto& summary_state = simulator.vanguard().summaryState();
|
const auto& summary_state = simulator.vanguard().summaryState();
|
||||||
|
@ -126,28 +126,32 @@ void PackUnpackXConn::unpack([[maybe_unused]] const int link,
|
|||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
WellState::WellState(const ParallelWellInfo& pinfo)
|
template<class Scalar>
|
||||||
|
WellState<Scalar>::WellState(const ParallelWellInfo& pinfo)
|
||||||
: phase_usage_{}
|
: phase_usage_{}
|
||||||
{
|
{
|
||||||
wells_.add("test4",
|
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{});
|
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.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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellState::base_init(const std::vector<double>& cellPressures,
|
template<class Scalar>
|
||||||
const std::vector<Well>& wells_ecl,
|
void WellState<Scalar>::base_init(const std::vector<Scalar>& cellPressures,
|
||||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
const std::vector<Well>& wells_ecl,
|
||||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||||
const SummaryState& summary_state)
|
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||||
|
const SummaryState& summary_state)
|
||||||
{
|
{
|
||||||
// clear old name mapping
|
// clear old name mapping
|
||||||
this->wells_.clear();
|
this->wells_.clear();
|
||||||
@ -164,13 +168,15 @@ void WellState::base_init(const std::vector<double>& cellPressures,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellState::initSingleProducer(const Well& well,
|
template<class Scalar>
|
||||||
const ParallelWellInfo& well_info,
|
void WellState<Scalar>::initSingleProducer(const Well& well,
|
||||||
double pressure_first_connection,
|
const ParallelWellInfo& well_info,
|
||||||
const std::vector<PerforationData>& well_perf_data,
|
Scalar pressure_first_connection,
|
||||||
const SummaryState& summary_state) {
|
const std::vector<PerforationData>& well_perf_data,
|
||||||
|
const SummaryState& summary_state)
|
||||||
|
{
|
||||||
const auto& pu = this->phase_usage_;
|
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(),
|
auto& ws = this->wells_.add(well.name(),
|
||||||
SingleWellState{well.name(),
|
SingleWellState{well.name(),
|
||||||
@ -191,22 +197,23 @@ void WellState::initSingleProducer(const Well& well,
|
|||||||
ws.update_producer_targets(well, summary_state);
|
ws.update_producer_targets(well, summary_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellState::initSingleInjector(const Well& well,
|
template<class Scalar>
|
||||||
const ParallelWellInfo& well_info,
|
void WellState<Scalar>::initSingleInjector(const Well& well,
|
||||||
double pressure_first_connection,
|
const ParallelWellInfo& well_info,
|
||||||
const std::vector<PerforationData>& well_perf_data,
|
Scalar pressure_first_connection,
|
||||||
const SummaryState& summary_state) {
|
const std::vector<PerforationData>& well_perf_data,
|
||||||
|
const SummaryState& summary_state)
|
||||||
|
{
|
||||||
const auto& pu = this->phase_usage_;
|
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(),
|
auto& ws = this->wells_.add(well.name(), SingleWellState<Scalar>{well.name(),
|
||||||
well_info,
|
well_info,
|
||||||
false,
|
false,
|
||||||
pressure_first_connection,
|
pressure_first_connection,
|
||||||
well_perf_data,
|
well_perf_data,
|
||||||
pu,
|
pu,
|
||||||
temp});
|
temp});
|
||||||
|
|
||||||
// the rest of the code needs to executed even if ws.perf_data is empty
|
// 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.
|
// 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);
|
ws.update_injector_targets(well, summary_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellState::initSingleWell(const std::vector<double>& cellPressures,
|
template<class Scalar>
|
||||||
const Well& well,
|
void WellState<Scalar>::initSingleWell(const std::vector<Scalar>& cellPressures,
|
||||||
const std::vector<PerforationData>& well_perf_data,
|
const Well& well,
|
||||||
const ParallelWellInfo& well_info,
|
const std::vector<PerforationData>& well_perf_data,
|
||||||
const SummaryState& summary_state)
|
const ParallelWellInfo& well_info,
|
||||||
|
const SummaryState& summary_state)
|
||||||
{
|
{
|
||||||
double pressure_first_connection = -1;
|
Scalar pressure_first_connection = -1;
|
||||||
if (!well_perf_data.empty())
|
if (!well_perf_data.empty())
|
||||||
pressure_first_connection = cellPressures[well_perf_data[0].cell_index];
|
pressure_first_connection = cellPressures[well_perf_data[0].cell_index];
|
||||||
pressure_first_connection = well_info.broadcastFirstPerforationValue(pressure_first_connection);
|
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,
|
template<class Scalar>
|
||||||
const Schedule& schedule,
|
void WellState<Scalar>::init(const std::vector<Scalar>& cellPressures,
|
||||||
const std::vector<Well>& wells_ecl,
|
const Schedule& schedule,
|
||||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
const std::vector<Well>& wells_ecl,
|
||||||
const int report_step,
|
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||||
const WellState* prevState,
|
const int report_step,
|
||||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
const WellState* prevState,
|
||||||
const SummaryState& summary_state)
|
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||||
|
const SummaryState& summary_state)
|
||||||
{
|
{
|
||||||
// call init on base class
|
// call init on base class
|
||||||
this->base_init(cellPressures, wells_ecl, parallel_well_info,
|
this->base_init(cellPressures, wells_ecl, parallel_well_info,
|
||||||
@ -255,7 +264,7 @@ void WellState::init(const std::vector<double>& cellPressures,
|
|||||||
wells_ecl);
|
wells_ecl);
|
||||||
for (const auto& wname : schedule.wellNames(report_step))
|
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)
|
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) {
|
for (int perf = 0; perf < num_perf_this_well; ++perf) {
|
||||||
if (wells_ecl[w].getStatus() == Well::Status::OPEN) {
|
if (wells_ecl[w].getStatus() == Well::Status::OPEN) {
|
||||||
for (int p = 0; p < this->numPhases(); ++p) {
|
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];
|
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) {
|
for (int w = 0; w < nw; ++w) {
|
||||||
switch (wells_ecl[w].getStatus()) {
|
switch (wells_ecl[w].getStatus()) {
|
||||||
case Well::Status::SHUT:
|
case Well::Status::SHUT:
|
||||||
@ -390,7 +398,7 @@ void WellState::init(const std::vector<double>& cellPressures,
|
|||||||
auto& target_rates = perf_data.phase_rates;
|
auto& target_rates = perf_data.phase_rates;
|
||||||
for (int perf_index = 0; perf_index < num_perf_this_well; perf_index++) {
|
for (int perf_index = 0; perf_index < num_perf_this_well; perf_index++) {
|
||||||
for (int p = 0; p < np; ++p) {
|
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);
|
updateWellsDefaultALQ(wells_ecl, summary_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellState::resize(const std::vector<Well>& wells_ecl,
|
template<class Scalar>
|
||||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
void WellState<Scalar>::resize(const std::vector<Well>& wells_ecl,
|
||||||
const Schedule& schedule,
|
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||||
const bool handle_ms_well,
|
const Schedule& schedule,
|
||||||
const std::size_t numCells,
|
const bool handle_ms_well,
|
||||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
const std::size_t numCells,
|
||||||
const SummaryState& summary_state)
|
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);
|
init(tmp, schedule, wells_ecl, parallel_well_info, 0, nullptr, well_perf_data, summary_state);
|
||||||
|
|
||||||
if (handle_ms_well) {
|
if (handle_ms_well) {
|
||||||
@ -426,8 +434,9 @@ void WellState::resize(const std::vector<Well>& wells_ecl,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<double>&
|
template<class Scalar>
|
||||||
WellState::currentWellRates(const std::string& wellName) const
|
const std::vector<Scalar>&
|
||||||
|
WellState<Scalar>::currentWellRates(const std::string& wellName) const
|
||||||
{
|
{
|
||||||
auto it = well_rates.find(wellName);
|
auto it = well_rates.find(wellName);
|
||||||
|
|
||||||
@ -438,7 +447,8 @@ WellState::currentWellRates(const std::string& wellName) const
|
|||||||
return it->second.second;
|
return it->second.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellState::
|
template<class Scalar>
|
||||||
|
void WellState<Scalar>::
|
||||||
gatherVectorsOnRoot(const std::vector<data::Connection>& from_connections,
|
gatherVectorsOnRoot(const std::vector<data::Connection>& from_connections,
|
||||||
std::vector<data::Connection>& to_connections,
|
std::vector<data::Connection>& to_connections,
|
||||||
const Parallel::Communication& comm) const
|
const Parallel::Communication& comm) const
|
||||||
@ -463,9 +473,10 @@ gatherVectorsOnRoot(const std::vector<data::Connection>& from_connections,
|
|||||||
toOwnerComm.exchange(lineariser);
|
toOwnerComm.exchange(lineariser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
data::Wells
|
data::Wells
|
||||||
WellState::report(const int* globalCellIdxMap,
|
WellState<Scalar>::report(const int* globalCellIdxMap,
|
||||||
const std::function<bool(const int)>& wasDynamicallyClosed) const
|
const std::function<bool(const int)>& wasDynamicallyClosed) const
|
||||||
{
|
{
|
||||||
if (this->numWells() == 0) {
|
if (this->numWells() == 0) {
|
||||||
return {};
|
return {};
|
||||||
@ -573,10 +584,11 @@ WellState::report(const int* globalCellIdxMap,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellState::reportConnections(std::vector<data::Connection>& connections,
|
template<class Scalar>
|
||||||
const PhaseUsage &pu,
|
void WellState<Scalar>::reportConnections(std::vector<data::Connection>& connections,
|
||||||
std::size_t well_index,
|
const PhaseUsage &pu,
|
||||||
const int* globalCellIdxMap) const
|
std::size_t well_index,
|
||||||
|
const int* globalCellIdxMap) const
|
||||||
{
|
{
|
||||||
using rt = data::Rates::opt;
|
using rt = data::Rates::opt;
|
||||||
const auto& ws = this->well(well_index);
|
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,
|
template<class Scalar>
|
||||||
const WellState* prev_well_state)
|
void WellState<Scalar>::initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||||
|
const WellState* prev_well_state)
|
||||||
{
|
{
|
||||||
// still using the order in wells
|
// still using the order in wells
|
||||||
const int nw = wells_ecl.size();
|
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
|
// assuming the order of the perforations in well_ecl is the same with Wells
|
||||||
const WellConnections& completion_set = well_ecl.getConnections();
|
const WellConnections& completion_set = well_ecl.getConnections();
|
||||||
// number of segment for this single well
|
// 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();
|
const int well_nseg = segment_set.size();
|
||||||
int n_activeperf = 0;
|
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;
|
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);
|
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
|
// 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
|
template<class Scalar>
|
||||||
WellState::calculateSegmentRates(const std::vector<std::vector<int>>& segment_inlets,
|
void WellState<Scalar>::
|
||||||
const std::vector<std::vector<int>>& segment_perforations,
|
calculateSegmentRates(const std::vector<std::vector<int>>& segment_inlets,
|
||||||
const std::vector<double>& perforation_rates,
|
const std::vector<std::vector<int>>& segment_perforations,
|
||||||
const int np, const int segment,
|
const std::vector<Scalar>& perforation_rates,
|
||||||
std::vector<double>& segment_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 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.
|
// 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);
|
auto& ws = this->well(well_index);
|
||||||
ws.stop();
|
ws.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellState::openWell(int well_index)
|
template<class Scalar>
|
||||||
|
void WellState<Scalar>::openWell(int well_index)
|
||||||
{
|
{
|
||||||
auto& ws = this->well(well_index);
|
auto& ws = this->well(well_index);
|
||||||
ws.open();
|
ws.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellState::shutWell(int well_index)
|
template<class Scalar>
|
||||||
|
void WellState<Scalar>::shutWell(int well_index)
|
||||||
{
|
{
|
||||||
auto& ws = this->well(well_index);
|
auto& ws = this->well(well_index);
|
||||||
ws.shut();
|
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);
|
auto& ws = this->well(well_index);
|
||||||
ws.updateStatus(status);
|
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.
|
// Compute the size of the data.
|
||||||
std::size_t sz = 0;
|
std::size_t sz = 0;
|
||||||
@ -848,9 +867,8 @@ void WellState::communicateGroupRates(const Parallel::Communication& comm)
|
|||||||
}
|
}
|
||||||
sz += this->alq_state.pack_size();
|
sz += this->alq_state.pack_size();
|
||||||
|
|
||||||
|
|
||||||
// Make a vector and collect all data into it.
|
// Make a vector and collect all data into it.
|
||||||
std::vector<double> data(sz);
|
std::vector<Scalar> data(sz);
|
||||||
std::size_t pos = 0;
|
std::size_t pos = 0;
|
||||||
for (const auto& [_, owner_rates] : this->well_rates) {
|
for (const auto& [_, owner_rates] : this->well_rates) {
|
||||||
(void)_;
|
(void)_;
|
||||||
@ -884,7 +902,8 @@ void WellState::communicateGroupRates(const Parallel::Communication& comm)
|
|||||||
assert(pos == sz);
|
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();
|
this->global_well_info.value().clear();
|
||||||
for (std::size_t well_index = 0; well_index < this->size(); well_index++) {
|
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);
|
this->global_well_info.value().communicate(comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
data::Segment
|
data::Segment
|
||||||
WellState::reportSegmentResults(const int well_id,
|
WellState<Scalar>::reportSegmentResults(const int well_id,
|
||||||
const int seg_ix,
|
const int seg_ix,
|
||||||
const int seg_no) const
|
const int seg_no) const
|
||||||
{
|
{
|
||||||
using PhaseQuant = data::SegmentPhaseQuantity::Item;
|
using PhaseQuant = data::SegmentPhaseQuantity::Item;
|
||||||
using PhaseDensity = data::SegmentPhaseDensity::Item;
|
using PhaseDensity = data::SegmentPhaseDensity::Item;
|
||||||
@ -976,8 +996,9 @@ WellState::reportSegmentResults(const int well_id,
|
|||||||
return seg_res;
|
return seg_res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WellState::wellIsOwned(std::size_t well_index,
|
template<class Scalar>
|
||||||
[[maybe_unused]] const std::string& wellName) const
|
bool WellState<Scalar>::wellIsOwned(std::size_t well_index,
|
||||||
|
[[maybe_unused]] const std::string& wellName) const
|
||||||
{
|
{
|
||||||
const auto& well_info = this->parallelWellInfo(well_index);
|
const auto& well_info = this->parallelWellInfo(well_index);
|
||||||
assert(well_info.name() == wellName);
|
assert(well_info.name() == wellName);
|
||||||
@ -985,7 +1006,8 @@ bool WellState::wellIsOwned(std::size_t well_index,
|
|||||||
return well_info.isOwner();
|
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);
|
const auto& well_index = this->index(wellName);
|
||||||
if (!well_index.has_value()) {
|
if (!well_index.has_value()) {
|
||||||
@ -996,7 +1018,10 @@ bool WellState::wellIsOwned(const std::string& wellName) const
|
|||||||
return wellIsOwned(well_index.value(), wellName);
|
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();
|
const int nw = wells_ecl.size();
|
||||||
for (int i = 0; i<nw; i++) {
|
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 &&
|
return this->alq_state == rhs.alq_state &&
|
||||||
this->well_rates == rhs.well_rates &&
|
this->well_rates == rhs.well_rates &&
|
||||||
this->wells_ == rhs.wells_;
|
this->wells_ == rhs.wells_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
const ParallelWellInfo&
|
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);
|
const auto& ws = this->well(well_index);
|
||||||
return ws.parallel_info;
|
return ws.parallel_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template class WellState<double>;
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -57,6 +57,7 @@ enum class WellStatus;
|
|||||||
|
|
||||||
/// The state of a set of wells, tailored for use by the fully
|
/// The state of a set of wells, tailored for use by the fully
|
||||||
/// implicit blackoil simulator.
|
/// implicit blackoil simulator.
|
||||||
|
template<class Scalar>
|
||||||
class WellState
|
class WellState
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -75,15 +76,16 @@ public:
|
|||||||
|
|
||||||
static WellState serializationTestObject(const ParallelWellInfo& pinfo);
|
static WellState serializationTestObject(const ParallelWellInfo& pinfo);
|
||||||
|
|
||||||
std::size_t size() const {
|
std::size_t size() const
|
||||||
|
{
|
||||||
return this->wells_.size();
|
return this->wells_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> wells() const {
|
std::vector<std::string> wells() const
|
||||||
|
{
|
||||||
return this->wells_.wells();
|
return this->wells_.wells();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int numWells() const
|
int numWells() const
|
||||||
{
|
{
|
||||||
return this->size();
|
return this->size();
|
||||||
@ -91,12 +93,10 @@ public:
|
|||||||
|
|
||||||
const ParallelWellInfo& parallelWellInfo(std::size_t well_index) const;
|
const ParallelWellInfo& parallelWellInfo(std::size_t well_index) const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Allocate and initialize if wells is non-null. Also tries
|
/// Allocate and initialize if wells is non-null. Also tries
|
||||||
/// to give useful initial values to the bhp(), wellRates()
|
/// to give useful initial values to the bhp(), wellRates()
|
||||||
/// and perfPhaseRatesORG() fields, depending on controls
|
/// and perfPhaseRatesORG() fields, depending on controls
|
||||||
void init(const std::vector<double>& cellPressures,
|
void init(const std::vector<Scalar>& cellPressures,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
const std::vector<Well>& wells_ecl,
|
const std::vector<Well>& wells_ecl,
|
||||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
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 std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||||
const SummaryState& summary_state);
|
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);
|
auto& [owner, rates] = this->well_rates.at(wellName);
|
||||||
if (owner)
|
if (owner)
|
||||||
rates = new_rates;
|
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();
|
return this->well_rates.find(wellName) != this->well_rates.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,15 +133,16 @@ public:
|
|||||||
this->well_rates.clear();
|
this->well_rates.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void gatherVectorsOnRoot(const std::vector< data::Connection >& from_connections,
|
void gatherVectorsOnRoot(const std::vector<data::Connection>& from_connections,
|
||||||
std::vector< data::Connection >& to_connections,
|
std::vector<data::Connection>& to_connections,
|
||||||
const Parallel::Communication& comm) const;
|
const Parallel::Communication& comm) const;
|
||||||
|
|
||||||
data::Wells
|
data::Wells
|
||||||
report(const int* globalCellIdxMap,
|
report(const int* globalCellIdxMap,
|
||||||
const std::function<bool(const int)>& wasDynamicallyClosed) const;
|
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,
|
std::size_t well_index,
|
||||||
const int* globalCellIdxMap) const;
|
const int* globalCellIdxMap) const;
|
||||||
|
|
||||||
@ -146,61 +150,75 @@ public:
|
|||||||
void initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
void initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||||
const WellState* prev_well_state);
|
const WellState* prev_well_state);
|
||||||
|
|
||||||
static void calculateSegmentRates(const std::vector<std::vector<int>>& segment_inlets, const std::vector<std::vector<int>>&segment_perforations,
|
static void calculateSegmentRates(const std::vector<std::vector<int>>& segment_inlets, const
|
||||||
const std::vector<double>& perforation_rates, const int np, const int segment, std::vector<double>& segment_rates);
|
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 communicateGroupRates(const Parallel::Communication& comm);
|
||||||
|
|
||||||
void updateGlobalIsGrup(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);
|
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);
|
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);
|
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);
|
this->alq_state.set(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int gliftGetDebugCounter() {
|
int gliftGetDebugCounter()
|
||||||
|
{
|
||||||
return this->alq_state.get_debug_counter();
|
return this->alq_state.get_debug_counter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void gliftSetDebugCounter(int value) {
|
void gliftSetDebugCounter(int value)
|
||||||
|
{
|
||||||
return this->alq_state.set_debug_counter(value);
|
return this->alq_state.set_debug_counter(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int gliftUpdateDebugCounter() {
|
int gliftUpdateDebugCounter()
|
||||||
|
{
|
||||||
return this->alq_state.update_debug_counter();
|
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);
|
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);
|
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);
|
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);
|
this->alq_state.update_count(name, increase);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gliftTimeStepInit() {
|
void gliftTimeStepInit()
|
||||||
|
{
|
||||||
this->alq_state.reset_count();
|
this->alq_state.reset_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,13 +226,16 @@ public:
|
|||||||
// reset current_alq and update default_alq. ALQ is used for
|
// reset current_alq and update default_alq. ALQ is used for
|
||||||
// constant lift gas injection and for gas lift optimization
|
// constant lift gas injection and for gas lift optimization
|
||||||
// (THP controlled wells).
|
// (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);
|
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);
|
return this->global_well_info.value().well_name(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,55 +256,69 @@ public:
|
|||||||
return this->phase_usage_.num_phases;
|
return this->phase_usage_.num_phases;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PhaseUsage& phaseUsage() const {
|
const PhaseUsage& phaseUsage() const
|
||||||
|
{
|
||||||
return this->phase_usage_;
|
return this->phase_usage_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// One rate per well and phase.
|
/// One rate per well and phase.
|
||||||
std::vector<double>& wellRates(std::size_t well_index) { return this->wells_[well_index].surface_rates; }
|
std::vector<Scalar>& wellRates(std::size_t well_index)
|
||||||
const std::vector<double>& wellRates(std::size_t well_index) const { return this->wells_[well_index].surface_rates; }
|
{ 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);
|
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);
|
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];
|
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];
|
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];
|
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];
|
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);
|
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);
|
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);
|
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);
|
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);
|
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
|
// 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
|
// process. Observe that since a well can be split over several processes a
|
||||||
// well might appear in the WellContainer on different processes.
|
// 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
|
// 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.
|
// structures which will have entries for *all* the wells in the system.
|
||||||
@ -323,12 +358,12 @@ private:
|
|||||||
// WellStateFullyImplicitBlackoil class should be default constructible,
|
// WellStateFullyImplicitBlackoil class should be default constructible,
|
||||||
// whereas the GlobalWellInfo is not.
|
// whereas the GlobalWellInfo is not.
|
||||||
std::optional<GlobalWellInfo> global_well_info;
|
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
|
// 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
|
// bool in the value pair is whether the current process owns the well or
|
||||||
// not.
|
// 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
|
data::Segment
|
||||||
reportSegmentResults(const int well_id,
|
reportSegmentResults(const int well_id,
|
||||||
@ -341,13 +376,13 @@ private:
|
|||||||
/// wellRates() fields, depending on controls. The
|
/// wellRates() fields, depending on controls. The
|
||||||
/// perfRates() field is filled with zero, and perfPress()
|
/// perfRates() field is filled with zero, and perfPress()
|
||||||
/// with -1e100.
|
/// 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<Well>& wells_ecl,
|
||||||
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
|
||||||
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
const std::vector<std::vector<PerforationData>>& well_perf_data,
|
||||||
const SummaryState& summary_state);
|
const SummaryState& summary_state);
|
||||||
|
|
||||||
void initSingleWell(const std::vector<double>& cellPressures,
|
void initSingleWell(const std::vector<Scalar>& cellPressures,
|
||||||
const Well& well,
|
const Well& well,
|
||||||
const std::vector<PerforationData>& well_perf_data,
|
const std::vector<PerforationData>& well_perf_data,
|
||||||
const ParallelWellInfo& well_info,
|
const ParallelWellInfo& well_info,
|
||||||
@ -355,19 +390,17 @@ private:
|
|||||||
|
|
||||||
void initSingleProducer(const Well& well,
|
void initSingleProducer(const Well& well,
|
||||||
const ParallelWellInfo& well_info,
|
const ParallelWellInfo& well_info,
|
||||||
double pressure_first_connection,
|
Scalar pressure_first_connection,
|
||||||
const std::vector<PerforationData>& well_perf_data,
|
const std::vector<PerforationData>& well_perf_data,
|
||||||
const SummaryState& summary_state);
|
const SummaryState& summary_state);
|
||||||
|
|
||||||
void initSingleInjector(const Well& well,
|
void initSingleInjector(const Well& well,
|
||||||
const ParallelWellInfo& well_info,
|
const ParallelWellInfo& well_info,
|
||||||
double pressure_first_connection,
|
Scalar pressure_first_connection,
|
||||||
const std::vector<PerforationData>& well_perf_data,
|
const std::vector<PerforationData>& well_perf_data,
|
||||||
const SummaryState& summary_state);
|
const SummaryState& summary_state);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
|
||||||
|
|
||||||
#endif // OPM_WELLSTATEFULLYIMPLICITBLACKOIL_HEADER_INCLUDED
|
#endif // OPM_WELLSTATEFULLYIMPLICITBLACKOIL_HEADER_INCLUDED
|
||||||
|
@ -36,7 +36,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
|
|
||||||
template<class RatioFunc>
|
template<class RatioFunc>
|
||||||
bool WellTest::checkMaxRatioLimitWell(const SingleWellState& ws,
|
bool WellTest::checkMaxRatioLimitWell(const SingleWellState<double>& ws,
|
||||||
const double max_ratio_limit,
|
const double max_ratio_limit,
|
||||||
const RatioFunc& ratioFunc) const
|
const RatioFunc& ratioFunc) const
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ bool WellTest::checkMaxRatioLimitWell(const SingleWellState& ws,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class RatioFunc>
|
template<class RatioFunc>
|
||||||
void WellTest::checkMaxRatioLimitCompletions(const SingleWellState& ws,
|
void WellTest::checkMaxRatioLimitCompletions(const SingleWellState<double>& ws,
|
||||||
const double max_ratio_limit,
|
const double max_ratio_limit,
|
||||||
const RatioFunc& ratioFunc,
|
const RatioFunc& ratioFunc,
|
||||||
RatioLimitCheckReport& report) const
|
RatioLimitCheckReport& report) const
|
||||||
@ -97,7 +97,7 @@ void WellTest::checkMaxRatioLimitCompletions(const SingleWellState& ws,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WellTest::checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
void WellTest::checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
||||||
const SingleWellState& ws,
|
const SingleWellState<double>& ws,
|
||||||
RatioLimitCheckReport& report) const
|
RatioLimitCheckReport& report) const
|
||||||
{
|
{
|
||||||
static constexpr int Oil = BlackoilPhases::Liquid;
|
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,
|
void WellTest::checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
||||||
const SingleWellState& ws,
|
const SingleWellState<double>& ws,
|
||||||
RatioLimitCheckReport& report) const
|
RatioLimitCheckReport& report) const
|
||||||
{
|
{
|
||||||
static constexpr int Gas = BlackoilPhases::Vapour;
|
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,
|
void WellTest::checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
||||||
const SingleWellState& ws,
|
const SingleWellState<double>& ws,
|
||||||
RatioLimitCheckReport& report) const
|
RatioLimitCheckReport& report) const
|
||||||
{
|
{
|
||||||
static constexpr int Oil = BlackoilPhases::Liquid;
|
static constexpr int Oil = BlackoilPhases::Liquid;
|
||||||
@ -241,7 +241,7 @@ bool WellTest::checkRateEconLimits(const WellEconProductionLimits& econ_producti
|
|||||||
|
|
||||||
WellTest::RatioLimitCheckReport WellTest::
|
WellTest::RatioLimitCheckReport WellTest::
|
||||||
checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||||
const SingleWellState& ws,
|
const SingleWellState<double>& ws,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
// TODO: not sure how to define the worst-offending completion when more than one
|
// 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;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellTest::updateWellTestStateEconomic(const SingleWellState& ws,
|
void WellTest::updateWellTestStateEconomic(const SingleWellState<double>& ws,
|
||||||
const double simulation_time,
|
const double simulation_time,
|
||||||
const bool write_message_to_opmlog,
|
const bool write_message_to_opmlog,
|
||||||
WellTestState& well_test_state,
|
WellTestState& well_test_state,
|
||||||
|
@ -32,7 +32,7 @@ namespace Opm
|
|||||||
|
|
||||||
class DeferredLogger;
|
class DeferredLogger;
|
||||||
struct PhaseUsage;
|
struct PhaseUsage;
|
||||||
class SingleWellState;
|
template<class Scalar> class SingleWellState;
|
||||||
class WellEconProductionLimits;
|
class WellEconProductionLimits;
|
||||||
class WellInterfaceGeneric;
|
class WellInterfaceGeneric;
|
||||||
class WellTestState;
|
class WellTestState;
|
||||||
@ -43,7 +43,7 @@ public:
|
|||||||
//! \brief Constructor sets reference to well.
|
//! \brief Constructor sets reference to well.
|
||||||
WellTest(const WellInterfaceGeneric& well) : well_(well) {}
|
WellTest(const WellInterfaceGeneric& well) : well_(well) {}
|
||||||
|
|
||||||
void updateWellTestStateEconomic(const SingleWellState& ws,
|
void updateWellTestStateEconomic(const SingleWellState<double>& ws,
|
||||||
const double simulation_time,
|
const double simulation_time,
|
||||||
const bool write_message_to_opmlog,
|
const bool write_message_to_opmlog,
|
||||||
WellTestState& well_test_state,
|
WellTestState& well_test_state,
|
||||||
@ -63,24 +63,24 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
void checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
||||||
const SingleWellState& ws,
|
const SingleWellState<double>& ws,
|
||||||
RatioLimitCheckReport& report) const;
|
RatioLimitCheckReport& report) const;
|
||||||
|
|
||||||
void checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
void checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
||||||
const SingleWellState& ws,
|
const SingleWellState<double>& ws,
|
||||||
RatioLimitCheckReport& report) const;
|
RatioLimitCheckReport& report) const;
|
||||||
|
|
||||||
void checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
void checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
||||||
const SingleWellState& ws,
|
const SingleWellState<double>& ws,
|
||||||
RatioLimitCheckReport& report) const;
|
RatioLimitCheckReport& report) const;
|
||||||
|
|
||||||
template<class RatioFunc>
|
template<class RatioFunc>
|
||||||
bool checkMaxRatioLimitWell(const SingleWellState& ws,
|
bool checkMaxRatioLimitWell(const SingleWellState<double>& ws,
|
||||||
const double max_ratio_limit,
|
const double max_ratio_limit,
|
||||||
const RatioFunc& ratioFunc) const;
|
const RatioFunc& ratioFunc) const;
|
||||||
|
|
||||||
template<class RatioFunc>
|
template<class RatioFunc>
|
||||||
void checkMaxRatioLimitCompletions(const SingleWellState& ws,
|
void checkMaxRatioLimitCompletions(const SingleWellState<double>& ws,
|
||||||
const double max_ratio_limit,
|
const double max_ratio_limit,
|
||||||
const RatioFunc& ratioFunc,
|
const RatioFunc& ratioFunc,
|
||||||
RatioLimitCheckReport& report) const;
|
RatioLimitCheckReport& report) const;
|
||||||
@ -91,7 +91,7 @@ private:
|
|||||||
|
|
||||||
RatioLimitCheckReport
|
RatioLimitCheckReport
|
||||||
checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||||
const SingleWellState& ws,
|
const SingleWellState<double>& ws,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,20 +21,17 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <exception>
|
||||||
#include <opm/simulators/wells/ALQState.hpp>
|
#include <opm/simulators/wells/ALQState.hpp>
|
||||||
|
|
||||||
|
|
||||||
#define BOOST_TEST_MODULE GroupStateTest
|
#define BOOST_TEST_MODULE GroupStateTest
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
using namespace Opm;
|
using namespace Opm;
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(ALQStateCreate)
|
||||||
|
{
|
||||||
BOOST_AUTO_TEST_CASE(ALQStateCreate) {
|
ALQState<double> alq_state;
|
||||||
ALQState alq_state;
|
|
||||||
|
|
||||||
|
|
||||||
alq_state.update_default("W1", 100);
|
alq_state.update_default("W1", 100);
|
||||||
alq_state.update_default("W2", 200);
|
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};
|
std::size_t num_phases{3};
|
||||||
GroupState gs(num_phases);
|
GroupState<double> gs(num_phases);
|
||||||
|
|
||||||
BOOST_CHECK(!gs.has_production_rates("AGROUP"));
|
BOOST_CHECK(!gs.has_production_rates("AGROUP"));
|
||||||
BOOST_CHECK_THROW( gs.update_production_rates("AGROUP", {0}), std::exception);
|
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) \
|
#define TEST_FOR_TYPE(TYPE) \
|
||||||
TEST_FOR_TYPE_NAMED(TYPE, TYPE)
|
TEST_FOR_TYPE_NAMED(TYPE, TYPE)
|
||||||
|
|
||||||
TEST_FOR_TYPE(ALQState)
|
namespace Opm { using ALQS = ALQState<double>; }
|
||||||
TEST_FOR_TYPE(GroupState)
|
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(HardcodedTimeStepControl)
|
||||||
TEST_FOR_TYPE(Inplace)
|
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(PIDAndIterationCountTimeStepControl)
|
||||||
TEST_FOR_TYPE(PIDTimeStepControl)
|
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(SimpleIterationCountTimeStepControl)
|
||||||
TEST_FOR_TYPE(SimulatorReport)
|
TEST_FOR_TYPE(SimulatorReport)
|
||||||
TEST_FOR_TYPE(SimulatorReportSingle)
|
TEST_FOR_TYPE(SimulatorReportSingle)
|
||||||
@ -146,7 +150,7 @@ TEST_FOR_TYPE_NAMED(BVec, BlockVectorWrapper)
|
|||||||
BOOST_AUTO_TEST_CASE(SingleWellState)
|
BOOST_AUTO_TEST_CASE(SingleWellState)
|
||||||
{
|
{
|
||||||
Opm::ParallelWellInfo dummy;
|
Opm::ParallelWellInfo dummy;
|
||||||
auto data_out = Opm::SingleWellState::serializationTestObject(dummy);
|
auto data_out = Opm::SingleWellState<double>::serializationTestObject(dummy);
|
||||||
Opm::Serialization::MemPacker packer;
|
Opm::Serialization::MemPacker packer;
|
||||||
Opm::Serializer ser(packer);
|
Opm::Serializer ser(packer);
|
||||||
ser.pack(data_out);
|
ser.pack(data_out);
|
||||||
@ -175,7 +179,7 @@ BOOST_AUTO_TEST_CASE(WellContainer)
|
|||||||
BOOST_AUTO_TEST_CASE(WellState)
|
BOOST_AUTO_TEST_CASE(WellState)
|
||||||
{
|
{
|
||||||
Opm::ParallelWellInfo dummy;
|
Opm::ParallelWellInfo dummy;
|
||||||
auto data_out = Opm::WellState::serializationTestObject(dummy);
|
auto data_out = Opm::WellState<double>::serializationTestObject(dummy);
|
||||||
Opm::Serialization::MemPacker packer;
|
Opm::Serialization::MemPacker packer;
|
||||||
Opm::Serializer ser(packer);
|
Opm::Serializer ser(packer);
|
||||||
ser.pack(data_out);
|
ser.pack(data_out);
|
||||||
@ -190,13 +194,13 @@ BOOST_AUTO_TEST_CASE(WellState)
|
|||||||
BOOST_AUTO_TEST_CASE(WGState)
|
BOOST_AUTO_TEST_CASE(WGState)
|
||||||
{
|
{
|
||||||
Opm::ParallelWellInfo dummy;
|
Opm::ParallelWellInfo dummy;
|
||||||
auto data_out = Opm::WGState::serializationTestObject(dummy);
|
auto data_out = Opm::WGState<double>::serializationTestObject(dummy);
|
||||||
Opm::Serialization::MemPacker packer;
|
Opm::Serialization::MemPacker packer;
|
||||||
Opm::Serializer ser(packer);
|
Opm::Serializer ser(packer);
|
||||||
ser.pack(data_out);
|
ser.pack(data_out);
|
||||||
const size_t pos1 = ser.position();
|
const size_t pos1 = ser.position();
|
||||||
decltype(data_out) data_in(Opm::PhaseUsage{});
|
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);
|
ser.unpack(data_in);
|
||||||
const size_t pos2 = ser.position();
|
const size_t pos2 = ser.position();
|
||||||
BOOST_CHECK_MESSAGE(pos1 == pos2, "Packed size differ from unpack size for WGState");
|
BOOST_CHECK_MESSAGE(pos1 == pos2, "Packed size differ from unpack size for WGState");
|
||||||
@ -268,9 +272,9 @@ public:
|
|||||||
eclState, phase_usage, comm)
|
eclState, phase_usage, comm)
|
||||||
{
|
{
|
||||||
if (deserialize) {
|
if (deserialize) {
|
||||||
active_wgstate_.well_state = WellState(dummy);
|
active_wgstate_.well_state = WellState<double>(dummy);
|
||||||
last_valid_wgstate_.well_state = WellState(dummy);
|
last_valid_wgstate_.well_state = WellState<double>(dummy);
|
||||||
nupcol_wgstate_.well_state = WellState(dummy);
|
nupcol_wgstate_.well_state = WellState<double>(dummy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,9 +287,9 @@ public:
|
|||||||
closed_this_step_ = {"test1", "test2"};
|
closed_this_step_ = {"test1", "test2"};
|
||||||
guideRate_.setSerializationTestData();
|
guideRate_.setSerializationTestData();
|
||||||
node_pressures_ = {{"test3", 4.0}};
|
node_pressures_ = {{"test3", 4.0}};
|
||||||
active_wgstate_ = WGState::serializationTestObject(dummy);
|
active_wgstate_ = WGState<double>::serializationTestObject(dummy);
|
||||||
last_valid_wgstate_ = WGState::serializationTestObject(dummy);
|
last_valid_wgstate_ = WGState<double>::serializationTestObject(dummy);
|
||||||
nupcol_wgstate_ = WGState::serializationTestObject(dummy);
|
nupcol_wgstate_ = WGState<double>::serializationTestObject(dummy);
|
||||||
last_glift_opt_time_ = 5.0;
|
last_glift_opt_time_ = 5.0;
|
||||||
switched_prod_groups_ = {{"test4", "test5"}};
|
switched_prod_groups_ = {{"test4", "test5"}};
|
||||||
switched_inj_groups_ = {{{"test4", Phase::SOLVENT}, "test5"}};
|
switched_inj_groups_ = {{{"test4", Phase::SOLVENT}, "test5"}};
|
||||||
@ -299,7 +303,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
void computePotentials(const std::size_t,
|
void computePotentials(const std::size_t,
|
||||||
const WellState&,
|
const WellState<double>&,
|
||||||
std::string&,
|
std::string&,
|
||||||
ExceptionType::ExcEnum&,
|
ExceptionType::ExcEnum&,
|
||||||
DeferredLogger&) override
|
DeferredLogger&) override
|
||||||
|
@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE(G1)
|
|||||||
//using EclProblem = Opm::EclProblem<TypeTag>;
|
//using EclProblem = Opm::EclProblem<TypeTag>;
|
||||||
//using EclWellModel = typename EclProblem::EclWellModel;
|
//using EclWellModel = typename EclProblem::EclWellModel;
|
||||||
using WellModel = Opm::BlackoilWellModel<TypeTag>;
|
using WellModel = Opm::BlackoilWellModel<TypeTag>;
|
||||||
using WellState = Opm::WellState;
|
using WellState = Opm::WellState<double>;
|
||||||
using StdWell = Opm::StandardWell<TypeTag>;
|
using StdWell = Opm::StandardWell<TypeTag>;
|
||||||
using GasLiftSingleWell = Opm::GasLiftSingleWell<TypeTag>;
|
using GasLiftSingleWell = Opm::GasLiftSingleWell<TypeTag>;
|
||||||
using GasLiftGroupInfo = Opm::GasLiftGroupInfo;
|
using GasLiftGroupInfo = Opm::GasLiftGroupInfo;
|
||||||
|
@ -136,11 +136,11 @@ struct Setup
|
|||||||
};
|
};
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
Opm::WellState
|
Opm::WellState<double>
|
||||||
buildWellState(const Setup& setup, const std::size_t timeStep,
|
buildWellState(const Setup& setup, const std::size_t timeStep,
|
||||||
std::vector<Opm::ParallelWellInfo>& pinfos)
|
std::vector<Opm::ParallelWellInfo>& pinfos)
|
||||||
{
|
{
|
||||||
auto state = Opm::WellState{setup.pu};
|
auto state = Opm::WellState<double>{setup.pu};
|
||||||
|
|
||||||
const auto cpress =
|
const auto cpress =
|
||||||
std::vector<double>(setup.grid.c_grid()->number_of_cells,
|
std::vector<double>(setup.grid.c_grid()->number_of_cells,
|
||||||
@ -171,7 +171,7 @@ namespace {
|
|||||||
|
|
||||||
|
|
||||||
void setSegPress(const std::vector<Opm::Well>& wells,
|
void setSegPress(const std::vector<Opm::Well>& wells,
|
||||||
Opm::WellState& wstate)
|
Opm::WellState<double>& wstate)
|
||||||
{
|
{
|
||||||
const auto nWell = wells.size();
|
const auto nWell = wells.size();
|
||||||
|
|
||||||
@ -200,8 +200,8 @@ namespace {
|
|||||||
|
|
||||||
|
|
||||||
void setSegRates(const std::vector<Opm::Well>& wells,
|
void setSegRates(const std::vector<Opm::Well>& wells,
|
||||||
const Opm::PhaseUsage& pu,
|
const Opm::PhaseUsage& pu,
|
||||||
Opm::WellState& wstate)
|
Opm::WellState<double>& wstate)
|
||||||
{
|
{
|
||||||
const auto wat = pu.phase_used[Opm::BlackoilPhases::Aqua];
|
const auto wat = pu.phase_used[Opm::BlackoilPhases::Aqua];
|
||||||
const auto iw = wat ? pu.phase_pos[Opm::BlackoilPhases::Aqua] : -1;
|
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 Setup setup{ "msw.data" };
|
||||||
const auto& well = setup.sched.getWell("PROD01", 0);
|
const auto& well = setup.sched.getWell("PROD01", 0);
|
||||||
const auto& segments = well.getSegments();
|
const auto& segments = well.getSegments();
|
||||||
Opm::SegmentState ss1(3, segments);
|
Opm::SegmentState<double> ss1(3, segments);
|
||||||
Opm::SegmentState ss2;
|
Opm::SegmentState<double> ss2;
|
||||||
|
|
||||||
|
|
||||||
ss1.pressure_drop_hydrostatic[0] = 1;
|
ss1.pressure_drop_hydrostatic[0] = 1;
|
||||||
@ -553,10 +553,10 @@ BOOST_AUTO_TEST_CASE(TESTSegmentState2) {
|
|||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(TESTPerfData) {
|
BOOST_AUTO_TEST_CASE(TESTPerfData) {
|
||||||
Opm::PerfData pd1(3, 100, true, 3);
|
Opm::PerfData pd1(3, 100.0, true, 3);
|
||||||
Opm::PerfData pd2(3, 100, true, 3);
|
Opm::PerfData pd2(3, 100.0, true, 3);
|
||||||
Opm::PerfData pd3(2, 100, true, 3);
|
Opm::PerfData pd3(2, 100.0, true, 3);
|
||||||
Opm::PerfData pd4(3, 100, false, 3);
|
Opm::PerfData pd4(3, 100.0, false, 3);
|
||||||
|
|
||||||
|
|
||||||
for (std::size_t i = 0; i < 3; i++) {
|
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
|
// This is totally bonkers, but the pu needs a complete deck to initialize properly
|
||||||
pu.num_phases = 3;
|
pu.num_phases = 3;
|
||||||
|
|
||||||
Opm::SingleWellState ws1("W1", pinfo, true, 100, connections, pu, 1);
|
Opm::SingleWellState ws1("W1", pinfo, true, 100.0, connections, pu, 1.0);
|
||||||
Opm::SingleWellState ws2("W2", pinfo, true, 100, connections, pu, 2);
|
Opm::SingleWellState ws2("W2", pinfo, true, 100.0, connections, pu, 2.0);
|
||||||
Opm::SingleWellState ws3("W3", pinfo, false, 100, connections, pu, 3);
|
Opm::SingleWellState ws3("W3", pinfo, false, 100.0, connections, pu, 3.0);
|
||||||
|
|
||||||
ws1.bhp = 100;
|
ws1.bhp = 100;
|
||||||
ws1.thp = 200;
|
ws1.thp = 200;
|
||||||
|
Loading…
Reference in New Issue
Block a user