# commercial and/or for-profit applications. ################################################################################ #!/usr/bin/env python # bluebottle_reader python module example code import sys, getopt import numpy as np import bluebottle_flow_reader as bbflow # initialize the reader times = bbflow.init("~/scratch/tmp-cgns") # Pull grid positions (x, y, z) = bbflow.read_flow_position() # visit all outputted time values for time in times: # open the CGNS file for this particular output time bbflow.open(time) # read the CGNS file t = bbflow.read_time() (u, v, w) = bbflow.read_flow_velocity() print("t =", t) # close the CGNS file bbflow.close()
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() times = bbparts.init(data_dir) timesf = bbflow.init(data_dir) bbflow.open(timesf[0]) rho,nu = bbflow.read_flow_params() bbflow.close() bbparts.open(times[0]) nparts = bbparts.read_nparts() bbparts.close() vel = np.zeros((len(times), nparts)) zvel = np.zeros((len(times), nparts)) t = np.zeros(len(times)) Rep = np.zeros((len(times), nparts)) r = np.zeros(nparts) for tt,time in enumerate(times): bbparts.open(time)