36#ifndef OPENRS_MATCHSATURATEDVOLUMEFUNCTOR_HEADER
37#define OPENRS_MATCHSATURATEDVOLUMEFUNCTOR_HEADER
48 template <
class Gr
idInterface,
class ReservoirProperties>
50 const ReservoirProperties& rp,
51 const std::vector<double>& sat)
53 typedef typename GridInterface::CellIterator CellIter;
54 double pore_vol = 0.0;
56 for (CellIter c = grid.cellbegin(); c != grid.cellend(); ++c) {
57 double cell_pore_vol = c->volume()*rp.porosity(c->index());
58 pore_vol += cell_pore_vol;
59 sat_vol += cell_pore_vol*sat[c->index()];
62 return std::make_pair(pore_vol, sat_vol);
66 template <
class Gr
idInterface,
class ReservoirProperties>
71 const ReservoirProperties& rp,
72 const std::vector<double>& orig_sat,
73 const std::vector<double>& cap_press)
76 cap_press_(cap_press),
79 std::pair<double, double> vols =
poreSatVolumes(grid, rp, orig_sat);
80 orig_satvol_ = vols.second;
81 int num_cells = orig_sat.size();
82 cp_new_.resize(num_cells);
83 sat_.resize(num_cells);
89 std::transform(cap_press_.begin(), cap_press_.end(), cp_new_.begin(),
90 [dp](
const double& input) { return input + dp; });
93 return (vols.second - orig_satvol_)/vols.first;
102 void computeSaturations()
const
104 int num_cells = grid_.numberOfCells();
105 for (
int c = 0; c < num_cells; ++c) {
106 sat_[c] = rp_.saturationFromCapillaryPressure(c, cp_new_[c]);
110 const GridInterface& grid_;
111 const ReservoirProperties& rp_;
112 const std::vector<double>& cap_press_;
114 mutable std::vector<double> cp_new_;
115 mutable std::vector<double> sat_;
Definition: ImplicitAssembly.hpp:43
std::pair< double, double > poreSatVolumes(const GridInterface &grid, const ReservoirProperties &rp, const std::vector< double > &sat)
Definition: MatchSaturatedVolumeFunctor.hpp:49
Definition: MatchSaturatedVolumeFunctor.hpp:68
const std::vector< double > & lastSaturations() const
Definition: MatchSaturatedVolumeFunctor.hpp:96
double operator()(double dp) const
Definition: MatchSaturatedVolumeFunctor.hpp:87
MatchSaturatedVolumeFunctor(const GridInterface &grid, const ReservoirProperties &rp, const std::vector< double > &orig_sat, const std::vector< double > &cap_press)
Definition: MatchSaturatedVolumeFunctor.hpp:70