Alternating Direction Implicit method
Equations, coefficients, and quantity definitions for the 2D solver.
Equations and coefficient conversion
Go to problem setupStart with the 2D heat equation
Discretise time and space
Use a backward difference in time and centred second differences in space. The discrete equation at an interior node is
Match the solver’s coefficient form
Factor one grid spacing out of each spatial denominator. For the x direction, the conversion is
Do the same for the y direction, then match the two numerators to this form.
The form above shows all spatial terms at time level n + 1. ADI uses the same coefficients in two sweeps, treating x implicitly first and y implicitly second.
Coefficients to enter
| Input | Meaning | Heat equation value |
|---|---|---|
| a | East neighbour (i + 1, j) | α/Δx |
| b | Centre node, x direction | −2α/Δx |
| c | West neighbour (i − 1, j) | α/Δx |
| d | Source term, x direction | 0 |
| e | North neighbour (i, j + 1) | α/Δy |
| f | Centre node, y direction | −2α/Δy |
| g | South neighbour (i, j − 1) | α/Δy |
| h | Source term, y direction | 0 |
For constant thermal diffusivity, use these values at every interior node. Enter the initial temperatures in U0, set m = 1 and leave G at zero.
Symbols
- T
- Temperature in a consistent unit throughout the grid.
- Ti,jn
- Temperature at grid node (i, j) at the current time level n. The superscript n + 1 indicates the next time level.
- x, y, t
- Spatial coordinates x and y in metres, and time t in seconds.
- i, j, k
- Zero-based x-node, y-node, and variable indices. In this single-temperature model, k is 0.
- α
- Thermal diffusivity, in m²/s.
- Nx
- Number of nodes in the x direction.
- Ny
- Number of nodes in the y direction.
- m
- Number of variables or equations at each node.
- Δx
- Grid spacing in the x direction, in metres for the heat example.
- Δy
- Grid spacing in the y direction, in metres for the heat example.
- Nt
- Number of time steps.
- Δt
- Time step size, in seconds for the heat example.
- U0
- Initial values on the grid. For heat diffusion these are the temperatures at time level 0.
- G
- m × m matrix for coupling different variables at the same node.
Two directional sweeps
The Alternating Direction Implicit (ADI) method in Chapter 4 of the Adsorption Chiller project report treats x implicitly during the first half step and y implicitly during the second. The other direction is evaluated from known values in each sweep. The solver applies the Thomas algorithm to scalar tridiagonal systems and the Block Thomas algorithm to locally coupled variables.
Symbols
- I
- Identity matrix.
- Δt
- Full time step. Each sweep uses Δt/2.
- Lx, Ly
- Discrete x and y operators. Each includes half of the local coupling matrix G.
- Un, U*, Un+1
- Current, intermediate, and next-step solution vectors.
- n
- Time-level index.
- S
- Combined source term for both directions.
- d, h
- Source coefficients in the x and y directions.
- Δx, Δy
- Grid spacing in the x and y directions.
Coupled equations
When each node has multiple variables, use the same coefficient form for the state vector U and include the local coupling term.
Symbols
- UP
- State vector at the centre node.
- UE, UW
- East and west neighbour vectors.
- UN, US
- North and south neighbour vectors.
- G UP
- Contribution of the variables at the centre node to each other through the coupling matrix G.
Numerical method terms
| Quantity | Definition |
|---|---|
| Spatial coupling | Dependence between neighbouring nodes through the discretised x and y operators. |
| Tridiagonal system | A linear system whose only potentially nonzero entries lie on the main and adjacent diagonals. |
| Block Thomas method | A line solver that treats each tridiagonal entry as a matrix block so it can solve interacting variables together. |
| Explicit method | Uses known values from the current step to calculate the next step directly. |
| Implicit method | Includes unknown values from the next step in a system that is solved simultaneously. |
Boundary convention
Fixed edge values from U0 are the default and enter both sweeps. Desktop compatibility reproduces the Python line solves, which omit the implicit end contributions while still using edge values in the explicit terms. A grid with fewer than three nodes in either direction returns the initial values.
Worked example
For α = 1, Δx = Δy = 1, Δt = 0.1 and Nt = 10, set the edge values to 100 and the centre to 0 on a 3 × 3 grid. With fixed boundaries the solver returns 98.1928405 at (1, 1, 0). Use Load example in the full solver to run these inputs.
References
Project Adsorption Chiller, Chapter 4 (ADI method) and Chapter 5 (ADI Solver GUI), and the accompanying Python Tkinter source.