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

@@ -225,7 +225,7 @@ private:
for (const auto& elem : elements(gridView, Dune::Partitions::interior)) {
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];
if (idx < 0) {
continue;
@@ -300,7 +300,7 @@ private:
const std::size_t i = face.interiorIndex();
const std::size_t j = face.exteriorIndex();
// 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);
assert(stencil.globalSpaceIndex(i) == cell_index);

View File

@@ -37,6 +37,7 @@
#include <dune/common/parallel/mpihelper.hh>
#endif
#include <cstddef>
#include <memory>
#include <string_view>
@@ -526,7 +527,7 @@ void handleExtraConvergenceOutput(SimulatorReport& report,
// initialize variables
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_) {
std::ostringstream oss;

View File

@@ -154,9 +154,9 @@ namespace KeywordValidation
const auto& keyword_properties = partially_supported_items.find(keyword.name());
if (keyword_properties != partially_supported_items.end()) {
// 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);
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);
// Find the index number, which starts counting at one, so 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,
const PartiallySupportedKeywordProperties<T>& properties,
const bool multiple_records,
const size_t record_index,
const size_t item_index,
const std::size_t record_index,
const std::size_t item_index,
const T& item_value,
std::vector<ValidationError>& errors) const
{

View File

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

View File

@@ -331,7 +331,7 @@ fipResv(const Inplace& inplace) const
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;
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;
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(),
stored_strings.end(), difference[i]);
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.
std::ifstream is(filename);
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.",
cellpart.size(), num_cells);
throw std::runtime_error(msg);

View File

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

View File

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

View File

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

View File

@@ -24,6 +24,8 @@
#include <opm/simulators/linalg/ISTLSolverEbos.hpp>
#include <cstddef>
namespace Opm {
class Well;
@@ -54,7 +56,7 @@ struct BdaSolverInfo
const Dune::CartesianIndexMapper<Grid>& cartMapper,
const std::vector<Well>& wellsForConn,
const std::vector<int>& cellPartition,
const size_t nonzeroes,
const std::size_t nonzeroes,
const bool useWellConn);
bool apply(Vector& rhs,
@@ -75,7 +77,7 @@ private:
template<class Grid>
void blockJacobiAdjacency(const Grid& grid,
const std::vector<int>& cell_part,
size_t nonzeroes);
std::size_t nonzeroes);
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
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
using rowiterator = typename M::RowIterator;
@@ -419,7 +419,7 @@ update()
// The ILU_ matrix is already a copy with the same
// sparse structure as A_, but the values of A_ may
// 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];
auto& ILUrow = (*ILU_)[row];
auto Ait = Arow.begin();

View File

