Closed aguitton closed 2 years ago
Please specify the workflow used to generate your plots and post any custom post-processing scripts used.
Here is the python code for plotting the results.
import numpy as np
import math
import h5py
import scipy.ndimage as nd
import matplotlib.pyplot as plt
from matplotlib import rcParams
import ipywidgets as widgets
f=h5py.File('pressure_history-awe1.hdf5')
p=np.array(f['pressure_np1'])
f.close()
p=np.reshape(p,(60,101,101,101))
%matplotlib inline
d=p
dt=0.0005
ix=51
iy=51
iz=51
vmax=0.05
nt=d.shape[0]
nx=d.shape[1]
ny=d.shape[2]
nz=d.shape[3]
ixmin=15
ixmax=nx-1-ixmin
iymin=15
iymax=ny-1-iymin
izmin=15
izmax=nz-1-izmin
def plotWfld(d,it,output="figure",save=False):
time=it*dt
plt.figure(figsize=(16,6))
plt.subplot(1,3,1)
plt.imshow(np.transpose(d[it,ix,:,:]),vmin=-vmax,vmax=vmax,cmap='seismic')
#plt.hlines((izmin,izmax),iymin,iymax,LineStyle='--')
#plt.vlines((iymin,iymax),izmin,izmax,LineStyle='--')
plt.xlabel("Y")
plt.ylabel("Z")
plt.title(r"X-slice @ %0.2f sec" %time)
plt.subplot(1,3,2)
plt.imshow(np.transpose(d[it,:,iy,:]),vmin=-vmax,vmax=vmax,cmap='seismic')
#plt.hlines((izmin,izmax),ixmin,ixmax,LineStyle='--')
#plt.vlines((ixmin,ixmax),izmin,izmax,LineStyle='--')
plt.xlabel("X")
plt.ylabel("Z")
plt.title(r"Y-slice @ %0.2f sec" %time)
plt.subplot(1,3,3)
plt.imshow(np.transpose(d[it,:,:,iz]),vmin=-vmax,vmax=vmax,cmap='seismic')
#plt.hlines((iymin,iymax),ixmin,ixmax,LineStyle='--')
#plt.vlines((ixmin,ixmax),iymin,iymax,LineStyle='--')
plt.xlabel("X")
plt.ylabel("Y")
plt.title(r"Z-slice @ %0.2f sec" %time)
plt.tight_layout()
if save==True:
plt.savefig("./fig/"+output+"_%d" %it)
widgets.interact(plotWfld, d=widgets.fixed(d), it=(0,nt-1,1))
The TimeHistory hd5f output isn't implicitly structured based on the mesh, which this post-processing script seems to presuppose. The output file should include multiple data sets including -- when collecting from mesh entities -- coordinate information. This information needs to be used to plot data spatially.
Since the TimeHistory output is focused only on extracting information at the lowest-level possible, no restructuring or post-processing is done internally.
I'm closing this as "Not Planned" for now. If you use the nodal coordinate information and still have any issues with the output in parallel feel free to update / reopen this issue.
@jhuang2601 You used to consider TimeHistory
with locations of a fracture.
Do you think your XP could help there?
@aguitton Using the following way, you might be able to get the nodal coordinate information directly from HDF5 file, as @wrtobin mentioned
f = h5py.File(pressure_history-awe1.hdf5, 'r')
xl_elm = f.get('pressure_np1 elementCenter')
xl_elm = np.array(xl_elm)
xcord_elm = xl_elm[0, :, 0]
ycord_elm = xl_elm[0, :, 1]
zcord_elm = xl_elm[0, :, 2]
Great! Thank you @jhuang2601 and all. Will try that...
I tried @jhuang2601's suggestion but the hdf5 doesn't contain the coordinates of the elements, only the values of the wavefields at the assigned time steps.
Please h5ls
the file and provide the names of the datasets in the file. Note if you're collecting a nodal quantity it won't have element centers, only nodal coordinates.
Got it. I didn't know about h5ls. I have coordinates now. Thank you @wrtobin
Was able to reorder the array thanks to the coordinates and I get the correct wavefield.
Describe the bug When running an acoustic simulation in parallel, the wavefields saved in the hdf5 are not reassembled correctly. The information is in the hdf5 but at the wrong spatial locations. Running on one node yields the correct result.
To Reproduce On sherlock (Stanford):
sbatch slurm_run.sh
with slurm_run.shwhere to_source_gpu is
and awe.xml is
Screenshots
These are time slices of the wavefield generated in a constant velocity medium
Running on four nodes
Running on one node
Platform (please complete the following information):