FMM2D.jl is a Julia interface for computing N-body interactions using the Flatiron Institute's FMM2D library.
Currently, the wrapper only wraps the Helmholtz and Laplace functionalities.
Let
where
using FMM2D
# Simple example for the FMM2D Library
thresh = 10.0^(-5) # Tolerance
zk = rand(ComplexF64) # Wavenumber
# Source-to-source
n = 200
sources = rand(2,n)
charges = rand(ComplexF64,n)
pg = 3 # Evaluate potential, gradient, and Hessian at the sources
vals = hfmm2d(eps=thresh,zk=zk,sources=sources,charges=charges,pg=pg)
vals.pot
vals.grad
vals.hess
# Source-to-target
m = 200
targets = rand(2,m)
pgt = 3 # Evaluate potential, gradient, and Hessian at the targets
vals = hfmm2d(targets=targets,eps=thresh,zk=zk,sources=sources,charges=charges,pgt=pgt)
vals.pottarg
vals.gradtarg
vals.hesstarg
The Laplace problem in 2D have the following form
In the case of complex charges and dipole strengths (lfmm2d
has to be used. In the case of real charges and dipole strengths (rfmm2d
has to be used.
using FMM2D
# Simple example for the FMM2D Library
thresh = 10.0^(-5) # Tolerance
# Source-to-source
n = 200
sources = rand(2,n)
charges = rand(ComplexF64,n)
dipvecs = randn(2,n)
dipstr = rand(ComplexF64,n)
pg = 3 # Evaluate potential, gradient, and Hessian at the sources
vals = lfmm2d(eps=thresh,sources=sources,charges=charges,dipvecs=dipvecs,dipstr=dipstr,pg=pg)
vals.pot
vals.grad
vals.hess
# Source-to-target
m = 100
targets = rand(2,m)
pgt = 3 # Evaluate potential, gradient, and Hessian at the targets
vals = lfmm2d(targets=targets,eps=thresh,sources=sources,charges=charges,dipvecs=dipvecs,dipstr=dipstr,pgt=pgt)
vals.pottarg
vals.gradtarg
vals.hesstarg
FMMLIB2D.jl interfaces the FMMLIB2D library which the FMM2D library improves on.