0% found this document useful (0 votes)
3 views16 pages

Lec18 Waveguide

The document discusses the finite difference method for determining the propagation constant of TM modes in a rectangular waveguide, detailing the mathematical formulations and iterative approaches for solving the governing equations. It outlines the discretization process, matrix formulation, and the importance of boundary conditions, as well as providing a programming example for implementation. The document emphasizes the need for convergence in iterative methods and the potential for increased accuracy through finer grid sizes.

Uploaded by

nadanasri007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views16 pages

Lec18 Waveguide

The document discusses the finite difference method for determining the propagation constant of TM modes in a rectangular waveguide, detailing the mathematical formulations and iterative approaches for solving the governing equations. It outlines the discretization process, matrix formulation, and the importance of boundary conditions, as well as providing a programming example for implementation. The document emphasizes the need for convergence in iterative methods and the potential for increased accuracy through finer grid sizes.

Uploaded by

nadanasri007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Example: Rectangular Waveguide

Learning Objectives

✴ To see how to use finite difference method to determine propagation


constant of TM mode of a rectangular waveguide.
✴ To show how various procedures (LU factorisation, bisection) are
combined to solve a composite problem.
Waveguide Modes
For a rectangular waveguide (aligned with z axis) the TM modes
are described by non-vanishing components Ex , Ey , Hx , and Hy ,
expressed in terms of Ez :

Ez (x, y , z, t) = E (x, y )e j(!t z)

where Z is the propagation direction and

@2E @2E 2
2
+ 2
+ k E = 0, k 2 = ! 2 µ✏ 2
@x @y

Further, E = 0 on the boundary


Y
E=0 on boundary

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

E (i + 1, j) + E (i 1, j) + E (i, j + 1) + E (i, j 1) 4E (i, j)


h2
+k 2 E (i, j) = 0
Rearranging,

E (i + 1, j) E (i 1, j) E (i, j + 1) E (i, j 1) + ↵E (i, j) = 0

↵=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

Nontrivial solution requiress that

det (A) = 0

On solving p p
3
↵ 2↵ = 0 ! ↵ = 2, 0, 2.
This corresponds to the approximate values for

ka ⇡ 6.4322, 8.00, 9.3

of the first three modes.


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
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

Grid size are same in both directions


Finite Difference Approach
Task I: Counting and indexing the inner nodes
Inner nodes can be counted as as follows:

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

Nodes can be indexed and


stored as a table if needed.
count= 1 2 3
(1,1) (1,2) (1,3)
Finite Difference Approach
Task II: Computing the matrix elements
Matrix elements will be symmetrical, and shall be
evaluated by exploring the adjacency between nodes.

do j = 1,N
Initialised to zero do i = 1,N
initially a(i,j) = 0.0 !Initializing
end do
end do

!Assigning matrix elements other than zeros


do j = 1,3
do i = 1,7
Assign -1 for those a(ind(i,j),ind(i,j)) = alpha
if (i.ne.1) a(ind(i,j),ind(i-1,j)) = -1.
Elements between if (i.ne.7) a(ind(i,j),ind(i+1,j)) = -1.
if (j.ne.1) a(ind(i,j),ind(i,j-1)) = -1.
Adjacent nodes. if (j.ne.3) a(ind(i,j),ind(i,j+1)) = -1.
end do
end do
print *,'ka = ',ka

program waveguide end program waveguide


function deter(alpha)
! Solving the dispersion of reactandular waveguide
! FD method for TM modes
! Ref> Booton + Sadiku implicit none
function deter(alpha)
! -----------------------------VM 22-07-2021 integer, parameter :: N=21
integer
implicit none :: i,j,R
implicit none integer, dimension(N,N)
integer, parameter :: :: ind
N=21
external deter integerdimension(N,N) :: ::
real, i,j,R
a, al, au
real :: deter,ka,xa=2.9,xb=3.5,tol=0.00001, alpha0 integer, dimension(N,N) :: ::
inddeter,alpha
real
real, dimension(N,N) :: a, al, au
print *, 'Propagation constant for rec waveguide'
real :: deter,alpha
Print *, 'TM Mode' R = 0
do j=1,3
R = 0
call bisect(deter,xa,xb,tol,alpha0) do i=1,7
do j=1,3
R = R + 1
do i=1,7 !Counting internal points
print *, 'alpha = ', alpha0
ka = 8.0*sqrt(4. - alpha0) Rind(i,j)
= R + 1 = R!Counting
!Indexing internal
internal points
points
print *,'ka = ',ka end ind(i,j)
do = R !Indexing internal points
end do
end do
end program waveguide end do
do j = 1,N
if (j.ne.3) a(ind(i,j),ind(i,j+1))
do j = =
1,N-1.
do i = 1,N
function end do
deter(alpha) do i = 1,N
a(i,j) = 0.0 !Initializing
a(i,j) = 0.0 !Initializing
implicit none
end do end do
end do
integer, parameter :: N=21 end do
end do
integer :: i,j,R
call dl(al,au,a,N)
integer, dimension(N,N) :: ind
!Assigning matrixelements
!Assigning matrix elements other
other thanthan zeros
zeros
real, dimension(N,N) :: a, al, au
do j
do j == 1,3
1,3
real deter = :: 1.deter,alpha do i
do i == 1,7
1,7
R = 0 do i = 1,N a(ind(i,j),ind(i,j))
a(ind(i,j),ind(i,j)) = alpha
= alpha
if (i.ne.1) a(ind(i,j),ind(i-1,j)) = -1.
do j=1,3 deter = deter * au(i,i) if (i.ne.1) a(ind(i,j),ind(i-1,j)) = -1.
do i=1,7 if (i.ne.7) a(ind(i,j),ind(i+1,j)) = -1.
end do if (i.ne.7) a(ind(i,j),ind(i+1,j)) = -1.
R = R + 1 !Counting internal points if (j.ne.1) a(ind(i,j),ind(i,j-1)) = -1.
if (j.ne.1) a(ind(i,j),ind(i,j-1)) = -1.
ind(i,j) = R !Indexing internal points if (j.ne.3) a(ind(i,j),ind(i,j+1)) = -1.
end do end function deter end do
end do end do
Finite Difference Approach: Iterative

