Exemplo n.º 1
0
static void ecl_rft_node_init_RFT_cells( ecl_rft_node_type * rft_node , const ecl_file_view_type * rft_view) {
  const ecl_kw_type * conipos     = ecl_file_view_iget_named_kw( rft_view , CONIPOS_KW , 0);
  const ecl_kw_type * conjpos     = ecl_file_view_iget_named_kw( rft_view , CONJPOS_KW , 0);
  const ecl_kw_type * conkpos     = ecl_file_view_iget_named_kw( rft_view , CONKPOS_KW , 0);
  const ecl_kw_type * depth_kw    = ecl_file_view_iget_named_kw( rft_view , DEPTH_KW , 0);
  const ecl_kw_type * swat_kw     = ecl_file_view_iget_named_kw( rft_view , SWAT_KW , 0);
  const ecl_kw_type * sgas_kw     = ecl_file_view_iget_named_kw( rft_view , SGAS_KW , 0);
  const ecl_kw_type * pressure_kw = ecl_rft_node_get_pressure_kw( rft_node , rft_view );

  const float * SW     = ecl_kw_get_float_ptr( swat_kw );
  const float * SG     = ecl_kw_get_float_ptr( sgas_kw );
  const float * P      = ecl_kw_get_float_ptr( pressure_kw );
  const float * depth  = ecl_kw_get_float_ptr( depth_kw );
  const int   * i      = ecl_kw_get_int_ptr( conipos );
  const int   * j      = ecl_kw_get_int_ptr( conjpos );
  const int   * k      = ecl_kw_get_int_ptr( conkpos );

  {
    int c;
    for (c = 0; c < ecl_kw_get_size( conipos ); c++) {
      /* The connection coordinates are shifted -= 1; i.e. all internal usage is offset 0. */
      ecl_rft_cell_type * cell = ecl_rft_cell_alloc_RFT( i[c] - 1 , j[c] - 1 , k[c] - 1 ,
                                                         depth[c] , P[c] , SW[c] , SG[c]);
      ecl_rft_node_append_cell( rft_node , cell );
    }
  }
}
Exemplo n.º 2
0
    ecl_rft_node_type * EclipseWriteRFTHandler::createEclRFTNode(WellConstPtr well,
                                                                  const SimulatorTimerInterface& simulatorTimer,
                                                                  EclipseGridConstPtr eclipseGrid,
                                                                  const std::vector<double>& pressure,
                                                                  const std::vector<double>& swat,
                                                                  const std::vector<double>& sgas) {


        const std::string& well_name      = well->name();
        size_t             timestep       = (size_t)simulatorTimer.currentStepNum();
        time_t             recording_date = simulatorTimer.currentPosixTime();
        double             days           = Opm::unit::convert::to(simulatorTimer.simulationTimeElapsed(), Opm::unit::day);

        std::string type = "RFT";
        ecl_rft_node_type * ecl_rft_node = ecl_rft_node_alloc_new(well_name.c_str(), type.c_str(), recording_date, days);

        CompletionSetConstPtr completionsSet = well->getCompletions(timestep);
        for (size_t index = 0; index < completionsSet->size(); ++index) {
            CompletionConstPtr completion = completionsSet->get(index);
            size_t i = (size_t)completion->getI();
            size_t j = (size_t)completion->getJ();
            size_t k = (size_t)completion->getK();

            size_t global_index = eclipseGrid->getGlobalIndex(i,j,k);
            int active_index = globalToActiveIndex_[global_index];

            if (active_index > -1) {
                double depth = eclipseGrid->getCellDepth(i,j,k);
                double completion_pressure = pressure.size() > 0 ? pressure[active_index] : 0.0;
                double saturation_water    = swat.size() > 0 ? swat[active_index] : 0.0;
                double saturation_gas      = sgas.size() > 0 ? sgas[active_index] : 0.0;

                ecl_rft_cell_type * ecl_rft_cell = ecl_rft_cell_alloc_RFT( i ,j, k , depth, completion_pressure, saturation_water, saturation_gas);
                ecl_rft_node_append_cell( ecl_rft_node , ecl_rft_cell);
            }
        }

        return ecl_rft_node;
    }