My Project
Loading...
Searching...
No Matches
CO2Tables.hpp
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*/
23
24#ifndef OPM_CO2TABLES_HPP
25#define OPM_CO2TABLES_HPP
26
29
30namespace Opm {
31
33{
34 using Scalar = double;
35 static const char *name;
36 static const int numX = 200;
37 static const Scalar xMin;
38 static const Scalar xMax;
39 static const int numY = 500;
40 static const Scalar yMin;
41 static const Scalar yMax;
42 static const Scalar vals[200][500];
43};
44
46{
47 using Scalar = double;
48 static const char *name;
49 static const int numX = 200;
50 static const Scalar xMin;
51 static const Scalar xMax;
52 static const int numY = 500;
53 static const Scalar yMin;
54 static const Scalar yMax;
55 static const Scalar vals[200][500];
56};
57
58template<class Scalar = double, class ContainerT = std::vector<double>>
60{
61public:
64 static constexpr double brineSalinity = 1.000000000000000e-01;
65
66 CO2Tables();
67
70 : tabulatedEnthalpy(enthalpy), tabulatedDensity(density)
71 {
72 }
73
74 const Opm::UniformTabulated2DFunction<Scalar, ContainerT>& getTabulatedEnthalpy() const {
75 return tabulatedEnthalpy;
76 }
77
78 const Opm::UniformTabulated2DFunction<Scalar, ContainerT>& getTabulatedDensity() const {
79 return tabulatedDensity;
80 }
81};
82
83} // namespace Opm
84
85namespace Opm::gpuistl {
86 template <class ViewType, class Scalar, class ContainerType>
87 CO2Tables<Scalar, ViewType>
88 make_view(CO2Tables<Scalar, ContainerType>& oldCO2Tables) {
89 Opm::UniformTabulated2DFunction<double, ViewType> newEnthalpy = make_view<ViewType>(oldCO2Tables.tabulatedEnthalpy);
90 Opm::UniformTabulated2DFunction<double, ViewType> newDensity = make_view<ViewType>(oldCO2Tables.tabulatedDensity);
91
92 return CO2Tables<Scalar, ViewType>(newEnthalpy, newDensity);
93 }
94
95 template <class NewContainerType, class Scalar, class OldContainerType>
96 CO2Tables<Scalar, NewContainerType>
97 copy_to_gpu(const CO2Tables<Scalar, OldContainerType>& oldCO2Tables) {
98 return CO2Tables<Scalar, NewContainerType>(
99 copy_to_gpu<NewContainerType>(oldCO2Tables.tabulatedEnthalpy),
100 copy_to_gpu<NewContainerType>(oldCO2Tables.tabulatedDensity)
101 );
102 }
103}
104
105#endif // OPM_CO2TABLES_HPP
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
Implements a scalar function that depends on two variables and which is sampled on an uniform X-Y gri...
Definition CO2Tables.hpp:60
Implements a scalar function that depends on two variables and which is sampled on an uniform X-Y gri...
Definition UniformTabulated2DFunction.hpp:64
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition CO2Tables.hpp:33
Definition CO2Tables.hpp:46