From aa54bc67dea3a7e57dc5d756a8cf25cd29c8ad6b Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Fri, 2 Oct 2020 19:05:09 +0200 Subject: [PATCH] Load group->parent_group when loading from restart file --- opm/io/eclipse/rst/group.hpp | 1 + opm/io/eclipse/rst/header.hpp | 1 + src/opm/io/eclipse/rst/group.cpp | 3 ++- src/opm/io/eclipse/rst/header.cpp | 1 + src/opm/io/eclipse/rst/state.cpp | 1 + tests/test_rst.cpp | 1 + 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/opm/io/eclipse/rst/group.hpp b/opm/io/eclipse/rst/group.hpp index a1b468c9c..af4eb442a 100644 --- a/opm/io/eclipse/rst/group.hpp +++ b/opm/io/eclipse/rst/group.hpp @@ -32,6 +32,7 @@ struct RstHeader; struct RstGroup { RstGroup(const UnitSystem& unit_system, + const RstHeader& header, const std::string* zwel, const int * igrp, const float * sgrp, diff --git a/opm/io/eclipse/rst/header.hpp b/opm/io/eclipse/rst/header.hpp index 2c57e8589..5aba3ae84 100644 --- a/opm/io/eclipse/rst/header.hpp +++ b/opm/io/eclipse/rst/header.hpp @@ -86,6 +86,7 @@ struct RstHeader { int ntfreg; int nplmix; int ngroup; + int nwgmax; bool e300_radial; bool e100_radial; diff --git a/src/opm/io/eclipse/rst/group.cpp b/src/opm/io/eclipse/rst/group.cpp index b8e8a4bc6..3f2887be1 100644 --- a/src/opm/io/eclipse/rst/group.cpp +++ b/src/opm/io/eclipse/rst/group.cpp @@ -33,12 +33,13 @@ namespace RestartIO { using M = ::Opm::UnitSystem::measure; RstGroup::RstGroup(const ::Opm::UnitSystem& unit_system, + const RstHeader& header, const std::string* zwel, const int * igrp, const float * sgrp, const double * xgrp) : name(trim_copy(zwel[0])), - parent_group(igrp[VI::IGroup::ParentGroup] ), + parent_group(igrp[header.nwgmax + VI::IGroup::ParentGroup] ), oil_rate_limit( unit_system.to_si(M::liquid_surface_rate, sgrp[VI::SGroup::OilRateLimit])), water_rate_limit( unit_system.to_si(M::liquid_surface_rate, sgrp[VI::SGroup::WatRateLimit])), gas_rate_limit( unit_system.to_si(M::gas_surface_rate, sgrp[VI::SGroup::GasRateLimit])), diff --git a/src/opm/io/eclipse/rst/header.cpp b/src/opm/io/eclipse/rst/header.cpp index 31dc2c823..e91559a01 100644 --- a/src/opm/io/eclipse/rst/header.cpp +++ b/src/opm/io/eclipse/rst/header.cpp @@ -84,6 +84,7 @@ RstHeader::RstHeader(const std::vector& intehead, const std::vector& ntfip(intehead[VI::intehead::NTFIP]), nmfipr(intehead[VI::intehead::NMFIPR]), ngroup(intehead[VI::intehead::NGRP]), + nwgmax(intehead[VI::intehead::NWGMAX]), // e300_radial(logihead[VI::logihead::E300Radial]), e100_radial(logihead[VI::logihead::E100Radial]), diff --git a/src/opm/io/eclipse/rst/state.cpp b/src/opm/io/eclipse/rst/state.cpp index 754bde182..74d46d618 100644 --- a/src/opm/io/eclipse/rst/state.cpp +++ b/src/opm/io/eclipse/rst/state.cpp @@ -181,6 +181,7 @@ void RstState::add_groups(const std::vector& zgrp, std::size_t xgrp_offset = ig * this->header.nxgrpz; this->groups.emplace_back(this->unit_system, + this->header, zgrp.data() + zgrp_offset, igrp.data() + igrp_offset, sgrp.data() + sgrp_offset, diff --git a/tests/test_rst.cpp b/tests/test_rst.cpp index 33c402941..869a02b2a 100644 --- a/tests/test_rst.cpp +++ b/tests/test_rst.cpp @@ -247,6 +247,7 @@ BOOST_AUTO_TEST_CASE(group_test) { std::size_t xgrp_offset = ig * header.nxgrpz; Opm::RestartIO::RstGroup group(unit_system, + header, zgrp.data() + zgrp_offset, igrp.data() + igrp_offset, sgrp.data() + sgrp_offset,