make most indices unsigned

(instead of using 'int'.) This triggered quite a few compiler warnings
which are also dealt-with by this patch.
This commit is contained in:
Andreas Lauser 2015-11-18 11:54:35 +01:00
parent bac1a6990d
commit a63a4f2bdc
8 changed files with 183 additions and 183 deletions

View File

@ -58,12 +58,12 @@ public:
{ } { }
template <bool prepareValues = true, bool prepareGradients = true> template <bool prepareValues = true, bool prepareGradients = true>
void prepare(const ElementContext &elemCtx, int timeIdx) void prepare(const ElementContext &elemCtx, unsigned timeIdx)
{ } { }
template <class QuantityCallback, class QuantityType = Scalar> template <class QuantityCallback, class QuantityType = Scalar>
QuantityType calculateValue(const ElementContext &elemCtx, QuantityType calculateValue(const ElementContext &elemCtx,
int fapIdx, unsigned fapIdx,
const QuantityCallback &quantityCallback) const const QuantityCallback &quantityCallback) const
{ {
OPM_THROW(std::logic_error, OPM_THROW(std::logic_error,
@ -73,7 +73,7 @@ public:
template <class QuantityCallback> template <class QuantityCallback>
void calculateGradient(DimVector &quantityGrad, void calculateGradient(DimVector &quantityGrad,
const ElementContext &elemCtx, const ElementContext &elemCtx,
int fapIdx, unsigned fapIdx,
const QuantityCallback &quantityCallback) const const QuantityCallback &quantityCallback) const
{ {
OPM_THROW(std::logic_error, OPM_THROW(std::logic_error,
@ -82,7 +82,7 @@ public:
template <class QuantityCallback> template <class QuantityCallback>
Scalar calculateBoundaryValue(const ElementContext &elemCtx, Scalar calculateBoundaryValue(const ElementContext &elemCtx,
int fapIdx, unsigned fapIdx,
const QuantityCallback &quantityCallback) const QuantityCallback &quantityCallback)
{ {
OPM_THROW(std::logic_error, OPM_THROW(std::logic_error,
@ -92,7 +92,7 @@ public:
template <class QuantityCallback> template <class QuantityCallback>
void calculateBoundaryGradient(DimVector &quantityGrad, void calculateBoundaryGradient(DimVector &quantityGrad,
const ElementContext &elemCtx, const ElementContext &elemCtx,
int fapIdx, unsigned fapIdx,
const QuantityCallback &quantityCallback) const const QuantityCallback &quantityCallback) const
{ {
OPM_THROW(std::logic_error, OPM_THROW(std::logic_error,

View File

@ -89,8 +89,8 @@ public:
Opm::UgGridHelpers::cartDims(equilGrid), Opm::UgGridHelpers::cartDims(equilGrid),
tmpParam); tmpParam);
const int numElems = equilGrid.size(/*codim=*/0); const unsigned numElems = equilGrid.size(/*codim=*/0);
assert( int(gridManager.grid().size(/*codim=*/0)) == numElems ); assert( gridManager.grid().size(/*codim=*/0) == static_cast<int>(numElems) );
// initialize the boiler plate of opm-core the state structure. // initialize the boiler plate of opm-core the state structure.
Opm::BlackoilState opmBlackoilState; Opm::BlackoilState opmBlackoilState;
opmBlackoilState.init(numElems, opmBlackoilState.init(numElems,
@ -112,14 +112,14 @@ public:
// copy the result into the array of initial fluid states // copy the result into the array of initial fluid states
initialFluidStates_.resize(numElems); initialFluidStates_.resize(numElems);
for (int elemIdx = 0; elemIdx < numElems; ++elemIdx) { for (unsigned elemIdx = 0; elemIdx < numElems; ++elemIdx) {
auto &fluidState = initialFluidStates_[elemIdx]; auto &fluidState = initialFluidStates_[elemIdx];
// get the PVT region index of the current element // 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 // 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]; Scalar S = opmBlackoilState.saturation()[elemIdx*numPhases + phaseIdx];
fluidState.setSaturation(phaseIdx, S); fluidState.setSaturation(phaseIdx, S);
} }
@ -138,13 +138,13 @@ public:
const auto& matParams = simulator.problem().materialLawParams(elemIdx); const auto& matParams = simulator.problem().materialLawParams(elemIdx);
MaterialLaw::capillaryPressures(pC, matParams, fluidState); MaterialLaw::capillaryPressures(pC, matParams, fluidState);
Scalar po = opmBlackoilState.pressure()[elemIdx]; 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])); fluidState.setPressure(phaseIdx, po + (pC[phaseIdx] - pC[oilPhaseIdx]));
Scalar pg = fluidState.pressure(gasPhaseIdx); Scalar pg = fluidState.pressure(gasPhaseIdx);
// reset the phase compositions // reset the phase compositions
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
for (int compIdx = 0; compIdx < numComponents; ++compIdx) for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx)
fluidState.setMoleFraction(phaseIdx, compIdx, 0.0); fluidState.setMoleFraction(phaseIdx, compIdx, 0.0);
// the composition of the water phase is simple: it only consists of the // 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. * This is supposed to correspond to hydrostatic conditions.
*/ */
const ScalarFluidState& initialFluidState(int elemIdx) const const ScalarFluidState& initialFluidState(unsigned elemIdx) const
{ return initialFluidStates_[elemIdx]; } { return initialFluidStates_[elemIdx]; }
protected: protected:

View File

@ -84,7 +84,7 @@ class EclTransIntensiveQuantities
{ {
typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext; typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
protected: 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 * \param phaseIdx The index of the fluid phase
*/ */
const EvalDimVector& potentialGrad(int phaseIdx) const const EvalDimVector& potentialGrad(unsigned phaseIdx) const
{ {
OPM_THROW(Opm::NotImplemented, OPM_THROW(Opm::NotImplemented,
"The ECL transmissibility module does not provide explicit potential gradients"); "The ECL transmissibility module does not provide explicit potential gradients");
@ -143,7 +143,7 @@ public:
* *
* \param phaseIdx The index of the fluid phase * \param phaseIdx The index of the fluid phase
*/ */
const EvalDimVector& filterVelocity(int phaseIdx) const const EvalDimVector& filterVelocity(unsigned phaseIdx) const
{ {
OPM_THROW(Opm::NotImplemented, OPM_THROW(Opm::NotImplemented,
"The ECL transmissibility module does not provide explicit filter velocities"); "The ECL transmissibility module does not provide explicit filter velocities");
@ -158,7 +158,7 @@ public:
* *
* \param phaseIdx The index of the fluid phase * \param phaseIdx The index of the fluid phase
*/ */
const Evaluation& volumeFlux(int phaseIdx) const const Evaluation& volumeFlux(unsigned phaseIdx) const
{ return volumeFlux_[phaseIdx]; } { return volumeFlux_[phaseIdx]; }
protected: protected:
@ -169,7 +169,7 @@ protected:
* i.e., the DOF which exhibits a higher effective pressure for * i.e., the DOF which exhibits a higher effective pressure for
* the given phase. * the given phase.
*/ */
int upstreamIndex_(int phaseIdx) const unsigned upstreamIndex_(unsigned phaseIdx) const
{ {
assert(0 <= phaseIdx && phaseIdx < numPhases); assert(0 <= phaseIdx && phaseIdx < numPhases);
return (Toolbox::value(pressureDifferential_[phaseIdx]) >= 0)?exteriorDofIdx_:interiorDofIdx_; 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 * i.e., the DOF which exhibits a lower effective pressure for the
* given phase. * given phase.
*/ */
int downstreamIndex_(int phaseIdx) const unsigned downstreamIndex_(unsigned phaseIdx) const
{ {
assert(0 <= phaseIdx && phaseIdx < numPhases); assert(0 <= phaseIdx && phaseIdx < numPhases);
return (pressureDifferential_[phaseIdx] < 0)?exteriorDofIdx_:interiorDofIdx_; return (pressureDifferential_[phaseIdx] < 0)?exteriorDofIdx_:interiorDofIdx_;
@ -191,7 +191,7 @@ protected:
/*! /*!
* \brief Update the required gradients for interior faces * \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); Valgrind::SetUndefined(*this);
@ -222,7 +222,7 @@ protected:
// exterior DOF) // exterior DOF)
Scalar distZ = zIn - zEx; 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 // do the gravity correction: compute the hydrostatic pressure for the
// external at the depth of the internal one // external at the depth of the internal one
const Evaluation& rhoIn = intQuantsIn.fluidState().density(phaseIdx); const Evaluation& rhoIn = intQuantsIn.fluidState().density(phaseIdx);
@ -238,7 +238,7 @@ protected:
// this is slightly hacky because in the automatic differentiation case, it // this is slightly hacky because in the automatic differentiation case, it
// only works for the element centered finite volume method. for ebos this // only works for the element centered finite volume method. for ebos this
// does not matter, though. // does not matter, though.
int upstreamIdx = upstreamIndex_(phaseIdx); unsigned upstreamIdx = upstreamIndex_(phaseIdx);
const auto& up = elemCtx.intensiveQuantities(upstreamIdx, timeIdx); const auto& up = elemCtx.intensiveQuantities(upstreamIdx, timeIdx);
if (upstreamIdx == interiorDofIdx_) if (upstreamIdx == interiorDofIdx_)
volumeFlux_[phaseIdx] = volumeFlux_[phaseIdx] =
@ -253,12 +253,12 @@ protected:
/*! /*!
* \brief Update the volumetric fluxes for all fluid phases on the interior faces of the context * \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 // the local indices of the interior and exterior degrees of freedom
int interiorDofIdx_; unsigned interiorDofIdx_;
int exteriorDofIdx_; unsigned exteriorDofIdx_;
// transmissibility [m^3 s] // transmissibility [m^3 s]
Scalar trans_; Scalar trans_;

View File

@ -135,11 +135,11 @@ public:
auto bufferType = ParentType::ElementBuffer; auto bufferType = ParentType::ElementBuffer;
if (saturationsOutput_()) { if (saturationsOutput_()) {
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx)
this->resizeScalarBuffer_(saturation_[phaseIdx], bufferType); this->resizeScalarBuffer_(saturation_[phaseIdx], bufferType);
} }
if (pressuresOutput_()) { if (pressuresOutput_()) {
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx)
this->resizeScalarBuffer_(pressure_[phaseIdx], bufferType); this->resizeScalarBuffer_(pressure_[phaseIdx], bufferType);
} }
if (gasDissolutionFactorOutput_()) if (gasDissolutionFactorOutput_())
@ -163,23 +163,23 @@ public:
if (!std::is_same<Discretization, Ewoms::EcfvDiscretization<TypeTag> >::value) if (!std::is_same<Discretization, Ewoms::EcfvDiscretization<TypeTag> >::value)
return; 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(); const auto &fs = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0).fluidState();
int globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0); unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
int regionIdx = elemCtx.primaryVars(dofIdx, /*timeIdx=*/0).pvtRegionIndex(); unsigned regionIdx = elemCtx.primaryVars(dofIdx, /*timeIdx=*/0).pvtRegionIndex();
Scalar po = Toolbox::value(fs.pressure(oilPhaseIdx)); Scalar po = Toolbox::value(fs.pressure(oilPhaseIdx));
Scalar To = Toolbox::value(fs.temperature(oilPhaseIdx)); Scalar To = Toolbox::value(fs.temperature(oilPhaseIdx));
Scalar XoG = Toolbox::value(fs.massFraction(oilPhaseIdx, gasCompIdx)); Scalar XoG = Toolbox::value(fs.massFraction(oilPhaseIdx, gasCompIdx));
Scalar XgO = Toolbox::value(fs.massFraction(gasPhaseIdx, oilCompIdx)); Scalar XgO = Toolbox::value(fs.massFraction(gasPhaseIdx, oilCompIdx));
if (saturationsOutput_()) { if (saturationsOutput_()) {
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
saturation_[phaseIdx][globalDofIdx] = Toolbox::value(fs.saturation(phaseIdx)); saturation_[phaseIdx][globalDofIdx] = Toolbox::value(fs.saturation(phaseIdx));
Valgrind::CheckDefined(saturation_[phaseIdx][globalDofIdx]); Valgrind::CheckDefined(saturation_[phaseIdx][globalDofIdx]);
} }
} }
if (pressuresOutput_()) { if (pressuresOutput_()) {
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
pressure_[phaseIdx][globalDofIdx] = Toolbox::value(fs.pressure(phaseIdx)); pressure_[phaseIdx][globalDofIdx] = Toolbox::value(fs.pressure(phaseIdx));
Valgrind::CheckDefined(pressure_[phaseIdx][globalDofIdx]); Valgrind::CheckDefined(pressure_[phaseIdx][globalDofIdx]);
} }
@ -223,7 +223,7 @@ public:
typename ParentType::BufferType bufferType = ParentType::ElementBuffer; typename ParentType::BufferType bufferType = ParentType::ElementBuffer;
if (pressuresOutput_()) { if (pressuresOutput_()) {
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx)
deckUnits.siToDeck(pressure_[phaseIdx], DeckUnits::pressure); deckUnits.siToDeck(pressure_[phaseIdx], DeckUnits::pressure);
this->commitScalarBuffer_(writer, "PRESSURE", pressure_[oilPhaseIdx], bufferType); this->commitScalarBuffer_(writer, "PRESSURE", pressure_[oilPhaseIdx], bufferType);
@ -231,7 +231,7 @@ public:
this->commitScalarBuffer_(writer, "PWAT", pressure_[waterPhaseIdx], bufferType); this->commitScalarBuffer_(writer, "PWAT", pressure_[waterPhaseIdx], bufferType);
} }
if (saturationsOutput_()) { if (saturationsOutput_()) {
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx)
deckUnits.siToDeck(saturation_[phaseIdx], DeckUnits::saturation); deckUnits.siToDeck(saturation_[phaseIdx], DeckUnits::saturation);
this->commitScalarBuffer_(writer, "SWAT", saturation_[waterPhaseIdx], bufferType); this->commitScalarBuffer_(writer, "SWAT", saturation_[waterPhaseIdx], bufferType);

View File

@ -101,21 +101,21 @@ class EclPeacemanWell : public BaseAuxiliaryModule<TypeTag>
// convenient access to the number of phases and the number of // convenient access to the number of phases and the number of
// components // components
static const int numComponents = GET_PROP_VALUE(TypeTag, NumComponents); static const unsigned numComponents = GET_PROP_VALUE(TypeTag, NumComponents);
static const int numPhases = GET_PROP_VALUE(TypeTag, NumPhases); static const unsigned numPhases = GET_PROP_VALUE(TypeTag, NumPhases);
// convenient access to the phase and component indices. If the compiler bails out // 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 // here, you're probably using an incompatible fluid system. This class has only been
// tested with Opm::FluidSystems::BlackOil... // tested with Opm::FluidSystems::BlackOil...
static const int gasPhaseIdx = FluidSystem::gasPhaseIdx; static const unsigned gasPhaseIdx = FluidSystem::gasPhaseIdx;
static const int oilPhaseIdx = FluidSystem::oilPhaseIdx; static const unsigned oilPhaseIdx = FluidSystem::oilPhaseIdx;
static const int waterPhaseIdx = FluidSystem::waterPhaseIdx; static const unsigned waterPhaseIdx = FluidSystem::waterPhaseIdx;
static const int oilCompIdx = FluidSystem::oilCompIdx; static const unsigned oilCompIdx = FluidSystem::oilCompIdx;
static const int waterCompIdx = FluidSystem::waterCompIdx; static const unsigned waterCompIdx = FluidSystem::waterCompIdx;
static const int gasCompIdx = FluidSystem::gasCompIdx; 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<Scalar, FluidSystem, /*storeEnthalpy=*/false> FluidState; typedef Opm::CompositionalFluidState<Scalar, FluidSystem, /*storeEnthalpy=*/false> FluidState;
typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> DimMatrix; typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> DimMatrix;
@ -136,13 +136,13 @@ class EclPeacemanWell : public BaseAuxiliaryModule<TypeTag>
void update(const IntensiveQuantities& intQuants) void update(const IntensiveQuantities& intQuants)
{ {
const auto& fs = intQuants.fluidState(); const auto& fs = intQuants.fluidState();
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
pressure[phaseIdx] = fs.pressure(phaseIdx); pressure[phaseIdx] = fs.pressure(phaseIdx);
density[phaseIdx] = fs.density(phaseIdx); density[phaseIdx] = fs.density(phaseIdx);
mobility[phaseIdx] = intQuants.mobility(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); oilMassFraction[compIdx] = fs.massFraction(oilPhaseIdx, compIdx);
gasMassFraction[compIdx] = fs.massFraction(gasPhaseIdx, compIdx); gasMassFraction[compIdx] = fs.massFraction(gasPhaseIdx, compIdx);
} }
@ -197,7 +197,7 @@ class EclPeacemanWell : public BaseAuxiliaryModule<TypeTag>
std::array<Evaluation, numComponents> gasMassFraction; std::array<Evaluation, numComponents> gasMassFraction;
std::shared_ptr<ElementPointer> elementPtr; std::shared_ptr<ElementPointer> elementPtr;
int localDofIdx; unsigned localDofIdx;
}; };
// some safety checks/caveats // some safety checks/caveats
@ -254,7 +254,7 @@ public:
actualWeightedSurfaceRate_ = 0.0; actualWeightedSurfaceRate_ = 0.0;
actualWeightedResvRate_ = 0.0; actualWeightedResvRate_ = 0.0;
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
actualSurfaceRates_[phaseIdx] = 0.0; actualSurfaceRates_[phaseIdx] = 0.0;
actualResvRates_[phaseIdx] = 0.0; actualResvRates_[phaseIdx] = 0.0;
@ -266,8 +266,8 @@ public:
// set the composition of the injected fluids based. If // set the composition of the injected fluids based. If
// somebody is stupid enough to inject oil, we assume he wants // somebody is stupid enough to inject oil, we assume he wants
// to loose his fortune on dry oil... // to loose his fortune on dry oil...
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx)
for (int compIdx = 0; compIdx < numComponents; ++ compIdx) for (unsigned compIdx = 0; compIdx < numComponents; ++ compIdx)
injectionFluidState_.setMoleFraction(phaseIdx, compIdx, 0.0); injectionFluidState_.setMoleFraction(phaseIdx, compIdx, 0.0);
injectionFluidState_.setMoleFraction(gasPhaseIdx, gasCompIdx, 1.0); injectionFluidState_.setMoleFraction(gasPhaseIdx, gasCompIdx, 1.0);
injectionFluidState_.setMoleFraction(waterPhaseIdx, waterCompIdx, 1.0); injectionFluidState_.setMoleFraction(waterPhaseIdx, waterCompIdx, 1.0);
@ -282,7 +282,7 @@ public:
/*! /*!
* \copydoc Ewoms::BaseAuxiliaryModule::numDofs() * \copydoc Ewoms::BaseAuxiliaryModule::numDofs()
*/ */
virtual int numDofs() const virtual unsigned numDofs() const
{ return 1; } { return 1; }
/*! /*!
@ -323,7 +323,7 @@ public:
{ {
const SolutionVector& curSol = simulator_.model().solution(/*timeIdx=*/0); const SolutionVector& curSol = simulator_.model().solution(/*timeIdx=*/0);
int wellGlobalDofIdx = AuxModule::localToGlobalDof(/*localDofIdx=*/0); unsigned wellGlobalDofIdx = AuxModule::localToGlobalDof(/*localDofIdx=*/0);
residual[wellGlobalDofIdx] = 0.0; residual[wellGlobalDofIdx] = 0.0;
Scalar wellResid = wellResidual_(actualBottomHolePressure_); Scalar wellResid = wellResidual_(actualBottomHolePressure_);
@ -331,7 +331,7 @@ public:
auto &diagBlock = matrix[wellGlobalDofIdx][wellGlobalDofIdx]; auto &diagBlock = matrix[wellGlobalDofIdx][wellGlobalDofIdx];
diagBlock = 0.0; diagBlock = 0.0;
for (int i = 0; i < numModelEq; ++ i) for (unsigned i = 0; i < numModelEq; ++ i)
diagBlock[i][i] = 1.0; diagBlock[i][i] = 1.0;
// account for the effect of the grid DOFs which are influenced by the well on // account for the effect of the grid DOFs which are influenced by the well on
@ -355,7 +355,7 @@ public:
elemCtx.updateStencil(*(*dofVars.elementPtr)); elemCtx.updateStencil(*(*dofVars.elementPtr));
#endif #endif
curBlock = 0.0; 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 // calculate the derivative of the well equation w.r.t. the current
// primary variable using forward differences // primary variable using forward differences
Scalar eps = 1e-6*std::max<Scalar>(1.0, priVars[priVarIdx]); Scalar eps = 1e-6*std::max<Scalar>(1.0, priVars[priVarIdx]);
@ -388,20 +388,20 @@ public:
// first, we need the source term of the grid for the slightly disturbed well. // first, we need the source term of the grid for the slightly disturbed well.
Scalar eps = std::max<Scalar>(1e5, actualBottomHolePressure_)*1e-8; Scalar eps = std::max<Scalar>(1e5, actualBottomHolePressure_)*1e-8;
computeVolumetricDofRates_(resvRates, actualBottomHolePressure_ + eps, dofVariables_[gridDofIdx]); 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]); modelRate.setVolumetricRate(fluidState, phaseIdx, resvRates[phaseIdx]);
q += modelRate; q += modelRate;
} }
// then, we subtract the source rates for a undisturbed well. // then, we subtract the source rates for a undisturbed well.
computeVolumetricDofRates_(resvRates, actualBottomHolePressure_, dofVariables_[gridDofIdx]); 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]); modelRate.setVolumetricRate(fluidState, phaseIdx, resvRates[phaseIdx]);
q -= modelRate; q -= modelRate;
} }
// and finally, we divide by the epsilon to get the derivative // 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; q[eqIdx] /= eps;
// now we put this derivative into the right place in the Jacobian // now we put this derivative into the right place in the Jacobian
@ -413,7 +413,7 @@ public:
Valgrind::CheckDefined(q); Valgrind::CheckDefined(q);
auto &matrixEntry = matrix[gridDofIdx][wellGlobalDofIdx]; auto &matrixEntry = matrix[gridDofIdx][wellGlobalDofIdx];
matrixEntry = 0.0; 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; matrixEntry[eqIdx][0] = - Toolbox::value(q[eqIdx])/dofVars.totalVolume;
// //
///////////// /////////////
@ -518,7 +518,7 @@ public:
actualBottomHolePressure_ = 0.0; actualBottomHolePressure_ = 0.0;
// By default, all fluids exhibit the weight 1.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; volumetricWeight_[phaseIdx] = 1.0;
wellType_ = Undefined; wellType_ = Undefined;
@ -554,9 +554,9 @@ public:
* \brief Add a degree of freedom to the well. * \brief Add a degree of freedom to the well.
*/ */
template <class Context> template <class Context>
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)) if (applies(globalDofIdx))
// we already have this DOF in the well! // we already have this DOF in the well!
return; return;
@ -588,8 +588,8 @@ public:
// determine the current element's effective size // determine the current element's effective size
const auto &elem = context.element(); const auto &elem = context.element();
int faceIdx = 0; unsigned faceIdx = 0;
int numFaces = refElem.size(/*codim=*/1); unsigned numFaces = refElem.size(/*codim=*/1);
for (; faceIdx < numFaces; ++faceIdx) { for (; faceIdx < numFaces; ++faceIdx) {
const auto &faceCenterLocal = refElem.position(faceIdx, /*codim=*/1); const auto &faceCenterLocal = refElem.position(faceIdx, /*codim=*/1);
const auto &faceCenter = elem.geometry().global(faceCenterLocal); const auto &faceCenter = elem.geometry().global(faceCenterLocal);
@ -677,9 +677,9 @@ public:
* \brief Set the connection transmissibility factor for a given degree of freedom. * \brief Set the connection transmissibility factor for a given degree of freedom.
*/ */
template <class Context> template <class Context>
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; dofVariables_[globalDofIdx].connectionTransmissibilityFactor = value;
} }
@ -695,9 +695,9 @@ public:
* be called after setEffectivePermeability()! * be called after setEffectivePermeability()!
*/ */
template <class Context> template <class Context>
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; dofVariables_[globalDofIdx].effectivePermeability = value;
computeConnectionTransmissibilityFactor_(globalDofIdx); computeConnectionTransmissibilityFactor_(globalDofIdx);
@ -720,7 +720,7 @@ public:
* *
* This is only relevant if the well type is an injector. * This is only relevant if the well type is an injector.
*/ */
void setInjectedPhaseIndex(int injPhaseIdx) void setInjectedPhaseIndex(unsigned injPhaseIdx)
{ injectedPhaseIdx_ = injPhaseIdx; } { injectedPhaseIdx_ = injPhaseIdx; }
/*! /*!
@ -751,7 +751,7 @@ public:
* \brief Return true iff a degree of freedom is directly affected * \brief Return true iff a degree of freedom is directly affected
* by the well * by the well
*/ */
bool applies(int globalDofIdx) const bool applies(unsigned globalDofIdx) const
{ return dofVariables_.count(globalDofIdx) > 0; } { 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 * \brief Return the reservoir rate [m^3/s] of a given fluid which is actually seen
* by the well in the current time step. * by the well in the current time step.
*/ */
Scalar reservoirRate(int phaseIdx) const Scalar reservoirRate(unsigned phaseIdx) const
{ return actualResvRates_[phaseIdx]; } { return actualResvRates_[phaseIdx]; }
/*! /*!
* \brief Return the weighted surface rate [m^3/s] of a given fluid which is actually * \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. * seen by the well in the current time step.
*/ */
Scalar surfaceRate(int phaseIdx) const Scalar surfaceRate(unsigned phaseIdx) const
{ return actualSurfaceRates_[phaseIdx]; } { return actualSurfaceRates_[phaseIdx]; }
/*! /*!
@ -859,9 +859,9 @@ public:
* be called after setSkinFactor()! * be called after setSkinFactor()!
*/ */
template <class Context> template <class Context>
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; dofVariables_[globalDofIdx].skinFactor = value;
computeConnectionTransmissibilityFactor_(globalDofIdx); computeConnectionTransmissibilityFactor_(globalDofIdx);
@ -870,7 +870,7 @@ public:
/*! /*!
* \brief Return the well's skin factor at a DOF [-]. * \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_; } { return dofVariables_.at(gridDofIdx).skinFactor_; }
/*! /*!
@ -881,9 +881,9 @@ public:
* be called after setRadius()! * be called after setRadius()!
*/ */
template <class Context> template <class Context>
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; dofVariables_[globalDofIdx].boreholeRadius = value;
computeConnectionTransmissibilityFactor_(globalDofIdx); computeConnectionTransmissibilityFactor_(globalDofIdx);
@ -892,7 +892,7 @@ public:
/*! /*!
* \brief Return the well's radius at a cell [m]. * \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_; } { return dofVariables_.at(gridDofIdx).radius_; }
/*! /*!
@ -947,13 +947,13 @@ public:
* \brief Do the DOF specific part at the beginning of each iteration * \brief Do the DOF specific part at the beginning of each iteration
*/ */
template <class Context> template <class Context>
void beginIterationAccumulate(Context &context, int timeIdx) void beginIterationAccumulate(Context &context, unsigned timeIdx)
{ {
if (wellStatus() == Shut) if (wellStatus() == Shut)
return; return;
for (int dofIdx = 0; dofIdx < context.numPrimaryDof(timeIdx); ++dofIdx) { for (unsigned dofIdx = 0; dofIdx < context.numPrimaryDof(timeIdx); ++dofIdx) {
int globalDofIdx = context.globalSpaceIndex(dofIdx, timeIdx); unsigned globalDofIdx = context.globalSpaceIndex(dofIdx, timeIdx);
if (!applies(globalDofIdx)) if (!applies(globalDofIdx))
continue; continue;
@ -1051,12 +1051,12 @@ public:
template <class Context> template <class Context>
void computeTotalRatesForDof(RateVector &q, void computeTotalRatesForDof(RateVector &q,
const Context &context, const Context &context,
int dofIdx, unsigned dofIdx,
int timeIdx) const unsigned timeIdx) const
{ {
q = 0.0; q = 0.0;
int globalDofIdx = context.globalSpaceIndex(dofIdx, timeIdx); unsigned globalDofIdx = context.globalSpaceIndex(dofIdx, timeIdx);
if (wellStatus() == Shut || !applies(globalDofIdx)) if (wellStatus() == Shut || !applies(globalDofIdx))
return; return;
@ -1071,7 +1071,7 @@ public:
// convert to mass rates // convert to mass rates
RateVector modelRate; RateVector modelRate;
const auto &intQuants = context.intensiveQuantities(dofIdx, timeIdx); 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]); modelRate.setVolumetricRate(intQuants.fluidState(), phaseIdx, volumetricRates[phaseIdx]);
q += modelRate; q += modelRate;
} }
@ -1082,7 +1082,7 @@ public:
protected: protected:
// compute the connection transmissibility factor based on the effective permeability // compute the connection transmissibility factor based on the effective permeability
// of a connection, the radius of the borehole and the skin factor. // of a connection, the radius of the borehole and the skin factor.
void computeConnectionTransmissibilityFactor_(int globalDofIdx) void computeConnectionTransmissibilityFactor_(unsigned globalDofIdx)
{ {
auto& dofVars = dofVariables_[globalDofIdx]; auto& dofVars = dofVariables_[globalDofIdx];
@ -1117,7 +1117,7 @@ protected:
{ {
typedef Opm::MathToolbox<Evaluation> Toolbox; typedef Opm::MathToolbox<Evaluation> Toolbox;
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
volRates[phaseIdx] = 0.0; volRates[phaseIdx] = 0.0;
// connection transmissibility factor for the current DOF. // connection transmissibility factor for the current DOF.
@ -1130,7 +1130,7 @@ protected:
// gravity constant // gravity constant
Scalar g = simulator_.problem().gravity()[dimWorld - 1]; 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 // well model due to Peaceman; see Chen et al., p. 449
// phase pressure in grid cell // phase pressure in grid cell
@ -1153,7 +1153,7 @@ protected:
// there should only be injected phase present, so its mobility should be // there should only be injected phase present, so its mobility should be
// 1/viscosity... // 1/viscosity...
lambda = 0.0; lambda = 0.0;
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
lambda += Toolbox::template toLhs<Eval>(dofVars.mobility[phaseIdx]); lambda += Toolbox::template toLhs<Eval>(dofVars.mobility[phaseIdx]);
} }
else else
@ -1190,7 +1190,7 @@ protected:
Scalar computeWeightedRate_(const std::array<Scalar, numPhases> &volRates) const Scalar computeWeightedRate_(const std::array<Scalar, numPhases> &volRates) const
{ {
Scalar result = 0; Scalar result = 0;
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
result += volRates[phaseIdx]*volumetricWeight_[phaseIdx]; result += volRates[phaseIdx]*volumetricWeight_[phaseIdx];
return result; return result;
} }
@ -1263,7 +1263,7 @@ protected:
int globalEvalDofIdx = -1) const int globalEvalDofIdx = -1) const
{ {
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
overallResvRates[phaseIdx] = 0.0; overallResvRates[phaseIdx] = 0.0;
overallSurfaceRates[phaseIdx] = 0.0; overallSurfaceRates[phaseIdx] = 0.0;
} }
@ -1283,7 +1283,7 @@ protected:
std::array<Scalar, numPhases> volumetricSurfaceRates; std::array<Scalar, numPhases> volumetricSurfaceRates;
computeSurfaceRates_(volumetricSurfaceRates, volumetricReservoirRates, *tmp); computeSurfaceRates_(volumetricSurfaceRates, volumetricReservoirRates, *tmp);
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
overallResvRates[phaseIdx] += volumetricReservoirRates[phaseIdx]; overallResvRates[phaseIdx] += volumetricReservoirRates[phaseIdx];
overallSurfaceRates[phaseIdx] += volumetricSurfaceRates[phaseIdx]; overallSurfaceRates[phaseIdx] += volumetricSurfaceRates[phaseIdx];
} }
@ -1403,7 +1403,7 @@ protected:
std::array<Scalar, numPhases> surfaceRates; std::array<Scalar, numPhases> surfaceRates;
computeSurfaceRates_(surfaceRates, resvRates, *dofVars); computeSurfaceRates_(surfaceRates, resvRates, *dofVars);
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
totalSurfaceRates[phaseIdx] += surfaceRates[phaseIdx]; totalSurfaceRates[phaseIdx] += surfaceRates[phaseIdx];
resvRate += computeWeightedRate_(resvRates); resvRate += computeWeightedRate_(resvRates);
@ -1430,7 +1430,7 @@ protected:
// fluids are produced on the surface... // fluids are produced on the surface...
maxSurfaceRate = 0.0; maxSurfaceRate = 0.0;
surfaceRate = 0; surfaceRate = 0;
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
surfaceRate += totalSurfaceRates[phaseIdx]; surfaceRate += totalSurfaceRates[phaseIdx];
// don't care about the reservoir rate... // don't care about the reservoir rate...
@ -1465,7 +1465,7 @@ protected:
std::map<int, DofVariables> dofVariables_; std::map<int, DofVariables> dofVariables_;
// the number of times beginIteration*() was called for the current time step // 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) // the type of the well (injector, producer or undefined)
WellType wellType_; WellType wellType_;
@ -1532,7 +1532,7 @@ protected:
// then performance would be slightly worse... // then performance would be slightly worse...
mutable FluidState injectionFluidState_; mutable FluidState injectionFluidState_;
int injectedPhaseIdx_; unsigned injectedPhaseIdx_;
}; };
} // namespace Ewoms } // namespace Ewoms

View File

@ -234,7 +234,7 @@ public:
EWOMS_REGISTER_PARAM(TypeTag, bool, EnableEclOutput, EWOMS_REGISTER_PARAM(TypeTag, bool, EnableEclOutput,
"Write binary output which is compatible with the commercial " "Write binary output which is compatible with the commercial "
"Eclipse simulator"); "Eclipse simulator");
EWOMS_REGISTER_PARAM(TypeTag, int, RestartWritingInterval, EWOMS_REGISTER_PARAM(TypeTag, unsigned, RestartWritingInterval,
"The frequencies of which time steps are serialized to disk"); "The frequencies of which time steps are serialized to disk");
} }
@ -455,8 +455,8 @@ public:
*/ */
bool shouldWriteRestartFile() const bool shouldWriteRestartFile() const
{ {
int n = EWOMS_GET_PARAM(TypeTag, int, RestartWritingInterval); unsigned n = EWOMS_GET_PARAM(TypeTag, unsigned, RestartWritingInterval);
int i = this->simulator().timeStepIndex(); unsigned i = this->simulator().timeStepIndex();
if (i > 0 && (i%n) == 0) if (i > 0 && (i%n) == 0)
return true; // we don't write a restart file for the initial condition return true; // we don't write a restart file for the initial condition
return false; return false;
@ -496,10 +496,10 @@ public:
*/ */
template <class Context> template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context, const DimMatrix &intrinsicPermeability(const Context &context,
int spaceIdx, unsigned spaceIdx,
int timeIdx) const unsigned timeIdx) const
{ {
int globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx); unsigned globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
return intrinsicPermeability_[globalSpaceIdx]; return intrinsicPermeability_[globalSpaceIdx];
} }
@ -509,22 +509,22 @@ public:
* *
* Its main (only?) usage is the ECL transmissibility calculation code... * 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]; } { return intrinsicPermeability_[globalElemIdx]; }
/*! /*!
* \copydoc FvBaseMultiPhaseProblem::transmissibility * \copydoc FvBaseMultiPhaseProblem::transmissibility
*/ */
Scalar transmissibility(int elem1Idx, int elem2Idx) const Scalar transmissibility(unsigned elem1Idx, unsigned elem2Idx) const
{ return transmissibilities_.transmissibility(elem1Idx, elem2Idx); } { return transmissibilities_.transmissibility(elem1Idx, elem2Idx); }
/*! /*!
* \copydoc FvBaseMultiPhaseProblem::porosity * \copydoc FvBaseMultiPhaseProblem::porosity
*/ */
template <class Context> template <class Context>
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]; return porosity_[globalSpaceIdx];
} }
@ -532,14 +532,14 @@ public:
* \copydoc BlackoilProblem::rockCompressibility * \copydoc BlackoilProblem::rockCompressibility
*/ */
template <class Context> template <class Context>
Scalar rockCompressibility(const Context &context, int spaceIdx, int timeIdx) const Scalar rockCompressibility(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
{ {
if (rockParams_.empty()) if (rockParams_.empty())
return 0.0; return 0.0;
int tableIdx = 0; unsigned tableIdx = 0;
if (!rockTableIdx_.empty()) { if (!rockTableIdx_.empty()) {
int globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx); unsigned globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
tableIdx = rockTableIdx_[globalSpaceIdx]; tableIdx = rockTableIdx_[globalSpaceIdx];
} }
@ -550,14 +550,14 @@ public:
* \copydoc BlackoilProblem::rockReferencePressure * \copydoc BlackoilProblem::rockReferencePressure
*/ */
template <class Context> template <class Context>
Scalar rockReferencePressure(const Context &context, int spaceIdx, int timeIdx) const Scalar rockReferencePressure(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
{ {
if (rockParams_.empty()) if (rockParams_.empty())
return 1e5; return 1e5;
int tableIdx = 0; unsigned tableIdx = 0;
if (!rockTableIdx_.empty()) { if (!rockTableIdx_.empty()) {
int globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx); unsigned globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
tableIdx = rockTableIdx_[globalSpaceIdx]; tableIdx = rockTableIdx_[globalSpaceIdx];
} }
@ -569,26 +569,26 @@ public:
*/ */
template <class Context> template <class Context>
const MaterialLawParams &materialLawParams(const Context &context, 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); return materialLawParams(globalSpaceIdx);
} }
const MaterialLawParams& materialLawParams(int globalDofIdx) const const MaterialLawParams& materialLawParams(unsigned globalDofIdx) const
{ return materialLawManager_->materialLawParams(globalDofIdx); } { return materialLawManager_->materialLawParams(globalDofIdx); }
/*! /*!
* \brief Returns the index of the relevant region for thermodynmic properties * \brief Returns the index of the relevant region for thermodynmic properties
*/ */
template <class Context> template <class Context>
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)); } { return pvtRegionIndex(context.globalSpaceIndex(spaceIdx, timeIdx)); }
/*! /*!
* \brief Returns the index the relevant PVT region given a cell index * \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(); Opm::DeckConstPtr deck = this->simulator().gridManager().deck();
@ -597,7 +597,7 @@ public:
const auto& gridManager = this->simulator().gridManager(); const auto& gridManager = this->simulator().gridManager();
int cartesianDofIdx = gridManager.cartesianIndex(elemIdx); unsigned cartesianDofIdx = gridManager.cartesianIndex(elemIdx);
return deck->getKeyword("PVTNUM")->getIntData()[cartesianDofIdx] - 1; return deck->getKeyword("PVTNUM")->getIntData()[cartesianDofIdx] - 1;
} }
@ -611,11 +611,11 @@ public:
* \copydoc FvBaseMultiPhaseProblem::temperature * \copydoc FvBaseMultiPhaseProblem::temperature
*/ */
template <class Context> template <class Context>
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 // use the temporally constant temperature, i.e. use the initial temperature of
// the DOF // the DOF
int globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx); unsigned globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
return initialFluidStates_[globalDofIdx].temperature(/*phaseIdx=*/0); return initialFluidStates_[globalDofIdx].temperature(/*phaseIdx=*/0);
} }
@ -627,8 +627,8 @@ public:
template <class Context> template <class Context>
void boundary(BoundaryRateVector &values, void boundary(BoundaryRateVector &values,
const Context &context, const Context &context,
int spaceIdx, unsigned spaceIdx,
int timeIdx) const unsigned timeIdx) const
{ values.setNoFlow(); } { values.setNoFlow(); }
/*! /*!
@ -638,9 +638,9 @@ public:
* the whole domain. * the whole domain.
*/ */
template <class Context> template <class Context>
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)); values.setPvtRegionIndex(pvtRegionIndex(context, spaceIdx, timeIdx));
@ -665,20 +665,20 @@ public:
template <class Context> template <class Context>
void source(RateVector &rate, void source(RateVector &rate,
const Context &context, const Context &context,
int spaceIdx, unsigned spaceIdx,
int timeIdx) const unsigned timeIdx) const
{ {
rate = Toolbox::createConstant(0); rate = Toolbox::createConstant(0);
for (int eqIdx = 0; eqIdx < numEq; ++ eqIdx) for (unsigned eqIdx = 0; eqIdx < numEq; ++ eqIdx)
rate[eqIdx] = Toolbox::createConstant(0.0); rate[eqIdx] = Toolbox::createConstant(0.0);
wellManager_.computeTotalRatesForDof(rate, context, spaceIdx, timeIdx); wellManager_.computeTotalRatesForDof(rate, context, spaceIdx, timeIdx);
// convert the source term from the total mass rate of the // convert the source term from the total mass rate of the
// cell to the one per unit of volume as used by the model. // cell to the one per unit of volume as used by the model.
int globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx); unsigned globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
for (int eqIdx = 0; eqIdx < numEq; ++ eqIdx) for (unsigned eqIdx = 0; eqIdx < numEq; ++ eqIdx)
rate[eqIdx] /= this->model().dofTotalVolume(globalDofIdx); rate[eqIdx] /= this->model().dofTotalVolume(globalDofIdx);
} }
@ -724,7 +724,7 @@ private:
eclState->getIntGridProperty("PVTNUM")->getData(); eclState->getIntGridProperty("PVTNUM")->getData();
rockTableIdx_.resize(gridManager.gridView().size(/*codim=*/0)); rockTableIdx_.resize(gridManager.gridView().size(/*codim=*/0));
for (size_t elemIdx = 0; elemIdx < rockTableIdx_.size(); ++ elemIdx) { 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 // reminder: Eclipse uses FORTRAN-style indices
rockTableIdx_[elemIdx] = pvtnumData[cartElemIdx] - 1; rockTableIdx_[elemIdx] = pvtnumData[cartElemIdx] - 1;
@ -759,7 +759,7 @@ private:
permzData = eclState->getDoubleGridProperty("PERMZ")->getData(); permzData = eclState->getDoubleGridProperty("PERMZ")->getData();
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) { 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;
intrinsicPermeability_[dofIdx][0][0] = permxData[cartesianElemIdx]; intrinsicPermeability_[dofIdx][0][0] = permxData[cartesianElemIdx];
intrinsicPermeability_[dofIdx][1][1] = permyData[cartesianElemIdx]; intrinsicPermeability_[dofIdx][1][1] = permyData[cartesianElemIdx];
@ -787,7 +787,7 @@ private:
eclState->getDoubleGridProperty("PORO")->getData(); eclState->getDoubleGridProperty("PORO")->getData();
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) { for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) {
int cartesianElemIdx = gridManager.cartesianIndex(dofIdx); unsigned cartesianElemIdx = gridManager.cartesianIndex(dofIdx);
porosity_[dofIdx] = poroData[cartesianElemIdx]; porosity_[dofIdx] = poroData[cartesianElemIdx];
} }
} }
@ -799,7 +799,7 @@ private:
eclState->getDoubleGridProperty("PORV")->getData(); eclState->getDoubleGridProperty("PORV")->getData();
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) { for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) {
int cartesianElemIdx = gridManager.cartesianIndex(dofIdx); unsigned cartesianElemIdx = gridManager.cartesianIndex(dofIdx);
if (std::isfinite(porvData[cartesianElemIdx])) { if (std::isfinite(porvData[cartesianElemIdx])) {
Scalar dofVolume = this->simulator().model().dofTotalVolume(dofIdx); Scalar dofVolume = this->simulator().model().dofTotalVolume(dofIdx);
porosity_[dofIdx] = porvData[cartesianElemIdx]/dofVolume; porosity_[dofIdx] = porvData[cartesianElemIdx]/dofVolume;
@ -981,7 +981,7 @@ private:
MaterialLaw::capillaryPressures(pc, matParams, dofFluidState); MaterialLaw::capillaryPressures(pc, matParams, dofFluidState);
Valgrind::CheckDefined(oilPressure); Valgrind::CheckDefined(oilPressure);
Valgrind::CheckDefined(pc); 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])); dofFluidState.setPressure(phaseIdx, oilPressure + (pc[phaseIdx] - pc[oilPhaseIdx]));
Scalar gasPressure = dofFluidState.pressure(gasPhaseIdx); Scalar gasPressure = dofFluidState.pressure(gasPhaseIdx);
@ -990,8 +990,8 @@ private:
////// //////
// reset all mole fractions to 0 // reset all mole fractions to 0
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
for (int compIdx = 0; compIdx < numComponents; ++compIdx) for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx)
dofFluidState.setMoleFraction(phaseIdx, compIdx, 0.0); dofFluidState.setMoleFraction(phaseIdx, compIdx, 0.0);
// by default, assume immiscibility for all phases // by default, assume immiscibility for all phases
@ -1103,7 +1103,7 @@ private:
elemCtx.updateStencil(elem); elemCtx.updateStencil(elem);
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0); 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); const auto& intQuants = elemCtx.intensiveQuantities(/*spaceIdx=*/0, /*timeIdx=*/0);
materialLawManager_->updateHysteresis(intQuants.fluidState(), compressedDofIdx); materialLawManager_->updateHysteresis(intQuants.fluidState(), compressedDofIdx);
} }