An iterative method can also be adopted with finite


difference scheme to solve for propagation constant
and fields. (Successive approximation method)
Finite Difference Approach: Iterative

Successive approximation scheme depends on computing field


components and propagation constant alternatively using
interdependent expression till the results converges below a
predefined tolerance value.
We have the expression

@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

A finite di↵erence version of this can be achieved as follows:



P P E (i + 1, j) + E (i 1, j)+
i j E (i, j)
2 2 E (i, j + 1) + E (i, j 1) 4E (i, j)
k h = P P 2
i j [E (i, j)]

This can be rewritten as


P P
i j E (i, j) [E (i + 1, j) + E (i 1, j) + E (i, j + 1) + E (i, j 1)]
↵= P P 2
i j [E (i, j)]

Similarly we have

E (i + 1, j) + E (i 1, j) + E (i, j + 1) + E (i, j 1)
E (i, j) =

The successive approximation method is iteration between the


equations in boxes till convergence is obtained.
!program waveguide_iterative
-----------------------------
! Solving the dispersion of reactandular waveguide
! VM 22-07-2021
! FD method
program for TM modes (Iterative)
waveguide_iterative
!! Solving the dispersion
Ref> Booton + Sadikuof reactandular waveguide
!implicit
! FD none
method for TM modes (Iterative)
-----------------------------
! Ref> Booton + Sadiku
integer, parameter :: m=9,n=5 !no. of
! VM 22-07-2021 points along X and Y
! -----------------------------
!integer :: i,j, iter
VM 22-07-2021
implicit none
real :: alpha,beta,ka,kaold,num,den,tol=0.0001
integer,none
implicit parameter :: m=9,n=5 !no. of points along X and Y
integer parameter
integer, :: i,j, iter
:: m=9,n=5 !no. of points along X and Y
real,dimension(0:m-1,0:n-1)
integer
real :::: i,j, iter :: f
alpha,beta,ka,kaold,num,den,tol=0.0001
real :: alpha,beta,ka,kaold,num,den,tol=0.0001

print *, 'Propagation constant


real,dimension(0:m-1,0:n-1) :: f
real,dimension(0:m-1,0:n-1) :: f
for rec waveguide'
Print *, 'Iterative, successive approximation method'
print*,*,'Propagation
print 'Propagation constant
constant forwaveguide'
for rec rec waveguide'
Print*,*,'Iterative,
Print 'Iterative, successive
successive approximation
approximation method' method'
!Initialise fields at all points to be zero
!It reassigns
!Initialise
!Initialisefields iner
at
fields all points
points
at all to with
be to
points zerofield
be zero values =.5
!It
!Itreassigns iner points with with
field field
valuesvalues
=.5
f=0. reassigns iner points =.5
f=0.
f=0.
doi=1,m-2
do i=1,m-2
do do
i=1,m-2
j=1,n-2
do j=1,n-2
do f(i,j)=0.5
j=1,n-2 The program initialises field values and
f(i,j)=0.5
end dof(i,j)=0.5 propagation parameter k to suitable values
enddodo
end doend
end do
before iteration starts.
end do
ka = 1. Different modes are selected by
kaold = 0.
ka = 1.
iter
ka == 01. appropriate initialisation of fields E(i,j).
kaold
do = 0.
while(abs(ka-kaold).gt.tol)
kaold
iter = =
kaold 0 = 0.
ka
Here, fields are all initialised to 0.5, leading
iter
do num == 0.
0
while(abs(ka-kaold).gt.tol) to the fundamental mode.
do den = 0. = ka
while(abs(ka-kaold).gt.tol)
kaold
beta = 0.
num = 0.= ka
dokaold
i = 1,m-2
dendo=j 0.
num = = 0.1,n-2
beta = 0.
iter = 0
do while(abs(ka-kaold).gt.tol)
kaold = ka
num = 0.
den = 0.
beta = 0.
do i = 1,m-2
do j = 1,n-2
beta = f(i+1,j)+f(i-1,j)+f(i,j+1)+f(i,j-1)
num = num + f(i,j)*beta
den = den + f(i,j)*f(i,j)
end do
end do
alpha = num/den
ka = 8.0*sqrt(4. - alpha) ! taking m=9 & n=5 & equal spacing

!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)

end program waveguide_iterative

You might also like