diff --git a/opm/io/eclipse/rst/header.hpp b/opm/io/eclipse/rst/header.hpp index 236b2b626..0034dc195 100644 --- a/opm/io/eclipse/rst/header.hpp +++ b/opm/io/eclipse/rst/header.hpp @@ -24,10 +24,12 @@ #include namespace Opm { +class UnitSystem; + namespace RestartIO { struct RstHeader { - RstHeader(const std::vector& intehead, const std::vector& logihead, const std::vector& doubhead); + RstHeader(const UnitSystem& unit_system, const std::vector& intehead, const std::vector& logihead, const std::vector& doubhead); int nx; int ny; @@ -112,6 +114,8 @@ struct RstHeader { double guide_rate_d; double guide_rate_e; double guide_rate_f; + double guide_rate_delay; + double guide_rate_damping; double udq_range; double udq_undefined; double udq_eps; diff --git a/src/opm/io/eclipse/rst/header.cpp b/src/opm/io/eclipse/rst/header.cpp index bcdf897a1..18c0509b3 100644 --- a/src/opm/io/eclipse/rst/header.cpp +++ b/src/opm/io/eclipse/rst/header.cpp @@ -23,13 +23,15 @@ #include #include #include +#include namespace VI = ::Opm::RestartIO::Helpers::VectorItems; +using M = ::Opm::UnitSystem::measure; namespace Opm { namespace RestartIO { -RstHeader::RstHeader(const std::vector& intehead, const std::vector& logihead, const std::vector& doubhead) : +RstHeader::RstHeader(const Opm::UnitSystem& unit_system, const std::vector& intehead, const std::vector& logihead, const std::vector& doubhead) : nx(intehead[VI::intehead::NX]), ny(intehead[VI::intehead::NY]), nz(intehead[VI::intehead::NZ]), @@ -101,15 +103,17 @@ RstHeader::RstHeader(const std::vector& intehead, const std::vector& alt_eps(logihead[VI::logihead::AltEPS]), group_control_active(intehead[VI::intehead::NGRNPH] == 1), // - next_timestep1(doubhead[VI::doubhead::TsInit]), - next_timestep2(doubhead[VI::doubhead::TsMaxz]), - max_timestep(doubhead[VI::doubhead::TsMinz]), + next_timestep1(unit_system.to_si(M::time, doubhead[VI::doubhead::TsInit])), + next_timestep2(0), + max_timestep(unit_system.to_si(M::time, doubhead[VI::doubhead::TsMaxz])), guide_rate_a(doubhead[VI::doubhead::GRpar_a]), guide_rate_b(doubhead[VI::doubhead::GRpar_b]), guide_rate_c(doubhead[VI::doubhead::GRpar_c]), guide_rate_d(doubhead[VI::doubhead::GRpar_d]), guide_rate_e(doubhead[VI::doubhead::GRpar_e]), guide_rate_f(doubhead[VI::doubhead::GRpar_f]), + guide_rate_delay(unit_system.to_si(M::time, doubhead[VI::doubhead::GRpar_int])), + guide_rate_damping(doubhead[VI::doubhead::GRpar_damp]), udq_range(doubhead[VI::doubhead::UdqPar_2]), udq_undefined(doubhead[VI::doubhead::UdqPar_3]), udq_eps(doubhead[VI::doubhead::UdqPar_4]) diff --git a/src/opm/io/eclipse/rst/state.cpp b/src/opm/io/eclipse/rst/state.cpp index adad43bbc..bb2e34720 100644 --- a/src/opm/io/eclipse/rst/state.cpp +++ b/src/opm/io/eclipse/rst/state.cpp @@ -39,7 +39,7 @@ RstState::RstState(const ::Opm::UnitSystem& unit_system_, const std::vector& logihead, const std::vector& doubhead): unit_system(unit_system_), - header(intehead, logihead, doubhead) + header(unit_system_, intehead, logihead, doubhead) { this->load_tuning(intehead, doubhead); } diff --git a/tests/test_AggregateWellData.cpp b/tests/test_AggregateWellData.cpp index 41efafa2c..4ba306a0a 100644 --- a/tests/test_AggregateWellData.cpp +++ b/tests/test_AggregateWellData.cpp @@ -1155,7 +1155,7 @@ BOOST_AUTO_TEST_CASE(WELL_POD) { const auto& scon = connectionData.getSConn(); const auto& xcon = connectionData.getXConn(); - Opm::RestartIO::RstHeader header(ih, std::vector(100), std::vector(1000)); + Opm::RestartIO::RstHeader header(units, ih, std::vector(100), std::vector(1000)); std::vector wells; std::vector zwel; for (const auto& s8: zwel8) diff --git a/tests/test_InteHEAD.cpp b/tests/test_InteHEAD.cpp index 0304e5c97..4e76e09de 100755 --- a/tests/test_InteHEAD.cpp +++ b/tests/test_InteHEAD.cpp @@ -557,10 +557,11 @@ BOOST_AUTO_TEST_CASE(TestHeader) { const auto nmfipr = 22; const auto ngroup = 8; + auto unit_system = Opm::UnitSystem::newMETRIC(); auto ih = Opm::RestartIO::InteHEAD{} .dimensions(nx, ny, nz) .numActive(nactive) - .unitConventions(Opm::UnitSystem::newMETRIC()) + .unitConventions(unit_system) .wellTableDimensions({ numWells, maxPerf, maxWellsInGroup, maxGroupInField, maxWellsInField}) .calendarDate({year, month, mday, hour, minute, seconds, mseconds}) .activePhases(Ph{1,1,1}) @@ -575,7 +576,7 @@ BOOST_AUTO_TEST_CASE(TestHeader) { .regionDimensions({ntfip, nmfipr, 0,0,0}) .ngroups({ngroup}); - Opm::RestartIO::RstHeader header(ih.data(), std::vector(100), std::vector(1000)); + Opm::RestartIO::RstHeader header(unit_system, ih.data(), std::vector(100), std::vector(1000)); BOOST_CHECK_EQUAL(header.nx, nx); BOOST_CHECK_EQUAL(header.ny, ny); BOOST_CHECK_EQUAL(header.nactive, nactive); diff --git a/tests/test_rst.cpp b/tests/test_rst.cpp index 869a02b2a..499329708 100644 --- a/tests/test_rst.cpp +++ b/tests/test_rst.cpp @@ -239,7 +239,7 @@ BOOST_AUTO_TEST_CASE(group_test) { for (const auto& s8: zgrp8) zgrp.push_back(s8.c_str()); - Opm::RestartIO::RstHeader header(ih,lh,dh); + Opm::RestartIO::RstHeader header(unit_system,ih,lh,dh); for (int ig=0; ig < header.ngroup; ig++) { std::size_t zgrp_offset = ig * header.nzgrpz; std::size_t igrp_offset = ig * header.nigrpz;