Unless matlab treats floats and ints differently than most other languages, I'd say its a bug because zero over anything is always zero.
But, I have no clue as to what context its running in, so it may be deliberate. --Bruce On 04/06/2013 02:03 PM, Bruce Labitt wrote: > I'm trying to understand a chunk of 3D FDTD code that I downloaded > from the publisher of the book, "Computational Electrodynamics". It > is in matlab, so I tried to run it in Octave. Something is not quite > right, so it doesn't execute. That doesn't matter to me right now. > The piece of code is: > > //start snippet > % x-varying material properties > delbc=upml*delta; > sigmam=-log(rmax)*(orderbc+1.0)/(2.0*eta*delbc); > sigfactor=sigmam/(delta*(delbc^orderbc)*(orderbc+1.0)); > kmax=1; > kfactor=(kmax-1.0)/delta/(orderbc+1.0)/delbc^orderbc; > //end snippet > > It would seem to me that kfactor is always zero, since kmax is set to > 1 in the line above. That probably is not the intent, I think. > kfactor does not seem to be updated later in the code. > > Is this just a bug? Or what does the last line do? The author of the > code is a long graduated PhD student from UWisc. Just contact UW? > > URL of actual code: > http://www.artechhouse.com/static/downloads/fdtd3D_UPML.zip > > It doesn't matter if it executes in octave. (It would be nice, though > - it currently runs, plots a little, then seg faults) > > octave:1> fdtd3D_UPML > error: base_graphics_object::get_properties: invalid graphics object > panic: Segmentation fault -- stopping myself... > attempting to save variables to `octave-core'... > save to `octave-core' complete > Segmentation fault > > I tested the code in Matlab, and it executes. Can't really say if the > code is doing everything right, but it runs and vaguely does things > sort of ok. The simulation is kind of coarse, but one can see an > electric field starting to radiate from a dipole. > > I'm porting it to python/scipy and maybe later to pycuda, once I get > it working. Then maybe I can do some cool stuff with it. > > Thanks in Advance > -Bruce > > > > > _______________________________________________ > gnhlug-discuss mailing list > gnhlug-discuss@mail.gnhlug.org > http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/
_______________________________________________ gnhlug-discuss mailing list gnhlug-discuss@mail.gnhlug.org http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/