opm-simulators
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/material/fluidsystems/PhaseUsageInfo.hpp>
30
31#include <opm/simulators/wells/SegmentState.hpp>
32#include <opm/simulators/wells/PerfData.hpp>
33#include <opm/simulators/wells/ParallelWellInfo.hpp>
34#include <opm/simulators/wells/ALQState.hpp>
35
36namespace Opm {
37
38template<class Scalar> struct PerforationData;
39class SummaryState;
40class Well;
41
42template<typename Scalar, typename IndexTraits>
43class SingleWellState {
44public:
45 static const int waterPhaseIdx = PhaseUsageInfo<IndexTraits>::waterPhaseIdx;
46 static const int oilPhaseIdx = PhaseUsageInfo<IndexTraits>::oilPhaseIdx;
47 static const int gasPhaseIdx = PhaseUsageInfo<IndexTraits>::gasPhaseIdx;
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
57 static SingleWellState serializationTestObject(const ParallelWellInfo<Scalar>& pinfo);
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(efficiency_scaling_factor);
69 serializer(phase_mixing_rates);
70 serializer(well_potentials);
71 serializer(productivity_index);
72 serializer(implicit_ipr_a);
73 serializer(implicit_ipr_b);
74 serializer(surface_rates);
75 serializer(reservoir_rates);
76 serializer(prev_surface_rates);
77 serializer(trivial_group_target);
78 serializer(segments);
79 serializer(events);
80 serializer(injection_cmode);
81 serializer(production_cmode);
82 serializer(filtrate_conc);
83 serializer(perf_data);
84 serializer(primaryvar);
85 serializer(alq_state);
86 serializer(group_target);
87 }
88
89 bool operator==(const SingleWellState&) const;
90
91 std::string name;
92 std::reference_wrapper<const ParallelWellInfo<Scalar>> parallel_info;
93
94 WellStatus status{WellStatus::OPEN};
95 bool producer;
97 Scalar bhp{0};
98 Scalar thp{0};
99 Scalar temperature{0};
100 Scalar efficiency_scaling_factor{1.0};
101
102 // filtration injection concentration
103 Scalar filtrate_conc{0};
104
105 std::array<Scalar,4> phase_mixing_rates{};
106 enum RateIndices {
107 dissolved_gas = 0,
108 dissolved_gas_in_water = 1,
109 vaporized_oil = 2,
110 vaporized_water = 3
111 };
112
113 std::vector<Scalar> well_potentials;
114 std::vector<Scalar> productivity_index;
115 std::vector<Scalar> implicit_ipr_a;
116 std::vector<Scalar> implicit_ipr_b;
117 std::vector<Scalar> surface_rates;
118 std::vector<Scalar> reservoir_rates;
119 std::vector<Scalar> prev_surface_rates;
120 PerfData<Scalar> perf_data;
121 bool trivial_group_target;
122 std::optional<Scalar> group_target;
123 SegmentState<Scalar> segments;
124 Events events;
125 WellInjectorCMode injection_cmode{WellInjectorCMode::CMODE_UNDEFINED};
126 WellProducerCMode production_cmode{WellProducerCMode::CMODE_UNDEFINED};
127 std::vector<Scalar> primaryvar;
128 ALQState<Scalar> alq_state;
129
136 void reset_connection_factors(const std::vector<PerforationData<Scalar>>& new_perf_data);
137 void update_producer_targets(const Well& ecl_well, const SummaryState& st);
138 void update_injector_targets(const Well& ecl_well, const SummaryState& st);
144 void update_type_and_targets(const Well& ecl_well, const SummaryState& st);
145 bool updateStatus(WellStatus status);
146 void init_timestep(const SingleWellState& other);
147 void shut();
148 void stop();
149 void open();
150
151 // The sum_xxx_rates() functions sum over all connection rates of pertinent
152 // types. In the case of distributed wells this involves an MPI
153 // communication.
154 Scalar sum_solvent_rates() const;
155 Scalar sum_polymer_rates() const;
156 Scalar sum_brine_rates() const;
157 Scalar sum_microbial_rates() const;
158 Scalar sum_oxygen_rates() const;
159 Scalar sum_urea_rates() const;
160 Scalar sum_wat_mass_rates() const;
161
162 Scalar sum_filtrate_rate() const;
163 Scalar sum_filtrate_total() const;
164
165private:
166 Scalar sum_connection_rates(const std::vector<Scalar>& connection_rates) const;
167};
168
169}
170
171#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
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:149
void update_type_and_targets(const Well &ecl_well, const SummaryState &st)
update the type of the well and the targets.
Definition SingleWellState.cpp:357
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
Static data associated with a well perforation.
Definition PerforationData.hpp:30