Updated animation with new data format

This commit is contained in:
Edgar P. Burkhart 2022-01-23 10:04:30 +01:00
parent 2503e8dfae
commit cae6780831
Signed by: edpibu
GPG Key ID: 9833D3C5A25BD227
3 changed files with 33 additions and 7 deletions

1
post_process/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/out

View File

@ -41,7 +41,8 @@ def animate(config_path):
if item.is_dir() and re.match(r'^[0-9]+(\.[0-9]+)?$', item.name):
t.append(item.name)
timesteps = pd.Series(t, dtype='string', name='t')
timesteps = pd.Series(t, dtype='string', name='t')\
.sort_values(key=np.float64)
log.info('Reading mesh')
fluidfoam_log = StringIO()
@ -60,10 +61,15 @@ def animate(config_path):
alpha_water['x'] = mesh[0]
alpha_water['y'] = mesh[2]
bathy = pd.read_hdf(
config['bathy']['path'],
'bathy',
)
with pd.HDFStore(
config['data']['path'],
mode='r',
) as hdf:
bathy = hdf.get('bathy')
rubble = hdf.get('rubble')
blocs = {}
for bloc in config['data']['blocs'].split(','):
blocs[bloc] = hdf.get(bloc)
log.info('Starting plot')
fig, ax = plt.subplots(figsize=(19.2,10.8), dpi=100)
@ -76,6 +82,23 @@ def animate(config_path):
color='k',
zorder=10
),
ax.fill_between(
rubble.index,
rubble,
rubble.min(),
color='k',
alpha=.1,
lw=2,
zorder=11
),
*[
ax.fill(
bloc.index,
bloc,
color='k',
zorder=12
) for bloc in blocs.values()
]
]
log.info('Generating artists')
@ -110,6 +133,6 @@ def animate(config_path):
blit=True,
repeat=True
)
ani.save('anim.mp4')
ani.save(config['main']['out'])
log.info('Program ended successfully')

View File

@ -1,6 +1,8 @@
[main]
logging = INFO
root = /home/masterccce/OpenFOAM/work/artha
out = out/anim.mp4
[bathy]
[data]
path = ../bathymetry/3_pd/data.hdf
blocs = bloc0,bloc1