Commit 126969fa authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

minor changes in monte carlo transport

parent 470df45a
#include "MonteCarloTransport.h" #include "MonteCarloTransport.h"
using namespace std; using namespace std;
void MonteCarloTransport::Method() { void MonteCarloTransport::Method() {
logger->startMethodMSG(); logger->StartMethodMsg();
if (!onlyFineLevel) if (!onlyFineLevel)
logger->logMSGV1("l: " + to_string(l) logger->LogMsgv1("l: " + to_string(l)
+ " dM: " + to_string(dM)); + " dM: " + to_string(dM));
else else
logger->logMSGV1("l: " + to_string(l) logger->LogMsgv1("l: " + to_string(l)
+ " dM: " + to_string(dM) + " dM: " + to_string(dM)
+ " onlyFineLevel: True"); + " onlyFineLevel: True");
...@@ -29,11 +28,12 @@ void MonteCarloTransport::Method() { ...@@ -29,11 +28,12 @@ void MonteCarloTransport::Method() {
assemble->plot = &plot; assemble->plot = &plot;
for (int m = M; m < M + dM; m++) { for (int m = M; m < M + dM; m++) {
mkSampleDir(m);
stochasticField->GetFineSample(l, fineFlux); stochasticField->GetFineSample(l, fineFlux);
assemble->problem->LoadNewSample(&fineFlux); assemble->problem->LoadNewSample(&fineFlux);
if (plotting > 1) { if (plotting > 1) {
const char *name = buildString(m, "flux"); string name = buildName(m, mkSampleDirName(m).append("/flux"));
plot.celldata(fineFlux, 3); plot.celldata(fineFlux, 3);
plot.vtk_cellvector(name); plot.vtk_cellvector(name);
} }
...@@ -49,11 +49,10 @@ void MonteCarloTransport::Method() { ...@@ -49,11 +49,10 @@ void MonteCarloTransport::Method() {
UpscaleFlux(coarseFlux, coarseFluxUp); UpscaleFlux(coarseFlux, coarseFluxUp);
if (plotting > 1) { if (plotting > 1) {
const char *name = buildString(m, "flux_up"); string name = buildName(m, "flux_up");
plot.celldata(coarseFluxUp, 3); plot.celldata(coarseFluxUp, 3);
plot.vtk_cellvector(name); plot.vtk_cellvector(name);
} }
} else { } else {
coarseQ = 0.0, coarseCost = 0.0, coarseSolutionUp = 0.0; coarseQ = 0.0, coarseCost = 0.0, coarseSolutionUp = 0.0;
} }
...@@ -62,9 +61,9 @@ void MonteCarloTransport::Method() { ...@@ -62,9 +61,9 @@ void MonteCarloTransport::Method() {
updateAvg(); updateAvg();
updateStatistic(); updateStatistic();
logger->logMSGV1("|E[Y]|: " + to_string(avgY) logger->LogMsgv1("|E[Y]|: " + to_string(avgY)
+ " V[Y]: " + to_string(varY)); + " V[Y]: " + to_string(varY));
logger->endMethodMSG(); logger->EndMethodMsg();
} }
void MonteCarloTransport::solveTransport(int l, void MonteCarloTransport::solveTransport(int l,
...@@ -72,8 +71,7 @@ void MonteCarloTransport::solveTransport(int l, ...@@ -72,8 +71,7 @@ void MonteCarloTransport::solveTransport(int l,
double &valueQ, double &valueQ,
double &cost, double &cost,
Vector &solution) { Vector &solution) {
// Date startSolving; assemble->logger->StartMethodMsg();
Solver solver; Solver solver;
Preconditioner *BJ = GetPC("PointBlockJacobi"); Preconditioner *BJ = GetPC("PointBlockJacobi");
Solver IM(BJ); Solver IM(BJ);
...@@ -87,9 +85,8 @@ void MonteCarloTransport::solveTransport(int l, ...@@ -87,9 +85,8 @@ void MonteCarloTransport::solveTransport(int l,
if (functional == "Energy") valueQ = assemble->Energy(solution); if (functional == "Energy") valueQ = assemble->Energy(solution);
if (functional == "Outflow") if (functional == "Outflow")
valueQ = assemble->InFlowOutFlowRate(solution).second; valueQ = assemble->InFlowOutFlowRate(solution).second;
mout << endl;
// logger->logMSGV2("Solving on level " + to_string(l) + " took " + assemble->logger->EndMethodMsg();
// to_string((startSolving - Date()).t) + " seconds");
} }
TimeSeries MonteCarloTransport::getTimeSeries(bool fineLevel) { TimeSeries MonteCarloTransport::getTimeSeries(bool fineLevel) {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "MonteCarlo.h" #include "MonteCarlo.h"
#include "assemble/DGTransportAssemble.h" #include "assemble/DGTransportAssemble.h"
#include "timestepping/TimeIntegrator.h" #include "timestepping/TimeIntegrator.h"
#include "timestepping/TimeIntegrator2.h" //#include "timestepping/TimeIntegrator2.h"
class MonteCarloTransport : public MonteCarlo { class MonteCarloTransport : public MonteCarlo {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment