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()
|
||||
|
||||
if args.var == 'alpha.water':
|
||||
import alpha_water
|
||||
from . import alpha_water
|
||||
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(
|
||||
config.getint('main', 'nthreads', fallback=1)
|
||||
) as pool:
|
||||
sensor = dict(zip(timesteps, pool.map(
|
||||
lambda t:np.apply_along_axis(
|
||||
lambda x:np.sqrt((x**2).sum()),
|
||||
0,
|
||||
fluidfoam.readvector(
|
||||
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()),
|
||||
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),
|
||||
t,
|
||||
config.get('sensor', 'value')
|
||||
),
|
||||
),
|
||||
timesteps.index
|
||||
)))
|
||||
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),
|
||||
)
|
||||
|
|
Reference in a new issue