MonteCarloTransport.h 1.86 KB
Newer Older
1
2
3
4
5
#ifndef MLMC_MONTECARLOTRANSPORT_HPP
#define MLMC_MONTECARLOTRANSPORT_HPP

#include "MonteCarlo.h"
#include "assemble/DGTransportAssemble.h"
6
#include "timestepping/TimeIntegrator.h"
7
//#include "timestepping/TimeIntegrator2.h"
8

9

10
class MonteCarloTransport : public MonteCarlo {
niklas.baumgarten's avatar
niklas.baumgarten committed
11
12
13
14
protected:
    void initialize() override;

    void method() override;
niklas.baumgarten's avatar
niklas.baumgarten committed
15

16
17
18
19
20
    void solvePDE(int l,
                  int m,
                  bool fineLevel,
                  double &valueQ,
                  double &cost,
niklas.baumgarten's avatar
niklas.baumgarten committed
21
22
23
24
25
                  Vector &solution) override;

private:
    double startTime = 0.0;
    double endTime = 0.0;
26
27

    TimeSeries getTimeSeries(bool fineLevel);
28

29
30
public:
    DGTransportAssemble *assemble;
31

niklas.baumgarten's avatar
niklas.baumgarten committed
32
    MatrixGraphs cellMatrixGraphs;
33
    MatrixGraphs faceMatrixGraphs;
34
35
    CellMatrixGraphs solMatrixGraphs;

36
37
38
39
40
    Vector fineNormalFlux;
    Vector coarseNormalFlux;
    Vector fineSolution;
    Vector coarseSolution;

41
    MonteCarloTransport(int l, int dM, bool baseLevel, Meshes *meshes,
42
43
44
                        StochasticField *stochFields, DGTransportAssemble *assemble) :
        MonteCarlo(l, dM, baseLevel, meshes, stochFields),
        assemble(assemble),
niklas.baumgarten's avatar
niklas.baumgarten committed
45
        cellMatrixGraphs(MatrixGraphs(*meshes, dof("cell", 3))),
46
        faceMatrixGraphs(MatrixGraphs(*meshes, dof("face", 3))),
47
48
49
50
51
52
53
54
        solMatrixGraphs(*meshes, *assemble->disc),
        fineNormalFlux(Vector(faceMatrixGraphs[l - pLevel])),
        coarseNormalFlux(Vector(faceMatrixGraphs[l - pLevel - 1])),
        fineSolution(Vector(solMatrixGraphs[l - pLevel])),
        coarseSolution(Vector(solMatrixGraphs[l - pLevel - 1])) {

        fineNormalFlux = 0.0, coarseNormalFlux = 0.0;
        fineSolution = 0.0, coarseSolution = 0.0;
55

56
        fineQ = 0.0, coarseQ = 0.0, fineCost = 0.0, coarseCost = 0.0;
57
58
        config.get("startTime", startTime);
        config.get("endTime", endTime);
59
60
61
62
    }
};

#endif //MLMC_MONTECARLOTRANSPORT_HPP