My Project
cuWellContributions.hpp
1 /*
2  Copyright 2020 Equinor ASA
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 3 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 
20 #ifndef WELLCONTRIBUTIONS_CUDA_HEADER_INCLUDED
21 #define WELLCONTRIBUTIONS_CUDA_HEADER_INCLUDED
22 
23 #include <opm/simulators/linalg/bda/WellContributions.hpp>
24 
25 #include <cuda_runtime.h>
26 
27 #include <memory>
28 #include <vector>
29 
30 
31 namespace Opm
32 {
33 
35 {
36 public:
37  ~WellContributionsCuda() override;
38 
41  void setCudaStream(cudaStream_t stream);
42 
47  void apply(double *d_x, double *d_y);
48 
49 protected:
51  void APIalloc() override;
52 
58  void APIaddMatrix(MatrixType type, int *colIndices, double *values, unsigned int val_size) override;
59 
60  cudaStream_t stream;
61 
62  // data for StandardWells, could remain nullptrs if not used
63  double *d_Cnnzs = nullptr;
64  double *d_Dnnzs = nullptr;
65  double *d_Bnnzs = nullptr;
66  int *d_Ccols = nullptr;
67  int *d_Bcols = nullptr;
68  double *d_z1 = nullptr;
69  double *d_z2 = nullptr;
70  unsigned int *d_val_pointers = nullptr;
71  double* h_x = nullptr;
72  double* h_y = nullptr;
73 
74 };
75 
76 } //namespace Opm
77 
78 #endif
Definition: cuWellContributions.hpp:35
void APIalloc() override
Allocate memory for the StandardWells.
void APIaddMatrix(MatrixType type, int *colIndices, double *values, unsigned int val_size) override
Store a matrix in this object, in blocked csr format, can only be called after alloc() is called.
void apply(double *d_x, double *d_y)
Apply all Wells in this object performs y -= (C^T * (D^-1 * (B*x))) for all Wells.
void setCudaStream(cudaStream_t stream)
Set a cudaStream to be used.
This class serves to eliminate the need to include the WellContributions into the matrix (with –matri...
Definition: WellContributions.hpp:53
MatrixType
StandardWell has C, D and B matrices that need to be copied.
Definition: WellContributions.hpp:63
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27