36#ifndef OPENRS_MATCHSATURATEDVOLUMEFUNCTOR_HEADER
37#define OPENRS_MATCHSATURATEDVOLUMEFUNCTOR_HEADER
40#include <boost/bind.hpp>
49 template <
class Gr
idInterface,
class ReservoirProperties>
51 const ReservoirProperties& rp,
52 const std::vector<double>& sat)
54 typedef typename GridInterface::CellIterator CellIter;
55 double pore_vol = 0.0;
57 for (CellIter c = grid.cellbegin(); c != grid.cellend(); ++c) {
58 double cell_pore_vol = c->volume()*rp.porosity(c->index());
59 pore_vol += cell_pore_vol;
60 sat_vol += cell_pore_vol*sat[c->index()];
63 return std::make_pair(pore_vol, sat_vol);
67 template <
class Gr
idInterface,
class ReservoirProperties>
72 const ReservoirProperties& rp,
73 const std::vector<double>& orig_sat,
74 const std::vector<double>& cap_press)
77 cap_press_(cap_press),
80 std::pair<double, double> vols =
poreSatVolumes(grid, rp, orig_sat);
81 orig_satvol_ = vols.second;
82 int num_cells = orig_sat.size();
83 cp_new_.resize(num_cells);
84 sat_.resize(num_cells);
90 std::transform(cap_press_.begin(), cap_press_.end(), cp_new_.begin(),
91 boost::bind(std::plus<double>(), dp, _1));
94 return (vols.second - orig_satvol_)/vols.first;
103 void computeSaturations()
const
105 int num_cells = grid_.numberOfCells();
106 for (
int c = 0; c < num_cells; ++c) {
107 sat_[c] = rp_.saturationFromCapillaryPressure(c, cp_new_[c]);
111 const GridInterface& grid_;
112 const ReservoirProperties& rp_;
113 const std::vector<double>& cap_press_;
115 mutable std::vector<double> cp_new_;
116 mutable std::vector<double> sat_;
Definition: BlackoilFluid.hpp:32
std::pair< double, double > poreSatVolumes(const GridInterface &grid, const ReservoirProperties &rp, const std::vector< double > &sat)
Definition: MatchSaturatedVolumeFunctor.hpp:50
Definition: MatchSaturatedVolumeFunctor.hpp:69
const std::vector< double > & lastSaturations() const
Definition: MatchSaturatedVolumeFunctor.hpp:97
double operator()(double dp) const
Definition: MatchSaturatedVolumeFunctor.hpp:88
MatchSaturatedVolumeFunctor(const GridInterface &grid, const ReservoirProperties &rp, const std::vector< double > &orig_sat, const std::vector< double > &cap_press)
Definition: MatchSaturatedVolumeFunctor.hpp:71