3D Simulation
3D Simulation
3D Simulation
Contents
Page
1
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
1. Yee grid
2. Maxwell’s equations in three dimensions
3. Maxwell’s equations on Yee grid
4. Exponential time-stepping
5. MATLAB implementation of the Yee method
6. References
1. Yee grid
A cubic Yee unit cell (uniform cell size in all directions) is shown in Fig. 1. It has the
following features [1]:
Therefore, four interleaving indexing systems (i,j,k) in space may be introduced and used
simultaneously:
i. the system based on cube edge centers (for the electric field);
ii. the system based on cube face centers (for the magnetic field);
iii. the system based on cube centers (for electric permittivity/conductivity
values);
2
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
iv.
the system based on cube nodes (for magnetic permeability/magnetic loss
values);
The interleaving feature of those systems is mathematically described by half-integer
indexes. For example, when the indexing system for the magnetic field is used, the nodal
magnetic field H y i , j ,k is located exactly halfway between electric field nodes E z i 1 / 2, j ,k
and E z i 1 / 2, j , k
in Fig. 1. Similarly, when the indexing system for the electric field is used,
the nodal electric field E z i , j ,k
is located exactly halfway between magnetic field nodes
Hy and H y in Fig. 1, except for the boundary nodes.
i 1 / 2 , j , k i 1 / 2 , j , k
The electric conduction current is always present in a lossy medium in the form J E
where is the electric conductivity with the units of S/m. So does an equivalent
magnetic conduction current describing the magnetic loss mechanism, J m H where
is the equivalent magnetic resistivity with the units of /m.
In a lossy space with driving sources, Maxwell’s equations for the electric field (or the
electric field intensity) E [V/m] and for the magnetic field (or the magnetic field
intensity) H [A/m] in time domain have the form
E
Ampere’s law modified by displacement currents H J JS (2a)
t
H
Faraday’s law E J m J ms (2b)
t
Gauss’ law for electric field E s (2c)
Gauss’ law for magnetic field (no magnetic charges) H ms (2d)
s
Continuity equation for the impressed electric current Js 0 (2e)
t
ms
Continuity equation for the impressed magnetic current J ms 0 (2e)
t
(i) the closed loop of electric current to model the magnetic dipole (a small coil or
loop antenna) and;
(ii) the closed loop of magnetic current to model the electric dipole (a small current
element). The loops of current (electric or magnetic) do not possess the (net)
charge. Other methods include dumping charges into lumped resistors, etc.
4
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
Determine magnetic field at half temporal grid using the past values of the magnetic and
electric fields:
Hx
n 1 / 2
i , j ,k
H x1 i , j ,k H x
n 1 / 2
i , j ,k
H x2 i , j ,k
E n
y i , j , k 1 / 2 Ey
n
i , j , k 1 / 2
Ez
n
i , j 1 / 2, k
Ez
n
i , j 1 / 2, k
(3a)
Hy
n 1 / 2
i , j ,k
H y1
i , j ,k
Hy
n 1 / 2
i , j ,k
H y2
i , j ,k
E n
z i 1 / 2, j , k Ez
n
i 1 / 2, j , k
Ex
n
i , j , k 1 / 2
Ex
n
i , j , k 1 / 2
(3b)
n 1/ 2 n 1/ 2
n
H z i , j ,k H z1 i , j ,k H z i , j ,k H z 2 i , j ,k Ex i , j 1/ 2,k Ex i , j 1/ 2,k E y
n n
i 1/ 2, j , k
Ey
n
i 1/ 2, j , k
(3c)
Determine electric field at integer temporal grid using the past values of the magnetic and
electric fields:
Ex
n 1
i , j ,k
E x1 i , j ,k E x
n
i , j ,k
Ex2 i , j ,k
H n 1 / 2
z i , j 1 / 2, k Hz
n 1 / 2
i , j 1 / 2, k
Hy
n 1 / 2
i , j , k 1 / 2
Hy
n 1 / 2
i , j , k 1 / 2
(3d)
Ey
n 1
i , j ,k
E y1
i , j ,k
Ey
n
i , j ,k
Ey2
i , j ,k
H n 1 / 2
x i , j , k 1 / 2 Hx
n 1 / 2
i , j , k 1 / 2
Hz
n 1 / 2
i 1 / 2, j , k
Hz
n 1 / 2
i 1 / 2, j , k
(3e)
Ez
n 1
i , j ,k
E z1 i , j ,k E z
n
i , j ,k
Ez2 i , j ,k
H n 1 / 2
y i 1 / 2, j , k Hy
n 1 / 2
i 1 / 2, j , k
Hx
n 1 / 2
i , j 1 / 2, k
Hx
n 1 / 2
i , j 1 / 2, k
(3f)
The sources may then be added as described by Eqs. (2). The electric-field updating
coefficients are defined by material properties in the form
1 i , j ,k t /( 2 i , j ,k ) t /( i , j ,k )
E x1 i , j ,k , Ex2 (3g)
1 i , j ,k t /( 2 i , j ,k ) i , j ,k
1 i , j ,k t /( 2 i , j ,k )
The same equation applies to E y1 , E y 2 and to Ez1, Ez 2 , respectively, but the material
properties at the observation node i,j,k may be different.
The magnetic-field updating coefficients are defined by material properties in the similar
form
1 i , j ,k t /( 2 i , j ,k ) t /( i , j ,k )
H x1 i , j ,k , H x 2 i , j ,k (3h)
1 i , j ,k t /( 2 i , j ,k ) 1 i , j ,k t /( 2 i , j ,k )
The same equation applies to H y1 , H y 2 and to H z1 , H z 2 , but the material properties at the
observation node i,j,k may be different.
5
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
Hx
n 1 / 2
i , j ,k
H x1 i , j ,k H x
n 1 / 2
i , j ,k
H x2 i , j ,k
E n
y i , j , k 1 Ey
n
i , j ,k
Ez
n
i , j ,k
Ez
n
i , j 1, k
(4a)
Hy
n 1 / 2
i , j ,k
H y1
i , j ,k
Hy
n 1 / 2
i , j ,k
H y2
i , j ,k
E n
z i 1, j , k Ez
n
i , j ,k
Ex
n
i , j ,k
Ex
n
i , j , k 1
(4b)
Hz
n 1 / 2
i , j ,k
H z1 i , j ,k H z
n 1 / 2
i , j ,k
H z2 i , j ,k
E n
x i , j 1, k Ex
n
i , j ,k
Ey
n
i , j ,k
Ey
n
i 1, j , k
(4c)
Determine electric field at integer temporal grid using the past values of the magnetic and
electric fields:
Ex
n 1
i , j ,k
E x1 i , j ,k E x
n
i , j ,k
Ex2 i , j ,k
H n 1 / 2
z i , j ,k Hz
n 1 / 2
i , j 1, k
Hy
n 1 / 2
i , j , k 1
Hy
n 1 / 2
i , j ,k
(4d)
Ey
n 1
i , j ,k
E y1
i , j ,k
Ey
n
i , j ,k
Ey2
i , j ,k
H n 1 / 2
x i , j ,k Hx
n 1 / 2
i , j , k 1
Hz
n 1 / 2
i 1, j , k
Hz
n 1 / 2
i , j ,k
(4e)
6
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
Ez
n 1
i , j ,k
E z1 i , j , k E z
n
i , j ,k
Ez2 i , j ,k
H n 1 / 2
y i , j ,k Hy
n 1 / 2
i 1, j , k
Hx
n 1 / 2
i , j 1, k
Hx
n 1 / 2
i , j ,k
(4f)
The electric-field updating coefficients are defined by material properties in the same
form as before
1 i , j ,k t /( 2 i , j ,k ) t /( i , j ,k )
E x1 i , j ,k , Ex2 (4g)
1 i , j ,k t /( 2 i , j ,k ) i , j ,k
1 i , j ,k t /( 2 i , j ,k )
The same equation applies to E y1 , E y 2 and to Ez1, Ez 2 , respectively, but the material
properties at the observation node i,j,k may be different.
The magnetic-field updating coefficients are defined by material properties in the same
form as before
1 i , j ,k t /( 2 i , j ,k ) t /( i , j ,k )
H x1 i , j ,k , H x2 (4h)
1 i , j ,k t /( 2 i , j ,k ) i , j ,k
1 i , j ,k t /( 2 i , j ,k )
The same equation applies to H y1 , H y 2 and to H z1 , H z 2 , but the material properties at the
observation node i,j,k may be different.
and then obtain the solution of the full equations in the form of a convolution integral.
This results in the following formulas for the update coefficients, valid for both
homogeneous and inhomogeneous materials [6]
1 i , j ,k t /( 2 i , j ,k )
E x1 i , j ,k exp i , j ,k t / i , j ,k
1 i , j ,k t /( 2 i , j ,k )
(5b)
t /( i , j ,k )
Ex2
1
1 exp i, j ,k t / i, j ,k
i , j ,k
1 i , j ,k t /( 2 i , j ,k )
The same equation applies to E y1 , E y 2 and to Ez1, Ez 2 , respectively, but the material
properties at the observation node i,j,k may be different. Eqs. (5b) are equivalent to
Taylor series to the first or second order of accuracy.
7
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
1 i , j ,k t /( 2 i , j ,k )
H x1 i , j ,k exp i , j ,k t / i , j ,k
1 i , j ,k t /( 2 i , j ,k )
(5c)
t /( i , j ,k )
H x2
1
1 exp i, j ,k t / i, j ,k
i , j ,k
1 i , j ,k t /( 2 i , j ,k )
The same equation applies to H y1 , H y 2 and to H z1 , H z 2 , but the material properties at the
observation node i,j,k may be different. Eqs. (5b) are again equivalent to Taylor series to
the first or second order of accuracy.
The implementation of the exponential time stepping requires care, due to the singularity
of the second Eq. (5b) when 0 . A vanishingly small conductivity value for air, that
is 10 6 S/m , was assumed to make second Eq. (5b) uniformly valid.
For the electric field, the update equations have the form
%% E-field update (everywhere except on the boundary
ExN(:,2:Ny,2:Nz) = Ex1.*ExP(:,2:Ny,2:Nz)+Ex2.*(diff(HzP(:,:,2:Nz),1,2)-diff(HyP(:,2:Ny,:),1,3));
EyN(2:Nx,:,2:Nz) = Ey1.*EyP(2:Nx,:,2:Nz)+Ey2.*(diff(HxP(2:Nx,:,:),1,3)-diff(HzP(:,:,2:Nz),1,1));
EzN(2:Nx,2:Ny,:) = Ez1.*EzP(2:Nx,2:Ny,:)+Ez2.*(diff(HyP(:,2:Ny,:),1,1)-diff(HxP(2:Nx,:,:),1,2));
6. References
9
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
1. Material properties
2. MATLAB implementation
3. References
1. Material properties
In the standard FDTD formulation, every elementary Yee cell (electric-field components
along a cube edges) is filled by a homogeneous medium. Dielectric boundaries can be
only located between adjacent cells, therefore, they are tangential to the electric field
components – see Fig. 3. Simultaneously, magnetic boundaries can be only located
halfway between adjacent cells, therefore they are also tangential to the magnetic field
components. Fig. 3 shows the corresponding concept.
Fig. 3. Standard field nodes and material parameter nodes. The permittivity/conductivity is
defined at cell centers. The permeability/magnetic loss is defined at cell corners.
Effective constitutive parameters are derived by enforcing the continuity of the tangential
electric- and magnetic field components in the integral formulation of the Ampere’s law
and Faraday’s law [1]. These parameters are obtained by averaging the parameters of the
neighboring cells with respect to the discontinuity. Such formulation is first-order
accurate in cell size and leads to the definition of an effective permittivity and
permeability. The result has the form[1],[2]:
10
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
2. MATLAB implementation
We assume again that the FDTD cubic grid has N x N y N z cube cells and
( N x 1) ( N y 1) ( N z 1) corner nodes. Then, the dielectric properties are described
by 3D permittivity and conductivity arrays initialized in the form
DIELC = ones(Nx, Ny, Nz); %3D Permittivity array on half grid (cube centers)
SIGEC = zeros(Nx, Ny, Nz); %3D Electric conductivity array on half grid (cube centers)
Once those arrays have been filled, the electric-field updating coefficients from Eq. (4a)
are defined by material properties in the form (the result is only given for Ez1, Ez 2 , other
coefficient are obtained by permutation)
% Arrays for Ez
nx = 2:Nx; ny = 2:Ny; nz =2:Nz;
Dtemp = (DIELC(nx,ny,:)+DIELC(nx-1,ny,:)+DIELC(nx,ny-1,:)+DIELC(nx-1,ny-1,:))/4;
Stemp = (SIGEC(nx,ny,:)+SIGEC(nx-1,ny,:)+SIGEC(nx,ny-1,:)+SIGEC(nx-1,ny-1,:))/4;
The exponential time-stepping considered in the previous section requires the somewhat
different update:
Similarly, for the magnetic field one initializes 3D permeability and resistivity arrays
with the dimensions given by
MAGNC = ones(Nx+1, Ny+1, Nz+1); %3D Permeability array on integer grid (cube nodes)
RHOMC = zeros(Nx+1,Ny+1, Nz+1); %3D Magnetic res. array on integer grid (cube nodes)
The magnetic-field updating coefficients from Eq. (4b) have the form (the result is only
given for H x1 , H x 2 , other coefficient are obtained by permutation)
ny = 1:Ny; nz = 1:Nz;
Mtemp = (MAGNC(:,ny,nz)+MAGNC(:,ny+1,nz)+MAGNC(:,ny,nz+1)+MAGNC(:,ny+1,nz+1))/4;
Rtemp = (RHOMC(:,ny,nz)+RHOMC(:,ny+1,nz)+RHOMC(:,ny,nz+1)+RHOMC(:,ny+1,nz+1))/4;
The exponential time-stepping considered in the previous section requires the somewhat
different update:
More accurate (subcell) models of fine dielectric and magnetic boundaries crossing the
unit cells are possible at the expense of increased complexity [3].
3. References
[2]. K. S. Kunz and R. Luebbers, The Finite Difference Time Domain Method, Boca
Raton, FL: CRC Press, 1993.
12
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
The line current is transformed to an equivalent volumetric current density averaged over
one unit cell:
l
J s (t ) i s (t ) (1)
3
which produces the same electric dipole moment. This current density is substituted in one
of the FDTD update equations for the electric field (Eqs. (4d) to (4f)). For the dipole shown
in Fig. 5, the result has the form
13
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
Fig. 6. Dipole antenna model with the dipole placed at the center node of the Yee cell.
The dipole of arbitrary orientation with the unit direction vector n is then considered as
a superposition of three dipoles directed along the x-, y-, and z-axes. All those dipoles
have the same (phase) center. The corresponding current densities are given by
1 1 1
J sX (t ) n X i s (t ), J sY (t ) nY i s (t ), J sZ (t ) n Z i s (t ) (4)
2 2 2
14
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
The port update given Eq. (2) is straightforwardly modified to the present case: it remains
the same for the node i, j , k (except that the current is divided by two), and uses index
substitution j j 1 for the second node in Fig. 6.
Complete update equations for a dipole of arbitrary orientation have the form
Here, only current excitation terms have to be added after the standard update equations
for the electric field.
The model described above was implemented in the code. It is advantage is the ability to
describe the coil of arbitrary orientation, whilst keeping the same phase center. Its
disadvantage is a “large” volume occupied by the coil model that extends to two unit
cells in every direction.
(t 0 t ) (t t 0 ) 2
i s (t ) I 0 exp , t 0 5 (6)
(2 )
2
0.16
fc , BW 1.15 f c (7)
For example,
4. MATLAB implementation
The MATLAB implementation of the symmetric dipole model (and of the related field
probe) is given by the code that follows
15
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
% setting up parameters
Js = PortM(m)/d^3*(IG(m, kt)+IG(m, kt+1))/2;% volum. current density at n+1/2
i_e = PortIndX(m); % port location grid nodes
j_e = PortIndY(m); % port location grid nodes
k_e = PortIndZ(m); % port location grid nodes
Jx = d*Js/2*PortNX(m);
Jy = d*Js/2*PortNY(m);
Jz = d*Js/2*PortNZ(m);
The accuracy and limitations of the small symmetric-dipole model have been quantified
by many examples using the comparison with analytical solutions for point sources [2]
reformulated in time domain.
References
[2]. C. A. Balanis, Antenna Theory. Analysis and Design, Third Ed., Wiley, New
York, 2005, Chapter 5.
16
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
The antenna is excited by a current pulse i(t ) . If necessary, the voltage across the coil
antenna may be calculated by [1]
di
L (t ) L Ri , L Lstatic, R Rstatic Rrad (1)
dt
where two indexes relate to static values and their radiation corrections, respectively. One
has for the static inductance of an air-core solenoid with radius r , cross-section area A,
and length l,
0 AN 2 8w w 2 w 4 r
Lstatic 1 , w 1 (2)
l 3 2 4 l
17
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
4
Rrad 0 ( AN ) 2 (3)
6 c0
The calculation of inductance for the coil with a straight magnetic core becomes a
nontrivial theoretical exercise. The graphical data is given in [1]. We also present here a
useful theoretical result. It is only valid for a high-permeability magnetic core, with
approximately 100 0 . The resulting inductance for the inductor in Fig. 7 has the
form [2]
0.50 l * N 2 l
L 1 * [H] (4)
l *
2l
ln 1
r
where l * is the core length and r is the coil radius. Interestingly, the resulting inductance
does not explicitly depend on the specific value of as long as this value is sufficiently
large. More precisely, Eq. (4) holds only for situations where the core length-to-diameter
ratio is considerably smaller than the relative magnetic permeability, r / 0 . Eq. (4)
was compared with experiment and indicated about 40% accuracy in predicting the
inductance.
2. Receive coil
2.1. Coil without magnetic core
In the receiving mode, the open-circuited air-core RX coil shown in Fig. 7 generates the
induced emf voltage,
H z
Eemf (t ) 0 AN (5a)
t
where the emf polarity “+” corresponds to the dotted terminal of the coil shown in Fig. 7.
Thus, the receive coil in the open-circuit mode does not significantly disturb the incident
field and acts similar to a field probe. This concept will be implemented in the numerical
code. Therefore, the small receive coil does not need a dedicated FDTD modeling.
0 AN
n
Eemf ( H zn1 / 2 (i, j, k ) H zn1 / 2 (i, j, k )) (5b)
t
18
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
n
Eemf (t ) AN E z Eemf
n
AN E z (5c)
E
n
z
1 /( ) E xn (i, j 1, k ) E xn (i, j , k ) E yn (i, j, k ) E yn (i 1, j, k ) (5d)
0.5 0 l *l l
eff 1 * (7)
l *
2l
ln 1 r 2
r
Eq. (8) was not tested by comparison with experiment and should be used with care.
M z (t ) ANi(t ) (9)
19
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
where A is the coil cross-section, N is the number of turns, and i(t ) is the instantaneous
coil current. The meaning of the magnetic moment originates from the torque exerted on
a loop of current in an external magnetic field. On the other hand, the magnetic moment
is the only characteristic of a very small coil antenna that defines both its near- and far
field [3],[4]. Generally, the magnetic moment is a vector quantity, with the unit direction
vector n . The magnetic moment is directed along the coil axis according to the right-
hand rule for the electric current. For example, it is directed up in Fig. 7.
dM z
J ms (r , t ) 0 (r ) (11)
dt
0 dM z 0 AN di
J ms (t ) (12)
3
dt 3 dt
This method has a number of disadvantages. One of them is that the magnetic current
source given by Eqs. (12) and (13) does not work well on the boundary between vacuum
and a magnetic material. Therefore, it is not implemented in the code.
Such a location is convenient, but it does not allow us to consider an arbitrary coil
antenna orientation in general. An arbitrarily-oriented radiating coil may be considered as
a superposition of three coils oriented along the axes; however, these coils will not have
the same phase center.
20
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
Following the approach from Ref. [4], the coil in Fig. 8 is replaced by a square loop of
the grid-aligned current i s (t ) which possesses the same magnetic moment:
AN
2 i s (t ) M z (t ) i s (t ) i (t ) (14)
2
where is the cell size of the cubic grid. Further, the current i s (t ) is replaced by its
current density uniformly distributed over every involved cell’s cross-section,
is (t ) AN
J s (t ) J s (t ) 4 i(t ) (15)
2
Let’s assume the coil is located at the Hz-field node i,j,k – see Fig. 8. Maxwell’s
equations in a lossy inhomogeneous medium for four surrounding E-field nodes
E
H E zˆJ s (16)
t
21
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
E xn 1 (i, j 1, k ) E x1 E xn (i, j 1, k ) E x 2
(17b)
H n 1 / 2
z (i, j 1, k ) H zn1 / 2 (i, j, k ) H yn1 / 2 (i, j 1, k 1) H yn 1 / 2 (i, j 1, k ) J sn1 / 2
E yn1 (i, j, k ) E y1 E yn (i, j, k ) E y 2
(17c)
H n 1 / 2
x (i, j, k ) H xn1 / 2 (i, j, k 1) H zn 1 / 2 (i 1, j, k ) H zn 1 / 2 (i, j, k ) J sn 1 / 2
E yn 1 (i 1, j, k ) E y1 E yn (i 1, j, k ) E y 2
(17d)
H n 1 / 2
x (i 1, j, k ) H xn1 / 2 (i 1, j, k 1) H zn1 / 2 (i, j, k ) H zn 1 / 2 (i 1, j, k ) J sn 1 / 2
where
3.4 Magnetic dipole model with two loops of electric current and arbitrary coil
orientation
The current-loop model of Fig. 8 is straightforwardly modified for the case of arbitrary
coil orientation. The concept is shown in Fig. 9 that follows. The coil antenna is now
placed at the center of the Yee cell. The coil in Fig. 9 is replaced by two square loops of
the grid-aligned electric current, which in sum possess the same magnetic moment.
Instead of Eq. (15), the current density for each loop becomes
1 AN
J s (t ) i (t ) (19)
2 4
i.e. the half of the original current density. Update Eqs. (17) are straightforwardly
modified to the present case: they remain the same for the lower face in Fig. 9 and use
index substitution k k 1 for the upper face.
The coil of arbitrary orientation with the unit direction vector n is considered as a
superposition of three coils directed along the x-, y-, and z-axes. The corresponding
current densities are given by
22
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
Fig. 9. Coil antenna model with the coil placed at the center node of the Yee cell.
1 AN 1 AN 1 AN
J sX (t ) n X 4 i(t ), J sY (t ) nY 4 i (t ), J sZ (t ) n Z 4 i (t ) (20)
2 2 2
All the current densities should follow the right-hand rule with regard to all three
Cartesian axes as shown in Fig. 9 for the z-axis.
The model described above was implemented in the code. It is advantage is the ability to
describe the coil of arbitrary orientation, whilst keeping the same phase center. Its
disadvantage is a “large” volume occupied by the coil model that extends to two unit
cells in every direction. The above coil model may be treated as a symmetric point
source model.
m
fft( Eemf (t )) fft( H xm, y , z (t ))
Lm1 ( ) 0 AN (21)
jfft(i 1 (t )) fft(i 1 (t ))
23
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
5. MATLAB implementation
The MATLAB implementation of the symmetric coil model (and of the related field
probe) is given by the code that follows
% setting up parameters
Js = PortM(m)/d^4*(IG(m, kt)+IG(m, kt+1))/2; % volumetric current density
at n+1/2 - tested
i_e = PortIndX(m); % port location grid nodes
j_e = PortIndY(m); % port location grid nodes
k_e = PortIndZ(m); % port location grid nodes
Jx = d*Js/2*PortNX(m);
Jy = d*Js/2*PortNY(m);
Jz = d*Js/2*PortNZ(m);
24
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
% step n
AntEz = 1/4*(EzP(i_e, j_e, k_e)+...
EzP(i_e+1, j_e, k_e)+...
EzP(i_e, j_e+1, k_e)+...
EzP(i_e+1, j_e+1, k_e));
% E-fields for all ports -step n
AntHz = 0.5*(HzN(i_e, j_e, k_e)+HzN(i_e, j_e, k_e+1));
% H-fields for all ports -step n+1/2
% co-polar components
AntE(m, kt) = PortNX(m)*AntEx + PortNY(m)*AntEy + PortNZ(m)*AntEz;
% at step n - tested
TmpH(m, kt) = PortNX(m)*AntHx + PortNY(m)*AntHy + PortNZ(m)*AntHz;
% at step n+1/2 - tested
AntH(m, kt) = (TmpH(m, kt) + TmpH(m, kt-1))/2;
% at step n - tested
AntI(m, kt) = IG(m, kt);
% at step n - tested
AntV(m, kt) = -mu0*PortM(m)*(TmpH(m, kt) - TmpH(m, kt-1))/dt;
% antenna voltages for all ports at step n
The accuracy and limitations of the small symmetric-coil model have been quantified by
many examples using the comparison with analytical solutions for point magnetic sources
[3] reformulated in time domain.
6. References
[3]. C. A. Balanis, Antenna Theory. Analysis and Design, Third Ed., Wiley, New
York, 2005.
25
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
(t )
E in (t ) (1)
l
is uniform between the plates, which is true for small separation distances. Also assume
that the electric field is zero otherwise (medium 2). The boundary condition for the
electric field on the side boundary of the cylinder states that
M m ( E 2 Ein (t )) (2)
where M is the resulting surface magnetic current density (V/m) on the side boundary,
m is the outer normal. With reference to Fig. 1, M has only an angular component, i.e.
26
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
(t )
M E in (t ) (3a)
l
Thus, the impressed electric field source (or the voltage source) is equivalent to the loop
of a surface magnetic current. The total magnetic current in the loop is lM , the loop
area is A. Therefore, the product AlM A (t ) has the sense of a loop moment where A
is the moment per one volt.
H xn 1 / 2 (i, j , k ) H x1 H xn 1 / 2 (i, j , k ) H x 2
(4a)
E y
n (i, j , k 1) E ny (i, j , k ) E nz (i, j , k ) E nz (i, j 1, k ) J ms
n
27
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
H xn 1 / 2 (i, j , k 1) H x1 H xn 1 / 2 (i, j , k 1) H x 2
(4b)
E y
n (i, j , k ) E ny (i, j , k 1) E nz (i, j , k 1) E nz (i, j 1, k 1) J ms
n
H zn1 / 2 (i, j, k ) H z1 H zn 1 / 2 (i, j, k ) H z 2
(4c)
E n
x (i, j 1, k ) E xn (i, j, k ) E yn (i, j, k ) E yn (i 1, j, k ) J ms
n
H zn 1 / 2 (i 1, j, k ) H z1 H zn 1 / 2 (i 1, j, k ) H z 2
(4d)
E n
x (i 1, j 1, k ) E xn (i 1, j, k ) E yn (i 1, j, k ) E yn (i, j, k ) J ms
n
An important observation is that it is very straightforward to implement Eqs. (4) in
practice. Namely, only current excitation terms have to be added after the standard update
equations for the magnetic field.
Update Eqs. (4) are straightforwardly modified to the present case: they remain the same
for the upper face in Fig. 11 and employ the index substitution j j 1 for the lower
face.
The source of arbitrary orientation with the unit direction vector n is considered as a
superposition of three elementary sources directed along the x-, y-, and z-axes. The
corresponding current densities are given by
1 1 1
J msX (t ) n X ims (t ), J msY (t ) nY ims (t ), J msZ (t ) n Z ims (t ) (5)
2 2 2
All the magnetic current densities should follow the right-hand rule with regard to all
three Cartesian axes as shown in Fig. 11 for the y-axis.
The model described above was implemented in the code. It is advantage is the ability to
describe the source of arbitrary orientation, whilst keeping the same phase center. Its
disadvantage is a “large” volume occupied by the dipole model that extends to two unit
cells in every direction.
28
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
Fig. 11. Impressed source model with the dipole placed at the corner node of the Yee cell.
4. Relation between the magnetic current loop source and the electric dipole source
The displacement current (current in the capacitor) in Fig. 10a is directed down.
Therefore, the counterpart of the magnetic current loop in Fig. 10a, with the magnetic
current running following the right-hand rule with regard to the positive z-direction,
should be an infinitesimally small electric dipole oriented toward the negative z-direction.
If this dipole has a length l and a uniform line current is (t ) I 0 s cos t , its radiation in
the far field is described by ([1], Ch. 4, p. 159):
kI0 s l
E j sin exp( jkr)
4 r
(6)
kI l
H j 0 s sin exp( jkr)
4 r
On the other hand, the small magnetic current loop, whose right-hand rule axis is the z-
axis, and which has a uniform magnetic current ims (t ) I 0ms cos t and an area S,
radiates in the far field in the following way:
29
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
k 2 I 0 ms S
E sin exp( jkr)
4 r
(7)
k 2 I 0 ms S
H sin exp( jkr)
4 r
Eq. (8) can be transformed to the time-domain solution for an arbitrary pulse by operator
substitution jk c01 t . This gives
S ims (t )
t
l
S 0
i s (t ) ims (t ) i s (t )dt (9)
l t
Further, the magnetic current ims (t ) is replaced by its current density uniformly
distributed over every involved cell’s cross-section:
t
ims (t ) l
2 S 0
J ms (t ) i s (t )dt (10)
2
Finally, since the loop area is the cell face, one has
t
l
0
J ms (t ) 4
i s (t )dt (11)
The above expression has the units of V/m2, indeed. The last step is to substitute into Eq.
(11) the expression for J ms (t ) that follows from Eq. (3b), that is
A (t )
J ms (t ) (12)
4
The result becomes
d A
is (t ) C , C (13)
dt l
which is the familiar capacitor model introduced yet in the first figure to this section.
5. MATLAB implementation
The MATLAB implementation of the symmetric voltage source model is given by the
code that follows
30
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
% setting up parameters
Jms = PortM(m)/d^4*VG(m, kt+1);
% magnetic current/voltage at step n+1
% Port parameters
AntV(m, kt) = VG(m, kt);
The accuracy and limitations of the small symmetric voltage-source model have been
quantified by many examples using the comparison with the analytical solutions for point
sources [1].
6. References
[1]. C. A. Balanis, Antenna Theory. Analysis and Design, Third Ed., Wiley, New
York, 2005.
31
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
A simple yet reasonably accurate combination is that of the first-order Mur’s ABCs and
superabsorption. This combination does not need a special treatment for edges and
corners. It is trivially extended to the case of an inhomogeneous medium and still has a
sufficient numerical accuracy (second-order) as confirmed by a number of computational
examples.
2. Mur’s ABCs
Let's take a look at Fig. 12 that follows. First, if a source of excitation is located
approximately in the center of the FDTD domain, and the size of this domain is large
enough, the signal that hits the boundary is a combination of plane propagating waves.
Fig. 12. An "almost" plane wave that is coming toward the boundaries needs to be absorbed.
32
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
2W 2 W 2W 2W
2
c0 0 (1)
t2 x
2
y2 z2
One can obtain another form of this equation, to underscore the dominant propagation
along the x-axis
2W 2W
c0 c0 W c02 0 , (2)
t x t x y z2
2
either in the positive or in the negative direction. We are interested in the boundary at
x=0, i.e. in the negative direction of propagation. When the direction of propagation is
exactly the negative x-axis and the wave is exactly plane, from Eq. (2) one obtains
c0 W 0 (3)
t x
While this observation is only approximately true, we could still replace one spatial
derivative in the first term on the right-hand side of Eq. (2) by
c0 c0 2 (4)
t x t x t
This yields
2W 2W
c0 2 W c02 0 (5)
t x t y 2
z2
2W 2 W c02 2W 2W
c 0 0 (6)
t2 t x 2 y
2
z2
Eq. (6) is the well-known parabolic approximation to the wave equation. It says that the
electromagnetic signal propagates predominantly along the negative x-axis; it is also a
subject to diffraction in the transversal plane (in the yz-plane). The parabolic equation is
easier to solve than the wave equation itself, and it is straightforward to formulate the
boundary conditions in terms of it. The first-order Mur’s ABCs utilize Eq. (3); the
second-order Mur’s ABCs utilize Eq. (6).
33
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
First-order Mur's ABCs are given by Eq. (3) applied at all boundaries. In particular,
Ez Ez
c0 0 (7a)
t x
Ez Ez
c0 0 (7b)
t x
for the left and right boundary in Fig. 12, respectively. The results for the lower and
upper boundaries are obtained by permutation (xy) . Despite this very simple nature,
even those equations will do a decent job when implemented correctly.
Note: The first-order Mur's ABCs are given for the E-field only. The H-field is not
involved. The reason becomes clear if we examine the field array:
The component Hy, which might be a subject to the boundary conditions on the left/right
boundary in Fig. 12 is simply not defined on those boundaries.
Ez Ez
c0 0
t x
1 E z 1, j ,k E z 1, j ,k E z 2, j ,k E z 2, j ,k 1 E z 2, j ,k E z 1, j ,k E z 2, j ,k E z 1, j ,k
n 1 n n 1 n n 1 n 1 n n
c 0 (8a)
2 t t 0 2
n 1 n
E z 1, j ,k E z 2, j ,k 0
c t
c0 t
n 1 n
E z 2, j ,k E z 1, j ,k , j 1 : N y 1, k 1 : N z
for the left boundary. Eq. (8a) is valid for any node on the boundary, including the edges
and the corners. When the inhomogeneous material properties are involved, the local
speed of light c 1 / is assumed to be constant close to the boundary in the direction
perpendicular to the boundary, on both its sides. The tangential changes are allowed at
34
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
any node of the boundary; they are included into consideration exactly as in the main
FDTD grid. For the right boundary in Fig. 12, one similarly has
Ez Ez
c0 0
t x
c 0
2 t t 0 2
n 1 n c t
E z N x 1, j ,k E z N x , j ,k 0
c0 t
n 1 n
E z N x , j ,k E z N x 1, j ,k , j 1 : N y 1, k 1 : N z
(8b)
The extensions to the lower and upper boundaries and to the 3D case are straightforward.
Namely, the calculation of the 2-D TM (TE) magnetic (electric) components, from their
respective boundary ABC-derived electric (magnetic) ones, yields reflection errors which
are strongly related to the errors in magnetic (electric) field components directly
computed from the ABC. The opposite sign that these errors have in both of the above
separate calculations is a point of crucial importance in the superabsorption procedure.
Taking this fact into consideration and by properly combining the two different
computations of the magnetic (electric) fields near the boundary, it is possible to cancel
the reflection errors mutually while maintaining the correct values of the fields on the
boundary [5].
Fig. 13 illustrates schematically the implementation of the method for the right boundary
( x L ) of the computational domain in Fig. 12. For this boundary, we apply the first-
order Mur’s ABC given by Eq. (8b) not only to the Ez-field but also to the Hy-field in the
vicinity to that boundary, i.e.
HyN
n 1 / 2 ( 2 )
x, j ,k
n 1 / 2
HyN
x, j ,k
c0 t
c0 t
n 1 / 2 n 1 / 2
H y N 1, j H y N , j ,k
x x
(9a)
n 1 / 2 (1)
HyN (9b)
x, j ,k
35
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
After that, we form a weighted average of those two values and obtain the final updated
magnetic field value a the last point by
n 1 / 2 (1) n 1 / 2 ( 2 )
n 1 / 2
HyN H y N
x , j ,k x, j ,k
HyN (9c)
x , j ,k
1
Here,
c0 t
(10)
It can be shown that this procedure significantly decreases the error of a local ABC, in
particular, the first-order Mur’s ABC. It is also very simply implemented and does not
require any extra variables. When the inhomogeneous material properties are involved,
the same scheme is followed as for the first-order Mur’s ABCs.
5. MATLAB implementation in 3D
The MATLAB implementation of the ABCs is given by the code that follows (for a
homogeneous medium)
36
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
% Right
EyN(Nx+1, :,:)= EyP(Nx,:,:) + m1*(EyN(Nx, :,:) - EyP(Nx+1,:,:)); % right - Ey;
EzN(Nx+1, :,:)= EzP(Nx,:,:) + m1*(EzN(Nx, :,:) - EzP(Nx+1,:,:)); % right - Ez;
% Front
ExN(:, 1,:) = ExP(:,2,:) + m1*(ExN(:,2,:) - ExP(:,1,:)); % front - Ex;
EzN(:, 1,:) = EzP(:,2,:) + m1*(EzN(:,2,:) - EzP(:,1,:)); % front - Ez;
% Rear
ExN(:, Ny+1,:)= ExP(:,Ny,:) + m1*(ExN(:,Ny,:) - ExP(:,Ny+1,:)); % rear - Ex;
EzN(:, Ny+1,:)= EzP(:,Ny,:) + m1*(EzN(:,Ny,:) - EzP(:,Ny+1,:)); % rear - Ey;
% Bottom
ExN(:, :,1) = ExP(:, :,2) + m1*(ExN(:,:,2) - ExP(:,:,1)); % bottom - Ex;
EyN(:, :,1) = EyP(:, :,2) + m1*(EyN(:,:,2) - EyP(:,:,1)); % bottom - Ey;
% Top
ExN(:, :, Nz+1)= ExP(:,:,Nz) + m1*(ExN(:,:,Nz) - ExP(:,:,Nz+1)); % top - Ex;
EyN(:, :, Nz+1)= EyP(:,:,Nz) + m1*(EyN(:,:,Nz) - EyP(:,:,Nz+1)); % top - Ex;
6. References
37
MATLAB® FDTD Fields Solver v.2-0 2011 Neva EM
38