miscUtilities.hpp
Go to the documentation of this file.
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 
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 
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 
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 
143  const std::vector<int>& cells,
144  const std::vector<double>& s,
145  std::vector<double>& totmob);
146 
154  const std::vector<int>& cells,
155  const std::vector<double>& s,
156  std::vector<double>& totmob,
157  std::vector<double>& omega);
158 
159 
166  const std::vector<int>& cells,
167  const std::vector<double>& s ,
168  std::vector<double>& pmobc);
169 
170 
177  const std::vector<int>& cells,
178  const std::vector<double>& saturations,
179  std::vector<double>& fractional_flows);
180 
181 
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 
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
Definition: wells.h:50
Definition: IncompPropertiesInterface.hpp:35
void computeWDP(const Wells &wells, const UnstructuredGrid &grid, const std::vector< double > &saturations, const double *densities, const double gravity, const bool per_grid_cell, std::vector< double > &wdp)
Definition: grid.h:98
void toBothSat(const std::vector< double > &sw, std::vector< double > &sboth)
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)
Definition: AnisotropicEikonal.hpp:43
void computeAverageSat(const std::vector< double > &pv, const std::vector< double > &s, double *aver_sat)
Computes average saturations over all grid cells.
void computeFlowRatePerWell(const Wells &wells, const std::vector< double > &flow_rates_per_cell, std::vector< double > &flow_rates_per_well)
void computePhaseMobilities(const Opm::IncompPropertiesInterface &props, const std::vector< int > &cells, const std::vector< double > &s, std::vector< double > &pmobc)
Computes phase mobilities for a set of saturation values.
void write(std::ostream &os) const
void computeTotalMobilityOmega(const Opm::IncompPropertiesInterface &props, const std::vector< int > &cells, const std::vector< double > &s, std::vector< double > &totmob, std::vector< double > &omega)
Computes total mobility and omega for a set of saturation values.
Definition: BlackoilPropertiesInterface.hpp:37
void computeTotalMobility(const Opm::IncompPropertiesInterface &props, const std::vector< int > &cells, const std::vector< double > &s, std::vector< double > &totmob)
Computes total mobility for a set of saturation values.
void wellsToSrc(const Wells &wells, const int num_cells, std::vector< double > &src)
void write(std::ostream &os) const
const double gravity
Definition: Units.hpp:120
void computeFractionalFlow(const Opm::IncompPropertiesInterface &props, const std::vector< int > &cells, const std::vector< double > &saturations, std::vector< double > &fractional_flows)
void estimateCellVelocity(const UnstructuredGrid &grid, const std::vector< double > &face_flux, std::vector< double > &cell_velocity)
Estimates a scalar cell velocity from face fluxes.
void computePhaseFlowRatesPerWell(const Wells &wells, const std::vector< double > &flow_rates_per_well_cell, const std::vector< double > &fractional_flows, std::vector< double > &phase_flow_per_well)
void push(double time, double fraction, double produced)
void computePorosity(const UnstructuredGrid &grid, const double *porosity_standard, const RockCompressibility &rock_comp, const std::vector< double > &pressure, std::vector< double > &porosity)
Computes porosity of all cells in a grid, with rock compressibility effects.
void computeTransportSource(const UnstructuredGrid &grid, const std::vector< double > &src, const std::vector< double > &faceflux, const double inflow_frac, const Wells *wells, const std::vector< double > &well_perfrates, std::vector< double > &transport_src)
const UnstructuredGrid & grid
Definition: ColumnExtract.hpp:31
void toWaterSat(const std::vector< double > &sboth, std::vector< double > &sw)
void computeInjectedProduced(const IncompPropertiesInterface &props, const std::vector< double > &s, const std::vector< double > &src, const double dt, double *injected, double *produced)
Computes injected and produced volumes of all phases. Note 1: assumes that only the first phase is in...
void computeSaturatedVol(const std::vector< double > &pv, const std::vector< double > &s, double *sat_vol)
Computes total saturated volumes over all grid cells.
Definition: miscUtilities.hpp:344
Definition: miscUtilities.hpp:313
void computePorevolume(const UnstructuredGrid &grid, const double *porosity, std::vector< double > &porevol)
Computes pore volume of all cells in a grid.