RosenbrockStationary.h 3.28 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
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  TU Dresden                                                            ==
// ==                                                                        ==
// ==  Institut fr Wissenschaftliches Rechnen                               ==
// ==  Zellescher Weg 12-14                                                  ==
// ==  01069 Dresden                                                         ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  https://gforge.zih.tu-dresden.de/projects/amdis/                      ==
// ==                                                                        ==
// ============================================================================

/** \file RosenbrockStationary.h */

#ifndef AMDIS_ROSENBROCKSTATIONARY_H
#define AMDIS_ROSENBROCKSTATIONARY_H

#include "AMDiS_fwd.h"
#include "ProblemVec.h"
#include "SystemVector.h"
28
#include "time/RosenbrockMethod.h"
29
30
31
32
33
34

namespace AMDiS {

  class RosenbrockStationary : public ProblemVec
  {
  public:
35
36
37
38
39
40
41
42
43
44
45
46
47
48
    class IdFunc : public AbstractFunction<double, double>
    {
    public:
      IdFunc()
	: AbstractFunction<double, double>(1)
      {}
      
      double operator()(const double& u) const 
      {
	return u;
      }
    };


49
50
    RosenbrockStationary(std::string name)
      : ProblemVec(name),
51
52
53
54
	first(true),
	minusOne(-1.0),
	tauPtr(NULL),
	tauGamma(NULL)
55
56
57
58
59
60
61
    {}

    DOFVector<double>* getUnVec(int i)
    {
      return unVec->getDOFVector(i);
    }

62
    DOFVector<double>* getStageSolution(int i)
63
    {
64
      return stageSolution->getDOFVector(i);
65
66
67
68
69
70
71
72
73
    }

    void acceptTimestep();

    void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag,
			   bool asmMatrix, bool asmVector);

    void solve(AdaptInfo *adaptInfo, bool fixedMatrix);

74
75
76
77
78
79
    void setRosenbrockMethod(RosenbrockMethod *method)
    {
      rm = method;
      init();
    }

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
    void addOperator(Operator &op, int row, int col, 
		     double *factor = NULL, double *estFactor = NULL);

    void addJacobianOperator(Operator &op, int row, int col, 
			     double *factor = NULL, double *estFactor = NULL);

    void addTimeOperator(int i, int j);

    void setTau(double *ptr)
    {
      tauPtr = ptr;
    }

    void setTauGamma(double *ptr)
    {
      tauGamma = ptr;
    }

98
  protected:
99
100
    void init();

101
  protected:    
102
    RosenbrockMethod *rm;
103
104
105
106
107
108
109

    SystemVector *stageSolution, *unVec, *newUn, *tmp, *lowSol;

    std::vector<SystemVector*> stageSolutions;

    DOFVector<double> *phiSum, *tmpDof;

110
111
112
113
    bool first;

    double minusOne;

114
115
    double *tauPtr;

116
    double *tauGamma;
117
118
119
120
121
  };

}

#endif // AMDIS_ROSENBROCKSTATIONARY_H