corrections/improvements based on comments from reviewer

This commit is contained in:
Jostein Alvestad
2021-10-25 14:13:06 +02:00
parent 6830a8581e
commit 85367ec6d7
13 changed files with 66 additions and 68 deletions

View File

@@ -172,11 +172,11 @@ BOOST_AUTO_TEST_CASE(Declared_Actionx_data)
Opm::EclIO::OutputStream::Unified {ioConfig.getUNIFOUT()}};
std::vector<int> ih
= Opm::RestartIO::Helpers::createInteHead(es, grid, sched, secs_elapsed, rptStep, rptStep + 1, rptStep);
= Opm::RestartIO::Helpers::createInteHead(es, grid, sched, secs_elapsed, rptStep, rptStep, rptStep-1);
// set dummy value for next_step_size
const double next_step_size = 0.1;
const auto dh = Opm::RestartIO::Helpers::createDoubHead(es, sched, rptStep+1, rptStep, secs_elapsed, next_step_size);
const auto dh = Opm::RestartIO::Helpers::createDoubHead(es, sched, rptStep-1, rptStep, secs_elapsed, next_step_size);
const auto& lh = Opm::RestartIO::Helpers::createLogiHead(es);
@@ -190,7 +190,7 @@ BOOST_AUTO_TEST_CASE(Declared_Actionx_data)
rstFile.write("LOGIHEAD", lh);
{
auto group_aggregator = Opm::RestartIO::Helpers::AggregateGroupData(ih);
group_aggregator.captureDeclaredGroupData(sched, es.getUnits(), rptStep, st, ih);
group_aggregator.captureDeclaredGroupData(sched, es.getUnits(), rptStep-1, st, ih);
rstFile.write("IGRP", group_aggregator.getIGroup());
rstFile.write("SGRP", group_aggregator.getSGroup());
rstFile.write("XGRP", group_aggregator.getXGroup());
@@ -198,7 +198,7 @@ BOOST_AUTO_TEST_CASE(Declared_Actionx_data)
}
{
auto well_aggregator = Opm::RestartIO::Helpers::AggregateWellData(ih);
well_aggregator.captureDeclaredWellData(sched, es.getUnits(), rptStep, {}, {}, st, ih);
well_aggregator.captureDeclaredWellData(sched, es.getUnits(), rptStep-1, {}, {}, st, ih);
rstFile.write("IWEL", well_aggregator.getIWell());
rstFile.write("SWEL", well_aggregator.getSWell());
rstFile.write("XWEL", well_aggregator.getXWell());
@@ -207,18 +207,14 @@ BOOST_AUTO_TEST_CASE(Declared_Actionx_data)
{
auto conn_aggregator = Opm::RestartIO::Helpers::AggregateConnectionData(ih);
auto xw = Opm::data::Wells {};
conn_aggregator.captureDeclaredConnData(sched, grid, es.getUnits(), xw, st, rptStep);
conn_aggregator.captureDeclaredConnData(sched, grid, es.getUnits(), xw, st, rptStep-1);
rstFile.write("ICON", conn_aggregator.getIConn());
rstFile.write("SCON", conn_aggregator.getSConn());
rstFile.write("XCON", conn_aggregator.getXConn());
}
// const auto udqDims = Opm::RestartIO::Helpers::createUdqDims(sched, rptStep, ih);
// auto udqData = Opm::RestartIO::Helpers::AggregateUDQData(udqDims);
// udqData.captureDeclaredUDQData(sched, rptStep, udq_state, ih);
const auto actDims = Opm::RestartIO::Helpers::createActionRSTDims(sched, rptStep);
Opm::RestartIO::Helpers::AggregateActionxData actionxData {sched, action_state, st, rptStep};
const auto actDims = Opm::RestartIO::Helpers::createActionRSTDims(sched, rptStep-1);
Opm::RestartIO::Helpers::AggregateActionxData actionxData {sched, action_state, st, rptStep-1};
rstFile.write("IACT", actionxData.getIACT());
rstFile.write("SACT", actionxData.getSACT());
@@ -240,24 +236,24 @@ BOOST_AUTO_TEST_CASE(Declared_Actionx_data)
---------------------------------------------------------------------------------------------------------------------]
*/
const auto rptStep_1 = std::size_t {0};
const auto rptStep_1 = std::size_t {1};
const auto ih_1 = Opm::RestartIO::Helpers::createInteHead(
es, grid, sched, secs_elapsed, rptStep, rptStep_1 + 1, rptStep_1);
es, grid, sched, secs_elapsed, rptStep, rptStep_1, rptStep_1-1);
BOOST_CHECK_EQUAL(ih_1[156], 2);
BOOST_CHECK_EQUAL(ih_1[157], 7);
const auto rptStep_2 = std::size_t {1};
const auto rptStep_2 = std::size_t {2};
const auto ih_2 = Opm::RestartIO::Helpers::createInteHead(
es, grid, sched, secs_elapsed, rptStep, rptStep_2 + 1, rptStep_2);
es, grid, sched, secs_elapsed, rptStep, rptStep_2, rptStep_2-1);
BOOST_CHECK_EQUAL(ih_2[156], 14);
BOOST_CHECK_EQUAL(ih_2[157], 10);
const auto rptStep_3 = std::size_t {2};
const auto rptStep_3 = std::size_t {3};
const auto ih_3 = Opm::RestartIO::Helpers::createInteHead(
es, grid, sched, secs_elapsed, rptStep, rptStep_3 + 1, rptStep_3);
es, grid, sched, secs_elapsed, rptStep, rptStep_3, rptStep_3-1);
BOOST_CHECK_EQUAL(ih_3[156], 14);
BOOST_CHECK_EQUAL(ih_3[157], 10);
@@ -1007,7 +1003,7 @@ BOOST_AUTO_TEST_CASE(Declared_Actionx_data)
auto rst_file = std::make_shared<Opm::EclIO::ERst>("UDQ_ACTIONX_TEST1.UNRST");
auto rst_view = std::make_shared<Opm::EclIO::RestartFileView>(std::move(rst_file), 3);
auto rst_state = Opm::RestartIO::RstState::load(std::move(rst_view), es.runspec(), simCase.parser);
const auto& input_actions = sched[rptStep].actions();
const auto& input_actions = sched[rptStep-1].actions();
BOOST_CHECK(rst_state.actions.size() == input_actions.ecl_size());

