SplineTwoPhaseMaterialParams.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 OPM_SPLINE_TWO_PHASE_MATERIAL_PARAMS_HPP
26 #define OPM_SPLINE_TWO_PHASE_MATERIAL_PARAMS_HPP
27 
29 
30 #include <vector>
31 #include <cassert>
32 
33 namespace Opm {
40 template<class TraitsT>
42 {
43  typedef typename TraitsT::Scalar Scalar;
44 
45 public:
46  typedef std::vector<Scalar> SamplePoints;
48  typedef typename Spline::SplineType SplineType;
49 
50  typedef TraitsT Traits;
51 
53  {
54 #ifndef NDEBUG
55  finalized_ = false;
56 #endif
57  }
58 
63  void finalize()
64  {
65 #ifndef NDEBUG
66  finalized_ = true;
67 #endif
68  }
69 
75  const Spline& pcnwSpline() const
76  { assertFinalized_(); return pcwnSpline_; }
77 
83  void setPcnwSamples(const SamplePoints& SwSamplePoints,
84  const SamplePoints& pcnwSamplePoints,
85  SplineType splineType = Spline::Monotonic)
86  {
87  assert(SwSamplePoints.size() == pcnwSamplePoints.size());
88  pcwnSpline_.setXYContainers(SwSamplePoints, pcnwSamplePoints, splineType);
89  }
90 
97  const Spline& krwSpline() const
98  { assertFinalized_(); return krwSpline_; }
99 
106  void setKrwSamples(const SamplePoints& SwSamplePoints,
107  const SamplePoints& krwSamplePoints,
108  SplineType splineType = Spline::Monotonic)
109  {
110  assert(SwSamplePoints.size() == krwSamplePoints.size());
111  krwSpline_.setXYContainers(SwSamplePoints, krwSamplePoints, splineType);
112  }
113 
120  const Spline& krnSpline() const
121  { assertFinalized_(); return krnSpline_; }
122 
129  void setKrnSamples(const SamplePoints& SwSamplePoints,
130  const SamplePoints& krnSamplePoints,
131  SplineType splineType = Spline::Monotonic)
132  {
133  assert(SwSamplePoints.size() == krnSamplePoints.size());
134  krnSpline_.setXYContainers(SwSamplePoints, krnSamplePoints, splineType);
135  }
136 
137 private:
138 #ifndef NDEBUG
139  void assertFinalized_() const
140  { assert(finalized_); }
141 
142  bool finalized_;
143 #else
144  void assertFinalized_() const
145  { }
146 #endif
147 
148  Spline SwSpline_;
149  Spline pcwnSpline_;
150  Spline krwSpline_;
151  Spline krnSpline_;
152 };
153 } // namespace Opm
154 
155 #endif
Definition: Spline.hpp:104
void setKrnSamples(const SamplePoints &SwSamplePoints, const SamplePoints &krnSamplePoints, SplineType splineType=Spline::Monotonic)
Set the sampling points for the relative permeability curve of the non-wetting phase.
Definition: SplineTwoPhaseMaterialParams.hpp:129
Definition: Air_Mesitylene.hpp:31
Opm::Spline< Scalar > Spline
Definition: SplineTwoPhaseMaterialParams.hpp:47
const Spline & krwSpline() const
Return the sampling points for the relative permeability curve of the wetting phase.
Definition: SplineTwoPhaseMaterialParams.hpp:97
SplineType
The type of the spline to be created.
Definition: Spline.hpp:100
Class implementing cubic splines.
std::vector< Scalar > SamplePoints
Definition: SplineTwoPhaseMaterialParams.hpp:46
void setKrwSamples(const SamplePoints &SwSamplePoints, const SamplePoints &krwSamplePoints, SplineType splineType=Spline::Monotonic)
Set the sampling points for the relative permeability curve of the wetting phase. ...
Definition: SplineTwoPhaseMaterialParams.hpp:106
void setXYContainers(const ScalarContainerX &x, const ScalarContainerY &y, Scalar m0, Scalar m1, bool sortInputs=false)
Set the sampling points and the boundary slopes of a full spline using STL-compatible containers...
Definition: Spline.hpp:361
const Spline & krnSpline() const
Return the sampling points for the relative permeability curve of the non-wetting phase...
Definition: SplineTwoPhaseMaterialParams.hpp:120
Class implementing cubic splines.
Definition: Spline.hpp:89
Spline::SplineType SplineType
Definition: SplineTwoPhaseMaterialParams.hpp:48
void setPcnwSamples(const SamplePoints &SwSamplePoints, const SamplePoints &pcnwSamplePoints, SplineType splineType=Spline::Monotonic)
Set the sampling points for the capillary pressure curve.
Definition: SplineTwoPhaseMaterialParams.hpp:83
SplineTwoPhaseMaterialParams()
Definition: SplineTwoPhaseMaterialParams.hpp:52
Specification of the material parameters for a two-phase material law which uses a table and spline-b...
Definition: SplineTwoPhaseMaterialParams.hpp:41
void finalize()
Calculate all dependent quantities once the independent quantities of the parameter object have been ...
Definition: SplineTwoPhaseMaterialParams.hpp:63
TraitsT Traits
Definition: SplineTwoPhaseMaterialParams.hpp:50
const Spline & pcnwSpline() const
Return the sampling points for the capillary pressure curve.
Definition: SplineTwoPhaseMaterialParams.hpp:75