My Project
PAvgCalculator.hpp
1/*
2 Copyright 2020 Equinor ASA.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20
21#ifndef PAVE_CALC_HPP
22#define PAVE_CALC_HPP
23
24#include <functional>
25#include <map>
26#include <optional>
27#include <vector>
28
29#include <opm/input/eclipse/Schedule/Well/PAvg.hpp>
30#include <opm/input/eclipse/Schedule/Well/Connection.hpp>
31
32namespace Opm {
33
34class WellConnections;
35class EclipseGrid;
36
38public:
39
40 PAvgCalculator(const std::string& well, double well_ref_depth, const EclipseGrid& grid, const std::vector<double>& porv, const WellConnections& connections, const PAvg& pavg);
41
42 enum class WBPMode {
43 WBP,
44 WBP4,
45 WBP5,
46 WBP9
47 };
48
49
50 struct Neighbour {
51 Neighbour(double porv_arg, std::size_t index_arg) :
52 porv(porv_arg),
53 global_index(index_arg)
54 {}
55
56 double porv;
57 std::size_t global_index;
58 };
59
60
61 struct Connection {
62 Connection(double porv_arg, double cf, ::Opm::Connection::Direction dir_arg, std::size_t index_arg) :
63 porv(porv_arg),
64 cfactor(cf),
65 dir(dir_arg),
66 global_index(index_arg)
67 {
68 }
69
70 double porv;
71 double cfactor;
72 ::Opm::Connection::Direction dir;
73 std::size_t global_index;
74 std::vector<Neighbour> rect_neighbours;
75 std::vector<Neighbour> diag_neighbours;
76 };
77
78
79 const std::string& wname() const;
80 double wbp() const;
81 double wbp4() const;
82 double wbp5() const;
83 double wbp9() const;
84 double wbp(WBPMode mode) const;
85 bool add_pressure(std::size_t global_index, double pressure);
86 const std::vector< std::size_t >& index_list() const;
87 std::pair< std::reference_wrapper<const std::vector<double>>, std::reference_wrapper<const std::vector<bool>> > data() const;
88
89private:
90 void update(const std::vector<double>& p, const std::vector<char>& m);
91 void add_connection(const PAvgCalculator::Connection& conn);
92 void add_neighbour(std::size_t global_index, std::optional<PAvgCalculator::Neighbour> neighbour, bool rect_neighbour);
93 double get_pressure(std::size_t global_index) const;
94 double cf_avg(const std::vector<std::optional<double>>& block_pressure) const;
95 std::pair<double,double> porv_pressure(std::size_t global_index) const;
96 std::vector<std::optional<double>> block_pressures(PAvgCalculator::WBPMode mode) const;
97
98 std::string well_name;
99 PAvg m_pavg;
100 std::vector<Connection> m_connections;
101 std::map<std::size_t, std::size_t> m_index_map;
102 std::vector<std::size_t> m_index_list;
103 std::vector<double> pressure;
104 std::vector<char> valid_pressure;
105 double ref_depth;
106};
107
108}
109#endif
About cell information and dimension: The actual grid information is held in a pointer to an ERT ecl_...
Definition: EclipseGrid.hpp:54
Definition: PAvgCalculator.hpp:37
Definition: PAvg.hpp:28
Definition: WellConnections.hpp:44
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29
Definition: PAvgCalculator.hpp:61
Definition: PAvgCalculator.hpp:50