def test_induced_velocity(): P1, P2 = np.array([1, 0]), np.array([0, 0]) P3, P4 = np.array([0, 1]), np.array([1, 1]) panel = Panel(P1, P2, P3, P4) CP = panel.control_point() calculated_induced_velocity = panel.induced_velocity(CP) expected_induced_velocity = -0.7684680 assert_almost_equal(calculated_induced_velocity, expected_induced_velocity)
for i in range(0, n): for j in range(0, m): P1 = np.array([x[i + 1], y[j]]) P2 = np.array([x[i], y[j]]) P3 = np.array([x[i], y[j + 1]]) P4 = np.array([x[i + 1], y[j + 1]]) panel_pivot = Panel(P1, P2, P3, P4) s = panel_pivot.area() CP = panel_pivot.control_point() # print(P1, P2, P3, P4) print('---- Induced vel. on panel %s...' % k) # print('area = ', s, 'control point = ', CP) kk = 0 for ii in range(0, n): for jj in range(0, m): PP1 = np.array([x[ii + 1], y[jj]]) PP2 = np.array([x[ii], y[jj]]) PP3 = np.array([x[ii], y[jj + 1]]) PP4 = np.array([x[ii + 1], y[jj + 1]]) panel = Panel(PP1, PP2, PP3, PP4) w = panel.induced_velocity(CP) print(' ...by panel %s = %s' % (kk, w)) A[k, kk] = w kk += 1 k += 1 np.set_printoptions(precision=4) print() print('Matrix A =') print(A)
P3 = np.array([0, 0]) P4 = np.array([0, b / 2]) P5 = np.array([c, b / 2]) P6 = np.array([c, 0]) # Calculations panel1 = Panel(P1, P2, P3, P6) panel2 = Panel(P6, P3, P4, P5) S1 = panel1.area() S2 = panel2.area() CP1 = panel1.control_point() CP2 = panel2.control_point() w11 = panel1.induced_velocity(CP1) w12 = panel1.induced_velocity(CP2) w22 = panel2.induced_velocity(CP2) w21 = panel2.induced_velocity(CP1) print('control point1 =', CP1, ' area1 =', '%4.3F' % S1) print('control point2 =', CP2, ' area2 =', '%4.3F' % S2) print('w11_induced =', '%4.3F' % w11, ' w12_induced =', '%4.3F' % w12) print('w21_induced =', '%4.3F' % w21, ' w22_induced =', '%4.3F' % w22) # Linear equation solving AX = Y A = np.array([[w11, w12], [w21, w22]]) v1 = -V * np.sin(alpha) v2 = -V * np.sin(alpha) Y = np.array([[v1], [v2]]) X = np.linalg.solve(A, Y)