Bannister and Mucklow [1] experimentally validated the theory of finite waves using a shock tube experiment. Riemann [11] had earlier proposed the method of ...
17th Australasian Fluid Mechanics Conference Auckland, New Zealand 5-9 December 2010
Improving the accuracy of a 1D Gas Dynamics Model Greg Gibbes, Guang Hong School of Electrical, Mechanical and Mechatronic Systems University of Technology, Sydney, New South Wales 2007, Australia Abstract This paper and its companion present the salient features of a 1D gas dynamics code which traces the propagation of finite amplitude waves along a quasi 1D duct. This model extends an originally first order method to second order, and re-works the way heat transfer is accounted for, including a method for maintaining full mass conservation. The model is fully nonhomentropic, accounting for the large variations in gas properties and temperature that routinely occur in internal combustion engine ducts. In this paper, the model is tested against three basic problems for constant-area frictionless flow – namely propagation of a small short wavelength pulse to test numerical smearing, the shock tube problem to test handling of steep gradients, and the Rayleigh flow problem to test the heat transfer implementation. The tests show the model performs very well in these simple cases which are a pre-requisite to more complex modeling tasks. This mode offers a useful alternative to finite difference based codes and addresses the criticisms usually made of wave action methods. It allows a uniform treatment of duct and cell boundaries to be used throughout. Introduction Unsteady gas dynamics is an important phenomenon in numerous fluid-mechanical devices – most well known of which is the reciprocating internal combustion engine, but also of importance in other unsteady devices such as pulse jet engines and in normally steady flow devices such as gas piping and turbomachinery. Gas dynamic modeling has a long history. The relationship between pressure and velocity for a wave travelling in one direction was derived by Samuel Earnshaw [7] in 1860. Bannister and Mucklow [1] experimentally validated the theory of finite waves using a shock tube experiment. Riemann [11] had earlier proposed the method of characteristics (MOC) and this was now developed into graphical solution for unsteady flow problems. Benson et al. [2] used digital computing and the MOC to evaluate unsteady flows in engine ducts. By the 1980’s gas dynamics in engine modelling using the MOC was well established [3]. Since then finite difference formulations have become popular for engine gas dynamics [12], though research using the MOC continue eg [13]. A vast plurality of numerical schemes and variations on schemes exists in the literature and in engine research laboratories around the world. A code should display good mass conservation, handle thermal and property discontinuities and handle rapid changes in pressure or even shocks. For engine modeling, the code must accuracy simulate flow in tapered ducts and sudden changes in area such as pipe entries, valves, junctions and the like. The accuracy of the discretisation method (be it first, second or higher order) is also important. Finally, the computational efficiency and complexity of the code should be considerd.
1D engine simulations require modeling of multiple boundary connections, tapers and area changes, and gas property changes. These requirements mean that the simple elegance of a finite difference solution is somewhat smothered. A critical comparison of the most popular schemes on all of the above issues is beyond the scope of this paper, and has indeed been attempted by others [5, 6, 10, 12]. This paper and its companion [9] merely present the salient features of another gas dynamics code. This is a wave action based code which addresses the main shortcomings of typical wave action methods. The 1D gas dynamics code introduced in here is based on the method developed at Queens University, Belfast eg. [4, 8] and subsequently adopted by the commercial simulation package Virtual EnginesTM. That method has been slightly re-worked, with the original first order (linear) interpolation of pressure waves extended to second order. Also, the way heat transfer is incorporated is modified and includes a method for achieving full mass conservation.
Theoretical Basis The foundational equation used here for evaluation of unsteady gas flow is that given by Earnshaw [7] for a pressure wave travelling in one direction where a particle experiences a change in velocity as a function of the change in pressure. The equation assumes a calorically perfect gas. 1 2a0 P 2 1 u u0 ( 1) P0
1
(1)
Where u and u0 are the final and initial velocities, P and P0 are the final and initial pressures, is the ratio of specific heats and a0 is the speed of sound at the original pressure P0. The compression or expansion process is assumed to be isentropic, so the final speed of sound is found as: 1
P 2 a a0 P0
2
(2)
In equation (1) the positive direction of velocity is in the same direction as the motion of the pressure wave.
P
PL u
PR u u0
P0
a0 position
Figure 1 Oppositely moving pressure waves.
Setting the quiescent velocity u0 in equation (1) to zero and evaluating the general case of oppositely moving pressure waves as shown in Figure 1, equations for velocity and pressure as functions of the left and right travelling pressure waves can be written as:
u
3
2 a0 X R X L ( 1)
(3)
Second Order Wave Interpolation
X X R X L 1
4
(4)
Velocity u is positive in the rightward direction. The variable X is shorthand for 1
P 2 X P0
5
successive interpolations result in smearing of features. Second, the distance traversed must not be allowed to exceed one mesh space, since this would result in extrapolation and solution instability. As a result the majority of waves in a model will tend to traverse much less than the ideal one mesh space. The socalled Courant number is the proportion of a mesh space traversed by a wave in one time step.
If a third ‘upwind’ mesh point is included in the interpolation procedure, a parabolic curve can be fitted between these points, raising the accuracy from first order to second order and permitting waves to traverse more than one mesh space during a time step. This is illustrated in Figure 3.
(5)
X2
6
(6)
7
( 1) X L X u 1 / 2 2 a0
(7)
The left and right travelling waves are then advanced on a timestep basis where the speed of propagation at each point on the wave is the sum of the local speed of sound and the flow velocity.
cua
(8)
u a0 X
Figure 2 illustrates the procedure for advancing the two waves. Right travelling wave time
Left travelling wave
XR XL
x1
x2
position
Figure 3 second order interpolation of pressure waves
Non-physical overshoots will appear in the solution near large changes in gradient, unless precautions are taken. The method adopted here is to simply limit the value returned from the interpolation to between the upper and lower values in the interval.
The basic theory of wave propagation outlined above does not allow for heat transfer to or from the walls of the duct, or indeed for heat released internally due to chemical reactions. The approach taken here is to treat each section of duct between mesh points as a control volume (computational cell). Midway through each timestep, heat transfer is applied to the gas in each cell, which results in a small instantaneous change in local pressure, but no change in local velocity. Step 1 calculate or estimate the mid cell, mid time step pressure and mass before heat transfer is included. Step 2 calculate the cell pressure that occurs when heat transfer is accounted for. Step 3 alter the left and right travelling waves according to the change in pressure due to heat transfer. Two options are available in step 1. Either pressure information is strictly conserved and cell mass is adjusted accordingly, or mass is strictly conserved and pressure information is adjusted accordingly. Neither option is ideal, so the approach taken here is to apply mild pressure correction (for any accumulating mass imbalance) so that un-necessary changes to the pressure waves are minimised but the scheme retains long term mass conservation.
current time-step
previous time-step
x0
Heat Transfer and Mass Conservation
( 1) X R X u 1 / 2 2 a0
8
Non-overshoot value limit
wave
Wave Propagation Earnshaw’s equation (1) was derived under the conditions of constant flow area, constant gas properties and no friction or heat transfer. If these conditions are met, then the waves will propagate through one another with unchanged magnitude (though they may distort due to uneven propagation velocities). At the any given instant, the value of the left and right travelling pressure waves at all points along the duct can be calculated by re-arranging equations (3) and (4)
Basic curve – three point quadratic
X1 X0
The subscripts R and L signify the rightward and leftward travelling pressure waves respectively. Where X appears without a subscript, this signifies the superposition pressure – ie the static pressure. Note the reference pressure P0 can be set to an arbitrary value, though it should be a similar pressure to that being modelled. It is conventional to set it to atmospheric pressure.
position
Figure 2 advancing pressure waves by one time step
The value of the wave incident on the mesh points at the current time step is found by interpolation of the previous mesh point values. This interpolation is typically linear between the two nearest mesh points. This has two disadvantages. First, unless the wave traverses exactly one mesh space in one time step,
Next the mid cell pressure due to heat transfer and chemical reactions is found (step 2). The change in magnitude of both left and right travelling waves is then calculated as.
9
X L , R
1 1 Pq 2 Pq0 2 /2 P0 P0
(9)
Area Change, Friction and Varying Gas Properties The conditions assumed for equation (1) are too restrictive to directly produce a useful model for the flow of gas in the ducts of engines. Instead the effects of area changes, friction and changes in gas properties must also be included carefully. These are evaluated at the mesh points along the duct. Thus a duct is made up of a string of idealised ducts (cells) where equation (1) and its derivations hold true. At the connection point of each of these idealised segments, any area change, friction or gas property change is accounted for. See [9] for the details of this calculation.
Re-meshing The mesh spacing in a duct should ideally be such that the Courant number is unity. Practically however, it is impossible to achieve this since any change in flow velocity will change the wave speed oppositely in right and left travelling waves. Moreover changes in the temperature and specific heats will also change the wave speeds. Re-meshing allows the mesh spacing of each duct in a model to be adjusted independently from time to time to suit changing flow conditions.
Results and Discussion The 1D gas dynamics model outlined in the first part of this paper will be used to model several test cases of constant area, frictionless flow for which analytical solutions exist. Smearing A high frequency triangular pressure pulse with a wavelength of 12 cells is introduced into a straight, frictionless duct and propagates through the duct for 100 mesh spaces. The amplitude of the wave is small enough that wave distortion due to uneven propagation velocity is negligible. Figure 4 shows the performance of the second order interpolation model for different courant numbers. Figure 5 shows the results of the same problem for standard linear interpolation. Both methods show accumulating interpolation error however there is significantly less smearing for the second order method which preserves better detail. A disturbing phase error is apparent in the second order model though it should be noted that this smear test pushes the code’s limits in resolution, and waves with a longer wavelength propagate with accurate speed. Clearly, Courant numbers close to unity produce better results, but the first order method fails spectacularly if the number exceeds one. Compared to linear interpolation the second order method is markedly improved, with only a small increase in computational effort. Shock Tube This problem as used by [6, 12] tests a code’s ability to handle steep gradients in both pressure (normal shock front) and temperature (contact discontinuity). Figure 6 shows the pressure calculated by the present gas dynamics model. The second order method out-performs the first order method, preserving a steep gradient well. Shock speed is well predicted which is noteworthy since no explicit shock handling algorithm is employed. A small overshoot is apparent on the second order model, which is actually a consequence of the full mass conservation algorithm implemented here, resulting in slight non physical distortion at steep pressure/velocity gradients. The jump condition does not satisfy the Rankine-Hugoniot equation, since the model assumes the compression process across the shock is isentropic, but the error is small at these small pressure ratios. Although not shown, careful evaluation of mass convection allows the thermal contact surface to be resolved over one mesh space – though degrees of mixing can also be specified in the model.
Pa
1.01
70
0.9 0.8
Wave direction
50
0.6
0.4
30 10 -10
Mesh points
-30 -50
exact
-70
Figure 4 Smearing of a triangular pulse traversing 100 mesh spaces - 2nd order interpolation with overshoot prevention and mass conservation. Curves show results for different Courant numbers. 90
Pa
1.01
70
Wave direction
50
0.9 0.6
30 10 -10
0.4
-30
exact
Mesh points
0.8
-50 -70 -90
Figure 5 Smearing of a triangular pulse traversing 100 mesh spaces – 1st order interpolation. Curves show results for different Courant numbers.
Pressure (Bar) Pressure
6 600000 bar 5 500000
first order second order with mass cons. exact
4 400000
bar3 300000 2 200000 1 100000
0 0
0.2
0.4
m
0.6
0.8
1
Figure 6 Shock tube problem. Air, R=287J/kg-K, =1.4, P1=5bar, T1=1200K, P2=1bar, T2=300K. Diaphragm location=0.5m, t=0.5ms. Computational mesh spacing 10mm. Time step 0.01ms K
kPa
1090
Temperature
1070
85
model
Pressure
1050 1030 0.65
95
exact
75 65 0.7
0.75
0.8
0.85
0.9
0.95
1
Mach number Figure 7 Rayleigh flow. Air, R=287J/kg-K, =1.4 Second order with mass conservation compared to exact solution fixed at the left-most data point. Peak Courant number is approx 1.
It must be remarked that this test is not representative of the typical flow in engine ducts, where the pressure ratios are much lower and shocks usually do not have time to fully develop. In this context the failure to properly model the non-isentropic compression process across a shock is unimportant. Rayleigh Flow Figure 7 shows a test of the code’s response to heat transfer using the Rayleigh flow problem. A straight frictionless duct is divided into 10 equal cells and caries a subsonic flow of air. Heat is transferred to/from the air in the duct, resulting in a change of pressure, temperature and velocity along the duct. The critical region near M=1 is shown here by running the model to steady state. The pressure and temperature are a close match with the analytical solution, which is significant because the change in pressure and velocity along the duct is caused indirectly, purely due to the equal application of equation (9) to the left and right travelling waves.
Nomenclature a, a0 c P, P0
q R t u, u0
1
P 2 X P0
Wave action methods are reportedly less efficient than their finite difference counterparts [12]. However for engine modeling codes, it is unfair to base performance comparisons on simple test cases such as the shock tube problem alone since they don’t account for the extra computational load due to multiple boundaries, area changes and gas property variation that exist in typical engines. In this context, overall computational effort compared to a fully capable finite difference scheme is likely to be similar according to [6, 10, 12].
[1]
[2]
[3]
[4]
[5]
[6]
The wave action method presented here uses a uniform boundary calculation for both duct boundaries and all internal cell boundaries [9]. The benefits of the model are summarised as:
[7]
Easily comprehended and visualised. The engine designer benefits from having access to the underlying pressure wave data in post process visualisation of simulation results.
[8]
Simple maths. Undergraduate engineering mathematics is sufficient since only algebraic equations are used. Uniform theoretical treatment of all boundaries including cell boundaries within ducts. Rigorous. The model carefully accounts for non-isentropic flows and variation in gas properties (being thus nonhomentropic), friction and area change. Species mass and thermal energy can be convected with full conservation. Accurate. Compared to the original first order pressure wave interpolation scheme, extension to second order interpolation greatly improves resolution, reduces smearing and allows Courant numbers somewhat greater than 1. Counting against this model is that supersonic flow requires some additional complexity, and also that it assumes the ideal gas equation of state and locally constant specific heats (though the specific heats and temperature are permitted to change in space and time).
pressure amplitude ratio
References
Conclusion The 1D gas dynamics method outlined here addresses most of the criticisms made against wave action methods. The numerical smearing test shows that the second order interpolation method preserves the wave shape quite well over 100 mesh spaces and up to 250 time steps (corresponding to a Courant number of 0.4). Full mass conservation is also implemented with apparently minimal disruption to wave shape. The shock tube problem demonstrates the code’s ability to handle steep gradients in a non-oscillatory way. The Rayleigh flow problem is validation for the heat transfer implementation.
speed of sound, isentropic reference pressure a wave velocity pressure, reference pressure specific heat transfer gas constant time fluid velocity, quiescent fluid velocity ratio of specific heats
[9]
[10]
[11]
[12]
[13]
Bannister, F.K. and G.F. Mucklow, Wave action following sudden release of compressed gas from a cylinder. Proceedings of the Institution of Mechanical Engineers, 1948. vol. 159: p. 269-300. Benson, R.S., R.D. Garg, and D. Woollatt, A Numerical Solution of Unsteady Flow Problems. Int. J. Mech. Sci., 1964. vol. 6: p. 117. Benson, R.S., The Thermodynamics and Gas Dynamics of Internal Combustion Engines Volume 1, ed. J.H. Horlock and D.E. Winterbone. Vol. 1. 1982: Oxford University Press, Walton Street, Oxford. Blair, G.P. An Alternative Method for the Prediction of Unsteady Gas Flow Through the Internal Combustion Engine. 1991: SAE. Paper 911850 Chalet, D., et al. Comparison of Different Methods for the Determination of Pressure Wave in the Inlet and Exhaust Systems of Internal Combustion Engine. 2006: SAE. Paper 2006-01-1542 Depcik, C., B. van Leer, and D. Assanis, The Numerical Simulation of Variable-Property ReactingGas Dynamics: New Insights and Validation. Numerical Heat Transfer, Part A: Applications, 2004. 47(1): p. 27 - 56. Earnshaw, S., On the Mathematical Theory of Sound. Philosophical Transactions of the Royal Society of London, 1860. 150: p. 133-148. Foley, L., et al. One-Dimensional Mass and Energy Transport Using a Modified Mesh Method. 1998: SAE. Paper 982049 Gibbes, G. and G. Hong. A General Boundary Solution Method for 1D Gas Dynamic Models. in 17th Australasian Fluid Mechanics Conference. 2010. Auckland, New Zealand. Kirkpatrick, S.J., et al. Experimental Evaluation of 1-D Computer Codes for the Simulation of Unsteady Gas Flow Through Engines - a First Phase. 1994: SAE. Paper 941685 Riemann, B., Ueber die Fortpflanzung ebener Luftwellen von endlicher Schwingungsweite. Abhandlungen der Königlichen Gesellschaft der Wissenschaften zu Göttingen, 1860. vol. 8 Winterbone, D.E. and R.J. Pearson, Theory of Engine Manifold Design: Wave Action Methods for IC Engineers. 1999: Professional Engineering Publishing Ltd, Suffolk, UK. Zhu, Y. and R.D. Reitz, A 1-D gas dynamics code for subsonic and supersonic flows applied to predict EGR levels in a heavy-duty diesel engine. Int. J. of Vehicle Design, 1999. Vol. 22(3/4): p. 227-252.