View File

@@ -222,18 +222,18 @@ BOOST_AUTO_TEST_CASE (Declared_UDQ_data)
double secs_elapsed = 3.1536E07;
const auto ih = Opm::RestartIO::Helpers::
createInteHead(es, grid, sched, secs_elapsed,
rptStep, rptStep, rptStep);
rptStep, rptStep, rptStep-1);
//set dummy value for next_step_size
const double next_step_size= 0.1;
const auto dh = Opm::RestartIO::Helpers::createDoubHead(es, sched, rptStep+1, rptStep,
const auto dh = Opm::RestartIO::Helpers::createDoubHead(es, sched, rptStep-1, rptStep,
secs_elapsed, next_step_size);
const auto& lh = Opm::RestartIO::Helpers::createLogiHead(es);
const auto udqDims = Opm::RestartIO::Helpers::createUdqDims(sched, rptStep, ih);
const auto udqDims = Opm::RestartIO::Helpers::createUdqDims(sched, rptStep-1, ih);
auto udqData = Opm::RestartIO::Helpers::AggregateUDQData(udqDims);
udqData.captureDeclaredUDQData(sched, rptStep, udq_state, ih);
udqData.captureDeclaredUDQData(sched, rptStep-1, udq_state, ih);
{
WorkArea work;
@@ -249,7 +249,7 @@ BOOST_AUTO_TEST_CASE (Declared_UDQ_data)
rstFile.write("LOGIHEAD", lh);
{
auto group_aggregator = Opm::RestartIO::Helpers::AggregateGroupData(ih);
group_aggregator.captureDeclaredGroupData(sched, es.getUnits(), rptStep, st, ih);
group_aggregator.captureDeclaredGroupData(sched, es.getUnits(), rptStep-1, st, ih);
rstFile.write("IGRP", group_aggregator.getIGroup());
rstFile.write("SGRP", group_aggregator.getSGroup());
rstFile.write("XGRP", group_aggregator.getXGroup());
@@ -259,7 +259,7 @@ BOOST_AUTO_TEST_CASE (Declared_UDQ_data)
auto action_state = Opm::Action::State {};
auto wtest_state = Opm::WellTestState{};
auto well_aggregator = Opm::RestartIO::Helpers::AggregateWellData(ih);
well_aggregator.captureDeclaredWellData(sched, es.getUnits(), rptStep, action_state, wtest_state, st, ih);
well_aggregator.captureDeclaredWellData(sched, es.getUnits(), rptStep-1, action_state, wtest_state, st, ih);
rstFile.write("IWEL", well_aggregator.getIWell());
rstFile.write("SWEL", well_aggregator.getSWell());
rstFile.write("XWEL", well_aggregator.getXWell());
@@ -268,7 +268,7 @@ BOOST_AUTO_TEST_CASE (Declared_UDQ_data)
{
auto conn_aggregator = Opm::RestartIO::Helpers::AggregateConnectionData(ih);
auto xw = Opm::data::Wells {};
conn_aggregator.captureDeclaredConnData(sched, grid, es.getUnits(), xw, st, rptStep);
conn_aggregator.captureDeclaredConnData(sched, grid, es.getUnits(), xw, st, rptStep-1);
rstFile.write("ICON", conn_aggregator.getIConn());
rstFile.write("SCON", conn_aggregator.getSConn());
rstFile.write("XCON", conn_aggregator.getXConn());
@@ -922,7 +922,7 @@ BOOST_AUTO_TEST_CASE (Declared_UDQ_data_2)
//set dummy value for next_step_size
double next_step_size= 0.1;
auto dh = Opm::RestartIO::Helpers::createDoubHead(es, sched, simStep+1, simStep,
auto dh = Opm::RestartIO::Helpers::createDoubHead(es, sched, simStep, simStep+1,
secs_elapsed, next_step_size);
auto lh = Opm::RestartIO::Helpers::createLogiHead(es);
@@ -949,7 +949,7 @@ BOOST_AUTO_TEST_CASE (Declared_UDQ_data_2)
//set dummy value for next_step_size
next_step_size= 0.1;
dh = Opm::RestartIO::Helpers::createDoubHead(es, sched, simStep+1, simStep,
dh = Opm::RestartIO::Helpers::createDoubHead(es, sched, simStep, simStep+1,
secs_elapsed, next_step_size);
lh = Opm::RestartIO::Helpers::createLogiHead(es);

View File

@@ -782,7 +782,7 @@ BOOST_AUTO_TEST_CASE (Declared_Well_Data)
createInteHead(simCase.es, simCase.es.getInputGrid(), simCase.sched, secs_elapsed,
rptStep, rptStep, rptStep);
const auto dh = Opm::RestartIO::Helpers::createDoubHead(simCase.es, simCase.sched, rptStep+1, rptStep,
const auto dh = Opm::RestartIO::Helpers::createDoubHead(simCase.es, simCase.sched, rptStep, rptStep+1,
secs_elapsed, next_step_size);
const auto& lh = Opm::RestartIO::Helpers::createLogiHead(simCase.es);

View File

@@ -193,19 +193,19 @@ BOOST_AUTO_TEST_CASE(Netbalan)
createInteHead(es, grid, sched, simTime,
report_step, // Should really be number of timesteps
report_step, lookup_step);
const auto dh = Opm::RestartIO::Helpers::createDoubHead(es, sched, report_step, lookup_step,
const auto dh = Opm::RestartIO::Helpers::createDoubHead(es, sched, lookup_step, report_step,
simTime, next_step_size);
const auto& v = dh.data();
namespace VI = Opm::RestartIO::Helpers::VectorItems;
BOOST_CHECK_EQUAL(v[VI::doubhead::Netbalan_1], 2.345);
BOOST_CHECK_EQUAL(v[VI::doubhead::Netbalan_2], 0.033);
BOOST_CHECK_EQUAL(v[VI::doubhead::Netbalan_4], 0.1);
BOOST_CHECK_EQUAL(v[VI::doubhead::Netbalan_6], 1.E+19);
BOOST_CHECK_EQUAL(v[VI::doubhead::Netbalan_7], 1.E+18);
BOOST_CHECK_EQUAL(v[VI::doubhead::Netbalan_8], 0.15);
BOOST_CHECK_EQUAL(v[VI::doubhead::Netbalint], 2.345);
BOOST_CHECK_EQUAL(v[VI::doubhead::Netbalnpre], 0.033);
BOOST_CHECK_EQUAL(v[VI::doubhead::Netbalthpc], 0.1);
BOOST_CHECK_EQUAL(v[VI::doubhead::Netbaltarerr], 1.E+19);
BOOST_CHECK_EQUAL(v[VI::doubhead::Netbalmaxerr], 1.E+18);
BOOST_CHECK_EQUAL(v[VI::doubhead::Netbalstepsz], 0.15);
}

View File

@@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(liftGasOptimzation_data)
// set dummy value for next_step_size
const double next_step_size = 0.1;
const auto dh = Opm::RestartIO::Helpers::createDoubHead(es, sched, simStep+1, simStep, secs_elapsed, next_step_size);
const auto dh = Opm::RestartIO::Helpers::createDoubHead(es, sched, simStep, simStep+1, secs_elapsed, next_step_size);
auto wellData = Opm::RestartIO::Helpers::AggregateWellData(ih);
wellData.captureDeclaredWellData(sched, es.getUnits(), simStep, action_state, {}, st, ih);

View File

@@ -231,8 +231,8 @@ BOOST_AUTO_TEST_CASE(group_test) {
const auto dh = Opm::RestartIO::Helpers::createDoubHead(simCase.es,
simCase.sched,
sim_step+1,
sim_step,
sim_step+1,
0, 0);
auto groupData = Opm::RestartIO::Helpers::AggregateGroupData(ih);
@@ -286,8 +286,8 @@ BOOST_AUTO_TEST_CASE(State_test) {
const auto dh = Opm::RestartIO::Helpers::createDoubHead(simCase.es,
simCase.sched,
sim_step+1,
sim_step,
sim_step+1,
0, 0);
auto wellData = Opm::RestartIO::Helpers::AggregateWellData(ih);