The dimensionless balloon. Utilitarian magic of dimensional analysis

  • Tutorial

On writing this small note, I was prompted by a recently published article on Habré article Dynamics of vertical flight of an aircraft lighter than air . I wanted to write a comment, but it quickly grew into something more and, as it seems, more useful.

The original article gives an example of calculating the dynamics of a balloon or a balloon in the atmosphere. At the same time, air resistance and atmospheric density and temperature gradients are taken into account, so the task is reduced to a non-trivial differential equation, which is successfully solved numerically using Python. Everything is good in the article: the ball took off, stopped, where necessary, and we got the ultimate height and time of ascent. It was necessary to launch another balloon, say, more, load it more fundamentally, or change the hydrogen to helium - not a problem - we change the parameters in the program and again we calculate everything. The program is clear, linear, works, what can be improved here, if not complicate the model?

You can make the model and calculations become universally useful not for any particular ball, but for a wide range of tasks. It is possible to ensure optimal accuracy of calculations in the numerical integration of a differential equation. You can get rid of the need to manually set the limits of integration and the step when calculating in a wide range of parameters. Finally, you can tell a lot about the dynamics of the flight of our ball without a numerical solution. And for all this there is one old method, true and reliable, once obligatory for any calculations on a computer and before their appearance, and now optional and often attributable to magic and art - bringing equations to a dimensionless form and its own scales. I will use the task of aeronautics, as an example, and show how much more meaningful and graceful the analysis of the problem becomes when using this technique. And then I will explain why this may be important for programmers, and why this article got into the hub "Functional programming".

The essence of bringing equations to their own scales consists in finding and introducing such units of time, distances, masses, currents and other dimensional variables in which the problem takes the most simple and elegant form. Such units are called characteristic or own scale of the task. At the same time, the number of parameters affecting its solution is significantly reduced, and if you are lucky to stumble upon a self-similar solution, the parameters may disappear altogether!

Usually, this technique is introduced when studying the dynamics of a harmonic oscillator, bringing the equation of motion to a canonical form. Indeed, whatever the oscillator (large or small, low or high frequency, mechanical or electromagnetic), if time is measured not in seconds, but in periods of its free oscillations, and the amplitude is not in meters, but, say, in the magnitude of the initial deviation then the equation for any linear oscillator will have the same form:

$ x '' + 2 \ zeta x '+ x = 0 $

It suffices to study the properties of the solutions of this equation in order to know everything about all viscous friction harmonic oscillators. Without friction in the problem, the parameters completely disappear, and we get, as a solution, an exemplary sinusoid. All other sinusoids with an accuracy of a simple linear change of coordinates are absolutely identical, so there is no point in analyzing them separately.

The same is true of the analysis of second-order curves. Having considered a parabola, hyperbola or ellipse in their canonical (most compact) form, we learned all their remarkable properties. After that, this knowledge applies to any non-trivial quadric. Moreover, the same technique is used in the analysis of the equations of second-order mathematical physics (in partial derivatives).

Reduction of the problem to a dimensionless form at its own scales in physics corresponds to the search for the canonical form or some pattern in programming. And, fortunately, it can be expressed by a completely formal algorithm:
  1. We introduce formal scale factors for variables;
  2. we divide the entire equation by any quantity having the dimension of its terms;
  3. from the resulting dimensionless complexes, including large-scale factors, choose as many as the factors we have, and equate them to one;
  4. We solve the resulting equations, expressing the scale factors through the parameters of the problem, and use the remaining complexes as similarity criteria.

As a result, we obtain equations in canonical form, the eigenvalues ​​of the problem, as well as similarity criteria for generalizing solutions to physically similar systems. The more scales one can introduce (using, for example, symmetry), the more concise the equation of motion will turn out and the less control parameters will remain in the problem. The real treasure for the researcher is the situation when it is possible to exclude in general all the parameters of the problem and all its possible solutions in a single curve. Such solutions are called self-similar solutions, and they make life much easier, turning partial differential equations into ordinary differential equations, and even into algebraic ones. The second and third steps of the above algorithm require selection and reasoning, they are the least formal, but, even if we act by the method of enumeration,

Let us turn to the original equation of motion given in the article on aircraft, and show by his example how to transform it to a dimensionless form at its own scales. The equation has the form:

$ m \ frac {d ^ 2h} {dt ^ 2} = -mg + g W \ rho_0 e ^ {- bh} - \ frac {1} {2} with S \ rho_0 e ^ {- bh} \ operatorname { sign} \ left (\ frac {dh} {dt} \ right) \ left (\ frac {dh} {dt} \ right) ^ 2, $

