第 2 版
等离子体壁相互作用
Multigrid Line Smoothers for Higher Order Upwind Discretizations of Convection-Dominated Problems
C. W. Oosterlee,<sup>∗</sup> F. J. Gaspar, T. Washio, and R. Wienands<sup>∗</sup>
<sup>∗</sup>GMD, Institute for Algorithms and Scientific Computing, D-53754 Sankt Augustin, Germany; C.P.S. University of Zaragoza, 50008 Zaragoza, Spain; C&C Research Laboratories, NEC Europe Ltd., D-53757 Sankt Augustin, Germany E-mail: oosterlee@gmd.de
Received March 4, 1997; revised September 18, 1997
In this paper we present new multigrid line smoothers for the solution of higher order discretizations of convection-dominated problems directly. The behavior of the smoothers is analyzed theoretically with Fourier smoothing and two-grid analysis. A parallel tri-line variant is presented and evaluated. The smoothers are applied to scalar convection-diffusion problems, discretized with limiters and systems of incompressible Navier–Stokes and Euler equations. °c 1998 Academic Press
Key Words: multigrid; line smoothers; higher order discretizations; convection domination.
Listing 1.6. GPP with OpenMP 4.5 directives
#pragma omp target teams distribute
map(to...) map(from:output_re[0:3], output_im[0:3])
for(X){
#pragma omp parallel for
for(N){
for(M){
for(int iw = 0; iw < 3; ++iw){
//Store in local variables
}
}
for(int iw = 0; iw < 3; ++iw){
#pragma omp atomic
output_re[iw] += ...
#pragma omp atomic
output_im[iw] += ...
}
}
}
The target directive on line 1 ofloads the code block that follows the directive onto the accelerator. The teams distribute directives divide the loop iterations into teams and distribute them among the threadblocks. The parallel for on line 4 will distribute the loop among the threads within a threadblock. We inline all function calls from inside the kernel region to avoid additional overhead caused by kernel calls from the device. Array reductions are not supported inside target regions by the xl compilers and therefore we resorted to our atomic update approach. We furthermore need to manage the data accessed inside the target region. This information is passed to the framework via the map clauses and their use is shown in Listing 1.6:
– map(to:input[0:N]) - copy the values in the data structure to the device at the start of the target region.
– map(tofrom:input-output[0:N]) - copy the values in the data structure to-and-from the device
– map(from:output[0:N]) - copy the values in the data structure from the device at the end of the target region
– map(alloc:input[0:N]) - A corresponding storage space for input is created on the device
– map(delete:input[0:N]) - Delete the allocated data on the device
Our initial implementation shown in Listing 1.6 did not make the optimal use of available resources. It generated a kernel with 1280 threadblocks and 354 threads per block. Even though the X loop has only 512 iteration space, xl implementation of OpenMP 4.5 directives generated approximately twice the necessary threadblocks. The xl compilers distributed the N loop following the parallel for directive among the threads of a threadblock. Based on the iteration space and assuming all iterations take similar runtime, every thread would execute 4 iterations of the N loop and in every iteration the M loop is executed sequentially. This implies that the loop which has an iteration space of O(33K) are not parallelized. After experimentation with diferent combinations of work distribution Listing 1.7 shows our best implementation (without replacing atomic) of GPP.
9.3 Explicit Upwind Diferencing
Suppose we are concerned with solving a simple one-dimensional conservation equation such as the continuity equation,
This is of the form of Eq. (9.1) if we identify An explicit, two-time-level method which is conditionally stable involves the use of one-sided, rather than space-centered, diferencing. Backward spatial diferences are used if the velocity u is positive, and forward spatial diferences are used if u is negative.
The basic method is then
This method is known as “upwind,” “upstream,” or “donor cell” diferencing. It has a truncation error , and is stable for . It is instructive to examine the leading order truncation error for the constant u case. Expanding in Taylor series and using Eq. (9.28) to eliminate time derivatives in favor of space derivatives gives for the truncation error
We see that the upwind diference method introduces an artificial (or numerical) difusion term which makes the method stable if so that the efective difusion coeficient in brackets is positive.
To gain further insight as to why the upwind method works and is robustly stable, let us apply it to the simplified case where the velocity u is constant and positive, . Eq. (9.29) then reduces to
where . This is illustrated schematically in Figure 9.3. We see that for , the new value is obtained by following the characteristic curve back to the previous time level n and using linear interpolation to evaluate the intersection point. This also implies that there will be no new minima or maxima since the interpolated value will aways be bounded by the values at the two endpoints. This guarantees stability of the upwind method for

FIGURE 9.3: The upwind method corresponds to linear interpolation for the point where the characteristic curve intersects time level n as long as
As a generalization of Eq. (9.31), we see that it can be written in the form
where the coeficients are all non-negative and are zero except for nearest neighbors, i.e.,
If is a local maximum, then , and so . Conversely, if is a local minimum, then , and so . The scheme is therefore local extremum diminishing. It is clear that a method built on these principles can readily be extended to multiple dimensions.
The diference method described by Eq. (9.29) is conservative if the velocity u doesn’t change sign in the computational domain. If it does change sign, there will be a non-conservative error which introduces an artificial source or sink of mass, although it will be proportional to the local u which would be small since it is passing through zero near that point.
There is a variant of the upwind diferencing method which is fully conservative. We first define average interface velocities on each of the mesh points.
The sign of these velocities determines, by upwind diferencing, which cell values of to use. The method can be expressed as
where
Alternatively, because of the staggered locations, the may be the fundamental variables. In either case, we would define the values as follows:
Because the method of Eq. (9.34) is conservative and also takes centered derivatives of it is generally preferred to that of Eq. (9.29).