EclipseWriter.hpp
Go to the documentation of this file.
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 
27 #include <opm/core/wells.h> // WellType
29 
30 #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
31 
32 #include <string>
33 #include <vector>
34 #include <array>
35 #include <memory>
36 
37 struct UnstructuredGrid;
38 
39 namespace Opm {
40 
41 // forward declarations
42 namespace EclipseWriterDetails {
43 class Summary;
44 }
45 
46 class SimulatorState;
47 class WellState;
48 
49 namespace parameter { class ParameterGroup; }
50 
61 {
62 public:
68  Opm::EclipseStateConstPtr eclipseState,
69  const Opm::PhaseUsage &phaseUsage,
70  int numCells,
71  const int* compressedToCartesianCellIdx);
72 
77  virtual ~EclipseWriter ();
78 
82  virtual void writeInit(const SimulatorTimerInterface &timer);
83 
99  virtual void writeTimeStep(const SimulatorTimerInterface& timer,
100  const SimulatorState& reservoirState,
101  const WellState& wellState, bool isSubstep );
102 
103 
104  static int eclipseWellTypeMask(WellType wellType, WellInjector::TypeEnum injectorType);
105  static int eclipseWellStatusMask(WellCommon::StatusEnum wellStatus);
106  static ert_ecl_unit_enum convertUnitTypeErtEclUnitEnum(UnitSystem::UnitType unit);
107 
108 private:
109  Opm::EclipseStateConstPtr eclipseState_;
110  int numCells_;
111  std::array<int, 3> cartesianSize_;
112  const int* compressedToCartesianCellIdx_;
113  std::vector< int > gridToEclipseIdx_;
114  double deckToSiPressure_;
115  double deckToSiTemperatureFactor_;
116  double deckToSiTemperatureOffset_;
117  bool enableOutput_;
118  int writeStepIdx_;
119  int reportStepIdx_;
120  std::string outputDir_;
121  std::string baseName_;
122  PhaseUsage phaseUsage_; // active phases in the input deck
123  std::shared_ptr<EclipseWriterDetails::Summary> summary_;
124 
125  void init(const parameter::ParameterGroup& params);
126 };
127 
128 typedef std::shared_ptr<EclipseWriter> EclipseWriterPtr;
129 typedef std::shared_ptr<const EclipseWriter> EclipseWriterConstPtr;
130 
131 } // namespace Opm
132 
133 
134 #endif // OPM_ECLIPSE_WRITER_HPP
static int eclipseWellStatusMask(WellCommon::StatusEnum wellStatus)
static int eclipseWellTypeMask(WellType wellType, WellInjector::TypeEnum injectorType)
std::shared_ptr< const EclipseWriter > EclipseWriterConstPtr
Definition: EclipseWriter.hpp:129
Definition: grid.h:98
EclipseWriter(const parameter::ParameterGroup &params, Opm::EclipseStateConstPtr eclipseState, const Opm::PhaseUsage &phaseUsage, int numCells, const int *compressedToCartesianCellIdx)
Sets the common attributes required to write eclipse binary files using ERT.
Definition: AnisotropicEikonal.hpp:43
Definition: ParameterGroup.hpp:109
Definition: SimulatorState.hpp:16
int numCells(const UnstructuredGrid &grid)
Get the number of cells of a grid.
std::shared_ptr< EclipseWriter > EclipseWriterPtr
Definition: EclipseWriter.hpp:128
A class to write the reservoir state and the well state of a blackoil simulation to disk using the Ec...
Definition: EclipseWriter.hpp:60
virtual ~EclipseWriter()
Definition: OutputWriter.hpp:61
The state of a set of wells.
Definition: WellState.hpp:36
virtual void writeTimeStep(const SimulatorTimerInterface &timer, const SimulatorState &reservoirState, const WellState &wellState, bool isSubstep)
Write a reservoir state and summary information to disk.
WellType
Definition: wells.h:41
Interface class for SimulatorTimer objects, to be improved.
Definition: SimulatorTimerInterface.hpp:33
virtual void writeInit(const SimulatorTimerInterface &timer)
Definition: BlackoilPhases.hpp:36
static ert_ecl_unit_enum convertUnitTypeErtEclUnitEnum(UnitSystem::UnitType unit)