My Project
Loading...
Searching...
No Matches
MultisegmentWellEval.hpp
1/*
2 Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
3 Copyright 2017 Statoil ASA.
4
5 This file is part of the Open Porous Media project (OPM).
6
7 OPM is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 OPM is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with OPM. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21
22#ifndef OPM_MULTISEGMENTWELL_EVAL_HEADER_INCLUDED
23#define OPM_MULTISEGMENTWELL_EVAL_HEADER_INCLUDED
24
25#include <opm/simulators/wells/MultisegmentWellEquations.hpp>
26#include <opm/simulators/wells/MultisegmentWellGeneric.hpp>
27#include <opm/simulators/wells/MultisegmentWellPrimaryVariables.hpp>
28#include <opm/simulators/wells/MultisegmentWellSegments.hpp>
29
30#include <opm/material/densead/Evaluation.hpp>
31
32#include <utility>
33#include <vector>
34
35namespace Opm {
36
37class ConvergenceReport;
38class Schedule;
39class SummaryState;
40
41template<class FluidSystem, class Indices> class WellInterfaceIndices;
42template<class Scalar> class WellState;
43
44template<typename FluidSystem, typename Indices>
45class MultisegmentWellEval : public MultisegmentWellGeneric<typename FluidSystem::Scalar>
46{
47protected:
48 using Scalar = typename FluidSystem::Scalar;
50 static constexpr int numWellEq = PrimaryVariables::numWellEq;
51 static constexpr int SPres = PrimaryVariables::SPres;
52 static constexpr int WQTotal = PrimaryVariables::WQTotal;
53
56
57 using BVector = typename Equations::BVector;
58 using BVectorWell = typename Equations::BVectorWell;
59
60 // TODO: for more efficient implementation, we should have EvalReservoir, EvalWell, and EvalRerservoirAndWell
61 // EvalR (Eval), EvalW, EvalRW
62 // TODO: for now, we only use one type to save some implementation efforts, while improve later.
63 using EvalWell = typename PrimaryVariables::EvalWell;
64 using Eval = DenseAd::Evaluation<Scalar, /*size=*/Indices::numEq>;
65
66public:
68 const Equations& linSys() const
69 { return linSys_; }
70
71protected:
73
74 void initMatrixAndVectors();
75
76 void assembleDefaultPressureEq(const int seg,
77 WellState<Scalar>& well_state,
78 const bool use_average_density);
79
80 // assemble pressure equation for ICD segments
81 void assembleICDPressureEq(const int seg,
83 WellState<Scalar>& well_state,
85 const bool use_average_density,
87
88 void assembleAccelerationAndHydroPressureLosses(const int seg,
89 WellState<Scalar>& well_state,
90 const bool use_average_density);
91
92
93 void assemblePressureEq(const int seg,
95 WellState<Scalar>& well_state,
97 const bool use_average_density,
99
102 const std::vector<Scalar>& B_avg,
104 const Scalar max_residual_allowed,
105 const Scalar tolerance_wells,
107 const Scalar tolerance_pressure_ms_wells,
109 const bool relax_tolerance,
110 const bool well_is_stopped) const;
111
112 std::pair<bool, std::vector<Scalar> >
113 getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
115
116 Scalar getControlTolerance(const WellState<Scalar>& well_state,
117 const Scalar tolerance_wells,
118 const Scalar tolerance_pressure_ms_wells,
120
121 Scalar getResidualMeasureValue(const WellState<Scalar>& well_state,
122 const std::vector<Scalar>& residuals,
123 const Scalar tolerance_wells,
124 const Scalar tolerance_pressure_ms_wells,
126
127 void assembleAccelerationPressureLoss(const int seg,
128 WellState<Scalar>& well_state);
129
130 EvalWell pressureDropAutoICD(const int seg,
131 const UnitSystem& unit_system) const;
132
133 // convert a Eval from reservoir to contain the derivative related to wells
134 EvalWell extendEval(const Eval& in) const;
135
137
141
142 // depth difference between perforations and the perforated grid cells
143 std::vector<Scalar> cell_perforation_depth_diffs_;
144 // pressure correction due to the different depth of the perforation and
145 // center depth of the grid block
146 std::vector<Scalar> cell_perforation_pressure_diffs_;
147};
148
149}
150
151#endif // OPM_MULTISEGMENTWELL_GENERIC_HEADER_INCLUDED
Represents the convergence status of the whole simulator, to make it possible to query and store the ...
Definition ConvergenceReport.hpp:38
Definition DeferredLogger.hpp:57
Definition MultisegmentWellEval.hpp:46
Equations linSys_
The equation system.
Definition MultisegmentWellEval.hpp:138
const Equations & linSys() const
Returns a const reference to equation system.
Definition MultisegmentWellEval.hpp:68
PrimaryVariables primary_variables_
The primary variables.
Definition MultisegmentWellEval.hpp:139
MSWSegments segments_
Segment properties.
Definition MultisegmentWellEval.hpp:140
ConvergenceReport getWellConvergence(const WellState< Scalar > &well_state, const std::vector< Scalar > &B_avg, DeferredLogger &deferred_logger, const Scalar max_residual_allowed, const Scalar tolerance_wells, const Scalar relaxed_inner_tolerance_flow_ms_well, const Scalar tolerance_pressure_ms_wells, const Scalar relaxed_inner_tolerance_pressure_ms_well, const bool relax_tolerance, const bool well_is_stopped) const
check whether the well equations get converged for this well
Definition MultisegmentWellEval.cpp:81
Definition MultisegmentWellGeneric.hpp:42
Definition MultisegmentWellPrimaryVariables.hpp:45
Definition MultisegmentWellSegments.hpp:45
Definition WellInterfaceIndices.hpp:34
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition WellState.hpp:62
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242