20 #ifndef OPM_WELLSTATE_HEADER_INCLUDED
21 #define OPM_WELLSTATE_HEADER_INCLUDED
47 template <
class State>
58 temperature_.resize(nw, 273.15 + 20);
59 wellrates_.resize(nw * np, 0.0);
60 for (
int w = 0; w < nw; ++w) {
62 const WellControls* ctrl = wells->
ctrls[w];
66 assert( wells->
name[ w ] );
67 std::string name( wells->
name[ w ] );
68 assert( name.size() > 0 );
69 mapentry_t& wellMapEntry = wellMap_[name];
70 wellMapEntry[ 0 ] = w;
74 wellMapEntry[ 2 ] = num_perf_this_well;
80 for (
int p = 0; p < np; ++p) {
81 wellrates_[np*w + p] = 0.0;
90 bhp_[w] = state.pressure()[first_cell];
110 for (
int p = 0; p < np; ++p) {
111 wellrates_[np*w + p] = rate_target * distr[p];
114 const double small_rate = 1e-14;
115 const double sign = (wells->
type[w] ==
INJECTOR) ? 1.0 : -1.0;
116 for (
int p = 0; p < np; ++p) {
117 wellrates_[np*w + p] = small_rate * sign;
130 const double safety_factor = (wells->
type[w] ==
INJECTOR) ? 1.01 : 0.99;
131 bhp_[w] = safety_factor*state.pressure()[first_cell];
153 std::vector<double>&
bhp() {
return bhp_; }
154 const std::vector<double>&
bhp()
const {
return bhp_; }
157 std::vector<double>&
thp() {
return thp_; }
158 const std::vector<double>&
thp()
const {
return thp_; }
162 const std::vector<double>&
temperature()
const {
return temperature_; }
166 const std::vector<double>&
wellRates()
const {
return wellrates_; }
170 const std::vector<double>&
perfRates()
const {
return perfrates_; }
174 const std::vector<double>&
perfPress()
const {
return perfpress_; }
196 const WellMapType&
wellMap()
const {
return wellMap_; }
212 std::vector<double> bhp_;
213 std::vector<double> thp_;
214 std::vector<double> temperature_;
215 std::vector<double> wellrates_;
216 std::vector<double> perfrates_;
217 std::vector<double> perfpress_;
219 WellMapType wellMap_;
224 #endif // OPM_WELLSTATE_HEADER_INCLUDED
int * well_connpos
Definition: wells.h:81
const std::vector< double > & perfPress() const
Definition: WellState.hpp:174
Definition: well_controls.h:38
size_t getRestartTemperatureOffset() const
Definition: WellState.hpp:188
int number_of_wells
Definition: wells.h:52
Definition: AnisotropicEikonal.hpp:43
std::vector< double > & bhp()
One bhp pressure per well.
Definition: WellState.hpp:153
const std::vector< double > & perfRates() const
Definition: WellState.hpp:170
const double * well_controls_get_current_distr(const struct WellControls *ctrl)
const std::vector< double > & bhp() const
Definition: WellState.hpp:154
Definition: well_controls.h:36
std::vector< double > & temperature()
One temperature per well.
Definition: WellState.hpp:161
std::array< int, 3 > mapentry_t
Definition: WellState.hpp:39
int * well_cells
Definition: wells.h:87
int numWells() const
The number of wells present.
Definition: WellState.hpp:200
size_t getRestartWellRatesOffset() const
Definition: WellState.hpp:192
std::vector< double > & perfPress()
One pressure per well connection.
Definition: WellState.hpp:173
const std::vector< double > & wellRates() const
Definition: WellState.hpp:166
int number_of_phases
Definition: wells.h:53
const WellMapType & wellMap() const
Definition: WellState.hpp:196
enum WellType * type
Definition: wells.h:58
char ** name
Definition: wells.h:103
struct WellControls ** ctrls
Definition: wells.h:98
The state of a set of wells.
Definition: WellState.hpp:36
std::map< std::string, mapentry_t > WellMapType
Definition: WellState.hpp:40
std::vector< double > & wellRates()
One rate per well and phase.
Definition: WellState.hpp:165
double well_controls_get_current_target(const struct WellControls *ctrl)
const std::vector< double > & temperature() const
Definition: WellState.hpp:162
bool well_controls_well_is_stopped(const struct WellControls *ctrl)
enum WellControlType well_controls_get_current_type(const struct WellControls *ctrl)
Definition: legacy_well.h:42
size_t getRestartPerfPressOffset() const
Definition: WellState.hpp:180
int numPhases() const
The number of phases present.
Definition: WellState.hpp:206
std::vector< double > & perfRates()
One rate per well connection.
Definition: WellState.hpp:169
size_t getRestartBhpOffset() const
Definition: WellState.hpp:176
void init(const Wells *wells, const State &state)
Definition: WellState.hpp:48
Definition: legacy_well.h:37
size_t getRestartPerfRatesOffset() const
Definition: WellState.hpp:184
Definition: legacy_well.h:37
WellMapType & wellMap()
Definition: WellState.hpp:197
const std::vector< double > & thp() const
Definition: WellState.hpp:158
std::vector< double > & thp()
One thp pressure per well.
Definition: WellState.hpp:157