Calculation of wave processes in a hydraulic line by the method of characteristics
Hello, Habr! In this article, I'll talk about creating a mathematical model of a long pipeline for the SimulationX CAE program in Modelica. We will talk about the calculation of wave processes (pressure pulsations, hydraulic shock, etc.) in the hydraulic line by the method of characteristics. Despite the fact that this method is quite old, there is very little information about its application for solving applied problems in runet.
Under the cut I will try to explain why we need to take into account the wave processes in the pipelines, highlight the problems that I encountered in programming, and at the end I will compare the process of pressure pulsations during operation of a three-plunger high-pressure water pump for a simple long pipeline in the URACA model and stand. Germany.
all over the world. the Zhukovsky formula :
Hydrodynamic in practice manifests itself, as a rule, at pipeline lengths of 100 meters. At lengths below it is already difficult to find hydraulic equipment, which would have time to close faster than the pressure wave will pass from the gate and back (the condition of the hydrostatic attack). Nevertheless, even relatively short pipelines can still ruin the lives of engineers if there is a source of flow pulsations in the system (for example, a volume pump with a finite number of plungers).
The hypha shows the beneficial effect of a piece of pipeline length just a little more than a meter. Its length is equal to a quarter of the wavelength of the pressure, so when it is connected to the main pipeline, a so-called standing wave that, in antiphase, strikes the source of pulsations and suppresses them in this way (this is the so-called quarter-wave pulsation damper). It is clear that in case of an unfortunate coincidence, the effect may be the opposite.
In my practice, I tried to wave away from wave processes for a long time. their calculation required a deepening in the matan and numerical methods, to which throughout the study I was treated with condescending disdain. But when one day I saw with my own eyes that the standard advice (to put everywhere RVD, hydraulic accumulator, to organize a support at the pump suction) do not help either to get rid of pulsations at the stand, or, even more so, to understand the ongoing processes, we had to go deeper into matan . Especially to my shame, for me, the scientific advisor of the pipeline model for C ++ has already started to write.
1. One-dimensional model of the hydraulic line in the distributed parameters
The main problem that makes the traditional one-dimensional models described by ordinary differential equations come out of the comfort zone is that the simplest pipeline, even with the most brutal assumptions (completely filled with liquid, constant cross-section along the length, the fluid velocity is averaged over the section, the heat exchange processes are not are considered) by differential equations in distributed parameters (Euler's equations, only taking into account the mass force and friction in the right-hand side of the second
- Frictional losses,
- Pressure drop due to gravitational force.
Those. To integrate now it is necessary not only on time
, but also in the spatial coordinate
In the case of liquids, one can simplify one's life a little more if we rewrite equations from conservative variables into primitive variables (velocity and pressure):
- sound speed.
Now, if we assume that the speed of sound is much larger than the velocity of the liquid
(which is valid in the absence of cavitation), then the equations become even simpler:
In order to solve these equations, it is necessary in one way or another to get rid of differentiation with respect to the spatial coordinate
. This can be done in the forehead by replacing the spatial differential with a finite-difference scheme, and in the case of time, then simply moving to the total differential, saying that within the same cell, the state parameters do not depend on the coordinate:
Now these equations can be solved as ordinary differential equations, dividing the length of the tube into a set of finite volumes. So this is becomes , for example, in the Simscape package, in MATLAB Simulink, so the problem was solved until recently in SimulationX .
Something in this way, of course, can be calculated, but the numerical oscillations arising in this case strongly hinder:
The figure shows the front of the pressure wave moving from left to right.
You can deal with these fluctuations, for example, by introducing numerical diffusion, but then the wave propagation velocity is significantly distorted. You can increase the friction (especially helping to increase its non-stationary component), but then the model ceases to reflect the physical essence.
It is best to use another method of transforming equations in distributed parameters into ordinary differential equations, for example, the method of characteristics.
2. The method of characteristics
Wikipedia on request "Method of Characteristics" recommends:
to find such characteristics along which the partial differential equation becomes an ordinary differential equation. Once ordinary differential equations are found, they can be solved along the characteristics and the solution found is transformed into a solution of the original partial differential equation.
It's like a philosopher's stone, but instead of turning metals into gold, we transform partial differential equations into ordinary ones, and vice versa. The question arises: "how can this be applied in practice?", And it is desirable to be more effective than the medieval alchemists did
To begin with, we will deal with the formulation of the problem. At our disposal at the initial moment of time, there is some distribution of pressures and velocities along the length of the tube. First of all, we split the pipe into a finite number of elements and assign a pressure value of
to each face.
and the speed
We are interested in how the values at these points will change at time
. Let's move to space-time and position the state of the pipe in the future above the initial state:
Here, then, we will use the "magic" characteristics! The workers 'and peasants' explanation is that all changes in the pipe occur at the speed of sound. Pressure and speed at the current time at
depend on the pressure and velocity at those points of the tube where the sound wave was (would)
seconds ago. This is illustrated as follows:
Two symmetrical lines are drawn from any point, the angle of inclination of which is determined by the speed of sound. These are the same characteristics along which the partial differential equations become ordinary differential equations. If we call the points at which the characteristics intersect with the state of the pipe in the past as
, the equations are written as follows:
The values of pressures and velocities at these points can be obtained by linear interpolation between the values of the state parameters on the grid:
It is important to take into account that these points should always be within neighboring cells! For this, the time step must satisfy the Courant-Friedrichs-Levy criterion (CFL):
Now we can apply the simplest difference scheme to these equations:
In the resulting system of two equations, two unknowns: pressure
and the speed
. You can solve it numerically, but there is no special problem to get an analytical solution. Then, if we assume the constancy of the speed of sound, we obtain a completely explicit difference scheme.
For fixing, I will give an animation of the method of characteristics:
the speed of sound depends on the pressure of the liquid. In this case the characteristics, strictly speaking, will not be straight lines, but in order to find the pressure, one must already know the speed of sound, which depends on this pressure. Those. the scheme will be already implicit.
When creating the model, I assumed that the speed of sound varies little from step to step. For a liquid this is true in the case of low gas content and in the absence of cavitation. To be sure of the result, the model is best used at pressures of 10 bar.
I had the opportunity to finally bring the model to mind when I started working at ESI ITI GmbH in Dresden. One day, I received a ticket in Helpdesk, where the engineers of the firm URACA complained that they could not achieve convergence with experiment with our "old" pipe.
They make high-pressure water plunger pumps, such huge "Kercher" and would like to be able to predict possible resonance effects caused by t.ch. wave processes in the pipeline. The problem is that these pumps, as a rule, have few plungers and operate at low speeds (250-500 rpm):
Because of this, and also because of the influence of the compressibility of the liquid, a very uneven supply is obtained at the output:
Discontinuities and nonlinearities make it difficult to linearize and analyze the model in the frequency domain, and CFD calculations for such a task are firing from a cannon on sparrows. In addition, they already had models in SimulationX, where they took into account the dynamics of the mechanical part of the pump, the elasticity of the frame, the characteristics of the electric motor, so it would be interesting to see how this will affect the pipeline.
The test stand is quite simple:
There is a simple pipeline with a total length of about 30 meters. At the beginning of the pipeline, a pressure sensor pd1 is installed, at a distance of 22 meters from it there is a pressure sensor pd2. At the end of the pipeline is a valve that adjusts the pressure in the system.
I offered to test the beta version of my model, as a result in SimulationX was collected such a model:
The results even surprised me pleasantly:
It can be seen that the model is slightly worse than damped, which is understandable, provided that hydraulic resistance is not taken into account in it. Nevertheless, the fundamental harmonics coincide rather well and allow predicting the values of the pressure amplitudes with fairly good accuracy.
This experience allowed to quickly launch a new model of the hydraulic line in the release of SimulationX, and I plunged into this topic and did not notice how, together with the intern student, I also saw a pneumatic line model, where everything was much more interesting. There atThe method was based on the Godunov method, which in its turn is based on the solution of the Riemann problem on the decay of an arbitrary discontinuity, well, about this some other time
In the domestic literature, the method of characteristics for engineering applications is best described in book "Hydromechanics", DN Popov, SS Panaiotti, M.V. Ryabinin.
In his publication
Pipeline simulation by the method of characteristics for calculating the pressure of a high-pressure water plunger pump [/b]
Dr.-Ing. (Rus.) Maxim Andreev, Dipl.-Ing. Uwe Grätz and Dipl.-Ing. (FH) Achim Lamparter », The 11th International Fluid Power Conference, 11. IFK, March 19-2? 201? Aachen, Germany, for the text, please contact
I discussed in more detail the problems of joining the method of characteristics and solver of ODE.
Who has access to German libraries, the best overview of the methods for solving hyperbolic equations applied to hydraulic lines, which I met, is contained in the following dissertation: Beck, M., Modellierung und Simulation der Wellenbewegung in kavitierenden Hydraulikleitungen, Univ. Stuttgart, Germany, 2003.
Classics of the genre according to hyperbolic equations as a whole: Randall J. Leveque, Finite Volume Methods for Hyperbolic Problems, Cambridge University Press, Cambridge, United Kingdom, 2002.