Commit 9a467dc5 authored by Timo Koch's avatar Timo Koch
Browse files

Add paramGroup parameter for problem base classes

parent fe149855
......@@ -83,12 +83,14 @@ public:
/*!
* \brief Constructor
* \param fvGridGeometry The finite volume grid geometry
* \param paramGroup The parameter group in which to look for runtime parameters first (default is "")
*/
FVProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry)
FVProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, const std::string& paramGroup = "")
: fvGridGeometry_(fvGridGeometry)
, paramGroup_(paramGroup)
{
// set a default name for the problem
problemName_ = getParamFromGroup<std::string>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "Problem.Name");
problemName_ = getParamFromGroup<std::string>(paramGroup, "Problem.Name");
}
/*!
......@@ -550,6 +552,10 @@ public:
const FVGridGeometry& fvGridGeometry() const
{ return *fvGridGeometry_; }
//! The parameter group in which to retrieve runtime parameters
const std::string& paramGroup() const
{ return paramGroup_; }
protected:
//! Returns the implementation of the problem (i.e. static polymorphism)
Implementation &asImp_()
......@@ -587,6 +593,9 @@ private:
//! The finite volume grid geometry
std::shared_ptr<const FVGridGeometry> fvGridGeometry_;
//! The parameter group in which to retrieve runtime parameters
std::string paramGroup_;
//! The name of the problem
std::string problemName_;
......
......@@ -68,10 +68,11 @@ class StaggeredFVProblem : public FVProblem<TypeTag>
public:
/*!
* \brief Constructor
* \param fvGridGeometry The finite volume grid geometry
* \param fvGridGeometry The finite volume grid geometry
* \param paramGroup The parameter group in which to look for runtime parameters first (default is "")
*/
StaggeredFVProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry)
: ParentType(fvGridGeometry)
StaggeredFVProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, const std::string& paramGroup = "")
: ParentType(fvGridGeometry, paramGroup)
{ }
/*!
......
......@@ -29,9 +29,7 @@
#include <dumux/discretization/methods.hh>
#include "model.hh"
namespace Dumux
{
namespace Dumux {
//! The implementation is specialized for the different discretizations
template<class TypeTag, DiscretizationMethod discMethod> struct NavierStokesParentProblemImpl;
......@@ -66,7 +64,7 @@ class NavierStokesProblem : public NavierStokesParentProblem<TypeTag>
using GridView = typename FVGridGeometry::GridView;
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView;
using FVElementGeometry = typename FVGridGeometry::LocalView;
using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector);
using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
......@@ -80,12 +78,16 @@ class NavierStokesProblem : public NavierStokesParentProblem<TypeTag>
using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
public:
//! The constructor sets the gravity, if desired by the user.
NavierStokesProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry)
: ParentType(fvGridGeometry),
gravity_(0)
/*!
* \brief The constructor
* \param fvGridGeometry The finite volume grid geometry
* \param paramGroup The parameter group in which to look for runtime parameters first (default is "")
*/
NavierStokesProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, const std::string& paramGroup = "")
: ParentType(fvGridGeometry, paramGroup)
, gravity_(0.0)
{
if (getParamFromGroup<bool>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "Problem.EnableGravity"))
if (getParamFromGroup<bool>(paramGroup, "Problem.EnableGravity"))
gravity_[dim-1] = -9.81;
}
......@@ -140,6 +142,6 @@ private:
GlobalPosition gravity_;
};
}
} // end namespace Dumux
#endif
......@@ -33,8 +33,7 @@
#include "model.hh"
namespace Dumux
{
namespace Dumux {
/*!
* \ingroup RANSModel
......@@ -71,9 +70,13 @@ class RANSProblem : public NavierStokesProblem<TypeTag>
using DimMatrix = Dune::FieldMatrix<Scalar, dim, dim>;
public:
//! The constructor sets the gravity, if desired by the user.
RANSProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry)
: ParentType(fvGridGeometry)
/*!
* \brief The constructor
* \param fvGridGeometry The finite volume grid geometry
* \param paramGroup The parameter group in which to look for runtime parameters first (default is "")
*/
RANSProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, const std::string& paramGroup = "")
: ParentType(fvGridGeometry, paramGroup)
{ }
/*!
......@@ -350,6 +353,6 @@ private:
{ return *static_cast<const Implementation *>(this); }
};
}
} // end namespace Dumux
#endif
......@@ -34,8 +34,7 @@
#include "model.hh"
#include "models.hh"
namespace Dumux
{
namespace Dumux {
/*!
* \ingroup ZeroEqModel
......@@ -71,11 +70,15 @@ class ZeroEqProblem : public RANSProblem<TypeTag>
using DimMatrix = Dune::FieldMatrix<Scalar, dim, dim>;
public:
//! The constructor sets the gravity, if desired by the user.
ZeroEqProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry)
: ParentType(fvGridGeometry)
/*!
* \brief The constructor
* \param fvGridGeometry The finite volume grid geometry
* \param paramGroup The parameter group in which to look for runtime parameters first (default is "")
*/
ZeroEqProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, const std::string& paramGroup = "")
: ParentType(fvGridGeometry, paramGroup)
{
eddyViscosityModel_ = getParamFromGroup<int>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "RANS.EddyViscosityModel", 1);
eddyViscosityModel_ = getParamFromGroup<int>(paramGroup, "RANS.EddyViscosityModel", 1);
}
/*!
......@@ -277,6 +280,6 @@ private:
{ return *static_cast<const Implementation *>(this); }
};
}
} // end namespace Dumux
#endif
......@@ -25,11 +25,10 @@
#include <dumux/common/fvproblem.hh>
namespace Dumux
{
namespace Dumux {
/*!
* \ingroup ImplicitBaseProblems
* \ingroup PorousmediumFlow
* \brief Base class for all fully implicit porous media problems
* TODO: derive from base problem property?
*/
......@@ -56,14 +55,15 @@ public:
* \brief The constructor
*
* \param fvGridGeometry The finite volume grid geometry
* \param paramGroup The parameter group in which to look for runtime parameters first (default is "")
*/
PorousMediumFlowProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry)
: ParentType(fvGridGeometry)
PorousMediumFlowProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, const std::string& paramGroup = "")
: ParentType(fvGridGeometry, paramGroup)
, gravity_(0.0)
, spatialParams_(std::make_shared<SpatialParams>(this->asImp_()))
{
// TODO: spatial params init?
const bool enableGravity = getParamFromGroup<bool>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "Problem.EnableGravity");
const bool enableGravity = getParamFromGroup<bool>(paramGroup, "Problem.EnableGravity");
if (enableGravity)
gravity_[dimWorld-1] = -9.81;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment