shad manual

Upload: lclout

Post on 30-May-2018

237 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 Shad Manual

    1/52

    Preprint LDC-2010-0014/18/2010

    SHAD: A SIMPLIFIED HYDRODYNAMICS PROGRAM FOR

    TRANSIENT COMPRESSIBLE FLUID FLOWS

    Lawrence D. Cloutman

    [email protected]

    Abstract

    We describe a simple two-dimensional, transient, Eulerian hydrodynamics algo-

    rithm that has capabilities for a wide range of applications. It is based on a variant

    of the ICE method, which is useful at all flow speeds. The method is implemented in

    a very simple Fortran program, SHAD. Besides being useful as a research tool, SHAD

    is useful as a teaching tool for beginners in computational fluid dynamics. It is easily

    modified by the user, making it useful as a test bed for new methods. Several numerical

    examples are discussed.

    c2010 by Lawrence D. Cloutman. All rights reserved.

    1

  • 8/9/2019 Shad Manual

    2/52

    1 Introduction

    Fluid flows in a compressible fluid occur in a wide variety of situations, ranging from very slow

    (such as air movement by air conditioners) to high speed subsonic flows (such as air flows over

    commercial airliners) to hypersonic (such as flows around spacecraft during reentry). Length

    scales range from submillimeter (such as boundary layers) to laboratory scale (combustionexperiments) to industrial scale (smokestack plumes) to planetary scale (meteorology) to

    astronomical scale (convection and explosions in stars). All these flows are described by the

    full Navier-Stokes equations, and their numerical simulation ranges from easy to extremely

    difficult.

    Explicit numerical techniques usually work efficiently for flows with a Mach number

    greater than 0.1 or so. However, many important flows occur at lower speeds, and these

    are more of a challenge to simulate efficiently. First, the low Mach number makes explicit

    techniques inefficient because the time step is limited by the sound speed rather than the

    fluid speed. Second, the buoyancy forces tend to be rather small compared to, for example,

    gravity. Often these flows are simulated with the Boussinesq approximation in which density

    fluctuations are ignored except in the gravitational acceleration. Incompressible flows are

    relatively easy to calculate (for example, with the MAC method [1, 2, 3]), but this approach

    fails when large density variations occur, such as in combustion, the solar granulation, and

    large-scale meteorological flows such as thunderstorms. For these cases the compressible flow

    equations should be used, and implicit numerical methods should be employed to improve

    the stability limits on the time step.

    One partially implicit technique that has been used successfully for low Mach numberflows is the ICE method [4, 5]. The basic idea is to make the pressure gradient in the mo-

    mentum equation and the advection term in the continuity equation implicit, which removes

    the sound speed from the Courant condition on the time step. The original ICE method al-

    gebraically combines the momentum and continuity equations to derive a diffusion equation

    to calculate the advanced time pressure, but it suffers from numerical instabilities when the

    Mach number gets below approximately 0.01. The ICED-ALE method [6, 7] introduced a

    more stable form of ICE that also makes the P dV work term in the energy equation implicit

    by iterating on the density, internal energy, and velocity until the pressure from the pressure

    iteration agrees with the equation of state pressure. The SOLA-ICE Eulerian program [8]

    employs a similar version of ICE. The resulting nonlinear algebraic equations are solved by

    successive over-relaxation (SOR) of Newtons method. The low Mach number instabilities

    no longer occur, although SOR requires accurate convergence and converges slowly at very

    low Mach numbers.

    Since SOLA-ICE was written in the days of mainframe computers and punch cards,

    2

  • 8/9/2019 Shad Manual

    3/52

    we decided update it to reflect changes in computers and programming languages during

    the last 35 years. The resulting program, SHAD, 1 is presented in this report. However, we

    retained the simplicity and ease of use of the original program so it can still be used as a

    teaching tool and test bed for new methodology while retaining the capability to perform

    useful fluid dynamical research. Because SHAD is still simple and easy to modify, the user

    may add new capabilities as needed.

    Section II presents the governing equations, Section III describes the algorithm in

    detail, Section IV discusses some numerical results, and Section V contains our conclusions.

    1Shad are a large group of fish that vary from commercially important species to small baitfish used as

    forage for game fish.

    3

  • 8/9/2019 Shad Manual

    4/52

    2 Governing Equations

    The SHAD program is based on the Navier-Stokes equations for a one-component compress-

    ible fluid in an Eulerian coordinate system. In this section, we present the general equations,

    the equations specialized to two-dimensional Cartesian and cylindrical coordinates, the con-

    stitutive relations used in the program, and a comment on the stream function.

    2.1 The General Equations

    The continuity equation is

    t+ (u) = 0, (1)

    where is the density, t is time, and u is the velocity.

    The momentum equation is

    u

    t + u u = g P + T, (2)

    where g is the gravitational acceleration, P is the pressure, and T is the stress tensor

    T = [u + (u)T] + 1 u U. (3)

    Here U is the unit tensor, and is the coefficient of viscosity, and 1 is the second coefficient

    of viscosity.

    We express energy conservation in terms of the specific internal energy I:

    (I)

    t + (Iu) = P u +T

    : u + (KT), (4)

    where I is the specific internal energy, and T is the temperature.

    2.2 The Two-Dimensional Equations

    The program uses the two dimensional Eulerian equations in both Cartesian and cylindrical

    coordinates. The continuity equation becomes

    t+

    1

    r

    (ru)

    x+

    (v)

    y= 0, (5)

    where x is the horizontal or radial coordinate, y is the vertical or axial coordinate, and

    u = (u, v). The variable r is unity in Cartesian coordinates and equal to x in cylindrical

    coordinates.

    The momentum equations are

    u

    t+ u

    u

    x+ v

    u

    y

    = gx

    P

    x+

    4

    3

    2u

    x2+

    2u

    y2+

    1

    3

    2v

    xy

    +

    4

    3x

    u

    x

    u

    x

    (6)

    4

  • 8/9/2019 Shad Manual

    5/52

    and

    v

    t+ u

    v

    x+ v

    v

    y

    = gy

    P

    y+

    4

    3

    2v

    y2+

    2v

    x2+

    1

    3

    2u

    xy

    +

    x

    v

    x+

    1

    3

    u

    y

    , (7)

    where is zero in Cartesian coordinates and unity in cylindrical coordinates. Here we have

    assumed that the viscosity is constant and that the second coefficient of viscosity 1 is

    1 = 2

    3. (8)

    Also, (gx, gy) is an external body acceleration (for example, gravity).

    The internal energy equation is

    (I)

    t+

    1

    r

    (ruI)

    x+

    (vI)

    y= P

    1

    r

    (ru)

    x+

    v

    y

    + K

    1

    r

    x

    r

    T

    x

    +

    2T

    y2

    +

    2

    ux2

    + 2

    yy2

    +

    uy + vx2

    + 2u

    2

    x2 23

    1r (ru)x + vy2

    , (9)

    where K is the conductivity, which is assumed to be a constant.

    2.3 Constitutive Relations

    The gas constitutive relations are very simple: We assume the equation of state for an ideal

    gas with a constant molecular weight M and constant ratio of specific heats . The thermal

    equation of state is

    P = F(, I) =

    RT

    M = ( 1)I, (10)where R is the universal gas constant. The caloric equation of state is

    I = CvT =RT

    ( 1)M. (11)

    The conductivity is given by

    K =Cv

    Pr, (12)

    where Pr is the Prandtl number.

    2.4 The Stream Function

    For incompressible flows, the stream function is a useful concept. Many two-dimensional

    programs use the stream function as a primary computational variable instead of velocity.

    One advantage of this approach is that the velocity field derived from the stream function

    automatically satisfies the constraint u = 0.

    5

  • 8/9/2019 Shad Manual

    6/52

    The concept can be extended to steady compressible flows. In three dimensions, the

    stream function is the vector potential A such that u = A. This velocity field

    automatically satisfies the steady-state condition u = 0 since the divergence of a curl is

    identically zero. For our two-dimensional calculations in the coordinates (x, y), the (scalar)

    stream function is the z-component of A. The velocity components are

    u =

    y(13)

    and

    v = 1

    r

    r

    x. (14)

    One important feature of the stream function is that the velocity vector should be

    tangent to the streamlines at every point. The normal to the streamlines is , so we require

    u = 0. It is easy to show that this is not the case in cylindrical coordinates. However,

    if we use as the stream function = r,

    u =1

    r

    y(15)

    and

    v = 1

    r

    x. (16)

    Now we have u = 0.

    The stream function is computed in SHAD only as a supplemental variable to be

    printed in a crude printer plot. Printer plots cannot be used to show velocity vectors, so

    the stream function is used to show the flow pattern. It is computed by specifying a zerovalue at the lower left corner of the grid. Then we integrate equation (16) to the right along

    the bottom boundary. Finally, equation (15) is integrated vertically for each column of cell

    corners. For transient problems, a slightly different flow pattern would be found doing the

    integrations in the opposite order (that is, up along the left, then to the right along rows of

    cell corners), so the plotted flow pattern is only approximate for transient problems.

    6

  • 8/9/2019 Shad Manual

    7/52

    3 Numerical Algorithm

    The finite difference mesh used for numerical solution of the above equations consists of

    rectangular cells of width x and height y. The part of the mesh that contains the fluid

    is composed of IBAR cells in the x-direction, labeled with the index i, and JBAR cells in

    the y-direction, labeled with the index j. The fluid region is surrounded by a single layerof fictitious cells so the complete mesh is IMAX = IBAR + 2 by JMAX = JBAR + 2 (see

    figure 1).

    The finite difference subscripting used in this report is illustrated in figure 2. Sub-

    scripts i and j denote cell centers, i + 1/2 denotes the right cell edge, and j + 1/2 denotes the

    upper cell edge. Velocity components are defined at the centers of cell edges, with ui1/2,j

    defined on the vertical (left and right) edges and vi,j1/2 defined on horizontal (upper and

    lower) edges. All other quantities, such as density, pressure, and internal energy, are defined

    at cell centers. The half-integer subscripts on the velocity components are converted into

    integer indices in the program as illustrated in figure 2. A superscript n denotes a quantity

    evaluated at time tn = n t, where t is the time step. For convenience, we will omit the

    superscript on quantities evaluated at time level n.

    The reason for this particular form of staggered grid is to minimize a particular failure

    mode sometimes called hourglassing by eliminating numerical differentiation across more

    than one zone at a time. Hourglassing is characterized by an every-other-zone component of

    the velocity field, e.g. ui+1/2,j = (1)i+j . Hourglassing problems usually are due to difference

    methods that are blind to this mode, producing no restoring force to damp it. This lack

    of restoring forces happens with methods such as FLIC [9] that put all quantities at thesame location. In that case, the hourglassing occurs because the pressure gradient at a cell

    center is independent of the pressure there. In effect, there are two independent pressure

    fields each defined on alternate cell centers but offset by one cell. The staggered grid avoids

    this problem by taking pressure gradients over a distance of x rather than 2 x.

    Each computational cycle advances the solution one time step and is divided into

    three phases:

    1. Explicit momentum equations provide estimates of the advanced-time velocity.

    2. Advanced-time pressures are computed iteratively, which also updates velocities toinclude advanced-time pressure gradients.

    3. Solve for advanced time density and internal energy using the advanced-time velocities.

    7

  • 8/9/2019 Shad Manual

    8/52

    3.1 Phase 1. Explicit Velocities

    We begin the first phase by adding explicit gravity, pressure gradient, advection, and viscous

    terms to the velocity components:

    ui+1/2,j = ui+1/2,j + tgx uu

    xi+1/2,j

    vu

    yi+1/2,j

    2

    x

    Pi+1,j Pi,j

    i+1,j + i,j

    +2

    i+1,j + i,j

    4

    3 x2

    ui+3/2,j 2ui+1/2,j + ui1/2,j

    +

    1

    y2

    ui+1/2,j+1 2ui+1/2,j + ui+1/2,j1

    +1

    3xy

    vi+1,j+1/2 vi+1,j1/2 vi,j+1/2 + vi,j1/2

    +4

    3xi+1/2

    1

    2 x(ui+3/2,j ui1/2,j)

    ui+1/2,jxi+1/2

    (17)

    and

    vi,j+1/2 = vi,j+1/2 + t

    gy

    uv

    xi,j+1/2

    vv

    yi,j+1/2

    2

    y

    Pi,j+1 Pi,ji,j+1 + i,j

    +2

    i,j+1 + i,j

    4

    3 y2

    vi,j+3/2 2vi,j+1/2 + vi,j1/2

    +

    1

    x2

    vi+1,j+1/2 2vi,j+1/2 + vi1,j+1/2

    +1

    3 xy

    ui+1/2,j+1 ui+1/2,j ui1/2,j+1 + ui1/2,j

    +

    2xi

    1x

    (vi+1,j+1/2 vi1,j+1/2)

    +1

    3 y(ui+1/2,j+1 ui+1/2,j + ui1/2,j+1 ui1/2,j)

    . (18)

    We evaluate the radial advection of radial velocity using a linear combination donor

    cell (upwind) differencing and centered differencing. Let , 0 1, be the donor cellfraction. Then

    uu

    x

    i+1/2,j

    =(1 )

    2 xui+1/2,j

    ui+3/2,j ui1/2,j

    +

    2 x

    ui+3/2,j ui1/2,j

    ui+1/2,j |ui1/2,j |

    +

    ui+1/2,j ui1/2,j

    ui+1/2,j + |ui1/2,j |

    .

    (19)

    The axial advection of radial momentum isv

    u

    y

    i+1/2,j

    =(1 )

    2 yvi+1/2,j ui+1/2,j+1 ui+1/2,j1

    +

    2 y

    ui+1/2,j+1 ui+1/2,j

    vi+1/2,j |vi+1/2,j |

    +

    ui+1/2,j ui+1/2,j1

    vi+1/2,j + |vi1/2,j |

    (20)

    where

    vi+1/2,j =1

    4

    vi+1,j+1/2 + vi+1,j1/2 + vi,j+1/2 + vi,j1/2

    . (21)

    The advection of axial momentum is differenced in the obvious analogous fashion.

    8

  • 8/9/2019 Shad Manual

    9/52

    3.2 Phase 2. Pressure Iteration

    In the second phase, we calculate a partially implicit solution by solving the following equa-

    tions for the starred variables.

    i,j = i,j/[1 + t( u)i,j], (22)

    Ii,j = Ii,j t Pi,j

    i,j( u)i,j , (23)

    Pi,j = f(

    i,j , I

    i,j), (24)

    ui+1/2 = ui+1/2,j t

    i+1/2,j x(Pi+1,j P

    i,j), (25)

    vi,j+1/2 = vi,j+1/2 t

    i,j+1/2 y(Pi,j+1 P

    i,j), (26)

    and

    ( u)i,j = (ri+1/2u

    i+1/2,j ri1/2u

    i1/2,j)ri x

    + v

    i,j+1/2 v

    i,j1/2

    y. (27)

    Note that the advanced time density and internal energy are approximated by inviscid La-

    grangian approximations to the continuity and energy equations. Equations (22) through (27)

    form a set of coupled nonlinear algebraic equations. These algebraic equations can be solved

    iteratively by successive over-relaxation (SOR) of Newtons method. This is done by finding

    a set of starred variables such that

    W(Pi,j ,

    i,j , I

    i,j)) P

    i,j F(

    i,j , I

    i,j) = 0, (28)

    where F is defined in equation (10).

    We begin the iteration procedure by making a guess at the solution. Let a superscript

    () denote the iteration count. This initial guess (= 0) is the time-n density, internal energy,

    and pressure along with u(0)i1/2,j = ui1/2,j and v

    (0)i,j1/2 = vi,j1/2. Then each iteration ()

    takes the latest information from iteration ( 1) and computes updated values for all

    variables in a sweep over the entire mesh. In each real cell after iteration (), we have

    estimates of and I that do not satisfy equation (28) exactly. We calculate the nonzero

    value of W()i,j = W(P

    ()i,j ,

    ()i,j , I

    ()i,j ) using the latest estimates and then calculate a pressure

    correction P()i,j such that

    W(+1)i,j = W

    ()i,j +

    W

    P

    i,j

    P()i,j = 0, (29)

    and

    P(+1)i,j = P

    ()i,j + P

    ()i,j . (30)

    9

  • 8/9/2019 Shad Manual

    10/52

    For now, assume that we have computed Bi,j = / (W/P)i,j before we begin the

    iterations. The constant is the over-relaxation parameter. We shall discuss shortly how to

    choose and compute (W/P)i,j .

    Given the velocity components from iteration (), we begin the next iteration by

    computing

    D()i,j =

    ri+1/2u()i+1/2,j ri1/2u()i1/2,jri x

    +v()i,j+1/2 v()i,j1/2

    y, (31)

    () = ni,j / (1 + t D()i,j ), (32)

    and

    I() = Ii,j t P()i,j D

    ()i,j /

    ni,j. (33)

    Then from equations (28) and (29),

    P()i,j = Bi,j F(

    (), I()) P()i,j . (34)

    Next the pressure is updated using equation (30), and the velocity is updated by

    u(+1)i1/2,j = u

    ()i1/2,j

    2 tP()

    x (ni1,j + ni,j)

    (35)

    and

    v(+1)i,j1/2 = v

    ()i,j1/2

    2 tP()

    y (ni,j1 + ni,j)

    . (36)

    This procedure is repeated for every real cell, and then iteration (+ 1) can be started. The

    iterations are continued until|P()| P

    (+1)i,j , (37)

    where > 0 is a small constant, for every cell. Then we take un+1i+1/2,j = u(+1)i+1/2,j , v

    n+1i,j+1/2 =

    v(+1)i,j+1/2, and P

    i,j is an approximation to Pn+1i,j used in the energy equation.

    To compute the Bi,j , we note that

    W

    P= 1

    F

    P. (38)

    The derivative ofF is evaluated numerically by perturbing Pni,j by some more or less arbitrary

    perturbation, say Pi,j = 104Pni,j . This perturbation changes the velocities on the four

    cell faces by

    ui1/2,j = 2 Pi,j t

    xi1/2

    ni1,j + ni,j

    , (39)and

    vi,j1/2 = 2 Pi,j t

    zj1/2 (ni,j1 +

    ni,j)

    , (40)

    10

  • 8/9/2019 Shad Manual

    11/52

  • 8/9/2019 Shad Manual

    12/52

    3.3 Phase 3. Continuity and Energy Equations

    Once the pressure iteration has converged, we can use the advanced-time velocities to solve

    the continuity and energy equations.

    3.3.1 Conservative Advection Terms

    The original SOLA-ICE program solved the internal energy equation based on the noncon-

    servative form of the advection term, uI. This is unnecessary and leads to the possibility

    of significant errors in the conservation of total energy. The I equation in SHAD uses the

    conservative form (Iu). The flux on the right cell face for the cell-centered scalar I is

    (Iu)i+1/2,j =(1 )

    2(i+1,jIi+1,j + i,jIi,j)ui+1/2,j

    +

    2i+1,jIi+1,j(ui+1/2,j |ui+1/2,j | ) +

    2i,jIi,j(ui+1/2,j + |ui+1/2,j | )

    =1

    2 (i+1,jIi+1,j + i,jIi,j)ui+1/2,j

    2 |ui+1/2,j| (i+1,jIi+1,j i,jIi,j ). (46)

    This approximation assumes a mixture of centered and donor cell fluxes with donor cell

    fraction . Fluxes on the other three cell faces are defined in the obvious way. Density

    fluxes for the continuity equation are computed simply by setting I to unity.

    3.3.2 Continuity Equation

    The difference approximation to the continuity equation is

    n+1i,j i,j

    t

    = 1

    ri xri+1/2(u)i+1/2,j ri1/2(u)i1/2,j

    1

    y(v)i,j+1/2 (v)i,j1/2 .

    (47)

    3.3.3 Energy Equation

    The difference approximation to the energy equation is

    n+1i,j In+1i,j i,jIi,j

    t=

    K

    ri Cv x2

    ri+1/2 (Ii+1,j Ii,j) ri1/2 (Ii,j Ii1,j)

    +K

    Cv y2[Ii,j+1 2Ii,j + Ii,j1] P

    i,j( u)n+1i,j

    1ri x

    ri+1/2(Iu)i+1/2,j ri1/2(Iu)i1/2,j

    1

    y

    (Iv)i,j+1/2 (Iv)i,j1/2

    . (48)

    The SHAD program does not include the viscous dissipation terms. For the low-speed

    flows considered here, this is a good approximation. However, for transonic or faster flows,

    these terms should be included.

    Once the energy equation has been solved, we can recover Tn+1i,j from In+1i,j and com-

    pute Pn+1i,j from the equation of state. We are now ready to begin the next cycle.

    12

  • 8/9/2019 Shad Manual

    13/52

    3.4 Boundary Conditions

    Boundary conditions are imposed by setting appropriate values of the dependent variables

    in the fictitious cells surrounding the mesh. This procedure is simpler than using IF-tests in

    all DO-loops or special difference equations for boundary cells. We have built four kinds of

    boundary conditions into the program: rigid free-slip, rigid no-slip, periodic, and continuativeoutflow. Specified inflow-outflow boundaries often are useful, and they can be programmed

    easily.

    As an example of how to treat boundary conditions, consider the left wall. For a rigid

    free-slip boundary, the normal velocity component must be zero, and the tangential velocity

    component must have no normal gradient:

    u3/2,j = 0, (49)

    u1/2,j = u5/2,j ,

    and

    v1,j+1/2 = v2,j+1/2 (50)

    for all j. The variables and I are treated the same as v for an adiabatic boundary.

    For some problems, it will be necessary to set function values on boundaries. For

    example, if we want to impose an internal energy Ib,j on the left wall at a height of j cells,

    we set

    I1,j = 2 Ib,j I2,j . (51)

    If the left boundary is a no-slip rigid wall, then the tangential velocity componentshould also be zero, and the conditions imposed are

    u3/2,j = 0, (52)

    u1/2,j = u5/2,j ,

    and

    v1,j+1/2 = v2,j+1/2 (53)

    for all j. The variables and I are treated the same as for a free-slip boundary. These

    conditions are imposed after each pressure iteration.

    Inflow and outflow boundaries always pose special problems for finite difference pro-

    grams because there is always the possibility that nonphysical waves may be reflected into

    the mesh, causing significant errors. The program described in this report has a continuative

    outflow boundary, which is usually satisfactory for supersonic outflow. For subsonic outflow,

    13

  • 8/9/2019 Shad Manual

    14/52

    it is mathematically inconsistent, but sometimes works (for example, [10]). For the left wall,

    the continuative boundary condition is

    u1/2,j = u3/2,j = u5/2,j ,

    and

    v1,j+1/2 = v2,j+1/2 (54)

    for all j. We treat and I the same as v. These conditions are imposed only after the

    pressure iterations have converged and not after each pressure iteration. During the iteration

    the normal boundary velocities can vary with changes in the pressure, just as any interior

    velocity component.

    For periodic boundaries in the x-direction, both the left and right boundaries must

    be set to impose the periodicity. Assume there are N real zones in the x-direction. Then

    the boundary conditions for the fictitious cells on the left are

    u3/2,j = uN+3/2,j ,

    v1,j+1/2 = vN+1,j+1/2,

    1,j = N+1,j ,

    and

    I1,j = IN+1,j (55)

    for all j. On the right,

    uN+5/2,j = u5/2,j ,

    vN+2,j+1/2 = v2,j+1/2,

    N+2,j = 2,j ,

    and

    IN+2,j = I2,j (56)

    for all j. These conditions are imposed after each pressure iteration.

    Boundary conditions similar to those for the left wall are used at the right, top, and

    bottom boundaries of the mesh. Of course, the normal and tangential velocities at the top

    and bottom boundaries are v and u respectively.

    14

  • 8/9/2019 Shad Manual

    15/52

    3.5 Stability Conditions

    In general, the exact stability requirements of a given algorithm cannot be specified due to the

    presence of nonlinear terms. However, heuristic stability analysis [11, 12, 13] and linearized

    von Neumann stability analysis [14] of the difference equations gives us some approximate

    stability conditions that are usually necessary (but not always sufficient) conditions for sta-bility.

    The first limit on the time step is that the fluid cannot move more than one cell width

    per time step. This can be shown for a simplified model advection equation [14], and it is

    verified by experience. Thus, we require

    t < mini,j

    xui+1/2,j ,

    yvi,j+1/2 , (57)

    where the minimum is with respect to every cell in the mesh. Typically, t is chosen equal

    to one-fifth of the minimum cell transit time. Although the formal (linear) stability limit ismuch larger, the smaller time step is required for accuracy. For example, we do not want a

    time step so large that the density in a cell goes negative. This can happen for donor cell

    differencing in a square cell with the same outward velocity component on each cell face if

    |u| t/x is greater than 0.25 because each cell face transports out over a quarter of the mass

    in the cell in one time step. So for donor cell differencing, we must limit |u| t/x to less

    than 1/2Nd, where Nd is the number of dimensions of the calculation, to insure positivity of

    the density in each cell.

    A second stability requirement is related to the explicit diffusion terms in the momen-

    tum and energy equations. Momentum and energy must not diffuse more than approximately

    one cell per time step. If these equations are analyzed as pure diffusion equations, then a

    von Neumann stability analysis shows that

    t