Advertisement
UF6

Untitled

UF6
Jul 14th, 2020
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. import yt
  2. import glob
  3. from yt.analysis_modules.particle_trajectories.api import ParticleTrajectories
  4.  
  5. # If your particles are separate from your grid data, you have to do this:
  6.  
  7. f_plts = glob.glob("/work/02418/rkashyap/flash4/super3D/run_89_small/super3d_hdf5_plt_cnt_0[0-2][0-9][0-9]")
  8. f_plts.sort()
  9.  
  10. f_parts = glob.glob("/work/02418/rkashyap/flash4/super3D/run_89_small/super3d_hdf5_part_0[0-2][0-9][0-9]")
  11. f_parts.sort()
  12.  
  13. fields = ["particle_dens","particle_temp","particle_pres","particle_ni56","particle_velocity_x", "particle_velocity_y", "particle_velocity_z"]
  14.  
  15. #fields = ["particle_dens","particle_velocity_x", "particle_velocity_y", "particle_velocity_z"]
  16.  
  17. indices = [1,2,3,67537,35164,64875]
  18.  
  19. #indices = [64875]
  20.  
  21. pfs = []
  22.  
  23. for f_plt, f_part in zip(f_plts, f_parts):
  24. pfs.append(yt.load(f_plt, particle_filename=f_part))
  25.  
  26. ts = yt.DatasetSeries(pfs)
  27.  
  28. trajs = ParticleTrajectories(ts, indices, fields=fields)
  29.  
  30.  
  31. # If your particles are in the same HDF5 file as your grid data,
  32. # you can call ParticleTrajectories like this:
  33. # trajs = ParticleTrajectories(filenames, indices, fields=fields)
  34. # without having to load each one up as above--it will do it for you.
  35.  
  36. trajs.write_out_h5("super3D_89_trajectories.h5") # This will write all trajectories to a single file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement