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
8b25202b
Commit
8b25202b
authored
Jan 15, 2020
by
niklas.baumgarten
Browse files
added coarse level, added flux plot added time sereies
parent
fd02b33a
Changes
4
Show whitespace changes
Inline
Side-by-side
mlmc/conf/mlmc.conf
View file @
8b25202b
...
...
@@ -18,29 +18,30 @@ Problem = StochasticPollution2D
StochasticField
=
LogNormal
#StochasticField = Gaussian
#
Experiment = ConvergenceTest
Experiment
=
MLMCExperiment
Experiment
=
ConvergenceTest
#
Experiment = MLMCExperiment
#Experiment = MLMCOverEpsilon
initLevels
=
4
,
5
,
initSampleAmount
=
1
,
1
2
,
initLevels
=
4
,
5
initSampleAmount
=
0
,
1
#l_init = 3, 4, 5
#M_init = 45, 15, 5
epsilon
=
0
.
0
1
epsilon
=
0
.
0
03
mcOnly
=
false
epsilon_lst
=
0
.
05
,
0
.
01
,
0
.
005
maxLevel
=
5
maxLevel
=
8
plevel
=
2
degree
=
2
functional
=
L2
#
functional = Energy
#
functional = L2
functional
=
Energy
#funcitonal = H1
#functional = Outflow
#functional = Goal
#functional = Mass
MCVerbose
=
2
MLMCVerbose
=
2
...
...
@@ -80,11 +81,12 @@ MuteLevel = -1
NewtonVerbose
= -
1
DebugLevel
= -
1
#Transport
startTime
=
0
.
0
endTime
=
2
.
0
TimeSeries
=
uniform
plot_tStep
=
1
T
=
1
.
6
T
=
2
dt
=
0
.
005
Kmax
=
250
Keps
=
1
e
-
5
...
...
@@ -97,3 +99,6 @@ rkorder = -2 #Implicit MP-rule
#rkorder = 1000 #Polynomial Krylov-Arnoldi method
gamma
=
0
.
01
plotPermForTransport
=
true
\ No newline at end of file
mlmc/src/assemble/DGTransportAssemble.h
View file @
8b25202b
...
...
@@ -19,7 +19,7 @@ public:
const
char
*
Name
()
const
override
{
return
"DGTransportAssemble"
;
}
virtual
double
Residual
(
const
Vector
&
u
,
Vector
&
b
)
const
{
double
Residual
(
const
Vector
&
u
,
Vector
&
b
)
const
override
{
b
=
0
;
Matrix
*
massMatrix
=
new
Matrix
(
u
);
...
...
@@ -302,7 +302,7 @@ public:
energy
+=
w
*
(
U
*
U
);
}
}
return
0.5
*
PPM
->
Sum
(
energy
);
//TODO was soll das sein? M.E. L2 !
return
0.5
*
PPM
->
Sum
(
energy
);
}
double
Error
(
double
t
,
const
Vector
&
u
)
const
{
...
...
mlmc/src/mc/MonteCarloTransport.C
View file @
8b25202b
...
...
@@ -38,12 +38,19 @@ void MonteCarloTransport::Method() {
plot
.
vtk_cellvector
(
name
);
}
solveTransport
(
l
,
fineQ
,
fineCost
,
fineSolution
);
solveTransport
(
l
,
true
,
fineQ
,
fineCost
,
fineSolution
);
if
(
!
onlyFineLevel
)
{
stochasticField
->
GetCoarseSample
(
l
-
1
,
fineFlux
,
coarseFlux
);
assemble
->
problem
->
LoadNewSample
(
&
coarseFlux
);
solveTransport
(
l
,
fineQ
,
fineCost
,
fineSolution
);
if
(
plotting
>
1
)
{
const
char
*
name
=
buildString
(
m
,
"flux_down"
);
plot
.
celldata
(
coarseFlux
,
3
);
plot
.
vtk_cellvector
(
name
);
}
solveTransport
(
l
,
false
,
coarseQ
,
coarseCost
,
coarseSolution
);
}
else
{
coarseQ
=
0
.
0
,
coarseCost
=
0
.
0
,
coarseSolutionUp
=
0
.
0
;
}
...
...
@@ -57,17 +64,37 @@ void MonteCarloTransport::Method() {
logger
->
endMethodMSG
();
}
void
MonteCarloTransport
::
solveTransport
(
int
l
,
double
&
valueQ
,
double
&
cost
,
void
MonteCarloTransport
::
solveTransport
(
int
l
,
bool
fineLevel
,
double
&
valueQ
,
double
&
cost
,
Vector
&
solution
)
{
Date
startSolving
;
//
Date startSolving;
Solver
solver
;
Preconditioner
*
BJ
=
GetPC
(
"PointBlockJacobi"
);
Solver
IM
(
BJ
);
DGTimeIntegrator
timeIntegrator
(
solver
,
solver
,
solver
,
IM
);
assemble
->
PrintInfo
(
solution
);
TimeSeries
timeSeries
=
getTimeSeries
(
fineLevel
);
assemble
->
resetTAssemble
();
timeIntegrator
(
*
assemble
,
timeSeries
,
solution
);
cost
=
solution
.
pSize
()
*
assemble
->
getStep
();
logger
->
logMSGV2
(
"Solving on level "
+
to_string
(
l
)
+
" took "
+
to_string
((
startSolving
-
Date
()).
t
)
+
" seconds"
);
if
(
functional
==
"Mass"
)
valueQ
=
assemble
->
Mass
(
solution
);
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");
}
TimeSeries
MonteCarloTransport
::
getTimeSeries
(
bool
fineLevel
)
{
int
scaling
=
8
;
if
(
fineLevel
)
return
TimeSeries
(
startTime
,
endTime
,
scaling
*
(
int
)
(
pow
(
2
,
l
)
*
(
endTime
-
startTime
)));
else
return
TimeSeries
(
startTime
,
endTime
,
scaling
*
(
int
)
(
pow
(
2
,
l
-
1
)
*
(
endTime
-
startTime
)));
}
mlmc/src/mc/MonteCarloTransport.h
View file @
8b25202b
...
...
@@ -3,23 +3,29 @@
#include
"MonteCarlo.h"
#include
"assemble/DGTransportAssemble.h"
#include
"TimeIntegrator.h"
#include
"
timestepping/
TimeIntegrator.h"
class
MonteCarloTransport
:
public
MonteCarlo
{
private:
Plot
plot
;
void
solveTransport
(
int
l
,
double
&
valueQ
,
double
&
cost
,
Vector
&
solution
);
void
solveTransport
(
int
l
,
bool
fineLevel
,
double
&
valueQ
,
double
&
cost
,
Vector
&
solution
);
TimeSeries
getTimeSeries
(
bool
fineLevel
);
public:
DGTransportAssemble
*
assemble
;
TimeSeries
timeSeries
;
double
startTime
=
0.0
;
double
endTime
=
0.0
;
MatrixGraphs
fluxMatrixGraphs
;
CellMatrixGraphs
solMatrixGraphs
;
Transfer
*
transfer
;
MonteCarloTransport
(
int
l
,
int
dM
,
bool
baseLevel
,
Meshes
*
meshes
,
...
...
@@ -30,6 +36,8 @@ public:
solMatrixGraphs
(
*
meshes
,
*
assemble
->
disc
),
plot
(
Plot
((
*
meshes
)[
l
],
meshes
->
dim
()))
{
config
.
get
(
"startTime"
,
startTime
);
config
.
get
(
"endTime"
,
endTime
);
// transfer = new MatrixTransfer(*assemble);
// transfer->Construct((solMatrixGraphs)[l - pLevel], (solMatrixGraphs)[l - pLevel - 1]);
}
...
...
Write
Preview
Supports
Markdown
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