# Tutorial: Scattering by a dielectric sphere

This tutorial is aimed at helping new users become familiar with FDTD++. In it, the classical problem[1] of scattering of light by a spherical particle will be solved. In particular, the cross sections for a 10 nm radius glass particle in free space will be calculated. Looking forward to later tutorials, the solution will be purposefully not converged.

You will learn:

Note that the geometries file will not be created for this problem[2]. The files for this tutorial (input and expected output) can be obtained here: Tutorial1.tgz

## Preparing the work directory

Create a work directory, work/, where you would like output directed to. Switch to this directory. This is the where we will next create our parameters file and materials file, where you should store the provided geometries file, geom.unv, and where we will eventually run FDTD++.

## Geometries file

Typically, the first task in FDTD++ is to create the geometries file. As discussed above, this file is provided for this tutorial as geom.unv.

## Materials file

The next task in FDTD++ is to create a materials file. Both free space and glass need to be defined, with material numbers 0 and 1, respectively, to be consistent with the geometries file.

Open a text editor, and enter:  

 material 0 { epsr 1.0 } material 1 { epsr 2.25 } 

Save this file as mat.

## Parameters file

The final task is to now create the parameters file. Note that even though many of the default parameters are sufficient for this simulation, a number of them will be discussed below to illustrate the design of the parameters file for FDTD++.

First of all, since the spherical particle is rather small, the exterior computational domain can be reduced in size (from the default value of 100 nm). Since we also need to allow enough room for absorbing boundary conditions, etc., (given the computational domain discretization below), we will use 80 nm:  

 domain size 80.0e-9 

Since we are purposefully trying not to converge this simulation, we should first increase the computational domain discretization to 2 nm (from the default value of 1 nm:  

 domain disc 2.0e-9 

And then we should decrease the total computational time to 15 fs (from the default value of 50 fs):  

 time total 15.0e-15 

Since absorbing boundary conditions are set by default, and convolution perfectly matched layer parameters are sufficient for the majority of simulations, there is nothing to set here.

Note that the provided geometry was modeled at $(0, 0, 0)$ with units of 1 (unitless) (see the Geometric modeling section). It therefore needs to be scaled and shifted to the center of the interior computational domain, which can be accomplished using geom scale and geom shift:  

 geom scale 1.0e-9 geom shift 40.0e-9 

The default source parameters are sufficient for spectra over the visible range, as studied in this example. However, due to the increased size of computational domain discretization, the total-field/scattered-field $z$-position should be shifted slightly up from its default value of $z = 20$ nm:  

 TFSF_z 26.0e-9 

Continuing, the parameters necessary to calculate cross sections must be set. The default values of spect_npts, spect_minwave, and spect_maxwave are sufficient. However, details of the cross sections values must be set. The cross section box will be centered on the particle, and a radius of 14 nm will be used, which provides a small buffer around the particle:  

 calc_cs cs_x 40.0e-9 cs_y 40.0e-9 cs_z 40.0e-9 cs_r 16.0e-9 

Thus, the total parameters file can be written:  

 domain size 80.0e-9 domain disc 2.0e-9 time total 15.0e-15 geom scale 1.0e-9 geom shift 40.0e-9 TFSF_z 26.0e-9 calc_cs cs_x 40.0e-9 cs_y 40.0e-9 cs_z 40.0e-9 cs_r 16.0e-9 

Open a text editor in your work directory, enter the above, and save it as work/param.

## Running FDTD++

Now that the relevant files have been created, the simulation can be performed.

Open a terminal in your work directory, and since this simulation is to be run in serial, type:  

 FDTDxx param mat geom.unv 

## Output

Once the simulation has finished, the following output should exist:

• work/FDTDxx.log
• work/FDTDxx.err
• work/output/cross_sections.dat

First, check work/FDTDxx.err to ensure that no errors were generated during the simulation.

Next, check work/FDTDxx.log for any important notes. Also, double check the definition of materials and simulation parameters, as reported.

Finally, check work/output/cross_sections.dat against cross_sections.correct.dat, to ensure that the simulation completed as expected.

#### Analysis

JMM: Ignore the following Note the absorption as well as the oscillations present.

## Notes and references

1. C. F. Bohren and D. R. Huffman, "Absorption and Scattering of Light by Small Particles," John Wiley & Sons, Inc.: New York, 1983. ISBN 978-0471293408
2. The creation of a 10 nm radius sphere is covered in the tutorial Creating a sphere with SALOME