Commit 3a4de0e8 authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

implicit branch: unify PorousMediaBox- and PorousMediaCC-Problem to...

implicit branch: unify PorousMediaBox- and PorousMediaCC-Problem to ImplicitPorousMediaProblem. Delete porousmediaccproblem.hh. Deprecate PorousMediaBoxProblem in favor of ImplicitPorousMediaProblem. Adapt includes and names.

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/branches/implicit@9745 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 6429ab93
#warning This file is deprecated. Include dumux/implicit/box/porousmediaboxproblem.hh instead.
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* 2012 by Bernd Flemisch *
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \brief Base class for all problems which use the two-phase box model
*/
#ifndef DUMUX_POROUS_MEDIA_BOX_PROBLEM_HH
#define DUMUX_POROUS_MEDIA_BOX_PROBLEM_HH
#include <dumux/implicit/box/porousmediaboxproblem.hh>
#include <dumux/implicit/common/implicitporousmediaproblem.hh>
namespace Dumux
{
/*!
* \ingroup BoxBaseProblems
* \brief Base class for all porous media box problems
*/
template<class TypeTag>
class PorousMediaBoxProblem : public ImplicitPorousMediaProblem<TypeTag>
{
typedef ImplicitPorousMediaProblem<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
public:
/*!
* \brief The constructor
*
* \param timeManager The time manager
* \param gridView The grid view
* \param verbose Turn verbosity on or off
*/
DUNE_DEPRECATED_MSG("Use ImplicitPorousMediaProblem from dumux/implicit/common/implicitporousmediaproblem.hh.")
PorousMediaBoxProblem(TimeManager &timeManager,
const GridView &gridView,
const bool verbose = true)
: ParentType(timeManager, gridView)
{}
};
}
#endif
......@@ -21,7 +21,7 @@
#ifndef DUMUX_BOXMODELS_2PDFM_PROBLEM_HH
#define DUMUX_BOXMODELS_2PDFM_PROBLEM_HH
#include <dumux/implicit/box/porousmediaboxproblem.hh>
#include <dumux/implicit/common/implicitporousmediaproblem.hh>
#include "2pdfmproperties.hh"
namespace Dumux
......@@ -32,9 +32,9 @@ namespace Dumux
* \brief Base class for all problems which use the two-phase box model
*/
template<class TypeTag>
class TwoPDFMProblem : public PorousMediaBoxProblem<TypeTag>
class TwoPDFMProblem : public ImplicitPorousMediaProblem<TypeTag>
{
typedef PorousMediaBoxProblem<TypeTag> ParentType;
typedef ImplicitPorousMediaProblem<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
......@@ -48,7 +48,7 @@ public:
* \param gridView The grid view
* \param verbose Turn verbosity on or off
*/
DUNE_DEPRECATED_MSG("use PorousMediaBoxProblem instead")
DUNE_DEPRECATED_MSG("use ImplicitPorousMediaProblem instead")
TwoPDFMProblem(TimeManager &timeManager,
const GridView &gridView,
bool verbose = true)
......
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* 2012 by Bernd Flemisch *
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \brief Base class for all problems which use the two-phase box model
*/
#ifndef DUMUX_POROUS_MEDIA_BOX_PROBLEM_HH
#define DUMUX_POROUS_MEDIA_BOX_PROBLEM_HH
#include "boxproperties.hh"
#include <dumux/implicit/common/implicitproblem.hh>
namespace Dumux
{
namespace Properties
{
NEW_PROP_TAG(SpatialParams); //!< The type of the spatial parameters object
NEW_PROP_TAG(ProblemEnableGravity); //!< Returns whether gravity is considered in the problem
}
/*!
* \ingroup BoxBaseProblems
* \brief Base class for all porous media box problems
*/
template<class TypeTag>
class PorousMediaBoxProblem : public ImplicitProblem<TypeTag>
{
typedef ImplicitProblem<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, Problem) Implementation;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef typename GET_PROP_TYPE(TypeTag, SpatialParams) SpatialParams;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GridView::template Codim<0>::Entity Element;
enum {
dim = GridView::dimension,
dimWorld = GridView::dimensionworld
};
typedef typename GridView::ctype CoordScalar;
typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef Dune::FieldVector<Scalar, dim> DimVector;
public:
/*!
* \brief The constructor
*
* \param timeManager The time manager
* \param gridView The grid view
* \param verbose Turn verbosity on or off
*/
PorousMediaBoxProblem(TimeManager &timeManager,
const GridView &gridView,
const bool verbose = true)
: ParentType(timeManager, gridView),
gravity_(0)
{
newSpatialParams_ = true;
spatialParams_ = new SpatialParams(gridView);
if (GET_PARAM_FROM_GROUP(TypeTag, bool, Problem, EnableGravity))
gravity_[dim-1] = -9.81;
}
~PorousMediaBoxProblem()
{
if (newSpatialParams_)
delete spatialParams_;
}
/*!
* \name Problem parameters
*/
// \{
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ within a control volume.
*
* This is the discretization specific interface for the box
* method. By default it just calls temperature(pos).
*
* \param element The DUNE Codim<0> enitiy which intersects with
* the finite volume.
* \param fvGeometry The finite volume geometry of the element.
* \param scvIdx The local index of the sub control volume inside the element
*/
Scalar boxTemperature(const Element &element,
const FVElementGeometry fvGeometry,
const int scvIdx) const
{ return asImp_().temperatureAtPos(fvGeometry.subContVol[scvIdx].global); }
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ at a given global position.
*
* This is not specific to the discretization. By default it just
* calls temperature().
*
* \param pos The position in global coordinates where the temperature should be specified.
*/
Scalar temperatureAtPos(const GlobalPosition &pos) const
{ return asImp_().temperature(); }
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ for an isothermal problem.
*
* This is not specific to the discretization. By default it just
* throws an exception so it must be overloaded by the problem if
* no energy equation is used.
*/
Scalar temperature() const
{ DUNE_THROW(Dune::NotImplemented, "temperature() method not implemented by the actual problem"); };
/*!
* \brief Returns the acceleration due to gravity \f$\mathrm{[m/s^2]}\f$.
*
* This is the box discretization specific interface. By default
* it just calls gravityAtPos().
*/
const DimVector &boxGravity(const Element &element,
const FVElementGeometry &fvGeometry,
const int scvIdx) const
{ return asImp_().gravityAtPos(fvGeometry.subContVol[scvIdx].global); }
/*!
* \brief Returns the acceleration due to gravity \f$\mathrm{[m/s^2]}\f$.
*
* This is discretization independent interface. By default it
* just calls gravity().
*/
const DimVector &gravityAtPos(const GlobalPosition &pos) const
{ return asImp_().gravity(); }
/*!
* \brief Returns the acceleration due to gravity \f$\mathrm{[m/s^2]}\f$.
*
* This method is used for problems where the gravitational
* acceleration does not depend on the spatial position. The
* default behaviour is that if the <tt>EnableGravity</tt>
* property is true, \f$\boldsymbol{g} = ( 0,\dots,\ -9.81)^T \f$ holds,
* else \f$\boldsymbol{g} = ( 0,\dots, 0)^T \f$.
*/
const DimVector &gravity() const
{ return gravity_; }
/*!
* \brief Returns the spatial parameters object.
*/
SpatialParams &spatialParams()
{ return *spatialParams_; }
/*!
* \brief Returns the spatial parameters object.
*/
const SpatialParams &spatialParams() const
{ return *spatialParams_; }
// \}
protected:
//! Returns the implementation of the problem (i.e. static polymorphism)
Implementation &asImp_()
{ return *static_cast<Implementation *>(this); }
//! \copydoc asImp_()
const Implementation &asImp_() const
{ return *static_cast<const Implementation *>(this); }
DimVector gravity_;
// fluids and material properties
SpatialParams* spatialParams_;
bool newSpatialParams_;
};
}
#endif
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* Copyright (C) 2009 by Andreas Lauser *
* Institute for Modelling Hydraulic and Environmental Systems *
* University of Stuttgart, Germany *
* email: <givenname>.<name>@iws.uni-stuttgart.de *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \brief Base class for all problems which use the two-phase box model
*/
#ifndef DUMUX_POROUS_MEDIA_CC_PROBLEM_HH
#define DUMUX_POROUS_MEDIA_CC_PROBLEM_HH
#include <dumux/implicit/common/implicitproblem.hh>
#include "ccproperties.hh"
namespace Dumux
{
namespace Properties
{
NEW_PROP_TAG(SpatialParams);
NEW_PROP_TAG(ProblemEnableGravity);
}
/*!
* \ingroup CCBaseProblems
* \brief Base class for all fully implicit cell centered porous media problems
*/
template<class TypeTag>
class PorousMediaCCProblem : public ImplicitProblem<TypeTag>
{
typedef ImplicitProblem<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, Problem) Implementation;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef typename GET_PROP_TYPE(TypeTag, SpatialParams) SpatialParams;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GridView::template Codim<0>::Entity Element;
enum {
dim = GridView::dimension,
dimWorld = GridView::dimensionworld
};
typedef typename GridView::ctype CoordScalar;
typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef Dune::FieldVector<Scalar, dim> Vector;
public:
/*!
* \brief The constructor
*
* \param timeManager The time manager
* \param gridView The grid view
* \param verbose Turn verbosity on or off
*/
PorousMediaCCProblem(TimeManager &timeManager,
const GridView &gridView,
bool verbose = true)
: ParentType(timeManager, gridView),
gravity_(0)
{
newSpatialParams_ = true;
spatialParams_ = new SpatialParams(gridView);
if (GET_PARAM_FROM_GROUP(TypeTag, bool, Problem, EnableGravity))
gravity_[dim-1] = -9.81;
}
~PorousMediaCCProblem()
{
if (newSpatialParams_)
delete spatialParams_;
}
/*!
* \name Problem parameters
*/
// \{
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ within a control volume.
*
* This is the discretization specific interface for the box
* method. By default it just calls temperature(pos).
*
* \param element The DUNE Codim<0> enitiy which intersects with
* the finite volume.
* \param fvGeom The finite volume geometry of the element.
* \param scvIdx The local index of the sub control volume inside the element
*/
Scalar boxTemperature(const Element &element,
const FVElementGeometry fvGeom,
int scvIdx) const
{ return asImp_().temperatureAtPos(fvGeom.neighbors[scvIdx]->geometry().center()); }
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ at a given global position.
*
* This is not specific to the discretization. By default it just
* calls temperature().
*
* \param pos The position in global coordinates where the temperature should be specified.
*/
Scalar temperatureAtPos(const GlobalPosition &pos) const
{ return asImp_().temperature(); }
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ for an isothermal problem.
*
* This is not specific to the discretization. By default it just
* throws an exception so it must be overloaded by the problem if
* no energy equation is used.
*/
Scalar temperature() const
{ DUNE_THROW(Dune::NotImplemented, "temperature() method not implemented by the actual problem"); };
/*!
* \brief Returns the acceleration due to gravity \f$\mathrm{[m/s^2]}\f$.
*
* This is the box discretization specific interface. By default
* it just calls gravityAtPos().
*/
const Vector &boxGravity(const Element &element,
const FVElementGeometry &fvGeom,
int scvIdx) const
{ return asImp_().gravityAtPos(fvGeom.neighbors[scvIdx]->geometry().center()); }
/*!
* \brief Returns the acceleration due to gravity \f$\mathrm{[m/s^2]}\f$.
*
* This is discretization independent interface. By default it
* just calls gravity().
*/
const Vector &gravityAtPos(const GlobalPosition &pos) const
{ return asImp_().gravity(); }
/*!
* \brief Returns the acceleration due to gravity \f$\mathrm{[m/s^2]}\f$.
*
* This method is used for problems where the gravitational
* acceleration does not depend on the spatial position. The
* default behaviour is that if the <tt>ProblemEnableGravity</tt>
* property is true, \f$\boldsymbol{g} = ( 0,\dots,\ -9.81)^T \f$ holds,
* else \f$\boldsymbol{g} = ( 0,\dots, 0)^T \f$.
*/
const Vector &gravity() const
{ return gravity_; }
/*!
* \brief Returns the spatial parameters object.
*/
SpatialParams &spatialParams()
{ return *spatialParams_; }
/*!
* \brief Returns the spatial parameters object.
*/
const SpatialParams &spatialParams() const
{ return *spatialParams_; }
// \}
private:
//! Returns the implementation of the problem (i.e. static polymorphism)
Implementation &asImp_()
{ return *static_cast<Implementation *>(this); }
//! \copydoc asImp_()
const Implementation &asImp_() const
{ return *static_cast<const Implementation *>(this); }
Vector gravity_;
// fluids and material properties
SpatialParams* spatialParams_;
bool newSpatialParams_;
};
}
#endif
......@@ -19,10 +19,10 @@
*****************************************************************************/
/*!
* \file
* \brief Base class for all problems which use the two-phase box model
* \brief Base class for all fully implicit porous media problems
*/
#ifndef DUMUX_POROUS_MEDIA_BOX_PROBLEM_HH
#define DUMUX_POROUS_MEDIA_BOX_PROBLEM_HH
#ifndef DUMUX_IMPLICIT_POROUS_MEDIA_PROBLEM_HH
#define DUMUX_IMPLICIT_POROUS_MEDIA_PROBLEM_HH
#include "implicitproperties.hh"
......@@ -41,7 +41,7 @@ NEW_PROP_TAG(ProblemEnableGravity); //!< Returns whether gravity is considered i
* \brief Base class for all porous media box problems
*/
template<class TypeTag>
class PorousMediaBoxProblem : public ImplicitProblem<TypeTag>
class ImplicitPorousMediaProblem : public ImplicitProblem<TypeTag>
{
typedef ImplicitProblem<TypeTag> ParentType;
......@@ -62,6 +62,8 @@ class PorousMediaBoxProblem : public ImplicitProblem<TypeTag>
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef Dune::FieldVector<Scalar, dim> DimVector;
enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) };
public:
/*!
* \brief The constructor
......@@ -70,7 +72,7 @@ public:
* \param gridView The grid view
* \param verbose Turn verbosity on or off
*/
PorousMediaBoxProblem(TimeManager &timeManager,
ImplicitPorousMediaProblem(TimeManager &timeManager,
const GridView &gridView,
const bool verbose = true)
: ParentType(timeManager, gridView),
......@@ -83,7 +85,7 @@ public:
gravity_[dim-1] = -9.81;
}
~PorousMediaBoxProblem()
~ImplicitPorousMediaProblem()
{
if (newSpatialParams_)
delete spatialParams_;
......@@ -108,8 +110,13 @@ public:
Scalar boxTemperature(const Element &element,
const FVElementGeometry fvGeometry,
const int scvIdx) const
{ return asImp_().temperatureAtPos(fvGeometry.subContVol[scvIdx].global); }
{
if (isBox)
return asImp_().temperatureAtPos(fvGeometry.subContVol[scvIdx].global);
else
return asImp_().temperatureAtPos(fvGeometry.neighbors[scvIdx]->geometry().center());
}
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ at a given global position.
*
......@@ -140,7 +147,12 @@ public:
const DimVector &boxGravity(const Element &element,
const FVElementGeometry &fvGeometry,
const int scvIdx) const
{ return asImp_().gravityAtPos(fvGeometry.subContVol[scvIdx].global); }
{
if (isBox)
return asImp_().gravityAtPos(fvGeometry.subContVol[scvIdx].global);
else
return asImp_().gravityAtPos(fvGeometry.neighbors[scvIdx]->geometry().center());
}
/*!
* \brief Returns the acceleration due to gravity \f$\mathrm{[m/s^2]}\f$.
......@@ -156,7 +168,7 @@ public:
*
* This method is used for problems where the gravitational
* acceleration does not depend on the spatial position. The
* default behaviour is that if the <tt>EnableGravity</tt>
* default behaviour is that if the <tt>ProblemEnableGravity</tt>
* property is true, \f$\boldsymbol{g} = ( 0,\dots,\ -9.81)^T \f$ holds,
* else \f$\boldsymbol{g} = ( 0,\dots, 0)^T \f$.
*/
......
......@@ -23,7 +23,7 @@
#ifndef DUMUX_RICHARDS_PROBLEM_HH
#define DUMUX_RICHARDS_PROBLEM_HH
#include <dumux/implicit/box/porousmediaboxproblem.hh>
#include <dumux/implicit/common/implicitporousmediaproblem.hh>
#include "richardsproperties.hh"
......@@ -37,9 +37,9 @@ namespace Dumux
* For a description of the Richards model, see Dumux::RichardsModel
*/
template<class TypeTag>
class RichardsBoxProblem : public PorousMediaBoxProblem<TypeTag>
class RichardsBoxProblem : public ImplicitPorousMediaProblem<TypeTag>
{
typedef PorousMediaBoxProblem<TypeTag> ParentType;
typedef ImplicitPorousMediaProblem<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
......
......@@ -35,7 +35,7 @@
#include <dumux/material/fluidsystems/liquidphase.hh>
//box model
#include <dumux/implicit/box/porousmediaboxproblem.hh>
#include <dumux/implicit/common/implicitporousmediaproblem.hh>
#include <dumux/implicit/2p/2pmodel.hh>