Add guide rate delay and damping to rst header class

This commit is contained in:
Joakim Hove 2020-10-13 13:11:04 +02:00
parent ead5a19209
commit 53fe0f2d11
6 changed files with 19 additions and 10 deletions

View File

@ -24,10 +24,12 @@
#include <cstddef>
namespace Opm {
class UnitSystem;
namespace RestartIO {
struct RstHeader {
RstHeader(const std::vector<int>& intehead, const std::vector<bool>& logihead, const std::vector<double>& doubhead);
RstHeader(const UnitSystem& unit_system, const std::vector<int>& intehead, const std::vector<bool>& logihead, const std::vector<double>& 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;

View File

@ -23,13 +23,15 @@
#include <opm/output/eclipse/VectorItems/logihead.hpp>
#include <opm/output/eclipse/VectorItems/doubhead.hpp>
#include <opm/common/utility/TimeService.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
namespace VI = ::Opm::RestartIO::Helpers::VectorItems;
using M = ::Opm::UnitSystem::measure;
namespace Opm {
namespace RestartIO {
RstHeader::RstHeader(const std::vector<int>& intehead, const std::vector<bool>& logihead, const std::vector<double>& doubhead) :
RstHeader::RstHeader(const Opm::UnitSystem& unit_system, const std::vector<int>& intehead, const std::vector<bool>& logihead, const std::vector<double>& 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<int>& intehead, const std::vector<bool>&
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])

View File

@ -39,7 +39,7 @@ RstState::RstState(const ::Opm::UnitSystem& unit_system_,
const std::vector<bool>& logihead,
const std::vector<double>& doubhead):
unit_system(unit_system_),
header(intehead, logihead, doubhead)
header(unit_system_, intehead, logihead, doubhead)
{
this->load_tuning(intehead, doubhead);
}

View File

@ -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<bool>(100), std::vector<double>(1000));
Opm::RestartIO::RstHeader header(units, ih, std::vector<bool>(100), std::vector<double>(1000));
std::vector<Opm::RestartIO::RstWell> wells;
std::vector<std::string> zwel;
for (const auto& s8: zwel8)

View File

@ -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<bool>(100), std::vector<double>(1000));
Opm::RestartIO::RstHeader header(unit_system, ih.data(), std::vector<bool>(100), std::vector<double>(1000));
BOOST_CHECK_EQUAL(header.nx, nx);
BOOST_CHECK_EQUAL(header.ny, ny);
BOOST_CHECK_EQUAL(header.nactive, nactive);

View File

@ -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;