miscUtilities.hpp
1 /*
2  Copyright 2012 SINTEF ICT, Applied Mathematics.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef OPM_MISCUTILITIES_HEADER_INCLUDED
21 #define OPM_MISCUTILITIES_HEADER_INCLUDED
22 
23 #include <vector>
24 #include <iosfwd>
25 
26 struct Wells;
27 struct UnstructuredGrid;
28 
29 namespace Opm
30 {
31 
32  class IncompPropertiesInterface;
33  class BlackoilPropertiesInterface;
34  class RockCompressibility;
35 
40  void computePorevolume(const UnstructuredGrid& grid,
41  const double* porosity,
42  std::vector<double>& porevol);
43 
49  template<class T>
50  void computePorevolume(int number_of_cells,
51  T begin_cell_volume,
52  const double* porosity,
53  std::vector<double>& porevol);
54 
61  void computePorevolume(const UnstructuredGrid& grid,
62  const double* porosity,
63  const RockCompressibility& rock_comp,
64  const std::vector<double>& pressure,
65  std::vector<double>& porevol);
66 
74  template<class T>
75  void computePorevolume(int number_of_cells,
76  T begin_cell_volume,
77  const double* porosity,
78  const RockCompressibility& rock_comp,
79  const std::vector<double>& pressure,
80  std::vector<double>& porevol);
81 
88  void computePorosity(const UnstructuredGrid& grid,
89  const double* porosity_standard,
90  const RockCompressibility& rock_comp,
91  const std::vector<double>& pressure,
92  std::vector<double>& porosity);
93 
101  void computeSaturatedVol(const std::vector<double>& pv,
102  const std::vector<double>& s,
103  double* sat_vol);
104 
105 
113  void computeAverageSat(const std::vector<double>& pv,
114  const std::vector<double>& s,
115  double* aver_sat);
116 
117 
130  void computeInjectedProduced(const IncompPropertiesInterface& props,
131  const std::vector<double>& s,
132  const std::vector<double>& src,
133  const double dt,
134  double* injected,
135  double* produced);
136 
142  void computeTotalMobility(const Opm::IncompPropertiesInterface& props,
143  const std::vector<int>& cells,
144  const std::vector<double>& s,
145  std::vector<double>& totmob);
146 
153  void computeTotalMobilityOmega(const Opm::IncompPropertiesInterface& props,
154  const std::vector<int>& cells,
155  const std::vector<double>& s,
156  std::vector<double>& totmob,
157  std::vector<double>& omega);
158 
159 
165  void computePhaseMobilities(const Opm::IncompPropertiesInterface& props,
166  const std::vector<int>& cells,
167  const std::vector<double>& s ,
168  std::vector<double>& pmobc);
169 
170 
176  void computeFractionalFlow(const Opm::IncompPropertiesInterface& props,
177  const std::vector<int>& cells,
178  const std::vector<double>& saturations,
179  std::vector<double>& fractional_flows);
180 
181 
199  void computeTransportSource(const UnstructuredGrid& grid,
200  const std::vector<double>& src,
201  const std::vector<double>& faceflux,
202  const double inflow_frac,
203  const Wells* wells,
204  const std::vector<double>& well_perfrates,
205  std::vector<double>& transport_src);
206 
207 
212  void estimateCellVelocity(const UnstructuredGrid& grid,
213  const std::vector<double>& face_flux,
214  std::vector<double>& cell_velocity);
215 
225  template<class CC, class FC, class FC1, class CV>
226  void estimateCellVelocity(int number_of_cells,
227  int number_of_faces,
228  FC begin_face_centroids,
229  FC1 face_cells,
230  CC begin_cell_centroids,
231  CV begin_cell_volumes,
232  int dimension,
233  const std::vector<double>& face_flux,
234  std::vector<double>& cell_velocity);
235 
238  void toWaterSat(const std::vector<double>& sboth,
239  std::vector<double>& sw);
240 
243  void toBothSat(const std::vector<double>& sw,
244  std::vector<double>& sboth);
245 
249  void wellsToSrc(const Wells& wells, const int num_cells, std::vector<double>& src);
250 
262  void computeWDP(const Wells& wells, const UnstructuredGrid& grid, const std::vector<double>& saturations,
263  const double* densities, const double gravity, const bool per_grid_cell,
264  std::vector<double>& wdp);
265 
278  template<class T>
279  void computeWDP(const Wells& wells, int number_of_cells, T begin_cell_centroids,
280  const std::vector<double>& saturations,
281  const double* densities, const double gravity, const bool per_grid_cell,
282  std::vector<double>& wdp);
283 
289  void computeFlowRatePerWell(const Wells& wells, const std::vector<double>& flow_rates_per_cell,
290  std::vector<double>& flow_rates_per_well);
291 
298  void computePhaseFlowRatesPerWell(const Wells& wells,
299  const std::vector<double>& flow_rates_per_well_cell,
300  const std::vector<double>& fractional_flows,
301  std::vector<double>& phase_flow_per_well);
302 
303 
304 
305 
313  class Watercut
314  {
315  public:
320  void push(double time, double fraction, double produced);
323  void write(std::ostream& os) const;
324  private:
325  std::vector<double> data_;
326  };
327 
328 
329 
330 
345  {
346  public:
354  void push(const IncompPropertiesInterface& props,
355  const Wells& wells,
356  const std::vector<double>& saturation,
357  const double time,
358  const std::vector<double>& well_bhp,
359  const std::vector<double>& well_perfrates);
369  void push(const BlackoilPropertiesInterface& props,
370  const Wells& wells,
371  const std::vector<double>& p,
372  const std::vector<double>& z,
373  const std::vector<double>& s,
374  const double time,
375  const std::vector<double>& well_bhp,
376  const std::vector<double>& well_perfrates);
379  void write(std::ostream& os) const;
380  private:
381  std::vector<std::vector<double> > data_;
382  };
383 
384 } // namespace Opm
385 
386 #include "miscUtilities_impl.hpp"
387 #endif // OPM_MISCUTILITIES_HEADER_INCLUDED
void push(const IncompPropertiesInterface &props, const Wells &wells, const std::vector< double > &saturation, const double time, const std::vector< double > &well_bhp, const std::vector< double > &well_perfrates)
Add a report point.
Definition: miscUtilities.cpp:546
A simple flow reporting utility, encapsulating the watercut curves.
Definition: miscUtilities.hpp:313
void write(std::ostream &os) const
Write report to a stream.
Definition: miscUtilities.cpp:662
Definition: AnisotropicEikonal.cpp:446
Data structure aggregating static information about all wells in a scenario.
Definition: wells.h:50
void write(std::ostream &os) const
Write report to a stream.
Definition: miscUtilities.cpp:535
Abstract base class for blackoil fluid and reservoir properties.
Definition: BlackoilPropertiesInterface.hpp:37
void push(double time, double fraction, double produced)
Add a report point.
Definition: miscUtilities.cpp:528
Well reporting utility.
Definition: miscUtilities.hpp:344
Abstract base class for incompressible fluid and reservoir properties.
Definition: IncompPropertiesInterface.hpp:35