Esempio n. 1
0
else:  # nothing given
    print("read_parts error: Invalid commandline arguments.")
    print("Usage: ")
    print("   ./read_parts.py <./path/to/sim/output> <start_time>")
    print(" or")
    print("   ./read_parts.py <./path/to/sim/output>")
    sys.exit()

# initialize the reader
times = bbparts.init(data_dir)

# visit all outputted time values
for time in times:
    # open the CGNS file for this particular output time
    bbparts.open(time)

    # read the CGNS file
    t = bbparts.read_time()
    n = bbparts.read_nparts()
    (x, y, z) = bbparts.read_part_position()
    (u, v, w) = bbparts.read_part_velocity()

    print("time = ", time, "t =", t, "n =", n)

    print(u)
    sys.exit()

    # close the CGNS file
    bbparts.close()
Esempio n. 2
0
# number of time outputs
nt = 0;

for realization in ensemble:
  timeseries = bb.init(realization + "/output")[int(timestart/DT_out):]

  # open final output in timeseries and read time for comparison
  bb.open(timeseries[-1])
  t_tmp = bb.read_time()
  if t_tmp < t_end:
    t_end = t_tmp
    nt = len(timeseries)

  # close this output
  bb.close()

# overwrite number of time outputs to read (for testing)
#nt = 300
#t_end = 3

####################################################################
# store particle position data at initial time t_init
####################################################################

timeseries = bb.init(ensemble[0] + "/output")[int(timestart/DT_out):]
bb.open(timeseries[0])  # using time step 0 for now
(X_init, Y_init, Z_init) = bb.read_part_position()
T_init = bb.read_time()
np = len(X_init)  # also store particle number
bb.close()