INTERACTIVE VISUALIZATION IN
COMPUTATIONAL FLUID DYNAMICS
Ji Zhou
(Center of Aerodynamics Design and Research, Northwestern Polytechnical University,
Xi'an, China, 710072)
Abstract
Using conception of interactive display, the present work makes results of computational fluid dynamics much more comprehensible. Real-time control of the display by simple keyboard operation is convenient and effective. Several typical examples are discussed. When the calculating grid are analyzed, interactive display is powerful to find the characteristics on different scales. So is it in the display of vector field, such as flow velocity field. Some very special problems as result representation of vortex lattice method are also well dealt with by this theory.
Introduction
The intelligible representation of the results of computational fluid mechanics (CFD) is becoming more and more an important branch of the field. Although many commercial visualization software are available presently. But most CFD researchers write their own display programs more often or less because of diversity of the problems in CFD.
Although interactive display is a widely applied concept to make computer graphics more lively and easy to be understood[1], the common user-made display program does not use such a method. In this paper, interactive method improve the performance of the display program significantly. The examples presented include analysis of calculating grid, representation of vector field and observation of complicated surface. And actual applications are more extensive.
In commercial general-purpose software, the operation to control the display conditions usually include keyboard press, combination of keypresses and mouse operation on menu, and sometimes optic pen or tactile screen is used. In present work, interactive display is implemented mainly by single keypresses. Such operation in a program with specific purpose is easier to use. And it is more convenient than complicated menu operation in many situation.
The work described here is a good example that an ad hoc way and also a goal-directed method is simple and efficient[2].
Algorithm and Examples
The traditional result visualizing algorithm used by ordinary CFD user can be described roughly as following figure 1. When you want to get a different vision of the results, you have to change the parameter you use in the program to obtain another display. In many problem, as we will show in the following examples, even a lot of display of printed copy can not make you grasp the calculation result correctly or thoroughly.
input data input data
describing object describing object
initialize
transform and represent modifiable parameters
transform and represent
display graphics
display graphics
end No
event received?
Yes
event to modify parameter?
No
event to stop display
end
Fig.1 Traditional algorithm Fig.2 Interactive algorithm
Similarly as the 'events handling' conception in a window system, we can include the above-mentioned display algorithm in an event handling loop as shown in figure 2. The event to be handled in this loop here is likely very simple operation as a single keypress. The crucial difference is the introduction of the notion of modifiable parameters. These parameters changing during the cycle is the individual characteristic of every interactive display procedure. Size and orientation are among the most basic and common used parameters.
In the situation when a whole display takes a longer time to be generated because of complexity of the graphics or insufficient speed of the machine, the display would better be represented in double-buffering mode. That means graphics is drawn in a hidden color buffer which swaps with the displayed one after drawing completed.
Example 1. Analyzing the characteristics of calculating grid.
Calculating grid plays an influential role in CFD. The global and local density, the orthogality, etc. influence the results of CFD very much. But these characteristics can hardly be judged quantitatively. We need many drawings of different size and different portion of grid to observe and evaluate them. Even after analyzing a lot of drawings, you still find it difficult to get a impression as a whole.
But when the set of grid is displayed and analyzed by interactive algorithm, the observer is made to 'tour' in the grid system and to understand its global property easily. The modifiable characteristic parameters chosen in this example are origin position (x,y) on the screen, size ratio S of grid. The keyboard operation or 'event' to modify these parameters are four arrow keys changing (x,y) to move the origin position of grid system, 'A' or 'a' key increasing S to enlarge the graphic display, and 'Z' or 'z' to reduce the display. Observing the grid interactively, you can know it thoroughly and lively. Two different portion of a set of 2-dimensional grid around NACA0012 airfoil is shown in figure 3.
If a pair of crossed rulers in x and y direction as in figure 1 and a protractor are displayed on the screen also, the analysis of result will be more exact. When used in a window system, the window itself can be enlarged, reduced or changed aspect ratio. It makes the program more convenient.
Example 2. Analyzing flow velocity field.
This is a similar example as the foregoing one. The greatest difficulty in analyzing a vector field as velocity field is that there are several portions of different characteristic scale in the whole field. In some parts there are few velocity vectors and they are not quite different. In other parts, the vectors may be distributed much closely and have more different sizes. Such a field cannot be understand completely with one or a few drawings. Also as in example 1, many different displays or printed drawings are not very easy to grasp.
The vector is usually represented by arrows or short lines drawn from a set of grid points. So the same modifiable parameters and corresponding keys to modify them as in example 1 are needed. Besides, we choose another parameter V to manifest the size of each vector arrow or line. Key '0' is assigned to reduce V and '1' to enlarge it. In the part of field where vectors are very small, enlarged V makes the vectors large enough to be visible . Reduced V helps us to observe the region with larger vector.
Example 3. Observation of complicated 3-dimensional configuration.
In some special problem in fluid dynamics, very odd shape or surface has to be studied. If particular demand is made, general-purpose visualizing software may seem weak or incapable.
Figure 4 is a calculation result of unsteady vortex lattice method[3]. The graphics to be displayed is vortex sheets represented by sets of meshes. Such meshes would rolled up to make the inside part difficult to observe. Sometimes the configuration of the rolled-up surface would be unpredictable. The right upper corner of the screen shows a different perspective of the main display.
In this problem, more modifiable parameters are needed. First, position of origin on the screen (x,y) are controlled by four arrow keys. The size of the display, or 'position in the direction perpendicular to screen', is changed by keys 'A' and 'a'. The former moves the object nearer (enlarging) and the latter moves it far away.
Then there are three angles about the three coordinate axis. We use keys 'X' and 'x' to change the angle or rotate the object about x axis clockwise and counterclockwise. Rotation about the other two axes is controlled by keys 'Y' and 'y', or 'Z' and 'z'.
Changing size and position of whole or part of the display can be used in most kinds of visualizing problems in computational fluid dynamics, such as a pressure coefficient to x graph, a lift coefficient to angle of attack graph, isopotentials and cloud graphics, etc. And every specific problem has its unique modifiable parameters. For example, in x-y graph the scales of two directions would be changed separately and more detailed ruler or coordinates displayed, in isobar cloud graphics the density of the contours and the color range adopted should be changeable. Those examples proved to be very convenient and welcome as well.
In all the applications we can also define some key events to toggle between display and no display of rulers or protractor, send the display to printer, change the color of certain part of the display, etc. to make the program more powerful. But simple keyboard event used to change display interactively is still the characteristic and merit of that method. Most of the examples mentioned are carried out on graphics working stations, but some of applications as grid analysis are also well implemented on microcomputers.
Discussions
Interactive control of display proved to be a critical means to make the display more comprehensible. In the field of CFD, graphics to be displayed is of something unknown or being studied, interactive way enable the observer to 'tour' in the scene or 'manipulate' the object analyzed so that it could be understood thoroughly and lucidly. Even in some very simple display program, the notion of interactive observation implemented by only a perception-action cycle will make the program much more powerful.
Secondly, in those programs not for general purpose, the simple control operation makes the interactive display more effective. Single keypress easy to be remembered or natural mouse operation is the best.
References
[1]Wang Shuoqiang, Interactive Computer Graphics and its Applications, Anhui Science and Technology Press, Hefei, 1987 (in Chinese).
[2]Jean-Michel Jolion, Computer Vision Methodologies, CVGIP:IMAGE UNDERSTANDING, 59(1), 1994, pp.53-71.
[3]Ji Zhou, Study on Unsteady Separated Flow, Journal of Aeronautics, (to be published, in Chinese)
Fig.3 Display of 2-dimensional grid around NACA0012 airfoil
Fig.4 Display of unsteady 3-dimensional vortex lattice