util_typedefs.hh 2.04 KB
Newer Older
Dion Haefner's avatar
Dion Haefner committed
1 2 3
#ifndef DUNE_DORIE_TYPEDEFS_HH
#define DUNE_DORIE_TYPEDEFS_HH

4 5
#include <dune/pdelab/common/function.hh>

Dion Haefner's avatar
Dion Haefner committed
6 7 8 9 10 11 12 13
namespace Dune{
	namespace Dorie{

		//! Boundary condition types
		struct BoundaryCondition
		{
			//! Enum for the Boundary condition type
			enum Type {
Dion Haefner's avatar
Dion Haefner committed
14
				Neumann, //!< Fixed flux at boundary
Dion Haefner's avatar
Dion Haefner committed
15 16
				Dirichlet, //!< Fixed matric head at boundary
				Evaporation, //!< Special BC which switches between Neumann and Dirichlet depending on the water content
Dion Haefner's avatar
Dion Haefner committed
17 18
				LimitedInFlux, //!< Special Neumann BC which stops infiltration into saturated medium
				Other //!< UNUSED
Dion Haefner's avatar
Dion Haefner committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
			};

			//! Test for Dirichlet boundary condition
			static bool isDirichlet (Type i)
			{
				return (i == Dirichlet);
			}
			//! Test for Neumann boundary condition
			static bool isNeumann (Type i)
			{
				return (i == Neumann);
			}
			//! Test for Limited Flux boundary condition
			static bool isLimitedInFlux (Type i)
			{
				return (i == LimitedInFlux);
			}
			//! Test for Evaporation boundary condition
			static bool isEvaporation (Type i)
			{
				return (i == Evaporation);
			}
			//! UNUSED: Test for other(?) boundary condition
			static bool isOther (Type i)
			{
				return (i == Other);
			}
		};

		/**
		 * @brief Homogeneous initial condition: Matric head h=0
		 */
		template<typename Traits>
			class ZeroInitial
			: public Dune::PDELab::AnalyticGridFunctionBase<Dune::PDELab::AnalyticGridFunctionTraits<typename Traits::GridTraits::GridView, typename Traits::GridTraits::RangeField,1>,
			ZeroInitial<Traits> >
		{
			public:
				typedef Dune::PDELab::AnalyticGridFunctionTraits<typename Traits::GridTraits::GridView, typename Traits::GridTraits::RangeField,1> AGFTraits;
				typedef Dune::PDELab::AnalyticGridFunctionBase<AGFTraits,ZeroInitial<Traits> > BaseT;

				enum {dim = Traits::GridTraits::dim};

				ZeroInitial (const Dune::ParameterTree& config, const typename Traits::GridTraits::GridView gv) : BaseT(gv) {}

Dion Haefner's avatar
Dion Haefner committed
64
				void evaluateGlobal (const typename Traits::GridTraits::Domain& x, typename Traits::GridTraits::Scalar& y) const
Dion Haefner's avatar
Dion Haefner committed
65 66 67 68 69 70 71
				{
					y = 0.;
				}
		};

	}
}
Dion Haefner's avatar
Dion Haefner committed
72

Dion Haefner's avatar
Dion Haefner committed
73 74 75


#endif