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>
43public:
44 SingleWellState(const std::string& name,
45 const ParallelWellInfo<Scalar>& pinfo,
46 bool is_producer,
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(efficiency_scaling_factor);
64 serializer(phase_mixing_rates);
65 serializer(well_potentials);
66 serializer(productivity_index);
67 serializer(implicit_ipr_a);
68 serializer(implicit_ipr_b);
69 serializer(surface_rates);
70 serializer(reservoir_rates);
71 serializer(prev_surface_rates);
72 serializer(trivial_group_target);
73 serializer(segments);
74 serializer(events);
75 serializer(injection_cmode);
76 serializer(production_cmode);
77 serializer(filtrate_conc);
78 serializer(perf_data);
79 }
80
81 bool operator==(const SingleWellState&) const;
82
83 std::string name;
84 std::reference_wrapper<const ParallelWellInfo<Scalar>> parallel_info;
85
86 WellStatus status{WellStatus::OPEN};
87 bool producer;
88 PhaseUsage pu;
89 Scalar bhp{0};
90 Scalar thp{0};
91 Scalar temperature{0};
92 Scalar efficiency_scaling_factor{1.0};
93
94 // filtration injection concentration
95 Scalar filtrate_conc{0};
96
97 std::array<Scalar,4> phase_mixing_rates{};
98 enum RateIndices {
99 dissolved_gas = 0,
100 dissolved_gas_in_water = 1,
101 vaporized_oil = 2,
102 vaporized_water = 3
103 };
104
105 std::vector<Scalar> well_potentials;
106 std::vector<Scalar> productivity_index;
107 std::vector<Scalar> implicit_ipr_a;
108 std::vector<Scalar> implicit_ipr_b;
109 std::vector<Scalar> surface_rates;
110 std::vector<Scalar> reservoir_rates;
111 std::vector<Scalar> prev_surface_rates;
112 PerfData<Scalar> perf_data;
113 bool trivial_group_target;
114 SegmentState<Scalar> segments;
115 Events events;
116 WellInjectorCMode injection_cmode{WellInjectorCMode::CMODE_UNDEFINED};
117 WellProducerCMode production_cmode{WellProducerCMode::CMODE_UNDEFINED};
118
119
127 void update_producer_targets(const Well& ecl_well, const SummaryState& st);
128 void update_injector_targets(const Well& ecl_well, const SummaryState& st);
135 void updateStatus(WellStatus status);
136 void init_timestep(const SingleWellState& other);
137 void shut();
138 void stop();
139 void open();
140
141 // The sum_xxx_rates() functions sum over all connection rates of pertinent
142 // types. In the case of distributed wells this involves an MPI
143 // communication.
144 Scalar sum_solvent_rates() const;
145 Scalar sum_polymer_rates() const;
146 Scalar sum_brine_rates() const;
147 Scalar sum_microbial_rates() const;
148 Scalar sum_oxygen_rates() const;
149 Scalar sum_urea_rates() const;
150
151 Scalar sum_filtrate_rate() const;
152 Scalar sum_filtrate_total() const;
153
154private:
155 Scalar sum_connection_rates(const std::vector<Scalar>& connection_rates) const;
156};
157
158}
159
160#endif
Class encapsulating some information about parallel wells.
Definition ParallelWellInfo.hpp:195
Definition PerfData.hpp:34
Definition SegmentState.hpp:34
Definition SingleWellState.hpp:42
bool update_type_and_targets(const Well &ecl_well, const SummaryState &st)
update the type of the well and the targets.
Definition SingleWellState.cpp:345
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
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242
Static data associated with a well perforation.
Definition PerforationData.hpp:30
Definition BlackoilPhases.hpp:46