diff --git a/post_process/.gitignore b/post_process/.gitignore new file mode 100644 index 0000000..e2e7327 --- /dev/null +++ b/post_process/.gitignore @@ -0,0 +1 @@ +/out diff --git a/post_process/animate/alpha_water.py b/post_process/animate/alpha_water.py index 7ffb016..1953c4b 100644 --- a/post_process/animate/alpha_water.py +++ b/post_process/animate/alpha_water.py @@ -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') diff --git a/post_process/config.ini b/post_process/config.ini index a81ec51..be7d9c9 100644 --- a/post_process/config.ini +++ b/post_process/config.ini @@ -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