opm-common
Loading...
Searching...
No Matches
ScheduleDeck.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#ifndef SCHEDULE_DECK_HPP
20#define SCHEDULE_DECK_HPP
21
22#include <opm/common/OpmLog/KeywordLocation.hpp>
23#include <opm/common/utility/TimeService.hpp>
24
25#include <opm/input/eclipse/Deck/DeckKeyword.hpp>
26
27#include <opm/input/eclipse/Schedule/ScheduleBlock.hpp>
28
29#include <cstddef>
30#include <iosfwd>
31#include <vector>
32
33namespace Opm {
34
36
37 class Deck;
38 class DeckOutput;
40 class Runspec;
41 class UnitSystem;
42
43} // namespace Opm
44
45namespace Opm {
46
56 {
57 public:
63
74 explicit ScheduleDeck(const time_point& start_time,
75 const Deck& deck,
76 const ScheduleRestartInfo& rst_info);
77
87 ScheduleBlock& mutableKeywordBlock(const std::size_t index);
88
97 const ScheduleBlock& operator[](const std::size_t index) const;
98
103 auto begin() const { return this->m_blocks.begin(); }
104
109 auto end() const { return this->m_blocks.end(); }
110
112 auto size() const { return this->m_blocks.size(); }
113
115 std::size_t restart_offset() const;
116
118 const KeywordLocation& location() const;
119
126 double seconds(std::size_t timeStep) const;
127
135 bool operator==(const ScheduleDeck& other) const;
136
139
145 template<class Serializer>
146 void serializeOp(Serializer& serializer)
147 {
148 serializer(m_restart_time);
149 serializer(m_restart_offset);
150 serializer(skiprest);
151 serializer(m_blocks);
152 serializer(m_location);
153 }
154
163 void dump_deck(std::ostream& os, const UnitSystem& usys) const;
164
172 void clearKeywords(const std::size_t idx);
173
174 private:
176 time_point m_restart_time{};
177
179 std::size_t m_restart_offset{};
180
182 bool skiprest{false};
183
185 KeywordLocation m_location{};
186
190 std::vector<ScheduleBlock> m_blocks{};
191
202 void handleDATES(const DeckKeyword& keyword,
203 const std::time_t restart_time,
204 ScheduleDeckContext& context);
205
217 void add_block(ScheduleTimeType time_type,
218 const time_point& t,
219 const KeywordLocation& location,
220 ScheduleDeckContext& context);
221
229 void add_TSTEP(const DeckKeyword& TSTEPKeyword,
230 ScheduleDeckContext& context);
231 };
232}
233
234#endif
Definition DeckOutput.hpp:29
Definition Deck.hpp:46
Definition KeywordLocation.hpp:27
Definition Runspec.hpp:608
Definition ScheduleBlock.hpp:52
All SCHEDULE section keywords in a simulation run.
Definition ScheduleDeck.hpp:56
double seconds(std::size_t timeStep) const
Simulated time, in seconds, since start of simulation.
Definition ScheduleDeck.cpp:240
const ScheduleBlock & operator[](const std::size_t index) const
Model input associated to a single report step.
Definition ScheduleDeck.cpp:271
void dump_deck(std::ostream &os, const UnitSystem &usys) const
Write schedule section keywords to output stream.
Definition ScheduleDeck.cpp:297
auto size() const
Number of report steps in SCHEDULE section.
Definition ScheduleDeck.hpp:112
bool operator==(const ScheduleDeck &other) const
Equality predicate.
Definition ScheduleDeck.cpp:276
ScheduleDeck()
Default constructor.
Definition ScheduleDeck.cpp:260
ScheduleBlock & mutableKeywordBlock(const std::size_t index)
Model input associated to a single report step.
Definition ScheduleDeck.cpp:266
void clearKeywords(const std::size_t idx)
Discard input keywords for a single report step.
Definition ScheduleDeck.cpp:310
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition ScheduleDeck.hpp:146
static ScheduleDeck serializationTestObject()
Create a serialisation test object.
Definition ScheduleDeck.cpp:284
std::size_t restart_offset() const
Report step index of restarted simulation's restart step.
Definition ScheduleDeck.cpp:66
auto end() const
One past the end of report step sequence.
Definition ScheduleDeck.hpp:109
const KeywordLocation & location() const
Location of simulation run's SCHEDULE section keyword.
Definition ScheduleDeck.cpp:61
auto begin() const
Start of report step sequence.
Definition ScheduleDeck.hpp:103
Class for (de-)serializing.
Definition Serializer.hpp:94
Definition UnitSystem.hpp:34
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition ScheduleDeck.cpp:51
Definition ScheduleRestartInfo.hpp:31