def minmax(cfdfile, coolfile): ### Get data cfd = TorchCFD(cfdfile) cool = TorchCool(coolfile) nh = cfd.get_var('nh') tem = cfd.get_var('tem') crate = cool.get_var('cool') L = np.absolute(cool.get_var('lcool')/(nh*nh)) E = 1.5*nh*1.3806488e-16*tem with np.errstate(divide='ignore', over='ignore'): dt = E / np.absolute(crate) / 3.15569e7 dt[crate == 0] = 1e10 return [nh.min(), tem.min(), E.min(), L.min(), dt.min(), nh.max(), tem.max(), E.min(), L.max(), dt.max()]
plt.rc('xtick',**{'labelsize':6}) plt.rc('ytick',**{'labelsize':6}) fformat = 'jpg' log = True ### Parse arguements parser = argparse.ArgumentParser(description='Plots 2D image of CFD cooling data.') parser.add_argument('cfdfile', metavar='cfdfile', type=str, help='CFD file to produce image.') parser.add_argument('coolfile', metavar='coolfile', type=str, help='Cooling file to produce image.') args = parser.parse_args() outputfile = os.path.splitext(args.cfdfile)[0] + '.' + fformat ### Data set up. cfd = TorchCFD(args.cfdfile, axial=True) cool = TorchCool(args.coolfile, axial=True) nh = cfd.get_var('nh') tem = cfd.get_var('tem') crate = cool.get_var('cool') L = np.absolute(cool.get_var('lcool')/(nh*nh)) E = 1.5*nh*1.3806488e-16*tem with np.errstate(divide='ignore', over='ignore'): dt = E / np.absolute(crate) / 3.15569e7 dt[crate == 0] = 1e10 dt[~np.isfinite(dt)] = 1e10 L[dt > 20] = L[dt < 20].min() vs = [nh, tem, L, dt] for i in range(3):
help='Input directory with CFD output data.') args = parser.parse_args() input_dir = args.input_dir if not input_dir.endswith('/'): input_dir += '/' input_regex = input_dir + '*.txt' time = [] radius = [] for inputfile in glob.iglob(input_regex): ### Data set up. torchData = TorchCFD(inputfile, axial=True) den = torchData.get_var('den') deni = torchData.interpolate(den, 'nearest') ### Find bubble radius. index = 0 max_den = 0 for i in range(11, torchData.nx): if deni[i,0] > max_den: index = i max_den = deni[i,0] time.append(t) radius.append(torchData.xi[0, index]) zipped = zip(time, radius) zipped.sort()