WellInterfaceFluidSystem.hpp
Go to the documentation of this file.
1/*
2 Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
3 Copyright 2017 Statoil ASA.
4 Copyright 2017 IRIS
5 Copyright 2019 Norce
6
7 This file is part of the Open Porous Media project (OPM).
8
9 OPM is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 OPM is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with OPM. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23
24#ifndef OPM_WELLINTERFACE_FLUID_SYSTEM_HEADER_INCLUDED
25#define OPM_WELLINTERFACE_FLUID_SYSTEM_HEADER_INCLUDED
26
28
29#include <limits>
30#include <optional>
31#include <vector>
32
33namespace Opm
34{
35namespace RateConverter
36{
37 template <class FluidSystem, class Region> class SurfaceToReservoirVoidage;
38}
39
40class Group;
41template<class Scalar> class GroupState;
42class Schedule;
43struct RatioLimitCheckReport;
44template<typename Scalar, typename IndexTraits> class SingleWellState;
45template<typename Scalar, typename IndexTraits> class WellState;
46template<typename Scalar, typename IndexTraits> class WellGroupHelper;
47
48template<class FluidSystem>
49class WellInterfaceFluidSystem : public WellInterfaceGeneric<typename FluidSystem::Scalar, typename FluidSystem::IndexTraitsType>
50{
51protected:
52 using RateConverterType = RateConverter::
53 SurfaceToReservoirVoidage<FluidSystem, std::vector<int>>;
54 // to indicate a invalid completion
55 static constexpr int INVALIDCOMPLETION = std::numeric_limits<int>::max();
56
57public:
58 using Scalar = typename FluidSystem::Scalar;
59 using IndexTraits = typename FluidSystem::IndexTraitsType;
63
64 static constexpr int Water = IndexTraits::waterPhaseIdx;
65 static constexpr int Oil = IndexTraits::oilPhaseIdx;
66 static constexpr int Gas = IndexTraits::gasPhaseIdx;
67
69 {
70 return rateConverter_;
71 }
72
73protected:
74 WellInterfaceFluidSystem(const Well& well,
75 const ParallelWellInfo<Scalar>& parallel_well_info,
76 const int time_step,
77 const ModelParameters& param,
78 const RateConverterType& rate_converter,
79 const int pvtRegionIdx,
80 const int num_conservation_quantities,
81 const int num_phases,
82 const int index_of_well,
83 const std::vector<PerforationData<Scalar>>& perf_data);
84
85 // updating the voidage rates in well_state when requested
87
89 const SummaryState& summaryState,
90 DeferredLogger& deferred_logger,
91 const std::optional<Well::InjectionControls>& inj_controls = std::nullopt,
92 const std::optional<Well::ProductionControls>& prod_controls = std::nullopt) const;
93
95 const Schedule& schedule,
96 const SummaryState& summaryState,
97 const bool check_guide_rate,
98 WellStateType& well_state,
99 DeferredLogger& deferred_logger) const;
100
102 const Schedule& schedule,
103 const SummaryState& summaryState,
104 WellStateType& well_state,
105 DeferredLogger& deferred_logger) const;
106
107 std::optional<Scalar>
108 getGroupInjectionTargetRate(const Group& group,
109 const WellState<Scalar, IndexTraits>& well_state,
110 const GroupState<Scalar>& group_state,
111 const Schedule& schedule,
112 const SummaryState& summaryState,
113 const InjectorType& injectorType,
114 Scalar efficiencyFactor,
115 DeferredLogger& deferred_logger) const;
116
117 Scalar
119 const WellState<Scalar, IndexTraits>& well_state,
120 const GroupState<Scalar>& group_state,
121 const Schedule& schedule,
122 const SummaryState& summaryState,
123 Scalar efficiencyFactor,
124 DeferredLogger& deferred_logger) const;
125
126 bool zeroGroupRateTarget(const SummaryState& summary_state,
127 const Schedule& schedule,
128 const WellState<Scalar, IndexTraits>& well_state,
129 const GroupState<Scalar>& group_state,
130 DeferredLogger& deferredLogger) const;
131
132 // For the conversion between the surface volume rate and reservoir voidage rate
134};
135
136}
137
138#endif // OPM_WELLINTERFACE_FLUID_SYSTEM_HEADER_INCLUDED
Definition: DeferredLogger.hpp:57
Definition: GroupState.hpp:41
Class encapsulating some information about parallel wells.
Definition: ParallelWellInfo.hpp:198
Definition: RateConverter.hpp:70
Definition: SingleWellState.hpp:43
Definition: WellGroupHelper.hpp:51
Definition: WellInterfaceFluidSystem.hpp:50
Scalar getGroupProductionTargetRate(const Group &group, const WellState< Scalar, IndexTraits > &well_state, const GroupState< Scalar > &group_state, const Schedule &schedule, const SummaryState &summaryState, Scalar efficiencyFactor, DeferredLogger &deferred_logger) const
const RateConverterType & rateConverter() const
Definition: WellInterfaceFluidSystem.hpp:68
std::optional< Scalar > getGroupInjectionTargetRate(const Group &group, const WellState< Scalar, IndexTraits > &well_state, const GroupState< Scalar > &group_state, const Schedule &schedule, const SummaryState &summaryState, const InjectorType &injectorType, Scalar efficiencyFactor, DeferredLogger &deferred_logger) const
typename FluidSystem::IndexTraitsType IndexTraits
Definition: WellInterfaceFluidSystem.hpp:59
static constexpr int Oil
Definition: WellInterfaceFluidSystem.hpp:65
static constexpr int Water
Definition: WellInterfaceFluidSystem.hpp:64
bool checkConstraints(const WellGroupHelperType &wgHelper, const Schedule &schedule, const SummaryState &summaryState, WellStateType &well_state, DeferredLogger &deferred_logger) const
typename FluidSystem::Scalar Scalar
Definition: WellInterfaceFluidSystem.hpp:58
WellInterfaceFluidSystem(const Well &well, const ParallelWellInfo< Scalar > &parallel_well_info, const int time_step, const ModelParameters &param, const RateConverterType &rate_converter, const int pvtRegionIdx, const int num_conservation_quantities, const int num_phases, const int index_of_well, const std::vector< PerforationData< Scalar > > &perf_data)
void calculateReservoirRates(const bool co2store, SingleWellState< Scalar, IndexTraits > &ws) const
static constexpr int Gas
Definition: WellInterfaceFluidSystem.hpp:66
const RateConverterType & rateConverter_
Definition: WellInterfaceFluidSystem.hpp:133
bool checkIndividualConstraints(SingleWellState< Scalar, IndexTraits > &ws, const SummaryState &summaryState, DeferredLogger &deferred_logger, const std::optional< Well::InjectionControls > &inj_controls=std::nullopt, const std::optional< Well::ProductionControls > &prod_controls=std::nullopt) const
bool checkGroupConstraints(const WellGroupHelperType &wgHelper, const Schedule &schedule, const SummaryState &summaryState, const bool check_guide_rate, WellStateType &well_state, DeferredLogger &deferred_logger) const
typename WellInterfaceGeneric< Scalar, IndexTraits >::ModelParameters ModelParameters
Definition: WellInterfaceFluidSystem.hpp:60
bool zeroGroupRateTarget(const SummaryState &summary_state, const Schedule &schedule, const WellState< Scalar, IndexTraits > &well_state, const GroupState< Scalar > &group_state, DeferredLogger &deferredLogger) const
static constexpr int INVALIDCOMPLETION
Definition: WellInterfaceFluidSystem.hpp:55
Definition: WellInterfaceGeneric.hpp:53
int pvtRegionIdx() const
Definition: WellInterfaceGeneric.hpp:130
Definition: WellState.hpp:66
Definition: blackoilbioeffectsmodules.hh:43
Solver parameters for the BlackoilModel.
Definition: BlackoilModelParameters.hpp:180
Static data associated with a well perforation.
Definition: PerforationData.hpp:30