if len(sys.argv) >= 2: # output directory given data_dir = sys.argv[1] if len(sys.argv) >= 3: # start time given t_start = sys.argv[2] 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)
#timestart = 20 timestart = 0 DT_out = 0.01 ############################################################ # visit each realization to find minimum simulation duration ############################################################ # maximum time of shortest realization t_end = 10e10; # 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
# limitations under the License. # # Please contact the Johns Hopkins University to use Bluebottle for # commercial and/or for-profit applications. ################################################################################ #!/usr/bin/env python # bluebottle_particle_reader python module example code import sys, getopt import numpy as np import bluebottle_particle_reader as bbparts # initialize the reader times = bbparts.init("~/bluebottle/sim/output") # 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)
#!/usr/bin/env python # bluebottle_particle_reader python module example code import sys, getopt import numpy as np import bluebottle_particle_reader as bb # initialize the reader times = bb.init("/home/asiera/bluebottle/sim/output") # visit all outputted time values for time in times: # open the CGNS file for this particular output time bb.open(time) # read the CGNS file t = bb.read_time() (x,y,z) = bb.read_part_position() (u,v,w) = bb.read_part_velocity() print("t =", t) # close the CGNS file bb.close()
# get all base directories ensemble = glob.glob("/scratch/users/[email protected]/shear-laura/*") #ensemble = glob.glob("/scratch/users/[email protected]/shear-laura-test/*") ############################################################ # visit each realization to find minimum simulation duration ############################################################ # maximum time of shortest realization t_end = 10e10; # number of time outputs nt = 0; for realization in ensemble: timeseries = bb.init(realization + "/output") # 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 = 5000 #t_end = 50.0