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:
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:
- We introduce formal scale factors for variables;
- we divide the entire equation by any quantity having the dimension of its terms;
- from the resulting dimensionless complexes, including large-scale factors, choose as many as the factors we have, and equate them to one;
- 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:
First step. We introduce the formal scales for time and distance:
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
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:
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:
This is a universal one-parameter family of solutions obtained by numerical integration of problem (3) for various values

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
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
Scales are expressed as:
Characteristic height and time of the ball
For example, let's see what happens for the physical parameters given in the original article:
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:
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
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!