VanGenuchtenParams.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) 2009-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 VAN_GENUCHTEN_PARAMS_HPP
26 #define VAN_GENUCHTEN_PARAMS_HPP
27 
28 #include <cassert>
29 
30 namespace Opm {
41 template<class TraitsT>
43 {
44  typedef typename TraitsT::Scalar Scalar;
45 
46 public:
47  typedef TraitsT Traits;
48 
50  {
51 #ifndef NDEBUG
52  finalized_ = false;
53 #endif
54  }
55 
56  VanGenuchtenParams(Scalar vgAlpha, Scalar vgN)
57  {
58  setVgAlpha(vgAlpha);
59  setVgN(vgN);
60  finalize();
61  }
62 
67  void finalize()
68  {
69 #ifndef NDEBUG
70  finalized_ = true;
71 #endif
72  }
73 
78  Scalar vgAlpha() const
79  { assertFinalized_(); return vgAlpha_; }
80 
85  void setVgAlpha(Scalar v)
86  { vgAlpha_ = v; }
87 
92  Scalar vgM() const
93  { assertFinalized_(); return vgM_; }
94 
101  void setVgM(Scalar m)
102  { vgM_ = m; vgN_ = 1/(1 - vgM_); }
103 
108  Scalar vgN() const
109  { assertFinalized_(); return vgN_; }
110 
117  void setVgN(Scalar n)
118  { vgN_ = n; vgM_ = 1 - 1/vgN_; }
119 
120 private:
121 #ifndef NDEBUG
122  void assertFinalized_() const
123  { assert(finalized_); }
124 
125  bool finalized_;
126 #else
127  void assertFinalized_() const
128  { }
129 #endif
130 
131  Scalar vgAlpha_;
132  Scalar vgM_;
133  Scalar vgN_;
134 };
135 } // namespace Opm
136 
137 #endif
Definition: Air_Mesitylene.hpp:31
void setVgN(Scalar n)
Set the shape parameter of van Genuchten's curve.
Definition: VanGenuchtenParams.hpp:117
void setVgAlpha(Scalar v)
Set the shape parameter of van Genuchten's curve.
Definition: VanGenuchtenParams.hpp:85
void finalize()
Calculate all dependent quantities once the independent quantities of the parameter object have been ...
Definition: VanGenuchtenParams.hpp:67
Scalar vgM() const
Return the shape parameter of van Genuchten's curve.
Definition: VanGenuchtenParams.hpp:92
TraitsT Traits
Definition: VanGenuchtenParams.hpp:47
VanGenuchtenParams(Scalar vgAlpha, Scalar vgN)
Definition: VanGenuchtenParams.hpp:56
Scalar vgAlpha() const
Return the shape parameter of van Genuchten's curve.
Definition: VanGenuchtenParams.hpp:78
VanGenuchtenParams()
Definition: VanGenuchtenParams.hpp:49
Scalar vgN() const
Return the shape parameter of van Genuchten's curve.
Definition: VanGenuchtenParams.hpp:108
Specification of the material parameters for the van Genuchten constitutive relations.
Definition: VanGenuchtenParams.hpp:42
void setVgM(Scalar m)
Set the shape parameter of van Genuchten's curve.
Definition: VanGenuchtenParams.hpp:101