with initial conditions

$ h (0) = h '(0) = 0. $

Here $ h $ - height of the ball, $ m $ - the mass of the entire aircraft with cargo, $ g $ - acceleration of gravity, $ W $ - the volume of gas in the ball, $ c $ - coefficient of drag, $ S $ - characteristic area of ​​resistance, $ ρ_0 $ - air density at zero height, $ b $- coefficient in the Boltzmann distribution.

First step. We introduce the formal scales for time and distance:

$ h = h_0 y, \ quad t = t_0 \ tau \ qquad (1) $

and rewrite the equation of motion using strokes to denote derivatives:

$ m \ frac {h_0} {t_0 ^ 2} y '' = -mg + g W \ rho_0 e ^ {- b h_0 y} \ left [1 - \ frac {c S} {2W g} \ frac {h_0 ^ 2} {t_0 ^ 2} \ operatorname {sign} (y ') (y') ^ 2 \ right].  $

The initial conditions in our case are trivial, so they can be omitted, but in general, we must rewrite them too.

The second step, in fact, the dimensioning of the equation. All the terms in it have the dimension of force and we are free to divide them into any force. Usually divided by the force of inertia - factor by the second derivative of the distance. In this case, as the parameters of the problem, usually well-known dynamic similarity criteria are obtained, such as the Reynolds number or Euler number. But in our task, we will attribute all forces included in the task to gravity$ mg $, and that's why. We are mainly interested in the position of static equilibrium - the limiting height of a balloon's flight at a given carrying capacity and the time of transition to it. A static equilibrium does not depend on the inertial properties of the system, but it directly depends on gravity. So, divide and cut, which is possible:

$ \ frac {h_0} {gt_0 ^ 2} y '' = -1 + \ frac {W \ rho_0} {m} e ^ {- b h_0 y} \ left [1 - \ frac {c S} {2W g } \ frac {h_0 ^ 2} {t_0 ^ 2} \ operatorname {sign} (y ') (y') ^ 2 \ right]. $

Everything, the equation is dimensionless, now all the variables and all the terms in it are just numbers. And now we are free to choose such length and time scales in order to minimize the number of task parameters. We have two unknowns.$ h_0 $ and $ t_0 $ and four dimensionless complexes:

$ \ frac {h_0} {gt_0 ^ 2}, \ quad \ frac {W \ rho_0} {m}, \ quad b h_0, \ quad \ frac {c S} {2W g} \ frac {h_0 ^ 2} { t_0 ^ 2} $

then we can make two of them disappear just by equating them to one. Moreover, the second complex does not depend on large-scale factors, and we need to choose the two remaining for destruction. And again we turn to the argument about the static equilibrium that interests us. The equilibrium position is determined by the equality to zero of acceleration, that is, it will not matter what factor will be at the second derivative of the height and we can do minimization of the number of parameters on the right side of the equation. Thus, we arrive at the following solution: we will choose the scale factors so that the third and fourth of the complexes listed by us disappear from the equation. For this we assume

$ b h_0 = 1, \ quad \ frac {c S} {2W g} \ frac {h_0 ^ 2} {t_0 ^ 2} = 1 $

and we get our own scale of the task:

$ h_0 = \ frac {1} {b}, \ quad t_0 = \ frac {1} {b} \ sqrt {\ frac {c S} {2W g}}. \ qquad (2) $

The remaining parameters are denoted as follows:

$ \ frac {h_0} {gt_0 ^ 2} = \ frac {1} {\ gamma}, \ quad \ frac {W \ rho_0} {m} = B. $

This is probably the most magical stage of our transformation, which is closest to art. But experience and some reasoning help in choosing the right scales. And then this same experience allows us to see similar phenomena in different areas of science and to guess the characteristic properties of complex systems.

I allow myself to postpone a little analysis of the physical meaning of the scales and parameters we received, although it is also very nice and interesting, but I will immediately move on to the most delicious - to a dimensionless equation on my own scales:

$ \ frac {1} {\ gamma} y '' = B e ^ {- y} \ left (1 - \ operatorname {sign} (y ') (y') ^ 2 \ right) -1, \ quad y (0) = y '(0) = 0. \ qquad (3) $

Here! I am ready to solve such an equation, analyze and integrate numerically. And when I decide, I will easily move from my own scales to meters and seconds, encoded in relations (1) and (2).

