LogOutputHelper.hpp
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*
4 This file is part of the Open Porous Media project (OPM).
5 OPM is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9 OPM is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with OPM. If not, see <http://www.gnu.org/licenses/>.
15 Consult the COPYING file in the top-level source directory of this
16 module for the precise wording of the license and the list of
17 copyright holders.
18*/
22#ifndef LOG_OUTPUT_HELPER_HPP
23#define LOG_OUTPUT_HELPER_HPP
24
25#include <opm/output/eclipse/Inplace.hpp>
26
27#include <cstddef>
28#include <map>
29#include <string>
30#include <unordered_map>
31#include <vector>
32#include <boost/date_time.hpp>
33
34
35namespace Opm {
36
37class Connection;
38class EclipseState;
39class Inplace;
40class Schedule;
41class SummaryState;
42class Well;
43
44template<class Scalar>
46public:
47 LogOutputHelper(const EclipseState& eclState,
48 const Schedule& schedule,
49 const SummaryState& st,
50 const std::string& moduleVersionName);
51
53 void cumulative(const std::size_t reportStepNum,
54 const bool withConns) const;
55
57 void error(const std::vector<int>& failedCellsPbub,
58 const std::vector<int>& failedCellsPdew) const;
59
61 void fip(const Inplace& inplace,
62 const Inplace& initialInplace,
63 const std::string& name) const;
64
66 void fipResv(const Inplace& inplace, const std::string& name) const;
67
69 void fip_csv(std::ostringstream& ss,const Inplace& inplace, const std::string& name) const;
70
72 void csv_header(std::ostringstream& ss) const;
73
75 void injection(const std::size_t reportStepNum,
76 const std::map<std::pair<std::string,int>, double>& block_pressures) const;
77
79 void msw(const std::size_t reportStepNum) const;
80
82 void production(const std::size_t reportStepNum,
83 const std::map<std::pair<std::string,int>, double>& block_pressures) const;
84
91 void wellSpecification(const std::vector<std::string>& changedWells,
92 const std::size_t reportStepNum) const;
93
94 void timeStamp(const std::string& lbl,
95 double elapsed,
96 int rstep,
97 boost::posix_time::ptime currentDate) const;
98
99private:
100 struct ConnData
101 {
102 ConnData(const Connection& conn);
103
104 int I, J, K;
105 std::vector<Scalar> data;
106 };
107
108 void beginCumulativeReport_() const;
109 void endCumulativeReport_() const;
110 void outputCumulativeReportRecord_(const std::vector<Scalar>& wellCum,
111 const std::vector<std::string>& wellCumNames,
112 const std::vector<ConnData>& connData) const;
113
114 void outputRegionFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> oip,
115 std::unordered_map<Inplace::Phase, Scalar> cip,
116 const Scalar pav,
117 const std::string& name,
118 const int reg) const;
119
120 void outputResvFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> cipr,
121 const int reg) const;
122
123 void beginInjectionReport_() const;
124 void endInjectionReport_() const;
125 void outputInjectionReportRecord_(const std::vector<Scalar>& wellInj,
126 const std::vector<std::string>& wellInjNames,
127 const std::vector<ConnData>& connData) const;
128
129 void beginMSWReport_() const;
130 void endMSWReport_() const;
131 void outputMSWReportRecord_(const Well& well) const;
132
133 void beginProductionReport_() const;
134 void endProductionReport_() const;
135 void outputProductionReportRecord_(const std::vector<Scalar>& wellProd,
136 const std::vector<std::string>& wellProdNames,
137 const std::vector<ConnData>& connData) const;
138
139 void fipUnitConvert_(std::unordered_map<Inplace::Phase, Scalar>& fip) const;
140 void pressureUnitConvert_(Scalar& pav) const;
141
142 struct WellCumDataType
143 {
144 enum WCId
145 {
146 WellLocationi = 0, // WLi
147 WellLocationj = 1, // WLj
148 OilProd = 2, // OP
149 WaterProd = 3, // WP
150 GasProd = 4, // GP
151 FluidResVolProd = 5, // FRVP
152 OilInj = 6, // OI
153 WaterInj = 7, // WI
154 GasInj = 8, // GI
155 FluidResVolInj = 9, // FRVI
156 WellName = 0, // WName
157 WellType = 1, // WType
158 WellCTRL = 2, // WCTRL
159 };
160 static constexpr int numWCValues = 10;
161 static constexpr int numWCNames = 3;
162 };
163
164 struct WellInjDataType
165 {
166 enum WIId
167 {
168 WellLocationi = 0, // WLi
169 WellLocationj = 1, // WLj
170 OilRate = 2, // OR
171 WaterRate = 3, // WR
172 GasRate = 4, // GR
173 FluidResVol = 5, // FRV
174 BHP = 6, // BHP
175 CPR = 6, // Connection pressure
176 THP = 7, // THP
177 BPR = 7, // Block pressures for connections
178 SteadyStateII = 8, // SteadyStateII
179 WellName = 0, // WName
180 CTRLModeOil = 1, // CTRLo
181 CTRLModeWat = 2, // CTRLw
182 CTRLModeGas = 3, // CTRLg
183 };
184 static constexpr int numWIValues = 9;
185 static constexpr int numWINames = 4;
186 };
187
188 struct WellProdDataType
189 {
190 enum WPId
191 {
192 WellLocationi = 0, // WLi
193 WellLocationj = 1, // WLj
194 OilRate = 2, // OR
195 WaterRate = 3, // WR
196 GasRate = 4, // GR
197 FluidResVol = 5, // FRV
198 WaterCut = 6, // WC
199 GasOilRatio = 7, // GOR
200 WatGasRatio = 8, // WGR
201 BHP = 9, // BHP
202 CPR = 9, // Connection pressure
203 THP = 10, // THP
204 BPR = 10, // Block pressures for connections
205 SteadyStatePI = 11, // SteadyStatePI
206 WellName = 0, // WName
207 CTRLMode = 1, // CTRL
208 };
209
210 static constexpr int numWPValues = 12;
211 static constexpr int numWPNames = 2;
212 };
213
214 const EclipseState& eclState_;
215 const Schedule& schedule_;
216 const SummaryState& summaryState_;
217 std::string flowVersionName_;
218};
219
220} // namespace Opm
221
222#endif // LOG_OUTPUT_HELPER_HPP
Definition: LogOutputHelper.hpp:45
void timeStamp(const std::string &lbl, double elapsed, int rstep, boost::posix_time::ptime currentDate) const
void error(const std::vector< int > &failedCellsPbub, const std::vector< int > &failedCellsPdew) const
Write error report to output.
void fip(const Inplace &inplace, const Inplace &initialInplace, const std::string &name) const
Write fluid-in-place reports to output.
void msw(const std::size_t reportStepNum) const
Write msw report to output.
void cumulative(const std::size_t reportStepNum, const bool withConns) const
Write cumulative production and injection reports to output.
void fipResv(const Inplace &inplace, const std::string &name) const
Write fluid-in-place reservoir reports to output.
void injection(const std::size_t reportStepNum, const std::map< std::pair< std::string, int >, double > &block_pressures) const
Write injection report to output.
void fip_csv(std::ostringstream &ss, const Inplace &inplace, const std::string &name) const
Write fluid-in-place reservoir reports to csv file.
LogOutputHelper(const EclipseState &eclState, const Schedule &schedule, const SummaryState &st, const std::string &moduleVersionName)
void wellSpecification(const std::vector< std::string > &changedWells, const std::size_t reportStepNum) const
Write well specification report to output.
void production(const std::size_t reportStepNum, const std::map< std::pair< std::string, int >, double > &block_pressures) const
Write production report to output.
void csv_header(std::ostringstream &ss) const
Write fluid-in-place reservoir reports to csv file.
@ CPR
Definition: Preconditioner.hpp:33
Definition: blackoilboundaryratevector.hh:39
std::string moduleVersionName()