diff --git a/applications/ebos/ecldummygradientcalculator.hh b/applications/ebos/ecldummygradientcalculator.hh index c52d6cad9..a55322048 100644 --- a/applications/ebos/ecldummygradientcalculator.hh +++ b/applications/ebos/ecldummygradientcalculator.hh @@ -58,12 +58,12 @@ public: { } template - void prepare(const ElementContext &elemCtx, int timeIdx) + void prepare(const ElementContext &elemCtx, unsigned timeIdx) { } template QuantityType calculateValue(const ElementContext &elemCtx, - int fapIdx, + unsigned fapIdx, const QuantityCallback &quantityCallback) const { OPM_THROW(std::logic_error, @@ -73,7 +73,7 @@ public: template void calculateGradient(DimVector &quantityGrad, const ElementContext &elemCtx, - int fapIdx, + unsigned fapIdx, const QuantityCallback &quantityCallback) const { OPM_THROW(std::logic_error, @@ -82,7 +82,7 @@ public: template Scalar calculateBoundaryValue(const ElementContext &elemCtx, - int fapIdx, + unsigned fapIdx, const QuantityCallback &quantityCallback) { OPM_THROW(std::logic_error, @@ -92,7 +92,7 @@ public: template void calculateBoundaryGradient(DimVector &quantityGrad, const ElementContext &elemCtx, - int fapIdx, + unsigned fapIdx, const QuantityCallback &quantityCallback) const { OPM_THROW(std::logic_error, diff --git a/applications/ebos/eclequilinitializer.hh b/applications/ebos/eclequilinitializer.hh index ebdb67d89..76e97153a 100644 --- a/applications/ebos/eclequilinitializer.hh +++ b/applications/ebos/eclequilinitializer.hh @@ -89,8 +89,8 @@ public: Opm::UgGridHelpers::cartDims(equilGrid), tmpParam); - const int numElems = equilGrid.size(/*codim=*/0); - assert( int(gridManager.grid().size(/*codim=*/0)) == numElems ); + const unsigned numElems = equilGrid.size(/*codim=*/0); + assert( gridManager.grid().size(/*codim=*/0) == static_cast(numElems) ); // initialize the boiler plate of opm-core the state structure. Opm::BlackoilState opmBlackoilState; opmBlackoilState.init(numElems, @@ -112,14 +112,14 @@ public: // copy the result into the array of initial fluid states initialFluidStates_.resize(numElems); - for (int elemIdx = 0; elemIdx < numElems; ++elemIdx) { + for (unsigned elemIdx = 0; elemIdx < numElems; ++elemIdx) { auto &fluidState = initialFluidStates_[elemIdx]; // get the PVT region index of the current element - int regionIdx = simulator_.problem().pvtRegionIndex(elemIdx); + unsigned regionIdx = simulator_.problem().pvtRegionIndex(elemIdx); // set the phase saturations - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { Scalar S = opmBlackoilState.saturation()[elemIdx*numPhases + phaseIdx]; fluidState.setSaturation(phaseIdx, S); } @@ -138,13 +138,13 @@ public: const auto& matParams = simulator.problem().materialLawParams(elemIdx); MaterialLaw::capillaryPressures(pC, matParams, fluidState); Scalar po = opmBlackoilState.pressure()[elemIdx]; - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) fluidState.setPressure(phaseIdx, po + (pC[phaseIdx] - pC[oilPhaseIdx])); Scalar pg = fluidState.pressure(gasPhaseIdx); // reset the phase compositions - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) - for (int compIdx = 0; compIdx < numComponents; ++compIdx) + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) fluidState.setMoleFraction(phaseIdx, compIdx, 0.0); // the composition of the water phase is simple: it only consists of the @@ -194,7 +194,7 @@ public: * * This is supposed to correspond to hydrostatic conditions. */ - const ScalarFluidState& initialFluidState(int elemIdx) const + const ScalarFluidState& initialFluidState(unsigned elemIdx) const { return initialFluidStates_[elemIdx]; } protected: diff --git a/applications/ebos/eclfluxmodule.hh b/applications/ebos/eclfluxmodule.hh index 58c01bd55..49ac8489c 100644 --- a/applications/ebos/eclfluxmodule.hh +++ b/applications/ebos/eclfluxmodule.hh @@ -84,7 +84,7 @@ class EclTransIntensiveQuantities { typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext; protected: - void update_(const ElementContext &elemCtx, int dofIdx, int timeIdx) + void update_(const ElementContext &elemCtx, unsigned dofIdx, unsigned timeIdx) { } }; @@ -131,7 +131,7 @@ public: * * \param phaseIdx The index of the fluid phase */ - const EvalDimVector& potentialGrad(int phaseIdx) const + const EvalDimVector& potentialGrad(unsigned phaseIdx) const { OPM_THROW(Opm::NotImplemented, "The ECL transmissibility module does not provide explicit potential gradients"); @@ -143,7 +143,7 @@ public: * * \param phaseIdx The index of the fluid phase */ - const EvalDimVector& filterVelocity(int phaseIdx) const + const EvalDimVector& filterVelocity(unsigned phaseIdx) const { OPM_THROW(Opm::NotImplemented, "The ECL transmissibility module does not provide explicit filter velocities"); @@ -158,7 +158,7 @@ public: * * \param phaseIdx The index of the fluid phase */ - const Evaluation& volumeFlux(int phaseIdx) const + const Evaluation& volumeFlux(unsigned phaseIdx) const { return volumeFlux_[phaseIdx]; } protected: @@ -169,7 +169,7 @@ protected: * i.e., the DOF which exhibits a higher effective pressure for * the given phase. */ - int upstreamIndex_(int phaseIdx) const + unsigned upstreamIndex_(unsigned phaseIdx) const { assert(0 <= phaseIdx && phaseIdx < numPhases); return (Toolbox::value(pressureDifferential_[phaseIdx]) >= 0)?exteriorDofIdx_:interiorDofIdx_; @@ -182,7 +182,7 @@ protected: * i.e., the DOF which exhibits a lower effective pressure for the * given phase. */ - int downstreamIndex_(int phaseIdx) const + unsigned downstreamIndex_(unsigned phaseIdx) const { assert(0 <= phaseIdx && phaseIdx < numPhases); return (pressureDifferential_[phaseIdx] < 0)?exteriorDofIdx_:interiorDofIdx_; @@ -191,7 +191,7 @@ protected: /*! * \brief Update the required gradients for interior faces */ - void calculateGradients_(const ElementContext &elemCtx, int scvfIdx, int timeIdx) + void calculateGradients_(const ElementContext &elemCtx, unsigned scvfIdx, unsigned timeIdx) { Valgrind::SetUndefined(*this); @@ -222,7 +222,7 @@ protected: // exterior DOF) Scalar distZ = zIn - zEx; - for (int phaseIdx=0; phaseIdx < numPhases; phaseIdx++) { + for (unsigned phaseIdx=0; phaseIdx < numPhases; phaseIdx++) { // do the gravity correction: compute the hydrostatic pressure for the // external at the depth of the internal one const Evaluation& rhoIn = intQuantsIn.fluidState().density(phaseIdx); @@ -238,7 +238,7 @@ protected: // this is slightly hacky because in the automatic differentiation case, it // only works for the element centered finite volume method. for ebos this // does not matter, though. - int upstreamIdx = upstreamIndex_(phaseIdx); + unsigned upstreamIdx = upstreamIndex_(phaseIdx); const auto& up = elemCtx.intensiveQuantities(upstreamIdx, timeIdx); if (upstreamIdx == interiorDofIdx_) volumeFlux_[phaseIdx] = @@ -253,12 +253,12 @@ protected: /*! * \brief Update the volumetric fluxes for all fluid phases on the interior faces of the context */ - void calculateFluxes_(const ElementContext &elemCtx, int scvfIdx, int timeIdx) + void calculateFluxes_(const ElementContext &elemCtx, unsigned scvfIdx, unsigned timeIdx) { } // the local indices of the interior and exterior degrees of freedom - int interiorDofIdx_; - int exteriorDofIdx_; + unsigned interiorDofIdx_; + unsigned exteriorDofIdx_; // transmissibility [m^3 s] Scalar trans_; diff --git a/applications/ebos/ecloutputblackoilmodule.hh b/applications/ebos/ecloutputblackoilmodule.hh index a8a0098a8..95feaac3e 100644 --- a/applications/ebos/ecloutputblackoilmodule.hh +++ b/applications/ebos/ecloutputblackoilmodule.hh @@ -135,11 +135,11 @@ public: auto bufferType = ParentType::ElementBuffer; if (saturationsOutput_()) { - for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) this->resizeScalarBuffer_(saturation_[phaseIdx], bufferType); } if (pressuresOutput_()) { - for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) this->resizeScalarBuffer_(pressure_[phaseIdx], bufferType); } if (gasDissolutionFactorOutput_()) @@ -163,23 +163,23 @@ public: if (!std::is_same >::value) return; - for (int dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) { + for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) { const auto &fs = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0).fluidState(); - int globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0); - int regionIdx = elemCtx.primaryVars(dofIdx, /*timeIdx=*/0).pvtRegionIndex(); + unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0); + unsigned regionIdx = elemCtx.primaryVars(dofIdx, /*timeIdx=*/0).pvtRegionIndex(); Scalar po = Toolbox::value(fs.pressure(oilPhaseIdx)); Scalar To = Toolbox::value(fs.temperature(oilPhaseIdx)); Scalar XoG = Toolbox::value(fs.massFraction(oilPhaseIdx, gasCompIdx)); Scalar XgO = Toolbox::value(fs.massFraction(gasPhaseIdx, oilCompIdx)); if (saturationsOutput_()) { - for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { saturation_[phaseIdx][globalDofIdx] = Toolbox::value(fs.saturation(phaseIdx)); Valgrind::CheckDefined(saturation_[phaseIdx][globalDofIdx]); } } if (pressuresOutput_()) { - for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { pressure_[phaseIdx][globalDofIdx] = Toolbox::value(fs.pressure(phaseIdx)); Valgrind::CheckDefined(pressure_[phaseIdx][globalDofIdx]); } @@ -223,7 +223,7 @@ public: typename ParentType::BufferType bufferType = ParentType::ElementBuffer; if (pressuresOutput_()) { - for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) deckUnits.siToDeck(pressure_[phaseIdx], DeckUnits::pressure); this->commitScalarBuffer_(writer, "PRESSURE", pressure_[oilPhaseIdx], bufferType); @@ -231,7 +231,7 @@ public: this->commitScalarBuffer_(writer, "PWAT", pressure_[waterPhaseIdx], bufferType); } if (saturationsOutput_()) { - for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) deckUnits.siToDeck(saturation_[phaseIdx], DeckUnits::saturation); this->commitScalarBuffer_(writer, "SWAT", saturation_[waterPhaseIdx], bufferType); diff --git a/applications/ebos/eclpeacemanwell.hh b/applications/ebos/eclpeacemanwell.hh index c96f78c41..8592e7b26 100644 --- a/applications/ebos/eclpeacemanwell.hh +++ b/applications/ebos/eclpeacemanwell.hh @@ -101,21 +101,21 @@ class EclPeacemanWell : public BaseAuxiliaryModule // convenient access to the number of phases and the number of // components - static const int numComponents = GET_PROP_VALUE(TypeTag, NumComponents); - static const int numPhases = GET_PROP_VALUE(TypeTag, NumPhases); + static const unsigned numComponents = GET_PROP_VALUE(TypeTag, NumComponents); + static const unsigned numPhases = GET_PROP_VALUE(TypeTag, NumPhases); // convenient access to the phase and component indices. If the compiler bails out // here, you're probably using an incompatible fluid system. This class has only been // tested with Opm::FluidSystems::BlackOil... - static const int gasPhaseIdx = FluidSystem::gasPhaseIdx; - static const int oilPhaseIdx = FluidSystem::oilPhaseIdx; - static const int waterPhaseIdx = FluidSystem::waterPhaseIdx; + static const unsigned gasPhaseIdx = FluidSystem::gasPhaseIdx; + static const unsigned oilPhaseIdx = FluidSystem::oilPhaseIdx; + static const unsigned waterPhaseIdx = FluidSystem::waterPhaseIdx; - static const int oilCompIdx = FluidSystem::oilCompIdx; - static const int waterCompIdx = FluidSystem::waterCompIdx; - static const int gasCompIdx = FluidSystem::gasCompIdx; + static const unsigned oilCompIdx = FluidSystem::oilCompIdx; + static const unsigned waterCompIdx = FluidSystem::waterCompIdx; + static const unsigned gasCompIdx = FluidSystem::gasCompIdx; - static const int numModelEq = GET_PROP_VALUE(TypeTag, NumEq); + static const unsigned numModelEq = GET_PROP_VALUE(TypeTag, NumEq); typedef Opm::CompositionalFluidState FluidState; typedef Dune::FieldMatrix DimMatrix; @@ -136,13 +136,13 @@ class EclPeacemanWell : public BaseAuxiliaryModule void update(const IntensiveQuantities& intQuants) { const auto& fs = intQuants.fluidState(); - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { pressure[phaseIdx] = fs.pressure(phaseIdx); density[phaseIdx] = fs.density(phaseIdx); mobility[phaseIdx] = intQuants.mobility(phaseIdx); } - for (int compIdx = 0; compIdx < numComponents; ++compIdx) { + for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) { oilMassFraction[compIdx] = fs.massFraction(oilPhaseIdx, compIdx); gasMassFraction[compIdx] = fs.massFraction(gasPhaseIdx, compIdx); } @@ -197,7 +197,7 @@ class EclPeacemanWell : public BaseAuxiliaryModule std::array gasMassFraction; std::shared_ptr elementPtr; - int localDofIdx; + unsigned localDofIdx; }; // some safety checks/caveats @@ -254,7 +254,7 @@ public: actualWeightedSurfaceRate_ = 0.0; actualWeightedResvRate_ = 0.0; - for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { actualSurfaceRates_[phaseIdx] = 0.0; actualResvRates_[phaseIdx] = 0.0; @@ -266,8 +266,8 @@ public: // set the composition of the injected fluids based. If // somebody is stupid enough to inject oil, we assume he wants // to loose his fortune on dry oil... - for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) - for (int compIdx = 0; compIdx < numComponents; ++ compIdx) + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) + for (unsigned compIdx = 0; compIdx < numComponents; ++ compIdx) injectionFluidState_.setMoleFraction(phaseIdx, compIdx, 0.0); injectionFluidState_.setMoleFraction(gasPhaseIdx, gasCompIdx, 1.0); injectionFluidState_.setMoleFraction(waterPhaseIdx, waterCompIdx, 1.0); @@ -282,7 +282,7 @@ public: /*! * \copydoc Ewoms::BaseAuxiliaryModule::numDofs() */ - virtual int numDofs() const + virtual unsigned numDofs() const { return 1; } /*! @@ -323,7 +323,7 @@ public: { const SolutionVector& curSol = simulator_.model().solution(/*timeIdx=*/0); - int wellGlobalDofIdx = AuxModule::localToGlobalDof(/*localDofIdx=*/0); + unsigned wellGlobalDofIdx = AuxModule::localToGlobalDof(/*localDofIdx=*/0); residual[wellGlobalDofIdx] = 0.0; Scalar wellResid = wellResidual_(actualBottomHolePressure_); @@ -331,7 +331,7 @@ public: auto &diagBlock = matrix[wellGlobalDofIdx][wellGlobalDofIdx]; diagBlock = 0.0; - for (int i = 0; i < numModelEq; ++ i) + for (unsigned i = 0; i < numModelEq; ++ i) diagBlock[i][i] = 1.0; // account for the effect of the grid DOFs which are influenced by the well on @@ -355,7 +355,7 @@ public: elemCtx.updateStencil(*(*dofVars.elementPtr)); #endif curBlock = 0.0; - for (int priVarIdx = 0; priVarIdx < numModelEq; ++priVarIdx) { + for (unsigned priVarIdx = 0; priVarIdx < numModelEq; ++priVarIdx) { // calculate the derivative of the well equation w.r.t. the current // primary variable using forward differences Scalar eps = 1e-6*std::max(1.0, priVars[priVarIdx]); @@ -388,20 +388,20 @@ public: // first, we need the source term of the grid for the slightly disturbed well. Scalar eps = std::max(1e5, actualBottomHolePressure_)*1e-8; computeVolumetricDofRates_(resvRates, actualBottomHolePressure_ + eps, dofVariables_[gridDofIdx]); - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { modelRate.setVolumetricRate(fluidState, phaseIdx, resvRates[phaseIdx]); q += modelRate; } // then, we subtract the source rates for a undisturbed well. computeVolumetricDofRates_(resvRates, actualBottomHolePressure_, dofVariables_[gridDofIdx]); - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { modelRate.setVolumetricRate(fluidState, phaseIdx, resvRates[phaseIdx]); q -= modelRate; } // and finally, we divide by the epsilon to get the derivative - for (int eqIdx = 0; eqIdx < numModelEq; ++eqIdx) + for (unsigned eqIdx = 0; eqIdx < numModelEq; ++eqIdx) q[eqIdx] /= eps; // now we put this derivative into the right place in the Jacobian @@ -413,7 +413,7 @@ public: Valgrind::CheckDefined(q); auto &matrixEntry = matrix[gridDofIdx][wellGlobalDofIdx]; matrixEntry = 0.0; - for (int eqIdx = 0; eqIdx < numModelEq; ++ eqIdx) + for (unsigned eqIdx = 0; eqIdx < numModelEq; ++ eqIdx) matrixEntry[eqIdx][0] = - Toolbox::value(q[eqIdx])/dofVars.totalVolume; // ///////////// @@ -518,7 +518,7 @@ public: actualBottomHolePressure_ = 0.0; // By default, all fluids exhibit the weight 1.0 - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) volumetricWeight_[phaseIdx] = 1.0; wellType_ = Undefined; @@ -554,9 +554,9 @@ public: * \brief Add a degree of freedom to the well. */ template - void addDof(const Context &context, int dofIdx) + void addDof(const Context &context, unsigned dofIdx) { - int globalDofIdx = context.globalSpaceIndex(dofIdx, /*timeIdx=*/0); + unsigned globalDofIdx = context.globalSpaceIndex(dofIdx, /*timeIdx=*/0); if (applies(globalDofIdx)) // we already have this DOF in the well! return; @@ -588,8 +588,8 @@ public: // determine the current element's effective size const auto &elem = context.element(); - int faceIdx = 0; - int numFaces = refElem.size(/*codim=*/1); + unsigned faceIdx = 0; + unsigned numFaces = refElem.size(/*codim=*/1); for (; faceIdx < numFaces; ++faceIdx) { const auto &faceCenterLocal = refElem.position(faceIdx, /*codim=*/1); const auto &faceCenter = elem.geometry().global(faceCenterLocal); @@ -677,9 +677,9 @@ public: * \brief Set the connection transmissibility factor for a given degree of freedom. */ template - void setConnectionTransmissibilityFactor(const Context &context, int dofIdx, Scalar value) + void setConnectionTransmissibilityFactor(const Context &context, unsigned dofIdx, Scalar value) { - int globalDofIdx = context.globalSpaceIndex(dofIdx, /*timeIdx=*/0); + unsigned globalDofIdx = context.globalSpaceIndex(dofIdx, /*timeIdx=*/0); dofVariables_[globalDofIdx].connectionTransmissibilityFactor = value; } @@ -695,9 +695,9 @@ public: * be called after setEffectivePermeability()! */ template - void setEffectivePermeability(const Context &context, int dofIdx, Scalar value) + void setEffectivePermeability(const Context &context, unsigned dofIdx, Scalar value) { - int globalDofIdx = context.globalSpaceIndex(dofIdx, /*timeIdx=*/0); + unsigned globalDofIdx = context.globalSpaceIndex(dofIdx, /*timeIdx=*/0); dofVariables_[globalDofIdx].effectivePermeability = value; computeConnectionTransmissibilityFactor_(globalDofIdx); @@ -720,7 +720,7 @@ public: * * This is only relevant if the well type is an injector. */ - void setInjectedPhaseIndex(int injPhaseIdx) + void setInjectedPhaseIndex(unsigned injPhaseIdx) { injectedPhaseIdx_ = injPhaseIdx; } /*! @@ -751,7 +751,7 @@ public: * \brief Return true iff a degree of freedom is directly affected * by the well */ - bool applies(int globalDofIdx) const + bool applies(unsigned globalDofIdx) const { return dofVariables_.count(globalDofIdx) > 0; } /*! @@ -841,14 +841,14 @@ public: * \brief Return the reservoir rate [m^3/s] of a given fluid which is actually seen * by the well in the current time step. */ - Scalar reservoirRate(int phaseIdx) const + Scalar reservoirRate(unsigned phaseIdx) const { return actualResvRates_[phaseIdx]; } /*! * \brief Return the weighted surface rate [m^3/s] of a given fluid which is actually * seen by the well in the current time step. */ - Scalar surfaceRate(int phaseIdx) const + Scalar surfaceRate(unsigned phaseIdx) const { return actualSurfaceRates_[phaseIdx]; } /*! @@ -859,9 +859,9 @@ public: * be called after setSkinFactor()! */ template - void setSkinFactor(const Context &context, int dofIdx, Scalar value) + void setSkinFactor(const Context &context, unsigned dofIdx, Scalar value) { - int globalDofIdx = context.globalSpaceIndex(dofIdx, /*timeIdx=*/0); + unsigned globalDofIdx = context.globalSpaceIndex(dofIdx, /*timeIdx=*/0); dofVariables_[globalDofIdx].skinFactor = value; computeConnectionTransmissibilityFactor_(globalDofIdx); @@ -870,7 +870,7 @@ public: /*! * \brief Return the well's skin factor at a DOF [-]. */ - Scalar skinFactor(int gridDofIdx) const + Scalar skinFactor(unsigned gridDofIdx) const { return dofVariables_.at(gridDofIdx).skinFactor_; } /*! @@ -881,9 +881,9 @@ public: * be called after setRadius()! */ template - void setRadius(const Context &context, int dofIdx, Scalar value) + void setRadius(const Context &context, unsigned dofIdx, Scalar value) { - int globalDofIdx = context.globalSpaceIndex(dofIdx, /*timeIdx=*/0); + unsigned globalDofIdx = context.globalSpaceIndex(dofIdx, /*timeIdx=*/0); dofVariables_[globalDofIdx].boreholeRadius = value; computeConnectionTransmissibilityFactor_(globalDofIdx); @@ -892,7 +892,7 @@ public: /*! * \brief Return the well's radius at a cell [m]. */ - Scalar radius(int gridDofIdx) const + Scalar radius(unsigned gridDofIdx) const { return dofVariables_.at(gridDofIdx).radius_; } /*! @@ -947,13 +947,13 @@ public: * \brief Do the DOF specific part at the beginning of each iteration */ template - void beginIterationAccumulate(Context &context, int timeIdx) + void beginIterationAccumulate(Context &context, unsigned timeIdx) { if (wellStatus() == Shut) return; - for (int dofIdx = 0; dofIdx < context.numPrimaryDof(timeIdx); ++dofIdx) { - int globalDofIdx = context.globalSpaceIndex(dofIdx, timeIdx); + for (unsigned dofIdx = 0; dofIdx < context.numPrimaryDof(timeIdx); ++dofIdx) { + unsigned globalDofIdx = context.globalSpaceIndex(dofIdx, timeIdx); if (!applies(globalDofIdx)) continue; @@ -1051,12 +1051,12 @@ public: template void computeTotalRatesForDof(RateVector &q, const Context &context, - int dofIdx, - int timeIdx) const + unsigned dofIdx, + unsigned timeIdx) const { q = 0.0; - int globalDofIdx = context.globalSpaceIndex(dofIdx, timeIdx); + unsigned globalDofIdx = context.globalSpaceIndex(dofIdx, timeIdx); if (wellStatus() == Shut || !applies(globalDofIdx)) return; @@ -1071,7 +1071,7 @@ public: // convert to mass rates RateVector modelRate; const auto &intQuants = context.intensiveQuantities(dofIdx, timeIdx); - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { modelRate.setVolumetricRate(intQuants.fluidState(), phaseIdx, volumetricRates[phaseIdx]); q += modelRate; } @@ -1082,7 +1082,7 @@ public: protected: // compute the connection transmissibility factor based on the effective permeability // of a connection, the radius of the borehole and the skin factor. - void computeConnectionTransmissibilityFactor_(int globalDofIdx) + void computeConnectionTransmissibilityFactor_(unsigned globalDofIdx) { auto& dofVars = dofVariables_[globalDofIdx]; @@ -1117,7 +1117,7 @@ protected: { typedef Opm::MathToolbox Toolbox; - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) volRates[phaseIdx] = 0.0; // connection transmissibility factor for the current DOF. @@ -1130,7 +1130,7 @@ protected: // gravity constant Scalar g = simulator_.problem().gravity()[dimWorld - 1]; - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { // well model due to Peaceman; see Chen et al., p. 449 // phase pressure in grid cell @@ -1153,7 +1153,7 @@ protected: // there should only be injected phase present, so its mobility should be // 1/viscosity... lambda = 0.0; - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) lambda += Toolbox::template toLhs(dofVars.mobility[phaseIdx]); } else @@ -1190,7 +1190,7 @@ protected: Scalar computeWeightedRate_(const std::array &volRates) const { Scalar result = 0; - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) result += volRates[phaseIdx]*volumetricWeight_[phaseIdx]; return result; } @@ -1263,7 +1263,7 @@ protected: int globalEvalDofIdx = -1) const { - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { overallResvRates[phaseIdx] = 0.0; overallSurfaceRates[phaseIdx] = 0.0; } @@ -1283,7 +1283,7 @@ protected: std::array volumetricSurfaceRates; computeSurfaceRates_(volumetricSurfaceRates, volumetricReservoirRates, *tmp); - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { overallResvRates[phaseIdx] += volumetricReservoirRates[phaseIdx]; overallSurfaceRates[phaseIdx] += volumetricSurfaceRates[phaseIdx]; } @@ -1403,7 +1403,7 @@ protected: std::array surfaceRates; computeSurfaceRates_(surfaceRates, resvRates, *dofVars); - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) totalSurfaceRates[phaseIdx] += surfaceRates[phaseIdx]; resvRate += computeWeightedRate_(resvRates); @@ -1430,7 +1430,7 @@ protected: // fluids are produced on the surface... maxSurfaceRate = 0.0; surfaceRate = 0; - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) surfaceRate += totalSurfaceRates[phaseIdx]; // don't care about the reservoir rate... @@ -1465,7 +1465,7 @@ protected: std::map dofVariables_; // the number of times beginIteration*() was called for the current time step - int iterationIdx_; + unsigned iterationIdx_; // the type of the well (injector, producer or undefined) WellType wellType_; @@ -1532,7 +1532,7 @@ protected: // then performance would be slightly worse... mutable FluidState injectionFluidState_; - int injectedPhaseIdx_; + unsigned injectedPhaseIdx_; }; } // namespace Ewoms diff --git a/applications/ebos/eclproblem.hh b/applications/ebos/eclproblem.hh index 017d6ec18..2c6bf00c8 100644 --- a/applications/ebos/eclproblem.hh +++ b/applications/ebos/eclproblem.hh @@ -234,7 +234,7 @@ public: EWOMS_REGISTER_PARAM(TypeTag, bool, EnableEclOutput, "Write binary output which is compatible with the commercial " "Eclipse simulator"); - EWOMS_REGISTER_PARAM(TypeTag, int, RestartWritingInterval, + EWOMS_REGISTER_PARAM(TypeTag, unsigned, RestartWritingInterval, "The frequencies of which time steps are serialized to disk"); } @@ -455,8 +455,8 @@ public: */ bool shouldWriteRestartFile() const { - int n = EWOMS_GET_PARAM(TypeTag, int, RestartWritingInterval); - int i = this->simulator().timeStepIndex(); + unsigned n = EWOMS_GET_PARAM(TypeTag, unsigned, RestartWritingInterval); + unsigned i = this->simulator().timeStepIndex(); if (i > 0 && (i%n) == 0) return true; // we don't write a restart file for the initial condition return false; @@ -496,10 +496,10 @@ public: */ template const DimMatrix &intrinsicPermeability(const Context &context, - int spaceIdx, - int timeIdx) const + unsigned spaceIdx, + unsigned timeIdx) const { - int globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx); + unsigned globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx); return intrinsicPermeability_[globalSpaceIdx]; } @@ -509,22 +509,22 @@ public: * * Its main (only?) usage is the ECL transmissibility calculation code... */ - const DimMatrix &intrinsicPermeability(int globalElemIdx) const + const DimMatrix &intrinsicPermeability(unsigned globalElemIdx) const { return intrinsicPermeability_[globalElemIdx]; } /*! * \copydoc FvBaseMultiPhaseProblem::transmissibility */ - Scalar transmissibility(int elem1Idx, int elem2Idx) const + Scalar transmissibility(unsigned elem1Idx, unsigned elem2Idx) const { return transmissibilities_.transmissibility(elem1Idx, elem2Idx); } /*! * \copydoc FvBaseMultiPhaseProblem::porosity */ template - Scalar porosity(const Context &context, int spaceIdx, int timeIdx) const + Scalar porosity(const Context &context, unsigned spaceIdx, unsigned timeIdx) const { - int globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx); + unsigned globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx); return porosity_[globalSpaceIdx]; } @@ -532,14 +532,14 @@ public: * \copydoc BlackoilProblem::rockCompressibility */ template - Scalar rockCompressibility(const Context &context, int spaceIdx, int timeIdx) const + Scalar rockCompressibility(const Context &context, unsigned spaceIdx, unsigned timeIdx) const { if (rockParams_.empty()) return 0.0; - int tableIdx = 0; + unsigned tableIdx = 0; if (!rockTableIdx_.empty()) { - int globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx); + unsigned globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx); tableIdx = rockTableIdx_[globalSpaceIdx]; } @@ -550,14 +550,14 @@ public: * \copydoc BlackoilProblem::rockReferencePressure */ template - Scalar rockReferencePressure(const Context &context, int spaceIdx, int timeIdx) const + Scalar rockReferencePressure(const Context &context, unsigned spaceIdx, unsigned timeIdx) const { if (rockParams_.empty()) return 1e5; - int tableIdx = 0; + unsigned tableIdx = 0; if (!rockTableIdx_.empty()) { - int globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx); + unsigned globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx); tableIdx = rockTableIdx_[globalSpaceIdx]; } @@ -569,26 +569,26 @@ public: */ template const MaterialLawParams &materialLawParams(const Context &context, - int spaceIdx, int timeIdx) const + unsigned spaceIdx, unsigned timeIdx) const { - int globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx); + unsigned globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx); return materialLawParams(globalSpaceIdx); } - const MaterialLawParams& materialLawParams(int globalDofIdx) const + const MaterialLawParams& materialLawParams(unsigned globalDofIdx) const { return materialLawManager_->materialLawParams(globalDofIdx); } /*! * \brief Returns the index of the relevant region for thermodynmic properties */ template - int pvtRegionIndex(const Context &context, int spaceIdx, int timeIdx) const + unsigned pvtRegionIndex(const Context &context, unsigned spaceIdx, unsigned timeIdx) const { return pvtRegionIndex(context.globalSpaceIndex(spaceIdx, timeIdx)); } /*! * \brief Returns the index the relevant PVT region given a cell index */ - int pvtRegionIndex(int elemIdx) const + unsigned pvtRegionIndex(unsigned elemIdx) const { Opm::DeckConstPtr deck = this->simulator().gridManager().deck(); @@ -597,7 +597,7 @@ public: const auto& gridManager = this->simulator().gridManager(); - int cartesianDofIdx = gridManager.cartesianIndex(elemIdx); + unsigned cartesianDofIdx = gridManager.cartesianIndex(elemIdx); return deck->getKeyword("PVTNUM")->getIntData()[cartesianDofIdx] - 1; } @@ -611,11 +611,11 @@ public: * \copydoc FvBaseMultiPhaseProblem::temperature */ template - Scalar temperature(const Context &context, int spaceIdx, int timeIdx) const + Scalar temperature(const Context &context, unsigned spaceIdx, unsigned timeIdx) const { // use the temporally constant temperature, i.e. use the initial temperature of // the DOF - int globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx); + unsigned globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx); return initialFluidStates_[globalDofIdx].temperature(/*phaseIdx=*/0); } @@ -627,8 +627,8 @@ public: template void boundary(BoundaryRateVector &values, const Context &context, - int spaceIdx, - int timeIdx) const + unsigned spaceIdx, + unsigned timeIdx) const { values.setNoFlow(); } /*! @@ -638,9 +638,9 @@ public: * the whole domain. */ template - void initial(PrimaryVariables &values, const Context &context, int spaceIdx, int timeIdx) const + void initial(PrimaryVariables &values, const Context &context, unsigned spaceIdx, unsigned timeIdx) const { - int globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx); + unsigned globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx); values.setPvtRegionIndex(pvtRegionIndex(context, spaceIdx, timeIdx)); @@ -665,20 +665,20 @@ public: template void source(RateVector &rate, const Context &context, - int spaceIdx, - int timeIdx) const + unsigned spaceIdx, + unsigned timeIdx) const { rate = Toolbox::createConstant(0); - for (int eqIdx = 0; eqIdx < numEq; ++ eqIdx) + for (unsigned eqIdx = 0; eqIdx < numEq; ++ eqIdx) rate[eqIdx] = Toolbox::createConstant(0.0); wellManager_.computeTotalRatesForDof(rate, context, spaceIdx, timeIdx); // convert the source term from the total mass rate of the // cell to the one per unit of volume as used by the model. - int globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx); - for (int eqIdx = 0; eqIdx < numEq; ++ eqIdx) + unsigned globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx); + for (unsigned eqIdx = 0; eqIdx < numEq; ++ eqIdx) rate[eqIdx] /= this->model().dofTotalVolume(globalDofIdx); } @@ -724,7 +724,7 @@ private: eclState->getIntGridProperty("PVTNUM")->getData(); rockTableIdx_.resize(gridManager.gridView().size(/*codim=*/0)); for (size_t elemIdx = 0; elemIdx < rockTableIdx_.size(); ++ elemIdx) { - int cartElemIdx = gridManager.cartesianIndex(elemIdx); + unsigned cartElemIdx = gridManager.cartesianIndex(elemIdx); // reminder: Eclipse uses FORTRAN-style indices rockTableIdx_[elemIdx] = pvtnumData[cartElemIdx] - 1; @@ -759,7 +759,7 @@ private: permzData = eclState->getDoubleGridProperty("PERMZ")->getData(); for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) { - int cartesianElemIdx = gridManager.cartesianIndex(dofIdx); + unsigned cartesianElemIdx = gridManager.cartesianIndex(dofIdx); intrinsicPermeability_[dofIdx] = 0.0; intrinsicPermeability_[dofIdx][0][0] = permxData[cartesianElemIdx]; intrinsicPermeability_[dofIdx][1][1] = permyData[cartesianElemIdx]; @@ -787,7 +787,7 @@ private: eclState->getDoubleGridProperty("PORO")->getData(); for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) { - int cartesianElemIdx = gridManager.cartesianIndex(dofIdx); + unsigned cartesianElemIdx = gridManager.cartesianIndex(dofIdx); porosity_[dofIdx] = poroData[cartesianElemIdx]; } } @@ -799,7 +799,7 @@ private: eclState->getDoubleGridProperty("PORV")->getData(); for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) { - int cartesianElemIdx = gridManager.cartesianIndex(dofIdx); + unsigned cartesianElemIdx = gridManager.cartesianIndex(dofIdx); if (std::isfinite(porvData[cartesianElemIdx])) { Scalar dofVolume = this->simulator().model().dofTotalVolume(dofIdx); porosity_[dofIdx] = porvData[cartesianElemIdx]/dofVolume; @@ -981,7 +981,7 @@ private: MaterialLaw::capillaryPressures(pc, matParams, dofFluidState); Valgrind::CheckDefined(oilPressure); Valgrind::CheckDefined(pc); - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) dofFluidState.setPressure(phaseIdx, oilPressure + (pc[phaseIdx] - pc[oilPhaseIdx])); Scalar gasPressure = dofFluidState.pressure(gasPhaseIdx); @@ -990,8 +990,8 @@ private: ////// // reset all mole fractions to 0 - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) - for (int compIdx = 0; compIdx < numComponents; ++compIdx) + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) dofFluidState.setMoleFraction(phaseIdx, compIdx, 0.0); // by default, assume immiscibility for all phases @@ -1103,7 +1103,7 @@ private: elemCtx.updateStencil(elem); elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0); - int compressedDofIdx = elemCtx.globalSpaceIndex(/*spaceIdx=*/0, /*timeIdx=*/0); + unsigned compressedDofIdx = elemCtx.globalSpaceIndex(/*spaceIdx=*/0, /*timeIdx=*/0); const auto& intQuants = elemCtx.intensiveQuantities(/*spaceIdx=*/0, /*timeIdx=*/0); materialLawManager_->updateHysteresis(intQuants.fluidState(), compressedDofIdx); } diff --git a/applications/ebos/ecltransmissibility.hh b/applications/ebos/ecltransmissibility.hh index fe316b0de..46d453a69 100644 --- a/applications/ebos/ecltransmissibility.hh +++ b/applications/ebos/ecltransmissibility.hh @@ -82,18 +82,18 @@ public: const auto& gridView = simulator_.gridView(); const auto& problem = simulator_.problem(); - int numElements = elementMapper.size(); + unsigned numElements = elementMapper.size(); // this code assumes that the DOFs are the elements. (i.e., an // ECFV spatial discretization with TPFA). if you try to use // it with something else, you're currently out of luck, // sorry! - assert((int) simulator_.model().numGridDof() == numElements); + assert(simulator_.model().numGridDof() == numElements); // calculate the axis specific centroids of all elements std::array, dimWorld> axisCentroids; - for (int dimIdx = 0; dimIdx < dimWorld; ++dimIdx) + for (unsigned dimIdx = 0; dimIdx < dimWorld; ++dimIdx) axisCentroids[dimIdx].resize(numElements); auto elemIt = gridView.template begin(); @@ -101,9 +101,9 @@ public: for (; elemIt != elemEndIt; ++elemIt) { const auto& elem = *elemIt; #if DUNE_VERSION_NEWER(DUNE_COMMON, 2,4) - int elemIdx = elementMapper.index(elem); + unsigned elemIdx = elementMapper.index(elem); #else - int elemIdx = elementMapper.map(elem); + unsigned elemIdx = elementMapper.map(elem); #endif // get the geometry of the current element @@ -111,7 +111,7 @@ public: // compute the axis specific "centroids" used for the // transmissibilities - for (int dimIdx = 0; dimIdx < dimWorld; ++dimIdx) { + for (unsigned dimIdx = 0; dimIdx < dimWorld; ++dimIdx) { DimVector x0Local(0.5); DimVector x1Local(0.5); @@ -172,11 +172,11 @@ public: const auto& inside = intersection.inside(); const auto& outside = intersection.outside(); #if DUNE_VERSION_NEWER(DUNE_COMMON, 2,4) - int insideElemIdx = elementMapper.index(inside); - int outsideElemIdx = elementMapper.index(outside); + unsigned insideElemIdx = elementMapper.index(inside); + unsigned outsideElemIdx = elementMapper.index(outside); #else - int insideElemIdx = elementMapper.map(*inside); - int outsideElemIdx = elementMapper.map(*outside); + unsigned insideElemIdx = elementMapper.map(*inside); + unsigned outsideElemIdx = elementMapper.map(*outside); #endif // we only need to calculate a face's transmissibility @@ -184,13 +184,13 @@ public: if (insideElemIdx > outsideElemIdx) continue; - int cartesianElemIdxInside = gridManager.cartesianIndex(insideElemIdx); - int cartesianElemIdxOutside = gridManager.cartesianIndex(outsideElemIdx); + unsigned cartesianElemIdxInside = gridManager.cartesianIndex(insideElemIdx); + unsigned cartesianElemIdxOutside = gridManager.cartesianIndex(outsideElemIdx); // local indices of the faces of the inside and // outside elements which contain the intersection - int insideFaceIdx = intersection.indexInInside(); - int outsideFaceIdx = intersection.indexInOutside(); + unsigned insideFaceIdx = intersection.indexInInside(); + unsigned outsideFaceIdx = intersection.indexInOutside(); Scalar halfTrans1; Scalar halfTrans2; @@ -262,15 +262,15 @@ public: } } - Scalar transmissibility(int elemIdx1, int elemIdx2) const + Scalar transmissibility(unsigned elemIdx1, unsigned elemIdx2) const { return trans_.at(isId_(elemIdx1, elemIdx2)); } private: - std::uint64_t isId_(int elemIdx1, int elemIdx2) const + std::uint64_t isId_(unsigned elemIdx1, unsigned elemIdx2) const { - static const int elemIdxShift = 32; // bits + static const unsigned elemIdxShift = 32; // bits - int elemAIdx = std::min(elemIdx1, elemIdx2); + unsigned elemAIdx = std::min(elemIdx1, elemIdx2); std::uint64_t elemBIdx = std::max(elemIdx1, elemIdx2); return (elemBIdx<, dimWorld>& axisCentroids) const { - int dimIdx = faceIdx/2; + unsigned dimIdx = faceIdx/2; assert(dimIdx < dimWorld); DimVector x = is.geometry().center(); x -= axisCentroids[dimIdx][elemIdx]; @@ -310,7 +310,7 @@ private: } template - void applyMultipliers_(Scalar &trans, int faceIdx, int elemIdx, + void applyMultipliers_(Scalar &trans, unsigned faceIdx, unsigned elemIdx, const std::vector& multx, const std::vector& multxMinus, const std::vector& multy, @@ -346,7 +346,7 @@ private: } template - void applyNtg_(Scalar &trans, int faceIdx, int elemIdx, + void applyNtg_(Scalar &trans, unsigned faceIdx, unsigned elemIdx, const std::vector& ntg) const { // apply multiplyer for the transmissibility of the face. (the diff --git a/applications/ebos/eclwellmanager.hh b/applications/ebos/eclwellmanager.hh index 27046bd64..f7187392d 100644 --- a/applications/ebos/eclwellmanager.hh +++ b/applications/ebos/eclwellmanager.hh @@ -134,9 +134,9 @@ public: continue; // non-local entities need to be skipped elemCtx.updateStencil(elem); - for (int dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) + for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) { - const int globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0); + const unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0); CartesianCoordinate cartCoord; simulator_.gridManager().cartesianCoordinate( globalDofIdx, cartCoord ); @@ -167,7 +167,7 @@ public: */ void beginEpisode(Opm::EclipseStateConstPtr eclState, bool wasRestarted=false) { - int episodeIdx = simulator_.episodeIndex(); + unsigned episodeIdx = simulator_.episodeIndex(); const auto &deckSchedule = eclState->getSchedule(); WellCompletionsMap wellCompMap; @@ -356,7 +356,7 @@ public: /*! * \brief Return the number of wells considered by the EclWellManager. */ - int numWells() const + unsigned numWells() const { return wells_.size(); } /*! @@ -370,7 +370,7 @@ public: /*! * \brief Returns true iff a given degree of freedom is currently penetrated by any well. */ - bool gridDofIsPenetrated(int globalDofIdx) const + bool gridDofIsPenetrated(unsigned globalDofIdx) const { return gridDofIsPenetrated_[globalDofIdx]; } /*! @@ -378,7 +378,7 @@ public: * * A std::runtime_error will be thrown if the well name is unknown. */ - int wellIndex(const std::string &wellName) const + unsigned wellIndex(const std::string &wellName) const { assert( hasWell( wellName ) ); const auto &it = wellNameToIndex_.find(wellName); @@ -504,7 +504,7 @@ public: else producedVolume = &wellTotalProducedVolume_[well->name()]; - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { + for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { // this assumes that the implicit Euler method is used for time // integration. TODO: Once the time discretization becomes pluggable, // this integration needs to be done by the time discretization code! @@ -527,7 +527,7 @@ public: /*! * \brief Returns the surface volume of a fluid phase produced by a well. */ - Scalar totalProducedVolume(const std::string& wellName, int phaseIdx) const + Scalar totalProducedVolume(const std::string& wellName, unsigned phaseIdx) const { if (wellTotalProducedVolume_.count(wellName) == 0) return 0.0; // well not yet seen @@ -537,7 +537,7 @@ public: /*! * \brief Returns the surface volume of a fluid phase injected by a well. */ - Scalar totalInjectedVolume(const std::string& wellName, int phaseIdx) const + Scalar totalInjectedVolume(const std::string& wellName, unsigned phaseIdx) const { if (wellTotalInjectedVolume_.count(wellName) == 0) return 0.0; // well not yet seen @@ -551,8 +551,8 @@ public: template void computeTotalRatesForDof(EvalEqVector &q, const Context &context, - int dofIdx, - int timeIdx) const + unsigned dofIdx, + unsigned timeIdx) const { q = 0.0; @@ -600,7 +600,7 @@ public: * "Something" can either be the well topology (i.e., which grid blocks are contained * in which well) or it can be a well parameter like the bottom hole pressure... */ - bool wellsChanged(Opm::EclipseStateConstPtr eclState, int reportStepIdx) const + bool wellsChanged(Opm::EclipseStateConstPtr eclState, unsigned reportStepIdx) const { if (wellTopologyChanged_(eclState, reportStepIdx)) return true; @@ -626,7 +626,7 @@ public: } protected: - bool wellTopologyChanged_(Opm::EclipseStateConstPtr eclState, int reportStepIdx) const + bool wellTopologyChanged_(Opm::EclipseStateConstPtr eclState, unsigned reportStepIdx) const { if (reportStepIdx == 0) { // the well topology has always been changed relative to before the @@ -698,7 +698,7 @@ protected: return false; } - void updateWellTopology_(int reportStepIdx, + void updateWellTopology_(unsigned reportStepIdx, const WellCompletionsMap& wellCompletions, std::vector& gridDofIsPenetrated) const { @@ -728,9 +728,9 @@ protected: continue; // non-local entities need to be skipped elemCtx.updateStencil(elem); - for (int dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) { - int globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0); - int cartesianDofIdx = gridManager.cartesianIndex(globalDofIdx); + for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) { + unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0); + unsigned cartesianDofIdx = gridManager.cartesianIndex(globalDofIdx); if (wellCompletions.count(cartesianDofIdx) == 0) // the current DOF is not contained in any well, so we must skip @@ -755,7 +755,7 @@ protected: } } - void computeWellCompletionsMap_(int reportStepIdx, WellCompletionsMap& cartesianIdxToCompletionMap) + void computeWellCompletionsMap_(unsigned reportStepIdx, WellCompletionsMap& cartesianIdxToCompletionMap) { auto eclStatePtr = simulator_.gridManager().eclState(); auto deckSchedule = eclStatePtr->getSchedule(); @@ -806,7 +806,7 @@ protected: } } - void updateWellParameters_(int reportStepIdx, const WellCompletionsMap& wellCompletions) + void updateWellParameters_(unsigned reportStepIdx, const WellCompletionsMap& wellCompletions) { auto eclStatePtr = simulator_.gridManager().eclState(); auto deckSchedule = eclStatePtr->getSchedule(); @@ -838,11 +838,11 @@ protected: continue; // non-local entities need to be skipped elemCtx.updateStencil(elem); - for (int dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) + for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) { assert( elemCtx.numPrimaryDof(/*timeIdx=*/0) == 1 ); - int globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0); - int cartesianDofIdx = gridManager.cartesianIndex(globalDofIdx); + unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0); + unsigned cartesianDofIdx = gridManager.cartesianIndex(globalDofIdx); if (wellCompletions.count(cartesianDofIdx) == 0) // the current DOF is not contained in any well, so we must skip