My Project
MSWellHelpers.hpp
1 /*
2  Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
3  Copyright 2017 Statoil ASA.
4  Copyright 2020 Equinor ASA.
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_MSWELLHELPERS_HEADER_INCLUDED
24 #define OPM_MSWELLHELPERS_HEADER_INCLUDED
25 
26 #include <dune/istl/matrix.hh>
27 
28 namespace Dune {
29 template<class Matrix> class UMFPack;
30 }
31 
32 #include <memory>
33 
34 namespace Opm {
35 
36 class DeferredLogger;
37 class SICD;
38 
39 namespace mswellhelpers
40 {
41 
43  template <typename MatrixType, typename VectorType>
44  VectorType
45  applyUMFPack(const MatrixType& D,
46  std::shared_ptr<Dune::UMFPack<MatrixType>>& linsolver,
47  VectorType x);
48 
49 
50 
52  template <typename MatrixType, typename VectorType>
53  Dune::Matrix<typename MatrixType::block_type>
54  invertWithUMFPack(const MatrixType& D,
55  std::shared_ptr<Dune::UMFPack<MatrixType> >& linsolver);
56 
57 
58 
59  // obtain y = D^-1 * x with a BICSSTAB iterative solver
60  template <typename MatrixType, typename VectorType>
61  VectorType
62  invDX(const MatrixType& D, VectorType x, DeferredLogger& deferred_logger);
63 
64 
65  template <typename ValueType>
66  ValueType calculateFrictionFactor(const double area, const double diameter,
67  const ValueType& w, const double roughness,
68  const ValueType& mu);
69 
70 
71  // calculating the friction pressure loss
72  // l is the segment length
73  // area is the segment cross area
74  // diameter is the segment inner diameter
75  // w is mass flow rate through the segment
76  // density is density
77  // roughness is the absolute roughness
78  // mu is the average phase viscosity
79  template <typename ValueType>
80  ValueType frictionPressureLoss(const double l, const double diameter,
81  const double area, const double roughness,
82  const ValueType& density,
83  const ValueType& w, const ValueType& mu);
84 
85 
86  template <typename ValueType>
87  ValueType valveContrictionPressureLoss(const ValueType& mass_rate,
88  const ValueType& density,
89  const double area_con, const double cv);
90 
91 
92  template <typename ValueType>
93  ValueType velocityHead(const double area, const ValueType& mass_rate,
94  const ValueType& density);
95 
96 
97  // calculating the viscosity of oil-water emulsion at local conditons
98  template <typename ValueType>
99  ValueType emulsionViscosity(const ValueType& water_fraction,
100  const ValueType& water_viscosity,
101  const ValueType& oil_fraction,
102  const ValueType& oil_viscosity,
103  const SICD& sicd);
104 
105 } // namespace mswellhelpers
106 } // namespace Opm
107 
108 #endif
Definition: MSWellHelpers.hpp:29
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27