Commit 83ae91eb authored by Andreas Lauser's avatar Andreas Lauser
Browse files

document dumux/common, remove obsoloete file boundaryconditions.hh

(except the parts for which Bernd is responsible, i.e. the PDELab
preconditioner and the interface to Pardiso)

boundaryconditions.hh has been moved to dumux-devel

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@4555 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent bbfdf8fd
// $Id$
/*****************************************************************************
* Copyright (C) 2009-2010 by Bernd Flemisch *
* 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. *
*****************************************************************************/
#ifndef DUMUX_BOUNDARYCONDITIONS_HH
#define DUMUX_BOUNDARYCONDITIONS_HH
/**
* @file
* @brief Definition of boundary condition types, extend if necessary
* @author Peter Bastian
*/
namespace Dumux
{
/** @addtogroup DISC_Operators
*
* @{
*/
/**
* @brief Define a class containing boundary condition flags
*
*/
//! base Class that defines boundary condition flags
struct BoundaryConditions
{
/** \brief These values are ordered according to precedence */
enum Flags {
couplingOutflow = -2,
couplingInflow = -1,
outflow = 0,
neumann = 1, //!< Neumann boundary
process = 2, //!< Processor boundary
dirichlet = 3 //!< Dirichlet boundary
};
};
/** @} */
}
#endif
......@@ -27,6 +27,9 @@
namespace Dumux
{
/*!
* \brief Class to specify the type of a boundary.
*/
template <int numEq>
class BoundaryTypes
{
......@@ -58,7 +61,10 @@ public:
}
/*!
* \brief Returns true if the boundary types for a given equation has been set.
* \brief Returns true if the boundary types for a given equation
* has been specified.
*
* \param eqIdx The index of the equation
*/
bool isSet(int eqIdx) const
{ return boundaryInfo_[eqIdx].visited; };
......@@ -66,14 +72,16 @@ public:
/*!
* \brief Make sure the boundary conditions are well-posed.
*
* If they are not, an exception is thrown!#
* If they are not, an assertation fails and the program aborts!
* (if the NDEBUG macro is not defined)
*/
void checkWellPosed() const
{
for (int i=0; i < numEq; ++i) {
#ifndef NDEBUG
for (int i=0; i < numEq; ++i)
// if this fails, at least one condition is missing.
assert(boundaryInfo_[i].visited);
}
#endif
};
/*!
......@@ -167,6 +175,8 @@ public:
/*!
* \brief Set a neumann boundary condition for a single a single
* equation.
*
* \param eqIdx The index of the equation
*/
void setNeumann(int eqIdx)
{
......@@ -184,13 +194,12 @@ public:
* \brief Set a dirichlet boundary condition for a single primary
* variable
*
* \param pvIdx The index of the primary variable which should be
* dirichlet.
* \param eqIdx The index of the equation which should be ignored
* as a consequence
* \param pvIdx The index of the primary variable for which the
* Dirichlet condition should apply.
* \param eqIdx The index of the equation which should used to set
* the Dirichlet condition
*/
void setDirichlet(int pvIdx,
int eqIdx)
void setDirichlet(int pvIdx, int eqIdx)
{
boundaryInfo_[eqIdx].visited = 1;
boundaryInfo_[eqIdx].isDirichlet = 1;
......@@ -209,6 +218,9 @@ public:
/*!
* \brief Set a neumann boundary condition for a single a single
* equation.
*
* \param eqIdx The index of the equation on which the outflow
* condition applies.
*/
void setOutflow(int eqIdx)
{
......@@ -224,7 +236,11 @@ public:
/*!
* \brief Set a dirichlet boundary condition for a single primary
* variable
* variable.
*
* WARNING: This method assumes that the equation with the same
* index as the primary variable to be set is used to specify the
* Dirichlet condition. USE WITH _GREAT_ CARE!
*
* \param eqIdx The index of the equation which is assumed to be
* equal to the index of the primary variable
......@@ -237,6 +253,8 @@ public:
/*!
* \brief Returns true if an equation is used to specify a
* dirichlet condition.
*
* \param eqIdx The index of the equation
*/
bool isDirichlet(unsigned eqIdx) const
{ return boundaryInfo_[eqIdx].isDirichlet; };
......@@ -256,6 +274,8 @@ public:
/*!
* \brief Returns true if an equation is used to specify a
* neumann condition.
*
* \param eqIdx The index of the equation
*/
bool isNeumann(unsigned eqIdx) const
{ return boundaryInfo_[eqIdx].isNeumann; };
......@@ -275,6 +295,8 @@ public:
/*!
* \brief Returns true if an equation is used to specify an
* outflow condition.
*
* \param eqIdx The index of the equation
*/
bool isOutflow(unsigned eqIdx) const
{ return boundaryInfo_[eqIdx].isOutflow; };
......@@ -294,6 +316,8 @@ public:
/*!
* \brief Returns true if an equation is used to specify an
* inflow coupling condition.
*
* \param eqIdx The index of the equation
*/
bool isCouplingInflow(unsigned eqIdx) const
{ return boundaryInfo_[eqIdx].isCouplingInflow; };
......@@ -313,6 +337,8 @@ public:
/*!
* \brief Returns true if an equation is used to specify an
* outflow coupling condition.
*
* \param eqIdx The index of the equation
*/
bool isCouplingOutflow(unsigned eqIdx) const
{ return boundaryInfo_[eqIdx].isCouplingOutflow; };
......@@ -331,16 +357,22 @@ public:
/*!
* \brief Returns the index of the equation which should be used
* for the dirichlet condition of the pvIdx's primary
* for the Dirichlet condition of the pvIdx's primary
* variable.
*
* \param pvIdx The index of the primary variable which is be set
* by the Dirichlet condition.
*/
unsigned dirichletToEqIndex(unsigned pvIdx) const
{ return pv2eqIdx_[pvIdx]; };
/*!
* \brief Returns the index of the primary variable which should
* be used for the dirichlet condition given an equation
* be used for the Dirichlet condition given an equation
* index.
*
* \param eqIdx The index of the equation which is used to set
* the Dirichlet condition.
*/
unsigned eqToDirichletIndex(unsigned eqIdx) const
{ return eq2pvIdx_[eqIdx]; };
......
......@@ -28,7 +28,9 @@
namespace Dumux
{
/*
/*!
* \internal
*
* \brief The common code for all 3rd order polynomial splines with
* more than two sampling points.
*/
......
......@@ -30,6 +30,9 @@ namespace Dumux
{
/*!
* \brief Calculate the harmonic mean of two scalar values.
*
* \param x The first input value
* \param y The second input value
*/
template <class Scalar>
Scalar harmonicMean(Scalar x, Scalar y)
......@@ -41,6 +44,9 @@ Scalar harmonicMean(Scalar x, Scalar y)
/*!
* \brief Calculate the geometric mean of two scalar values.
*
* \param x The first input value
* \param y The second input value
*/
template <class Scalar>
Scalar geometricMean(Scalar x, Scalar y)
......@@ -55,6 +61,10 @@ Scalar geometricMean(Scalar x, Scalar y)
*
* This is done by calculating the harmonic mean for each entry
* individually. The result is stored the first argument.
*
* \param K The matrix for storing the result
* \param Ki The first input matrix
* \param Kj The second input matrix
*/
template <class Scalar, int m, int n>
void harmonicMeanMatrix(Dune::FieldMatrix<Scalar, m, n> &K,
......@@ -77,7 +87,15 @@ void harmonicMeanMatrix(Dune::FieldMatrix<Scalar, m, n> &K,
/*!
* \brief Invert a linear polynomial analytically
*
* Returns the number of solutions which are in the real numbers.
* The polynomial is defined as
* \f[ p(x) = a\; x + b \f]
*
* This method Returns the number of solutions which are in the real
* numbers, i.e. 1 except if the slope of the line is 0.
*
* \param sol Container into which the solutions are written
* \param a The coefficiont for the linear term
* \param b The coefficiont for the constant term
*/
template <class Scalar, class SolContainer>
int invertLinearPolynomial(SolContainer &sol,
......@@ -94,9 +112,17 @@ int invertLinearPolynomial(SolContainer &sol,
/*!
* \brief Invert a quadratic polynomial analytically
*
* Returns the number of solutions which are in the real numbers. The
* "sol" argument contains the real roots of the parabola in order
* with the smallest root first.
* The polynomial is defined as
* \f[ p(x) = a\; x^2 + + b\;x + c \f]
*
* This method teturns the number of solutions which are in the real
* numbers. The "sol" argument contains the real roots of the parabola
* in order with the smallest root first.
*
* \param sol Container into which the solutions are written
* \param a The coefficiont for the quadratic term
* \param b The coefficiont for the linear term
* \param c The coefficiont for the constant term
*/
template <class Scalar, class SolContainer>
int invertQuadraticPolynomial(SolContainer &sol,
......@@ -126,7 +152,18 @@ int invertQuadraticPolynomial(SolContainer &sol,
/*!
* \brief Invert a cubic polynomial analytically
*
* Returns the number of solutions which are in the real numbers.
* The polynomial is defined as
* \f[ p(x) = a\; x^3 + + b\;x^3 + c\;x + d \f]
*
* This method teturns the number of solutions which are in the real
* numbers. The "sol" argument contains the real roots of the cubic
* polynomial in order with the smallest root first.
*
* \param sol Container into which the solutions are written
* \param a The coefficiont for the cubic term
* \param b The coefficiont for the quadratic term
* \param c The coefficiont for the linear term
* \param d The coefficiont for the constant term
*/
template <class Scalar, class SolContainer>
int invertCubicPolynomial(SolContainer &sol,
......@@ -297,8 +334,8 @@ int invertCubicPolynomial(SolContainer &sol,
* "Larger" in this case means that all the entries of each spacial dimension are
* larger compared to the reference vector.
*
* \param &pos Vektor holding the current Position that is to be checked
* \param &smallerVec Reference vector, holding the minimum values for comparison.
* \param pos Vektor holding the current Position that is to be checked
* \param smallerVec Reference vector, holding the minimum values for comparison.
*/
template <class Scalar, int dim>
bool isLarger(const Dune::FieldVector<Scalar, dim> &pos,
......@@ -322,8 +359,8 @@ bool isLarger(const Dune::FieldVector<Scalar, dim> &pos,
* "Smaller" in this case means that all the entries of each spacial dimension are
* smaller in comparison with the reference vector.
*
* \param &pos Vektor holding the current Position that is to be checked
* \param &largerVec Reference vector, holding the maximum values for comparison.
* \param pos Vektor holding the current Position that is to be checked
* \param largerVec Reference vector, holding the maximum values for comparison.
*/
template <class Scalar, int dim>
bool isSmaller(const Dune::FieldVector<Scalar, dim> &pos,
......@@ -350,9 +387,9 @@ bool isSmaller(const Dune::FieldVector<Scalar, dim> &pos,
* This is comfortable to cheack weather the current position is located inside or
* outside of a lense with different properties.
*
* \param &pos Vektor holding the current Position that is to be checked
* \param &smallerVec Reference vector, holding the minimum values for comparison.
* \param &largerVec Reference vector, holding the maximum values for comparison.
* \param pos Vektor holding the current Position that is to be checked
* \param smallerVec Reference vector, holding the minimum values for comparison.
* \param largerVec Reference vector, holding the maximum values for comparison.
*/
template <class Scalar, int dim>
bool isBetween(const Dune::FieldVector<Scalar, dim> &pos,
......@@ -373,6 +410,11 @@ bool isBetween(const Dune::FieldVector<Scalar, dim> &pos,
* pressure of various liquids.
*
* See http://en.wikipedia.org/wiki/Antoine_equation
*
* \param temperature The temperature [K] of the fluid
* \param A The first coefficient for the Antoine equation
* \param B The first coefficient for the Antoine equation
* \param C The first coefficient for the Antoine equation
*/
template <class Scalar>
Scalar antoine(Scalar temperature,
......
......@@ -352,9 +352,12 @@ using namespace boost::type_traits;
using boost::is_void;
using boost::is_base_of;
//! \internal
class PropertyUndefined {};
//! \internal
class PropertyExplicitlyUnset {};
//! \internal
template <class RealTypeTag,
class EffectiveTypeTag,
class PropertyTag>
......@@ -362,12 +365,14 @@ struct Property : public PropertyUndefined
{
};
//! \internal
template <class EffectiveTypeTag,
class PropertyTag>
struct PropertyUnset : public PropertyUndefined
{
};
//! \internal
template <class EffectiveTypeTag, class PropertyTag>
struct PropertyInfo
{
......@@ -384,12 +389,14 @@ struct PropertyInfo
{ return __LINE__; }
};
//! \internal
template <class RealTypeTag,
class PropertyTag>
struct DefaultProperty : public PropertyUndefined
{
};
//! \internal
template <class Tree, class PropertyTag>
struct propertyExplicitlyUnset
{
......@@ -400,6 +407,7 @@ struct propertyExplicitlyUnset
>::value;
};
//! \internal
template <class Tree, class PropertyTag>
class propertyExplicitlyUnsetOnTree
{
......@@ -424,12 +432,14 @@ public:
>::value;
};
//! \internal
template <class PropertyTag>
struct propertyExplicitlyUnsetOnTree<void, PropertyTag>
{
const static bool value = boost::true_type::value;
};
//! \internal
template <class RealTypeTag, class Tree, class PropertyTag>
struct propertyDefinedOnSelf
{
......@@ -442,6 +452,7 @@ struct propertyDefinedOnSelf
>::value;
};
//! \internal
template <class RealTypeTag, class Tree, class PropertyTag>
class propertyDefinedOnTree
{
......@@ -461,6 +472,7 @@ public:
>::value >::value;
};
//! \internal
template <class RealTypeTag, class PropertyTag>
class propertyDefinedOnTree<RealTypeTag, void, PropertyTag>
{
......@@ -468,6 +480,7 @@ public:
static const bool value = boost::false_type::value;
};
//! \internal
template <class RealTypeTag, class PropertyTag>
struct defaultPropertyDefined
{
......@@ -479,6 +492,7 @@ struct defaultPropertyDefined
>::value;
};
//! \internal
template <class RealTypeTag, class Tree, class PropertyTag>
class defaultPropertyDefinedOnTree
{
......@@ -503,13 +517,14 @@ public:
>::value >::value;
};
//! \internal
template <class RealTypeTag, class PropertyTag>
struct defaultPropertyDefinedOnTree<RealTypeTag,void, PropertyTag>
{
static const bool value = boost::false_type::value;
};
//! \internal
template <class RealTypeTag, class Tree, class PropertyTag>
class propertyDefined
{
......@@ -540,6 +555,7 @@ public:
};
//! \internal
template <class RealTypeTag, class Tree, class PropertyTag>
class propertyTagIndex
{
......@@ -558,6 +574,7 @@ public:
};
//! \internal
template <class SelfT,
class Child1T = void,
class Child2T = void,
......@@ -576,6 +593,7 @@ public:
typedef Child5T Child5;
};
//! \internal
template <class EffectiveTypeTag,
class PropertyTag,
class RealTypeTag=EffectiveTypeTag,
......@@ -585,6 +603,7 @@ struct GetProperty
};
// property not defined, but a default property is available
//! \internal
template <class TypeTag, class PropertyTag, class RealTypeTag>
struct GetProperty<TypeTag, PropertyTag, RealTypeTag, -1>
{
......@@ -592,36 +611,42 @@ struct GetProperty<TypeTag, PropertyTag, RealTypeTag, -1>
};
// property defined on self
//! \internal
template <class TypeTag, class PropertyTag, class RealTypeTag>
struct GetProperty<TypeTag, PropertyTag, RealTypeTag, 0>
{
typedef Property<RealTypeTag, TypeTag, PropertyTag> p;
};
//! \internal
template <class TypeTag, class PropertyTag, class RealTypeTag>
struct GetProperty<TypeTag, PropertyTag, RealTypeTag, 1>
{
typedef typename GetProperty<typename TypeTag::Child1, PropertyTag, RealTypeTag>::p p;
};
//! \internal
template <class TypeTag, class PropertyTag, class RealTypeTag>
struct GetProperty<TypeTag, PropertyTag, RealTypeTag, 2>
{
typedef typename GetProperty<typename TypeTag::Child2, PropertyTag, RealTypeTag>::p p;
};
//! \internal
template <class TypeTag, class PropertyTag, class RealTypeTag>
struct GetProperty<TypeTag, PropertyTag, RealTypeTag, 3>
{
typedef typename GetProperty<typename TypeTag::Child3, PropertyTag, RealTypeTag>::p p;
};
//! \internal
template <class TypeTag, class PropertyTag, class RealTypeTag>
struct GetProperty<TypeTag, PropertyTag, RealTypeTag, 4>
{
typedef typename GetProperty<typename TypeTag::Child4, PropertyTag, RealTypeTag>::p p;
};
//! \internal
template <class TypeTag, class PropertyTag, class RealTypeTag>
struct GetProperty<TypeTag, PropertyTag, RealTypeTag, 5>
{
......@@ -629,6 +654,7 @@ struct GetProperty<TypeTag, PropertyTag, RealTypeTag, 5>
};
#if !defined NO_PROPERTY_INTROSPECTION
//! \internal
template <class RealTypeTag, class Tree, class PropertyTag>
struct propertyDiagnostic
{
......@@ -807,6 +833,7 @@ struct propertyDiagnostic
}
};
//! \internal
template <class RealTypeTag, class PropertyTag>
struct propertyDiagnostic<RealTypeTag, void, PropertyTag>
{
......
......@@ -15,14 +15,7 @@
*****************************************************************************/
/*!
* \file
* \brief A 3rd order polynomial p(x) for which, given two points x1 and x2!=x1,
* the following hold:
* p(x1) = y1
* p(x2) = y2
* p'(x1) = m1
* p'(x2) = m2
*
* or any given y1, y2, m1, m2.
* \brief Provides 3rd order polynomial splines.
*/
#ifndef DUMUX_SPLINE_HH
#define DUMUX_SPLINE_HH
......@@ -36,34 +29,62 @@ namespace Dumux
/*!
* \brief A 3rd order polynomial spline.
* This class implements a spline s(x) for which, given n sampling
* points x_1, ..., x_n, the following holds:
*
* s(x_i) = y_i
* s'(x_1) = m_1
* s'(x_n) = m_n
* This class implements a spline \f$s(x)\f$ for which, given \f$n\f$ sampling
* points \f$x_1, \dots, x_n\f$, the following conditions hold
*\f{align*}{
s(x_i) & = y_i \quad \forall i \in \{1, \dots, n \}\\
s'(x_1) & = m_1 \\
s'(x_n) = m_n
\f}
*
* for any given boundary slopes m_1 and m_n.
* for any given boundary slopes \f$m_1\f$ and \f$m_n\f$. Alternatively, natural
* splines are supported which are defined by
*\f{align*}{
s(x_i) & = y_i \quad \forall i \in \{1, \dots, n \} \\
s''(x_1) & = 0 \\
s''(x_n) = 0
\f}
*/
template<class Scalar, int numSamples = 2>
class Spline : public FixedLengthSpline_<Scalar, numSamples>
{
public:
/*!
* \brief Default constructor for a spline.
*
* To specfiy the acutal curve, use one of the set() methods.
*/
Spline()
{ };
// convenience constructor
/*!
* \brief Convenience constructor for a natural spline
*
* \param x An array containing the \f$x\f$ values of the spline's sampling points
* \param y An array containing the \f$y\f$ values of the spline's sampling points
*/
template <class ScalarContainer>
Spline(const ScalarContainer &x,
const ScalarContainer &y)
{ this->set(x, y); }
// convenience constructor
/*!
* \brief Convenience constructor for a natural spline
*
* \param tuples An array of \f$(x,y)\f$ tuples of the spline's sampling points
*/
template <class XYContainer>
Spline(const XYContainer &tuples)
{ this->set(tuples); }
// convenience constructor
/*!
* \brief Convenience constructor for a full spline
*
* \param x An array containing the \f$x\f$ values of the spline's sampling points
* \param y An array containing the \f$y\f$ values of the spline's sampling points
* \param m0 The slope of the spline at \f$x_0\f$
* \param m1 The slope of the spline at \f$x_n\f$
*/
template <class ScalarContainer>
Spline(const ScalarContainer &x,
const ScalarContainer &y,
......@@ -71,7 +92,13 @@ public:
Scalar m1)
{ this->set(x, y, m0, m1); }