opm-simulators
MultisegmentWellAssemble.hpp
1 /*
2  Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
3  Copyright 2017 Statoil ASA.
4  Copyright 2016 - 2017 IRIS AS.
5 
6  This file is part of the Open Porous Media project (OPM).
7 
8  OPM is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  OPM is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OPM. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 
23 #ifndef OPM_MULTISEGMENTWELL_ASSEMBLE_HEADER_INCLUDED
24 #define OPM_MULTISEGMENTWELL_ASSEMBLE_HEADER_INCLUDED
25 
26 #include <opm/input/eclipse/Schedule/Well/Well.hpp>
27 #include <opm/material/densead/Evaluation.hpp>
28 
29 namespace Opm
30 {
31 
32 class DeferredLogger;
33 template<class Scalar> class GroupState;
34 template<class Scalar, typename IndexTraits, int numWellEq, int numEq> class MultisegmentWellEquations;
35 template<class FluidSystem, class Indices> class MultisegmentWellPrimaryVariables;
36 class Schedule;
37 class SummaryState;
38 template<class FluidSystem, class Indices> class WellInterfaceIndices;
39 template<typename Scalar, typename IndexTraits> class WellState;
40 template<typename Scalar, typename IndexTraits> class GroupStateHelper;
41 
43 template<class FluidSystem, class Indices>
45 {
47  static constexpr int WQTotal = PrimaryVariables::WQTotal;
48  static constexpr bool has_wfrac_variable = PrimaryVariables::has_wfrac_variable;
49  static constexpr bool has_gfrac_variable = PrimaryVariables::has_gfrac_variable;
50  static constexpr int WFrac = PrimaryVariables::WFrac;
51  static constexpr int GFrac = PrimaryVariables::GFrac;
52  static constexpr int SPres = PrimaryVariables::SPres;
53 
54 public:
55  static constexpr int numWellEq = Indices::numPhases+1;
56  using Scalar = typename FluidSystem::Scalar;
57  using IndexTraits = typename FluidSystem::IndexTraitsType;
59  using EvalWell = DenseAd::Evaluation<Scalar, numWellEq+Indices::numEq>;
61 
64  : well_(well)
65  {}
66 
68  void assembleControlEq(const GroupStateHelperType& groupStateHelper,
69  const Well::InjectionControls& inj_controls,
70  const Well::ProductionControls& prod_controls,
71  const Scalar rho,
72  const PrimaryVariables& primary_variables,
73  Equations& eqns,
74  const bool stopped_or_zero_target) const;
75 
77  void assembleAccelerationTerm(const int seg_target,
78  const int seg,
79  const int seg_upwing,
80  const EvalWell& accelerationTerm,
81  Equations& eqns1) const;
82 
84  void assembleHydroPressureLoss(const int seg,
85  const int seg_density,
86  const EvalWell& hydro_pressure_drop_seg,
87  Equations& eqns1) const;
88 
90  void assemblePressureEqExtraDerivatives(const int seg,
91  const int seg_upwind,
92  const EvalWell& extra_derivatives,
93  Equations& eqns1) const;
94 
96  void assemblePressureEq(const int seg,
97  const int seg_upwind,
98  const int outlet_segment_index,
99  const EvalWell& pressure_equation,
100  const EvalWell& outlet_pressure,
101  Equations& eqns) const;
102 
104  void assembleTrivialEq(const int seg,
105  const Scalar value,
106  Equations& eqns) const;
107 
109  void assembleAccumulationTerm(const int seg,
110  const int comp_idx,
111  const EvalWell& accumulation_term,
112  Equations& eqns1) const;
113 
115  void assembleOutflowTerm(const int seg,
116  const int seg_upwind,
117  const int comp_idx,
118  const EvalWell& segment_rate,
119  Equations& eqns1) const;
120 
122  void assembleInflowTerm(const int seg,
123  const int inlet,
124  const int inlet_upwind,
125  const int comp_idx,
126  const EvalWell& inlet_rate,
127  Equations& eqns) const;
128 
130  void assemblePerforationEq(const int seg,
131  const int local_perf_index,
132  const int comp_idx,
133  const EvalWell& cq_s_effective,
134  Equations& eqns) const;
135 
136 private:
138 };
139 
140 }
141 
142 #endif // OPM_STANDARDWELL_ASSEMBLE_HEADER_INCLUDED
void assemblePressureEq(const int seg, const int seg_upwind, const int outlet_segment_index, const EvalWell &pressure_equation, const EvalWell &outlet_pressure, Equations &eqns) const
Assemble pressure terms.
Definition: MultisegmentWellAssemble.cpp:269
void assembleOutflowTerm(const int seg, const int seg_upwind, const int comp_idx, const EvalWell &segment_rate, Equations &eqns1) const
Assemble outflow term.
Definition: MultisegmentWellAssemble.cpp:335
void assembleHydroPressureLoss(const int seg, const int seg_density, const EvalWell &hydro_pressure_drop_seg, Equations &eqns1) const
Assemble hydraulic pressure term.
Definition: MultisegmentWellAssemble.cpp:231
Class handling assemble of the equation system for MultisegmentWell.
Definition: MultisegmentWellAssemble.hpp:44
void assembleAccelerationTerm(const int seg_target, const int seg, const int seg_upwing, const EvalWell &accelerationTerm, Equations &eqns1) const
Assemble piece of the acceleration term.
Definition: MultisegmentWellAssemble.cpp:200
void assembleTrivialEq(const int seg, const Scalar value, Equations &eqns) const
Assembles a trivial equation.
Definition: MultisegmentWellAssemble.cpp:299
Definition: MultisegmentWellAssemble.hpp:34
Definition: MultisegmentWellAssemble.hpp:35
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Definition: BlackoilWellModelConstraints.hpp:37
MultisegmentWellAssemble(const WellInterfaceIndices< FluidSystem, Indices > &well)
Constructor initializes reference to well.
Definition: MultisegmentWellAssemble.hpp:63
void assemblePressureEqExtraDerivatives(const int seg, const int seg_upwind, const EvalWell &extra_derivatives, Equations &eqns1) const
Assemble additional derivatives due to reverse flow.
Definition: MultisegmentWellAssemble.cpp:251
Definition: MultisegmentWellAssemble.hpp:38
void assembleInflowTerm(const int seg, const int inlet, const int inlet_upwind, const int comp_idx, const EvalWell &inlet_rate, Equations &eqns) const
Assemble inflow term.
Definition: MultisegmentWellAssemble.cpp:359
void assembleControlEq(const GroupStateHelperType &groupStateHelper, const Well::InjectionControls &inj_controls, const Well::ProductionControls &prod_controls, const Scalar rho, const PrimaryVariables &primary_variables, Equations &eqns, const bool stopped_or_zero_target) const
Assemble control equation.
Definition: MultisegmentWellAssemble.cpp:86
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition: TemperatureModel.hpp:61
void assembleAccumulationTerm(const int seg, const int comp_idx, const EvalWell &accumulation_term, Equations &eqns1) const
Assemble accumulation term.
Definition: MultisegmentWellAssemble.cpp:317
void assemblePerforationEq(const int seg, const int local_perf_index, const int comp_idx, const EvalWell &cq_s_effective, Equations &eqns) const
Assemble equation for a perforation.
Definition: MultisegmentWellAssemble.cpp:384