RestartIO.hpp
1 /*
2  Copyright (c) 2016 Statoil ASA
3  Copyright (c) 2013-2015 Andreas Lauser
4  Copyright (c) 2013 SINTEF ICT, Applied Mathematics.
5  Copyright (c) 2013 Uni Research AS
6  Copyright (c) 2015 IRIS AS
7 
8  This file is part of the Open Porous Media project (OPM).
9 
10  OPM is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  OPM is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with OPM. If not, see <http://www.gnu.org/licenses/>.
22 */
23 #ifndef RESTART_IO_HPP
24 #define RESTART_IO_HPP
25 
26 #include <vector>
27 #include <map>
28 
29 #include <opm/parser/eclipse/Units/UnitSystem.hpp>
30 #include <opm/parser/eclipse/EclipseState/Runspec.hpp>
31 #include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
32 
33 #include <opm/output/data/Cells.hpp>
34 #include <opm/output/data/Solution.hpp>
35 #include <opm/output/data/Wells.hpp>
36 #include <opm/output/eclipse/RestartValue.hpp>
37 
38 #include <ert/ecl/EclKW.hpp>
39 #include <ert/ecl/ecl_rsthead.h>
40 #include <ert/ecl/ecl_rst_file.h>
41 #include <ert/util/util.h>
42 
43 namespace Opm {
44 
45 class EclipseGrid;
46 class EclipseState;
47 class Phases;
48 class Schedule;
49 
50 namespace RestartIO {
51 
52 
53 /*
54  The two loose functions RestartIO::save() and RestartIO::load() can
55  be used to save and load reservoir and well state from restart
56  files. Observe that these functions 'just do it', i.e. the checking
57  of which report step to load from, if output is enabled at all and
58  so on is handled by an outer scope.
59 
60  If the filename corresponds to unified eclipse restart file,
61  i.e. UNRST the functions will seek correctly to the correct report
62  step, and truncate in the case of save. For any other filename the
63  functions will start reading and writing from file offset zero. If
64  the input filename does not correspond to a unified restart file
65  there is no consistency checking between filename and report step;
66  i.e. these calls:
67 
68  load("CASE.X0010" , 99 , ...)
69  save("CASE.X0010" , 99 , ...)
70 
71  will read and write to the file "CASE.X0010" - completely ignoring
72  the report step argument '99'.
73 */
74 
75 void save(const std::string& filename,
76  int report_step,
77  double seconds_elapsed,
78  data::Solution cells,
79  data::Wells wells,
80  const EclipseState& es,
81  const EclipseGrid& grid,
82  std::map<std::string, std::vector<double>> extra_data = {},
83  bool write_double = false);
84 
85 
86 RestartValue load( const std::string& filename,
87  int report_step,
88  const std::map<std::string, RestartKey>& keys,
89  const EclipseState& es,
90  const EclipseGrid& grid,
91  const std::map<std::string, bool>& extra_keys = {});
92 
93 }
94 }
95 #endif
Definition: Cells.hpp:28