Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KiT-RT
KiT-RT
Commits
da7c4dfb
Commit
da7c4dfb
authored
Dec 18, 2020
by
Steffen Schotthöfer
Browse files
added postprocessing and cluster scripts. (quality of life)
parent
6ff43d2a
Pipeline
#124110
canceled with stage
Changes
14
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
code/input/exampleMN.cfg
View file @
da7c4dfb
...
...
@@ -10,12 +10,12 @@
% Output directory
OUTPUT_DIR = ../result
% Output file
OUTPUT_FILE = exampleMN
OUTPUT_FILE = exampleMN
_mono
% Log directory
LOG_DIR = ../result/logs
% Mesh File
MESH_FILE = linesource.su2
%
MESH_FILE = linesource_debug.su2
%
MESH_FILE = linesource.su2
MESH_FILE = linesource_debug.su2
%
% ---- Problem description ---
%
...
...
@@ -25,7 +25,7 @@ SCATTER_COEFF = 1
% ---- Solver specifications ----
%
% Choice of basis functions
SPHERICAL_BASIS = SPHERICAL_
HARMONIC
S
SPHERICAL_BASIS = SPHERICAL_
MONOMIAL
S
% Maximal Moment degree
MAX_MOMENT_SOLVER = 1
% Solver type
...
...
scripts/cluster/CPU_run_job.sh
0 → 100644
View file @
da7c4dfb
#!/bin/bash
#BATCH --ntasks=24
#SBATCH --time=24:00:00
#SBATCH --mem=20gb
#SBATCH --partition=single
#SBATCH --job-name=EntropyTrainerCPU
#SBATCH --output=0_CPU_training_out_%j
#SBATCH --error=0_CPU_training_err_%j
python3 trainNNMK2.py
scripts/cluster/GPU_run_job.sh
0 → 100644
View file @
da7c4dfb
#!/bin/bash
#SBATCH --ntasks=20
#SBATCH --partition=gpu_4
#SBATCH --time=24:00:00
#SBATCH --mem=20gb
#SBATCH --gres=gpu:1
#SBATCH --job-name=EntropyTrainer
#SBATCH --output=0_GPU_out_%j
#SBATCH --error=0_GPU_err_%j
python3 trainNNMK2.py
scripts/runner_script.sh
→
scripts/
gitlab runner/
runner_script.sh
View file @
da7c4dfb
File moved
scripts/test_with_runner.sh
→
scripts/
gitlab runner/
test_with_runner.sh
View file @
da7c4dfb
File moved
scripts/postprocessing/exampleMN.vtk
0 → 100644
View file @
da7c4dfb
This diff is collapsed.
Click to expand it.
scripts/postprocessing/logs/2020-11-19_11_11_48
0 → 100644
View file @
da7c4dfb
2020-11-19 11:11:48.599340 | ------------------------------------------------------------------------
2020-11-19 11:11:48.599355 | | _ _____ _____ ____ _____ |
2020-11-19 11:11:48.599358 | | | |/ /_ _|_ _| | _ \_ _| |
2020-11-19 11:11:48.599359 | | | ' / | | | |_____| |_) || | Version |
2020-11-19 11:11:48.599361 | | | . \ | | | |_____| _ < | | 0.0.2 |
2020-11-19 11:11:48.599362 | | |_|\_\___| |_| |_| \_\|_| |
2020-11-19 11:11:48.599363 | | |
2020-11-19 11:11:48.599365 | ------------------------------------------------------------------------
2020-11-19 11:11:48.599368 | | Copyright statement goes here |
2020-11-19 11:11:48.599371 | ------------------------------------------------------------------------
2020-11-19 11:11:48.599376 | Git commit : c3a02db0ad807f20d20f1a1f89ea40e59e517897
2020-11-19 11:11:48.599379 | Config file: exampleMN.cfg
2020-11-19 11:11:48.599380 | MPI Threads: 1
2020-11-19 11:11:48.599382 | OMP Threads: 24
2020-11-19 11:11:48.599384 |
2020-11-19 11:11:48.599384 | -------------------------- Config File Info ----------------------------
2020-11-19 11:11:48.599392 | OUTPUT_DIR = ../result
2020-11-19 11:11:48.599394 | OUTPUT_FILE = exampleMN
2020-11-19 11:11:48.599395 | LOG_DIR = ../result/logs
2020-11-19 11:11:48.599395 | MESH_FILE = linesource.su2
2020-11-19 11:11:48.599396 | PROBLEM = CHECKERBOARD
2020-11-19 11:11:48.599397 | SCATTER_COEFF = 1
2020-11-19 11:11:48.599399 | SOLVER = MN_SOLVER
2020-11-19 11:11:48.599401 | CFL_NUMBER = 0.7
2020-11-19 11:11:48.599402 | TIME_FINAL = 0.3
2020-11-19 11:11:48.599406 | MAX_MOMENT_SOLVER = 0
2020-11-19 11:11:48.599407 | ENTROPY_FUNCTIONAL = MAXWELL_BOLTZMANN
2020-11-19 11:11:48.599409 | ENTROPY_OPTIMIZER = NEWTON
2020-11-19 11:11:48.599411 | NEWTON_FAST_MODE = NO
2020-11-19 11:11:48.599412 | NEWTON_ITER = 1000
2020-11-19 11:11:48.599415 | NEWTON_EPSILON = 0.01
2020-11-19 11:11:48.599417 | NEWTON_STEP_SIZE = 0.7
2020-11-19 11:11:48.599420 | NEWTON_LINE_SEARCH_ITER = 1000
2020-11-19 11:11:48.599421 | BC_DIRICHLET = ( void )
2020-11-19 11:11:48.599424 | QUAD_TYPE = GAUSS_LEGENDRE_TENSORIZED
2020-11-19 11:11:48.599426 | QUAD_ORDER = 8
2020-11-19 11:11:48.599428 | VOLUME_OUTPUT = (ANALYTIC, MINIMAL, MOMENTS, DUAL_MOMENTS)
2020-11-19 11:11:48.599429 | VOLUME_OUTPUT_FREQUENCY = 3
2020-11-19 11:11:48.599432 | SCREEN_OUTPUT = (ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT)
2020-11-19 11:11:48.599434 | SCREEN_OUTPUT_FREQUENCY = 1
2020-11-19 11:11:48.599435 | HISTORY_OUTPUT = (ITER, MASS, RMS_FLUX, VTK_OUTPUT, CSV_OUTPUT)
2020-11-19 11:11:48.599436 | HISTORY_OUTPUT_FREQUENCY = 1
2020-11-19 11:11:48.599437 |
2020-11-19 11:11:48.599440 | ------------------------------------------------------------------------
2020-11-19 11:11:48.781705 | ------------------------------ Solver Starts ----------------------------
2020-11-19 11:11:48.781723 | The simulation will run for 38 iterations.
2020-11-19 11:11:48.781725 | --------------------------------------------------------------
2020-11-19 11:11:48.781727 | | Iter | Mass | RMS flux | VTK out | CSV out |
2020-11-19 11:11:48.781728 | --------------------------------------------------------------
2020-11-19 11:11:49.155765 | | 0 | 3.57222 | 3072.69 | yes | yes |
2020-11-19 11:11:49.286030 | | 1 | 3.57143 | 134.5 | no | yes |
2020-11-19 11:11:49.366109 | | 2 | 3.57077 | 123.225 | no | yes |
2020-11-19 11:11:49.452938 | | 3 | 3.57003 | 113.385 | yes | yes |
2020-11-19 11:11:49.578906 | | 4 | 3.56943 | 104.724 | no | yes |
2020-11-19 11:11:49.657852 | | 5 | 3.56856 | 97.0358 | no | yes |
2020-11-19 11:11:49.760817 | | 6 | 3.56762 | 90.1983 | yes | yes |
2020-11-19 11:11:49.885710 | | 7 | 3.5667 | 84.0994 | no | yes |
2020-11-19 11:11:49.965278 | | 8 | 3.56587 | 78.6345 | no | yes |
2020-11-19 11:11:50.094492 | | 9 | 3.565 | 73.7166 | yes | yes |
2020-11-19 11:11:50.219988 | | 10 | 3.56404 | 69.2681 | no | yes |
2020-11-19 11:11:50.299266 | | 11 | 3.56303 | 65.2102 | no | yes |
2020-11-19 11:11:50.473995 | | 12 | 3.56208 | 61.5433 | yes | yes |
2020-11-19 11:11:50.599151 | | 13 | 3.56109 | 58.2002 | no | yes |
2020-11-19 11:11:50.678754 | | 14 | 3.56012 | 55.1438 | no | yes |
2020-11-19 11:11:50.901624 | | 15 | 3.5591 | 52.3372 | yes | yes |
2020-11-19 11:11:51.027067 | | 16 | 3.55798 | 49.7198 | no | yes |
2020-11-19 11:11:51.106768 | | 17 | 3.55692 | 47.3423 | no | yes |
2020-11-19 11:11:51.385521 | | 18 | 3.55594 | 45.1445 | yes | yes |
2020-11-19 11:11:51.517463 | | 19 | 3.55484 | 43.1041 | no | yes |
2020-11-19 11:11:51.597400 | | 20 | 3.55365 | 41.2031 | no | yes |
2020-11-19 11:11:51.956371 | | 21 | 3.55232 | 39.432 | yes | yes |
2020-11-19 11:11:52.081696 | | 22 | 3.55087 | 37.7798 | no | yes |
2020-11-19 11:11:52.161169 | | 23 | 3.54941 | 36.2502 | no | yes |
2020-11-19 11:11:52.603294 | | 24 | 3.54799 | 34.8252 | yes | yes |
2020-11-19 11:11:52.728973 | | 25 | 3.5466 | 33.4918 | no | yes |
2020-11-19 11:11:52.808888 | | 26 | 3.54519 | 32.2393 | no | yes |
2020-11-19 11:11:53.343002 | | 27 | 3.54373 | 31.061 | yes | yes |
2020-11-19 11:11:53.468968 | | 28 | 3.54239 | 29.9368 | no | yes |
2020-11-19 11:11:53.549029 | | 29 | 3.54109 | 28.8911 | no | yes |
2020-11-19 11:11:54.200150 | | 30 | 3.5397 | 27.904 | yes | yes |
2020-11-19 11:11:54.326219 | | 31 | 3.53842 | 26.9779 | no | yes |
2020-11-19 11:11:54.406302 | | 32 | 3.53703 | 26.0931 | no | yes |
2020-11-19 11:11:55.172290 | | 33 | 3.5357 | 25.2496 | yes | yes |
2020-11-19 11:11:55.294660 | | 34 | 3.53421 | 24.4554 | no | yes |
2020-11-19 11:11:55.372173 | | 35 | 3.53276 | 23.7097 | no | yes |
2020-11-19 11:11:56.221421 | | 36 | 3.53126 | 22.9734 | yes | yes |
2020-11-19 11:11:57.166060 | | 37 | 3.52979 | 22.2951 | yes | yes |
2020-11-19 11:11:57.166072 | | 37 | 3.52979 | 22.2951 | yes | yes |
2020-11-19 11:11:57.166078 | --------------------------------------------------------------
2020-11-19 11:11:57.166079 |
2020-11-19 11:11:57.166080 | ------------------------------ Solver Finished ---------------------------
scripts/postprocessing/logs/2020-11-19_11_11_48_csv
0 → 100644
View file @
da7c4dfb
2020-11-19 11:11:48.781730 , Iter,Mass,RMS_flux,VTK_out,CSV_out
2020-11-19 11:11:49.155777 , 0.000000,3.572218,3072.693515,1.000000,1.000000
2020-11-19 11:11:49.286044 , 1.000000,3.571432,134.499790,0.000000,1.000000
2020-11-19 11:11:49.366115 , 2.000000,3.570766,123.225169,0.000000,1.000000
2020-11-19 11:11:49.452946 , 3.000000,3.570034,113.384853,1.000000,1.000000
2020-11-19 11:11:49.578919 , 4.000000,3.569425,104.724263,0.000000,1.000000
2020-11-19 11:11:49.657860 , 5.000000,3.568560,97.035756,0.000000,1.000000
2020-11-19 11:11:49.760845 , 6.000000,3.567623,90.198274,1.000000,1.000000
2020-11-19 11:11:49.885721 , 7.000000,3.566696,84.099367,0.000000,1.000000
2020-11-19 11:11:49.965285 , 8.000000,3.565865,78.634456,0.000000,1.000000
2020-11-19 11:11:50.094502 , 9.000000,3.565000,73.716643,1.000000,1.000000
2020-11-19 11:11:50.220000 , 10.000000,3.564036,69.268073,0.000000,1.000000
2020-11-19 11:11:50.299274 , 11.000000,3.563033,65.210243,0.000000,1.000000
2020-11-19 11:11:50.474006 , 12.000000,3.562079,61.543311,1.000000,1.000000
2020-11-19 11:11:50.599163 , 13.000000,3.561093,58.200193,0.000000,1.000000
2020-11-19 11:11:50.678762 , 14.000000,3.560118,55.143819,0.000000,1.000000
2020-11-19 11:11:50.901634 , 15.000000,3.559096,52.337214,1.000000,1.000000
2020-11-19 11:11:51.027081 , 16.000000,3.557982,49.719779,0.000000,1.000000
2020-11-19 11:11:51.106775 , 17.000000,3.556919,47.342308,0.000000,1.000000
2020-11-19 11:11:51.385530 , 18.000000,3.555939,45.144463,1.000000,1.000000
2020-11-19 11:11:51.517476 , 19.000000,3.554836,43.104124,0.000000,1.000000
2020-11-19 11:11:51.597406 , 20.000000,3.553652,41.203091,0.000000,1.000000
2020-11-19 11:11:51.956379 , 21.000000,3.552316,39.432019,1.000000,1.000000
2020-11-19 11:11:52.081709 , 22.000000,3.550872,37.779758,0.000000,1.000000
2020-11-19 11:11:52.161177 , 23.000000,3.549414,36.250201,0.000000,1.000000
2020-11-19 11:11:52.603302 , 24.000000,3.547990,34.825214,1.000000,1.000000
2020-11-19 11:11:52.728984 , 25.000000,3.546605,33.491756,0.000000,1.000000
2020-11-19 11:11:52.808896 , 26.000000,3.545189,32.239256,0.000000,1.000000
2020-11-19 11:11:53.343012 , 27.000000,3.543734,31.060959,1.000000,1.000000
2020-11-19 11:11:53.468981 , 28.000000,3.542385,29.936779,0.000000,1.000000
2020-11-19 11:11:53.549037 , 29.000000,3.541085,28.891112,0.000000,1.000000
2020-11-19 11:11:54.200160 , 30.000000,3.539703,27.904022,1.000000,1.000000
2020-11-19 11:11:54.326231 , 31.000000,3.538425,26.977853,0.000000,1.000000
2020-11-19 11:11:54.406309 , 32.000000,3.537029,26.093051,0.000000,1.000000
2020-11-19 11:11:55.172304 , 33.000000,3.535701,25.249594,1.000000,1.000000
2020-11-19 11:11:55.294673 , 34.000000,3.534210,24.455435,0.000000,1.000000
2020-11-19 11:11:55.372181 , 35.000000,3.532756,23.709717,0.000000,1.000000
2020-11-19 11:11:56.221432 , 36.000000,3.531263,22.973376,1.000000,1.000000
2020-11-19 11:11:57.166076 , 37.000000,3.529790,22.295120,1.000000,1.000000
2020-11-19 11:11:57.166077 , 37.000000,3.529790,22.295120,1.000000,1.000000
scripts/postprocessing/plot.py
0 → 100644
View file @
da7c4dfb
import
matplotlib.pyplot
as
plt
from
matplotlib
import
cm
import
argparse
import
numpy
as
np
import
datetime
as
dt
import
os
import
pandas
as
pd
import
re
import
errno
import
vtk
import
itertools
import
seaborn
as
sns
#################### SETUP ####################
def
getProblemVTKSettings
(
problem
):
if
problem
==
'CHECKERBOARD'
:
return
{
'logScale'
:
True
,
'cameraPosition'
:
[
3.5
,
3
,
-
17.5
],
'cameraFocalPoint'
:
[
3.5
,
3
,
0
]
}
else
:
return
{
'logScale'
:
False
,
'cameraPosition'
:
[
0
,
0
,
0
],
'cameraFocalPoint'
:
[
0
,
0
,
0
]
}
def
getLabel
(
s
):
labelDict
=
{
'Iter'
:
'Iterations'
,
'Runtime'
:
'Runtime [s]'
,
'Mass'
:
'Mass'
,
'RMS_flux'
:
'L$_2$ flux difference'
,
}
if
s
in
labelDict
:
return
labelDict
[
s
]
else
:
return
s
def
latexify
(
s
):
if
any
(
latexExpression
in
s
for
latexExpression
in
[
'ρ'
,
'µ'
,
'θ'
]):
s
=
''
.
join
(
'${0}$'
.
format
(
s
))
s
.
replace
(
'ρ'
,
'
\\
rho '
)
s
.
replace
(
'µ'
,
'
\\
mu '
)
s
.
replace
(
'θ'
,
'
\\
theta '
)
return
s
#################### CODE ####################
def
timeToFloat
(
time
):
t
=
dt
.
datetime
.
strptime
(
time
.
strip
(),
"%Y-%m-%d %H:%M:%S.%f"
)
epoch
=
dt
.
datetime
.
utcfromtimestamp
(
0
)
return
(
t
-
epoch
).
total_seconds
()
class
LogFile
:
def
__init__
(
self
,
filepath
):
self
.
filepath
=
os
.
path
.
normpath
(
filepath
)
if
os
.
path
.
isfile
(
self
.
filepath
):
with
open
(
self
.
filepath
,
'r'
)
as
content
:
print
(
"Parsing:
\t
"
+
self
.
filepath
)
self
.
raw
=
content
.
readlines
()
else
:
raise
FileNotFoundError
(
self
.
filepath
)
self
.
outputDir
=
os
.
path
.
dirname
(
filepath
)
self
.
logFile
=
os
.
path
.
basename
(
filepath
)
self
.
header
=
[]
sectionCtr
=
0
# 1 = banner, 2 = copyright, 3 = git/mpi info, 4 = config file, 5 = spacer, 6 = log
for
line
in
self
.
raw
:
if
'----------'
in
line
:
sectionCtr
+=
1
continue
elif
sectionCtr
==
4
:
self
.
header
.
append
(
line
.
split
(
'|'
)[
1
].
strip
())
#strip time stamp and leading/trailing whitespaces
elif
sectionCtr
>
4
:
break
self
.
header
=
list
(
filter
(
None
,
self
.
header
))
#strip empty lines
for
line
in
self
.
header
:
if
'MESH_FILE'
in
line
:
self
.
meshFile
=
line
.
split
(
'='
)[
1
].
strip
()
if
'PROBLEM'
in
line
:
self
.
problem
=
line
.
split
(
'='
)[
1
].
strip
()
if
'SOLVER'
in
line
:
self
.
solver
=
line
.
split
(
'='
)[
1
].
strip
()
if
'CFL_NUMBER'
in
line
:
self
.
cfl
=
float
(
line
.
split
(
'='
)[
1
].
strip
())
if
'TIME_FINAL'
in
line
:
self
.
tEnd
=
float
(
line
.
split
(
'='
)[
1
].
strip
())
if
'QUAD_TYPE'
in
line
:
self
.
quadType
=
line
.
split
(
'='
)[
1
].
strip
()
if
'QUAD_ORDER'
in
line
:
self
.
quadOrder
=
int
(
line
.
split
(
'='
)[
1
].
strip
())
if
'OUTPUT_FILE'
in
line
:
self
.
vtkFile
=
line
.
split
(
'='
)[
1
].
strip
()
if
os
.
path
.
isfile
(
self
.
filepath
+
'_csv'
):
df
=
pd
.
read_csv
(
self
.
filepath
+
'_csv'
)
df
.
rename
(
columns
=
{
df
.
columns
[
0
]:
"Time"
},
inplace
=
True
)
t0
=
timeToFloat
(
df
[
'Time'
][
0
])
df
[
'Runtime'
]
=
np
.
zeros
(
len
(
df
[
'Time'
]))
for
index
,
_
in
df
.
iterrows
():
df
.
loc
[
index
,
'Runtime'
]
=
timeToFloat
(
df
[
'Time'
][
index
])
-
t0
df
=
df
.
drop
(
columns
=
[
'Time'
,
'VTK_out'
,
'CSV_out'
])
df
.
columns
=
df
.
columns
.
str
.
strip
()
self
.
data
=
df
if
not
self
.
vtkFile
.
endswith
(
'.vtk'
):
self
.
vtkFile
+=
'.vtk'
def
createVTKPlots
(
dir
,
logFiles
,
disableRescaling
=
False
,
showMesh
=
False
,
showIsolines
=
False
):
outputdir
=
'plots/vtk'
if
not
os
.
path
.
exists
(
outputdir
):
os
.
makedirs
(
outputdir
)
if
not
all
(
l
.
problem
==
logFiles
[
0
].
problem
for
l
in
logFiles
):
raise
(
ValueError
)
problem
=
logFiles
[
0
].
problem
setup
=
getProblemVTKSettings
(
problem
)
minVal
=
{}
maxVal
=
{}
fieldNames
=
[]
for
log
in
logFiles
:
reader
=
vtk
.
vtkUnstructuredGridReader
()
reader
.
SetFileName
(
log
.
vtkFile
)
reader
.
ReadAllScalarsOn
()
reader
.
ReadAllVectorsOn
()
reader
.
Update
()
output
=
reader
.
GetOutput
()
for
i
in
range
(
output
.
GetCellData
().
GetNumberOfArrays
()):
f
=
output
.
GetCellData
().
GetArrayName
(
i
)
if
f
not
in
fieldNames
:
fieldNames
.
append
(
f
)
valRange
=
output
.
GetCellData
().
GetArray
(
i
).
GetRange
()
minVal
[
f
]
=
valRange
[
0
]
#np.maximum(minVal[f] if f in minVal else -np.inf, valRange[0])
maxVal
[
f
]
=
valRange
[
1
]
#np.minimum(maxVal[f] if f in maxVal else np.inf, valRange[1])
ctf
=
vtk
.
vtkColorTransferFunction
()
ctf
.
SetColorSpaceToRGB
()
cmap
=
cm
.
get_cmap
(
'viridis'
,
256
)
ctf
.
AddRGBPoint
(
-
1
,
1
,
0
,
0
)
for
i
,
rgb
in
enumerate
(
cmap
.
colors
):
ctf
.
AddRGBPoint
(
float
(
i
/
256
),
rgb
[
0
],
rgb
[
1
],
rgb
[
2
])
for
log
in
logFiles
:
reader
=
vtk
.
vtkUnstructuredGridReader
()
reader
.
SetFileName
(
log
.
vtkFile
)
reader
.
ReadAllScalarsOn
()
reader
.
ReadAllVectorsOn
()
reader
.
Update
()
output
=
reader
.
GetOutput
()
if
setup
[
'logScale'
]:
lut
=
vtk
.
vtkLogLookupTable
()
else
:
lut
=
vtk
.
vtkLookupTable
()
lut
.
SetNumberOfTableValues
(
256
)
lut
.
Build
()
for
i
in
range
(
0
,
256
):
rgb
=
list
(
ctf
.
GetColor
(
float
(
i
)
/
256
))
+
[
1
]
lut
.
SetTableValue
(
i
,
rgb
)
camera
=
vtk
.
vtkCamera
()
camPos
=
setup
[
'cameraPosition'
]
camFP
=
setup
[
'cameraFocalPoint'
]
camera
.
SetPosition
(
camPos
[
0
],
camPos
[
1
],
camPos
[
2
]);
camera
.
SetFocalPoint
(
camFP
[
0
],
camFP
[
1
],
camFP
[
2
]);
for
f
in
fieldNames
:
mapper
=
vtk
.
vtkDataSetMapper
()
mapper
.
SetInputData
(
output
)
mapper
.
ScalarVisibilityOn
()
mapper
.
SetColorModeToMapScalars
()
mapper
.
SetLookupTable
(
lut
)
mapper
.
SetScalarModeToUsePointFieldData
()
mapper
.
SelectColorArray
(
f
)
if
disableRescaling
:
mapper
.
SetScalarRange
(
output
.
GetCellData
().
GetArray
(
f
).
GetRange
())
else
:
mapper
.
SetScalarRange
(
minVal
[
f
],
maxVal
[
f
])
scalarBar
=
vtk
.
vtkScalarBarActor
()
scalarBar
.
SetLookupTable
(
mapper
.
GetLookupTable
())
scalarBar
.
SetTitle
(
latexify
(
f
))
scalarBar
.
SetOrientationToHorizontal
()
scalarBar
.
SetPosition
(
0.1
,
-
0.001
)
scalarBar
.
SetLabelFormat
(
'%-#6.1e'
)
scalarBar
.
SetWidth
(
0.8
)
scalarBar
.
SetHeight
(
0.1
)
scalarBar
.
SetNumberOfLabels
(
4
)
scalarBar
.
SetMaximumNumberOfColors
(
256
)
scalarBar
.
SetTitleRatio
(
0.6
)
titleprop
=
scalarBar
.
GetTitleTextProperty
()
titleprop
.
ShadowOff
()
titleprop
.
BoldOff
()
titleprop
.
SetColor
(
0
,
0
,
0
)
labelprop
=
scalarBar
.
GetLabelTextProperty
()
labelprop
.
ShadowOff
()
labelprop
.
BoldOff
()
labelprop
.
SetColor
(
0
,
0
,
0
)
scalarBar
.
SetLabelTextProperty
(
labelprop
)
actor
=
vtk
.
vtkActor
()
actor
.
SetMapper
(
mapper
)
if
showMesh
:
actor
.
GetProperty
().
EdgeVisibilityOn
()
actor
.
GetProperty
().
SetLineWidth
(
1.0
)
if
showIsolines
:
output
.
GetPointData
().
SetActiveScalars
(
f
)
contours
=
vtk
.
vtkContourFilter
()
contours
.
SetInputData
(
output
)
contours
.
GenerateValues
(
10
,
minVal
[
f
],
maxVal
[
f
])
contMapper
=
vtk
.
vtkPolyDataMapper
()
contMapper
.
SetInputConnection
(
contours
.
GetOutputPort
())
contMapper
.
ScalarVisibilityOff
()
contActor
=
vtk
.
vtkActor
()
contActor
.
SetMapper
(
contMapper
)
#contActor.GetProperty().SetColor(1,1,1)
renderer
=
vtk
.
vtkRenderer
()
renderer
.
AddActor
(
actor
)
if
showIsolines
:
renderer
.
AddActor
(
contActor
)
renderer
.
AddActor2D
(
scalarBar
)
renderer
.
UseFXAAOn
()
renderer
.
SetBackground
(
1
,
1
,
1
)
renderer
.
SetActiveCamera
(
camera
)
render_window
=
vtk
.
vtkRenderWindow
()
render_window
.
SetOffScreenRendering
(
True
)
render_window
.
AddRenderer
(
renderer
)
render_window
.
SetSize
(
800
,
1000
)
render_window
.
Render
()
windowToImageFilter
=
vtk
.
vtkWindowToImageFilter
()
windowToImageFilter
.
SetInput
(
render_window
)
windowToImageFilter
.
ReadFrontBufferOff
()
windowToImageFilter
.
Update
()
writer
=
vtk
.
vtkPNGWriter
()
writer
.
SetFileName
(
outputdir
+
'/'
+
log
.
logFile
+
"_"
+
f
+
".png"
)
writer
.
SetInputConnection
(
windowToImageFilter
.
GetOutputPort
())
writer
.
Write
()
print
(
'Plot created:
\t
'
+
outputdir
+
'/'
+
log
.
logFile
+
"_"
+
f
+
".png"
)
def
createConvergencePlots
(
logFiles
):
outputDir
=
'plots/convergence'
if
not
os
.
path
.
exists
(
outputDir
):
os
.
makedirs
(
outputDir
)
columns
=
list
(
logFiles
[
0
].
data
)
if
not
all
(
list
(
l
.
data
)
==
list
(
logFiles
[
0
].
data
)
for
l
in
logFiles
):
raise
(
ValueError
)
cpal
=
[
"#886a4c"
,
"#7548cf"
,
"#5dbf48"
,
"#d150c6"
,
"#a1ae43"
,
"#8081d3"
,
"#d19b45"
,
"#8f4888"
,
"#73b990"
,
"#dc4d32"
,
"#6facc3"
,
"#cb4671"
,
"#4e6f3f"
,
"#cf9bad"
,
"#ab583e"
,
"#5b5f79"
]
xData
=
[
'Iter'
,
'Runtime'
]
yData
=
[
y
for
y
in
columns
if
y
not
in
xData
]
for
x
in
xData
:
for
y
in
yData
:
plt
.
cla
()
plt
.
clf
()
palette
=
itertools
.
cycle
(
sns
.
color_palette
(
cpal
))
plt
.
xlabel
(
getLabel
(
x
))
plt
.
title
(
getLabel
(
y
))
for
f
in
logFiles
:
plt
.
semilogy
(
f
.
data
.
loc
[:,
x
].
values
,
f
.
data
.
loc
[:,
y
].
values
,
color
=
next
(
palette
))
plotName
=
os
.
path
.
normpath
(
x
+
'_'
+
y
+
'.pdf'
)
plt
.
savefig
(
os
.
path
.
join
(
outputDir
,
plotName
))
print
(
'Plot created:
\t
'
+
os
.
path
.
join
(
outputDir
,
plotName
))
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
()
disableRescaling
=
showIsolines
=
showMesh
=
False
parser
.
add_argument
(
"--dir"
,
"-d"
,
type
=
str
,
required
=
False
,
default
=
'logs'
)
parser
.
add_argument
(
"--disable-rescaling"
,
"-r"
,
action
=
'store_true'
,
dest
=
'disableRescaling'
)
parser
.
add_argument
(
"--show-isolines"
,
"-i"
,
action
=
'store_true'
,
dest
=
'showIsolines'
)
parser
.
add_argument
(
"--show-mesh"
,
"-m"
,
action
=
'store_true'
,
dest
=
'showMesh'
)
args
=
parser
.
parse_args
()
dir
=
os
.
path
.
normpath
(
args
.
dir
)
if
not
os
.
path
.
exists
(
'plots'
):
os
.
makedirs
(
'plots'
)
files
=
os
.
listdir
(
dir
)
logFiles
=
[]
for
f
in
files
:
if
not
f
.
endswith
(
'_csv'
):
logFiles
.
append
(
LogFile
(
os
.
path
.
join
(
dir
,
f
)))
createConvergencePlots
(
logFiles
)
createVTKPlots
(
os
.
getcwd
(),
logFiles
,
disableRescaling
,
showMesh
,
showIsolines
)
\ No newline at end of file
scripts/postprocessing/plots/convergence/Iter_Mass.pdf
0 → 100644
View file @
da7c4dfb
File added
scripts/postprocessing/plots/convergence/Iter_RMS_flux.pdf
0 → 100644
View file @
da7c4dfb
File added
scripts/postprocessing/plots/convergence/Runtime_Mass.pdf
0 → 100644
View file @
da7c4dfb
File added
scripts/postprocessing/plots/convergence/Runtime_RMS_flux.pdf
0 → 100644
View file @
da7c4dfb
File added
scripts/postprocessing/plots/vtk/2020-11-19_11_11_48_flux.png
0 → 100644
View file @
da7c4dfb
257 KB
jannick.wolters
@jm2154
mentioned in commit
594099ea
·
Apr 30, 2021
mentioned in commit
594099ea
mentioned in commit 594099eae0a1c99affa2657967a86fb12ada482f
Toggle commit list
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