[1d fdtd yee algorithm using fortran 90] unexpected graph- what is the problem?

Status
Not open for further replies.

s_hy

Newbie level 4
Joined
May 28, 2012
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,320
hi all,

i have codes about reflective 1d fdtd maxwell equation as below:

Code:
!d fdtd Simulation in free space 
subroutine fd1d01(f0,miu,delta,S,E0)
implicit none

real                               :: f0 
real                               :: miu
real                               :: delta 
real                               :: S 
real                               :: E0
integer                            :: iinit 
integer                            :: ilast 
integer                            :: i,j
integer                            :: t,t0
double precision                   :: di
integer                            :: n
double precision                   :: Ca
double precision                   :: Da
double precision                   :: tdelta 
double precision                   :: c
double precision,dimension(100)    :: Ez
double precision,dimension(100)    :: Hy
real, parameter                    :: pi = 3.14159265
double precision                   :: Cb
double precision                   :: Db
double precision                   :: lambda
double precision                   :: alpha
character(len=20)                  :: filename

f0 = 1.0
miu = 1.0
delta = 1.0 
S = 1.0
E0 = 1.0
iinit = 0 
ilast = 100
 
c = 3.e8
lambda = c/f0
alpha = 0.04*lambda
tdelta = 1.0*alpha/(S*c)

!initialization
Ez = 0
Hy = 0

Ca = 1.0
Cb = tdelta/(delta*alpha)
Da = 1.0
Db = tdelta/(miu*alpha)

do n = 0,500
 write (filename, "('ez',I3.3,'.dat')") n
 open (unit=130,file=filename)
  do j = 0,2*ilast
     di = 0.5*j 
     if (Mod(j,2) == 0 ) then  !j is even; hence di is whole number
        Ez(Int(di-0.5)) = Ca*(Ez(Int(di-0.5)))+Cb*(Hy(Int(di))-Hy(Int(di-1)))
     else  !j is odd; hence di is 1/2 of whole number
        Hy(Int(di)) = Da*(Hy(Int(di)))+Db*(Ez(Int(di+0.5))-Ez(Int(di-0.5)))
     end if
  write (130,*) Ez(Int(di))
  end do

  !plane wave source
  Ez(50) = E0*sin (2*pi*f0*n*tdelta)

 close (unit=130)

end do !n

end SUBROUTINE fd1d01

the problem is after compiling the wave line i got is not as i expected since i expected gaussian envelope, but the result is as below:




can anyone explain to me why it is happened?
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…