Научная статья на тему 'DETERMINATION OF PARAMETERS BEHIND AN OBLIQUE SHOCK WAVE ON A WEDGE USING NUMERICAL METHODS IN THE PYTHON PROGRAMMING LANGUAGE'

DETERMINATION OF PARAMETERS BEHIND AN OBLIQUE SHOCK WAVE ON A WEDGE USING NUMERICAL METHODS IN THE PYTHON PROGRAMMING LANGUAGE Текст научной статьи по специальности «Математика»

CC BY
12
1
i Надоели баннеры? Вы всегда можете отключить рекламу.
Ключевые слова
oblique shock wave / numerical methods / Newton method / secant method / supersonic flow / косой скачок уплотнения / численные методы / метод Ньютона / метод секущих / сверхзвуковой поток

Аннотация научной статьи по математике, автор научной работы — I.S. Stulov, I.A. Ferapontov, K.A. Spiridonov

The article discusses numerical methods for solving nonlinear equations applied to determine the parameters behind an oblique shock wave on a wedge in a supersonic gas flow. Two main methods are considered: the Newton method and the secant method. The specifics of their application and convergence in solving equations related to the angle of inclination of the shock wave are described. A comparison of the methods' performance is conducted on the example of determining the oblique shock wave angle (OSW), along with calculations of flow parameters behind the shock wave. Both methods yielded identical results, but the secant method required less computation time. The article also highlights important conditions affecting the convergence of the methods and the accuracy of the calculations.

i Надоели баннеры? Вы всегда можете отключить рекламу.
iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.
i Надоели баннеры? Вы всегда можете отключить рекламу.

ОПРЕДЕЛЕНИЕ ПАРАМЕТРОВ ЗА КОСЫМ СКАЧКОМ УПЛОТНЕНИЯ НА КЛИНЕ С ПОМОЩЬЮ ЧИСЛЕННЫХ МЕТОДОВ НА ЯЗЫКЕ ПРОГРАММИРОВАНИЯ PYTHON

В статье рассматриваются методы численного решения нелинейных уравнений, применяемые для определения параметров за косым скачком уплотнения на клине в потоке сверхзвукового газа. Рассмотрены два основных метода: метод Ньютона и метод секущих. Описаны особенности их применения и сходимость в решении уравнений, связанных с углом наклона скачка уплотнения. В работе проведено сравнение производительности методов на примере задачи определения угла наклона КСУ, а также расчет параметров потока за ударной волной. Оба метода дали идентичные результаты, но метод секущих показал меньшую затрату времени. Также в статье отмечены важные условия, влияющие на сходимость методов и точность вычислений.

Текст научной работы на тему «DETERMINATION OF PARAMETERS BEHIND AN OBLIQUE SHOCK WAVE ON A WEDGE USING NUMERICAL METHODS IN THE PYTHON PROGRAMMING LANGUAGE»

DETERMINATION OF PARAMETERS BEHIND AN OBLIQUE SHOCK WAVE ON A WEDGE USING NUMERICAL METHODS IN THE PYTHON PROGRAMMING LANGUAGE

I.S. Stulov1, Graduate Student I.A. Ferapontov2, Graduate Student K.A. Spiridonov1, Graduate Student

1Moscow Aviation Institute (National Research University) 2Plekhanov Russian University of Economics (Russia, Moscow)

DOI:10.24412/2500-1000-2024-10-5-79-85

Abstract. The article discusses numerical methods for solving nonlinear equations applied to determine the parameters behind an oblique shock wave on a wedge in a supersonic gas flow. Two main methods are considered: the Newton method and the secant method. The specifics of their application and convergence in solving equations related to the angle of inclination of the shock wave are described. A comparison of the methods' performance is conducted on the example of determining the oblique shock wave angle (OSW), along with calculations of flow parameters behind the shock wave. Both methods yielded identical results, but the secant method required less computation time. The article also highlights important conditions affecting the convergence of the methods and the accuracy of the calculations.

Keywords: oblique shock wave, numerical methods, Newton method, secant method, supersonic flow.

The goal of this study is to investigate conditionally and unconditionally converging iterative methods for solving nonlinear equations.

Problem Statement:

Determine the parameters behind an oblique shock wave on a wedge using numerical methods for solving nonlinear equations, specifically

Newton's Method (Tangent Method) and the Secant Method.

A flow of an ideal inviscid gas with an adia-batic index k = 1.4 impacts the wedge. The task is to determine the shock wave inclination angle 6 from equation (1):

K+1 ■ n ■ n 9

, „ -, -Sin0cSinß / 1 \2

f(0c) = sin2 0c - -2——^s—- - ( — ) = 0, (1)

' K cJ c cos(0c-ß) \mJ ' v '

Where:

P - wedge angle in radians (degrees); 0S - shock wave inclination angle in radians (degrees);

Mx - Mach number of the incident flow, defined by the formula;

K - adiabatic index of air.

The solution is to be found in the interval (0, n/2) using both Newton's Method and the Secant

Method. The following parameters (

pressure P2, temperature 72, density p2, Mach numbe ) behind the shock wave are to be calculated. The results for 6 must be presented in degrees and compared in a summary table alongside the other parameters.

Table 1. Parameters of the Incident Flow (Example)

Pi, Pa Ti, К Mi ß, ' Method

98000 278 4 25 Newton

Theory

The key feature of supersonic flows is that, under deceleration conditions, they form discontinuity surfaces where the flow parameters

change abruptly. These surfaces, whose positions do not change over time, are called shock waves (SW).

- TexnuHecKue uayHU -

A shock wave formed under real-world conditions has a certain thickness comparable to the mean free path of gas molecules. The change in gas parameters within such a shock wave is not

From the figure, it can be seen that shock wave surfaces can either be oriented perpendicular (Figure 1b) to the incident flow velocity vector v1v1 or inclined at some angle (Figure 1c). In the first case, the shock wave is called a normal

Newton's Method (Tangent Method)

Newton's method is based on approximating the studied function f(x)f(x) by a simpler function—in this case, a tangent. Geometrically, a

instantaneous but occurs rapidly, with continuous changes in the gas state.

The most common scenario for shock wave formation occurs when bodies are moving recti-

shock wave (NSW), and in the second case - an oblique shock wave (OSW).

