From 3569ac4b3ae3ebf0214015388fa43ef7cde9c408 Mon Sep 17 00:00:00 2001
From: Markus Wolff <markus.wolff@twt-gmbh.de>
Date: Thu, 10 Jan 2013 12:16:03 +0000
Subject: [PATCH] changed reset of CFL-Timestep-Estimator

   - reset is now done directly in the transport loop to
     avoid errors

   -Reviewed by Klaus



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@9958 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 .../decoupled/2p/transport/fv/evalcflflux.hh  |  4 ++++
 .../2p/transport/fv/evalcflfluxdefault.hh     | 24 +++++++------------
 dumux/decoupled/common/fv/fvtransport.hh      |  2 ++
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/dumux/decoupled/2p/transport/fv/evalcflflux.hh b/dumux/decoupled/2p/transport/fv/evalcflflux.hh
index e5420cebb5..6c6259f61f 100644
--- a/dumux/decoupled/2p/transport/fv/evalcflflux.hh
+++ b/dumux/decoupled/2p/transport/fv/evalcflflux.hh
@@ -114,6 +114,10 @@ public:
         return 0.0;
     }
 
+    //! reset function
+    void reset()
+    {}
+
     /*! @brief Constructs a EvalCflFlux instance */
     EvalCflFlux ()
     {}
diff --git a/dumux/decoupled/2p/transport/fv/evalcflfluxdefault.hh b/dumux/decoupled/2p/transport/fv/evalcflfluxdefault.hh
index 19b208bcf1..c0cb35b6b8 100644
--- a/dumux/decoupled/2p/transport/fv/evalcflfluxdefault.hh
+++ b/dumux/decoupled/2p/transport/fv/evalcflfluxdefault.hh
@@ -111,6 +111,15 @@ public:
             return (getCFLFluxFunction(element) * element.geometry().volume());
     }
 
+    //! resets the accumulated CFL-fluxes to zero
+    void reset()
+    {
+        fluxWettingOut_ = 0;
+        fluxNonwettingOut_ = 0;
+        fluxIn_ = 0;
+        fluxOut_ = 0;
+    }
+
     /*! \brief Constructs an EvalCflFluxDefault object
      *
      * \param problem A problem type object
@@ -209,19 +218,6 @@ private:
             return fluxOut_;
     }
 
-
-protected:
-
-    //! resets the accumulated CFL-fluxes to zero
-    void reset()
-    {
-        fluxWettingOut_ = 0;
-        fluxNonwettingOut_ = 0;
-        fluxIn_ = 0;
-        fluxOut_ = 0;
-    }
-
-private:
     Problem& problem_;//problem data
     Scalar fluxWettingOut_;
     Scalar fluxNonwettingOut_;
@@ -273,8 +269,6 @@ typename EvalCflFluxDefault<TypeTag>::Scalar EvalCflFluxDefault<TypeTag>::getCFL
     //determine timestep
     Scalar cFLFluxFunction = std::min(cFLFluxIn, cFLFluxOut);
 
-    reset();
-
     return cFLFluxFunction;
 }
 
diff --git a/dumux/decoupled/common/fv/fvtransport.hh b/dumux/decoupled/common/fv/fvtransport.hh
index 8123012022..1d711254e1 100644
--- a/dumux/decoupled/common/fv/fvtransport.hh
+++ b/dumux/decoupled/common/fv/fvtransport.hh
@@ -244,6 +244,8 @@ void FVTransport<TypeTag>::update(const Scalar t, Scalar& dt, TransportSolutionT
         CellData& cellDataI = problem_.variables().cellData(globalIdxI);
 
         Scalar update = 0;
+        evalCflFluxFunction().reset();
+
         // run through all intersections with neighbors and boundary
         IntersectionIterator isItEnd = problem_.gridView().iend(*eIt);
         for (IntersectionIterator isIt = problem_.gridView().ibegin(*eIt); isIt != isItEnd; ++isIt)
-- 
GitLab