Commit e500a3ac authored by Kilian Weishaupt's avatar Kilian Weishaupt

[staggered] Clean-up properties and improve docu

parent a45b6171
......@@ -196,6 +196,8 @@ NEW_PROP_TAG(StaggeredPrimaryVariables); //!< The hybrid primary varia
NEW_PROP_TAG(BaseEpsilon); //!< A base epsilon for numerical differentiation, can contain multiple values
NEW_PROP_TAG(FaceVariables); //!< Class containing local face-related data
NEW_PROP_TAG(BoundaryValues); //!< Class containing local boundary data
NEW_PROP_TAG(StaggeredFaceSolution); //!< A vector containing the solution for a face (similar to ElementSolution)
NEW_PROP_TAG(ElementFaceVariables); //!< Face related varibles (similar to volume variables)
NEW_PROP_TAG(EnableGridFaceVariablesCache); //!< Switch on/off caching of face variables
/////////////////////////////////////////////////////////////
......
......@@ -27,7 +27,8 @@
#include <dune/common/fvector.hh>
#include <dumux/common/properties.hh>
namespace Dumux {
namespace Dumux
{
template<class TypeTag>
class StaggeredFaceVariables
......
......@@ -17,10 +17,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \ingroup Properties
* \ingroup StaggeredDiscretization
* \file
*
* \brief Defines a type tag and some properties for models using the staggered scheme.
This scheme features degrees of freedom at the elements' centers and intersections (faces).
* TODO: detailed documentation and figures
*/
#ifndef DUMUX_STAGGERD_PROPERTIES_HH
......@@ -59,12 +61,6 @@ template<class TypeTag> class CCElementBoundaryTypes;
namespace Properties
{
NEW_PROP_TAG(CellCenterSolutionVector);
NEW_PROP_TAG(FaceSolutionVector);
NEW_PROP_TAG(StaggeredFaceSolution);
NEW_PROP_TAG(ElementFaceVariables);
//! Type tag for the staggered scheme.
NEW_TYPE_TAG(StaggeredModel, INHERITS_FROM(FiniteVolumeModel));
......@@ -80,7 +76,7 @@ SET_TYPE_PROP(StaggeredModel, FVGridGeometry, StaggeredFVGridGeometry<TypeTag, G
//! Set the default for the FVElementGeometry vector
SET_TYPE_PROP(StaggeredModel, FVElementGeometry, StaggeredFVElementGeometry<TypeTag, GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>);
//! The sub control volume
//! The default sub control volume
SET_PROP(StaggeredModel, SubControlVolume)
{
private:
......@@ -127,34 +123,44 @@ public:
using type = BaseStaggeredGeometryHelper<GridView>;
};
//! Set the default global face variables
//! Set the default global face variables cache vector class
SET_TYPE_PROP(StaggeredModel, GridFaceVariables, StaggeredGridFaceVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridFaceVariablesCache)>);
//! Set the default for the ElementBoundaryTypes
SET_TYPE_PROP(StaggeredModel, ElementBoundaryTypes, CCElementBoundaryTypes<TypeTag>);
//! Set the default element face variables
SET_TYPE_PROP(StaggeredModel, ElementFaceVariables, StaggeredElementFaceVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridFaceVariablesCache)>);
//! Cache the face variables per default
SET_BOOL_PROP(StaggeredModel, EnableGridFaceVariablesCache, true);
//! The global volume variables vector class
//! Set the default global volume variables cache vector class
SET_TYPE_PROP(StaggeredModel, GridVolumeVariables, StaggeredGridVolumeVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridVolumeVariablesCache)>);
//! The element volume variables vector class
//! Set the element volume variables class
SET_TYPE_PROP(StaggeredModel, ElementVolumeVariables, StaggeredElementVolumeVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridVolumeVariablesCache)>);
//! The global flux variables cache vector class
//! Set the global flux variables cache vector class
SET_TYPE_PROP(StaggeredModel, GridFluxVariablesCache, StaggeredGridFluxVariablesCache<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridFluxVariablesCache)>);
//! The local flux variables cache vector class
//! Set the local flux variables cache vector class
SET_TYPE_PROP(StaggeredModel, ElementFluxVariablesCache, StaggeredElementFluxVariablesCache<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridFluxVariablesCache)>);
//! Set the BaseLocalResidual to StaggeredLocalResidual
SET_TYPE_PROP(StaggeredModel, BaseLocalResidual, StaggeredLocalResidual<TypeTag>);
//! Set the face solution type
SET_TYPE_PROP(StaggeredModel, StaggeredFaceSolution, StaggeredFaceSolution<TypeTag>);
SET_TYPE_PROP(StaggeredModel, IntersectionMapper, ConformingGridIntersectionMapper<TypeTag>);
//! Set the element solution type
SET_TYPE_PROP(StaggeredModel, ElementSolutionVector, Dune::BlockVector<typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables)>);
SET_TYPE_PROP(StaggeredModel, StaggeredFaceSolution, StaggeredFaceSolution<TypeTag>);
//! Set the grid variables (volume, flux and face variables)
SET_TYPE_PROP(StaggeredModel, GridVariables, StaggeredGridVariables<TypeTag>);
SET_TYPE_PROP(StaggeredModel, ElementFaceVariables, StaggeredElementFaceVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGridFaceVariablesCache)>);
//! Use the cell center element boundary types per default
SET_TYPE_PROP(StaggeredModel, ElementBoundaryTypes, CCElementBoundaryTypes<TypeTag>);
SET_BOOL_PROP(StaggeredModel, EnableGridFaceVariablesCache, true);
//! Set the intersection mapper
SET_TYPE_PROP(StaggeredModel, IntersectionMapper, ConformingGridIntersectionMapper<TypeTag>);
//! Set the BaseLocalResidual to StaggeredLocalResidual
SET_TYPE_PROP(StaggeredModel, BaseLocalResidual, StaggeredLocalResidual<TypeTag>);
//! Definition of the indices for cell center and face dofs in the global solution vector
SET_PROP(StaggeredModel, DofTypeIndices)
......@@ -163,17 +169,45 @@ SET_PROP(StaggeredModel, DofTypeIndices)
using FaceIdx = Dune::index_constant<1>;
};
//! A vector of primary variables
//! The cell center primary variables
SET_TYPE_PROP(StaggeredModel,
CellCenterPrimaryVariables,
Dune::FieldVector<typename GET_PROP_TYPE(TypeTag, Scalar),
GET_PROP_VALUE(TypeTag, NumEqCellCenter)>);
//! A vector of primary variables
//! The face primary variables
SET_TYPE_PROP(StaggeredModel,
FacePrimaryVariables,
Dune::FieldVector<typename GET_PROP_TYPE(TypeTag, Scalar),
GET_PROP_VALUE(TypeTag, NumEqFace)>);
//! Boundary types at a single degree of freedom
SET_PROP(StaggeredModel, BoundaryTypes)
{
private:
static constexpr auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter);
static constexpr auto numEqFace = GET_PROP_VALUE(TypeTag, NumEqFace);
public:
using type = BoundaryTypes<numEqCellCenter + numEqFace>;
};
//! Set one or different base epsilons for the calculations of the localJacobian's derivatives
SET_PROP(StaggeredModel, BaseEpsilon)
{
private:
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
static constexpr Scalar dCCdCC = 1e-8;
static constexpr Scalar dCCdFace = 1e-8;
static constexpr Scalar dFacedCC = 1e-8;
static constexpr Scalar dFacedFace = 1e-8;
public:
static constexpr auto getEps()
{
return std::array<std::array<Scalar, 2>, 2>{{{dCCdCC, dCCdFace},
{dFacedCC, dFacedFace}}};
}
};
// TODO: bundle SolutionVector, JacobianMatrix and LinearSolverPreconditionerBlockLevel
// in LinearAlgebra traits
......@@ -202,24 +236,22 @@ SET_PROP(StaggeredModel, JacobianMatrix)
{
private:
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
enum {
numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter),
numEqFace = GET_PROP_VALUE(TypeTag, NumEqFace)
};
static constexpr auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter);
static constexpr auto numEqFace = GET_PROP_VALUE(TypeTag, NumEqFace);
public:
// the sub-blocks
using MatrixLittleBlockCCToCC = typename Dune::FieldMatrix<Scalar, numEqCellCenter, numEqCellCenter>; // 2x2
using MatrixLittleBlockCCToFace = typename Dune::FieldMatrix<Scalar, numEqCellCenter, numEqFace>; // 2x1
using MatrixLittleBlockCCToCC = typename Dune::FieldMatrix<Scalar, numEqCellCenter, numEqCellCenter>;
using MatrixLittleBlockCCToFace = typename Dune::FieldMatrix<Scalar, numEqCellCenter, numEqFace>;
using MatrixLittleBlockFaceToFace = typename Dune::FieldMatrix<Scalar, numEqFace, numEqFace>; // 1x1
using MatrixLittleBlockFaceToCC = typename Dune::FieldMatrix<Scalar, numEqFace, numEqCellCenter>; // 1x2
using MatrixLittleBlockFaceToFace = typename Dune::FieldMatrix<Scalar, numEqFace, numEqFace>;
using MatrixLittleBlockFaceToCC = typename Dune::FieldMatrix<Scalar, numEqFace, numEqCellCenter>;
// the BCRS matrices of the subproblems as big blocks
using MatrixBlockCCToCC = typename Dune::BCRSMatrix<MatrixLittleBlockCCToCC>;
using MatrixBlockCCToFace = typename Dune::BCRSMatrix<MatrixLittleBlockCCToFace>;
using MatrixBlockFaceToFace = typename Dune::BCRSMatrix<MatrixLittleBlockFaceToFace>;
using MatrixBlockFaceToCC = typename Dune::BCRSMatrix<MatrixLittleBlockFaceToCC>;
......@@ -234,44 +266,6 @@ public:
// set the block level to 2 (nested multiple times) TODO: move to LinearAlgebra traits
SET_INT_PROP(StaggeredModel, LinearSolverPreconditionerBlockLevel, 2);
SET_TYPE_PROP(StaggeredModel, ElementSolutionVector, Dune::BlockVector<typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables)>);
//! Boundary types at a single degree of freedom
SET_PROP(StaggeredModel, BoundaryTypes)
{
private:
enum {
numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter),
numEqFace = GET_PROP_VALUE(TypeTag, NumEqFace)
};
public:
using type = BoundaryTypes<numEqCellCenter + numEqFace>;
};
SET_TYPE_PROP(StaggeredModel, GridVariables, StaggeredGridVariables<TypeTag>);
//! Set one or different base epsilons for the calculations of the localJacobian's derivatives
SET_PROP(StaggeredModel, BaseEpsilon)
{
private:
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
static constexpr Scalar dCCdCC = 1e-8;
static constexpr Scalar dCCdFace = 1e-8;
static constexpr Scalar dFacedCC = 1e-8;
static constexpr Scalar dFacedFace = 1e-8;
public:
static constexpr auto getEps()
{
return std::array<std::array<Scalar, 2>, 2>{{{dCCdCC, dCCdFace},
{dFacedCC, dFacedFace}}};
}
};
} // namespace Properties
} // namespace Dumux
......
Markdown is supported
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