From a76b64bc56d799c8a79ad39f09427f626e326bee Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Mon, 14 Apr 2014 20:32:30 +0200 Subject: [PATCH] refactoring: extend the TimeManager to become the Simulator this also comes with moving responsibilities around and some smaller cleanups for the grid creation. (although grid creation could be possibly done by the simulator now, the GridCreator concept has not been abandoned, yet...) --- examples/problems/co2injectionproblem.hh | 12 +--- examples/problems/cuvetteproblem.hh | 17 ++---- examples/problems/diffusionproblem.hh | 12 +--- examples/problems/fingergridcreator.hh | 62 ++++++++------------ examples/problems/fingerproblem.hh | 34 +++-------- examples/problems/fractureproblem.hh | 12 +--- examples/problems/groundwaterproblem.hh | 12 +--- examples/problems/infiltrationproblem.hh | 14 ++--- examples/problems/lensgridcreator.hh | 24 ++++++-- examples/problems/lensproblem.hh | 21 ++----- examples/problems/navierstokestestproblem.hh | 12 +--- examples/problems/obstacleproblem.hh | 14 ++--- examples/problems/outflowproblem.hh | 14 ++--- examples/problems/powerinjectionproblem.hh | 12 +--- examples/problems/reservoirproblem.hh | 12 +--- examples/problems/richardslensproblem.hh | 19 ++---- examples/problems/stokes2ctestproblem.hh | 12 +--- examples/problems/stokesnitestproblem.hh | 20 +++---- examples/problems/stokestestproblem.hh | 12 +--- examples/problems/waterairproblem.hh | 11 +--- examples/tutorial1problem.hh | 14 ++--- tests/run-vtu-test.sh | 13 ++-- 22 files changed, 127 insertions(+), 258 deletions(-) diff --git a/examples/problems/co2injectionproblem.hh b/examples/problems/co2injectionproblem.hh index 4646bac70..b88f69cf4 100644 --- a/examples/problems/co2injectionproblem.hh +++ b/examples/problems/co2injectionproblem.hh @@ -211,7 +211,7 @@ class Co2InjectionProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector; typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; typedef typename GET_PROP_TYPE(TypeTag, Model) Model; typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLaw) HeatConductionLaw; @@ -225,14 +225,8 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - Co2InjectionProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) -#endif + Co2InjectionProblem(Simulator &simulator) + : ParentType(simulator) { eps_ = 1e-6; diff --git a/examples/problems/cuvetteproblem.hh b/examples/problems/cuvetteproblem.hh index dfbd37c46..6089636f2 100644 --- a/examples/problems/cuvetteproblem.hh +++ b/examples/problems/cuvetteproblem.hh @@ -150,12 +150,11 @@ class CuvetteProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLaw) HeatConductionLaw; - typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLawParams) - HeatConductionLawParams; + typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLawParams) HeatConductionLawParams; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector; typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, Model) Model; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; @@ -182,15 +181,9 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - CuvetteProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()), -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()), -#endif - eps_(1e-6) + CuvetteProblem(Simulator &simulator) + : ParentType(simulator) + , eps_(1e-6) { if (Valgrind::IsRunning()) FluidSystem::init(/*minT=*/283.15, /*maxT=*/500.0, /*nT=*/20, diff --git a/examples/problems/diffusionproblem.hh b/examples/problems/diffusionproblem.hh index 8db2479d5..5146ebf82 100644 --- a/examples/problems/diffusionproblem.hh +++ b/examples/problems/diffusionproblem.hh @@ -132,7 +132,7 @@ class DiffusionProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, Model) Model; enum { @@ -167,14 +167,8 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - DiffusionProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) -#endif + DiffusionProblem(Simulator &simulator) + : ParentType(simulator) { FluidSystem::init(); diff --git a/examples/problems/fingergridcreator.hh b/examples/problems/fingergridcreator.hh index a5cafaca0..cf1a1ccf3 100644 --- a/examples/problems/fingergridcreator.hh +++ b/examples/problems/fingergridcreator.hh @@ -24,6 +24,7 @@ #define EWOMS_FINGER_GRID_CREATOR_HH #include +#include #include #include @@ -33,21 +34,23 @@ #include -namespace Ewoms { // some hacky defines for the grid creator #define FINGER_DIM 2 #define FINGER_CUBES 1 +namespace Ewoms { +template +class FingerGridCreator; + template class FingerProblem; } // namespace Ewoms namespace Opm { -////////// -// Specify the properties for the finger problem -////////// namespace Properties { // declare the properties required by the for the finger grid creator +NEW_TYPE_TAG(FingerGridCreator); + NEW_PROP_TAG(Grid); NEW_PROP_TAG(Scalar); @@ -60,22 +63,25 @@ NEW_PROP_TAG(CellsY); NEW_PROP_TAG(CellsZ); NEW_PROP_TAG(GridGlobalRefinements); -} // namespace Properties -} // namespace Opm + +SET_TYPE_PROP(FingerGridCreator, Grid, Dune::ALUGrid); +SET_TYPE_PROP(FingerGridCreator, GridCreator, Ewoms::FingerGridCreator); + +}} // namespace Opm, Properties namespace Ewoms { /*! * \brief Helper class for grid instantiation of the finger problem. */ template -class FingerGridCreator +class FingerGridCreator : public BaseGridCreator { typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; enum { dim = FINGER_DIM }; public: - typedef Dune::ALUGrid Grid; + typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid; /*! * \brief Register all run-time parameters for the grid creator. @@ -187,57 +193,44 @@ public: v[5] = i5; v[6] = i6; v[7] = i7; - factory.insertElement( - Dune::GeometryType(Dune::GeometryType::cube, 3), v); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube, 3), v); #else v[0] = i0; v[1] = i1; v[2] = i2; v[3] = i4; - factory.insertElement( - Dune::GeometryType(Dune::GeometryType::simplex, 3), - v); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 3), v); v[0] = i4; v[1] = i5; v[2] = i6; v[3] = i2; - factory.insertElement( - Dune::GeometryType(Dune::GeometryType::simplex, 3), - v); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 3), v); v[0] = i2; v[1] = i5; v[2] = i4; v[3] = i1; - factory.insertElement( - Dune::GeometryType(Dune::GeometryType::simplex, 3), - v); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 3), v); v[0] = i2; v[1] = i3; v[2] = i7; v[3] = i5; - factory.insertElement( - Dune::GeometryType(Dune::GeometryType::simplex, 3), - v); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 3), v); v[0] = i5; v[1] = i7; v[2] = i6; v[3] = i2; - factory.insertElement( - Dune::GeometryType(Dune::GeometryType::simplex, 3), - v); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 3), v); v[0] = i1; v[1] = i3; v[2] = i5; v[3] = i2; - factory.insertElement( - Dune::GeometryType(Dune::GeometryType::simplex, 3), - v); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 3), v); #endif } } @@ -254,20 +247,17 @@ public: v[1] = i1; v[2] = i2; v[3] = i3; - factory.insertElement( - Dune::GeometryType(Dune::GeometryType::cube, 2), v); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube, 2), v); #else v[0] = i0; v[1] = i1; v[2] = i2; - factory.insertElement( - Dune::GeometryType(Dune::GeometryType::simplex, 2), v); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 2), v); v[0] = i1; v[1] = i3; v[2] = i2; - factory.insertElement( - Dune::GeometryType(Dune::GeometryType::simplex, 2), v); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 2), v); #endif } } @@ -280,8 +270,8 @@ public: /*! * \brief Return a reference to the grid. */ - static Grid &grid() - { return *grid_; } + static Grid* gridPointer() + { return grid_; } /*! * \brief Distribute the grid (and attached data) over all diff --git a/examples/problems/fingerproblem.hh b/examples/problems/fingerproblem.hh index 29809bf88..3c6d7b32b 100644 --- a/examples/problems/fingerproblem.hh +++ b/examples/problems/fingerproblem.hh @@ -53,16 +53,9 @@ class FingerProblem; namespace Opm { namespace Properties { -NEW_TYPE_TAG(FingerBaseProblem); +NEW_TYPE_TAG(FingerBaseProblem, INHERITS_FROM(FingerGridCreator)); -// set the GridCreator property -SET_TYPE_PROP(FingerBaseProblem, GridCreator, Ewoms::FingerGridCreator); - -// Retrieve the grid type from the grid creator -SET_TYPE_PROP(FingerBaseProblem, Grid, - typename GET_PROP_TYPE(TypeTag, GridCreator)::Grid); - -// declare the properties specific for the finger problem +// declare the properties used by the finger problem NEW_PROP_TAG(InitialWaterSaturation); // Set the problem property @@ -95,8 +88,7 @@ SET_PROP(FingerBaseProblem, MaterialLaw) typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef Opm::TwoPhaseMaterialTraits - Traits; + /*nonWettingPhaseIdx=*/FluidSystem::nonWettingPhaseIdx> Traits; // use the parker-lenhard hysteresis law typedef Opm::ParkerLenhard ParkerLenhard; @@ -131,12 +123,11 @@ SET_SCALAR_PROP(FingerBaseProblem, EndTime, 1e3); // The default for the initial time step size of the simulation SET_SCALAR_PROP(FingerBaseProblem, InitialTimeStepSize, 10); -} // namespace Properties -} // namespace Opm +}} // namespace Opm, Properties namespace Ewoms { /*! - * \ingroup VcfvTestProblems + * \ingroup TestProblems * * \brief Two-phase problem featuring some gravity-driven saturation * fingers. @@ -163,7 +154,7 @@ class FingerProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) typedef typename GET_PROP_TYPE(TypeTag, WettingPhase) WettingPhase; typedef typename GET_PROP_TYPE(TypeTag, NonwettingPhase) NonwettingPhase; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints; typedef typename GET_PROP_TYPE(TypeTag, Model) Model; @@ -192,7 +183,6 @@ class FingerProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) typedef typename GridView::ctype CoordScalar; typedef Dune::FieldVector GlobalPosition; - typedef Dune::FieldMatrix DimMatrix; //!\endcond @@ -200,14 +190,8 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - FingerProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) -#endif + FingerProblem(Simulator &simulator) + : ParentType(simulator) { eps_ = 3e-6; FluidSystem::init(); @@ -280,7 +264,7 @@ public: void postTimeStep() { // update the history of the hysteresis law - ElementContext elemCtx(*this); + ElementContext elemCtx(this->simulator()); auto elemIt = this->gridView().template begin<0>(); const auto &elemEndIt = this->gridView().template end<0>(); diff --git a/examples/problems/fractureproblem.hh b/examples/problems/fractureproblem.hh index 97458d8e1..738237f97 100644 --- a/examples/problems/fractureproblem.hh +++ b/examples/problems/fractureproblem.hh @@ -171,7 +171,7 @@ class FractureProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; @@ -210,14 +210,8 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - FractureProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) -#endif + FractureProblem(Simulator &simulator) + : ParentType(simulator) { eps_ = 3e-6; temperature_ = 273.15 + 20; // -> 20°C diff --git a/examples/problems/groundwaterproblem.hh b/examples/problems/groundwaterproblem.hh index 427ecf883..a0fd7eaa3 100644 --- a/examples/problems/groundwaterproblem.hh +++ b/examples/problems/groundwaterproblem.hh @@ -135,7 +135,7 @@ class GroundWaterProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) pressure0Idx = Indices::pressure0Idx }; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector; typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; @@ -151,14 +151,8 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - GroundWaterProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) -#endif + GroundWaterProblem(Simulator &simulator) + : ParentType(simulator) { eps_ = 1.0e-3; diff --git a/examples/problems/infiltrationproblem.hh b/examples/problems/infiltrationproblem.hh index e1f707297..66e5cc51d 100644 --- a/examples/problems/infiltrationproblem.hh +++ b/examples/problems/infiltrationproblem.hh @@ -150,7 +150,7 @@ class InfiltrationProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector; typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, Model) Model; @@ -186,15 +186,9 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - InfiltrationProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()), -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()), -#endif - eps_(1e-6) + InfiltrationProblem(Simulator &simulator) + : ParentType(simulator) + , eps_(1e-6) { temperature_ = 273.15 + 10.0; // -> 10 degrees Celsius FluidSystem::init(/*tempMin=*/temperature_ - 1, diff --git a/examples/problems/lensgridcreator.hh b/examples/problems/lensgridcreator.hh index cdf78fee9..07dc3e4dd 100644 --- a/examples/problems/lensgridcreator.hh +++ b/examples/problems/lensgridcreator.hh @@ -24,6 +24,7 @@ #define EWOMS_LENS_GRID_CREATOR_HH #include +#include #include #include @@ -36,10 +37,15 @@ namespace Ewoms { template class LensProblem; + +template +class LensGridCreator; } // namespace Ewoms namespace Opm { namespace Properties { +NEW_TYPE_TAG(LensGridCreator); + // declare the properties required by the for the lens grid creator NEW_PROP_TAG(Grid); NEW_PROP_TAG(Scalar); @@ -53,6 +59,10 @@ NEW_PROP_TAG(CellsY); NEW_PROP_TAG(CellsZ); NEW_PROP_TAG(GridGlobalRefinements); + +// set the Grid and GridCreator properties +SET_TYPE_PROP(LensGridCreator, Grid, Dune::YaspGrid<2>); +SET_TYPE_PROP(LensGridCreator, GridCreator, Ewoms::LensGridCreator); }} // namespace Opm, Properties namespace Ewoms { @@ -62,15 +72,17 @@ namespace Ewoms { * \brief Helper class for grid instantiation of the lens problem. */ template -class LensGridCreator +class LensGridCreator : public BaseGridCreator { typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; - static const int dim = 2; +public: + typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid; + +private: + static const int dim = Grid::dimension; public: - typedef Dune::YaspGrid Grid; - /*! * \brief Register all run-time parameters for the grid creator. */ @@ -142,8 +154,8 @@ public: /*! * \brief Return a reference to the grid. */ - static Grid &grid() - { return *grid_; } + static Grid* gridPointer() + { return grid_; } /*! * \brief Distribute the grid (and attached data) over all diff --git a/examples/problems/lensproblem.hh b/examples/problems/lensproblem.hh index 9070af04b..ad3a1ccd3 100644 --- a/examples/problems/lensproblem.hh +++ b/examples/problems/lensproblem.hh @@ -53,7 +53,7 @@ class LensProblem; namespace Opm { namespace Properties { -NEW_TYPE_TAG(LensBaseProblem); +NEW_TYPE_TAG(LensBaseProblem, INHERITS_FROM(LensGridCreator)); // declare the properties specific for the lens problem NEW_PROP_TAG(LensLowerLeftX); @@ -63,13 +63,6 @@ NEW_PROP_TAG(LensUpperRightX); NEW_PROP_TAG(LensUpperRightY); NEW_PROP_TAG(LensUpperRightZ); -// set the GridCreator property -SET_TYPE_PROP(LensBaseProblem, GridCreator, Ewoms::LensGridCreator); - -// Retrieve the grid type from the grid creator -SET_TYPE_PROP(LensBaseProblem, Grid, - typename GET_PROP_TYPE(TypeTag, GridCreator)::Grid); - // Set the problem property SET_TYPE_PROP(LensBaseProblem, Problem, Ewoms::LensProblem); @@ -189,7 +182,7 @@ class LensProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) typedef typename GET_PROP_TYPE(TypeTag, WettingPhase) WettingPhase; typedef typename GET_PROP_TYPE(TypeTag, NonwettingPhase) NonwettingPhase; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, Model) Model; enum { @@ -223,14 +216,8 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - LensProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) -#endif + LensProblem(Simulator &simulator) + : ParentType(simulator) { eps_ = 3e-6; FluidSystem::init(); diff --git a/examples/problems/navierstokestestproblem.hh b/examples/problems/navierstokestestproblem.hh index 3316811e1..313e36ef1 100644 --- a/examples/problems/navierstokestestproblem.hh +++ b/examples/problems/navierstokestestproblem.hh @@ -103,7 +103,7 @@ class NavierStokesTestProblem : public StokesProblem typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector; typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; @@ -128,14 +128,8 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - NavierStokesTestProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) -#endif + NavierStokesTestProblem(Simulator &simulator) + : ParentType(simulator) { eps_ = 1e-6; } /*! diff --git a/examples/problems/obstacleproblem.hh b/examples/problems/obstacleproblem.hh index 3273bf9c0..e064854fe 100644 --- a/examples/problems/obstacleproblem.hh +++ b/examples/problems/obstacleproblem.hh @@ -162,24 +162,18 @@ class ObstacleProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) N2Idx = FluidSystem::N2Idx }; - typedef Dune::FieldVector GlobalPosition; + typedef Dune::FieldVector GlobalPosition; typedef Dune::FieldVector PhaseVector; typedef Dune::FieldMatrix DimMatrix; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, Model) Model; public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - ObstacleProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) -#endif + ObstacleProblem(Simulator &simulator) + : ParentType(simulator) { eps_ = 1e-6; temperature_ = 273.15 + 25; // -> 25°C diff --git a/examples/problems/outflowproblem.hh b/examples/problems/outflowproblem.hh index 90485177f..2b6ab057c 100644 --- a/examples/problems/outflowproblem.hh +++ b/examples/problems/outflowproblem.hh @@ -105,7 +105,7 @@ class OutflowProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector; typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; typedef typename GET_PROP_TYPE(TypeTag, Model) Model; @@ -130,15 +130,9 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - OutflowProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()), -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()), -#endif - eps_(1e-6) + OutflowProblem(Simulator &simulator) + : ParentType(simulator) + , eps_(1e-6) { temperature_ = 273.15 + 20; FluidSystem::init(/*minT=*/temperature_ - 1, /*maxT=*/temperature_ + 2, diff --git a/examples/problems/powerinjectionproblem.hh b/examples/problems/powerinjectionproblem.hh index ec6ba1e89..e915b7ad5 100644 --- a/examples/problems/powerinjectionproblem.hh +++ b/examples/problems/powerinjectionproblem.hh @@ -158,7 +158,7 @@ class PowerInjectionProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector; typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, Model) Model; enum { @@ -188,14 +188,8 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - PowerInjectionProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) -#endif + PowerInjectionProblem(Simulator &simulator) + : ParentType(simulator) { eps_ = 3e-6; FluidSystem::init(); diff --git a/examples/problems/reservoirproblem.hh b/examples/problems/reservoirproblem.hh index bc9112ab8..ca7a4a1fc 100644 --- a/examples/problems/reservoirproblem.hh +++ b/examples/problems/reservoirproblem.hh @@ -156,7 +156,7 @@ class ReservoirProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints; typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; typedef typename GET_PROP_TYPE(TypeTag, BlackOilFluidState) BlackOilFluidState; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; typedef typename GET_PROP_TYPE(TypeTag, Model) Model; @@ -169,14 +169,8 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - ReservoirProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) -#endif + ReservoirProblem(Simulator &simulator) + : ParentType(simulator) { eps_ = 1e-6; diff --git a/examples/problems/richardslensproblem.hh b/examples/problems/richardslensproblem.hh index b09bf13be..a982db2dd 100644 --- a/examples/problems/richardslensproblem.hh +++ b/examples/problems/richardslensproblem.hh @@ -52,10 +52,7 @@ NEW_TYPE_TAG(RichardsLensProblem, Richards); SET_TYPE_PROP(RichardsLensProblem, Grid, Dune::YaspGrid<2>); // Set the physical problem to be solved -SET_PROP(RichardsLensProblem, Problem) -{ - typedef Ewoms::RichardsLensProblem type; -}; +SET_TYPE_PROP(RichardsLensProblem, Problem, Ewoms::RichardsLensProblem); // Set the wetting phase SET_PROP(RichardsLensProblem, WettingPhase) @@ -148,7 +145,7 @@ class RichardsLensProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector; typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Model) Model; @@ -180,15 +177,9 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - RichardsLensProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()), -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()), -#endif - pnRef_(1e5) + RichardsLensProblem(Simulator &simulator) + : ParentType(simulator) + , pnRef_(1e5) { eps_ = 3e-6; pnRef_ = 1e5; diff --git a/examples/problems/stokes2ctestproblem.hh b/examples/problems/stokes2ctestproblem.hh index e916da5bb..8494d4958 100644 --- a/examples/problems/stokes2ctestproblem.hh +++ b/examples/problems/stokes2ctestproblem.hh @@ -91,7 +91,7 @@ class Stokes2cTestProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) { typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; @@ -121,14 +121,8 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - Stokes2cTestProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) -#endif + Stokes2cTestProblem(Simulator &simulator) + : ParentType(simulator) { eps_ = 1e-6; diff --git a/examples/problems/stokesnitestproblem.hh b/examples/problems/stokesnitestproblem.hh index 043e5de75..d82721273 100644 --- a/examples/problems/stokesnitestproblem.hh +++ b/examples/problems/stokesnitestproblem.hh @@ -95,7 +95,7 @@ class StokesNiTestProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) { typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints; @@ -105,10 +105,12 @@ class StokesNiTestProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Model) Model; - enum { // Number of equations and grid dimension - numEq = GET_PROP_VALUE(TypeTag, NumEq), - dimWorld = GridView::dimensionworld }; enum { + // Number of equations and grid dimension + numEq = GET_PROP_VALUE(TypeTag, NumEq), + + dimWorld = GridView::dimensionworld, + // primary variable indices pressureIdx = Indices::pressureIdx, moleFrac1Idx = Indices::moleFrac1Idx, @@ -132,14 +134,8 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - StokesNiTestProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) -#endif + StokesNiTestProblem(Simulator &simulator) + : ParentType(simulator) { eps_ = 1e-6; diff --git a/examples/problems/stokestestproblem.hh b/examples/problems/stokestestproblem.hh index a14a608c0..4335ee7c0 100644 --- a/examples/problems/stokestestproblem.hh +++ b/examples/problems/stokestestproblem.hh @@ -97,7 +97,7 @@ class StokesTestProblem : public GET_PROP_TYPE(TypeTag, BaseProblem) { typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector; typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; @@ -128,14 +128,8 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - StokesTestProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) -#endif + StokesTestProblem(Simulator &simulator) + : ParentType(simulator) { eps_ = 1e-6; } /*! diff --git a/examples/problems/waterairproblem.hh b/examples/problems/waterairproblem.hh index dae79dc8c..0b749813b 100644 --- a/examples/problems/waterairproblem.hh +++ b/examples/problems/waterairproblem.hh @@ -157,7 +157,6 @@ class WaterAirProblem typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; - typedef typename GridView::Grid Grid; // copy some indices for convenience typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; @@ -191,7 +190,7 @@ class WaterAirProblem typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, Constraints) Constraints; - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, Model) Model; typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams; @@ -207,12 +206,8 @@ public: /*! * \copydoc Doxygen::defaultProblemConstructor */ - WaterAirProblem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,3) - : ParentType(timeManager, GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()) -#else - : ParentType(timeManager, GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()) -#endif + WaterAirProblem(Simulator &simulator) + : ParentType(simulator) { maxDepth_ = 1000.0; // [m] eps_ = 1e-6; diff --git a/examples/tutorial1problem.hh b/examples/tutorial1problem.hh index 5900d5b8b..70ba99e29 100644 --- a/examples/tutorial1problem.hh +++ b/examples/tutorial1problem.hh @@ -144,7 +144,7 @@ class Tutorial1Problem typedef Dune::FieldMatrix DimMatrix; // eWoms specific types are specified via the property system - typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; + typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector; typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector; @@ -164,15 +164,9 @@ class Tutorial1Problem public: //! The constructor of the problem - Tutorial1Problem(TimeManager &timeManager) -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafGridView()), -#else - : ParentType(timeManager, - GET_PROP_TYPE(TypeTag, GridCreator)::grid().leafView()), -#endif - eps_(3e-6) + Tutorial1Problem(Simulator &simulator) + : ParentType(simulator) + , eps_(3e-6) { // Use an isotropic and homogeneous intrinsic permeability K_ = this->toDimMatrix_(1e-7); diff --git a/tests/run-vtu-test.sh b/tests/run-vtu-test.sh index 7c69e7e00..a3faea635 100755 --- a/tests/run-vtu-test.sh +++ b/tests/run-vtu-test.sh @@ -90,10 +90,10 @@ case "$TEST_TYPE" in echo "######################" echo "RND: '$RND'" - SIM_NAME=$(grep "Initializing the problem" "test-$RND.log" | sed "s/.*\"\(.*\)\".*/\1/" | head -n1) - NUM_TIMESTEPS=$(grep "Writing result" "test-$RND.log" | wc -l) + SIM_NAME=$(grep "Applying the initial solution of the" "test-$RND.log" | sed "s/.*\"\(.*\)\".*/\1/" | head -n1) + NUM_TIMESTEPS=$(grep "Time step [0-9]* done" "test-$RND.log" | wc -l) TEST_RESULT=$(printf "%s-%05i" "$SIM_NAME" "$NUM_TIMESTEPS") - TEST_RESULT=$(ls "$TEST_RESULT".*) + TEST_RESULT=$(ls -- "$TEST_RESULT".*) rm "test-$RND.log" if ! test -r "$TEST_RESULT"; then echo "File $TEST_RESULT does not exist or is not readable" @@ -119,9 +119,8 @@ case "$TEST_TYPE" in exit 1 fi - grep "Initializing the problem" "test-$RND.log" - SIM_NAME=$(grep "Initializing the problem" "test-$RND.log" | sed "s/.*\"\(.*\)\".*/\1/" | head -n1) - NUM_TIMESTEPS=$(grep "Writing result" "test-$RND.log" | wc -l) + SIM_NAME=$(grep "Applying the initial solution of the" "test-$RND.log" | sed "s/.*\"\(.*\)\".*/\1/" | head -n1) + NUM_TIMESTEPS=$(grep "Time step [0-9]* done" "test-$RND.log" | wc -l) rm "test-$RND.log" echo "Simulation name: '$SIM_NAME'" @@ -129,7 +128,7 @@ case "$TEST_TYPE" in for PROC_NUM in 0 1 2 3; do REF_FILE=$(printf "s%04d-p%04d-%s" "$NUM_PROCS" "$PROC_NUM" "$SIM_NAME") TEST_RESULT=$(printf "s%04d-p%04d-%s-%05i" "$NUM_PROCS" "$PROC_NUM" "$SIM_NAME" "$NUM_TIMESTEPS") - TEST_RESULT=$(ls "$TEST_RESULT".*) + TEST_RESULT=$(ls -- "$TEST_RESULT".*) if ! test -r "$TEST_RESULT"; then echo "File $TEST_RESULT does not exist or is not readable" exit 1