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('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): vs[i] = cfd.safe_log10(vs[i])