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