mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #5906 from akva2/janitoring_const_correctness
Janitoring: const correctness
This commit is contained in:
commit
0507c87e39
@ -509,8 +509,8 @@ private:
|
||||
if (!onUpperBoundary_(pos))
|
||||
return false;
|
||||
|
||||
Scalar xInject[] = { 0.25, 0.75 };
|
||||
Scalar injectLen[] = { 0.1, 0.1 };
|
||||
const Scalar xInject[] = { 0.25, 0.75 };
|
||||
const Scalar injectLen[] = { 0.1, 0.1 };
|
||||
for (unsigned i = 0; i < sizeof(xInject) / sizeof(Scalar); ++i) {
|
||||
if (xInject[i] - injectLen[i] / 2 < lambda
|
||||
&& lambda < xInject[i] + injectLen[i] / 2)
|
||||
|
@ -28,12 +28,14 @@
|
||||
#ifndef EWOMS_DISPERSION_MODULE_HH
|
||||
#define EWOMS_DISPERSION_MODULE_HH
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
#include <opm/models/common/multiphasebaseproperties.hh>
|
||||
#include <opm/models/discretization/common/fvbaseproperties.hh>
|
||||
|
||||
#include <opm/material/common/MathToolbox.hpp>
|
||||
#include <opm/material/common/Valgrind.hpp>
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Opm {
|
||||
@ -371,7 +373,7 @@ protected:
|
||||
for (unsigned i = 0; i < phaseIdxs.size(); ++i) {
|
||||
normVelocityCell_[i] = 0;
|
||||
}
|
||||
for (auto& velocityInfo : velocityInfos) {
|
||||
for (const auto& velocityInfo : velocityInfos) {
|
||||
for (unsigned i = 0; i < phaseIdxs.size(); ++i) {
|
||||
if (FluidSystem::phaseIsActive(phaseIdxs[i])) {
|
||||
normVelocityCell_[phaseIdxs[i]] = max( normVelocityCell_[phaseIdxs[i]],
|
||||
|
@ -136,11 +136,12 @@ BlackoilAquiferModel<TypeTag>::endTimeStep()
|
||||
{
|
||||
using NumAq = AquiferNumerical<TypeTag>;
|
||||
|
||||
for (auto& aquifer : this->aquifers) {
|
||||
for (const auto& aquifer : this->aquifers) {
|
||||
aquifer->endTimeStep();
|
||||
NumAq* num = dynamic_cast<NumAq*>(aquifer.get());
|
||||
if (num)
|
||||
const NumAq* num = dynamic_cast<const NumAq*>(aquifer.get());
|
||||
if (num) {
|
||||
this->simulator_.vanguard().grid().comm().barrier();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ void mergeParallelLogFiles(std::string_view output_dir,
|
||||
enableLoggingFalloutWarning));
|
||||
}
|
||||
|
||||
void handleExtraConvergenceOutput(SimulatorReport& report,
|
||||
void handleExtraConvergenceOutput(const SimulatorReport& report,
|
||||
std::string_view option,
|
||||
std::string_view optionName,
|
||||
std::string_view output_dir,
|
||||
|
@ -36,7 +36,7 @@ void mergeParallelLogFiles(std::string_view output_dir,
|
||||
std::string_view deck_filename,
|
||||
bool enableLoggingFalloutWarning);
|
||||
|
||||
void handleExtraConvergenceOutput(SimulatorReport& report,
|
||||
void handleExtraConvergenceOutput(const SimulatorReport& report,
|
||||
std::string_view option,
|
||||
std::string_view optionName,
|
||||
std::string_view output_dir,
|
||||
|
@ -23,6 +23,8 @@
|
||||
#ifndef OPM_GENERIC_THRESHOLD_PRESSURE_IMPL_HPP
|
||||
#define OPM_GENERIC_THRESHOLD_PRESSURE_IMPL_HPP
|
||||
|
||||
#include <opm/simulators/flow/GenericThresholdPressure.hpp>
|
||||
|
||||
#include <dune/grid/common/mcmgmapper.hh>
|
||||
#include <dune/grid/common/rangegenerators.hh>
|
||||
|
||||
@ -34,8 +36,6 @@
|
||||
#include <opm/input/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
|
||||
|
||||
#include <opm/simulators/flow/GenericThresholdPressure.hpp>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <algorithm>
|
||||
@ -73,10 +73,11 @@ thresholdPressure(int elem1Idx, int elem2Idx) const
|
||||
int fault1Idx = lookUpCartesianData_(elem1Idx, cartElemFaultIdx_);
|
||||
int fault2Idx = lookUpCartesianData_(elem2Idx, cartElemFaultIdx_);
|
||||
|
||||
if (fault1Idx != -1 && fault1Idx == fault2Idx)
|
||||
if (fault1Idx != -1 && fault1Idx == fault2Idx) {
|
||||
// inside a fault there's no threshold pressure, even accross EQUIL
|
||||
// regions.
|
||||
return 0.0;
|
||||
}
|
||||
if (fault1Idx != fault2Idx) {
|
||||
// TODO: which value if a cell is part of multiple faults? we take
|
||||
// the maximum here.
|
||||
@ -90,8 +91,9 @@ thresholdPressure(int elem1Idx, int elem2Idx) const
|
||||
auto equilRegion1Idx = elemEquilRegion_[elem1Idx];
|
||||
auto equilRegion2Idx = elemEquilRegion_[elem2Idx];
|
||||
|
||||
if (equilRegion1Idx == equilRegion2Idx)
|
||||
if (equilRegion1Idx == equilRegion2Idx) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return thpres_[equilRegion1Idx*numEquilRegions_ + equilRegion2Idx];
|
||||
}
|
||||
@ -103,8 +105,9 @@ finishInit()
|
||||
const auto& simConfig = eclState_.getSimulationConfig();
|
||||
|
||||
enableThresholdPressure_ = simConfig.useThresholdPressure();
|
||||
if (!enableThresholdPressure_)
|
||||
if (!enableThresholdPressure_) {
|
||||
return;
|
||||
}
|
||||
|
||||
numEquilRegions_ = eclState_.getTableManager().getEqldims().getNumEquilRegions();
|
||||
const decltype(numEquilRegions_) maxRegions =
|
||||
@ -129,16 +132,18 @@ finishInit()
|
||||
}
|
||||
|
||||
// internalize the data specified using the EQLNUM keyword
|
||||
elemEquilRegion_ = lookUpData_.template assignFieldPropsIntOnLeaf<short unsigned int>(eclState_.fieldProps(),
|
||||
"EQLNUM", true);
|
||||
elemEquilRegion_ = lookUpData_.
|
||||
template assignFieldPropsIntOnLeaf<short unsigned int>(eclState_.fieldProps(),
|
||||
"EQLNUM", true);
|
||||
|
||||
/*
|
||||
If this is a restart run the ThresholdPressure object will be active,
|
||||
and already properly initialized with numerical values from the restart.
|
||||
Done using GenericThresholdPressure::setFromRestart() in EclWriter::beginRestart().
|
||||
*/
|
||||
if (simConfig.getThresholdPressure().restart())
|
||||
if (simConfig.getThresholdPressure().restart()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// allocate the array which specifies the threshold pressures
|
||||
thpres_.resize(numEquilRegions_*numEquilRegions_, 0.0);
|
||||
@ -156,10 +161,12 @@ applyExplicitThresholdPressures_()
|
||||
// intersection in the grid
|
||||
for (const auto& elem : elements(gridView_, Dune::Partitions::interior)) {
|
||||
for (const auto& intersection : intersections(gridView_, elem)) {
|
||||
if (intersection.boundary())
|
||||
if (intersection.boundary()) {
|
||||
continue; // ignore boundary intersections for now (TODO?)
|
||||
else if (!intersection.neighbor()) //processor boundary but not domain boundary
|
||||
}
|
||||
else if (!intersection.neighbor()) { // processor boundary but not domain boundary
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto& inside = intersection.inside();
|
||||
const auto& outside = intersection.outside();
|
||||
@ -189,8 +196,9 @@ applyExplicitThresholdPressures_()
|
||||
}
|
||||
|
||||
// apply threshold pressures across faults
|
||||
if (thpres.ftSize() > 0)
|
||||
if (thpres.ftSize() > 0) {
|
||||
configureThpresft_();
|
||||
}
|
||||
}
|
||||
|
||||
template<class Grid, class GridView, class ElementMapper, class Scalar>
|
||||
@ -207,14 +215,16 @@ configureThpresft_()
|
||||
int numCartesianElem = eclState_.getInputGrid().getCartesianSize();
|
||||
thpresftValues_.resize(numFaults, -1.0);
|
||||
cartElemFaultIdx_.resize(numCartesianElem, -1);
|
||||
for (std::size_t faultIdx = 0; faultIdx < faults.size(); faultIdx++) {
|
||||
auto& fault = faults.getFault(faultIdx);
|
||||
for (std::size_t faultIdx = 0; faultIdx < faults.size(); ++faultIdx) {
|
||||
const auto& fault = faults.getFault(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
|
||||
// indices, but we go with the conventions of the parser here...
|
||||
for (std::size_t cartElemIdx : face)
|
||||
for (std::size_t cartElemIdx : face) {
|
||||
cartElemFaultIdx_[cartElemIdx] = faultIdx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,8 +233,9 @@ std::vector<Scalar>
|
||||
GenericThresholdPressure<Grid,GridView,ElementMapper,Scalar>::
|
||||
getRestartVector() const
|
||||
{
|
||||
if (!enableThresholdPressure_)
|
||||
if (!enableThresholdPressure_) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return this->thpres_;
|
||||
}
|
||||
@ -243,8 +254,9 @@ void
|
||||
GenericThresholdPressure<Grid,GridView,ElementMapper,Scalar>::
|
||||
logPressures()
|
||||
{
|
||||
if (!enableThresholdPressure_)
|
||||
if (!enableThresholdPressure_) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto lineFormat = [this](unsigned i, unsigned j, double val)
|
||||
{
|
||||
@ -274,7 +286,8 @@ logPressures()
|
||||
if (thpres.hasRegionBarrier(i, j)) {
|
||||
if (thpres.hasThresholdPressure(i, j)) {
|
||||
str += lineFormat(i, j, thpres.getThresholdPressure(j, i));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
std::size_t idx = (j - 1) * numEquilRegions_ + (i - 1);
|
||||
str += lineFormat(i, j, this->thpresDefault_[idx]);
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ Opm::InterRegFlowMap::getInterRegFlows() const
|
||||
auto maps = std::vector<data::InterRegFlowMap>{};
|
||||
maps.reserve(this->regionMaps_.size());
|
||||
|
||||
for (auto& regionMap : this->regionMaps_) {
|
||||
for (const auto& regionMap : this->regionMaps_) {
|
||||
maps.push_back(regionMap.getInterRegFlows());
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ Opm::InterRegFlowMap::getLocalMaxRegionID() const
|
||||
auto maxLocalRegionID = std::vector<std::size_t>{};
|
||||
maxLocalRegionID.reserve(this->regionMaps_.size());
|
||||
|
||||
for (auto& regionMap : this->regionMaps_) {
|
||||
for (const auto& regionMap : this->regionMaps_) {
|
||||
maxLocalRegionID.push_back(regionMap.getLocalMaxRegionID());
|
||||
}
|
||||
|
||||
|
@ -711,7 +711,7 @@ public:
|
||||
if (!problem.model().linearizer().getFlowsInfo().empty()) {
|
||||
const auto& flowsInf = problem.model().linearizer().getFlowsInfo();
|
||||
auto flowsInfos = flowsInf[globalDofIdx];
|
||||
for (auto& flowsInfo : flowsInfos) {
|
||||
for (const auto& flowsInfo : flowsInfos) {
|
||||
if (flowsInfo.faceId >= 0) {
|
||||
if (!this->flows_[flowsInfo.faceId][gasCompIdx].empty()) {
|
||||
this->flows_[flowsInfo.faceId][gasCompIdx][globalDofIdx]
|
||||
@ -750,7 +750,7 @@ public:
|
||||
if (!problem.model().linearizer().getFloresInfo().empty()) {
|
||||
const auto& floresInf = problem.model().linearizer().getFloresInfo();
|
||||
auto floresInfos =floresInf[globalDofIdx];
|
||||
for (auto& floresInfo : floresInfos) {
|
||||
for (const auto& floresInfo : floresInfos) {
|
||||
if (floresInfo.faceId >= 0) {
|
||||
if (!this->flores_[floresInfo.faceId][gasCompIdx].empty()) {
|
||||
this->flores_[floresInfo.faceId][gasCompIdx][globalDofIdx]
|
||||
|
@ -244,7 +244,7 @@ public:
|
||||
|
||||
#ifdef RESERVOIR_COUPLING_ENABLED
|
||||
// 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>();
|
||||
if (slave_mode) {
|
||||
@ -269,7 +269,7 @@ public:
|
||||
}
|
||||
}
|
||||
#else
|
||||
void init(SimulatorTimer &timer)
|
||||
void init(const SimulatorTimer& timer)
|
||||
{
|
||||
#endif
|
||||
simulator_.setEpisodeIndex(-1);
|
||||
|
@ -616,7 +616,7 @@ protected:
|
||||
if (elem.partitionType() != Dune::InteriorEntity)
|
||||
{
|
||||
// Dirichlet boundary conditions needed for the parallel matrix
|
||||
for (auto& tr : tbatch) {
|
||||
for (const auto& tr : tbatch) {
|
||||
if (tr.numTracer() != 0) {
|
||||
(*tr.mat)[I][I][0][0] = 1.;
|
||||
(*tr.mat)[I][I][1][1] = 1.;
|
||||
@ -892,7 +892,7 @@ protected:
|
||||
|
||||
TracerBatch(int phaseIdx = 0) : phaseIdx_(phaseIdx) {}
|
||||
|
||||
int numTracer() const {return idx_.size(); }
|
||||
int numTracer() const { return idx_.size(); }
|
||||
|
||||
void addTracer(const int idx, const TV & concentration)
|
||||
{
|
||||
|
@ -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
|
||||
// a = a - (b * c)
|
||||
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 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*/
|
||||
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 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) \
|
||||
template void blockMultSub(T*, T*, T*, unsigned int); \
|
||||
template void blockMult(T*, T*, T*, unsigned int);
|
||||
template void blockMultSub(T*, const T*, const T*, unsigned int); \
|
||||
template void blockMult(const T*, const T*, T*, unsigned int);
|
||||
|
||||
INSTANTIATE_TYPE(double)
|
||||
|
||||
|
@ -111,7 +111,8 @@ void sortRow(int* colIndices, int* data, int left, int right);
|
||||
/// \param[in] c input block
|
||||
/// \param[in] block_size size of block
|
||||
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
|
||||
/// resMat = mat1 * mat2
|
||||
|
@ -23,28 +23,28 @@
|
||||
|
||||
#include <opm/simulators/linalg/gpubridge/Reorder.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
namespace Accelerator
|
||||
{
|
||||
|
||||
namespace Opm::Accelerator {
|
||||
|
||||
/* Check is operations on a node in the matrix can be started
|
||||
* A node can only be started if all nodes that it depends on during sequential execution have already completed.*/
|
||||
* A node can only be started if all nodes that it depends on during sequential
|
||||
* execution have already completed.*/
|
||||
|
||||
bool canBeStarted(const int rowIndex, const int *rowPointers, const int *colIndices, const std::vector<bool>& doneRows) {
|
||||
bool canBeStarted(const int rowIndex,
|
||||
const int* rowPointers,
|
||||
const int* colIndices,
|
||||
const std::vector<bool>& doneRows)
|
||||
{
|
||||
bool canStart = !doneRows[rowIndex];
|
||||
int i, thisDependency;
|
||||
if (canStart) {
|
||||
for (i = rowPointers[rowIndex]; i < rowPointers[rowIndex + 1]; i++) {
|
||||
thisDependency = colIndices[i];
|
||||
for (int i = rowPointers[rowIndex]; i < rowPointers[rowIndex + 1]; ++i) {
|
||||
int thisDependency = colIndices[i];
|
||||
// Only dependencies on rows that should execute before the current one are relevant
|
||||
if (thisDependency >= rowIndex)
|
||||
if (thisDependency >= rowIndex) {
|
||||
break;
|
||||
}
|
||||
// Check if dependency has been resolved
|
||||
if (!doneRows[thisDependency]) {
|
||||
return false;
|
||||
@ -55,14 +55,23 @@ bool canBeStarted(const int rowIndex, const int *rowPointers, const int *colIndi
|
||||
}
|
||||
|
||||
/*
|
||||
* The level scheduling of a non-symmetric, blocked matrix requires access to a CSC encoding and a CSR encoding of the sparsity pattern of the input matrix.
|
||||
* The level scheduling of a non-symmetric, blocked matrix requires access to a CSC
|
||||
* encoding and a CSR encoding of the sparsity pattern of the input matrix.
|
||||
* This function is based on a standard level scheduling algorithm, like the one described in:
|
||||
* "Iterative methods for Sparse Linear Systems" by Yousef Saad in section 11.6.3
|
||||
*/
|
||||
|
||||
void findLevelScheduling(int *CSRColIndices, int *CSRRowPointers, int *CSCRowIndices, int *CSCColPointers, int Nb, int *numColors, int *toOrder, int* fromOrder, std::vector<int>& rowsPerColor) {
|
||||
int activeRowIndex = 0, colorEnd, nextActiveRowIndex = 0;
|
||||
int thisRow;
|
||||
void findLevelScheduling(const int* CSRColIndices,
|
||||
const int* CSRRowPointers,
|
||||
const int* CSCRowIndices,
|
||||
const int* CSCColPointers,
|
||||
int Nb,
|
||||
int* numColors,
|
||||
int* toOrder,
|
||||
int* fromOrder,
|
||||
std::vector<int>& rowsPerColor)
|
||||
{
|
||||
int activeRowIndex = 0, nextActiveRowIndex = 0;
|
||||
std::vector<bool> doneRows(Nb, false);
|
||||
std::vector <int> rowsToStart;
|
||||
|
||||
@ -70,23 +79,27 @@ void findLevelScheduling(int *CSRColIndices, int *CSRRowPointers, int *CSCRowInd
|
||||
assert(rowsPerColor.empty());
|
||||
|
||||
// find starting rows: rows that are independent from all rows that come before them.
|
||||
for (thisRow = 0; thisRow < Nb; thisRow++) {
|
||||
int thisRow;
|
||||
for (thisRow = 0; thisRow < Nb; ++thisRow) {
|
||||
if (canBeStarted(thisRow, CSCColPointers, CSCRowIndices, doneRows)) {
|
||||
fromOrder[nextActiveRowIndex] = thisRow;
|
||||
toOrder[thisRow] = nextActiveRowIndex;
|
||||
nextActiveRowIndex++;
|
||||
++nextActiveRowIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// 'do' compute on all active rows
|
||||
for (colorEnd = 0; colorEnd < nextActiveRowIndex; colorEnd++) {
|
||||
int colorEnd;
|
||||
for (colorEnd = 0; colorEnd < nextActiveRowIndex; ++colorEnd) {
|
||||
doneRows[fromOrder[colorEnd]] = true;
|
||||
}
|
||||
|
||||
rowsPerColor.emplace_back(nextActiveRowIndex - activeRowIndex);
|
||||
|
||||
while (colorEnd < Nb) {
|
||||
// Go over all rows active from the last color, and check which of their neighbours can be activated this color
|
||||
for (; activeRowIndex < colorEnd; activeRowIndex++) {
|
||||
// Go over all rows active from the last color, and check which of
|
||||
// their neighbours can be activated this color
|
||||
for (; activeRowIndex < colorEnd; ++activeRowIndex) {
|
||||
thisRow = fromOrder[activeRowIndex];
|
||||
|
||||
for (int i = CSCColPointers[thisRow]; i < CSCColPointers[thisRow + 1]; i++) {
|
||||
@ -104,7 +117,7 @@ void findLevelScheduling(int *CSRColIndices, int *CSRRowPointers, int *CSCRowInd
|
||||
doneRows[thisRow] = true;
|
||||
fromOrder[nextActiveRowIndex] = thisRow;
|
||||
toOrder[thisRow] = nextActiveRowIndex;
|
||||
nextActiveRowIndex++;
|
||||
++nextActiveRowIndex;
|
||||
}
|
||||
}
|
||||
rowsToStart.clear();
|
||||
@ -115,10 +128,13 @@ void findLevelScheduling(int *CSRColIndices, int *CSRRowPointers, int *CSCRowInd
|
||||
*numColors = rowsPerColor.size();
|
||||
}
|
||||
|
||||
|
||||
// based on the scipy package from python, scipy/sparse/sparsetools/csr.h on github
|
||||
void csrPatternToCsc(int *CSRColIndices, int *CSRRowPointers, int *CSCRowIndices, int *CSCColPointers, int Nb) {
|
||||
|
||||
void csrPatternToCsc(const int* CSRColIndices,
|
||||
const int* CSRRowPointers,
|
||||
int* CSCRowIndices,
|
||||
int* CSCColPointers,
|
||||
int Nb)
|
||||
{
|
||||
int nnz = CSRRowPointers[Nb];
|
||||
|
||||
// compute number of nnzs per column
|
||||
@ -141,7 +157,7 @@ void csrPatternToCsc(int *CSRColIndices, int *CSRRowPointers, int *CSCRowIndices
|
||||
int col = CSRColIndices[j];
|
||||
int dest = CSCColPointers[col];
|
||||
CSCRowIndices[dest] = row;
|
||||
CSCColPointers[col]++;
|
||||
++CSCColPointers[col];
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,6 +168,4 @@ void csrPatternToCsc(int *CSRColIndices, int *CSRRowPointers, int *CSCRowIndices
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Accelerator
|
||||
} // namespace Opm
|
||||
} // namespace Opm::Accelerator
|
||||
|
@ -22,10 +22,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
namespace Accelerator
|
||||
{
|
||||
namespace Opm::Accelerator {
|
||||
|
||||
/// Determine whether all rows that a certain row depends on are done already
|
||||
/// \param[in] rowIndex index of the row that needs to be checked for
|
||||
@ -33,7 +30,10 @@ namespace Accelerator
|
||||
/// \param[in] colIndices column indices of the matrix that the row is in
|
||||
/// \param[in] doneRows array that for each row lists whether it is done or not
|
||||
/// \return true iff all dependencies are done and if the result itself was not done yet
|
||||
bool canBeStarted(const int rowIndex, const int *rowPointers, const int *colIndices, const std::vector<bool>& doneRows);
|
||||
bool canBeStarted(const int rowIndex,
|
||||
const int* rowPointers,
|
||||
const int* colIndices,
|
||||
const std::vector<bool>& doneRows);
|
||||
|
||||
/// Find a level scheduling reordering for an input matrix
|
||||
/// The toOrder and fromOrder arrays must be allocated already
|
||||
@ -46,7 +46,15 @@ bool canBeStarted(const int rowIndex, const int *rowPointers, const int *colIn
|
||||
/// \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] rowsPerColor for each color, an array of all rowIndices in that color, this function uses emplace_back() to fill
|
||||
void findLevelScheduling(int *CSRColIndices, int *CSRRowPointers, int *CSCRowIndices, int *CSCColPointers, int Nb, int *numColors, int *toOrder, int* fromOrder, std::vector<int>& rowsPerColor);
|
||||
void findLevelScheduling(const int* CSRColIndices,
|
||||
const int* CSRRowPointers,
|
||||
const int* CSCRowIndices,
|
||||
const int* CSCColPointers,
|
||||
int Nb,
|
||||
int* numColors,
|
||||
int* toOrder,
|
||||
int* fromOrder,
|
||||
std::vector<int>& rowsPerColor);
|
||||
|
||||
/// Convert a sparsity pattern stored in the CSR format to the CSC format
|
||||
/// CSCRowIndices and CSCColPointers arrays must be allocated already
|
||||
@ -56,9 +64,12 @@ void findLevelScheduling(int *CSRColIndices, int *CSRRowPointers, int *CSCRowInd
|
||||
/// \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[in] Nb number of blockrows in the matrix
|
||||
void csrPatternToCsc(int *CSRColIndices, int *CSRRowPointers, int *CSCRowIndices, int *CSCColPointers, int Nb);
|
||||
void csrPatternToCsc(const int* CSRColIndices,
|
||||
const int* CSRRowPointers,
|
||||
int* CSCRowIndices,
|
||||
int* CSCColPointers,
|
||||
int Nb);
|
||||
|
||||
} // namespace Accelerator
|
||||
} // namespace Opm
|
||||
} // namespace Opm::Accelerator
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -163,7 +163,7 @@ void amgclSolverBackend<Scalar,block_size>::initialize(int Nb_, int nnzbs)
|
||||
|
||||
template<class Scalar, unsigned int 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;
|
||||
const unsigned int bs = block_size;
|
||||
@ -193,7 +193,7 @@ convert_sparsity_pattern(int* rows, int* cols)
|
||||
|
||||
template<class Scalar, unsigned int block_size>
|
||||
void amgclSolverBackend<Scalar,block_size>::
|
||||
convert_data(Scalar* vals, int* rows)
|
||||
convert_data(const Scalar* vals, const int* rows)
|
||||
{
|
||||
Timer t;
|
||||
const unsigned int bs = block_size;
|
||||
|
@ -105,12 +105,12 @@ private:
|
||||
/// Convert the BCSR sparsity pattern to a CSR one
|
||||
/// \param[in] rows array of rowPointers, contains N/dim+1 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
|
||||
/// \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
|
||||
void convert_data(Scalar* vals, int* rows);
|
||||
void convert_data(const Scalar* vals, const int* rows);
|
||||
|
||||
/// Solve linear system
|
||||
/// \param[in] b pointer to b vector
|
||||
|
@ -194,12 +194,13 @@ create_preconditioner(BlockedMatrix<Scalar>* mat, BlockedMatrix<Scalar>* jacMat)
|
||||
{
|
||||
const unsigned int bs = block_size;
|
||||
|
||||
auto *matToDecompose = jacMat ? jacMat : mat;
|
||||
const auto* matToDecompose = jacMat ? jacMat : mat;
|
||||
bool use_multithreading = true;
|
||||
|
||||
#if HAVE_OPENMP
|
||||
if (omp_get_max_threads() == 1)
|
||||
if (omp_get_max_threads() == 1) {
|
||||
use_multithreading = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (jacMat && use_multithreading) {
|
||||
|
@ -18,14 +18,19 @@
|
||||
*/
|
||||
#ifndef OPM_GPUISTL_GPUOWNEROVERLAPCOPY_HPP
|
||||
#define OPM_GPUISTL_GPUOWNEROVERLAPCOPY_HPP
|
||||
|
||||
#include <dune/istl/owneroverlapcopy.hh>
|
||||
|
||||
#include <opm/simulators/linalg/gpuistl/GpuVector.hpp>
|
||||
|
||||
#include <mpi.h>
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <opm/simulators/linalg/gpuistl/GpuVector.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm::gpuistl
|
||||
{
|
||||
namespace Opm::gpuistl {
|
||||
|
||||
/**
|
||||
* @brief GPUSender is a wrapper class for classes which will implement copOwnerToAll
|
||||
* This is implemented with the intention of creating communicators with generic GPUSender
|
||||
@ -119,10 +124,11 @@ public:
|
||||
|
||||
explicit GPUObliviousMPISender(const OwnerOverlapCopyCommunicationType& cpuOwnerOverlapCopy)
|
||||
: GPUSender<field_type, OwnerOverlapCopyCommunicationType>(cpuOwnerOverlapCopy)
|
||||
{
|
||||
}
|
||||
{
|
||||
}
|
||||
|
||||
void copyOwnerToAll(const X& source, X& dest) const override {
|
||||
void copyOwnerToAll(const X& source, X& dest) const override
|
||||
{
|
||||
// TODO: [perf] Can we reduce copying from the GPU here?
|
||||
// TODO: [perf] Maybe create a global buffer instead?
|
||||
auto sourceAsDuneVector = source.template asDuneBlockVector<block_size>();
|
||||
@ -179,7 +185,6 @@ public:
|
||||
|
||||
void copyOwnerToAll(const X& source, X& dest) const override
|
||||
{
|
||||
|
||||
OPM_ERROR_IF(&source != &dest, "The provided GpuVectors' address did not match"); // In this context, source == dest!!!
|
||||
std::call_once(this->m_initializedIndices, [&]() { initIndexSet(); });
|
||||
|
||||
@ -198,9 +203,9 @@ public:
|
||||
|
||||
{
|
||||
size_t i = 0;
|
||||
for(const_iterator info = m_messageInformation.begin(); info != end; ++info, ++i) {
|
||||
for (const_iterator info = m_messageInformation.begin(); info != end; ++info, ++i) {
|
||||
processMap[i]=info->first;
|
||||
if(info->second.second.m_size) {
|
||||
if (info->second.second.m_size) {
|
||||
MPI_Irecv(m_GPURecvBuf->data()+info->second.second.m_start,
|
||||
detail::to_int(info->second.second.m_size),
|
||||
MPI_BYTE,
|
||||
@ -209,16 +214,17 @@ public:
|
||||
this->m_cpuOwnerOverlapCopy.communicator(),
|
||||
&recvRequests[i]);
|
||||
numberOfRealRecvRequests += 1;
|
||||
} else {
|
||||
recvRequests[i]=MPI_REQUEST_NULL;
|
||||
}
|
||||
else {
|
||||
recvRequests[i] = MPI_REQUEST_NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
size_t i = 0;
|
||||
for(const_iterator info = m_messageInformation.begin(); info != end; ++info, ++i) {
|
||||
if(info->second.first.m_size) {
|
||||
for (const_iterator info = m_messageInformation.begin(); info != end; ++info, ++i) {
|
||||
if (info->second.first.m_size) {
|
||||
MPI_Issend(m_GPUSendBuf->data()+info->second.first.m_start,
|
||||
detail::to_int(info->second.first.m_size),
|
||||
MPI_BYTE,
|
||||
@ -227,24 +233,28 @@ public:
|
||||
this->m_cpuOwnerOverlapCopy.communicator(),
|
||||
&sendRequests[i]);
|
||||
} else {
|
||||
sendRequests[i]=MPI_REQUEST_NULL;
|
||||
sendRequests[i] = MPI_REQUEST_NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
int finished = MPI_UNDEFINED;
|
||||
MPI_Status status;
|
||||
for(size_t i = 0; i < numberOfRealRecvRequests; i++) {
|
||||
for (size_t i = 0; i < numberOfRealRecvRequests; i++) {
|
||||
status.MPI_ERROR=MPI_SUCCESS;
|
||||
MPI_Waitany(m_messageInformation.size(), recvRequests.data(), &finished, &status);
|
||||
|
||||
if(status.MPI_ERROR!=MPI_SUCCESS) {
|
||||
OPM_THROW(std::runtime_error, fmt::format("MPI_Error occurred while rank {} received a message from rank {}", rank, processMap[finished]));
|
||||
if (status.MPI_ERROR!=MPI_SUCCESS) {
|
||||
OPM_THROW(std::runtime_error,
|
||||
fmt::format("MPI_Error occurred while rank {} received a message from rank {}",
|
||||
rank, processMap[finished]));
|
||||
}
|
||||
}
|
||||
MPI_Status recvStatus;
|
||||
for(size_t i = 0; i < m_messageInformation.size(); i++) {
|
||||
if(MPI_SUCCESS!=MPI_Wait(&sendRequests[i], &recvStatus)) {
|
||||
OPM_THROW(std::runtime_error, fmt::format("MPI_Error occurred while rank {} sent a message from rank {}", rank, processMap[finished]));
|
||||
for (size_t i = 0; i < m_messageInformation.size(); i++) {
|
||||
if (MPI_SUCCESS != MPI_Wait(&sendRequests[i], &recvStatus)) {
|
||||
OPM_THROW(std::runtime_error,
|
||||
fmt::format("MPI_Error occurred while rank {} sent a message from rank {}",
|
||||
rank, processMap[finished]));
|
||||
}
|
||||
}
|
||||
// ...End of MPI stuff
|
||||
@ -275,24 +285,25 @@ private:
|
||||
|
||||
void buildCommPairIdxs() const
|
||||
{
|
||||
auto &ri = this->m_cpuOwnerOverlapCopy.remoteIndices();
|
||||
const auto& ri = this->m_cpuOwnerOverlapCopy.remoteIndices();
|
||||
std::vector<int> commpairIndicesCopyOnCPU;
|
||||
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>());
|
||||
for(int send = 0; send < 2; ++send) {
|
||||
for (int send = 0; send < 2; ++send) {
|
||||
auto remoteEnd = send ? process.second.first->end()
|
||||
: process.second.second->end();
|
||||
auto remote = send ? process.second.first->begin()
|
||||
: process.second.second->begin();
|
||||
|
||||
while(remote != remoteEnd) {
|
||||
while (remote != remoteEnd) {
|
||||
if (send ? (remote->localIndexPair().local().attribute() == 1)
|
||||
: (remote->attribute() == 1)) {
|
||||
if (send) {
|
||||
m_im[process.first].first.push_back(remote->localIndexPair().local().local());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m_im[process.first].second.push_back(remote->localIndexPair().local().local());
|
||||
}
|
||||
}
|
||||
@ -317,13 +328,13 @@ private:
|
||||
recvBufIdx * block_size,
|
||||
noRecv * block_size * sizeof(field_type)))));
|
||||
|
||||
for(int x = 0; x < noSend; x++) {
|
||||
for(int bs = 0; bs < block_size; bs++) {
|
||||
for (int x = 0; x < noSend; x++) {
|
||||
for (int bs = 0; bs < block_size; bs++) {
|
||||
commpairIndicesOwnerCPU.push_back(it->second.first[x] * block_size + bs);
|
||||
}
|
||||
}
|
||||
for(int x = 0; x < noRecv; x++) {
|
||||
for(int bs = 0; bs < block_size; bs++) {
|
||||
for (int x = 0; x < noRecv; x++) {
|
||||
for (int bs = 0; bs < block_size; bs++) {
|
||||
commpairIndicesCopyOnCPU.push_back(it->second.second[x] * block_size + bs);
|
||||
}
|
||||
}
|
||||
@ -385,9 +396,12 @@ class GpuOwnerOverlapCopy
|
||||
public:
|
||||
using X = GpuVector<field_type>;
|
||||
|
||||
explicit GpuOwnerOverlapCopy(std::shared_ptr<GPUSender<field_type, OwnerOverlapCopyCommunicationType>> sender) : m_sender(sender){}
|
||||
explicit GpuOwnerOverlapCopy(std::shared_ptr<GPUSender<field_type, OwnerOverlapCopyCommunicationType>> sender)
|
||||
: m_sender(sender)
|
||||
{}
|
||||
|
||||
void copyOwnerToAll(const X& source, X& dest) const {
|
||||
void copyOwnerToAll(const X& source, X& dest) const
|
||||
{
|
||||
m_sender->copyOwnerToAll(source, dest);
|
||||
}
|
||||
|
||||
@ -409,5 +423,7 @@ public:
|
||||
private:
|
||||
std::shared_ptr<GPUSender<field_type, OwnerOverlapCopyCommunicationType>> m_sender;
|
||||
};
|
||||
|
||||
} // namespace Opm::gpuistl
|
||||
|
||||
#endif
|
||||
|
@ -6,17 +6,22 @@
|
||||
// NOTE: This file is a modified version of dune/istl/paamg/twolevelmethod.hh from
|
||||
// dune-istl release 2.6.0. Modifications have been kept as minimal as possible.
|
||||
|
||||
#include <tuple>
|
||||
|
||||
#include<dune/istl/operators.hh>
|
||||
#include <dune/istl/operators.hh>
|
||||
//#include "amg.hh"
|
||||
//#include"galerkin.hh"
|
||||
#include<dune/istl/paamg/amg.hh>
|
||||
#include<dune/istl/paamg/galerkin.hh>
|
||||
#include<dune/istl/solver.hh>
|
||||
#include <dune/istl/paamg/amg.hh>
|
||||
#include <dune/istl/paamg/galerkin.hh>
|
||||
#include <dune/istl/solver.hh>
|
||||
|
||||
#include<dune/common/unused.hh>
|
||||
#include<dune/common/version.hh>
|
||||
#include <dune/common/unused.hh>
|
||||
#include <dune/common/version.hh>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
* @addtogroup ISTL_PAAMG
|
||||
@ -189,13 +194,8 @@ public:
|
||||
ParallelInformation pinfo;
|
||||
|
||||
std::size_t aggregates = coarsen(renumberer, pinfo, pg, vm,*aggregatesMap_, noAggregates, true);
|
||||
std::vector<bool>& visited=excluded;
|
||||
|
||||
typedef std::vector<bool>::iterator Iterator;
|
||||
|
||||
for(Iterator iter= visited.begin(), end=visited.end();
|
||||
iter != end; ++iter)
|
||||
*iter=false;
|
||||
std::fill(excluded.begin(), excluded.end(), false);
|
||||
matrix_.reset(productBuilder.build(mg, vm,
|
||||
SequentialInformation(),
|
||||
*aggregatesMap_,
|
||||
|
@ -542,7 +542,7 @@ extern "C" {
|
||||
if (cells.empty()) { return; }
|
||||
|
||||
const auto first = parts[cells.front()];
|
||||
for (auto& cell : cells) {
|
||||
for (const auto& cell : cells) {
|
||||
parts[cell] = first;
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ template<class Scalar> class WellContributions;
|
||||
|
||||
// add source from wells to the reservoir matrix
|
||||
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
|
||||
void beginReportStep(const int time_step);
|
||||
|
@ -1906,7 +1906,7 @@ getMaxWellConnections() const
|
||||
|
||||
const auto possibleFutureConnectionSetIt = possibleFutureConnections.find(well.name());
|
||||
if (possibleFutureConnectionSetIt != possibleFutureConnections.end()) {
|
||||
for (auto& global_index : possibleFutureConnectionSetIt->second) {
|
||||
for (const auto& global_index : possibleFutureConnectionSetIt->second) {
|
||||
int compressed_idx = compressedIndexForInterior(global_index);
|
||||
if (compressed_idx >= 0) { // Ignore connections in inactive/remote cells.
|
||||
compressed_well_perforations.push_back(compressed_idx);
|
||||
|
@ -433,7 +433,7 @@ namespace Opm {
|
||||
// have proper multi-phase rates proportional to rates at bhp zero.
|
||||
// This is done only for producers, as injectors will only have a single
|
||||
// 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);
|
||||
if (well->isProducer() && !zero_target) {
|
||||
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)){
|
||||
well->setPrevSurfaceRates(this->wellState(), this->prevWellState());
|
||||
}
|
||||
@ -478,7 +478,7 @@ namespace Opm {
|
||||
auto exc_type = ExceptionType::NONE;
|
||||
// update gpmaint targets
|
||||
if (this->schedule_[reportStepIdx].has_gpmaint()) {
|
||||
for (auto& calculator : regionalAveragePressureCalculator_) {
|
||||
for (const auto& calculator : regionalAveragePressureCalculator_) {
|
||||
calculator.second->template defineState<ElementContext>(simulator_);
|
||||
}
|
||||
const double dt = simulator_.timeStepSize();
|
||||
@ -1641,7 +1641,7 @@ namespace Opm {
|
||||
template <typename TypeTag>
|
||||
void BlackoilWellModel<TypeTag>::
|
||||
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
|
||||
// if a cell is perforated by more than one well, so it should
|
||||
@ -2011,7 +2011,10 @@ namespace Opm {
|
||||
const int iterationIdx,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
this->updateAndCommunicateGroupData(reportStepIdx, iterationIdx, param_.nupcol_group_rate_tolerance_, deferred_logger);
|
||||
this->updateAndCommunicateGroupData(reportStepIdx,
|
||||
iterationIdx,
|
||||
param_.nupcol_group_rate_tolerance_,
|
||||
deferred_logger);
|
||||
|
||||
// updateWellStateWithTarget might throw for multisegment wells hence we
|
||||
// have a parallel try catch here to thrown on all processes.
|
||||
@ -2019,15 +2022,20 @@ namespace Opm {
|
||||
// if a well or group change control it affects all wells that are under the same group
|
||||
for (const auto& well : well_container_) {
|
||||
// We only want to update wells under group-control here
|
||||
auto& ws = this->wellState().well(well->indexOfWell());
|
||||
if (ws.production_cmode == Well::ProducerCMode::GRUP || ws.injection_cmode == Well::InjectorCMode::GRUP) {
|
||||
const auto& ws = this->wellState().well(well->indexOfWell());
|
||||
if (ws.production_cmode == Well::ProducerCMode::GRUP ||
|
||||
ws.injection_cmode == Well::InjectorCMode::GRUP)
|
||||
{
|
||||
well->updateWellStateWithTarget(simulator_, this->groupState(),
|
||||
this->wellState(), deferred_logger);
|
||||
}
|
||||
}
|
||||
OPM_END_PARALLEL_TRY_CATCH("BlackoilWellModel::updateAndCommunicate failed: ",
|
||||
simulator_.gridView().comm())
|
||||
this->updateAndCommunicateGroupData(reportStepIdx, iterationIdx, param_.nupcol_group_rate_tolerance_, deferred_logger);
|
||||
this->updateAndCommunicateGroupData(reportStepIdx,
|
||||
iterationIdx,
|
||||
param_.nupcol_group_rate_tolerance_,
|
||||
deferred_logger);
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
|
@ -1590,7 +1590,7 @@ template<class Scalar>
|
||||
void GasLiftSingleWellGeneric<Scalar>::
|
||||
updateWellStateAlqFixedValue_(const GasLiftWell& well)
|
||||
{
|
||||
auto& max_alq_optional = well.max_rate();
|
||||
const auto& max_alq_optional = well.max_rate();
|
||||
if (max_alq_optional) {
|
||||
// According to WLIFTOPT, item 3:
|
||||
// If item 2 is NO, then item 3 is regarded as the fixed
|
||||
|
@ -215,7 +215,7 @@ void
|
||||
GasLiftSingleWell<TypeTag>::
|
||||
setAlqMaxRate_(const GasLiftWell& well)
|
||||
{
|
||||
auto& max_alq_optional = well.max_rate();
|
||||
const auto& max_alq_optional = well.max_rate();
|
||||
if (max_alq_optional) {
|
||||
// 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.
|
||||
|
@ -474,7 +474,7 @@ recalculateGradientAndUpdateData_(GradPairItr& grad_itr,
|
||||
// only applies to wells in the well_state_map (i.e. wells on this rank)
|
||||
// the grads and other grads are synchronized later
|
||||
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);
|
||||
if (grad) {
|
||||
|
@ -121,7 +121,7 @@ public:
|
||||
// Create a function that calls some function
|
||||
// for all the individual data items to simplify
|
||||
// the further code.
|
||||
auto iterateContainer = [](auto& container, auto& func) {
|
||||
auto iterateContainer = [](auto& container, const auto& func) {
|
||||
for (auto& x : container) {
|
||||
func(x.second);
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
// Now add the cells of the possible future connections
|
||||
const auto possibleFutureConnectionSetIt = possibleFutureConnections.find(well.name());
|
||||
if (possibleFutureConnectionSetIt != possibleFutureConnections.end()) {
|
||||
for (auto& global_index : possibleFutureConnectionSetIt->second) {
|
||||
for (const auto& global_index : possibleFutureConnectionSetIt->second) {
|
||||
int compressed_idx = model_.compressedIndexForInterior(global_index);
|
||||
if (compressed_idx >= 0) { // Ignore connections in inactive/remote cells.
|
||||
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);
|
||||
}
|
||||
|
@ -476,7 +476,7 @@ namespace Opm
|
||||
deferred_logger.info(msg);
|
||||
|
||||
// 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))
|
||||
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>
|
||||
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;
|
||||
Vector<bz> x(rhs.size());
|
||||
@ -131,7 +132,8 @@ testOpenclSolver(Opm::GpuBridge<Matrix<bz>, Vector<bz>, bz>& bridge, Matrix<bz>&
|
||||
|
||||
template <int 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;
|
||||
Vector<bz> x(rhs.size());
|
||||
|
Loading…
Reference in New Issue
Block a user