from math import sqrt # nb = 28 pick_list = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26] # surface rho_inf = 6.081e-4 # kg/m**3 p_inf = 18.55 # Pa u_inf = 2576.0 # m/s T_inf = 102.2 # K T_wall = 295.8 # K from cfpylib.gasdyn import sutherland mu_inf = sutherland.mu(T_inf, 'N2') mm = 0.001 # metres corner1 = Vector(92.08, 42.94) * mm corner2 = Vector(153.69, 130.925) * mm # grid, flow, dim = read_all_blocks(job, nb, tindx, zipFiles=True) print "Compute properties for cell-centres along the surface" outfile = open("surface.data", "w") outfile.write( "# x(m) s(m) tau_w(Pa) Cf Cf_blasius y_plus p(Pa) Cp q(W/m**2) Ch\n") for ib in pick_list: j = 0 # surface is along the South boundary k = 0 # of a 2D grid print "# start of block" for i in range(flow[ib].ni): # Cell closest to surface x = flow[ib].data['pos.x'][i, j, k] y = flow[ib].data['pos.y'][i, j, k] ctr = Vector(x, y) # Get vertices on surface, for this cell. x = grid[ib].x[i, j, k]
key = "massf[%i]-%s" % (isp, speciesList[isp]) blk.data[key][i, j, k] = mf return if __name__ == '__main__': if len(sys.argv) != 3: print_usage() sys.exit(1) print "add-mass-fractions : Adding mass fractions to equilibrium air simulation." job = sys.argv[1] tindx = int(sys.argv[2]) final_tindx, times_dict = read_time_indices(job) print "Reading flow data." grid, flow, dimensions = read_all_blocks(job, nblocks, tindx, True, False) print "Done." print "Adding mass fractions using CEA." for blk in flow: add_mass_fractions_to_block(blk) print "Done." print "Writing out Tecplot file." write_Tecplot_file(job, tindx, nblocks, grid, flow, times_dict[tindx]) print "Done." print "add-mass-fractions : Done."