# [FDTD/Fotran] detected reflection near boundary but don't know why

• s_hy
In summary: You may want to consult with an expert in the field or do some further research on how to correct impedance mismatch in FDTD simulations.
s_hy
hi all,

i have wrote codes for 2d fdtd in different permittivity (epsilon). in this code, cell size is 200 x 200, start with eps=1 from center, and different permittivity started at boundary (i1,i2) = (25,75) = (j1,j2), epsilon = 2. the problem is, when the wave propagates and approach (i1,i2) = (25,75) = (j1,j2), i have detected some reflections happened to the wave at timesteps, n after 50, the reflections become obvious...i just wondering, why is that happened. i attached here the animation of the wave and my codes. i really have no idea how to solve this problem.

Code:
subroutine test7
implicit none

double precision                                     :: f0,A0
double precision                                     :: delta, deltat
double precision                                     :: eps0,epsr,miu0,miur
double precision                                     :: lamda
double precision                                     :: omega
double precision                                     :: S,k,c
integer                                                     :: i,j
integer                                                     :: ie,je,ic,jc,i1,i2,j1,j2
integer                                                     :: n
double precision,dimension(202,202)   :: Ez,Hy,Hx
double precision,dimension(202,202)   :: Ca,Cb,Da,Db,Dax,Dbx,Day,Dby
!double precision                                     :: Ca,Cb,Da,Db
double precision,dimension(202,202)   :: miu,eps,sigma, sigmat
double precision, parameter                 :: pi = 3.14159265
character(len=20)                                   :: filename

! parameters
f0 = 3.0e7
eps0 = 8.8e-12
miu0 =  4*pi*1e-7
c = 3.e8
lamda = c/f0
omega = 2*pi*f0
print *, 'lamda=',lamda
A0 = 5.0
k = 2*pi / lamda
omega = c*k

!courant stability factor
!S = 1/sqrt(2.0)
! spatial and time grid steps
delta = lamda/10
deltat = delta/(2*c)
print *, 'deltat=',deltat

!model size
ie = 100
je = 100

!source location
ic = ie/2
jc = je/2

!boundary for different permittivity
i1 = ie/4
i2 = ie*3/4
j1 = je/4
j2 = je*3/4

print*, 'see me?'

!initialize Ez, Hx,Hy to zero at t=0
do i = 1,ie
do j = 1,je
Hx(i,j) = 0.0
Hy(i,j) = 0.0
Ez(i,j) = 0.0
end do
end do

!medium's properties
miur = 1.0
epsr = 1.0

do i = 1,ie
do j = 1,je
!initialize permittivity and permeability
eps(i,j) = epsr*eps0
miu(i,j) = miur*miu0
end do
end do

do i = i1,i2
do j = j1,j2
eps(i,j) = 2*eps0
miu(i,j) = 1*miu0
end do
end do

!medium's properties
! initialize electric conductivity & magnetic conductivity
do i = 1,ie
do j = 1,je
sigma(i,j) = 0.0
sigmat(i,j) = 0.0
Ca(i,j) = (2*eps(i,j)-deltat*sigma(i,j))/(2*eps(i,j)+deltat*sigma(i,j))
Cb(i,j) = (2*deltat)/(2*eps(i,j)+deltat*sigma(i,j))
Da(i,j) = (2*miu(i,j)-deltat*sigmat(i,j))/(2*miu(i,j)+deltat*sigmat(i,j))
Db(i,j) = (2*deltat)/(2*miu(i,j)+deltat*sigmat(i,j))
end do
end do

! beginning of timesteps
do n = 1,300

write (filename, "('data',I3.3,'.dat')") n
open (unit=130,file=filename)

!initiate sinusoidal wavepulse at center
Ez(ic,jc) = A0*sin(2*pi*f0*n*deltat)

! calculate ez-field
do i = 2,ie-1
do j = 2,je-1
Ez(i,j) = Ca(i,j)*Ez(i,j) + Cb(i,j)*(Hy(i,j) - Hy(i-1,j) - Hx(i,j) + Hx(i,j-1))
write (130,*) i,j,Ez(i,j)
if (j == 99) write (130,*) ' '
!          !print *,'i=',i,'j=',j,'Ez(i,j)=',Ez(i,j)
end do
end do

do i = 1,ie-1
do j = 1,je-1
Hx(i,j) = Da(i,j)*Hx(i,j) + Db(i,j)*(Ez(i,j) - Ez(i,j+1))
!print *,'i=',i,'j=',j,'Hx(i,j)=',Hx(i,j)
end do
end do

do i = 1,ie-1
do j = 1,je-1
Hy(i,j) = Da(i,j)*Hy(i,j) + Db(i,j)*(Ez(i+1,j) - Ez(i,j))
!print *,'i=',i,'j=',j,'Hy(i,j)=',Hy(i,j)
end do
end do

close (unit=130)

end do !n

end SUBROUTINE test7

thank you for the reply. i just found out the problem caused by impedance mismatch. it is happened when i use different epsilon. wave impedance inversely proportional to the square of epsilon. So epsilon =1 wave impedance value is 1.414 times greater than epsilon= 2. If there is any impedance mismatch between the two layers it will create reflection. then, another problem, i found the cause of problem, but have no idea how to correct impedance mismatch in my simulation. do you have any idea?

I'm sorry, but as I have never used FDTD or worked with that kind of problem, I have no advice to give you.

I would first examine the code and try to understand the logic behind it. I would also look at the animation and try to identify any patterns or anomalies in the wave propagation. From there, I would consider the boundary conditions and the different permittivity values set at the boundary. It is possible that the reflections are occurring due to a mismatch between the permittivity values at the boundary and the rest of the medium. I would also consider the Courant stability factor and make sure it is properly accounted for in the calculations. Additionally, I would check for any errors in the code that may be causing the reflections. If the issue cannot be resolved, I would consult with other experts in the field for further insights and potential solutions.

## 1. What is FDTD/Fortran?

FDTD (Finite-Difference Time-Domain) is a computational method used in electromagnetics to solve Maxwell's equations. It is commonly implemented using the programming language Fortran.

## 2. Why is a reflection being detected near the boundary?

A reflection near the boundary can occur due to a mismatch in the material properties or geometry of the boundary. It can also be caused by an error in the simulation setup or parameters.

## 3. How can I determine the cause of the reflection?

To determine the cause of the reflection, you can analyze the material properties and geometry of the boundary, as well as the simulation setup and parameters. You can also try adjusting the simulation parameters to see if the reflection disappears.

## 4. Can I eliminate the reflection?

In most cases, it is possible to reduce or eliminate the reflection by adjusting the simulation parameters or ensuring a smooth transition between different materials at the boundary. However, in some cases, the reflection may be physically present and cannot be eliminated.

## 5. Are there any other possible reasons for the detected reflection?

Yes, there may be other reasons for the detected reflection, such as numerical errors or instabilities in the simulation. It is important to carefully review all simulation settings and parameters to ensure the accuracy of the results.

• Programming and Computer Science
Replies
4
Views
3K
• Programming and Computer Science
Replies
1
Views
4K
• Programming and Computer Science
Replies
4
Views
3K
• Programming and Computer Science
Replies
5
Views
2K
• Programming and Computer Science
Replies
4
Views
3K
• Atomic and Condensed Matter
Replies
8
Views
4K
• Programming and Computer Science
Replies
2
Views
4K
• Programming and Computer Science
Replies
11
Views
2K
• Programming and Computer Science
Replies
8
Views
6K
• Programming and Computer Science
Replies
1
Views
2K