x_source = numpy.loadtxt('resources\\NACA0012_x.txt') y_source = numpy.loadtxt('resources\\NACA0012_y.txt') strength_source = numpy.loadtxt('resources\\NACA0012_sigma.txt') U = 1.0 # freestream # computes stream-function and velocity field psi, u, v = 0, 0, 0 for i in range(len(x_source)): psi += pblocks.get_stream_function_source(strength_source[i], x_source[i], y_source[i], X, Y) u_s, v_s = pblocks.get_velocity_source(strength_source[i], x_source[i], y_source[i], X, Y) u += u_s v += v_s psi += pblocks.get_stream_function_freestream(U, 0., X, Y) u_stream, v_stream = pblocks.get_velocity_freestream(U, 0., X, Y) u += u_stream v += v_stream # computes the pressure coefficient field cp = 1.0 - (u**2 + v**2)/U**2 ############################## # plotting the streamlines size = 10 pyplot.figure(figsize=(size, (y_end-y_start)/(x_end-x_start)*size)) pyplot.xlabel('x', fontsize=16) pyplot.ylabel('y', fontsize=16) pyplot.xlim(x_start, x_end) pyplot.ylim(y_start, y_end)
Z_c = Jouk_transform(c, Z) X_c = Z_c.real Y_c = Z_c.imag # pyplot.scatter(X_c, Y_c, s=1) # freestream u_inf = 1.0 AoA = 20.0 / 180 * math.pi # rotate mesh Z_dash = rotate(xc, yc, AoA, Z) X_dash = Z_dash.real Y_dash = Z_dash.imag # pyplot.scatter(X_dash, Y_dash, s=1) psi_stream = pblocks.get_stream_function_freestream(u_inf, 0.0, X_dash, Y_dash) u_stream, v_stream = pblocks.get_velocity_freestream(u_inf, 0.0, X_dash, Y_dash) # dublet strength = R ** 2 * u_inf * 2 * math.pi print("strength = ", strength) psi_dublet = pblocks.get_stream_function_doublet(strength, 0.0, 0.0, X_dash, Y_dash) u_dublet, v_dublet = pblocks.get_velocity_doublet(strength, 0.0, 0.0, X_dash, Y_dash) # vortex gamma = 4 * math.pi * R * u_inf * math.sin(AoA) print("gamma = ", gamma) psi_vortex = pblocks.get_stream_function_vortex(gamma, 0, 0.0, X_dash, Y_dash) u_vortex, v_vortex = pblocks.get_velocity_vortex(gamma, 0, 0.0, X_dash, Y_dash) psi = psi_stream + psi_dublet + psi_vortex