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