UDQ - hooked up to the Summary Output

This commit is contained in:
Joakim Hove
2019-01-31 19:33:45 +01:00
parent 3d4b467a2f
commit 96c02c9d35
4 changed files with 50 additions and 1 deletions

View File

@@ -508,6 +508,7 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/Schedule/UDQContext.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ.hpp
opm/parser/eclipse/EclipseState/UDQParams.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQExpression.hpp
opm/parser/eclipse/Deck/DeckItem.hpp
opm/parser/eclipse/Deck/Deck.hpp

View File

@@ -32,6 +32,8 @@
#include <opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp>
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQContext.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
@@ -1110,6 +1112,16 @@ inline std::vector< const Well* > find_wells( const Schedule& schedule,
return {};
}
bool is_udq(const std::string& keyword) {
return (keyword.size() > 1 && keyword[1] == 'U');
}
void eval_udq(const UDQ& udq, const UDQContext& context, SummaryState& st)
{
}
}
namespace out {
@@ -1152,6 +1164,7 @@ Summary::Summary( const EclipseState& st,
handlers( new keyword_handlers() )
{
const auto& udq = schedule.getUDQConfig(schedule.size() - 1);
const auto& init_config = st.getInitConfig();
const char * restart_case = nullptr;
int restart_step = -1;
@@ -1244,6 +1257,10 @@ Summary::Summary( const EclipseState& st,
auto * nodeptr = ecl_smspec_add_node( smspec, keyword.c_str(), node.wgname().c_str(), node.num(), st.getUnits().name( val.unit ), 0 );
this->handlers->handlers.emplace_back( nodeptr, handle );
} else if (is_udq(keyword)) {
const auto& unit = udq.unit(keyword);
const auto& udq_params = st.runspec().udqParams();
ecl_smspec_add_node(smspec, keyword.c_str(), node.wgname().c_str(), node.num(), unit.c_str(), udq_params.undefinedValue());
} else {
unsupported_keywords.insert(keyword);
}
@@ -1468,6 +1485,11 @@ void Summary::add_timestep( int report_step,
}
}
{
UDQContext udq_context(st);
const UDQ& udq = schedule.getUDQConfig(sim_step);
eval_udq(udq, udq_context, st);
}
{
const ecl_sum_type * ecl_sum = this->ecl_sum.get();
const ecl_smspec_type * smspec = ecl_sum_get_smspec(ecl_sum);

View File

@@ -632,8 +632,16 @@ CTFAC
----'E-2H' /
----/
WUBHP
/
SCHEDULE
UDQ
UNITS WUBHP 'BARSA' /
/
-- Three wells, two producers (so that we can form a group) and one injector
WELSPECS
'W_1' 'G_1' 1 1 3.33 'OIL' 7* /

View File

@@ -266,7 +266,7 @@ struct setup {
/*-----------------------------------------------------------------*/
setup( const std::string& fname , const char* path = "summary_deck.DATA") :
setup( const std::string& fname , const char* path = "summary_deck.DATA") :
deck( Parser().parseFile( path) ),
es( deck ),
grid( es.getInputGrid() ),
@@ -501,6 +501,24 @@ BOOST_AUTO_TEST_CASE(well_keywords) {
BOOST_CHECK_CLOSE( 2.2, ecl_sum_get_well_var( resp, 1, "W_3", "WTHPH" ), 1e-5 );
}
BOOST_AUTO_TEST_CASE(udq_keywords) {
setup cfg( "test_summary_udq" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name );
writer.add_timestep( 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {});
writer.add_timestep( 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {});
writer.add_timestep( 2, 2 * day, cfg.es, cfg.schedule, cfg.wells , {});
writer.write();
auto res = readsum( cfg.name );
const auto* resp = res.get();
const auto& udq_params = cfg.es.runspec().udqParams();
BOOST_CHECK_CLOSE( ecl_sum_get_well_var(resp, 1, "W_1", "WUBHP"), udq_params.undefinedValue(), 1e-5 );
BOOST_CHECK_CLOSE( ecl_sum_get_well_var(resp, 1, "W_3", "WUBHP"), udq_params.undefinedValue(), 1e-5 );
BOOST_CHECK_EQUAL( std::string(ecl_sum_get_unit(resp, "WUBHP:W_1")), "BARSA");
}
BOOST_AUTO_TEST_CASE(group_keywords) {
setup cfg( "test_summary_group" );