From 853d96a32d22f31aeafc30f7ff776713e12f5a05 Mon Sep 17 00:00:00 2001 From: Benjamin Faigle <benjamin.faigle@posteo.de> Date: Thu, 23 Feb 2012 16:35:12 +0000 Subject: [PATCH] removed resetting of volume derivatives before output to perform the output fixed bug in saturation flash: mole equilibrium ratios had still been formulated for old fluid framework episode end and end of simulation cancel error correction. git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@7899 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- dumux/decoupled/2p2c/cellData2p2c.hh | 4 ---- dumux/decoupled/2p2c/dec2p2cfluidstate.hh | 10 ++++------ dumux/decoupled/2p2c/fvpressure2p2c.hh | 11 +++++++++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/dumux/decoupled/2p2c/cellData2p2c.hh b/dumux/decoupled/2p2c/cellData2p2c.hh index b70597d457..2e069cb336 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 f35ec4107c..46ef932ed1 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 9f3efbfe5d..d5d05a72d1 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] += -- GitLab