Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mpp
MLUQ
Commits
126969fa
Commit
126969fa
authored
Jan 17, 2020
by
niklas.baumgarten
Browse files
minor changes in monte carlo transport
parent
470df45a
Changes
2
Hide whitespace changes
Inline
Side-by-side
mlmc/src/mc/MonteCarloTransport.C
View file @
126969fa
#include "MonteCarloTransport.h"
using
namespace
std
;
void
MonteCarloTransport
::
Method
()
{
logger
->
s
tartMethodM
SG
();
logger
->
S
tartMethodM
sg
();
if
(
!
onlyFineLevel
)
logger
->
l
ogM
SGV
1
(
"l: "
+
to_string
(
l
)
logger
->
L
ogM
sgv
1
(
"l: "
+
to_string
(
l
)
+
" dM: "
+
to_string
(
dM
));
else
logger
->
l
ogM
SGV
1
(
"l: "
+
to_string
(
l
)
logger
->
L
ogM
sgv
1
(
"l: "
+
to_string
(
l
)
+
" dM: "
+
to_string
(
dM
)
+
" onlyFineLevel: True"
);
...
...
@@ -29,11 +28,12 @@ void MonteCarloTransport::Method() {
assemble
->
plot
=
&
plot
;
for
(
int
m
=
M
;
m
<
M
+
dM
;
m
++
)
{
mkSampleDir
(
m
);
stochasticField
->
GetFineSample
(
l
,
fineFlux
);
assemble
->
problem
->
LoadNewSample
(
&
fineFlux
);
if
(
plotting
>
1
)
{
const
char
*
name
=
buildString
(
m
,
"
flux"
);
string
name
=
buildName
(
m
,
mkSampleDirName
(
m
).
append
(
"/
flux"
)
)
;
plot
.
celldata
(
fineFlux
,
3
);
plot
.
vtk_cellvector
(
name
);
}
...
...
@@ -49,11 +49,10 @@ void MonteCarloTransport::Method() {
UpscaleFlux
(
coarseFlux
,
coarseFluxUp
);
if
(
plotting
>
1
)
{
const
char
*
name
=
build
String
(
m
,
"flux_up"
);
string
name
=
build
Name
(
m
,
"flux_up"
);
plot
.
celldata
(
coarseFluxUp
,
3
);
plot
.
vtk_cellvector
(
name
);
}
}
else
{
coarseQ
=
0
.
0
,
coarseCost
=
0
.
0
,
coarseSolutionUp
=
0
.
0
;
}
...
...
@@ -62,9 +61,9 @@ void MonteCarloTransport::Method() {
updateAvg
();
updateStatistic
();
logger
->
l
ogM
SGV
1
(
"|E[Y]|: "
+
to_string
(
avgY
)
logger
->
L
ogM
sgv
1
(
"|E[Y]|: "
+
to_string
(
avgY
)
+
" V[Y]: "
+
to_string
(
varY
));
logger
->
e
ndMethodM
SG
();
logger
->
E
ndMethodM
sg
();
}
void
MonteCarloTransport
::
solveTransport
(
int
l
,
...
...
@@ -72,8 +71,7 @@ void MonteCarloTransport::solveTransport(int l,
double
&
valueQ
,
double
&
cost
,
Vector
&
solution
)
{
// Date startSolving;
assemble
->
logger
->
StartMethodMsg
();
Solver
solver
;
Preconditioner
*
BJ
=
GetPC
(
"PointBlockJacobi"
);
Solver
IM
(
BJ
);
...
...
@@ -87,9 +85,8 @@ void MonteCarloTransport::solveTransport(int l,
if
(
functional
==
"Energy"
)
valueQ
=
assemble
->
Energy
(
solution
);
if
(
functional
==
"Outflow"
)
valueQ
=
assemble
->
InFlowOutFlowRate
(
solution
).
second
;
// logger->logMSGV2("Solving on level " + to_string(l) + " took " +
// to_string((startSolving - Date()).t) + " seconds");
mout
<<
endl
;
assemble
->
logger
->
EndMethodMsg
();
}
TimeSeries
MonteCarloTransport
::
getTimeSeries
(
bool
fineLevel
)
{
...
...
mlmc/src/mc/MonteCarloTransport.h
View file @
126969fa
...
...
@@ -4,7 +4,7 @@
#include "MonteCarlo.h"
#include "assemble/DGTransportAssemble.h"
#include "timestepping/TimeIntegrator.h"
#include "timestepping/TimeIntegrator2.h"
//
#include "timestepping/TimeIntegrator2.h"
class
MonteCarloTransport
:
public
MonteCarlo
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment