diff --git a/src/opm/parser/eclipse/EclipseState/Grid/FieldProps.cpp b/src/opm/parser/eclipse/EclipseState/Grid/FieldProps.cpp index 09287f230..d432f87ad 100644 --- a/src/opm/parser/eclipse/EclipseState/Grid/FieldProps.cpp +++ b/src/opm/parser/eclipse/EclipseState/Grid/FieldProps.cpp @@ -874,7 +874,7 @@ void FieldProps::handle_COPY(const DeckKeyword& keyword, Box box, bool region) { if (region) { int region_value = record.getItem(2).get(0); - const auto& region_item = record.getItem(4); + const auto& region_item = record.getItem(3); const auto& region_name = this->region_name( region_item ); index_list = this->region_index(region_name, region_value); } else { diff --git a/tests/parser/FieldPropsTests.cpp b/tests/parser/FieldPropsTests.cpp index 0d4edc12c..058d1fb9d 100644 --- a/tests/parser/FieldPropsTests.cpp +++ b/tests/parser/FieldPropsTests.cpp @@ -2293,3 +2293,51 @@ MAXVALUE // and some special casing might be required. BOOST_CHECK_NO_THROW( FieldPropsManager(deck3, Phases{true, true, true}, grid, TableManager())); } + +BOOST_AUTO_TEST_CASE(REGION_OPERATION) { + std::string deck_string1 = R"( +GRID + +PORO + 200*0.15 / + +PERMX + 200*1 / + +REGIONS + +FIPNUM + 200*1 / + +MULTNUM + 50*1 50*2 100*3 / + +EDIT + +MULTIREG + PERMX 1 1 M/ + PERMX 2 2 M/ + PERMX 3 3 M/ +/ + +COPYREG + PERMX PERMY 1 M / + PERMX PERMY 2 M / + PERMX PERMY 3 M / +/ + +)"; + + UnitSystem unit_system(UnitSystem::UnitType::UNIT_TYPE_METRIC); + auto to_si = [&unit_system](double raw_value) { return unit_system.to_si(UnitSystem::measure::permeability, raw_value); }; + EclipseGrid grid(10,10, 2); + Deck deck1 = Parser{}.parseString(deck_string1); + FieldPropsManager fp(deck1, Phases{true, true, true}, grid, TableManager()); + const auto& permx = fp.get_double("PERMX"); + const auto& permy = fp.get_double("PERMY"); + const auto& multn = fp.get_int("MULTNUM"); + for (std::size_t g = 0; g < 200; g++) { + BOOST_CHECK_CLOSE(to_si(multn[g]), permx[g], 1e-5); + BOOST_CHECK_EQUAL(permx[g], permy[g]); + } +}