Add WellTestState argument to AggregateWellData functions

This commit is contained in:
Joakim Hove 2021-10-10 10:59:26 +02:00
parent bc6e2b268a
commit f7b09380d4
8 changed files with 39 additions and 20 deletions

View File

@ -33,6 +33,7 @@ namespace Opm {
class Schedule;
class SummaryState;
class UnitSystem;
class WellTestState;
namespace Action {
class State;
}
@ -49,12 +50,13 @@ namespace Opm { namespace RestartIO { namespace Helpers {
public:
explicit AggregateWellData(const std::vector<int>& inteHead);
void captureDeclaredWellData(const Schedule& sched,
const UnitSystem& units,
const std::size_t sim_step,
const ::Opm::Action::State& action_state,
const ::Opm::SummaryState& smry,
const std::vector<int>& inteHead);
void captureDeclaredWellData(const Schedule& sched,
const UnitSystem& units,
const std::size_t sim_step,
const Opm::Action::State& action_state,
const Opm::WellTestState& wtest_state,
const Opm::SummaryState& smry,
const std::vector<int>& inteHead);
void captureDynamicWellData(const Opm::Schedule& sched,
const std::size_t sim_step,

View File

@ -38,6 +38,8 @@
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <opm/parser/eclipse/Units/Units.hpp>
@ -970,6 +972,7 @@ captureDeclaredWellData(const Schedule& sched,
const UnitSystem& units,
const std::size_t sim_step,
const ::Opm::Action::State& action_state,
const Opm::WellTestState& wtest_state,
const ::Opm::SummaryState& smry,
const std::vector<int>& inteHead)
{

View File

@ -383,14 +383,14 @@ namespace {
const std::vector<std::string>& well_names,
const data::Wells& wells,
const Opm::Action::State& action_state,
const Opm::WellTestState& wtest_state,
const Opm::SummaryState& sumState,
const std::vector<int>& ih,
EclIO::OutputStream::Restart& rstFile)
{
auto wellData = Helpers::AggregateWellData(ih);
wellData.captureDeclaredWellData(schedule, units, sim_step, action_state, sumState, ih);
wellData.captureDynamicWellData(schedule, sim_step,
wells, sumState);
wellData.captureDeclaredWellData(schedule, units, sim_step, action_state, wtest_state, sumState, ih);
wellData.captureDynamicWellData(schedule, sim_step, wells, sumState);
rstFile.write("IWEL", wellData.getIWell());
rstFile.write("SWEL", wellData.getSWell());
@ -482,6 +482,7 @@ namespace {
const Schedule& schedule,
const data::Wells& wellSol,
const Opm::Action::State& action_state,
const Opm::WellTestState& wtest_state,
const Opm::SummaryState& sumState,
const std::vector<int>& inteHD,
const data::Aquifers& aquDynData,
@ -514,7 +515,7 @@ namespace {
}
writeWell(sim_step, ecl_compatible_rst, phases, units, grid, schedule,
wells, wellSol, action_state, sumState, inteHD, rstFile);
wells, wellSol, action_state, wtest_state, sumState, inteHD, rstFile);
}
if ((es.aquifer().hasAnalyticalAquifer() || es.aquifer().hasNumericalAquifer()) &&
@ -757,7 +758,7 @@ void save(EclIO::OutputStream::Restart& rstFile,
const EclipseGrid& grid,
const Schedule& schedule,
const Action::State& action_state,
const WellTestState& ,
const WellTestState& wtest_state,
const SummaryState& sumState,
const UDQState& udqState,
std::optional<Helpers::AggregateAquiferData>& aquiferData,
@ -784,7 +785,7 @@ void save(EclIO::OutputStream::Restart& rstFile,
if (report_step > 0) {
writeDynamicData(sim_step, ecl_compatible_rst, es.runspec().phases(),
units, grid, es, schedule, value.wells, action_state,
units, grid, es, schedule, value.wells, action_state, wtest_state,
sumState, inteHD, value.aquifer, aquiferData, rstFile);
}

View File

@ -30,6 +30,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionContext.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <opm/parser/eclipse/Units/Units.hpp>
@ -197,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, Opm::Action::State {}, st, ih);
well_aggregator.captureDeclaredWellData(sched, es.getUnits(), rptStep, {}, {}, st, ih);
rstFile.write("IWEL", well_aggregator.getIWell());
rstFile.write("SWEL", well_aggregator.getSWell());
rstFile.write("XWEL", well_aggregator.getXWell());

View File

@ -26,6 +26,7 @@
#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/Schedule/Well/WellTestState.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <opm/parser/eclipse/Units/Units.hpp>
@ -256,8 +257,9 @@ 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, st, ih);
well_aggregator.captureDeclaredWellData(sched, es.getUnits(), rptStep, action_state, wtest_state, st, ih);
rstFile.write("IWEL", well_aggregator.getIWell());
rstFile.write("SWEL", well_aggregator.getSWell());
rstFile.write("XWEL", well_aggregator.getXWell());

View File

@ -43,6 +43,8 @@
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/State.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
#include <exception>
#include <stdexcept>
@ -596,6 +598,7 @@ BOOST_AUTO_TEST_CASE (Declared_Well_Data)
{
const auto simCase = SimulationCase{first_sim()};
Opm::Action::State action_state;
Opm::WellTestState wtest_state;
// Report Step 1: 2008-10-10 --> 2011-01-20
const auto rptStep = std::size_t{1};
@ -608,7 +611,7 @@ BOOST_AUTO_TEST_CASE (Declared_Well_Data)
const auto smry = sim_state();
auto awd = Opm::RestartIO::Helpers::AggregateWellData{ih.value};
awd.captureDeclaredWellData(simCase.sched,
simCase.es.getUnits(), rptStep, action_state, smry, ih.value);
simCase.es.getUnits(), rptStep, action_state, wtest_state, smry, ih.value);
// IWEL (OP_1)
{
@ -753,7 +756,7 @@ BOOST_AUTO_TEST_CASE (Declared_Well_Data)
//smry = sim_state();
awd = Opm::RestartIO::Helpers::AggregateWellData{ih_8.value};
awd.captureDeclaredWellData(simCase.sched,
simCase.es.getUnits(), rptStep_8, action_state, smry, ih_8.value);
simCase.es.getUnits(), rptStep_8, action_state, wtest_state, smry, ih_8.value);
{
using Ix = ::Opm::RestartIO::Helpers::VectorItems::SWell::index;
@ -779,6 +782,7 @@ BOOST_AUTO_TEST_CASE (Declared_Well_Data_MSW_well_data)
Opm::EclipseState es = simCase.es;
Opm::Schedule sched = simCase.sched;
Opm::Action::State action_state;
Opm::WellTestState wtest_state;
const auto rptStep = std::size_t{1};
const auto ih = MockIH {
@ -788,7 +792,7 @@ BOOST_AUTO_TEST_CASE (Declared_Well_Data_MSW_well_data)
auto awd = Opm::RestartIO::Helpers::AggregateWellData{ih.value};
awd.captureDeclaredWellData(simCase.sched,
simCase.es.getUnits(), rptStep, action_state, smry, ih.value);
simCase.es.getUnits(), rptStep, action_state, wtest_state, smry, ih.value);
// IWEL (PROD1)
{
@ -848,6 +852,7 @@ BOOST_AUTO_TEST_CASE (Dynamic_Well_Data_Step1)
const auto xw = well_rates_1();
const auto smry = sim_state();
auto awd = Opm::RestartIO::Helpers::AggregateWellData{ih.value};
Opm::WellTestState wtest_state;
awd.captureDynamicWellData(simCase.sched, rptStep, xw, smry);
@ -991,6 +996,7 @@ BOOST_AUTO_TEST_CASE (Dynamic_Well_Data_Step2)
const auto xw = well_rates_2();
const auto smry = sim_state();
auto awd = Opm::RestartIO::Helpers::AggregateWellData{ih.value};
Opm::WellTestState wtest_state;
awd.captureDynamicWellData(simCase.sched, rptStep, xw, smry);
@ -1172,6 +1178,7 @@ BOOST_AUTO_TEST_CASE(WELL_POD) {
const auto rptStep = std::size_t{2};
const auto sim_step = rptStep - 1;
Opm::SummaryState sumState(Opm::TimeService::now());
Opm::WellTestState wtest_state;
const auto xw = well_rates_1();
Opm::Action::State action_state;
@ -1184,7 +1191,7 @@ BOOST_AUTO_TEST_CASE(WELL_POD) {
sim_step);
auto wellData = Opm::RestartIO::Helpers::AggregateWellData(ih);
wellData.captureDeclaredWellData(simCase.sched, units, sim_step, action_state, sumState, ih);
wellData.captureDeclaredWellData(simCase.sched, units, sim_step, action_state, wtest_state, sumState, ih);
wellData.captureDynamicWellData(simCase.sched, sim_step, xw , sumState);
auto connectionData = Opm::RestartIO::Helpers::AggregateConnectionData(ih);

View File

@ -8,6 +8,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/output/eclipse/AggregateWellData.hpp>
@ -98,7 +99,7 @@ BOOST_AUTO_TEST_CASE(liftGasOptimzation_data)
const auto dh = Opm::RestartIO::Helpers::createDoubHead(es, sched, simStep, secs_elapsed, next_step_size);
auto wellData = Opm::RestartIO::Helpers::AggregateWellData(ih);
wellData.captureDeclaredWellData(sched, es.getUnits(), simStep, action_state, st, ih);
wellData.captureDeclaredWellData(sched, es.getUnits(), simStep, action_state, {}, st, ih);
// intehead data
auto eachnc = Opm::RestartIO::Helpers::VectorItems::intehead::EACHNCITS;

View File

@ -44,6 +44,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Action/State.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
#include <opm/common/utility/TimeService.hpp>
@ -270,6 +271,7 @@ BOOST_AUTO_TEST_CASE(State_test) {
const auto sim_step = rptStep - 1;
Opm::SummaryState sumState(Opm::TimeService::now());
Opm::Action::State action_state;
Opm::WellTestState wtest_state;
const auto ih = Opm::RestartIO::Helpers::createInteHead(simCase.es,
simCase.grid,
@ -287,7 +289,7 @@ BOOST_AUTO_TEST_CASE(State_test) {
0, 0);
auto wellData = Opm::RestartIO::Helpers::AggregateWellData(ih);
wellData.captureDeclaredWellData(simCase.sched, units, sim_step, action_state, sumState, ih);
wellData.captureDeclaredWellData(simCase.sched, units, sim_step, action_state, wtest_state, sumState, ih);
wellData.captureDynamicWellData(simCase.sched, sim_step, {} , sumState);
auto connectionData = Opm::RestartIO::Helpers::AggregateConnectionData(ih);