Commit f6ad530a authored by Andreas Lauser's avatar Andreas Lauser
Browse files

introduce new file dumux/common/basicproperties.hh; remove ReferenceElements...

introduce new file dumux/common/basicproperties.hh; remove ReferenceElements property from decoupled models; doc

- now every model type tag should be derived from the NumericModel type
tag.
- instead of retrieving the reference elements from the ReferenceElements property,
  use Dune::GenericReferenceElements<Scalar, dim>
- some improvements for the handbook's design patterns and property system chapeters

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@4626 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent bd19d885
......@@ -2,7 +2,7 @@
\newcommand{\nextline}{\par\phantom{a}\vspace*{0.1\textwidth}}
\chapter{The flow of things in \Dumux}
This chapter is supposed to show how things are "handed around" in \Dumux. This is not a comprehenisve guide through the modeling framework of \Dumux, but hopefully it will help getting to grips with it.
This chapter is supposed to show how things are ``handed around'' in \Dumux. This is not a comprehenisve guide through the modeling framework of \Dumux, but hopefully it will help getting to grips with it.
In Section \ref{content} the structure of \Dumux is shown from a \emph{content} point of view.
Section \ref{implementation} is written from the point of view of the \emph{implementation}. These two approaches are linked by the circled numbers (like \textbf{\textcircled{\ref{init}}}) in the flowchart of Section \ref{implementation} corresponding to the enumeration of the list of Section \ref{content}. This is supposed to demonstrate at which point of the program-flow you are content- and implementation-wise.
......@@ -562,4 +562,4 @@ $\left \lbrace
\end{landscape}
\normalsize
\ No newline at end of file
\normalsize
\chapter{Tips \& Tricks}
This chapter tries to be a useful collection of tips and tricks that can be handy when working with
\Dumux. One of the most prominent ideas for developing DUNE/\Dumux is that reinventing the wheel in terms of FEM-code should
be avoided. We try to follow this idea also in the day-to-day work by stating the \emph{tell us dogma}: "If you found something useful,
handy or for other reasons helping when working with \Dumux: put it into this chapter." (or at least write it to the mailing list \\ \verb+dumux@iws.uni-stuttgart.de so somebody else can+).
be avoided. We try to follow this idea also in the day-to-day work by stating the \emph{tell us dogma}: ``If you found something useful,
handy or for other reasons helping when working with \Dumux: put it into this chapter.'' (or at least write it to the mailing list \\ \verb+dumux@iws.uni-stuttgart.de so somebody else can+).
\begin{itemize}
\item Using the \Dumux-Eclipse profile:
......@@ -11,7 +11,7 @@ Everybody using the same profile has the advantage of resulting in less conflic
\item in eclipse open: \verb#window->preferences->C/C++->Code Style#
\item press the \verb+Import+ button
\item choose the file \verb+eclipse_profile.xml+ from your dumux-devel directory
\item make sure that that now DuMux is chosen in "select a profile"
\item make sure that that now DuMux is chosen in ``select a profile''
\end{itemize}
\item Checking whether commit worked:
......
......@@ -21,6 +21,8 @@
\usepackage{rotating}
\usepackage{subfig}
%\usepackage{ngerman}
\usepackage[english]{babel}
\DeclareGraphicsExtensions{.eps, .jpg}
......
......@@ -34,5 +34,5 @@ of documentation is documented, and it is easier to get rid of it systematically
The use of exceptions for error handling is encouraged. Until further notice, all exceptions thrown are DuneEx.
\item Debugging Code:
Global debugging code is switched off by setting the symbol NDEBUG. In particular, all asserts are
automatically removed. Use those asserts freely!"
automatically removed. Use those asserts freely!
\end{itemize}
This diff is collapsed.
......@@ -70,7 +70,7 @@ can be retrieved by the \Dumux property system and only depend on this
single type tag. Retrieving them is done between line
\ref{tutorial-coupled:retrieve-types-begin} and
\ref{tutorial-coupled:retrieve-types-end}. For an introduction to the
property system, see section \ref{sec:propertysytem}.
property system, see section \ref{sec:propertysystem}.
The first thing which should be done at run time is to initialize the
message passing interface using DUNE's \texttt{MPIHelper} class. Line
......@@ -412,3 +412,8 @@ Use benzene as a new fluid and run the model of Exercise 2 with water
and benzene. Benzene has a density of $889.51 \, \text{kg} / \text{m}^3$
and a viscosity of $0.00112 \, \text{Pa} \; \text{s}$.
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "dumux-handbook"
%%% End:
......@@ -19,6 +19,8 @@
#include <dumux/common/propertysystem.hh>
#include <dumux/common/basicproperties.hh>
/*!
* \file
* \brief Specify the shape functions, operator assemblers, etc
......@@ -35,19 +37,16 @@ namespace Properties
// \{
//////////////////////////////////////////////////////////////////
// Type tags tags
// Type tags
//////////////////////////////////////////////////////////////////
//! The type tag for models based on the box-scheme
NEW_TYPE_TAG(BoxModel);
NEW_TYPE_TAG(BoxModel, INHERITS_FROM(CoupledModel));
//////////////////////////////////////////////////////////////////
// Property tags
//////////////////////////////////////////////////////////////////
//!< Property tag for scalar vaslues
NEW_PROP_TAG(Scalar);
NEW_PROP_TAG(Grid); //!< The type of the DUNE grid
NEW_PROP_TAG(GridView); //!< The type of the grid view
......
......@@ -49,9 +49,6 @@ namespace Properties {
// Some defaults for very fundamental properties
//////////////////////////////////////////////////////////////////
//! Set the default type for scalar values to double
SET_TYPE_PROP(BoxModel, Scalar, double);
//! Set the default type for the time manager
SET_TYPE_PROP(BoxModel, TimeManager, Dumux::TimeManager<TypeTag>);
......
// $Id$
/*****************************************************************************
* Copyright (C) 2010 by Andreas Lauser *
* Institute of Hydraulic Engineering *
* 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, as long as this copyright notice *
* is included in its original form. *
* *
* This program is distributed WITHOUT ANY WARRANTY. *
*****************************************************************************/
/*!
* \file
*
* \brief Defines a type tags and some fundamental properties for
* fully coupled and decoupled models
*/
#ifndef DUMUX_BASIC_PROPERTIES_HH
#define DUMUX_BASIC_PROPERTIES_HH
#include <dumux/common/propertysystem.hh>
namespace Dumux
{
namespace Properties
{
///////////////////////////////////
// Type tag definitions:
//
// NumericModel
// |
// +-> CoupledModel
// |
// \-> DecoupledModel
///////////////////////////////////
//! Type tag for all models.
NEW_TYPE_TAG(NumericModel);
//! Type tag for all fully coupled models.
NEW_TYPE_TAG(CoupledModel, INHERITS_FROM(NumericModel));
//! Type tag for all decoupled models.
NEW_TYPE_TAG(DecoupledModel, INHERITS_FROM(NumericModel));
///////////////////////////////////
// Property names which are always available:
//
// Scalar
///////////////////////////////////
//! Property to specify the type of scalar values.
NEW_PROP_TAG(Scalar);
///////////////////////////////////
// Default values for properties:
//
// Scalar -> double
///////////////////////////////////
//! Set the default type of scalar values to double
SET_TYPE_PROP(NumericModel, Scalar, double);
} // namespace Properties
} // namespace Dumux
#endif
......@@ -62,9 +62,6 @@ template<class TypeTag> class FVPressure1P
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Variables)) Variables;
typedef typename GET_PROP(TypeTag, PTAG(ReferenceElements)) ReferenceElements;
typedef typename ReferenceElements::Container ReferenceElementContainer;
typedef typename ReferenceElements::ContainerFaces ReferenceElementFaceContainer;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(SpatialParameters)) SpatialParameters;
......
......@@ -50,13 +50,7 @@ class FVVelocity1P: public FVPressure1P<TypeTag>
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Variables)) Variables;
typedef typename GET_PROP(TypeTag, PTAG(ReferenceElements)) ReferenceElements;
typedef typename ReferenceElements::Container ReferenceElementContainer;
typedef typename ReferenceElements::ContainerFaces ReferenceElementFaceContainer;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(SpatialParameters)) SpatialParameters;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Fluid)) Fluid;
typedef typename GridView::Traits::template Codim<0>::Entity Element;
......@@ -139,10 +133,11 @@ public:
Dune::FieldVector<Scalar, dim> refVelocity(0);
refVelocity[0] = 0.5 * (flux[1] - flux[0]);
refVelocity[1] = 0.5 * (flux[3] - flux[2]);
const Dune::FieldVector<Scalar, dim>& localPos = ReferenceElementContainer::general(eIt->geometry().type()).position(0,
typedef Dune::GenericReferenceElements<Scalar, dim> ReferenceElements;
const Dune::FieldVector<Scalar, dim>& localPos = ReferenceElements::general(eIt->geometry().type()).position(0,
0);
// get the transposed Jacobian of the element mapping
const FieldMatrix& jacobianInv = eIt->geometry().jacobianInverseTransposed(localPos);
FieldMatrix jacobianT(jacobianInv);
......
......@@ -61,9 +61,6 @@ template<class TypeTag> class FVPressure2P
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Variables)) Variables;
typedef typename GET_PROP(TypeTag, PTAG(ReferenceElements)) ReferenceElements;
typedef typename ReferenceElements::Container ReferenceElementContainer;
typedef typename ReferenceElements::ContainerFaces ReferenceElementFaceContainer;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(SpatialParameters)) SpatialParameters;
typedef typename SpatialParameters::MaterialLaw MaterialLaw;
......
......@@ -50,10 +50,7 @@ class FVVelocity2P: public FVPressure2P<TypeTag>
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Variables)) Variables;
typedef typename GET_PROP(TypeTag, PTAG(ReferenceElements)) ReferenceElements;
typedef typename ReferenceElements::Container ReferenceElementContainer;
typedef typename ReferenceElements::ContainerFaces ReferenceElementFaceContainer;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(SpatialParameters)) SpatialParameters;
typedef typename SpatialParameters::MaterialLaw MaterialLaw;
......@@ -184,7 +181,7 @@ public:
// refVelocity[0] = 0.5 * (flux[1] - flux[0]);
// refVelocity[1] = 0.5 * (flux[3] - flux[2]);
//
// const Dune::FieldVector<Scalar, dim>& localPos = ReferenceElementContainer::general(eIt->geometry().type()).position(0,
// const Dune::FieldVector<Scalar, dim>& localPos = GenericReferenceElements::general(eIt->geometry().type()).position(0,
// 0);
//
// // get the transposed Jacobian of the element mapping
......
......@@ -64,9 +64,6 @@ class FVMPFAOPressure2P
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Variables)) Variables;
typedef typename GET_PROP(TypeTag, PTAG(ReferenceElements)) ReferenceElements;
typedef typename ReferenceElements::Container ReferenceElementContainer;
typedef typename ReferenceElements::ContainerFaces ReferenceElementFaceContainer;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(SpatialParameters)) SpatialParameters;
typedef typename SpatialParameters::MaterialLaw MaterialLaw;
......@@ -2429,6 +2426,7 @@ void FVMPFAOPressure2P<TypeTag>::updateMaterialLaws()
Dune::GeometryType gt = eIt->geometry().type();
// get cell center in reference element
typedef Dune::GenericReferenceElements<Scalar, dim> ReferenceElementContainer;
const LocalPosition &localPos = ReferenceElementContainer::general(gt).position(0, 0);
// get global coordinate of cell center
......
......@@ -35,9 +35,6 @@ template<class TypeTag> class FVMPFAOVelocity2P: public FVMPFAOPressure2P<TypeTa
typedef FVMPFAOPressure2P<TypeTag> ParentType;typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem;
typedef typename GET_PROP(TypeTag, PTAG(ReferenceElements)) ReferenceElements;
typedef typename ReferenceElements::Container ReferenceElementContainer;
typedef typename ReferenceElements::ContainerFaces ReferenceElementFaceContainer;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(SpatialParameters)) SpatialParameters;
typedef typename SpatialParameters::MaterialLaw MaterialLaw;
......
......@@ -65,9 +65,6 @@ template<class TypeTag> class MimeticPressure2P
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Variables)) Variables;
typedef typename GET_PROP(TypeTag, PTAG(ReferenceElements)) ReferenceElements;
typedef typename ReferenceElements::Container ReferenceElementContainer;
typedef typename ReferenceElements::ContainerFaces ReferenceElementFaceContainer;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(SpatialParameters)) SpatialParameters;
typedef typename SpatialParameters::MaterialLaw MaterialLaw;
......
......@@ -50,9 +50,6 @@ private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem;
typedef typename GET_PROP(TypeTag, PTAG(ReferenceElements)) ReferenceElements;
typedef typename ReferenceElements::Container ReferenceElementContainer;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(TwoPIndices)) Indices;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(SpatialParameters)) SpatialParameters;
......@@ -94,7 +91,8 @@ public:
Dune::GeometryType gt = element.geometry().type();
// cell center in reference element
const LocalPosition& localPos = ReferenceElementContainer::general(gt).position(0,0);
typedef Dune::GenericReferenceElements<Scalar, dim> ReferenceElements;
const LocalPosition& localPos = ReferenceElements::general(gt).position(0,0);
// get global coordinate of cell center
const GlobalPosition& globalPos = element.geometry().global(localPos);
......@@ -146,7 +144,8 @@ public:
// compute factor in neighbor
Dune::GeometryType neighborGT = neighborPointer->geometry().type();
const LocalPosition& localPosNeighbor = ReferenceElementContainer::general(neighborGT).position(0,0);
typedef Dune::GenericReferenceElements<Scalar, dim> ReferenceElements;
const LocalPosition& localPosNeighbor = ReferenceElements::general(neighborGT).position(0,0);
// neighbor cell center in global coordinates
const GlobalPosition& globalPosNeighbor = neighborPointer->geometry().global(localPosNeighbor);
......
......@@ -53,9 +53,6 @@ class FVSaturation2P
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Variables)) Variables;
typedef typename GET_PROP(TypeTag, PTAG(ReferenceElements)) ReferenceElements;
typedef typename ReferenceElements::Container ReferenceElementContainer;
typedef typename ReferenceElements::ContainerFaces ReferenceElementFaceContainer;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(DiffusivePart)) DiffusivePart;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(ConvectivePart)) ConvectivePart;
......
......@@ -52,9 +52,6 @@ private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem;
typedef typename GET_PROP(TypeTag, PTAG(ReferenceElements)) ReferenceElements;
typedef typename ReferenceElements::Container ReferenceElementContainer;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(TwoPIndices)) Indices;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(SpatialParameters)) SpatialParameters;
......@@ -95,7 +92,8 @@ public:
Dune::GeometryType gt = element.geometry().type();
// cell center in reference element
const LocalPosition& localPos = ReferenceElementContainer::general(gt).position(0,0);
typedef Dune::GenericReferenceElements<Scalar, dim> ReferenceElements;
const LocalPosition& localPos = ReferenceElements::general(gt).position(0,0);
// get global coordinate of cell center
const GlobalPosition& globalPos = element.geometry().global(localPos);
......@@ -159,7 +157,8 @@ public:
// compute factor in neighbor
Dune::GeometryType neighborGT = neighborPointer->geometry().type();
const LocalPosition& localPosNeighbor = ReferenceElementContainer::general(neighborGT).position(0,0);
typedef Dune::GenericReferenceElements<Scalar, dim> ReferenceElements;
const LocalPosition& localPosNeighbor = ReferenceElements::general(neighborGT).position(0,0);
// neighbor cell center in global coordinates
const GlobalPosition& globalPosNeighbor = neighborPointer->geometry().global(localPosNeighbor);
......
......@@ -65,9 +65,6 @@ template<class TypeTag> class FVPressure2P2C
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP(TypeTag, PTAG(SolutionTypes)) SolutionTypes;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem;
typedef typename GET_PROP(TypeTag, PTAG(ReferenceElements)) ReferenceElements;
typedef typename ReferenceElements::Container ReferenceElementContainer;
typedef typename ReferenceElements::ContainerFaces ReferenceElementFaceContainer;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(SpatialParameters)) SpatialParameters;
typedef typename SpatialParameters::MaterialLaw MaterialLaw;
......@@ -432,7 +429,8 @@ void FVPressure2P2C<TypeTag>::assemble(bool first)
Dune::GeometryType gt = eIt->geometry().type();
// number of Faces of current element
int numberOfFaces = ReferenceElementContainer::general(gt).size(1);
typedef Dune::GenericReferenceElements<Scalar, dim> ReferenceElements;
int numberOfFaces = ReferenceElements::general(gt).size(1);
// get global coordinate of cell center
......@@ -493,7 +491,9 @@ void FVPressure2P2C<TypeTag>::assemble(bool first)
Dune::GeometryType faceGT = isIt->geometryInInside().type();
// center in face's reference element
const Dune::FieldVector<Scalar, dim - 1>& faceLocal = ReferenceElementFaceContainer::general(faceGT).position(0,0);
typedef Dune::GenericReferenceElements<Scalar, dim - 1> FaceReferenceElements;
const Dune::FieldVector<Scalar, dim - 1>& faceLocal =
FaceReferenceElements::general(faceGT).position(0,0);
int isIndex = isIt->indexInInside();
......
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