Updated post_process scripts
This commit is contained in:
parent
028b9db8b7
commit
14bd508058
4 changed files with 29 additions and 11 deletions
|
@ -14,5 +14,5 @@ parser.add_argument('-l', '--log-level', default='INFO', type=str,
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.var == 'alpha.water':
|
if args.var == 'alpha.water':
|
||||||
import alpha_water
|
from . import alpha_water
|
||||||
alpha_water.animate(args.config, args.log_level)
|
alpha_water.animate(args.config, args.log_level)
|
||||||
|
|
8
post_process/config.anim.ini
Normal file
8
post_process/config.anim.ini
Normal 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
BIN
post_process/local.p.hdf
Normal file
Binary file not shown.
|
@ -44,18 +44,28 @@ if config.getboolean('main', 'loaddata', fallback=False):
|
||||||
with ThreadPool(
|
with ThreadPool(
|
||||||
config.getint('main', 'nthreads', fallback=1)
|
config.getint('main', 'nthreads', fallback=1)
|
||||||
) as pool:
|
) as pool:
|
||||||
sensor = dict(zip(timesteps, pool.map(
|
if config.getboolean('sensor', 'vector', fallback=False):
|
||||||
lambda t:np.apply_along_axis(
|
sensor = dict(zip(timesteps, pool.map(
|
||||||
lambda x:np.sqrt((x**2).sum()),
|
lambda t:np.apply_along_axis(
|
||||||
0,
|
lambda x:np.sqrt((x**2).sum()),
|
||||||
fluidfoam.readvector(
|
0,
|
||||||
|
fluidfoam.readvector(
|
||||||
|
root.joinpath(case),
|
||||||
|
t,
|
||||||
|
config.get('sensor', 'value')
|
||||||
|
),
|
||||||
|
),
|
||||||
|
timesteps.index
|
||||||
|
)))
|
||||||
|
else:
|
||||||
|
sensor = dict(zip(timesteps, pool.map(
|
||||||
|
lambda t:fluidfoam.readscalar(
|
||||||
root.joinpath(case),
|
root.joinpath(case),
|
||||||
t,
|
t,
|
||||||
config.get('sensor', 'value')
|
config.get('sensor', 'value')
|
||||||
),
|
),
|
||||||
),
|
timesteps.index
|
||||||
timesteps.index
|
)))
|
||||||
)))
|
|
||||||
|
|
||||||
hdf.put(case, pd.DataFrame(sensor))
|
hdf.put(case, pd.DataFrame(sensor))
|
||||||
del sensor
|
del sensor
|
||||||
|
@ -75,7 +85,7 @@ with pd.HDFStore(
|
||||||
mesh = data.get('mesh')
|
mesh = data.get('mesh')
|
||||||
rawxs = config.get('sensor', 'x').split(',')
|
rawxs = config.get('sensor', 'x').split(',')
|
||||||
fig, ax = plt.subplots(len(rawxs))
|
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):
|
for axi, rawx in zip(ax, rawxs):
|
||||||
x0 = float(rawx)
|
x0 = float(rawx)
|
||||||
y0 = rubble_line.iloc[np.abs(x0-rubble_line.index).argmin()]
|
y0 = rubble_line.iloc[np.abs(x0-rubble_line.index).argmin()]
|
||||||
|
@ -107,7 +117,7 @@ with pd.HDFStore(
|
||||||
axi.grid()
|
axi.grid()
|
||||||
axi.set(
|
axi.set(
|
||||||
xlabel='t (s)',
|
xlabel='t (s)',
|
||||||
ylabel='U (m/s)',
|
ylabel=config.get('figure', 'ylabel', fallback=''),
|
||||||
xlim=(0,timesteps.max()),
|
xlim=(0,timesteps.max()),
|
||||||
ylim=(0,figmax),
|
ylim=(0,figmax),
|
||||||
)
|
)
|
||||||
|
|
Reference in a new issue