The ultimate goal is to determine the parameters behind the shock wave, as well as the angle of inclination of the shock on the wedge (Fig-

tangent line is drawn at the initial point x0x0 of the curve f(x)f(x) and its intersection with the x-axis is found (Figure 3).

linearly at a constant supersonic speed (Figure 1).

- TexHuuecKue HayKU -

y = m

Figure 3. Newton's Method

The successive approximations can be found by drawing tangents from points Mx, in mind that f(xn) ^ 0 :

x.

n+1

x1

f(.Xn)

f(xny

Mn-1, keeping

(2)

Newton's method is conditionally convergent, meaning that for convergence:

lim Xj = x*

œ

The following condition must be met in the root-finding region:

|/(x)/''(x)|<(/'(x))2,

(3)

(4)

Where x* is the desired root value. It is important to note that fulfilling Bolzano-Cauchy theorem conditions is not sufficient for accurate convergence. The verification of lf(x)f(x)l < (/'(x))2 over the entire interval is mandatory. Otherwise, convergence will only occur in the vicinity of the root.

Secant Method

Calculating the derivative f'(x), required for Newton's method, is not always convenient or

feasible. Replacing the derivative with the first divided difference, found from the two most recent iterations (i.e., replacing the tangent with a secant), leads us to the Secant Method. From the perspective of analytical methods, a straight line passing through the two most recent points xn and xn-1 is used, meaning that instead of the derivative in Newton's method, the following is substituted:

f' =

f(xn)- f(Xn-l)

(5)

Xv> Xti_

n-l

n

This results in the secant method formula:

Xn+1 = Xn- /(XnWCrrL/^- (6)

The Secant Method is a two-step process, meaning it requires two initial points x0 and xx. For x0, we can take the boundary of the initial interval. This method is illustrated graphically in Figure 4.

\ rpg

r<* 0 J A

-

X-j X2 Xq X

Figure 4. Secant Method

In the Secant Method, boundary values x0 and xx can be taken if the Bolzano-Cauchy theorem conditions hold in the interval.

First, we draw a straight line through the selected points (x0,/(x0)), (x1,/(x1)) and determine x2, with the vertical line at point x2 giving /(x2). Then, the line is drawn through points (x1,/(x1)) and (x2,/(x2)) and so on, until one of the following conditions is met: |xn+1 — xn| < £ or |/(xn)| < £1, signaling the end of the iterative process.

Task Execution:

The code for all tasks was implemented in Ju-pyter Lab on a local machine in Python. The following libraries are required for code execution:

import time import numpy as np from numdifftools import Derivative from scipy.optimize import root_scalar import matplotlib.pyplot as plt from scipy.optimize import fsolve

Upon applying Newton's method under the given conditions, it was found that the derivative does not change sign in the interval (0, n/2), and the function does not take different signs within this interval. Therefore, the equation has no single root on this interval. We manually selected different intervals for further calculations. Let's manually select different intervals:

import math

Newton's Method for solving the interval (0, 10)

• - f<ec> Iterations of Newton's Method

i-1-1-1-1-

0 20 40 60 80

Inclination angle of the oblique shock wave (degrees)

Figure 5. Graph of the function depending on the oblique shock wave inclination angle (degrees) for the

interval from 0 to 10

interval from 10 to 60

20 40 60

Inclination angle of the oblique shock wave (degrees)

Figure 6. Graph of the function depending on the oblique shock wave inclination angle (degrees) for the

Newton's Method for solving the interval {0, 90)

-100 -

-200 -

CD

-300 -

-400 -

• - f(9c) Iterations of Newton's Method

100

iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

120

0 20 40 6 0 80

Inclination angle of the oblique shock wave (degrees)

Figure 7. Graph of the function depending on the oblique shock wave inclination angle (degrees) for the

interval from 0 to 90

After selecting a new interval, it was found that the function takes on different signs in the interval (n/18, n/3). It was also found that the derivative does not change sign in the interval

(n/18, n/3). Thus, we select the interval (n/18, n/3).

We call Newton's method on the new interval:

20 30 40 50

Inclination angle of the oblique shock wave (degrees)

Figure 8. Graph of the function depending on the oblique shock wave inclination angle (degrees) for the

interval from 10 to 60

Next, we measure the execution time of the method and calculate the given parameters. Results:

For Newton's method: Iterations: 24

Execution time: 0.00186 seconds Table 2. Results for Newton's Method

в, ° Pi, Па Ti, К кг M2

38.459 691298.770 590.878 4.081 2.209

For Secant Method: Iterations: 4

Execution time: 0.00085 seconds Table 3. Results for Secant Method

кг

в, ° Pi, Па Ti, К Р2'~м Mi

38.459 691298.770 590.88 4.081 2.21

Table of results for finding 6 sing different methods (Secant and Newton):

Table 4. Results for finding 0 using different methods

0, ° Pa 72, К M2 Method Time, sec Iterations

38.459 691298.770 590.878 4.081 2.209 Newton 0.00186 24

38.459 691298.770 590.880 4.081 2.210 Secant 0.00085 4

Conclusions:

From the output data, we can conclude the following:

- Both methods (Newton's and Secant) yield the same shock wave inclination angle 0 of 38.459 degrees.

- Both methods also compute identical values for the other flow parameters behind the shock wave, such as P2, T2, p2, M2.

- Newton's method required 24 iterations,

- Newton's method took 0.00186 seconds, which is longer than the Secant method (0.00085 seconds). This could be due to Newton's method requiring more iterations for convergence. The calculations were performed on a local machine with varying resource availability, which may have impacted the execution times. The execution time of the methods differs, which can be an important factor when choosing a method for solving similar problems.

while the Secant method required only 4.

Библиографический список

1. Голубев А.Г. Аэродинамика. - М.: МГТУ им. Н.Э. Баумана. 2017. - 608 с.

2. Землянский Б.А., Лунев В.В. Конвективный теплообмен летательных аппаратов. - М.: ФИЗМАТЛИТ. 2014. - 380 с.

3. Калугин В.Т. Моделирование процессов обтекания и управления аэродинамическими характеристиками летательных аппаратов. - М.: МГТУ им. Н.Э. Баумана. 2011. - 528 с.

4. Лукьяненко Д.В. Численные методы. - М: МГУ им. М.В. Ломоносова. - 101 с.

5. Савчук В.Ф. Методы численного анализа. - Б.: БрГУ. 2013. - 403 с.

ОПРЕДЕЛЕНИЕ ПАРАМЕТРОВ ЗА КОСЫМ СКАЧКОМ УПЛОТНЕНИЯ НА КЛИНЕ С ПОМОЩЬЮ ЧИСЛЕННЫХ МЕТОДОВ НА ЯЗЫКЕ ПРОГРАММИРОВАНИЯ PYTHON

И.С. Стулов1, магистрант И.А. Ферапонтов2, магистрант К.А. Спиридонов1, магистрант

1Московский авиационный институт (национальный исследовательский университет) 2Российский экономический университет имени Г. В. Плеханова (Россия, г. Москва)

Аннотация. В статье рассматриваются методы численного решения нелинейных уравнений, применяемые для определения параметров за косым скачком уплотнения на клине в потоке сверхзвукового газа. Рассмотрены два основных метода: метод Ньютона и метод секущих. Описаны особенности их применения и сходимость в решении уравнений, связанных с углом наклона скачка уплотнения. В работе проведено сравнение производительности методов на примере задачи определения угла наклона КСУ, а также расчет параметров потока за ударной волной. Оба метода дали идентичные результаты, но метод секущих показал меньшую затрату времени. Также в статье отмечены важные условия, влияющие на сходимость методов и точность вычислений.

Ключевые слова: косой скачок уплотнения, численные методы, метод Ньютона, метод секущих, сверхзвуковой поток.

i Надоели баннеры? Вы всегда можете отключить рекламу.