Professional Documents
Culture Documents
Chapter 5 - The FDTD Simulation Program
Chapter 5 - The FDTD Simulation Program
Chapter 5 - The FDTD Simulation Program
or MATHCAD
+ =
+
+
2
1
2
1
2
1
2
1
) 1 , , ( ) , , ( ) , 1 , ( ) , , ( ) , , (
1
) , , (
n
k j i y
n
k j i y z
t
n
k j i z
n
k j i z y
t n
k j i x
n
k j i x
H H H H E E
(5.3.1a)
This can be written as:
+ =
+
+ +
+
+
2
1
2
1
2
1
2
1
) 1 , , ( ) , , (
1
) , 1 , ( ) , , (
0
) , , (
1
) , , (
n
k j i y
n
k j i y
X
n
k j i z
n
k j i z
X
n
k j i x
n
k j i x
H H C H H C E E (5.3.1b)
where
z
t
X
y
t
X
C C
= =
1 0
, (5.3.2)
The computation coefficients C
0X
and C
1X
are frequently used as other E field
components in similar dielectric will use similar update function too. These coefficients
are stored in a two-dimensional array and assigned a certain row index, for example row
r. Hence all E
x
computations that share similar update form as Equation (5.3.1a) and
similar dielectric constant will use the computation coefficients C
0X
and C
1X
stored in
row r of the array. The computation coefficients will be different for E
x
in region of
different dielectric constant . Another row entry will have to be created for that
particular region. Sometimes the update form also varies, for instance when E
x
83
component coincide with a lumped resistor of resistance R Ohms, the update equation
will be given by (4.3.4), which is repeated here again:
( )
( ) z y R
x
X
n
k j i y
n
k j i y z C
t
n
k j i z
n
k j i z y C
t n
k j i x C
C
n
k j i x
C H H
H H E E
X
X X
X
+
+
+
+
]
]
]
]
]
]
+
,
`
.
|
,
2
1
2
1
2
1
2
1
) 1 , , ( ) , , ( 1
) , 1 , ( ) , , ( 1 ) , , ( 1
1
1
) , , (
(5.3.3)
In this case the computation coefficients will be:
( ) ( ) z
X
C
t
X
y
X
C
t
X
X
C
X
C
X
C C C
+
1
2
1
1
1
1
0
, ,
(5.3.4)
In this software, the actual computation coefficient table is implemented as an
array of structures instead of a two-dimensional floating-point array (note: the structure
here is a form of datatype in C/C++ Language). Each field component, E
x
, E
y
, E
z
, H
x
,
H
y
, H
z
has its own look-up table. The structures are named stCCEx, stCCEy, stCCEz,
stCCHx, stCCHy and stCCHz. Each structure contains ten double type variables fC0 to
fC9, a char type variable umode and a void pointer plist. For example the look-up table
for E
x
field components would look like this:
stCCEx[0]
stCCEx[1]
stCCEx[2]
stCCEx[m-1]
stCCEx[m]
fC0 fC1 fC2 fC9 umode plist
stCCEx[1]
value
next
value
next
value
next
NULL
value
next
Optional linked-list
Computational Coefficients
Look-up Table for E
x
84
Figure 5.8 Computational coefficients look-up table for E
x
field components.
Each entry stCCEx[i] can store up to ten coefficients. The variable umode is an
8-bit unsigned integer (known as char datatype in C/C++) used to identify the type of
lumped element associated with the E
x
field component using these coefficients. For
instance umode = 0 means the E
x
field is in a linear, lossless and non-dispersive
dielectric, umode = 100 means the E
x
field component coincide with a lumped resistor
and so forth. The values assigned to umode are the same as that used to differentiate
various lumped components as given in Appendix 7. The void pointer plist can point to
a linked-list (Murray and Pappas, 1996). This is used when the ten variables fC0 - fC9
are not sufficient to store the computation coefficients, and extra memory locations are
needed. The linked-list provides a mechanism of variable length storage. It will be
asked why not do away with fC0 - fC9, having just plist and umode. The reason is
retrieving information from a linked-list is computationally slower and more
cumbersome than directly reading from an array. To access fC2 in stCCEx[1], the
following statement is used: stCCEx[1].fC2. To access the third elements in the linked-
list, we have to access the first element, then the second and finally the third in a
sequential manner (Murray and Pappas, 1996). Most update functions for E and H field
components usually do not require so many coefficients, so having ten variables in the
structure and the rest in an optional linked-list provide a compromise between computer
memory requirement and speed.
5.3.3 Other Important Objects in the Simulation Engine
In the parlance of object-oriented programming, there is no variable or datatype.
Instead there are only objects or class as it is called in C++ (Horton 1998, Murray &
Pappas 1996). Each object consist of a number of members, which can be a data
storage element such as integer, floating-point (float), long floating-point (double),
character (char), structures etc. or functions. The functions within an object are known
as methods. The members of an object have different visibility scope, some members
are accessible by functions outside of the object, while others are only accessible by
other members within the object. An object can be inherited by other objects, making
85
all its member data and functions available to the child object. The inherited object is
usually called the parent object. During program execution all active objects will reside
in the computer memory.
A number of objects are declared for the FDTD Simulation Engine. Among the
more important objects are the electric field object (tEfield), magnetic field object
(tHfield) and Absorbing Boundary Condition object (tABC). The electric field object
contains the variables to store all the E field components in the model. Similarly the
magnetic field object contains the variables to store all H field components in the
model. The Absorbing Boundary Condition object contains some variables and
functions for updating the E fields tangential to the model boundary. These three are
the base objects, sometimes also called the parent objects. A child object, the FDTD
field object (tEHfdtd) inherits both tEfield and tHfield objects. There is also another
object, the cube object (tCube) which is used during the initialization stage and for
creating the computation coefficient look-up table. The cube object tCube is used to
store the characteristics of every cube in the model as the MDF file is read and parsed.
Information contained in tCube is then used to assist in constructing the look-up table
depicted in Figure 5.8 for E and H field components. The object tCube will be removed
from the computer memory once initialization is completed. The details of each object
or class are defined in the header file fdtd_class.h in the CD-ROM.
Figure 5.9 Various objects declared in the FDTD simulation engine.
tEfield tHfield tCube tABC
tEHfdtd
86
Associated with each field component are three variables. A char variable to
specify the update mode for the field such as Equations (5.3.1a) or (5.3.3), another char
variable specifies the row index for the associated computation coefficients look-up
table, and lastly a double variable to store the current value of the field component.
Figure 5.10 illustrates this concept for E
x
and H
x
components. In Figure 5.10,
uparamex and uparamhx are the variables associated with the row index of the look-up
tables for E
x
and H
x
field respectively. The variables umodex and umodhx are
associated with the update mode. Lastly the current values for the fields are stored in
fEx and fHx. All these variables are contained in tEfield and tHfield objects.
Figure 5.10 Three data storage locations are needed for each field component.
Since the tEfield object contains storage locations for all E field components, it
has three-dimensional arrays of the variables uparamex, umodex and fEx for E
x.
Of the
three variables, only fEx is accessible by external functions. Variables uparamex and
umodex are private to the tEfield and can only be accessed by methods declared within
the object. This is known as encapsulation in object-oriented programming. It serves to
provide transparency to external functions and prevent accidental modification of
important variable, reducing the chances of programming bug. Another two similar sets
of arrays have also been declared in tEfield for E
y
and E
z
. The same can be said for
tHfield, where nine three-dimensional arrays are declared for H
x
, H
y
and H
z
. The
tEHfdtd object inherits both tEfield and tHfield objects. It also introduces all functions
required to update E and H field components under various modes. This relationship is
shown in Figure 5.11.
fEx
umodex
uparamex
E
x
fHx
umodhx
uparamhx
H
x
87
Figure 5.11 Relationship between tEHfdtd, tEfield and tHfield.
Finally, Figure 5.12 illustrates the details of a typical field component update
sequence. This example is for E
x
field components. Figure 5.13 shows the state
diagram for creating the computation coefficient look-up table for E
x
field components
during the initialization stages. The procedures shown in Figure 5.12 and Figure 5.13
are then repeated for E
y
, E
z
, H
x
, H
y
and H
z
field components. There are also other
objects or data structures not described by this short discussion. This includes a linked-
list to store the information for field components to probe or save to the output file,
and a linked-list for storing the information for various lumped components.
Object tEfield
uparamex[ ][ ][ ]
uparamey[ ][ ][ ]
uparamez[ ][ ][ ]
umodex[ ][ ][ ]
umodey[ ][ ][ ]
umodez[ ][ ][ ]
fEx[ ][ ][ ]
fEy[ ][ ][ ]
fEz[ ][ ][ ]
Functions to read values stored
in umode and uparam
Functions to change values
stored in umode and uparam.
Function to initialize all
variables.
Object tHfield
uparamhx[ ][ ][ ]
uparamhy[ ][ ][ ]
uparamhz[ ][ ][ ]
umodhx[ ][ ][ ]
umodhy[ ][ ][ ]
umodhz[ ][ ][ ]
fHx[ ][ ][ ]
fHy[ ][ ][ ]
fHz[ ][ ][ ]
Functions to read values stored
in umode and uparam
Functions to change values
stored in umode and uparam.
Function to initialize all
variables.
Functions to update E field components
Functions to update H field components
Object tEHfdtd
88
Figure 5.12 Update E field component sequence, as seen for E
x
component.
Access
coefficients based
on uparamex
Check umodex
Update E
x
n+1
using Equation
(1)
Update E
x
n+1
using Equation
(2)
Update E
x
n+1
using Equation
(3)
Sample E field update functions
Update H field components
in field object
Update E field components
in field object
Update Boundary E fields
( )
( )
( )
( )
:
:
: (3) Equation
0
: (2) Equation
: (1) Equation
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
) 1 , , ( ) , , (
1
) , 1 , ( ) , , (
1
) , , (
1
) , , (
1
) , , (
) 1 , , ( ) , , (
) , 1 , ( ) , , ( ) , , (
1
) , , (
+ =
=
+ =
+
+
+
+
+
+
+
+
n
k j i y
n
k j i y
z
t
n
k j i z
n
k j i z
y
t n
k j i x
n
k j i x
n
k j i x
n
k j i y
n
k j i y z
t
n
k j i z
n
k j i z y
t n
k j i x
n
k j i x
H H
H H E E
E
H H
H H E E
z y
z C
z y
z C
pList
stCCEx[0]
Computation Coefficient Look-up Table for E
x
fC0 fC1 fC2 umode
pList
stCCEx[1]
fC0 fC1 fC2 umode
pList
stCCEx[2]
fC0 fC1 fC2 umode
pList
stCCEx[m]
From
Figure 5.7
89
Figure 5.13 State diagram for creating computational coefficient look-up table for E
x
field components.
Start
Assign
r
and for
) 1 , 1 , 1 ( x
E ,
AssignEpsilonSigma( ) is called.
Create entry in stCCEx[ ] based on update mode
for
) 1 , 1 , 1 ( x
E , CreateExConstEntry( ) is called.
Update auxiliary look-up table stCEAx[ ].
Create entry for E
x
component which coincide
with perfect electric conductor (PEC).
Update auxiliary look-up table stCEAx[ ].
Assign
r
and for next E
x
component
Compare
r
, and
umode of
) , , ( k j i x
E with
entry in stCEAx[ ]
Set uparamx of
) , , ( k j i x
E to
current index
Next entry in stCEAx[ ]
End of E
x
field
components ?
Create new entry in stCCEx[ ] ,
(call CreateExConstEntry( ) )
Update stCEAx[ ]
End
Yes
Set uparamx of
) , , ( k j i x
E to 1
No
Not equal
Equal
End of entry
in stCEAx[ ]
umode = 1
Note:
stCEAx is needed because values of
r
and
are embedded in the computation
coefficients. It is difficult to extract these
values from the coefficients.
stCEAx[ ]
stCCEx[ ]
stCCEx[ ] is the computation coefficient look-up table for E
x
field components.
stCEAx[ ] is a local auxialiary table, it is used to store the all the different sets
of
r
, and umode for comparison. stCCEx[ ] and stCEAx[ ] share similar row
index.
90
5.4 The Complete Package
The complete FDTD simulation package developed for this thesis consists of three
separate programs.
1. The FDTD simulation engine called winFDTD which is described in details in
Section 5.3.
2. A utility called winFDTD_draw which is a program for the user to draw the three-
dimensional model layer-by-layer. The program then generates the model definition
file (MDF) automatically. Thus the user has the option of defining the model by
creating the model definition file using a text editor, or through the
winFDTD_draw utility.
3. A simple utility called Plot, to plot either the field components, or the equivalent
voltages and currents. This program is embedded with the interface of the FDTD
simulation engine.
Both winFDTD_draw and Plot are also Windows based programs that are created
using the programming language Visual Basic 6.0 by Microsoft Corp. The details will
not be described, as these are merely helper programs. The source codes for
winFDTD_draw and Plot are also included in the CD-ROM attached to this thesis.
A tutorial for using winFDTD, winFDTD_draw and Plot is included in Appendix
8. Figure 5.14 shows the screen shots of the three programs.
91
Figure 5.14 Screen shots of winFDTD, winFDTD_draw and Plot.
FDTD simulation engine
winFDTD_draw
Plot
92
5.5 Sample Simulation Examples
Transmission Line Loaded with Series RL Impedance
The first simulation example shows a resistive voltage source driving a short length of
transmission line with a series RL load. The schematic and top view of the model are
shown in Figure 5.15a while Figure 5.15b shows the side view of the model. V
s
is a
trapezoidal pulse source, with rise/fall time of 200ps, amplitude of 3.3V, high period of
600ps and low period of 1000ps. Transmission line T
1
is a lossles microstrip line, it is
designed to have a characteristic impedance of 50, and propagation delay of 150ps.
The printed circuit board (PCB) is assumed to be linear, lossless with 2 . 4 =
r
.
Thickness of the PCB is three cells along the z-axis. A PEC conducting plane covers
the bottom of the PCB. At the top and four sides of the model, Murs first order
absorbing boundary condition is employed.
Figure 5.15a Schematic and the view of the model at k = 4 ( z z = 4 ).
Z
c
= 50
T
d
= 150ps
V
in
V
L
x = 0.7mm
y = 0.8mm
z = 0.52mm
t = 1ps
16 cells along x-axis
45 cells along y-axis
13 cells along z-axis
y
x
Lumped
inductor
Lumped
resistor
Resistive voltage
source along z-axis
Murs
first
order
ABCs
PEC Conductor
Microstrip line
93
Figure 5.15b Side view of the model.
The simulation results are shown in Figure 5.16a and Figure 5.16b respectively.
The effective voltages are obtained by performing a numerical line integration of the
corresponding E field components. For instance the lumped resistor R
L
coincides with
) 5 , 37 , 9 ( y
E and the lumped inductor L
L
conincides with
) 5 , 34 , 9 ( y
E . Thus the effective
voltage across the series RL load can be computed as:
( )
n
y
n
y
n
L
E E y N V
) 5 , 34 , 9 ( ) 5 , 37 , 9 (
+ = (5.5.1)
where N = -1 because positive current flows in positive y direction. Similarly the
voltage across the resistive voltage source can be computed as:
n
z
n
in
zE N V
) 4 , 7 , 9 (
= (5.5.2)
where N = 1 because positive current flows in negative z direction. For the sake of
comparison, the schematic of Figure 5.15a is also implemented in PSPICE circuit
simulator and the results are superimposed on the FDTD results in Figure 5.16a and
Figure 5.16b.
y
z
Resistive
voltage
source
PEC wires
to model
vias
Lumped
inductor
Lumped
resistor
PCB
Microstrip line
94
0 1000 2000 3000 4000 5000 6000
1
0
1
2
3
V2
n
V3
n
n Int
Figure 5.16a The effective voltage across the resistive voltage source.
0 1000 2000 3000 4000 5000 6000
1
0
1
2
3
V1
n
V4
n
n Int
Figure 5.16b The effective voltage across the series RL load.
V
in
FDTD
PSPICE
ps
V
L
FDTD
PSPICE
ps
95
Crosstalk Simulation
The second example is a simulation of electromagnetic coupling between two adjacent
microstrip lines. This is the classical crosstalk simulation. The schematic and top view
of the model are shown in Figure 5.17a. The discretization of the model domain and the
printed circuit board characteristics are similar to the first example. In the schematic,
both the active and passive transmission lines are terminated with its own characteristic
impedance of 50.
Figure 5.17a Top view of the model at k = 4 ( z z = 4 ).
V
s
is a trapezoidal pulse source, with rise/fall time of 200ps, amplitude of 3.3V,
high period of 600ps and low period of 1000ps. As the electromagnetic energy from V
s
travels along the active transmission line, energy is also coupled to the passive
transmission line via electric and magnetic field coupling. The coupled electromagnetic
energy appears as voltages across the source and load end of the passive transmission
line. These voltages are known as Near-End Crosstalk (NEXT) and Far-End Crosstalk
x = 0.7mm
y = 0.8mm
z = 0.52mm
t = 1ps
21 cells along x-axis
51 cells along y-axis
13 cells along z-axis
V
1 V
2
V
3
V
4
50
50
50
50
Active microstrip line
Passive microstrip line
V
s
Active line
Passive line
x
y
Source
end
Load
end
96
(FEXT) respectively in the literature (Blood 1980, Johnson and Graham, 1993). The
result of the simulation is shown in Figure 5.17b.
0 1000 2000 3000 4000 5000 6000
0.5
0
0.5
1
1.5
2
V1
n
V2
n
V3
n
V4
n
n Int
Figure 5.17b Voltages on the source and load ends of the active and passive
transmission lines.
As observed in Figure 5.17b, crosstalk only occurs when there is a transition of
the electrical signal on the active transmission line. The effect of crosstalk can be
modeled by assuming the existence distributed mutual inductance and capacitance
between the two transmission lines under quasi-static approximation. As the changing
electrical pulse travels along the active transmission line, energy is coupled into the
passive line via the distributed mutual inductance and capacitance. The coupled energy
propagates in both directions on the passive transmission line, resulting in near-end and
far-end crosstalk voltages (Blood 1980).
ps
V
1
V
2
V
3
V
4
Near-End Crosstalk (V
3
)
Far-End Crosstalk (V
4
)
Source pulse (V
1
)
Delay of tranmission line
V
2