mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
mark parameters/variables as const where appropriate
This commit is contained in:
@@ -509,8 +509,8 @@ private:
|
|||||||
if (!onUpperBoundary_(pos))
|
if (!onUpperBoundary_(pos))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Scalar xInject[] = { 0.25, 0.75 };
|
const Scalar xInject[] = { 0.25, 0.75 };
|
||||||
Scalar injectLen[] = { 0.1, 0.1 };
|
const Scalar injectLen[] = { 0.1, 0.1 };
|
||||||
for (unsigned i = 0; i < sizeof(xInject) / sizeof(Scalar); ++i) {
|
for (unsigned i = 0; i < sizeof(xInject) / sizeof(Scalar); ++i) {
|
||||||
if (xInject[i] - injectLen[i] / 2 < lambda
|
if (xInject[i] - injectLen[i] / 2 < lambda
|
||||||
&& lambda < xInject[i] + injectLen[i] / 2)
|
&& lambda < xInject[i] + injectLen[i] / 2)
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ protected:
|
|||||||
for (unsigned i = 0; i < phaseIdxs.size(); ++i) {
|
for (unsigned i = 0; i < phaseIdxs.size(); ++i) {
|
||||||
normVelocityCell_[i] = 0;
|
normVelocityCell_[i] = 0;
|
||||||
}
|
}
|
||||||
for (auto& velocityInfo : velocityInfos) {
|
for (const auto& velocityInfo : velocityInfos) {
|
||||||
for (unsigned i = 0; i < phaseIdxs.size(); ++i) {
|
for (unsigned i = 0; i < phaseIdxs.size(); ++i) {
|
||||||
if (FluidSystem::phaseIsActive(phaseIdxs[i])) {
|
if (FluidSystem::phaseIsActive(phaseIdxs[i])) {
|
||||||
normVelocityCell_[phaseIdxs[i]] = max( normVelocityCell_[phaseIdxs[i]],
|
normVelocityCell_[phaseIdxs[i]] = max( normVelocityCell_[phaseIdxs[i]],
|
||||||
|
|||||||
@@ -136,9 +136,9 @@ BlackoilAquiferModel<TypeTag>::endTimeStep()
|
|||||||
{
|
{
|
||||||
using NumAq = AquiferNumerical<TypeTag>;
|
using NumAq = AquiferNumerical<TypeTag>;
|
||||||
|
|
||||||
for (auto& aquifer : this->aquifers) {
|
for (const auto& aquifer : this->aquifers) {
|
||||||
aquifer->endTimeStep();
|
aquifer->endTimeStep();
|
||||||
NumAq* num = dynamic_cast<NumAq*>(aquifer.get());
|
const NumAq* num = dynamic_cast<const NumAq*>(aquifer.get());
|
||||||
if (num) {
|
if (num) {
|
||||||
this->simulator_.vanguard().grid().comm().barrier();
|
this->simulator_.vanguard().grid().comm().barrier();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ void mergeParallelLogFiles(std::string_view output_dir,
|
|||||||
enableLoggingFalloutWarning));
|
enableLoggingFalloutWarning));
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleExtraConvergenceOutput(SimulatorReport& report,
|
void handleExtraConvergenceOutput(const SimulatorReport& report,
|
||||||
std::string_view option,
|
std::string_view option,
|
||||||
std::string_view optionName,
|
std::string_view optionName,
|
||||||
std::string_view output_dir,
|
std::string_view output_dir,
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ void mergeParallelLogFiles(std::string_view output_dir,
|
|||||||
std::string_view deck_filename,
|
std::string_view deck_filename,
|
||||||
bool enableLoggingFalloutWarning);
|
bool enableLoggingFalloutWarning);
|
||||||
|
|
||||||
void handleExtraConvergenceOutput(SimulatorReport& report,
|
void handleExtraConvergenceOutput(const SimulatorReport& report,
|
||||||
std::string_view option,
|
std::string_view option,
|
||||||
std::string_view optionName,
|
std::string_view optionName,
|
||||||
std::string_view output_dir,
|
std::string_view output_dir,
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ configureThpresft_()
|
|||||||
thpresftValues_.resize(numFaults, -1.0);
|
thpresftValues_.resize(numFaults, -1.0);
|
||||||
cartElemFaultIdx_.resize(numCartesianElem, -1);
|
cartElemFaultIdx_.resize(numCartesianElem, -1);
|
||||||
for (std::size_t faultIdx = 0; faultIdx < faults.size(); ++faultIdx) {
|
for (std::size_t faultIdx = 0; faultIdx < faults.size(); ++faultIdx) {
|
||||||
auto& fault = faults.getFault(faultIdx);
|
const auto& fault = faults.getFault(faultIdx);
|
||||||
thpresftValues_[faultIdx] = thpres.getThresholdPressureFault(faultIdx);
|
thpresftValues_[faultIdx] = thpres.getThresholdPressureFault(faultIdx);
|
||||||
for (const FaultFace& face : fault) {
|
for (const FaultFace& face : fault) {
|
||||||
// "face" is a misnomer because the object describes a set of cell
|
// "face" is a misnomer because the object describes a set of cell
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ Opm::InterRegFlowMap::getInterRegFlows() const
|
|||||||
auto maps = std::vector<data::InterRegFlowMap>{};
|
auto maps = std::vector<data::InterRegFlowMap>{};
|
||||||
maps.reserve(this->regionMaps_.size());
|
maps.reserve(this->regionMaps_.size());
|
||||||
|
|
||||||
for (auto& regionMap : this->regionMaps_) {
|
for (const auto& regionMap : this->regionMaps_) {
|
||||||
maps.push_back(regionMap.getInterRegFlows());
|
maps.push_back(regionMap.getInterRegFlows());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ Opm::InterRegFlowMap::getLocalMaxRegionID() const
|
|||||||
auto maxLocalRegionID = std::vector<std::size_t>{};
|
auto maxLocalRegionID = std::vector<std::size_t>{};
|
||||||
maxLocalRegionID.reserve(this->regionMaps_.size());
|
maxLocalRegionID.reserve(this->regionMaps_.size());
|
||||||
|
|
||||||
for (auto& regionMap : this->regionMaps_) {
|
for (const auto& regionMap : this->regionMaps_) {
|
||||||
maxLocalRegionID.push_back(regionMap.getLocalMaxRegionID());
|
maxLocalRegionID.push_back(regionMap.getLocalMaxRegionID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -711,7 +711,7 @@ public:
|
|||||||
if (!problem.model().linearizer().getFlowsInfo().empty()) {
|
if (!problem.model().linearizer().getFlowsInfo().empty()) {
|
||||||
const auto& flowsInf = problem.model().linearizer().getFlowsInfo();
|
const auto& flowsInf = problem.model().linearizer().getFlowsInfo();
|
||||||
auto flowsInfos = flowsInf[globalDofIdx];
|
auto flowsInfos = flowsInf[globalDofIdx];
|
||||||
for (auto& flowsInfo : flowsInfos) {
|
for (const auto& flowsInfo : flowsInfos) {
|
||||||
if (flowsInfo.faceId >= 0) {
|
if (flowsInfo.faceId >= 0) {
|
||||||
if (!this->flows_[flowsInfo.faceId][gasCompIdx].empty()) {
|
if (!this->flows_[flowsInfo.faceId][gasCompIdx].empty()) {
|
||||||
this->flows_[flowsInfo.faceId][gasCompIdx][globalDofIdx]
|
this->flows_[flowsInfo.faceId][gasCompIdx][globalDofIdx]
|
||||||
@@ -750,7 +750,7 @@ public:
|
|||||||
if (!problem.model().linearizer().getFloresInfo().empty()) {
|
if (!problem.model().linearizer().getFloresInfo().empty()) {
|
||||||
const auto& floresInf = problem.model().linearizer().getFloresInfo();
|
const auto& floresInf = problem.model().linearizer().getFloresInfo();
|
||||||
auto floresInfos =floresInf[globalDofIdx];
|
auto floresInfos =floresInf[globalDofIdx];
|
||||||
for (auto& floresInfo : floresInfos) {
|
for (const auto& floresInfo : floresInfos) {
|
||||||
if (floresInfo.faceId >= 0) {
|
if (floresInfo.faceId >= 0) {
|
||||||
if (!this->flores_[floresInfo.faceId][gasCompIdx].empty()) {
|
if (!this->flores_[floresInfo.faceId][gasCompIdx].empty()) {
|
||||||
this->flores_[floresInfo.faceId][gasCompIdx][globalDofIdx]
|
this->flores_[floresInfo.faceId][gasCompIdx][globalDofIdx]
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ public:
|
|||||||
|
|
||||||
#ifdef RESERVOIR_COUPLING_ENABLED
|
#ifdef RESERVOIR_COUPLING_ENABLED
|
||||||
// NOTE: The argc and argv will be used when launching a slave process
|
// NOTE: The argc and argv will be used when launching a slave process
|
||||||
void init(SimulatorTimer &timer, int argc, char** argv)
|
void init(const SimulatorTimer& timer, int argc, char** argv)
|
||||||
{
|
{
|
||||||
auto slave_mode = Parameters::Get<Parameters::Slave>();
|
auto slave_mode = Parameters::Get<Parameters::Slave>();
|
||||||
if (slave_mode) {
|
if (slave_mode) {
|
||||||
@@ -269,7 +269,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void init(SimulatorTimer &timer)
|
void init(const SimulatorTimer& timer)
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
simulator_.setEpisodeIndex(-1);
|
simulator_.setEpisodeIndex(-1);
|
||||||
|
|||||||
@@ -616,7 +616,7 @@ protected:
|
|||||||
if (elem.partitionType() != Dune::InteriorEntity)
|
if (elem.partitionType() != Dune::InteriorEntity)
|
||||||
{
|
{
|
||||||
// Dirichlet boundary conditions needed for the parallel matrix
|
// Dirichlet boundary conditions needed for the parallel matrix
|
||||||
for (auto& tr : tbatch) {
|
for (const auto& tr : tbatch) {
|
||||||
if (tr.numTracer() != 0) {
|
if (tr.numTracer() != 0) {
|
||||||
(*tr.mat)[I][I][0][0] = 1.;
|
(*tr.mat)[I][I][0][0] = 1.;
|
||||||
(*tr.mat)[I][I][1][1] = 1.;
|
(*tr.mat)[I][I][1][1] = 1.;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ void sortRow(int *colIndices, int *data, int left, int right)
|
|||||||
// LUMat->nnzValues[ik] = LUMat->nnzValues[ik] - (pivot * LUMat->nnzValues[jk]) in ilu decomposition
|
// LUMat->nnzValues[ik] = LUMat->nnzValues[ik] - (pivot * LUMat->nnzValues[jk]) in ilu decomposition
|
||||||
// a = a - (b * c)
|
// a = a - (b * c)
|
||||||
template<class Scalar>
|
template<class Scalar>
|
||||||
void blockMultSub(Scalar* a, Scalar* b, Scalar* c, unsigned int block_size)
|
void blockMultSub(Scalar* a, const Scalar* b, const Scalar* c, unsigned int block_size)
|
||||||
{
|
{
|
||||||
for (unsigned int row = 0; row < block_size; row++) {
|
for (unsigned int row = 0; row < block_size; row++) {
|
||||||
for (unsigned int col = 0; col < block_size; col++) {
|
for (unsigned int col = 0; col < block_size; col++) {
|
||||||
@@ -76,7 +76,8 @@ void blockMultSub(Scalar* a, Scalar* b, Scalar* c, unsigned int block_size)
|
|||||||
|
|
||||||
/*Perform a 3x3 matrix-matrix multiplicationj on two blocks*/
|
/*Perform a 3x3 matrix-matrix multiplicationj on two blocks*/
|
||||||
template<class Scalar>
|
template<class Scalar>
|
||||||
void blockMult(Scalar* mat1, Scalar* mat2, Scalar* resMat, unsigned int block_size)
|
void blockMult(const Scalar* mat1, const Scalar* mat2,
|
||||||
|
Scalar* resMat, unsigned int block_size)
|
||||||
{
|
{
|
||||||
for (unsigned int row = 0; row < block_size; row++) {
|
for (unsigned int row = 0; row < block_size; row++) {
|
||||||
for (unsigned int col = 0; col < block_size; col++) {
|
for (unsigned int col = 0; col < block_size; col++) {
|
||||||
@@ -90,8 +91,8 @@ void blockMult(Scalar* mat1, Scalar* mat2, Scalar* resMat, unsigned int block_si
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define INSTANTIATE_TYPE(T) \
|
#define INSTANTIATE_TYPE(T) \
|
||||||
template void blockMultSub(T*, T*, T*, unsigned int); \
|
template void blockMultSub(T*, const T*, const T*, unsigned int); \
|
||||||
template void blockMult(T*, T*, T*, unsigned int);
|
template void blockMult(const T*, const T*, T*, unsigned int);
|
||||||
|
|
||||||
INSTANTIATE_TYPE(double)
|
INSTANTIATE_TYPE(double)
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ void sortRow(int* colIndices, int* data, int left, int right);
|
|||||||
/// \param[in] c input block
|
/// \param[in] c input block
|
||||||
/// \param[in] block_size size of block
|
/// \param[in] block_size size of block
|
||||||
template<class Scalar>
|
template<class Scalar>
|
||||||
void blockMultSub(Scalar* a, Scalar* b, Scalar* c, unsigned int block_size);
|
void blockMultSub(Scalar* a, const Scalar* b,
|
||||||
|
const Scalar* c, unsigned int block_size);
|
||||||
|
|
||||||
/// Perform a matrix-matrix multiplication on two blocks
|
/// Perform a matrix-matrix multiplication on two blocks
|
||||||
/// resMat = mat1 * mat2
|
/// resMat = mat1 * mat2
|
||||||
|
|||||||
@@ -61,10 +61,10 @@ bool canBeStarted(const int rowIndex,
|
|||||||
* "Iterative methods for Sparse Linear Systems" by Yousef Saad in section 11.6.3
|
* "Iterative methods for Sparse Linear Systems" by Yousef Saad in section 11.6.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void findLevelScheduling(int* CSRColIndices,
|
void findLevelScheduling(const int* CSRColIndices,
|
||||||
int* CSRRowPointers,
|
const int* CSRRowPointers,
|
||||||
int* CSCRowIndices,
|
const int* CSCRowIndices,
|
||||||
int* CSCColPointers,
|
const int* CSCColPointers,
|
||||||
int Nb,
|
int Nb,
|
||||||
int* numColors,
|
int* numColors,
|
||||||
int* toOrder,
|
int* toOrder,
|
||||||
@@ -129,8 +129,8 @@ void findLevelScheduling(int* CSRColIndices,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// based on the scipy package from python, scipy/sparse/sparsetools/csr.h on github
|
// based on the scipy package from python, scipy/sparse/sparsetools/csr.h on github
|
||||||
void csrPatternToCsc(int* CSRColIndices,
|
void csrPatternToCsc(const int* CSRColIndices,
|
||||||
int* CSRRowPointers,
|
const int* CSRRowPointers,
|
||||||
int* CSCRowIndices,
|
int* CSCRowIndices,
|
||||||
int* CSCColPointers,
|
int* CSCColPointers,
|
||||||
int Nb)
|
int Nb)
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ bool canBeStarted(const int rowIndex,
|
|||||||
/// \param[out] toOrder the reorder pattern that was found, which lists for each index in the original order, to which index in the new order it should be moved
|
/// \param[out] toOrder the reorder pattern that was found, which lists for each index in the original order, to which index in the new order it should be moved
|
||||||
/// \param[out] fromOrder the reorder pattern that was found, which lists for each index in the new order, from which index in the original order it was moved
|
/// \param[out] fromOrder the reorder pattern that was found, which lists for each index in the new order, from which index in the original order it was moved
|
||||||
/// \param[out] rowsPerColor for each color, an array of all rowIndices in that color, this function uses emplace_back() to fill
|
/// \param[out] rowsPerColor for each color, an array of all rowIndices in that color, this function uses emplace_back() to fill
|
||||||
void findLevelScheduling(int* CSRColIndices,
|
void findLevelScheduling(const int* CSRColIndices,
|
||||||
int* CSRRowPointers,
|
const int* CSRRowPointers,
|
||||||
int* CSCRowIndices,
|
const int* CSCRowIndices,
|
||||||
int* CSCColPointers,
|
const int* CSCColPointers,
|
||||||
int Nb,
|
int Nb,
|
||||||
int* numColors,
|
int* numColors,
|
||||||
int* toOrder,
|
int* toOrder,
|
||||||
@@ -64,8 +64,8 @@ void findLevelScheduling(int* CSRColIndices,
|
|||||||
/// \param[inout] CSCRowIndices row indices of the result CSC representation of the pattern
|
/// \param[inout] CSCRowIndices row indices of the result CSC representation of the pattern
|
||||||
/// \param[inout] CSCColPointers column pointers of the result CSC representation of the pattern
|
/// \param[inout] CSCColPointers column pointers of the result CSC representation of the pattern
|
||||||
/// \param[in] Nb number of blockrows in the matrix
|
/// \param[in] Nb number of blockrows in the matrix
|
||||||
void csrPatternToCsc(int* CSRColIndices,
|
void csrPatternToCsc(const int* CSRColIndices,
|
||||||
int* CSRRowPointers,
|
const int* CSRRowPointers,
|
||||||
int* CSCRowIndices,
|
int* CSCRowIndices,
|
||||||
int* CSCColPointers,
|
int* CSCColPointers,
|
||||||
int Nb);
|
int Nb);
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ void amgclSolverBackend<Scalar,block_size>::initialize(int Nb_, int nnzbs)
|
|||||||
|
|
||||||
template<class Scalar, unsigned int block_size>
|
template<class Scalar, unsigned int block_size>
|
||||||
void amgclSolverBackend<Scalar,block_size>::
|
void amgclSolverBackend<Scalar,block_size>::
|
||||||
convert_sparsity_pattern(int* rows, int* cols)
|
convert_sparsity_pattern(const int* rows, const int* cols)
|
||||||
{
|
{
|
||||||
Timer t;
|
Timer t;
|
||||||
const unsigned int bs = block_size;
|
const unsigned int bs = block_size;
|
||||||
@@ -193,7 +193,7 @@ convert_sparsity_pattern(int* rows, int* cols)
|
|||||||
|
|
||||||
template<class Scalar, unsigned int block_size>
|
template<class Scalar, unsigned int block_size>
|
||||||
void amgclSolverBackend<Scalar,block_size>::
|
void amgclSolverBackend<Scalar,block_size>::
|
||||||
convert_data(Scalar* vals, int* rows)
|
convert_data(const Scalar* vals, const int* rows)
|
||||||
{
|
{
|
||||||
Timer t;
|
Timer t;
|
||||||
const unsigned int bs = block_size;
|
const unsigned int bs = block_size;
|
||||||
|
|||||||
@@ -105,12 +105,12 @@ private:
|
|||||||
/// Convert the BCSR sparsity pattern to a CSR one
|
/// Convert the BCSR sparsity pattern to a CSR one
|
||||||
/// \param[in] rows array of rowPointers, contains N/dim+1 values
|
/// \param[in] rows array of rowPointers, contains N/dim+1 values
|
||||||
/// \param[in] cols array of columnIndices, contains nnz values
|
/// \param[in] cols array of columnIndices, contains nnz values
|
||||||
void convert_sparsity_pattern(int *rows, int *cols);
|
void convert_sparsity_pattern(const int *rows, const int *cols);
|
||||||
|
|
||||||
/// Convert the BCSR nonzero data to a CSR format
|
/// Convert the BCSR nonzero data to a CSR format
|
||||||
/// \param[in] vals array of nonzeroes, each block is stored row-wise and contiguous, contains nnz values
|
/// \param[in] vals array of nonzeroes, each block is stored row-wise and contiguous, contains nnz values
|
||||||
/// \param[in] rows array of rowPointers, contains N/dim+1 values
|
/// \param[in] rows array of rowPointers, contains N/dim+1 values
|
||||||
void convert_data(Scalar* vals, int* rows);
|
void convert_data(const Scalar* vals, const int* rows);
|
||||||
|
|
||||||
/// Solve linear system
|
/// Solve linear system
|
||||||
/// \param[in] b pointer to b vector
|
/// \param[in] b pointer to b vector
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ create_preconditioner(BlockedMatrix<Scalar>* mat, BlockedMatrix<Scalar>* jacMat)
|
|||||||
{
|
{
|
||||||
const unsigned int bs = block_size;
|
const unsigned int bs = block_size;
|
||||||
|
|
||||||
auto *matToDecompose = jacMat ? jacMat : mat;
|
const auto* matToDecompose = jacMat ? jacMat : mat;
|
||||||
bool use_multithreading = true;
|
bool use_multithreading = true;
|
||||||
|
|
||||||
#if HAVE_OPENMP
|
#if HAVE_OPENMP
|
||||||
|
|||||||
@@ -285,11 +285,11 @@ private:
|
|||||||
|
|
||||||
void buildCommPairIdxs() const
|
void buildCommPairIdxs() const
|
||||||
{
|
{
|
||||||
auto &ri = this->m_cpuOwnerOverlapCopy.remoteIndices();
|
const auto& ri = this->m_cpuOwnerOverlapCopy.remoteIndices();
|
||||||
std::vector<int> commpairIndicesCopyOnCPU;
|
std::vector<int> commpairIndicesCopyOnCPU;
|
||||||
std::vector<int> commpairIndicesOwnerCPU;
|
std::vector<int> commpairIndicesOwnerCPU;
|
||||||
|
|
||||||
for (auto process : ri) {
|
for (const auto& process : ri) {
|
||||||
m_im[process.first] = std::pair(std::vector<int>(), std::vector<int>());
|
m_im[process.first] = std::pair(std::vector<int>(), std::vector<int>());
|
||||||
for (int send = 0; send < 2; ++send) {
|
for (int send = 0; send < 2; ++send) {
|
||||||
auto remoteEnd = send ? process.second.first->end()
|
auto remoteEnd = send ? process.second.first->end()
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include <dune/common/unused.hh>
|
#include <dune/common/unused.hh>
|
||||||
#include <dune/common/version.hh>
|
#include <dune/common/version.hh>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -193,13 +194,8 @@ public:
|
|||||||
ParallelInformation pinfo;
|
ParallelInformation pinfo;
|
||||||
|
|
||||||
std::size_t aggregates = coarsen(renumberer, pinfo, pg, vm,*aggregatesMap_, noAggregates, true);
|
std::size_t aggregates = coarsen(renumberer, pinfo, pg, vm,*aggregatesMap_, noAggregates, true);
|
||||||
std::vector<bool>& visited=excluded;
|
|
||||||
|
|
||||||
typedef std::vector<bool>::iterator Iterator;
|
std::fill(excluded.begin(), excluded.end(), false);
|
||||||
|
|
||||||
for(Iterator iter= visited.begin(), end=visited.end();
|
|
||||||
iter != end; ++iter)
|
|
||||||
*iter=false;
|
|
||||||
matrix_.reset(productBuilder.build(mg, vm,
|
matrix_.reset(productBuilder.build(mg, vm,
|
||||||
SequentialInformation(),
|
SequentialInformation(),
|
||||||
*aggregatesMap_,
|
*aggregatesMap_,
|
||||||
|
|||||||
@@ -542,7 +542,7 @@ extern "C" {
|
|||||||
if (cells.empty()) { return; }
|
if (cells.empty()) { return; }
|
||||||
|
|
||||||
const auto first = parts[cells.front()];
|
const auto first = parts[cells.front()];
|
||||||
for (auto& cell : cells) {
|
for (const auto& cell : cells) {
|
||||||
parts[cell] = first;
|
parts[cell] = first;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ template<class Scalar> class WellContributions;
|
|||||||
|
|
||||||
// add source from wells to the reservoir matrix
|
// add source from wells to the reservoir matrix
|
||||||
void addReservoirSourceTerms(GlobalEqVector& residual,
|
void addReservoirSourceTerms(GlobalEqVector& residual,
|
||||||
std::vector<typename SparseMatrixAdapter::MatrixBlock*>& diagMatAddress) const;
|
const std::vector<typename SparseMatrixAdapter::MatrixBlock*>& diagMatAddress) const;
|
||||||
|
|
||||||
// called at the beginning of a report step
|
// called at the beginning of a report step
|
||||||
void beginReportStep(const int time_step);
|
void beginReportStep(const int time_step);
|
||||||
|
|||||||
@@ -1906,7 +1906,7 @@ getMaxWellConnections() const
|
|||||||
|
|
||||||
const auto possibleFutureConnectionSetIt = possibleFutureConnections.find(well.name());
|
const auto possibleFutureConnectionSetIt = possibleFutureConnections.find(well.name());
|
||||||
if (possibleFutureConnectionSetIt != possibleFutureConnections.end()) {
|
if (possibleFutureConnectionSetIt != possibleFutureConnections.end()) {
|
||||||
for (auto& global_index : possibleFutureConnectionSetIt->second) {
|
for (const auto& global_index : possibleFutureConnectionSetIt->second) {
|
||||||
int compressed_idx = compressedIndexForInterior(global_index);
|
int compressed_idx = compressedIndexForInterior(global_index);
|
||||||
if (compressed_idx >= 0) { // Ignore connections in inactive/remote cells.
|
if (compressed_idx >= 0) { // Ignore connections in inactive/remote cells.
|
||||||
compressed_well_perforations.push_back(compressed_idx);
|
compressed_well_perforations.push_back(compressed_idx);
|
||||||
|
|||||||
@@ -433,7 +433,7 @@ namespace Opm {
|
|||||||
// have proper multi-phase rates proportional to rates at bhp zero.
|
// have proper multi-phase rates proportional to rates at bhp zero.
|
||||||
// This is done only for producers, as injectors will only have a single
|
// This is done only for producers, as injectors will only have a single
|
||||||
// nonzero phase anyway.
|
// nonzero phase anyway.
|
||||||
for (auto& well : well_container_) {
|
for (const auto& well : well_container_) {
|
||||||
const bool zero_target = well->stoppedOrZeroRateTarget(simulator_, this->wellState(), local_deferredLogger);
|
const bool zero_target = well->stoppedOrZeroRateTarget(simulator_, this->wellState(), local_deferredLogger);
|
||||||
if (well->isProducer() && !zero_target) {
|
if (well->isProducer() && !zero_target) {
|
||||||
well->updateWellStateRates(simulator_, this->wellState(), local_deferredLogger);
|
well->updateWellStateRates(simulator_, this->wellState(), local_deferredLogger);
|
||||||
@@ -441,7 +441,7 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& well : well_container_) {
|
for (const auto& well : well_container_) {
|
||||||
if (well->isVFPActive(local_deferredLogger)){
|
if (well->isVFPActive(local_deferredLogger)){
|
||||||
well->setPrevSurfaceRates(this->wellState(), this->prevWellState());
|
well->setPrevSurfaceRates(this->wellState(), this->prevWellState());
|
||||||
}
|
}
|
||||||
@@ -478,7 +478,7 @@ namespace Opm {
|
|||||||
auto exc_type = ExceptionType::NONE;
|
auto exc_type = ExceptionType::NONE;
|
||||||
// update gpmaint targets
|
// update gpmaint targets
|
||||||
if (this->schedule_[reportStepIdx].has_gpmaint()) {
|
if (this->schedule_[reportStepIdx].has_gpmaint()) {
|
||||||
for (auto& calculator : regionalAveragePressureCalculator_) {
|
for (const auto& calculator : regionalAveragePressureCalculator_) {
|
||||||
calculator.second->template defineState<ElementContext>(simulator_);
|
calculator.second->template defineState<ElementContext>(simulator_);
|
||||||
}
|
}
|
||||||
const double dt = simulator_.timeStepSize();
|
const double dt = simulator_.timeStepSize();
|
||||||
@@ -1641,7 +1641,7 @@ namespace Opm {
|
|||||||
template <typename TypeTag>
|
template <typename TypeTag>
|
||||||
void BlackoilWellModel<TypeTag>::
|
void BlackoilWellModel<TypeTag>::
|
||||||
addReservoirSourceTerms(GlobalEqVector& residual,
|
addReservoirSourceTerms(GlobalEqVector& residual,
|
||||||
std::vector<typename SparseMatrixAdapter::MatrixBlock*>& diagMatAddress) const
|
const std::vector<typename SparseMatrixAdapter::MatrixBlock*>& diagMatAddress) const
|
||||||
{
|
{
|
||||||
// NB this loop may write multiple times to the same element
|
// NB this loop may write multiple times to the same element
|
||||||
// if a cell is perforated by more than one well, so it should
|
// if a cell is perforated by more than one well, so it should
|
||||||
@@ -2022,7 +2022,7 @@ namespace Opm {
|
|||||||
// if a well or group change control it affects all wells that are under the same group
|
// if a well or group change control it affects all wells that are under the same group
|
||||||
for (const auto& well : well_container_) {
|
for (const auto& well : well_container_) {
|
||||||
// We only want to update wells under group-control here
|
// We only want to update wells under group-control here
|
||||||
auto& ws = this->wellState().well(well->indexOfWell());
|
const auto& ws = this->wellState().well(well->indexOfWell());
|
||||||
if (ws.production_cmode == Well::ProducerCMode::GRUP ||
|
if (ws.production_cmode == Well::ProducerCMode::GRUP ||
|
||||||
ws.injection_cmode == Well::InjectorCMode::GRUP)
|
ws.injection_cmode == Well::InjectorCMode::GRUP)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1590,7 +1590,7 @@ template<class Scalar>
|
|||||||
void GasLiftSingleWellGeneric<Scalar>::
|
void GasLiftSingleWellGeneric<Scalar>::
|
||||||
updateWellStateAlqFixedValue_(const GasLiftWell& well)
|
updateWellStateAlqFixedValue_(const GasLiftWell& well)
|
||||||
{
|
{
|
||||||
auto& max_alq_optional = well.max_rate();
|
const auto& max_alq_optional = well.max_rate();
|
||||||
if (max_alq_optional) {
|
if (max_alq_optional) {
|
||||||
// According to WLIFTOPT, item 3:
|
// According to WLIFTOPT, item 3:
|
||||||
// If item 2 is NO, then item 3 is regarded as the fixed
|
// If item 2 is NO, then item 3 is regarded as the fixed
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ void
|
|||||||
GasLiftSingleWell<TypeTag>::
|
GasLiftSingleWell<TypeTag>::
|
||||||
setAlqMaxRate_(const GasLiftWell& well)
|
setAlqMaxRate_(const GasLiftWell& well)
|
||||||
{
|
{
|
||||||
auto& max_alq_optional = well.max_rate();
|
const auto& max_alq_optional = well.max_rate();
|
||||||
if (max_alq_optional) {
|
if (max_alq_optional) {
|
||||||
// NOTE: To prevent extrapolation of the VFP tables, any value
|
// NOTE: To prevent extrapolation of the VFP tables, any value
|
||||||
// entered here must not exceed the largest ALQ value in the well's VFP table.
|
// entered here must not exceed the largest ALQ value in the well's VFP table.
|
||||||
|
|||||||
@@ -474,7 +474,7 @@ recalculateGradientAndUpdateData_(GradPairItr& grad_itr,
|
|||||||
// only applies to wells in the well_state_map (i.e. wells on this rank)
|
// only applies to wells in the well_state_map (i.e. wells on this rank)
|
||||||
// the grads and other grads are synchronized later
|
// the grads and other grads are synchronized later
|
||||||
if(this->stage1_wells_.count(name) > 0) {
|
if(this->stage1_wells_.count(name) > 0) {
|
||||||
GasLiftSingleWell &gs_well = *(this->stage1_wells_.at(name).get());
|
const GasLiftSingleWell& gs_well = *(this->stage1_wells_.at(name).get());
|
||||||
{
|
{
|
||||||
auto grad = calcIncOrDecGrad_(name, gs_well, gr_name_dont_limit, increase);
|
auto grad = calcIncOrDecGrad_(name, gs_well, gr_name_dont_limit, increase);
|
||||||
if (grad) {
|
if (grad) {
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public:
|
|||||||
// Create a function that calls some function
|
// Create a function that calls some function
|
||||||
// for all the individual data items to simplify
|
// for all the individual data items to simplify
|
||||||
// the further code.
|
// the further code.
|
||||||
auto iterateContainer = [](auto& container, auto& func) {
|
auto iterateContainer = [](auto& container, const auto& func) {
|
||||||
for (auto& x : container) {
|
for (auto& x : container) {
|
||||||
func(x.second);
|
func(x.second);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public:
|
|||||||
// Now add the cells of the possible future connections
|
// Now add the cells of the possible future connections
|
||||||
const auto possibleFutureConnectionSetIt = possibleFutureConnections.find(well.name());
|
const auto possibleFutureConnectionSetIt = possibleFutureConnections.find(well.name());
|
||||||
if (possibleFutureConnectionSetIt != possibleFutureConnections.end()) {
|
if (possibleFutureConnectionSetIt != possibleFutureConnections.end()) {
|
||||||
for (auto& global_index : possibleFutureConnectionSetIt->second) {
|
for (const auto& global_index : possibleFutureConnectionSetIt->second) {
|
||||||
int compressed_idx = model_.compressedIndexForInterior(global_index);
|
int compressed_idx = model_.compressedIndexForInterior(global_index);
|
||||||
if (compressed_idx >= 0) { // Ignore connections in inactive/remote cells.
|
if (compressed_idx >= 0) { // Ignore connections in inactive/remote cells.
|
||||||
wellCells.push_back(compressed_idx);
|
wellCells.push_back(compressed_idx);
|
||||||
@@ -126,7 +126,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void postSolveDomain(GlobalEqVector& deltaX, const Domain& domain)
|
void postSolveDomain(const GlobalEqVector& deltaX, const Domain& domain)
|
||||||
{
|
{
|
||||||
model_.recoverWellSolutionAndUpdateWellStateDomain(deltaX, domain);
|
model_.recoverWellSolutionAndUpdateWellStateDomain(deltaX, domain);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -476,7 +476,7 @@ namespace Opm
|
|||||||
deferred_logger.info(msg);
|
deferred_logger.info(msg);
|
||||||
|
|
||||||
// also reopen completions
|
// also reopen completions
|
||||||
for (auto& completion : this->well_ecl_.getCompletions()) {
|
for (const auto& completion : this->well_ecl_.getCompletions()) {
|
||||||
if (!welltest_state_temp.completion_is_closed(this->name(), completion.first))
|
if (!welltest_state_temp.completion_is_closed(this->name(), completion.first))
|
||||||
well_test_state.open_completion(this->name(), completion.first);
|
well_test_state.open_completion(this->name(), completion.first);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,8 @@ createBridge(const boost::property_tree::ptree& prm, std::unique_ptr<Opm::GpuBri
|
|||||||
|
|
||||||
template <int bz>
|
template <int bz>
|
||||||
Dune::BlockVector<Dune::FieldVector<double, bz>>
|
Dune::BlockVector<Dune::FieldVector<double, bz>>
|
||||||
testOpenclSolver(Opm::GpuBridge<Matrix<bz>, Vector<bz>, bz>& bridge, Matrix<bz>& matrix, Vector<bz>& rhs)
|
testOpenclSolver(Opm::GpuBridge<Matrix<bz>, Vector<bz>, bz>& bridge,
|
||||||
|
const Matrix<bz>& matrix, Vector<bz>& rhs)
|
||||||
{
|
{
|
||||||
Dune::InverseOperatorResult result;
|
Dune::InverseOperatorResult result;
|
||||||
Vector<bz> x(rhs.size());
|
Vector<bz> x(rhs.size());
|
||||||
@@ -131,7 +132,8 @@ testOpenclSolver(Opm::GpuBridge<Matrix<bz>, Vector<bz>, bz>& bridge, Matrix<bz>&
|
|||||||
|
|
||||||
template <int bz>
|
template <int bz>
|
||||||
Dune::BlockVector<Dune::FieldVector<double, bz>>
|
Dune::BlockVector<Dune::FieldVector<double, bz>>
|
||||||
testOpenclSolverJacobi(Opm::GpuBridge<Matrix<bz>, Vector<bz>, bz>& bridge, Matrix<bz>& matrix, Vector<bz>& rhs)
|
testOpenclSolverJacobi(Opm::GpuBridge<Matrix<bz>, Vector<bz>, bz>& bridge,
|
||||||
|
const Matrix<bz>& matrix, Vector<bz>& rhs)
|
||||||
{
|
{
|
||||||
Dune::InverseOperatorResult result;
|
Dune::InverseOperatorResult result;
|
||||||
Vector<bz> x(rhs.size());
|
Vector<bz> x(rhs.size());
|
||||||
|
|||||||
Reference in New Issue
Block a user