consistently use std::size_t

This commit is contained in:
Arne Morten Kvarving 2023-08-15 09:32:10 +02:00
parent f806e7668b
commit 92fa9577da
64 changed files with 316 additions and 267 deletions

View File

@ -36,6 +36,7 @@
#include <array> #include <array>
#include <cassert> #include <cassert>
#include <cstddef>
#include <memory> #include <memory>
#include <stdexcept> #include <stdexcept>
#include <vector> #include <vector>
@ -122,7 +123,7 @@ public:
//! \brief loop over all internal data handlers and call scatter for //! \brief loop over all internal data handlers and call scatter for
//! given entity //! given entity
template<class MessageBufferImp, class EntityType> template<class MessageBufferImp, class EntityType>
void scatter(MessageBufferImp& buff, const EntityType& element, size_t /* n */) void scatter(MessageBufferImp& buff, const EntityType& element, std::size_t /* n */)
{ {
int globalIdx = -1; int globalIdx = -1;
buff.read(globalIdx); buff.read(globalIdx);
@ -136,7 +137,7 @@ public:
//! \brief loop over all internal data handlers and return sum of data //! \brief loop over all internal data handlers and return sum of data
//! size of given entity //! size of given entity
template<class EntityType> template<class EntityType>
size_t size(const EntityType& /* en */) const std::size_t size(const EntityType& /* en */) const
{ return 1; } { return 1; }
protected: protected:

View File

@ -36,6 +36,7 @@
#include <opm/output/data/Wells.hpp> #include <opm/output/data/Wells.hpp>
#include <array> #include <array>
#include <cstddef>
#include <map> #include <map>
#include <set> #include <set>
#include <string> #include <string>
@ -133,7 +134,7 @@ public:
bool doesNeedReordering() const bool doesNeedReordering() const
{ return needsReordering;} { return needsReordering;}
size_t numCells () const std::size_t numCells () const
{ return globalCartesianIndex_.size(); } { return globalCartesianIndex_.size(); }
const std::vector<int>& globalRanks() const const std::vector<int>& globalRanks() const

View File

@ -105,10 +105,10 @@ public:
, recv_(recv) , recv_(recv)
, ranks_(ranks) , ranks_(ranks)
{ {
size_t size = globalIndex.size(); std::size_t size = globalIndex.size();
// create mapping globalIndex --> localIndex // create mapping globalIndex --> localIndex
if ( isIORank ) // ioRank if ( isIORank ) // ioRank
for (size_t index = 0; index < size; ++index) for (std::size_t index = 0; index < size; ++index)
globalPosition_.insert(std::make_pair(globalIndex[index], index)); globalPosition_.insert(std::make_pair(globalIndex[index], index));
// we need to create a mapping from local to global // we need to create a mapping from local to global
@ -117,9 +117,9 @@ public:
ranks_.resize(size, -1); ranks_.resize(size, -1);
// for the ioRank create a localIndex to index in global state map // for the ioRank create a localIndex to index in global state map
IndexMapType& indexMap = indexMaps_.back(); IndexMapType& indexMap = indexMaps_.back();
size_t localSize = localIndexMap_.size(); std::size_t localSize = localIndexMap_.size();
indexMap.resize(localSize); indexMap.resize(localSize);
for (size_t i=0; i<localSize; ++i) for (std::size_t i = 0; i < localSize; ++i)
{ {
int id = distributedGlobalIndex_[localIndexMap_[i]]; int id = distributedGlobalIndex_[localIndexMap_[i]];
indexMap[i] = id; indexMap[i] = id;
@ -285,7 +285,7 @@ public:
data::Solution& globalCellData, data::Solution& globalCellData,
const IndexMapType& localIndexMap, const IndexMapType& localIndexMap,
const IndexMapStorageType& indexMaps, const IndexMapStorageType& indexMaps,
size_t globalSize, std::size_t globalSize,
bool isIORank) bool isIORank)
: localCellData_(localCellData) : localCellData_(localCellData)
, globalCellData_(globalCellData) , globalCellData_(globalCellData)
@ -505,7 +505,7 @@ public:
// read all block data // read all block data
unsigned int size = 0; unsigned int size = 0;
buffer.read(size); buffer.read(size);
for (size_t i = 0; i < size; ++i) { for (std::size_t i = 0; i < size; ++i) {
std::string name; std::string name;
int idx; int idx;
double data; double data;
@ -879,7 +879,7 @@ CollectDataToIORank(const Grid& grid, const EquilGrid* equilGrid,
// We need a mapping from local to global grid, here we // We need a mapping from local to global grid, here we
// use equilGrid which represents a view on the global grid // use equilGrid which represents a view on the global grid
// reserve memory // reserve memory
const size_t globalSize = equilGrid->leafGridView().size(0); const std::size_t globalSize = equilGrid->leafGridView().size(0);
globalCartesianIndex_.resize(globalSize, -1); globalCartesianIndex_.resize(globalSize, -1);
const EquilGridView equilGridView = equilGrid->leafGridView(); const EquilGridView equilGridView = equilGrid->leafGridView();
@ -926,7 +926,7 @@ CollectDataToIORank(const Grid& grid, const EquilGrid* equilGrid,
} }
localIndexMap_.clear(); localIndexMap_.clear();
const size_t gridSize = grid.size(0); const std::size_t gridSize = grid.size(0);
localIndexMap_.reserve(gridSize); localIndexMap_.reserve(gridSize);
// store the local Cartesian index // store the local Cartesian index

View File

@ -44,6 +44,7 @@
#include <opm/simulators/utils/ParallelEclipseState.hpp> #include <opm/simulators/utils/ParallelEclipseState.hpp>
#include <array> #include <array>
#include <cstddef>
#include <memory> #include <memory>
#include <tuple> #include <tuple>
#include <vector> #include <vector>
@ -331,7 +332,7 @@ protected:
grid_ = factory_->convert(*equilGrid_, cartesianCellId_, ordering_); grid_ = factory_->convert(*equilGrid_, cartesianCellId_, ordering_);
OpmLog::warning("Space Filling Curve Ordering is not yet supported: DISABLE_ALUGRID_SFC_ORDERING is enabled"); OpmLog::warning("Space Filling Curve Ordering is not yet supported: DISABLE_ALUGRID_SFC_ORDERING is enabled");
equilGridToGrid_.resize(ordering_.size()); equilGridToGrid_.resize(ordering_.size());
for (size_t index = 0; index<ordering_.size(); ++index) { for (std::size_t index = 0; index < ordering_.size(); ++index) {
equilGridToGrid_[ordering_[index]] = index; equilGridToGrid_[ordering_[index]] = index;
} }

View File

@ -43,6 +43,7 @@
#include <opm/simulators/flow/BlackoilModelParametersEbos.hpp> #include <opm/simulators/flow/BlackoilModelParametersEbos.hpp>
#include <array> #include <array>
#include <cstddef>
#include <optional> #include <optional>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
@ -503,7 +504,7 @@ protected:
void updateCartesianToCompressedMapping_() void updateCartesianToCompressedMapping_()
{ {
size_t num_cells = asImp_().grid().leafGridView().size(0); std::size_t num_cells = asImp_().grid().leafGridView().size(0);
is_interior_.resize(num_cells); is_interior_.resize(num_cells);
ElementMapper elemMapper(this->gridView(), Dune::mcmgElementLayout()); ElementMapper elemMapper(this->gridView(), Dune::mcmgElementLayout());

View File

@ -223,7 +223,7 @@ EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
template<class FluidSystem, class Scalar> template<class FluidSystem, class Scalar>
void EclGenericOutputBlackoilModule<FluidSystem,Scalar>:: void EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
outputCumLog(size_t reportStepNum, const bool substep, bool forceDisableCumOutput) outputCumLog(std::size_t reportStepNum, const bool substep, bool forceDisableCumOutput)
{ {
if (!substep && !forceDisableCumOutput) { if (!substep && !forceDisableCumOutput) {
logOutput_.cumulative(reportStepNum, logOutput_.cumulative(reportStepNum,
@ -234,7 +234,7 @@ outputCumLog(size_t reportStepNum, const bool substep, bool forceDisableCumOutpu
template<class FluidSystem,class Scalar> template<class FluidSystem,class Scalar>
void EclGenericOutputBlackoilModule<FluidSystem,Scalar>:: void EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
outputProdLog(size_t reportStepNum, outputProdLog(std::size_t reportStepNum,
const bool substep, const bool substep,
bool forceDisableProdOutput) bool forceDisableProdOutput)
{ {
@ -247,7 +247,7 @@ outputProdLog(size_t reportStepNum,
template<class FluidSystem,class Scalar> template<class FluidSystem,class Scalar>
void EclGenericOutputBlackoilModule<FluidSystem,Scalar>:: void EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
outputInjLog(size_t reportStepNum, const bool substep, bool forceDisableInjOutput) outputInjLog(std::size_t reportStepNum, const bool substep, bool forceDisableInjOutput)
{ {
if (!substep && !forceDisableInjOutput) { if (!substep && !forceDisableInjOutput) {
logOutput_.injection(reportStepNum, logOutput_.injection(reportStepNum,
@ -302,7 +302,7 @@ outputFipresvLog(std::map<std::string, double>& miscSummaryData,
template<class FluidSystem,class Scalar> template<class FluidSystem,class Scalar>
void EclGenericOutputBlackoilModule<FluidSystem,Scalar>:: void EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
addRftDataToWells(data::Wells& wellDatas, size_t reportStepNum) addRftDataToWells(data::Wells& wellDatas, std::size_t reportStepNum)
{ {
const auto& rft_config = schedule_[reportStepNum].rft_config(); const auto& rft_config = schedule_[reportStepNum].rft_config();
for (const auto& well: schedule_.getWells(reportStepNum)) { for (const auto& well: schedule_.getWells(reportStepNum)) {
@ -320,13 +320,13 @@ addRftDataToWells(data::Wells& wellDatas, size_t reportStepNum)
continue; continue;
wellData.connections.resize(well.getConnections().size()); wellData.connections.resize(well.getConnections().size());
size_t count = 0; std::size_t count = 0;
for (const auto& connection: well.getConnections()) { for (const auto& connection: well.getConnections()) {
const size_t i = size_t(connection.getI()); const std::size_t i = std::size_t(connection.getI());
const size_t j = size_t(connection.getJ()); const std::size_t j = std::size_t(connection.getJ());
const size_t k = size_t(connection.getK()); const std::size_t k = std::size_t(connection.getK());
const size_t index = eclState_.gridDims().getGlobalIndex(i, j, k); const std::size_t index = eclState_.gridDims().getGlobalIndex(i, j, k);
auto& connectionData = wellData.connections[count]; auto& connectionData = wellData.connections[count];
connectionData.index = index; connectionData.index = index;
count++; count++;
@ -617,7 +617,7 @@ typename EclGenericOutputBlackoilModule<FluidSystem,Scalar>::ScalarBuffer
EclGenericOutputBlackoilModule<FluidSystem,Scalar>:: EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
regionSum(const ScalarBuffer& property, regionSum(const ScalarBuffer& property,
const std::vector<int>& regionId, const std::vector<int>& regionId,
size_t maxNumberOfRegions, std::size_t maxNumberOfRegions,
const Parallel::Communication& comm) const Parallel::Communication& comm)
{ {
ScalarBuffer totals(maxNumberOfRegions, 0.0); ScalarBuffer totals(maxNumberOfRegions, 0.0);
@ -626,7 +626,7 @@ regionSum(const ScalarBuffer& property,
return totals; return totals;
assert(regionId.size() == property.size()); assert(regionId.size() == property.size());
for (size_t j = 0; j < regionId.size(); ++j) { for (std::size_t j = 0; j < regionId.size(); ++j) {
const int regionIdx = regionId[j] - 1; const int regionIdx = regionId[j] - 1;
// the cell is not attributed to any region. ignore it! // the cell is not attributed to any region. ignore it!
if (regionIdx < 0) if (regionIdx < 0)
@ -636,7 +636,7 @@ regionSum(const ScalarBuffer& property,
totals[regionIdx] += property[j]; totals[regionIdx] += property[j];
} }
for (size_t i = 0; i < maxNumberOfRegions; ++i) for (std::size_t i = 0; i < maxNumberOfRegions; ++i)
totals[i] = comm.sum(totals[i]); totals[i] = comm.sum(totals[i]);
return totals; return totals;
@ -721,10 +721,10 @@ doAllocBuffers(unsigned bufferSize,
continue; continue;
for (const auto& connection: well.getConnections()) { for (const auto& connection: well.getConnections()) {
const size_t i = size_t(connection.getI()); const std::size_t i = std::size_t(connection.getI());
const size_t j = size_t(connection.getJ()); const std::size_t j = std::size_t(connection.getJ());
const size_t k = size_t(connection.getK()); const std::size_t k = std::size_t(connection.getK());
const size_t index = eclState_.gridDims().getGlobalIndex(i, j, k); const std::size_t index = eclState_.gridDims().getGlobalIndex(i, j, k);
if (FluidSystem::phaseIsActive(oilPhaseIdx)) if (FluidSystem::phaseIsActive(oilPhaseIdx))
oilConnectionPressures_.emplace(std::make_pair(index, 0.0)); oilConnectionPressures_.emplace(std::make_pair(index, 0.0));

View File

@ -32,6 +32,7 @@
#include <opm/simulators/utils/ParallelCommunication.hpp> #include <opm/simulators/utils/ParallelCommunication.hpp>
#include <array> #include <array>
#include <cstddef>
#include <functional> #include <functional>
#include <map> #include <map>
#include <numeric> #include <numeric>
@ -62,17 +63,17 @@ public:
}; };
// write cumulative production and injection reports to output // write cumulative production and injection reports to output
void outputCumLog(size_t reportStepNum, void outputCumLog(std::size_t reportStepNum,
const bool substep, const bool substep,
bool forceDisableCumOutput); bool forceDisableCumOutput);
// write production report to output // write production report to output
void outputProdLog(size_t reportStepNum, void outputProdLog(std::size_t reportStepNum,
const bool substep, const bool substep,
bool forceDisableProdOutput); bool forceDisableProdOutput);
// write injection report to output // write injection report to output
void outputInjLog(size_t reportStepNum, void outputInjLog(std::size_t reportStepNum,
const bool substep, const bool substep,
bool forceDisableInjOutput); bool forceDisableInjOutput);
@ -93,7 +94,7 @@ public:
void outputErrorLog(const Parallel::Communication& comm) const; void outputErrorLog(const Parallel::Communication& comm) const;
void addRftDataToWells(data::Wells& wellDatas, void addRftDataToWells(data::Wells& wellDatas,
size_t reportStepNum); std::size_t reportStepNum);
/*! /*!
* \brief Move all buffers to data::Solution. * \brief Move all buffers to data::Solution.
@ -445,9 +446,9 @@ protected:
std::array<std::pair<std::string, std::pair<std::vector<int>, ScalarBuffer>>, 3> floresn_; std::array<std::pair<std::string, std::pair<std::vector<int>, ScalarBuffer>>, 3> floresn_;
std::array<std::pair<std::string, std::pair<std::vector<int>, ScalarBuffer>>, 3> flowsn_; std::array<std::pair<std::string, std::pair<std::vector<int>, ScalarBuffer>>, 3> flowsn_;
std::map<size_t, Scalar> oilConnectionPressures_; std::map<std::size_t, Scalar> oilConnectionPressures_;
std::map<size_t, Scalar> waterConnectionSaturations_; std::map<std::size_t, Scalar> waterConnectionSaturations_;
std::map<size_t, Scalar> gasConnectionSaturations_; std::map<std::size_t, Scalar> gasConnectionSaturations_;
std::map<std::pair<std::string, int>, double> blockData_; std::map<std::pair<std::string, int>, double> blockData_;
std::optional<Inplace> initialInplace_; std::optional<Inplace> initialInplace_;

View File

@ -35,6 +35,7 @@
#include <opm/material/common/Tabulated1DFunction.hpp> #include <opm/material/common/Tabulated1DFunction.hpp>
#include <array> #include <array>
#include <cstddef>
#include <functional> #include <functional>
#include <set> #include <set>
#include <string> #include <string>
@ -327,7 +328,7 @@ protected:
std::function<std::array<int,3>(const unsigned)> ijkIndex); std::function<std::array<int,3>(const unsigned)> ijkIndex);
void readRockCompactionParameters_(); void readRockCompactionParameters_();
void readBlackoilExtentionsInitialConditions_(size_t numDof, void readBlackoilExtentionsInitialConditions_(std::size_t numDof,
bool enableSolvent, bool enableSolvent,
bool enablePolymer, bool enablePolymer,
bool enablePolymerMolarWeight, bool enablePolymerMolarWeight,
@ -389,7 +390,7 @@ protected:
private: private:
template<class T> template<class T>
void updateNum(const std::string& name, std::vector<T>& numbers, size_t num_regions); void updateNum(const std::string& name, std::vector<T>& numbers, std::size_t num_regions);
}; };
} // namespace Opm } // namespace Opm

View File

@ -54,7 +54,7 @@ int eclPositionalParameter(Dune::ParameterTree& tree,
int paramIdx) int paramIdx)
{ {
std::string param = argv[paramIdx]; std::string param = argv[paramIdx];
size_t i = param.find('='); std::size_t i = param.find('=');
if (i != std::string::npos) { if (i != std::string::npos) {
std::string oldParamName = param.substr(0, i); std::string oldParamName = param.substr(0, i);
std::string oldParamValue = param.substr(i+1); std::string oldParamValue = param.substr(i+1);
@ -167,7 +167,7 @@ readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
if (eclState_.fieldProps().has_int(rock_config.rocknum_property())) { if (eclState_.fieldProps().has_int(rock_config.rocknum_property())) {
rockTableIdx_.resize(numElem); rockTableIdx_.resize(numElem);
const auto& num = eclState_.fieldProps().get_int(rock_config.rocknum_property()); const auto& num = eclState_.fieldProps().get_int(rock_config.rocknum_property());
for (size_t elemIdx = 0; elemIdx < numElem; ++ elemIdx) { for (std::size_t elemIdx = 0; elemIdx < numElem; ++ elemIdx) {
rockTableIdx_[elemIdx] = num[elemIdx] - 1; rockTableIdx_[elemIdx] = num[elemIdx] - 1;
auto fmtError = auto fmtError =
[&num,elemIdx,&ijkIndex,&rock_config](const char* type, std::size_t size) [&num,elemIdx,&ijkIndex,&rock_config](const char* type, std::size_t size)
@ -194,18 +194,18 @@ readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
const auto& overburdTables = eclState_.getTableManager().getOverburdTables(); const auto& overburdTables = eclState_.getTableManager().getOverburdTables();
if (!overburdTables.empty()) { if (!overburdTables.empty()) {
overburdenPressure_.resize(numElem,0.0); overburdenPressure_.resize(numElem,0.0);
size_t numRocktabTables = rock_config.num_rock_tables(); std::size_t numRocktabTables = rock_config.num_rock_tables();
if (overburdTables.size() != numRocktabTables) if (overburdTables.size() != numRocktabTables)
throw std::runtime_error(std::to_string(numRocktabTables) +" OVERBURD tables is expected, but " + std::to_string(overburdTables.size()) +" is provided"); throw std::runtime_error(std::to_string(numRocktabTables) +" OVERBURD tables is expected, but " + std::to_string(overburdTables.size()) +" is provided");
std::vector<Tabulated1DFunction<Scalar>> overburdenTables(numRocktabTables); std::vector<Tabulated1DFunction<Scalar>> overburdenTables(numRocktabTables);
for (size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) { for (std::size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) {
const OverburdTable& overburdTable = overburdTables.template getTable<OverburdTable>(regionIdx); const OverburdTable& overburdTable = overburdTables.template getTable<OverburdTable>(regionIdx);
overburdenTables[regionIdx].setXYContainers(overburdTable.getDepthColumn(),overburdTable.getOverburdenPressureColumn()); overburdenTables[regionIdx].setXYContainers(overburdTable.getDepthColumn(),overburdTable.getOverburdenPressureColumn());
} }
for (size_t elemIdx = 0; elemIdx < numElem; ++ elemIdx) { for (std::size_t elemIdx = 0; elemIdx < numElem; ++ elemIdx) {
unsigned tableIdx = 0; unsigned tableIdx = 0;
if (!rockTableIdx_.empty()) { if (!rockTableIdx_.empty()) {
tableIdx = rockTableIdx_[elemIdx]; tableIdx = rockTableIdx_[elemIdx];
@ -237,7 +237,7 @@ readRockCompactionParameters_()
throw std::runtime_error("Not support ROCKOMP hysteresis option "); throw std::runtime_error("Not support ROCKOMP hysteresis option ");
} }
size_t numRocktabTables = rock_config.num_rock_tables(); std::size_t numRocktabTables = rock_config.num_rock_tables();
bool waterCompaction = rock_config.water_compaction(); bool waterCompaction = rock_config.water_compaction();
if (!waterCompaction) { if (!waterCompaction) {
@ -248,7 +248,7 @@ readRockCompactionParameters_()
rockCompPoroMult_.resize(numRocktabTables); rockCompPoroMult_.resize(numRocktabTables);
rockCompTransMult_.resize(numRocktabTables); rockCompTransMult_.resize(numRocktabTables);
for (size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) { for (std::size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) {
const auto& rocktabTable = rocktabTables.template getTable<RocktabTable>(regionIdx); const auto& rocktabTable = rocktabTables.template getTable<RocktabTable>(regionIdx);
const auto& pressureColumn = rocktabTable.getPressureColumn(); const auto& pressureColumn = rocktabTable.getPressureColumn();
const auto& poroColumn = rocktabTable.getPoreVolumeMultiplierColumn(); const auto& poroColumn = rocktabTable.getPoreVolumeMultiplierColumn();
@ -271,16 +271,16 @@ readRockCompactionParameters_()
+" ROCKWNOD tables is expected, but " + std::to_string(rockwnodTables.size()) +" is provided"); +" ROCKWNOD tables is expected, but " + std::to_string(rockwnodTables.size()) +" is provided");
//TODO check size match //TODO check size match
rockCompPoroMultWc_.resize(numRocktabTables, TabulatedTwoDFunction(TabulatedTwoDFunction::InterpolationPolicy::Vertical)); rockCompPoroMultWc_.resize(numRocktabTables, TabulatedTwoDFunction(TabulatedTwoDFunction::InterpolationPolicy::Vertical));
for (size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) { for (std::size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) {
const RockwnodTable& rockwnodTable = rockwnodTables.template getTable<RockwnodTable>(regionIdx); const RockwnodTable& rockwnodTable = rockwnodTables.template getTable<RockwnodTable>(regionIdx);
const auto& rock2dTable = rock2dTables[regionIdx]; const auto& rock2dTable = rock2dTables[regionIdx];
if (rockwnodTable.getSaturationColumn().size() != rock2dTable.sizeMultValues()) if (rockwnodTable.getSaturationColumn().size() != rock2dTable.sizeMultValues())
throw std::runtime_error("Number of entries in ROCKWNOD and ROCK2D needs to match."); throw std::runtime_error("Number of entries in ROCKWNOD and ROCK2D needs to match.");
for (size_t xIdx = 0; xIdx < rock2dTable.size(); ++xIdx) { for (std::size_t xIdx = 0; xIdx < rock2dTable.size(); ++xIdx) {
rockCompPoroMultWc_[regionIdx].appendXPos(rock2dTable.getPressureValue(xIdx)); rockCompPoroMultWc_[regionIdx].appendXPos(rock2dTable.getPressureValue(xIdx));
for (size_t yIdx = 0; yIdx < rockwnodTable.getSaturationColumn().size(); ++yIdx) for (std::size_t yIdx = 0; yIdx < rockwnodTable.getSaturationColumn().size(); ++yIdx)
rockCompPoroMultWc_[regionIdx].appendSamplePoint(xIdx, rockCompPoroMultWc_[regionIdx].appendSamplePoint(xIdx,
rockwnodTable.getSaturationColumn()[yIdx], rockwnodTable.getSaturationColumn()[yIdx],
rock2dTable.getPvmultValue(xIdx, yIdx)); rock2dTable.getPvmultValue(xIdx, yIdx));
@ -289,16 +289,16 @@ readRockCompactionParameters_()
if (!rock2dtrTables.empty()) { if (!rock2dtrTables.empty()) {
rockCompTransMultWc_.resize(numRocktabTables, TabulatedTwoDFunction(TabulatedTwoDFunction::InterpolationPolicy::Vertical)); rockCompTransMultWc_.resize(numRocktabTables, TabulatedTwoDFunction(TabulatedTwoDFunction::InterpolationPolicy::Vertical));
for (size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) { for (std::size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) {
const RockwnodTable& rockwnodTable = rockwnodTables.template getTable<RockwnodTable>(regionIdx); const RockwnodTable& rockwnodTable = rockwnodTables.template getTable<RockwnodTable>(regionIdx);
const auto& rock2dtrTable = rock2dtrTables[regionIdx]; const auto& rock2dtrTable = rock2dtrTables[regionIdx];
if (rockwnodTable.getSaturationColumn().size() != rock2dtrTable.sizeMultValues()) if (rockwnodTable.getSaturationColumn().size() != rock2dtrTable.sizeMultValues())
throw std::runtime_error("Number of entries in ROCKWNOD and ROCK2DTR needs to match."); throw std::runtime_error("Number of entries in ROCKWNOD and ROCK2DTR needs to match.");
for (size_t xIdx = 0; xIdx < rock2dtrTable.size(); ++xIdx) { for (std::size_t xIdx = 0; xIdx < rock2dtrTable.size(); ++xIdx) {
rockCompTransMultWc_[regionIdx].appendXPos(rock2dtrTable.getPressureValue(xIdx)); rockCompTransMultWc_[regionIdx].appendXPos(rock2dtrTable.getPressureValue(xIdx));
for (size_t yIdx = 0; yIdx < rockwnodTable.getSaturationColumn().size(); ++yIdx) for (std::size_t yIdx = 0; yIdx < rockwnodTable.getSaturationColumn().size(); ++yIdx)
rockCompTransMultWc_[regionIdx].appendSamplePoint(xIdx, rockCompTransMultWc_[regionIdx].appendSamplePoint(xIdx,
rockwnodTable.getSaturationColumn()[yIdx], rockwnodTable.getSaturationColumn()[yIdx],
rock2dtrTable.getTransMultValue(xIdx, yIdx)); rock2dtrTable.getTransMultValue(xIdx, yIdx));
@ -360,7 +360,7 @@ rockFraction(unsigned elementIdx, unsigned timeIdx) const
template<class GridView, class FluidSystem, class Scalar> template<class GridView, class FluidSystem, class Scalar>
template<class T> template<class T>
void EclGenericProblem<GridView,FluidSystem,Scalar>:: void EclGenericProblem<GridView,FluidSystem,Scalar>::
updateNum(const std::string& name, std::vector<T>& numbers, size_t num_regions) updateNum(const std::string& name, std::vector<T>& numbers, std::size_t num_regions)
{ {
if (!eclState_.fieldProps().has_int(name)) if (!eclState_.fieldProps().has_int(name))
return; return;
@ -517,7 +517,7 @@ initFluidSystem_()
template<class GridView, class FluidSystem, class Scalar> template<class GridView, class FluidSystem, class Scalar>
void EclGenericProblem<GridView,FluidSystem,Scalar>:: void EclGenericProblem<GridView,FluidSystem,Scalar>::
readBlackoilExtentionsInitialConditions_(size_t numDof, readBlackoilExtentionsInitialConditions_(std::size_t numDof,
bool enableSolvent, bool enableSolvent,
bool enablePolymer, bool enablePolymer,
bool enablePolymerMolarWeight, bool enablePolymerMolarWeight,

View File

@ -40,6 +40,7 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <cstddef>
#include <limits> #include <limits>
#include <stdexcept> #include <stdexcept>
@ -217,13 +218,13 @@ configureThpresft_()
int numCartesianElem = eclState_.getInputGrid().getCartesianSize(); int numCartesianElem = eclState_.getInputGrid().getCartesianSize();
thpresftValues_.resize(numFaults, -1.0); thpresftValues_.resize(numFaults, -1.0);
cartElemFaultIdx_.resize(numCartesianElem, -1); cartElemFaultIdx_.resize(numCartesianElem, -1);
for (size_t faultIdx = 0; faultIdx < faults.size(); faultIdx++) { for (std::size_t faultIdx = 0; faultIdx < faults.size(); faultIdx++) {
auto& fault = faults.getFault(faultIdx); 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
// indices, but we go with the conventions of the parser here... // indices, but we go with the conventions of the parser here...
for (size_t cartElemIdx : face) for (std::size_t cartElemIdx : face)
cartElemFaultIdx_[cartElemIdx] = faultIdx; cartElemFaultIdx_[cartElemIdx] = faultIdx;
} }
} }

View File

@ -37,6 +37,7 @@
#include <opm/simulators/linalg/matrixblock.hh> #include <opm/simulators/linalg/matrixblock.hh>
#include <array> #include <array>
#include <cstddef>
#include <functional> #include <functional>
#include <map> #include <map>
#include <memory> #include <memory>
@ -97,10 +98,10 @@ protected:
* \brief Initialize all internal data structures needed by the tracer module * \brief Initialize all internal data structures needed by the tracer module
*/ */
void doInit(bool rst, void doInit(bool rst,
size_t numGridDof, std::size_t numGridDof,
size_t gasPhaseIdx, std::size_t gasPhaseIdx,
size_t oilPhaseIdx, std::size_t oilPhaseIdx,
size_t waterPhaseIdx); std::size_t waterPhaseIdx);
bool linearSolve_(const TracerMatrix& M, TracerVector& x, TracerVector& b); bool linearSolve_(const TracerMatrix& M, TracerVector& x, TracerVector& b);

View File

@ -161,8 +161,8 @@ name(int tracerIdx) const
template<class Grid,class GridView, class DofMapper, class Stencil, class Scalar> template<class Grid,class GridView, class DofMapper, class Stencil, class Scalar>
void EclGenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>:: void EclGenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
doInit(bool rst, size_t numGridDof, doInit(bool rst, std::size_t numGridDof,
size_t gasPhaseIdx, size_t oilPhaseIdx, size_t waterPhaseIdx) std::size_t gasPhaseIdx, std::size_t oilPhaseIdx, std::size_t waterPhaseIdx)
{ {
const auto& tracers = eclState_.tracer(); const auto& tracers = eclState_.tracer();
@ -170,13 +170,13 @@ doInit(bool rst, size_t numGridDof,
return; // tracer treatment is supposed to be disabled return; // tracer treatment is supposed to be disabled
// retrieve the number of tracers from the deck // retrieve the number of tracers from the deck
const size_t numTracers = tracers.size(); const std::size_t numTracers = tracers.size();
tracerConcentration_.resize(numTracers); tracerConcentration_.resize(numTracers);
storageOfTimeIndex1_.resize(numTracers); storageOfTimeIndex1_.resize(numTracers);
// the phase where the tracer is // the phase where the tracer is
tracerPhaseIdx_.resize(numTracers); tracerPhaseIdx_.resize(numTracers);
for (size_t tracerIdx = 0; tracerIdx < numTracers; tracerIdx++) { for (std::size_t tracerIdx = 0; tracerIdx < numTracers; tracerIdx++) {
const auto& tracer = tracers[tracerIdx]; const auto& tracer = tracers[tracerIdx];
if (tracer.phase == Phase::WATER) if (tracer.phase == Phase::WATER)
@ -200,7 +200,7 @@ doInit(bool rst, size_t numGridDof,
if (tblkDatasize < cartMapper_.cartesianSize()){ if (tblkDatasize < cartMapper_.cartesianSize()){
throw std::runtime_error("Wrong size of TBLK for" + tracer.name); throw std::runtime_error("Wrong size of TBLK for" + tracer.name);
} }
for (size_t globalDofIdx = 0; globalDofIdx < numGridDof; ++globalDofIdx){ for (std::size_t globalDofIdx = 0; globalDofIdx < numGridDof; ++globalDofIdx) {
int cartDofIdx = cartMapper_.cartesianIndex(globalDofIdx); int cartDofIdx = cartMapper_.cartesianIndex(globalDofIdx);
tracerConcentration_[tracerIdx][globalDofIdx] = free_concentration[cartDofIdx]; tracerConcentration_[tracerIdx][globalDofIdx] = free_concentration[cartDofIdx];
} }
@ -208,7 +208,7 @@ doInit(bool rst, size_t numGridDof,
//TVDPF keyword //TVDPF keyword
else if (tracer.free_tvdp.has_value()) { else if (tracer.free_tvdp.has_value()) {
const auto& free_tvdp = tracer.free_tvdp.value(); const auto& free_tvdp = tracer.free_tvdp.value();
for (size_t globalDofIdx = 0; globalDofIdx < numGridDof; ++globalDofIdx){ for (std::size_t globalDofIdx = 0; globalDofIdx < numGridDof; ++globalDofIdx) {
tracerConcentration_[tracerIdx][globalDofIdx] = tracerConcentration_[tracerIdx][globalDofIdx] =
free_tvdp.evaluate("TRACER_CONCENTRATION", free_tvdp.evaluate("TRACER_CONCENTRATION",
centroids_(globalDofIdx)[2]); centroids_(globalDofIdx)[2]);
@ -339,7 +339,7 @@ linearSolveBatchwise_(const TracerMatrix& M, std::vector<TracerVector>& x, std::
createParallelFlexibleSolver<TracerVector>(gridView_.grid(), M, prm); createParallelFlexibleSolver<TracerVector>(gridView_.grid(), M, prm);
(void) tracerOperator; (void) tracerOperator;
bool converged = true; bool converged = true;
for (size_t nrhs =0; nrhs < b.size(); ++nrhs) { for (std::size_t nrhs = 0; nrhs < b.size(); ++nrhs) {
x[nrhs] = 0.0; x[nrhs] = 0.0;
Dune::InverseOperatorResult result; Dune::InverseOperatorResult result;
solver->apply(x[nrhs], b[nrhs], result); solver->apply(x[nrhs], b[nrhs], result);
@ -364,7 +364,7 @@ linearSolveBatchwise_(const TracerMatrix& M, std::vector<TracerVector>& x, std::
verbosity); verbosity);
bool converged = true; bool converged = true;
for (size_t nrhs =0; nrhs < b.size(); ++nrhs) { for (std::size_t nrhs = 0; nrhs < b.size(); ++nrhs) {
x[nrhs] = 0.0; x[nrhs] = 0.0;
Dune::InverseOperatorResult result; Dune::InverseOperatorResult result;
solver.apply(x[nrhs], b[nrhs], result); solver.apply(x[nrhs], b[nrhs], result);

View File

@ -1241,7 +1241,7 @@ private:
void createLocalRegion_(std::vector<int>& region) void createLocalRegion_(std::vector<int>& region)
{ {
size_t elemIdx = 0; std::size_t elemIdx = 0;
for (const auto& elem : elements(simulator_.gridView())) { for (const auto& elem : elements(simulator_.gridView())) {
if (elem.partitionType() != Dune::InteriorEntity) if (elem.partitionType() != Dune::InteriorEntity)
region[elemIdx] = 0; region[elemIdx] = 0;

View File

@ -1679,7 +1679,7 @@ protected:
const auto& model = this->simulator().model(); const auto& model = this->simulator().model();
const auto& primaryVars = model.solution(/*timeIdx*/0); const auto& primaryVars = model.solution(/*timeIdx*/0);
const auto& vanguard = this->simulator().vanguard(); const auto& vanguard = this->simulator().vanguard();
size_t numGridDof = primaryVars.size(); std::size_t numGridDof = primaryVars.size();
OPM_BEGIN_PARALLEL_TRY_CATCH(); OPM_BEGIN_PARALLEL_TRY_CATCH();
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp parallel for #pragma omp parallel for
@ -1869,14 +1869,14 @@ protected:
const auto& vanguard = simulator.vanguard(); const auto& vanguard = simulator.vanguard();
const auto& eclState = vanguard.eclState(); const auto& eclState = vanguard.eclState();
size_t numDof = this->model().numGridDof(); std::size_t numDof = this->model().numGridDof();
this->referencePorosity_[/*timeIdx=*/0].resize(numDof); this->referencePorosity_[/*timeIdx=*/0].resize(numDof);
const auto& fp = eclState.fieldProps(); const auto& fp = eclState.fieldProps();
const std::vector<double> porvData = fp.porv(false); const std::vector<double> porvData = fp.porv(false);
const std::vector<int> actnumData = fp.actnum(); const std::vector<int> actnumData = fp.actnum();
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) { for (std::size_t dofIdx = 0; dofIdx < numDof; ++dofIdx) {
Scalar poreVolume = porvData[dofIdx]; Scalar poreVolume = porvData[dofIdx];
// we define the porosity as the accumulated pore volume divided by the // we define the porosity as the accumulated pore volume divided by the
@ -1907,8 +1907,8 @@ protected:
enableMICP); enableMICP);
//initialize min/max values //initialize min/max values
size_t numElems = this->model().numGridDof(); std::size_t numElems = this->model().numGridDof();
for (size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) { for (std::size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) {
const auto& fs = initialFluidStates_[elemIdx]; const auto& fs = initialFluidStates_[elemIdx];
if (!this->maxWaterSaturation_.empty()) if (!this->maxWaterSaturation_.empty())
this->maxWaterSaturation_[elemIdx] = std::max(this->maxWaterSaturation_[elemIdx], fs.saturation(waterPhaseIdx)); this->maxWaterSaturation_[elemIdx] = std::max(this->maxWaterSaturation_[elemIdx], fs.saturation(waterPhaseIdx));
@ -1929,9 +1929,9 @@ protected:
using EquilInitializer = EclEquilInitializer<TypeTag>; using EquilInitializer = EclEquilInitializer<TypeTag>;
EquilInitializer equilInitializer(simulator, *materialLawManager_); EquilInitializer equilInitializer(simulator, *materialLawManager_);
size_t numElems = this->model().numGridDof(); std::size_t numElems = this->model().numGridDof();
initialFluidStates_.resize(numElems); initialFluidStates_.resize(numElems);
for (size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) { for (std::size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) {
auto& elemFluidState = initialFluidStates_[elemIdx]; auto& elemFluidState = initialFluidStates_[elemIdx];
elemFluidState.assign(equilInitializer.initialFluidState(elemIdx)); elemFluidState.assign(equilInitializer.initialFluidState(elemIdx));
} }
@ -1958,7 +1958,7 @@ protected:
Scalar dt = std::min(eclWriter_->restartTimeStepSize(), simulator.episodeLength()); Scalar dt = std::min(eclWriter_->restartTimeStepSize(), simulator.episodeLength());
simulator.setTimeStepSize(dt); simulator.setTimeStepSize(dt);
size_t numElems = this->model().numGridDof(); std::size_t numElems = this->model().numGridDof();
initialFluidStates_.resize(numElems); initialFluidStates_.resize(numElems);
if constexpr (enableSolvent) if constexpr (enableSolvent)
this->solventSaturation_.resize(numElems, 0.0); this->solventSaturation_.resize(numElems, 0.0);
@ -1978,7 +1978,7 @@ protected:
this->micp_.resize(numElems); this->micp_.resize(numElems);
} }
for (size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) { for (std::size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) {
auto& elemFluidState = initialFluidStates_[elemIdx]; auto& elemFluidState = initialFluidStates_[elemIdx];
elemFluidState.setPvtRegionIndex(pvtRegionIndex(elemIdx)); elemFluidState.setPvtRegionIndex(pvtRegionIndex(elemIdx));
eclWriter_->eclOutputModule().initHysteresisParams(simulator, elemIdx); eclWriter_->eclOutputModule().initHysteresisParams(simulator, elemIdx);
@ -2046,7 +2046,7 @@ protected:
// this is used to recover some RESTART running with the defaulted single-precision format // this is used to recover some RESTART running with the defaulted single-precision format
const Scalar smallSaturationTolerance = 1.e-6; const Scalar smallSaturationTolerance = 1.e-6;
Scalar sumSaturation = 0.0; Scalar sumSaturation = 0.0;
for (size_t phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { for (std::size_t phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
if (FluidSystem::phaseIsActive(phaseIdx)) { if (FluidSystem::phaseIsActive(phaseIdx)) {
if (elemFluidState.saturation(phaseIdx) < smallSaturationTolerance) if (elemFluidState.saturation(phaseIdx) < smallSaturationTolerance)
elemFluidState.setSaturation(phaseIdx, 0.0); elemFluidState.setSaturation(phaseIdx, 0.0);
@ -2064,7 +2064,7 @@ protected:
assert(sumSaturation > 0.0); assert(sumSaturation > 0.0);
for (size_t phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { for (std::size_t phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
if (FluidSystem::phaseIsActive(phaseIdx)) { if (FluidSystem::phaseIsActive(phaseIdx)) {
const Scalar saturation = elemFluidState.saturation(phaseIdx) / sumSaturation; const Scalar saturation = elemFluidState.saturation(phaseIdx) / sumSaturation;
elemFluidState.setSaturation(phaseIdx, saturation); elemFluidState.setSaturation(phaseIdx, saturation);
@ -2118,7 +2118,7 @@ protected:
throw std::runtime_error("The ECL input file requires the SALTP keyword to be present if" throw std::runtime_error("The ECL input file requires the SALTP keyword to be present if"
" salt precipitation is enabled and the model is initialized explicitly"); " salt precipitation is enabled and the model is initialized explicitly");
size_t numDof = this->model().numGridDof(); std::size_t numDof = this->model().numGridDof();
initialFluidStates_.resize(numDof); initialFluidStates_.resize(numDof);
@ -2164,7 +2164,7 @@ protected:
saltpData = fp.get_double("SALTP"); saltpData = fp.get_double("SALTP");
// calculate the initial fluid states // calculate the initial fluid states
for (size_t dofIdx = 0; dofIdx < numDof; ++dofIdx) { for (std::size_t dofIdx = 0; dofIdx < numDof; ++dofIdx) {
auto& dofFluidState = initialFluidStates_[dofIdx]; auto& dofFluidState = initialFluidStates_[dofIdx];
dofFluidState.setPvtRegionIndex(pvtRegionIndex(dofIdx)); dofFluidState.setPvtRegionIndex(pvtRegionIndex(dofIdx));
@ -2359,7 +2359,7 @@ private:
if (bcconfig.size() > 0) { if (bcconfig.size() > 0) {
nonTrivialBoundaryConditions_ = true; nonTrivialBoundaryConditions_ = true;
size_t numCartDof = vanguard.cartesianSize(); std::size_t numCartDof = vanguard.cartesianSize();
unsigned numElems = vanguard.gridView().size(/*codim=*/0); unsigned numElems = vanguard.gridView().size(/*codim=*/0);
std::vector<int> cartesianToCompressedElemIdx(numCartDof, -1); std::vector<int> cartesianToCompressedElemIdx(numCartDof, -1);
@ -2450,7 +2450,7 @@ private:
} }
} }
size_t numDof = this->model().numGridDof(); std::size_t numDof = this->model().numGridDof();
const auto& comm = this->simulator().vanguard().grid().comm(); const auto& comm = this->simulator().vanguard().grid().comm();
comm.sum(sumInvB.data(),sumInvB.size()); comm.sum(sumInvB.data(),sumInvB.size());
Scalar numTotalDof = comm.sum(numDof); Scalar numTotalDof = comm.sum(numDof);
@ -2495,7 +2495,7 @@ private:
{ {
std::array<std::vector<T>,6> data; std::array<std::vector<T>,6> data;
void resize(size_t size, T defVal) void resize(std::size_t size, T defVal)
{ {
for (auto& d : data) for (auto& d : data)
d.resize(size, defVal); d.resize(size, defVal);

View File

@ -37,6 +37,7 @@
#include <opm/simulators/utils/VectorVectorDataHandle.hpp> #include <opm/simulators/utils/VectorVectorDataHandle.hpp>
#include <array> #include <array>
#include <cstddef>
#include <memory> #include <memory>
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
@ -132,7 +133,7 @@ public:
void prepareTracerBatches() void prepareTracerBatches()
{ {
for (size_t tracerIdx=0; tracerIdx<this->tracerPhaseIdx_.size(); ++tracerIdx) { for (std::size_t tracerIdx = 0; tracerIdx < this->tracerPhaseIdx_.size(); ++tracerIdx) {
if (this->tracerPhaseIdx_[tracerIdx] == FluidSystem::waterPhaseIdx) { if (this->tracerPhaseIdx_[tracerIdx] == FluidSystem::waterPhaseIdx) {
if (! FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)){ if (! FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)){
throw std::runtime_error("Water tracer specified for non-water fluid system:" + this->name(tracerIdx)); throw std::runtime_error("Water tracer specified for non-water fluid system:" + this->name(tracerIdx));
@ -394,7 +395,7 @@ protected:
for (const auto& elem : elements(simulator_.gridView())) { for (const auto& elem : elements(simulator_.gridView())) {
elemCtx.updateStencil(elem); elemCtx.updateStencil(elem);
size_t I = elemCtx.globalSpaceIndex(/*dofIdx=*/ 0, /*timeIdx=*/0); std::size_t I = elemCtx.globalSpaceIndex(/*dofIdx=*/ 0, /*timeIdx=*/0);
if (elem.partitionType() != Dune::InteriorEntity) if (elem.partitionType() != Dune::InteriorEntity)
{ {
@ -418,13 +419,13 @@ protected:
* extrusionFactor; * extrusionFactor;
Scalar dt = elemCtx.simulator().timeStepSize(); Scalar dt = elemCtx.simulator().timeStepSize();
size_t I1 = elemCtx.globalSpaceIndex(/*dofIdx=*/ 0, /*timeIdx=*/1); std::size_t I1 = elemCtx.globalSpaceIndex(/*dofIdx=*/ 0, /*timeIdx=*/1);
for (auto& tr : tbatch) { for (auto& tr : tbatch) {
this->assembleTracerEquationVolume(tr, elemCtx, scvVolume, dt, I, I1); this->assembleTracerEquationVolume(tr, elemCtx, scvVolume, dt, I, I1);
} }
size_t numInteriorFaces = elemCtx.numInteriorFaces(/*timIdx=*/0); std::size_t numInteriorFaces = elemCtx.numInteriorFaces(/*timIdx=*/0);
for (unsigned scvfIdx = 0; scvfIdx < numInteriorFaces; scvfIdx++) { for (unsigned scvfIdx = 0; scvfIdx < numInteriorFaces; scvfIdx++) {
const auto& face = elemCtx.stencil(0).interiorFace(scvfIdx); const auto& face = elemCtx.stencil(0).interiorFace(scvfIdx);
unsigned j = face.exteriorIndex(); unsigned j = face.exteriorIndex();

View File

@ -42,6 +42,7 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <cmath> #include <cmath>
#include <cstddef>
#include <sstream> #include <sstream>
#include <stdexcept> #include <stdexcept>
@ -499,7 +500,7 @@ extractPermeability_()
else else
permzData = permxData; permzData = permxData;
for (size_t dofIdx = 0; dofIdx < numElem; ++ dofIdx) { for (std::size_t dofIdx = 0; dofIdx < numElem; ++ dofIdx) {
permeability_[dofIdx] = 0.0; permeability_[dofIdx] = 0.0;
permeability_[dofIdx][0][0] = permxData[dofIdx]; permeability_[dofIdx][0][0] = permxData[dofIdx];
permeability_[dofIdx][1][1] = permyData[dofIdx]; permeability_[dofIdx][1][1] = permyData[dofIdx];
@ -541,9 +542,9 @@ extractPermeability_(const std::function<unsigned int(unsigned int)>& map)
else else
permzData = permxData; permzData = permxData;
for (size_t dofIdx = 0; dofIdx < numElem; ++ dofIdx) { for (std::size_t dofIdx = 0; dofIdx < numElem; ++ dofIdx) {
permeability_[dofIdx] = 0.0; permeability_[dofIdx] = 0.0;
size_t inputDofIdx = map(dofIdx); std::size_t inputDofIdx = map(dofIdx);
permeability_[dofIdx][0][0] = permxData[inputDofIdx]; permeability_[dofIdx][0][0] = permxData[inputDofIdx];
permeability_[dofIdx][1][1] = permyData[inputDofIdx]; permeability_[dofIdx][1][1] = permyData[inputDofIdx];
permeability_[dofIdx][2][2] = permzData[inputDofIdx]; permeability_[dofIdx][2][2] = permzData[inputDofIdx];

View File

@ -86,7 +86,7 @@ namespace Details {
using MatLaw = EclMaterialLawManager<ThreePhaseMaterialTraits<double,0,1,2>>; using MatLaw = EclMaterialLawManager<ThreePhaseMaterialTraits<double,0,1,2>>;
template class PhaseSaturations<MatLaw,BlackOilFluidSystem<double>, template class PhaseSaturations<MatLaw,BlackOilFluidSystem<double>,
EquilReg,size_t>; EquilReg,std::size_t>;
template std::pair<double,double> cellZMinMax(const Dune::cpgrid::Entity<0>& element); template std::pair<double,double> cellZMinMax(const Dune::cpgrid::Entity<0>& element);
} }

View File

@ -50,6 +50,7 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <cstddef>
#include <limits> #include <limits>
#include <stdexcept> #include <stdexcept>
@ -1336,7 +1337,7 @@ InitialStateComputer(MaterialLawManager& materialLawManager,
// Create Rs functions. // Create Rs functions.
rsFunc_.reserve(rec.size()); rsFunc_.reserve(rec.size());
if (FluidSystem::enableDissolvedGas()) { if (FluidSystem::enableDissolvedGas()) {
for (size_t i = 0; i < rec.size(); ++i) { for (std::size_t i = 0; i < rec.size(); ++i) {
if (eqlmap.cells(i).empty()) { if (eqlmap.cells(i).empty()) {
rsFunc_.push_back(std::shared_ptr<Miscibility::RsVD<FluidSystem>>()); rsFunc_.push_back(std::shared_ptr<Miscibility::RsVD<FluidSystem>>());
continue; continue;
@ -1377,14 +1378,14 @@ InitialStateComputer(MaterialLawManager& materialLawManager,
} }
} }
else { else {
for (size_t i = 0; i < rec.size(); ++i) { for (std::size_t i = 0; i < rec.size(); ++i) {
rsFunc_.push_back(std::make_shared<Miscibility::NoMixing>()); rsFunc_.push_back(std::make_shared<Miscibility::NoMixing>());
} }
} }
rvFunc_.reserve(rec.size()); rvFunc_.reserve(rec.size());
if (FluidSystem::enableVaporizedOil()) { if (FluidSystem::enableVaporizedOil()) {
for (size_t i = 0; i < rec.size(); ++i) { for (std::size_t i = 0; i < rec.size(); ++i) {
if (eqlmap.cells(i).empty()) { if (eqlmap.cells(i).empty()) {
rvFunc_.push_back(std::shared_ptr<Miscibility::RvVD<FluidSystem>>()); rvFunc_.push_back(std::shared_ptr<Miscibility::RvVD<FluidSystem>>());
continue; continue;
@ -1424,14 +1425,14 @@ InitialStateComputer(MaterialLawManager& materialLawManager,
} }
} }
else { else {
for (size_t i = 0; i < rec.size(); ++i) { for (std::size_t i = 0; i < rec.size(); ++i) {
rvFunc_.push_back(std::make_shared<Miscibility::NoMixing>()); rvFunc_.push_back(std::make_shared<Miscibility::NoMixing>());
} }
} }
rvwFunc_.reserve(rec.size()); rvwFunc_.reserve(rec.size());
if (FluidSystem::enableVaporizedWater()) { if (FluidSystem::enableVaporizedWater()) {
for (size_t i = 0; i < rec.size(); ++i) { for (std::size_t i = 0; i < rec.size(); ++i) {
if (eqlmap.cells(i).empty()) { if (eqlmap.cells(i).empty()) {
rvwFunc_.push_back(std::shared_ptr<Miscibility::RvwVD<FluidSystem>>()); rvwFunc_.push_back(std::shared_ptr<Miscibility::RvwVD<FluidSystem>>());
continue; continue;
@ -1487,7 +1488,7 @@ InitialStateComputer(MaterialLawManager& materialLawManager,
} }
} }
else { else {
for (size_t i = 0; i < rec.size(); ++i) { for (std::size_t i = 0; i < rec.size(); ++i) {
rvwFunc_.push_back(std::make_shared<Miscibility::NoMixing>()); rvwFunc_.push_back(std::make_shared<Miscibility::NoMixing>());
} }
} }
@ -1554,7 +1555,7 @@ updateInitialSaltConcentration_(const EclipseState& eclState, const RMap& reg)
table.setXYContainers(x, y); table.setXYContainers(x, y);
} }
} else { } else {
for (size_t i = 0; i < saltvdTables.size(); ++i) { for (std::size_t i = 0; i < saltvdTables.size(); ++i) {
const SaltvdTable& saltvdTable = saltvdTables.getTable<SaltvdTable>(i); const SaltvdTable& saltvdTable = saltvdTables.getTable<SaltvdTable>(i);
saltVdTable_[i].setXYContainers(saltvdTable.getDepthColumn(), saltvdTable.getSaltColumn()); saltVdTable_[i].setXYContainers(saltvdTable.getDepthColumn(), saltvdTable.getSaltColumn());
@ -1585,7 +1586,7 @@ updateInitialSaltSaturation_(const EclipseState& eclState, const RMap& reg)
const auto& tables = eclState.getTableManager(); const auto& tables = eclState.getTableManager();
const TableContainer& saltpvdTables = tables.getSaltpvdTables(); const TableContainer& saltpvdTables = tables.getSaltpvdTables();
for (size_t i = 0; i < saltpvdTables.size(); ++i) { for (std::size_t i = 0; i < saltpvdTables.size(); ++i) {
const SaltpvdTable& saltpvdTable = saltpvdTables.getTable<SaltpvdTable>(i); const SaltpvdTable& saltpvdTable = saltpvdTables.getTable<SaltpvdTable>(i);
saltpVdTable_[i].setXYContainers(saltpvdTable.getDepthColumn(), saltpvdTable.getSaltpColumn()); saltpVdTable_[i].setXYContainers(saltpvdTable.getDepthColumn(), saltpvdTable.getSaltpColumn());
@ -1756,7 +1757,7 @@ calcPressSatRsRv(const RMap& reg,
auto vspan = std::array<double, 2>{}; auto vspan = std::array<double, 2>{};
std::vector<int> regionIsEmpty(rec.size(), 0); std::vector<int> regionIsEmpty(rec.size(), 0);
for (size_t r = 0; r < rec.size(); ++r) { for (std::size_t r = 0; r < rec.size(); ++r) {
const auto& cells = reg.cells(r); const auto& cells = reg.cells(r);
Details::verticalExtent(cells, cellZMinMax_, comm, vspan); Details::verticalExtent(cells, cellZMinMax_, comm, vspan);
@ -1802,7 +1803,7 @@ calcPressSatRsRv(const RMap& reg,
} }
comm.min(regionIsEmpty.data(),regionIsEmpty.size()); comm.min(regionIsEmpty.data(),regionIsEmpty.size());
if (comm.rank() == 0) { if (comm.rank() == 0) {
for (size_t r = 0; r < rec.size(); ++r) { for (std::size_t r = 0; r < rec.size(); ++r) {
if (regionIsEmpty[r]) //region is empty on all partitions if (regionIsEmpty[r]) //region is empty on all partitions
OpmLog::warning("Equilibration region " + std::to_string(r + 1) OpmLog::warning("Equilibration region " + std::to_string(r + 1)
+ " has no active cells"); + " has no active cells");

View File

@ -109,7 +109,7 @@ namespace Opm {
if (eclTracerConcentrationOutput_()){ if (eclTracerConcentrationOutput_()){
const auto& tracerModel = this->simulator_.problem().tracerModel(); const auto& tracerModel = this->simulator_.problem().tracerModel();
eclTracerConcentration_.resize(tracerModel.numTracers()); eclTracerConcentration_.resize(tracerModel.numTracers());
for(size_t tracerIdx=0; tracerIdx<eclTracerConcentration_.size();++tracerIdx){ for (std::size_t tracerIdx = 0; tracerIdx < eclTracerConcentration_.size(); ++tracerIdx) {
this->resizeScalarBuffer_(eclTracerConcentration_[tracerIdx]); this->resizeScalarBuffer_(eclTracerConcentration_[tracerIdx]);
} }
@ -132,7 +132,7 @@ namespace Opm {
unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0); unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
if (eclTracerConcentrationOutput_()){ if (eclTracerConcentrationOutput_()){
for(size_t tracerIdx=0; tracerIdx<eclTracerConcentration_.size();++tracerIdx){ for (std::size_t tracerIdx = 0; tracerIdx < eclTracerConcentration_.size(); ++tracerIdx) {
eclTracerConcentration_[tracerIdx][globalDofIdx] = tracerModel.tracerConcentration(tracerIdx, globalDofIdx); eclTracerConcentration_[tracerIdx][globalDofIdx] = tracerModel.tracerConcentration(tracerIdx, globalDofIdx);
} }
} }
@ -150,7 +150,7 @@ namespace Opm {
if (eclTracerConcentrationOutput_()){ if (eclTracerConcentrationOutput_()){
const auto& tracerModel = this->simulator_.problem().tracerModel(); const auto& tracerModel = this->simulator_.problem().tracerModel();
for(size_t tracerIdx=0; tracerIdx<eclTracerConcentration_.size();++tracerIdx){ for (std::size_t tracerIdx = 0; tracerIdx < eclTracerConcentration_.size(); ++tracerIdx) {
const std::string tmp = "tracerConcentration_" + tracerModel.name(tracerIdx); const std::string tmp = "tracerConcentration_" + tracerModel.name(tracerIdx);
this->commitScalarBuffer_(baseWriter,tmp.c_str(), eclTracerConcentration_[tracerIdx]); this->commitScalarBuffer_(baseWriter,tmp.c_str(), eclTracerConcentration_[tracerIdx]);
} }

View File

@ -225,7 +225,7 @@ private:
for (const auto& elem : elements(gridView, Dune::Partitions::interior)) { for (const auto& elem : elements(gridView, Dune::Partitions::interior)) {
elem_ctx.updatePrimaryStencil(elem); elem_ctx.updatePrimaryStencil(elem);
const size_t cell_index = elem_ctx.globalSpaceIndex(/*spaceIdx=*/0, /*timeIdx=*/0); const std::size_t cell_index = elem_ctx.globalSpaceIndex(/*spaceIdx=*/0, /*timeIdx=*/0);
const int idx = this->cell_to_aquifer_cell_idx_[cell_index]; const int idx = this->cell_to_aquifer_cell_idx_[cell_index];
if (idx < 0) { if (idx < 0) {
continue; continue;
@ -300,7 +300,7 @@ private:
const std::size_t i = face.interiorIndex(); const std::size_t i = face.interiorIndex();
const std::size_t j = face.exteriorIndex(); const std::size_t j = face.exteriorIndex();
// compressed index // compressed index
// const size_t I = stencil.globalSpaceIndex(i); // const std::size_t I = stencil.globalSpaceIndex(i);
const std::size_t J = stencil.globalSpaceIndex(j); const std::size_t J = stencil.globalSpaceIndex(j);
assert(stencil.globalSpaceIndex(i) == cell_index); assert(stencil.globalSpaceIndex(i) == cell_index);

View File

@ -37,6 +37,7 @@
#include <dune/common/parallel/mpihelper.hh> #include <dune/common/parallel/mpihelper.hh>
#endif #endif
#include <cstddef>
#include <memory> #include <memory>
#include <string_view> #include <string_view>
@ -526,7 +527,7 @@ void handleExtraConvergenceOutput(SimulatorReport& report,
// initialize variables // initialize variables
const auto& initConfig = eclState().getInitConfig(); const auto& initConfig = eclState().getInitConfig();
simtimer_->init(schedule, (size_t)initConfig.getRestartStep()); simtimer_->init(schedule, static_cast<std::size_t>(initConfig.getRestartStep()));
if (this->output_cout_) { if (this->output_cout_) {
std::ostringstream oss; std::ostringstream oss;

View File

@ -154,9 +154,9 @@ namespace KeywordValidation
const auto& keyword_properties = partially_supported_items.find(keyword.name()); const auto& keyword_properties = partially_supported_items.find(keyword.name());
if (keyword_properties != partially_supported_items.end()) { if (keyword_properties != partially_supported_items.end()) {
// If this keyworcs has partially supported items, iterate over all of them. // If this keyworcs has partially supported items, iterate over all of them.
for (size_t record_index = 0; record_index < keyword.size(); record_index++) { for (std::size_t record_index = 0; record_index < keyword.size(); record_index++) {
const auto& record = keyword.getRecord(record_index); const auto& record = keyword.getRecord(record_index);
for (size_t item_index = 0; item_index < record.size(); item_index++) { for (std::size_t item_index = 0; item_index < record.size(); item_index++) {
const auto& item = record.getItem(item_index); const auto& item = record.getItem(item_index);
// Find the index number, which starts counting at one, so item_index + 1 // Find the index number, which starts counting at one, so item_index + 1
const auto& item_properties = keyword_properties->second.find(item_index + 1); const auto& item_properties = keyword_properties->second.find(item_index + 1);
@ -182,8 +182,8 @@ namespace KeywordValidation
void KeywordValidator::validateKeywordItem(const DeckKeyword& keyword, void KeywordValidator::validateKeywordItem(const DeckKeyword& keyword,
const PartiallySupportedKeywordProperties<T>& properties, const PartiallySupportedKeywordProperties<T>& properties,
const bool multiple_records, const bool multiple_records,
const size_t record_index, const std::size_t record_index,
const size_t item_index, const std::size_t item_index,
const T& item_value, const T& item_value,
std::vector<ValidationError>& errors) const std::vector<ValidationError>& errors) const
{ {

View File

@ -22,6 +22,7 @@
#include <opm/common/OpmLog/KeywordLocation.hpp> #include <opm/common/OpmLog/KeywordLocation.hpp>
#include <cstddef>
#include <functional> #include <functional>
#include <initializer_list> #include <initializer_list>
#include <map> #include <map>
@ -59,7 +60,7 @@ namespace KeywordValidation
// This is used to list the partially supported items of a keyword: // This is used to list the partially supported items of a keyword:
template <typename T> template <typename T>
using PartiallySupportedKeywordItems = std::map<size_t, PartiallySupportedKeywordProperties<T>>; using PartiallySupportedKeywordItems = std::map<std::size_t, PartiallySupportedKeywordProperties<T>>;
// This is used to list the keywords that have partially supported items: // This is used to list the keywords that have partially supported items:
template <typename T> template <typename T>
@ -71,8 +72,8 @@ namespace KeywordValidation
struct ValidationError { struct ValidationError {
bool critical; // Determines if the encountered problem should be an error or a warning bool critical; // Determines if the encountered problem should be an error or a warning
KeywordLocation location; // Location information (keyword name, file and line number) KeywordLocation location; // Location information (keyword name, file and line number)
size_t record_number; // Number of the offending record std::size_t record_number; // Number of the offending record
std::optional<size_t> item_number; // Number of the offending item std::optional<std::size_t> item_number; // Number of the offending item
std::optional<std::string> item_value; // The offending value of a problematic item std::optional<std::string> item_value; // The offending value of a problematic item
std::optional<std::string> user_message; // An optional message to show if a problem is encountered std::optional<std::string> user_message; // An optional message to show if a problem is encountered
}; };
@ -127,8 +128,8 @@ namespace KeywordValidation
void validateKeywordItem(const DeckKeyword& keyword, void validateKeywordItem(const DeckKeyword& keyword,
const PartiallySupportedKeywordProperties<T>& properties, const PartiallySupportedKeywordProperties<T>& properties,
const bool multiple_records, const bool multiple_records,
const size_t record_number, const std::size_t record_number,
const size_t item_number, const std::size_t item_number,
const T& item_value, const T& item_value,
std::vector<ValidationError>& errors) const; std::vector<ValidationError>& errors) const;

View File

@ -331,7 +331,7 @@ fipResv(const Inplace& inplace) const
this->outputResvFluidInPlace_(current_values, 0); this->outputResvFluidInPlace_(current_values, 0);
} }
for (size_t reg = 1; reg <= inplace.max_region("FIPNUM"); ++reg) { for (std::size_t reg = 1; reg <= inplace.max_region("FIPNUM"); ++reg) {
std::unordered_map<Inplace::Phase, Scalar> current_values; std::unordered_map<Inplace::Phase, Scalar> current_values;
for (const auto& phase : Inplace::phases()) { for (const auto& phase : Inplace::phases()) {

View File

@ -96,7 +96,7 @@ void checkSerializedCmdLine(const std::string& current,
std::vector<std::string> only_stored, only_curr; std::vector<std::string> only_stored, only_curr;
if (!difference.empty()) { if (!difference.empty()) {
for (size_t i = 0; i < difference.size(); ) { for (std::size_t i = 0; i < difference.size(); ) {
auto stored_it = std::find(stored_strings.begin(), auto stored_it = std::find(stored_strings.begin(),
stored_strings.end(), difference[i]); stored_strings.end(), difference[i]);
auto pos = difference[i].find_first_of('='); auto pos = difference[i].find_first_of('=');

View File

@ -106,7 +106,7 @@ std::pair<std::vector<int>, int> partitionCellsFromFile(const std::string& filen
// Read file into single vector. // Read file into single vector.
std::ifstream is(filename); std::ifstream is(filename);
const std::vector<int> cellpart{std::istream_iterator<int>(is), std::istream_iterator<int>()}; const std::vector<int> cellpart{std::istream_iterator<int>(is), std::istream_iterator<int>()};
if (cellpart.size() != size_t(num_cells)) { if (cellpart.size() != static_cast<std::size_t>(num_cells)) {
auto msg = fmt::format("Partition file contains {} entries, but there are {} cells.", auto msg = fmt::format("Partition file contains {} entries, but there are {} cells.",
cellpart.size(), num_cells); cellpart.size(), num_cells);
throw std::runtime_error(msg); throw std::runtime_error(msg);

View File

@ -49,7 +49,7 @@ namespace Opm {
namespace detail { namespace detail {
#ifdef HAVE_MPI #ifdef HAVE_MPI
void copyParValues(std::any& parallelInformation, size_t size, void copyParValues(std::any& parallelInformation, std::size_t size,
Dune::OwnerOverlapCopyCommunication<int,int>& comm) Dune::OwnerOverlapCopyCommunication<int,int>& comm)
{ {
if (parallelInformation.type() == typeid(ParallelISTLInformation)) { if (parallelInformation.type() == typeid(ParallelISTLInformation)) {
@ -85,7 +85,7 @@ void makeOverlapRowsInvalid(Matrix& matrix,
template<class Vector, class Matrix> template<class Vector, class Matrix>
std::function<Vector()> getWeightsCalculator(const PropertyTree& prm, std::function<Vector()> getWeightsCalculator(const PropertyTree& prm,
const Matrix& matrix, const Matrix& matrix,
size_t pressureIndex, std::size_t pressureIndex,
std::function<Vector()> trueFunc) std::function<Vector()> trueFunc)
{ {
std::function<Vector()> weightsCalculator; std::function<Vector()> weightsCalculator;
@ -122,7 +122,7 @@ template<class Matrix, class Vector, class Comm>
void FlexibleSolverInfo<Matrix,Vector,Comm>::create(const Matrix& matrix, void FlexibleSolverInfo<Matrix,Vector,Comm>::create(const Matrix& matrix,
bool parallel, bool parallel,
const PropertyTree& prm, const PropertyTree& prm,
size_t pressureIndex, std::size_t pressureIndex,
std::function<Vector()> trueFunc, std::function<Vector()> trueFunc,
[[maybe_unused]] Comm& comm) [[maybe_unused]] Comm& comm)

View File

@ -101,7 +101,7 @@ struct FlexibleSolverInfo
void create(const Matrix& matrix, void create(const Matrix& matrix,
bool parallel, bool parallel,
const PropertyTree& prm, const PropertyTree& prm,
size_t pressureIndex, std::size_t pressureIndex,
std::function<Vector()> trueFunc, std::function<Vector()> trueFunc,
Comm& comm); Comm& comm);
@ -109,13 +109,13 @@ struct FlexibleSolverInfo
std::unique_ptr<AbstractOperatorType> op_; std::unique_ptr<AbstractOperatorType> op_;
std::unique_ptr<LinearOperatorExtra<Vector,Vector>> wellOperator_; std::unique_ptr<LinearOperatorExtra<Vector,Vector>> wellOperator_;
AbstractPreconditionerType* pre_ = nullptr; AbstractPreconditionerType* pre_ = nullptr;
size_t interiorCellNum_ = 0; std::size_t interiorCellNum_ = 0;
}; };
#ifdef HAVE_MPI #ifdef HAVE_MPI
/// Copy values in parallel. /// Copy values in parallel.
void copyParValues(std::any& parallelInformation, size_t size, void copyParValues(std::any& parallelInformation, std::size_t size,
Dune::OwnerOverlapCopyCommunication<int,int>& comm); Dune::OwnerOverlapCopyCommunication<int,int>& comm);
#endif #endif
@ -130,7 +130,7 @@ void makeOverlapRowsInvalid(Matrix& matrix,
template<class Matrix, class Grid> template<class Matrix, class Grid>
std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid, std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
const std::vector<int>& cell_part, const std::vector<int>& cell_part,
size_t nonzeroes, std::size_t nonzeroes,
const std::vector<std::set<int>>& wellConnectionsGraph); const std::vector<std::set<int>>& wellConnectionsGraph);
} }
@ -262,7 +262,7 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
const bool firstcall = (matrix_ == nullptr); const bool firstcall = (matrix_ == nullptr);
#if HAVE_MPI #if HAVE_MPI
if (firstcall) { if (firstcall) {
const size_t size = M.N(); const std::size_t size = M.N();
detail::copyParValues(parallelInformation_, size, *comm_); detail::copyParValues(parallelInformation_, size, *comm_);
} }
#endif #endif

View File

@ -73,7 +73,7 @@ prepare(const Grid& grid,
const Dune::CartesianIndexMapper<Grid>& cartMapper, const Dune::CartesianIndexMapper<Grid>& cartMapper,
const std::vector<Well>& wellsForConn, const std::vector<Well>& wellsForConn,
const std::vector<int>& cellPartition, const std::vector<int>& cellPartition,
const size_t nonzeroes, const std::size_t nonzeroes,
const bool useWellConn) const bool useWellConn)
{ {
if (numJacobiBlocks_ > 1) { if (numJacobiBlocks_ > 1) {
@ -146,7 +146,7 @@ template<class Grid>
void BdaSolverInfo<Matrix,Vector>:: void BdaSolverInfo<Matrix,Vector>::
blockJacobiAdjacency(const Grid& grid, blockJacobiAdjacency(const Grid& grid,
const std::vector<int>& cell_part, const std::vector<int>& cell_part,
size_t nonzeroes) std::size_t nonzeroes)
{ {
using size_type = typename Matrix::size_type; using size_type = typename Matrix::size_type;
using Iter = typename Matrix::CreateIterator; using Iter = typename Matrix::CreateIterator;
@ -219,7 +219,7 @@ using BV = Dune::BlockVector<Dune::FieldVector<double,Dim>>;
const Dune::CartesianIndexMapper<Grid>&, \ const Dune::CartesianIndexMapper<Grid>&, \
const std::vector<Well>&, \ const std::vector<Well>&, \
const std::vector<int>&, \ const std::vector<int>&, \
const size_t, const bool); const std::size_t, const bool);
using PolyHedralGrid3D = Dune::PolyhedralGrid<3, 3>; using PolyHedralGrid3D = Dune::PolyhedralGrid<3, 3>;
#if HAVE_DUNE_ALUGRID #if HAVE_DUNE_ALUGRID
#if HAVE_MPI #if HAVE_MPI

View File

@ -24,6 +24,8 @@
#include <opm/simulators/linalg/ISTLSolverEbos.hpp> #include <opm/simulators/linalg/ISTLSolverEbos.hpp>
#include <cstddef>
namespace Opm { namespace Opm {
class Well; class Well;
@ -54,7 +56,7 @@ struct BdaSolverInfo
const Dune::CartesianIndexMapper<Grid>& cartMapper, const Dune::CartesianIndexMapper<Grid>& cartMapper,
const std::vector<Well>& wellsForConn, const std::vector<Well>& wellsForConn,
const std::vector<int>& cellPartition, const std::vector<int>& cellPartition,
const size_t nonzeroes, const std::size_t nonzeroes,
const bool useWellConn); const bool useWellConn);
bool apply(Vector& rhs, bool apply(Vector& rhs,
@ -75,7 +77,7 @@ private:
template<class Grid> template<class Grid>
void blockJacobiAdjacency(const Grid& grid, void blockJacobiAdjacency(const Grid& grid,
const std::vector<int>& cell_part, const std::vector<int>& cell_part,
size_t nonzeroes); std::size_t nonzeroes);
void copyMatToBlockJac(const Matrix& mat, Matrix& blockJac); void copyMatToBlockJac(const Matrix& mat, Matrix& blockJac);

View File

@ -38,7 +38,7 @@ namespace detail
//! Compute Blocked ILU0 decomposition, when we know junk ghost rows are located at the end of A //! Compute Blocked ILU0 decomposition, when we know junk ghost rows are located at the end of A
template<class M> template<class M>
void ghost_last_bilu0_decomposition (M& A, size_t interiorSize) void ghost_last_bilu0_decomposition (M& A, std::size_t interiorSize)
{ {
// iterator types // iterator types
using rowiterator = typename M::RowIterator; using rowiterator = typename M::RowIterator;
@ -419,7 +419,7 @@ update()
// The ILU_ matrix is already a copy with the same // The ILU_ matrix is already a copy with the same
// sparse structure as A_, but the values of A_ may // sparse structure as A_, but the values of A_ may
// have changed, so we must copy all elements. // have changed, so we must copy all elements.
for (size_t row = 0; row < A_->N(); ++row) { for (std::size_t row = 0; row < A_->N(); ++row) {
const auto& Arow = (*A_)[row]; const auto& Arow = (*A_)[row];
auto& ILUrow = (*ILU_)[row]; auto& ILUrow = (*ILU_)[row];
auto Ait = Arow.begin(); auto Ait = Arow.begin();

View File

@ -128,7 +128,7 @@ makeAmgPreconditioner(const Operator& op,
if (useKamg) { if (useKamg) {
using Type = Dune::DummyUpdatePreconditioner<Dune::Amg::KAMG<Operator, Vector, Smoother>>; using Type = Dune::DummyUpdatePreconditioner<Dune::Amg::KAMG<Operator, Vector, Smoother>>;
return std::make_shared<Type>(op, crit, sargs, return std::make_shared<Type>(op, crit, sargs,
prm.get<size_t>("max_krylov", 1), prm.get<std::size_t>("max_krylov", 1),
prm.get<double>("min_reduction", 1e-1)); prm.get<double>("min_reduction", 1e-1));
} else { } else {
using Type = Dune::Amg::AMGCPR<Operator, Vector, Smoother>; using Type = Dune::Amg::AMGCPR<Operator, Vector, Smoother>;
@ -255,7 +255,7 @@ struct StandardPreconditioners
const bool reorder_spheres = prm.get<bool>("reorder_spheres", false); const bool reorder_spheres = prm.get<bool>("reorder_spheres", false);
// Already a parallel preconditioner. Need to pass comm, but no need to wrap it in a BlockPreconditioner. // Already a parallel preconditioner. Need to pass comm, but no need to wrap it in a BlockPreconditioner.
if (ilulevel == 0) { if (ilulevel == 0) {
const size_t num_interior = interiorIfGhostLast(comm); const std::size_t num_interior = interiorIfGhostLast(comm);
return std::make_shared<Opm::ParallelOverlappingILU0<M, V, V, Comm>>( return std::make_shared<Opm::ParallelOverlappingILU0<M, V, V, Comm>>(
op.getmat(), comm, w, Opm::MILU_VARIANT::ILU, num_interior, redblack, reorder_spheres); op.getmat(), comm, w, Opm::MILU_VARIANT::ILU, num_interior, redblack, reorder_spheres);
} else { } else {
@ -268,10 +268,10 @@ struct StandardPreconditioners
/// K interior cells from [0, K-1] and ghost cells from [K, N-1]. /// K interior cells from [0, K-1] and ghost cells from [K, N-1].
/// Returns K if true, otherwise returns N. This is motivated by /// Returns K if true, otherwise returns N. This is motivated by
/// usage in the ParallelOverlappingILU0 preconditioner. /// usage in the ParallelOverlappingILU0 preconditioner.
static size_t interiorIfGhostLast(const Comm& comm) static std::size_t interiorIfGhostLast(const Comm& comm)
{ {
size_t interior_count = 0; std::size_t interior_count = 0;
size_t highest_interior_index = 0; std::size_t highest_interior_index = 0;
const auto& is = comm.indexSet(); const auto& is = comm.indexSet();
for (const auto& ind : is) { for (const auto& ind : is) {
if (Comm::OwnerSet::contains(ind.local().attribute())) { if (Comm::OwnerSet::contains(ind.local().attribute())) {

View File

@ -28,6 +28,8 @@
#include <dune/istl/paamg/pinfo.hh> #include <dune/istl/paamg/pinfo.hh>
#include <cstddef>
namespace Opm namespace Opm
{ {
template <class Communication> template <class Communication>
@ -44,22 +46,22 @@ namespace Opm
const int max_nw = comm.communicator().max(nw); const int max_nw = comm.communicator().max(nw);
const int rank = comm.communicator().rank(); const int rank = comm.communicator().rank();
int glo_max = 0; int glo_max = 0;
size_t loc_max = 0; std::size_t loc_max = 0;
indset_rw.beginResize(); indset_rw.beginResize();
for (auto ind = indset.begin(), indend = indset.end(); ind != indend; ++ind) { for (auto ind = indset.begin(), indend = indset.end(); ind != indend; ++ind) {
indset_rw.add(ind->global(), LocalIndex(ind->local(), ind->local().attribute(), true)); indset_rw.add(ind->global(), LocalIndex(ind->local(), ind->local().attribute(), true));
const int glo = ind->global(); const int glo = ind->global();
const size_t loc = ind->local().local(); const std::size_t loc = ind->local().local();
glo_max = std::max(glo_max, glo); glo_max = std::max(glo_max, glo);
loc_max = std::max(loc_max, loc); loc_max = std::max(loc_max, loc);
} }
const int global_max = comm.communicator().max(glo_max); const int global_max = comm.communicator().max(glo_max);
// used append the welldofs at the end // used append the welldofs at the end
assert(loc_max + 1 == indset.size()); assert(loc_max + 1 == indset.size());
size_t local_ind = loc_max + 1; std::size_t local_ind = loc_max + 1;
for (int i = 0; i < nw; ++i) { for (int i = 0; i < nw; ++i) {
// need to set unique global number // need to set unique global number
const size_t v = global_max + max_nw * rank + i + 1; const std::size_t v = global_max + max_nw * rank + i + 1;
// set to true to not have problems with higher levels if growing of domains is used // set to true to not have problems with higher levels if growing of domains is used
indset_rw.add(v, LocalIndex(local_ind, Dune::OwnerOverlapCopyAttributeSet::owner, true)); indset_rw.add(v, LocalIndex(local_ind, Dune::OwnerOverlapCopyAttributeSet::owner, true));
++local_ind; ++local_ind;
@ -114,8 +116,8 @@ namespace Opm
const auto& fineLevelMatrix = fineOperator.getmat(); const auto& fineLevelMatrix = fineOperator.getmat();
const auto& nw = fineOperator.getNumberOfExtraEquations(); const auto& nw = fineOperator.getNumberOfExtraEquations();
if (prm_.get<bool>("add_wells")) { if (prm_.get<bool>("add_wells")) {
const size_t average_elements_per_row const std::size_t average_elements_per_row
= static_cast<size_t>(std::ceil(fineLevelMatrix.nonzeroes() / fineLevelMatrix.N())); = static_cast<std::size_t>(std::ceil(fineLevelMatrix.nonzeroes() / fineLevelMatrix.N()));
const double overflow_fraction = 1.2; const double overflow_fraction = 1.2;
coarseLevelMatrix_.reset(new CoarseMatrix(fineLevelMatrix.N() + nw, coarseLevelMatrix_.reset(new CoarseMatrix(fineLevelMatrix.N() + nw,
fineLevelMatrix.M() + nw, fineLevelMatrix.M() + nw,
@ -176,12 +178,12 @@ namespace Opm
double matrix_el = 0; double matrix_el = 0;
if (transpose) { if (transpose) {
const auto& bw = weights_[entry.index()]; const auto& bw = weights_[entry.index()];
for (size_t i = 0; i < bw.size(); ++i) { for (std::size_t i = 0; i < bw.size(); ++i) {
matrix_el += (*entry)[pressure_var_index_][i] * bw[i]; matrix_el += (*entry)[pressure_var_index_][i] * bw[i];
} }
} else { } else {
const auto& bw = weights_[row.index()]; const auto& bw = weights_[row.index()];
for (size_t i = 0; i < bw.size(); ++i) { for (std::size_t i = 0; i < bw.size(); ++i) {
matrix_el += (*entry)[i][pressure_var_index_] * bw[i]; matrix_el += (*entry)[i][pressure_var_index_] * bw[i];
} }
} }
@ -216,7 +218,7 @@ namespace Opm
if (transpose) { if (transpose) {
rhs_el = (*block)[pressure_var_index_]; rhs_el = (*block)[pressure_var_index_];
} else { } else {
for (size_t i = 0; i < block->size(); ++i) { for (std::size_t i = 0; i < block->size(); ++i) {
rhs_el += (*block)[i] * bw[i]; rhs_el += (*block)[i] * bw[i];
} }
} }
@ -235,7 +237,7 @@ namespace Opm
for (auto block = begin; block != end; ++block) { for (auto block = begin; block != end; ++block) {
if (transpose) { if (transpose) {
const auto& bw = weights_[block.index()]; const auto& bw = weights_[block.index()];
for (size_t i = 0; i < block->size(); ++i) { for (std::size_t i = 0; i < block->size(); ++i) {
(*block)[i] = this->lhs_[block - begin] * bw[i]; (*block)[i] = this->lhs_[block - begin] * bw[i];
} }
} else { } else {

View File

@ -26,6 +26,7 @@
#include <opm/simulators/linalg/PropertyTree.hpp> #include <opm/simulators/linalg/PropertyTree.hpp>
#include <opm/simulators/linalg/matrixblock.hh> #include <opm/simulators/linalg/matrixblock.hh>
#include <cstddef>
namespace Opm namespace Opm
{ {
@ -104,12 +105,12 @@ public:
double matrix_el = 0; double matrix_el = 0;
if (transpose) { if (transpose) {
const auto& bw = weights_[entry.index()]; const auto& bw = weights_[entry.index()];
for (size_t i = 0; i < bw.size(); ++i) { for (std::size_t i = 0; i < bw.size(); ++i) {
matrix_el += (*entry)[pressure_var_index_][i] * bw[i]; matrix_el += (*entry)[pressure_var_index_][i] * bw[i];
} }
} else { } else {
const auto& bw = weights_[row.index()]; const auto& bw = weights_[row.index()];
for (size_t i = 0; i < bw.size(); ++i) { for (std::size_t i = 0; i < bw.size(); ++i) {
matrix_el += (*entry)[i][pressure_var_index_] * bw[i]; matrix_el += (*entry)[i][pressure_var_index_] * bw[i];
} }
} }
@ -132,7 +133,7 @@ public:
if (transpose) { if (transpose) {
rhs_el = (*block)[pressure_var_index_]; rhs_el = (*block)[pressure_var_index_];
} else { } else {
for (size_t i = 0; i < block->size(); ++i) { for (std::size_t i = 0; i < block->size(); ++i) {
rhs_el += (*block)[i] * bw[i]; rhs_el += (*block)[i] * bw[i];
} }
} }
@ -149,7 +150,7 @@ public:
for (auto block = begin; block != end; ++block) { for (auto block = begin; block != end; ++block) {
if (transpose) { if (transpose) {
const auto& bw = weights_[block.index()]; const auto& bw = weights_[block.index()];
for (size_t i = 0; i < block->size(); ++i) { for (std::size_t i = 0; i < block->size(); ++i) {
(*block)[i] = this->lhs_[block - begin] * bw[i]; (*block)[i] = this->lhs_[block - begin] * bw[i];
} }
} else { } else {
@ -172,6 +173,7 @@ public:
{ {
return pressure_var_index_; return pressure_var_index_;
} }
private: private:
Communication* communication_; Communication* communication_;
const FineVectorType& weights_; const FineVectorType& weights_;

View File

@ -22,9 +22,16 @@
#ifndef OPM_WELLOPERATORS_HEADER_INCLUDED #ifndef OPM_WELLOPERATORS_HEADER_INCLUDED
#define OPM_WELLOPERATORS_HEADER_INCLUDED #define OPM_WELLOPERATORS_HEADER_INCLUDED
#include <dune/common/parallel/communication.hh>
#include <dune/istl/operators.hh> #include <dune/istl/operators.hh>
#include <dune/istl/bcrsmatrix.hh>
#include <opm/common/TimingMacros.hpp>
#include <opm/simulators/linalg/matrixblock.hh> #include <opm/simulators/linalg/matrixblock.hh>
#include <cstddef>
namespace Opm namespace Opm
{ {
@ -237,7 +244,7 @@ public:
//! constructor: just store a reference to a matrix //! constructor: just store a reference to a matrix
WellModelGhostLastMatrixAdapter (const M& A, WellModelGhostLastMatrixAdapter (const M& A,
const Opm::LinearOperatorExtra<X, Y>& wellOper, const Opm::LinearOperatorExtra<X, Y>& wellOper,
const size_t interiorSize ) const std::size_t interiorSize )
: A_( A ), wellOper_( wellOper ), interiorSize_(interiorSize) : A_( A ), wellOper_( wellOper ), interiorSize_(interiorSize)
{} {}
@ -294,14 +301,14 @@ public:
protected: protected:
void ghostLastProject(Y& y) const void ghostLastProject(Y& y) const
{ {
size_t end = y.size(); std::size_t end = y.size();
for (size_t i = interiorSize_; i < end; ++i) for (std::size_t i = interiorSize_; i < end; ++i)
y[i] = 0; y[i] = 0;
} }
const matrix_type& A_ ; const matrix_type& A_ ;
const Opm::LinearOperatorExtra< X, Y>& wellOper_; const Opm::LinearOperatorExtra< X, Y>& wellOper_;
size_t interiorSize_; std::size_t interiorSize_;
}; };
} // namespace Opm } // namespace Opm

View File

@ -72,6 +72,7 @@
} \ } \
} }
#include <cstddef>
namespace Opm namespace Opm
{ {
@ -421,7 +422,7 @@ void rocsparseSolverBackend<block_size>::update_system_on_gpu(double *b) {
template <unsigned int block_size> template <unsigned int block_size>
bool rocsparseSolverBackend<block_size>::analyze_matrix() { bool rocsparseSolverBackend<block_size>::analyze_matrix() {
size_t d_bufferSize_M, d_bufferSize_L, d_bufferSize_U, d_bufferSize; std::size_t d_bufferSize_M, d_bufferSize_L, d_bufferSize_U, d_bufferSize;
Timer t; Timer t;
ROCSPARSE_CHECK(rocsparse_set_pointer_mode(handle, rocsparse_pointer_mode_host)); ROCSPARSE_CHECK(rocsparse_set_pointer_mode(handle, rocsparse_pointer_mode_host));

View File

@ -20,11 +20,13 @@
#ifndef OPM_FINDOVERLAPROWSANDCOLUMNS_HEADER_INCLUDED #ifndef OPM_FINDOVERLAPROWSANDCOLUMNS_HEADER_INCLUDED
#define OPM_FINDOVERLAPROWSANDCOLUMNS_HEADER_INCLUDED #define OPM_FINDOVERLAPROWSANDCOLUMNS_HEADER_INCLUDED
#include <vector>
#include <utility>
#include <opm/grid/common/WellConnections.hpp> #include <opm/grid/common/WellConnections.hpp>
#include <opm/grid/common/CartesianIndexMapper.hpp> #include <opm/grid/common/CartesianIndexMapper.hpp>
#include <cstddef>
#include <utility>
#include <vector>
namespace Dune { namespace Dune {
template<class Grid> class CartesianIndexMapper; template<class Grid> class CartesianIndexMapper;
} }
@ -117,9 +119,9 @@ namespace detail
/// returns the number of interior cells numInterior. In the linear solver only the first numInterior rows of /// returns the number of interior cells numInterior. In the linear solver only the first numInterior rows of
/// the matrix are needed. /// the matrix are needed.
template <class Grid> template <class Grid>
size_t numMatrixRowsToUseInSolver(const Grid& grid, bool ownerFirst) std::size_t numMatrixRowsToUseInSolver(const Grid& grid, bool ownerFirst)
{ {
size_t numInterior = 0; std::size_t numInterior = 0;
if (!ownerFirst || grid.comm().size()==1) if (!ownerFirst || grid.comm().size()==1)
return grid.leafGridView().size(0); return grid.leafGridView().size(0);
const auto& gridView = grid.leafGridView(); const auto& gridView = grid.leafGridView();

View File

@ -21,12 +21,12 @@
#include "config.h" #include "config.h"
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
#include <cassert>
#include <iostream>
#include <vector>
#include <algorithm> #include <algorithm>
#include <cassert>
#include <cstddef>
#include <ostream>
#include <numeric> #include <numeric>
#include <vector>
#include <opm/input/eclipse/Units/Units.hpp> #include <opm/input/eclipse/Units/Units.hpp>
#include <opm/simulators/timestepping/AdaptiveSimulatorTimer.hpp> #include <opm/simulators/timestepping/AdaptiveSimulatorTimer.hpp>
@ -157,7 +157,7 @@ AdaptiveSimulatorTimer& AdaptiveSimulatorTimer::operator++ ()
report(std::ostream& os) const report(std::ostream& os) const
{ {
os << "Sub steps started at time = " << unit::convert::to( start_time_, unit::day ) << " (days)" << std::endl; os << "Sub steps started at time = " << unit::convert::to( start_time_, unit::day ) << " (days)" << std::endl;
for( size_t i=0; i<steps_.size(); ++i ) for (std::size_t i = 0; i < steps_.size(); ++i)
{ {
os << " step[ " << i << " ] = " << unit::convert::to( steps_[ i ], unit::day ) << " (days)" << std::endl; os << " step[ " << i << " ] = " << unit::convert::to( steps_[ i ], unit::day ) << " (days)" << std::endl;
} }

View File

@ -23,6 +23,7 @@
#include <opm/common/OpmLog/OpmLog.hpp> #include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/input/eclipse/Units/Units.hpp> #include <opm/input/eclipse/Units/Units.hpp>
#include <cstddef>
#include <iomanip> #include <iomanip>
#include <ostream> #include <ostream>
#include <fmt/format.h> #include <fmt/format.h>
@ -247,7 +248,7 @@ namespace Opm
void SimulatorReport::fullReports(std::ostream& os) const void SimulatorReport::fullReports(std::ostream& os) const
{ {
os << " Time(day) TStep(day) Assembly LSetup LSolve Update Output WellIt Lins NewtIt LinIt Conv\n"; os << " Time(day) TStep(day) Assembly LSetup LSolve Update Output WellIt Lins NewtIt LinIt Conv\n";
for (size_t i = 0; i < this->stepreports.size(); ++i) { for (std::size_t i = 0; i < this->stepreports.size(); ++i) {
const SimulatorReportSingle& sr = this->stepreports[i]; const SimulatorReportSingle& sr = this->stepreports[i];
os.precision(10); os.precision(10);
os << std::defaultfloat; os << std::defaultfloat;

View File

@ -22,12 +22,14 @@
#include <opm/common/utility/parameters/ParameterGroup.hpp> #include <opm/common/utility/parameters/ParameterGroup.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp> #include <opm/input/eclipse/Schedule/Schedule.hpp>
#include <opm/input/eclipse/Units/Units.hpp> #include <opm/input/eclipse/Units/Units.hpp>
#include <ostream>
#include <numeric>
#include <boost/date_time/gregorian/gregorian_types.hpp> #include <boost/date_time/gregorian/gregorian_types.hpp>
#include <boost/date_time/posix_time/conversion.hpp> #include <boost/date_time/posix_time/conversion.hpp>
#include <cstddef>
#include <numeric>
#include <ostream>
namespace Opm namespace Opm
{ {
@ -65,11 +67,11 @@ namespace Opm
} }
/// Use the SimulatorTimer as a shim around opm-parser's Opm::TimeMap /// Use the SimulatorTimer as a shim around opm-parser's Opm::TimeMap
void SimulatorTimer::init(const Schedule& schedule, size_t report_step) void SimulatorTimer::init(const Schedule& schedule, std::size_t report_step)
{ {
total_time_ = schedule.seconds( schedule.size() - 1 ); total_time_ = schedule.seconds( schedule.size() - 1 );
timesteps_.resize(schedule.size() - 1); timesteps_.resize(schedule.size() - 1);
for ( size_t i = 0; i < schedule.size() - 1; ++i ) { for (std::size_t i = 0; i < schedule.size() - 1; ++i) {
timesteps_[i] = schedule.stepLength(i); timesteps_[i] = schedule.stepLength(i);
} }

View File

@ -24,6 +24,7 @@
#include <boost/date_time/gregorian/gregorian_types.hpp> #include <boost/date_time/gregorian/gregorian_types.hpp>
#include <cstddef>
#include <iosfwd> #include <iosfwd>
#include <memory> #include <memory>
#include <vector> #include <vector>
@ -52,7 +53,7 @@ namespace Opm
void init(const ParameterGroup& param); void init(const ParameterGroup& param);
/// Use the SimulatorTimer as a shim around opm-commons Schedule class /// Use the SimulatorTimer as a shim around opm-commons Schedule class
void init(const Schedule& schedule, size_t report_step = 0); void init(const Schedule& schedule, std::size_t report_step = 0);
/// Whether the current step is the first step. /// Whether the current step is the first step.
bool initialStep() const override; bool initialStep() const override;

View File

@ -27,6 +27,7 @@
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp> #include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
#include <cassert> #include <cassert>
#include <cstddef>
#include <filesystem> #include <filesystem>
#include <stdexcept> #include <stdexcept>
@ -115,7 +116,7 @@ void HDF5File::write(const std::string& group,
} else { } else {
auto grps = split_string(realGroup, '/'); auto grps = split_string(realGroup, '/');
std::string curr; std::string curr;
for (size_t i = 0; i < grps.size(); ++i) { for (std::size_t i = 0; i < grps.size(); ++i) {
if (grps[i].empty()) if (grps[i].empty())
continue; continue;
curr += '/'; curr += '/';

View File

@ -23,6 +23,8 @@
#include <opm/common/ErrorMacros.hpp> #include <opm/common/ErrorMacros.hpp>
#include <cstddef>
namespace Opm { namespace Opm {
@ -63,7 +65,7 @@ std::vector<double> ParallelFieldPropsManager::porv(bool global) const
if (m_comm.rank() == 0) if (m_comm.rank() == 0)
global_porv = m_manager.porv(true); global_porv = m_manager.porv(true);
size_t size = global_porv.size(); std::size_t size = global_porv.size();
m_comm.broadcast(&size, 1, 0); m_comm.broadcast(&size, 1, 0);
global_porv.resize(size); global_porv.resize(size);
m_comm.broadcast(global_porv.data(), size, 0); m_comm.broadcast(global_porv.data(), size, 0);
@ -124,7 +126,7 @@ std::vector<int> ParallelFieldPropsManager::get_global_int(const std::string& ke
if (exceptionThrown) if (exceptionThrown)
OPM_THROW_NOLOG(std::runtime_error, "No integer property field: " + keyword); OPM_THROW_NOLOG(std::runtime_error, "No integer property field: " + keyword);
size_t size = result.size(); std::size_t size = result.size();
m_comm.broadcast(&size, 1, 0); m_comm.broadcast(&size, 1, 0);
result.resize(size); result.resize(size);
m_comm.broadcast(result.data(), size, 0); m_comm.broadcast(result.data(), size, 0);
@ -178,7 +180,7 @@ std::vector<double> ParallelFieldPropsManager::get_global_double(const std::stri
if (exceptionThrown) if (exceptionThrown)
OPM_THROW_NOLOG(std::runtime_error, "No double property field: " + keyword); OPM_THROW_NOLOG(std::runtime_error, "No double property field: " + keyword);
size_t size = result.size(); std::size_t size = result.size();
m_comm.broadcast(&size, 1, 0); m_comm.broadcast(&size, 1, 0);
result.resize(size); result.resize(size);
m_comm.broadcast(result.data(), size, 0); m_comm.broadcast(result.data(), size, 0);

View File

@ -169,7 +169,7 @@ void
BlackoilWellModelGeneric:: BlackoilWellModelGeneric::
initFromRestartFile(const RestartValue& restartValues, initFromRestartFile(const RestartValue& restartValues,
WellTestState wtestState, WellTestState wtestState,
const size_t numCells, const std::size_t numCells,
bool handle_ms_well) bool handle_ms_well)
{ {
// The restart step value is used to identify wells present at the given // The restart step value is used to identify wells present at the given
@ -224,7 +224,7 @@ initFromRestartFile(const RestartValue& restartValues,
void void
BlackoilWellModelGeneric:: BlackoilWellModelGeneric::
prepareDeserialize(int report_step, const size_t numCells, bool handle_ms_well) prepareDeserialize(int report_step, const std::size_t numCells, bool handle_ms_well)
{ {
// wells_ecl_ should only contain wells on this processor. // wells_ecl_ should only contain wells on this processor.
wells_ecl_ = getLocalWells(report_step); wells_ecl_ = getLocalWells(report_step);
@ -1201,7 +1201,7 @@ updateWellPotentials(const int reportStepIdx,
const bool write_restart_file = schedule().write_rst_file(reportStepIdx); const bool write_restart_file = schedule().write_rst_file(reportStepIdx);
auto exc_type = ExceptionType::NONE; auto exc_type = ExceptionType::NONE;
std::string exc_msg; std::string exc_msg;
size_t widx = 0; std::size_t widx = 0;
for (const auto& well : well_container_generic_) { for (const auto& well : well_container_generic_) {
const bool needed_for_summary = const bool needed_for_summary =
((summaryConfig.hasSummaryKey( "WWPI:" + well->name()) || ((summaryConfig.hasSummaryKey( "WWPI:" + well->name()) ||
@ -1458,7 +1458,7 @@ void BlackoilWellModelGeneric::initInjMult() {
void BlackoilWellModelGeneric::updateFiltrationParticleVolume(const double dt, void BlackoilWellModelGeneric::updateFiltrationParticleVolume(const double dt,
const size_t water_index) const std::size_t water_index)
{ {
for (auto& well : this->well_container_generic_) { for (auto& well : this->well_container_generic_) {
if (well->isInjector() && well->wellEcl().getFilterConc() > 0.) { if (well->isInjector() && well->wellEcl().getFilterConc() > 0.) {

View File

@ -146,11 +146,11 @@ public:
void initFromRestartFile(const RestartValue& restartValues, void initFromRestartFile(const RestartValue& restartValues,
WellTestState wtestState, WellTestState wtestState,
const size_t numCells, const std::size_t numCells,
bool handle_ms_well); bool handle_ms_well);
void prepareDeserialize(int report_step, void prepareDeserialize(int report_step,
const size_t numCells, const std::size_t numCells,
bool handle_ms_well); bool handle_ms_well);
/* /*
@ -386,7 +386,7 @@ protected:
void updateInjMult(DeferredLogger& deferred_logger); void updateInjMult(DeferredLogger& deferred_logger);
void updateInjFCMult(DeferredLogger& deferred_logger); void updateInjFCMult(DeferredLogger& deferred_logger);
void updateFiltrationParticleVolume(const double dt, const size_t water_index); void updateFiltrationParticleVolume(const double dt, const std::size_t water_index);
// create the well container // create the well container
virtual void createWellContainer(const int time_step) = 0; virtual void createWellContainer(const int time_step) = 0;

View File

@ -1007,9 +1007,9 @@ namespace Opm {
const double dt = this->ebosSimulator_.timeStepSize(); const double dt = this->ebosSimulator_.timeStepSize();
// TODO: should we also have the group and network backed-up here in case the solution did not get converged? // TODO: should we also have the group and network backed-up here in case the solution did not get converged?
auto& well_state = this->wellState(); auto& well_state = this->wellState();
constexpr size_t max_iter = 100; constexpr std::size_t max_iter = 100;
bool converged = false; bool converged = false;
size_t iter = 0; std::size_t iter = 0;
bool changed_well_group = false; bool changed_well_group = false;
do { do {
changed_well_group = updateWellControlsAndNetwork(true, dt, deferred_logger); changed_well_group = updateWellControlsAndNetwork(true, dt, deferred_logger);
@ -1107,9 +1107,9 @@ namespace Opm {
bool do_network_update = true; bool do_network_update = true;
bool well_group_control_changed = false; bool well_group_control_changed = false;
// after certain number of the iterations, we use relaxed tolerance for the network update // after certain number of the iterations, we use relaxed tolerance for the network update
const size_t iteration_to_relax = param_.network_max_strict_iterations_; const std::size_t iteration_to_relax = param_.network_max_strict_iterations_;
// after certain number of the iterations, we terminate // after certain number of the iterations, we terminate
const size_t max_iteration = param_.network_max_iterations_; const std::size_t max_iteration = param_.network_max_iterations_;
std::size_t network_update_iteration = 0; std::size_t network_update_iteration = 0;
while (do_network_update) { while (do_network_update) {
if (network_update_iteration == iteration_to_relax) { if (network_update_iteration == iteration_to_relax) {

View File

@ -29,12 +29,14 @@
#include <opm/simulators/wells/WellInterfaceGeneric.hpp> #include <opm/simulators/wells/WellInterfaceGeneric.hpp>
#include <opm/simulators/wells/WellState.hpp> #include <opm/simulators/wells/WellState.hpp>
#include <opm/simulators/wells/GasLiftGroupInfo.hpp> #include <opm/simulators/wells/GasLiftGroupInfo.hpp>
#include <cmath>
#include <optional>
#include <string>
#include <fmt/format.h> #include <fmt/format.h>
#include <cmath>
#include <cstddef>
#include <optional>
#include <string>
namespace Opm { namespace Opm {
GasLiftStage2::GasLiftStage2( GasLiftStage2::GasLiftStage2(
@ -372,7 +374,7 @@ mpiSyncLocalToGlobalGradVector_(
using Pair = std::pair<int, double>; using Pair = std::pair<int, double>;
std::vector<Pair> grads_local_tmp; std::vector<Pair> grads_local_tmp;
grads_local_tmp.reserve(grads_local.size()); grads_local_tmp.reserve(grads_local.size());
for (size_t i = 0; i < grads_local.size(); ++i) { for (std::size_t i = 0; i < grads_local.size(); ++i) {
if (!this->well_state_.wellIsOwned(grads_local[i].first)) if (!this->well_state_.wellIsOwned(grads_local[i].first))
continue; continue;
grads_local_tmp.push_back( grads_local_tmp.push_back(
@ -395,7 +397,7 @@ mpiSyncLocalToGlobalGradVector_(
// memory is not reallocated here // memory is not reallocated here
grads_global.clear(); grads_global.clear();
for (size_t i = 0; i < grads_global_tmp.size(); ++i) { for (std::size_t i = 0; i < grads_global_tmp.size(); ++i) {
grads_global.emplace_back( grads_global.emplace_back(
std::make_pair( std::make_pair(
well_state_.globalIdxToWellName(grads_global_tmp[i].first), well_state_.globalIdxToWellName(grads_global_tmp[i].first),

View File

@ -43,6 +43,7 @@
#endif // HAVE_UMFPACK #endif // HAVE_UMFPACK
#include <cmath> #include <cmath>
#include <cstddef>
namespace { namespace {
@ -118,8 +119,8 @@ applyUMFPack(Dune::UMFPack<MatrixType>& linsolver,
// Checking if there is any inf or nan in y // Checking if there is any inf or nan in y
// it will be the solution before we find a way to catch the singularity of the matrix // it will be the solution before we find a way to catch the singularity of the matrix
for (size_t i_block = 0; i_block < y.size(); ++i_block) { for (std::size_t i_block = 0; i_block < y.size(); ++i_block) {
for (size_t i_elem = 0; i_elem < y[i_block].size(); ++i_elem) { for (std::size_t i_elem = 0; i_elem < y[i_block].size(); ++i_elem) {
if (std::isinf(y[i_block][i_elem]) || std::isnan(y[i_block][i_elem]) ) { if (std::isinf(y[i_block][i_elem]) || std::isnan(y[i_block][i_elem]) ) {
const std::string msg{"nan or inf value found after UMFPack solve due to singular matrix"}; const std::string msg{"nan or inf value found after UMFPack solve due to singular matrix"};
OpmLog::debug(msg); OpmLog::debug(msg);

View File

@ -25,7 +25,6 @@
#include <opm/simulators/wells/MultisegmentWellEquations.hpp> #include <opm/simulators/wells/MultisegmentWellEquations.hpp>
#include <dune/istl/umfpack.hh> #include <dune/istl/umfpack.hh>
#include <opm/input/eclipse/Schedule/MSW/WellSegments.hpp> #include <opm/input/eclipse/Schedule/MSW/WellSegments.hpp>
#if COMPILE_BDA_BRIDGE #if COMPILE_BDA_BRIDGE
@ -40,6 +39,7 @@
#include <opm/simulators/wells/MultisegmentWellGeneric.hpp> #include <opm/simulators/wells/MultisegmentWellGeneric.hpp>
#include <opm/simulators/wells/WellInterfaceGeneric.hpp> #include <opm/simulators/wells/WellInterfaceGeneric.hpp>
#include <cstddef>
#include <stdexcept> #include <stdexcept>
namespace Opm { namespace Opm {
@ -278,11 +278,11 @@ extract(SparseMatrixAdapter& jacobian) const
// perforation at cell j connected to segment i. The code // perforation at cell j connected to segment i. The code
// assumes that no cell is connected to more than one segment, // assumes that no cell is connected to more than one segment,
// i.e. the columns of B/C have no more than one nonzero. // i.e. the columns of B/C have no more than one nonzero.
for (size_t rowC = 0; rowC < duneC_.N(); ++rowC) { for (std::size_t rowC = 0; rowC < duneC_.N(); ++rowC) {
for (auto colC = duneC_[rowC].begin(), for (auto colC = duneC_[rowC].begin(),
endC = duneC_[rowC].end(); colC != endC; ++colC) { endC = duneC_[rowC].end(); colC != endC; ++colC) {
const auto row_index = colC.index(); const auto row_index = colC.index();
for (size_t rowB = 0; rowB < duneB_.N(); ++rowB) { for (std::size_t rowB = 0; rowB < duneB_.N(); ++rowB) {
for (auto colB = duneB_[rowB].begin(), for (auto colB = duneB_[rowB].begin(),
endB = duneB_[rowB].end(); colB != endB; ++colB) { endB = duneB_[rowB].end(); colB != endB; ++colB) {
const auto col_index = colB.index(); const auto col_index = colB.index();
@ -313,14 +313,14 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
// Add for coupling from well to reservoir // Add for coupling from well to reservoir
const int welldof_ind = duneC_.M() + well.indexOfWell(); const int welldof_ind = duneC_.M() + well.indexOfWell();
if (!well.isPressureControlled(well_state)) { if (!well.isPressureControlled(well_state)) {
for (size_t rowC = 0; rowC < duneC_.N(); ++rowC) { for (std::size_t rowC = 0; rowC < duneC_.N(); ++rowC) {
for (auto colC = duneC_[rowC].begin(), for (auto colC = duneC_[rowC].begin(),
endC = duneC_[rowC].end(); colC != endC; ++colC) { endC = duneC_[rowC].end(); colC != endC; ++colC) {
const auto row_index = colC.index(); const auto row_index = colC.index();
const auto& bw = weights[row_index]; const auto& bw = weights[row_index];
double matel = 0.0; double matel = 0.0;
for(size_t i = 0; i< bw.size(); ++i){ for (std::size_t i = 0; i< bw.size(); ++i) {
matel += bw[i]*(*colC)[seg_pressure_var_ind][i]; matel += bw[i]*(*colC)[seg_pressure_var_ind][i];
} }
jacobian[row_index][welldof_ind] += matel; jacobian[row_index][welldof_ind] += matel;
@ -333,7 +333,7 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
auto well_weight = weights[0]; auto well_weight = weights[0];
well_weight = 0.0; well_weight = 0.0;
int num_perfs = 0; int num_perfs = 0;
for (size_t rowB = 0; rowB < duneB_.N(); ++rowB) { for (std::size_t rowB = 0; rowB < duneB_.N(); ++rowB) {
for (auto colB = duneB_[rowB].begin(), for (auto colB = duneB_[rowB].begin(),
endB = duneB_[rowB].end(); colB != endB; ++colB) { endB = duneB_[rowB].end(); colB != endB; ++colB) {
const auto col_index = colB.index(); const auto col_index = colB.index();
@ -348,13 +348,13 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
// Add for coupling from reservoir to well and caclulate diag elelement corresping to incompressible standard well // Add for coupling from reservoir to well and caclulate diag elelement corresping to incompressible standard well
double diag_ell = 0.0; double diag_ell = 0.0;
for (size_t rowB = 0; rowB < duneB_.N(); ++rowB) { for (std::size_t rowB = 0; rowB < duneB_.N(); ++rowB) {
const auto& bw = well_weight; const auto& bw = well_weight;
for (auto colB = duneB_[rowB].begin(), for (auto colB = duneB_[rowB].begin(),
endB = duneB_[rowB].end(); colB != endB; ++colB) { endB = duneB_[rowB].end(); colB != endB; ++colB) {
const auto col_index = colB.index(); const auto col_index = colB.index();
double matel = 0.0; double matel = 0.0;
for(size_t i = 0; i< bw.size(); ++i){ for (std::size_t i = 0; i< bw.size(); ++i) {
matel += bw[i] *(*colB)[i][pressureVarIndex]; matel += bw[i] *(*colB)[i][pressureVarIndex];
} }
jacobian[welldof_ind][col_index] += matel; jacobian[welldof_ind][col_index] += matel;

View File

@ -53,7 +53,7 @@ template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>:: void MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
init() init()
{ {
for (size_t seg = 0; seg < value_.size(); ++seg) { for (std::size_t seg = 0; seg < value_.size(); ++seg) {
for (int eq_idx = 0; eq_idx < numWellEq; ++eq_idx) { for (int eq_idx = 0; eq_idx < numWellEq; ++eq_idx) {
evaluation_[seg][eq_idx] = 0.0; evaluation_[seg][eq_idx] = 0.0;
evaluation_[seg][eq_idx].setValue(value_[seg][eq_idx]); evaluation_[seg][eq_idx].setValue(value_[seg][eq_idx]);
@ -85,7 +85,7 @@ update(const WellState& well_state, const bool stop_or_zero_rate_target)
const auto& segment_pressure = segments.pressure; const auto& segment_pressure = segments.pressure;
const PhaseUsage& pu = well_.phaseUsage(); const PhaseUsage& pu = well_.phaseUsage();
for (size_t seg = 0; seg < value_.size(); ++seg) { for (std::size_t seg = 0; seg < value_.size(); ++seg) {
// calculate the total rate for each segment // calculate the total rate for each segment
double total_seg_rate = 0.0; double total_seg_rate = 0.0;
// the segment pressure // the segment pressure
@ -160,7 +160,7 @@ updateNewton(const BVectorWell& dwells,
{ {
const std::vector<std::array<double, numWellEq>> old_primary_variables = value_; const std::vector<std::array<double, numWellEq>> old_primary_variables = value_;
for (size_t seg = 0; seg < value_.size(); ++seg) { for (std::size_t seg = 0; seg < value_.size(); ++seg) {
if (has_wfrac_variable) { if (has_wfrac_variable) {
const int sign = dwells[seg][WFrac] > 0. ? 1 : -1; const int sign = dwells[seg][WFrac] > 0. ? 1 : -1;
const double dx_limited = sign * std::min(std::abs(dwells[seg][WFrac]) * relaxation_factor, dFLimit); const double dx_limited = sign * std::min(std::abs(dwells[seg][WFrac]) * relaxation_factor, dFLimit);
@ -228,7 +228,7 @@ copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
auto& disgas = segments.dissolved_gas_rate; auto& disgas = segments.dissolved_gas_rate;
auto& vapoil = segments.vaporized_oil_rate; auto& vapoil = segments.vaporized_oil_rate;
auto& segment_pressure = segments.pressure; auto& segment_pressure = segments.pressure;
for (size_t seg = 0; seg < value_.size(); ++seg) { for (std::size_t seg = 0; seg < value_.size(); ++seg) {
std::vector<double> fractions(well_.numPhases(), 0.0); std::vector<double> fractions(well_.numPhases(), 0.0);
fractions[oil_pos] = 1.0; fractions[oil_pos] = 1.0;
@ -540,7 +540,7 @@ typename MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>:: MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
getSegmentRateUpwinding(const int seg, getSegmentRateUpwinding(const int seg,
const int seg_upwind, const int seg_upwind,
const size_t comp_idx) const const std::size_t comp_idx) const
{ {
// the result will contain the derivative with respect to WQTotal in segment seg, // the result will contain the derivative with respect to WQTotal in segment seg,
// and the derivatives with respect to WFrac GFrac in segment seg_upwind. // and the derivatives with respect to WFrac GFrac in segment seg_upwind.

View File

@ -28,6 +28,7 @@
#include <opm/input/eclipse/Schedule/SummaryState.hpp> #include <opm/input/eclipse/Schedule/SummaryState.hpp>
#include <array> #include <array>
#include <cstddef>
#include <vector> #include <vector>
namespace Opm namespace Opm
@ -119,7 +120,7 @@ public:
//! \brief Returns upwinding rate for a component in a segment. //! \brief Returns upwinding rate for a component in a segment.
EvalWell getSegmentRateUpwinding(const int seg, EvalWell getSegmentRateUpwinding(const int seg,
const int seg_upwind, const int seg_upwind,
const size_t comp_idx) const; const std::size_t comp_idx) const;
//! \brief Get bottomhole pressure. //! \brief Get bottomhole pressure.
EvalWell getBhp() const; EvalWell getBhp() const;

View File

@ -88,7 +88,7 @@ MultisegmentWellSegments(const int numSegments,
int i_perf_wells = 0; int i_perf_wells = 0;
well.perfDepth().resize(well_.numPerfs(), 0.); well.perfDepth().resize(well_.numPerfs(), 0.);
const auto& segment_set = well_.wellEcl().getSegments(); const auto& segment_set = well_.wellEcl().getSegments();
for (size_t perf = 0; perf < completion_set.size(); ++perf) { for (std::size_t perf = 0; perf < completion_set.size(); ++perf) {
const Connection& connection = completion_set.get(perf); const Connection& connection = completion_set.get(perf);
if (connection.state() == Connection::State::OPEN) { if (connection.state() == Connection::State::OPEN) {
const int segment_index = segment_set.segmentNumberToIndex(connection.segment()); const int segment_index = segment_set.segmentNumberToIndex(connection.segment());
@ -148,7 +148,7 @@ computeFluidProperties(const EvalWell& temperature,
surf_dens[compIdx] = FluidSystem::referenceDensity( phaseIdx, pvt_region_index); surf_dens[compIdx] = FluidSystem::referenceDensity( phaseIdx, pvt_region_index);
} }
for (size_t seg = 0; seg < perforations_.size(); ++seg) { for (std::size_t seg = 0; seg < perforations_.size(); ++seg) {
// the compostion of the components inside wellbore under surface condition // the compostion of the components inside wellbore under surface condition
std::vector<EvalWell> mix_s(well_.numComponents(), 0.0); std::vector<EvalWell> mix_s(well_.numComponents(), 0.0);
for (int comp_idx = 0; comp_idx < well_.numComponents(); ++comp_idx) { for (int comp_idx = 0; comp_idx < well_.numComponents(); ++comp_idx) {
@ -310,7 +310,7 @@ template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellSegments<FluidSystem,Indices,Scalar>:: void MultisegmentWellSegments<FluidSystem,Indices,Scalar>::
updateUpwindingSegments(const PrimaryVariables& primary_variables) updateUpwindingSegments(const PrimaryVariables& primary_variables)
{ {
for (size_t seg = 0; seg < perforations_.size(); ++seg) { for (std::size_t seg = 0; seg < perforations_.size(); ++seg) {
// special treatment is needed for segment 0 // special treatment is needed for segment 0
if (seg == 0) { if (seg == 0) {
// we are not supposed to have injecting producers and producing injectors // we are not supposed to have injecting producers and producing injectors

View File

@ -35,8 +35,9 @@
#include <opm/simulators/wells/WellBhpThpCalculator.hpp> #include <opm/simulators/wells/WellBhpThpCalculator.hpp>
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp> #include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
#include <string>
#include <algorithm> #include <algorithm>
#include <cstddef>
#include <string>
#if HAVE_CUDA || HAVE_OPENCL #if HAVE_CUDA || HAVE_OPENCL
#include <opm/simulators/linalg/bda/WellContributions.hpp> #include <opm/simulators/linalg/bda/WellContributions.hpp>
@ -1044,7 +1045,7 @@ namespace Opm
* this->segments_.perforation_depth_diff(perf); * this->segments_.perforation_depth_diff(perf);
const double perf_press = segment_pres + perf_seg_press_diff; const double perf_press = segment_pres + perf_seg_press_diff;
const double multiplier = this->getInjMult(perf, segment_pres, perf_press); const double multiplier = this->getInjMult(perf, segment_pres, perf_press);
for (size_t i = 0; i < mob.size(); ++i) { for (std::size_t i = 0; i < mob.size(); ++i) {
mob[i] *= multiplier; mob[i] *= multiplier;
} }
} }
@ -1160,7 +1161,7 @@ namespace Opm
// calculating the b for the connection // calculating the b for the connection
std::vector<double> b_perf(this->num_components_); std::vector<double> b_perf(this->num_components_);
for (size_t phase = 0; phase < FluidSystem::numPhases; ++phase) { for (std::size_t phase = 0; phase < FluidSystem::numPhases; ++phase) {
if (!FluidSystem::phaseIsActive(phase)) { if (!FluidSystem::phaseIsActive(phase)) {
continue; continue;
} }
@ -1209,7 +1210,7 @@ namespace Opm
ipr_b_perf[oil_comp_idx] += vap_oil_b; ipr_b_perf[oil_comp_idx] += vap_oil_b;
} }
for (size_t comp_idx = 0; comp_idx < ipr_a_perf.size(); ++comp_idx) { for (std::size_t comp_idx = 0; comp_idx < ipr_a_perf.size(); ++comp_idx) {
this->ipr_a_[comp_idx] += ipr_a_perf[comp_idx]; this->ipr_a_[comp_idx] += ipr_a_perf[comp_idx];
this->ipr_b_[comp_idx] += ipr_b_perf[comp_idx]; this->ipr_b_[comp_idx] += ipr_b_perf[comp_idx];
} }

View File

@ -35,6 +35,7 @@
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <cstddef>
namespace Opm namespace Opm
{ {
@ -164,7 +165,7 @@ void StandardWellEquations<Scalar,numEq>::invert()
} catch (NumericalProblem&) { } catch (NumericalProblem&) {
// for singular matrices, use identity as the inverse // for singular matrices, use identity as the inverse
invDuneD_[0][0] = 0.0; invDuneD_[0][0] = 0.0;
for (size_t i = 0; i < invDuneD_[0][0].rows(); ++i) { for (std::size_t i = 0; i < invDuneD_[0][0].rows(); ++i) {
invDuneD_[0][0][i][i] = 1.0; invDuneD_[0][0][i][i] = 1.0;
} }
} }
@ -316,7 +317,7 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
const auto& bw = weights[row_ind]; const auto& bw = weights[row_ind];
double matel = 0; double matel = 0;
assert((*colC).M() == bw.size()); assert((*colC).M() == bw.size());
for (size_t i = 0; i < bw.size(); ++i) { for (std::size_t i = 0; i < bw.size(); ++i) {
matel += (*colC)[bhp_var_index][i] * bw[i]; matel += (*colC)[bhp_var_index][i] * bw[i];
} }
@ -328,7 +329,7 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
cell_weights /= nperf; cell_weights /= nperf;
BVectorWell bweights(1); BVectorWell bweights(1);
size_t blockSz = duneD_[0][0].N(); std::size_t blockSz = duneD_[0][0].N();
bweights[0].resize(blockSz); bweights[0].resize(blockSz);
bweights[0] = 0.0; bweights[0] = 0.0;
double diagElem = 0; double diagElem = 0;
@ -343,15 +344,15 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
DiagMatrixBlockWellType inv_diag_block = invDuneD_[0][0]; DiagMatrixBlockWellType inv_diag_block = invDuneD_[0][0];
DiagMatrixBlockWellType inv_diag_block_transpose = DiagMatrixBlockWellType inv_diag_block_transpose =
Opm::wellhelpers::transposeDenseDynMatrix(inv_diag_block); Opm::wellhelpers::transposeDenseDynMatrix(inv_diag_block);
for (size_t i = 0; i < blockSz; ++i) { for (std::size_t i = 0; i < blockSz; ++i) {
bweights[0][i] = 0; bweights[0][i] = 0;
for (size_t j = 0; j < blockSz; ++j) { for (std::size_t j = 0; j < blockSz; ++j) {
bweights[0][i] += inv_diag_block_transpose[i][j] * rhs[0][j]; bweights[0][i] += inv_diag_block_transpose[i][j] * rhs[0][j];
} }
abs_max = std::max(abs_max, std::fabs(bweights[0][i])); abs_max = std::max(abs_max, std::fabs(bweights[0][i]));
} }
assert(abs_max > 0.0); assert(abs_max > 0.0);
for (size_t i = 0; i < blockSz; ++i) { for (std::size_t i = 0; i < blockSz; ++i) {
bweights[0][i] /= abs_max; bweights[0][i] /= abs_max;
} }
diagElem = 1.0 / abs_max; diagElem = 1.0 / abs_max;
@ -361,13 +362,13 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
bweights[0][blockSz-1] = 1.0; bweights[0][blockSz-1] = 1.0;
diagElem = 1.0; // better scaling could have used the calculation below if weights were calculated diagElem = 1.0; // better scaling could have used the calculation below if weights were calculated
} else { } else {
for (size_t i = 0; i < cell_weights.size(); ++i) { for (std::size_t i = 0; i < cell_weights.size(); ++i) {
bweights[0][i] = cell_weights[i]; bweights[0][i] = cell_weights[i];
} }
bweights[0][blockSz-1] = 0.0; bweights[0][blockSz-1] = 0.0;
diagElem = 0.0; diagElem = 0.0;
const auto& locmat = duneD_[0][0]; const auto& locmat = duneD_[0][0];
for (size_t i = 0; i < cell_weights.size(); ++i) { for (std::size_t i = 0; i < cell_weights.size(); ++i) {
diagElem += locmat[i][bhp_var_index] * cell_weights[i]; diagElem += locmat[i][bhp_var_index] * cell_weights[i];
} }
@ -382,7 +383,7 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
const auto col_index = colB.index(); const auto col_index = colB.index();
const auto& bw = bweights[0]; const auto& bw = bweights[0];
double matel = 0; double matel = 0;
for (size_t i = 0; i < bw.size(); ++i) { for (std::size_t i = 0; i < bw.size(); ++i) {
matel += (*colB)[i][pressureVarIndex] * bw[i]; matel += (*colB)[i][pressureVarIndex] * bw[i];
} }
jacobian[welldof_ind][col_index] = matel; jacobian[welldof_ind][col_index] = matel;

View File

@ -39,8 +39,7 @@
#include <cassert> #include <cassert>
#include <cmath> #include <cmath>
#include <cstddef>
namespace Opm namespace Opm
{ {
@ -93,7 +92,7 @@ void
StandardWellEval<FluidSystem,Indices,Scalar>:: StandardWellEval<FluidSystem,Indices,Scalar>::
computeAccumWell() computeAccumWell()
{ {
for (size_t eq_idx = 0; eq_idx < F0_.size(); ++eq_idx) { for (std::size_t eq_idx = 0; eq_idx < F0_.size(); ++eq_idx) {
F0_[eq_idx] = this->primary_variables_.surfaceVolumeFraction(eq_idx).value(); F0_[eq_idx] = this->primary_variables_.surfaceVolumeFraction(eq_idx).value();
} }
} }

View File

@ -34,10 +34,10 @@
#include <fmt/format.h> #include <fmt/format.h>
#include <algorithm> #include <algorithm>
#include <cstddef>
#include <functional> #include <functional>
#include <numeric> #include <numeric>
namespace { namespace {
template<class dValue, class Value> template<class dValue, class Value>
@ -648,10 +648,11 @@ namespace Opm
if constexpr (!Base::has_polymermw) { if constexpr (!Base::has_polymermw) {
if constexpr (std::is_same_v<Value, Scalar>) { if constexpr (std::is_same_v<Value, Scalar>) {
std::vector<EvalWell> mob_eval(this->num_components_, {this->primary_variables_.numWellEq() + Indices::numEq, 0.}); std::vector<EvalWell> mob_eval(this->num_components_, {this->primary_variables_.numWellEq() + Indices::numEq, 0.});
for (size_t i = 0; i < mob.size(); ++i) for (std::size_t i = 0; i < mob.size(); ++i) {
mob_eval[i].setValue(mob[i]); mob_eval[i].setValue(mob[i]);
}
updateWaterMobilityWithPolymer(ebosSimulator, perf, mob_eval, deferred_logger); updateWaterMobilityWithPolymer(ebosSimulator, perf, mob_eval, deferred_logger);
for (size_t i = 0; i < mob.size(); ++i) { for (std::size_t i = 0; i < mob.size(); ++i) {
mob[i] = getValue(mob_eval[i]); mob[i] = getValue(mob_eval[i]);
} }
} else { } else {
@ -665,7 +666,7 @@ namespace Opm
const double bhp = this->primary_variables_.value(Bhp); const double bhp = this->primary_variables_.value(Bhp);
const double perf_press = bhp + this->connections_.pressure_diff(perf); const double perf_press = bhp + this->connections_.pressure_diff(perf);
const double multiplier = this->getInjMult(perf, bhp, perf_press); const double multiplier = this->getInjMult(perf, bhp, perf_press);
for (size_t i = 0; i < mob.size(); ++i) { for (std::size_t i = 0; i < mob.size(); ++i) {
mob[i] *= multiplier; mob[i] *= multiplier;
} }
} }
@ -759,7 +760,7 @@ namespace Opm
// calculating the b for the connection // calculating the b for the connection
std::vector<double> b_perf(this->num_components_); std::vector<double> b_perf(this->num_components_);
for (size_t phase = 0; phase < FluidSystem::numPhases; ++phase) { for (std::size_t phase = 0; phase < FluidSystem::numPhases; ++phase) {
if (!FluidSystem::phaseIsActive(phase)) { if (!FluidSystem::phaseIsActive(phase)) {
continue; continue;
} }
@ -816,7 +817,7 @@ namespace Opm
ipr_b_perf[oil_comp_idx] += vap_oil_b; ipr_b_perf[oil_comp_idx] += vap_oil_b;
} }
for (size_t comp_idx = 0; comp_idx < ipr_a_perf.size(); ++comp_idx) { for (std::size_t comp_idx = 0; comp_idx < ipr_a_perf.size(); ++comp_idx) {
this->ipr_a_[comp_idx] += ipr_a_perf[comp_idx]; this->ipr_a_[comp_idx] += ipr_a_perf[comp_idx];
this->ipr_b_[comp_idx] += ipr_b_perf[comp_idx]; this->ipr_b_[comp_idx] += ipr_b_perf[comp_idx];
} }

View File

@ -27,7 +27,7 @@
#include <opm/simulators/wells/VFPHelpers.hpp> #include <opm/simulators/wells/VFPHelpers.hpp>
#include <cstddef>
namespace Opm { namespace Opm {
@ -125,7 +125,7 @@ bhpwithflo(const std::vector<double>& flos,
const auto alq_i = detail::findInterpData( alq, table.getALQAxis()); //assume constant const auto alq_i = detail::findInterpData( alq, table.getALQAxis()); //assume constant
std::vector<double> bhps(flos.size(), 0.); std::vector<double> bhps(flos.size(), 0.);
for (size_t i = 0; i < flos.size(); ++i) { for (std::size_t i = 0; i < flos.size(); ++i) {
// Value of FLO is negative in OPM for producers, but positive in VFP table // Value of FLO is negative in OPM for producers, but positive in VFP table
const auto flo_i = detail::findInterpData(-flos[i], table.getFloAxis()); const auto flo_i = detail::findInterpData(-flos[i], table.getFloAxis());
const detail::VFPEvaluation bhp_val = detail::interpolate(table, flo_i, thp_i, wfr_i, gfr_i, alq_i); const detail::VFPEvaluation bhp_val = detail::interpolate(table, flo_i, thp_i, wfr_i, gfr_i, alq_i);

View File

@ -25,6 +25,7 @@
#include <opm/simulators/wells/WellState.hpp> #include <opm/simulators/wells/WellState.hpp>
#include <opm/simulators/wells/VFPHelpers.hpp> #include <opm/simulators/wells/VFPHelpers.hpp>
#include <cstddef>
#include <map> #include <map>
namespace Opm { namespace Opm {
@ -71,7 +72,7 @@ public:
return &m_prod; return &m_prod;
} }
double getExplicitWFR(const int table_id, const size_t well_index) const { double getExplicitWFR(const int table_id, const std::size_t well_index) const {
const auto& rates = well_state_.well(well_index).prev_surface_rates; const auto& rates = well_state_.well(well_index).prev_surface_rates;
const auto& pu = well_state_.phaseUsage(); const auto& pu = well_state_.phaseUsage();
const auto& aqua = pu.phase_used[BlackoilPhases::Aqua]? rates[pu.phase_pos[BlackoilPhases::Aqua]]:0.0; const auto& aqua = pu.phase_used[BlackoilPhases::Aqua]? rates[pu.phase_pos[BlackoilPhases::Aqua]]:0.0;
@ -81,7 +82,7 @@ public:
return detail::getWFR(table, aqua, liquid, vapour); return detail::getWFR(table, aqua, liquid, vapour);
} }
double getExplicitGFR(const int table_id, const size_t well_index) const { double getExplicitGFR(const int table_id, const std::size_t well_index) const {
const auto& rates = well_state_.well(well_index).prev_surface_rates; const auto& rates = well_state_.well(well_index).prev_surface_rates;
const auto& pu = well_state_.phaseUsage(); const auto& pu = well_state_.phaseUsage();
const auto& aqua = pu.phase_used[BlackoilPhases::Aqua]? rates[pu.phase_pos[BlackoilPhases::Aqua]]:0.0; const auto& aqua = pu.phase_used[BlackoilPhases::Aqua]? rates[pu.phase_pos[BlackoilPhases::Aqua]]:0.0;

View File

@ -37,6 +37,7 @@
#include <opm/simulators/wells/WellState.hpp> #include <opm/simulators/wells/WellState.hpp>
#include <algorithm> #include <algorithm>
#include <cstddef>
#include <cassert> #include <cassert>
namespace Opm namespace Opm
@ -164,9 +165,9 @@ getGroupInjectionControl(const Group& group,
const auto chain = WellGroupHelpers::groupChainTopBot(well_.name(), group.name(), const auto chain = WellGroupHelpers::groupChainTopBot(well_.name(), group.name(),
schedule, well_.currentStep()); schedule, well_.currentStep());
// Because 'name' is the last of the elements, and not an ancestor, we subtract one below. // Because 'name' is the last of the elements, and not an ancestor, we subtract one below.
const size_t num_ancestors = chain.size() - 1; const std::size_t num_ancestors = chain.size() - 1;
double target = orig_target; double target = orig_target;
for (size_t ii = 0; ii < num_ancestors; ++ii) { for (std::size_t ii = 0; ii < num_ancestors; ++ii) {
if ((ii == 0) || well_.guideRate()->has(chain[ii], injectionPhase)) { if ((ii == 0) || well_.guideRate()->has(chain[ii], injectionPhase)) {
// Apply local reductions only at the control level // Apply local reductions only at the control level
// (top) and for levels where we have a specified // (top) and for levels where we have a specified
@ -284,9 +285,9 @@ getGroupInjectionTargetRate(const Group& group,
const auto chain = WellGroupHelpers::groupChainTopBot(well_.name(), group.name(), schedule, well_.currentStep()); const auto chain = WellGroupHelpers::groupChainTopBot(well_.name(), group.name(), schedule, well_.currentStep());
// Because 'name' is the last of the elements, and not an ancestor, we subtract one below. // Because 'name' is the last of the elements, and not an ancestor, we subtract one below.
const size_t num_ancestors = chain.size() - 1; const std::size_t num_ancestors = chain.size() - 1;
double target = orig_target; double target = orig_target;
for (size_t ii = 0; ii < num_ancestors; ++ii) { for (std::size_t ii = 0; ii < num_ancestors; ++ii) {
if ((ii == 0) || well_.guideRate()->has(chain[ii], injectionPhase)) { if ((ii == 0) || well_.guideRate()->has(chain[ii], injectionPhase)) {
// Apply local reductions only at the control level // Apply local reductions only at the control level
// (top) and for levels where we have a specified // (top) and for levels where we have a specified
@ -388,9 +389,9 @@ void WellGroupControls::getGroupProductionControl(const Group& group,
const auto chain = WellGroupHelpers::groupChainTopBot(well_.name(), group.name(), const auto chain = WellGroupHelpers::groupChainTopBot(well_.name(), group.name(),
schedule, well_.currentStep()); schedule, well_.currentStep());
// Because 'name' is the last of the elements, and not an ancestor, we subtract one below. // Because 'name' is the last of the elements, and not an ancestor, we subtract one below.
const size_t num_ancestors = chain.size() - 1; const std::size_t num_ancestors = chain.size() - 1;
double target = orig_target; double target = orig_target;
for (size_t ii = 0; ii < num_ancestors; ++ii) { for (std::size_t ii = 0; ii < num_ancestors; ++ii) {
if ((ii == 0) || well_.guideRate()->has(chain[ii])) { if ((ii == 0) || well_.guideRate()->has(chain[ii])) {
// Apply local reductions only at the control level // Apply local reductions only at the control level
// (top) and for levels where we have a specified // (top) and for levels where we have a specified
@ -474,9 +475,9 @@ getGroupProductionTargetRate(const Group& group,
const auto chain = WellGroupHelpers::groupChainTopBot(well_.name(), group.name(), const auto chain = WellGroupHelpers::groupChainTopBot(well_.name(), group.name(),
schedule, well_.currentStep()); schedule, well_.currentStep());
// Because 'name' is the last of the elements, and not an ancestor, we subtract one below. // Because 'name' is the last of the elements, and not an ancestor, we subtract one below.
const size_t num_ancestors = chain.size() - 1; const std::size_t num_ancestors = chain.size() - 1;
double target = orig_target; double target = orig_target;
for (size_t ii = 0; ii < num_ancestors; ++ii) { for (std::size_t ii = 0; ii < num_ancestors; ++ii) {
if ((ii == 0) || well_.guideRate()->has(chain[ii])) { if ((ii == 0) || well_.guideRate()->has(chain[ii])) {
// Apply local reductions only at the control level // Apply local reductions only at the control level
// (top) and for levels where we have a specified // (top) and for levels where we have a specified

View File

@ -43,6 +43,7 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <cstddef>
#include <set> #include <set>
#include <stack> #include <stack>
#include <stdexcept> #include <stdexcept>
@ -847,7 +848,7 @@ namespace WellGroupHelpers
up = down; up = down;
} else { } else {
assert (up.size() == down.size()); assert (up.size() == down.size());
for (size_t ii = 0; ii < up.size(); ++ii) { for (std::size_t ii = 0; ii < up.size(); ++ii) {
up[ii] += down[ii]; up[ii] += down[ii];
} }
} }
@ -1306,10 +1307,10 @@ namespace WellGroupHelpers
= -tcalc.calcModeRateFromRates(rates); // Switch sign since 'rates' are negative for producers. = -tcalc.calcModeRateFromRates(rates); // Switch sign since 'rates' are negative for producers.
const auto chain = groupChainTopBot(name, group.name(), schedule, reportStepIdx); const auto chain = groupChainTopBot(name, group.name(), schedule, reportStepIdx);
// Because 'name' is the last of the elements, and not an ancestor, we subtract one below. // Because 'name' is the last of the elements, and not an ancestor, we subtract one below.
const size_t num_ancestors = chain.size() - 1; const std::size_t num_ancestors = chain.size() - 1;
// we need to find out the level where the current well is applied to the local reduction // we need to find out the level where the current well is applied to the local reduction
size_t local_reduction_level = 0; std::size_t local_reduction_level = 0;
for (size_t ii = 1; ii < num_ancestors; ++ii) { for (std::size_t ii = 1; ii < num_ancestors; ++ii) {
const int num_gr_ctrl = groupControlledWells(schedule, const int num_gr_ctrl = groupControlledWells(schedule,
wellState, wellState,
group_state, group_state,
@ -1323,7 +1324,7 @@ namespace WellGroupHelpers
} }
} }
// check whether guide rate is violated // check whether guide rate is violated
for (size_t ii = 1; ii < num_ancestors; ++ii) { for (std::size_t ii = 1; ii < num_ancestors; ++ii) {
if (guideRate->has(chain[ii])) { if (guideRate->has(chain[ii])) {
const auto& guided_group = chain[ii]; const auto& guided_group = chain[ii];
const double grefficiency const double grefficiency
@ -1338,7 +1339,7 @@ namespace WellGroupHelpers
} }
} }
double target = orig_target; double target = orig_target;
for (size_t ii = 0; ii < num_ancestors; ++ii) { for (std::size_t ii = 0; ii < num_ancestors; ++ii) {
if ((ii == 0) || guideRate->has(chain[ii])) { if ((ii == 0) || guideRate->has(chain[ii])) {
// Apply local reductions only at the control level // Apply local reductions only at the control level
// (top) and for levels where we have a specified // (top) and for levels where we have a specified
@ -1453,10 +1454,10 @@ namespace WellGroupHelpers
= tcalc.calcModeRateFromRates(rates); // Switch sign since 'rates' are negative for producers. = tcalc.calcModeRateFromRates(rates); // Switch sign since 'rates' are negative for producers.
const auto chain = groupChainTopBot(name, group.name(), schedule, reportStepIdx); const auto chain = groupChainTopBot(name, group.name(), schedule, reportStepIdx);
// Because 'name' is the last of the elements, and not an ancestor, we subtract one below. // Because 'name' is the last of the elements, and not an ancestor, we subtract one below.
const size_t num_ancestors = chain.size() - 1; const std::size_t num_ancestors = chain.size() - 1;
// we need to find out the level where the current well is applied to the local reduction // we need to find out the level where the current well is applied to the local reduction
size_t local_reduction_level = 0; std::size_t local_reduction_level = 0;
for (size_t ii = 1; ii < num_ancestors; ++ii) { for (std::size_t ii = 1; ii < num_ancestors; ++ii) {
const int num_gr_ctrl = groupControlledWells(schedule, const int num_gr_ctrl = groupControlledWells(schedule,
wellState, wellState,
group_state, group_state,
@ -1471,7 +1472,7 @@ namespace WellGroupHelpers
} }
// check whether guide rate is violated // check whether guide rate is violated
for (size_t ii = 1; ii < num_ancestors; ++ii) { for (std::size_t ii = 1; ii < num_ancestors; ++ii) {
if (guideRate->has(chain[ii], injectionPhase)) { if (guideRate->has(chain[ii], injectionPhase)) {
const auto& guided_group = chain[ii]; const auto& guided_group = chain[ii];
const double grefficiency const double grefficiency
@ -1487,7 +1488,7 @@ namespace WellGroupHelpers
} }
double target = orig_target; double target = orig_target;
for (size_t ii = 0; ii < num_ancestors; ++ii) { for (std::size_t ii = 0; ii < num_ancestors; ++ii) {
if ((ii == 0) || guideRate->has(chain[ii], injectionPhase)) { if ((ii == 0) || guideRate->has(chain[ii], injectionPhase)) {
// Apply local reductions only at the control level // Apply local reductions only at the control level
// (top) and for levels where we have a specified // (top) and for levels where we have a specified

View File

@ -32,6 +32,8 @@
#include <opm/simulators/wells/ParallelWellInfo.hpp> #include <opm/simulators/wells/ParallelWellInfo.hpp>
#include <fmt/format.h> #include <fmt/format.h>
#include <cstddef>
#include <vector> #include <vector>
namespace Opm { namespace Opm {
@ -164,8 +166,8 @@ template <class DenseMatrix>
DenseMatrix transposeDenseDynMatrix(const DenseMatrix& M) DenseMatrix transposeDenseDynMatrix(const DenseMatrix& M)
{ {
DenseMatrix tmp{M.cols(), M.rows()}; DenseMatrix tmp{M.cols(), M.rows()};
for (size_t i = 0; i < M.rows(); ++i) { for (std::size_t i = 0; i < M.rows(); ++i) {
for (size_t j = 0; j < M.cols(); ++j) { for (std::size_t j = 0; j < M.cols(); ++j) {
tmp[j][i] = M[i][j]; tmp[j][i] = M[i][j];
} }
} }

View File

@ -32,6 +32,8 @@
#include <fmt/format.h> #include <fmt/format.h>
#include <cstddef>
namespace Opm namespace Opm
{ {
@ -286,7 +288,7 @@ namespace Opm
// individually. We first open all completions, then we close one by one by calling updateWellTestState // individually. We first open all completions, then we close one by one by calling updateWellTestState
// untill the number of closed completions do not increase anymore. // untill the number of closed completions do not increase anymore.
while (testWell) { while (testWell) {
const size_t original_number_closed_completions = welltest_state_temp.num_closed_completions(); const std::size_t original_number_closed_completions = welltest_state_temp.num_closed_completions();
bool converged = solveWellForTesting(simulator, well_state_copy, group_state, deferred_logger); bool converged = solveWellForTesting(simulator, well_state_copy, group_state, deferred_logger);
if (!converged) { if (!converged) {
const auto msg = fmt::format("WTEST: Well {} is not solvable (physical)", this->name()); const auto msg = fmt::format("WTEST: Well {} is not solvable (physical)", this->name());

View File

@ -420,7 +420,7 @@ void WellState::resize(const std::vector<Well>& wells_ecl,
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info, const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
const Schedule& schedule, const Schedule& schedule,
const bool handle_ms_well, const bool handle_ms_well,
const size_t numCells, const std::size_t numCells,
const std::vector<std::vector<PerforationData>>& well_perf_data, const std::vector<std::vector<PerforationData>>& well_perf_data,
const SummaryState& summary_state) const SummaryState& summary_state)
{ {
@ -614,7 +614,7 @@ void WellState::reportConnections(std::vector<data::Connection>& connections,
pi .at( pu.phase_pos[Gas] ) = rt::productivity_index_gas; pi .at( pu.phase_pos[Gas] ) = rt::productivity_index_gas;
} }
size_t local_conn_index = 0; std::size_t local_conn_index = 0;
for (auto& comp : connections) { for (auto& comp : connections) {
const auto * rates = &perf_data.phase_rates[np * local_conn_index]; const auto * rates = &perf_data.phase_rates[np * local_conn_index];
const auto * connPI = &perf_data.prod_index[np * local_conn_index]; const auto * connPI = &perf_data.prod_index[np * local_conn_index];
@ -670,7 +670,7 @@ void WellState::initWellStateMSWell(const std::vector<Well>& wells_ecl,
// we need to know for each segment, how many perforation it has and how many segments using it as outlet_segment // we need to know for each segment, how many perforation it has and how many segments using it as outlet_segment
// that is why I think we should use a well model to initialize the WellState here // that is why I think we should use a well model to initialize the WellState here
std::vector<std::vector<int>> segment_perforations(well_nseg); std::vector<std::vector<int>> segment_perforations(well_nseg);
for (size_t perf = 0; perf < completion_set.size(); ++perf) { for (std::size_t perf = 0; perf < completion_set.size(); ++perf) {
const Connection& connection = completion_set.get(perf); const Connection& connection = completion_set.get(perf);
if (connection.state() == Connection::State::OPEN) { if (connection.state() == Connection::State::OPEN) {
const int segment_index = segment_set.segmentNumberToIndex(connection.segment()); const int segment_index = segment_set.segmentNumberToIndex(connection.segment());

View File

@ -108,7 +108,7 @@ public:
const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info, const std::vector<std::reference_wrapper<ParallelWellInfo>>& parallel_well_info,
const Schedule& schedule, const Schedule& schedule,
const bool handle_ms_well, const bool handle_ms_well,
const size_t numCells, const std::size_t numCells,
const std::vector<std::vector<PerforationData>>& well_perf_data, const std::vector<std::vector<PerforationData>>& well_perf_data,
const SummaryState& summary_state); const SummaryState& summary_state);