TransportPDESolver.hpp 1.8 KB
Newer Older
niklas.baumgarten's avatar
niklas.baumgarten committed
1
2
3
#ifndef TRANSPORTPDESOLVER_HPP
#define TRANSPORTPDESOLVER_HPP

niklas.baumgarten's avatar
niklas.baumgarten committed
4
5
#include "DGTransportAssemble.hpp"

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


class TransportPDESolver : public PDESolver {
private:
niklas.baumgarten's avatar
niklas.baumgarten committed
11
12
13
14
15
  std::string quantity = "L2";

  std::string costMeasure = "size";

  std::unique_ptr<TimeIntegrator> timeInt;
niklas.baumgarten's avatar
niklas.baumgarten committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29

  IStochasticLinearTransportAssemble *assemble;

protected:
  void run(SampleSolution &solution) override;

  void computeQ(SampleSolution &solution) override;

  void computeCost(SampleSolution &solution) override;

  void plotSolution(SampleSolution &solution) override;

public:
  TransportPDESolver(IStochasticLinearTransportAssemble *assemble,
niklas.baumgarten's avatar
niklas.baumgarten committed
30
                     const string &quantity, const string &costMeasure) :
niklas.baumgarten's avatar
niklas.baumgarten committed
31
32
33
    PDESolver(), assemble(assemble), quantity(quantity), costMeasure(costMeasure) {

    timeInt = TimeIntegratorCreator(IMPLICIT_MIDPOINT).
niklas.baumgarten's avatar
niklas.baumgarten committed
34
35
36
37
      WithLinearSolver(new GMRES(GetPC("PointBlockJacobi_dG"))).
      WithLinearSolver(new GMRES(GetPC("PointBlockJacobi_dG"))).
      WithLinearSolver(new GMRES(GetPC("PointBlockJacobi_dG"))).
      WithLinearSolver(new GMRES(GetPC("PointBlockJacobi_dG"))).
niklas.baumgarten's avatar
niklas.baumgarten committed
38
39
      CreateUnique();

niklas.baumgarten's avatar
niklas.baumgarten committed
40
    if (verbose)
niklas.baumgarten's avatar
niklas.baumgarten committed
41
42
43
      mout.PrintInfo("TransportPDESolver", verbose,
                     PrintInfoEntry("Quantity", quantity),
                     PrintInfoEntry("Cost measure", costMeasure));
niklas.baumgarten's avatar
niklas.baumgarten committed
44
45
  }

niklas.baumgarten's avatar
niklas.baumgarten committed
46
  ~TransportPDESolver() override {
niklas.baumgarten's avatar
niklas.baumgarten committed
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
    delete assemble;
  }

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

  IDiscretization *GetDisc() const override { return assemble->GetDisc(); }

  IStochasticProblem *GetProblem() const override { return assemble->GetProblem(); }

  void DrawSample(const SampleID &id) override { assemble->DrawSample(id); }

  std::string Name() const override { return "TransportPDESolver"; }
};

#endif //TRANSPORTPDESOLVER_HPP