Ejemplo n.º 1
0
 void IOConfig::initFirstOutput(const Schedule& schedule) {
     m_first_restart_step = -1;
     m_first_rft_step = -1;
     assertTimeMap( schedule.getTimeMap() );
     {
         size_t report_step = 0;
         while (true) {
             if (getWriteRestartFile(report_step)) {
                 m_first_restart_step = report_step;
                 break;
             }
             report_step++;
             if (report_step == m_timemap->size())
                 break;
         }
     }
     {
         for (const auto& well : schedule.getWells( )) {
             int well_output = well->firstRFTOutput();
             if (well_output >= 0) {
                 if ((m_first_rft_step < 0) || (well_output < m_first_rft_step))
                     m_first_rft_step = well_output;
             }
         }
     }
 }
Ejemplo n.º 2
0
    void IOConfig::initFirstRFTOutput(const Schedule& schedule) {
        m_first_rft_step = -1;

        for (const auto& well : schedule.getWells( )) {
            int well_output = well->firstRFTOutput();
            if (well_output >= 0) {
                if ((m_first_rft_step < 0) || (well_output < m_first_rft_step))
                    m_first_rft_step = well_output;
            }
        }
    }
Ejemplo n.º 3
0
void verifyWellState(const std::string& rst_filename,
                     const EclipseGrid& ecl_grid,
                     const Schedule& schedule) {

  well_info_type* well_info = well_info_alloc(ecl_grid.c_ptr());
  well_info_load_rstfile(well_info, rst_filename.c_str(), false);

  //Verify numwells
  int numwells = well_info_get_num_wells(well_info);
  BOOST_CHECK_EQUAL( numwells, schedule.numWells() );

  auto wells = schedule.getWells();

  for (int i = 0; i < numwells; ++i) {

    //Verify wellnames
    const char * wellname = well_info_iget_well_name(well_info, i);
    auto* well = wells.at(i);
    BOOST_CHECK_EQUAL( wellname, well->name() );

    // Verify well-head position data
    well_ts_type* well_ts = well_info_get_ts(well_info , wellname);
    well_state_type* well_state = well_ts_iget_state(well_ts, 0);
    const well_conn_type* well_head = well_state_get_wellhead(well_state, ECL_GRID_GLOBAL_GRID);
    BOOST_CHECK_EQUAL(well_conn_get_i(well_head), well->getHeadI());
    BOOST_CHECK_EQUAL(well_conn_get_j(well_head), well->getHeadJ());

    for (int j = 0; j < well_ts_get_size(well_ts); ++j) {
      well_state = well_ts_iget_state(well_ts, j);

      //Verify welltype
      int well_type = ERT_UNDOCUMENTED_ZERO;
      if( well->isProducer( j ) ) {
          well_type = ERT_PRODUCER;
      }
      else {
          switch( well->getInjectionProperties( j ).injectorType ) {
              case WellInjector::WATER:
                  well_type = ERT_WATER_INJECTOR;
                  break;
              case WellInjector::GAS:
                  well_type = ERT_GAS_INJECTOR;
                  break;
              case WellInjector::OIL:
                  well_type = ERT_OIL_INJECTOR;
                  break;
              default:
                  break;
          }
      }

      int ert_well_type = well_state_get_type( well_state );
      BOOST_CHECK_EQUAL( ert_well_type, well_type );

      //Verify wellstatus
      int ert_well_status = well_state_is_open(well_state) ? 1 : 0;
      int wellstatus = well->getStatus( j ) == WellCommon::OPEN ? 1 : 0;

      BOOST_CHECK_EQUAL(ert_well_status, wellstatus);

      //Verify number of completion connections
      const well_conn_collection_type * well_connections = well_state_get_global_connections( well_state );
      size_t num_wellconnections = well_conn_collection_get_size(well_connections);

      int report_nr = well_state_get_report_nr(well_state);
      const auto& connections_set = well->getConnections((size_t)report_nr);

      BOOST_CHECK_EQUAL(num_wellconnections, connections_set.size());

      //Verify coordinates for each completion connection
      for (size_t k = 0; k < num_wellconnections; ++k) {
          const well_conn_type * well_connection = well_conn_collection_iget_const(well_connections , k);

          const auto& completion = connections_set.get(k);

          BOOST_CHECK_EQUAL(well_conn_get_i(well_connection), completion.getI());
          BOOST_CHECK_EQUAL(well_conn_get_j(well_connection), completion.getJ());
          BOOST_CHECK_EQUAL(well_conn_get_k(well_connection), completion.getK());
      }
    }
  }

  well_info_free(well_info);
}