SingleWellState.hpp
Go to the documentation of this file.
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/WellEnums.hpp>
27#include <opm/input/eclipse/Schedule/Events.hpp>
28
33
34namespace Opm {
35
36struct PerforationData;
37class SummaryState;
38class Well;
39
40template<class Scalar>
42public:
43 SingleWellState(const std::string& name,
44 const ParallelWellInfo& pinfo,
45 bool is_producer,
46 Scalar presssure_first_connection,
47 const std::vector<PerforationData>& perf_input,
48 const PhaseUsage& pu,
49 Scalar temp);
50
52
53 template<class Serializer>
54 void serializeOp(Serializer& serializer)
55 {
56 serializer(name);
57 serializer(status);
58 serializer(producer);
59 serializer(bhp);
60 serializer(thp);
61 serializer(temperature);
62 serializer(phase_mixing_rates);
63 serializer(well_potentials);
64 serializer(productivity_index);
65 serializer(implicit_ipr_a);
66 serializer(implicit_ipr_b);
67 serializer(surface_rates);
68 serializer(reservoir_rates);
69 serializer(prev_surface_rates);
70 serializer(trivial_target);
71 serializer(segments);
72 serializer(events);
73 serializer(injection_cmode);
74 serializer(production_cmode);
75 serializer(filtrate_conc);
76 serializer(perf_data);
77 }
78
79 bool operator==(const SingleWellState&) const;
80
81 std::string name;
82 std::reference_wrapper<const ParallelWellInfo> parallel_info;
83
84 WellStatus status{WellStatus::OPEN};
87 Scalar bhp{0};
88 Scalar thp{0};
89 Scalar temperature{0};
90
91 // filtration injection concentration
92 Scalar filtrate_conc{0};
93
94 std::array<Scalar,4> phase_mixing_rates{};
100 };
101
102 std::vector<Scalar> well_potentials;
103 std::vector<Scalar> productivity_index;
104 std::vector<Scalar> implicit_ipr_a;
105 std::vector<Scalar> implicit_ipr_b;
106 std::vector<Scalar> surface_rates;
107 std::vector<Scalar> reservoir_rates;
108 std::vector<Scalar> prev_surface_rates;
112 Events events;
113 WellInjectorCMode injection_cmode{WellInjectorCMode::CMODE_UNDEFINED};
114 WellProducerCMode production_cmode{WellProducerCMode::CMODE_UNDEFINED};
115
116
123 void reset_connection_factors(const std::vector<PerforationData>& new_perf_data);
124 void update_producer_targets(const Well& ecl_well, const SummaryState& st);
125 void update_injector_targets(const Well& ecl_well, const SummaryState& st);
126 void update_targets(const Well& ecl_well, const SummaryState& st);
127 void updateStatus(WellStatus status);
128 void init_timestep(const SingleWellState& other);
129 void shut();
130 void stop();
131 void open();
132
133 // The sum_xxx_rates() functions sum over all connection rates of pertinent
134 // types. In the case of distributed wells this involves an MPI
135 // communication.
136 Scalar sum_solvent_rates() const;
137 Scalar sum_polymer_rates() const;
138 Scalar sum_brine_rates() const;
139
140 Scalar sum_filtrate_rate() const;
141 Scalar sum_filtrate_total() const;
142
143private:
144 Scalar sum_connection_rates(const std::vector<Scalar>& connection_rates) const;
145};
146
147}
148
149#endif
Class encapsulating some information about parallel wells.
Definition: ParallelWellInfo.hpp:184
Definition: PerfData.hpp:33
Definition: SegmentState.hpp:34
Definition: SingleWellState.hpp:41
void updateStatus(WellStatus status)
Scalar sum_polymer_rates() const
std::vector< Scalar > surface_rates
Definition: SingleWellState.hpp:106
PhaseUsage pu
Definition: SingleWellState.hpp:86
Scalar sum_filtrate_total() const
SingleWellState(const std::string &name, const ParallelWellInfo &pinfo, bool is_producer, Scalar presssure_first_connection, const std::vector< PerforationData > &perf_input, const PhaseUsage &pu, Scalar temp)
void reset_connection_factors(const std::vector< PerforationData > &new_perf_data)
std::vector< Scalar > implicit_ipr_b
Definition: SingleWellState.hpp:105
Events events
Definition: SingleWellState.hpp:112
std::vector< Scalar > prev_surface_rates
Definition: SingleWellState.hpp:108
Scalar sum_brine_rates() const
WellInjectorCMode injection_cmode
Definition: SingleWellState.hpp:113
SegmentState< Scalar > segments
Definition: SingleWellState.hpp:111
std::string name
Definition: SingleWellState.hpp:81
void init_timestep(const SingleWellState &other)
WellProducerCMode production_cmode
Definition: SingleWellState.hpp:114
std::vector< Scalar > well_potentials
Definition: SingleWellState.hpp:102
bool trivial_target
Definition: SingleWellState.hpp:110
std::vector< Scalar > implicit_ipr_a
Definition: SingleWellState.hpp:104
Scalar thp
Definition: SingleWellState.hpp:88
bool producer
Definition: SingleWellState.hpp:85
void update_targets(const Well &ecl_well, const SummaryState &st)
void update_injector_targets(const Well &ecl_well, const SummaryState &st)
Scalar filtrate_conc
Definition: SingleWellState.hpp:92
PerfData< Scalar > perf_data
Definition: SingleWellState.hpp:109
Scalar sum_solvent_rates() const
RateIndices
Definition: SingleWellState.hpp:95
@ dissolved_gas_in_water
Definition: SingleWellState.hpp:97
@ vaporized_oil
Definition: SingleWellState.hpp:98
@ dissolved_gas
Definition: SingleWellState.hpp:96
@ vaporized_water
Definition: SingleWellState.hpp:99
static SingleWellState serializationTestObject(const ParallelWellInfo &pinfo)
bool operator==(const SingleWellState &) const
Scalar bhp
Definition: SingleWellState.hpp:87
std::reference_wrapper< const ParallelWellInfo > parallel_info
Definition: SingleWellState.hpp:82
Scalar temperature
Definition: SingleWellState.hpp:89
void update_producer_targets(const Well &ecl_well, const SummaryState &st)
Scalar sum_filtrate_rate() const
WellStatus status
Definition: SingleWellState.hpp:84
std::vector< Scalar > reservoir_rates
Definition: SingleWellState.hpp:107
std::vector< Scalar > productivity_index
Definition: SingleWellState.hpp:103
void serializeOp(Serializer &serializer)
Definition: SingleWellState.hpp:54
std::array< Scalar, 4 > phase_mixing_rates
Definition: SingleWellState.hpp:94
Definition: BlackoilPhases.hpp:27
Definition: BlackoilPhases.hpp:46