opm-common
EclTwoPhaseMaterialParams.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  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 2 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  Consult the COPYING file in the top-level source directory of this
20  module for the precise wording of the license and the list of
21  copyright holders.
22 */
27 #ifndef OPM_ECL_TWO_PHASE_MATERIAL_PARAMS_HPP
28 #define OPM_ECL_TWO_PHASE_MATERIAL_PARAMS_HPP
29 
30 #include <memory>
31 
32 #include <opm/common/utility/gpuDecorators.hpp>
34 
35 namespace Opm
36 {
37 
38 enum class EclTwoPhaseApproach { GasOil, OilWater, GasWater };
39 
53 template <class Traits,
54  class GasOilParamsT,
55  class OilWaterParamsT,
56  class GasWaterParamsT,
57  template <class> class StoragePolicy = std::shared_ptr>
59 {
60  using Scalar = typename Traits::Scalar;
61  enum { numPhases = 3 };
62 
63 public:
65 
66  using GasOilParams = GasOilParamsT;
67  using OilWaterParams = OilWaterParamsT;
68  using GasWaterParams = GasWaterParamsT;
69 
70  using GasOilParamsStorage = StoragePolicy<GasOilParams>;
71  using OilWaterParamsStorage = StoragePolicy<OilWaterParams>;
72  using GasWaterParamsStorage = StoragePolicy<GasWaterParams>;
73 
77  OPM_HOST_DEVICE EclTwoPhaseMaterialParams() = default;
78 
79  OPM_HOST_DEVICE void setApproach(EclTwoPhaseApproach newApproach)
80  {
81  approach_ = newApproach;
82  }
83 
84  OPM_HOST_DEVICE EclTwoPhaseApproach approach() const
85  {
86  return approach_;
87  }
88 
92  OPM_HOST_DEVICE const GasOilParams& gasOilParams() const
93  {
94  EnsureFinalized::check();
95  return *gasOilParams_;
96  }
97 
101  OPM_HOST_DEVICE GasOilParams& gasOilParams()
102  {
103  EnsureFinalized::check();
104  return *gasOilParams_;
105  }
106 
110  OPM_HOST_DEVICE void setGasOilParams(GasOilParamsStorage val)
111  {
112  gasOilParams_ = val;
113  }
114 
118  OPM_HOST_DEVICE const OilWaterParams& oilWaterParams() const
119  {
120  EnsureFinalized::check();
121  return *oilWaterParams_;
122  }
123 
127  OPM_HOST_DEVICE OilWaterParams& oilWaterParams()
128  {
129  EnsureFinalized::check();
130  return *oilWaterParams_;
131  }
132 
136  OPM_HOST_DEVICE void setOilWaterParams(OilWaterParamsStorage val)
137  {
138  oilWaterParams_ = val;
139  }
140 
144  OPM_HOST_DEVICE const GasWaterParams& gasWaterParams() const
145  {
146  EnsureFinalized::check();
147  return *gasWaterParams_;
148  }
149 
153  OPM_HOST_DEVICE GasWaterParams& gasWaterParams()
154  {
155  EnsureFinalized::check();
156  return *gasWaterParams_;
157  }
158 
162  OPM_HOST_DEVICE void setGasWaterParams(GasWaterParamsStorage val)
163  {
164  gasWaterParams_ = val;
165  }
166 
167  template <class Serializer>
168  void serializeOp(Serializer& serializer)
169  {
170  // This is for restart serialization.
171  // Only dynamic state in the parameters need to be stored.
172  serializer(*gasOilParams_);
173  serializer(*oilWaterParams_);
174  serializer(*gasWaterParams_);
175  }
176 
177  void setSwl(Scalar)
178  {
179  }
180 
181 private:
182  EclTwoPhaseApproach approach_ {EclTwoPhaseApproach::GasOil};
183 
184  GasOilParamsStorage gasOilParams_ {};
185  OilWaterParamsStorage oilWaterParams_ {};
186  GasWaterParamsStorage gasWaterParams_ {};
187 };
188 
189 } // namespace Opm
190 
191 #endif
OPM_HOST_DEVICE OilWaterParams & oilWaterParams()
The parameter object for the oil-water twophase law.
Definition: EclTwoPhaseMaterialParams.hpp:127
OPM_HOST_DEVICE void setGasOilParams(GasOilParamsStorage val)
Set the parameter object for the gas-oil twophase law.
Definition: EclTwoPhaseMaterialParams.hpp:110
OPM_HOST_DEVICE const GasOilParams & gasOilParams() const
The parameter object for the gas-oil twophase law.
Definition: EclTwoPhaseMaterialParams.hpp:92
OPM_HOST_DEVICE EclTwoPhaseMaterialParams()=default
The default constructor.
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
OPM_HOST_DEVICE void setGasWaterParams(GasWaterParamsStorage val)
Set the parameter object for the gas-water twophase law.
Definition: EclTwoPhaseMaterialParams.hpp:162
Default implementation for asserting finalization of parameter objects.
OPM_HOST_DEVICE void setOilWaterParams(OilWaterParamsStorage val)
Set the parameter object for the oil-water twophase law.
Definition: EclTwoPhaseMaterialParams.hpp:136
OPM_HOST_DEVICE const GasWaterParams & gasWaterParams() const
The parameter object for the gas-water twophase law.
Definition: EclTwoPhaseMaterialParams.hpp:144
OPM_HOST_DEVICE GasWaterParams & gasWaterParams()
The parameter object for the gas-water twophase law.
Definition: EclTwoPhaseMaterialParams.hpp:153
OPM_HOST_DEVICE void finalize()
Mark the object as finalized.
Definition: EnsureFinalized.hpp:82
OPM_HOST_DEVICE const OilWaterParams & oilWaterParams() const
The parameter object for the oil-water twophase law.
Definition: EclTwoPhaseMaterialParams.hpp:118
Implementation for the parameters required by the material law for two-phase simulations.
Definition: EclTwoPhaseMaterialParams.hpp:58
Default implementation for asserting finalization of parameter objects.
Definition: EnsureFinalized.hpp:48
OPM_HOST_DEVICE GasOilParams & gasOilParams()
The parameter object for the gas-oil twophase law.
Definition: EclTwoPhaseMaterialParams.hpp:101
Class for (de-)serializing.
Definition: Serializer.hpp:95