Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

2D FDTD with plane wave incidence(code in matlab)

Status
Not open for further replies.

MusicMan

Member level 2
Joined
Apr 18, 2007
Messages
42
Helped
9
Reputation
18
Reaction score
4
Trophy points
1,288
Activity points
1,527
2d fdtd matlab

attached with this message is a 2D FDTD(TE mode) with a plane wave source

i borrowed the 2d fdtd by susan hagness and changed the source to plane wave...

please feel free to comment if there is any error;-)
 

fdtd 2d

I want to ask about placing the incident source at ey_inc(3). Why should at than 3 point? and why when I try to shift it to another point bigger than 3 the results always mess.
If anybody know, please explain to me.
Thanks
 
2d fdtd

Thank you for your code. I think that this code can remove pml region because TFSF can hide the scatered field. I have any question about iinterpolate 1D incident wave to 2D at TFSF interface. Thank you.:D
 

2d fdtd code matlab

khalmusa said:
I want to ask about placing the incident source at ey_inc(3). Why should at than 3 point? and why when I try to shift it to another point bigger than 3 the results always mess.
If anybody know, please explain to me.
Thanks

Hi khalmusa
You can place the incident soure in the range before the connecting boundaries ,so in this program you could place the incident soure not exceed 7 point

Thank you MusicMan for your helpful.
 

scilab fdtd

thank you for your code, I want to ask when I change the background epsilon n (any value), why the propagation is not as the same as that in case of free space?
 

fdtd plane wave source

what specific epsilon did you change? maybe it would be better if you can upload the code and highlight what specific part you changed=0
 

planewave fdtd

Hi all,
Do you have TM mode also?
 

plane wave fdtd

hi

is there a working scilab translation?

i have scilab, not matlab. i have tried to translate the file, it was successful, but i can not run the translated code, error...
 
implementig fdtd in 2d in matlab

i want to ask a question.
i do exactly as the book writed by sullivan. i got somewhat reflection when the wave hit the boundary in 1D.but the author said there is no anything reflection. i hope somebody can tell me why.thanks a lot!
 

2d fdtd matlab code

i want to ask a question.
i do exactly as the book writed by sullivan. i got somewhat reflection when the wave hit the boundary in 1D.but the author said there is no anything reflection. i hope somebody can tell me why.thanks a lot!
 

fdtd 2d matlab

if you are using the PML boundary. please check the interface of computational region and PML layers.
if you are using simple boundary condition, may be the magic step is not matched in case of dielectric background.
for free space case, the magic step is matched.
 

plane wave - fdtd

the wave transmit in the free space .thank you for the same!
 
fdtd,periodic boundary condition,matlab code

I am just learning FDTD and this is vey useful for me.
 

fdtd scilab

could you tell me how can you set the direction of the oblique incident plane wave
 

fdtd-2d.f

very helpfull, this program is a nice job
 

fdtd with plane wave source matlab

I have not run or looked at the attached MATLAB code, but I may be able to answer some of the questions posed in this discussion. I apologize if any of my answers don't apply to the attached code.

1. No reflections in 1D FDTD?
For the special case of 1D FDTD there exists an exact boundary condition from which you should not get any reflections. This is possible because energy can only be traveling in one direction and all frequencies will have the same velocity. Roughly speaking, this boundary simply works by storing the outermost field values for two time steps and using them as the boundary field field values at the current time step.

2. Oblique incidence in FDTD?
This is a tricky question. If you are using periodic boundary conditions and wish to use an impulse source at oblique incidence, there is no good way to do this. There is a technique called the "angled update method" but this is limited in the angles it can implement. Otherwise you are stuck with just normal incidence. If you can make your problem space cover more than one period in its cross section, there will be other discrete angles available to you. You can calculate what angles using the grating equation.
If you do not have periodic boundaries (PML for example) or you are using a sinusoidal source, you can easily incorporate oblique incidence. I would suggest using the total-field/scattered-field technique for this, but other approaches exist such as the scattered-field only method. Using TF/SF, you would set all your PML regions to be the scattered-field. You may also include a few more grid cells in the scattered-field if you want to more easily calculate the reflected energy from whatever you are modeling.

