This module illustrates fully discrete finite difference methods for
numerically solving the convection-diffusion equation. The
convection-diffusion equation (sometimes called the transport equation)
in one dimension is the partial differential equation
The user begins by selecting the convection constant c, the diffusion constant d, and an initial function. The initial function, represented by a truncated Fourier sine series approximation, is plotted on a predetermined interval. Depending on the selected constants, boundary conditions g(t) and h(t) are determined to define a problem with a known exact solution. Next the user chooses a fully discrete finite difference method to apply to the convection-diffusion equation. Methods not named after specific people use a two-word naming convention in which the first and second words describe the finite difference approximations to the time derivative ut and the convective term ux, respectively. The diffusive term uxx is approximated by centered differences in all cases. The stencil of the selected method is shown below, with the point being computed colored red, the other points used in the difference scheme colored blue, and any remaining points colored black. The red and blue points are drawn with three different levels of intensity to indicate how many of the terms in the convection-diffusion equation they are used to approximate. A point that is used in approximating only one term (e.g., the diffusive term uxx) is drawn with the lowest intensity, while a point used in approximating all three terms has the highest intensity. Finally, the user specifies the step sizes in space and time for the discrete mesh of points used in the finite difference method. The stability limit shown below gives, for the chosen constants c and d and the selected space step size, the restriction on the size of the time step in order for the specified numerical method to be stable. If the time step chosen violates this restriction, then the numerical solution may oscillate wildly and bear little resemblance to the true solution. A value of infinity for the stability limit indicates unconditional stability.
To view the numerical solution, the user chooses between
two-dimensional and three-dimensional display modes and clicks
Start. The approximate solution is advanced time step by time
step, and the plot of the solution is updated accordingly. In
two-dimensional display mode, the solution at the current time is
plotted as a curve on the spatial interval
Details:
All of the finite difference methods implemented are discussed in [1],
in which each of the six is shown to be a special case of a general
finite difference equation, depending on the choice of two weights,
φ and θ. Unfortunately, that general equation
(4.6) in [1] is incorrect. Taking the terms in the same order, the
correct coefficients are
References
Developers: Evan VanderZee and Michael Heath