diff --git a/dumux/decoupled/2p2c/cellData2p2c.hh b/dumux/decoupled/2p2c/cellData2p2c.hh index b70597d45749fc75845ea5d25ef3c453e501ef9c..2e069cb336910ed35084c8439919a4486519a580 100644 --- a/dumux/decoupled/2p2c/cellData2p2c.hh +++ b/dumux/decoupled/2p2c/cellData2p2c.hh @@ -375,10 +375,6 @@ public: void reset() { volumeDerivativesAvailable_ = false; - dv_dp_ = 0.; - dv_[0] = 0.; - dv_[1] = 0.; - //include future fluxData here } diff --git a/dumux/decoupled/2p2c/dec2p2cfluidstate.hh b/dumux/decoupled/2p2c/dec2p2cfluidstate.hh index f35ec4107c6cb095666c72dac3930a48a8189861..46ef932ed152cef203742319dbc38ee064dd7255 100644 --- a/dumux/decoupled/2p2c/dec2p2cfluidstate.hh +++ b/dumux/decoupled/2p2c/dec2p2cfluidstate.hh @@ -94,8 +94,8 @@ public: //mole equilibrium ratios K for in case wPhase is reference phase - double k1 = FluidSystem::fugacityCoefficient(*this, wPhaseIdx, wCompIdx); // = p^wComp_vap - double k2 = FluidSystem::fugacityCoefficient(*this, wPhaseIdx, nCompIdx); // = H^nComp_w + double k1 = FluidSystem::fugacityCoefficient(*this, wPhaseIdx, wCompIdx); // = p^wComp_vap / p + double k2 = FluidSystem::fugacityCoefficient(*this, wPhaseIdx, nCompIdx); // = H^nComp_w / p // get mole fraction from equilibrium konstants moleFraction_[wPhaseIdx][wCompIdx] = (1. - k2) / (k1 -k2); @@ -196,10 +196,8 @@ public: //mole equilibrium ratios K for in case wPhase is reference phase - double k1 = FluidSystem::fugacityCoefficient(*this, wPhaseIdx, wCompIdx) - / phasePressure_[nPhaseIdx]; - double k2 = FluidSystem::fugacityCoefficient(*this, wPhaseIdx, nCompIdx) - / phasePressure_[nPhaseIdx]; + double k1 = FluidSystem::fugacityCoefficient(*this, wPhaseIdx, wCompIdx); // = p^wComp_vap / p + double k2 = FluidSystem::fugacityCoefficient(*this, wPhaseIdx, nCompIdx); // = H^nComp_w / p // get mole fraction from equilibrium konstants moleFraction_[wPhaseIdx][wCompIdx] = (1. - k2) / (k1 -k2); diff --git a/dumux/decoupled/2p2c/fvpressure2p2c.hh b/dumux/decoupled/2p2c/fvpressure2p2c.hh index 9f3efbfe5db2b4bec8b0084f2bb35f0cf9eeb9ed..d5d05a72d12e0ab7eb28cebdc28d163d24d59909 100644 --- a/dumux/decoupled/2p2c/fvpressure2p2c.hh +++ b/dumux/decoupled/2p2c/fvpressure2p2c.hh @@ -278,6 +278,14 @@ void FVPressure2P2C<TypeTag>::getStorage(Dune::FieldVector<Scalar, 2>& storageEn DUNE_THROW(Dune::NotImplemented, "Compressibility is switched off???"); } + // Abort error damping if there will be a possibly tiny timestep compared with last one + // This might be the case if the episode or simulation comes to an end. + if( problem().timeManager().episodeWillBeOver() + || problem().timeManager().willBeFinished()) + { + problem().variables().cellData(globalIdxI).errorCorrection() = 0.; + return; + } // error reduction routine: volumetric error is damped and inserted to right hand side // if damping is not done, the solution method gets unstable! @@ -292,8 +300,7 @@ void FVPressure2P2C<TypeTag>::getStorage(Dune::FieldVector<Scalar, 2>& storageEn Scalar lofac = 0.; Scalar hifac = 0.; - if ((erri*timestep_ > 5e-5) && (erri > x_lo * maxError) - && (!problem().timeManager().willBeFinished())) + if ((erri*timestep_ > 5e-5) && (erri > x_lo * maxError)) { if (erri <= x_mi * maxError) storageEntry[rhs] +=