My Project
Loading...
Searching...
No Matches
Opm::BlackoilWellModel< TypeTag > Class Template Reference

Class for handling the blackoil well model. More...

#include <BlackoilWellModel.hpp>

Inheritance diagram for Opm::BlackoilWellModel< TypeTag >:
Opm::BlackoilWellModelGeneric

Classes

struct  WBPCalcID
 

Public Types

using ModelParameters = BlackoilModelParameters< TypeTag >
 
using Grid = GetPropType< TypeTag, Properties::Grid >
 
using EquilGrid = GetPropType< TypeTag, Properties::EquilGrid >
 
using FluidSystem = GetPropType< TypeTag, Properties::FluidSystem >
 
using ElementContext = GetPropType< TypeTag, Properties::ElementContext >
 
using Indices = GetPropType< TypeTag, Properties::Indices >
 
using Simulator = GetPropType< TypeTag, Properties::Simulator >
 
using Scalar = GetPropType< TypeTag, Properties::Scalar >
 
using RateVector = GetPropType< TypeTag, Properties::RateVector >
 
using GlobalEqVector = GetPropType< TypeTag, Properties::GlobalEqVector >
 
using SparseMatrixAdapter = GetPropType< TypeTag, Properties::SparseMatrixAdapter >
 
using GasLiftSingleWell = typename WellInterface< TypeTag >::GasLiftSingleWell
 
using GLiftOptWells = typename BlackoilWellModelGeneric::GLiftOptWells
 
using GLiftProdWells = typename BlackoilWellModelGeneric::GLiftProdWells
 
using GLiftWellStateMap = typename BlackoilWellModelGeneric::GLiftWellStateMap
 
using GLiftEclWells = typename GasLiftGroupInfo::GLiftEclWells
 
using GLiftSyncGroups = typename GasLiftSingleWellGeneric::GLiftSyncGroups
 
typedef BaseAuxiliaryModule< TypeTag >::NeighborSet NeighborSet
 
typedef Dune::FieldVector< Scalar, numEq > VectorBlockType
 
typedef Dune::BlockVector< VectorBlockType > BVector
 
typedef BlackOilPolymerModule< TypeTag > PolymerModule
 
typedef BlackOilMICPModule< TypeTag > MICPModule
 
using RateConverterType = RateConverter::SurfaceToReservoirVoidage< FluidSystem, std::vector< int > >
 
using AverageRegionalPressureType = RegionAverageCalculator::AverageRegionalPressure< FluidSystem, std::vector< int > >
 
using Domain = SubDomain< Grid >
 
using WellInterfacePtr = std::shared_ptr< WellInterface< TypeTag > >
 
using PressureMatrix = Dune::BCRSMatrix< Opm::MatrixBlock< double, 1, 1 > >
 
- Public Types inherited from Opm::BlackoilWellModelGeneric
using GLiftOptWells = std::map< std::string, std::unique_ptr< GasLiftSingleWellGeneric > >
 
using GLiftProdWells = std::map< std::string, const WellInterfaceGeneric * >
 
using GLiftWellStateMap = std::map< std::string, std::unique_ptr< GasLiftWellState > >
 

Public Member Functions

 BlackoilWellModel (Simulator &simulator)
 
void init ()
 
void initWellContainer (const int reportStepIdx) override
 
unsigned numDofs () const override
 
void addNeighbors (std::vector< NeighborSet > &neighbors) const override
 
void applyInitial () override
 
void linearize (SparseMatrixAdapter &jacobian, GlobalEqVector &res) override
 
void linearizeDomain (const Domain &domain, SparseMatrixAdapter &jacobian, GlobalEqVector &res)
 
void postSolve (GlobalEqVector &deltaX) override
 
void postSolveDomain (GlobalEqVector &deltaX, const Domain &domain)
 
template<class Restarter >
void deserialize (Restarter &)
 
template<class Restarter >
void serialize (Restarter &)
 This method writes the complete state of the well to the harddisk.
 
void beginEpisode ()
 
void beginTimeStep ()
 
void beginIteration ()
 
void endIteration ()
 
void endTimeStep ()
 
void endEpisode ()
 
