opm-common
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#include <opm/common/utility/gpuDecorators.hpp>
30#include <opm/common/utility/VectorWithDefaultAllocator.hpp>
32
33namespace Opm {
34
36{
37 using Scalar = double;
38 static const char *name;
39 static const int numX = 200;
40 static const Scalar xMin;
41 static const Scalar xMax;
42 static const int numY = 500;
43 static const Scalar yMin;
44 static const Scalar yMax;
45 static const Scalar vals[200][500];
46};
47
49{
50 using Scalar = double;
51 static const char *name;
52 static const int numX = 200;
53 static const Scalar xMin;
54 static const Scalar xMax;
55 static const int numY = 500;
56 static const Scalar yMin;
57 static const Scalar yMax;
58 static const Scalar vals[200][500];
59};
60
61template<class Scalar = double, template<class> class Storage = VectorWithDefaultAllocator>
62class CO2Tables
63{
64public:
67 static constexpr double brineSalinity = 1.000000000000000e-01;
68
69 CO2Tables();
70
73 : tabulatedEnthalpy(std::move(enthalpy)), tabulatedDensity(std::move(density))
74 {
75 }
76
77 const Opm::UniformTabulated2DFunction<Scalar, Storage>& getTabulatedEnthalpy() const {
78 return tabulatedEnthalpy;
79 }
80
81 const Opm::UniformTabulated2DFunction<Scalar, Storage>& getTabulatedDensity() const {
82 return tabulatedDensity;
83 }
84};
85
86} // namespace Opm
87
88#if HAVE_CUDA
89namespace Opm::gpuistl {
90 template <class Scalar>
91 CO2Tables<Scalar, GpuView>
92 make_view(CO2Tables<Scalar, GpuBuffer>& oldCO2Tables) {
93 return CO2Tables<Scalar, GpuView>(
94 make_view(oldCO2Tables.tabulatedEnthalpy),
95 make_view(oldCO2Tables.tabulatedDensity)
96 );
97 }
98
99 template <class Scalar>
100 CO2Tables<Scalar, GpuBuffer>
101 copy_to_gpu(const CO2Tables<Scalar>& oldCO2Tables) {
102 return CO2Tables<Scalar, GpuBuffer>(
103 copy_to_gpu(oldCO2Tables.tabulatedEnthalpy),
104 copy_to_gpu(oldCO2Tables.tabulatedDensity)
105 );
106 }
107} // namespace Opm::gpuistl
108#endif // HAVE_CUDA
109#endif // OPM_CO2TABLES_HPP
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
PiecewiseLinearTwoPhaseMaterialParams< TraitsT, GPUContainerType > copy_to_gpu(const PiecewiseLinearTwoPhaseMaterialParams< TraitsT > &params)
Move a PiecewiseLinearTwoPhaseMaterialParams-object to the GPU.
Definition PiecewiseLinearTwoPhaseMaterialParams.hpp:285
Implements a scalar function that depends on two variables and which is sampled on an uniform X-Y gri...
Implements a scalar function that depends on two variables and which is sampled on an uniform X-Y gri...
Definition UniformTabulated2DFunction.hpp:68
Convience header to include the gpuistl headers if HAVE_CUDA is defined.
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition CO2Tables.hpp:36
Definition CO2Tables.hpp:49