Add start_time argument to SummaryState

This commit is contained in:
Joakim Hove 2019-09-19 16:17:38 +02:00
parent ae75aa3255
commit ff69737b99
20 changed files with 78 additions and 69 deletions

View File

@ -41,7 +41,7 @@ void msim::run(Schedule& schedule, EclipseIO& io, bool report_only) {
const double week = 7 * 86400; const double week = 7 * 86400;
data::Solution sol; data::Solution sol;
data::Wells well_data; data::Wells well_data;
SummaryState st; SummaryState st(std::chrono::system_clock::from_time_t(schedule.getStartTime()));
io.writeInitial(); io.writeInitial();
for (size_t report_step = 1; report_step < schedule.size(); report_step++) { for (size_t report_step = 1; report_step < schedule.size(); report_step++) {

View File

@ -21,6 +21,7 @@
#define SUMMARY_STATE_H #define SUMMARY_STATE_H
#include <string> #include <string>
#include <chrono>
#include <vector> #include <vector>
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
@ -66,6 +67,7 @@ namespace Opm{
class SummaryState { class SummaryState {
public: public:
typedef std::unordered_map<std::string, double>::const_iterator const_iterator; typedef std::unordered_map<std::string, double>::const_iterator const_iterator;
explicit SummaryState(std::chrono::system_clock::time_point sim_start_arg);
/* /*
The set() function has to be retained temporarily to support updating of The set() function has to be retained temporarily to support updating of
@ -99,6 +101,7 @@ public:
std::size_t num_wells() const; std::size_t num_wells() const;
std::size_t size() const; std::size_t size() const;
private: private:
std::chrono::system_clock::time_point sim_start;
double elapsed = 0; double elapsed = 0;
std::unordered_map<std::string,double> values; std::unordered_map<std::string,double> values;

View File

@ -154,7 +154,6 @@ namespace {
int wellVFPTab(const Opm::Well2& well, const Opm::SummaryState& st) int wellVFPTab(const Opm::Well2& well, const Opm::SummaryState& st)
{ {
Opm::SummaryState summaryState;
if (well.isInjector()) { if (well.isInjector()) {
return well.injectionControls(st).vfp_table_number; return well.injectionControls(st).vfp_table_number;
} }

View File

@ -1269,7 +1269,7 @@ Summary::Summary( const EclipseState& st,
* entry. * entry.
*/ */
std::set< std::string > unsupported_keywords; std::set< std::string > unsupported_keywords;
SummaryState summary_state(std::chrono::system_clock::from_time_t(schedule.getStartTime()));
for( const auto& node : sum ) { for( const auto& node : sum ) {
ecl_smspec_type * smspec = ecl_sum_get_smspec(this->ecl_sum.get()); ecl_smspec_type * smspec = ecl_sum_get_smspec(this->ecl_sum.get());
std::string keyword = node.keyword(); std::string keyword = node.keyword();
@ -1322,7 +1322,7 @@ Summary::Summary( const EclipseState& st,
0, // Duration of time step 0, // Duration of time step
0, // Simulation step 0, // Simulation step
node.num(), node.num(),
{}, // SummaryState summary_state, // SummaryState
{}, // Well results - data::Wells {}, // Well results - data::Wells
{}, // Region <-> cell mappings. {}, // Region <-> cell mappings.
this->grid, this->grid,

View File

@ -51,6 +51,13 @@ namespace {
} }
} }
SummaryState::SummaryState(std::chrono::system_clock::time_point sim_start_arg):
sim_start(sim_start_arg)
{
}
void SummaryState::update_elapsed(double delta) { void SummaryState::update_elapsed(double delta) {
this->elapsed += delta; this->elapsed += delta;
} }

View File

@ -524,7 +524,7 @@ BOOST_AUTO_TEST_CASE(TestMatchingWells2) {
BOOST_AUTO_TEST_CASE(TestMatchingWells_AND) { BOOST_AUTO_TEST_CASE(TestMatchingWells_AND) {
Action::AST ast({"WOPR", "*", ">", "1.0", "AND", "WWCT", "*", "<", "0.50"}); Action::AST ast({"WOPR", "*", ">", "1.0", "AND", "WWCT", "*", "<", "0.50"});
SummaryState st; SummaryState st(std::chrono::system_clock::now());
st.update_well_var("OPX", "WOPR", 0); st.update_well_var("OPX", "WOPR", 0);
st.update_well_var("OPY", "WOPR", 0.50); st.update_well_var("OPY", "WOPR", 0.50);
@ -546,7 +546,7 @@ BOOST_AUTO_TEST_CASE(TestMatchingWells_AND) {
BOOST_AUTO_TEST_CASE(TestMatchingWells_OR) { BOOST_AUTO_TEST_CASE(TestMatchingWells_OR) {
Action::AST ast({"WOPR", "*", ">", "1.0", "OR", "WWCT", "*", "<", "0.50"}); Action::AST ast({"WOPR", "*", ">", "1.0", "OR", "WWCT", "*", "<", "0.50"});
SummaryState st; SummaryState st(std::chrono::system_clock::now());
st.update_well_var("OPX", "WOPR", 0); st.update_well_var("OPX", "WOPR", 0);
st.update_well_var("OPY", "WOPR", 0.50); st.update_well_var("OPY", "WOPR", 0.50);
@ -571,7 +571,7 @@ BOOST_AUTO_TEST_CASE(TestMatchingWells_OR) {
BOOST_AUTO_TEST_CASE(TestFieldAND) { BOOST_AUTO_TEST_CASE(TestFieldAND) {
Action::AST ast({"FMWPR", ">=", "4", "AND", "WUPR3", "OP*", "=", "1"}); Action::AST ast({"FMWPR", ">=", "4", "AND", "WUPR3", "OP*", "=", "1"});
SummaryState st; SummaryState st(std::chrono::system_clock::now());
Action::Context context(st); Action::Context context(st);
st.update_well_var("OP1", "WUPR3", 3); st.update_well_var("OP1", "WUPR3", 3);

View File

@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE(CreateGroup_SetInjectorProducer_CorrectStatusSet) {
BOOST_AUTO_TEST_CASE(ControlModeOK) { BOOST_AUTO_TEST_CASE(ControlModeOK) {
Opm::Group2 group("G1" , 1, 0, 0, UnitSystem::newMETRIC()); Opm::Group2 group("G1" , 1, 0, 0, UnitSystem::newMETRIC());
Opm::SummaryState st; Opm::SummaryState st(std::chrono::system_clock::now());
const auto& inj = group.injectionControls(st); const auto& inj = group.injectionControls(st);
BOOST_CHECK( Opm::Group2::InjectionCMode::NONE == inj.cmode); BOOST_CHECK( Opm::Group2::InjectionCMode::NONE == inj.cmode);
} }
@ -84,7 +84,7 @@ BOOST_AUTO_TEST_CASE(ControlModeOK) {
BOOST_AUTO_TEST_CASE(GroupChangePhaseSameTimeThrows) { BOOST_AUTO_TEST_CASE(GroupChangePhaseSameTimeThrows) {
Opm::Group2 group("G1" , 1, 0, 0, UnitSystem::newMETRIC()); Opm::Group2 group("G1" , 1, 0, 0, UnitSystem::newMETRIC());
Opm::SummaryState st; Opm::SummaryState st(std::chrono::system_clock::now());
const auto& inj = group.injectionControls(st); const auto& inj = group.injectionControls(st);
BOOST_CHECK_EQUAL( Opm::Phase::WATER , inj.phase); // Default phase - assumed WATER BOOST_CHECK_EQUAL( Opm::Phase::WATER , inj.phase); // Default phase - assumed WATER
} }
@ -285,7 +285,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithGCONPROD) {
Eclipse3DProperties eclipseProperties ( deck , table, grid); Eclipse3DProperties eclipseProperties ( deck , table, grid);
Runspec runspec (deck ); Runspec runspec (deck );
Opm::Schedule schedule(deck, grid, eclipseProperties, runspec); Opm::Schedule schedule(deck, grid, eclipseProperties, runspec);
SummaryState st; SummaryState st(std::chrono::system_clock::now());
const auto& group1 = schedule.getGroup2("G1", 0); const auto& group1 = schedule.getGroup2("G1", 0);
const auto& group2 = schedule.getGroup2("G2", 0); const auto& group2 = schedule.getGroup2("G2", 0);

View File

@ -1193,7 +1193,7 @@ BOOST_AUTO_TEST_CASE(createDeckModifyMultipleGCONPROD) {
Eclipse3DProperties eclipseProperties ( deck , table, grid); Eclipse3DProperties eclipseProperties ( deck , table, grid);
Runspec runspec (deck); Runspec runspec (deck);
Opm::Schedule schedule(deck, grid, eclipseProperties, runspec); Opm::Schedule schedule(deck, grid, eclipseProperties, runspec);
Opm::SummaryState st; Opm::SummaryState st(std::chrono::system_clock::now());
Opm::UnitSystem unitSystem = deck.getActiveUnitSystem(); Opm::UnitSystem unitSystem = deck.getActiveUnitSystem();
double siFactorL = unitSystem.parse("LiquidSurfaceVolume/Time").getSIScaling(); double siFactorL = unitSystem.parse("LiquidSurfaceVolume/Time").getSIScaling();

View File

@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE(MIX_SCALAR) {
UDQFunctionTable udqft; UDQFunctionTable udqft;
UDQParams udqp; UDQParams udqp;
UDQDefine def_add(udqp, "WU", {"WOPR", "+", "1"}); UDQDefine def_add(udqp, "WU", {"WOPR", "+", "1"});
SummaryState st; SummaryState st(std::chrono::system_clock::now());
UDQContext context(udqft, st); UDQContext context(udqft, st);
st.update_well_var("P1", "WOPR", 1); st.update_well_var("P1", "WOPR", 1);
@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(UDQFieldSetTest) {
UDQFunctionTable udqft(udqp); UDQFunctionTable udqft(udqp);
UDQDefine def_fxxx(udqp, "FU_SCALAR", {"123"}); UDQDefine def_fxxx(udqp, "FU_SCALAR", {"123"});
UDQDefine def_fopr(udqp, "FUOPR", {"SUM", "(", "WOPR", ")"}); UDQDefine def_fopr(udqp, "FUOPR", {"SUM", "(", "WOPR", ")"});
SummaryState st; SummaryState st(std::chrono::system_clock::now());
UDQContext context(udqft, st); UDQContext context(udqft, st);
st.update_well_var("P1", "WOPR", 1.0); st.update_well_var("P1", "WOPR", 1.0);
@ -149,7 +149,7 @@ BOOST_AUTO_TEST_CASE(UDQ_GROUP_TEST) {
UDQParams udqp; UDQParams udqp;
UDQFunctionTable udqft(udqp); UDQFunctionTable udqft(udqp);
UDQDefine def_fopr(udqp, "FUOPR", {"SUM", "(", "GOPR", ")"}); UDQDefine def_fopr(udqp, "FUOPR", {"SUM", "(", "GOPR", ")"});
SummaryState st; SummaryState st(std::chrono::system_clock::now());
UDQContext context(udqft, st); UDQContext context(udqft, st);
st.update_group_var("G1", "GOPR", 1.0); st.update_group_var("G1", "GOPR", 1.0);
@ -170,7 +170,7 @@ BOOST_AUTO_TEST_CASE(UDQ_DEFINETEST) {
UDQFunctionTable udqft(udqp); UDQFunctionTable udqft(udqp);
{ {
UDQDefine def(udqp, "WUBHP", {"WBHP"}); UDQDefine def(udqp, "WUBHP", {"WBHP"});
SummaryState st; SummaryState st(std::chrono::system_clock::now());
UDQContext context(udqft, st); UDQContext context(udqft, st);
st.update_well_var("W1", "WBHP", 11); st.update_well_var("W1", "WBHP", 11);
@ -184,7 +184,7 @@ BOOST_AUTO_TEST_CASE(UDQ_DEFINETEST) {
} }
{ {
UDQDefine def(udqp, "WUBHP", {"WBHP" , "'P*'"}); UDQDefine def(udqp, "WUBHP", {"WBHP" , "'P*'"});
SummaryState st; SummaryState st(std::chrono::system_clock::now());
UDQContext context(udqft, st); UDQContext context(udqft, st);
@ -201,7 +201,7 @@ BOOST_AUTO_TEST_CASE(UDQ_DEFINETEST) {
} }
{ {
UDQDefine def(udqp, "WUBHP", {"NINT" , "(", "WBHP", ")"}); UDQDefine def(udqp, "WUBHP", {"NINT" , "(", "WBHP", ")"});
SummaryState st; SummaryState st(std::chrono::system_clock::now());
UDQContext context(udqft, st); UDQContext context(udqft, st);
st.update_well_var("P1", "WBHP", 4); st.update_well_var("P1", "WBHP", 4);
st.update_well_var("P2", "WBHP", 3); st.update_well_var("P2", "WBHP", 3);
@ -437,7 +437,7 @@ ASSIGN WU2 8.0 /
BOOST_AUTO_TEST_CASE(UDQ_CONTEXT) { BOOST_AUTO_TEST_CASE(UDQ_CONTEXT) {
SummaryState st; SummaryState st(std::chrono::system_clock::now());
UDQFunctionTable func_table; UDQFunctionTable func_table;
UDQParams udqp; UDQParams udqp;
UDQContext ctx(func_table, st); UDQContext ctx(func_table, st);
@ -846,7 +846,7 @@ BOOST_AUTO_TEST_CASE(UDQ_POW_TEST) {
UDQParams udqp; UDQParams udqp;
UDQDefine def_pow1(udqp, "WU", {"WOPR", "+", "WWPR", "*", "WGOR", "^", "WWIR"}); UDQDefine def_pow1(udqp, "WU", {"WOPR", "+", "WWPR", "*", "WGOR", "^", "WWIR"});
UDQDefine def_pow2(udqp, "WU", {"(", "WOPR", "+", "WWPR", ")", "^", "(", "WOPR", "+" , "WGOR", "*", "WWIR", "-", "WOPT", ")"}); UDQDefine def_pow2(udqp, "WU", {"(", "WOPR", "+", "WWPR", ")", "^", "(", "WOPR", "+" , "WGOR", "*", "WWIR", "-", "WOPT", ")"});
SummaryState st; SummaryState st(std::chrono::system_clock::now());
UDQContext context(udqft, st); UDQContext context(udqft, st);
st.update_well_var("P1", "WOPR", 1); st.update_well_var("P1", "WOPR", 1);
@ -865,7 +865,7 @@ BOOST_AUTO_TEST_CASE(UDQ_CMP_TEST) {
UDQFunctionTable udqft; UDQFunctionTable udqft;
UDQParams udqp; UDQParams udqp;
UDQDefine def_cmp(udqp, "WU", {"WOPR", ">", "WWPR", "+", "WGOR", "*", "WWIR"}); UDQDefine def_cmp(udqp, "WU", {"WOPR", ">", "WWPR", "+", "WGOR", "*", "WWIR"});
SummaryState st; SummaryState st(std::chrono::system_clock::now());
UDQContext context(udqft, st); UDQContext context(udqft, st);
st.update_well_var("P1", "WOPR", 0); st.update_well_var("P1", "WOPR", 0);
@ -892,7 +892,7 @@ BOOST_AUTO_TEST_CASE(UDQ_CMP_TEST) {
BOOST_AUTO_TEST_CASE(UDQ_SCALAR_SET) { BOOST_AUTO_TEST_CASE(UDQ_SCALAR_SET) {
UDQParams udqp; UDQParams udqp;
UDQFunctionTable udqft; UDQFunctionTable udqft;
SummaryState st; SummaryState st(std::chrono::system_clock::now());
UDQContext context(udqft, st); UDQContext context(udqft, st);
st.update_well_var("P1", "WOPR", 1); st.update_well_var("P1", "WOPR", 1);
@ -963,7 +963,7 @@ BOOST_AUTO_TEST_CASE(UDQ_BASIC_MATH_TEST) {
UDQDefine def_div(udqp, "WU2OPR", {"WOPR", "/", "WOPR"}); UDQDefine def_div(udqp, "WU2OPR", {"WOPR", "/", "WOPR"});
UDQDefine def_muladd(udqp , "WUX", {"WOPR", "+", "WOPR", "*", "WOPR"}); UDQDefine def_muladd(udqp , "WUX", {"WOPR", "+", "WOPR", "*", "WOPR"});
UDQDefine def_wuwct(udqp , "WUWCT", {"WWPR", "/", "(", "WOPR", "+", "WWPR", ")"}); UDQDefine def_wuwct(udqp , "WUWCT", {"WWPR", "/", "(", "WOPR", "+", "WWPR", ")"});
SummaryState st; SummaryState st(std::chrono::system_clock::now());
UDQContext context(udqft, st); UDQContext context(udqft, st);
st.update_well_var("P1", "WOPR", 1); st.update_well_var("P1", "WOPR", 1);
@ -1023,7 +1023,7 @@ BOOST_AUTO_TEST_CASE(DECK_TEST) {
UDQParams udqp; UDQParams udqp;
UDQFunctionTable udqft(udqp); UDQFunctionTable udqft(udqp);
UDQDefine def(udqp, "WUOPRL", {"(", "WOPR", "OP1", "-", "150", ")", "*", "0.90"}); UDQDefine def(udqp, "WUOPRL", {"(", "WOPR", "OP1", "-", "150", ")", "*", "0.90"});
SummaryState st; SummaryState st(std::chrono::system_clock::now());
UDQContext context(udqft, st); UDQContext context(udqft, st);
st.update_well_var("OP1", "WOPR", 300); st.update_well_var("OP1", "WOPR", 300);
@ -1055,7 +1055,7 @@ BOOST_AUTO_TEST_CASE(UDQ_PARSE_ERROR) {
parseContext.update(ParseContext::UDQ_PARSE_ERROR, InputError::IGNORE); parseContext.update(ParseContext::UDQ_PARSE_ERROR, InputError::IGNORE);
{ {
UDQDefine def1(udqp, "WUBHP", tokens, parseContext, errors); UDQDefine def1(udqp, "WUBHP", tokens, parseContext, errors);
SummaryState st; SummaryState st(std::chrono::system_clock::now());
UDQFunctionTable udqft(udqp); UDQFunctionTable udqft(udqp);
UDQContext context(udqft, st); UDQContext context(udqft, st);
st.update_well_var("P1", "WBHP", 1); st.update_well_var("P1", "WBHP", 1);
@ -1079,7 +1079,7 @@ BOOST_AUTO_TEST_CASE(UDQ_TYPE_ERROR) {
UDQDefine def1(udqp, "FUBHP", tokens1, parseContext, errors); UDQDefine def1(udqp, "FUBHP", tokens1, parseContext, errors);
UDQDefine def2(udqp, "WUBHP", tokens2, parseContext, errors); UDQDefine def2(udqp, "WUBHP", tokens2, parseContext, errors);
SummaryState st; SummaryState st(std::chrono::system_clock::now());
UDQFunctionTable udqft(udqp); UDQFunctionTable udqft(udqp);
UDQContext context(udqft, st); UDQContext context(udqft, st);
st.update_well_var("P1", "WBHP", 1); st.update_well_var("P1", "WBHP", 1);

View File

@ -759,7 +759,7 @@ BOOST_AUTO_TEST_CASE(CMODE_DEFAULT) {
BOOST_AUTO_TEST_CASE(WELL_CONTROLS) { BOOST_AUTO_TEST_CASE(WELL_CONTROLS) {
Opm::Well2 well("WELL", "GROUP", 0, 0, 0, 0, 1000, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Opm::Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0); Opm::Well2 well("WELL", "GROUP", 0, 0, 0, 0, 1000, Opm::Phase::OIL, Opm::Well2::ProducerCMode::CMODE_UNDEFINED, Opm::Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);
Opm::Well2::WellProductionProperties prod("OP1"); Opm::Well2::WellProductionProperties prod("OP1");
Opm::SummaryState st; Opm::SummaryState st(std::chrono::system_clock::now());
well.productionControls(st); well.productionControls(st);
// Use a scalar FIELD variable - that should work; although it is a bit weird. // Use a scalar FIELD variable - that should work; although it is a bit weird.

View File

@ -1396,7 +1396,7 @@ BOOST_AUTO_TEST_CASE( WCONINJE ) {
Eclipse3DProperties eclipseProperties( deck , table, grid ); Eclipse3DProperties eclipseProperties( deck , table, grid );
Runspec runspec (deck); Runspec runspec (deck);
Schedule sched( deck, grid, eclipseProperties, runspec); Schedule sched( deck, grid, eclipseProperties, runspec);
SummaryState st; SummaryState st(std::chrono::system_clock::now());
BOOST_CHECK_EQUAL(5U, sched.numWells()); BOOST_CHECK_EQUAL(5U, sched.numWells());
BOOST_CHECK(sched.hasWell("PROD1")); BOOST_CHECK(sched.hasWell("PROD1"));

View File

@ -205,7 +205,7 @@ BOOST_AUTO_TEST_CASE(WellTesting) {
BOOST_CHECK( sched.getWell2("W_1", 9).isInjector()); BOOST_CHECK( sched.getWell2("W_1", 9).isInjector());
{ {
SummaryState st; SummaryState st(std::chrono::system_clock::now());
const auto controls = sched.getWell2("W_1", 9).injectionControls(st); const auto controls = sched.getWell2("W_1", 9).injectionControls(st);
BOOST_CHECK_CLOSE(20000/Metric::Time , controls.surface_rate , 0.001); BOOST_CHECK_CLOSE(20000/Metric::Time , controls.surface_rate , 0.001);
BOOST_CHECK_CLOSE(200000/Metric::Time , controls.reservoir_rate, 0.001); BOOST_CHECK_CLOSE(200000/Metric::Time , controls.reservoir_rate, 0.001);
@ -224,7 +224,7 @@ BOOST_AUTO_TEST_CASE(WellTesting) {
BOOST_CHECK( Well2::Status::SHUT == sched.getWell2("W_1", 13).getStatus( )); BOOST_CHECK( Well2::Status::SHUT == sched.getWell2("W_1", 13).getStatus( ));
BOOST_CHECK( Well2::Status::OPEN == sched.getWell2("W_1", 14).getStatus( )); BOOST_CHECK( Well2::Status::OPEN == sched.getWell2("W_1", 14).getStatus( ));
{ {
SummaryState st; SummaryState st(std::chrono::system_clock::now());
const auto controls = sched.getWell2("W_1", 12).injectionControls(st); const auto controls = sched.getWell2("W_1", 12).injectionControls(st);
BOOST_CHECK( controls.hasControl(Well2::InjectorCMode::RATE )); BOOST_CHECK( controls.hasControl(Well2::InjectorCMode::RATE ));
BOOST_CHECK( !controls.hasControl(Well2::InjectorCMode::RESV)); BOOST_CHECK( !controls.hasControl(Well2::InjectorCMode::RESV));
@ -333,7 +333,7 @@ BOOST_AUTO_TEST_CASE( WellTestGroups ) {
Eclipse3DProperties eclipseProperties ( deck , table, grid); Eclipse3DProperties eclipseProperties ( deck , table, grid);
Runspec runspec (deck); Runspec runspec (deck);
Schedule sched(deck, grid , eclipseProperties, runspec); Schedule sched(deck, grid , eclipseProperties, runspec);
SummaryState st; SummaryState st(std::chrono::system_clock::now());
BOOST_CHECK_EQUAL( 3U , sched.numGroups() ); BOOST_CHECK_EQUAL( 3U , sched.numGroups() );
BOOST_CHECK( sched.hasGroup( "INJ" )); BOOST_CHECK( sched.hasGroup( "INJ" ));

View File

@ -430,7 +430,7 @@ END
Opm::SummaryState sim_state() Opm::SummaryState sim_state()
{ {
auto state = Opm::SummaryState{}; auto state = Opm::SummaryState{std::chrono::system_clock::now()};
state.update("GOPR:GRP1", 235.); state.update("GOPR:GRP1", 235.);
state.update("GGPR:GRP1", 100237.); state.update("GGPR:GRP1", 100237.);

View File

@ -496,7 +496,7 @@ END
Opm::SummaryState sim_state() Opm::SummaryState sim_state()
{ {
auto state = Opm::SummaryState{}; auto state = Opm::SummaryState{std::chrono::system_clock::now()};
state.update("SPR:PROD:1", 235.); state.update("SPR:PROD:1", 235.);
state.update("SPR:PROD:2", 237.); state.update("SPR:PROD:2", 237.);

View File

@ -216,7 +216,7 @@ TSTEP -- 8
Opm::SummaryState sim_state() Opm::SummaryState sim_state()
{ {
auto state = Opm::SummaryState{}; auto state = Opm::SummaryState{std::chrono::system_clock::now()};
state.update("WOPR:OP_1" , 1.0); state.update("WOPR:OP_1" , 1.0);
state.update("WWPR:OP_1" , 2.0); state.update("WWPR:OP_1" , 2.0);

View File

@ -292,7 +292,7 @@ BOOST_AUTO_TEST_CASE(EclipseIOIntegration) {
auto& eclGrid = es.getInputGrid(); auto& eclGrid = es.getInputGrid();
Schedule schedule(deck, eclGrid, es.get3DProperties(), es.runspec()); Schedule schedule(deck, eclGrid, es.get3DProperties(), es.runspec());
SummaryConfig summary_config( deck, schedule, es.getTableManager( )); SummaryConfig summary_config( deck, schedule, es.getTableManager( ));
SummaryState st; SummaryState st(std::chrono::system_clock::now());
es.getIOConfig().setBaseName( "FOO" ); es.getIOConfig().setBaseName( "FOO" );
EclipseIO eclWriter( es, eclGrid , schedule, summary_config); EclipseIO eclWriter( es, eclGrid , schedule, summary_config);

View File

@ -271,7 +271,7 @@ BOOST_AUTO_TEST_CASE(test_RFT)
const auto start_time = schedule.posixStartTime(); const auto start_time = schedule.posixStartTime();
const auto step_time = timeStamp(::Opm::EclIO::ERft::RftDate{ 2008, 10, 10 }); const auto step_time = timeStamp(::Opm::EclIO::ERft::RftDate{ 2008, 10, 10 });
SummaryState st; SummaryState st(std::chrono::system_clock::now());
data::Rates r1, r2; data::Rates r1, r2;
r1.set( data::Rates::opt::wat, 4.11 ); r1.set( data::Rates::opt::wat, 4.11 );
@ -385,7 +385,7 @@ BOOST_AUTO_TEST_CASE(test_RFT2)
Schedule schedule(deck, eclipseState); Schedule schedule(deck, eclipseState);
SummaryConfig summary_config( deck, schedule, eclipseState.getTableManager( )); SummaryConfig summary_config( deck, schedule, eclipseState.getTableManager( ));
SummaryState st; SummaryState st(std::chrono::system_clock::now());
const auto start_time = schedule.posixStartTime(); const auto start_time = schedule.posixStartTime();
const auto& time_map = schedule.getTimeMap( ); const auto& time_map = schedule.getTimeMap( );

View File

@ -349,7 +349,7 @@ data::Solution mkSolution( int numCells ) {
Opm::SummaryState sim_state() Opm::SummaryState sim_state()
{ {
auto state = Opm::SummaryState{}; auto state = Opm::SummaryState{std::chrono::system_clock::now()};
state.update("WOPR:OP_1" , 1.0); state.update("WOPR:OP_1" , 1.0);
state.update("WWPR:OP_1" , 2.0); state.update("WWPR:OP_1" , 2.0);
@ -546,7 +546,7 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData) {
Setup setup("FIRST_SIM.DATA"); Setup setup("FIRST_SIM.DATA");
EclipseIO eclWriter( setup.es, setup.grid, setup.schedule, setup.summary_config); EclipseIO eclWriter( setup.es, setup.grid, setup.schedule, setup.summary_config);
SummaryState st; SummaryState st(std::chrono::system_clock::now());
auto state1 = first_sim( setup.es , eclWriter , st, false ); auto state1 = first_sim( setup.es , eclWriter , st, false );
auto state2 = second_sim( eclWriter , st , keys ); auto state2 = second_sim( eclWriter , st , keys );
compare(state1, state2 , keys); compare(state1, state2 , keys);
@ -680,7 +680,7 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData_double) {
test_work_area_copy_file( test_area, "FIRST_SIM.DATA"); test_work_area_copy_file( test_area, "FIRST_SIM.DATA");
Setup setup("FIRST_SIM.DATA"); Setup setup("FIRST_SIM.DATA");
EclipseIO eclWriter( setup.es, setup.grid, setup.schedule, setup.summary_config); EclipseIO eclWriter( setup.es, setup.grid, setup.schedule, setup.summary_config);
SummaryState st; SummaryState st(std::chrono::system_clock::now());
auto state1 = first_sim( setup.es , eclWriter , st, true); auto state1 = first_sim( setup.es , eclWriter , st, true);
auto state2 = second_sim( eclWriter ,st, solution_keys ); auto state2 = second_sim( eclWriter ,st, solution_keys );
@ -698,7 +698,7 @@ BOOST_AUTO_TEST_CASE(WriteWrongSOlutionSize) {
auto num_cells = setup.grid.getNumActive( ) + 1; auto num_cells = setup.grid.getNumActive( ) + 1;
auto cells = mkSolution( num_cells ); auto cells = mkSolution( num_cells );
auto wells = mkWells(); auto wells = mkWells();
Opm::SummaryState sumState; Opm::SummaryState sumState(std::chrono::system_clock::now());
const auto seqnum = 1; const auto seqnum = 1;
auto rstFile = OS::Restart { auto rstFile = OS::Restart {
@ -751,7 +751,7 @@ BOOST_AUTO_TEST_CASE(ExtraData_content) {
const auto& units = setup.es.getUnits(); const auto& units = setup.es.getUnits();
{ {
RestartValue restart_value(cells, wells); RestartValue restart_value(cells, wells);
SummaryState st; SummaryState st(std::chrono::system_clock::now());
const auto sumState = sim_state(); const auto sumState = sim_state();
restart_value.addExtra("EXTRA", UnitSystem::measure::pressure, {10,1,2,3}); restart_value.addExtra("EXTRA", UnitSystem::measure::pressure, {10,1,2,3});
@ -947,7 +947,7 @@ BOOST_AUTO_TEST_CASE(Restore_Cumulatives)
setup.es, setup.grid, setup.schedule, sumState); setup.es, setup.grid, setup.schedule, sumState);
} }
SummaryState rstSumState; SummaryState rstSumState(std::chrono::system_clock::now());
RestartIO::load(OS::outputFileName(rset, "UNRST"), seqnum, rstSumState, RestartIO::load(OS::outputFileName(rset, "UNRST"), seqnum, rstSumState,
/* solution_keys = */ { /* solution_keys = */ {
RestartKey("SWAT", UnitSystem::measure::identity), RestartKey("SWAT", UnitSystem::measure::identity),

View File

@ -311,7 +311,7 @@ BOOST_AUTO_TEST_CASE(well_keywords) {
util_make_path( "PATH" ); util_make_path( "PATH" );
cfg.name = "PATH/CASE"; cfg.name = "PATH/CASE";
SummaryState st; SummaryState st(std::chrono::system_clock::now());
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name ); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name );
writer.eval(st, 0, 0*day, cfg.es, cfg.schedule, cfg.wells, {}); writer.eval(st, 0, 0*day, cfg.es, cfg.schedule, cfg.wells, {});
@ -528,7 +528,7 @@ BOOST_AUTO_TEST_CASE(udq_keywords) {
setup cfg( "test_summary_udq" ); setup cfg( "test_summary_udq" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name ); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name );
SummaryState st; SummaryState st(std::chrono::system_clock::now());
writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {});
writer.add_timestep( st, 0); writer.add_timestep( st, 0);
writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {});
@ -550,7 +550,7 @@ BOOST_AUTO_TEST_CASE(group_keywords) {
setup cfg( "test_summary_group" ); setup cfg( "test_summary_group" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
SummaryState st; SummaryState st(std::chrono::system_clock::now());
writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {});
writer.add_timestep( st, 0); writer.add_timestep( st, 0);
@ -694,7 +694,7 @@ BOOST_AUTO_TEST_CASE(group_group) {
setup cfg( "test_summary_group_group" , "group_group.DATA"); setup cfg( "test_summary_group_group" , "group_group.DATA");
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
SummaryState st; SummaryState st(std::chrono::system_clock::now());
writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {});
writer.add_timestep( st, 0); writer.add_timestep( st, 0);
writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {});
@ -750,7 +750,7 @@ BOOST_AUTO_TEST_CASE(completion_kewords) {
setup cfg( "test_summary_completion" ); setup cfg( "test_summary_completion" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
SummaryState st; SummaryState st(std::chrono::system_clock::now());
writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {});
writer.add_timestep( st, 0); writer.add_timestep( st, 0);
writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {});
@ -812,7 +812,7 @@ BOOST_AUTO_TEST_CASE(field_keywords) {
setup cfg( "test_summary_field" ); setup cfg( "test_summary_field" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
SummaryState st; SummaryState st(std::chrono::system_clock::now());
writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {});
writer.add_timestep( st, 0); writer.add_timestep( st, 0);
writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {});
@ -941,7 +941,7 @@ BOOST_AUTO_TEST_CASE(report_steps_time) {
setup cfg( "test_summary_report_steps_time" ); setup cfg( "test_summary_report_steps_time" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
SummaryState st; SummaryState st(std::chrono::system_clock::now());
writer.eval( st, 1, 2 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 1, 2 * day, cfg.es, cfg.schedule, cfg.wells , {});
writer.add_timestep( st, 1); writer.add_timestep( st, 1);
writer.eval( st, 1, 5 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 1, 5 * day, cfg.es, cfg.schedule, cfg.wells , {});
@ -967,7 +967,7 @@ BOOST_AUTO_TEST_CASE(skip_unknown_var) {
setup cfg( "test_summary_skip_unknown_var" ); setup cfg( "test_summary_skip_unknown_var" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
SummaryState st; SummaryState st(std::chrono::system_clock::now());
writer.eval( st, 1, 2 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 1, 2 * day, cfg.es, cfg.schedule, cfg.wells , {});
writer.add_timestep( st, 1); writer.add_timestep( st, 1);
writer.eval( st, 1, 5 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 1, 5 * day, cfg.es, cfg.schedule, cfg.wells , {});
@ -1078,7 +1078,7 @@ BOOST_AUTO_TEST_CASE(region_vars) {
{ {
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
SummaryState st; SummaryState st(std::chrono::system_clock::now());
writer.eval( st, 1, 2 * day, cfg.es, cfg.schedule, cfg.wells, {}, region_values); writer.eval( st, 1, 2 * day, cfg.es, cfg.schedule, cfg.wells, {}, region_values);
writer.add_timestep( st, 1); writer.add_timestep( st, 1);
writer.eval( st, 1, 5 * day, cfg.es, cfg.schedule, cfg.wells, {}, region_values); writer.eval( st, 1, 5 * day, cfg.es, cfg.schedule, cfg.wells, {}, region_values);
@ -1129,7 +1129,7 @@ BOOST_AUTO_TEST_CASE(region_production) {
{ {
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
SummaryState st; SummaryState st(std::chrono::system_clock::now());
writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {});
writer.add_timestep( st, 0); writer.add_timestep( st, 0);
writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {});
@ -1161,7 +1161,7 @@ BOOST_AUTO_TEST_CASE(region_injection) {
setup cfg( "region_injection" ); setup cfg( "region_injection" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
SummaryState st; SummaryState st(std::chrono::system_clock::now());
writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {});
writer.add_timestep( st, 0); writer.add_timestep( st, 0);
writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {});
@ -1217,7 +1217,7 @@ BOOST_AUTO_TEST_CASE(BLOCK_VARIABLES) {
block_values[std::make_pair("BOVIS", 1)] = 33.0; block_values[std::make_pair("BOVIS", 1)] = 33.0;
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
SummaryState st; SummaryState st(std::chrono::system_clock::now());
writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {},{}, block_values); writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {},{}, block_values);
writer.add_timestep( st, 0); writer.add_timestep( st, 0);
writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {},{}, block_values); writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {},{}, block_values);
@ -1314,7 +1314,7 @@ BOOST_AUTO_TEST_CASE(MISC) {
setup cfg( "test_misc"); setup cfg( "test_misc");
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name ); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name );
SummaryState st; SummaryState st(std::chrono::system_clock::now());
writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , {});
writer.add_timestep( st, 0); writer.add_timestep( st, 0);
writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {}); writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , {});
@ -1334,7 +1334,7 @@ BOOST_AUTO_TEST_CASE(EXTRA) {
{ {
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name ); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name );
SummaryState st; SummaryState st(std::chrono::system_clock::now());
writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , { {"TCPU" , 0 }}); writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells , { {"TCPU" , 0 }});
writer.add_timestep( st, 0); writer.add_timestep( st, 0);
writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , { {"TCPU" , 1 }}); writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells , { {"TCPU" , 1 }});
@ -1432,7 +1432,7 @@ BOOST_AUTO_TEST_CASE(efficiency_factor) {
setup cfg( "test_efficiency_factor", "SUMMARY_EFF_FAC.DATA" ); setup cfg( "test_efficiency_factor", "SUMMARY_EFF_FAC.DATA" );
out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name );
SummaryState st; SummaryState st(std::chrono::system_clock::now());
writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells, {}); writer.eval( st, 0, 0 * day, cfg.es, cfg.schedule, cfg.wells, {});
writer.add_timestep( st, 0); writer.add_timestep( st, 0);
writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells, {}); writer.eval( st, 1, 1 * day, cfg.es, cfg.schedule, cfg.wells, {});
@ -1504,7 +1504,7 @@ BOOST_AUTO_TEST_CASE(efficiency_factor) {
BOOST_AUTO_TEST_CASE(Test_SummaryState) { BOOST_AUTO_TEST_CASE(Test_SummaryState) {
Opm::SummaryState st; Opm::SummaryState st(std::chrono::system_clock::now());
st.update("WWCT:OP_2", 100); st.update("WWCT:OP_2", 100);
BOOST_CHECK_CLOSE(st.get("WWCT:OP_2"), 100, 1e-5); BOOST_CHECK_CLOSE(st.get("WWCT:OP_2"), 100, 1e-5);
BOOST_CHECK_THROW(st.get("NO_SUCH_KEY"), std::out_of_range); BOOST_CHECK_THROW(st.get("NO_SUCH_KEY"), std::out_of_range);
@ -1569,7 +1569,7 @@ namespace {
config.schedule, "Ignore.This" config.schedule, "Ignore.This"
}; };
SummaryState st; SummaryState st(std::chrono::system_clock::now());
smry.eval(st, 0, 0*day, config.es, config.schedule, config.wells, {}); smry.eval(st, 0, 0*day, config.es, config.schedule, config.wells, {});
smry.add_timestep(st, 0); smry.add_timestep(st, 0);
smry.eval(st, 1, 1*day, config.es, config.schedule, config.wells, {}); smry.eval(st, 1, 1*day, config.es, config.schedule, config.wells, {});
@ -2565,7 +2565,7 @@ BOOST_AUTO_TEST_CASE(Write_Read)
config.es, config.config, config.grid, config.schedule config.es, config.config, config.grid, config.schedule
}; };
SummaryState st; SummaryState st(std::chrono::system_clock::now());
writer.eval(st, 0, 0*day, config.es, config.schedule, config.wells, {}); writer.eval(st, 0, 0*day, config.es, config.schedule, config.wells, {});
writer.add_timestep(st, 0); writer.add_timestep(st, 0);
writer.eval(st, 1, 1*day, config.es, config.schedule, config.wells, {}); writer.eval(st, 1, 1*day, config.es, config.schedule, config.wells, {});
@ -3061,7 +3061,7 @@ BOOST_AUTO_TEST_SUITE(Reset_Cumulative_Vectors)
BOOST_AUTO_TEST_CASE(SummaryState_TOTAL) { BOOST_AUTO_TEST_CASE(SummaryState_TOTAL) {
SummaryState st; SummaryState st(std::chrono::system_clock::now());
st.update("FOPR", 100); st.update("FOPR", 100);
BOOST_CHECK_EQUAL(st.get("FOPR"), 100); BOOST_CHECK_EQUAL(st.get("FOPR"), 100);
st.update("FOPR", 100); st.update("FOPR", 100);
@ -3162,7 +3162,7 @@ bool equal(const SummaryState& st1 , const SummaryState& st2) {
void test_serialize(const SummaryState& st) { void test_serialize(const SummaryState& st) {
SummaryState st2; SummaryState st2(std::chrono::system_clock::now());
auto serial = st.serialize(); auto serial = st.serialize();
st2.deserialize(serial); st2.deserialize(serial);
BOOST_CHECK( equal(st, st2)); BOOST_CHECK( equal(st, st2));
@ -3175,7 +3175,7 @@ void test_serialize(const SummaryState& st) {
BOOST_AUTO_TEST_CASE(serialize_sumary_state) { BOOST_AUTO_TEST_CASE(serialize_sumary_state) {
SummaryState st; SummaryState st(std::chrono::system_clock::now());
test_serialize(st); test_serialize(st);
st.update_elapsed(1000); st.update_elapsed(1000);

View File

@ -151,7 +151,7 @@ BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo) {
const auto num_cells = grid.getCartesianSize(); const auto num_cells = grid.getCartesianSize();
EclipseIO eclipseWriter( es, grid , schedule, summary_config); EclipseIO eclipseWriter( es, grid , schedule, summary_config);
int countTimeStep = schedule.getTimeMap().numTimesteps(); int countTimeStep = schedule.getTimeMap().numTimesteps();
SummaryState st; SummaryState st(std::chrono::system_clock::now());
data::Solution solution; data::Solution solution;
solution.insert( "PRESSURE",UnitSystem::measure::pressure , std::vector< double >( num_cells, 1 ) , data::TargetType::RESTART_SOLUTION); solution.insert( "PRESSURE",UnitSystem::measure::pressure , std::vector< double >( num_cells, 1 ) , data::TargetType::RESTART_SOLUTION);