Events.hpp
Go to the documentation of this file.
1/*
2 Copyright 2015 Statoil 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#ifndef SCHEDULE_EVENTS_HPP
20#define SCHEDULE_EVENTS_HPP
21
22#include <cstdint>
23
25
26namespace Opm
27{
28 namespace ScheduleEvents {
29 // These values are used as bitmask - 2^n structure is essential.
30 enum Events {
31 /*
32 The NEW_WELL event is triggered by the WELSPECS
33 keyword. For wells the event is triggered the first
34 time the well is mentioned in the WELSPECS keyword, for
35 the Schedule object the NEW_WELL event is triggered
36 every time a WELSPECS keyword is encountered.
37 */
39
40 /*
41 WHen the well data is updated with the WELSPECS keyword
42 this event is triggered. Only applies to individual
43 wells, and not the global Schedule object.
44 */
46
47
48 //WELL_POLYMER_UPDATE = 4,
49 /*
50 The NEW_GROUP event is triggered by the WELSPECS and
51 GRUPTREE keywords.
52 */
54
55 /*
56 The PRODUCTION_UPDATE event is triggered by the
57 WCONPROD and WCONHIST keywords. The event will be
58 triggered if *any* of the elements in one of keywords
59 is changed. Quite simlar for INJECTION_UPDATE and
60 POLYMER_UPDATE.
61 */
64 //POLYMER_UPDATES = 64,
65
66 /*
67 This event is triggered if the well status is changed
68 between {OPEN,SHUT,STOP,AUTO}. There are many keywords
69 which can trigger a well status change.
70 */
72
73 /*
74 COMPDAT and WELOPEN
75 */
77
78 /*
79 The well group topolyg has changed.
80 */
82
83
84 /*
85 Geology modifier.
86 */
88
89 /*
90 TUNING has changed
91 */
93
94 /* The VFP tables have changed */
97
98
99 /*
100 GROUP production or injection targets has changed
101 */
104 };
105 }
106
107 /*
108 This class implements a simple system for recording when various
109 events happen in the Schedule file. The purpose of the class is
110 that downstream code can query this system whether a certain a
111 event has taken place, and then perform potentially expensive
112 calculations conditionally:
113
114 auto events = schedule->getEvents();
115 if (events.hasEvent(SchedulEvents::NEW_WELL , reportStep))
116 // Perform expensive calculation which must be performed
117 // when a new well is introduced.
118 ...
119
120 */
121
122 class Events {
123 public:
124 Events() = default;
125 explicit Events(const TimeMap& timeMap);
126
128
129 void addEvent(ScheduleEvents::Events event, size_t reportStep);
130 bool hasEvent(uint64_t eventMask, size_t reportStep) const;
131
132 bool operator==(const Events& data) const;
133
134 template<class Serializer>
135 void serializeOp(Serializer& serializer)
136 {
137 m_events.template serializeOp<Serializer,false>(serializer);
138 }
139
140 private:
142 };
143}
144
145#endif
Definition: Events.hpp:122
Events(const TimeMap &timeMap)
static Events serializeObject()
bool operator==(const Events &data) const
bool hasEvent(uint64_t eventMask, size_t reportStep) const
Events()=default
void addEvent(ScheduleEvents::Events event, size_t reportStep)
void serializeOp(Serializer &serializer)
Definition: Events.hpp:135
Definition: Serializer.hpp:38
Definition: TimeMap.hpp:40
Events
Definition: Events.hpp:30
@ COMPLETION_CHANGE
Definition: Events.hpp:76
@ GROUP_INJECTION_UPDATE
Definition: Events.hpp:103
@ WELL_STATUS_CHANGE
Definition: Events.hpp:71
@ VFPINJ_UPDATE
Definition: Events.hpp:95
@ PRODUCTION_UPDATE
Definition: Events.hpp:62
@ VFPPROD_UPDATE
Definition: Events.hpp:96
@ NEW_GROUP
Definition: Events.hpp:53
@ WELL_WELSPECS_UPDATE
Definition: Events.hpp:45
@ GEO_MODIFIER
Definition: Events.hpp:87
@ TUNING_CHANGE
Definition: Events.hpp:92
@ NEW_WELL
Definition: Events.hpp:38
@ INJECTION_UPDATE
Definition: Events.hpp:63
@ GROUP_CHANGE
Definition: Events.hpp:81
@ GROUP_PRODUCTION_UPDATE
Definition: Events.hpp:102
Definition: A.hpp:4
static std::string data()
Definition: exprtk.hpp:40022