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
94 void wellSpecification(const std::vector<std::string>& changedWells,
95 const bool changedWellLists,
96 const std::size_t reportStepNum) const;
97
98 void timeStamp(const std::string& lbl,
99 double elapsed,
100 int rstep,
101 boost::posix_time::ptime currentDate) const;
102
103private:
104 struct ConnData
105 {
106 explicit ConnData(const Connection& conn);
107
108 int I, J, K;
109 std::vector<Scalar> data;
110 };
111
112 void beginCumulativeReport_() const;
113 void endCumulativeReport_() const;
114 void outputCumulativeReportRecord_(const std::vector<Scalar>& wellCum,
115 const std::vector<std::string>& wellCumNames,
116 const std::vector<ConnData>& connData) const;
117
118 void outputRegionFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> oip,
119 std::unordered_map<Inplace::Phase, Scalar> cip,
120 const Scalar pav,
121 const std::string& name,
122 const int reg) const;
123
124 void outputResvFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> cipr,
125 const int reg) const;
126
127 void beginInjectionReport_() const;
128 void endInjectionReport_() const;
129 void outputInjectionReportRecord_(const std::vector<Scalar>& wellInj,
130 const std::vector<std::string>& wellInjNames,
131 const std::vector<ConnData>& connData) const;
132
133 void beginMSWReport_() const;
134 void endMSWReport_() const;
135 void outputMSWReportRecord_(const Well& well) const;
136
137 void beginProductionReport_() const;
138 void endProductionReport_() const;
139 void outputProductionReportRecord_(const std::vector<Scalar>& wellProd,
140 const std::vector<std::string>& wellProdNames,
141 const std::vector<ConnData>& connData) const;
142
143 void fipUnitConvert_(std::unordered_map<Inplace::Phase, Scalar>& fip) const;
144 void pressureUnitConvert_(Scalar& pav) const;
145
146 struct WellCumDataType
147 {
148 enum WCId
149 {
150 WellLocationi = 0, // WLi
151 WellLocationj = 1, // WLj
152 OilProd = 2, // OP
153 WaterProd = 3, // WP
154 GasProd = 4, // GP
155 FluidResVolProd = 5, // FRVP
156 OilInj = 6, // OI
157 WaterInj = 7, // WI
158 GasInj = 8, // GI
159 FluidResVolInj = 9, // FRVI
160 WellName = 0, // WName
161 WellType = 1, // WType
162 WellCTRL = 2, // WCTRL
163 };
164 static constexpr int numWCValues = 10;
165 static constexpr int numWCNames = 3;
166 };
167
168 struct WellInjDataType
169 {
170 enum WIId
171 {
172 WellLocationi = 0, // WLi
173 WellLocationj = 1, // WLj
174 OilRate = 2, // OR
175 WaterRate = 3, // WR
176 GasRate = 4, // GR
177 FluidResVol = 5, // FRV
178 BHP = 6, // BHP
179 CPR = 6, // Connection pressure
180 THP = 7, // THP
181 BPR = 7, // Block pressures for connections
182 SteadyStateII = 8, // SteadyStateII
183 WellName = 0, // WName
184 CTRLModeOil = 1, // CTRLo
185 CTRLModeWat = 2, // CTRLw
186 CTRLModeGas = 3, // CTRLg
187 };
188 static constexpr int numWIValues = 9;
189 static constexpr int numWINames = 4;
190 };
191
192 struct WellProdDataType
193 {
194 enum WPId
195 {
196 WellLocationi = 0, // WLi
197 WellLocationj = 1, // WLj
198 OilRate = 2, // OR
199 WaterRate = 3, // WR
200 GasRate = 4, // GR
201 FluidResVol = 5, // FRV
202 WaterCut = 6, // WC
203 GasOilRatio = 7, // GOR
204 WatGasRatio = 8, // WGR
205 BHP = 9, // BHP
206 CPR = 9, // Connection pressure
207 THP = 10, // THP
208 BPR = 10, // Block pressures for connections
209 SteadyStatePI = 11, // SteadyStatePI
210 WellName = 0, // WName
211 CTRLMode = 1, // CTRL
212 };
213
214 static constexpr int numWPValues = 12;
215 static constexpr int numWPNames = 2;
216 };
217
218 const EclipseState& eclState_;
219 const Schedule& schedule_;
220 const SummaryState& summaryState_;
221 std::string flowVersionName_;
222};
223
224} // namespace Opm
225
226#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 bool changedWellLists, 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:35
Definition: blackoilbioeffectsmodules.hh:43
std::string moduleVersionName()