Loading...
Searching...
No Matches
Opm::WellContributions< Scalar > Class Template Reference

This class serves to eliminate the need to include the WellContributions into the matrix (with –matrix-add-well-contributions=true) for the cusparseSolver or openclSolver. More...

`#include <WellContributions.hpp>`

Inheritance diagram for Opm::WellContributions< Scalar >:

## Public Types

enum class | MatrixType { C , D , B }
| StandardWell has C, D and B matrices that need to be copied.
using | UMFPackIndex = SuiteSparse_long

## Public Member Functions

unsigned int | getNumWells ()
void | addNumBlocks (unsigned int numBlocks)
| Indicate how large the next StandardWell is, this function cannot be called after alloc() is called.
void | alloc ()
| Allocate memory for the StandardWells.
virtual | ~WellContributions ()
| Empty destructor.
void | setBlockSize (unsigned int dim, unsigned int dim_wells)
| Indicate how large the blocks of the StandardWell (C and B) are.
void | setVectorSize (unsigned N)
| Set size of vector that the wells are applied to.
void | addMatrix (MatrixType type, int *colIndices, Scalar *values, unsigned int val_size)
| Store a matrix in this object, in blocked csr format, can only be called after alloc() is called.
void | addMultisegmentWellContribution (unsigned int dim, unsigned int dim_wells, unsigned int Mb, std::vector< Scalar > &Bvalues, std::vector< unsigned int > &BcolIndices, std::vector< unsigned int > &BrowPointers, unsigned int DnumBlocks, Scalar *Dvalues, UMFPackIndex *DcolPointers, UMFPackIndex *DrowIndices, std::vector< Scalar > &Cvalues)
| Add a MultisegmentWellContribution, actually creates an object on heap that is destroyed in the destructor Matrices C and B are passed in Blocked CSR, matrix D in CSC.

## Static Public Member Functions

static std::unique_ptr< WellContributions > | create (const std::string &accelerator_mode, bool useWellConn)

## Protected Member Functions

virtual void | APIalloc ()
| API specific allocation.
virtual void | APIaddMatrix (MatrixType, int *, Scalar *, unsigned int)
| Api specific upload of matrix.

## Protected Attributes

bool | allocated = false
unsigned int | N
unsigned int | dim
unsigned int | dim_wells
unsigned int | num_blocks = 0
unsigned int | num_std_wells = 0
unsigned int | num_ms_wells = 0
unsigned int | num_blocks_so_far = 0
unsigned int | num_std_wells_so_far = 0
std::vector< unsigned int > | val_pointers
std::vector< std::unique_ptr< MultisegmentWellContribution< Scalar > > > | multisegments

## Detailed Description

template<class Scalar>
class Opm::WellContributions< Scalar >

This class serves to eliminate the need to include the WellContributions into the matrix (with –matrix-add-well-contributions=true) for the cusparseSolver or openclSolver.

If the –matrix-add-well-contributions commandline parameter is true, this class should still be used, but be empty. StandardWell and MultisegmentWell are supported for both cusparseSolver and openclSolver. A single instance (or pointer) of this class is passed to the GpuSolver. For StandardWell, this class contains all the data and handles the computation. For MultisegmentWell, the vector 'multisegments' contains all the data. For more information, check the MultisegmentWellContribution class. A StandardWell uses C, D and B and performs y -= (C^T * (D^-1 * (B*x))) B and C are vectors, disguised as matrices and contain blocks of StandardWell::numEq by StandardWell::numStaticWellEq D is a block, disguised as matrix, the square block has size StandardWell::numStaticWellEq. D is actually stored as D^-1 B*x and D*B*x are a vector with numStaticWellEq doubles C*D*B*x is a blocked matrix with a symmetric sparsity pattern, contains square blocks with size numEq. For every columnindex i, j in StandardWell::duneB_, there is a block on (i, j) in C*D*B*x.

This class is used in 3 phases:

- get total size of all wellcontributions that must be stored here
- allocate memory
- copy data of wellcontributions

## Member Function Documentation

