Loading...
Searching...
No Matches
WellContributions.hpp
/*
Copyright 2020 Equinor ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WELLCONTRIBUTIONS_HEADER_INCLUDED
#define WELLCONTRIBUTIONS_HEADER_INCLUDED
#include <memory>
#include <vector>
#include <umfpack.h>
#include <dune/common/version.hh>
namespace Opm {
template<class Scalar> class MultisegmentWellContribution;
template<class Scalar>
class WellContributions
{
public:
static std::unique_ptr<WellContributions> create(const std::string& accelerator_mode, bool useWellConn);
using UMFPackIndex = SuiteSparse_long;
enum class MatrixType {
C,
D,
B
};
protected:
bool allocated = false;
unsigned int N; // number of rows (not blockrows) in vectors x and y
unsigned int dim; // number of columns in blocks in B and C, equal to StandardWell::numEq
unsigned int dim_wells; // number of rows in blocks in B and C, equal to StandardWell::numStaticWellEq
unsigned int num_blocks = 0; // total number of blocks in all wells
unsigned int num_std_wells = 0; // number of StandardWells in this object
unsigned int num_ms_wells = 0; // number of MultisegmentWells in this object, must equal multisegments.size()
unsigned int num_blocks_so_far = 0; // keep track of where next data is written
unsigned int num_std_wells_so_far = 0; // keep track of where next data is written
std::vector<unsigned int> val_pointers; // val_pointers[wellID] == index of first block for this well in Ccols and Bcols
std::vector<std::unique_ptr<MultisegmentWellContribution<Scalar>>> multisegments;
public:
unsigned int getNumWells(){
return num_std_wells + num_ms_wells;
}
void addNumBlocks(unsigned int numBlocks);
void alloc();
virtual ~WellContributions();
void setBlockSize(unsigned int dim, unsigned int dim_wells);
void setVectorSize(unsigned N);
void addMatrix(MatrixType type, int* colIndices, Scalar* values, unsigned int val_size);
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);
protected:
virtual void APIalloc() {}
virtual void APIaddMatrix(MatrixType, int*, Scalar*, unsigned int) {}
};
} //namespace Opm
#endif
Opm::MultisegmentWellContribution
This class serves to duplicate the functionality of the MultisegmentWell A MultisegmentWell uses C,...
Definition MultisegmentWellContribution.hpp:44
Opm::WellContributions
This class serves to eliminate the need to include the WellContributions into the matrix (with –matri...
Definition WellContributions.hpp:51
Opm::WellContributions::addMatrix
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.
Definition WellContributions.cpp:92
Opm::WellContributions::addMultisegmentWellContribution
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 destr...
Definition WellContributions.cpp:157
Opm::WellContributions::alloc
void alloc()
Allocate memory for the StandardWells.
Definition WellContributions.cpp:145
Opm::WellContributions::setBlockSize
void setBlockSize(unsigned int dim, unsigned int dim_wells)
Indicate how large the blocks of the StandardWell (C and B) are.
Definition WellContributions.cpp:114
Opm::WellContributions::addNumBlocks
void addNumBlocks(unsigned int numBlocks)
Indicate how large the next StandardWell is, this function cannot be called after alloc() is called.
Definition WellContributions.cpp:135
Opm::WellContributions::setVectorSize
void setVectorSize(unsigned N)
Set size of vector that the wells are applied to.
Definition WellContributions.cpp:129
Opm::WellContributions::~WellContributions
virtual ~WellContributions()
Empty destructor.
Opm::WellContributions::APIaddMatrix
virtual void APIaddMatrix(MatrixType, int *, Scalar *, unsigned int)
Api specific upload of matrix.
Definition WellContributions.hpp:138
Opm::WellContributions::MatrixType
MatrixType
StandardWell has C, D and B matrices that need to be copied.
Definition WellContributions.hpp:57
Opm::WellContributions::APIalloc
virtual void APIalloc()
API specific allocation.
Definition WellContributions.hpp:135
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43