GroupState: template Scalar type

This commit is contained in:
Arne Morten Kvarving 2024-02-17 18:13:46 +01:00
parent be57843296
commit 67f1811234
48 changed files with 377 additions and 261 deletions

View File

@ -382,7 +382,7 @@ void BlackoilWellModelConstraints::
actionOnBrokenConstraints(const Group& group,
const Group::InjectionCMode& newControl,
const Phase& controlPhase,
GroupState& group_state,
GroupState<double>& group_state,
DeferredLogger& deferred_logger) const
{
auto oldControl = wellModel_.groupState().injection_control(group.name(), controlPhase);
@ -407,7 +407,7 @@ actionOnBrokenConstraints(const Group& group,
const Group::ProductionCMode& newControl,
const WellState<double>& well_state,
std::optional<std::string>& worst_offending_well,
GroupState& group_state,
GroupState<double>& group_state,
DeferredLogger& deferred_logger) const
{
@ -499,7 +499,7 @@ updateGroupIndividualControl(const Group& group,
std::map<std::pair<std::string,Opm::Phase>,std::string>& switched_inj,
std::map<std::string, std::string>& switched_prod,
std::map<std::string, std::pair<std::string, std::string>>& closed_offending_wells,
GroupState& group_state,
GroupState<double>& group_state,
WellState<double>& well_state,
DeferredLogger& deferred_logger) const
{

View File

@ -31,7 +31,7 @@ namespace Opm {
class BlackoilWellModelGeneric;
class DeferredLogger;
class GroupState;
template<class Scalar> class GroupState;
class SummaryState;
template<class Scalar> class WellState;
@ -56,7 +56,7 @@ public:
void actionOnBrokenConstraints(const Group& group,
const Group::InjectionCMode& newControl,
const Phase& controlPhase,
GroupState& group_state,
GroupState<double>& group_state,
DeferredLogger& deferred_logger) const;
//! \brief Execute action on broken constraint for a production well group. Return true if a group control is changed
@ -66,7 +66,7 @@ public:
const Group::ProductionCMode& newControl,
const WellState<double>& well_state,
std::optional<std::string>& worst_offending_well,
GroupState& group_state,
GroupState<double>& group_state,
DeferredLogger& deferred_logger) const;
//! \brief Update the individual controls for wells in a group. Return true if a group control is changed
@ -75,7 +75,7 @@ public:
std::map<std::pair<std::string,Opm::Phase>,std::string>& switched_inj,
std::map<std::string, std::string>& switched_prod,
std::map<std::string, std::pair<std::string, std::string>>& closed_offending_wells,
GroupState& group_state,
GroupState<double>& group_state,
WellState<double>& well_state,
DeferredLogger& deferred_logger) const;

View File

@ -114,7 +114,7 @@ public:
std::vector<Well> getLocalWells(const int timeStepIdx) const;
const Schedule& schedule() const { return schedule_; }
const PhaseUsage& phaseUsage() const { return phase_usage_; }
const GroupState& groupState() const { return this->active_wgstate_.group_state; }
const GroupState<double>& groupState() const { return this->active_wgstate_.group_state; }
std::vector<const WellInterfaceGeneric*> genericWells() const
{ return {well_container_generic_.begin(), well_container_generic_.end()}; }
@ -142,7 +142,7 @@ public:
{
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; }

View File

@ -158,7 +158,7 @@ loadRestartWellData(const std::string& well_name,
void BlackoilWellModelRestart::
loadRestartGroupData(const std::string& group,
const data::GroupData& value,
GroupState& grpState) const
GroupState<double>& grpState) const
{
using GPMode = Group::ProductionCMode;
using GIMode = Group::InjectionCMode;
@ -224,7 +224,7 @@ loadRestartData(const data::Wells& rst_wells,
const data::GroupAndNetworkValues& grpNwrkValues,
const bool handle_ms_well,
WellState<double>& well_state,
GroupState& grpState) const
GroupState<double>& grpState) const
{
using rt = data::Rates::opt;
const auto& phases = wellModel_.phaseUsage();

View File

@ -35,7 +35,7 @@ namespace data {
struct GroupData;
class GroupAndNetworkValues;
}
class GroupState;
template<class Scalar> class GroupState;
class GuideRate;
class GuideRateConfig;
struct PerforationData;
@ -69,7 +69,7 @@ public:
const data::GroupAndNetworkValues& grpNwrkValues,
const bool handle_ms_well,
WellState<double>& well_state,
GroupState& grpState) const;
GroupState<double>& grpState) const;
private:
//! \brief Loads per-connection data from restart structures.
@ -95,7 +95,7 @@ private:
//! \brief Loads per-group data from restart structures.
void loadRestartGroupData(const std::string& group,
const data::GroupData& value,
GroupState& grpState) const;
GroupState<double>& grpState) const;
const BlackoilWellModelGeneric& wellModel_; //!< Reference to well model
};

View File

