Inspect keywords during ACTIONX sequence and activate Cells.

This commit is contained in:
Daniel 2021-11-09 15:01:18 +01:00
parent 1d6a930784
commit ff638862d9
2 changed files with 31 additions and 1 deletions

View File

@ -525,6 +525,7 @@ namespace Opm
SimulatorUpdate * sim_update,
const std::unordered_map<std::string, double> * target_wellpi);
void inspect_actionx_keyword(const ScheduleGrid& grid, const DeckKeyword& keyword);
static std::string formatDate(std::time_t t);
std::string simulationDays(std::size_t currentStep) const;

View File

@ -482,8 +482,10 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
if (action_keyword.name() == "ENDACTIO")
break;
if (Action::ActionX::valid_keyword(action_keyword.name()))
if (Action::ActionX::valid_keyword(action_keyword.name())){
action.addKeyword(action_keyword);
this->inspect_actionx_keyword(grid, action_keyword);
}
else {
std::string msg_fmt = "The keyword {keyword} is not supported in the ACTIONX block\n"
"In {file} line {line}.";
@ -523,6 +525,33 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
this->snapshots.back().actions.update( std::move(new_actions) );
}
void Schedule::inspect_actionx_keyword(const ScheduleGrid& grid, const DeckKeyword& keyword){
static std::unordered_set<std::string> keyword_list = {"COMPDAT"};
if(keyword_list.count(keyword.name())){
for (auto record : keyword){
const auto& itemI = record.getItem("I");
const auto& itemJ = record.getItem("J");
bool defaulted_I = itemI.defaultApplied(0) || itemI.get<int>(0) == 0;
bool defaulted_J = itemJ.defaultApplied(0) || itemJ.get<int>(0) == 0;
if (defaulted_I || defaulted_J)
throw std::logic_error(fmt::format("Defaulted grid coordinates not allowed: {}, {}", defaulted_I, defaulted_J));
const int I = itemI.get<int>(0) - 1;
const int J = itemJ.get<int>(0) - 1;
int K1 = record.getItem("K1").get<int>(0) - 1;
int K2 = record.getItem("K2").get<int>(0) - 1;
for (int k = K1; k <= K2; k++){
auto cell = grid.get_cell(I, J, k);
(void) cell;
//Only interested in activating the cells.
}
}
}
}
void Schedule::handlePYACTION(const DeckKeyword& keyword) {
if (!this->m_static.m_python_handle->enabled()) {
//Must have a real Python instance here - to ensure that IMPORT works