From ee482e87a6c7933ec3bb30d2e54163973471157f Mon Sep 17 00:00:00 2001 From: hnil Date: Thu, 23 May 2019 09:13:45 +0200 Subject: [PATCH] change according to comments in pullrequest --- opm/models/blackoil/blackoilenergymodules.hh | 1 - .../blackoil/blackoilintensivequantities.hh | 22 ++++++++----------- .../blackoil/blackoilonephaseindices.hh | 10 ++++----- opm/models/utils/simulator.hh | 9 +++----- 4 files changed, 17 insertions(+), 25 deletions(-) diff --git a/opm/models/blackoil/blackoilenergymodules.hh b/opm/models/blackoil/blackoilenergymodules.hh index 2021b74ef..c40d0462c 100644 --- a/opm/models/blackoil/blackoilenergymodules.hh +++ b/opm/models/blackoil/blackoilenergymodules.hh @@ -376,7 +376,6 @@ public: // and the thermal condictivity coefficients for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { if (!FluidSystem::phaseIsActive(phaseIdx)) { - //fs.setEnthalpy(phaseIdx, 0.0); continue; } diff --git a/opm/models/blackoil/blackoilintensivequantities.hh b/opm/models/blackoil/blackoilintensivequantities.hh index 1f1ca165f..984f5a3b5 100644 --- a/opm/models/blackoil/blackoilintensivequantities.hh +++ b/opm/models/blackoil/blackoilintensivequantities.hh @@ -140,6 +140,7 @@ public: { if (priVars.primaryVarsMeaning() == PrimaryVariables::Sw_po_Sg) // -> threephase case + assert( not(priVars.primaryVarsMeaning() == PrimaryVariables::px) ) Sg = priVars.makeEvaluation(Indices::compositionSwitchIdx, timeIdx); else if (priVars.primaryVarsMeaning() == PrimaryVariables::Sw_pg_Rv) { // -> gas-water case @@ -206,7 +207,6 @@ public: asImp_().solventPostSatFuncUpdate_(elemCtx, dofIdx, timeIdx); Evaluation SoMax=0; - //const Evaluation& if(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)){ SoMax = Opm::max(fluidState_.saturation(oilPhaseIdx), @@ -266,11 +266,9 @@ public: fluidState_.setRv(0.0); } else if (priVars.primaryVarsMeaning() == PrimaryVariables::Sw_pg_Rv) { - //assert(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 @@ -280,12 +278,12 @@ public: oilPhaseIdx, pvtRegionIdx, SoMax); - + fluidState_.setRs(Opm::min(RsMax, RsSat)); - } - else + } else { fluidState_.setRs(0.0); - }else{ + } + } else { assert(priVars.primaryVarsMeaning() == PrimaryVariables::px); } @@ -353,12 +351,10 @@ public: Evaluation x; if(FluidSystem::phaseIsActive(oilPhaseIdx)){ x = rockCompressibility*(fluidState_.pressure(oilPhaseIdx) - rockRefPressure); + }else if( FluidSystem::phaseIsActive(waterPhaseIdx) ){ + x = rockCompressibility*(fluidState_.pressure(waterPhaseIdx) - rockRefPressure); }else{ - if(FluidSystem::phaseIsActive(waterPhaseIdx)){ - x = rockCompressibility*(fluidState_.pressure(waterPhaseIdx) - rockRefPressure); - }else{ - x = rockCompressibility*(fluidState_.pressure(gasPhaseIdx) - rockRefPressure); - } + x = rockCompressibility*(fluidState_.pressure(gasPhaseIdx) - rockRefPressure); } porosity_ *= 1.0 + x + 0.5*x*x; } diff --git a/opm/models/blackoil/blackoilonephaseindices.hh b/opm/models/blackoil/blackoilonephaseindices.hh index 571725ba3..8be4f4622 100644 --- a/opm/models/blackoil/blackoilonephaseindices.hh +++ b/opm/models/blackoil/blackoilonephaseindices.hh @@ -37,13 +37,13 @@ namespace Ewoms { * * \brief The primary variable and equation indices for the black-oil model. */ -template +template struct BlackOilOnePhaseIndices { //! Is phase enabled or not - static const bool oilEnabled = (enableCanonicalCompIdx == 0); - static const bool waterEnabled = (enableCanonicalCompIdx == 1); - static const bool gasEnabled = (enableCanonicalCompIdx == 2); + static const bool oilEnabled = (canonicalCompIdx == 0); + static const bool waterEnabled = (canonicalCompIdx == 1); + static const bool gasEnabled = (canonicalCompIdx == 2); //! Are solvents involved? static const bool enableSolvent = numSolventsV > 0; @@ -116,7 +116,7 @@ struct BlackOilOnePhaseIndices static unsigned activeToCanonicalComponentIndex(unsigned compIdx) { // assumes canonical oil = 0, water = 1, gas = 2; - assert(compIdx < 2); + assert(compIdx == 0); if(gasEnabled) { return 2; } else if (waterEnabled) { diff --git a/opm/models/utils/simulator.hh b/opm/models/utils/simulator.hh index f52ac7604..f8a9a16c6 100644 --- a/opm/models/utils/simulator.hh +++ b/opm/models/utils/simulator.hh @@ -401,10 +401,7 @@ public: */ void setTimeStepSize(Scalar value) { - if( not(value>0)){ - std::cout << "Time step set to zero" << std::endl; - } - timeStepSize_ = value; + timeStepSize_ = value; } /*! @@ -448,7 +445,7 @@ public: */ bool finished() const { - assert(timeStepSize_ > 0.0); + assert(timeStepSize_ >= 0.0); Scalar eps = std::max(Scalar(std::abs(this->time())), timeStepSize()) *std::numeric_limits::epsilon()*1e3; @@ -765,7 +762,7 @@ public: else // ask the problem to provide the next time step size dt = std::min(maxTimeStepSize(), problem_->nextTimeStepSize()); - + assert(dt>0); setTimeStepSize(dt); } prePostProcessTimer_.stop();