The first-order forward and backward finite differences in space are, respectively,
The basic upwind scheme for equation (7) is
This specification is incomplete, of course. The various upwind schemes differ in the way in which the intermediate cases are handled; i.e. when the sign of changes amongst the three points of the stencil. The scheme of Engquist and Osher handles the intermediate cases via the formula:
Note that the specification given above is still not complete: the slowness is position-dependent, therefore so is the flux. We have suppressed this dependence in the notation, but it must be respected. Some obvious ways of evaluating the flux lead to inconsistent schemes. In general it seems sufficient to verify that the elementary upwind differences above are recovered when the sign of is consistent. For example, taking the slowness locally constant at its value at seems to work.
Because an explicit scheme is used, each step (fixed by the input slowness grid) may require several partial steps to satisfy the Courant-Friedrichs-Lewy stability condition. The appropriate partial steps are determined adaptively, and the full step is always taken if stably possible. Note the contrast with Vidale's code, which uses an implicit upwind scheme.