My Project
EclipseIO.hpp
1/*
2 Copyright (c) 2013 Andreas Lauser
3 Copyright (c) 2013 Uni Research AS
4 Copyright (c) 2014 IRIS AS
5
6 This file is part of the Open Porous Media project (OPM).
7
8 OPM is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 OPM is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with OPM. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#ifndef OPM_ECLIPSE_WRITER_HPP
23#define OPM_ECLIPSE_WRITER_HPP
24
25#include <map>
26#include <memory>
27#include <string>
28#include <vector>
29
30#include <opm/input/eclipse/EclipseState/Grid/NNC.hpp>
31
32#include <opm/output/data/Cells.hpp>
33#include <opm/output/data/Solution.hpp>
34#include <opm/output/data/Wells.hpp>
35
36namespace Opm { namespace out {
37 class Summary;
38}} // namespace Opm::out
39
40namespace Opm {
41
42class EclipseGrid;
43class EclipseState;
44class RestartKey;
45class RestartValue;
46class Schedule;
47class SummaryConfig;
48class SummaryState;
49class UDQState;
50class WellTestState;
51namespace Action { class State; }
56class EclipseIO {
57public:
63 EclipseGrid grid,
64 const Schedule& schedule,
65 const SummaryConfig& summary_config,
66 const std::string& basename = "",
67 const bool writeEsmry = false
68 );
69
70
71
72
120 void writeInitial( data::Solution simProps = data::Solution(), std::map<std::string, std::vector<int> > int_data = {}, const std::vector<NNCdata>& nnc = {});
121
130 void overwriteInitialOIP( const data::Solution& simProps );
131
183 void writeTimeStep( const Action::State& action_state,
184 const WellTestState& wtest_state,
185 const SummaryState& st,
186 const UDQState& udq_state,
187 int report_step,
188 bool isSubstep,
189 double seconds_elapsed,
190 RestartValue value,
191 const bool write_double = false);
192
193
194 /*
195 Will load solution data and wellstate from the restart
196 file. This method will consult the IOConfig object to get
197 filename and report step to restart from.
198
199 The map keys should be a map of keyword names and their
200 corresponding dimension object, i.e. to load the state from a
201 simple two phase simulation you would pass:
202
203 keys = {{"PRESSURE" , UnitSystem::measure::pressure},
204 {"SWAT" , UnitSystem::measure::identity }}
205
206 For a three phase black oil simulation you would add pairs for
207 SGAS, RS and RV. If you ask for keys which are not found in the
208 restart file an exception will be raised, the happens if the
209 size of a vector is wrong.
210
211 The function will consult the InitConfig object in the
212 EclipseState object to determine which file and report step to
213 load.
214
215 The return value is of type 'data::Solution', which is the same
216 container type which is used by the EclipseIO, but observe
217 that the dim and target elements carry no information:
218
219 - The returned double data has been converted to SI.
220 . The target is unconditionally set to 'RESTART_SOLUTION'
221
222 The extra_keys argument can be used to request additional
223 kewyords from the restart value. The extra vectors will be
224 stored in the 'extra' field of the RestartValue return
225 value. These values must have been added to the restart file
226 previosuly with the extra argument to the writeTimeStep()
227 method. If the bool value in the map is true the value is
228 required, and the output layer will throw an exception if it is
229 missing, if the bool is false missing keywords will be ignored
230 (there will *not* be an empty vector in the return value).
231 */
232 RestartValue loadRestart(Action::State& action_state, SummaryState& summary_state, const std::vector<RestartKey>& solution_keys, const std::vector<RestartKey>& extra_keys = {}) const;
233 const out::Summary& summary();
234
235 EclipseIO( const EclipseIO& ) = delete;
236 ~EclipseIO();
237
238private:
239 class Impl;
240 std::unique_ptr< Impl > impl;
241};
242
243} // namespace Opm
244
245
246#endif // OPM_ECLIPSE_WRITER_HPP
Definition: State.hpp:40
About cell information and dimension: The actual grid information is held in a pointer to an ERT ecl_...
Definition: EclipseGrid.hpp:54
A class to write the reservoir state and the well state of a blackoil simulation to disk using the Ec...
Definition: EclipseIO.hpp:56
void overwriteInitialOIP(const data::Solution &simProps)
Overwrite the initial OIP values.
void writeInitial(data::Solution simProps=data::Solution(), std::map< std::string, std::vector< int > > int_data={}, const std::vector< NNCdata > &nnc={})
Output static properties in EGRID and INIT file.
void writeTimeStep(const Action::State &action_state, const WellTestState &wtest_state, const SummaryState &st, const UDQState &udq_state, int report_step, bool isSubstep, double seconds_elapsed, RestartValue value, const bool write_double=false)
Write a reservoir state and summary information to disk.
EclipseIO(const EclipseState &es, EclipseGrid grid, const Schedule &schedule, const SummaryConfig &summary_config, const std::string &basename="", const bool writeEsmry=false)
Sets the common attributes required to write eclipse binary files using ERT.
Definition: EclipseState.hpp:55
Definition: RestartValue.hpp:74
Definition: Schedule.hpp:130
Definition: SummaryConfig.hpp:132
Definition: SummaryState.hpp:68
Definition: UDQState.hpp:38
Definition: WellTestState.hpp:60
Definition: Solution.hpp:35
Definition: Summary.hpp:54
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30