Skip to content
Snippets Groups Projects
Commit 039576bc authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

[sequential] Fix test_dec1p on next.

Use getParam instead of the old macro and Components::Constant
instead of Unit.
parent 00dfcf71
No related branches found
No related tags found
2 merge requests!626[sequential] Fix test_dec1p on next.,!617[WIP] Next
...@@ -45,7 +45,7 @@ namespace Components { ...@@ -45,7 +45,7 @@ namespace Components {
* [1.Component] * [1.Component]
* MolarMass = 0.018 # kg/mol * MolarMass = 0.018 # kg/mol
* \endcode * \endcode
* \note If you only have one component you can also leaf out the "1.". * \note If you only have one component you can also omit the "1.".
*/ */
template<int id, class Scalar> template<int id, class Scalar>
class Constant : public Component<Scalar, Constant<id, Scalar> > class Constant : public Component<Scalar, Constant<id, Scalar> >
......
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
{ {
spatialParams_ = std::make_shared<SpatialParams>(gridView); spatialParams_ = std::make_shared<SpatialParams>(gridView);
gravity_ = 0; gravity_ = 0;
if (GET_PARAM_FROM_GROUP(TypeTag, bool, Problem, EnableGravity)) if (getParam<bool>("Problem.EnableGravity", true))
gravity_[dim - 1] = -9.81; gravity_[dim - 1] = -9.81;
} }
/*! /*!
...@@ -93,7 +93,7 @@ public: ...@@ -93,7 +93,7 @@ public:
{ {
spatialParams_ = Dune::stackobject_to_shared_ptr<SpatialParams>(spatialParams); spatialParams_ = Dune::stackobject_to_shared_ptr<SpatialParams>(spatialParams);
gravity_ = 0; gravity_ = 0;
if (GET_PARAM_FROM_GROUP(TypeTag, bool, Problem, EnableGravity)) if (getParam<bool>("Problem.EnableGravity", true))
gravity_[dim - 1] = -9.81; gravity_[dim - 1] = -9.81;
} }
/*! /*!
...@@ -106,7 +106,7 @@ public: ...@@ -106,7 +106,7 @@ public:
{ {
spatialParams_ = std::make_shared<SpatialParams>(gridView); spatialParams_ = std::make_shared<SpatialParams>(gridView);
gravity_ = 0; gravity_ = 0;
if (GET_PARAM_FROM_GROUP(TypeTag, bool, Problem, EnableGravity)) if (getParam<bool>("Problem.EnableGravity", true))
gravity_[dim - 1] = -9.81; gravity_[dim - 1] = -9.81;
} }
/*! /*!
...@@ -120,7 +120,7 @@ public: ...@@ -120,7 +120,7 @@ public:
{ {
spatialParams_ = Dune::stackobject_to_shared_ptr<SpatialParams>(spatialParams); spatialParams_ = Dune::stackobject_to_shared_ptr<SpatialParams>(spatialParams);
gravity_ = 0; gravity_ = 0;
if (GET_PARAM_FROM_GROUP(TypeTag, bool, Problem, EnableGravity)) if (getParam<bool>("Problem.EnableGravity", true))
gravity_[dim - 1] = -9.81; gravity_[dim - 1] = -9.81;
} }
......
...@@ -59,7 +59,6 @@ NEW_TYPE_TAG(SequentialOneP, INHERITS_FROM(SequentialModel)); ...@@ -59,7 +59,6 @@ NEW_TYPE_TAG(SequentialOneP, INHERITS_FROM(SequentialModel));
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
NEW_PROP_TAG( SpatialParams ); //!< The type of the spatial parameters object NEW_PROP_TAG( SpatialParams ); //!< The type of the spatial parameters object
NEW_PROP_TAG( ProblemEnableGravity); //!< Returns whether gravity is considered in the problem
NEW_PROP_TAG( Fluid ); //!< The fluid for one-phase models NEW_PROP_TAG( Fluid ); //!< The fluid for one-phase models
NEW_PROP_TAG( Indices ); //!< Set of indices for the one-phase model NEW_PROP_TAG( Indices ); //!< Set of indices for the one-phase model
NEW_PROP_TAG( CellData ); //!< The cell data storage class NEW_PROP_TAG( CellData ); //!< The cell data storage class
...@@ -99,9 +98,6 @@ SET_TYPE_PROP(SequentialOneP, CellData, CellData1P<TypeTag>); ...@@ -99,9 +98,6 @@ SET_TYPE_PROP(SequentialOneP, CellData, CellData1P<TypeTag>);
//! The spatial parameters to be employed. Use BoxSpatialParams by default. //! The spatial parameters to be employed. Use BoxSpatialParams by default.
SET_TYPE_PROP(SequentialOneP, SpatialParams, FVSpatialParamsOneP<TypeTag>); SET_TYPE_PROP(SequentialOneP, SpatialParams, FVSpatialParamsOneP<TypeTag>);
//! Enable gravity by default
SET_BOOL_PROP(SequentialOneP, ProblemEnableGravity, true);
} }
} }
#endif #endif
...@@ -109,6 +109,7 @@ public: ...@@ -109,6 +109,7 @@ public:
timeManager_ = std::make_shared<TimeManager>(verbose); timeManager_ = std::make_shared<TimeManager>(verbose);
model_ = std::make_shared<Model>(asImp_()) ; model_ = std::make_shared<Model>(asImp_()) ;
maxTimeStepSize_ = getParam<Scalar>("TimeManager.MaxTimeStepSize", std::numeric_limits<Scalar>::max());
} }
//! Constructs an object of type OneModelProblemProblem //! Constructs an object of type OneModelProblemProblem
...@@ -137,6 +138,7 @@ public: ...@@ -137,6 +138,7 @@ public:
timeManager_ = Dune::stackobject_to_shared_ptr<TimeManager>(timeManager); timeManager_ = Dune::stackobject_to_shared_ptr<TimeManager>(timeManager);
model_ = std::make_shared<Model>(asImp_()) ; model_ = std::make_shared<Model>(asImp_()) ;
maxTimeStepSize_ = getParam<Scalar>("TimeManager.MaxTimeStepSize", std::numeric_limits<Scalar>::max());
} }
/*! /*!
...@@ -365,9 +367,7 @@ public: ...@@ -365,9 +367,7 @@ public:
* Overload in problem for custom needs. * Overload in problem for custom needs.
*/ */
Scalar maxTimeStepSize() const Scalar maxTimeStepSize() const
{ { return maxTimeStepSize_; }
return GET_PARAM_FROM_GROUP(TypeTag, Scalar, TimeManager, MaxTimeStepSize);
}
/*! /*!
* \brief Returns the current time step size [seconds]. * \brief Returns the current time step size [seconds].
...@@ -665,6 +665,7 @@ private: ...@@ -665,6 +665,7 @@ private:
GlobalPosition bBoxMax_; GlobalPosition bBoxMax_;
std::shared_ptr<TimeManager> timeManager_; std::shared_ptr<TimeManager> timeManager_;
Scalar maxTimeStepSize_;
Variables variables_; Variables variables_;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#define DUMUX_TEST_1P_PROBLEM_HH #define DUMUX_TEST_1P_PROBLEM_HH
#include <dumux/material/fluidsystems/liquidphase.hh> #include <dumux/material/fluidsystems/liquidphase.hh>
#include <dumux/material/components/unit.hh> #include <dumux/material/components/constant.hh>
#include <dumux/porousmediumflow/1p/sequential/diffusion/cellcentered/pressureproperties.hh> #include <dumux/porousmediumflow/1p/sequential/diffusion/cellcentered/pressureproperties.hh>
#include <dumux/porousmediumflow/1p/sequential/diffusion/problem.hh> #include <dumux/porousmediumflow/1p/sequential/diffusion/problem.hh>
...@@ -55,7 +55,7 @@ SET_PROP(TestProblemOneP, Fluid) ...@@ -55,7 +55,7 @@ SET_PROP(TestProblemOneP, Fluid)
private: private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public: public:
typedef FluidSystems::LiquidPhase<Scalar, Unit<Scalar> > type; typedef FluidSystems::LiquidPhase<Scalar, Components::Constant<1, Scalar> > type;
}; };
// Set the spatial parameters // Set the spatial parameters
...@@ -94,7 +94,6 @@ class TestProblemOneP: public DiffusionProblem1P<TypeTag > ...@@ -94,7 +94,6 @@ class TestProblemOneP: public DiffusionProblem1P<TypeTag >
typedef typename GridView::Intersection Intersection; typedef typename GridView::Intersection Intersection;
typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition;
typedef Dune::FieldVector<Scalar, dim> LocalPosition; typedef Dune::FieldVector<Scalar, dim> LocalPosition;
typedef typename GET_PROP(TypeTag, ParameterTree) ParameterTree;
typedef typename GET_PROP_TYPE(TypeTag, GridCreator) GridCreator; typedef typename GET_PROP_TYPE(TypeTag, GridCreator) GridCreator;
...@@ -102,13 +101,10 @@ public: ...@@ -102,13 +101,10 @@ public:
TestProblemOneP(TimeManager &timeManager, const GridView &gridView) : TestProblemOneP(TimeManager &timeManager, const GridView &gridView) :
ParentType(gridView), velocity_(*this) ParentType(gridView), velocity_(*this)
{ {
delta_ = 1e-3 ; delta_ = getParam<Scalar>("Problem.Delta", 1e-3);
if (ParameterTree::tree().hasKey("Problem.Delta")) int numRefine = getParam<int>("Grid.NumRefine");
delta_ = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, Scalar, Problem, Delta); GridCreator::grid().globalRefine(numRefine);
int numRefine;
numRefine = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, int, Grid, NumRefine);
GridCreator::grid().globalRefine(numRefine);
this->spatialParams().initialize(delta_); this->spatialParams().initialize(delta_);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment