BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck, Opm::EclipseStateConstPtr eclState, const UnstructuredGrid& grid, const parameter::ParameterGroup& param, bool init_rock) { std::vector<int> compressedToCartesianIdx = compressedToCartesian(grid.number_of_cells, grid.global_cell); auto materialLawManager = std::make_shared<MaterialLawManager>(); materialLawManager->initFromDeck(deck, eclState, compressedToCartesianIdx); init(deck, eclState, materialLawManager, grid.number_of_cells, grid.global_cell, grid.cartdims, param, init_rock); }
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck, Opm::EclipseStateConstPtr eclState, int number_of_cells, const int* global_cell, const int* cart_dims, bool init_rock) { std::vector<int> compressedToCartesianIdx = compressedToCartesian(number_of_cells, global_cell); auto materialLawManager = std::make_shared<MaterialLawManager>(); materialLawManager->initFromDeck(deck, eclState, compressedToCartesianIdx); init(deck, eclState, materialLawManager, number_of_cells, global_cell, cart_dims, init_rock); }
void WellsManager::init(const Opm::EclipseStateConstPtr eclipseState, const size_t timeStep, int number_of_cells, const int* global_cell, const int* cart_dims, int dimensions, const C2F& cell_to_faces, FC begin_face_centroids, const double* permeability) { if (dimensions != 3) { OPM_THROW(std::runtime_error, "We cannot initialize wells from a deck unless " "the corresponding grid is 3-dimensional."); } if (eclipseState->getSchedule()->numWells() == 0) { OPM_MESSAGE("No wells specified in Schedule section, " "initializing no wells"); return; } std::map<int,int> cartesian_to_compressed; setupCompressedToCartesian(global_cell, number_of_cells, cartesian_to_compressed); // Obtain phase usage data. PhaseUsage pu = phaseUsageFromDeck(eclipseState); // These data structures will be filled in this constructor, // then used to initialize the Wells struct. std::vector<std::string> well_names; std::vector<WellData> well_data; // For easy lookup: std::map<std::string, int> well_names_to_index; ScheduleConstPtr schedule = eclipseState->getSchedule(); std::vector<WellConstPtr> wells = schedule->getWells(timeStep); std::vector<int> wells_on_proc; well_names.reserve(wells.size()); well_data.reserve(wells.size()); typedef GridPropertyAccess::ArrayPolicy::ExtractFromDeck<double> DoubleArray; typedef GridPropertyAccess::Compressed<DoubleArray, GridPropertyAccess::Tag::NTG> NTGArray; DoubleArray ntg_glob(eclipseState, "NTG", 1.0); NTGArray ntg(ntg_glob, global_cell); EclipseGridConstPtr eclGrid = eclipseState->getEclipseGrid(); // use cell thickness (dz) from eclGrid // dz overwrites values calculated by WellDetails::getCubeDim std::vector<double> dz(number_of_cells); { std::vector<int> gc = compressedToCartesian(number_of_cells, global_cell); for (int cell = 0; cell < number_of_cells; ++cell) { dz[cell] = eclGrid->getCellThicknes(gc[cell]); } } createWellsFromSpecs(wells, timeStep, cell_to_faces, cart_dims, begin_face_centroids, dimensions, dz, well_names, well_data, well_names_to_index, pu, cartesian_to_compressed, permeability, ntg, wells_on_proc); setupWellControls(wells, timeStep, well_names, pu, wells_on_proc); { GroupTreeNodeConstPtr fieldNode = schedule->getGroupTree(timeStep)->getNode("FIELD"); GroupConstPtr fieldGroup = schedule->getGroup(fieldNode->name()); well_collection_.addField(fieldGroup, timeStep, pu); addChildGroups(fieldNode, schedule, timeStep, pu); } for (auto w = wells.begin(), e = wells.end(); w != e; ++w) { well_collection_.addWell(*w, timeStep, pu); } well_collection_.setWellsPointer(w_); well_collection_.applyGroupControls(); setupGuideRates(wells, timeStep, well_data, well_names_to_index); // Debug output. #define EXTRA_OUTPUT #ifdef EXTRA_OUTPUT /* std::cout << "\t WELL DATA" << std::endl; for(int i = 0; i< num_wells; ++i) { std::cout << i << ": " << well_data[i].type << " " << well_data[i].control << " " << well_data[i].target << std::endl; } std::cout << "\n\t PERF DATA" << std::endl; for(int i=0; i< int(wellperf_data.size()); ++i) { for(int j=0; j< int(wellperf_data[i].size()); ++j) { std::cout << i << ": " << wellperf_data[i][j].cell << " " << wellperf_data[i][j].well_index << std::endl; } } */ #endif }