StandardWellEval.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#ifndef OPM_STANDARDWELL_EVAL_HEADER_INCLUDED
23#define OPM_STANDARDWELL_EVAL_HEADER_INCLUDED
24
28
29#include <opm/grid/utility/SparseTable.hpp>
30
31#include <opm/material/densead/Evaluation.hpp>
32
33#include <vector>
34
35namespace Opm
36{
37
38class ConvergenceReport;
39class DeferredLogger;
40class Schedule;
41class SummaryState;
42template<class Scalar> class WellContributions;
43template<class FluidSystem, class Indices> class WellInterfaceIndices;
44template<typename FluidSystem, typename Indices> class WellState;
45
46template<class FluidSystem, class Indices>
48{
49public:
50 using Scalar = typename FluidSystem::Scalar;
51
52protected:
53 using IndexTraits = typename FluidSystem::IndexTraitsType;
56 static constexpr int Bhp = PrimaryVariables::Bhp;
57 static constexpr int WQTotal= PrimaryVariables::WQTotal;
59
62 static constexpr int WFrac = PrimaryVariables::WFrac;
63 static constexpr int GFrac = PrimaryVariables::GFrac;
64 static constexpr int SFrac = PrimaryVariables::SFrac;
65public:
67 using Eval = DenseAd::Evaluation<Scalar, Indices::numDerivatives>;
69
72 { return linSys_; }
73
74 static constexpr int numResDofs = Indices::numEq;
75 static constexpr int numWellDofs = numResDofs + 1;// NB will fail for for thermal for now
76 using BMatrix = Dune::BCRSMatrix<Dune::FieldMatrix<Scalar, numWellDofs, numResDofs>>;
77 using CMatrix = Dune::BCRSMatrix<Dune::FieldMatrix<Scalar, numResDofs, numWellDofs>>;
78 using DMatrix = Dune::BCRSMatrix<Dune::FieldMatrix<Scalar, numWellDofs, numWellDofs>>;
79 using WVector = Dune::BlockVector<Dune::FieldVector<Scalar, numWellDofs>>;
80
81 void addBCDMatrix(std::vector<BMatrix>& b_matrices,
82 std::vector<CMatrix>& c_matrices,
83 std::vector<DMatrix>& d_matrices,
84 Opm::SparseTable<int>& wcells) const;
85protected:
87
89
90 EvalWell extendEval(const Eval& in) const;
91
92 // computing the accumulation term for later use in well mass equations
94
96 const std::vector<Scalar>& B_avg,
97 const Scalar maxResidualAllowed,
98 const Scalar tol_wells,
99 const Scalar relaxed_tolerance_flow,
100 const bool relax_tolerance,
101 const bool well_is_stopped,
102 std::vector<Scalar>& res,
103 DeferredLogger& deferred_logger) const;
104
105 void init(std::vector<Scalar>& perf_depth,
106 const std::vector<Scalar>& depth_arg,
107 const bool has_polymermw);
108
110
111 // the saturations in the well bore under surface conditions at the beginning of the time step
112 std::vector<Scalar> F0_;
113
116};
117
118}
119
120#endif // OPM_STANDARDWELL_EVAL_HEADER_INCLUDED
Definition: ConvergenceReport.hpp:38
Definition: DeferredLogger.hpp:57
Definition: StandardWellConnections.hpp:46
Definition: StandardWellEquations.hpp:47
Definition: StandardWellEval.hpp:48
StandardWellEval(const WellInterfaceIndices< FluidSystem, Indices > &baseif)
Dune::BlockVector< Dune::FieldVector< Scalar, numWellDofs > > WVector
Definition: StandardWellEval.hpp:79
static constexpr int numWellConservationEq
Definition: StandardWellEval.hpp:58
static constexpr bool has_gfrac_variable
Definition: StandardWellEval.hpp:61
const StandardWellEquations< Scalar, IndexTraits, Indices::numEq > & linSys() const
Returns a const reference to equation system.
Definition: StandardWellEval.hpp:71
static constexpr int GFrac
Definition: StandardWellEval.hpp:63
DenseAd::Evaluation< Scalar, Indices::numDerivatives > Eval
Definition: StandardWellEval.hpp:67
Dune::BCRSMatrix< Dune::FieldMatrix< Scalar, numWellDofs, numWellDofs > > DMatrix
Definition: StandardWellEval.hpp:78
static constexpr int numWellDofs
Definition: StandardWellEval.hpp:75
Dune::BCRSMatrix< Dune::FieldMatrix< Scalar, numWellDofs, numResDofs > > BMatrix
Definition: StandardWellEval.hpp:76
const WellInterfaceIndices< FluidSystem, Indices > & baseif_
Definition: StandardWellEval.hpp:88
void addBCDMatrix(std::vector< BMatrix > &b_matrices, std::vector< CMatrix > &c_matrices, std::vector< DMatrix > &d_matrices, Opm::SparseTable< int > &wcells) const
Dune::BCRSMatrix< Dune::FieldMatrix< Scalar, numResDofs, numWellDofs > > CMatrix
Definition: StandardWellEval.hpp:77
ConvergenceReport getWellConvergence(const WellState< Scalar, IndexTraits > &well_state, const std::vector< Scalar > &B_avg, const Scalar maxResidualAllowed, const Scalar tol_wells, const Scalar relaxed_tolerance_flow, const bool relax_tolerance, const bool well_is_stopped, std::vector< Scalar > &res, DeferredLogger &deferred_logger) const
StandardWellEquations< Scalar, IndexTraits, Indices::numEq > linSys_
Linear equation system.
Definition: StandardWellEval.hpp:114
static constexpr int WFrac
Definition: StandardWellEval.hpp:62
StdWellConnections connections_
Connection level values.
Definition: StandardWellEval.hpp:115
PrimaryVariables primary_variables_
Primary variables for well.
Definition: StandardWellEval.hpp:109
EvalWell extendEval(const Eval &in) const
typename StandardWellEquations< Scalar, IndexTraits, Indices::numEq >::BVectorWell BVectorWell
Definition: StandardWellEval.hpp:68
std::vector< Scalar > F0_
Definition: StandardWellEval.hpp:112
typename PrimaryVariables::EvalWell EvalWell
Definition: StandardWellEval.hpp:66
static constexpr int Bhp
Definition: StandardWellEval.hpp:56
static constexpr int numResDofs
Definition: StandardWellEval.hpp:74
static constexpr bool has_wfrac_variable
Definition: StandardWellEval.hpp:60
static constexpr int SFrac
Definition: StandardWellEval.hpp:64
void init(std::vector< Scalar > &perf_depth, const std::vector< Scalar > &depth_arg, const bool has_polymermw)
static constexpr int WQTotal
Definition: StandardWellEval.hpp:57
typename FluidSystem::IndexTraitsType IndexTraits
Definition: StandardWellEval.hpp:53
typename FluidSystem::Scalar Scalar
Definition: StandardWellEval.hpp:50
Class holding primary variables for StandardWell.
Definition: StandardWellPrimaryVariables.hpp:42
static constexpr int SFrac
Definition: StandardWellPrimaryVariables.hpp:84
static constexpr bool has_gfrac_variable
Definition: StandardWellPrimaryVariables.hpp:81
DenseAd::DynamicEvaluation< Scalar, numStaticWellEq+Indices::numEq+1 > EvalWell
Evaluation for the well equations.
Definition: StandardWellPrimaryVariables.hpp:89
static constexpr bool has_wfrac_variable
Definition: StandardWellPrimaryVariables.hpp:80
static constexpr int WQTotal
The index for the weighted total rate.
Definition: StandardWellPrimaryVariables.hpp:73
static constexpr int GFrac
Definition: StandardWellPrimaryVariables.hpp:83
static constexpr int numWellConservationEq
Number of the conservation equations.
Definition: StandardWellPrimaryVariables.hpp:67
static constexpr int WFrac
Definition: StandardWellPrimaryVariables.hpp:82
static constexpr int Bhp
The index for Bhp in primary variables and the index of well control equation.
Definition: StandardWellPrimaryVariables.hpp:78
Definition: WellInterfaceIndices.hpp:34
Definition: WellState.hpp:66
Definition: blackoilbioeffectsmodules.hh:45