## addMatrix()

template<class Scalar>

void Opm::WellContributions< Scalar >::addMatrix | ( | MatrixType | type,
|  | int * | colIndices,
|  | Scalar * | values,
|  | unsigned int | val_size )

Store a matrix in this object, in blocked csr format, can only be called after alloc() is called.

Parameters

  [in] | type | indicate if C, D or B is sent
  [in] | colIndices | columnindices of blocks in C or B, ignored for D
  [in] | values | array of nonzeroes
  [in] | val_size | number of blocks in C or B, ignored for D

## addMultisegmentWellContribution()

template<class Scalar>

void Opm::WellContributions< Scalar >::addMultisegmentWellContribution | ( | unsigned int | dim,
|  | unsigned int | dim_wells,
|  | unsigned int | Mb,
|  | std::vector< Scalar > & | Bvalues,
|  | std::vector< unsigned int > & | BcolIndices,
|  | std::vector< unsigned int > & | BrowPointers,
|  | unsigned int | DnumBlocks,
|  | Scalar * | Dvalues,
|  | UMFPackIndex * | DcolPointers,
|  | UMFPackIndex * | DrowIndices,
|  | std::vector< Scalar > & | Cvalues )

Add a MultisegmentWellContribution, actually creates an object on heap that is destroyed in the destructor Matrices C and B are passed in Blocked CSR, matrix D in CSC.

Parameters

  [in] | dim | size of blocks in vectors x and y, equal to MultisegmentWell::numEq
  [in] | dim_wells | size of blocks of C, B and D, equal to MultisegmentWell::numWellEq
  [in] | Mb | number of blockrows in C, B and D
  [in] | Bvalues | nonzero values of matrix B
  [in] | BcolIndices | columnindices of blocks of matrix B
  [in] | BrowPointers | rowpointers of matrix B
  [in] | DnumBlocks | number of blocks in D
  [in] | Dvalues | nonzero values of matrix D
  [in] | DcolPointers | columnpointers of matrix D
  [in] | DrowIndices | rowindices of matrix D
  [in] | Cvalues | nonzero values of matrix C

## addNumBlocks()

template<class Scalar>

void Opm::WellContributions< Scalar >::addNumBlocks | ( | unsigned int | numBlocks | ) |

Indicate how large the next StandardWell is, this function cannot be called after alloc() is called.

Parameters

  [in] | numBlocks | number of blocks in C and B of next StandardWell

## APIaddMatrix()

template<class Scalar>

virtual void Opm::WellContributions< Scalar >::APIaddMatrix | ( | MatrixType | ,
|  | int * | ,
|  | Scalar * | ,
|  | unsigned int | )

inline protected virtual

Api specific upload of matrix.

Reimplemented in Opm::WellContributionsCuda< Scalar >, Opm::WellContributionsOCL< Scalar >, and Opm::WellContributionsRocsparse< Scalar >.

## APIalloc()

template<class Scalar>

virtual void Opm::WellContributions< Scalar >::APIalloc | ( |  | ) |

inline protected virtual

API specific allocation.

Reimplemented in Opm::WellContributionsCuda< Scalar >, Opm::WellContributionsOCL< Scalar >, and Opm::WellContributionsRocsparse< Scalar >.

## setBlockSize()

template<class Scalar>

void Opm::WellContributions< Scalar >::setBlockSize | ( | unsigned int | dim,
|  | unsigned int | dim_wells )

Indicate how large the blocks of the StandardWell (C and B) are.

Parameters

  [in] | dim | number of columns
  [in] | dim_wells | number of rows

## setVectorSize()

template<class Scalar>

void Opm::WellContributions< Scalar >::setVectorSize | ( | unsigned | N | ) |

Set size of vector that the wells are applied to.

Parameters

  [in] | N | size of vector

The documentation for this class was generated from the following files:

- opm/simulators/linalg/gpubridge/GpuBridge.hpp
- opm/simulators/linalg/gpubridge/WellContributions.hpp
- opm/simulators/linalg/gpubridge/WellContributions.cpp