Time manager is instantiated in application file Problems instantiated with Timemanager TimeManager now runs the problem

update of handbook according to that.
This commit is contained in:
Benjamin Faigle
2011-07-27 14:47:38 +00:00
committed by Andreas Lauser
parent 813a7dd0d7
commit b1fd80d743
3 changed files with 15 additions and 11 deletions

View File

@@ -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}.

View File

@@ -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<Scalar, Grid::dimensionworld> 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) {

View File

@@ -141,7 +141,7 @@ class TutorialProblemDecoupled: public IMPESProblem2P<TypeTag, TutorialProblemDe
typedef TutorialProblemDecoupled<TypeTag> ThisType;
typedef IMPESProblem2P<TypeTag, ThisType> 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<TypeTag, TutorialProblemDe
typedef Dune::FieldVector<Scalar, dim> 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.