## Vapor Diffusion in a Tube Again

This example, using the same data, illustrates the use of a smaller grid size. The spreadsheet ('Crank-Nicholson 3'), not shown here, can be examined on the accompanying CD-ROM. The x-increment is 2 cm, thus creating a table of values that is 11 columns wide, including the boundary values, and requiring a 9 x 9 matrix of coefficients.

The spreadsheet employs a single formula for all cells of the coefficients table:

=IF(CoeffTableRow=CoeffTableCol,2+2*f,IF(ABS(CoeffTableRow-CoeflTableCol)=1,-f,0))

The formula uses the following named formulas CoeffTableCol =COLUMN()-MIN(COLUMN(coefficients)) CoeffTableRow =ROW()-MIN(ROW(coefficients))

Thus a Crank-Nicholson calculation can be set up on a spreadsheet using a single formula to create the coefficients table, a (different) single formula to create the constants table, and a single formula for the values table.

The results using the smaller grid size are shown in the following chart. 0 200 400 600 800 1000 1200 Time, seconds

Figure 12-11. Chart of the results produced by the spreadsheet shown in Figure 12-10. (folder 'Chapter 12 (PDE) Examples, workbook 'Parabolic PDE', sheet 'Crank-Nicholson 3')