My Project
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
29namespace Opm
30{
31
32class DeferredLogger;
33class GroupState;
34template<class Scalar, int numWellEq, int numEq> class MultisegmentWellEquations;
35template<class FluidSystem, class Indices, class Scalar> class MultisegmentWellPrimaryVariables;
36class Schedule;
37class SummaryState;
38template<class FluidSystem, class Indices, class Scalar> class WellInterfaceIndices;
39class WellState;
40
42template<class FluidSystem, class Indices, class Scalar>
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;
64 using EvalWell = DenseAd::Evaluation<Scalar, numWellEq+Indices::numEq>;
65
68 : well_(well)
69 {}
70
72 void assembleControlEq(const WellState& well_state,
73 const GroupState& group_state,
74 const Schedule& schedule,
75 const SummaryState& summaryState,
76 const Well::InjectionControls& inj_controls,
77 const Well::ProductionControls& prod_controls,
78 const double rho,
79 const PrimaryVariables& primary_variables,
80 Equations& eqns,
81 DeferredLogger& deferred_logger) const;
82
83
85 void assemblePressureLoss(const int seg,
86 const int seg_upwind,
87 const EvalWell& accelerationPressureLoss,
88 Equations& eqns) const;
89
91 void assemblePressureEq(const int seg,
92 const int seg_upwind,
93 const int outlet_segment_index,
94 const EvalWell& pressure_equation,
95 const EvalWell& outlet_pressure,
96 Equations& eqns,
97 bool wfrac = has_wfrac_variable,
98 bool gfrac = has_gfrac_variable) const;
99
101 void assembleTrivialEq(const int seg,
102 const Scalar value,
103 Equations& eqns) const;
104
106 void assembleAccumulationTerm(const int seg,
107 const int comp_idx,
108 const EvalWell& accumulation_term,
109 Equations& eqns1) const;
110
112 void assembleOutflowTerm(const int seg,
113 const int seg_upwind,
114 const int comp_idx,
115 const EvalWell& segment_rate,
116 Equations& eqns1) const;
117
119 void assembleInflowTerm(const int seg,
120 const int inlet,
121 const int inlet_upwind,
122 const int comp_idx,
123 const EvalWell& inlet_rate,
124 Equations& eqns) const;
125
127 void assemblePerforationEq(const int seg,
128 const int cell_idx,
129 const int comp_idx,
130 const EvalWell& cq_s_effective,
131 Equations& eqns) const;
132
133private:
135};
136
137}
138
139#endif // OPM_STANDARDWELL_ASSEMBLE_HEADER_INCLUDED
Definition: DeferredLogger.hpp:57
Definition: GroupState.hpp:34
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.
Definition: MultisegmentWellAssemble.cpp:275
MultisegmentWellAssemble(const WellInterfaceIndices< FluidSystem, Indices, Scalar > &well)
Constructor initializes reference to well.
Definition: MultisegmentWellAssemble.hpp:67
void assembleTrivialEq(const int seg, const Scalar value, Equations &eqns) const
Assembles a trivial equation.
Definition: MultisegmentWellAssemble.cpp:250
void assembleControlEq(const WellState &well_state, const GroupState &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.
Definition: MultisegmentWellAssemble.cpp:86
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.
Definition: MultisegmentWellAssemble.cpp:316
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.
Definition: MultisegmentWellAssemble.cpp:221
void assembleAccumulationTerm(const int seg, const int comp_idx, const EvalWell &accumulation_term, Equations &eqns1) const
Assemble accumulation term.
Definition: MultisegmentWellAssemble.cpp:261
void assemblePressureLoss(const int seg, const int seg_upwind, const EvalWell &accelerationPressureLoss, Equations &eqns) const
Assemble pressure loss term.
Definition: MultisegmentWellAssemble.cpp:202
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:295
Definition: MultisegmentWellPrimaryVariables.hpp:42
Definition: WellInterfaceIndices.hpp:33
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition: WellState.hpp:60
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27