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/EclipseGrid.hpp>
31 #include <opm/input/eclipse/EclipseState/Grid/NNC.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 namespace Opm { namespace out {
39  class Summary;
40 }} // namespace Opm::out
41 
42 namespace Opm {
43 
44 class EclipseState;
45 class Schedule;
46 class SummaryConfig;
47 class SummaryState;
48 class UDQState;
49 class WellTestState;
50 namespace Action { class State; }
55 class EclipseIO {
56 public:
61  EclipseIO( const EclipseState& es,
62  EclipseGrid grid,
63  const Schedule& schedule,
64  const SummaryConfig& summary_config,
65  const std::string& basename = "",
66  const bool writeEsmry = false
67  );
68 
69 
70 
71 
119  void writeInitial( data::Solution simProps = data::Solution(), std::map<std::string, std::vector<int> > int_data = {}, const std::vector<NNCdata>& nnc = {});
120 
129  void overwriteInitialOIP( const data::Solution& simProps );
130 
182  void writeTimeStep( const Action::State& action_state,
183  const WellTestState& wtest_state,
184  const SummaryState& st,
185  const UDQState& udq_state,
186  int report_step,
187  bool isSubstep,
188  double seconds_elapsed,
189  RestartValue value,
190  const bool write_double = false);
191 
192 
193  /*
194  Will load solution data and wellstate from the restart
195  file. This method will consult the IOConfig object to get
196  filename and report step to restart from.
197 
198  The map keys should be a map of keyword names and their
199  corresponding dimension object, i.e. to load the state from a
200  simple two phase simulation you would pass:
201 
202  keys = {{"PRESSURE" , UnitSystem::measure::pressure},
203  {"SWAT" , UnitSystem::measure::identity }}
204 
205  For a three phase black oil simulation you would add pairs for
206  SGAS, RS and RV. If you ask for keys which are not found in the
207  restart file an exception will be raised, the happens if the
208  size of a vector is wrong.
209 
210  The function will consult the InitConfig object in the
211  EclipseState object to determine which file and report step to
212  load.
213 
214  The return value is of type 'data::Solution', which is the same
215  container type which is used by the EclipseIO, but observe
216  that the dim and target elements carry no information:
217 
218  - The returned double data has been converted to SI.
219  . The target is unconditionally set to 'RESTART_SOLUTION'
220 
221  The extra_keys argument can be used to request additional
222  kewyords from the restart value. The extra vectors will be
223  stored in the 'extra' field of the RestartValue return
224  value. These values must have been added to the restart file
225  previosuly with the extra argument to the writeTimeStep()
226  method. If the bool value in the map is true the value is
227  required, and the output layer will throw an exception if it is
228  missing, if the bool is false missing keywords will be ignored
229  (there will *not* be an empty vector in the return value).
230  */
231  RestartValue loadRestart(Action::State& action_state, SummaryState& summary_state, const std::vector<RestartKey>& solution_keys, const std::vector<RestartKey>& extra_keys = {}) const;
232  const out::Summary& summary();
233 
234  EclipseIO( const EclipseIO& ) = delete;
235  ~EclipseIO();
236 
237 private:
238  class Impl;
239  std::unique_ptr< Impl > impl;
240 };
241 
242 } // namespace Opm
243 
244 
245 #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:55
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:69
Definition: Schedule.hpp:145
Definition: SummaryConfig.hpp:132
Definition: SummaryState.hpp:69
Definition: UDQState.hpp:36
Definition: WellTestState.hpp:62
Definition: Solution.hpp:32
Definition: Summary.hpp:54
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29