diff --git a/opm/models/blackoil/blackoilintensivequantities.hh b/opm/models/blackoil/blackoilintensivequantities.hh index 50dfa82f6..c8454d0fd 100644 --- a/opm/models/blackoil/blackoilintensivequantities.hh +++ b/opm/models/blackoil/blackoilintensivequantities.hh @@ -128,10 +128,10 @@ public: // extract the water and the gas saturations for convenience Evaluation Sw = 0.0; - if (waterEnabled){ - if(priVars.primaryVarsMeaning() == PrimaryVariables::OnePhase_p){ + if (waterEnabled) { + if (priVars.primaryVarsMeaning() == PrimaryVariables::OnePhase_p) { Sw = 1.0; - }else{ + } else { Sw = priVars.makeEvaluation(Indices::waterSaturationIdx, timeIdx); } } @@ -140,7 +140,7 @@ public: { if (priVars.primaryVarsMeaning() == PrimaryVariables::Sw_po_Sg) { // -> threephase case - assert( not(priVars.primaryVarsMeaning() == PrimaryVariables::OnePhase_p) ); + assert( priVars.primaryVarsMeaning() != PrimaryVariables::OnePhase_p ); Sg = priVars.makeEvaluation(Indices::compositionSwitchIdx, timeIdx); } else if (priVars.primaryVarsMeaning() == PrimaryVariables::Sw_pg_Rv) { // -> gas-water case @@ -206,11 +206,10 @@ public: // update the Saturation functions for the blackoil solvent module. asImp_().solventPostSatFuncUpdate_(elemCtx, dofIdx, timeIdx); - Evaluation SoMax=0; - if(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)){ - SoMax = - Opm::max(fluidState_.saturation(oilPhaseIdx), - elemCtx.problem().maxOilSaturation(globalSpaceIdx)); + Evaluation SoMax = 0.0; + if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) { + SoMax = Opm::max(fluidState_.saturation(oilPhaseIdx), + elemCtx.problem().maxOilSaturation(globalSpaceIdx)); } // take the meaning of the switiching primary variable into account for the gas @@ -268,7 +267,7 @@ public: else if (priVars.primaryVarsMeaning() == PrimaryVariables::Sw_pg_Rv) { const auto& Rv = priVars.makeEvaluation(Indices::compositionSwitchIdx, timeIdx); fluidState_.setRv(Rv); - + if (FluidSystem::enableDissolvedGas()) { // the oil phase is not present, but we need to compute its "composition" for // the gravity correction anyway @@ -278,7 +277,7 @@ public: oilPhaseIdx, pvtRegionIdx, SoMax); - + fluidState_.setRs(Opm::min(RsMax, RsSat)); } else { fluidState_.setRs(0.0); @@ -349,11 +348,11 @@ public: if (rockCompressibility > 0.0) { Scalar rockRefPressure = problem.rockReferencePressure(elemCtx, dofIdx, timeIdx); Evaluation x; - if(FluidSystem::phaseIsActive(oilPhaseIdx)){ + if (FluidSystem::phaseIsActive(oilPhaseIdx)) { x = rockCompressibility*(fluidState_.pressure(oilPhaseIdx) - rockRefPressure); - }else if( FluidSystem::phaseIsActive(waterPhaseIdx) ){ + } else if (FluidSystem::phaseIsActive(waterPhaseIdx)){ x = rockCompressibility*(fluidState_.pressure(waterPhaseIdx) - rockRefPressure); - }else{ + } else { x = rockCompressibility*(fluidState_.pressure(gasPhaseIdx) - rockRefPressure); } porosity_ *= 1.0 + x + 0.5*x*x; diff --git a/opm/models/blackoil/blackoilprimaryvariables.hh b/opm/models/blackoil/blackoilprimaryvariables.hh index b21efa69e..6807d76c7 100644 --- a/opm/models/blackoil/blackoilprimaryvariables.hh +++ b/opm/models/blackoil/blackoilprimaryvariables.hh @@ -265,13 +265,14 @@ public: EnergyModule::assignPrimaryVars(*this, fluidState); // determine the meaning of the primary variables - if ( FluidSystem::numActivePhases() == 1 ){ + if (FluidSystem::numActivePhases() == 1) { primaryVarsMeaning_ = OnePhase_p; - }else if ((gasPresent && oilPresent) || (onlyWater && FluidSystem::phaseIsActive(oilPhaseIdx)) ){ + } + else if ((gasPresent && oilPresent) || (onlyWater && FluidSystem::phaseIsActive(oilPhaseIdx))) { // gas and oil: both hydrocarbon phases are in equilibrium (i.e., saturated // with the "protagonist" component of the other phase.) primaryVarsMeaning_ = Sw_po_Sg; - } + } else if (oilPresent) { // only oil: if dissolved gas is enabled, we need to consider the oil phase // composition, if it is disabled, the gas component must stick to its phase @@ -292,10 +293,10 @@ public: // assign the actual primary variables if (primaryVarsMeaning() == OnePhase_p) { - if (waterEnabled){ + if (waterEnabled) { (*this)[waterSaturationIdx] = FsToolbox::value(fluidState.saturation(waterPhaseIdx)); (*this)[pressureSwitchIdx] = FsToolbox::value(fluidState.pressure(waterPhaseIdx)); - }else{ + } else { throw std::logic_error("Only pure ware is presently allowed"); } diff --git a/opm/models/discretization/common/fvbaselocalresidual.hh b/opm/models/discretization/common/fvbaselocalresidual.hh index d4efde481..1b302b594 100644 --- a/opm/models/discretization/common/fvbaselocalresidual.hh +++ b/opm/models/discretization/common/fvbaselocalresidual.hh @@ -580,9 +580,9 @@ protected: // Use the implicit Euler time discretization for (unsigned eqIdx = 0; eqIdx < numEq; ++eqIdx) { double dt = elemCtx.simulator().timeStepSize(); - assert(dt>0); + assert(dt > 0); tmp[eqIdx] -= tmp2[eqIdx]; - tmp[eqIdx] *= scvVolume / dt; + tmp[eqIdx] *= scvVolume / dt; residual[dofIdx][eqIdx] += tmp[eqIdx]; } diff --git a/opm/models/utils/simulator.hh b/opm/models/utils/simulator.hh index c1db35ee4..a0d013038 100644 --- a/opm/models/utils/simulator.hh +++ b/opm/models/utils/simulator.hh @@ -762,7 +762,7 @@ public: else // ask the problem to provide the next time step size dt = std::min(maxTimeStepSize(), problem_->nextTimeStepSize()); - assert(dt>0); + assert(dt > 0); setTimeStepSize(dt); } prePostProcessTimer_.stop();