# SuanShu, a Java numerical and statistical library

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

## Class ExplicitCentralDifference2D

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

public class ExplicitCentralDifference2D
extends Object
implements PDESolver
This explicit central difference method is a numerical technique for solving the two-dimensional wave equation by the following explicit three-point central difference equation. $\frac{u^{k+1}_{ij} - 2u^k_{ij} + u^{k-1}_{ij}}{\Delta t^2} = \beta \left( \frac{u^{k}_{i+1,j} - 2u^k_{ij} + u^{k}_{i-1,j}}{\Delta x^2} + \frac{u^{k}_{i,j+1} - 2u^k_{ij} + u^{k}_{i,j-1}}{\Delta y^2} \right)$ where $$u^k_{ij} = u(t_k,x_i,y_j)$$ is the estimate at $$(k, i, j)$$ in the grid.

This method is NOT unconditionally stable. Specifically, it is up to the user to ensure that: $\Delta t^2 \leq \frac{\Delta x^2 + \Delta y^2}{4 \beta}$ where $$\Delta t = \frac{T}{m}$$, $$\Delta x = \frac{a}{n+1}$$ and $$\Delta y = \frac{b}{p+1}$$, by specifying the grid resolution parameters m, n, and p.

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

• ### Constructor Summary

Constructors
Constructor and Description
ExplicitCentralDifference2D()
• ### Method Summary

All Methods
Modifier and Type Method and Description
PDESolutionTimeSpaceGrid2D solve(WaveEquation2D pde, int m, int n, int p)
Solve a two-dimensional wave equation, with the resolution parameters of the solution grid.
• ### Methods inherited from class java.lang.Object

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

• #### ExplicitCentralDifference2D

public ExplicitCentralDifference2D()
• ### Method Detail

• #### solve

public PDESolutionTimeSpaceGrid2D solve(WaveEquation2D pde,
int m,
int n,
int p)
Solve a two-dimensional wave equation, with the resolution parameters of the solution grid.
Parameters:
pde - the wave 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 two boundaries)
p - the number of grid points along the y-axis (excluding the two boundaries)
Returns:
the solution grid