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 <string>
29#include <unordered_map>
30#include <vector>
31#include <boost/date_time.hpp>
32
33
34namespace Opm {
35
36class EclipseState;
37class Inplace;
38class Schedule;
39class SummaryState;
40
41template<class Scalar>
43public:
44 LogOutputHelper(const EclipseState& eclState,
45 const Schedule& schedule,
46 const SummaryState& st,
47 const std::string& moduleVersionName);
48
50 void cumulative(const std::size_t reportStepNum) const;
51
53 void error(const std::vector<int>& failedCellsPbub,
54 const std::vector<int>& failedCellsPdew) const;
55
57 void fip(const Inplace& inplace,
58 const Inplace& initialInplace,
59 const std::string& name) const;
60
62 void fipResv(const Inplace& inplace, const std::string& name) const;
63
65 void injection(const std::size_t reportStepNum) const;
66
68 void production(const std::size_t reportStepNum) const;
69
70 void timeStamp(const std::string& lbl, double elapsed, int rstep, boost::posix_time::ptime currentDate) const;
71
72private:
73 void beginCumulativeReport_() const;
74 void endCumulativeReport_() const;
75 void outputCumulativeReportRecord_(const std::vector<Scalar>& wellCum,
76 const std::vector<std::string>& wellCumNames) const;
77
78 void outputRegionFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> oip,
79 std::unordered_map<Inplace::Phase, Scalar> cip,
80 const Scalar pav,
81 const std::string& name,
82 const int reg) const;
83
84 void outputResvFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> cipr,
85 const int reg) const;
86
87 void beginInjectionReport_() const;
88 void endInjectionReport_() const;
89 void outputInjectionReportRecord_(const std::vector<Scalar>& wellInj,
90 const std::vector<std::string>& wellInjNames) const;
91
92 void beginProductionReport_() const;
93 void endProductionReport_() const;
94 void outputProductionReportRecord_(const std::vector<Scalar>& wellProd,
95 const std::vector<std::string>& wellProdNames) const;
96
97 void fipUnitConvert_(std::unordered_map<Inplace::Phase, Scalar>& fip) const;
98 void pressureUnitConvert_(Scalar& pav) const;
99
100 struct WellCumDataType
101 {
102 enum WCId
103 {
104 WellLocationi = 0, // WLi
105 WellLocationj = 1, // WLj
106 OilProd = 2, // OP
107 WaterProd = 3, // WP
108 GasProd = 4, // GP
109 FluidResVolProd = 5, // FRVP
110 OilInj = 6, // OI
111 WaterInj = 7, // WI
112 GasInj = 8, // GI
113 FluidResVolInj = 9, // FRVI
114 WellName = 0, // WName
115 WellType = 1, // WType
116 WellCTRL = 2, // WCTRL
117 };
118 static constexpr int numWCValues = 10;
119 static constexpr int numWCNames = 3;
120 };
121
122 struct WellInjDataType
123 {
124 enum WIId
125 {
126 WellLocationi = 0, // WLi
127 WellLocationj = 1, // WLj
128 OilRate = 2, // OR
129 WaterRate = 3, // WR
130 GasRate = 4, // GR
131 FluidResVol = 5, // FRV
132 BHP = 6, // BHP
133 THP = 7, // THP
134 SteadyStateII = 8, // SteadyStateII
135 WellName = 0, // WName
136 CTRLModeOil = 1, // CTRLo
137 CTRLModeWat = 2, // CTRLw
138 CTRLModeGas = 3, // CTRLg
139 };
140 static constexpr int numWIValues = 9;
141 static constexpr int numWINames = 4;
142 };
143
144 struct WellProdDataType
145 {
146 enum WPId
147 {
148 WellLocationi = 0, // WLi
149 WellLocationj = 1, // WLj
150 OilRate = 2, // OR
151 WaterRate = 3, // WR
152 GasRate = 4, // GR
153 FluidResVol = 5, // FRV
154 WaterCut = 6, // WC
155 GasOilRatio = 7, // GOR
156 WatGasRatio = 8, // WGR
157 BHP = 9, // BHP
158 THP = 10, // THP
159 SteadyStatePI = 11, // SteadyStatePI
160 WellName = 0, // WName
161 CTRLMode = 1, // CTRL
162 };
163
164 static constexpr int numWPValues = 12;
165 static constexpr int numWPNames = 2;
166 };
167
168 const EclipseState& eclState_;
169 const Schedule& schedule_;
170 const SummaryState& summaryState_;
171 std::string flowVersionName_;
172};
173
174} // namespace Opm
175
176#endif // LOG_OUTPUT_HELPER_HPP
Definition: LogOutputHelper.hpp:42
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 cumulative(const std::size_t reportStepNum) const
Write cumulative production and injection reports to output.
void production(const std::size_t reportStepNum) const
Write production report to output.
void fipResv(const Inplace &inplace, const std::string &name) const
Write fluid-in-place reservoir reports to output.
LogOutputHelper(const EclipseState &eclState, const Schedule &schedule, const SummaryState &st, const std::string &moduleVersionName)
void injection(const std::size_t reportStepNum) const
Write injection report to output.
Definition: BlackoilPhases.hpp:27
std::string moduleVersionName()