📄 readme
字号:
README file for ToyFDTD1 v1.03 Copyright (C) 1998,1999 Laurie E. Miller, Paul Hayes, Matthew O'KeefeWith this README file you should also have receivedgpl.txt A copy of the GNU General Public Licensechangelog Text file listing change history since v1.0ToyFDTD1.c A listing of the ToyFDTD1 source code in CToyFDTD1.f90 A listing of the ToyFDTD1 source code in FORTRAN 90Makefile The makefile for compiling ToyFDTD1chengGbry.cmap A useful colormap for viewing the results of ToyFDTD1 in animabob or viz. /////////////////////////////////////////////////////////////////////////////Regarding ToyFDTD1, version 1.03: Copyright (C) 1998,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 generates201 output files of 25 kbytes each for about 5 Mbytes total output. If thiswill choke your machine, you should alter the global constants at the beginningof the code as a preventative measure. However, this is a very tiny mesh for3D 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've1. downloaded the tar file: ToyFDTD1-v1.03.tar.gz or ToyFDTD1-v1.03.tar2. 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#targz3. untarred the tar file with a command like: tar xvf ToyFDTD1-v1.03.tar4. changed to the new directory just created: cd ToyFDTD1-v1.03Unless of course you're reading this on the web page, in which case you shouldgo and do steps 1-4, and then5. compile the source code -- type the command: make ToyFDTD1cto compile the C version or make ToyFDTD1f90to 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.htmlyou 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 *.bobat the beginning and at the end of the notes. This activates bob with thecolormap included in the tar file and feeds it the appropriate dimensionsof 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 runlogfile. Once bob has fired up and loaded, make sure the x, y, and z dimensionsare 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.htmlyou will see a link to Viz. It's also free. Download yourself a copy and getit running. Next check those progress notes from your run; you'll see a command like: viz ToyFDTD1c.vizor viz ToyFDTD1f90.vizat the beginning and at the end of the notes. This activates viz with thecolormap included in the tar file and feeds it the appropriate dimensionsof 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 whatyou want if you've got a suitable platform to run them on. If you needsomething less resource-intensive, there are methods for outputting a 2Dslice from each timestep of your simulation and then viewing those slices asa sequence of 2D images. This isn't as nice, since you can't surf around yourdata 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 bychanging the #define statements at the beginning. With these you can alterthe 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 outputfile. I set this last control, (PLOT_MODULUS) to a fairly high number, whichmeans it doesn't output very often. This is to keep the amount of datachoking your system low, but it also makes for a jerky simulation. Youmay want to set it to a smaller number to smooth things out a bit so theresults look nice when you view the data files with your volume visualizationtool 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 keepyour runlog file to keep track of simulations you've done, rename it somethingelse first: mv c_runlog whatever or mv f90_runlog whatever If you type: make cleanin 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 testcin your ToyFDTD1 directory, it will compile the C code, remove any c_runlog file present, and execute ToyFDTD1c while running a timecommand and directing the progress notes to a c_runlog file. The resultsof the time command will output to the screen when the run completes.If you type: make testf90in your ToyFDTD1 directory, it will compile the F90 code, remove any f90_runlog file present, and execute ToyFDTD1f90 while running a timecommand and directing the progress notes to an f90_runlog file. The resultsof 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 CFLAGSor F90FLAGS. All of them are commented out (by a # at the beginning ofthe line) except the last CFLAGS line and the last F90FLAGS line. Only one CFLAGS line and/or one F90FLAGS line should ever be uncommentedat once. The last in each set, CFLAGS = -Xcpluscomm -gor F90FLAGS = -cpp -gis 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//////////////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -