88 Designing Scientific Applications on GPUs
right-hand side. For simplicity, assume that we know the exact solution, u
true
,
corresponding to (6.5). Then we use the method of manufactured solutions to
derive an expression for the corresponding right-hand side f(x, y):
f(x, y) = ∇
2
u
true
= −2π
2
sin(πx) sin(πy). (6.9)
The spatial derivative in (6.8) is again approximated with finite differences,
similar to the example in (6.2), except boundary values are explicitly set to
zero. The discrete form of the system can now be written as a sparse linear
system of equations:
Au = f, u, f ∈ R
N
, A ∈ R
N×N
, (6.10)
where A is the sparse matrix formed by finite difference coefficients, N is the
number of unknowns, and f is given by (6.9). Equation (6.10) can be solved
in numerous ...