opm-common
Toggle main menu visibility
Loading...
Searching...
No Matches
IOConfig.hpp
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
20
#ifndef OPM_IO_CONFIG_HPP
21
#define OPM_IO_CONFIG_HPP
22
23
#include <string>
24
25
namespace
Opm
{
26
27
class
Deck
;
28
class
GRIDSection
;
29
class
RUNSPECSection
;
30
31
/*The IOConfig class holds data about input / output configurations
32
33
Amongst these configuration settings, a IOConfig object knows if
34
a restart file should be written for a specific report step
35
36
The write of restart files is governed by several eclipse keywords.
37
These keywords are all described in the eclipse manual, but some
38
of them are rather porly described there.
39
To have equal sets of restart files written from Eclipse and Flow for various
40
configurations, we have made a qualified guess on the behaviour
41
for some of the keywords (by running eclipse for different configurations,
42
and looked at which restart files that have been written).
43
44
45
------ RPTSOL RESTART (solution section) ------
46
If RPTSOL RESTART > 1 initial restart file is written.
47
48
49
------ RPTRST (solution section) ------
50
Eclipse manual states that the initial restart file is to be written
51
if RPTSOL RESTART > 1. But - due to that the initial restart file
52
is written from Eclipse for data where RPTSOL RESTART is not set, - we
53
have made a guess that when RPTRST is set in SOLUTION (no basic though...),
54
it means that the initial restart file should be written.
55
Running of eclipse with different settings have proven this to be a qualified guess.
56
57
58
------ RPTRST BASIC=0 (solution or schedule section) ------
59
No restart files are written
60
61
62
------ RPTRST BASIC=1 or RPTRST BASIC=2 (solution or schedule section) ------
63
Restart files are written for every timestep, from timestep 1 to number of timesteps.
64
(Write of inital timestep is governed by a separate setting)
65
66
Notice! Eclipse simulator RPTRST BASIC=1 writes restart files for every
67
report step, but only keeps the last one written. This functionality is
68
not supported in Flow; so to compare Eclipse results with Flow results
69
for every report step, set RPTRST BASIC=2 for the eclipse run
70
71
72
------ RPTRST BASIC=3 FREQ=n (solution or schedule section) ------
73
Restart files are created every nth report time. Default frequency is 1 (every report step)
74
75
If a frequency higher than 1 is given:
76
start_rs = report step the setting was given.
77
write report step rstep if (rstep >= start_rs) && ((rstep % frequency) == 0).
78
79
80
------ RPTRST BASIC=4 FREQ=n or RPTRST BASIC=5 FREQ=n (solution or schedule section) ------
81
For the settings BASIC 4 or BASIC 5, - first report step of every new year(4) or new month(5),
82
the first report step is compared with report step 0 (start), and then every report step is
83
compared with the previous one to see if year/month has changed.
84
85
This leaves us with a set of timesteps.
86
All timesteps in the set that are higher or equal to the timestep the RPTRST keyword was set on is written.
87
88
If in addition FREQUENCY is given (higher than 1), every n'the value of this set are to be written.
89
90
If the setting BASIC=4 or BASIC=5 is set on a timestep that is a member of the set "first timestep of
91
each year" / "First timestep of each month", then the timestep that is freq-1 timesteps (within the set) from
92
this start timestep will be written, and then every n'the timestep (within the set) from this one will be written.
93
94
If the setting BASIC=4 or BASIC=5 is set on a timestep that is not a member of the list "first timestep of
95
each year" / "First timestep of each month", then the list is searched for the closest timestep that are
96
larger than the timestep that introduced the setting, and then; same as above - the timestep that is freq-1
97
timesteps from this one (within the set) will be written, and then every n'the timestep (within the set) from
98
this one will be written.
99
100
101
------ RPTRST BASIC=6 (solution or schedule section) ------
102
Not supported in Flow
103
104
105
------ Default ------
106
If no keywords for config of writing restart files have been handled; no restart files are written.
107
108
109
ECL compatible restart
110
======================
111
112
Unfortunately flow & eclipse are not compatible across restarts. The
113
RestartIO implementation can write restart files for flow -> flow restart
114
or alternatively for flow -> eclipse restart. This is regulated by the
115
boolean flag ecl_compatible_restart in the IOConfig class. The difference
116
between the two are as follows:
117
118
ecl_compatible_restart = false:
119
120
1. The 'extra' fields in the RestartValue structure are actually
121
written to disk.
122
123
2. You can optionally ask the RestartIO::save() function to save the
124
solution in double precision.
125
126
ecl_compatible_restart = true:
127
128
1. The 'extra' fields in the RestartValue are silently ignored.
129
130
2. If request double precision solution data that is silently ignored,
131
it will be float.
132
133
Observe that the solution data in the RestartValue is passed
134
unconditionally to the solution section in the restart file, so if you
135
pass a field in the solution section which Eclipse does not recognize you
136
will end up with a restart file which Eclipse can not read, even if you
137
have set ecl_compatible_restart to true.
138
*/
139
140
141
142
class
IOConfig
143
{
144
public
:
145
IOConfig() =
default
;
146
explicit
IOConfig(
const
Deck
&);
147
explicit
IOConfig(
const
std::string& input_path);
148
149
static
IOConfig serializationTestObject();
150
151
void
setEclCompatibleRST(
bool
ecl_rst);
152
bool
getEclCompatibleRST()
const
;
153
bool
getWriteEGRIDFile()
const
;
154
bool
getWriteINITFile()
const
;
155
bool
getUNIFOUT()
const
;
156
bool
getUNIFIN()
const
;
157
bool
getFMTIN()
const
;
158
bool
getFMTOUT()
const
;
159
160
bool
writeAllTransMultipliers()
const
161
{
162
return
this->m_write_all_multminus;
163
}
164
165
const
std::string& getEclipseInputPath()
const
;
166
167
void
overrideNOSIM(
bool
nosim);
168
void
consistentFileFlags();
169
170
std::string getRestartFileName(
const
std::string& restart_base,
int
report_step,
bool
output)
const
;
171
172
bool
getOutputEnabled()
const
;
173
void
setOutputEnabled(
bool
enabled);
174
175
const
std::string& getOutputDir()
const
;
176
void
setOutputDir(
const
std::string& outputDir);
177
178
const
std::string& getBaseName()
const
;
179
void
setBaseName(
const
std::string& baseName);
180
183
std::string
fullBasePath
()
const
;
184
185
std::string getInputDir()
const
;
186
187
bool
initOnly()
const
;
188
189
bool
operator==(
const
IOConfig& data)
const
;
190
static
bool
rst_cmp(
const
IOConfig& full_config,
const
IOConfig& rst_config);
191
192
template
<
class
Serializer>
193
void
serializeOp(
Serializer
& serializer)
194
{
195
serializer(m_deck_filename);
196
serializer(m_output_dir);
197
198
serializer(m_write_INIT_file);
199
serializer(m_write_EGRID_file);
200
serializer(m_FMTIN);
201
serializer(m_FMTOUT);
202
serializer(m_nosim);
203
serializer(m_write_all_multminus);
204
205
serializer(m_base_name);
206
serializer(m_UNIFIN);
207
serializer(m_UNIFOUT);
208
209
serializer(m_output_enabled);
210
serializer(ecl_compatible_rst);
211
}
212
213
private
:
214
std::string m_deck_filename{};
215
std::string m_output_dir{};
216
217
bool
m_write_INIT_file {
false
};
218
bool
m_write_EGRID_file {
true
};
219
bool
m_FMTIN {
false
};
220
bool
m_FMTOUT {
false
};
221
bool
m_nosim {
false
};
222
229
bool
m_write_all_multminus {
false
};
230
231
std::string m_base_name{};
232
233
bool
m_UNIFIN {
false
};
234
bool
m_UNIFOUT {
false
};
235
236
bool
m_output_enabled {
true
};
237
bool
ecl_compatible_rst {
true
};
238
239
IOConfig(
const
GRIDSection
&,
240
const
RUNSPECSection
&,
241
bool
nosim,
242
const
std::string& input_path);
243
};
244
245
}
//namespace Opm
246
247
248
249
#endif
Opm::Deck
Definition
Deck.hpp:46
Opm::GRIDSection
Definition
DeckSection.hpp:115
Opm::IOConfig::fullBasePath
std::string fullBasePath() const
Return a string consisting of outputpath and basename; i.e.
Definition
IOConfig.cpp:339
Opm::RUNSPECSection
Definition
DeckSection.hpp:110
Opm::Serializer
Class for (de-)serializing.
Definition
Serializer.hpp:94
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition
Exceptions.hpp:30
opm
input
eclipse
EclipseState
IOConfig
IOConfig.hpp
Generated by
1.17.0