Skip to content
Snippets Groups Projects
Commit 97b5deb2 authored by felix's avatar felix
Browse files

created diagrams

parent 38f178fa
No related branches found
No related tags found
No related merge requests found
zeichnungen/100_U_x.png

148 KiB

zeichnungen/100_U_y.png

166 KiB

zeichnungen/100_p.png

188 KiB

% This file was created by tikzplotlib v0.9.5.
\begin{tikzpicture}
\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
\begin{axis}[
tick align=outside,
tick pos=left,
width=\diagramwidth,
x grid style={white!69.0196078431373!black},
xlabel={time},
xmin=-0.1, xmax=2.1,
xtick style={color=black},
y grid style={white!69.0196078431373!black},
ylabel={\(\displaystyle C_d\)},
ymin=-7.89722, ymax=165.84162,
ytick style={color=black}
]
\addplot [semithick, color0]
table {%
0 0
0.02 157.9444
0.04 44.26363
0.06 38.91157
0.08 36.58299
0.1 35.36867
0.12 34.68655
0.14 34.29299
0.16 34.06388
0.18 33.93122
0.2 33.85525
0.22 33.81286
0.24 33.79022
0.26 33.77877
0.28 33.77404
0.3 33.77233
0.32 33.77265
0.34 33.77357
0.36 33.77471
0.38 33.77593
0.4 33.77694
0.42 33.7777
0.44 33.77809
0.46 33.7785
0.48 33.77861
0.5 33.77857
0.52 33.77847
0.54 33.77832
0.56 33.77809
0.58 33.77784
0.6 33.77756
0.62 33.77729
0.64 33.77702
0.66 33.77675
0.68 33.77649
0.7 33.77624
0.72 33.77601
0.74 33.7758
0.76 33.7756
0.78 33.77539
0.8 33.77523
0.82 33.77506
0.84 33.77492
0.86 33.77478
0.88 33.77466
0.9 33.77455
0.92 33.77444
0.94 33.77435
0.96 33.77426
0.98 33.77418
1 33.77411
1.02 33.77405
1.04 33.77398
1.06 33.77394
1.08 33.77388
1.1 33.77383
1.12 33.77379
1.14 33.77375
1.16 33.7737
1.18 33.77374
1.2 33.77368
1.22 33.77357
1.24 33.77355
1.26 33.77354
1.28 33.77361
1.3 33.77355
1.32 33.77354
1.34 33.77356
1.36 33.7735
1.38 33.77348
1.4 33.77347
1.42 33.77347
1.44 33.77346
1.46 33.77343
1.48 33.77346
1.5 33.7734
1.52 33.77344
1.54 33.77342
1.56 33.77344
1.58 33.77337
1.6 33.77339
1.62 33.77342
1.64 33.77338
1.66 33.77342
1.68 33.77338
1.7 33.77335
1.72 33.77332
1.74 33.77333
1.76 33.77336
1.78 33.77337
1.8 33.77342
1.82 33.77336
1.84 33.77337
1.86 33.77339
1.88 33.77338
1.9 33.77331
1.92 33.77338
1.94 33.77336
1.96 33.77338
1.98 33.77337
2 33.77332
};
\end{axis}
\end{tikzpicture}
% This file was created by tikzplotlib v0.9.5.
\begin{tikzpicture}
\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
\begin{axis}[
tick align=outside,
tick pos=left,
width=\diagramwidth,
x grid style={white!69.0196078431373!black},
xlabel={time},
xmin=-0.1, xmax=2.1,
xtick style={color=black},
y grid style={white!69.0196078431373!black},
ylabel={\(\displaystyle C_l\)},
ymin=-0.23364924, ymax=0.80674044,
ytick style={color=black}
]
\addplot [semithick, color0]
table {%
0 0
0.02 -0.1863588
0.04 0.1234094
0.06 0.09407882
0.08 0.1360382
0.1 0.1649028
0.12 0.2042137
0.14 0.2451391
0.16 0.2862253
0.18 0.3247839
0.2 0.3609078
0.22 0.3944476
0.24 0.4254137
0.26 0.4539131
0.28 0.4801828
0.3 0.503981
0.32 0.5259272
0.34 0.5458478
0.36 0.5642304
0.38 0.5810589
0.4 0.5963595
0.42 0.6103708
0.44 0.6231027
0.46 0.6346435
0.48 0.6453098
0.5 0.6551357
0.52 0.6640906
0.54 0.6721629
0.56 0.67951
0.58 0.6862759
0.6 0.6925219
0.62 0.6982052
0.64 0.7034839
0.66 0.7081282
0.68 0.712406
0.7 0.7163022
0.72 0.719892
0.74 0.7232097
0.76 0.7262754
0.78 0.7291016
0.8 0.7316458
0.82 0.7339281
0.84 0.7359483
0.86 0.7378311
0.88 0.7395661
0.9 0.7412332
0.92 0.7427017
0.94 0.7440582
0.96 0.7453283
0.98 0.746477
1 0.7475447
1.02 0.7485541
1.04 0.7494714
1.06 0.7503309
1.08 0.7510937
1.1 0.7518399
1.12 0.7524253
1.14 0.7530406
1.16 0.7535617
1.18 0.7539535
1.2 0.7545097
1.22 0.7548177
1.24 0.7551769
1.26 0.7555083
1.28 0.7557617
1.3 0.7560962
1.32 0.7564223
1.34 0.7564908
1.36 0.756924
1.38 0.7571395
1.4 0.7573336
1.42 0.7575382
1.44 0.7577179
1.46 0.7578355
1.48 0.7579912
1.5 0.7581168
1.52 0.7582106
1.54 0.7584122
1.56 0.7583932
1.58 0.7585329
1.6 0.7587092
1.62 0.7587606
1.64 0.758758
1.66 0.7589603
1.68 0.7588989
1.7 0.7590338
1.72 0.7590348
1.74 0.7591256
1.76 0.7591765
1.78 0.7592255
1.8 0.7592126
1.82 0.7592747
1.84 0.7593411
1.86 0.7593243
1.88 0.7593365
1.9 0.7593759
1.92 0.7593751
1.94 0.7593911
1.96 0.7594022
1.98 0.7594174
2 0.75945
};
\end{axis}
\end{tikzpicture}
% This file was created by tikzplotlib v0.9.5.
\begin{tikzpicture}
\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
\definecolor{color1}{rgb}{1,0.498039215686275,0.0549019607843137}
\definecolor{color2}{rgb}{0.172549019607843,0.627450980392157,0.172549019607843}
\begin{axis}[
legend cell align={left},
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, draw=white!80!black},
tick align=outside,
tick pos=left,
width=\diagramwidth,
x grid style={white!69.0196078431373!black},
xlabel={time},
xmin=-0.1, xmax=2.1,
xtick style={color=black},
y grid style={white!69.0196078431373!black},
ylabel={pressure},
ymin=-1.146125, ymax=24.068625,
ytick style={color=black}
]
\addplot [semithick, color0]
table {%
0 0
0.02 22.9225
0.04 1.38537
0.06 1.11069
0.08 0.992092
0.1 0.923828
0.12 0.878548
0.14 0.846371
0.16 0.822534
0.18 0.804338
0.2 0.790059
0.22 0.778599
0.24 0.769209
0.26 0.761369
0.28 0.754732
0.3 0.74905
0.32 0.744124
0.34 0.739825
0.36 0.736025
0.38 0.732666
0.4 0.729689
0.42 0.727022
0.44 0.724631
0.46 0.722491
0.48 0.720554
0.5 0.71881
0.52 0.717233
0.54 0.715809
0.56 0.714516
0.58 0.713343
0.6 0.712277
0.62 0.71131
0.64 0.710431
0.66 0.709631
0.68 0.708901
0.7 0.708236
0.72 0.707632
0.74 0.70708
0.76 0.706577
0.78 0.706117
0.8 0.705699
0.82 0.705317
0.84 0.704967
0.86 0.704648
0.88 0.704357
0.9 0.704091
0.92 0.703848
0.94 0.703626
0.96 0.703423
0.98 0.703238
1 0.703068
1.02 0.702914
1.04 0.702772
1.06 0.702643
1.08 0.702525
1.1 0.702417
1.12 0.702318
1.14 0.702227
1.16 0.70214
1.18 0.702082
1.2 0.701996
1.22 0.701935
1.24 0.701879
1.26 0.701825
1.28 0.701776
1.3 0.701734
1.32 0.701696
1.34 0.701659
1.36 0.701623
1.38 0.701593
1.4 0.701565
1.42 0.701538
1.44 0.701517
1.46 0.701492
1.48 0.701478
1.5 0.701452
1.52 0.701449
1.54 0.701416
1.56 0.70142
1.58 0.701398
1.6 0.701384
1.62 0.701384
1.64 0.701359
1.66 0.701362
1.68 0.701353
1.7 0.701338
1.72 0.701339
1.74 0.70133
1.76 0.701326
1.78 0.70132
1.8 0.701319
1.82 0.701306
1.84 0.701307
1.86 0.701307
1.88 0.701304
1.9 0.701289
1.92 0.701293
1.94 0.701294
1.96 0.701294
1.98 0.701291
2 0.701278
};
\addlegendentry{pressure in front}
\addplot [semithick, color1]
table {%
0 0
0.02 19.7483
0.04 0.7115
0.06 0.533157
0.08 0.45074
0.1 0.399825
0.12 0.363718
0.14 0.336545
0.16 0.315446
0.18 0.298718
0.2 0.285196
0.22 0.274096
0.24 0.264852
0.26 0.257049
0.28 0.25039
0.3 0.244674
0.32 0.239704
0.34 0.235369
0.36 0.231539
0.38 0.228155
0.4 0.225162
0.42 0.222487
0.44 0.220093
0.46 0.217952
0.48 0.216017
0.5 0.214279
0.52 0.212709
0.54 0.211291
0.56 0.210005
0.58 0.208839
0.6 0.20778
0.62 0.20682
0.64 0.205946
0.66 0.205153
0.68 0.204427
0.7 0.203768
0.72 0.203167
0.74 0.202619
0.76 0.20212
0.78 0.201664
0.8 0.201248
0.82 0.200869
0.84 0.200521
0.86 0.200204
0.88 0.199915
0.9 0.199651
0.92 0.199409
0.94 0.199188
0.96 0.198987
0.98 0.198802
1 0.198634
1.02 0.19848
1.04 0.198339
1.06 0.198211
1.08 0.198093
1.1 0.197986
1.12 0.197887
1.14 0.197797
1.16 0.197711
1.18 0.197651
1.2 0.197566
1.22 0.197508
1.24 0.197451
1.26 0.197398
1.28 0.197347
1.3 0.197306
1.32 0.197268
1.34 0.197231
1.36 0.197196
1.38 0.197166
1.4 0.197138
1.42 0.197111
1.44 0.197089
1.46 0.197066
1.48 0.197051
1.5 0.197025
1.52 0.197022
1.54 0.196989
1.56 0.196993
1.58 0.196972
1.6 0.196958
1.62 0.196957
1.64 0.196932
1.66 0.196935
1.68 0.196926
1.7 0.196912
1.72 0.196914
1.74 0.196904
1.76 0.196899
1.78 0.196893
1.8 0.196892
1.82 0.19688
1.84 0.196881
1.86 0.19688
1.88 0.196877
1.9 0.196864
1.92 0.196866
1.94 0.196867
1.96 0.196867
1.98 0.196864
2 0.196853
};
\addlegendentry{pressure behind}
\addplot [semithick, color2]
table {%
0 0
0.02 3.1742
0.04 0.67387
0.06 0.577533
0.08 0.541352
0.1 0.524003
0.12 0.51483
0.14 0.509826
0.16 0.507088
0.18 0.50562
0.2 0.504863
0.22 0.504503
0.24 0.504357
0.26 0.50432
0.28 0.504342
0.3 0.504376
0.32 0.50442
0.34 0.504456
0.36 0.504486
0.38 0.504511
0.4 0.504527
0.42 0.504535
0.44 0.504538
0.46 0.504539
0.48 0.504537
0.5 0.504531
0.52 0.504524
0.54 0.504518
0.56 0.504511
0.58 0.504504
0.6 0.504497
0.62 0.50449
0.64 0.504485
0.66 0.504478
0.68 0.504474
0.7 0.504468
0.72 0.504465
0.74 0.504461
0.76 0.504457
0.78 0.504453
0.8 0.504451
0.82 0.504448
0.84 0.504446
0.86 0.504444
0.88 0.504442
0.9 0.50444
0.92 0.504439
0.94 0.504438
0.96 0.504436
0.98 0.504436
1 0.504434
1.02 0.504434
1.04 0.504433
1.06 0.504432
1.08 0.504432
1.1 0.504431
1.12 0.504431
1.14 0.50443
1.16 0.504429
1.18 0.504431
1.2 0.50443
1.22 0.504427
1.24 0.504428
1.26 0.504427
1.28 0.504429
1.3 0.504428
1.32 0.504428
1.34 0.504428
1.36 0.504427
1.38 0.504427
1.4 0.504427
1.42 0.504427
1.44 0.504428
1.46 0.504426
1.48 0.504427
1.5 0.504427
1.52 0.504427
1.54 0.504427
1.56 0.504427
1.58 0.504426
1.6 0.504426
1.62 0.504427
1.64 0.504427
1.66 0.504427
1.68 0.504427
1.7 0.504426
1.72 0.504425
1.74 0.504426
1.76 0.504427
1.78 0.504427
1.8 0.504427
1.82 0.504426
1.84 0.504426
1.86 0.504427
1.88 0.504427
1.9 0.504425
1.92 0.504427
1.94 0.504427
1.96 0.504427
1.98 0.504427
2 0.504425
};
\addlegendentry{pressure difference}
\end{axis}
\end{tikzpicture}
../..
\ No newline at end of file
#! /usr/bin/env python3
import os.path
import matplotlib as plotting
import matplotlib.pyplot as pyplot
import tikzplotlib
PATH_DATA = ".maindir/openfoam/run/flowAroundCylinder/postProcessing"
SUBPATH_PROBES = "probes/0/p"
SUBPATH_FORCE_COEFFS = "forceCoeffsIncompressible/0/forceCoeffs_0.dat"
if not os.path.isfile(SUBPATH_FORCE_COEFFS):
SUBPATH_FORCE_COEFFS = "forceCoeffsIncompressible/0/forceCoeffs.dat"
PATH_DIAGRAMS = ".maindir/zeichnungen/unsteady_"
DIAGRAM_WIDTH = r'\diagramwidth'
labels = {'Cd': '$C_d$',
'Cl(f)': '$C_l(f)$',
'Cl(r)': '$C_l(r)$',
'Cl': '$C_l$',
'Cm': '$C_m$',
'0': 'pressure in front',
'1': 'pressure behind',
'p_diff': 'pressure difference'}
def read_file(subpath):
with open(os.path.join(PATH_DATA, subpath)) as data_file:
return data_file.readlines()
def read(subpath):
lines = read_file(subpath)
column_names = []
columns = {}
times = []
for line in lines:
line = line.split()
if line[0] == "#" and line[1] == "Time":
# header end
column_names = line[2:]
columns = {name: [] for name in line[2:]}
continue
if line[0].startswith("#"):
# comment, ignore
continue
times.append(float(line[0]))
assert len(line[1:]) == len(column_names)
for value, name in zip(line[1:], column_names):
columns[name].append(float(value))
if '0' in column_names:
# pressure
columns['p_diff'] = [p0 - p1 for p0, p1 in zip(
columns['0'], columns['1'])]
assert 'p_diff' in columns
assert columns['p_diff'][1] == columns['0'][1] - columns['1'][1]
return times, columns
def create_diagrams(subpath):
times, forces = read(subpath)
for force in forces:
fig = pyplot.figure()
axis = pyplot.axes()
axis.set_xlabel('time')
axis.set_ylabel(labels[force] if force in labels else force)
axis.plot(times, forces[force])
tikzplotlib.save(figure=fig, filepath=(
PATH_DIAGRAMS + force.replace('(', "_").replace(')', '') + ".tex"),
axis_width=DIAGRAM_WIDTH
)
def create_both_pressures_diagram():
times, pressures = read(SUBPATH_PROBES)
fig = pyplot.figure()
axis = pyplot.axes()
axis.set_xlabel('time')
axis.set_ylabel('pressure')
for location in pressures:
axis.plot(times, pressures[location], label=labels[location])
axis.legend()
tikzplotlib.save(figure=fig, filepath=(
PATH_DIAGRAMS + "bothpressures.tex"),
axis_width=DIAGRAM_WIDTH
)
if __name__ == "__main__":
for subpath in [SUBPATH_PROBES, SUBPATH_FORCE_COEFFS]:
create_diagrams(subpath)
create_both_pressures_diagram()
\ No newline at end of file
name: diagrams
channels:
- conda-forge
- defaults
dependencies:
- matplotlib
- tikzplotlib
- pylint
% This file was created by tikzplotlib v0.9.5.
\begin{tikzpicture}
\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
\begin{axis}[
tick align=outside,
tick pos=left,
width=\diagramwidth,
x grid style={white!69.0196078431373!black},
xlabel={time},
xmin=-0.1, xmax=2.1,
xtick style={color=black},
y grid style={white!69.0196078431373!black},
ylabel={\(\displaystyle C_d\)},
ymin=-39.47507, ymax=828.97647,
ytick style={color=black}
]
\addplot [semithick, color0]
table {%
0 0
0.02 789.5014
0.04 236.3813
0.06 218.9936
0.08 214.9845
0.1 215.2578
0.12 216.4869
0.14 217.6785
0.16 218.5619
0.18 219.1342
0.2 219.4684
0.22 219.6431
0.24 219.7206
0.26 219.7438
0.28 219.738
0.3 219.7189
0.32 219.6944
0.34 219.6698
0.36 219.6464
0.38 219.6263
0.4 219.6084
0.42 219.5936
0.44 219.5808
0.46 219.5703
0.48 219.5614
0.5 219.554
0.52 219.5482
0.54 219.5429
0.56 219.5389
0.58 219.5356
0.6 219.5328
0.62 219.5306
0.64 219.529
0.66 219.5285
0.68 219.5262
0.7 219.5257
0.72 219.5239
0.74 219.5232
0.76 219.5226
0.78 219.5219
0.8 219.5216
0.82 219.5211
0.84 219.5209
0.86 219.5207
0.88 219.5204
0.9 219.5205
0.92 219.5205
0.94 219.5205
0.96 219.5199
0.98 219.5198
1 219.5194
1.02 219.5202
1.04 219.5194
1.06 219.5201
1.08 219.5192
1.1 219.5198
1.12 219.5188
1.14 219.5196
1.16 219.5195
1.18 219.5195
1.2 219.5198
1.22 219.52
1.24 219.5177
1.26 219.5197
1.28 219.5193
1.3 219.5195
1.32 219.5193
1.34 219.5201
1.36 219.5194
1.38 219.5191
1.4 219.52
1.42 219.5193
1.44 219.5192
1.46 219.5201
1.48 219.5197
1.5 219.52
1.52 219.5193
1.54 219.5193
1.56 219.5199
1.58 219.5193
1.6 219.5193
1.62 219.5199
1.64 219.5192
1.66 219.5195
1.68 219.5195
1.7 219.5195
1.72 219.5198
1.74 219.5198
1.76 219.5192
1.78 219.5198
1.8 219.5191
1.82 219.5195
1.84 219.5199
1.86 219.5197
1.88 219.519
1.9 219.5199
1.92 219.5194
1.94 219.5193
1.96 219.5196
1.98 219.5197
2 219.5195
};
\end{axis}
\end{tikzpicture}
% This file was created by tikzplotlib v0.9.5.
\begin{tikzpicture}
\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
\begin{axis}[
tick align=outside,
tick pos=left,
width=\diagramwidth,
x grid style={white!69.0196078431373!black},
xlabel={time},
xmin=-0.1, xmax=2.1,
xtick style={color=black},
y grid style={white!69.0196078431373!black},
ylabel={\(\displaystyle C_l\)},
ymin=-1.112262555, ymax=3.597331455,
ytick style={color=black}
]
\addplot [semithick, color0]
table {%
0 0
0.02 -0.8981901
0.04 1.256867
0.06 0.9424931
0.08 1.647092
0.1 2.136435
0.12 2.566036
0.14 2.905005
0.16 3.151565
0.18 3.30243
0.2 3.375302
0.22 3.383259
0.24 3.344645
0.26 3.276882
0.28 3.192982
0.3 3.103313
0.32 3.015669
0.34 2.934623
0.36 2.863616
0.38 2.804236
0.4 2.755998
0.42 2.717531
0.44 2.689207
0.46 2.66866
0.48 2.655653
0.5 2.647903
0.52 2.643603
0.54 2.64327
0.56 2.644141
0.58 2.647521
0.6 2.650778
0.62 2.654732
0.64 2.658047
0.66 2.66263
0.68 2.665112
0.7 2.668556
0.72 2.671052
0.74 2.673085
0.76 2.674883
0.78 2.676424
0.8 2.677434
0.82 2.678341
0.84 2.678924
0.86 2.679055
0.88 2.679194
0.9 2.679188
0.92 2.679272
0.94 2.678959
0.96 2.679065
0.98 2.678553
1 2.678814
1.02 2.678689
1.04 2.678063
1.06 2.677959
1.08 2.677741
1.1 2.677616
1.12 2.67746
1.14 2.676956
1.16 2.677278
1.18 2.677038
1.2 2.677025
1.22 2.676952
1.24 2.676816
1.26 2.676848
1.28 2.676867
1.3 2.677162
1.32 2.676602
1.34 2.676445
1.36 2.676595
1.38 2.676777
1.4 2.676715
1.42 2.676452
1.44 2.676899
1.46 2.676888
1.48 2.676827
1.5 2.676702
1.52 2.676499
1.54 2.676795
1.56 2.677019
1.58 2.677293
1.6 2.676984
1.62 2.67662
1.64 2.676055
1.66 2.676591
1.68 2.67703
1.7 2.676929
1.72 2.676792
1.74 2.676577
1.76 2.67704
1.78 2.677008
1.8 2.676867
1.82 2.676932
1.84 2.676898
1.86 2.676948
1.88 2.676882
1.9 2.676917
1.92 2.676799
1.94 2.676747
1.96 2.676662
1.98 2.677209
2 2.67656
};
\end{axis}
\end{tikzpicture}
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment