Ez¶
Equations¶
We want to solve
with Dirichlet (zero) boundary conditions.
Method¶
The algorithm can be succinctly written as iDST2D(dirichlet_matrix * DST2D(RHS))
,
where DST2D
and iDST2D
are
Type-1 Forward and Inverse Discrete Sine 2D Trasforms respectively,
RHS
is the right-hand side of the equiation above,
and dirichlet_matrix
is a ‘magical’ matrix that does all the work.
-
lcode.
dirichlet_matrix
(grid_steps, grid_step_size)[source]¶ Calculate a magical matrix that solves the Laplace equation if you elementwise-multiply the RHS by it “in DST-space”. See Samarskiy-Nikolaev, p. 187.
In addition to the magic values, it also hosts the DST normalization multiplier.
Todo
DOCS: expand with method description (Kargapolov, Shalimova)
DST2D¶
-
lcode.
dst2d
(a)[source]¶ Calculate DST-Type1-2D, jury-rigged from anti-symmetrically-padded rFFT.
As
cupy
currently ships no readily available function for calculating the DST2D on the GPU, we roll out our own FFT-based implementation.We don’t need to make a separate iDST2D function as (for Type-1) it matches DST2D up to the normalization multiplier, which is taken into account in
dirichlet_matrix()
.