ParabolicPDESolver.hpp 1.97 KB
Newer Older
niklas.baumgarten's avatar
niklas.baumgarten committed
1
2
3
4
5
6
#ifndef PARABOLICPDESOLVER_HPP
#define PARABOLICPDESOLVER_HPP

#include "DGReactionAssemble.hpp"
#include "PGReactionAssemble.hpp"

niklas.baumgarten's avatar
niklas.baumgarten committed
7
8
#include "PDESolver.hpp"

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

class ParabolicPDESolver : public PDESolver {
private:
  std::string quantity = "L2";

  std::string costMeasure = "size";

  std::unique_ptr<NonLinearTimeIntegrator> timeInt;

  IStochasticReactionAssemble *assemble;

protected:
  void run(SampleSolution &solution) override;

  void computeQ(SampleSolution &solution) override;

  void computeCost(SampleSolution &solution) override;

  void plotSolution(SampleSolution &solution) override;

public:
  ParabolicPDESolver(IStochasticReactionAssemble *assemble,
                     const string &quantity, const string &costMeasure) :
    PDESolver(), assemble(assemble), quantity(quantity), costMeasure(costMeasure) {

    if (typeid(*assemble).name() == typeid(PGReactionAssemble).name())
      timeInt = TimeIntegratorCreator(IMPLICIT_EULER).
        WithNonLinearSolver(new Newton(std::make_unique<GMRES>(GetPC("SuperLU")))).
        CreateUniqueNonLinearTimeIntegrator();

    if (typeid(*assemble).name() == typeid(DGReactionAssemble).name())
      timeInt = TimeIntegratorCreator(IMPLICIT_EULER).
        WithNonLinearSolver(new Newton(std::make_unique<GMRES>(GetPC(
        "PointBlockJacobi_dG")))).
        CreateUniqueNonLinearTimeIntegrator();

    if (verbose)
      mout.PrintInfo("TransportPDESolver", verbose,
                     PrintInfoEntry("Quantity", quantity),
                     PrintInfoEntry("Cost measure", costMeasure));
  }

  ~ParabolicPDESolver() override {
    delete assemble;
  }

  IAssemble *GetAssemble() const override {
    return nullptr;
//        return assemble;
  }

  IDiscretization *GetDisc() const override { return nullptr; }

  IStochasticProblem *GetProblem() const override { return nullptr; }

niklas.baumgarten's avatar
niklas.baumgarten committed
64
  void DrawSample(const SampleID &id) override {}
65
66

  std::string Name() const override { return "ParabolicPDESolver"; }
niklas.baumgarten's avatar
niklas.baumgarten committed
67
68
69
};

#endif //PARABOLICPDESOLVER_HPP