Commit bb034a68 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

convergence test

parent f2973ad2
Pipeline #147232 passed with stages
in 58 minutes and 42 seconds
%% Cell type:code id: tags:
``` python
import sys
sys.path.append('..')
import mpp.python.mppy as mppy
import mpp.python.mppy.utilities as utils
from python.mlmc_mppy import *
import pandas as pd
mpp = mppy.Mpp(project_name='MLMC',
executable='MLMC-M++',
kernels=4,
mute=False)
mpp.build()
```
%% Output
================ running cmake ================
-- Project directory= /home/niklas/CLionProjects/mlmc
-- Mpp directory= /home/niklas/CLionProjects/mlmc/mpp
-- Setting prepare commit message hook to mpp
file: /home/niklas/CLionProjects/mlmc/mpp/doc/../../.git/modules/mpp/hooks/prepare-commit-msg
-- Failed to find LLVM FileCheck
-- git Version: v1.5.2-bf585a27
-- Version: 1.5.2
-- Performing Test HAVE_STD_REGEX -- success
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK -- success
-- A library with LAPACK API found.
-- C Compiler optimization= -O3
-- C++ version= 17
-- Compiler version= c++
-- Compiler optimization= -O0
-- Suppress deprecated warnings= OFF
-- Building space time library= OFF
-- Time dimension= 0
-- Using fftw library= ON
-- Space dimension= 2
-- Affine linear transformations= ON
-- Geometric tolerance= 1e-10
-- Near zero= 1e-15
-- Very large= 1e30
-- Infinity= 1e100
-- Building mpp unit tests= OFF
-- Building mpp interval arithmetic unit tests= OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /home/niklas/CLionProjects/mlmc/build
================ running make ================
[ 1%] Built target gtest
[ 6%] Built target benchmark
[ 10%] Built target LIB_BASIC
[ 57%] Built target superlu
[ 57%] Built target benchmark_main
[ 58%] Built target gmock
[ 58%] Built target gtest_main
[ 59%] Built target gmock_main
[ 62%] Built target LIB_MATH
[ 63%] Built target LIB_TEST
[ 68%] Built target LIB_MESH
[ 71%] Built target LIB_DISC
[ 75%] Built target LIB_VECTOR
[ 80%] Built target LIB_ELEM
[ 84%] Built target LIB_SOLVERS
[ 84%] Built target MPP_LIBRARIES
[ 84%] Built target BASICS
[ 85%] Built target TestPlotting
Scanning dependencies of target PDESOLVER
[ 86%] Building CXX object mlmc/src/pdesolver/CMakeFiles/PDESOLVER.dir/PDESolverCreator.cpp.o
[ 86%] Building CXX object mlmc/src/pdesolver/CMakeFiles/PDESOLVER.dir/assembling/MixedEllipticAssemble.cpp.o
[ 86%] Building CXX object mlmc/src/pdesolver/CMakeFiles/PDESOLVER.dir/PDESolver.cpp.o
[ 86%] Building CXX object mlmc/src/pdesolver/CMakeFiles/PDESOLVER.dir/assembling/LagrangeEllipticAssemble.cpp.o
[ 86%] Building CXX object mlmc/src/pdesolver/CMakeFiles/PDESOLVER.dir/assembling/HybridEllipticAssemble.cpp.o
[ 87%] Building CXX object mlmc/src/pdesolver/CMakeFiles/PDESOLVER.dir/assembling/DGEllipticAssemble.cpp.o
[ 87%] Building CXX object mlmc/src/pdesolver/CMakeFiles/PDESOLVER.dir/assembling/PGReactionAssemble.cpp.o
[ 87%] Building CXX object mlmc/src/pdesolver/CMakeFiles/PDESOLVER.dir/assembling/DGReactionAssemble.cpp.o
[ 88%] Linking CXX static library libPDESOLVER.a
[ 88%] Built target PDESOLVER
Scanning dependencies of target PROBLEMS
[ 88%] Building CXX object mlmc/src/problems/CMakeFiles/PROBLEMS.dir/StochasticEllipticProblem.cpp.o
[ 89%] Linking CXX static library libPROBLEMS.a
[ 89%] Built target PROBLEMS
Scanning dependencies of target GENERATORS
[ 89%] Building CXX object mlmc/src/generators/CMakeFiles/GENERATORS.dir/algorithms/HybridFluxGenerator.cpp.o
[ 89%] Linking CXX static library libGENERATORS.a
[ 91%] Built target GENERATORS
[ 91%] Linking CXX executable TestNormalDistribution
[ 91%] Linking CXX executable TestUniformDistribution
[ 91%] Linking CXX executable TestCirculantEmbedding
Scanning dependencies of target MONTECARLO
[ 91%] Building CXX object mlmc/src/montecarlo/CMakeFiles/MONTECARLO.dir/MonteCarlo.cpp.o
[ 91%] Built target TestUniformDistribution
[ 91%] Linking CXX executable TestSymmetricCovariance
[ 91%] Built target TestNormalDistribution
Scanning dependencies of target TestPDESolverMPI
[ 91%] Building CXX object mlmc/tests/CMakeFiles/TestPDESolverMPI.dir/pdesolver/TestPDESolver.cpp.o
[ 91%] Built target TestCirculantEmbedding
[ 91%] Building CXX object mlmc/src/montecarlo/CMakeFiles/MONTECARLO.dir/MultilevelMonteCarlo.cpp.o
[ 92%] Built target TestSymmetricCovariance
Scanning dependencies of target TestPDESolver
[ 93%] Building CXX object mlmc/tests/CMakeFiles/TestPDESolver.dir/pdesolver/TestPDESolver.cpp.o
[ 94%] Building CXX object mlmc/src/montecarlo/CMakeFiles/MONTECARLO.dir/datastructure/Errors.cpp.o
[ 94%] Building CXX object mlmc/src/montecarlo/CMakeFiles/MONTECARLO.dir/datastructure/Exponents.cpp.o
[ 94%] Linking CXX executable TestPDESolverMPI
[ 94%] Building CXX object mlmc/src/montecarlo/CMakeFiles/MONTECARLO.dir/datastructure/EmpiricMeasureLevelMaps.cpp.o
[ 94%] Linking CXX executable TestPDESolver
[ 94%] Built target TestPDESolverMPI
[ 94%] Built target TestPDESolver
[ 95%] Linking CXX static library libMONTECARLO.a
[ 95%] Built target MONTECARLO
[ 95%] Linking CXX executable TestWelfordAggregateMPI
Scanning dependencies of target MLMC-M++
[ 96%] Building CXX object CMakeFiles/MLMC-M++.dir/mlmc/src/Main.cpp.o
Scanning dependencies of target TestMonteCarloMPI
Scanning dependencies of target TestMainMPI
[ 96%] Building CXX object mlmc/tests/CMakeFiles/TestMainMPI.dir/TestMain.cpp.o
[ 97%] Building CXX object mlmc/tests/CMakeFiles/TestMonteCarloMPI.dir/montecarlo/TestMonteCarlo.cpp.o
[ 98%] Built target TestWelfordAggregateMPI
Scanning dependencies of target TestEmpiricMeasureLevelMaps
[ 99%] Building CXX object mlmc/tests/CMakeFiles/TestEmpiricMeasureLevelMaps.dir/montecarlo/datastructure/TestEmpiricMeasureLevelMaps.cpp.o
[ 99%] Linking CXX executable MLMC-M++
[ 99%] Linking CXX executable TestMonteCarloMPI
[ 99%] Linking CXX executable TestMainMPI
[ 99%] Linking CXX executable TestEmpiricMeasureLevelMaps
[ 99%] Built target MLMC-M++
Scanning dependencies of target TestExponents
[100%] Building CXX object mlmc/tests/CMakeFiles/TestExponents.dir/montecarlo/datastructure/TestExponents.cpp.o
[100%] Built target TestMonteCarloMPI
Scanning dependencies of target TestErrors
[100%] Building CXX object mlmc/tests/CMakeFiles/TestErrors.dir/montecarlo/datastructure/TestErrors.cpp.o
[100%] Built target TestMainMPI
[100%] Linking CXX executable TestSPRNG5MPI
[100%] Built target TestEmpiricMeasureLevelMaps
[100%] Built target TestSPRNG5MPI
[100%] Linking CXX executable TestExponents
[100%] Linking CXX executable TestErrors
[100%] Built target TestExponents
[100%] Built target TestErrors
0
%% Cell type:code id: tags:
``` python
mpp.reset_data()
mpp.clean_data()
kwargs={"GeneratorPlotting": 1,
"PDESolverPlotting": 1,
"initLevels": [4, 5, 6],
"Problem": "StochasticLaplace2DTest"}
mpp.run(4, config="mlmc_elliptic", kwargs=kwargs)
```
%% Output
================ running mpp ================
start program on 4 procs at Tue Apr 27 13:38:15 2021
Running on: niklas-ThinkPad-T470p
Config Info:
GeneratorVerbose: ......... 0
NewtonVerbose: ............ 0
PDESolverVerbose: ......... 0
LinearVerbose: ............ 0
MeshVerbose: .............. 1
MainVerbose: .............. 1
MCVerbose: ................ 1
MLMCVerbose: .............. 1
PDESolverPlotting: ........ 1
GeneratorPlotting: ........ 1
lambda: ................... [0.15, 0.15]
Model: .................... LagrangeElliptic
AssembleVerbose: .......... 0
degree: ................... 1
MCParallel: ............... false
maxLevel: ................. 7
Problem: .................. StochasticLaplace2DTest
StochasticField: .......... LogNormal
epsilon: .................. 0.01
ConfigVerbose: ............ 1
onlyFine: ................. false
Mean: ..................... 0.0
initLevels: ............... [4, 5, 6]
smoothing: ................ 1.0
Quantity: ................. L2
initSampleAmount: ......... [12, 6, 3]
sigma: .................... 1.0
MLMC Experiment: Run
MLMC Method: eps=0.010000
MonteCarlo l=4: Start with: M=0 dM=12 Mcomm=0 dMcomm=12
MonteCarlo l=4: MeanQ=0 MeanY=0 SVarQ=0 SVarY=0
MonteCarlo l=4: End with: M=12 dM=12 Mcomm=0 dMcomm=0
MonteCarlo l=4: MeanQ=0.57815467 MeanY=0.57815467 SVarQ=1.6015669e-05 SVarY=1.6015669e-05
MonteCarlo l=4: Took 0.27 seconds
MonteCarlo l=5: Start with: M=0 dM=6 Mcomm=0 dMcomm=6
MonteCarlo l=5: MeanQ=0 MeanY=0 SVarQ=0 SVarY=0
MonteCarlo l=5: End with: M=6 dM=6 Mcomm=0 dMcomm=0
MonteCarlo l=5: MeanQ=0.57956002 MeanY=0.0027737227 SVarQ=1.3311143e-05 SVarY=4.9078869e-05
MonteCarlo l=5: Took 0.75 seconds
MonteCarlo l=6: Start with: M=0 dM=3 Mcomm=0 dMcomm=3
MonteCarlo l=6: MeanQ=0 MeanY=0 SVarQ=0 SVarY=0
MonteCarlo l=6: End with: M=3 dM=3 Mcomm=0 dMcomm=0
MonteCarlo l=6: MeanQ=0.58015262 MeanY=0.0026051525 SVarQ=1.1962813e-05 SVarY=6.3081821e-05
MonteCarlo l=6: Took 1.41 seconds
MLMC Method: alpha=0.090455732 beta=-0.36212231 gamma=1.9138626
MLMC Method: dM=[-8, -2, 0]
MLMC Method: numErr=0.040261089
MonteCarlo l=5: Start with: M=6 dM=3 Mcomm=0 dMcomm=3
MonteCarlo l=5: MeanQ=0.57956002 MeanY=0.0027737227 SVarQ=1.3311143e-05 SVarY=4.9078869e-05
MonteCarlo l=5: End with: M=9 dM=3 Mcomm=0 dMcomm=0
MonteCarlo l=5: MeanQ=0.58005915 MeanY=0.0012960378 SVarQ=1.1520124e-05 SVarY=4.865392e-05
MonteCarlo l=5: Took 0.36 seconds
MonteCarlo l=6: Start with: M=3 dM=2 Mcomm=0 dMcomm=2
MonteCarlo l=6: MeanQ=0.58015262 MeanY=0.0026051525 SVarQ=1.1962813e-05 SVarY=6.3081821e-05
MonteCarlo l=6: End with: M=5 dM=2 Mcomm=0 dMcomm=0
MonteCarlo l=6: MeanQ=0.57881206 MeanY=0.0016184985 SVarQ=1.2600565e-05 SVarY=5.2065491e-05
MonteCarlo l=6: Took 0.95 seconds
MonteCarlo l=7: Start with: M=0 dM=3 Mcomm=0 dMcomm=3
MonteCarlo l=7: MeanQ=0 MeanY=0 SVarQ=0 SVarY=0
MonteCarlo l=7: End with: M=3 dM=3 Mcomm=0 dMcomm=0
MonteCarlo l=7: MeanQ=0.58015614 MeanY=0.0025882243 SVarQ=1.1985695e-05 SVarY=6.3513427e-05
MonteCarlo l=7: Took 5.91 seconds
MLMC Method: alpha=-0.49892745 beta=-0.19225278 gamma=1.934905
MLMC Method: dM=[-3, -1, -1, 0]
MLMC Method: numErr=0
MLMC Method: statErr=0.0061907084
MLMC Method: 9.81 seconds
MLMC Experiment: 9.81 seconds
MC Results Info:
E(Qf-Qc): ................. [0.578155, 0.00129604, 0.0016185, 0.00258822]
E(Qf): .................... [0.578155, 0.580059, 0.578812, 0.580156]
V(Qf-Qc): ................. [1.60157e-05, 4.86539e-05, 5.20655e-05, 6.35134e-05]
V(Qf): .................... [1.60157e-05, 1.15201e-05, 1.26006e-05, 1.19857e-05]
kurtosis: ................. [1.742, 1.39489, 1.53131, 1.5]
E(cost): .................. [81, 289, 1089, 4225]
Used Levels: .............. [4, 5, 6, 7]
Used Samples: ............. [12, 9, 5, 3]
Exponents Info:
Final alpha: .............. -0.49892745
Final beta: ............... -0.19225278
Final gamma: .............. 1.934905
MLMC Results Info:
Value: .................... 1.7508484
Cost: ..................... 12827
Epsilon: .................. 0.01
Total Error: .............. 0.0061907084
Statistical Error: ........ 0.0061907084
Numerical Error: .......... 0
end program after 9.91 seconds on 4 procs at Tue Apr 27 13:38:25 2021
0
%% Cell type:code id: tags:
``` python
from mpp.python.mppy.utilities import VtkPlot
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
@interact(n=widgets.IntSlider(min=0, max=5, step=1, value=0))
def plot_nth_frame(n):
p = VtkPlot(figsize=(16, 12))
plt.axis('off')
gs = gridspec.GridSpec(2, 2)
p.ax1 = p.fig.add_subplot(gs[0])
#p.add_vtu("Kappa.5.0.{}.vtu".format(n), ax=p.ax1)
p.add_quivers("Flux.5.0.{}.vtu".format(n), ax=p.ax1)
p.ax2 = p.fig.add_subplot(gs[1])
#p.add_vtu("Kappa.5.1.{}.vtu".format(n), ax=p.ax2)
p.add_quivers("Flux.5.1.{}.vtu".format(n), ax=p.ax2)
p.ax3 = p.fig.add_subplot(gs[2])
p.add_vtu("Pressure.5.0.{}.vtu".format(n), ax=p.ax3)
p.ax4 = p.fig.add_subplot(gs[3])
p.add_vtu("Pressure.5.1.{}.vtu".format(n), ax=p.ax4)
```
%% Output
%% Cell type:code id: tags:
``` python
from mpp.python.mppy.utilities import VtkPlot
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
@interact(n=widgets.IntSlider(min=0, max=2, step=1, value=0))
def plot_nth_frame(n):
p = VtkPlot(figsize=(16, 12))
plt.axis('off')
gs = gridspec.GridSpec(2, 2)
p.ax1 = p.fig.add_subplot(gs[0])
#p.add_vtu("Kappa.6.0.{}.vtu".format(n), ax=p.ax1)
p.add_quivers("Flux.6.0.{}.vtu".format(n), ax=p.ax1)
p.ax2 = p.fig.add_subplot(gs[1])
#p.add_vtu("Kappa.6.1.{}.vtu".format(n), ax=p.ax2)
p.add_quivers("Flux.6.1.{}.vtu".format(n), ax=p.ax2)
p.ax3 = p.fig.add_subplot(gs[2])
p.add_vtu("Pressure.6.0.{}.vtu".format(n), ax=p.ax3)
p.ax4 = p.fig.add_subplot(gs[3])
p.add_vtu("Pressure.6.1.{}.vtu".format(n), ax=p.ax4)
```
%% Output
%% Cell type:markdown id: tags:
## Convergence tests
%% Cell type:code id: tags:
``` python
test_case = True
if test_case:
mpp.kernels = 4
mpp.mute = False
kwargs = {"epsilon": 0.0,
"initLevels": [3, 4, 5, 6, 7],
"initSampleAmount": [100, 100, 100, 100, 100],
"Problem": "StochasticLaplace2DTest"}
epsilons = [0.1, 0.03, 0.01, 0.003]
else:
mpp.kernels = 32
mpp.mute = True
kwargs = {"epsilon": 0.0,
"initLevels": [3, 4, 5, 6, 7, 8, 9],
"initSampleAmount": [500, 500, 500, 500, 500, 500, 500],
"Problem": "StochasticLaplace2DTest"}
epsilons = [0.1, 0.03, 0.01, 0.003, 0.001, 0.0003]
```
%% Cell type:code id: tags:
``` python
mpp.clean_data()
mpp.reset_data()
mpp.run(config="mlmc_elliptic", kwargs=kwargs)
mpp.parse_log()
convergence_plot(mpp)
```
......
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