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.

FDTD code that can compare different absorbing boundary conditions

Status
Not open for further replies.

gladiator

Member level 3
Joined
May 29, 2002
Messages
57
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
309
Hello,
I am looking for an FDTD code 2D or 3D that can compare different
absorbing boundary condiditons


help please


thanks
 

FDTD code

A simple 1-D FDTD code in matlab with ABC is given below.

% 1-D FDTD code
KE=200 ;%KE is he number of cells to be used
ex=zeros(1,KE);
hy=zeros(1,KE);
ex_low_m1=0;
ex_low_m2=0;
ex_high_m1=0;
ex_high_m2=0;

kc=KE/2;
%Gaussian pulse
t0=40;
spread=12;
n=input('T=?');
for T=1:n
%Main FDTD Loop
%Ex field

for k=2:KE
ex(k)=ex(k) + 0.5*(hy(k-1)-hy(k));
end

%Gaussian pulse in the middle

pulse=exp(-0.5*((t0-T)^2/spread^2));
ex(kc)=pulse;

%Absorbing Boundary Conditions

ex(1)=ex_low_m2;
ex_low_m2=ex_low_m1;
ex_low_m1=ex(2);

ex(KE)=ex_high_m2;
ex_high_m2=ex_high_m1;
ex_high_m1=ex(KE-1);

%Hy field

for k=1:KE-1
hy(k)=hy(k)+ 0.5*(ex(k)-ex(k+1));
end

end

%End of FDTD Loop

plot(ex)
 
Re: FDTD code

Nice piece ....

Can you please teach me a bit? I have some small questions and I am not verey familier with FDTD.

1. Can we replace the gaussian pulse? How?
2. Can we MIX FDTD with some other method?

thanks

:!: :idea: :?:

peter-gr said:
A simple 1-D FDTD code in matlab with ABC is given below.

% 1-D FDTD code
KE=200 ;%KE is he number of cells to be used
ex=zeros(1,KE);
hy=zeros(1,KE);
ex_low_m1=0;
ex_low_m2=0;
ex_high_m1=0;
ex_high_m2=0;

kc=KE/2;
%Gaussian pulse
t0=40;
spread=12;
n=input('T=?');
for T=1:n
%Main FDTD Loop
%Ex field

for k=2:KE
ex(k)=ex(k) + 0.5*(hy(k-1)-hy(k));
end

%Gaussian pulse in the middle

pulse=exp(-0.5*((t0-T)^2/spread^2));
ex(kc)=pulse;

%Absorbing Boundary Conditions

ex(1)=ex_low_m2;
ex_low_m2=ex_low_m1;
ex_low_m1=ex(2);

ex(KE)=ex_high_m2;
ex_high_m2=ex_high_m1;
ex_high_m1=ex(KE-1);

%Hy field

for k=1:KE-1
hy(k)=hy(k)+ 0.5*(ex(k)-ex(k+1));
end

end

%End of FDTD Loop

plot(ex)
 
Re: FDTD code

1. I think you can use any wave-form. How to do it would depend on the software you are using. An example would be providing a data file specifying the amplitude of pusle at a series of time steps. Now the accuracy of the result and the time to convergence would be affected by the wave-form. If your source runs for 10000 time steps before reaching "practical" zero, you would check carefully whether the output has stablized much earlier (say 5000). If the simulation is terminated too early, you have error. You would also think about numerical dispersion...

2. Obviously you can mix FDTD with other method. Some commercial codes (e.g. WASP-net) does that. From a theoretical point of view, those methods are used to solve some differential equations, and you could appy equivalent principle to decompose a problem domain into subdomains and apply different methods in each of them.
 
Re: FDTD code

Of course you can use a pulse other than gaussian.For example you can use a sinusoidal pulse.
Download the following file which will probaly help you.

good luck.

peter-gr.
 

Re: FDTD code

It is very easy to switch to switch to a sinusoidal source.Just replace the parameter pulse with the following:

pulse=sin(2*pi*freq_in*dt*T);

The parameter freq_in determines the frequency of the wave.
 

Re: FDTD code

Maybe you can find the 2d and 3d code in the book by Taflove.
Computational Electrodynamics: The Finite-Difference Time-Domain Method by Allen Taflove, Susan C. Hagness (Hardcover - June 2000)

Or You can find another book
Electromagnetic Simulation Using the FDTD Method by Dennis M. Sullivan (Author) (Hardcover)
 
Re: FDTD code

please visit **broken link removed** for help.
 

Re: FDTD code

another site you may like to try **broken link removed** .
 

FDTD code

I need a 3D FDTD code implementing a point source in a free-space mesh with Mur absorbing boundaries. Would help me?
 
Re: FDTD code

The book of Dennis Sullivan gives the programs you want for 3D FDTD simulation.
 
Re: FDTD code

in the matlab source code above, when it is asking for an input of "T" what does that do? help is appreciated.
 
Re: FDTD code

The T indicates the time-steps.(the time the pulse will last: T=δt*n)
 
Re: FDTD code

can someone explain the absorbing boundary condition? i'm still a bit lost on the algorithm. thanks.
 

Re: FDTD code

Absorbing Boundary Conditions are necessary to keep outgoing H and E fields from being reflected back into the problem space. Normally, in calculating the E field, we know the surrounding H values;this is a fundamental assumption in the FDTD method.At the edge of the problem space we will not have the value to one side.
Suppose we are looking for a boundary condition in the end.If the wave is going toward the boundary condition in free space, it is travelling at c, the speed of light.So in one time step of the FDTD algorithm,it travels:
distance=c*dt=c*(dx/2c)=dx/2

The above equation explains that it takes two time steps for a wave to cross one cell.So a common sense approach tells as that a common boundary condition would be Ex(n)(0)=Ex(n-2)(1)
It is relativeley easy to implement this.Store a value of Ex(1) for two time steps and then put it in Ex(0).
 
Re: FDTD code

Yes we can see this from the book of Sullivan. But, in the code you have pasted above, how were the time indexes "n" and "n-2" are presented, i.e. in
" ex(1) = ex_low_m2
ex_low_m2 = ex_low_m1
ex_low_m1 = ex(2) "
I saw just that ex(1) = ex(2).
Sorry for my zombie question. Thanks!
Absorbing Boundary ... So in one time step of the FDTD algorithm,it travels:
distance=c*dt=c*(dx/2c)=dx/2

The above equation explains that it takes two time steps for a wave to cross one cell.So a common sense approach tells as that a common boundary condition would be Ex(n)(0)=Ex(n-2)(1)
It is relativeley easy to implement this.Store a value of Ex(1) for two time steps and then put it in Ex(0).
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top