@@ -128,7 +128,7 @@ makeAmgPreconditioner(const Operator& op,
if (useKamg) {
using Type = Dune::DummyUpdatePreconditioner<Dune::Amg::KAMG<Operator, Vector, Smoother>>;
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));
} else {
using Type = Dune::Amg::AMGCPR<Operator, Vector, Smoother>;
@@ -255,7 +255,7 @@ struct StandardPreconditioners
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.
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>>(
op.getmat(), comm, w, Opm::MILU_VARIANT::ILU, num_interior, redblack, reorder_spheres);
} else {
@@ -268,10 +268,10 @@ struct StandardPreconditioners
/// 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
/// 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;
size_t highest_interior_index = 0;
std::size_t interior_count = 0;
std::size_t highest_interior_index = 0;
const auto& is = comm.indexSet();
for (const auto& ind : is) {
if (Comm::OwnerSet::contains(ind.local().attribute())) {

View File

@@ -28,6 +28,8 @@
#include <dune/istl/paamg/pinfo.hh>
#include <cstddef>
namespace Opm
{
template <class Communication>
@@ -44,22 +46,22 @@ namespace Opm
const int max_nw = comm.communicator().max(nw);
const int rank = comm.communicator().rank();
int glo_max = 0;
size_t loc_max = 0;
std::size_t loc_max = 0;
indset_rw.beginResize();
for (auto ind = indset.begin(), indend = indset.end(); ind != indend; ++ind) {
indset_rw.add(ind->global(), LocalIndex(ind->local(), ind->local().attribute(), true));
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);
loc_max = std::max(loc_max, loc);
}
const int global_max = comm.communicator().max(glo_max);
// used append the welldofs at the end
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) {
// 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
indset_rw.add(v, LocalIndex(local_ind, Dune::OwnerOverlapCopyAttributeSet::owner, true));
++local_ind;
@@ -114,8 +116,8 @@ namespace Opm
const auto& fineLevelMatrix = fineOperator.getmat();
const auto& nw = fineOperator.getNumberOfExtraEquations();
if (prm_.get<bool>("add_wells")) {
const size_t average_elements_per_row
= static_cast<size_t>(std::ceil(fineLevelMatrix.nonzeroes() / fineLevelMatrix.N()));
const std::size_t average_elements_per_row
= static_cast<std::size_t>(std::ceil(fineLevelMatrix.nonzeroes() / fineLevelMatrix.N()));
const double overflow_fraction = 1.2;
coarseLevelMatrix_.reset(new CoarseMatrix(fineLevelMatrix.N() + nw,
fineLevelMatrix.M() + nw,
@@ -176,12 +178,12 @@ namespace Opm
double matrix_el = 0;
if (transpose) {
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];
}
} else {
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];
}
}
@@ -216,7 +218,7 @@ namespace Opm
if (transpose) {
rhs_el = (*block)[pressure_var_index_];
} 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];
}
}
@@ -235,7 +237,7 @@ namespace Opm
for (auto block = begin; block != end; ++block) {
if (transpose) {
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];
}
} else {

View File

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

View File

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

View File

@@ -72,6 +72,7 @@
} \
}
#include <cstddef>
namespace Opm
{
@@ -421,7 +422,7 @@ void rocsparseSolverBackend<block_size>::update_system_on_gpu(double *b) {
template <unsigned int block_size>
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;
ROCSPARSE_CHECK(rocsparse_set_pointer_mode(handle, rocsparse_pointer_mode_host));

View File

@@ -20,11 +20,13 @@
#ifndef OPM_FINDOVERLAPROWSANDCOLUMNS_HEADER_INCLUDED
#define OPM_FINDOVERLAPROWSANDCOLUMNS_HEADER_INCLUDED
#include <vector>
#include <utility>
#include <opm/grid/common/WellConnections.hpp>
#include <opm/grid/common/CartesianIndexMapper.hpp>
#include <cstddef>
#include <utility>
#include <vector>
namespace Dune {
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
/// the matrix are needed.
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)
return grid.leafGridView().size(0);
const auto& gridView = grid.leafGridView();

View File

@@ -21,12 +21,12 @@
#include "config.h"
#endif // HAVE_CONFIG_H
#include <cassert>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <ostream>
#include <numeric>
#include <vector>
#include <opm/input/eclipse/Units/Units.hpp>
#include <opm/simulators/timestepping/AdaptiveSimulatorTimer.hpp>
@@ -157,7 +157,7 @@ AdaptiveSimulatorTimer& AdaptiveSimulatorTimer::operator++ ()
report(std::ostream& os) const
{
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;
}

View File

@@ -23,6 +23,7 @@
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/input/eclipse/Units/Units.hpp>
#include <cstddef>
#include <iomanip>
#include <ostream>
#include <fmt/format.h>
@@ -247,7 +248,7 @@ namespace Opm
void SimulatorReport::fullReports(std::ostream& os) const
{
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];
os.precision(10);
os << std::defaultfloat;

View File

@@ -22,12 +22,14 @@
#include <opm/common/utility/parameters/ParameterGroup.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp>
#include <opm/input/eclipse/Units/Units.hpp>
#include <ostream>
#include <numeric>
#include <boost/date_time/gregorian/gregorian_types.hpp>
#include <boost/date_time/posix_time/conversion.hpp>
#include <cstddef>
#include <numeric>
#include <ostream>
namespace Opm
{
@@ -65,11 +67,11 @@ namespace Opm
}
/// 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 );
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);
}

View File

@@ -24,6 +24,7 @@
#include <boost/date_time/gregorian/gregorian_types.hpp>
#include <cstddef>
#include <iosfwd>
#include <memory>
#include <vector>
@@ -52,7 +53,7 @@ namespace Opm
void init(const ParameterGroup& param);
/// 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.
bool initialStep() const override;

