All Classes Functions Variables
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 <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
26 #include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
27 
28 #include <map>
29 #include <string>
30 #include <vector>
31 #include <array>
32 #include <memory>
33 
34 #include <opm/output/data/Cells.hpp>
35 #include <opm/output/data/Solution.hpp>
36 #include <opm/output/data/Wells.hpp>
37 #include <opm/output/eclipse/RestartValue.hpp>
38 
39 namespace Opm {
40 
41 class EclipseState;
42 
47 class EclipseIO {
48 public:
53  EclipseIO( const EclipseState&, EclipseGrid );
54 
55 
56 
57 
105  void writeInitial( data::Solution simProps = data::Solution(), const NNC& nnc = NNC());
106 
115  void overwriteInitialOIP( const data::Solution& simProps );
116 
168  void writeTimeStep( int report_step,
169  bool isSubstep,
170  double seconds_elapsed,
172  data::Wells,
173  std::map<std::string, double> misc_summary_values,
174  std::map<std::string, std::vector<double>> extra_restart = {},
175  bool write_double = false);
176 
177 
178  /*
179  Will load solution data and wellstate from the restart
180  file. This method will consult the IOConfig object to get
181  filename and report step to restart from.
182 
183  The map keys should be a map of keyword names and their
184  corresponding dimension object, i.e. to load the state from a
185  simple two phase simulation you would pass:
186 
187  keys = {{"PRESSURE" , UnitSystem::measure::pressure},
188  {"SWAT" , UnitSystem::measure::identity }}
189 
190  For a three phase black oil simulation you would add pairs for
191  SGAS, RS and RV. If you ask for keys which are not found in the
192  restart file an exception will be raised, the happens if the
193  size of a vector is wrong.
194 
195  The function will consult the InitConfig object in the
196  EclipseState object to determine which file and report step to
197  load.
198 
199  The return value is of type 'data::Solution', which is the same
200  container type which is used by the EclipseIO, but observe
201  that the dim and target elements carry no information:
202 
203  - The returned double data has been converted to SI.
204  . The target is unconditionally set to 'RESTART_SOLUTION'
205 
206  The extra_keys argument can be used to request additional
207  kewyords from the restart value. The extra vectors will be
208  stored in the 'extra' field of the RestartValue return
209  value. These values must have been added to the restart file
210  previosuly with the extra argument to the writeTimeStep()
211  method. If the bool value in the map is true the value is
212  required, and the output layer will throw an exception if it is
213  missing, if the bool is false missing keywords will be ignored
214  (there will *not* be an empty vector in the return value).
215  */
216  RestartValue loadRestart(const std::map<std::string, RestartKey>& keys, const std::map<std::string, bool>& extra_keys = {}) const;
217 
218 
219  EclipseIO( const EclipseIO& ) = delete;
220  ~EclipseIO();
221 
222 private:
223  class Impl;
224  std::unique_ptr< Impl > impl;
225 
226 };
227 
228 } // namespace Opm
229 
230 
231 #endif // OPM_ECLIPSE_WRITER_HPP
Definition: Solution.hpp:32
EclipseIO(const EclipseState &, EclipseGrid)
Sets the common attributes required to write eclipse binary files using ERT.
Definition: EclipseIO.cpp:484
A class to write the reservoir state and the well state of a blackoil simulation to disk using the Ec...
Definition: EclipseIO.hpp:47
void overwriteInitialOIP(const data::Solution &simProps)
Overwrite the initial OIP values.
Definition: EclipseIO.cpp:387
void writeTimeStep(int report_step, bool isSubstep, double seconds_elapsed, data::Solution, data::Wells, std::map< std::string, double > misc_summary_values, std::map< std::string, std::vector< double >> extra_restart={}, bool write_double=false)
Write a reservoir state and summary information to disk.
Definition: EclipseIO.cpp:393
Definition: RestartValue.hpp:70
Definition: EclipseIO.cpp:192
void writeInitial(data::Solution simProps=data::Solution(), const NNC &nnc=NNC())
Output static properties in EGRID and INIT file.
Definition: EclipseIO.cpp:367
Definition: Wells.hpp:109