ResidualEstimator.h 4.4 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file ResidualEstimator.h */

/** \defgroup Estimator Estimator module
 * @{ <img src="estimator.png"> @}
 */

#ifndef AMDIS_RESIDUALESTIMATOR_H
#define AMDIS_RESIDUALESTIMATOR_H

#include "Estimator.h"
#include "FixVec.h"

namespace AMDiS {

  /** \brief
   * Returns residual square at quadrature point. Not Member of
   * Estimator to avoid multiple instantiation.
   */
  void r(const ElInfo              *elInfo,
	 int                        numPoints,
	 const double              *uhIq,
	 const WorldVector<double> *grdUhIq,
	 const WorldMatrix<double> *D2UhIq,
	 const double              *uhOldIq,
	 const WorldVector<double> *grdUhOldIq,
	 const WorldMatrix<double> *D2UhOldIq,
	 DOFMatrix *A, 
	 DOFVector<double> *fh,
	 Quadrature *quad,
	 double *result);
 
  /** \brief
   * Returns pow(det,2.0/dim). Not Member of
   * Estimator to avoid multiple instantiation.
   */
  inline double h2_from_det(double det, int dim) {
    return pow(det, 2.0 / dim);
  };

  // ============================================================================
  // ===== class ResidualEstimator ==============================================
  // ============================================================================

  /**
   * \ingroup Estimator
   * 
   * \brief
   * Estimator for scalar problems.
   */
  class ResidualEstimator : public Estimator
  {
  public:
    MEMORY_MANAGED(ResidualEstimator);

    /** \brief
     * Creator class used in the OEMSolverMap.
     */
    class Creator : public EstimatorCreator
    {
    public:
      MEMORY_MANAGED(Creator);

      Creator() : EstimatorCreator() {};

      virtual ~Creator() {};

      /** \brief
       * Returns a new ODirSolver object.
       */   
      Estimator* create() { 
	return NEW ResidualEstimator(name, row);
      };
    };
  

    /** \brief
     * Constructor.
     */
    ResidualEstimator(::std::string name, int r);

    virtual void init(double timestep);

    virtual void estimateElement(ElInfo *elInfo);

    virtual void exit(bool output = true);

  protected:
    /** \brief
     * Constant in front of element residual
     */
    double C0;
 
    /** \brief
     * Constant in front of edge/face residual
     */
    double C1;

    /** \brief
     * Constant in front of coarsening term
     */
    double C2;

    /** \brief
     * Constant in front of the time
     */
    double C3;


    int numSystems;

    int numPoints;

    int dim;

    int degree;

    Quadrature *quad;

    FastQuadrature **quadFast;

    const BasisFunction **basFcts;

    double **uhEl;

    double **uhOldEl;

146
147
    double **uhNeigh;

148
149
150
151
152
    double *uhQP;

    double *uhOldQP;

    double *riq;
153
154
155
156

    WorldVector<double> *grdUh_qp;

    WorldMatrix<double> *D2uhqp; 
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172

    ElInfo *neighInfo;

    Quadrature *surfaceQuad_;

    int nPointsSurface_;

    Vector<WorldVector<double> > grdUhEl_;

    Vector<WorldVector<double> > grdUhNeigh_;

    Vector<WorldVector<double> > jump_;

    Vector<WorldVector<double> > localJump_;

    int neighbours_;
173
174
175
176
  };
}

#endif // AMDIS_RESIDUALESTIMATOR_H