MultisegmentWellAssemble.hpp
Go to the documentation of this file.
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
29namespace Opm
30{
31
32class DeferredLogger;
33template<class Scalar> class GroupState;
34template<class Scalar, int numWellEq, int numEq> class MultisegmentWellEquations;
35template<class FluidSystem, class Indices> class MultisegmentWellPrimaryVariables;
36class Schedule;
37class SummaryState;
38template<class FluidSystem, class Indices> class WellInterfaceIndices;
39template<class Scalar> class WellState;
40
42template<class FluidSystem, class Indices>
44{
45 static constexpr bool has_water = (Indices::waterSwitchIdx >= 0);
46 static constexpr bool has_gas = (Indices::compositionSwitchIdx >= 0);
47 static constexpr bool has_oil = (Indices::numPhases - has_gas - has_water) > 0;
48
49 // In the implementation, one should use has_wfrac_variable
50 // rather than has_water to check if you should do something
51 // with the variable at the WFrac location, similar for GFrac.
52 static constexpr bool has_wfrac_variable = has_water && Indices::numPhases > 1;
53 static constexpr bool has_gfrac_variable = has_gas && has_oil;
54
55 static constexpr int WQTotal = 0;
56 static constexpr int WFrac = has_wfrac_variable ? 1 : -1000;
57 static constexpr int GFrac = has_gfrac_variable ? has_wfrac_variable + 1 : -1000;
58 static constexpr int SPres = has_wfrac_variable + has_gfrac_variable + 1;
59
60public:
61 static constexpr int numWellEq = Indices::numPhases+1;
62 using Scalar = typename FluidSystem::Scalar;
65 using EvalWell = DenseAd::Evaluation<Scalar, numWellEq+Indices::numEq>;
66
69 : well_(well)
70 {}
71
73 void assembleControlEq(const WellState<Scalar>& well_state,
74 const GroupState<Scalar>& group_state,
75 const Schedule& schedule,
76 const SummaryState& summaryState,
77 const Well::InjectionControls& inj_controls,
78 const Well::ProductionControls& prod_controls,
79 const double rho,
80 const PrimaryVariables& primary_variables,
81 Equations& eqns,
82 DeferredLogger& deferred_logger) const;
83
85 void assembleAccelerationTerm(const int seg_target,
86 const int seg,
87 const int seg_upwing,
88 const EvalWell& accelerationTerm,
89 Equations& eqns1) const;
90
92 void assembleHydroPressureLoss(const int seg,
93 const int seg_density,
94 const EvalWell& hydro_pressure_drop_seg,
95 Equations& eqns1) const;
96
99 const int seg_upwind,
100 const EvalWell& extra_derivatives,
101 Equations& eqns1) const;
102
104 void assemblePressureEq(const int seg,
105 const int seg_upwind,
106 const int outlet_segment_index,
107 const EvalWell& pressure_equation,
108 const EvalWell& outlet_pressure,
109 Equations& eqns,
110 bool wfrac = has_wfrac_variable,
111 bool gfrac = has_gfrac_variable) const;
112
114 void assembleTrivialEq(const int seg,
115 const Scalar value,
116 Equations& eqns) const;
117
119 void assembleAccumulationTerm(const int seg,
120 const int comp_idx,
121 const EvalWell& accumulation_term,
122 Equations& eqns1) const;
123
125 void assembleOutflowTerm(const int seg,
126 const int seg_upwind,
127 const int comp_idx,
128 const EvalWell& segment_rate,
129 Equations& eqns1) const;
130
132 void assembleInflowTerm(const int seg,
133 const int inlet,
134 const int inlet_upwind,
135 const int comp_idx,
136 const EvalWell& inlet_rate,
137 Equations& eqns) const;
138
140 void assemblePerforationEq(const int seg,
141 const int cell_idx,
142 const int comp_idx,
143 const EvalWell& cq_s_effective,
144 Equations& eqns) const;
145
146private:
148};
149
150}
151
152#endif // OPM_STANDARDWELL_ASSEMBLE_HEADER_INCLUDED
Definition: DeferredLogger.hpp:57
Definition: GroupState.hpp:35
Class handling assemble of the equation system for MultisegmentWell.
Definition: MultisegmentWellAssemble.hpp:44
void assembleOutflowTerm(const int seg, const int seg_upwind, const int comp_idx, const EvalWell &segment_rate, Equations &eqns1) const
Assemble outflow term.
typename FluidSystem::Scalar Scalar
Definition: MultisegmentWellAssemble.hpp:62
void assemblePerforationEq(const int seg, const int cell_idx, const int comp_idx, const EvalWell &cq_s_effective, Equations &eqns) const
Assemble equation for a perforation.
MultisegmentWellAssemble(const WellInterfaceIndices< FluidSystem, Indices > &well)
Constructor initializes reference to well.
Definition: MultisegmentWellAssemble.hpp:68
void assemblePressureEqExtraDerivatives(const int seg, const int seg_upwind, const EvalWell &extra_derivatives, Equations &eqns1) const
Assemble additional derivatives due to reverse flow.
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.
void assembleTrivialEq(const int seg, const Scalar value, Equations &eqns) const
Assembles a trivial equation.
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.
void assembleControlEq(const WellState< Scalar > &well_state, const GroupState< Scalar > &group_state, const Schedule &schedule, const SummaryState &summaryState, const Well::InjectionControls &inj_controls, const Well::ProductionControls &prod_controls, const double rho, const PrimaryVariables &primary_variables, Equations &eqns, DeferredLogger &deferred_logger) const
Assemble control equation.
void assembleAccumulationTerm(const int seg, const int comp_idx, const EvalWell &accumulation_term, Equations &eqns1) const
Assemble accumulation term.
DenseAd::Evaluation< Scalar, numWellEq+Indices::numEq > EvalWell
Definition: MultisegmentWellAssemble.hpp:65
void assembleHydroPressureLoss(const int seg, const int seg_density, const EvalWell &hydro_pressure_drop_seg, Equations &eqns1) const
Assemble hydraulic pressure term.
void assemblePressureEq(const int seg, const int seg_upwind, const int outlet_segment_index, const EvalWell &pressure_equation, const EvalWell &outlet_pressure, Equations &eqns, bool wfrac=has_wfrac_variable, bool gfrac=has_gfrac_variable) const
Assemble pressure terms.
static constexpr int numWellEq
Definition: MultisegmentWellAssemble.hpp:61
Definition: MultisegmentWellPrimaryVariables.hpp:45
Definition: WellInterfaceIndices.hpp:35
Definition: WellState.hpp:62
Definition: BlackoilPhases.hpp:27