So, let's begin. Find, for a start, where our generic balloon will stop. To do this, equate both the speed and the acceleration in equation (3) to zero:

$ 0 = B e ^ {- y ^ *} - 1, $

where do we get

$ y ^ * = \ ln B. $

Immediately we conclude: in order for the limit height to exist, the condition must be met $ B> 1 ​​$. Next, let's estimate how long the ball will reach this height. To do this, equate the acceleration to zero and solve the first-order Cauchy problem:

$ 0 = B e ^ {- y} \ left (1 - (y ') ^ 2 \ right) - 1, \ quad y (0) = y ^ *.  $

It is solved analytically by the method of separation of variables, and is reduced to the integral:

$ \ tau ^ * = \ int_0 ^ {y ^ *} \ frac {B dy} {\ sqrt {Be ^ y}} = 2 \ operatorname {arth} \ left (\ sqrt {1 - \ frac {1} { B}} \ right).  $

See, here they are - the fruits of the correctly chosen scale! Both the maximum height and the characteristic time of its achievement are expressed only through the parameter$ B $. This means that we can fix some value.$ B> 1 ​​$, construct a series of graphs for solving equation (3) for different values $ \ gamma $and thus immediately describe all the solutions for any values$ B $!

This is a universal one-parameter family of solutions obtained by numerical integration of problem (3) for various values$ \ gamma $:

After reaching equilibrium height, the balloon makes damped oscillations for some time, but the characteristic time to reach this height is correctly estimated. From criterion$ \ gamma $only the period of oscillations and the time of their attenuation depend. The more this parameter is, the more “rigid” our system is.

It remains to translate this family of graphs into a dimensional view, simply by multiplying the values ​​along the axes by the corresponding scale factors. And now the numerical experiment is over and its results have gained universal meaning. You can substitute the actual dimensional parameters of the task, and instantly get the numbers along the axes, already in meters and seconds! Such a result can already be published in a serious reference for severe aeronautics or in a scientific article describing the whole phenomenon on a single graph.

Now let's see what we got in the form of parameters and variables. Replace the mass of the ball$ m $ for the sum of the mass of gas $ W \ rho_g $ and payload mass $ M $:

$ m = W \ rho_g + M = W \ rho_g (1 + \ alpha), $

Where $ \ alpha = \ frac {M} {W \ rho_g} $- relative load capacity of the aircraft. In addition, we will take a spherical ball and express its area and volume through a radius$ R $. In this view, we get the parameters of the problem:

$ B = \ frac {\ rho_0} {\ rho_g (1 + \ alpha)}, \\ \ gamma = \ frac {3 c B} {8 R b}. $

The first is the buoyancy factor, depending on the gas used and the load being lifted, a very important parameter, it has absorbed all mass quantities. The second shows how the size and shape of the ball correlates with the density gradient in the atmosphere, that is, how large the atmospheric heterogeneities are with respect to the size of the ball.

Scales are expressed as:

$ h_0 = 1 / b \\ \ tau_0 = \ frac {1} {2 b} \ sqrt {\ frac {3 c} {2 g R}} = \ sqrt {\ frac {\ gamma} {gb}} $

The distance scale is determined only by the density gradient. What is absolutely true, because it is precisely because of this gradient that the lifting of the ball, in general, stops somewhere. The characteristic time included dynamic values ​​- acceleration of free fall, mass ratios and air resistance.

Characteristic height and time of the ball

$ h ^ * = y ^ * h_0 = \ frac {1} {b} \ ln B, \\ t ^ * = \ tau ^ * t_0 = 2 \ sqrt {\ frac {\ gamma} {gb}} \ operatorname {arth} \ left (\ sqrt {1 - \ frac {1} {B}} \ right) $

also expressed through the basic parameters and scope of the task.

For example, let's see what happens for the physical parameters given in the original article:

$ B = 4.57 \\ \ gamma = 686 \\ h_0 = 8000 \ m \\ \ tau_0 = 12.47 \ min \\ h ^ * = 12166.6 \ m \\ t ^ * = 13.72 \ min $

Summarize. Having worked a little on paper before feeding the task to the machine, we were able to get a more intelligible, universal result and noticed the most important properties of the solution. At the same time, we have not lost the “modularity” of the solution. That's what I mean. We formulated the task in the most general terms, and then, having received the solution, we began to add new “features”, for example, we divided the concept of payload and the mass of the gas that lifts it. This complication affected the scale values, but did not change the nature of the decision.

If later it is necessary to add an account of the temperature gradient, the expression in the exponent becomes more complicated, but its essence and, most importantly, the scale will not change:

$ \ exp \ left (\ frac {-bh T_0} {T_0 - ah} \ right) $

after dimensioning it will look like this:

$ \ exp \ left (\ frac {-y} {1 - \ psi y} \ right), $

where is the new parameter $ \ psi = \ frac {a} {bT_0} $It shows how the density and temperature gradients correlate. Since these are atmospheric parameters that are beyond our control,$ \ psi $ Is a constant equal to $ 0.17 $. The value of the constant, by the way, shows the significance of the effect of the temperature gradient, it is not great, but not negligible. The family of graphs will change a little, but, most importantly, it will remain one-parameter.

The use of the inherent scale of the problem in the calculations has one more significant advantage: the variables in this case usually take “moderate” values, that is, close to unity. This is very useful for floating-point calculations: accuracy is not lost in operations on values ​​that differ greatly in order of magnitude. In addition, it is possible to correctly compare the roles of individual effects in a problem by comparing the values ​​of the corresponding similarity criteria or the values ​​of variables. For example, the value$ B = 4.5 $says how many times the force of interaction with the atmosphere is greater than the force of gravity. And the square of the characteristic dimensionless lifting speed$ (y ^ * / \ tau ^ *) ^ 2 \ sim 0.3 $ shows the degree of importance of air resistance in the vertical movement of the aircraft in comparison with the buoyancy, which is expressed by a unit in brackets.

Finally, calculations in dimensionless variables and parameters have a certain internal consistency with the fact that solutions of differential equations are almost always transcendental functions, and only dimensionless quantities can be their arguments and results. The computer also operates solely on numbers, in dimensionless quantities. Static typing, in principle, allows you to enter the dimensions of physical quantities at the type level and check the program for correctness during compilation, but at the numerical destructive stage, we still work only with the values ​​themselves. Any errors associated with units of measurement and dimensions are lost in such calculations. It is reasonable to prepare the task for the calculations, eliminating unnecessary, and leaving only the most essential and natural for the solver.

And what would happen if we chose other complexes, or referred all forces not to gravity, but, say, to inertia? There would be two parameters left in the equation, but the family of curves would become two-parameter, and it could not be shown on the same diagram. I admit, at first it happened to me exactly, as a scale of length I got the radius of the ball. But having played with these curves, I saw their geometric similarity (you see one in all parabolas), and a further cursory analysis of the resulting criteria and equations he himself pushed me to a hidden symmetry and suggested what the "canonical form" of our equations should be. This, however, a beautiful occupation! The task itself begins to talk about itself. I feel the same pleasure building a type system and data structures in a program on Haskell or in C #:

Dimensions of physical quantities in themselves are very interesting. They form a linear space, and the search for similarity criteria can be reduced to the problem of finding a kernel in a space of dimensions, thereby formalizing this process. They, to some extent, play the role of types in physical calculations. Just as the compiler uses static typing to verify the correctness of a program, so a physicist uses dimensions to verify his calculations and results. As in a strictly typed pure functional language (for example, in Haskell), you can derive the function code from its type, in the same way, based on the dimension of physical quantities, you can construct dimensionless complexes, characteristic values ​​in physical systems and get extremely useful and universal results. There are many examples in mechanics, gas and thermodynamics, quantum mechanics, etc. I recommend to get acquainted withremarkable work , which provides a bunch of beautiful examples of the application of dimensional analysis to problems from the Pythagorean theorem, to the oscillations of stars and Rayleigh scattering in the sky. This paper cites the words of John Wheeler, the teacher of Richard Feynman, who received the name “Wheeler's Rule”:
“Never start a calculation until you know the answer. Predetermining the calculation for each calculation: attract simple physical considerations (symmetry! Invariance! Preservation!) Before starting a detailed conclusion; consider possible answers to each riddle. Be bolder: after all, no one cares what you suggested. So make assumptions quickly, intuitively. Successful assumptions strengthen this intuition. Erroneous assumptions give a useful shake. ”

This advice for programmers sounds very familiar: do not start writing the function code without having decided on its signature (type) and its behavior (tests); Before writing code, you should consider the types, data structures and their relationships. It is with this that OOP and functional programming are strong - there these principles not only work, they, with skillful use, suggest the most natural and elegant solutions themselves, and in the case of the FP, they do it on a deep mathematical level, making it possible to prove the properties of programs and charge some work on the output properties of the program to the compiler.

Learn math, program beautifully and have fun!

Also popular now: