read output files
-
hi
after simulation completed saved files :
input.h5
output.h5i want to use python to read the output data voltages x,y,z as generated after simulation completed
-
Hi,
I would recommend to perform the postprocessing in the GUI first, then right-click in the Explorer window of the Analysis tab and select "To-Python" in the context menu. This will generate a script (visible in the Scripter window) that reproduces your postprocessing pipeline. You can then modify the script to your liking. -
solved with h5py read :
import h5pywith h5py.File(fname,'r') as hdf:
FieldGroups=hdf['FieldGroups']
keygroup = list(FieldGroups.keys())
valField = FieldGroups[keygroup[0]]
AllFields = valField['AllFields']
EMPotential = AllFields['EM Potential(x,y,z,f0)']
EMPotentialObject = EMPotential['_Object']
AdditionalFieldDataCollection =
EMPotentialObject['AdditionalFieldDataCollection']
Snapshots = EMPotentialObject['Snapshots']
Potential = Snapshots['0']['comp0']#(n, m, k, 2) numpy array PotentialData = Potential[()]
==========
this can be plotted
import pyvista as pv