Updated post_process scripts

This commit is contained in:
Edgar P. Burkhart 2022-02-01 01:21:42 +01:00
parent 028b9db8b7
commit 14bd508058
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
4 changed files with 29 additions and 11 deletions

View file

@ -14,5 +14,5 @@ parser.add_argument('-l', '--log-level', default='INFO', type=str,
args = parser.parse_args()
if args.var == 'alpha.water':
import alpha_water
from . import alpha_water
alpha_water.animate(args.config, args.log_level)

View file

@ -0,0 +1,8 @@
[main]
root = ~/OpenFOAM/work/artha_4_04/
out = out/anim.mp4
#log_file = openfoam.log
[data]
path = ../bathymetry/3_pd/data.hdf
blocs = bloc0,bloc1

BIN
post_process/local.p.hdf Normal file

Binary file not shown.

View file

@ -44,6 +44,7 @@ if config.getboolean('main', 'loaddata', fallback=False):
with ThreadPool(
config.getint('main', 'nthreads', fallback=1)
) as pool:
if config.getboolean('sensor', 'vector', fallback=False):
sensor = dict(zip(timesteps, pool.map(
lambda t:np.apply_along_axis(
lambda x:np.sqrt((x**2).sum()),
@ -56,6 +57,15 @@ if config.getboolean('main', 'loaddata', fallback=False):
),
timesteps.index
)))
else:
sensor = dict(zip(timesteps, pool.map(
lambda t:fluidfoam.readscalar(
root.joinpath(case),
t,
config.get('sensor', 'value')
),
timesteps.index
)))
hdf.put(case, pd.DataFrame(sensor))
del sensor
@ -75,7 +85,7 @@ with pd.HDFStore(
mesh = data.get('mesh')
rawxs = config.get('sensor', 'x').split(',')
fig, ax = plt.subplots(len(rawxs))
figmax = config.getfloat('figure', 'max')
figmax = config.getfloat('figure', 'max', fallback=None)
for axi, rawx in zip(ax, rawxs):
x0 = float(rawx)
y0 = rubble_line.iloc[np.abs(x0-rubble_line.index).argmin()]
@ -107,7 +117,7 @@ with pd.HDFStore(
axi.grid()
axi.set(
xlabel='t (s)',
ylabel='U (m/s)',
ylabel=config.get('figure', 'ylabel', fallback=''),
xlim=(0,timesteps.max()),
ylim=(0,figmax),
)