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 <vector>
24 
29 
30 
31 namespace Opm {
32 
34 
35  public:
36 
37  ThresholdPressure(const ParseMode& parseMode , DeckConstPtr deck, std::shared_ptr<GridProperties<int>> gridProperties);
38 
39 
40  /*
41  The hasRegionBarrier() method checks if a threshold pressure
42  has been configured between the equilibration regions r1 and
43  r2; i.e. if the deck contains a THPRES record with regions
44  r1 and r2.
45  */
46  bool hasRegionBarrier(int r1 , int r2) const;
47 
48  /*
49  Checks if a threshold presssure has been configured between
50  the equilibration regions r1 and r2; the function will
51  return false either if no THPRES record with r1 and r2 has
52  been configured - or if THPRES record with ra and r2 has
53  defaulted pressure.
54  */
55  bool hasThresholdPressure(int r1 , int r2) const;
56 
57  /*
58  Will return the threshold pressure between equilibration
59  regions r1 and r2; if the pressure has been defaulted the
60  function will raise the error
61  INTERNAL_ERROR_UNINITIALIZED_THPRES - check with
62  hasThresholdPressure(r1,r2) first to be safe.
63  */
64  double getThresholdPressure(int r1 , int r2) const;
65  size_t size() const;
66  private:
67  void initThresholdPressure(const ParseMode& parseMode,
68  std::shared_ptr<const RUNSPECSection> runspecSection,
69  std::shared_ptr<const SOLUTIONSection> solutionSection,
70  std::shared_ptr<GridProperties<int>> gridProperties);
71 
72  static std::pair<int,int> makeIndex(int r1 , int r2);
73  void addPair(int r1 , int r2 , const std::pair<bool , double>& valuePair);
74  void addBarrier(int r1 , int r2);
75  void addBarrier(int r1 , int r2 , double p);
76 
77  std::vector<std::pair<bool,double>> m_thresholdPressureTable;
78  std::map<std::pair<int,int> , std::pair<bool , double> > m_pressureTable;
79  const ParseMode& m_parseMode;
80  };
81 
82 
83  typedef std::shared_ptr<ThresholdPressure> ThresholdPressurePtr;
84  typedef std::shared_ptr<const ThresholdPressure> ThresholdPressureConstPtr;
85 
86 } //namespace Opm
87 
88 #endif
bool hasRegionBarrier(int r1, int r2) const
Definition: Deck.hpp:29
Definition: GridProperties.hpp:51
std::shared_ptr< const Deck > DeckConstPtr
Definition: Deck.hpp:86
bool hasThresholdPressure(int r1, int r2) const
ThresholdPressure(const ParseMode &parseMode, DeckConstPtr deck, std::shared_ptr< GridProperties< int >> gridProperties)
Definition: ParseMode.hpp:78
double getThresholdPressure(int r1, int r2) const
std::shared_ptr< ThresholdPressure > ThresholdPressurePtr
Definition: ThresholdPressure.hpp:83
std::shared_ptr< const ThresholdPressure > ThresholdPressureConstPtr
Definition: ThresholdPressure.hpp:84
Definition: ThresholdPressure.hpp:33
size_t size() const