diff --git a/msim/include/opm/msim/msim.hpp b/msim/include/opm/msim/msim.hpp index 34ce4d342..e22783730 100644 --- a/msim/include/opm/msim/msim.hpp +++ b/msim/include/opm/msim/msim.hpp @@ -27,6 +27,7 @@ class Parser; class Python; class SummaryState; class UDQState; +class WellTestState; namespace Action { class State; @@ -48,10 +49,10 @@ public: void post_step(Schedule& schedule, Action::State& action_state, SummaryState& st, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, const time_point& sim_time); private: - void run_step(const Schedule& schedule, Action::State& action_state, SummaryState& st, UDQState& udq_state, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, EclipseIO& io) const; - void run_step(const Schedule& schedule, Action::State& action_state, SummaryState& st, UDQState& udq_state, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, double dt, EclipseIO& io) const; - void output(Action::State& action_state, SummaryState& st, const UDQState& udq_state, size_t report_step, bool substep, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, const data::GroupAndNetworkValues& group_data, EclipseIO& io) const; - void simulate(const Schedule& schedule, const SummaryState& st, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, double seconds_elapsed, double time_step) const; + void run_step(const Schedule& schedule, Action::State& action_state, WellTestState& wtest_state, SummaryState& st, UDQState& udq_state, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, EclipseIO& io) const; + void run_step(const Schedule& schedule, Action::State& action_state, WellTestState& wtest_state, SummaryState& st, UDQState& udq_state, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, double dt, EclipseIO& io) const; + void output(Action::State& action_state, WellTestState& wtest_state, SummaryState& st, const UDQState& udq_state, size_t report_step, bool substep, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, const data::GroupAndNetworkValues& group_data, EclipseIO& io) const; + void simulate(const Schedule& schedule, WellTestState& wtest_state, const SummaryState& st, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, double seconds_elapsed, double time_step) const; EclipseState state; std::map>> well_rates; diff --git a/msim/src/msim.cpp b/msim/src/msim.cpp index e34d773d6..f11ec1e0b 100644 --- a/msim/src/msim.cpp +++ b/msim/src/msim.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -50,6 +51,7 @@ void msim::run(Schedule& schedule, EclipseIO& io, bool report_only) { data::Solution sol; SummaryState st(TimeService::from_time_t(schedule.getStartTime())); UDQState udq_state(schedule.getUDQConfig(0).params().undefinedValue()); + WellTestState wtest_state; Action::State action_state; Python python; @@ -58,10 +60,10 @@ void msim::run(Schedule& schedule, EclipseIO& io, bool report_only) { data::Wells well_data; data::GroupAndNetworkValues group_nwrk_data; if (report_only) - run_step(schedule, action_state, st, udq_state, sol, well_data, group_nwrk_data, report_step, io); + run_step(schedule, action_state, wtest_state, st, udq_state, sol, well_data, group_nwrk_data, report_step, io); else { double time_step = std::min(week, 0.5*schedule.stepLength(report_step - 1)); - run_step(schedule, action_state, st, udq_state, sol, well_data, group_nwrk_data, report_step, time_step, io); + run_step(schedule, action_state, wtest_state, st, udq_state, sol, well_data, group_nwrk_data, report_step, time_step, io); } auto sim_time = TimeService::from_time_t( schedule.simTime(report_step) ); post_step(schedule, action_state, st, sol, well_data, group_nwrk_data, report_step, sim_time); @@ -95,12 +97,12 @@ void msim::post_step(Schedule& schedule, Action::State& action_state, SummarySta -void msim::run_step(const Schedule& schedule, Action::State& action_state, SummaryState& st, UDQState& udq_state, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& grp_nwrk_data, size_t report_step, EclipseIO& io) const { - this->run_step(schedule, action_state, st, udq_state, sol, well_data, grp_nwrk_data, report_step, schedule.stepLength(report_step - 1), io); +void msim::run_step(const Schedule& schedule, Action::State& action_state, WellTestState& wtest_state, SummaryState& st, UDQState& udq_state, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& grp_nwrk_data, size_t report_step, EclipseIO& io) const { + this->run_step(schedule, action_state, wtest_state, st, udq_state, sol, well_data, grp_nwrk_data, report_step, schedule.stepLength(report_step - 1), io); } -void msim::run_step(const Schedule& schedule, Action::State& action_state, SummaryState& st, UDQState& udq_state, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, double dt, EclipseIO& io) const { +void msim::run_step(const Schedule& schedule, Action::State& action_state, WellTestState& wtest_state, SummaryState& st, UDQState& udq_state, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, double dt, EclipseIO& io) const { double start_time = schedule.seconds(report_step - 1); double end_time = schedule.seconds(report_step); double seconds_elapsed = start_time; @@ -110,7 +112,7 @@ void msim::run_step(const Schedule& schedule, Action::State& action_state, Summa if ((seconds_elapsed + time_step) > end_time) time_step = end_time - seconds_elapsed; - this->simulate(schedule, st, sol, well_data, group_nwrk_data, report_step, seconds_elapsed, time_step); + this->simulate(schedule, wtest_state, st, sol, well_data, group_nwrk_data, report_step, seconds_elapsed, time_step); seconds_elapsed += time_step; @@ -127,6 +129,7 @@ void msim::run_step(const Schedule& schedule, Action::State& action_state, Summa schedule.getUDQConfig( report_step ).eval(report_step, schedule.wellMatcher(report_step), st, udq_state); this->output(action_state, + wtest_state, st, udq_state, report_step, @@ -141,9 +144,10 @@ void msim::run_step(const Schedule& schedule, Action::State& action_state, Summa -void msim::output(Action::State& action_state, SummaryState& st, const UDQState& udq_state, size_t report_step, bool substep, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, const data::GroupAndNetworkValues& group_nwrk_data, EclipseIO& io) const { +void msim::output(Action::State& action_state, WellTestState& wtest_state, SummaryState& st, const UDQState& udq_state, size_t report_step, bool substep, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, const data::GroupAndNetworkValues& group_nwrk_data, EclipseIO& io) const { RestartValue value(sol, well_data, group_nwrk_data, {}); io.writeTimeStep(action_state, + wtest_state, st, udq_state, report_step, @@ -153,7 +157,7 @@ void msim::output(Action::State& action_state, SummaryState& st, const UDQState& } -void msim::simulate(const Schedule& schedule, const SummaryState& st, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& /* group_nwrk_data */, size_t report_step, double seconds_elapsed, double time_step) const { +void msim::simulate(const Schedule& schedule, WellTestState& wtest_state, const SummaryState& st, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& /* group_nwrk_data */, size_t report_step, double seconds_elapsed, double time_step) const { for (const auto& sol_pair : this->solutions) { auto func = sol_pair.second; func(this->state, schedule, sol, report_step, seconds_elapsed + time_step); diff --git a/opm/output/eclipse/EclipseIO.hpp b/opm/output/eclipse/EclipseIO.hpp index bdcb86adc..5e9c1deee 100644 --- a/opm/output/eclipse/EclipseIO.hpp +++ b/opm/output/eclipse/EclipseIO.hpp @@ -46,6 +46,7 @@ class Schedule; class SummaryConfig; class SummaryState; class UDQState; +class WellTestState; namespace Action { class State; } /*! * \brief A class to write the reservoir state and the well state of a @@ -179,6 +180,7 @@ public: */ void writeTimeStep( const Action::State& action_state, + const WellTestState& wtest_state, const SummaryState& st, const UDQState& udq_state, int report_step, diff --git a/opm/output/eclipse/RestartIO.hpp b/opm/output/eclipse/RestartIO.hpp index 4ed7703f3..d6d16c640 100644 --- a/opm/output/eclipse/RestartIO.hpp +++ b/opm/output/eclipse/RestartIO.hpp @@ -40,6 +40,7 @@ namespace Opm { class Schedule; class UDQState; class SummaryState; + class WellTestState; } // namespace Opm @@ -86,6 +87,7 @@ namespace Opm { namespace RestartIO { const EclipseGrid& grid, const Schedule& schedule, const Action::State& action_state, + const WellTestState& wtest_state, const SummaryState& sumState, const UDQState& udqState, std::optional& aquiferData, diff --git a/src/opm/output/eclipse/EclipseIO.cpp b/src/opm/output/eclipse/EclipseIO.cpp index e5e939c06..13c4cc8dd 100644 --- a/src/opm/output/eclipse/EclipseIO.cpp +++ b/src/opm/output/eclipse/EclipseIO.cpp @@ -268,6 +268,7 @@ void EclipseIO::writeInitial( data::Solution simProps, std::mapimpl->aquiferData, write_double); } diff --git a/src/opm/output/eclipse/RestartIO.cpp b/src/opm/output/eclipse/RestartIO.cpp index a9647d7a9..95cd4818d 100644 --- a/src/opm/output/eclipse/RestartIO.cpp +++ b/src/opm/output/eclipse/RestartIO.cpp @@ -480,7 +480,7 @@ namespace { const EclipseGrid& grid, const EclipseState& es, const Schedule& schedule, - const data::Wells& wellSol, + const data::Wells& wellSol, const Opm::Action::State& action_state, const Opm::SummaryState& sumState, const std::vector& inteHD, @@ -757,6 +757,7 @@ void save(EclIO::OutputStream::Restart& rstFile, const EclipseGrid& grid, const Schedule& schedule, const Action::State& action_state, + const WellTestState& , const SummaryState& sumState, const UDQState& udqState, std::optional& aquiferData, diff --git a/tests/test_EclipseIO.cpp b/tests/test_EclipseIO.cpp index 9af2390ff..1209fc782 100644 --- a/tests/test_EclipseIO.cpp +++ b/tests/test_EclipseIO.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -325,10 +326,12 @@ BOOST_AUTO_TEST_CASE(EclipseIOIntegration) { sol.insert("KRG", measure::identity , std::vector(3*3*3 , i*10), TargetType::RESTART_AUXILIARY); Action::State action_state; + WellTestState wtest_state; UDQState udq_state(1); RestartValue restart_value(sol, wells, grp_nwrk, {}); auto first_step = ecl_util_make_date( 10 + i, 11, 2008 ); eclWriter.writeTimeStep( action_state, + wtest_state, st, udq_state, i, diff --git a/tests/test_RFT.cpp b/tests/test_RFT.cpp index 8e64ba228..0137d7a09 100644 --- a/tests/test_RFT.cpp +++ b/tests/test_RFT.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -280,6 +281,7 @@ BOOST_AUTO_TEST_CASE(test_RFT) SummaryState st(TimeService::now()); Action::State action_state; UDQState udq_state(1234); + WellTestState wtest_state; data::Rates r1, r2; r1.set( data::Rates::opt::wat, 4.11 ); @@ -322,6 +324,7 @@ BOOST_AUTO_TEST_CASE(test_RFT) RestartValue restart_value(std::move(solution), std::move(wells), std::move(group_nwrk), {}); eclipseWriter.writeTimeStep( action_state, + wtest_state, st, udq_state, 2, @@ -409,6 +412,7 @@ BOOST_AUTO_TEST_CASE(test_RFT2) SummaryState st(Opm::TimeService::now()); Action::State action_state; UDQState udq_state(10); + WellTestState wtest_state; const auto start_time = schedule.posixStartTime(); for (int counter = 0; counter < 2; counter++) { @@ -456,6 +460,7 @@ BOOST_AUTO_TEST_CASE(test_RFT2) RestartValue restart_value(std::move(solution), std::move(wells), data::GroupAndNetworkValues(), {}); eclipseWriter.writeTimeStep( action_state, + wtest_state, st, udq_state, step, diff --git a/tests/test_Restart.cpp b/tests/test_Restart.cpp index 5ca08bb8d..e08e5c2bb 100644 --- a/tests/test_Restart.cpp +++ b/tests/test_Restart.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -390,6 +391,7 @@ struct Setup { RestartValue first_sim(const Setup& setup, Action::State& action_state, SummaryState& st, UDQState& udq_state, bool write_double) { + WellTestState wtest_state; EclipseIO eclWriter( setup.es, setup.grid, setup.schedule, setup.summary_config); auto num_cells = setup.grid.getNumActive( ); int report_step = 1; @@ -404,6 +406,7 @@ RestartValue first_sim(const Setup& setup, Action::State& action_state, SummaryS udq.eval(report_step, setup.schedule.wellMatcher(report_step), st, udq_state); eclWriter.writeTimeStep( action_state, + wtest_state, st, udq_state, report_step, @@ -485,6 +488,7 @@ BOOST_AUTO_TEST_CASE(ECL_FORMATTED) { auto udqState = UDQState{1}; auto aquiferData = std::optional{std::nullopt}; Action::State action_state; + WellTestState wtest_state; { RestartValue restart_value(cells, wells, groups, {}); @@ -507,6 +511,7 @@ BOOST_AUTO_TEST_CASE(ECL_FORMATTED) { base_setup.grid, base_setup.schedule, action_state, + wtest_state, sumState, udqState, aquiferData, @@ -538,6 +543,7 @@ BOOST_AUTO_TEST_CASE(ECL_FORMATTED) { base_setup.grid, base_setup.schedule, action_state, + wtest_state, sumState, udqState, aquiferData, @@ -623,6 +629,7 @@ BOOST_AUTO_TEST_CASE(WriteWrongSOlutionSize) { Opm::SummaryState sumState(TimeService::now()); Opm::Action::State action_state; Opm::UDQState udq_state(19); + Opm::WellTestState wtest_state; auto aquiferData = std::optional{std::nullopt}; const auto seqnum = 1; @@ -638,6 +645,7 @@ BOOST_AUTO_TEST_CASE(WriteWrongSOlutionSize) { setup.grid , setup.schedule, action_state, + wtest_state, sumState, udq_state, aquiferData), @@ -676,6 +684,7 @@ BOOST_AUTO_TEST_CASE(ExtraData_content) { Setup setup("BASE_SIM.DATA"); { Action::State action_state; + WellTestState wtest_state; UDQState udq_state(10); auto num_cells = setup.grid.getNumActive( ); auto cells = mkSolution( num_cells ); @@ -706,6 +715,7 @@ BOOST_AUTO_TEST_CASE(ExtraData_content) { setup.grid, setup.schedule, action_state, + wtest_state, sumState, udq_state, aquiferData); @@ -786,6 +796,7 @@ BOOST_AUTO_TEST_CASE(STORE_THPRES) { const auto sumState = sim_state(base_setup.schedule); Action::State action_state; UDQState udq_state(99); + WellTestState wtest_state; /* THPRES data has wrong size in extra container. */ { @@ -802,6 +813,7 @@ BOOST_AUTO_TEST_CASE(STORE_THPRES) { base_setup.grid, base_setup.schedule, action_state, + wtest_state, sumState, udq_state, aquiferData), @@ -827,6 +839,7 @@ BOOST_AUTO_TEST_CASE(STORE_THPRES) { base_setup.grid, base_setup.schedule, action_state, + wtest_state, sumState, udq_state, aquiferData); @@ -884,6 +897,7 @@ BOOST_AUTO_TEST_CASE(Restore_Cumulatives) const auto seqnum = 1; { Action::State action_state; + WellTestState wtest_state; auto aquiferData = std::optional{std::nullopt}; auto rstFile = OS::Restart { rset, seqnum, OS::Formatted{ false }, OS::Unified{ true } @@ -891,7 +905,7 @@ BOOST_AUTO_TEST_CASE(Restore_Cumulatives) RestartIO::save(rstFile, seqnum, 100, restart_value, setup.es, setup.grid, setup.schedule, - action_state, sumState, udq_state, aquiferData); + action_state, wtest_state, sumState, udq_state, aquiferData); } Action::State action_state; diff --git a/tests/test_restartwellinfo.cpp b/tests/test_restartwellinfo.cpp index 06e4d7a0f..8d7005de9 100644 --- a/tests/test_restartwellinfo.cpp +++ b/tests/test_restartwellinfo.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include @@ -222,10 +223,12 @@ BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo) { solution.insert( "SGAS" , Opm::UnitSystem::measure::identity , std::vector< double >( num_cells, 1 ) , Opm::data::TargetType::RESTART_SOLUTION); Opm::data::Wells wells; Opm::data::GroupAndNetworkValues group_nwrk; + Opm::WellTestState wtest_state; for(int timestep = 0; timestep <= countTimeStep; ++timestep) { eclipseWriter.writeTimeStep( action_state, + wtest_state, st, udq_state, timestep,