- #1

s_hy

- 61

- 0

can anyone teach me how to put Mur's ABC in my fortran code for 1d fdtd maxwell's equation as below

Code:

```
!1d fdtd Simulation in free space
subroutine fd1d01(f0,miu,delta,S,E0)
implicit none
double precision :: f0 !frequency
double precision :: miu !permittivity
double precision :: delta
double precision :: S
double precision :: E0
integer :: iinit
integer :: ilast
integer :: i,j
integer :: n
double precision :: Ca
double precision :: Da
double precision :: tdelta
double precision :: c
double precision,dimension(202) :: Ez
double precision,dimension(202) :: Hy
double precision, parameter :: pi = 3.14159265
double precision :: Cb
double precision :: Db
double precision :: lambda
character(len=20) :: filename
f0 = 100.0
miu = 1.0
delta = 1.e-3
S = 1.0001
E0 = 1.0
iinit = 1
ilast = 100
c = 1.0
lambda = c/f0
tdelta = (delta/c)/sqrt(2.0)
!initialization
do j = 1, 2*ilast
If (Mod(j,2) == 0) then !j is even; hence di is whole number
Hy(j) = 0
else
Ez(j) = 0
End if
end do
Ca = 1.0
Cb = (tdelta/delta)
Da = 1.0
Db = tdelta/(miu*delta)
do n = 1,200
write (filename, "('ez',I3.3,'.dat')") n
open (unit=130,file=filename)
do j = 2, 2*ilast-1
if (Mod(j,2) /= 0) then !j is odd;
Ez(j) = Cb*(Hy(j+1)-Hy(j-1)) + Ca*Ez(j)
! Print*, 'n, j, Ez(j) = ', n, ' ', j, ' ' , Ez(j)
write (130,*) Ez(j)
end if
end do !j
!absorbing boundary condition
Ez(2) = 0
Ez(202) = 0
do j = 2, 2*ilast-1
if (Mod(j,2) == 0) then !j is even;
Hy(j) = Db*(Ez(j+1)-Ez(j-1)) + Da*Hy(j)
end if
end do !j
!plane wave source
Ez(101) = E0*sin (2*pi*f0*n*tdelta)
close (unit=130)
end do !n
end SUBROUTINE fd1d01
```

i tried to put it after Ez and before Hy...but i guess my ABC algorithm is wrong. anyone can teach me?

thanks