diff --git a/msim/src/msim.cpp b/msim/src/msim.cpp index 5c6dcdb67..f7c152793 100644 --- a/msim/src/msim.cpp +++ b/msim/src/msim.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -122,11 +121,11 @@ void msim::run_step(WellTestState& wtest_state, UDQState& udq_state, data::Solut report_step, seconds_elapsed, well_data, + /* wbp = */ {}, group_nwrk_data, - {}, - {}, - {}, - {}); + /* sing_values = */ {}, + /* initial_inplace = */ {}, + /* inplace = */ {}); this->schedule.getUDQConfig( report_step ).eval(report_step, schedule.wellMatcher(report_step), this->st, udq_state); diff --git a/opm/input/eclipse/Schedule/Well/Well.hpp b/opm/input/eclipse/Schedule/Well/Well.hpp index 7a86ff2f5..ce4d37f9e 100644 --- a/opm/input/eclipse/Schedule/Well/Well.hpp +++ b/opm/input/eclipse/Schedule/Well/Well.hpp @@ -34,8 +34,8 @@ #include #include #include +#include #include -#include #include #include #include @@ -497,7 +497,6 @@ public: void applyWellProdIndexScaling(const double scalingFactor, std::vector& scalingApplicable); const PAvg& pavg() const; - PAvgCalculator pavg_calculator(const EclipseGrid& grid, const std::vector& porv) const; template void serializeOp(Serializer& serializer) diff --git a/opm/output/data/Wells.hpp b/opm/output/data/Wells.hpp index 4ae2c4809..e24439a1c 100644 --- a/opm/output/data/Wells.hpp +++ b/opm/output/data/Wells.hpp @@ -549,6 +549,73 @@ namespace Opm { } }; + class WellBlockAvgPress + { + public: + enum class Quantity { WBP, WBP4, WBP5, WBP9 }; + + double& operator[](const Quantity q) + { + return this->wbp_[static_cast(q)]; + } + + double operator[](const Quantity q) const + { + return this->wbp_[static_cast(q)]; + } + + bool operator==(const WellBlockAvgPress& that) const + { + return this->wbp_ == that.wbp_; + } + + template + void write(MessageBufferType& buffer) const; + + template + void read(MessageBufferType& buffer); + + template + void serializeOp(Serializer& serializer) + { + serializer(this->wbp_); + } + + static WellBlockAvgPress serializationTestObject() + { + auto wbp = WellBlockAvgPress{}; + + wbp[Quantity::WBP] = 17.29; + wbp[Quantity::WBP4] = 2.718; + wbp[Quantity::WBP5] = 3.1415; + wbp[Quantity::WBP9] = 1.618; + + return wbp; + } + + private: + static constexpr auto NumQuantities = + static_cast(Quantity::WBP9) + 1; + + std::array wbp_{}; + + std::string quantityName(const Quantity quantity) const + { + switch (quantity) { + case Quantity::WBP : return "WBP"; + case Quantity::WBP4: return "WBP4"; + case Quantity::WBP5: return "WBP5"; + case Quantity::WBP9: return "WBP9"; + } + + throw std::invalid_argument { + "Unkown WBP quantity '" + + std::to_string(static_cast(quantity)) + + "'" + }; + } + }; + struct Well { Rates rates{}; double bhp{0.0}; @@ -597,16 +664,17 @@ namespace Opm { bool operator==(const Well& well2) const { - return rates == well2.rates && - bhp == well2.bhp && - thp == well2.thp && - temperature == well2.temperature && - control == well2.control && - dynamicStatus == well2.dynamicStatus && - connections == well2.connections && - segments == well2.segments && - current_control == well2.current_control && - guide_rates == well2.guide_rates; + return (this->rates == well2.rates) + && (this->bhp == well2.bhp) + && (this->thp == well2.thp) + && (this->temperature == well2.temperature) + && (this->control == well2.control) + && (this->dynamicStatus == well2.dynamicStatus) + && (this->connections == well2.connections) + && (this->segments == well2.segments) + && (this->current_control == well2.current_control) + && (this->guide_rates == well2.guide_rates) + ; } template @@ -626,21 +694,21 @@ namespace Opm { static Well serializationTestObject() { - return Well{Rates::serializationTestObject(), - 1.0, - 2.0, - 3.0, - 4, - ::Opm::WellStatus::SHUT, - {Connection::serializationTestObject()}, - {{0, Segment::serializationTestObject()}}, - CurrentControl::serializationTestObject(), - GuideRateValue::serializationTestObject() - }; + return Well { + Rates::serializationTestObject(), + 1.0, + 2.0, + 3.0, + 4, + ::Opm::WellStatus::SHUT, + {Connection::serializationTestObject()}, + {{0, Segment::serializationTestObject()}}, + CurrentControl::serializationTestObject(), + GuideRateValue::serializationTestObject() + }; } }; - class Wells: public std::map { public: @@ -728,6 +796,34 @@ namespace Opm { } }; + struct WellBlockAveragePressures + { + std::unordered_map values{}; + + template + void write(MessageBufferType& buffer) const; + + template + void read(MessageBufferType& buffer); + + bool operator==(const WellBlockAveragePressures& that) const + { + return this->values == that.values; + } + + template + void serializeOp(Serializer& serializer) + { + serializer(this->values); + } + + static WellBlockAveragePressures serializationTestObject() + { + return { + { { "I-45", WellBlockAvgPress::serializationTestObject() } }, + }; + } + }; /* IMPLEMENTATIONS */ @@ -978,6 +1074,14 @@ namespace Opm { } } + template + void WellBlockAvgPress::write(MessageBufferType& buffer) const + { + for (const auto& quantity : this->wbp_) { + buffer.write(quantity); + } + } + template void Well::write(MessageBufferType& buffer) const { this->rates.write(buffer); @@ -1010,6 +1114,17 @@ namespace Opm { this->guide_rates.write(buffer); } + template + void WellBlockAveragePressures::write(MessageBufferType& buffer) const + { + buffer.write(this->values.size()); + + for (const auto& [well, value] : this->values) { + buffer.write(well); + value.write(buffer); + } + } + template void Rates::read(MessageBufferType& buffer) { buffer.read(this->mask); @@ -1082,6 +1197,14 @@ namespace Opm { } } + template + void WellBlockAvgPress::read(MessageBufferType& buffer) + { + for (auto& quantity : this->wbp_) { + buffer.read(quantity); + } + } + template void Well::read(MessageBufferType& buffer) { this->rates.read(buffer); @@ -1127,6 +1250,25 @@ namespace Opm { this->guide_rates.read(buffer); } + template + void WellBlockAveragePressures::read(MessageBufferType& buffer) + { + const auto numWells = [&buffer, this]() + { + auto size = 0*this->values.size(); + buffer.read(size); + + return size; + }(); + + auto wellName = std::string{}; + for (auto well = 0*numWells; well < numWells; ++well) { + buffer.read(wellName); + + this->values[wellName].read(buffer); + } + } + void Well::init_json(Json::JsonObject& json_data) const { auto json_connections = json_data.add_array("connections"); for (const auto& conn : this->connections) { diff --git a/opm/output/eclipse/RestartValue.hpp b/opm/output/eclipse/RestartValue.hpp index 20566f160..ec55b7470 100644 --- a/opm/output/eclipse/RestartValue.hpp +++ b/opm/output/eclipse/RestartValue.hpp @@ -18,18 +18,18 @@ #ifndef RESTART_VALUE_HPP #define RESTART_VALUE_HPP +#include +#include +#include +#include + +#include + #include #include #include #include -#include - -#include -#include -#include -#include - namespace Opm { class RestartKey { diff --git a/opm/output/eclipse/Summary.hpp b/opm/output/eclipse/Summary.hpp index cf4fa7285..64e33fab4 100644 --- a/opm/output/eclipse/Summary.hpp +++ b/opm/output/eclipse/Summary.hpp @@ -36,22 +36,23 @@ namespace Opm { class EclipseGrid; class EclipseState; - class PAvgCalculatorCollection; + class Inplace; class Schedule; class SummaryConfig; class SummaryState; - class Inplace; } // namespace Opm namespace Opm { namespace data { - class Wells; class GroupAndNetworkValues; class InterRegFlowMap; + class WellBlockAveragePressures; + class Wells; }} // namespace Opm::data namespace Opm { namespace out { -class Summary { +class Summary +{ public: using GlobalProcessParameters = std::map; using RegionParameters = std::map>; @@ -69,24 +70,22 @@ public: void add_timestep(const SummaryState& st, const int report_step, bool isSubstep); - void eval(SummaryState& summary_state, - const int report_step, - const double secs_elapsed, - const data::Wells& well_solution, - const data::GroupAndNetworkValues& group_and_nwrk_solution, - GlobalProcessParameters single_values, - const Inplace& initial_inplace, - const Inplace& inplace, - const PAvgCalculatorCollection& , - const RegionParameters& region_values = {}, - const BlockValues& block_values = {}, - const data::Aquifers& aquifers_values = {}, - const InterRegFlowValues& interreg_flows = {}) const; + void eval(SummaryState& summary_state, + const int report_step, + const double secs_elapsed, + const data::Wells& well_solution, + const data::WellBlockAveragePressures& wbp, + const data::GroupAndNetworkValues& group_and_nwrk_solution, + const GlobalProcessParameters& single_values, + const Inplace& initial_inplace, + const Inplace& inplace, + const RegionParameters& region_values = {}, + const BlockValues& block_values = {}, + const data::Aquifers& aquifers_values = {}, + const InterRegFlowValues& interreg_flows = {}) const; void write(const bool is_final_summary = false) const; - PAvgCalculatorCollection wbp_calculators(std::size_t report_step) const; - private: class SummaryImplementation; std::unique_ptr pImpl_; diff --git a/src/opm/input/eclipse/Schedule/Well/Well.cpp b/src/opm/input/eclipse/Schedule/Well/Well.cpp index 3376fd7b8..c2681977c 100644 --- a/src/opm/input/eclipse/Schedule/Well/Well.cpp +++ b/src/opm/input/eclipse/Schedule/Well/Well.cpp @@ -1568,11 +1568,6 @@ bool Well::operator==(const Well& data) const { ; } - -PAvgCalculator Well::pavg_calculator(const EclipseGrid& grid, const std::vector& porv) const { - return PAvgCalculator(this->name(), this->getWPaveRefDepth(), grid, porv, this->getConnections(), this->m_pavg); -} - } // namespace Opm int Opm::Well::eclipseControlMode(const Well::InjectorCMode imode, diff --git a/src/opm/output/eclipse/Summary.cpp b/src/opm/output/eclipse/Summary.cpp index 64bd3ffa2..49edd3c78 100644 --- a/src/opm/output/eclipse/Summary.cpp +++ b/src/opm/output/eclipse/Summary.cpp @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -503,6 +502,7 @@ struct fn_args const std::optional> extra_data; const Opm::SummaryState& st; const Opm::data::Wells& wells; + const Opm::data::WellBlockAveragePressures& wbp; const Opm::data::GroupAndNetworkValues& grp_nwrk; const Opm::out::RegionCache& regionCache; const Opm::EclipseGrid& grid; @@ -2626,6 +2626,7 @@ namespace Evaluator { struct SimulatorResults { const Opm::data::Wells& wellSol; + const Opm::data::WellBlockAveragePressures& wbp; const Opm::data::GroupAndNetworkValues& grpNwrkSol; const std::map& single; const Opm::Inplace inplace; @@ -2655,7 +2656,7 @@ namespace Evaluator { , fcn_ (std::move(fcn)) { if (this->use_number()) { - this->number_ = this->node_.number; + this->number_ = std::max(0, this->node_.number); } } @@ -2665,9 +2666,7 @@ namespace Evaluator { const SimulatorResults& simRes, Opm::SummaryState& st) const override { - const auto get_wells = need_wells(this->node_); - - const auto wells = get_wells + const auto wells = need_wells(this->node_) ? find_wells(input.sched, this->node_, static_cast(sim_step), input.reg) : std::vector{}; @@ -2676,12 +2675,14 @@ namespace Evaluator { efac.setFactors(this->node_, input.sched, wells, sim_step); const fn_args args { - wells, this->group_name(), this->node_.keyword, stepSize, static_cast(sim_step), - std::max(0, this->number_), - this->node_.fip_region, - st, simRes.wellSol, simRes.grpNwrkSol, + wells, this->group_name(), this->node_.keyword, + stepSize, static_cast(sim_step), + this->number_, this->node_.fip_region, + st, + simRes.wellSol, simRes.wbp, simRes.grpNwrkSol, input.reg, input.grid, input.sched, - std::move(efac.factors), input.initial_inplace, simRes.inplace, + std::move(efac.factors), + input.initial_inplace, simRes.inplace, input.sched.getUnits() }; @@ -3502,22 +3503,29 @@ namespace Evaluator { std::string Factory::functionUnitString() const { + const auto unit_string_tracer = this->es_.tracer() + .get_unit_string(this->es_.getUnits(), + this->node_->keyword); + + if (! unit_string_tracer.empty()) { + // Non-default unit for tracer amount. + return unit_string_tracer; + } + const auto reg = Opm::out::RegionCache{}; const fn_args args { - {}, "", this->node_->keyword, 0.0, 0, std::max(0, this->node_->number), - this->node_->fip_region, - this->st_, {}, {}, reg, this->grid_, this->sched_, - {}, {}, {}, Opm::UnitSystem(Opm::UnitSystem::UnitType::UNIT_TYPE_METRIC) + {}, "", this->node_->keyword, 0.0, 0, + this->node_->number, this->node_->fip_region, + this->st_, + {}, {}, {}, + reg, this->grid_, this->sched_, + {}, {}, {}, + Opm::UnitSystem(Opm::UnitSystem::UnitType::UNIT_TYPE_METRIC) }; const auto prm = this->paramFunction_(args); - std::string unit_string_tracer = this->es_.tracer().get_unit_string(this->es_.getUnits(), this->node_->keyword); - if (unit_string_tracer != "") { //Non-default unit for tracer amount. - return unit_string_tracer; - } - return this->es_.getUnits().name(prm.unit); } @@ -3757,22 +3765,22 @@ public: SummaryImplementation& operator=(const SummaryImplementation& rhs) = delete; SummaryImplementation& operator=(SummaryImplementation&& rhs) = default; - void eval(const int sim_step, - const double secs_elapsed, - const data::Wells& well_solution, - const data::GroupAndNetworkValues& grp_nwrk_solution, - GlobalProcessParameters& single_values, - const Inplace& initial_inplace, - const Opm::Inplace& inplace, - const RegionParameters& region_values, - const BlockValues& block_values, - const data::Aquifers& aquifer_values, - const InterRegFlowValues& interreg_flows, - SummaryState& st) const; + void eval(const int sim_step, + const double secs_elapsed, + const data::Wells& well_solution, + const data::WellBlockAveragePressures& wbp, + const data::GroupAndNetworkValues& grp_nwrk_solution, + GlobalProcessParameters single_values, + const Inplace& initial_inplace, + const Opm::Inplace& inplace, + const RegionParameters& region_values, + const BlockValues& block_values, + const data::Aquifers& aquifer_values, + const InterRegFlowValues& interreg_flows, + SummaryState& st) const; void internal_store(const SummaryState& st, const int report_step, bool isSubstep); void write(const bool is_final_summary); - PAvgCalculatorCollection wbp_calculators(std::size_t report_step) const; private: struct MiniStep @@ -3789,7 +3797,6 @@ private: std::reference_wrapper es_; std::reference_wrapper sched_; Opm::out::RegionCache regCache_; - std::unordered_set wbp_wells; std::unique_ptr deferredSMSpec_; @@ -3867,9 +3874,6 @@ SummaryImplementation(const EclipseState& es, sched, evaluatorFactory); this->configureUDQ(es, sumcfg, sched); - for (const auto& config_node : sumcfg.keywords("WBP*")) - this->wbp_wells.insert( config_node.namedEntity() ); - std::string esmryFileName = EclIO::OutputStream::outputFileName(this->rset_, "ESMRY"); if (std::filesystem::exists(esmryFileName)) @@ -3899,43 +3903,25 @@ internal_store(const SummaryState& st, const int report_step, bool isSubstep) } } -Opm::PAvgCalculatorCollection -Opm::out::Summary::SummaryImplementation::wbp_calculators(std::size_t report_step) const -{ - if (this->wbp_wells.empty()) - return {}; - - Opm::PAvgCalculatorCollection calculators; - const auto& porv = this->es_.get().globalFieldProps().porv(true); - for (const auto& wname : this->wbp_wells) { - if (this->sched_.get().hasWell(wname, report_step)) { - const auto& well = this->sched_.get().getWell(wname, report_step); - if (well.getStatus() == Opm::Well::Status::OPEN) - calculators.add(well.pavg_calculator(this->grid_, porv)); - } - } - - return calculators; -} - void Opm::out::Summary::SummaryImplementation:: -eval(const int sim_step, - const double secs_elapsed, - const data::Wells& well_solution, - const data::GroupAndNetworkValues& grp_nwrk_solution, - GlobalProcessParameters& single_values, - const Inplace& initial_inplace, - const Opm::Inplace& inplace, - const RegionParameters& region_values, - const BlockValues& block_values, - const data::Aquifers& aquifer_values, - const InterRegFlowValues& interreg_flows, - Opm::SummaryState& st) const +eval(const int sim_step, + const double secs_elapsed, + const data::Wells& well_solution, + const data::WellBlockAveragePressures& wbp, + const data::GroupAndNetworkValues& grp_nwrk_solution, + GlobalProcessParameters single_values, + const Inplace& initial_inplace, + const Opm::Inplace& inplace, + const RegionParameters& region_values, + const BlockValues& block_values, + const data::Aquifers& aquifer_values, + const InterRegFlowValues& interreg_flows, + Opm::SummaryState& st) const { validateElapsedTime(secs_elapsed, this->es_, st); - const double duration = secs_elapsed - st.get_elapsed(); + const auto duration = secs_elapsed - st.get_elapsed(); single_values["TIMESTEP"] = duration; st.update("TIMESTEP", this->es_.get().getUnits().from_si(Opm::UnitSystem::measure::time, duration)); @@ -3944,7 +3930,7 @@ eval(const int sim_step, }; const Evaluator::SimulatorResults simRes { - well_solution, grp_nwrk_solution, single_values, inplace, + well_solution, wbp, grp_nwrk_solution, single_values, inplace, region_values, block_values, aquifer_values, interreg_flows }; @@ -4370,22 +4356,22 @@ Summary::Summary(const EclipseState& es, const Schedule& sched, const std::string& basename, const bool writeEsmry) - : pImpl_(new SummaryImplementation(es, sumcfg, grid, sched, basename, writeEsmry)) + : pImpl_ { std::make_unique(es, sumcfg, grid, sched, basename, writeEsmry) } {} -void Summary::eval(SummaryState& st, - const int report_step, - const double secs_elapsed, - const data::Wells& well_solution, - const data::GroupAndNetworkValues& grp_nwrk_solution, - GlobalProcessParameters single_values, - const Inplace& initial_inplace, - const Inplace& inplace, - const PAvgCalculatorCollection& , - const RegionParameters& region_values, - const BlockValues& block_values, - const Opm::data::Aquifers& aquifer_values, - const InterRegFlowValues& interreg_flows) const +void Summary::eval(SummaryState& st, + const int report_step, + const double secs_elapsed, + const data::Wells& well_solution, + const data::WellBlockAveragePressures& wbp, + const data::GroupAndNetworkValues& grp_nwrk_solution, + const GlobalProcessParameters& single_values, + const Inplace& initial_inplace, + const Inplace& inplace, + const RegionParameters& region_values, + const BlockValues& block_values, + const Opm::data::Aquifers& aquifer_values, + const InterRegFlowValues& interreg_flows) const { // Report_step is the one-based sequence number of the containing report. // Report_step = 0 for the initial condition, before simulation starts. @@ -4398,19 +4384,16 @@ void Summary::eval(SummaryState& st, // wells, groups, connections &c in the Schedule object. const auto sim_step = std::max(0, report_step - 1); + auto process_values = single_values; + this->pImpl_->eval(sim_step, secs_elapsed, - well_solution, grp_nwrk_solution, single_values, + well_solution, wbp, grp_nwrk_solution, + std::move(process_values), initial_inplace, inplace, region_values, block_values, aquifer_values, interreg_flows, st); } -PAvgCalculatorCollection -Summary::wbp_calculators(std::size_t report_step) const -{ - return this->pImpl_->wbp_calculators(report_step); -} - void Summary::add_timestep(const SummaryState& st, const int report_step, bool isSubstep) { this->pImpl_->internal_store(st, report_step, isSubstep); diff --git a/tests/parser/PAvgTests.cpp b/tests/parser/PAvgTests.cpp index 7493b73d8..5639b26a6 100644 --- a/tests/parser/PAvgTests.cpp +++ b/tests/parser/PAvgTests.cpp @@ -196,7 +196,7 @@ END auto summary_config = SummaryConfig{deck, sched, es.fieldProps(), es.aquifer()}; const auto& w1 = sched.getWell("P1", 0); const auto& porv = es.globalFieldProps().porv(true); - auto calc = w1.pavg_calculator(grid, porv); + auto calc = PAvgCalculator(w1.name(), w1.getWPaveRefDepth(), grid, porv, w1.getConnections(), w1.pavg()); { const auto& index_list = calc.index_list(); @@ -235,7 +235,7 @@ END //---------------------------------------------------- const auto& w5 = sched.getWell("P5", 0); - auto calc5 = w5.pavg_calculator(grid, porv); + auto calc5 = PAvgCalculator(w5.name(), w5.getWPaveRefDepth(), grid, porv, w5.getConnections(), w5.pavg()); { const auto& index_list = calc5.index_list(); @@ -263,8 +263,8 @@ END // We emulate MPI and calc1 and calc2 are on two different processors { - auto calc1 = w5.pavg_calculator(grid, porv); - auto calc2 = w5.pavg_calculator(grid, porv); + auto calc1 = PAvgCalculator(w5.name(), w5.getWPaveRefDepth(), grid, porv, w5.getConnections(), w5.pavg()); + auto calc2 = PAvgCalculator(w5.name(), w5.getWPaveRefDepth(), grid, porv, w5.getConnections(), w5.pavg()); for (std::size_t k = 0; k < 3; k++) { calc1.add_pressure(grid.getGlobalIndex(0,0,k), 1); calc2.add_pressure(grid.getGlobalIndex(1,0,k), 2.0); @@ -277,9 +277,8 @@ END PAvgCalculatorCollection calculators; - calculators.add(w1.pavg_calculator(grid, porv)); - calculators.add(w5.pavg_calculator(grid, porv)); - + calculators.add(PAvgCalculator(w1.name(), w1.getWPaveRefDepth(), grid, porv, w1.getConnections(), w1.pavg())); + calculators.add(PAvgCalculator(w5.name(), w5.getWPaveRefDepth(), grid, porv, w5.getConnections(), w5.pavg())); BOOST_CHECK( calculators.has("P1")); BOOST_CHECK( calculators.has("P5")); diff --git a/tests/test_Serialization.cpp b/tests/test_Serialization.cpp index 6dede882d..89bfa4aeb 100644 --- a/tests/test_Serialization.cpp +++ b/tests/test_Serialization.cpp @@ -212,6 +212,8 @@ TEST_FOR_TYPE_NAMED(data::SegmentPhaseQuantity, SegmentPhaseQuantity) TEST_FOR_TYPE_NAMED(data::Solution, Solution) TEST_FOR_TYPE_NAMED(data::Well, dataWell) TEST_FOR_TYPE_NAMED(data::Wells, Wells) +TEST_FOR_TYPE_NAMED(data::WellBlockAvgPress, dataWBPObject) +TEST_FOR_TYPE_NAMED(data::WellBlockAveragePressures, dataWBPCollection) TEST_FOR_TYPE(Deck) TEST_FOR_TYPE(DeckItem) TEST_FOR_TYPE(DeckKeyword) diff --git a/tests/test_Summary.cpp b/tests/test_Summary.cpp index 5873434d9..c82bb2a7a 100644 --- a/tests/test_Summary.cpp +++ b/tests/test_Summary.cpp @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -494,40 +493,46 @@ bool ecl_sum_has_well_connection_var( const EclIO::ESmry* smry, return ecl_sum_has_key(smry, key); } -struct setup { +struct setup +{ Deck deck; EclipseState es; const EclipseGrid& grid; Schedule schedule; SummaryConfig config; data::Wells wells; + data::WellBlockAveragePressures wbp; data::GroupAndNetworkValues grp_nwrk; std::string name; WorkArea ta; - /*-----------------------------------------------------------------*/ + // ------------------------------------------------------------------------ - setup(std::string fname, const std::string& path = "summary_deck.DATA", const bool w3_injector = true) : - deck( Parser().parseFile( path) ), - es( deck ), - grid( es.getInputGrid() ), - schedule( deck, es, std::make_shared()), - config( deck, schedule, es.fieldProps(), es.aquifer()), - wells( result_wells(w3_injector) ), - grp_nwrk( result_group_nwrk() ), - name( toupper(std::move(fname)) ), - ta( "summary_test" ) + setup(std::string case_name, + const std::string& path = "summary_deck.DATA", + const bool w3_injector = true) + : deck { Parser{}.parseFile(path) } + , es { deck } + , grid { es.getInputGrid() } + , schedule { deck, es, std::make_shared() } + , config { deck, schedule, es.fieldProps(), es.aquifer() } + , wells { result_wells(w3_injector) } + , wbp {} + , grp_nwrk { result_group_nwrk() } + , name { toupper(std::move(case_name)) } + , ta { "summary_test" } {} }; } // Anonymous namespace BOOST_AUTO_TEST_SUITE(Summary) -/* - * Tests works by reading the Deck, write the summary output, then immediately - * read it again (with ERT), and compare the read values with the input. - */ -BOOST_AUTO_TEST_CASE(well_keywords) { + +// Tests read the deck, write (synthetic) summary output, read the summary +// output, and compare those values with the input. + +BOOST_AUTO_TEST_CASE(well_keywords) +{ setup cfg( "test_summary_well" ); // Force to run in a directory, to make sure the basename with @@ -538,19 +543,17 @@ BOOST_AUTO_TEST_CASE(well_keywords) { SummaryState st(TimeService::now()); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name ); - writer.eval(st, 0, 0*day, cfg.wells, cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval(st, 0, 0*day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 0, false); - writer.eval(st, 1, 1*day, cfg.wells, cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval(st, 1, 1*day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval(st, 2, 2*day, cfg.wells, cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval(st, 2, 2*day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 2, false); writer.write(); - - auto res = readsum( cfg.name ); const auto* resp = res.get(); @@ -812,15 +815,15 @@ BOOST_AUTO_TEST_CASE(well_keywords_dynamic_close) { SummaryState st(TimeService::now()); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); - writer.eval(st, 0, 0*day, cfg.wells, cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval(st, 0, 0*day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 0, false); cfg.wells.at("W_2").dynamicStatus = ::Opm::Well::Status::SHUT; - writer.eval(st, 1, 1*day, cfg.wells, cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval(st, 1, 1*day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); cfg.wells.at("W_2").dynamicStatus = ::Opm::Well::Status::OPEN; - writer.eval(st, 2, 2*day, cfg.wells, cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval(st, 2, 2*day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 2, false); writer.write(); @@ -946,11 +949,11 @@ BOOST_AUTO_TEST_CASE(udq_keywords) { out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 0, 0 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 0, 0 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 0, false); - writer.eval( st, 1, 1 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 1, 1 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 2 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 2, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 2, false); writer.write(); @@ -971,13 +974,13 @@ BOOST_AUTO_TEST_CASE(group_keywords) { out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 0, 0 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 0, 0 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 0, false); - writer.eval( st, 1, 1 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 1, 1 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 2 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 2, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 2, false); writer.write(); @@ -1128,11 +1131,11 @@ BOOST_AUTO_TEST_CASE(group_group) { out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 0, 0 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 0, 0 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 0, false); - writer.eval( st, 1, 1 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 1, 1 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 2 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 2, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 2, false); writer.write(); @@ -1240,11 +1243,11 @@ BOOST_AUTO_TEST_CASE(connection_kewords) { out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 0, 0 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 0, 0 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 0, false); - writer.eval( st, 1, 1 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 1, 1 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 2 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 2, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 2, false); writer.write(); @@ -1347,13 +1350,13 @@ BOOST_AUTO_TEST_CASE(DATE) { out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 1, 1 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 1, 1 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 2 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 2, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 2, false); - writer.eval( st, 3, 18 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 3, 18 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 3, false); - writer.eval( st, 4, 22 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 4, 22 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 4, false); writer.write(); @@ -1384,11 +1387,11 @@ BOOST_AUTO_TEST_CASE(field_keywords) { out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 0, 0 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 0, 0 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 0, false); - writer.eval( st, 1, 1 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 1, 1 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 2 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 2, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 2, false); writer.write(); @@ -1524,11 +1527,11 @@ BOOST_AUTO_TEST_CASE(report_steps_time) { out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 1, 2 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 1, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 1, 5 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 1, 5 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 10 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 2, 10 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 2, false); writer.write(); @@ -1551,11 +1554,11 @@ BOOST_AUTO_TEST_CASE(skip_unknown_var) { out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 1, 2 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 1, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 1, 5 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 1, 5 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 10 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 2, 10 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 2, false); writer.write(); @@ -1566,8 +1569,6 @@ BOOST_AUTO_TEST_CASE(skip_unknown_var) { BOOST_CHECK( !ecl_sum_has_field_var( resp, "FGST" ) ); } - - BOOST_AUTO_TEST_CASE(region_vars) { setup cfg( "region_vars" ); @@ -1661,11 +1662,11 @@ BOOST_AUTO_TEST_CASE(region_vars) { { out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 1, 2 * day, cfg.wells, cfg.grp_nwrk, {}, {}, {}, {}, region_values); + writer.eval( st, 1, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, region_values); writer.add_timestep( st, 1, false); - writer.eval( st, 1, 5 * day, cfg.wells, cfg.grp_nwrk, {}, {}, {}, {}, region_values); + writer.eval( st, 1, 5 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, region_values); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 10 * day, cfg.wells, cfg.grp_nwrk, {}, {}, {}, {}, region_values); + writer.eval( st, 2, 10 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, region_values); writer.add_timestep( st, 2, false); writer.write(); } @@ -1705,18 +1706,17 @@ BOOST_AUTO_TEST_CASE(region_vars) { } } - BOOST_AUTO_TEST_CASE(region_production) { setup cfg( "region_production" ); { out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 0, 0 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 0, 0 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 0, false); - writer.eval( st, 1, 1 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 1, 1 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 2 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 2, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 2, false); writer.write(); } @@ -1744,11 +1744,11 @@ BOOST_AUTO_TEST_CASE(region_injection) { out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 0, 0 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 0, 0 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 0, false); - writer.eval( st, 1, 1 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 1, 1 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 2 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 2, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 2, false); writer.write(); @@ -1871,8 +1871,8 @@ BOOST_AUTO_TEST_CASE(inter_region_flows) const auto values = interRegionFlows(); for (auto i = 0; i < 3; ++i) { - writer.eval(st, i, i * day, cfg.wells, cfg.grp_nwrk, - {}, {}, {}, {}, {}, {}, {}, values); + writer.eval(st, i, i * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, + {}, {}, {}, {}, {}, {}, values); writer.add_timestep(st, 0, false); } @@ -1997,15 +1997,15 @@ BOOST_AUTO_TEST_CASE(BLOCK_VARIABLES) { out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 0, 0 * day, cfg.wells , cfg.grp_nwrk, {},{}, {}, {}, {}, block_values); + writer.eval( st, 0, 0 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}, block_values); writer.add_timestep( st, 0, false); - writer.eval( st, 1, 1 * day, cfg.wells , cfg.grp_nwrk, {},{}, {}, {}, {}, block_values); + writer.eval( st, 1, 1 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}, block_values); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 2 * day, cfg.wells , cfg.grp_nwrk, {},{}, {}, {}, {}, block_values); + writer.eval( st, 2, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}, block_values); writer.add_timestep( st, 2, false); - writer.eval( st, 3, 2 * day, cfg.wells , cfg.grp_nwrk, {},{}, {}, {}, {}, block_values); + writer.eval( st, 3, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}, block_values); writer.add_timestep( st, 3, false); - writer.eval( st, 4, 2 * day, cfg.wells , cfg.grp_nwrk, {},{}, {}, {}, {}, block_values); + writer.eval( st, 4, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}, block_values); writer.add_timestep( st, 4, false); writer.write(); @@ -2058,13 +2058,13 @@ BOOST_AUTO_TEST_CASE(NODE_VARIABLES) { out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 0, 0 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 0, 0 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 0, false); - writer.eval( st, 1, 1 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 1, 1 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 2 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 2, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 2, false); writer.write(); @@ -2091,8 +2091,6 @@ BOOST_AUTO_TEST_CASE(NODE_VARIABLES) { opm-parser implementation is changed/removed. */ - - BOOST_AUTO_TEST_CASE( require3D ) { setup cfg( "XXXX" ); @@ -2110,17 +2108,16 @@ BOOST_AUTO_TEST_CASE( require3D ) BOOST_CHECK( summaryConfig.require3DField( "GIPG" )); } - BOOST_AUTO_TEST_CASE(MISC) { setup cfg( "test_misc"); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 0, 0 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 0, 0 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 0, false); - writer.eval( st, 1, 1 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 1, 1 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 2 * day, cfg.wells , cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 2, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 2, false); writer.write(); @@ -2129,26 +2126,25 @@ BOOST_AUTO_TEST_CASE(MISC) { BOOST_CHECK( ecl_sum_has_key( resp , "TCPU" )); } - BOOST_AUTO_TEST_CASE(EXTRA) { setup cfg( "test_extra"); { out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 0, 0 * day, cfg.wells , cfg.grp_nwrk, { {"TCPU" , 0 }}, {}, {}, {}); + writer.eval( st, 0, 0 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, { {"TCPU" , 0 }}, {}, {}, {}); writer.add_timestep( st, 0, false); - writer.eval( st, 1, 1 * day, cfg.wells , cfg.grp_nwrk, { {"TCPU" , 1 }}, {}, {}, {}); + writer.eval( st, 1, 1 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, { {"TCPU" , 1 }}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 2 * day, cfg.wells , cfg.grp_nwrk, { {"TCPU" , 2}}, {}, {}, {}); + writer.eval( st, 2, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, { {"TCPU" , 2}}, {}, {}, {}); writer.add_timestep( st, 2, false); /* Add a not-recognized key; that is OK */ - BOOST_CHECK_NO_THROW( writer.eval( st, 3, 3 * day, cfg.wells , cfg.grp_nwrk, { {"MISSING" , 2 }}, {}, {}, {})); + BOOST_CHECK_NO_THROW( writer.eval( st, 3, 3 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, { {"MISSING" , 2 }}, {}, {}, {})); BOOST_CHECK_NO_THROW( writer.add_timestep( st, 3, false)); /* Override a NOT MISC variable - ignored. */ - writer.eval( st, 4, 4 * day, cfg.wells, cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 4, 4 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 4, false); writer.write(); } @@ -2272,11 +2268,11 @@ BOOST_AUTO_TEST_CASE(efficiency_factor) { out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule, cfg.name ); SummaryState st(TimeService::now()); - writer.eval( st, 0, 0 * day, cfg.wells, cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 0, 0 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 0, false); - writer.eval( st, 1, 1 * day, cfg.wells, cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 1, 1 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); - writer.eval( st, 2, 2 * day, cfg.wells, cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval( st, 2, 2 * day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 2, false); writer.write(); auto res = readsum( cfg.name ); @@ -2482,9 +2478,6 @@ BOOST_AUTO_TEST_CASE(efficiency_factor) { BOOST_CHECK_CLOSE( 200.1 * 0.2 * 0.01, ecl_sum_get_well_connection_var( resp, 1, "W_2", "COPT", 2, 1, 1 ), 1e-5 ); } - - - BOOST_AUTO_TEST_CASE(Test_SummaryState) { Opm::SummaryState st(TimeService::now()); st.update("WWCT:OP_2", 100); @@ -2563,7 +2556,7 @@ BOOST_AUTO_TEST_CASE(Test_SummaryState) { BOOST_CHECK_EQUAL(st.get_conn_var("OP2", "COPR", 101, 99), 99); } -BOOST_AUTO_TEST_SUITE_END() +BOOST_AUTO_TEST_SUITE_END() // Summary // #################################################################### @@ -2576,11 +2569,11 @@ namespace { }; SummaryState st(TimeService::now()); - smry.eval(st, 0, 0*day, config.wells, config.grp_nwrk, {}, {}, {}, {}); + smry.eval(st, 0, 0*day, config.wells, config.wbp, config.grp_nwrk, {}, {}, {}, {}); smry.add_timestep(st, 0, false); - smry.eval(st, 1, 1*day, config.wells, config.grp_nwrk, {}, {}, {}, {}); + smry.eval(st, 1, 1*day, config.wells, config.wbp, config.grp_nwrk, {}, {}, {}, {}); smry.add_timestep(st, 1, false); - smry.eval(st, 2, 2*day, config.wells, config.grp_nwrk, {}, {}, {}, {}); + smry.eval(st, 2, 2*day, config.wells, config.wbp, config.grp_nwrk, {}, {}, {}, {}); smry.add_timestep(st, 2, false); return st; @@ -2901,7 +2894,7 @@ BOOST_AUTO_TEST_CASE(Field_Vectors_Correct) (10.2 + 20.2) / (10.1 + 20.1), 1.0e-10); } -BOOST_AUTO_TEST_SUITE_END() +BOOST_AUTO_TEST_SUITE_END() // Restart // #################################################################### @@ -3279,7 +3272,7 @@ BOOST_AUTO_TEST_CASE(Field_Vectors_Correct) (10.1 + (efac_G * 20.1)), 1.0e-10); } -BOOST_AUTO_TEST_SUITE_END() +BOOST_AUTO_TEST_SUITE_END() // Restart_EffFac // #################################################################### @@ -3582,11 +3575,11 @@ BOOST_AUTO_TEST_CASE(Write_Read) }; SummaryState st(TimeService::now()); - writer.eval(st, 0, 0*day, config.wells, config.grp_nwrk, {}, {}, {}, {}); + writer.eval(st, 0, 0*day, config.wells, config.wbp, config.grp_nwrk, {}, {}, {}, {}); writer.add_timestep(st, 0, false); - writer.eval(st, 1, 1*day, config.wells, config.grp_nwrk, {}, {}, {}, {}); + writer.eval(st, 1, 1*day, config.wells, config.wbp, config.grp_nwrk, {}, {}, {}, {}); writer.add_timestep(st, 1, false); - writer.eval(st, 2, 2*day, config.wells, config.grp_nwrk, {}, {}, {}, {}); + writer.eval(st, 2, 2*day, config.wells, config.wbp, config.grp_nwrk, {}, {}, {}, {}); writer.add_timestep(st, 2, false); writer.write(); @@ -4346,7 +4339,7 @@ BOOST_AUTO_TEST_CASE(Write_Read) } } -BOOST_AUTO_TEST_SUITE_END() +BOOST_AUTO_TEST_SUITE_END() // Restart_Segment // ===================================================================== @@ -4413,7 +4406,6 @@ BOOST_AUTO_TEST_CASE(SummaryState_TOTAL) { BOOST_CHECK_EQUAL(st.get_elapsed(), 200); } - BOOST_AUTO_TEST_CASE(append_summary_state) { auto now = TimeService::now(); SummaryState st1(now); @@ -4438,5 +4430,4 @@ BOOST_AUTO_TEST_CASE(append_summary_state) { BOOST_CHECK_EQUAL(st_both.get_group_var("G1", "WOPR"), 3000); } - -BOOST_AUTO_TEST_SUITE_END() +BOOST_AUTO_TEST_SUITE_END() // Summary_State diff --git a/tests/test_Summary_Group.cpp b/tests/test_Summary_Group.cpp index 6f4889007..08482f786 100644 --- a/tests/test_Summary_Group.cpp +++ b/tests/test_Summary_Group.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -214,34 +213,35 @@ static data::GroupAndNetworkValues result_group_network() { return grp_nwrk; } - -struct setup { +struct setup +{ Deck deck; EclipseState es; const EclipseGrid& grid; - std::shared_ptr python; Schedule schedule; SummaryConfig config; data::Wells wells; + data::WellBlockAveragePressures wbp; data::GroupAndNetworkValues grp_nwrk; std::string name; WorkArea ta; - /*-----------------------------------------------------------------*/ + // ------------------------------------------------------------------------ - setup(std::string fname, const std::string& path = "UDQ_ACTIONX_TEST1_U.DATA") : - deck( Parser().parseFile( path) ), - es( deck ), - grid( es.getInputGrid() ), - python( std::make_shared() ), - schedule( deck, es, python), - config( deck, schedule, es.fieldProps(), es.aquifer() ), - wells( result_wells() ), - grp_nwrk( result_group_network() ), - name( toupper(std::move(fname)) ), - ta( "test_summary_group_constraints" ) + setup(std::string case_name, + const std::string& path = "UDQ_ACTIONX_TEST1_U.DATA") + : deck { Parser{}.parseFile(path) } + , es { deck } + , grid { es.getInputGrid() } + , schedule { deck, es, std::make_shared() } + , config { deck, schedule, es.fieldProps(), es.aquifer() } + , wells { result_wells() } + , wbp {} + , grp_nwrk { result_group_network() } + , name { toupper(std::move(case_name)) } + , ta { "test_summary_group_constraints" } {} - }; +}; } // Anonymous namespace // ===================================================================== @@ -262,10 +262,10 @@ BOOST_AUTO_TEST_CASE(group_keywords) { SummaryState st(TimeService::now()); out::Summary writer( cfg.es, cfg.config, cfg.grid, cfg.schedule , cfg.name ); - writer.eval(st, 0, 0*day, cfg.wells, cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval(st, 0, 0*day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 0, false); - writer.eval(st, 1, 1*day, cfg.wells, cfg.grp_nwrk, {}, {}, {}, {}); + writer.eval(st, 1, 1*day, cfg.wells, cfg.wbp, cfg.grp_nwrk, {}, {}, {}, {}); writer.add_timestep( st, 1, false); writer.write();