ThresholdPressure.hpp
Go to the documentation of this file.
1/*
2 Copyright 2015 Statoil 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#ifndef OPM_TRESHOLD_PRESSURES_HPP
21#define OPM_TRESHOLD_PRESSURES_HPP
22
23#include <map>
24#include <vector>
25
26namespace Opm {
27
28
29 class Deck;
30 class FieldPropsManager;
31
33
34 public:
35 using ThresholdPressureTable = std::vector<std::pair<bool,double>>;
36 using PressureTable = std::map<std::pair<int,int>,std::pair<bool,double>>;
37
39 const Deck& deck,
40 const FieldPropsManager& fp);
41
42 ThresholdPressure() { m_active = m_restart = false; }
43
46
47 /*
48 The hasRegionBarrier() method checks if a threshold pressure
49 has been configured between the equilibration regions r1 and
50 r2; i.e. if the deck contains a THPRES record with regions
51 r1 and r2.
52 */
53 bool hasRegionBarrier(int r1 , int r2) const;
54
55 /*
56 Checks if a threshold presssure has been configured between
57 the equilibration regions r1 and r2; the function will
58 return false either if no THPRES record with r1 and r2 has
59 been configured - or if THPRES record with ra and r2 has
60 defaulted pressure.
61 */
62 bool hasThresholdPressure(int r1 , int r2) const;
63
64 /*
65 Will return the threshold pressure between equilibration
66 regions r1 and r2; if the pressure has been defaulted the
67 function will raise the error
68 INTERNAL_ERROR_UNINITIALIZED_THPRES - check with
69 hasThresholdPressure(r1,r2) first to be safe.
70 */
71 double getThresholdPressure(int r1 , int r2) const;
72 size_t size() const;
73 bool active() const;
74 bool restart() const;
75
76 bool operator==(const ThresholdPressure& data) const;
77
78 template<class Serializer>
79 void serializeOp(Serializer& serializer)
80 {
81 serializer(m_active);
82 serializer(m_restart);
83 serializer(m_thresholdPressureTable);
84 serializer(m_pressureTable);
85 }
86
87 private:
88 bool m_active;
89 bool m_restart;
90 static std::pair<int,int> makeIndex(int r1 , int r2);
91 void addPair(int r1 , int r2 , const std::pair<bool , double>& valuePair);
92 void addBarrier(int r1 , int r2);
93 void addBarrier(int r1 , int r2 , double p);
94
95 std::vector<std::pair<bool,double>> m_thresholdPressureTable;
96 std::map<std::pair<int,int> , std::pair<bool , double> > m_pressureTable;
97 };
98} //namespace Opm
99
100#endif
Definition: Deck.hpp:115
Definition: FieldPropsManager.hpp:33
Definition: Serializer.hpp:38
Definition: ThresholdPressure.hpp:32
std::map< std::pair< int, int >, std::pair< bool, double > > PressureTable
Definition: ThresholdPressure.hpp:36
ThresholdPressure(bool restart, const Deck &deck, const FieldPropsManager &fp)
bool hasRegionBarrier(int r1, int r2) const
size_t size() const
std::vector< std::pair< bool, double > > ThresholdPressureTable
Definition: ThresholdPressure.hpp:35
bool hasThresholdPressure(int r1, int r2) const
double getThresholdPressure(int r1, int r2) const
static ThresholdPressure serializeObject()
Returns an instance for serialization tests.
ThresholdPressure()
Definition: ThresholdPressure.hpp:42
void serializeOp(Serializer &serializer)
Definition: ThresholdPressure.hpp:79
bool operator==(const ThresholdPressure &data) const
Definition: A.hpp:4
static std::string data()
Definition: exprtk.hpp:40022