opm-common
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/input/eclipse/EclipseState/Grid/NNC.hpp>
26 
27 #include <opm/output/data/Solution.hpp>
28 
29 #include <opm/output/eclipse/RestartValue.hpp>
30 #include <opm/output/eclipse/Summary.hpp>
31 
32 #include <cstddef>
33 #include <map>
34 #include <memory>
35 #include <optional>
36 #include <string>
37 #include <vector>
38 
39 namespace Opm {
40 
41 class EclipseGrid;
42 class EclipseState;
43 class RestartKey;
44 class Schedule;
45 class SummaryConfig;
46 class SummaryState;
47 class UDQState;
48 class WellTestState;
49 
50 } // namespace Opm
51 
52 namespace Opm::Action {
53  class State;
54 } // namespace Opm::Action
55 
56 namespace Opm {
57 
59 class EclipseIO
60 {
61 public:
91  EclipseIO(const EclipseState& es,
92  EclipseGrid grid,
93  const Schedule& schedule,
94  const SummaryConfig& summary_config,
95  const std::string& basename = std::string{},
96  const bool writeEsmry = false);
97 
102  EclipseIO(const EclipseIO&) = delete;
103 
108  EclipseIO& operator=(const EclipseIO&) = delete;
109 
113  ~EclipseIO();
114 
159  void writeInitial(data::Solution simProps = data::Solution(),
160  std::map<std::string, std::vector<int>> int_data = {},
161  const std::vector<NNCdata>& nnc = {});
162 
163 
180  void writeInitial(std::vector<data::Solution>,
181  std::map<std::string, std::vector<int>> int_data = {},
182  const std::vector<NNCdata>& nnc = {});
183 
184 
185  void writeInitial(std::vector<data::Solution>,
186  std::map<std::string, std::vector<int>> int_data = {},
187  const NNCCollection& nnc_col = {});
188 
189 
248  void writeTimeStep(const Action::State& action_state,
249  const WellTestState& wtest_state,
250  const SummaryState& st,
251  const UDQState& udq_state,
252  int report_step,
253  bool isSubstep,
254  double seconds_elapsed,
256  const bool write_double = false,
257  std::optional<int> time_step = std::nullopt,
258  const bool isFinalWriteOut = false);
259 
321  void writeTimeStep(const Action::State& action_state,
322  const WellTestState& wtest_state,
323  const SummaryState& st,
324  const UDQState& udq_state,
325  int report_step,
326  bool isSubstep,
327  double seconds_elapsed,
328  std::vector<RestartValue> value,
329  const bool write_double = false,
330  std::optional<int> time_step = std::nullopt,
331  const bool isFinalWriteOut = false);
332 
359 
406  RestartValue loadRestart(Action::State& action_state,
407  SummaryState& summary_state,
408  const std::vector<RestartKey>& solution_keys,
409  const std::vector<RestartKey>& extra_keys = {}) const;
410 
440  data::Solution loadRestartSolution(const std::vector<RestartKey>& solution_keys,
441  const int report_step) const;
442 
449  const out::Summary& summary() const;
450 
457  const SummaryConfig& finalSummaryConfig() const;
458 
459 private:
461  class Impl;
462 
464  std::unique_ptr<Impl> impl;
465 };
466 
467 } // namespace Opm
468 
469 #endif // OPM_ECLIPSE_WRITER_HPP
Definition: Python.hpp:35
Definition: Solution.hpp:34
File I/O management for reservoir description and dynamic results.
Definition: EclipseIO.hpp:59
std::vector< std::pair< std::string, std::vector< std::size_t > >> DynamicConns
Set of well connections that have been created during the simulation run.
Definition: Summary.hpp:185
Definition: Schedule.hpp:102
EclipseIO & operator=(const EclipseIO &)=delete
Deleted assignment operator.
Collection of run&#39;s summary vectors.
Definition: SummaryConfig.hpp:320
EclipseIO(const EclipseState &es, EclipseGrid grid, const Schedule &schedule, const SummaryConfig &summary_config, const std::string &basename=std::string{}, const bool writeEsmry=false)
Constructor.
Definition: EclipseIO.cpp:1132
About cell information and dimension: The actual grid information is held in a pointer to an ERT ecl_...
Definition: EclipseGrid.hpp:63
void writeInitial(data::Solution simProps=data::Solution(), std::map< std::string, std::vector< int >> int_data={}, const std::vector< NNCdata > &nnc={})
Output static properties to EGRID and INIT files.
Definition: EclipseIO.cpp:1151
const SummaryConfig & finalSummaryConfig() const
Access finalised summary configuration object.
Definition: EclipseIO.cpp:1304
Management information about the current run&#39;s ACTION system, especially concerning the number of tim...
Definition: State.hpp:50
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Computational engine for calculating summary vectors (2D curves as a function of time) and writing th...
Definition: Summary.hpp:58
Definition: NNC.hpp:192
Definition: RestartValue.hpp:72
Definition: EclipseState.hpp:66
Definition: UDQState.hpp:39
Internal implementation class for EclipseIO public interface.
Definition: EclipseIO.cpp:132
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, std::optional< int > time_step=std::nullopt, const bool isFinalWriteOut=false)
Write reservoir state and summary information to disk.
Definition: EclipseIO.cpp:1185
Definition: SummaryState.hpp:72
data::Solution loadRestartSolution(const std::vector< RestartKey > &solution_keys, const int report_step) const
Load per-cell solution data from restart file at specific time.
Definition: EclipseIO.cpp:1293
const out::Summary & summary() const
Access internal summary vector calculation engine.
Definition: EclipseIO.cpp:1299
void recordNewDynamicWellConns(const out::Summary::DynamicConns &newConns)
Activate pre-allocated summary vector slots for newly established well connections arising from dynam...
Definition: EclipseIO.cpp:1277
Definition: WellTestState.hpp:65
RestartValue loadRestart(Action::State &action_state, SummaryState &summary_state, const std::vector< RestartKey > &solution_keys, const std::vector< RestartKey > &extra_keys={}) const
Load per-cell solution data and wellstate from restart file.
Definition: EclipseIO.cpp:1283
~EclipseIO()
Destructor.