View File

@ -82,18 +82,18 @@ public:
const auto& gridView = simulator_.gridView(); const auto& gridView = simulator_.gridView();
const auto& problem = simulator_.problem(); 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 // this code assumes that the DOFs are the elements. (i.e., an
// ECFV spatial discretization with TPFA). if you try to use // ECFV spatial discretization with TPFA). if you try to use
// it with something else, you're currently out of luck, // it with something else, you're currently out of luck,
// sorry! // sorry!
assert((int) simulator_.model().numGridDof() == numElements); assert(simulator_.model().numGridDof() == numElements);
// calculate the axis specific centroids of all elements // calculate the axis specific centroids of all elements
std::array<std::vector<DimVector>, dimWorld> axisCentroids; std::array<std::vector<DimVector>, dimWorld> axisCentroids;
for (int dimIdx = 0; dimIdx < dimWorld; ++dimIdx) for (unsigned dimIdx = 0; dimIdx < dimWorld; ++dimIdx)
axisCentroids[dimIdx].resize(numElements); axisCentroids[dimIdx].resize(numElements);
auto elemIt = gridView.template begin</*codim=*/ 0>(); auto elemIt = gridView.template begin</*codim=*/ 0>();
@ -101,9 +101,9 @@ public:
for (; elemIt != elemEndIt; ++elemIt) { for (; elemIt != elemEndIt; ++elemIt) {
const auto& elem = *elemIt; const auto& elem = *elemIt;
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,4) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2,4)
int elemIdx = elementMapper.index(elem); unsigned elemIdx = elementMapper.index(elem);
#else #else
int elemIdx = elementMapper.map(elem); unsigned elemIdx = elementMapper.map(elem);
#endif #endif
// get the geometry of the current element // get the geometry of the current element
@ -111,7 +111,7 @@ public:
// compute the axis specific "centroids" used for the // compute the axis specific "centroids" used for the
// transmissibilities // transmissibilities
for (int dimIdx = 0; dimIdx < dimWorld; ++dimIdx) { for (unsigned dimIdx = 0; dimIdx < dimWorld; ++dimIdx) {
DimVector x0Local(0.5); DimVector x0Local(0.5);
DimVector x1Local(0.5); DimVector x1Local(0.5);
@ -172,11 +172,11 @@ public:
const auto& inside = intersection.inside(); const auto& inside = intersection.inside();
const auto& outside = intersection.outside(); const auto& outside = intersection.outside();
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,4) #if DUNE_VERSION_NEWER(DUNE_COMMON, 2,4)
int insideElemIdx = elementMapper.index(inside); unsigned insideElemIdx = elementMapper.index(inside);
int outsideElemIdx = elementMapper.index(outside); unsigned outsideElemIdx = elementMapper.index(outside);
#else #else
int insideElemIdx = elementMapper.map(*inside); unsigned insideElemIdx = elementMapper.map(*inside);
int outsideElemIdx = elementMapper.map(*outside); unsigned outsideElemIdx = elementMapper.map(*outside);
#endif #endif
// we only need to calculate a face's transmissibility // we only need to calculate a face's transmissibility
@ -184,13 +184,13 @@ public:
if (insideElemIdx > outsideElemIdx) if (insideElemIdx > outsideElemIdx)
continue; continue;
int cartesianElemIdxInside = gridManager.cartesianIndex(insideElemIdx); unsigned cartesianElemIdxInside = gridManager.cartesianIndex(insideElemIdx);
int cartesianElemIdxOutside = gridManager.cartesianIndex(outsideElemIdx); unsigned cartesianElemIdxOutside = gridManager.cartesianIndex(outsideElemIdx);
// local indices of the faces of the inside and // local indices of the faces of the inside and
// outside elements which contain the intersection // outside elements which contain the intersection
int insideFaceIdx = intersection.indexInInside(); unsigned insideFaceIdx = intersection.indexInInside();
int outsideFaceIdx = intersection.indexInOutside(); unsigned outsideFaceIdx = intersection.indexInOutside();
Scalar halfTrans1; Scalar halfTrans1;
Scalar halfTrans2; 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)); } { return trans_.at(isId_(elemIdx1, elemIdx2)); }
private: 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); std::uint64_t elemBIdx = std::max(elemIdx1, elemIdx2);
return (elemBIdx<<elemIdxShift) + elemAIdx; return (elemBIdx<<elemIdxShift) + elemAIdx;
@ -278,11 +278,11 @@ private:
void computeHalfTrans_(Scalar& halfTrans, void computeHalfTrans_(Scalar& halfTrans,
const Intersection& is, const Intersection& is,
int faceIdx, // in the reference element that contains the intersection unsigned faceIdx, // in the reference element that contains the intersection
const DimVector& distance, const DimVector& distance,
const DimMatrix& perm) const const DimMatrix& perm) const
{ {
int dimIdx = faceIdx/2; unsigned dimIdx = faceIdx/2;
assert(dimIdx < dimWorld); assert(dimIdx < dimWorld);
halfTrans = perm[dimIdx][dimIdx]; halfTrans = perm[dimIdx][dimIdx];
halfTrans *= is.geometry().volume(); halfTrans *= is.geometry().volume();
@ -297,11 +297,11 @@ private:
} }
DimVector distanceVector_(const Intersection& is, DimVector distanceVector_(const Intersection& is,
int faceIdx, // in the reference element that contains the intersection unsigned faceIdx, // in the reference element that contains the intersection
int elemIdx, unsigned elemIdx,
const std::array<std::vector<DimVector>, dimWorld>& axisCentroids) const const std::array<std::vector<DimVector>, dimWorld>& axisCentroids) const
{ {
int dimIdx = faceIdx/2; unsigned dimIdx = faceIdx/2;
assert(dimIdx < dimWorld); assert(dimIdx < dimWorld);
DimVector x = is.geometry().center(); DimVector x = is.geometry().center();
x -= axisCentroids[dimIdx][elemIdx]; x -= axisCentroids[dimIdx][elemIdx];
@ -310,7 +310,7 @@ private:
} }
template <class MultScalar> template <class MultScalar>
void applyMultipliers_(Scalar &trans, int faceIdx, int elemIdx, void applyMultipliers_(Scalar &trans, unsigned faceIdx, unsigned elemIdx,
const std::vector<MultScalar>& multx, const std::vector<MultScalar>& multx,
const std::vector<MultScalar>& multxMinus, const std::vector<MultScalar>& multxMinus,
const std::vector<MultScalar>& multy, const std::vector<MultScalar>& multy,
@ -346,7 +346,7 @@ private:
} }
template <class NtgScalar> template <class NtgScalar>
void applyNtg_(Scalar &trans, int faceIdx, int elemIdx, void applyNtg_(Scalar &trans, unsigned faceIdx, unsigned elemIdx,
const std::vector<NtgScalar>& ntg) const const std::vector<NtgScalar>& ntg) const
{ {
// apply multiplyer for the transmissibility of the face. (the // apply multiplyer for the transmissibility of the face. (the

View File

@ -134,9 +134,9 @@ public:
continue; // non-local entities need to be skipped continue; // non-local entities need to be skipped
elemCtx.updateStencil(elem); 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; CartesianCoordinate cartCoord;
simulator_.gridManager().cartesianCoordinate( globalDofIdx, cartCoord ); simulator_.gridManager().cartesianCoordinate( globalDofIdx, cartCoord );
@ -167,7 +167,7 @@ public:
*/ */
void beginEpisode(Opm::EclipseStateConstPtr eclState, bool wasRestarted=false) void beginEpisode(Opm::EclipseStateConstPtr eclState, bool wasRestarted=false)
{ {
int episodeIdx = simulator_.episodeIndex(); unsigned episodeIdx = simulator_.episodeIndex();
const auto &deckSchedule = eclState->getSchedule(); const auto &deckSchedule = eclState->getSchedule();
WellCompletionsMap wellCompMap; WellCompletionsMap wellCompMap;
@ -356,7 +356,7 @@ public:
/*! /*!
* \brief Return the number of wells considered by the EclWellManager. * \brief Return the number of wells considered by the EclWellManager.
*/ */
int numWells() const unsigned numWells() const
{ return wells_.size(); } { return wells_.size(); }
/*! /*!
@ -370,7 +370,7 @@ public:
/*! /*!
* \brief Returns true iff a given degree of freedom is currently penetrated by any well. * \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]; } { return gridDofIsPenetrated_[globalDofIdx]; }
/*! /*!
@ -378,7 +378,7 @@ public:
* *
* A std::runtime_error will be thrown if the well name is unknown. * 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 ) ); assert( hasWell( wellName ) );
const auto &it = wellNameToIndex_.find(wellName); const auto &it = wellNameToIndex_.find(wellName);
@ -504,7 +504,7 @@ public:
else else
producedVolume = &wellTotalProducedVolume_[well->name()]; 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 // this assumes that the implicit Euler method is used for time
// integration. TODO: Once the time discretization becomes pluggable, // integration. TODO: Once the time discretization becomes pluggable,
// this integration needs to be done by the time discretization code! // 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. * \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) if (wellTotalProducedVolume_.count(wellName) == 0)
return 0.0; // well not yet seen 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. * \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) if (wellTotalInjectedVolume_.count(wellName) == 0)
return 0.0; // well not yet seen return 0.0; // well not yet seen
@ -551,8 +551,8 @@ public:
template <class Context> template <class Context>
void computeTotalRatesForDof(EvalEqVector &q, void computeTotalRatesForDof(EvalEqVector &q,
const Context &context, const Context &context,
int dofIdx, unsigned dofIdx,
int timeIdx) const unsigned timeIdx) const
{ {
q = 0.0; q = 0.0;
@ -600,7 +600,7 @@ public:
* "Something" can either be the well topology (i.e., which grid blocks are contained * "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... * 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)) if (wellTopologyChanged_(eclState, reportStepIdx))
return true; return true;
@ -626,7 +626,7 @@ public:
} }
protected: protected:
bool wellTopologyChanged_(Opm::EclipseStateConstPtr eclState, int reportStepIdx) const bool wellTopologyChanged_(Opm::EclipseStateConstPtr eclState, unsigned reportStepIdx) const
{ {
if (reportStepIdx == 0) { if (reportStepIdx == 0) {
// the well topology has always been changed relative to before the // the well topology has always been changed relative to before the
@ -698,7 +698,7 @@ protected:
return false; return false;
} }
void updateWellTopology_(int reportStepIdx, void updateWellTopology_(unsigned reportStepIdx,
const WellCompletionsMap& wellCompletions, const WellCompletionsMap& wellCompletions,
std::vector<bool>& gridDofIsPenetrated) const std::vector<bool>& gridDofIsPenetrated) const
{ {
@ -728,9 +728,9 @@ protected:
continue; // non-local entities need to be skipped continue; // non-local entities need to be skipped
elemCtx.updateStencil(elem); elemCtx.updateStencil(elem);
for (int dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) { for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) {
int globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0); unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
int cartesianDofIdx = gridManager.cartesianIndex(globalDofIdx); unsigned cartesianDofIdx = gridManager.cartesianIndex(globalDofIdx);
if (wellCompletions.count(cartesianDofIdx) == 0) if (wellCompletions.count(cartesianDofIdx) == 0)
// the current DOF is not contained in any well, so we must skip // 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 eclStatePtr = simulator_.gridManager().eclState();
auto deckSchedule = eclStatePtr->getSchedule(); 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 eclStatePtr = simulator_.gridManager().eclState();
auto deckSchedule = eclStatePtr->getSchedule(); auto deckSchedule = eclStatePtr->getSchedule();
@ -838,11 +838,11 @@ protected:
continue; // non-local entities need to be skipped continue; // non-local entities need to be skipped
elemCtx.updateStencil(elem); 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 ); assert( elemCtx.numPrimaryDof(/*timeIdx=*/0) == 1 );
int globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0); unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
int cartesianDofIdx = gridManager.cartesianIndex(globalDofIdx); unsigned cartesianDofIdx = gridManager.cartesianIndex(globalDofIdx);
if (wellCompletions.count(cartesianDofIdx) == 0) if (wellCompletions.count(cartesianDofIdx) == 0)
// the current DOF is not contained in any well, so we must skip // the current DOF is not contained in any well, so we must skip