opm-simulators/opm/simulators/wells/TargetCalculator.hpp

117 lines
3.7 KiB
C++
Raw Normal View History

/*
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
#include <opm/input/eclipse/Schedule/Group/Group.hpp>
#include <opm/input/eclipse/Schedule/Group/GuideRate.hpp>
#include <string>
#include <vector>
namespace Opm
{
class DeferredLogger;
class GroupState;
struct PhaseUsage;
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,
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);
template <typename RateType>
RateType calcModeRateFromRates(const std::vector<RateType>& rates) const
{
return calcModeRateFromRates(rates.data());
}
template <typename RateType>
RateType calcModeRateFromRates(const RateType* rates) const;
double groupTarget(const Group::ProductionControls ctrl) const;
GuideRateModel::Target guideTargetMode() const;
private:
Group::ProductionCMode cmode_;
const PhaseUsage& pu_;
const std::vector<double>& resv_coeff_;
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_;
};
/// 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,
const PhaseUsage& pu,
const std::vector<double>& resv_coeff,
const std::string& group_name,
const double sales_target,
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,
DeferredLogger& deferred_logger);
template <typename RateVec>
auto calcModeRateFromRates(const RateVec& rates) const
{
return rates[pos_];
}
double groupTarget(const Group::InjectionControls& ctrl, Opm::DeferredLogger& deferred_logger) const;
GuideRateModel::Target guideTargetMode() const;
private:
Group::InjectionCMode cmode_;
const PhaseUsage& pu_;
const std::vector<double>& resv_coeff_;
const std::string& group_name_;
double sales_target_;
const GroupState& group_state_;
2021-09-01 08:04:54 -05:00
bool use_gpmaint_;
int pos_;
GuideRateModel::Target target_;
};
} // namespace WellGroupHelpers
} // namespace Opm
#endif