View File

@@ -27,6 +27,7 @@
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
#include <cassert>
#include <cstddef>
#include <filesystem>
#include <stdexcept>
@@ -115,7 +116,7 @@ void HDF5File::write(const std::string& group,
} else {
auto grps = split_string(realGroup, '/');
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())
continue;
curr += '/';

View File

@@ -23,6 +23,8 @@
#include <opm/common/ErrorMacros.hpp>
#include <cstddef>
namespace Opm {
@@ -63,7 +65,7 @@ std::vector<double> ParallelFieldPropsManager::porv(bool global) const
if (m_comm.rank() == 0)
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);
global_porv.resize(size);
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)
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);
result.resize(size);
m_comm.broadcast(result.data(), size, 0);
@@ -178,7 +180,7 @@ std::vector<double> ParallelFieldPropsManager::get_global_double(const std::stri
if (exceptionThrown)
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);
result.resize(size);
m_comm.broadcast(result.data(), size, 0);

View File

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

View File

@@ -146,11 +146,11 @@ public:
void initFromRestartFile(const RestartValue& restartValues,
WellTestState wtestState,
const size_t numCells,
const std::size_t numCells,
bool handle_ms_well);
void prepareDeserialize(int report_step,
const size_t numCells,
const std::size_t numCells,
bool handle_ms_well);
/*
@@ -386,7 +386,7 @@ protected:
void updateInjMult(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
virtual void createWellContainer(const int time_step) = 0;

View File

@@ -1007,9 +1007,9 @@ namespace Opm {
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?
auto& well_state = this->wellState();
constexpr size_t max_iter = 100;
constexpr std::size_t max_iter = 100;
bool converged = false;
size_t iter = 0;
std::size_t iter = 0;
bool changed_well_group = false;
do {
changed_well_group = updateWellControlsAndNetwork(true, dt, deferred_logger);
@@ -1107,9 +1107,9 @@ namespace Opm {
bool do_network_update = true;
bool well_group_control_changed = false;
// 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
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;
while (do_network_update) {
if (network_update_iteration == iteration_to_relax) {

View File

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

View File

@@ -43,6 +43,7 @@
#endif // HAVE_UMFPACK
#include <cmath>
#include <cstddef>
namespace {
@@ -118,8 +119,8 @@ applyUMFPack(Dune::UMFPack<MatrixType>& linsolver,
// 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
for (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_block = 0; i_block < y.size(); ++i_block) {
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]) ) {
const std::string msg{"nan or inf value found after UMFPack solve due to singular matrix"};
OpmLog::debug(msg);

View File

@@ -25,7 +25,6 @@
#include <opm/simulators/wells/MultisegmentWellEquations.hpp>
#include <dune/istl/umfpack.hh>
#include <opm/input/eclipse/Schedule/MSW/WellSegments.hpp>
#if COMPILE_BDA_BRIDGE
@@ -40,6 +39,7 @@
#include <opm/simulators/wells/MultisegmentWellGeneric.hpp>
#include <opm/simulators/wells/WellInterfaceGeneric.hpp>
#include <cstddef>
#include <stdexcept>
namespace Opm {
@@ -278,11 +278,11 @@ extract(SparseMatrixAdapter& jacobian) const
// perforation at cell j connected to segment i. The code
// assumes that no cell is connected to more than one segment,
// 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(),
endC = duneC_[rowC].end(); colC != endC; ++colC) {
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(),
endB = duneB_[rowB].end(); colB != endB; ++colB) {
const auto col_index = colB.index();
@@ -313,14 +313,14 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
// Add for coupling from well to reservoir
const int welldof_ind = duneC_.M() + well.indexOfWell();
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(),
endC = duneC_[rowC].end(); colC != endC; ++colC) {
const auto row_index = colC.index();
const auto& bw = weights[row_index];
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];
}
jacobian[row_index][welldof_ind] += matel;
@@ -333,7 +333,7 @@ extractCPRPressureMatrix(PressureMatrix& jacobian,
auto well_weight = weights[0];
well_weight = 0.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(),
endB = duneB_[rowB].end(); colB != endB; ++colB) {
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
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;
for (auto colB = duneB_[rowB].begin(),
endB = duneB_[rowB].end(); colB != endB; ++colB) {
const auto col_index = colB.index();
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];
}
jacobian[welldof_ind][col_index] += matel;

View File

@@ -53,7 +53,7 @@ template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
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) {
evaluation_[seg][eq_idx] = 0.0;
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 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
double total_seg_rate = 0.0;
// the segment pressure
@@ -160,7 +160,7 @@ updateNewton(const BVectorWell& dwells,
{
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) {
const int sign = dwells[seg][WFrac] > 0. ? 1 : -1;
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& vapoil = segments.vaporized_oil_rate;
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);
fractions[oil_pos] = 1.0;
@@ -540,7 +540,7 @@ typename MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
getSegmentRateUpwinding(const int seg,
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,
// 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 <array>
#include <cstddef>
#include <vector>
namespace Opm
@@ -119,7 +120,7 @@ public:
//! \brief Returns upwinding rate for a component in a segment.
EvalWell getSegmentRateUpwinding(const int seg,
const int seg_upwind,
const size_t comp_idx) const;
const std::size_t comp_idx) const;
//! \brief Get bottomhole pressure.
EvalWell getBhp() const;

View File

@@ -88,7 +88,7 @@ MultisegmentWellSegments(const int numSegments,
int i_perf_wells = 0;
well.perfDepth().resize(well_.numPerfs(), 0.);
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);
if (connection.state() == Connection::State::OPEN) {
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);
}
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
std::vector<EvalWell> mix_s(well_.numComponents(), 0.0);
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>::
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
if (seg == 0) {
// 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/utils/DeferredLoggingErrorHelpers.hpp>
#include <string>
#include <algorithm>
#include <cstddef>
#include <string>
#if HAVE_CUDA || HAVE_OPENCL
#include <opm/simulators/linalg/bda/WellContributions.hpp>
@@ -1044,7 +1045,7 @@ namespace Opm
* this->segments_.perforation_depth_diff(perf);
const double perf_press = segment_pres + perf_seg_press_diff;
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;
}
}
@@ -1160,7 +1161,7 @@ namespace Opm
// calculating the b for the connection
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)) {
continue;
}
@@ -1209,7 +1210,7 @@ namespace Opm
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_b_[comp_idx] += ipr_b_perf[comp_idx];
}

View File

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

View File

@@ -39,8 +39,7 @@
#include <cassert>
#include <cmath>
#include <cstddef>
namespace Opm
{
@@ -93,7 +92,7 @@ void
StandardWellEval<FluidSystem,Indices,Scalar>::
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();
}
}

View File

@@ -34,10 +34,10 @@
#include <fmt/format.h>
#include <algorithm>
#include <cstddef>
#include <functional>
#include <numeric>
namespace {
template<class dValue, class Value>
@@ -648,10 +648,11 @@ namespace Opm
if constexpr (!Base::has_polymermw) {
if constexpr (std::is_same_v<Value, Scalar>) {
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]);
}
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]);
}
} else {
@@ -665,7 +666,7 @@ namespace Opm
const double bhp = this->primary_variables_.value(Bhp);
const double perf_press = bhp + this->connections_.pressure_diff(perf);
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;
}
}
@@ -759,7 +760,7 @@ namespace Opm
// calculating the b for the connection
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)) {
continue;
}
@@ -816,7 +817,7 @@ namespace Opm
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_b_[comp_idx] += ipr_b_perf[comp_idx];
}

View File

@@ -27,7 +27,7 @@
#include <opm/simulators/wells/VFPHelpers.hpp>
#include <cstddef>
namespace Opm {
@@ -125,7 +125,7 @@ bhpwithflo(const std::vector<double>& flos,
const auto alq_i = detail::findInterpData( alq, table.getALQAxis()); //assume constant
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
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);

View File

@@ -25,6 +25,7 @@
#include <opm/simulators/wells/WellState.hpp>
#include <opm/simulators/wells/VFPHelpers.hpp>
#include <cstddef>
#include <map>
namespace Opm {
@@ -71,7 +72,7 @@ public:
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& pu = well_state_.phaseUsage();
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);
}
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& pu = well_state_.phaseUsage();
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 <algorithm>
#include <cstddef>
#include <cassert>
namespace Opm
@@ -164,9 +165,9 @@ getGroupInjectionControl(const Group& group,
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.
const size_t num_ancestors = chain.size() - 1;
const std::size_t num_ancestors = chain.size() - 1;
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)) {
// Apply local reductions only at the control level
// (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());
// 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;
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)) {
// Apply local reductions only at the control level
// (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(),
schedule, well_.currentStep());
// 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;
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])) {
// Apply local reductions only at the control level
// (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(),
schedule, well_.currentStep());
// 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;
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])) {
// Apply local reductions only at the control level
// (top) and for levels where we have a specified

View File

@@ -43,6 +43,7 @@
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <set>
#include <stack>
#include <stdexcept>
@@ -847,7 +848,7 @@ namespace WellGroupHelpers
up = down;
} else {
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];
}
}
@@ -1306,10 +1307,10 @@ namespace WellGroupHelpers
= -tcalc.calcModeRateFromRates(rates); // Switch sign since 'rates' are negative for producers.
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.
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
size_t local_reduction_level = 0;
for (size_t ii = 1; ii < num_ancestors; ++ii) {
std::size_t local_reduction_level = 0;
for (std::size_t ii = 1; ii < num_ancestors; ++ii) {
const int num_gr_ctrl = groupControlledWells(schedule,
wellState,
group_state,
@@ -1323,7 +1324,7 @@ namespace WellGroupHelpers
}
}
// 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])) {
const auto& guided_group = chain[ii];
const double grefficiency
@@ -1338,7 +1339,7 @@ namespace WellGroupHelpers
}
}
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])) {
// Apply local reductions only at the control level
// (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.
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.
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
size_t local_reduction_level = 0;
for (size_t ii = 1; ii < num_ancestors; ++ii) {
std::size_t local_reduction_level = 0;
for (std::size_t ii = 1; ii < num_ancestors; ++ii) {
const int num_gr_ctrl = groupControlledWells(schedule,
wellState,
group_state,
@@ -1471,7 +1472,7 @@ namespace WellGroupHelpers
}
// 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)) {
const auto& guided_group = chain[ii];
const double grefficiency
@@ -1487,7 +1488,7 @@ namespace WellGroupHelpers
}
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)) {
// Apply local reductions only at the control level
// (top) and for levels where we have a specified

View File

@@ -32,6 +32,8 @@
#include <opm/simulators/wells/ParallelWellInfo.hpp>
#include <fmt/format.h>
#include <cstddef>
#include <vector>
namespace Opm {
@@ -62,7 +64,7 @@ mv (const X& x, Y& y) const
parallel_well_info_.communication().allgatherv(send, cstring_size,
cstrings.data(), sizes.data(),
offsets.data());
for(std::size_t i = 0; i < sizes.size(); ++i)
for (std::size_t i = 0; i < sizes.size(); ++i)
{
std::string name(cstrings.data()+offsets[i]);
if (name != parallel_well_info_.name())
@@ -164,8 +166,8 @@ template <class DenseMatrix>
DenseMatrix transposeDenseDynMatrix(const DenseMatrix& M)
{
DenseMatrix tmp{M.cols(), M.rows()};
for (size_t i = 0; i < M.rows(); ++i) {
for (size_t j = 0; j < M.cols(); ++j) {
for (std::size_t i = 0; i < M.rows(); ++i) {
for (std::size_t j = 0; j < M.cols(); ++j) {
tmp[j][i] = M[i][j];
}
}

View File

@@ -32,6 +32,8 @@
#include <fmt/format.h>
#include <cstddef>
namespace Opm
{
@@ -286,7 +288,7 @@ namespace Opm
// 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.
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);
if (!converged) {
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 Schedule& schedule,
const bool handle_ms_well,
const size_t numCells,
const std::size_t numCells,
const std::vector<std::vector<PerforationData>>& well_perf_data,
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;
}
size_t local_conn_index = 0;
std::size_t local_conn_index = 0;
for (auto& comp : connections) {
const auto * rates = &perf_data.phase_rates[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
// 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);
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);
if (connection.state() == Connection::State::OPEN) {
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 Schedule& schedule,
const bool handle_ms_well,
const size_t numCells,
const std::size_t numCells,
const std::vector<std::vector<PerforationData>>& well_perf_data,
const SummaryState& summary_state);