diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index c004cac67..06699f610 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -63,7 +63,7 @@ list (APPEND MAIN_SOURCE_FILES opm/simulators/wells/WellGroupHelpers.cpp opm/simulators/wells/WellInterfaceGeneric.cpp opm/simulators/wells/WellProdIndexCalculator.cpp - opm/simulators/wells/WellStateFullyImplicitBlackoil.cpp + opm/simulators/wells/WellState.cpp opm/simulators/wells/WGState.cpp ) @@ -122,7 +122,7 @@ list (APPEND TEST_SOURCE_FILES tests/test_relpermdiagnostics.cpp tests/test_norne_pvt.cpp tests/test_wellprodindexcalculator.cpp - tests/test_wellstatefullyimplicitblackoil.cpp + tests/test_wellstate.cpp tests/test_parallelwellinfo.cpp tests/test_glift1.cpp tests/test_keyword_validator.cpp @@ -273,7 +273,7 @@ list (APPEND PUBLIC_HEADER_FILES opm/simulators/utils/readDeck.hpp opm/simulators/wells/TargetCalculator.hpp opm/simulators/wells/WellConnectionAuxiliaryModule.hpp - opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp + opm/simulators/wells/WellState.hpp opm/simulators/wells/GlobalWellInfo.hpp opm/simulators/wells/GroupState.hpp opm/simulators/wells/ALQState.hpp diff --git a/ebos/eclpeacemanwell.hh b/ebos/eclpeacemanwell.hh index f1a9abbac..bb43da4bb 100644 --- a/ebos/eclpeacemanwell.hh +++ b/ebos/eclpeacemanwell.hh @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include #include @@ -1413,12 +1413,12 @@ protected: / rhoWaterSurface; } - const WellStateFullyImplicitBlackoil& wellState() const + const WellState& wellState() const { throw std::logic_error("wellState() method not implemented for class eclpeacemanwell"); } - WellStateFullyImplicitBlackoil& wellState() + WellState& wellState() { throw std::logic_error("wellState() method not implemented for class eclpeacemanwell"); } diff --git a/ebos/eclwellmanager.hh b/ebos/eclwellmanager.hh index 86e8be0f7..df6eeaa1e 100644 --- a/ebos/eclwellmanager.hh +++ b/ebos/eclwellmanager.hh @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -622,12 +622,12 @@ public: throw std::logic_error("initFromRestartFile() method not implemented for class eclwellmanager"); } - const WellStateFullyImplicitBlackoil& wellState() const + const WellState& wellState() const { throw std::logic_error("wellState() method not implemented for class eclwellmanager"); } - WellStateFullyImplicitBlackoil& wellState() + WellState& wellState() { throw std::logic_error("wellState() method not implemented for class eclwellmanager"); } diff --git a/opm/simulators/flow/BlackoilModelEbos.hpp b/opm/simulators/flow/BlackoilModelEbos.hpp index c6a7ca764..892dde650 100644 --- a/opm/simulators/flow/BlackoilModelEbos.hpp +++ b/opm/simulators/flow/BlackoilModelEbos.hpp @@ -149,7 +149,6 @@ namespace Opm { { public: // --------- Types and enums --------- - typedef WellStateFullyImplicitBlackoil WellState; typedef BlackoilModelParametersEbos ModelParameters; using Simulator = GetPropType; diff --git a/opm/simulators/flow/NonlinearSolverEbos.hpp b/opm/simulators/flow/NonlinearSolverEbos.hpp index cc615c4f8..29e1ba4d9 100644 --- a/opm/simulators/flow/NonlinearSolverEbos.hpp +++ b/opm/simulators/flow/NonlinearSolverEbos.hpp @@ -80,6 +80,7 @@ struct NewtonRelaxationType { namespace Opm { +class WellState; /// A nonlinear solver class suitable for general fully-implicit models, /// as well as pressure, transport and sequential models. @@ -147,7 +148,7 @@ namespace Opm { }; // Forwarding types from PhysicalModel. - typedef typename PhysicalModel::WellState WellState; + //typedef typename PhysicalModel::WellState WellState; // --------- Public methods --------- diff --git a/opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp b/opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp index c2d1dfeb5..a6a50a1f5 100644 --- a/opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp +++ b/opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -80,7 +80,6 @@ public: typedef AdaptiveTimeSteppingEbos TimeStepper; typedef BlackOilPolymerModule PolymerModule; - typedef WellStateFullyImplicitBlackoil WellState; typedef BlackoilModelEbos Model; typedef NonlinearSolverEbos Solver; typedef typename Model::ModelParameters ModelParameters; diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index de65bed49..e198b8f2a 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include #include #include @@ -93,7 +93,6 @@ namespace Opm { { public: // --------- Types --------- - typedef WellStateFullyImplicitBlackoil WellState; typedef BlackoilModelParametersEbos ModelParameters; using Grid = GetPropType; @@ -231,7 +230,7 @@ namespace Opm { /* The dynamic state of the well model is maintained with an instance - of the WellStateFullyImplicitBlackoil class. Currently we have + of the WellState class. Currently we have three different wellstate instances: 1. The currently active wellstate is in the active_well_state_ @@ -253,7 +252,7 @@ namespace Opm { /* Immutable version of the currently active wellstate. */ - const WellStateFullyImplicitBlackoil& wellState() const + const WellState& wellState() const { return this->active_wgstate_.well_state; } @@ -261,7 +260,7 @@ namespace Opm { /* Mutable version of the currently active wellstate. */ - WellStateFullyImplicitBlackoil& wellState() + WellState& wellState() { return this->active_wgstate_.well_state; } @@ -273,7 +272,7 @@ namespace Opm { prevWellState() must have been stored with the commitWellState() function first. */ - const WellStateFullyImplicitBlackoil& prevWellState() const + const WellState& prevWellState() const { return this->last_valid_wgstate_.well_state; } @@ -286,7 +285,7 @@ namespace Opm { Will return the currently active nupcolWellState; must initialize the internal nupcol wellstate with initNupcolWellState() first. */ - const WellStateFullyImplicitBlackoil& nupcolWellState() const + const WellState& nupcolWellState() const { return this->nupcol_wgstate_.well_state; } @@ -590,7 +589,7 @@ namespace Opm { const data::GroupAndNetworkValues& grpNwrkValues, const PhaseUsage& phases, const bool handle_ms_well, - WellStateFullyImplicitBlackoil& state ); + WellState& state ); // whether there exists any multisegment well open on this process bool anyMSWellOpenLocal() const; @@ -611,7 +610,7 @@ namespace Opm { void actionOnBrokenConstraints(const Group& group, const Group::InjectionCMode& newControl, const Phase& topUpPhase, DeferredLogger& deferred_logger); - void updateWsolvent(const Group& group, const Schedule& schedule, const int reportStepIdx, const WellStateFullyImplicitBlackoil& wellState); + void updateWsolvent(const Group& group, const Schedule& schedule, const int reportStepIdx, const WellState& wellState); void setWsolvent(const Group& group, const Schedule& schedule, const int reportStepIdx, double wsolvent); diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 0d9757653..89c3bde44 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -812,13 +812,13 @@ namespace Opm { // TODO: more checking here, to make sure this standard more specific and complete // maybe there is some WCON keywords will not open the well auto& events = this->wellState().events(w); - if (events.hasEvent(WellStateFullyImplicitBlackoil::event_mask)) { + if (events.hasEvent(WellState::event_mask)) { if (wellTestState_.lastTestTime(well_name) == ebosSimulator_.time()) { // The well was shut this timestep, we are most likely retrying // a timestep without the well in question, after it caused // repeated timestep cuts. It should therefore not be opened, // even if it was new or received new targets this report step. - events.clearEvent(WellStateFullyImplicitBlackoil::event_mask); + events.clearEvent(WellState::event_mask); } else { wellTestState_.openWell(well_name); } @@ -1700,11 +1700,11 @@ namespace Opm { if (!well->isOperable() ) continue; auto& events = this->wellState().events(well->indexOfWell()); - if (events.hasEvent(WellStateFullyImplicitBlackoil::event_mask)) { + if (events.hasEvent(WellState::event_mask)) { well->updateWellStateWithTarget(ebosSimulator_, this->wellState(), deferred_logger); // There is no new well control change input within a report step, // so next time step, the well does not consider to have effective events anymore. - events.clearEvent(WellStateFullyImplicitBlackoil::event_mask); + events.clearEvent(WellState::event_mask); } // solve the well equation initially to improve the initial solution of the well model @@ -1951,7 +1951,7 @@ namespace Opm { const data::GroupAndNetworkValues& grpNwrkValues, const PhaseUsage& phases, const bool handle_ms_well, - WellStateFullyImplicitBlackoil& well_state) + WellState& well_state) { using GPMode = Group::ProductionCMode; using GIMode = Group::InjectionCMode; @@ -2948,7 +2948,7 @@ namespace Opm { template void BlackoilWellModel:: - updateWsolvent(const Group& group, const Schedule& schedule, const int reportStepIdx, const WellStateFullyImplicitBlackoil& wellState) { + updateWsolvent(const Group& group, const Schedule& schedule, const int reportStepIdx, const WellState& wellState) { for (const std::string& groupName : group.groups()) { const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx); updateWsolvent(groupTmp, schedule, reportStepIdx, wellState); diff --git a/opm/simulators/wells/GasLiftSingleWell.hpp b/opm/simulators/wells/GasLiftSingleWell.hpp index 811e1bb87..58afc1c26 100644 --- a/opm/simulators/wells/GasLiftSingleWell.hpp +++ b/opm/simulators/wells/GasLiftSingleWell.hpp @@ -26,7 +26,6 @@ namespace Opm { template class StandardWell; } #include - #include #include @@ -40,7 +39,6 @@ namespace Opm class GasLiftSingleWell : public GasLiftSingleWellGeneric { using Simulator = GetPropType; - using WellState = WellStateFullyImplicitBlackoil; using StdWell = StandardWell; public: diff --git a/opm/simulators/wells/GasLiftSingleWellGeneric.cpp b/opm/simulators/wells/GasLiftSingleWellGeneric.cpp index 181f166a1..de0fb41b2 100644 --- a/opm/simulators/wells/GasLiftSingleWellGeneric.cpp +++ b/opm/simulators/wells/GasLiftSingleWellGeneric.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include diff --git a/opm/simulators/wells/GasLiftSingleWellGeneric.hpp b/opm/simulators/wells/GasLiftSingleWellGeneric.hpp index 41ba07c7a..ca6a7206c 100644 --- a/opm/simulators/wells/GasLiftSingleWellGeneric.hpp +++ b/opm/simulators/wells/GasLiftSingleWellGeneric.hpp @@ -39,7 +39,7 @@ class DeferredLogger; class GasLiftWellState; class Schedule; class SummaryState; -class WellStateFullyImplicitBlackoil; +class WellState; class GasLiftSingleWellGeneric { @@ -49,8 +49,6 @@ class GasLiftSingleWellGeneric static constexpr double ALQ_EPSILON = 1e-8; public: - using WellState = WellStateFullyImplicitBlackoil; - struct GradInfo { GradInfo() { } diff --git a/opm/simulators/wells/GasLiftSingleWell_impl.hpp b/opm/simulators/wells/GasLiftSingleWell_impl.hpp index 3a031cfc6..bf0b75b3c 100644 --- a/opm/simulators/wells/GasLiftSingleWell_impl.hpp +++ b/opm/simulators/wells/GasLiftSingleWell_impl.hpp @@ -18,6 +18,16 @@ */ namespace Opm { +#include +#include +#include +#include +#include +#include +#include + +#include +#include template GasLiftSingleWell:: diff --git a/opm/simulators/wells/GasLiftStage2.hpp b/opm/simulators/wells/GasLiftStage2.hpp index 28de06887..e05ad948d 100644 --- a/opm/simulators/wells/GasLiftStage2.hpp +++ b/opm/simulators/wells/GasLiftStage2.hpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include // NOTE: BlackoilWellModel.hpp includes ourself (GasLiftStage2.hpp), so we need // to forward declare BlackoilWellModel for it to be defined in this file. namespace Opm { @@ -58,7 +58,6 @@ namespace Opm template class GasLiftStage2 { using Simulator = GetPropType; - using WellState = WellStateFullyImplicitBlackoil; using BlackoilWellModel = ::Opm::BlackoilWellModel; using GasLiftSingleWell = ::Opm::GasLiftSingleWell; using GLiftWellState = GasLiftWellState; diff --git a/opm/simulators/wells/GasLiftStage2_impl.hpp b/opm/simulators/wells/GasLiftStage2_impl.hpp index 4b565ead8..83acf94f2 100644 --- a/opm/simulators/wells/GasLiftStage2_impl.hpp +++ b/opm/simulators/wells/GasLiftStage2_impl.hpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include diff --git a/opm/simulators/wells/MultisegmentWell.hpp b/opm/simulators/wells/MultisegmentWell.hpp index 4311caa32..267d99169 100644 --- a/opm/simulators/wells/MultisegmentWell.hpp +++ b/opm/simulators/wells/MultisegmentWell.hpp @@ -36,7 +36,6 @@ namespace Opm public: typedef WellInterface Base; - using typename Base::WellState; using typename Base::Simulator; using typename Base::IntensiveQuantities; using typename Base::FluidSystem; diff --git a/opm/simulators/wells/StandardWell.hpp b/opm/simulators/wells/StandardWell.hpp index f484cf9ac..20c68c21a 100644 --- a/opm/simulators/wells/StandardWell.hpp +++ b/opm/simulators/wells/StandardWell.hpp @@ -67,7 +67,6 @@ namespace Opm // dealing with derivatives. It can be beneficial to make functions can work with either AD or scalar value. // And also, it can also be beneficial to make these functions hanle different types of AD variables. using typename Base::Simulator; - using typename Base::WellState; using typename Base::IntensiveQuantities; using typename Base::FluidSystem; using typename Base::MaterialLaw; diff --git a/opm/simulators/wells/WGState.hpp b/opm/simulators/wells/WGState.hpp index 555b513b6..80ba8e20b 100644 --- a/opm/simulators/wells/WGState.hpp +++ b/opm/simulators/wells/WGState.hpp @@ -20,7 +20,7 @@ #ifndef OPM_WGSTATE_HEADER_INCLUDED #define OPM_WGSTATE_HEADER_INCLUDED -#include +#include #include namespace Opm { @@ -34,7 +34,7 @@ struct PhaseUsage; struct WGState { WGState(const PhaseUsage& pu); - WellStateFullyImplicitBlackoil well_state; + WellState well_state; GroupState group_state; }; diff --git a/opm/simulators/wells/WellContainer.hpp b/opm/simulators/wells/WellContainer.hpp index 0f639936a..e57fbc5f8 100644 --- a/opm/simulators/wells/WellContainer.hpp +++ b/opm/simulators/wells/WellContainer.hpp @@ -36,7 +36,7 @@ namespace Opm { can also be accessed and updated with the name. The class is created to facilitate safe and piecewise refactoring of the - WellStateFullyImplicitBlackOil class, and might have a short life in the + WellState class, and might have a short life in the development timeline. */ diff --git a/opm/simulators/wells/WellGroupHelpers.cpp b/opm/simulators/wells/WellGroupHelpers.cpp index abbae8bf6..19d00bd04 100644 --- a/opm/simulators/wells/WellGroupHelpers.cpp +++ b/opm/simulators/wells/WellGroupHelpers.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -72,7 +72,7 @@ namespace WellGroupHelpers const Schedule& schedule, const SummaryState& summaryState, const int reportStepIdx, - WellStateFullyImplicitBlackoil& wellState, + WellState& wellState, GroupState& group_state) { @@ -129,7 +129,7 @@ namespace WellGroupHelpers double sumWellPhaseRates(const WellContainer>& rates, const Group& group, const Schedule& schedule, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const int reportStepIdx, const int phasePos, const bool injector) @@ -175,7 +175,7 @@ namespace WellGroupHelpers double sumWellRates(const Group& group, const Schedule& schedule, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const int reportStepIdx, const int phasePos, const bool injector) @@ -185,7 +185,7 @@ namespace WellGroupHelpers double sumWellResRates(const Group& group, const Schedule& schedule, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const int reportStepIdx, const int phasePos, const bool injector) @@ -196,7 +196,7 @@ namespace WellGroupHelpers double sumSolventRates(const Group& group, const Schedule& schedule, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const int reportStepIdx, const bool injector) { @@ -242,7 +242,7 @@ namespace WellGroupHelpers const SummaryState& summaryState, const Opm::PhaseUsage& pu, const int reportStepIdx, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const GroupState& group_state, GuideRate* guideRate, Opm::DeferredLogger& deferred_logger) @@ -300,8 +300,8 @@ namespace WellGroupHelpers const bool isInjector, const PhaseUsage& pu, const GuideRate& guide_rate, - const WellStateFullyImplicitBlackoil& wellStateNupcol, - WellStateFullyImplicitBlackoil& wellState, + const WellState& wellStateNupcol, + WellState& wellState, GroupState& group_state, std::vector& groupTargetReduction) { @@ -420,8 +420,8 @@ namespace WellGroupHelpers void updateVREPForGroups(const Group& group, const Schedule& schedule, const int reportStepIdx, - const WellStateFullyImplicitBlackoil& wellStateNupcol, - WellStateFullyImplicitBlackoil& wellState, + const WellState& wellStateNupcol, + WellState& wellState, GroupState& group_state) { for (const std::string& groupName : group.groups()) { @@ -445,8 +445,8 @@ namespace WellGroupHelpers void updateReservoirRatesInjectionGroups(const Group& group, const Schedule& schedule, const int reportStepIdx, - const WellStateFullyImplicitBlackoil& wellStateNupcol, - WellStateFullyImplicitBlackoil& wellState, + const WellState& wellStateNupcol, + WellState& wellState, GroupState& group_state) { for (const std::string& groupName : group.groups()) { @@ -470,8 +470,8 @@ namespace WellGroupHelpers void updateWellRates(const Group& group, const Schedule& schedule, const int reportStepIdx, - const WellStateFullyImplicitBlackoil& wellStateNupcol, - WellStateFullyImplicitBlackoil& wellState) + const WellState& wellStateNupcol, + WellState& wellState) { for (const std::string& groupName : group.groups()) { const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx); @@ -501,8 +501,8 @@ namespace WellGroupHelpers void updateGroupProductionRates(const Group& group, const Schedule& schedule, const int reportStepIdx, - const WellStateFullyImplicitBlackoil& wellStateNupcol, - WellStateFullyImplicitBlackoil& wellState, + const WellState& wellStateNupcol, + WellState& wellState, GroupState& group_state) { for (const std::string& groupName : group.groups()) { @@ -524,8 +524,8 @@ namespace WellGroupHelpers const int reportStepIdx, const PhaseUsage& pu, const SummaryState& st, - const WellStateFullyImplicitBlackoil& wellStateNupcol, - WellStateFullyImplicitBlackoil& wellState, + const WellState& wellStateNupcol, + WellState& wellState, GroupState& group_state) { const int np = wellState.numPhases(); @@ -557,7 +557,7 @@ namespace WellGroupHelpers std::map computeNetworkPressures(const Opm::Network::ExtNetwork& network, - const WellStateFullyImplicitBlackoil& well_state, + const WellState& well_state, const GroupState& group_state, const VFPProdProperties& vfp_prod_props, const Schedule& schedule, @@ -677,7 +677,7 @@ namespace WellGroupHelpers GuideRate::RateVector - getWellRateVector(const WellStateFullyImplicitBlackoil& well_state, const PhaseUsage& pu, const std::string& name) + getWellRateVector(const WellState& well_state, const PhaseUsage& pu, const std::string& name) { return getGuideRateVector(well_state.currentWellRates(name), pu); } @@ -690,7 +690,7 @@ namespace WellGroupHelpers double getGuideRate(const std::string& name, const Schedule& schedule, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const GroupState& group_state, const int reportStepIdx, const GuideRate* guideRate, @@ -738,7 +738,7 @@ namespace WellGroupHelpers double getGuideRateInj(const std::string& name, const Schedule& schedule, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const GroupState& group_state, const int reportStepIdx, const GuideRate* guideRate, @@ -788,7 +788,7 @@ namespace WellGroupHelpers int groupControlledWells(const Schedule& schedule, - const WellStateFullyImplicitBlackoil& well_state, + const WellState& well_state, const GroupState& group_state, const int report_step, const std::string& group_name, @@ -829,7 +829,7 @@ namespace WellGroupHelpers } FractionCalculator::FractionCalculator(const Schedule& schedule, - const WellStateFullyImplicitBlackoil& well_state, + const WellState& well_state, const GroupState& group_state, const int report_step, const GuideRate* guide_rate, @@ -975,7 +975,7 @@ namespace WellGroupHelpers std::pair checkGroupConstraintsProd(const std::string& name, const std::string& parent, const Group& group, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const GroupState& group_state, const int reportStepIdx, const GuideRate* guideRate, @@ -1099,7 +1099,7 @@ namespace WellGroupHelpers std::pair checkGroupConstraintsInj(const std::string& name, const std::string& parent, const Group& group, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const GroupState& group_state, const int reportStepIdx, const GuideRate* guideRate, @@ -1226,7 +1226,7 @@ namespace WellGroupHelpers const PhaseUsage& pu, const int reportStepIdx, const double& simTime, - WellStateFullyImplicitBlackoil& wellState, + WellState& wellState, const GroupState& group_state, const Comm& comm, GuideRate* guideRate, @@ -1309,7 +1309,7 @@ namespace WellGroupHelpers const PhaseUsage& pu, const int reportStepIdx, const double& simTime, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const Comm& comm, GuideRate* guideRate) { @@ -1349,7 +1349,7 @@ namespace WellGroupHelpers const PhaseUsage& pu, \ const int reportStepIdx, \ const double& simTime, \ - WellStateFullyImplicitBlackoil& wellState, \ + WellState& wellState, \ const GroupState& group_state, \ const Dune::CollectiveCommunication<__VA_ARGS__>& comm, \ GuideRate* guideRate, \ @@ -1359,7 +1359,7 @@ namespace WellGroupHelpers const PhaseUsage& pu, \ const int reportStepIdx, \ const double& simTime, \ - const WellStateFullyImplicitBlackoil& wellState, \ + const WellState& wellState, \ const Dune::CollectiveCommunication<__VA_ARGS__>& comm, \ GuideRate* guideRate); diff --git a/opm/simulators/wells/WellGroupHelpers.hpp b/opm/simulators/wells/WellGroupHelpers.hpp index b2cb22f09..d723e57b7 100644 --- a/opm/simulators/wells/WellGroupHelpers.hpp +++ b/opm/simulators/wells/WellGroupHelpers.hpp @@ -37,7 +37,7 @@ namespace Network { class ExtNetwork; } struct PhaseUsage; class Schedule; class VFPProdProperties; -class WellStateFullyImplicitBlackoil; +class WellState; template class WellContainer; @@ -53,7 +53,7 @@ namespace WellGroupHelpers const Schedule& schedule, const SummaryState& summaryState, const int reportStepIdx, - WellStateFullyImplicitBlackoil& wellState, + WellState& wellState, GroupState& group_state); void accumulateGroupEfficiencyFactor(const Group& group, @@ -64,28 +64,28 @@ namespace WellGroupHelpers double sumWellPhaseRates(const WellContainer>& rates, const Group& group, const Schedule& schedule, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const int reportStepIdx, const int phasePos, const bool injector); double sumWellRates(const Group& group, const Schedule& schedule, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const int reportStepIdx, const int phasePos, const bool injector); double sumWellResRates(const Group& group, const Schedule& schedule, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const int reportStepIdx, const int phasePos, const bool injector); double sumSolventRates(const Group& group, const Schedule& schedule, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const int reportStepIdx, const bool injector); @@ -95,8 +95,8 @@ namespace WellGroupHelpers const bool isInjector, const PhaseUsage& pu, const GuideRate& guide_rate, - const WellStateFullyImplicitBlackoil& wellStateNupcol, - WellStateFullyImplicitBlackoil& wellState, + const WellState& wellStateNupcol, + WellState& wellState, GroupState& group_state, std::vector& groupTargetReduction); @@ -106,7 +106,7 @@ namespace WellGroupHelpers const PhaseUsage& pu, const int reportStepIdx, const double& simTime, - WellStateFullyImplicitBlackoil& wellState, + WellState& wellState, const GroupState& group_state, const Comm& comm, GuideRate* guideRate, @@ -117,7 +117,7 @@ namespace WellGroupHelpers const PhaseUsage& pu, const int reportStepIdx, const double& simTime, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const Comm& comm, GuideRate* guideRate); @@ -126,7 +126,7 @@ namespace WellGroupHelpers const SummaryState& summaryState, const Opm::PhaseUsage& pu, const int reportStepIdx, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const GroupState& group_state, GuideRate* guideRate, Opm::DeferredLogger& deferred_logger); @@ -134,28 +134,28 @@ namespace WellGroupHelpers void updateVREPForGroups(const Group& group, const Schedule& schedule, const int reportStepIdx, - const WellStateFullyImplicitBlackoil& wellStateNupcol, - WellStateFullyImplicitBlackoil& wellState, + const WellState& wellStateNupcol, + WellState& wellState, GroupState& group_state); void updateReservoirRatesInjectionGroups(const Group& group, const Schedule& schedule, const int reportStepIdx, - const WellStateFullyImplicitBlackoil& wellStateNupcol, - WellStateFullyImplicitBlackoil& wellState, + const WellState& wellStateNupcol, + WellState& wellState, GroupState& group_state); void updateWellRates(const Group& group, const Schedule& schedule, const int reportStepIdx, - const WellStateFullyImplicitBlackoil& wellStateNupcol, - WellStateFullyImplicitBlackoil& wellState); + const WellState& wellStateNupcol, + WellState& wellState); void updateGroupProductionRates(const Group& group, const Schedule& schedule, const int reportStepIdx, - const WellStateFullyImplicitBlackoil& wellStateNupcol, - WellStateFullyImplicitBlackoil& wellState, + const WellState& wellStateNupcol, + WellState& wellState, GroupState& group_state); void updateREINForGroups(const Group& group, @@ -163,27 +163,27 @@ namespace WellGroupHelpers const int reportStepIdx, const PhaseUsage& pu, const SummaryState& st, - const WellStateFullyImplicitBlackoil& wellStateNupcol, - WellStateFullyImplicitBlackoil& wellState, + const WellState& wellStateNupcol, + WellState& wellState, GroupState& group_state); std::map computeNetworkPressures(const Opm::Network::ExtNetwork& network, - const WellStateFullyImplicitBlackoil& well_state, + const WellState& well_state, const GroupState& group_state, const VFPProdProperties& vfp_prod_props, const Schedule& schedule, const int report_time_step); GuideRate::RateVector - getWellRateVector(const WellStateFullyImplicitBlackoil& well_state, const PhaseUsage& pu, const std::string& name); + getWellRateVector(const WellState& well_state, const PhaseUsage& pu, const std::string& name); GuideRate::RateVector getProductionGroupRateVector(const GroupState& group_state, const PhaseUsage& pu, const std::string& group_name); double getGuideRate(const std::string& name, const Schedule& schedule, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const GroupState& group_state, const int reportStepIdx, const GuideRate* guideRate, @@ -193,7 +193,7 @@ namespace WellGroupHelpers double getGuideRateInj(const std::string& name, const Schedule& schedule, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const GroupState& group_state, const int reportStepIdx, const GuideRate* guideRate, @@ -202,7 +202,7 @@ namespace WellGroupHelpers const PhaseUsage& pu); int groupControlledWells(const Schedule& schedule, - const WellStateFullyImplicitBlackoil& well_state, + const WellState& well_state, const GroupState& group_state, const int report_step, const std::string& group_name, @@ -215,7 +215,7 @@ namespace WellGroupHelpers { public: FractionCalculator(const Schedule& schedule, - const WellStateFullyImplicitBlackoil& well_state, + const WellState& well_state, const GroupState& group_state, const int report_step, const GuideRate* guide_rate, @@ -233,7 +233,7 @@ namespace WellGroupHelpers int groupControlledWells(const std::string& group_name, const std::string& always_included_child); GuideRate::RateVector getGroupRateVector(const std::string& group_name); const Schedule& schedule_; - const WellStateFullyImplicitBlackoil& well_state_; + const WellState& well_state_; const GroupState& group_state_; int report_step_; const GuideRate* guide_rate_; @@ -247,7 +247,7 @@ namespace WellGroupHelpers std::pair checkGroupConstraintsInj(const std::string& name, const std::string& parent, const Group& group, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const GroupState& group_state, const int reportStepIdx, const GuideRate* guideRate, @@ -276,7 +276,7 @@ namespace WellGroupHelpers std::pair checkGroupConstraintsProd(const std::string& name, const std::string& parent, const Group& group, - const WellStateFullyImplicitBlackoil& wellState, + const WellState& wellState, const GroupState& group_state, const int reportStepIdx, const GuideRate* guideRate, diff --git a/opm/simulators/wells/WellInterface.hpp b/opm/simulators/wells/WellInterface.hpp index 3d9bd387f..e538aed85 100644 --- a/opm/simulators/wells/WellInterface.hpp +++ b/opm/simulators/wells/WellInterface.hpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include // NOTE: GasLiftSingleWell.hpp includes StandardWell.hpp which includes ourself // (WellInterface.hpp), so we need to forward declare GasLiftSingleWell // for it to be defined in this file. Similar for BlackoilWellModel @@ -76,8 +76,6 @@ namespace Opm { public: - using WellState = WellStateFullyImplicitBlackoil; - using ModelParameters = BlackoilModelParametersEbos; static const int Water = BlackoilPhases::Aqua; diff --git a/opm/simulators/wells/WellInterfaceGeneric.cpp b/opm/simulators/wells/WellInterfaceGeneric.cpp index d405a0de7..31dcfbcab 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.cpp +++ b/opm/simulators/wells/WellInterfaceGeneric.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include diff --git a/opm/simulators/wells/WellInterfaceGeneric.hpp b/opm/simulators/wells/WellInterfaceGeneric.hpp index f5e288338..615320523 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.hpp +++ b/opm/simulators/wells/WellInterfaceGeneric.hpp @@ -42,11 +42,10 @@ struct PhaseUsage; class SummaryState; class VFPProperties; class WellTestState; -class WellStateFullyImplicitBlackoil; +class WellState; class WellInterfaceGeneric { public: - using WellState = WellStateFullyImplicitBlackoil; WellInterfaceGeneric(const Well& well, const ParallelWellInfo& parallel_well_info, diff --git a/opm/simulators/wells/WellStateFullyImplicitBlackoil.cpp b/opm/simulators/wells/WellState.cpp similarity index 94% rename from opm/simulators/wells/WellStateFullyImplicitBlackoil.cpp rename to opm/simulators/wells/WellState.cpp index aaaf1236c..595200dbe 100644 --- a/opm/simulators/wells/WellStateFullyImplicitBlackoil.cpp +++ b/opm/simulators/wells/WellState.cpp @@ -19,7 +19,7 @@ */ #include -#include +#include #include #include @@ -32,7 +32,7 @@ namespace Opm { -void WellStateFullyImplicitBlackoil::base_init(const std::vector& cellPressures, +void WellState::base_init(const std::vector& cellPressures, const std::vector& wells_ecl, const std::vector& parallel_well_info, const std::vector>& well_perf_data, @@ -77,7 +77,7 @@ void WellStateFullyImplicitBlackoil::base_init(const std::vector& cellPr -void WellStateFullyImplicitBlackoil::initSingleWell(const std::vector& cellPressures, +void WellState::initSingleWell(const std::vector& cellPressures, const int w, const Well& well, const std::vector& well_perf_data, @@ -224,12 +224,12 @@ void WellStateFullyImplicitBlackoil::initSingleWell(const std::vector& c -void WellStateFullyImplicitBlackoil::init(const std::vector& cellPressures, +void WellState::init(const std::vector& cellPressures, const Schedule& schedule, const std::vector& wells_ecl, const std::vector& parallel_well_info, const int report_step, - const WellStateFullyImplicitBlackoil* prevState, + const WellState* prevState, const std::vector>& well_perf_data, const SummaryState& summary_state) { @@ -391,7 +391,7 @@ void WellStateFullyImplicitBlackoil::init(const std::vector& cellPressur this->update_thp( newIndex, prevState->thp( oldIndex )); // If new target is set using WCONPROD, WCONINJE etc. we use the new control - if (!this->events_[w].hasEvent(WellStateFullyImplicitBlackoil::event_mask)) { + if (!this->events_[w].hasEvent(WellState::event_mask)) { current_injection_controls_[ newIndex ] = prevState->currentInjectionControl(oldIndex); current_production_controls_[ newIndex ] = prevState->currentProductionControl(oldIndex); } @@ -412,7 +412,7 @@ void WellStateFullyImplicitBlackoil::init(const std::vector& cellPressur if (new_iter == this->wellMap().end()) { throw std::logic_error { well.name() + " is not in internal well map - " - "Bug in WellStateFullyImplicitBlackoil" + "Bug in WellState" }; } @@ -536,7 +536,7 @@ void WellStateFullyImplicitBlackoil::init(const std::vector& cellPressur do_glift_optimization_ = true; } -void WellStateFullyImplicitBlackoil::resize(const std::vector& wells_ecl, +void WellState::resize(const std::vector& wells_ecl, const std::vector& parallel_well_info, const Schedule& schedule, const bool handle_ms_well, @@ -553,7 +553,7 @@ void WellStateFullyImplicitBlackoil::resize(const std::vector& wells_ecl, } const std::vector& -WellStateFullyImplicitBlackoil::currentWellRates(const std::string& wellName) const +WellState::currentWellRates(const std::string& wellName) const { auto it = well_rates.find(wellName); @@ -564,7 +564,7 @@ WellStateFullyImplicitBlackoil::currentWellRates(const std::string& wellName) co } template -void WellStateFullyImplicitBlackoil::gatherVectorsOnRoot(const std::vector& from_connections, +void WellState::gatherVectorsOnRoot(const std::vector& from_connections, std::vector& to_connections, const Communication& comm) const { @@ -586,7 +586,7 @@ void WellStateFullyImplicitBlackoil::gatherVectorsOnRoot(const std::vector& wasDynamicallyClosed) const { if (this->numWells() == 0) @@ -735,7 +735,7 @@ WellStateFullyImplicitBlackoil::report(const int* globalCellIdxMap, return res; } -void WellStateFullyImplicitBlackoil::reportConnections(data::Well& well, +void WellState::reportConnections(data::Well& well, const PhaseUsage &pu, const WellMapType::value_type& wt, const int* globalCellIdxMap) const @@ -802,8 +802,8 @@ void WellStateFullyImplicitBlackoil::reportConnections(data::Well& well, assert(local_comp_index == this->well_perf_data_[wt.second[0]].size()); } -void WellStateFullyImplicitBlackoil::initWellStateMSWell(const std::vector& wells_ecl, - const WellStateFullyImplicitBlackoil* prev_well_state) +void WellState::initWellStateMSWell(const std::vector& wells_ecl, + const WellState* prev_well_state) { // still using the order in wells const int nw = wells_ecl.size(); @@ -981,7 +981,7 @@ void WellStateFullyImplicitBlackoil::initWellStateMSWell(const std::vector } void -WellStateFullyImplicitBlackoil::calculateSegmentRates(const std::vector>& segment_inlets, +WellState::calculateSegmentRates(const std::vector>& segment_inlets, const std::vector>&segment_perforations, const std::vector& perforation_rates, const int np, const int segment, @@ -1008,38 +1008,38 @@ WellStateFullyImplicitBlackoil::calculateSegmentRates(const std::vectorsumPerfValues(&perfRateSolvent_[0] + first_perf_index_[w], &perfRateSolvent_[0] + first_perf_index_[w] + num_perf_[w]); } -double WellStateFullyImplicitBlackoil::polymerWellRate(const int w) const +double WellState::polymerWellRate(const int w) const { return parallel_well_info_[w]->sumPerfValues(&perfRatePolymer_[0] + first_perf_index_[w], &perfRatePolymer_[0] + first_perf_index_[w] + num_perf_[w]); } -double WellStateFullyImplicitBlackoil::brineWellRate(const int w) const +double WellState::brineWellRate(const int w) const { return parallel_well_info_[w]->sumPerfValues(&perfRateBrine_[0] + first_perf_index_[w], &perfRateBrine_[0] + first_perf_index_[w] + num_perf_[w]); } -int WellStateFullyImplicitBlackoil::topSegmentIndex(const int w) const +int WellState::topSegmentIndex(const int w) const { assert(w < int(top_segment_index_.size()) ); return top_segment_index_[w]; } -void WellStateFullyImplicitBlackoil::stopWell(int well_index) +void WellState::stopWell(int well_index) { this->status_[well_index] = Well::Status::STOP; this->thp_[well_index] = 0; } -void WellStateFullyImplicitBlackoil::shutWell(int well_index) +void WellState::shutWell(int well_index) { this->status_[well_index] = Well::Status::SHUT; this->thp_[well_index] = 0; @@ -1061,7 +1061,7 @@ void WellStateFullyImplicitBlackoil::shutWell(int well_index) this->conn_productivity_index_.begin() + last, 0.0); } -void WellStateFullyImplicitBlackoil::updateStatus(int well_index, Well::Status status) +void WellState::updateStatus(int well_index, Well::Status status) { switch (status) { case Well::Status::OPEN: @@ -1081,7 +1081,7 @@ void WellStateFullyImplicitBlackoil::updateStatus(int well_index, Well::Status s template -void WellStateFullyImplicitBlackoil::communicateGroupRates(const Comm& comm) +void WellState::communicateGroupRates(const Comm& comm) { // Note that injection_group_vrep_rates is handled separate from // the forAllGroupData() function, since it contains single doubles, @@ -1144,14 +1144,14 @@ void WellStateFullyImplicitBlackoil::communicateGroupRates(const Comm& comm) } template -void WellStateFullyImplicitBlackoil::updateGlobalIsGrup(const Comm& comm) +void WellState::updateGlobalIsGrup(const Comm& comm) { this->global_well_info.value().update_group(this->status_.data(), this->current_injection_controls_.data(), this->current_production_controls_.data()); this->global_well_info.value().communicate(comm); } data::Segment -WellStateFullyImplicitBlackoil::reportSegmentResults(const PhaseUsage& pu, +WellState::reportSegmentResults(const PhaseUsage& pu, const int well_id, const int seg_ix, const int seg_no) const @@ -1194,7 +1194,7 @@ WellStateFullyImplicitBlackoil::reportSegmentResults(const PhaseUsage& pu, return seg_res; } -bool WellStateFullyImplicitBlackoil::wellIsOwned(std::size_t well_index, +bool WellState::wellIsOwned(std::size_t well_index, [[maybe_unused]] const std::string& wellName) const { const auto& well_info = parallelWellInfo(well_index); @@ -1203,7 +1203,7 @@ bool WellStateFullyImplicitBlackoil::wellIsOwned(std::size_t well_index, return well_info.isOwner(); } -bool WellStateFullyImplicitBlackoil::wellIsOwned(const std::string& wellName) const +bool WellState::wellIsOwned(const std::string& wellName) const { const auto& it = this->wellMap_.find( wellName ); if (it == this->wellMap_.end()) { @@ -1213,7 +1213,7 @@ bool WellStateFullyImplicitBlackoil::wellIsOwned(const std::string& wellName) co return wellIsOwned(well_index, wellName); } -int WellStateFullyImplicitBlackoil::numSegments(const int well_id) const +int WellState::numSegments(const int well_id) const { const auto topseg = this->topSegmentIndex(well_id); @@ -1222,14 +1222,14 @@ int WellStateFullyImplicitBlackoil::numSegments(const int well_id) const : (this->topSegmentIndex(well_id + 1) - topseg); } -int WellStateFullyImplicitBlackoil::segmentNumber(const int well_id, const int seg_id) const +int WellState::segmentNumber(const int well_id, const int seg_id) const { const auto top_offset = this->topSegmentIndex(well_id); return this->seg_number_[top_offset + seg_id]; } -void WellStateFullyImplicitBlackoil::updateWellsDefaultALQ( const std::vector& wells_ecl ) +void WellState::updateWellsDefaultALQ( const std::vector& wells_ecl ) { const int nw = wells_ecl.size(); for (int i = 0; i& well_perf_data) { if (this->well_perf_data_[well_index].size() != well_perf_data.size()) { @@ -1282,11 +1282,11 @@ void WellStateFullyImplicitBlackoil::resetConnectionTransFactors(const int well_ } const ParallelWellInfo& -WellStateFullyImplicitBlackoil::parallelWellInfo(std::size_t well_index) const +WellState::parallelWellInfo(std::size_t well_index) const { return *parallel_well_info_[well_index]; } -template void WellStateFullyImplicitBlackoil::updateGlobalIsGrup(const ParallelWellInfo::Communication& comm); -template void WellStateFullyImplicitBlackoil::communicateGroupRates(const ParallelWellInfo::Communication& comm); +template void WellState::updateGlobalIsGrup(const ParallelWellInfo::Communication& comm); +template void WellState::communicateGroupRates(const ParallelWellInfo::Communication& comm); } // namespace Opm diff --git a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp b/opm/simulators/wells/WellState.hpp similarity index 98% rename from opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp rename to opm/simulators/wells/WellState.hpp index 3c6c77f66..fb687d34a 100644 --- a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp +++ b/opm/simulators/wells/WellState.hpp @@ -46,7 +46,7 @@ class Schedule; /// The state of a set of wells, tailored for use by the fully /// implicit blackoil simulator. -class WellStateFullyImplicitBlackoil +class WellState { public: using mapentry_t = std::array; @@ -54,14 +54,14 @@ public: static const uint64_t event_mask = ScheduleEvents::WELL_STATUS_CHANGE + ScheduleEvents::PRODUCTION_UPDATE + ScheduleEvents::INJECTION_UPDATE; - virtual ~WellStateFullyImplicitBlackoil() = default; + virtual ~WellState() = default; // TODO: same definition with WellInterface, eventually they should go to a common header file. static const int Water = BlackoilPhases::Aqua; static const int Oil = BlackoilPhases::Liquid; static const int Gas = BlackoilPhases::Vapour; - explicit WellStateFullyImplicitBlackoil(const PhaseUsage& pu) + explicit WellState(const PhaseUsage& pu) { this->phase_usage_ = pu; } @@ -86,7 +86,7 @@ public: const std::vector& wells_ecl, const std::vector& parallel_well_info, const int report_step, - const WellStateFullyImplicitBlackoil* prevState, + const WellState* prevState, const std::vector>& well_perf_data, const SummaryState& summary_state); @@ -135,7 +135,7 @@ public: /// init the MS well related. void initWellStateMSWell(const std::vector& wells_ecl, - const WellStateFullyImplicitBlackoil* prev_well_state); + const WellState* prev_well_state); static void calculateSegmentRates(const std::vector>& segment_inlets, const std::vector>&segment_perforations, const std::vector& perforation_rates, const int np, const int segment, std::vector& segment_rates); diff --git a/tests/test_glift1.cpp b/tests/test_glift1.cpp index ae318ffb1..2425dc037 100644 --- a/tests/test_glift1.cpp +++ b/tests/test_glift1.cpp @@ -40,7 +40,7 @@ #include //#include //#include -#include +#include /// #include #if HAVE_DUNE_FEM @@ -119,7 +119,7 @@ BOOST_AUTO_TEST_CASE(G1) //using EclProblem = Opm::EclProblem; //using EclWellModel = typename EclProblem::EclWellModel; using WellModel = Opm::BlackoilWellModel; - using WellState = Opm::WellStateFullyImplicitBlackoil; + using WellState = Opm::WellState; using StdWell = Opm::StandardWell; using GasLiftSingleWell = Opm::GasLiftSingleWell; const std::string filename = "GLIFT1.DATA"; diff --git a/tests/test_wellstatefullyimplicitblackoil.cpp b/tests/test_wellstate.cpp similarity index 98% rename from tests/test_wellstatefullyimplicitblackoil.cpp rename to tests/test_wellstate.cpp index 129bcd616..6104f2130 100644 --- a/tests/test_wellstatefullyimplicitblackoil.cpp +++ b/tests/test_wellstate.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include @@ -123,11 +123,11 @@ struct Setup }; namespace { - Opm::WellStateFullyImplicitBlackoil + Opm::WellState buildWellState(const Setup& setup, const std::size_t timeStep, std::vector& pinfos) { - auto state = Opm::WellStateFullyImplicitBlackoil{setup.pu}; + auto state = Opm::WellState{setup.pu}; const auto cpress = std::vector(setup.grid.c_grid()->number_of_cells, @@ -160,7 +160,7 @@ namespace { void setSegPress(const std::vector& wells, - Opm::WellStateFullyImplicitBlackoil& wstate) + Opm::WellState& wstate) { const auto nWell = wells.size(); @@ -193,7 +193,7 @@ namespace { void setSegRates(const std::vector& wells, const Opm::PhaseUsage& pu, - Opm::WellStateFullyImplicitBlackoil& wstate) + Opm::WellState& wstate) { const auto wat = pu.phase_used[Opm::BlackoilPhases::Aqua]; const auto iw = wat ? pu.phase_pos[Opm::BlackoilPhases::Aqua] : -1;