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/simulators/wells/SegmentState.hpp>
27 #include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
28 #include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
29 #include <opm/simulators/wells/PerfData.hpp>
30 #include <opm/simulators/wells/ParallelWellInfo.hpp>
31 
32 namespace Opm {
33 
35 public:
36  SingleWellState(const ParallelWellInfo& pinfo, bool is_producer, std::size_t num_perf, std::size_t num_phases, double temp);
37 
38  std::reference_wrapper<const ParallelWellInfo> parallel_info;
39 
40  Well::Status status{Well::Status::OPEN};
41  bool producer;
42  double bhp{0};
43  double thp{0};
44  double temperature{0};
45  double dissolved_gas_rate{0};
46  double vaporized_oil_rate{0};
47  std::vector<double> well_potentials;
48  std::vector<double> productivity_index;
49  std::vector<double> surface_rates;
50  std::vector<double> reservoir_rates;
51  PerfData perf_data;
52  SegmentState segments;
53  Events events;
54  Well::InjectorCMode injection_cmode{Well::InjectorCMode::CMODE_UNDEFINED};
55  Well::ProducerCMode production_cmode{Well::ProducerCMode::CMODE_UNDEFINED};
56 
57 
58  void init_timestep(const SingleWellState& other);
59  void shut();
60  void stop();
61  void open();
62 
63  // The sum_xxx_rates() functions sum over all connection rates of pertinent
64  // types. In the case of distributed wells this involves an MPI
65  // communication.
66  double sum_solvent_rates() const;
67  double sum_polymer_rates() const;
68  double sum_brine_rates() const;
69 private:
70  double sum_connection_rates(const std::vector<double>& connection_rates) const;
71 };
72 
73 
74 }
75 
76 
77 
78 #endif
Class encapsulating some information about parallel wells.
Definition: ParallelWellInfo.hpp:252
Definition: PerfData.hpp:30
Definition: SegmentState.hpp:33
Definition: SingleWellState.hpp:34
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:26