Untitled
unknown
plain_text
22 days ago
4.2 kB
2
Indexable
Never
def intDY(P, ϑ1_t, ϑ2, t_1, t_2, h, dt): t, x, y, Vx, Vy = [0, 0, 0, 0, 0] m = m0 x_List = [] y_List = [] # Первый активный участок # Вертикальный while t < t_B: Vx, Vy, x, y, m = RK4(t, x, y, Vx, Vy, P, m, ϑ1_t, ϑ2, dt) t += dt x_List.append(x) y_List.append(y) print(Vx, ',', Vy, ',', x, ',', y, ',', m, ',', t) # График grafik(x_List, y_List, 'grey') # Не вертикальный while t < t_1: if round(t, 2) == t_1_to4ny: Vx, Vy, x, y, m = RK4(t, x, y, Vx, Vy, P, m, ϑ1_t, ϑ2, delta_t_1) x_List.append(x) y_List.append(y) t += delta_t_1 t = round(t, 3) print(Vx, ',', Vy, ',', x, ',', y, ',', m, ',', t) # Параметры на точке 360.456 # Находим параметры для 360.5 Vx, Vy, x, y, m = RK4(t, x, y, Vx, Vy, 0, m, ϑ1_t, ϑ2, round(Dt - t % 0.1, 3)) x_List.append(x) y_List.append(y) t += round(Dt - t % 0.1, 3) dt = Dt print(Vx, ',', Vy, ',', x, ',', y, ',', m, ',', t) else: Vx, Vy, x, y, m = RK4(t, x, y, Vx, Vy, P, m, ϑ1_t, ϑ2, dt) x_List.append(x) y_List.append(y) t += dt print(Vx, ',', Vy, ',', x, ',', y, ',', m, ',', t) # График grafik(x_List, y_List, 'orangered') # Второй пасивный участок while t < t_2: if round(t, 2) == t_2_to4ny: Vx, Vy, x, y, m = RK4(t, x, y, Vx, Vy, 0, m, ϑ1_t, ϑ2, delta_t_1) x_List.append(x) y_List.append(y) t += delta_t_1 t = round(t, 3) print(Vx, ',', Vy, ',', x, ',', y, ',', m, ',', t) # Находим параметры для точки нового участка Vx, Vy, x, y, m = RK4(t, x, y, Vx, Vy, P, m, ϑ1_t, ϑ2, round(Dt - t % 0.1, 3)) x_List.append(x) y_List.append(y) t += round(Dt - t % 0.1, 3) dt = Dt print(Vx, ',', Vy, ',', x, ',', y, ',', m, ',', t) else: Vx, Vy, x, y, m = RK4(t, x, y, Vx, Vy, 0, m, ϑ1_t, ϑ2, dt) x_List.append(x) y_List.append(y) t += dt print(Vx, ',', Vy, ',', x, ',', y, ',', m, ',', t) # График grafik(x_List, y_List, 'lightblue') V_UCL = np.sqrt(µ_m / (R_m + h)) # необходимая скорость while abs(np.sqrt(Vx ** 2 + Vy ** 2) - (V_UCL)) > (10 ** (-8)): Vx_prior = Vx Vy_prior = Vy x_prior = x y_prior = y m_prior = m Vx, Vy, x, y, m = RK4(t, x, y, Vx, Vy, P, m, ϑ1_t, ϑ2, dt) if np.sqrt(Vx ** 2 + Vy ** 2) > (V_UCL): Vx = Vx_prior Vy = Vy_prior x = x_prior y = y_prior m = m_prior dt /= 10 # print(np.sqrt(Vx**2 + Vy**2)) else: x_List.append(x) y_List.append(y) print(Vx, ',', Vy, ',', x, ',', y, ',', m, ',', t) t += dt if round(m, ) < 1465: Vx = Vx_prior Vy = Vy_prior x = x_prior y = y_prior m = m_prior t -= dt break print(Vx, ',', Vy, ',', x, ',', y, ',', m, ',', t) print(np.sqrt(Vx ** 2 + Vy ** 2)) print(V_UCL) # График grafik(x_List, y_List, 'palegreen') plt.xlabel('x') plt.ylabel('y') plt.xlim(0, 350000) plt.ylim(0, 350000) plt.title('Trajectory') plt.show() return Vx, Vy, x, y, m, t, x_List, y_List # Графики частей траекторий def grafik(x_List, y_List, color ='red'): plt.plot(x_List[:-1], y_List[:-1], color=color) plt.plot(x_List[-1:], y_List[-1:], marker='o', markerfacecolor='blue', markersize=8) x_List.clear() y_List.clear() # Интегрирование