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  double vaporized_wat_rate{0};
60  std::vector<double> well_potentials;
61  std::vector<double> productivity_index;
62  std::vector<double> surface_rates;
63  std::vector<double> reservoir_rates;
64  PerfData perf_data;
65  bool trivial_target;
66  SegmentState segments;
67  Events events;
68  Well::InjectorCMode injection_cmode{Well::InjectorCMode::CMODE_UNDEFINED};
69  Well::ProducerCMode production_cmode{Well::ProducerCMode::CMODE_UNDEFINED};
70 
71 
78  void reset_connection_factors(const std::vector<PerforationData>& new_perf_data);
79  void update_producer_targets(const Well& ecl_well, const SummaryState& st);
80  void update_injector_targets(const Well& ecl_well, const SummaryState& st);
81  void update_targets(const Well& ecl_well, const SummaryState& st);
82  void updateStatus(Well::Status status);
83  void init_timestep(const SingleWellState& other);
84  void shut();
85  void stop();
86  void open();
87 
88  // The sum_xxx_rates() functions sum over all connection rates of pertinent
89  // types. In the case of distributed wells this involves an MPI
90  // communication.
91  double sum_solvent_rates() const;
92  double sum_polymer_rates() const;
93  double sum_brine_rates() const;
94 private:
95  double sum_connection_rates(const std::vector<double>& connection_rates) const;
96 };
97 
98 
99 }
100 
101 
102 
103 #endif
Class encapsulating some information about parallel wells.
Definition: ParallelWellInfo.hpp:243
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:107
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27
Definition: BlackoilPhases.hpp:46