Пример #1
0
 /// Set the first saturation to either its min or max value in
 /// the indicated cells. The second saturation value s2 is set
 /// to (1.0 - s1) for each cell. Any further saturation values
 /// are unchanged.
 void setFirstSat(const std::vector<int>& cells,
                  const Opm::BlackoilPropertiesInterface& props,
                  ExtremalSat es)
 {
     const int n = cells.size();
     std::vector<double> smin(num_phases_*n);
     std::vector<double> smax(num_phases_*n);
     props.satRange(n, &cells[0], &smin[0], &smax[0]);
     const double* svals = (es == MinSat) ? &smin[0] : &smax[0];
     for (int ci = 0; ci < n; ++ci) {
         const int cell = cells[ci];
         sat_[num_phases_*cell] = svals[num_phases_*ci];
         sat_[num_phases_*cell + 1] = 1.0 - sat_[num_phases_*cell];
     }
 }
TransportSolverCompressibleTwophaseReorder::TransportSolverCompressibleTwophaseReorder(
    const UnstructuredGrid& grid,
    const Opm::BlackoilPropertiesInterface& props,
    const double tol,
    const int maxit)
    : grid_(grid),
      props_(props),
      tol_(tol),
      maxit_(maxit),
      darcyflux_(0),
      source_(0),
      dt_(0.0),
      saturation_(grid.number_of_cells, -1.0),
      fractionalflow_(grid.number_of_cells, -1.0),
      gravity_(0),
      mob_(2*grid.number_of_cells, -1.0),
      ia_upw_(grid.number_of_cells + 1, -1),
      ja_upw_(grid.number_of_faces, -1),
      ia_downw_(grid.number_of_cells + 1, -1),
      ja_downw_(grid.number_of_faces, -1)
{
    if (props.numPhases() != 2) {
        OPM_THROW(std::runtime_error, "Property object must have 2 phases");
    }
    int np = props.numPhases();
    int num_cells = props.numCells();
    visc_.resize(np*num_cells);
    A_.resize(np*np*num_cells);
    smin_.resize(np*num_cells);
    smax_.resize(np*num_cells);
    allcells_.resize(num_cells);
    for (int i = 0; i < num_cells; ++i) {
        allcells_[i] = i;
    }
    props.satRange(props.numCells(), &allcells_[0], &smin_[0], &smax_[0]);
}