@ -34,7 +34,7 @@ namespace Opm::WellGroupHelpers {
FractionCalculator::FractionCalculator(const Schedule& schedule,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const int report_step,
const GuideRate* guide_rate,
const GuideRateModel::Target target,

View File

@ -26,7 +26,7 @@
#include <string>
namespace Opm {
class GroupState;
template<class Scalar> class GroupState;
struct PhaseUsage;
class Schedule;
template<class Scalar> class WellState;
@ -39,7 +39,7 @@ class FractionCalculator
public:
FractionCalculator(const Schedule& schedule,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const int report_step,
const GuideRate* guide_rate,
const GuideRateModel::Target target,
@ -63,7 +63,7 @@ private:
GuideRate::RateVector getGroupRateVector(const std::string& group_name);
const Schedule& schedule_;
const WellState<double>& well_state_;
const GroupState& group_state_;
const GroupState<double>& group_state_;
int report_step_;
const GuideRate* guide_rate_;
GuideRateModel::Target target_;

View File

@ -31,7 +31,7 @@ namespace Opm {
GasLiftCommon::
GasLiftCommon(
WellState<double>& well_state,
const GroupState &group_state,
const GroupState<double>& group_state,
DeferredLogger &deferred_logger,
const Parallel::Communication& comm,
bool glift_debug

View File

@ -28,7 +28,7 @@ namespace Opm
{
class DeferredLogger;
class GroupState;
template<class Scalar> class GroupState;
template<class Scalar> class WellState;
class GasLiftCommon
@ -39,7 +39,7 @@ public:
protected:
GasLiftCommon(
WellState<double>& well_state,
const GroupState &group_state,
const GroupState<double>& group_state,
DeferredLogger &deferred_logger,
const Parallel::Communication& comm,
bool debug
@ -55,7 +55,7 @@ protected:
MessageType msg_type = MessageType::INFO) const;
WellState<double>& well_state_;
const GroupState& group_state_;
const GroupState<double>& group_state_;
DeferredLogger &deferred_logger_;
const Parallel::Communication& comm_;
bool debug;

View File

@ -42,7 +42,7 @@ GasLiftGroupInfo(
const PhaseUsage &phase_usage,
DeferredLogger &deferred_logger,
WellState<double>& well_state,
const GroupState &group_state,
const GroupState<double>& group_state,
const Communication &comm,
bool glift_debug
) :

View File

@ -35,7 +35,7 @@ namespace Opm
class DeferredLogger;
class GasLiftOpt;
class Group;
class GroupState;
template<class Scalar> class GroupState;
class Schedule;
class SummaryState;
class Well;
@ -75,7 +75,7 @@ public:
const PhaseUsage& phase_usage,
DeferredLogger& deferred_logger,
WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Parallel::Communication& comm,
bool glift_debug
);

View File

@ -47,7 +47,7 @@ namespace Opm
const SummaryState &summary_state,
DeferredLogger &deferred_logger,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
GasLiftGroupInfo &group_info,
GLiftSyncGroups &sync_groups,
const Parallel::Communication& comm,

View File

@ -39,7 +39,7 @@ namespace Opm
GasLiftSingleWellGeneric::GasLiftSingleWellGeneric(DeferredLogger& deferred_logger,
WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Well& ecl_well,
const SummaryState& summary_state,
GasLiftGroupInfo& group_info,

View File

@ -43,7 +43,7 @@ class Schedule;
class SummaryState;
class WellInterfaceGeneric;
template<class Scalar> class WellState;
class GroupState;
template<class Scalar> class GroupState;
class GasLiftSingleWellGeneric : public GasLiftCommon
{
@ -105,7 +105,7 @@ protected:
GasLiftSingleWellGeneric(
DeferredLogger& deferred_logger,
WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Well& ecl_well,
const SummaryState& summary_state,
GasLiftGroupInfo& group_info,

View File

@ -29,7 +29,7 @@ GasLiftSingleWell(const WellInterface<TypeTag> &well,
const SummaryState &summary_state,
DeferredLogger &deferred_logger,
WellState<Scalar>& well_state,
const GroupState &group_state,
const GroupState<Scalar>& group_state,
GasLiftGroupInfo &group_info,
GLiftSyncGroups &sync_groups,
const Parallel::Communication& comm,

View File

@ -46,7 +46,7 @@ GasLiftStage2::GasLiftStage2(
const SummaryState& summary_state,
DeferredLogger &deferred_logger,
WellState<double>& well_state,
const GroupState &group_state,
const GroupState<double>& group_state,
GLiftProdWells &prod_wells,
GLiftOptWells &glift_wells,
GasLiftGroupInfo& group_info,

View File

@ -37,7 +37,7 @@ class DeferredLogger;
class GasLiftOpt;
class GasLiftWellState;
class Group;
class GroupState;
template<class Scalar> class GroupState;
class Schedule;
class WellInterfaceGeneric;
template<class Scalar> class WellState;
@ -63,7 +63,7 @@ public:
const SummaryState& summary_state,
DeferredLogger& deferred_logger,
WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
GLiftProdWells& prod_wells,
GLiftOptWells& glift_wells,
GasLiftGroupInfo& group_info,

View File

@ -29,11 +29,13 @@
namespace Opm {
GroupState::GroupState(std::size_t np) :
template<class Scalar>
GroupState<Scalar>::GroupState(std::size_t np) :
num_phases(np)
{}
GroupState GroupState::serializationTestObject()
template<class Scalar>
GroupState<Scalar> GroupState<Scalar>::serializationTestObject()
{
GroupState result(3);
result.m_production_rates = {{"test1", {1.0, 2.0}}};
@ -52,7 +54,9 @@ GroupState GroupState::serializationTestObject()
return result;
}
bool GroupState::operator==(const GroupState& other) const {
template<class Scalar>
bool GroupState<Scalar>::operator==(const GroupState& other) const
{
return this->m_production_rates == other.m_production_rates &&
this->production_controls == other.production_controls &&
this->prod_red_rates == other.prod_red_rates &&
@ -68,19 +72,27 @@ bool GroupState::operator==(const GroupState& other) const {
//-------------------------------------------------------------------------
bool GroupState::has_production_rates(const std::string& gname) const {
template<class Scalar>
bool GroupState<Scalar>::has_production_rates(const std::string& gname) const
{
auto group_iter = this->m_production_rates.find(gname);
return (group_iter != this->m_production_rates.end());
}
void GroupState::update_production_rates(const std::string& gname, const std::vector<double>& rates) {
template<class Scalar>
void GroupState<Scalar>::update_production_rates(const std::string& gname,
const std::vector<Scalar>& rates)
{
if (rates.size() != this->num_phases)
throw std::logic_error("Wrong number of phases");
this->m_production_rates[gname] = rates;
}
const std::vector<double>& GroupState::production_rates(const std::string& gname) const {
template<class Scalar>
const std::vector<Scalar>&
GroupState<Scalar>::production_rates(const std::string& gname) const
{
auto group_iter = this->m_production_rates.find(gname);
if (group_iter == this->m_production_rates.end())
throw std::logic_error("No such group");
@ -90,19 +102,29 @@ const std::vector<double>& GroupState::production_rates(const std::string& gname
//-------------------------------------------------------------------------
bool GroupState::has_production_reduction_rates(const std::string& gname) const {
template<class Scalar>
bool GroupState<Scalar>::
has_production_reduction_rates(const std::string& gname) const
{
auto group_iter = this->prod_red_rates.find(gname);
return (group_iter != this->prod_red_rates.end());
}
void GroupState::update_production_reduction_rates(const std::string& gname, const std::vector<double>& rates) {
template<class Scalar>
void GroupState<Scalar>::
update_production_reduction_rates(const std::string& gname,
const std::vector<Scalar>& rates)
{
if (rates.size() != this->num_phases)
throw std::logic_error("Wrong number of phases");
this->prod_red_rates[gname] = rates;
}
const std::vector<double>& GroupState::production_reduction_rates(const std::string& gname) const {
template<class Scalar>
const std::vector<Scalar>&
GroupState<Scalar>::production_reduction_rates(const std::string& gname) const
{
auto group_iter = this->prod_red_rates.find(gname);
if (group_iter == this->prod_red_rates.end())
throw std::logic_error("No such group");
@ -112,19 +134,29 @@ const std::vector<double>& GroupState::production_reduction_rates(const std::str
//-------------------------------------------------------------------------
bool GroupState::has_injection_reduction_rates(const std::string& gname) const {
template<class Scalar>
bool GroupState<Scalar>::
has_injection_reduction_rates(const std::string& gname) const
{
auto group_iter = this->inj_red_rates.find(gname);
return (group_iter != this->inj_red_rates.end());
}
void GroupState::update_injection_reduction_rates(const std::string& gname, const std::vector<double>& rates) {
template<class Scalar>
void GroupState<Scalar>::
update_injection_reduction_rates(const std::string& gname,
const std::vector<Scalar>& rates)
{
if (rates.size() != this->num_phases)
throw std::logic_error("Wrong number of phases");
this->inj_red_rates[gname] = rates;
}
const std::vector<double>& GroupState::injection_reduction_rates(const std::string& gname) const {
template<class Scalar>
const std::vector<Scalar>&
GroupState<Scalar>::injection_reduction_rates(const std::string& gname) const
{
auto group_iter = this->inj_red_rates.find(gname);
if (group_iter == this->inj_red_rates.end())
throw std::logic_error("No such group");
@ -133,19 +165,30 @@ const std::vector<double>& GroupState::injection_reduction_rates(const std::stri
}
//-------------------------------------------------------------------------
bool GroupState::has_injection_surface_rates(const std::string& gname) const {
template<class Scalar>
bool GroupState<Scalar>::
has_injection_surface_rates(const std::string& gname) const
{
auto group_iter = this->inj_surface_rates.find(gname);
return (group_iter != this->inj_surface_rates.end());
}
void GroupState::update_injection_surface_rates(const std::string& gname, const std::vector<double>& rates) {
template<class Scalar>
void GroupState<Scalar>::
update_injection_surface_rates(const std::string& gname,
const std::vector<Scalar>& rates)
{
if (rates.size() != this->num_phases)
throw std::logic_error("Wrong number of phases");
this->inj_surface_rates[gname] = rates;
}
const std::vector<double>& GroupState::injection_surface_rates(const std::string& gname) const {
template<class Scalar>
const std::vector<Scalar>&
GroupState<Scalar>::
injection_surface_rates(const std::string& gname) const
{
auto group_iter = this->inj_surface_rates.find(gname);
if (group_iter == this->inj_surface_rates.end())
throw std::logic_error("No such group");
@ -155,19 +198,29 @@ const std::vector<double>& GroupState::injection_surface_rates(const std::string
//-------------------------------------------------------------------------
bool GroupState::has_injection_reservoir_rates(const std::string& gname) const {
template<class Scalar>
bool GroupState<Scalar>::
has_injection_reservoir_rates(const std::string& gname) const
{
auto group_iter = this->inj_resv_rates.find(gname);
return (group_iter != this->inj_resv_rates.end());
}
void GroupState::update_injection_reservoir_rates(const std::string& gname, const std::vector<double>& rates) {
template<class Scalar>
void GroupState<Scalar>::
update_injection_reservoir_rates(const std::string& gname,
const std::vector<Scalar>& rates)
{
if (rates.size() != this->num_phases)
throw std::logic_error("Wrong number of phases");
this->inj_resv_rates[gname] = rates;
}
const std::vector<double>& GroupState::injection_reservoir_rates(const std::string& gname) const {
template<class Scalar>
const std::vector<Scalar>&
GroupState<Scalar>::injection_reservoir_rates(const std::string& gname) const
{
auto group_iter = this->inj_resv_rates.find(gname);
if (group_iter == this->inj_resv_rates.end())
throw std::logic_error("No such group");
@ -177,14 +230,22 @@ const std::vector<double>& GroupState::injection_reservoir_rates(const std::stri
//-------------------------------------------------------------------------
void GroupState::update_injection_rein_rates(const std::string& gname, const std::vector<double>& rates) {
template<class Scalar>
void GroupState<Scalar>::
update_injection_rein_rates(const std::string& gname,
const std::vector<Scalar>& rates)
{
if (rates.size() != this->num_phases)
throw std::logic_error("Wrong number of phases");
this->inj_rein_rates[gname] = rates;
}
const std::vector<double>& GroupState::injection_rein_rates(const std::string& gname) const {
template<class Scalar>
const std::vector<Scalar>&
GroupState<Scalar>::
injection_rein_rates(const std::string& gname) const
{
auto group_iter = this->inj_rein_rates.find(gname);
if (group_iter == this->inj_rein_rates.end())
throw std::logic_error("No such group");
@ -194,11 +255,17 @@ const std::vector<double>& GroupState::injection_rein_rates(const std::string& g
//-------------------------------------------------------------------------
void GroupState::update_injection_vrep_rate(const std::string& gname, double rate) {
template<class Scalar>
void GroupState<Scalar>::
update_injection_vrep_rate(const std::string& gname, Scalar rate)
{
this->inj_vrep_rate[gname] = rate;
}
double GroupState::injection_vrep_rate(const std::string& gname) const {
template<class Scalar>
Scalar GroupState<Scalar>::
injection_vrep_rate(const std::string& gname) const
{
auto group_iter = this->inj_vrep_rate.find(gname);
if (group_iter == this->inj_vrep_rate.end())
throw std::logic_error("No such group");
@ -208,11 +275,17 @@ double GroupState::injection_vrep_rate(const std::string& gname) const {
//-------------------------------------------------------------------------
void GroupState::update_grat_sales_target(const std::string& gname, double target) {
template<class Scalar>
void GroupState<Scalar>::
update_grat_sales_target(const std::string& gname, Scalar target)
{
this->m_grat_sales_target[gname] = target;
}
double GroupState::grat_sales_target(const std::string& gname) const {
template<class Scalar>
Scalar GroupState<Scalar>::
grat_sales_target(const std::string& gname) const
{
auto group_iter = this->m_grat_sales_target.find(gname);
if (group_iter == this->m_grat_sales_target.end())
throw std::logic_error("No such group");
@ -220,13 +293,19 @@ double GroupState::grat_sales_target(const std::string& gname) const {
return group_iter->second;
}
bool GroupState::has_grat_sales_target(const std::string& gname) const {
template<class Scalar>
bool GroupState<Scalar>::
has_grat_sales_target(const std::string& gname) const
{
return (this->m_grat_sales_target.count(gname) > 0);
}
//-------------------------------------------------------------------------
bool GroupState::has_production_control(const std::string& gname) const {
template<class Scalar>
bool GroupState<Scalar>::
has_production_control(const std::string& gname) const
{
auto group_iter = this->production_controls.find(gname);
if (group_iter == this->production_controls.end())
return false;
@ -234,11 +313,18 @@ bool GroupState::has_production_control(const std::string& gname) const {
return true;
}
void GroupState::production_control(const std::string& gname, Group::ProductionCMode cmode) {
template<class Scalar>
void GroupState<Scalar>::
production_control(const std::string& gname,
Group::ProductionCMode cmode)
{
this->production_controls[gname] = cmode;
}
Group::ProductionCMode GroupState::production_control(const std::string& gname) const {
template<class Scalar>
Group::ProductionCMode
GroupState<Scalar>::production_control(const std::string& gname) const
{
auto group_iter = this->production_controls.find(gname);
if (group_iter == this->production_controls.end())
throw std::logic_error("Could not find any control for production group: " + gname);
@ -248,15 +334,26 @@ Group::ProductionCMode GroupState::production_control(const std::string& gname)
//-------------------------------------------------------------------------
bool GroupState::has_injection_control(const std::string& gname, Phase phase) const {
template<class Scalar>
bool GroupState<Scalar>::
has_injection_control(const std::string& gname, Phase phase) const
{
return this->injection_controls.count(std::make_pair(phase, gname)) > 0;
}
void GroupState::injection_control(const std::string& gname, Phase phase, Group::InjectionCMode cmode) {
template<class Scalar>
void GroupState<Scalar>::
injection_control(const std::string& gname,
Phase phase, Group::InjectionCMode cmode)
{
this->injection_controls[ std::make_pair(phase, gname) ] = cmode;
}
Group::InjectionCMode GroupState::injection_control(const std::string& gname, Phase phase) const {
template<class Scalar>
Group::InjectionCMode
GroupState<Scalar>::
injection_control(const std::string& gname, Phase phase) const
{
auto key = std::make_pair(phase, gname);
auto group_iter = this->injection_controls.find( key );
if (group_iter == this->injection_controls.end())
@ -267,7 +364,9 @@ Group::InjectionCMode GroupState::injection_control(const std::string& gname, Ph
//-------------------------------------------------------------------------
GPMaint::State& GroupState::gpmaint(const std::string& gname) {
template<class Scalar>
GPMaint::State& GroupState<Scalar>::gpmaint(const std::string& gname)
{
if (!this->gpmaint_state.has(gname))
this->gpmaint_state.add(gname, GPMaint::State{});
return this->gpmaint_state[gname];
@ -276,11 +375,16 @@ GPMaint::State& GroupState::gpmaint(const std::string& gname) {
//-------------------------------------------------------------------------
void GroupState::update_gpmaint_target(const std::string& gname, double target) {
template<class Scalar>
void GroupState<Scalar>::
update_gpmaint_target(const std::string& gname, Scalar target)
{
this->m_gpmaint_target[gname] = target;
}
double GroupState::gpmaint_target(const std::string& gname) const {
template<class Scalar>
Scalar GroupState<Scalar>::gpmaint_target(const std::string& gname) const
{
auto group_iter = this->m_gpmaint_target.find(gname);
if (group_iter == this->m_gpmaint_target.end())
throw std::logic_error("No such group");
@ -288,8 +392,13 @@ double GroupState::gpmaint_target(const std::string& gname) const {
return group_iter->second;
}
bool GroupState::has_gpmaint_target(const std::string& gname) const {
template<class Scalar>
bool GroupState<Scalar>::
has_gpmaint_target(const std::string& gname) const
{
return (this->m_gpmaint_target.count(gname) > 0);
}
template class GroupState<double>;
}

View File

@ -31,6 +31,7 @@
namespace Opm {
template<class Scalar>
class GroupState {
public:
GroupState() = default;
@ -41,38 +42,43 @@ public:
bool operator==(const GroupState& other) const;
bool has_production_rates(const std::string& gname) const;
void update_production_rates(const std::string& gname, const std::vector<double>& rates);
const std::vector<double>& production_rates(const std::string& gname) const;
void update_production_rates(const std::string& gname,
const std::vector<Scalar>& rates);
const std::vector<Scalar>& production_rates(const std::string& gname) const;
bool has_production_reduction_rates(const std::string& gname) const;
void update_production_reduction_rates(const std::string& gname, const std::vector<double>& rates);
const std::vector<double>& production_reduction_rates(const std::string& gname) const;
void update_production_reduction_rates(const std::string& gname,
const std::vector<Scalar>& rates);
const std::vector<Scalar>& production_reduction_rates(const std::string& gname) const;
bool has_injection_reduction_rates(const std::string& gname) const;
void update_injection_reduction_rates(const std::string& gname, const std::vector<double>& rates);
const std::vector<double>& injection_reduction_rates(const std::string& gname) const;
void update_injection_reduction_rates(const std::string& gname,
const std::vector<Scalar>& rates);
const std::vector<Scalar>& injection_reduction_rates(const std::string& gname) const;
bool has_injection_reservoir_rates(const std::string& gname) const;
void update_injection_reservoir_rates(const std::string& gname, const std::vector<double>& rates);
const std::vector<double>& injection_reservoir_rates(const std::string& gname) const;
void update_injection_reservoir_rates(const std::string& gname,
const std::vector<Scalar>& rates);
const std::vector<Scalar>& injection_reservoir_rates(const std::string& gname) const;
bool has_injection_surface_rates(const std::string& gname) const;
void update_injection_surface_rates(const std::string& gname, const std::vector<double>& rates);
const std::vector<double>& injection_surface_rates(const std::string& gname) const;
void update_injection_surface_rates(const std::string& gname,
const std::vector<Scalar>& rates);
const std::vector<Scalar>& injection_surface_rates(const std::string& gname) const;
void update_injection_rein_rates(const std::string& gname,
const std::vector<Scalar>& rates);
const std::vector<Scalar>& injection_rein_rates(const std::string& gname) const;
void update_injection_rein_rates(const std::string& gname, const std::vector<double>& rates);
const std::vector<double>& injection_rein_rates(const std::string& gname) const;
void update_injection_vrep_rate(const std::string& gname, Scalar rate);
Scalar injection_vrep_rate(const std::string& gname) const;
void update_injection_vrep_rate(const std::string& gname, double rate);
double injection_vrep_rate(const std::string& gname) const;
void update_grat_sales_target(const std::string& gname, double target);
double grat_sales_target(const std::string& gname) const;
void update_grat_sales_target(const std::string& gname, Scalar target);
Scalar grat_sales_target(const std::string& gname) const;
bool has_grat_sales_target(const std::string& gname) const;
void update_gpmaint_target(const std::string& gname, double target);
double gpmaint_target(const std::string& gname) const;
void update_gpmaint_target(const std::string& gname, Scalar target);
Scalar gpmaint_target(const std::string& gname) const;
bool has_gpmaint_target(const std::string& gname) const;
bool has_production_control(const std::string& gname) const;
@ -84,12 +90,11 @@ public:
Group::InjectionCMode injection_control(const std::string& gname, Phase phase) const;
std::size_t data_size() const;
std::size_t collect(double * data) const;
std::size_t distribute(const double * data);
std::size_t collect(Scalar* data) const;
std::size_t distribute(const Scalar* data);
GPMaint::State& gpmaint(const std::string& gname);
template<class Comm>
void communicate_rates(const Comm& comm)
{
@ -125,11 +130,9 @@ public:
sz += this->inj_vrep_rate.size();
// Make a vector and collect all data into it.
std::vector<double> data(sz);
std::vector<Scalar> data(sz);
std::size_t pos = 0;
// That the collect function mutates the vector v is an artifact for
// testing.
auto collect = [&data, &pos](auto& v) {
@ -183,17 +186,16 @@ public:
private:
std::size_t num_phases{};
std::map<std::string, std::vector<double>> m_production_rates;
std::map<std::string, std::vector<Scalar>> m_production_rates;
std::map<std::string, Group::ProductionCMode> production_controls;
std::map<std::string, std::vector<double>> prod_red_rates;
std::map<std::string, std::vector<double>> inj_red_rates;
std::map<std::string, std::vector<double>> inj_surface_rates;
std::map<std::string, std::vector<double>> inj_resv_rates;
std::map<std::string, std::vector<double>> inj_rein_rates;
std::map<std::string, double> inj_vrep_rate;
std::map<std::string, double> m_grat_sales_target;
std::map<std::string, double> m_gpmaint_target;
std::map<std::string, std::vector<Scalar>> prod_red_rates;
std::map<std::string, std::vector<Scalar>> inj_red_rates;
std::map<std::string, std::vector<Scalar>> inj_surface_rates;
std::map<std::string, std::vector<Scalar>> inj_resv_rates;
std::map<std::string, std::vector<Scalar>> inj_rein_rates;
std::map<std::string, Scalar> inj_vrep_rate;
std::map<std::string, Scalar> m_grat_sales_target;
std::map<std::string, Scalar> m_gpmaint_target;
std::map<std::pair<Phase, std::string>, Group::InjectionCMode> injection_controls;
WellContainer<GPMaint::State> gpmaint_state;

View File

@ -78,32 +78,32 @@ namespace Opm
const int index_of_well,
const std::vector<PerforationData>& perf_data);
virtual void init(const PhaseUsage* phase_usage_arg,
const std::vector<double>& depth_arg,
const double gravity_arg,
const int num_cells,
const std::vector< Scalar >& B_avg,
const bool changed_to_open_this_step) override;
void init(const PhaseUsage* phase_usage_arg,
const std::vector<double>& depth_arg,
const double gravity_arg,
const int num_cells,
const std::vector<Scalar>& B_avg,
const bool changed_to_open_this_step) override;
void initPrimaryVariablesEvaluation() override;
/// updating the well state based the current control mode
virtual void updateWellStateWithTarget(const Simulator& simulator,
const GroupState& group_state,
WellState<Scalar>& well_state,
DeferredLogger& deferred_logger) const override;
void updateWellStateWithTarget(const Simulator& simulator,
const GroupState<Scalar>& group_state,
WellState<Scalar>& well_state,
DeferredLogger& deferred_logger) const override;
/// check whether the well equations get converged for this well
virtual ConvergenceReport getWellConvergence(const SummaryState& summary_state,
const WellState<Scalar>& well_state,
const std::vector<double>& B_avg,
DeferredLogger& deferred_logger,
const bool relax_tolerance) const override;
ConvergenceReport getWellConvergence(const SummaryState& summary_state,
const WellState<Scalar>& well_state,
const std::vector<double>& B_avg,
DeferredLogger& deferred_logger,
const bool relax_tolerance) const override;
/// Ax = Ax - C D^-1 B x
virtual void apply(const BVector& x, BVector& Ax) const override;
void apply(const BVector& x, BVector& Ax) const override;
/// r = r - C D^-1 Rw
virtual void apply(BVector& r) const override;
void apply(BVector& r) const override;
/// using the solution x to recover the solution xw for wells and applying
/// xw to update Well State
@ -259,7 +259,7 @@ namespace Opm
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger) override;
virtual bool iterateWellEqWithSwitching(const Simulator& simulator,
@ -267,7 +267,7 @@ namespace Opm
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger,
const bool fixed_control = false,
const bool fixed_status = false) override;
@ -277,7 +277,7 @@ namespace Opm
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger) override;
virtual void updateWaterThroughput(const double dt, WellState<Scalar>& well_state) const override;

View File

@ -84,7 +84,7 @@ private:
template<class FluidSystem, class Indices>
void MultisegmentWellAssemble<FluidSystem,Indices>::
assembleControlEq(const WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const Well::InjectionControls& inj_controls,

View File

@ -30,7 +30,7 @@ namespace Opm
{
class DeferredLogger;
class GroupState;
template<class Scalar> class GroupState;
template<class Scalar, int numWellEq, int numEq> class MultisegmentWellEquations;
template<class FluidSystem, class Indices> class MultisegmentWellPrimaryVariables;
class Schedule;
@ -71,7 +71,7 @@ public:
//! \brief Assemble control equation.
void assembleControlEq(const WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const Well::InjectionControls& inj_controls,

View File

@ -38,7 +38,6 @@ namespace Opm
{
class ConvergenceReport;
class GroupState;
class Schedule;
class WellContributions;
class SummaryState;

View File

@ -172,7 +172,7 @@ namespace Opm
void
MultisegmentWell<TypeTag>::
updateWellStateWithTarget(const Simulator& simulator,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
WellState<Scalar>& well_state,
DeferredLogger& deferred_logger) const
{
@ -1435,7 +1435,7 @@ namespace Opm
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger)
{
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return true;
@ -1587,7 +1587,7 @@ namespace Opm
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger,
const bool fixed_control /*false*/,
const bool fixed_status /*false*/)
@ -1778,7 +1778,7 @@ namespace Opm
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger)
{
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;

View File

@ -200,7 +200,7 @@ namespace Opm
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger) override;
// iterate well equations including control switching
@ -209,7 +209,7 @@ namespace Opm
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger,
const bool fixed_control = false,
const bool fixed_status = false) override;
@ -355,7 +355,7 @@ namespace Opm
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger) override;
void assembleWellEqWithoutIterationImpl(const Simulator& simulator,
@ -363,7 +363,7 @@ namespace Opm
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger);
void calculateSinglePerf(const Simulator& simulator,

View File

@ -85,7 +85,7 @@ template<class FluidSystem, class Indices>
void
StandardWellAssemble<FluidSystem,Indices>::
assembleControlEq(const WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const Well::InjectionControls& inj_controls,

View File

@ -29,7 +29,7 @@ namespace Opm
{
class DeferredLogger;
class GroupState;
template<class Scalar> class GroupState;
class Schedule;
template<class Scalar, int numEq> class StandardWellEquations;
template<class FluidSystem, class Indices> class StandardWellPrimaryVariables;
@ -53,7 +53,7 @@ public:
//! \brief Assemble control equation.
void assembleControlEq(const WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const Well::InjectionControls& inj_controls,

View File

@ -36,7 +36,6 @@ namespace Opm
class ConvergenceReport;
class DeferredLogger;
class GroupState;
class Schedule;
class SummaryState;
class WellContributions;

View File

@ -333,7 +333,7 @@ namespace Opm
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger)
{
// TODO: only_wells should be put back to save some computation
@ -359,7 +359,7 @@ namespace Opm
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger)
{
// try to regularize equation if the well does not converge
@ -2283,7 +2283,7 @@ namespace Opm
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger)
{
const int max_iter = this->param_.max_inner_iter_wells_;
@ -2330,7 +2330,7 @@ namespace Opm
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger,
const bool fixed_control /*false*/,
const bool fixed_status /*false*/)

View File

@ -42,7 +42,7 @@ TargetCalculator::TargetCalculator(const Group::ProductionCMode cmode,
const std::vector<double>& resv_coeff,
const double group_grat_target_from_sales,
const std::string& group_name,
const GroupState& group_state,
const GroupState<double>& group_state,
const bool use_gpmaint)
: cmode_(cmode)
, pu_(pu)
@ -157,7 +157,7 @@ InjectionTargetCalculator::InjectionTargetCalculator(const Group::InjectionCMode
const std::vector<double>& resv_coeff,
const std::string& group_name,
const double sales_target,
const GroupState& group_state,
const GroupState<double>& group_state,
const Phase& injection_phase,
const bool use_gpmaint,
DeferredLogger& deferred_logger)

View File

@ -32,7 +32,7 @@ namespace Opm
{
class DeferredLogger;
class GroupState;
template<class Scalar> class GroupState;
struct PhaseUsage;
namespace WellGroupHelpers
@ -48,7 +48,7 @@ namespace WellGroupHelpers
const std::vector<double>& resv_coeff,
const double group_grat_target_from_sales,
const std::string& group_name,
const GroupState& group_state,
const GroupState<double>& group_state,
const bool use_gpmaint);
template <typename RateType>
@ -70,7 +70,7 @@ namespace WellGroupHelpers
const std::vector<double>& resv_coeff_;
const double group_grat_target_from_sales_;
const std::string& group_name_;
const GroupState& group_state_;
const GroupState<double>& group_state_;
bool use_gpmaint_;
};
@ -84,7 +84,7 @@ namespace WellGroupHelpers
const std::vector<double>& resv_coeff,
const std::string& group_name,
const double sales_target,
const GroupState& group_state,
const GroupState<double>& group_state,
const Phase& injection_phase,
const bool use_gpmaint,
DeferredLogger& deferred_logger);
@ -105,7 +105,7 @@ namespace WellGroupHelpers
const std::vector<double>& resv_coeff_;
const std::string& group_name_;
double sales_target_;
const GroupState& group_state_;
const GroupState<double>& group_state_;
bool use_gpmaint_;
int pos_;
GuideRateModel::Target target_;

View File

@ -36,7 +36,7 @@ WGState WGState::serializationTestObject(const ParallelWellInfo& pinfo)
{
WGState result(PhaseUsage{});
result.well_state = WellState<double>::serializationTestObject(pinfo);
result.group_state = GroupState::serializationTestObject();
result.group_state = GroupState<double>::serializationTestObject();
result.well_test_state = WellTestState::serializationTestObject();
return result;

View File

@ -42,7 +42,7 @@ struct WGState {
void wtest_state(WellTestState wtest_state);
WellState<double> well_state;
GroupState group_state;
GroupState<double> group_state;
WellTestState well_test_state;
bool operator==(const WGState&) const;

View File

@ -54,7 +54,7 @@ template<class EvalWell>
void
WellAssemble<FluidSystem>::
assembleControlEqProd(const WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const Well::ProductionControls& controls,
@ -190,7 +190,7 @@ template<class EvalWell>
void
WellAssemble<FluidSystem>::
assembleControlEqInj(const WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const Well::InjectionControls& controls,
@ -278,7 +278,7 @@ assembleControlEqInj(const WellState<Scalar>& well_state,
#define INSTANCE_METHODS(A,...) \
template void WellAssemble<A>:: \
assembleControlEqProd<__VA_ARGS__>(const WellState<typename A::Scalar>&, \
const GroupState&, \
const GroupState<typename A::Scalar>&, \
const Schedule&, \
const SummaryState&, \
const Well::ProductionControls&, \
@ -289,7 +289,7 @@ assembleControlEqProd<__VA_ARGS__>(const WellState<typename A::Scalar>&, \
DeferredLogger&) const; \
template void WellAssemble<A>:: \
assembleControlEqInj<__VA_ARGS__>(const WellState<typename A::Scalar>&, \
const GroupState&, \
const GroupState<typename A::Scalar>&, \
const Schedule&, \
const SummaryState&, \
const Well::InjectionControls&, \

View File

@ -36,7 +36,7 @@ namespace Opm
class DeferredLogger;
class Group;
class GroupState;
template<class Scalar> class GroupState;
class Schedule;
class SummaryState;
template<class FluidSystem> class WellInterfaceFluidSystem;
@ -56,7 +56,7 @@ public:
template<class EvalWell>
void assembleControlEqProd(const WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const WellProductionControls& controls,
@ -68,7 +68,7 @@ public:
template<class EvalWell>
void assembleControlEqInj(const WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const WellInjectionControls& controls,

View File

@ -37,7 +37,7 @@ std::pair<bool, double>
WellGroupConstraints::
checkGroupConstraintsInj(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const double efficiencyFactor,
const Schedule& schedule,
const SummaryState& summaryState,
@ -95,7 +95,7 @@ std::pair<bool, double>
WellGroupConstraints::
checkGroupConstraintsProd(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const double efficiencyFactor,
const Schedule& schedule,
const SummaryState& summaryState,
@ -125,7 +125,7 @@ checkGroupConstraintsProd(const Group& group,
bool WellGroupConstraints::
checkGroupConstraints(WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const RateConvFunc& rateConverter,

View File

@ -35,7 +35,7 @@ namespace Opm
class DeferredLogger;
class Group;
class GroupState;
template<class Scalar> class GroupState;
enum class InjectorType;
using RegionId = int;
class Schedule;
@ -52,7 +52,7 @@ public:
using RateConvFunc = std::function<void(const RegionId, const int, const std::optional<std::string>&, std::vector<double>&)>;
bool checkGroupConstraints(WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const RateConvFunc& rateConverter,
@ -62,7 +62,7 @@ private:
std::pair<bool, double>
checkGroupConstraintsInj(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const double efficiencyFactor,
const Schedule& schedule,
const SummaryState& summaryState,
@ -72,7 +72,7 @@ private:
std::pair<bool, double>
checkGroupConstraintsProd(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const double efficiencyFactor,
const Schedule& schedule,
const SummaryState& summaryState,

View File

@ -48,7 +48,7 @@ template<class EvalWell>
void WellGroupControls::
getGroupInjectionControl(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const InjectorType& injectorType,
@ -188,7 +188,7 @@ std::optional<double>
WellGroupControls::
getGroupInjectionTargetRate(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const InjectorType& injectorType,
@ -303,7 +303,7 @@ getGroupInjectionTargetRate(const Group& group,
template<class EvalWell>
void WellGroupControls::getGroupProductionControl(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const EvalWell& bhp,
@ -410,7 +410,7 @@ void WellGroupControls::getGroupProductionControl(const Group& group,
double WellGroupControls::
getGroupProductionTargetRate(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const RateConvFunc& rateConverter,
@ -506,7 +506,7 @@ getGroupProductionTargetRate(const Group& group,
template void WellGroupControls:: \
getGroupInjectionControl<__VA_ARGS__>(const Group&, \
const WellState<double>&, \
const GroupState&, \
const GroupState<double>&, \
const Schedule&, \
const SummaryState&, \
const InjectorType&, \
@ -519,7 +519,7 @@ getGroupInjectionControl<__VA_ARGS__>(const Group&, \
template void WellGroupControls:: \
getGroupProductionControl<__VA_ARGS__>(const Group&, \
const WellState<double>&, \
const GroupState&, \
const GroupState<double>&, \
const Schedule&, \
const SummaryState&, \
const __VA_ARGS__& bhp, \

View File

@ -34,7 +34,7 @@ namespace Opm
class DeferredLogger;
class Group;
class GroupState;
template<class Scalar> class GroupState;
enum class InjectorType;
using RegionId = int;
class Schedule;
@ -53,7 +53,7 @@ public:
template<class EvalWell>
void getGroupInjectionControl(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const InjectorType& injectorType,
@ -67,7 +67,7 @@ public:
std::optional<double>
getGroupInjectionTargetRate(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const InjectorType& injectorType,
@ -78,7 +78,7 @@ public:
template<class EvalWell>
void getGroupProductionControl(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const EvalWell& bhp,
@ -90,7 +90,7 @@ public:
double getGroupProductionTargetRate(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const RateConvFunc& rateConverter,

View File

@ -136,7 +136,7 @@ namespace WellGroupHelpers
const Schedule& schedule,
const SummaryState& summaryState,
const int reportStepIdx,
GroupState& group_state)
GroupState<double>& group_state)
{
for (const std::string& groupName : group.groups()) {
@ -270,7 +270,7 @@ namespace WellGroupHelpers
const Opm::PhaseUsage& pu,
const int reportStepIdx,
const WellState<double>& wellState,
const GroupState& group_state,
const GroupState<double>& group_state,
GuideRate* guideRate,
Opm::DeferredLogger& deferred_logger)
{
@ -331,7 +331,7 @@ namespace WellGroupHelpers
const PhaseUsage& pu,
const GuideRate& guide_rate,
const WellState<double>& wellState,
GroupState& group_state,
GroupState<double>& group_state,
std::vector<double>& groupTargetReduction)
{
const int np = wellState.numPhases();
@ -467,7 +467,7 @@ namespace WellGroupHelpers
const Schedule& schedule,
const int reportStepIdx,
bool isInjector,
const GroupState& group_state,
const GroupState<double>& group_state,
WellState<double>& wellState) {
for (const std::string& groupName : group.groups()) {
bool individual_control = false;
@ -535,7 +535,7 @@ namespace WellGroupHelpers
const Schedule& schedule,
const int reportStepIdx,
const WellState<double>& wellState,
GroupState& group_state)
GroupState<double>& group_state)
{
for (const std::string& groupName : group.groups()) {
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
@ -559,7 +559,7 @@ namespace WellGroupHelpers
const Schedule& schedule,
const int reportStepIdx,
const WellState<double>& wellState,
GroupState& group_state)
GroupState<double>& group_state)
{
for (const std::string& groupName : group.groups()) {
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
@ -583,7 +583,7 @@ namespace WellGroupHelpers
const Schedule& schedule,
const int reportStepIdx,
const WellState<double>& wellState,
GroupState& group_state)
GroupState<double>& group_state)
{
for (const std::string& groupName : group.groups()) {
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
@ -637,7 +637,7 @@ namespace WellGroupHelpers
const Schedule& schedule,
const int reportStepIdx,
const WellState<double>& wellState,
GroupState& group_state)
GroupState<double>& group_state)
{
for (const std::string& groupName : group.groups()) {
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
@ -658,7 +658,7 @@ namespace WellGroupHelpers
const PhaseUsage& pu,
const SummaryState& st,
const WellState<double>& wellState,
GroupState& group_state,
GroupState<double>& group_state,
bool sum_rank)
{
const int np = wellState.numPhases();
@ -694,7 +694,7 @@ namespace WellGroupHelpers
const int reportStepIdx,
const double dt,
const WellState<double>& well_state,
GroupState& group_state)
GroupState<double>& group_state)
{
for (const std::string& groupName : group.groups()) {
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
@ -780,7 +780,7 @@ namespace WellGroupHelpers
std::map<std::string, double>
computeNetworkPressures(const Opm::Network::ExtNetwork& network,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const VFPProdProperties& vfp_prod_props,
const Schedule& schedule,
const int report_time_step)
@ -925,7 +925,9 @@ namespace WellGroupHelpers
}
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);
}
@ -933,7 +935,7 @@ namespace WellGroupHelpers
double getGuideRate(const std::string& name,
const Schedule& schedule,
const WellState<double>& wellState,
const GroupState& group_state,
const GroupState<double>& group_state,
const int reportStepIdx,
const GuideRate* guideRate,
const GuideRateModel::Target target,
@ -987,7 +989,7 @@ namespace WellGroupHelpers
double getGuideRateInj(const std::string& name,
const Schedule& schedule,
const WellState<double>& wellState,
const GroupState& group_state,
const GroupState<double>& group_state,
const int reportStepIdx,
const GuideRate* guideRate,
const GuideRateModel::Target target,
@ -1038,7 +1040,7 @@ namespace WellGroupHelpers
int groupControlledWells(const Schedule& schedule,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const int report_step,
const std::string& group_name,
const std::string& always_included_child,
@ -1110,7 +1112,7 @@ namespace WellGroupHelpers
const std::string& parent,
const Group& group,
const WellState<double>& wellState,
const GroupState& group_state,
const GroupState<double>& group_state,
const int reportStepIdx,
const GuideRate* guideRate,
const double* rates,
@ -1256,7 +1258,7 @@ namespace WellGroupHelpers
const std::string& parent,
const Group& group,
const WellState<double>& wellState,
const GroupState& group_state,
const GroupState<double>& group_state,
const int reportStepIdx,
const GuideRate* guideRate,
const double* rates,
@ -1534,7 +1536,7 @@ namespace WellGroupHelpers
const int report_step,
const double sim_time,
WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Parallel::Communication& comm,
GuideRate* guide_rate,
std::vector<double>& pot,
@ -1552,7 +1554,7 @@ namespace WellGroupHelpers
const int reportStepIdx,
const double& simTime,
WellState<double>& wellState,
const GroupState& group_state,
const GroupState<double>& group_state,
const Parallel::Communication& comm,
GuideRate* guideRate,
std::vector<double>& pot)
@ -1668,7 +1670,7 @@ namespace WellGroupHelpers
int,
double,
const WellState<double>&,
GroupState&);
GroupState<double>&);
template void WellGroupHelpers::setRegionAveragePressureCalculator<AvgP>(const Group&,
const Schedule&,
const int,

View File

@ -34,7 +34,7 @@ namespace Opm
class DeferredLogger;
class Group;
class GroupState;
template<class Scalar> class GroupState;
namespace Network { class ExtNetwork; }
struct PhaseUsage;
class Schedule;
@ -53,7 +53,7 @@ namespace WellGroupHelpers
const Schedule& schedule,
const SummaryState& summaryState,
const int reportStepIdx,
GroupState& group_state);
GroupState<double>& group_state);
void accumulateGroupEfficiencyFactor(const Group& group,
const Schedule& schedule,
@ -87,7 +87,7 @@ namespace WellGroupHelpers
const PhaseUsage& pu,
const GuideRate& guide_rate,
const WellState<double>& wellState,
GroupState& group_state,
GroupState<double>& group_state,
std::vector<double>& groupTargetReduction);
void updateGuideRates(const Group& group,
@ -97,7 +97,7 @@ namespace WellGroupHelpers
int report_step,
double sim_time,
WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Parallel::Communication& comm,
GuideRate* guide_rate,
std::vector<double>& pot,
@ -109,7 +109,7 @@ namespace WellGroupHelpers
const int reportStepIdx,
const double& simTime,
WellState<double>& wellState,
const GroupState& group_state,
const GroupState<double>& group_state,
const Parallel::Communication& comm,
GuideRate* guideRate,
std::vector<double>& pot);
@ -128,7 +128,7 @@ namespace WellGroupHelpers
const Opm::PhaseUsage& pu,
const int reportStepIdx,
const WellState<double>& wellState,
const GroupState& group_state,
const GroupState<double>& group_state,
GuideRate* guideRate,
Opm::DeferredLogger& deferred_logger);
@ -136,19 +136,19 @@ namespace WellGroupHelpers
const Schedule& schedule,
const int reportStepIdx,
const WellState<double>& wellState,
GroupState& group_state);
GroupState<double>& group_state);
void updateReservoirRatesInjectionGroups(const Group& group,
const Schedule& schedule,
const int reportStepIdx,
const WellState<double>& wellState,
GroupState& group_state);
GroupState<double>& group_state);
void updateSurfaceRatesInjectionGroups(const Group& group,
const Schedule& schedule,
const int reportStepIdx,
const WellState<double>& wellState,
GroupState& group_state);
GroupState<double>& group_state);
void updateWellRates(const Group& group,
const Schedule& schedule,
@ -160,14 +160,14 @@ namespace WellGroupHelpers
const Schedule& schedule,
const int reportStepIdx,
const WellState<double>& wellState,
GroupState& group_state);
GroupState<double>& group_state);
void updateWellRatesFromGroupTargetScale(const double scale,
const Group& group,
const Schedule& schedule,
const int reportStepIdx,
bool isInjector,
const GroupState& group_state,
const GroupState<double>& group_state,
WellState<double>& wellState);
void updateREINForGroups(const Group& group,
@ -176,7 +176,7 @@ namespace WellGroupHelpers
const PhaseUsage& pu,
const SummaryState& st,
const WellState<double>& wellState,
GroupState& group_state,
GroupState<double>& group_state,
bool sum_rank);
@ -199,26 +199,30 @@ namespace WellGroupHelpers
const int reportStepIdx,
const double dt,
const WellState<double>& well_state,
GroupState& group_state);
GroupState<double>& group_state);
std::map<std::string, double>
computeNetworkPressures(const Opm::Network::ExtNetwork& network,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const VFPProdProperties& vfp_prod_props,
const Schedule& schedule,
const int report_time_step);
GuideRate::RateVector
getWellRateVector(const WellState<double>& well_state, const PhaseUsage& pu, const std::string& name);
getWellRateVector(const WellState<double>& well_state,
const PhaseUsage& pu,
const std::string& name);
GuideRate::RateVector
getProductionGroupRateVector(const GroupState& group_state, const PhaseUsage& pu, const std::string& group_name);
getProductionGroupRateVector(const GroupState<double>& group_state,
const PhaseUsage& pu,
const std::string& group_name);
double getGuideRate(const std::string& name,
const Schedule& schedule,
const WellState<double>& wellState,
const GroupState& group_state,
const GroupState<double>& group_state,
const int reportStepIdx,
const GuideRate* guideRate,
const GuideRateModel::Target target,
@ -228,7 +232,7 @@ namespace WellGroupHelpers
double getGuideRateInj(const std::string& name,
const Schedule& schedule,
const WellState<double>& wellState,
const GroupState& group_state,
const GroupState<double>& group_state,
const int reportStepIdx,
const GuideRate* guideRate,
const GuideRateModel::Target target,
@ -237,7 +241,7 @@ namespace WellGroupHelpers
int groupControlledWells(const Schedule& schedule,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const int report_step,
const std::string& group_name,
const std::string& always_included_child,
@ -249,7 +253,7 @@ namespace WellGroupHelpers
const std::string& parent,
const Group& group,
const WellState<double>& wellState,
const GroupState& group_state,
const GroupState<double>& group_state,
const int reportStepIdx,
const GuideRate* guideRate,
const double* rates,
@ -278,7 +282,7 @@ namespace WellGroupHelpers
const std::string& parent,
const Group& group,
const WellState<double>& wellState,
const GroupState& group_state,
const GroupState<double>& group_state,
const int reportStepIdx,
const GuideRate* guideRate,
const double* rates,

View File

@ -170,20 +170,20 @@ public:
void assembleWellEq(const Simulator& simulator,
const double dt,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger);
void assembleWellEqWithoutIteration(const Simulator& simulator,
const double dt,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger);
// TODO: better name or further refactoring the function to make it more clear
void prepareWellBeforeAssembling(const Simulator& simulator,
const double dt,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger);
@ -221,7 +221,7 @@ public:
DeferredLogger& deferred_logger) = 0;
virtual void updateWellStateWithTarget(const Simulator& simulator,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
WellState<Scalar>& well_state,
DeferredLogger& deferred_logger) const;
@ -238,12 +238,12 @@ public:
bool updateWellControl(const Simulator& simulator,
const IndividualOrGroup iog,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger) /* const */;
bool updateWellControlAndStatusLocalIteration(const Simulator& simulator,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
const double WQTotal,
@ -291,7 +291,7 @@ public:
void wellTesting(const Simulator& simulator,
const double simulation_time,
/* const */ WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
WellTestState& welltest_state,
DeferredLogger& deferred_logger);
@ -303,7 +303,7 @@ public:
const Simulator& simulator,
const double dt,
WellState<Scalar>& well_state,
const GroupState &group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger);
void gliftBeginTimeStepWellTestUpdateALQ(const Simulator& simulator,
@ -338,7 +338,7 @@ public:
void solveWellEquation(const Simulator& simulator,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger);
const std::vector<RateVector>& connectionRates() const
@ -414,7 +414,7 @@ protected:
const WellInjectionControls& inj_controls,
const WellProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger) = 0;
// iterate well equations with the specified control until converged
@ -423,7 +423,7 @@ protected:
const WellInjectionControls& inj_controls,
const WellProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger) = 0;
virtual bool iterateWellEqWithSwitching(const Simulator& simulator,
@ -431,7 +431,7 @@ protected:
const WellInjectionControls& inj_controls,
const WellProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger,
const bool fixed_control = false,
const bool fixed_status = false) = 0;
@ -443,7 +443,7 @@ protected:
bool iterateWellEquations(const Simulator& simulator,
const double dt,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger);
bool solveWellWithTHPConstraint(const Simulator& simulator,
@ -451,7 +451,7 @@ protected:
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger);
std::optional<double> estimateOperableBhp(const Simulator& simulator,
@ -473,7 +473,7 @@ protected:
bool solveWellForTesting(const Simulator& simulator,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger);
Eval getPerfCellPressure(const FluidState& fs) const;

View File

@ -178,7 +178,7 @@ template <typename FluidSystem>
bool
WellInterfaceFluidSystem<FluidSystem>::
checkGroupConstraints(WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
DeferredLogger& deferred_logger) const
@ -205,7 +205,7 @@ template <typename FluidSystem>
bool
WellInterfaceFluidSystem<FluidSystem>::
checkConstraints(WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
DeferredLogger& deferred_logger) const
@ -240,7 +240,7 @@ std::optional<double>
WellInterfaceFluidSystem<FluidSystem>::
getGroupInjectionTargetRate(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const InjectorType& injectorType,
@ -268,7 +268,7 @@ double
WellInterfaceFluidSystem<FluidSystem>::
getGroupProductionTargetRate(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
double efficiencyFactor,

View File

@ -37,7 +37,7 @@ namespace RateConverter
}
class Group;
class GroupState;
template<class Scalar> class GroupState;
class Schedule;
struct RatioLimitCheckReport;
template<class Scalar> class SingleWellState;
@ -84,13 +84,13 @@ protected:
const std::optional<Well::ProductionControls>& prod_controls = std::nullopt) const;
bool checkGroupConstraints(WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
DeferredLogger& deferred_logger) const;
bool checkConstraints(WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
DeferredLogger& deferred_logger) const;
@ -98,7 +98,7 @@ protected:
std::optional<double>
getGroupInjectionTargetRate(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
const InjectorType& injectorType,
@ -108,7 +108,7 @@ protected:
double
getGroupProductionTargetRate(const Group& group,
const WellState<double>& well_state,
const GroupState& group_state,
const GroupState<double>& group_state,
const Schedule& schedule,
const SummaryState& summaryState,
double efficiencyFactor,

View File

@ -44,7 +44,6 @@ class VFPProperties;
class WellTestState;
template<class Scalar> class WellState;
template<class Scalar> class SingleWellState;
class GroupState;
class Group;
class Schedule;

View File

@ -187,7 +187,7 @@ namespace Opm
updateWellControl(const Simulator& simulator,
const IndividualOrGroup iog,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger) /* const */
{
const auto& summary_state = simulator.vanguard().summaryState();
@ -263,7 +263,7 @@ namespace Opm
WellInterface<TypeTag>::
updateWellControlAndStatusLocalIteration(const Simulator& simulator,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
const double wqTotal,
@ -348,7 +348,7 @@ namespace Opm
wellTesting(const Simulator& simulator,
const double simulation_time,
/* const */ WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
WellTestState& well_test_state,
DeferredLogger& deferred_logger)
{
@ -446,7 +446,7 @@ namespace Opm
iterateWellEquations(const Simulator& simulator,
const double dt,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger)
{
const auto& summary_state = simulator.vanguard().summaryState();
@ -481,7 +481,7 @@ namespace Opm
const Well::InjectionControls& inj_controls,
const Well::ProductionControls& prod_controls,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger)
{
const auto& summary_state = simulator.vanguard().summaryState();
@ -595,8 +595,8 @@ namespace Opm
WellState<Scalar>& well_state,
DeferredLogger& deferred_logger)
{
// Solve a well using single bhp-constraint (but close if not operable under this)
auto group_state = GroupState(); // empty group
// Solve a well using single bhp-constraint (but close if not operable under this)
auto group_state = GroupState<Scalar>(); // empty group
auto inj_controls = Well::InjectionControls(0);
auto prod_controls = Well::ProductionControls(0);
auto& ws = well_state.well(this->index_of_well_);
@ -634,7 +634,7 @@ namespace Opm
const auto well_status_orig = this->wellStatus_;
this->stopWell();
auto group_state = GroupState(); // empty group
auto group_state = GroupState<Scalar>(); // empty group
auto inj_controls = Well::InjectionControls(0);
auto prod_controls = Well::ProductionControls(0);
const bool converged = this->iterateWellEqWithSwitching(simulator, dt, inj_controls, prod_controls, well_state, group_state, deferred_logger, /*fixed_control*/true, /*fixed_status*/ true);
@ -647,7 +647,7 @@ namespace Opm
WellInterface<TypeTag>::
solveWellForTesting(const Simulator& simulator,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger)
{
// keep a copy of the original well state
@ -682,7 +682,7 @@ namespace Opm
WellInterface<TypeTag>::
solveWellEquation(const Simulator& simulator,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger)
{
if (!this->isOperableAndSolvable() && !this->wellIsStopped())
@ -740,7 +740,7 @@ namespace Opm
assembleWellEq(const Simulator& simulator,
const double dt,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger)
{
@ -757,7 +757,7 @@ namespace Opm
assembleWellEqWithoutIteration(const Simulator& simulator,
const double dt,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger)
{
const auto& summary_state = simulator.vanguard().summaryState();
@ -776,7 +776,7 @@ namespace Opm
prepareWellBeforeAssembling(const Simulator& simulator,
const double dt,
WellState<Scalar>& well_state,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger)
{
const bool old_well_operable = this->operability_status_.isOperableAndSolvable();
@ -893,7 +893,7 @@ namespace Opm
const Simulator& simulator,
const double dt,
WellState<Scalar>& well_state,
const GroupState &group_state,
const GroupState<Scalar>& group_state,
DeferredLogger& deferred_logger)
{
const auto& well_name = this->name();
@ -1023,7 +1023,7 @@ namespace Opm
void
WellInterface<TypeTag>::
updateWellStateWithTarget(const Simulator& simulator,
const GroupState& group_state,
const GroupState<Scalar>& group_state,
WellState<Scalar>& well_state,
DeferredLogger& deferred_logger) const
{

View File

@ -39,9 +39,10 @@ public:
BOOST_AUTO_TEST_CASE(GroupStateCreate) {
BOOST_AUTO_TEST_CASE(GroupStateCreate)
{
std::size_t num_phases{3};
GroupState gs(num_phases);
GroupState<double> gs(num_phases);
BOOST_CHECK(!gs.has_production_rates("AGROUP"));
BOOST_CHECK_THROW( gs.update_production_rates("AGROUP", {0}), std::exception);

View File

@ -103,7 +103,8 @@ BOOST_AUTO_TEST_CASE(NAME) \
namespace Opm { using ALQS = ALQState<double>; }
TEST_FOR_TYPE_NAMED(ALQS, ALQState)
TEST_FOR_TYPE(GroupState)
namespace Opm { using GroupS = GroupState<double>; }
TEST_FOR_TYPE_NAMED(GroupS, GroupState)
TEST_FOR_TYPE(HardcodedTimeStepControl)
TEST_FOR_TYPE(Inplace)
namespace Opm { using PerfD = PerfData<double>; }