diff --git a/opm/simulators/wells/GroupEconomicLimitsChecker.cpp b/opm/simulators/wells/GroupEconomicLimitsChecker.cpp index 4f99104ee..f929e4633 100644 --- a/opm/simulators/wells/GroupEconomicLimitsChecker.cpp +++ b/opm/simulators/wells/GroupEconomicLimitsChecker.cpp @@ -40,7 +40,8 @@ namespace Opm { -std::string simTimeToString(const std::time_t start_time, const double sim_time) { +std::string simTimeToString(const std::time_t start_time, const double sim_time) +{ const auto start_timep = std::chrono::system_clock::from_time_t(start_time); const auto sim_duration = std::chrono::duration_cast( std::chrono::duration(sim_time) @@ -52,26 +53,24 @@ std::string simTimeToString(const std::time_t start_time, const double sim_time) } GroupEconomicLimitsChecker:: -GroupEconomicLimitsChecker( - const BlackoilWellModelGeneric &well_model, - WellTestState &well_test_state, - const Group &group, - const double simulation_time, - const int report_step_idx, - DeferredLogger &deferred_logger -) : - well_model_{well_model} - , group_{group} - , simulation_time_{simulation_time} - , report_step_idx_{report_step_idx} - , deferred_logger_{deferred_logger} - , date_string_{simTimeToString(well_model.schedule().getStartTime(),simulation_time)} - , unit_system_{well_model.eclipseState().getUnits()} - , well_state_{well_model.wellState()} - , well_test_state_{well_test_state} - , schedule_{well_model.schedule()} - , gecon_props_{schedule_[report_step_idx_].gecon().get_group_prop( - schedule_, well_model_.summaryState(), group_.name())} +GroupEconomicLimitsChecker(const BlackoilWellModelGeneric& well_model, + WellTestState& well_test_state, + const Group& group, + const double simulation_time, + const int report_step_idx, + DeferredLogger& deferred_logger) + : well_model_{well_model} + , group_{group} + , simulation_time_{simulation_time} + , report_step_idx_{report_step_idx} + , deferred_logger_{deferred_logger} + , date_string_{simTimeToString(well_model.schedule().getStartTime(),simulation_time)} + , unit_system_{well_model.eclipseState().getUnits()} + , well_state_{well_model.wellState()} + , well_test_state_{well_test_state} + , schedule_{well_model.schedule()} + , gecon_props_{schedule_[report_step_idx_].gecon().get_group_prop( + schedule_, well_model_.summaryState(), group_.name())} { for (std::size_t i = 0; i < this->phase_idx_map_.size(); i++) { auto phase_idx = this->phase_idx_map_[i]; @@ -397,4 +396,5 @@ throwNotImplementedError(const std::string &error) const const std::string msg = fmt::format("Group: {} : GECON : {} not implemented", this->group_.name(), error); OPM_DEFLOG_THROW(std::runtime_error, msg, this->deferred_logger_); } + } // namespace Opm diff --git a/opm/simulators/wells/GroupEconomicLimitsChecker.hpp b/opm/simulators/wells/GroupEconomicLimitsChecker.hpp index 038b5b2d9..b3674d7b8 100644 --- a/opm/simulators/wells/GroupEconomicLimitsChecker.hpp +++ b/opm/simulators/wells/GroupEconomicLimitsChecker.hpp @@ -37,56 +37,62 @@ class Group; template class WellState; class WellTestState; - class GroupEconomicLimitsChecker - { - public: - GroupEconomicLimitsChecker( - const BlackoilWellModelGeneric &well_model, - WellTestState &well_test_state, - const Group &group, - const double simulation_time, - const int report_step_idx, - DeferredLogger &deferred_logger - ); - void closeWells(); - bool minGasRate(); - bool minOilRate(); - bool waterCut(); - bool GOR(); - bool WGR(); - void doWorkOver(); - bool endRun(); - int numProducersOpenInitially(); - int numProducersOpen(); - void activateEndRun(); - std::string message_separator(const char sep_char='*', const size_t sep_length=110) const { return std::string(sep_length, sep_char); } +class GroupEconomicLimitsChecker +{ +public: + GroupEconomicLimitsChecker(const BlackoilWellModelGeneric& well_model, + WellTestState& well_test_state, + const Group& group, + const double simulation_time, + const int report_step_idx, + DeferredLogger& deferred_logger); + void closeWells(); + bool minGasRate(); + bool minOilRate(); + bool waterCut(); + bool GOR(); + bool WGR(); + void doWorkOver(); + bool endRun(); + int numProducersOpenInitially(); + int numProducersOpen(); + void activateEndRun(); + std::string message_separator(const char sep_char = '*', + const size_t sep_length = 110) const + { return std::string(sep_length, sep_char); } - static constexpr int NUM_PHASES = 3; - private: - void displayDebugMessage(const std::string &msg) const; - void addPrintMessage(const std::string &msg, const double value, const double limit, const UnitSystem::measure measure); - bool closeWellsRecursive(const Group& group, int level = 0); - void throwNotImplementedError(const std::string &error) const; - const BlackoilWellModelGeneric &well_model_; - const Group &group_; - const double simulation_time_; - const int report_step_idx_; - DeferredLogger &deferred_logger_; - const std::string date_string_; - const UnitSystem& unit_system_; - const WellState& well_state_; - WellTestState &well_test_state_; - const Schedule &schedule_; - GroupEconProductionLimits::GEconGroupProp gecon_props_; - bool debug_ = true; - std::array production_rates_; - std::map phase_idx_map_ = { - {0, BlackoilPhases::Liquid}, - {1, BlackoilPhases::Vapour}, - {2, BlackoilPhases::Aqua}}; - std::map phase_idx_reverse_map_; - std::string message_; + static constexpr int NUM_PHASES = 3; + +private: + void displayDebugMessage(const std::string& msg) const; + void addPrintMessage(const std::string& msg, + const double value, + const double limit, + const UnitSystem::measure measure); + bool closeWellsRecursive(const Group& group, int level = 0); + void throwNotImplementedError(const std::string& error) const; + + const BlackoilWellModelGeneric& well_model_; + const Group& group_; + const double simulation_time_; + const int report_step_idx_; + DeferredLogger& deferred_logger_; + const std::string date_string_; + const UnitSystem& unit_system_; + const WellState& well_state_; + WellTestState& well_test_state_; + const Schedule& schedule_; + GroupEconProductionLimits::GEconGroupProp gecon_props_; + bool debug_ = true; + std::array production_rates_; + std::map phase_idx_map_ = { + {0, BlackoilPhases::Liquid}, + {1, BlackoilPhases::Vapour}, + {2, BlackoilPhases::Aqua} }; + std::map phase_idx_reverse_map_; + std::string message_; +}; } // namespace Opm