next up previous contents index
Next: Minimisation and root-finding Up: Mathematical functions Previous: FFT and Fast Fourier   Contents   Index


Poisson solver, PoissonCL

CCATSL provides a routine for solving Poisson's equation

\begin{displaymath}
\m \nabla^2 \psi(x,y)=\zeta(x,y)
\end{displaymath}

in a two-dimensional rectangular region, where $\psi$ is specified on the boundary.

  void PoissonCL ( double *psi,
  double *zeta,
  int nx,
  int ny,
  double dlx,
  double dly);

  psi Array to hold the solution $\psi$. The values on the boundary of the array should be set to the boundary conditions; the rest of the array need not be initialised.
  zeta Array specifying the function $\zeta$.
  nx The number of divisions in the lattice in the $x$-direction.
  ny The number of divisions in the lattice in the $y$-direction. (ny must be a power of 2.)
  dlx, dly The grid spacing in the $x$ and $y$ directions respectively.

A typical use of PoissonCL might look like

  
/*   /examples/chapter2/poisnex.c   */
#include <catam.h>
int MainCL(void)
{
  int nx=10;
  int ny=8;
  double dlx=0.1;
  double dly=0.125;
  double psi[nx][ny];
  double zeta[nx][ny];

  /* setup zeta */
  /* .. */

  PoissonCL(psi,zeta,nx,ny,dlx,dly);
  return 0;
}

A complete example using PoissonCL can be found in b09poisn.c.


next up previous contents index
Next: Minimisation and root-finding Up: Mathematical functions Previous: FFT and Fast Fourier   Contents   Index
CATAM admin 2010-02-23