My Project
SingleWellState.hpp
1 /*
2  Copyright 2021 Equinor ASA
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef OPM_SINGLE_WELL_STATE_HEADER_INCLUDED
21 #define OPM_SINGLE_WELL_STATE_HEADER_INCLUDED
22 
23 #include <functional>
24 #include <vector>
25 
26 #include <opm/input/eclipse/Schedule/Well/Well.hpp>
27 #include <opm/input/eclipse/Schedule/Events.hpp>
28 
29 #include <opm/simulators/wells/SegmentState.hpp>
30 #include <opm/simulators/wells/PerfData.hpp>
31 #include <opm/simulators/wells/ParallelWellInfo.hpp>
32 #include <opm/core/props/BlackoilPhases.hpp>
33 
34 namespace Opm {
35 
36 struct PerforationData;
37 
39 public:
40  SingleWellState(const std::string& name,
41  const ParallelWellInfo& pinfo,
42  bool is_producer,
43  double presssure_first_connection,
44  const std::vector<PerforationData>& perf_input,
45  const PhaseUsage& pu,
46  double temp);
47 
48  std::string name;
49  std::reference_wrapper<const ParallelWellInfo> parallel_info;
50 
51  Well::Status status{Well::Status::OPEN};
52  bool producer;
53  PhaseUsage pu;
54  double bhp{0};
55  double thp{0};
56  double temperature{0};
57  double dissolved_gas_rate{0};
58  double vaporized_oil_rate{0};
59  std::vector<double> well_potentials;
60  std::vector<double> productivity_index;
61  std::vector<double> surface_rates;
62  std::vector<double> reservoir_rates;
63  PerfData perf_data;
64  SegmentState segments;
65  Events events;
66  Well::InjectorCMode injection_cmode{Well::InjectorCMode::CMODE_UNDEFINED};
67  Well::ProducerCMode production_cmode{Well::ProducerCMode::CMODE_UNDEFINED};
68 
69 
76  void reset_connection_factors(const std::vector<PerforationData>& new_perf_data);
77  void update_producer_targets(const Well& ecl_well, const SummaryState& st);
78  void update_injector_targets(const Well& ecl_well, const SummaryState& st);
79  void update_targets(const Well& ecl_well, const SummaryState& st);
80  void updateStatus(Well::Status status);
81  void init_timestep(const SingleWellState& other);
82  void shut();
83  void stop();
84  void open();
85 
86  // The sum_xxx_rates() functions sum over all connection rates of pertinent
87  // types. In the case of distributed wells this involves an MPI
88  // communication.
89  double sum_solvent_rates() const;
90  double sum_polymer_rates() const;
91  double sum_brine_rates() const;
92 private:
93  double sum_connection_rates(const std::vector<double>& connection_rates) const;
94 };
95 
96 
97 }
98 
99 
100 
101 #endif
Class encapsulating some information about parallel wells.
Definition: ParallelWellInfo.hpp:252
Definition: PerfData.hpp:30
Definition: SegmentState.hpp:33
Definition: SingleWellState.hpp:38
void reset_connection_factors(const std::vector< PerforationData > &new_perf_data)
Special purpose method to support dynamically rescaling a well's CTFs through WELPI.
Definition: SingleWellState.cpp:105
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27
Definition: BlackoilPhases.hpp:46