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#include <opm/simulators/wells/ParallelWellInfo.hpp>
30
31#include <opm/material/densead/Evaluation.hpp>
32
33#include <utility>
34#include <vector>
35
36namespace Opm {
37
38class ConvergenceReport;
39class Schedule;
40class SummaryState;
41
42template<class FluidSystem, class Indices> class WellInterfaceIndices;
43template<class Scalar> class WellState;
44
45template<typename FluidSystem, typename Indices>
46class MultisegmentWellEval : public MultisegmentWellGeneric<typename FluidSystem::Scalar>
47{
48protected:
49 using Scalar = typename FluidSystem::Scalar;
51 static constexpr int numWellEq = PrimaryVariables::numWellEq;
52 static constexpr int SPres = PrimaryVariables::SPres;
53 static constexpr int WQTotal = PrimaryVariables::WQTotal;
54
57
58 using BVector = typename Equations::BVector;
59 using BVectorWell = typename Equations::BVectorWell;
60
61 // TODO: for more efficient implementation, we should have EvalReservoir, EvalWell, and EvalRerservoirAndWell
62 // EvalR (Eval), EvalW, EvalRW
63 // TODO: for now, we only use one type to save some implementation efforts, while improve later.
64 using EvalWell = typename PrimaryVariables::EvalWell;
65 using Eval = DenseAd::Evaluation<Scalar, /*size=*/Indices::numEq>;
66
67public:
69 const Equations& linSys() const
70 { return linSys_; }
71 const ParallelWellInfo<Scalar>& pw_info_;
72
73protected:
75
76 void initMatrixAndVectors();
77
78 void assembleDefaultPressureEq(const int seg,
79 WellState<Scalar>& well_state,
80 const bool use_average_density);
81
82 // assemble pressure equation for ICD segments
83 void assembleICDPressureEq(const int seg,
85 WellState<Scalar>& well_state,
87 const bool use_average_density,
89
90 void assembleAccelerationAndHydroPressureLosses(const int seg,
91 WellState<Scalar>& well_state,
92 const bool use_average_density);
93
94
95 void assemblePressureEq(const int seg,
97 WellState<Scalar>& well_state,
99 const bool use_average_density,
101
104 const std::vector<Scalar>& B_avg,
106 const Scalar max_residual_allowed,
107 const Scalar tolerance_wells,
109 const Scalar tolerance_pressure_ms_wells,
111 const bool relax_tolerance,
112 const bool well_is_stopped) const;
113
114 std::pair<bool, std::vector<Scalar> >
115 getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
117
118 Scalar getControlTolerance(const WellState<Scalar>& well_state,
119 const Scalar tolerance_wells,
120 const Scalar tolerance_pressure_ms_wells,
122
123 Scalar getResidualMeasureValue(const WellState<Scalar>& well_state,
124 const std::vector<Scalar>& residuals,
125 const Scalar tolerance_wells,
126 const Scalar tolerance_pressure_ms_wells,
128
129 void assembleAccelerationPressureLoss(const int seg,
130 WellState<Scalar>& well_state);
131
132 EvalWell pressureDropAutoICD(const int seg,
133 const UnitSystem& unit_system) const;
134
135 // convert a Eval from reservoir to contain the derivative related to wells
136 EvalWell extendEval(const Eval& in) const;
137
139
143
144 // depth difference between perforations and the perforated grid cells
145 std::vector<Scalar> cell_perforation_depth_diffs_;
146 // pressure correction due to the different depth of the perforation and
147 // center depth of the grid block
148 std::vector<Scalar> cell_perforation_pressure_diffs_;
149};
150
151}
152
153#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:47
Equations linSys_
The equation system.
Definition MultisegmentWellEval.hpp:140
const Equations & linSys() const
Returns a const reference to equation system.
Definition MultisegmentWellEval.hpp:69
PrimaryVariables primary_variables_
The primary variables.
Definition MultisegmentWellEval.hpp:141
MSWSegments segments_
Segment properties.
Definition MultisegmentWellEval.hpp:142
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:82
Definition MultisegmentWellGeneric.hpp:39
Definition MultisegmentWellPrimaryVariables.hpp:45
Definition MultisegmentWellSegments.hpp:46
Class encapsulating some information about parallel wells.
Definition ParallelWellInfo.hpp:195
Definition WellInterfaceIndices.hpp:34
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition WellState.hpp:66
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