|
Return to ToyFDTD Home
What is this? ToyFDTD2 builds an
alternate memory allocation scheme into ToyFDTD1.
This new scheme forces the field update arrays to be contiguous, which
the ToyFDTD1
scheme does not.
Like ToyFDTD1, ToyFDTD2
is a very simple, heavily-commented 3-D FDTD code published under the GNU General Public License as
part of the ToyFDTD
series of codes.
Language: C
Author: John Schneider
Why it's cool:
Forcing the data arrays to be
contiguous will make the code run faster in many circumstances. The
speedup is platform-dependent, but addressing this issue is crucial in
running large, complex problems.
Uses spiffy macros to handle array
accessing, which makes the code easy to read
Makes you stop to think not just
about how the data is stored, but how you get at it -- another crucial
issue when things start to get fancy.
Simulations run with
ToyFDTD2: The code simulates the same problem
as ToyFDTD1.
The results are identical; comparison of the floating-point results
showed no differences. The animation below was made from running the ToyFDTD2
code for comparison with ToyFDTD1
results.
What
the colors mean: The entire simulation region is
highlighted with a box. Red/Yellow indicates positive values, with
yellow representing the greatest intensities and red representing
values near zero. Blue/Green indicates negative, green the greatest
intensities and blue values near zero.
Two
kinds of color scaling are used. Autoscaling
every timestep scales the field intensities in that timestep to the
full range of color values. This means that dim timesteps will look as
bright as intense ones, but the structure of the fields in the dim
timesteps will show well. Autoscaling is used unless global scaling is
specified. Global scaling over all timesteps scales
the entire simulation as a whole. Dim timesteps will barely show
anything visible, but you get a good idea of intensity variation over
time.
|