LinearMaterialParams.hpp
Go to the documentation of this file.
1 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 // vi: set et ts=4 sw=4 sts=4:
3 /*
4  Copyright (C) 2012-2013 by Andreas Lauser
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 2 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 */
25 #ifndef OPM_LINEAR_MATERIAL_PARAMS_HPP
26 #define OPM_LINEAR_MATERIAL_PARAMS_HPP
27 
28 #include <cassert>
29 
30 namespace Opm {
31 
36 template<class TraitsT>
38 {
39  enum { numPhases = TraitsT::numPhases };
40 
41  typedef typename TraitsT::Scalar Scalar;
42 
43 public:
44  typedef TraitsT Traits;
45 
52  {
53  for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
54  setPcMinSat(phaseIdx, 0.0);
55  setPcMaxSat(phaseIdx, 0.0);
56  }
57 
58 #ifndef NDEBUG
59  finalized_ = false;
60 #endif
61  }
62 
67  void finalize()
68  {
69 #ifndef NDEBUG
70  finalized_ = true;
71 #endif
72  }
73 
79  Scalar pcMinSat(unsigned phaseIdx) const
80  { assertFinalized_();return pcMinSat_[phaseIdx]; }
81 
87  void setPcMinSat(unsigned phaseIdx, Scalar val)
88  { pcMinSat_[phaseIdx] = val; }
89 
95  Scalar pcMaxSat(unsigned phaseIdx) const
96  { assertFinalized_(); return pcMaxSat_[phaseIdx]; }
97 
103  void setPcMaxSat(unsigned phaseIdx, Scalar val)
104  { pcMaxSat_[phaseIdx] = val; }
105 
106 private:
107 #ifndef NDEBUG
108  void assertFinalized_() const
109  { assert(finalized_); }
110 
111  bool finalized_;
112 #else
113  void assertFinalized_() const
114  { }
115 #endif
116 
117  Scalar pcMaxSat_[numPhases];
118  Scalar pcMinSat_[numPhases];
119 };
120 } // namespace Opm
121 
122 #endif
LinearMaterialParams()
The default constructor.
Definition: LinearMaterialParams.hpp:51
Definition: Air_Mesitylene.hpp:31
void finalize()
Calculate all dependent quantities once the independent quantities of the parameter object have been ...
Definition: LinearMaterialParams.hpp:67
Scalar pcMinSat(unsigned phaseIdx) const
Return the relative phase pressure at the minimum saturation of a phase.
Definition: LinearMaterialParams.hpp:79
void setPcMaxSat(unsigned phaseIdx, Scalar val)
Set the relative phase pressure at the maximum saturation of a phase.
Definition: LinearMaterialParams.hpp:103
Reference implementation of params for the linear M-phase material material.
Definition: LinearMaterialParams.hpp:37
Scalar pcMaxSat(unsigned phaseIdx) const
Return the relative phase pressure at the maximum saturation of a phase.
Definition: LinearMaterialParams.hpp:95
TraitsT Traits
Definition: LinearMaterialParams.hpp:44
void setPcMinSat(unsigned phaseIdx, Scalar val)
Set the relative phase pressure at the minimum saturation of a phase.
Definition: LinearMaterialParams.hpp:87