Here is a sample calculation involving a uniform population of stars.
# now use a rectangular grid
set gridcoords = 1
set gridlo1 = -10.0
set gridhi1 = 10.0
set gridlo2 = -10.0
set gridhi2 = 10.0
set ngrid1 = 21
set ngrid2 = 21
# size of region in which we want accurate deflections
set clumpzone = 15.0
set clumpmode = 1
# specify subgridding in the core of each lens, for handling faint microimages
set microimages = 0.001
set ncoreg = 20
# parameters for tree used to calculate stars
set leafsize = 0.5
set leaferr = 0.005
#
set inttol = 1.0e-4
set maxlev = 4
set gallev = 4
set plotmode = 2
# total convergence and shear are both 0.45, but 10% of convergence is in what wil become the stars
setlens 2 1
convrg 0.405 0 0 0 0 0.45 0 0 0 0
convrg 0.045 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
# generate the stars, using mass component #2 for the parent population
# the mass function has mean mass pi, dynamic range 10, and slope -2.35
# use enough stars that the statistical noise in the deflections is 0.01
set seed = -21
setclumps 1 0.01
2 3.14159 10.0 -2.35 star
# recompute the grid now that we have the stars
regrid
#
plotgrid stars.grid
plotcrit stars.crit
writeclumps stars
findsrc 1.1 -3.0 stars1.img
#
quit
Here are the grid and the critical curves for this example.
You can see there is some funny business near the position of each star. The code actually distorts the original rectangular grid to make sure there is a grid vertex at the position of each lens. That way the recursive subgridding automatically improves the resolution near the center of each lens. To do even better, once the code reaches the deepest level of the grid, it defines a number of radial spokes (specified by the microimages variable). These concepts are illustrated by zooming in on the grid near one of the lenses. The left panel shows an intermediate zoom, while the right panel shows a closer view.
This gridding scheme is successful at finding microimages:
setclumps 1 0.01
2 3.14159 10.0 -2.35 pjaffe 2.0
Here are sample results. The clump population is the same as in the stars example above, only now the masses are extended.
Notice that each clump now has a finite multiply-imaged region around it, so the microimages that previously appeared next to all the stars have disappeared. In this particular example, the source sits in a naked cusp so it produces a naked cusp configuration of three images.
set plotmode = 2
set microimages = 1.0e-5
set gridcoords = 1
set gridlo1 = -2.0
set gridhi1 = 2.0
set gridlo2 = -2.0
set gridhi2 = 2.0
set ngrid1 = 21
set ngrid2 = 21
set ncoreg = 20
set leafsize = 0.5
set leaferr = 0.005
set clumpzone = 4.0
set clumpmode = 1
set inttol = 1.0e-4
set maxlev = 4
set gallev = 4
startup 2 1
alpha 0.98 0 0 0 0 0.1 0 0.1 0 1
alpha 0.02 0 0 0 0 0 0 0.2 0 1
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
set seed = -22
setclumps 1 0.001
2 3.14159e-3 10.0 -2.35 gaus 0.5
makekapmap substr-kap.fits 3 substr-kap.rng -2.0 2.0 512 -2.0 2.0 512
regrid
plotgrid substr.grid
plotcrit substr.crit
writesubstr substr
findimg 0.0 0.0 substr1.img
quit
Notice the makekapmap command, which produces a map of the total mass distribution in this model. It is shown on the left below, and the critical curves and a sample image configuration are shown on the right.