Handle undefined UDQ expressions
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -21,6 +21,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.hpp>
|
||||
|
||||
@@ -105,6 +106,7 @@ BOOST_AUTO_TEST_CASE (Declared_Actionx_data)
|
||||
Opm::EclipseState es = simCase.es;
|
||||
Opm::Runspec rspec = es.runspec();
|
||||
Opm::SummaryState st = sum_state_TEST1();
|
||||
Opm::UDQState udq_state(1);
|
||||
Opm::Action::State action_state;
|
||||
Opm::Schedule sched = simCase.sched;
|
||||
Opm::EclipseGrid grid = simCase.grid;
|
||||
@@ -135,7 +137,7 @@ BOOST_AUTO_TEST_CASE (Declared_Actionx_data)
|
||||
|
||||
const auto udqDims = Opm::RestartIO::Helpers::createUdqDims(sched, rptStep, ih);
|
||||
auto udqData = Opm::RestartIO::Helpers::AggregateUDQData(udqDims);
|
||||
udqData.captureDeclaredUDQData(sched, rptStep, st, ih);
|
||||
udqData.captureDeclaredUDQData(sched, rptStep, udq_state, ih);
|
||||
|
||||
const auto actDims = Opm::RestartIO::Helpers::createActionxDims(rspec, sched, rptStep);
|
||||
auto actionxData = Opm::RestartIO::Helpers::AggregateActionxData(actDims);
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQSet.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
|
||||
|
||||
//#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
//#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
@@ -71,6 +74,48 @@ namespace {
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
Opm::UDQSet make_udq_set(const std::string& name, Opm::UDQVarType var_type, const std::vector<std::string>& wgnames, const std::vector<double>& values) {
|
||||
Opm::UDQSet s(name, var_type, wgnames);
|
||||
for (std::size_t i=0; i < values.size(); i++)
|
||||
s.assign(i , values[i]);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
Opm::UDQState make_udq_state()
|
||||
{
|
||||
auto state = Opm::UDQState{0};
|
||||
|
||||
state.add("WUOPRL", make_udq_set("WUOPRL",
|
||||
Opm::UDQVarType::WELL_VAR,
|
||||
{"PROD1", "PROD2", "WINJ1", "WINJ2"},
|
||||
{210, 211, 212, 213}));
|
||||
|
||||
state.add("WUOPRU", make_udq_set("WUOPRU",
|
||||
Opm::UDQVarType::WELL_VAR,
|
||||
{"PROD1", "PROD2", "WINJ1", "WINJ2"},
|
||||
{220, 221, 222, 223}));
|
||||
|
||||
state.add("WULPRL", make_udq_set("WULPRL",
|
||||
Opm::UDQVarType::WELL_VAR,
|
||||
{"PROD1", "PROD2", "WINJ1", "WINJ2"},
|
||||
{230, 231, 232, 233}));
|
||||
|
||||
state.add("WULPRU", make_udq_set("WULPRU",
|
||||
Opm::UDQVarType::WELL_VAR,
|
||||
{"PROD1", "PROD2", "WINJ1", "WINJ2"},
|
||||
{160, 161, 162, 163}));
|
||||
|
||||
state.add("GUOPRU", make_udq_set("GUOPRU",
|
||||
Opm::UDQVarType::GROUP_VAR,
|
||||
{"WGRP1", "WGRP2", "GRP1"},
|
||||
{360, 361, 362}));
|
||||
|
||||
state.add("FULPR", Opm::UDQSet::scalar("FULPR", 460));
|
||||
return state;
|
||||
}
|
||||
|
||||
Opm::SummaryState sum_state()
|
||||
{
|
||||
auto state = Opm::SummaryState{std::chrono::system_clock::now()};
|
||||
@@ -133,6 +178,7 @@ BOOST_AUTO_TEST_CASE (Declared_UDQ_data)
|
||||
|
||||
Opm::EclipseState es = simCase.es;
|
||||
Opm::SummaryState st = sum_state();
|
||||
Opm::UDQState udq_state = make_udq_state();
|
||||
Opm::Schedule sched = simCase.sched;
|
||||
Opm::EclipseGrid grid = simCase.grid;
|
||||
const auto& ioConfig = es.getIOConfig();
|
||||
@@ -162,7 +208,7 @@ BOOST_AUTO_TEST_CASE (Declared_UDQ_data)
|
||||
|
||||
const auto udqDims = Opm::RestartIO::Helpers::createUdqDims(sched, rptStep, ih);
|
||||
auto udqData = Opm::RestartIO::Helpers::AggregateUDQData(udqDims);
|
||||
udqData.captureDeclaredUDQData(sched, rptStep, st, ih);
|
||||
udqData.captureDeclaredUDQData(sched, rptStep, udq_state, ih);
|
||||
|
||||
rstFile.write("ZUDN", udqData.getZUDN());
|
||||
rstFile.write("ZUDL", udqData.getZUDL());
|
||||
|
||||
@@ -399,7 +399,7 @@ RestartValue first_sim(const Setup& setup, Action::State& action_state, SummaryS
|
||||
RestartValue restart_value(sol, wells, groups);
|
||||
|
||||
init_st(st);
|
||||
udq.eval(st);
|
||||
udq.eval(st, udq_state);
|
||||
eclWriter.writeTimeStep( action_state,
|
||||
st,
|
||||
udq_state,
|
||||
@@ -613,6 +613,7 @@ BOOST_AUTO_TEST_CASE(WriteWrongSOlutionSize) {
|
||||
auto groups = mkGroups();
|
||||
Opm::SummaryState sumState(std::chrono::system_clock::now());
|
||||
Opm::Action::State action_state;
|
||||
Opm::UDQState udq_state(19);
|
||||
|
||||
const auto seqnum = 1;
|
||||
auto rstFile = OS::Restart {
|
||||
@@ -627,7 +628,8 @@ BOOST_AUTO_TEST_CASE(WriteWrongSOlutionSize) {
|
||||
setup.grid ,
|
||||
setup.schedule,
|
||||
action_state,
|
||||
sumState),
|
||||
sumState,
|
||||
udq_state),
|
||||
std::runtime_error);
|
||||
}
|
||||
}
|
||||
@@ -663,6 +665,7 @@ BOOST_AUTO_TEST_CASE(ExtraData_content) {
|
||||
Setup setup("BASE_SIM.DATA");
|
||||
{
|
||||
Action::State action_state;
|
||||
UDQState udq_state(10);
|
||||
auto num_cells = setup.grid.getNumActive( );
|
||||
auto cells = mkSolution( num_cells );
|
||||
auto wells = mkWells();
|
||||
@@ -691,7 +694,8 @@ BOOST_AUTO_TEST_CASE(ExtraData_content) {
|
||||
setup.grid,
|
||||
setup.schedule,
|
||||
action_state,
|
||||
sumState);
|
||||
sumState,
|
||||
udq_state);
|
||||
}
|
||||
|
||||
const auto rstFile = ::Opm::EclIO::OutputStream::
|
||||
@@ -767,6 +771,7 @@ BOOST_AUTO_TEST_CASE(STORE_THPRES) {
|
||||
restart_value.addExtra("THRESHPR", UnitSystem::measure::pressure, {0,1});
|
||||
const auto sumState = sim_state();
|
||||
Action::State action_state;
|
||||
UDQState udq_state(99);
|
||||
|
||||
/* THPRES data has wrong size in extra container. */
|
||||
{
|
||||
@@ -783,7 +788,8 @@ BOOST_AUTO_TEST_CASE(STORE_THPRES) {
|
||||
base_setup.grid,
|
||||
base_setup.schedule,
|
||||
action_state,
|
||||
sumState),
|
||||
sumState,
|
||||
udq_state),
|
||||
std::runtime_error);
|
||||
}
|
||||
|
||||
@@ -806,7 +812,8 @@ BOOST_AUTO_TEST_CASE(STORE_THPRES) {
|
||||
base_setup.grid,
|
||||
base_setup.schedule,
|
||||
action_state,
|
||||
sumState);
|
||||
sumState,
|
||||
udq_state);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -853,7 +860,7 @@ BOOST_AUTO_TEST_CASE(Restore_Cumulatives)
|
||||
mkGroups()
|
||||
};
|
||||
const auto sumState = sim_state();
|
||||
|
||||
UDQState udq_state(98);
|
||||
namespace OS = ::Opm::EclIO::OutputStream;
|
||||
|
||||
const auto rset = OS::ResultSet{ wa.currentWorkingDirectory(), "FILE" };
|
||||
@@ -865,7 +872,7 @@ BOOST_AUTO_TEST_CASE(Restore_Cumulatives)
|
||||
};
|
||||
|
||||
RestartIO::save(rstFile, seqnum, 100, restart_value,
|
||||
setup.es, setup.grid, setup.schedule, action_state, sumState);
|
||||
setup.es, setup.grid, setup.schedule, action_state, sumState, udq_state);
|
||||
}
|
||||
|
||||
Action::State action_state;
|
||||
|
||||
Reference in New Issue
Block a user