2020-03-27 07:27:45 -05:00
|
|
|
/*
|
|
|
|
Copyright 2020 Equinor ASA.
|
|
|
|
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef OPM_TARGETCALCULATOR_HEADER_INCLUDED
|
|
|
|
#define OPM_TARGETCALCULATOR_HEADER_INCLUDED
|
|
|
|
|
2021-12-14 01:30:15 -06:00
|
|
|
#include <opm/input/eclipse/Schedule/Group/Group.hpp>
|
|
|
|
#include <opm/input/eclipse/Schedule/Group/GuideRate.hpp>
|
2020-03-27 07:27:45 -05:00
|
|
|
|
2021-04-29 02:01:03 -05:00
|
|
|
#include <string>
|
2020-03-27 07:27:45 -05:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace Opm
|
|
|
|
{
|
|
|
|
|
2021-04-29 02:01:03 -05:00
|
|
|
class DeferredLogger;
|
|
|
|
class GroupState;
|
2021-05-18 05:07:04 -05:00
|
|
|
struct PhaseUsage;
|
2021-04-29 02:01:03 -05:00
|
|
|
|
2020-03-27 07:27:45 -05:00
|
|
|
namespace WellGroupHelpers
|
|
|
|
{
|
|
|
|
|
|
|
|
/// Based on a group control mode, extract or calculate rates, and
|
|
|
|
/// provide other conveniences.
|
|
|
|
class TargetCalculator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TargetCalculator(const Group::ProductionCMode cmode,
|
|
|
|
const PhaseUsage& pu,
|
2020-05-04 08:56:34 -05:00
|
|
|
const std::vector<double>& resv_coeff,
|
2021-09-01 08:04:54 -05:00
|
|
|
const double group_grat_target_from_sales,
|
|
|
|
const std::string& group_name,
|
|
|
|
const GroupState& group_state,
|
|
|
|
const bool use_gpmaint);
|
2020-03-27 07:27:45 -05:00
|
|
|
|
2021-04-29 02:01:03 -05:00
|
|
|
template <typename RateType>
|
|
|
|
RateType calcModeRateFromRates(const std::vector<RateType>& rates) const
|
2020-03-27 07:27:45 -05:00
|
|
|
{
|
2021-04-29 02:01:03 -05:00
|
|
|
return calcModeRateFromRates(rates.data());
|
2020-03-27 07:27:45 -05:00
|
|
|
}
|
|
|
|
|
2021-04-29 02:01:03 -05:00
|
|
|
template <typename RateType>
|
|
|
|
RateType calcModeRateFromRates(const RateType* rates) const;
|
2020-05-04 08:56:34 -05:00
|
|
|
|
2021-04-29 02:01:03 -05:00
|
|
|
double groupTarget(const Group::ProductionControls ctrl) const;
|
2020-03-27 07:27:45 -05:00
|
|
|
|
2021-04-29 02:01:03 -05:00
|
|
|
GuideRateModel::Target guideTargetMode() const;
|
2020-03-27 07:27:45 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
Group::ProductionCMode cmode_;
|
|
|
|
const PhaseUsage& pu_;
|
|
|
|
const std::vector<double>& resv_coeff_;
|
2020-05-04 08:56:34 -05:00
|
|
|
const double group_grat_target_from_sales_;
|
2021-09-01 08:04:54 -05:00
|
|
|
const std::string& group_name_;
|
|
|
|
const GroupState& group_state_;
|
|
|
|
bool use_gpmaint_;
|
2020-03-27 07:27:45 -05:00
|
|
|
};
|
|
|
|
|
2021-03-10 07:26:04 -06:00
|
|
|
/// Based on a group control mode, extract or calculate rates, and
|
|
|
|
/// provide other conveniences.
|
|
|
|
class InjectionTargetCalculator
|
|
|
|
{
|
|
|
|
public:
|
2021-03-18 05:58:05 -05:00
|
|
|
InjectionTargetCalculator(const Group::InjectionCMode& cmode,
|
2021-03-10 07:26:04 -06:00
|
|
|
const PhaseUsage& pu,
|
|
|
|
const std::vector<double>& resv_coeff,
|
|
|
|
const std::string& group_name,
|
|
|
|
const double sales_target,
|
2021-04-22 10:31:21 -05:00
|
|
|
const GroupState& group_state,
|
2021-03-18 05:58:05 -05:00
|
|
|
const Phase& injection_phase,
|
2021-09-01 08:04:54 -05:00
|
|
|
const bool use_gpmaint,
|
2021-04-29 02:01:03 -05:00
|
|
|
DeferredLogger& deferred_logger);
|
2021-03-10 07:26:04 -06:00
|
|
|
|
|
|
|
template <typename RateVec>
|
|
|
|
auto calcModeRateFromRates(const RateVec& rates) const
|
|
|
|
{
|
|
|
|
return rates[pos_];
|
|
|
|
}
|
|
|
|
|
2021-04-29 02:01:03 -05:00
|
|
|
double groupTarget(const Group::InjectionControls& ctrl, Opm::DeferredLogger& deferred_logger) const;
|
2021-03-10 07:26:04 -06:00
|
|
|
|
2021-04-29 02:01:03 -05:00
|
|
|
GuideRateModel::Target guideTargetMode() const;
|
2021-03-10 07:26:04 -06:00
|
|
|
|
|
|
|
private:
|
|
|
|
Group::InjectionCMode cmode_;
|
|
|
|
const PhaseUsage& pu_;
|
|
|
|
const std::vector<double>& resv_coeff_;
|
|
|
|
const std::string& group_name_;
|
|
|
|
double sales_target_;
|
2021-04-22 10:31:21 -05:00
|
|
|
const GroupState& group_state_;
|
2021-09-01 08:04:54 -05:00
|
|
|
bool use_gpmaint_;
|
2021-03-10 07:26:04 -06:00
|
|
|
int pos_;
|
|
|
|
GuideRateModel::Target target_;
|
|
|
|
};
|
2020-03-27 07:27:45 -05:00
|
|
|
} // namespace WellGroupHelpers
|
|
|
|
|
|
|
|
} // namespace Opm
|
|
|
|
|
|
|
|
#endif
|