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
29#include <opm/material/fluidsystems/PhaseUsageInfo.hpp>
30
35
36namespace Opm {
37
38template<class Scalar> struct PerforationData;
39class SummaryState;
40class Well;
41
42template<typename Scalar, typename IndexTraits>
44public:
48
49 SingleWellState(const std::string& name,
50 const ParallelWellInfo<Scalar>& pinfo,
52 bool is_producer,
53 Scalar presssure_first_connection,
54 const std::vector<PerforationData<Scalar>>& perf_input,
55 Scalar temp);
56
58
59 template<class Serializer>
60 void serializeOp(Serializer& serializer)
61 {
62 serializer(name);
63 serializer(status);
64 serializer(producer);
65 serializer(bhp);
66 serializer(thp);
67 serializer(temperature);
68 serializer(energy_rate);
69 serializer(efficiency_scaling_factor);
70 serializer(phase_mixing_rates);
71 serializer(well_potentials);
72 serializer(productivity_index);
73 serializer(implicit_ipr_a);
74 serializer(implicit_ipr_b);
75 serializer(surface_rates);
76 serializer(reservoir_rates);
77 serializer(prev_surface_rates);
78 serializer(trivial_group_target);
79 serializer(segments);
80 serializer(events);
81 serializer(injection_cmode);
82 serializer(production_cmode);
83 serializer(filtrate_conc);
84 serializer(perf_data);
85 serializer(primaryvar);
86 serializer(alq_state);
87 serializer(group_target);
88 }
89
90 bool operator==(const SingleWellState&) const;
91
92 std::string name;
93 std::reference_wrapper<const ParallelWellInfo<Scalar>> parallel_info;
94
95 WellStatus status{WellStatus::OPEN};
98 Scalar bhp{0};
99 Scalar thp{0};
100
101 // thermal related
102 Scalar temperature{0};
103 Scalar energy_rate{0.};
104
106
107 // filtration injection concentration
108 Scalar filtrate_conc{0};
109
110 std::array<Scalar,4> phase_mixing_rates{};
116 };
117
118 std::vector<Scalar> well_potentials;
119 std::vector<Scalar> productivity_index;
120 std::vector<Scalar> implicit_ipr_a;
121 std::vector<Scalar> implicit_ipr_b;
122 std::vector<Scalar> surface_rates;
123 std::vector<Scalar> reservoir_rates;
124 std::vector<Scalar> prev_surface_rates;
127 std::optional<Scalar> group_target;
129 Events events;
130 WellInjectorCMode injection_cmode{WellInjectorCMode::CMODE_UNDEFINED};
131 WellProducerCMode production_cmode{WellProducerCMode::CMODE_UNDEFINED};
132 std::vector<Scalar> primaryvar;
134
141 void reset_connection_factors(const std::vector<PerforationData<Scalar>>& new_perf_data);
142 void update_producer_targets(const Well& ecl_well, const SummaryState& st);
143 void update_injector_targets(const Well& ecl_well, const SummaryState& st);
149 void update_type_and_targets(const Well& ecl_well, const SummaryState& st);
150 bool updateStatus(WellStatus status);
151 void init_timestep(const SingleWellState& other);
152 void shut();
153 void stop();
154 void open();
155
156 // The sum_xxx_rates() functions sum over all connection rates of pertinent
157 // types. In the case of distributed wells this involves an MPI
158 // communication.
159 Scalar sum_solvent_rates() const;
160 Scalar sum_polymer_rates() const;
161 Scalar sum_brine_rates() const;
162 Scalar sum_microbial_rates() const;
163 Scalar sum_oxygen_rates() const;
164 Scalar sum_urea_rates() const;
165 Scalar sum_wat_mass_rates() const;
166
167 Scalar sum_filtrate_rate() const;
168 Scalar sum_filtrate_total() const;
169
170private:
171 Scalar sum_connection_rates(const std::vector<Scalar>& connection_rates) const;
172};
173
174}
175
176#endif
Definition: ALQState.hpp:32
Class encapsulating some information about parallel wells.
Definition: ParallelWellInfo.hpp:198
Definition: PerfData.hpp:34
Definition: GasLiftGroupInfo.hpp:37
Definition: SegmentState.hpp:34
Definition: SingleWellState.hpp:43
WellProducerCMode production_cmode
Definition: SingleWellState.hpp:131
Scalar thp
Definition: SingleWellState.hpp:99
std::vector< Scalar > prev_surface_rates
Definition: SingleWellState.hpp:124
void reset_connection_factors(const std::vector< PerforationData< Scalar > > &new_perf_data)
static SingleWellState serializationTestObject(const ParallelWellInfo< Scalar > &pinfo)
std::array< Scalar, 4 > phase_mixing_rates
Definition: SingleWellState.hpp:110
std::vector< Scalar > surface_rates
Definition: SingleWellState.hpp:122
SingleWellState(const std::string &name, const ParallelWellInfo< Scalar > &pinfo, const PhaseUsageInfo< IndexTraits > &pu, bool is_producer, Scalar presssure_first_connection, const std::vector< PerforationData< Scalar > > &perf_input, Scalar temp)
WellStatus status
Definition: SingleWellState.hpp:95
void init_timestep(const SingleWellState &other)
Scalar sum_solvent_rates() const
Scalar sum_oxygen_rates() const
std::vector< Scalar > productivity_index
Definition: SingleWellState.hpp:119
Scalar bhp
Definition: SingleWellState.hpp:98
std::optional< Scalar > group_target
Definition: SingleWellState.hpp:127
std::reference_wrapper< const ParallelWellInfo< Scalar > > parallel_info
Definition: SingleWellState.hpp:93
void update_injector_targets(const Well &ecl_well, const SummaryState &st)
ALQState< Scalar > alq_state
Definition: SingleWellState.hpp:133
Scalar sum_filtrate_total() const
Scalar sum_microbial_rates() const
std::vector< Scalar > implicit_ipr_a
Definition: SingleWellState.hpp:120
void serializeOp(Serializer &serializer)
Definition: SingleWellState.hpp:60
Scalar sum_filtrate_rate() const
Scalar sum_wat_mass_rates() const
std::vector< Scalar > implicit_ipr_b
Definition: SingleWellState.hpp:121
RateIndices
Definition: SingleWellState.hpp:111
@ vaporized_water
Definition: SingleWellState.hpp:115
@ dissolved_gas_in_water
Definition: SingleWellState.hpp:113
@ dissolved_gas
Definition: SingleWellState.hpp:112
@ vaporized_oil
Definition: SingleWellState.hpp:114
static const int gasPhaseIdx
Definition: SingleWellState.hpp:47
bool operator==(const SingleWellState &) const
std::vector< Scalar > primaryvar
Definition: SingleWellState.hpp:132
Scalar sum_brine_rates() const
SegmentState< Scalar > segments
Definition: SingleWellState.hpp:128
void update_type_and_targets(const Well &ecl_well, const SummaryState &st)
update the type of the well and the targets.
Scalar filtrate_conc
Definition: SingleWellState.hpp:108
std::vector< Scalar > well_potentials
Definition: SingleWellState.hpp:118
Scalar energy_rate
Definition: SingleWellState.hpp:103
bool updateStatus(WellStatus status)
static const int waterPhaseIdx
Definition: SingleWellState.hpp:45
std::string name
Definition: SingleWellState.hpp:92
Scalar sum_polymer_rates() const
Events events
Definition: SingleWellState.hpp:129
Scalar temperature
Definition: SingleWellState.hpp:102
bool trivial_group_target
Definition: SingleWellState.hpp:126
WellInjectorCMode injection_cmode
Definition: SingleWellState.hpp:130
PhaseUsageInfo< IndexTraits > pu
Definition: SingleWellState.hpp:97
bool producer
Definition: SingleWellState.hpp:96
static const int oilPhaseIdx
Definition: SingleWellState.hpp:46
void update_producer_targets(const Well &ecl_well, const SummaryState &st)
Scalar sum_urea_rates() const
Scalar efficiency_scaling_factor
Definition: SingleWellState.hpp:105
PerfData< Scalar > perf_data
Definition: SingleWellState.hpp:125
std::vector< Scalar > reservoir_rates
Definition: SingleWellState.hpp:123
Definition: blackoilbioeffectsmodules.hh:43
Static data associated with a well perforation.
Definition: PerforationData.hpp:30