RobinBC.h 4.54 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file RobinBC.h */

#ifndef AMDIS_ROBINBC_H
#define AMDIS_ROBINBC_H

#include "BoundaryCondition.h"
#include "AbstractFunction.h"
#include "DOFMatrix.h"

namespace AMDiS {

  class SurfaceOperator;

  // ============================================================================
  // ===== class RobinBC ========================================================
  // ============================================================================

  /** 
   * \ingroup Assembler
   *
   * \brief
   * Sub class of BoundaryCondition. Implements Robin and Neumann boundary conditions.
   * The flux in normal direction is given by \f$ j = j_0 + \alpha u\f$ where
   * \f$ j_0 \f$ and \f$ alpha \f$ are functions evaluated at world coordinates
   * and \f$ u \f$ is the problem solution.
   */
  class RobinBC : public BoundaryCondition
  {
  public:
    /** \brief
     * Constructor. \f$ j \f$ and \f$ alpha \f$ are given as AbstractFunction
     * objects.
     */
    RobinBC(BoundaryType type,
	    AbstractFunction<double, WorldVector<double> > *j,
	    AbstractFunction<double, WorldVector<double> > *alpha,
	    FiniteElemSpace *rowFESpace,
	    FiniteElemSpace *colFESpace = NULL);

    /** \brief
     * Constructor. \f$ j \f$ and \f$ alpha \f$ are given as DOFVectors.
     */
    RobinBC(BoundaryType type,
	    DOFVectorBase<double> *j,
	    DOFVectorBase<double> *alpha,
	    FiniteElemSpace *rowFESpace,
	    FiniteElemSpace *colFESpace = NULL);

    /** \brief
     * Constructor. \f$ j \f$ and \f$ alpha \f$ are given as Operator objects.
     */
    RobinBC(BoundaryType type,
	    Operator* jOp, Operator* alphaOp,
	    FiniteElemSpace *rowFESpace,
	    FiniteElemSpace *colFESpace = NULL);

    /** \brief
     * Implements BoundaryCondition::fillBoundaryCondition();
     */
    virtual void fillBoundaryCondition(DOFMatrix*     matrix,
				       ElInfo*                elInfo,
				       const DegreeOfFreedom* dofIndices,
				       const BoundaryType*    localBound,
				       int                    nBasFcts);
  
    /** \brief
     * Implements BoundaryCondition::fillBoundaryCondition();
     */
    virtual void fillBoundaryCondition(DOFVectorBase<double>*     vector, 
				       ElInfo*                elInfo,
				       const DegreeOfFreedom* dofIndices,
				       const BoundaryType*    localBound,
				       int                    nBasFcts);

    /** \brief
     * Implements BoundaryCondition::boundResidual();
     */
    virtual double boundResidual(ElInfo *elInfo, 
				 DOFMatrix *matrix,
				 const DOFVectorBase<double> *dv);

  protected:
    /** \brief
     * Surface operators for each element side for the Neumann part.
     */
    DimVec<SurfaceOperator*>* neumannOperators;

    /** \brief
     * Surface operators for each element side for the Robin part.
     */
    DimVec<SurfaceOperator*>* robinOperators;

    VectorOfFixVecs<DimVec<double> >**coords;
  };

  class NeumannBC : public RobinBC
  {
  public:
    NeumannBC(BoundaryType type,
	      AbstractFunction<double, WorldVector<double> > *j,
	      FiniteElemSpace *rowFESpace,
	      FiniteElemSpace *colFESpace = NULL)
      : RobinBC(type, j, NULL, rowFESpace, colFESpace)
    {};
  };

}

#endif