void computeTotalRatesForDof (RateVector &rate, unsigned globalIdx) const
 
template<class Context >
void computeTotalRatesForDof (RateVector &rate, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
 
void initFromRestartFile (const RestartValue &restartValues)
 
void prepareDeserialize (const int report_step)
 
data::Wells wellData () const
 
data::WellBlockAveragePressures wellBlockAveragePressures () const
 
void apply (BVector &r) const
 
void apply (const BVector &x, BVector &Ax) const
 
void getWellContributions (WellContributions &x) const
 
void applyScaleAdd (const Scalar alpha, const BVector &x, BVector &Ax) const
 
ConvergenceReport getWellConvergence (const std::vector< Scalar > &B_avg, const bool checkWellGroupControls=false) const
 
ConvergenceReport getDomainWellConvergence (const Domain &domain, const std::vector< Scalar > &B_avg, DeferredLogger &local_deferredLogger) const
 
const SimulatorReportSinglelastReport () const
 
void addWellContributions (SparseMatrixAdapter &jacobian) const
 
void addReservoirSourceTerms (GlobalEqVector &residual, std::vector< typename SparseMatrixAdapter::MatrixBlock * > &diagMatAddress) const
 
void beginReportStep (const int time_step)
 
void calculateExplicitQuantities (DeferredLogger &deferred_logger) const
 Calculating the explict quantities used in the well calculation.
 
void prepareTimeStep (DeferredLogger &deferred_logger)
 
void initPrimaryVariablesEvaluation () const
 
void initPrimaryVariablesEvaluationDomain (const Domain &domain) const
 
std::pair< bool, bool > updateWellControls (const bool mandatory_network_balance, DeferredLogger &deferred_logger, const bool relax_network_tolerance=false)
 
void updateAndCommunicate (const int reportStepIdx, const int iterationIdx, DeferredLogger &deferred_logger)
 
bool updateGroupControls (const Group &group, DeferredLogger &deferred_logger, const int reportStepIdx, const int iterationIdx)
 
WellInterfacePtr getWell (const std::string &well_name) const
 
bool hasWell (const std::string &well_name) const
 
void addWellPressureEquations (PressureMatrix &jacobian, const BVector &weights, const bool use_well_weights) const
 
void addWellPressureEquationsStruct (PressureMatrix &jacobian) const
 
void initGliftEclWellMap (GLiftEclWells &ecl_well_map)
 
const std::vector< WellInterfacePtr > & localNonshutWells () const
 Get list of local nonshut wells.
 
void assembleDomain (const int iterationIdx, const double dt, const Domain &domain)
 
void updateWellControlsDomain (DeferredLogger &deferred_logger, const Domain &domain)
 
void logPrimaryVars () const
 
std::vector< double > getPrimaryVarsDomain (const Domain &domain) const
 
void setPrimaryVarsDomain (const Domain &domain, const std::vector< double > &vars)
 
void setupDomains (const std::vector< Domain > &domains)
 
void initFromRestartFile (const RestartValue &restartValues, WellTestState wtestState, const std::size_t numCells, bool handle_ms_well)
 
void prepareDeserialize (int report_step, const std::size_t numCells, bool handle_ms_well)
 
- Public Member Functions inherited from Opm::BlackoilWellModelGeneric
 BlackoilWellModelGeneric (Schedule &schedule, const SummaryState &summaryState, const EclipseState &eclState, const PhaseUsage &phase_usage, const Parallel::Communication &comm)
 
int numLocalWells () const
 
int numLocalWellsEnd () const
 
int numLocalNonshutWells () const
 
int numPhases () const
 
bool wellsActive () const
 return true if wells are available in the reservoir
 
bool hasWell (const std::string &wname) const
 
bool networkActive () const
 return true if network is active (at least one network well in prediction mode)
 
bool anyMSWellOpenLocal () const
 
const Well & getWellEcl (const std::string &well_name) const
 
std::vector< Well > getLocalWells (const int timeStepIdx) const
 
const Schedule & schedule () const
 
const PhaseUsagephaseUsage () const
 
const GroupStategroupState () const
 
std::vector< const WellInterfaceGeneric * > genericWells () const
 
const WellStatewellState () const
 
WellStatewellState ()
 
const WellStatenupcolWellState () const
 
GroupStategroupState ()
 
WellTestState & wellTestState ()
 
const WellTestState & wellTestState () const
 
double wellPI (const int well_index) const
 
double wellPI (const std::string &well_name) const
 
void updateEclWells (const int timeStepIdx, const SimulatorUpdate &sim_update, const SummaryState &st)
 
void initFromRestartFile (const RestartValue &restartValues, WellTestState wtestState, const std::size_t numCells, bool handle_ms_well)
 
void prepareDeserialize (int report_step, const std::size_t numCells, bool handle_ms_well)
 
void commitWGState ()
 
data::GroupAndNetworkValues groupAndNetworkData (const int reportStepIdx) const
 
bool hasTHPConstraints () const
 Return true if any well has a THP constraint.
 
void updateNetworkActiveState (const int report_step)
 Checks if network is active (at least one network well on prediction).
 
bool needPreStepNetworkRebalance (const int report_step) const
 Checks if there are reasons to perform a pre-step network re-balance.
 
bool forceShutWellByName (const std::string &wellname, const double simulation_time)
 Shut down any single well Returns true if the well was actually found and shut.
 
const std::vector< PerforationData > & perfData (const int well_idx) const
 
const Parallel::Communication & comm () const
 
const EclipseState & eclipseState () const
 
const SummaryState & summaryState () const
 
const GuideRate & guideRate () const
 
bool reportStepStarts () const
 
bool shouldBalanceNetwork (const int reportStepIndex, const int iterationIdx) const
 
void updateClosedWellsThisStep (const std::string &well_name) const
 
bool wasDynamicallyShutThisTimeStep (const std::string &well_name) const
 
template<class Serializer >
void serializeOp (Serializer &serializer)
 
bool operator== (const BlackoilWellModelGeneric &rhs) const
 

Static Public Attributes

static constexpr std::size_t pressureVarIndex = GetPropType<TypeTag, Properties::Indices>::pressureSwitchIdx
 
static const int numEq = Indices::numEq
 
static const int solventSaturationIdx = Indices::solventSaturationIdx
 
static constexpr bool has_solvent_ = getPropValue<TypeTag, Properties::EnableSolvent>()
 
static constexpr bool has_polymer_ = getPropValue<TypeTag, Properties::EnablePolymer>()
 
static constexpr bool has_energy_ = getPropValue<TypeTag, Properties::EnableEnergy>()
 
static constexpr bool has_micp_ = getPropValue<TypeTag, Properties::EnableMICP>()
 

Protected Member Functions

void initializeWellState (const int timeStepIdx)
 
void createWellContainer (const int report_step) override
 
WellInterfacePtr createWellPointer (const int wellID, const int report_step) const
 
template<typename WellType >
std::unique_ptr< WellType > createTypedWellPointer (const int wellID, const int time_step) const
 
WellInterfacePtr createWellForWellTest (const std::string &well_name, const int report_step, DeferredLogger &deferred_logger) const
 
void doPreStepNetworkRebalance (DeferredLogger &deferred_logger)
 
const Grid & grid () const
 
const EquilGrid & equilGrid () const
 
const EclipseState & eclState () const
 
void assemble (const int iterationIdx, const double dt)
 
std::pair< bool, bool > updateWellControlsAndNetworkIteration (const bool mandatory_network_balance, const bool relax_network_tolerance, const double dt, DeferredLogger &local_deferredLogger)
 
bool updateWellControlsAndNetwork (const bool mandatory_network_balance, const double dt, DeferredLogger &local_deferredLogger)
 
void initializeLocalWellStructure (const int reportStepIdx, const bool enableWellPIScaling)
 Update rank's notion of intersecting wells and their associate solution variables.
 
void initializeGroupStructure (const int reportStepIdx)
 Initialize group control modes/constraints and group solution state.
 
void timeStepSucceeded (const double simulationTime, const double dt)
 
void endReportStep ()
 
void recoverWellSolutionAndUpdateWellState (const BVector &x)
 
void recoverWellSolutionAndUpdateWellStateDomain (const BVector &x, const Domain &domain)
 
void updatePrimaryVariables (DeferredLogger &deferred_logger)
 
void initializeWBPCalculationService ()
 
data::WellBlockAveragePressures computeWellBlockAveragePressures () const
 
ParallelWBPCalculation::EvaluatorFactory makeWellSourceEvaluatorFactory (const std::vector< Well >::size_type wellIdx) const
 
void registerOpenWellsForWBPCalculation ()
 
void updateAverageFormationFactor ()
 
void computePotentials (const std::size_t widx, const WellState &well_state_copy, std::string &exc_msg, ExceptionType::ExcEnum &exc_type, DeferredLogger &deferred_logger) override
 
const std::vector< double > & wellPerfEfficiencyFactors () const
 
void calculateProductivityIndexValuesShutWells (const int reportStepIdx, DeferredLogger &deferred_logger) override
 
void calculateProductivityIndexValues (DeferredLogger &deferred_logger) override
 
void calculateProductivityIndexValues (const WellInterface< TypeTag > *wellPtr, DeferredLogger &deferred_logger)
 
int numComponents () const
 
int reportStepIndex () const
 
void assembleWellEq (const double dt, DeferredLogger &deferred_logger)
 
void assembleWellEqDomain (const double dt, const Domain &domain, DeferredLogger &deferred_logger)
 
void prepareWellsBeforeAssembling (const double dt, DeferredLogger &deferred_logger)
 
void assembleWellEqWithoutIteration (const double dt, DeferredLogger &deferred_logger)
 
bool maybeDoGasLiftOptimize (DeferredLogger &deferred_logger)
 
void gasLiftOptimizationStage1 (DeferredLogger &deferred_logger, GLiftProdWells &prod_wells, GLiftOptWells &glift_wells, GasLiftGroupInfo &group_info, GLiftWellStateMap &state_map)
 
void gasLiftOptimizationStage1SingleWell (WellInterface< TypeTag > *well, DeferredLogger &deferred_logger, GLiftProdWells &prod_wells, GLiftOptWells &glift_wells, GasLiftGroupInfo &group_info, GLiftWellStateMap &state_map, GLiftSyncGroups &groups_to_sync)
 
void extractLegacyCellPvtRegionIndex_ ()
 
void extractLegacyDepth_ ()
 
void updateWellTestState (const double &simulationTime, WellTestState &wellTestState) const
 upate the wellTestState related to economic limits
 
void wellTesting (const int timeStepIdx, const double simulationTime, DeferredLogger &deferred_logger)
 
void calcRates (const int fipnum, const int pvtreg, const std::vector< double > &production_rates, std::vector< double > &resv_coeff) override
 
void calcInjRates (const int fipnum, const int pvtreg, std::vector< double > &resv_coeff) override
 
void computeWellTemperature ()
 
int compressedIndexForInterior (int cartesian_cell_idx) const override
 get compressed index for interior cells (-1, otherwise
 
- Protected Member Functions inherited from Opm::BlackoilWellModelGeneric
const WellStateprevWellState () const
 
const WGStateprevWGState () const
 
void commitWGState (WGState wgstate)
 
void resetWGState ()
 
void updateNupcolWGState ()
 
std::vector< std::reference_wrapper< ParallelWellInfo > > createLocalParallelWellInfo (const std::vector< Well > &wells)
 Create the parallel well information.
 
void initializeWellProdIndCalculators ()
 
void initializeWellPerfData ()
 
bool wasDynamicallyShutThisTimeStep (const int well_index) const
 
double updateNetworkPressures (const int reportStepIdx)
 
void updateWsolvent (const Group &group, const int reportStepIdx, const WellState &wellState)
 
void setWsolvent (const Group &group, const int reportStepIdx, double wsolvent)
 
void assignShutConnections (data::Wells &wsrpt, const int reportStepIndex) const
 
void assignGroupControl (const Group &group, data::GroupData &gdata) const
 
void assignGroupValues (const int reportStepIdx, std::map< std::string, data::GroupData > &gvalues) const
 
void assignNodeValues (std::map< std::string, data::NodeData > &nodevalues, const int reportStepIdx) const
 
void calculateEfficiencyFactors (const int reportStepIdx)
 
void checkGconsaleLimits (const Group &group, WellState &well_state, const int reportStepIdx, DeferredLogger &deferred_logger)
 
void checkGEconLimits (const Group &group, const double simulation_time, const int report_step_idx, DeferredLogger &deferred_logger)
 
bool checkGroupHigherConstraints (const Group &group, DeferredLogger &deferred_logger, const int reportStepIdx)
 
void updateAndCommunicateGroupData (const int reportStepIdx, const int iterationIdx)
 
void inferLocalShutWells ()
 
void setRepRadiusPerfLength ()
 
void gliftDebug (const std::string &msg, DeferredLogger &deferred_logger) const
 
void gliftDebugShowALQ (DeferredLogger &deferred_logger)
 
void gasLiftOptimizationStage2 (DeferredLogger &deferred_logger, GLiftProdWells &prod_wells, GLiftOptWells &glift_wells, GasLiftGroupInfo &group_info, GLiftWellStateMap &map, const int episodeIndex)
 
void updateWellPotentials (const int reportStepIdx, const bool onlyAfterEvent, const SummaryConfig &summaryConfig, DeferredLogger &deferred_logger)
 
void initInjMult ()
 
void updateInjMult (DeferredLogger &deferred_logger)
 
void updateInjFCMult (DeferredLogger &deferred_logger)
 
void updateFiltrationParticleVolume (const double dt, const std::size_t water_index)
 
void runWellPIScaling (const int reportStepIdx, DeferredLogger &local_deferredLogger)
 
std::vector< int > getCellsForConnections (const Well &well) const
 
std::vector< std::vector< int > > getMaxWellConnections () const
 
std::vector< std::string > getWellsForTesting (const int timeStepIdx, const double simulationTime)
 
void assignWellTracerRates (data::Wells &wsrpt, const WellTracerRates &wellTracerRates) const
 

Protected Attributes

Simulator & simulator_
 
std::vector< WellInterfacePtr > well_container_ {}
 
std::vector< bool > is_cell_perforated_ {}
 
const ModelParameters param_
 
std::size_t global_num_cells_ {}
 
std::size_t local_num_cells_ {}
 
double gravity_ {}
 
std::vector< double > depth_ {}
 
bool alternative_well_rate_init_ {}
 
std::unique_ptr< RateConverterTyperateConverter_ {}
 
std::map< std::string, std::unique_ptr< AverageRegionalPressureType > > regionalAveragePressureCalculator_ {}
 
std::vector< WBPCalcIDwbpCalcMap_ {}
 
SimulatorReportSingle last_report_ {}
 
BVector scaleAddRes_ {}
 
std::vector< Scalar > B_avg_ {}
 
std::map< std::string, int > well_domain_
 
- Protected Attributes inherited from Opm::BlackoilWellModelGeneric
Schedule & schedule_
 
const SummaryState & summaryState_
 
const EclipseState & eclState_
 
const Parallel::Communication & comm_
 
PhaseUsage phase_usage_
 
bool terminal_output_ {false}
 
bool wells_active_ {false}
 
bool network_active_ {false}
 
bool initial_step_ {}
 
bool report_step_starts_ {}
 
std::optional< int > last_run_wellpi_ {}
 
std::vector< Well > wells_ecl_
 
std::vector< std::vector< PerforationData > > well_perf_data_
 
std::vector< ConnectionIndexMapconn_idx_map_ {}
 
std::function< bool(const Well &)> not_on_process_ {}
 
std::vector< WellInterfaceGeneric * > well_container_generic_ {}
 
std::vector< int > local_shut_wells_ {}
 
std::vector< ParallelWellInfoparallel_well_info_
 
std::vector< std::reference_wrapper< ParallelWellInfo > > local_parallel_well_info_
 
std::vector< WellProdIndexCalculatorprod_index_calc_
 
ParallelWBPCalculation wbpCalculationService_
 
std::vector< int > pvt_region_idx_
 
std::unordered_set< std::string > closed_this_step_
 
GuideRate guideRate_
 
std::unique_ptr< VFPPropertiesvfp_properties_ {}
 
std::map< std::string, double > node_pressures_
 
std::unordered_map< std::string, std::vector< double > > prev_inj_multipliers_
 
std::unordered_map< std::string, WellFilterCakefilter_cake_
 
WGState active_wgstate_
 
WGState last_valid_wgstate_
 
WGState nupcol_wgstate_
 
bool glift_debug = false
 
double last_glift_opt_time_ = -1.0
 
bool wellStructureChangedDynamically_ {false}
 
std::map< std::string, std::string > switched_prod_groups_
 
std::map< std::pair< std::string, Opm::Phase >, std::string > switched_inj_groups_
 
std::map< std::string, std::pair< std::string, std::string > > closed_offending_wells_
 

Additional Inherited Members

- Protected Types inherited from Opm::BlackoilWellModelGeneric
using WellTracerRates = std::map< std::pair< std::string, std::string >, double >
 

Detailed Description

template<typename TypeTag>
class Opm::BlackoilWellModel< TypeTag >

Class for handling the blackoil well model.

Member Function Documentation

◆ calcInjRates()

template<typename TypeTag >
void Opm::BlackoilWellModel< TypeTag >::calcInjRates ( const int  fipnum,
const int  pvtreg,
std::vector< double > &  resv_coeff 
)
overrideprotectedvirtual

◆ calcRates()

template<typename TypeTag >
void Opm::BlackoilWellModel< TypeTag >::calcRates ( const int  fipnum,
const int  pvtreg,
const std::vector< double > &  production_rates,
std::vector< double > &  resv_coeff 
)
overrideprotectedvirtual

◆ calculateExplicitQuantities()

template<typename TypeTag >
void Opm::BlackoilWellModel< TypeTag >::calculateExplicitQuantities ( DeferredLogger deferred_logger) const

Calculating the explict quantities used in the well calculation.

By explicit, we mean they are cacluated at the beginning of the time step and no derivatives are included in these quantities

◆ calculateProductivityIndexValues()

template<typename TypeTag >
void Opm::BlackoilWellModel< TypeTag >::calculateProductivityIndexValues ( DeferredLogger deferred_logger)
overrideprotectedvirtual

◆ calculateProductivityIndexValuesShutWells()

template<typename TypeTag >
void Opm::BlackoilWellModel< TypeTag >::calculateProductivityIndexValuesShutWells ( const int  reportStepIdx,
DeferredLogger deferred_logger 
)
overrideprotectedvirtual

◆ compressedIndexForInterior()

template<typename TypeTag >
int Opm::BlackoilWellModel< TypeTag >::compressedIndexForInterior ( int  cartesian_cell_idx) const
inlineoverrideprotectedvirtual

get compressed index for interior cells (-1, otherwise

Implements Opm::BlackoilWellModelGeneric.

◆ computePotentials()

template<typename TypeTag >
void Opm::BlackoilWellModel< TypeTag >::computePotentials ( const std::size_t  widx,
const WellState well_state_copy,
std::string &  exc_msg,
ExceptionType::ExcEnum &  exc_type,
DeferredLogger deferred_logger 
)
overrideprotectedvirtual

◆ createWellContainer()

template<typename TypeTag >
void Opm::BlackoilWellModel< TypeTag >::createWellContainer ( const int  report_step)
overrideprotectedvirtual

◆ initializeGroupStructure()

template<typename TypeTag >
void Opm::BlackoilWellModel< TypeTag >::initializeGroupStructure ( const int  reportStepIdx)
protected

Initialize group control modes/constraints and group solution state.

Parameters
[in]reportStepIdxReport step.

◆ initializeLocalWellStructure()

template<typename TypeTag >
void Opm::BlackoilWellModel< TypeTag >::initializeLocalWellStructure ( const int  reportStepIdx,
const bool  enableWellPIScaling 
)
protected

Update rank's notion of intersecting wells and their associate solution variables.

Parameters
[in]reportStepIdxReport step.
[in]enableWellPIScalingWhether or not to enable WELPI scaling. Typically enabled (i.e., true) only at the start of a report step.

◆ initWellContainer()

template<typename TypeTag >
void Opm::BlackoilWellModel< TypeTag >::initWellContainer ( const int  reportStepIdx)
overridevirtual

The documentation for this class was generated from the following files: