diff --git a/examples/printvfp.cpp b/examples/printvfp.cpp index 759258aed..a58fd6b3b 100644 --- a/examples/printvfp.cpp +++ b/examples/printvfp.cpp @@ -46,7 +46,7 @@ struct Setup std::shared_ptr python; std::unique_ptr schedule; std::unique_ptr summary_state; - std::unique_ptr vfp_properties; + std::unique_ptr> vfp_properties; Setup(const std::string& file) { @@ -63,7 +63,9 @@ struct Setup const int step = 0; const auto& sched_state = schedule->operator[](step); WellState well_state(phaseUsage(runspec.phases())); - vfp_properties = std::make_unique(sched_state.vfpinj(), sched_state.vfpprod(), well_state); + vfp_properties = std::make_unique>(sched_state.vfpinj(), + sched_state.vfpprod(), + well_state); }; }; diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index 45875a5a7..e1e13c456 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -63,7 +63,7 @@ namespace Opm { class Schedule; struct SimulatorUpdate; class SummaryConfig; - class VFPProperties; + template class VFPProperties; template class WellInterfaceGeneric; template class WellState; } // namespace Opm @@ -557,7 +557,7 @@ protected: mutable std::unordered_set closed_this_step_; GuideRate guideRate_; - std::unique_ptr vfp_properties_{}; + std::unique_ptr> vfp_properties_{}; std::map node_pressures_; // Storing network pressures for output. // previous injection multiplier, it is used in the injection multiplier calculation for WINJMULT keyword diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 9044f75e6..fcfe6b258 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -275,7 +275,7 @@ namespace Opm { { const auto& sched_state = this->schedule()[timeStepIdx]; - this->vfp_properties_ = std::make_unique + this->vfp_properties_ = std::make_unique> (sched_state.vfpinj(), sched_state.vfpprod(), this->wellState()); } } diff --git a/opm/simulators/wells/VFPProperties.hpp b/opm/simulators/wells/VFPProperties.hpp index b6e51d0cc..7c41c5f1d 100644 --- a/opm/simulators/wells/VFPProperties.hpp +++ b/opm/simulators/wells/VFPProperties.hpp @@ -36,6 +36,7 @@ class VFPProdTable; * A thin wrapper class that holds one VFPProdProperties and one * VFPInjProperties object. */ +template class VFPProperties { public: /** @@ -47,8 +48,8 @@ public: VFPProperties(const std::vector>& inj_tables, const std::vector>& prod_tables, - const WellState& well_state) - :well_state_(well_state) + const WellState& well_state) + : well_state_(well_state) { for (const auto& vfpinj : inj_tables) this->m_inj.addTable( vfpinj ); @@ -60,7 +61,7 @@ public: /** * Returns the VFP properties for injection wells */ - const VFPInjProperties* getInj() const + const VFPInjProperties* getInj() const { return &m_inj; } @@ -68,12 +69,13 @@ public: /** * Returns the VFP properties for production wells */ - const VFPProdProperties* getProd() const + const VFPProdProperties* getProd() const { return &m_prod; } - double getExplicitWFR(const int table_id, const std::size_t well_index) const { + Scalar getExplicitWFR(const int table_id, const std::size_t well_index) const + { const auto& rates = well_state_.well(well_index).prev_surface_rates; const auto& pu = well_state_.phaseUsage(); const auto& aqua = pu.phase_used[BlackoilPhases::Aqua]? rates[pu.phase_pos[BlackoilPhases::Aqua]]:0.0; @@ -83,7 +85,8 @@ public: return detail::getWFR(table, aqua, liquid, vapour); } - double getExplicitGFR(const int table_id, const std::size_t well_index) const { + Scalar getExplicitGFR(const int table_id, const std::size_t well_index) const + { const auto& rates = well_state_.well(well_index).prev_surface_rates; const auto& pu = well_state_.phaseUsage(); const auto& aqua = pu.phase_used[BlackoilPhases::Aqua]? rates[pu.phase_pos[BlackoilPhases::Aqua]]:0.0; @@ -94,9 +97,9 @@ public: } private: - VFPInjProperties m_inj; - VFPProdProperties m_prod; - const WellState& well_state_; + VFPInjProperties m_inj; + VFPProdProperties m_prod; + const WellState& well_state_; }; } // namespace Opm diff --git a/opm/simulators/wells/WellInterfaceGeneric.cpp b/opm/simulators/wells/WellInterfaceGeneric.cpp index 2cf2faec3..1b186bdca 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.cpp +++ b/opm/simulators/wells/WellInterfaceGeneric.cpp @@ -374,7 +374,7 @@ closeCompletions(const WellTestState& wellTestState) template void WellInterfaceGeneric:: -setVFPProperties(const VFPProperties* vfp_properties_arg) +setVFPProperties(const VFPProperties* vfp_properties_arg) { vfp_properties_ = vfp_properties_arg; } diff --git a/opm/simulators/wells/WellInterfaceGeneric.hpp b/opm/simulators/wells/WellInterfaceGeneric.hpp index fa1d1eccc..715ef8290 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.hpp +++ b/opm/simulators/wells/WellInterfaceGeneric.hpp @@ -40,7 +40,7 @@ class ParallelWellInfo; struct PerforationData; struct PhaseUsage; class SummaryState; -class VFPProperties; +template class VFPProperties; class WellTestState; template class WellState; template class SingleWellState; @@ -94,7 +94,7 @@ public: void initCompletions(); void closeCompletions(const WellTestState& wellTestState); - void setVFPProperties(const VFPProperties* vfp_properties_arg); + void setVFPProperties(const VFPProperties* vfp_properties_arg); void setPrevSurfaceRates(WellState& well_state, const WellState& prev_well_state) const; void setGuideRate(const GuideRate* guide_rate_arg); @@ -129,7 +129,7 @@ public: Scalar gravity() const { return gravity_; } - const VFPProperties* vfpProperties() const { return vfp_properties_; } + const VFPProperties* vfpProperties() const { return vfp_properties_; } const ParallelWellInfo& parallelWellInfo() const { return parallel_well_info_; } @@ -358,7 +358,7 @@ protected: std::vector inj_fc_multiplier_; Scalar well_efficiency_factor_; - const VFPProperties* vfp_properties_; + const VFPProperties* vfp_properties_; const GuideRate* guide_rate_; std::vector well_control_log_;