ToyFDTD1-v1.03

所属分类:单片机开发
开发工具:C/C++
文件大小:33KB
下载次数:29
上传日期:2005-08-18 16:22:25
上 传 者vivaldi
说明:  TOYFDTD1 is a stripped-down minimalist, 3D FDTD code demonstrating the basic tasks in implementing a simple 3D FDTD simulation. An idealized rectangular waveguide is modeled by treating the interior of the mesh as free space and enforcing PEC conditions on the faces of the mesh. A simplified plane wave source is inserted at one end. First released 12 April 1999. Version 1.03 released 2 December 1999.

文件列表:
ToyFDTD1-v1.03 (0, 2005-08-18)
ToyFDTD1-v1.03\changelog (4054, 1999-12-04)
ToyFDTD1-v1.03\chengGbry.cmap (4736, 1999-08-02)
ToyFDTD1-v1.03\gpl.txt (18007, 1999-08-02)
ToyFDTD1-v1.03\Makefile (2258, 1999-12-02)
ToyFDTD1-v1.03\ToyFDTD1.c (32422, 1999-12-04)
ToyFDTD1-v1.03\ToyFDTD1.f90 (34355, 1999-12-02)

README file for ToyFDTD1 v1.03 Copyright (C) 19***,1999 Laurie E. Miller, Paul Hayes, Matthew O'Keefe With this README file you should also have received gpl.txt A copy of the GNU General Public License changelog Text file listing change history since v1.0 ToyFDTD1.c A listing of the ToyFDTD1 source code in C ToyFDTD1.f90 A listing of the ToyFDTD1 source code in FORTRAN 90 Makefile The makefile for compiling ToyFDTD1 chengGbry.cmap A useful colormap for viewing the results of ToyFDTD1 in animabob or viz. ///////////////////////////////////////////////////////////////////////////// Regarding ToyFDTD1, version 1.03: Copyright (C) 19***,1999 Laurie E. Miller, Paul Hayes, Matthew O'Keefe 1999 Max Smirnoff, Paul Hayes, Matt Rundquist (F90 translation) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version, with the following conditions attached in addition to any and all conditions of the GNU General Public License: When reporting or displaying any results or animations created using this code or modification of this code, make the appropriate citation referencing ToyFDTD1 by name and including the version number. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, or if you cannot read your copy, write to the Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ///////////////////////////////////////////////////////////////////////////// ToyFDTD1-v1.03 as delivered uses 1.2 Mbytes of main memory to run and generates 201 output files of 25 kbytes each for about 5 Mbytes total output. If this will choke your machine, you should alter the global constants at the beginning of the code as a preventative measure. However, this is a very tiny mesh for 3D FDTD, so if it's going to choke your machine, you'll be needing to find another if you're going to FDTD much. ///////////////////////////////////////////////////////////////////////////// Notes on the F90 translation: We have endeavored to make the C and F90 versions as identical as possible. But keep in mind that we are not FORTRAN experts, and that none of us get enough sleep... Why F90, not F77? Well, among other things, we wanted to include a sample of dynamic memory allocation. Sure it's silly in a simulation this trivial, but we assume people who read the code will want to make more complex simulations in which it would be handy to allocate the field arrays dynamically. F77 doesn't have multiple indirected pointers; in effect, the only arrays we can do with F77 are static, with predefined sizes. In F90, arrays can declared allocatable. Later in the code, we dynamically allocate a 3D array of any size we want with just one statement. Floating-point adventure: There are some issues with how F90 handles floating point numbers. For example: real*8 :: a a = 0.7 print*,a instead of printing 0.7 on the screen, will print out 0.69999768 or some other such number. This has to do with the F90 standard and the assembly code produced by the compiler. Numbers in this ToyFDTD1 code are written using d instead of e for the exponent, which improves the accuracy of the number representation significantly. There is still some divergence however. A more thorough description of this problem is on the web at: http://www.borg.umn.edu/toyfdtd/ ///////////////////////////////////////////////////////////////////////////// What to do with the source now that you've got it: (The suggested commands in these notes are Unix commands. If you're using a different operating system, you'll want to use your system's equivalent commands.) If you're reading this, I assume you've 1. downloaded the tar file: ToyFDTD1-v1.03.tar.gz or ToyFDTD1-v1.03.tar 2. if you chose ToyFDTD1-v1.03.tar.gz, un-gzipped it with a command like: gunzip ToyFDTD1-v1.03.tar.gz for more info on gzip compression/uncompression see the ToyFAQ at http://www.borg.umn.edu/toyfdtd/Toyfaq.html#targz 3. untarred the tar file with a command like: tar xvf ToyFDTD1-v1.03.tar 4. changed to the new directory just created: cd ToyFDTD1-v1.03 Unless of course you're reading this on the web page, in which case you should go and do steps 1-4, and then 5. compile the source code -- type the command: make ToyFDTD1c to compile the C version or make ToyFDTD1f90 to compile the FORTRAN 90 version. 6. run that baby: you can either a. just type the name of the executable: ToyFDTD1c or ToyFDTD1f90 in which case the progress notes during the course of the simulation will appear on the screen, or b. use a command like: ToyFDTD1c >&! c_runlog & or ToyFDTD1f90 >&! f90_runlog & in which case all the progress notes will be written to a file named c_runlog or f90_runlog which you can view a screenful at a time using the command: more c_runlog or more f90_runlog ///////////////////////////////////////////////////////////////////////////// OK, now you've got a whole bunch of files named somethingorother.bob in your directory. Each of these files is a string of binary data bytes. You probably want to look at them somehow. If you have a volume visualization tool you know and like, you should use that one, though you may need to alter the output portion of the ToyFDTD1 source code to suit your tool. Here's another way: On the ToyFDTD R&R page, http://www.borg.umn.edu/toyfdtd/RandR.html you will see a link to BoB/AnimaBoB. It's free. Download yourself a copy if you haven't already got one and get it running. Next check those progress notes from your run; you'll see a command like: bob -cmap chengGbry.cmap -s 133x21x9 *.bob at the beginning and at the end of the notes. This activates bob with the colormap included in the tar file and feeds it the appropriate dimensions of the simulation mesh. If you change the dimensions of the waveguide, the progress notes will show the new correct bob command for the different- sized mesh. This is one good reason to keep your progress notes in a runlog file. Once bob has fired up and loaded, make sure the x, y, and z dimensions are set to maximum, and then just hit "start" to see the files play. Or, here's another way: On the ToyFDTD R&R page, http://www.borg.umn.edu/toyfdtd/RandR.html you will see a link to Viz. It's also free. Download yourself a copy and get it running. Next check those progress notes from your run; you'll see a command like: viz ToyFDTD1c.viz or viz ToyFDTD1f90.viz at the beginning and at the end of the notes. This activates viz with the colormap included in the tar file and feeds it the appropriate dimensions of the simulation mesh. If you change the dimensions of the waveguide, the .viz file will update accordingly when you run the new simulation. Yet another way: The really nice volume visualization tools like AnimaBoB and Viz are what you want if you've got a suitable platform to run them on. If you need something less resource-intensive, there are methods for outputting a 2D slice from each timestep of your simulation and then viewing those slices as a sequence of 2D images. This isn't as nice, since you can't surf around your data at will the way you can with the volume viewers, but it is simpler and fairly platform-independent. An excellent way of handling this was developed by John B. Schneider, Patrick J. Flynn, and Kurt L. Shlager, and can be found at http://www.eecs.wsu.edu/~schneidj/Animations/ Their site includes an excellent paper on the topic as well as free code. ToyFDTD examples of this method are in work at the time of this writing. ///////////////////////////////////////////////////////////////////////////// Playing with your ToyFDTD1: You can vary the simulation quite a bit and see different things just by changing the #define statements at the beginning. With these you can alter the length, width and height of the waveguide, the frequency of the stimulus, the number of timesteps it runs, and how often it writes data to an output file. I set this last control, (PLOT_MODULUS) to a fairly high number, which means it doesn't output very often. This is to keep the amount of data choking your system low, but it also makes for a jerky simulation. You may want to set it to a smaller number to smooth things out a bit so the results look nice when you view the data files with your volume visualization tool of choice. You can of course alter the code in other ways to make different simulations. That's what it's there for. Further suggestions on playing with it will start to appear on the ToyFDTD page at http://www.borg.umn.edu/toyfdtd/ when I get caught up on my homework... and when my hand fatigue gets better. ///////////////////////////////////////////////////////////////////////////// About the Makefile and make commands: If you type: make cleandata in your ToyFDTD1 directory, it will remove all the data files (all files ending in .bob or .viz and any runlog files). If you want to keep your runlog file to keep track of simulations you've done, rename it something else first: mv c_runlog whatever or mv f90_runlog whatever If you type: make clean in your ToyFDTD1 directory, it will remove all the object and executable files, file copies ending in ~, and core files from any core dumps you've managed to generate. If you type: make testc in your ToyFDTD1 directory, it will compile the C code, remove any c_runlog file present, and execute ToyFDTD1c while running a time command and directing the progress notes to a c_runlog file. The results of the time command will output to the screen when the run completes. If you type: make testf90 in your ToyFDTD1 directory, it will compile the F90 code, remove any f90_runlog file present, and execute ToyFDTD1f90 while running a time command and directing the progress notes to an f90_runlog file. The results of the time command will output to the screen when the run completes. If you view the Makefile, you'll see a bunch of lines starting with CFLAGS or F90FLAGS. All of them are commented out (by a # at the beginning of the line) except the last CFLAGS line and the last F90FLAGS line. Only one CFLAGS line and/or one F90FLAGS line should ever be uncommented at once. The last in each set, CFLAGS = -Xcpluscomm -g or F90FLAGS = -cpp -g is what you want to use if you're going to run a debugger on the executable. The others (different level of compiler optimization) are there for your convenience. If you don't know what they are, you should talk to a friendly neighborhood compiler guru before you try messing with them. ///////////////////////////////////////////////////////////////////////////// Contacting the perpetrators: Laurie E. Miller, Paul Hayes, Matthew O'Keefe, Max Smirnoff, Matt Rundquist Department of Electrical and Computer Engineering 200 Union Street S. E. Minneapolis, MN 55455 lemiller@borg.umn.edu http://www.borg.umn.edu/toyfdtd/ http://www.borg.umn.edu/toyfdtd/ToyFDTD1.html http://www.toyfdtd.org/ /////////////////////////////////////////////////////////////////////////////

近期下载者

相关文件


收藏者