Alternative Methods
================
You may also wan to consider the finite-difference frequency-domain (FDFD) method. This is excellent for 2D problems or modeling devices that are highly resonant where FDTD is less efficient. It is the easiest method I know of to implement. I teach a short course on the method and have made my course notes and example codes available for free from www.kraetonics.com. It is all MATLAB code and it can model TE and TM modes at any angle of incidence you wish.
The example codes model a polarizer, a photonic crystal, and a guided-mode resonance filter. The idea was to setup simple examples so that you could easily modify them to model whatever you wish.

Hope this helps!
-Tip
 
  • Like
Reactions: hoda_a

    hoda_a

    Points: 2
    Helpful Answer Positive Rating
fdtd matalab code for plane wave source

You may also wan to consider the finite-difference frequency-domain (FDFD) method. This is excellent for 2D problems or modeling devices that are highly resonant where FDTD is less efficient. It is the easiest method I know of to implement. I teach a short course on the method and have made my course notes and example codes available for free from www.kraetonics.com. It is all MATLAB code and it can model TE and TM modes at any angle of incidence you wish.

These are very nice slides. I strongly recommend other people interested in FDFD to
have look. Thanks for posting them.

I have one question however. You say that scaling all the fields into the same range
increases the accuracy. (I think Sullivan claims this or something similar too.)

I do not understand why that should be true (unless fix point arithmetic is used or
underflows/subnormal floating point numbers occur). No matter how you scale
the ratios of two values which need to be added stays the same and that means the
smaller (absolute value) number will lose significant bits independent of the
scaling if its exponent is smaller (ignoring variations in relative size of the fraction
(r' -r)/r where r' is the smallest exactly representable floating point number larger than r).
For products of floating point numbers the exponents take care of all differences.

The only time I could see scaling making a small difference is if some 'important' values
become exactly representable or when the significand gets larger.
 
matlab finite difference 2d

For example, suppose you had a system that could only store three digits of accuracy and the two numbers you wished to add were:

a = 2.31 e 0
b = 5.62 e -2

The real answer should be

a + b = 2.31 + 0.00562 = 2.31562

but since your computer only stores three digits, the answer your computer will give you is

a + b = 2.31

This operation essentially completely neglected the variable b.

If you are implementing FDTD, your equations are iterated thousands or millions of times so this error accumulates during the simulation.

I think 32-bit floating point numbers have 7 digits of accuracy while 64-bit numbers have something like 15.

In electromagnetics, the E and H fields are approximately related through the material impedance as E/H = Z. For free space Z=377 ohms so E and H are three orders of magnitude different. Every time you implement an equation that adds or subtracts them, you are losing precious digits of accuracy. The problem is not quite as bad as this argument seems to indicate because there are other scaling factors in the equation that make the situation better. The point, however, is that every time you calculate something you introduce error. Over thousands or millions of calculations, this error can become quite significant.

The error is much worse if you do not normalize as much as possible. FDTD is a particularly robust technique and you can seemingly get away with a lot. In numerical modeling, it is always good practice to normalize as much as possible.

-Tip
 

algorithm+program+matlab code +plane+wave+method

a = 2.31 e 0
b = 5.62 e -2

The real answer should be

a + b = 2.31 + 0.00562 = 2.31562

but since your computer only stores three digits, the answer your computer will give you is

a + b = 2.31

This operation essentially completely neglected the variable b.

I guess I did not express myself clearly enough.

What you say above is correct but what I tried to say is that it does not apply to FDTD.

If you scale the fields then you also change the constants.

E_{n+1} = c_1*E_n +c_2*(DEL x H)

turns into

E'_{n+1} = c'_1*E'_n +c'_2*(DEL x H')

The relative size of E and H versus E' and H' changes but because the constants c_1 and c_2
also change accordingly the ratio of the two summands is identical (if you scaled correctly).

And because the ratio of the summands is fixed no amount of scaling will give you higher accuracy.

Perhaps the best way to make my point is that E and H have different units. You don't add
numbers with different units in physics. The constants c_1,c_2 above will take care of the units
and will give you the same ratio between the summands no matter how you scale the fields.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top