MonteCarloTransport.h 2.01 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
42
43
44
45
46
47
48
    MonteCarloTransport(int l,
                        int dM,
                        bool baseLevel,
                        Meshes *meshes,
                        MultilevelPlotter &plots,
                        StochasticField *stochFields,
                        DGTransportAssemble *assemble) :
        MonteCarlo(l, dM, baseLevel, meshes, plots, stochFields),
49
        assemble(assemble),
niklas.baumgarten's avatar
niklas.baumgarten committed
50
        cellMatrixGraphs(MatrixGraphs(*meshes, dof("cell", 3))),
51
        faceMatrixGraphs(MatrixGraphs(*meshes, dof("face", 3))),
52
53
54
55
56
57
58
59
        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;
60

61
        fineQ = 0.0, coarseQ = 0.0, fineCost = 0.0, coarseCost = 0.0;
62
63
        config.get("startTime", startTime);
        config.get("endTime", endTime);
64
65
66
67
    }
};

#endif //MLMC_MONTECARLOTRANSPORT_HPP