Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Hello all the FDTD experts over there ,
I am starting out on my class project which requires me to write a 2D FDTD code.I am thinking of doing it in Matlab or C.Matlab would offer good user friendliness but I have heard that Matlab being an interpreted language is quite slow when it comes to loops.My requirement is about 4000 cells utmost ( 200 x 200 ) and time step of the order of 1 Pico second.Will Matlab be very slow that I should consider coding in C or will Matlab do okay with respect to the execution time. -Warm regards --Arun S V |
#2
![]() |
|||
|
|||
![]() "Arun S V" wrote in message ... Hello all the FDTD experts over there , I am starting out on my class project which requires me to write a 2D FDTD code.I am thinking of doing it in Matlab or C.Matlab would offer good user friendliness but I have heard that Matlab being an interpreted language is quite slow when it comes to loops.My requirement is about 4000 cells utmost ( 200 x 200 ) and time step of the order of 1 Pico second.Will Matlab be very slow that I should consider coding in C or will Matlab do okay with respect to the execution time. -Warm regards --Arun S V Don't think about it, do it. You'll find out soon enough if it's too slow. I did one several years ago using the interpreted Visual Basic that comes with Excel, letting Excel do the plotting. It seemed to update pretty quickly. Matlab would probably be fine. C is great if you're comfortable with plotting, otherwise you might spend all your time fighting the interface. Here are some references, if you're interested: References: 1. R. C. Booton, "Computational Methods for Electromagnetics and Microwaves" John Wiley & Sons, Inc. 1992. This text gives an uncommonly clear presentation of the basic theory, although it lacks enough detail to set up practical problems of the type that we selected. The FDTD section discusses primarily 1- and 2-dimensional problems. 2. K. S. Yee, "Numerical Solution of Initial Boundary Value Problems Involving Maxwell's Equations in Isotropic Media," IEEE AP-14, 1966. This is the classic paper to which all subsequent writers refer. 3. Sadiku, "Numerical Techniques in Electromagnetics." This book provided a good level of detail for setting up FDTD problems. It provides a good indexing scheme that makes for efficient implementation of Yee's algorithm. This book also gives a limited discussion of absorbing boundary conditions and briefly discusses options for feed waveforms. There is also a brief note about reducing run times by filling the space with a low conductivity, therefore reducing the effects of multiple reflections. 4. Omiya et. al. "Design of Cavity-Backed Slot Antennas Using the Finite-Difference Time-Domain Technique," IEEE AP-46 Dec. 1998. This paper provided some more detail on the problem setup, showed sensitivity of accuracy to the number of time steps, and discussed a windowing technique that could be used to shorten run time. It seems that this windowing in the time domain ends up being quite similar to Sadiku's introduction of loss in the cavity. The mathematical operations are very similar, even though the justifications are different. 5. The Internet site "FTDT.org" has some good information and programming examples. The content matches the information in the above references, with more effort put into formatted output. 6. Jeong Phill Kim, "FDTD Basics and Programming Tips," March 22, 1999. This is a very clear, concise treatment of the subject with sufficient detail to begin a practical analysis. 7. R. J. Luebbers and H. S. Langdon, "A simple feed model that reduces time steps needed for FDTD antenna and microstrip calculations," IEEE AP-11, July 1996. This paper describes a feed loading technique, used by Kim in reference 6 that greatly reduces the convergence time. 8. Cheng, Dib, and Katehi, "Theoretical Modeling of Cavity-Backed Patch Antennas Using a Hybrid Technique. The configuration studied in this paper is similar to the one studied in the final configuration of this study. 9. Balanis text, "Antenna Theory Analysis and Design," 1982, Harper and Row. There is a good description of the application of Huygen's Principle on pages 447-456. |
#3
![]() |
|||
|
|||
![]()
In message , Arun S V
writes Hello all the FDTD experts over there , I am starting out on my class project which requires me to write a 2D FDTD code.I am thinking of doing it in Matlab or C.Matlab would offer good user friendliness but I have heard that Matlab being an interpreted language is quite slow when it comes to loops.My requirement is about 4000 cells utmost ( 200 x 200 ) and time step of the order of 1 Pico second.Will Matlab be very slow that I should consider coding in C or will Matlab do okay with respect to the execution time. You can compile Matlab code as one of the options at least in Version 6 That speeds it up considerably. You can handle matrix maths without element by element addressing - I don't think C does that. I'd use FORTRAN myself ![]() Brian GM4DIJ -- Brian Howie |
#4
![]() |
|||
|
|||
![]()
I'm not sure what calcs you need to run, but wouldn't it be trivial to
do a test of Matlab's speed with respect to the sorts of things you need to do? It's one of the very nice things about an interpreted matrix language. I use Scilab (freeware), and just ran a little test: create a=rand(200,200), b=rand(200,200), c=a*b, ainv=inv(a), and then evaluate ainv*c-b, to make sure it comes out close to zero. It did, and the whole thing was fast enough that I couldn't time it accurately till I put it in a loop to repeat ten times. It's about 1.4 seconds per iteration. Guess I could have let it time itself, too. That's on a 700MHz Pentium machine. (Considering the work I put into inverting matrices in my linear algebra class years ago, the speed with which it can invert a large matrix puts a wry smile on my face.) Scilab, as Matlab, can compile functions, but if your math is very compact because of the matrix notation, it may not really matter much; most of the time is spent doing the matrix math anyway. And if the matrix notation lets you do things in a way that's more readable, that's a huge plus, and also consider the time you'll save programming (unless you already have good matrix libraries available, I suppose). (By the way, last time I checked, 200*200 = 40000, not 4000. ;-) Cheers, Tom "Arun S V" wrote in message ... Hello all the FDTD experts over there , I am starting out on my class project which requires me to write a 2D FDTD code.I am thinking of doing it in Matlab or C.Matlab would offer good user friendliness but I have heard that Matlab being an interpreted language is quite slow when it comes to loops.My requirement is about 4000 cells utmost ( 200 x 200 ) and time step of the order of 1 Pico second.Will Matlab be very slow that I should consider coding in C or will Matlab do okay with respect to the execution time. -Warm regards --Arun S V |
#5
![]() |
|||
|
|||
![]()
Thanks a lot to Dave Brian and Tom.I wrote out a simple 1D FDTD code with
PEC boundary condition , Gaussian excitation in Matlab. ( Well , I did not have to worry about multiplying the no. of cells in each dimension to get the total number of cells as Tom pointed out !! I will keep in mind that 200x200 is 40000 and not 4000 :-) ). It came out rather nicely. .I guess I will try to develop my code in Matlab and try to port it to C for later versions , if needed.Thanks for your comments and Dave , thanks for suggesting the papers to study. -Warm regards -Arun S V |
#6
![]() |
|||
|
|||
![]()
Arun S V wrote:
I am starting out on my class project which requires me to write a 2D FDTD code.I am thinking of doing it in Matlab or C.Matlab would offer good user friendliness but I have heard that Matlab being an interpreted language is quite slow when it comes to loops. We (myself and other classmates) did an entire numerical electromagnetics class in Matlab. It's true that Matlab 'for' loops are slow... usually the execution time of the programs was completely dominated by actually 'filling up' the matrix (or cells) rather than, say, inverting the matrix, updating cells, etc. Even so, for a 200x200 FDTD program on any contemporary PC (1GHz), Matlab is plenty fast and I'd argue the ease of plotting/manipulating the results more than outsweighs the generally ignoranble speed penalty. Heck, I did a FDTD program in C back in 1994 on some PA-RISC HPUX workstation, and I'm _sure_ Matlab is a lot faster on a modern PC than C was back then, and back then it was certainly fast enough! BTW, look into parallelizing your code... sometimes it's a lot more trouble than it's worth, but often it's very easy to get Matlab to fill in the results of an entire row or an entire matrix in a single statement if you code it correctly. ---Joel Kolstad |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|