MonteCarloTransport.h 1.84 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

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

private:
    double startTime = 0.0;
    double endTime = 0.0;
23
24

    TimeSeries getTimeSeries(bool fineLevel);
25

26
27
public:
    DGTransportAssemble *assemble;
28

niklas.baumgarten's avatar
niklas.baumgarten committed
29
    MatrixGraphs cellMatrixGraphs;
30
    MatrixGraphs faceMatrixGraphs;
31
32
    CellMatrixGraphs solMatrixGraphs;

33
34
35
36
37
    Vector fineNormalFlux;
    Vector coarseNormalFlux;
    Vector fineSolution;
    Vector coarseSolution;

38
    MonteCarloTransport(int l, int dM, bool baseLevel, Meshes *meshes,
39
40
41
                        StochasticField *stochFields, DGTransportAssemble *assemble) :
        MonteCarlo(l, dM, baseLevel, meshes, stochFields),
        assemble(assemble),
niklas.baumgarten's avatar
niklas.baumgarten committed
42
        cellMatrixGraphs(MatrixGraphs(*meshes, dof("cell", 3))),
43
        faceMatrixGraphs(MatrixGraphs(*meshes, dof("face", 3))),
44
45
46
47
48
49
50
51
        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;
52

53
        fineQ = 0.0, coarseQ = 0.0, fineCost = 0.0, coarseCost = 0.0;
54
55
        config.get("startTime", startTime);
        config.get("endTime", endTime);
56
57
    }

58
    ~MonteCarloTransport() {
niklas.baumgarten's avatar
niklas.baumgarten committed
59
    }
60
61
62
};

#endif //MLMC_MONTECARLOTRANSPORT_HPP