# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.analysis.differentialequation.pde.finitedifference.parabolic.dim2

## Class AlternatingDirectionImplicitMethod

• java.lang.Object
• com.numericalmethod.suanshu.analysis.differentialequation.pde.finitedifference.parabolic.dim2.AlternatingDirectionImplicitMethod
• All Implemented Interfaces:
PDESolver

public class AlternatingDirectionImplicitMethod
extends Object
implements PDESolver
Alternating direction implicit (ADI) method is an implicit method for obtaining numerical approximations to the solution of a HeatEquation2D. The idea behind the ADI method is to split the finite difference equations into two, one with the x-derivative taken implicitly and the next with the y-derivative taken implicitly, that allows solving the symmetric and tridiagonal systems of linear equations by using LU decomposition, at each step. Solutions are computed on a three-dimensional grid (time and x- and y-coordinates).

This method is unconditionally stable and is a second-order method with a truncation error of order $$O(\Delta t^2 + \Delta x^2 + \Delta y^2)$$.

Since a linear system for each row/column at the same time step can be solved independently, parallel computation by multi-core processor can be used for higher performance. By default, this option is turned on.

Wikipedia: Alternating direction implicit method
• ### Constructor Summary

Constructors
Constructor and Description
AlternatingDirectionImplicitMethod(double epsilon)
Create an ADI method with the given precision parameter.
AlternatingDirectionImplicitMethod(double epsilon, boolean parallel)
Create an ADI method with the given precision parameter, and choice for using multi-core parallel computation for higher performance.
• ### Method Summary

All Methods
Modifier and Type Method and Description
PDESolutionTimeSpaceGrid2D solve(HeatEquation2D pde, int m, int n, int p)
Solve the given two-dimensional heat equation problem, with the given numbers of points along the three axes in the grid (time, x, and y).
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### AlternatingDirectionImplicitMethod

public AlternatingDirectionImplicitMethod(double epsilon)
Create an ADI method with the given precision parameter. By default, multi-core parallel computation is used for higher performance.
Parameters:
epsilon - the precision parameter
• #### AlternatingDirectionImplicitMethod

public AlternatingDirectionImplicitMethod(double epsilon,
boolean parallel)
Create an ADI method with the given precision parameter, and choice for using multi-core parallel computation for higher performance.
Parameters:
epsilon - the precision parameter
parallel - true to turn on parallel computation
• ### Method Detail

• #### solve

public PDESolutionTimeSpaceGrid2D solve(HeatEquation2D pde,
int m,
int n,
int p)
Solve the given two-dimensional heat equation problem, with the given numbers of points along the three axes in the grid (time, x, and y).
Parameters:
pde - the heat equation problem
m - the number of grid points along the time-axis (excluding the initial condition)
n - the number of grid points along the x-axis (excluding the boundary)
p - the number of grid points along the y-axis (excluding the boundary)
Returns:
the solution grid