diff --git a/doc/handbook/tutorial-decoupled.tex b/doc/handbook/tutorial-decoupled.tex index 4a315e0f1..6820d9a6b 100644 --- a/doc/handbook/tutorial-decoupled.tex +++ b/doc/handbook/tutorial-decoupled.tex @@ -71,13 +71,13 @@ sequential model is strictly bound by a CFL-criterion, the first time-step size is initialized with the simulation time. After this, a grid is created on line \ref{tutorial-decoupled:create-grid} -and the problem is instantiated with information about the grid +and the time manager controlling the simulation run is instantiated +with the start parameters in line \ref{tutorial-decoupled:initTimeManager}. +The problem is instantiated with the time manager and information about the grid (via its leaf grid view) on line \ref{tutorial-decoupled:instantiate-problem}. If demanded, on line \ref{tutorial-decoupled:mainRestart} a state written to disk by a previous simulation run is restored on request by the user. -Finally, the time manager controlling the simulation run is instantiated -with the start parameters in line \ref{tutorial-decoupled:initTimeManager} -and the simulation proceedure is started by the time manager at line +Finally, the simulation proceedure is started by the time manager at line \ref{tutorial-decoupled:execute}. diff --git a/examples/tutorial_decoupled.cc b/examples/tutorial_decoupled.cc index 7f5d4e1bd..68eab2cd9 100644 --- a/examples/tutorial_decoupled.cc +++ b/examples/tutorial_decoupled.cc @@ -56,6 +56,7 @@ int main(int argc, char** argv) typedef GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; /*@\label{tutorial-decoupled:retrieve-types-begin}@*/ typedef GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid; typedef GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem; + typedef GET_PROP_TYPE(TypeTag, PTAG(TimeManager)) TimeManager; typedef Dune::FieldVector GlobalPosition; /*@\label{tutorial-decoupled:retrieve-types-end}@*/ // initialize MPI, finalize is done automatically on exit @@ -90,21 +91,23 @@ int main(int argc, char** argv) // create the grid Grid *gridPtr = GET_PROP(TypeTag, PTAG(Grid))::create(); /*@\label{tutorial-decoupled:create-grid}@*/ + // create time manager responsible for global simulation control + TimeManager timeManager; //////////////////////////////////////////////////////////// // instantiate and run the concrete problem //////////////////////////////////////////////////////////// + Problem problem(timeManager, gridPtr->leafView()); /*@\label{tutorial-decoupled:instantiate-problem}@*/ - Problem problem(gridPtr->leafView()); /*@\label{tutorial-decoupled:instantiate-problem}@*/ + // define simulation parameters + timeManager.init(problem, 0, dt, tEnd, !restart); /*@\label{tutorial-decoupled:initTimeManager}@*/ // load restart file if necessary if (restart) /*@\label{tutorial-decoupled:mainRestart}@*/ problem.deserialize(restartTime); - // define simulation parameters - problem.timeManager().init(problem, 0, dt, tEnd, !restart); /*@\label{tutorial-decoupled:initTimeManager}@*/ // run the simulation - problem.timeManager().run(); /*@\label{tutorial-decoupled:execute}@*/ + timeManager.run(); /*@\label{tutorial-decoupled:execute}@*/ return 0; } catch (Dune::Exception &e) { diff --git a/examples/tutorialproblem_decoupled.hh b/examples/tutorialproblem_decoupled.hh index e564baef4..576649ded 100644 --- a/examples/tutorialproblem_decoupled.hh +++ b/examples/tutorialproblem_decoupled.hh @@ -141,7 +141,7 @@ class TutorialProblemDecoupled: public IMPESProblem2P ThisType; typedef IMPESProblem2P ParentType; typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView; - + typedef typename GET_PROP_TYPE(TypeTag, PTAG(TimeManager)) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, PTAG(TwoPIndices)) Indices; typedef typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)) FluidSystem; @@ -165,9 +165,10 @@ class TutorialProblemDecoupled: public IMPESProblem2P LocalPosition; public: - TutorialProblemDecoupled(const GridView &gridView, + TutorialProblemDecoupled(TimeManager &timeManager, const GridView &gridView, const GlobalPosition lowerLeft = GlobalPosition(0.), - const GlobalPosition upperRight = GlobalPosition(0.)) : ParentType(gridView) /*@\label{tutorial-decoupled:constructor-problem}@*/ + const GlobalPosition upperRight = GlobalPosition(0.)) + : ParentType(timeManager, gridView) /*@\label{tutorial-decoupled:constructor-problem}@*/ { } //! The problem name.