Lec18 Waveguide
Lec18 Waveguide
Learning Objectives
@2E @2E 2
2
+ 2
+ k E = 0, k 2 = ! 2 µ✏ 2
@x @y
a/2
X
a
Finite Difference Approach
E=0 on boundary
h=a/4
1 2 3
a/2
h=a/4
a
The discretization size is h = a/4 has been set, with equal size
along x and y directions. Now the equation
@2E @2E 2
+ + k E =0
@x 2 @y 2
leads to the following discrete equation
↵=4 k 2 h2
Finite Difference Approach
The equation can be used to establish the following relationships
between field values at the three inner grid points:
↵E1 E2 = 0
E1 + ↵E2 E3 = 0
E2 + ↵E3 = 0
. This is equivalent to the matrix equation
0 10 1
↵ 1 0 E1
@ 1 ↵ 1A @E2 A = 0
0 1 ↵ E3
| {z }
Finite
A
Difference Approach
E=0 on boundary
h=a/4
1 2 3
a/2
h=a/4
a
The discretization size is h = a/4 has been set, with equal size
Finite Difference Approach
det (A) = 0
On solving p p
3
↵ 2↵ = 0 ! ↵ = 2, 0, 2.
This corresponds to the approximate values for
h=a/4
1 2 3
a/2
h=a/4
a
The discretization size is h = a/4 has been set, with equal size
Finite Difference Approach
The computation can be made more accurate by including more grid points
(and reducing the grid size). Naturally code should take care of indexing the
nodes and determining the matrix elements accordingly.
Consider the example below:
E=0
21
a/2
1 2
Count = 0
do j=1,3
We need to represent fields do i=1,7
at various nodes as E_i etc. and count = count + 1
ind(i,j) = count
to prepare matrix A. end do
end do
do j = 1,N
Initialised to zero do i = 1,N
initially a(i,j) = 0.0 !Initializing
end do
end do
@2E @2E 2
2
+ 2
+ k E =0
@x @y
Multiplying this equation by E and integrating, we get the
weighted average as follows (where r2 represents the
two-dimensional Laplacian
Z Z Z Z
E r2 E dxdy + k 2 E 2 dxdy = 0
Or RR
E r2 Edxdy
k2 = RR
E 2 dxdy
Finite Difference Approach: Iterative
Similarly we have
E (i + 1, j) + E (i 1, j) + E (i, j + 1) + E (i, j 1)
E (i, j) =
↵
!beta = 0.
do i = 1,m-2
do j = 1,n-2
f(i,j) = (f(i+1,j)+f(i-1,j)+f(i,j+1)+f(i,j-1))/alpha
end do
end do
iter = iter + 1
print *, 'Iteration =', iter,'; ka =', ka, alpha
if (iter.gt.1000) exit
end do
write(*,*)
write(*,*)'Field distribution-------'
do j=0,n-1
write(*,2) (f(i,j),i=0,m-1)
end do
2 format(9F9.2)