2012-05-02 02:39:05 -05:00
|
|
|
/*
|
|
|
|
Copyright 2012 SINTEF ICT, Applied Mathematics.
|
|
|
|
|
|
|
|
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/>.
|
|
|
|
*/
|
|
|
|
|
2012-03-27 09:57:01 -05:00
|
|
|
#ifndef OPM_WELLSGROUP_HPP
|
|
|
|
#define OPM_WELLSGROUP_HPP
|
2012-03-28 08:49:39 -05:00
|
|
|
|
2012-06-05 08:42:49 -05:00
|
|
|
#include <opm/core/wells/InjectionSpecification.hpp>
|
|
|
|
#include <opm/core/wells/ProductionSpecification.hpp>
|
2012-04-12 07:25:39 -05:00
|
|
|
#include <opm/core/grid.h>
|
2013-03-14 04:29:42 -05:00
|
|
|
#include <opm/core/props/BlackoilPhases.hpp>
|
2014-02-11 07:12:36 -06:00
|
|
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Group.hpp>
|
|
|
|
|
2012-03-28 08:49:39 -05:00
|
|
|
#include <string>
|
2013-08-08 05:32:01 -05:00
|
|
|
#include <memory>
|
2012-03-29 11:34:51 -05:00
|
|
|
|
2012-03-28 08:49:39 -05:00
|
|
|
namespace Opm
|
|
|
|
{
|
2013-07-28 06:34:13 -05:00
|
|
|
// Need to forward declare this one, some of the methods in the base
|
2012-04-25 09:40:31 -05:00
|
|
|
// class returns pointers to it.
|
2012-04-25 09:14:40 -05:00
|
|
|
class WellNode;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-04-25 09:40:31 -05:00
|
|
|
/// Basic information needed for group control (each group should typically
|
|
|
|
/// not exceed the sum of its leaf nodes)
|
2012-05-02 02:39:05 -05:00
|
|
|
struct WellPhasesSummed
|
|
|
|
{
|
2012-04-25 09:14:40 -05:00
|
|
|
WellPhasesSummed();
|
2012-05-02 02:39:05 -05:00
|
|
|
double res_inj_rates[3];
|
|
|
|
double res_prod_rates[3];
|
|
|
|
double surf_inj_rates[3];
|
|
|
|
double surf_prod_rates[3];
|
|
|
|
|
2012-04-25 09:40:31 -05:00
|
|
|
/// Sums each component
|
2012-04-25 09:14:40 -05:00
|
|
|
void operator+=(const WellPhasesSummed& other);
|
2012-04-17 09:36:49 -05:00
|
|
|
};
|
2012-04-25 07:03:57 -05:00
|
|
|
|
2012-03-28 08:49:39 -05:00
|
|
|
class WellsGroupInterface
|
|
|
|
{
|
|
|
|
public:
|
2012-04-11 03:52:45 -05:00
|
|
|
WellsGroupInterface(const std::string& name,
|
2016-10-24 07:54:48 -05:00
|
|
|
const double efficiency_factor,
|
2012-05-02 02:39:05 -05:00
|
|
|
const ProductionSpecification& prod_spec,
|
|
|
|
const InjectionSpecification& inj_spec,
|
|
|
|
const PhaseUsage& phase_usage);
|
2012-03-28 08:49:39 -05:00
|
|
|
virtual ~WellsGroupInterface();
|
|
|
|
|
2012-03-30 03:51:31 -05:00
|
|
|
/// The unique identifier for the well or well group.
|
2014-02-12 08:39:57 -06:00
|
|
|
const std::string& name() const;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-03-30 03:51:31 -05:00
|
|
|
/// Production specifications for the well or well group.
|
2012-03-28 08:49:39 -05:00
|
|
|
const ProductionSpecification& prodSpec() const;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-03-30 03:51:31 -05:00
|
|
|
/// Injection specifications for the well or well group.
|
2012-03-28 08:49:39 -05:00
|
|
|
const InjectionSpecification& injSpec() const;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-04-13 03:32:36 -05:00
|
|
|
/// Production specifications for the well or well group.
|
|
|
|
ProductionSpecification& prodSpec();
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-04-13 03:32:36 -05:00
|
|
|
/// Injection specifications for the well or well group.
|
|
|
|
InjectionSpecification& injSpec();
|
2012-05-02 02:39:05 -05:00
|
|
|
|
|
|
|
/// Phase usage information.
|
|
|
|
const PhaseUsage& phaseUsage() const;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-03-30 03:51:31 -05:00
|
|
|
/// \returns true if the object is a leaf node (WellNode), false otherwise.
|
|
|
|
virtual bool isLeafNode() const;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
|
|
|
/// \returns the pointer to the WellsGroupInterface with the given name. NULL if
|
2012-03-29 11:34:51 -05:00
|
|
|
/// the name is not found.a
|
2012-04-25 09:42:55 -05:00
|
|
|
virtual WellsGroupInterface* findGroup(const std::string& name_of_node) = 0;
|
2012-04-25 09:40:31 -05:00
|
|
|
|
|
|
|
/// Sets the parent
|
|
|
|
/// \param[in] parent the pointer to the parent
|
2012-04-12 08:48:24 -05:00
|
|
|
void setParent(WellsGroupInterface* parent);
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-04-25 09:40:31 -05:00
|
|
|
/// Gets the parent of the group, NULL if no parent.
|
2012-04-13 04:37:50 -05:00
|
|
|
const WellsGroupInterface* getParent() const;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2016-09-30 10:54:49 -05:00
|
|
|
WellsGroupInterface* getParent();
|
|
|
|
|
2013-07-28 06:34:13 -05:00
|
|
|
/// Calculates the number of leaf nodes in the given group.
|
2012-04-16 06:44:53 -05:00
|
|
|
/// A leaf node is defined to have one leaf node in its group.
|
|
|
|
virtual int numberOfLeafNodes() = 0;
|
2012-04-25 09:14:40 -05:00
|
|
|
|
2012-04-25 09:40:31 -05:00
|
|
|
/// Checks if each condition is met, applies well controls where needed
|
|
|
|
/// (that is, it either changes the active control of violating wells, or shuts
|
|
|
|
/// down wells). Only one change is applied per invocation. Typical use will be
|
|
|
|
/// \code
|
|
|
|
/// solve_pressure();
|
2012-05-02 02:39:05 -05:00
|
|
|
/// while(!group.conditionsMet(...)) {
|
2012-04-25 09:40:31 -05:00
|
|
|
/// solve_pressure();
|
|
|
|
/// }
|
|
|
|
/// \endcode
|
|
|
|
///
|
|
|
|
/// \note It's highly recommended to use the conditionsMet found in WellsManager.
|
2013-07-28 06:34:13 -05:00
|
|
|
/// \param[in] well_bhp A vector containing the bhp for each well. Is assumed
|
2012-04-25 09:40:31 -05:00
|
|
|
/// to be ordered the same way as the related Wells-struct.
|
2012-05-02 02:39:05 -05:00
|
|
|
/// \param[in] well_reservoirrates_phase
|
|
|
|
/// A vector containing reservoir rates by phase for each well.
|
|
|
|
/// Is assumed to be ordered the same way as the related Wells-struct,
|
|
|
|
/// with all phase rates of a single well adjacent in the array.
|
|
|
|
/// \param[in] well_surfacerates_phase
|
|
|
|
/// A vector containing surface rates by phase for each well.
|
|
|
|
/// Is assumed to be ordered the same way as the related Wells-struct,
|
|
|
|
/// with all phase rates of a single well adjacent in the array.
|
|
|
|
/// \param[out] summed_phases Will at end of invocation contain the summed phase rates
|
|
|
|
/// (rate ,etc.) for the group.
|
2012-04-25 09:40:31 -05:00
|
|
|
/// \return true if no violations were found, false otherwise (false also implies a change).
|
2012-04-25 09:14:40 -05:00
|
|
|
virtual bool conditionsMet(const std::vector<double>& well_bhp,
|
2012-05-02 02:39:05 -05:00
|
|
|
const std::vector<double>& well_reservoirrates_phase,
|
|
|
|
const std::vector<double>& well_surfacerates_phase,
|
2012-05-02 06:02:59 -05:00
|
|
|
WellPhasesSummed& summed_phases) = 0;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 02:39:05 -05:00
|
|
|
/// Sets the current active control to the provided one for all injectors within the group.
|
|
|
|
/// After this call, the combined rate (which rate depending on control_mode) of the group
|
|
|
|
/// shall be equal to target.
|
2016-10-07 05:56:21 -05:00
|
|
|
/// \param[in] only_group if true, only children that are under group control will be changed.
|
|
|
|
// otherwise, all children will be set under group control
|
2012-05-02 02:39:05 -05:00
|
|
|
virtual void applyInjGroupControl(const InjectionSpecification::ControlMode control_mode,
|
2016-10-24 06:24:41 -05:00
|
|
|
const InjectionSpecification::InjectorType injector_type,
|
2012-05-02 06:02:59 -05:00
|
|
|
const double target,
|
2016-10-07 05:56:21 -05:00
|
|
|
const bool only_group) = 0;
|
2012-05-02 02:39:05 -05:00
|
|
|
/// Sets the current active control to the provided one for all producers within the group.
|
|
|
|
/// After this call, the combined rate (which rate depending on control_mode) of the group
|
|
|
|
/// shall be equal to target.
|
2016-10-07 05:56:21 -05:00
|
|
|
/// \param[in] only_group if true, only children that are under group control will be changed.
|
|
|
|
// otherwise, all children will be set under group control
|
2012-05-02 02:39:05 -05:00
|
|
|
virtual void applyProdGroupControl(const ProductionSpecification::ControlMode control_mode,
|
2012-05-02 06:02:59 -05:00
|
|
|
const double target,
|
2016-10-07 05:56:21 -05:00
|
|
|
const bool only_group) = 0;
|
2012-05-02 02:39:05 -05:00
|
|
|
|
2012-04-25 09:40:31 -05:00
|
|
|
/// Gets the worst offending well based on the input
|
2012-05-02 06:02:59 -05:00
|
|
|
/// \param[in] well_reservoirrates_phase
|
|
|
|
/// A vector containing reservoir rates by phase for each well.
|
|
|
|
/// Is assumed to be ordered the same way as the related Wells-struct,
|
|
|
|
/// with all phase rates of a single well adjacent in the array.
|
|
|
|
/// \param[in] well_surfacerates_phase
|
|
|
|
/// A vector containing surface rates by phase for each well.
|
|
|
|
/// Is assumed to be ordered the same way as the related Wells-struct,
|
|
|
|
/// with all phase rates of a single well adjacent in the array.
|
|
|
|
/// \param[in] mode
|
|
|
|
/// The relevant control mode to find the maximum over.
|
2012-04-25 09:40:31 -05:00
|
|
|
/// \return first will be a pointer to the worst offending well, second will be the obtained value at that well.
|
2012-05-02 06:02:59 -05:00
|
|
|
virtual std::pair<WellNode*, double> getWorstOffending(const std::vector<double>& well_reservoirrates_phase,
|
|
|
|
const std::vector<double>& well_surfacerates_phase,
|
|
|
|
ProductionSpecification::ControlMode mode) = 0;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 06:02:59 -05:00
|
|
|
/// Gets the target rate for the given mode.
|
|
|
|
double getTarget(ProductionSpecification::ControlMode mode);
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 06:02:59 -05:00
|
|
|
/// Gets the target rate for the given mode.
|
|
|
|
double getTarget(InjectionSpecification::ControlMode mode);
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 06:02:59 -05:00
|
|
|
/// Applies any production group control relevant to all children nodes.
|
|
|
|
/// If no group control is set, this is called recursively to the children.
|
|
|
|
virtual void applyProdGroupControls() = 0;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 06:02:59 -05:00
|
|
|
/// Applies any injection group control relevant to all children nodes.
|
|
|
|
/// If no group control is set, this is called recursively to the children.
|
|
|
|
virtual void applyInjGroupControls() = 0;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 08:41:05 -05:00
|
|
|
/// Calculates the production guide rate for the group.
|
2013-07-28 06:34:13 -05:00
|
|
|
/// \param[in] only_group If true, will only accumelate guide rates for
|
2012-05-02 08:41:05 -05:00
|
|
|
/// wells under group control
|
|
|
|
virtual double productionGuideRate(bool only_group) = 0;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 08:41:05 -05:00
|
|
|
/// Calculates the injection guide rate for the group.
|
2013-07-28 06:34:13 -05:00
|
|
|
/// \param[in] only_group If true, will only accumelate guide rates for
|
2012-05-02 08:41:05 -05:00
|
|
|
/// wells under group control
|
|
|
|
virtual double injectionGuideRate(bool only_group) = 0;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
|
|
|
/// Gets the total production flow of the given phase.
|
2012-05-09 05:35:26 -05:00
|
|
|
/// \param[in] phase_flows A vector containing rates by phase for each well.
|
|
|
|
/// Is assumed to be ordered the same way as the related Wells-struct,
|
|
|
|
/// with all phase rates of a single well adjacent in the array.
|
|
|
|
/// \param[in] phase The phase for which to sum up.
|
|
|
|
virtual double getTotalProductionFlow(const std::vector<double>& phase_flows,
|
2016-10-10 07:47:19 -05:00
|
|
|
const BlackoilPhases::PhaseIndex phase) const = 0;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-09 05:57:36 -05:00
|
|
|
/// Applies explicit reinjection controls. This must be called at each timestep to be correct.
|
|
|
|
/// \param[in] well_reservoirrates_phase
|
|
|
|
/// A vector containing reservoir rates by phase for each well.
|
|
|
|
/// Is assumed to be ordered the same way as the related Wells-struct,
|
|
|
|
/// with all phase rates of a single well adjacent in the array.
|
|
|
|
/// \param[in] well_surfacerates_phase
|
|
|
|
/// A vector containing surface rates by phase for each well.
|
|
|
|
/// Is assumed to be ordered the same way as the related Wells-struct,
|
|
|
|
/// with all phase rates of a single well adjacent in the array.
|
|
|
|
virtual void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
|
|
|
|
const std::vector<double>& well_surfacerates_phase) = 0;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2016-10-21 10:39:31 -05:00
|
|
|
/// TODO: prototyping a VREP enforcement function.
|
|
|
|
virtual void applyVREPGroupControls(const std::vector<double>& well_voidage_rates,
|
|
|
|
const std::vector<double>& conversion_coeffs) = 0;
|
|
|
|
|
|
|
|
virtual void applyVREPGroupControl(const double target,
|
|
|
|
const std::vector<double>& well_voidage_rates,
|
|
|
|
const std::vector<double>& conversion_coeffs,
|
|
|
|
const bool only_group) = 0;
|
|
|
|
|
|
|
|
virtual double getTotalVoidageRate(const std::vector<double>& well_voidage_rates) = 0;
|
|
|
|
|
2016-09-30 10:54:49 -05:00
|
|
|
/// Return whether the well is running under group control target
|
|
|
|
/// or under their own limit.
|
|
|
|
/// True under their own limit.
|
|
|
|
/// False running under group control target
|
|
|
|
bool individualControl() const;
|
|
|
|
|
|
|
|
/// Update the status for individual contrl
|
|
|
|
void setIndividualControl(const bool);
|
|
|
|
|
2016-10-10 08:30:15 -05:00
|
|
|
/// Whether it is a production well
|
|
|
|
/// Should only appy for WellNode
|
|
|
|
virtual bool isProducer() const = 0;
|
|
|
|
|
|
|
|
/// Whether it is an injection well
|
|
|
|
/// Should only appy for WellNode
|
|
|
|
virtual bool isInjector() const = 0;
|
|
|
|
|
2016-10-13 05:37:07 -05:00
|
|
|
virtual double getProductionRate(const std::vector<double>& well_rates,
|
|
|
|
const ProductionSpecification::ControlMode prod_mode) const = 0;
|
2016-10-10 08:30:15 -05:00
|
|
|
|
|
|
|
virtual void updateWellProductionTargets(const std::vector<double>& well_rates) = 0;
|
|
|
|
|
|
|
|
virtual void updateWellInjectionTargets(const std::vector<double>& well_rates) = 0;
|
|
|
|
|
2016-11-15 07:36:19 -06:00
|
|
|
virtual void setTargetUpdated(const bool flag) = 0;
|
|
|
|
|
2016-10-24 07:54:48 -05:00
|
|
|
double efficiencyFactor() const;
|
2016-10-18 08:28:21 -05:00
|
|
|
|
2016-10-24 07:54:48 -05:00
|
|
|
void setEfficiencyFactor(const double efficiency_factor);
|
2016-10-10 08:30:15 -05:00
|
|
|
|
2012-04-12 08:48:24 -05:00
|
|
|
protected:
|
2012-05-02 02:39:05 -05:00
|
|
|
/// Calculates the correct rate for the given ProductionSpecification::ControlMode
|
2013-07-28 06:34:13 -05:00
|
|
|
double rateByMode(const double* res_rates,
|
2012-05-02 02:39:05 -05:00
|
|
|
const double* surf_rates,
|
|
|
|
const ProductionSpecification::ControlMode mode);
|
|
|
|
|
|
|
|
/// Calculates the correct rate for the given InjectionSpecification::ControlMode
|
2013-07-28 06:34:13 -05:00
|
|
|
double rateByMode(const double* res_rates,
|
2012-05-02 02:39:05 -05:00
|
|
|
const double* surf_rates,
|
|
|
|
const InjectionSpecification::ControlMode mode);
|
|
|
|
|
|
|
|
WellsGroupInterface* parent_;
|
2012-04-12 08:48:24 -05:00
|
|
|
|
2016-09-30 10:54:49 -05:00
|
|
|
// Whether well is running under the group control target.
|
|
|
|
// Current only consider one level of control.
|
|
|
|
// So not putting it in the WellsGroupInterface yet.
|
|
|
|
bool individual_control_;
|
2016-10-10 04:37:22 -05:00
|
|
|
|
2016-10-18 07:26:06 -05:00
|
|
|
// Efficiency factor
|
2016-10-24 07:54:48 -05:00
|
|
|
double efficiency_factor_;
|
2016-10-18 07:26:06 -05:00
|
|
|
|
2016-10-10 04:37:22 -05:00
|
|
|
private:
|
|
|
|
std::string name_;
|
|
|
|
ProductionSpecification production_specification_;
|
|
|
|
InjectionSpecification injection_specification_;
|
|
|
|
PhaseUsage phase_usage_;
|
2012-03-28 08:49:39 -05:00
|
|
|
};
|
2012-03-27 09:57:01 -05:00
|
|
|
|
2012-04-11 03:52:45 -05:00
|
|
|
|
|
|
|
|
2012-03-28 08:49:39 -05:00
|
|
|
class WellsGroup : public WellsGroupInterface
|
|
|
|
{
|
2012-03-29 11:34:51 -05:00
|
|
|
public:
|
2012-04-11 03:52:45 -05:00
|
|
|
WellsGroup(const std::string& name,
|
2016-10-24 07:54:48 -05:00
|
|
|
const double efficiency_factor,
|
2012-05-02 02:39:05 -05:00
|
|
|
const ProductionSpecification& prod_spec,
|
|
|
|
const InjectionSpecification& inj_spec,
|
|
|
|
const PhaseUsage& phase_usage);
|
2012-03-29 11:34:51 -05:00
|
|
|
|
2012-04-25 09:42:55 -05:00
|
|
|
virtual WellsGroupInterface* findGroup(const std::string& name_of_node);
|
2012-03-29 11:34:51 -05:00
|
|
|
|
2013-08-08 05:32:01 -05:00
|
|
|
void addChild(std::shared_ptr<WellsGroupInterface> child);
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-04-25 09:14:40 -05:00
|
|
|
virtual bool conditionsMet(const std::vector<double>& well_bhp,
|
2012-05-02 02:39:05 -05:00
|
|
|
const std::vector<double>& well_reservoirrates_phase,
|
|
|
|
const std::vector<double>& well_surfacerates_phase,
|
|
|
|
WellPhasesSummed& summed_phases);
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-04-16 06:44:53 -05:00
|
|
|
virtual int numberOfLeafNodes();
|
2012-05-02 06:02:59 -05:00
|
|
|
virtual std::pair<WellNode*, double> getWorstOffending(const std::vector<double>& well_reservoirrates_phase,
|
|
|
|
const std::vector<double>& well_surfacerates_phase,
|
|
|
|
ProductionSpecification::ControlMode mode);
|
2012-05-02 02:39:05 -05:00
|
|
|
|
|
|
|
/// Sets the current active control to the provided one for all injectors within the group.
|
|
|
|
/// After this call, the combined rate (which rate depending on control_mode) of the group
|
|
|
|
/// shall be equal to target.
|
2016-10-07 05:56:21 -05:00
|
|
|
/// \param[in] only_group if true, only children that are under group control will be changed.
|
|
|
|
// otherwise, all children will be set under group control
|
2012-05-02 02:39:05 -05:00
|
|
|
virtual void applyInjGroupControl(const InjectionSpecification::ControlMode control_mode,
|
2016-10-24 06:24:41 -05:00
|
|
|
const InjectionSpecification::InjectorType injector_type,
|
2012-05-02 06:02:59 -05:00
|
|
|
const double target,
|
2016-10-07 05:56:21 -05:00
|
|
|
bool only_group);
|
2012-05-02 02:39:05 -05:00
|
|
|
|
|
|
|
/// Sets the current active control to the provided one for all producers within the group.
|
|
|
|
/// After this call, the combined rate (which rate depending on control_mode) of the group
|
|
|
|
/// shall be equal to target.
|
2016-10-07 05:56:21 -05:00
|
|
|
/// \param[in] only_group if true, only children that are under group control will be changed.
|
|
|
|
// otherwise, all children will be set under group control
|
2012-05-02 02:39:05 -05:00
|
|
|
virtual void applyProdGroupControl(const ProductionSpecification::ControlMode control_mode,
|
2012-05-02 06:02:59 -05:00
|
|
|
const double target,
|
2016-10-07 05:56:21 -05:00
|
|
|
bool only_group);
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 06:02:59 -05:00
|
|
|
/// Applies any production group control relevant to all children nodes.
|
|
|
|
/// If no group control is set, this is called recursively to the children.
|
|
|
|
virtual void applyProdGroupControls();
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 06:02:59 -05:00
|
|
|
/// Applies any injection group control relevant to all children nodes.
|
|
|
|
/// If no group control is set, this is called recursively to the children.
|
|
|
|
virtual void applyInjGroupControls();
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 08:41:05 -05:00
|
|
|
/// Calculates the production guide rate for the group.
|
2013-07-28 06:34:13 -05:00
|
|
|
/// \param[in] only_group If true, will only accumelate guide rates for
|
2012-05-02 08:41:05 -05:00
|
|
|
/// wells under group control
|
|
|
|
virtual double productionGuideRate(bool only_group);
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 08:41:05 -05:00
|
|
|
/// Calculates the injection guide rate for the group.
|
2013-07-28 06:34:13 -05:00
|
|
|
/// \param[in] only_group If true, will only accumelate guide rates for
|
2012-05-02 08:41:05 -05:00
|
|
|
/// wells under group control
|
|
|
|
virtual double injectionGuideRate(bool only_group);
|
2013-07-28 06:34:13 -05:00
|
|
|
|
|
|
|
/// Gets the total production flow of the given phase.
|
2012-05-09 05:35:26 -05:00
|
|
|
/// \param[in] phase_flows A vector containing rates by phase for each well.
|
|
|
|
/// Is assumed to be ordered the same way as the related Wells-struct,
|
|
|
|
/// with all phase rates of a single well adjacent in the array.
|
|
|
|
/// \param[in] phase The phase for which to sum up.
|
|
|
|
virtual double getTotalProductionFlow(const std::vector<double>& phase_flows,
|
2016-10-10 07:47:19 -05:00
|
|
|
const BlackoilPhases::PhaseIndex phase) const;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-09 05:57:36 -05:00
|
|
|
/// Applies explicit reinjection controls. This must be called at each timestep to be correct.
|
|
|
|
/// \param[in] well_reservoirrates_phase
|
|
|
|
/// A vector containing reservoir rates by phase for each well.
|
|
|
|
/// Is assumed to be ordered the same way as the related Wells-struct,
|
|
|
|
/// with all phase rates of a single well adjacent in the array.
|
|
|
|
/// \param[in] well_surfacerates_phase
|
|
|
|
/// A vector containing surface rates by phase for each well.
|
|
|
|
/// Is assumed to be ordered the same way as the related Wells-struct,
|
|
|
|
/// with all phase rates of a single well adjacent in the array.
|
|
|
|
virtual void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
|
|
|
|
const std::vector<double>& well_surfacerates_phase);
|
2012-04-25 09:14:40 -05:00
|
|
|
|
2016-10-21 10:39:31 -05:00
|
|
|
/// TODO: prototyping a VREP enforcement function.
|
|
|
|
virtual void applyVREPGroupControls(const std::vector<double>& well_voidage_rates,
|
|
|
|
const std::vector<double>& conversion_coeffs);
|
|
|
|
|
|
|
|
virtual void applyVREPGroupControl(const double target,
|
|
|
|
const std::vector<double>& well_voidage_rates,
|
|
|
|
const std::vector<double>& conversion_coeffs,
|
|
|
|
const bool only_group);
|
|
|
|
|
|
|
|
virtual double getTotalVoidageRate(const std::vector<double>& well_voidage_rates);
|
|
|
|
|
2016-10-10 08:30:15 -05:00
|
|
|
virtual void updateWellProductionTargets(const std::vector<double>& well_rates);
|
2016-10-07 09:18:09 -05:00
|
|
|
|
2016-10-10 08:30:15 -05:00
|
|
|
virtual void updateWellInjectionTargets(const std::vector<double>& well_rates);
|
|
|
|
|
2016-11-15 07:36:19 -06:00
|
|
|
virtual void setTargetUpdated(const bool flag);
|
|
|
|
|
2016-10-10 08:30:15 -05:00
|
|
|
/// Whether it is a production well
|
|
|
|
/// Should only appy for WellNode
|
|
|
|
virtual bool isProducer() const;
|
|
|
|
|
|
|
|
/// Whether it is an injection well
|
|
|
|
/// Should only appy for WellNode
|
|
|
|
virtual bool isInjector() const;
|
|
|
|
|
2016-10-13 05:37:07 -05:00
|
|
|
virtual double getProductionRate(const std::vector<double>& well_rates,
|
|
|
|
const ProductionSpecification::ControlMode prod_mode) const;
|
2016-09-30 10:54:49 -05:00
|
|
|
|
2012-03-29 11:34:51 -05:00
|
|
|
private:
|
2013-08-08 05:32:01 -05:00
|
|
|
std::vector<std::shared_ptr<WellsGroupInterface> > children_;
|
2012-03-28 08:49:39 -05:00
|
|
|
};
|
2012-03-27 09:57:01 -05:00
|
|
|
|
2012-04-11 03:52:45 -05:00
|
|
|
|
|
|
|
|
2012-03-29 11:34:51 -05:00
|
|
|
class WellNode : public WellsGroupInterface
|
|
|
|
{
|
|
|
|
public:
|
2012-04-11 03:52:45 -05:00
|
|
|
WellNode(const std::string& name,
|
2016-10-24 07:54:48 -05:00
|
|
|
const double efficiency_factor,
|
2012-05-02 02:39:05 -05:00
|
|
|
const ProductionSpecification& prod_spec,
|
|
|
|
const InjectionSpecification& inj_spec,
|
|
|
|
const PhaseUsage& phase_usage);
|
2012-03-29 11:34:51 -05:00
|
|
|
|
2012-04-25 09:42:55 -05:00
|
|
|
virtual WellsGroupInterface* findGroup(const std::string& name_of_node);
|
2012-04-25 09:14:40 -05:00
|
|
|
virtual bool conditionsMet(const std::vector<double>& well_bhp,
|
2012-05-02 02:39:05 -05:00
|
|
|
const std::vector<double>& well_reservoirrates_phase,
|
|
|
|
const std::vector<double>& well_surfacerates_phase,
|
|
|
|
WellPhasesSummed& summed_phases);
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-03-30 03:51:31 -05:00
|
|
|
virtual bool isLeafNode() const;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-04-25 09:14:40 -05:00
|
|
|
void setWellsPointer(Wells* wells, int self_index);
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-04-16 06:44:53 -05:00
|
|
|
virtual int numberOfLeafNodes();
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-04-25 09:40:31 -05:00
|
|
|
// Shuts the well (in the well struct)
|
2012-04-25 09:14:40 -05:00
|
|
|
void shutWell();
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 06:02:59 -05:00
|
|
|
virtual std::pair<WellNode*, double> getWorstOffending(const std::vector<double>& well_reservoirrates_phase,
|
|
|
|
const std::vector<double>& well_surfacerates_phase,
|
|
|
|
ProductionSpecification::ControlMode mode);
|
2012-05-02 02:39:05 -05:00
|
|
|
|
|
|
|
/// Sets the current active control to the provided one for all injectors within the group.
|
|
|
|
/// After this call, the combined rate (which rate depending on control_mode) of the group
|
|
|
|
/// shall be equal to target.
|
2016-10-07 05:56:21 -05:00
|
|
|
/// \param[in] only_group if true, only children that are under group control will be changed.
|
|
|
|
/// otherwise, all children will be set under group control
|
2012-05-02 02:39:05 -05:00
|
|
|
virtual void applyInjGroupControl(const InjectionSpecification::ControlMode control_mode,
|
2016-10-24 06:24:41 -05:00
|
|
|
const InjectionSpecification::InjectorType injector_type,
|
2012-05-02 06:02:59 -05:00
|
|
|
const double target,
|
2016-10-07 05:56:21 -05:00
|
|
|
bool only_group);
|
2012-05-02 02:39:05 -05:00
|
|
|
|
|
|
|
/// Sets the current active control to the provided one for all producers within the group.
|
|
|
|
/// After this call, the combined rate (which rate depending on control_mode) of the group
|
|
|
|
/// shall be equal to target.
|
2016-10-07 05:56:21 -05:00
|
|
|
/// \param[in] only_group if true, only children that are under group control will be changed.
|
|
|
|
/// otherwise, all children will be set under group control
|
2012-05-02 02:39:05 -05:00
|
|
|
virtual void applyProdGroupControl(const ProductionSpecification::ControlMode control_mode,
|
2012-05-02 06:02:59 -05:00
|
|
|
const double target,
|
2016-10-07 05:56:21 -05:00
|
|
|
bool only_group);
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 06:02:59 -05:00
|
|
|
/// Applies any production group control relevant to all children nodes.
|
|
|
|
/// If no group control is set, this is called recursively to the children.
|
|
|
|
virtual void applyProdGroupControls();
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 06:02:59 -05:00
|
|
|
/// Applies any injection group control relevant to all children nodes.
|
|
|
|
/// If no group control is set, this is called recursively to the children.
|
|
|
|
virtual void applyInjGroupControls();
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 08:41:05 -05:00
|
|
|
/// Calculates the production guide rate for the group.
|
2013-07-28 06:34:13 -05:00
|
|
|
/// \param[in] only_group If true, will only accumelate guide rates for
|
2012-05-02 08:41:05 -05:00
|
|
|
/// wells under group control
|
|
|
|
virtual double productionGuideRate(bool only_group);
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-02 08:41:05 -05:00
|
|
|
/// Calculates the injection guide rate for the group.
|
2013-07-28 06:34:13 -05:00
|
|
|
/// \param[in] only_group If true, will only accumelate guide rates for
|
2012-05-02 08:41:05 -05:00
|
|
|
/// wells under group control
|
|
|
|
virtual double injectionGuideRate(bool only_group);
|
2013-07-28 06:34:13 -05:00
|
|
|
|
|
|
|
/// Gets the total production flow of the given phase.
|
2012-05-09 05:35:26 -05:00
|
|
|
/// \param[in] phase_flows A vector containing rates by phase for each well.
|
|
|
|
/// Is assumed to be ordered the same way as the related Wells-struct,
|
|
|
|
/// with all phase rates of a single well adjacent in the array.
|
|
|
|
/// \param[in] phase The phase for which to sum up.
|
|
|
|
virtual double getTotalProductionFlow(const std::vector<double>& phase_flows,
|
2016-10-10 07:47:19 -05:00
|
|
|
const BlackoilPhases::PhaseIndex phase) const;
|
2012-05-09 05:35:26 -05:00
|
|
|
|
|
|
|
/// Returns the type of the well.
|
|
|
|
WellType type() const;
|
2013-07-28 06:34:13 -05:00
|
|
|
|
2012-05-09 05:57:36 -05:00
|
|
|
/// Applies explicit reinjection controls. This must be called at each timestep to be correct.
|
|
|
|
/// \param[in] well_reservoirrates_phase
|
|
|
|
/// A vector containing reservoir rates by phase for each well.
|
|
|
|
/// Is assumed to be ordered the same way as the related Wells-struct,
|
|
|
|
/// with all phase rates of a single well adjacent in the array.
|
|
|
|
/// \param[in] well_surfacerates_phase
|
|
|
|
/// A vector containing surface rates by phase for each well.
|
|
|
|
/// Is assumed to be ordered the same way as the related Wells-struct,
|
|
|
|
/// with all phase rates of a single well adjacent in the array.
|
|
|
|
virtual void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
|
|
|
|
const std::vector<double>& well_surfacerates_phase);
|
2016-10-21 10:39:31 -05:00
|
|
|
|
|
|
|
/// TODO: prototyping a VREP enforcement function.
|
|
|
|
virtual void applyVREPGroupControls(const std::vector<double>& well_voidage_rates,
|
|
|
|
const std::vector<double>& conversion_coeffs);
|
|
|
|
|
|
|
|
virtual void applyVREPGroupControl(const double target,
|
|
|
|
const std::vector<double>& well_voidage_rates,
|
|
|
|
const std::vector<double>& conversion_coeffs,
|
|
|
|
const bool only_group);
|
|
|
|
|
|
|
|
virtual double getTotalVoidageRate(const std::vector<double>& well_voidage_rates);
|
|
|
|
|
2016-09-30 10:54:49 -05:00
|
|
|
int groupControlIndex() const;
|
2012-05-02 02:39:05 -05:00
|
|
|
|
2016-10-10 08:30:15 -05:00
|
|
|
virtual bool isProducer() const;
|
|
|
|
|
|
|
|
virtual bool isInjector() const;
|
|
|
|
|
2016-10-13 05:37:07 -05:00
|
|
|
virtual double getProductionRate(const std::vector<double>& well_rates,
|
|
|
|
const ProductionSpecification::ControlMode prod_mode) const;
|
2016-10-07 06:37:35 -05:00
|
|
|
|
2016-10-10 08:30:15 -05:00
|
|
|
virtual void updateWellProductionTargets(const std::vector<double>& well_rates);
|
2016-10-10 07:47:19 -05:00
|
|
|
|
2016-10-10 08:30:15 -05:00
|
|
|
virtual void updateWellInjectionTargets(const std::vector<double>& well_rates);
|
2016-10-10 07:47:19 -05:00
|
|
|
|
2016-10-18 08:28:21 -05:00
|
|
|
/// the efficiency factor for groups are muliplitive, this function return the resulted final efficiency factor
|
|
|
|
/// to the well in a multi-layer group structure.
|
|
|
|
double getAccumulativeEfficiencyFactor() const;
|
2016-10-10 07:47:19 -05:00
|
|
|
|
2016-11-04 07:37:50 -05:00
|
|
|
int selfIndex() const;
|
|
|
|
|
2016-11-15 07:36:19 -06:00
|
|
|
bool targetUpdated() const;
|
|
|
|
|
|
|
|
virtual void setTargetUpdated(const bool flag);
|
|
|
|
|
2012-04-12 07:25:39 -05:00
|
|
|
private:
|
2012-04-25 09:14:40 -05:00
|
|
|
Wells* wells_;
|
2012-04-12 07:25:39 -05:00
|
|
|
int self_index_;
|
2012-05-02 02:39:05 -05:00
|
|
|
int group_control_index_;
|
2012-05-02 06:02:59 -05:00
|
|
|
bool shut_well_;
|
2016-11-15 07:36:19 -06:00
|
|
|
// TODO: used when updating well targets
|
|
|
|
bool target_updated_;
|
2012-03-29 11:34:51 -05:00
|
|
|
};
|
|
|
|
|
2014-02-11 07:12:36 -06:00
|
|
|
/// Creates the WellsGroupInterface for the given well
|
|
|
|
/// \param[in] well the Well to construct object for
|
|
|
|
/// \param[in] timeStep the time step in question
|
|
|
|
/// \param[in] the phase usage
|
2016-06-16 02:33:43 -05:00
|
|
|
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well* well, size_t timeStep,
|
2014-02-11 07:12:36 -06:00
|
|
|
const PhaseUsage& phase_usage );
|
|
|
|
|
|
|
|
/// Creates the WellsGroupInterface for the given Group
|
|
|
|
/// \param[in] group the Group to construct object for
|
|
|
|
/// \param[in] timeStep the time step in question
|
|
|
|
/// \param[in] the phase usage
|
2016-10-05 08:24:14 -05:00
|
|
|
std::shared_ptr<WellsGroupInterface> createGroupWellsGroup(const Group& group, size_t timeStep,
|
2014-02-11 07:12:36 -06:00
|
|
|
const PhaseUsage& phase_usage );
|
2012-03-27 09:57:01 -05:00
|
|
|
}
|
2016-09-30 10:54:49 -05:00
|
|
|
|
2012-03-27 09:57:01 -05:00
|
|
|
#endif /* OPM_WELLSGROUP_HPP */
|
|
|
|
|