Vous êtes sur la page 1sur 85

Indian Institute of Technology Kanpur

Department of Electrical Engineering


B.Tech. Project Report (EE 492)
Finite Element Modelling of Radiation Conditions
in Electromagnetic Scattering
Vivek Saxena (Y6549)
viveks@iitk.ac.in
Advisor: Dr. Naren Naik
Department of Electrical Engineering
IIT Kanpur
Second Semester (2009-10)
Contents
Contents 2
Certicate 3
Abstract 4
Acknowledgments 5
List of Figures 6
1 Introduction 7
2 Motivation & Objectives 9
3 Literature Survey 10
4 Work Done in the Final Semester 11
5 Basic Theory 12
5.1 Scattering Boundary Value Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.1.1 Scalar Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.1.2 Vector Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.2 The Finite Element Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5.3 Meshing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.3.1 Concentric Ring Meshing for circular objects . . . . . . . . . . . . . . . . . . 15
5.3.2 DistMesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.3.3 COMSOL-based Meshing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.4 Mesh Truncation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6 Methodology Adopted 25
6.1 Statement of the Forward Problem (for Cylindrical PEC Object in Air) . . . . . . . 26
6.1.1 The Partial Dierential Equation for the Total Electric Field . . . . . . . . . 26
6.2 Statement of the Forward Problem (for Buried Mines) . . . . . . . . . . . . . . . . . 27
6.2.1 Parameter Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
1
7 Results 29
7.1 Circular PEC Object centered at the origin . . . . . . . . . . . . . . . . . . . . . . . 29
7.2 Location of 2
nd
order ABC vs. that of 1
st
order ABC . . . . . . . . . . . . . . . . . 31
7.3 Circular PEC Object placed o center . . . . . . . . . . . . . . . . . . . . . . . . . 32
7.4 Concave PEC Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
7.5 Square PEC Object placed o center . . . . . . . . . . . . . . . . . . . . . . . . . . 34
7.6 Two PEC Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
7.7 Comparison between 1
st
order ABC and PML PEC Cylinder in Air . . . . . . . . . 36
7.8 Comparison between ABC and PML for Dielectric Cylinder in Air . . . . . . . . . . 37
7.9 The Subsurface Problem (Half Space Scattering) . . . . . . . . . . . . . . . . . . . . 38
7.10 PEC Cylinder buried under Soil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
7.11 Dielectric Cylinder buried under Soil . . . . . . . . . . . . . . . . . . . . . . . . . . 39
7.12 Scattering from a PEC Cylinder in Air using the First Order ABC (Eect of varying
Discretization) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
8 Conclusions 41
References 42
Appendix A: Finite Element Method Formulation 43
Weak Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Element Matrices and Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Integration over an arbitrary triangular patch . . . . . . . . . . . . . . . . . . . . . . . . 47
Enforcement of Dirichlet Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Assembly of Matrix Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Solution of the Linear System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Appendix B: First Order Absorbing Boundary Condition 50
Appendix C: Second Order Absorbing Boundary Condition 52
Appendix D: COMSOL Results 59
Appendix E: MATLAB Codes for Meshing 2D Regions 63
8.1 Meshing Code for Cylinder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
8.2 Meshing Code for O-center Cylinder . . . . . . . . . . . . . . . . . . . . . . . . . . 65
8.3 Meshing Code for Square Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
8.4 Meshing Code for Concave Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
8.5 Meshing Code for Two Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Appendix F: MATLAB FEM Codes 69
8.6 First Order ABC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
8.7 Second Order ABC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
2
Certicate
This is to certify that the work contained in this report entitled Finite Element Modelling of Ra-
diation Conditions in Electromagnetic Scattering by Vivek Saxena has been carried out under my
supervision and that this work has not been submitted elsewhere for a degree or diploma.
Dr. Naren Naik
Department of Electrical Engineering
IIT Kanpur
3
Abstract
The present study develops Finite Element Method (FEM) based models for the scattering prob-
lem involving electromagnetic waves, with radiation boundary conditions. The main focus of our
work has been towards the development of Absorbing Boundary Conditions (ABC) and Perfectly
Matched Layer (PML) based solutions. This work is towards the larger objective of developing an
FEM framework for the shallow subsurface inverse scattering problem.
In the present work, the following has been accomplished:
Mesh generation for two dimensional domains, in MATLAB (meshing generation codes for
circular, rectangular, and arbitrarily shaped objects in 2D.)
Development and validation of rst order and second order ABC codes for homogeneous
backgrounds, in MATLAB.
Using COMSOL Multiphysics, motivated
the exploration of PML as against ABCs for the half-space problem by simulations, and
the need to generate own codes to solve the scattering problem (for greater exibility).
Second Order ABCs for homogeneous backgrounds have been derived and validated. These
and the First Order ABC are needed for a basic validation of the PML in homogeneous
backgrounds before moving on to the half-space inverse problem.
The primary objective was to set up the scattering problem and develop FEM codes for it, and
most importantly, compare dierent mesh truncation schemes.
4
Acknowledgments
I thank my advisor, Dr. Naren Naik, for his support and encouragement throughout the academic
year, and for introducing me to the nite element method, subsurface scattering, and other existing
academic issues and problems arising in computational electrodynamics.
Vivek Saxena
Roll Number: Y6549
Fourth Year Undergraduate
B.Tech. Programme
Department of Electrical Engineering
IIT Kanpur
viveks@iitk.ac.in
5
List of Figures
1.1 Basic geometry of a Landmine Detection Problem . . . . . . . . . . . . . . . . . . . 7
1.2 Block Diagram of the Forward Scattering Problem . . . . . . . . . . . . . . . . . . . 8
1.3 Block Diagram of the Inverse Scattering Problem . . . . . . . . . . . . . . . . . . . 8
5.1 Flowchart of the Finite Element Method-based solution process . . . . . . . . . . . 14
5.2 Triangular Mesh Pattern for h = 0.09 . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.3 Set Theoretic Operations on Regions . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.4 Circular Mesh generated using DistMesh . . . . . . . . . . . . . . . . . . . . . . . . 19
5.5 Mesh for a Concave PEC Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.6 The unbounded and PML-bounded problems . . . . . . . . . . . . . . . . . . . . . . 22
5.7 The three step-process for setting up a PML . . . . . . . . . . . . . . . . . . . . . . 23
7.1 First and Second Order Solutions for PEC Cylinder Scattering . . . . . . . . . . . . 29
7.2 Analytical and FEM Solutions for the PEC Cylindrical Scatterer at /25 . . . . . . 30
7.3 1
st
order ABC versus 2
nd
order ABC . . . . . . . . . . . . . . . . . . . . . . . . . . 31
7.4 Electric Fields near an o-center PEC Cylinder . . . . . . . . . . . . . . . . . . . . 32
7.5 Scattering from an o-center PEC Cylinder . . . . . . . . . . . . . . . . . . . . . . 32
7.6 Electric Fields near a Concave PEC Object . . . . . . . . . . . . . . . . . . . . . . . 33
7.7 Scattering from a Concave PEC Object . . . . . . . . . . . . . . . . . . . . . . . . . 33
7.8 Square PEC Object Mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
7.9 Scattering from a Square PEC Object . . . . . . . . . . . . . . . . . . . . . . . . . . 34
7.10 Mesh for two PEC objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
7.11 Scattering from Two PEC Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
7.12 Scattered Fields from PEC Cylinder in Air: ABC vs PML . . . . . . . . . . . . . . 36
7.13 Scattering from Dielectric Cylinder in Air: ABC vs PML . . . . . . . . . . . . . . . 37
7.14 Scattering from PEC Cylinder buried under Soil . . . . . . . . . . . . . . . . . . . . 38
7.15 Scattering from Dielectric Cylinder buried under Soil . . . . . . . . . . . . . . . . . 39
8.1 FEM Local Node Numbering Convention . . . . . . . . . . . . . . . . . . . . . . . . 44
8.2 Evaluation of ABC matrix elements . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
8.3 Scattered Fields from PEC Cylinder in Air: ABC vs PML . . . . . . . . . . . . . . 59
8.4 Scattering from Dielectric Cylinder in Air: ABC vs PML . . . . . . . . . . . . . . . 60
8.5 Scattering from PEC Cylinder buried under Soil . . . . . . . . . . . . . . . . . . . . 61
8.6 Scattering from Dielectric Cylinder buried under Soil . . . . . . . . . . . . . . . . . 62
6
Chapter 1
Introduction
Subsurface imaging is the reconstruction of topological attributes of an object buried underneath
or embedded within the volume of a dielectric material. It involves the use of data of the elec-
tromagnetic elds scattered by the object(s) of interest, to construct a contour map of the total
electromagnetic eld distribution in the near region of the scatterer(s). From this contour map and
the eld data, it is usually possible to recover important details of the structure, using reconstruc-
tion algorithms.
Important examples of subsurface imaging are landmine detection, tumor detection, geophysical
and oil exploration. The basic problem is conveyed eectively by the following illustration:
Figure 1.1: Basic geometry of a Landmine Detection Problem
The gure shows a spherical/cylindrical mine (shown in red) buried underneath the ground (soil,
shown in maroon), which is in general undulating. The mine is the object of interest here and the
quantities of relevance in this problem can be:
the depth below surface, of the mine, and
the structure of the mine.
These quantities can quantify the extent of destruction an explosion of the mine could cause. The
depth can be used to determine whether the mine can be safely defused without risking an explo-
sion, and the structural (material) content can give hints for identifying it so as to enable the use
of specically practical methods to defuse it.
An analogous situation arises in biomedical imaging, where structural information about a tu-
mor or an abnormal growth in the body can be used to advance prognosis, possibly allowing early
7
detection and improving the chances of patient treatment and survival in the case of a malignant
tumor. In this problem, the mine of the Figure 1.1 is replaced by a possibly malevolent growth
inside the body, and the interface becomes the skin-air interface. It is extremely important that the
methods of imaging be non-invasive; that is, the process of recovery of compositional information
must not result in perturbation which causes damage or destruction. For instance, tumors cannot
be imaged using ionizing radiation which might cause them to grow in size or become malignant.
Of course, landmines should not be touched more if one can help it.
Subsurface imaging problems form actually a subset of a larger category of problems known as
Inverse Problems. In general, to predict the results of a measurement requires
1. a model of the system under investigation, and,
2. a physical theory linking the parameters of the model to the parameters being measured.
This prediction of observations (in our case, the scattered elds), given the values of the parameters
dening the model (object topology, dielectric properties) constitutes the forward problem.
Figure 1.2: Block Diagram of the Forward Scattering Problem
Solving the inverse problem consists of using the results of actual observations (the scattered elds)
to infer the values of the parameters characterizing the system under investigation (the shape
descriptors of the mine and its depth below the surface).
Figure 1.3: Block Diagram of the Inverse Scattering Problem
8
Chapter 2
Motivation & Objectives
Subsurface imaging is the non-invasive recovery of shape and topological attributes of an object
buried within a dielectric region, for example, a mine buried beneath the soil. The method of imag-
ing referred to here involves propagating electromagnetic waves of known frequency and amplitude
on the ground, measuring the elds scattered by the dielectric surface (soil) and the object (mine),
and estimating the internal electromagnetic parameters of the scatterer.
In both landmine detection as well as tumor detection, there are several practical issues to consider,
namely
Need for a non-invasive detection.
Low False Alarm Rate.
Distinguishing between landmines and clutter, or malignant and benign tumors.
For such purposes, tomographic reconstruction of the subsurface object is essential. And as moti-
vated earlier, subsurface reconstruction is an inverse scattering problem.
The objective of this project is towards the development of a computational model for study-
ing and analyzing subsurface imaging of objects buried under the soil, using the Finite Element
Method. Towards this objective, this study investigates the use of Absorbing Boundary Conditions
and Perfectly Matched Layers to model the radiation conditions at innity.
Inverse scattering solutions typically need forward scattering models. Specically, it is desirable
to have complete control over the implementation aspects of the forward problem model, for in-
stance the FEM routines and the boundary conditions, because these are used to generate Frechet
derivatives required for shape reconstruction. Hence, writing our own code for solving the forward
problem through FEM is preferred over usage of existing forward problem solvers such as COM-
SOL Multiphysics. However, the power of these packages cannot be undermined, and ideally it is
desirable to use both approaches to solve the complete problem.
9
Chapter 3
Literature Survey
The rst part of the project involved familiarization with the Finite Element Method (FEM),
through the reading of the textbooks by Jin [1], Polycarpou [2] and Volakis et al [4], to understand
how Maxwells equations are discretized into linear matrix equations. This discretization procedure
is described in Appendix A. For meshing, before setting up our own triangular meshing codes,
the documentation of DistMesh [3], an open source MATLAB-based meshing library, was studied.
DistMesh is used here in conjunction with our own meshing codes, to specify objects which have
signed distance function descriptions, as described in section 5.3.2 of this report.
Next, a study of the two dimensional boundary value problem described by Polycarpou [2] and
Jin [1] and the three major boundary conditions (Dirichlet, Neumann and Mixed Boundary Con-
ditions) was undertaken. The weak form was developed using these ideas, and the mathematical
foundations underlying them, as outlined by Volakis et al [4] and Kesavan [5]. The Galerkin for-
mulation of Jin [1] was identied to be used for subsequent computational work, and a Helmoltz
equation was set up for a general two dimensional scattering problem. This is described in Chapter
5, of this report.
Existing literature on Abvsorbing Boundary Conditions (ABCs) by Bayliss et al [6], Volakis and
Chatterjee [9] and on the Perfectly Matched Layers (PMLs) by Johnson [8], Brenger [10], Rappa-
port and Winton [11], and Jin and Chew [12], was studied. For the 1
st
and 2
nd
order ABCs, the
treatments of Jin [1] and Volakis et al [4] were examined and taken up for implementation to solve
a prototypal scattering problem of scattering from a PEC cylinder. This was motivated by the
existence of an analytical solution for the total and scattered elds, as given by Balanis [7], and by
results for the 1
st
order ABC given by Polycarpou [2]. Certain mistakes in Jins formulation of the
2
nd
order ABC expressions were discovered, as outlined in Appendix C. Experiments with the PML
were conducted in COMSOL Multiphysics, an FEM Modelling package. Simulation results are
given in Chapter 6, and analytical expressions for the ABC are given in Appendices B and C.
For more complicated 2D objects which cannot be described easily using explicit signed distance
functions, a MATLAB program was written to interface with COMSOLs meshing subroutines.
For this purpose, the documentation of COMSOL was studied to gain access to the internal mesh
storage structure. Both COMSOLs meshing subroutines as well as those of DistMesh had to be
augmented with our own interface codes to make the meshes compatible with the FEM codes.
10
Chapter 4
Work Done in the Final Semester
Development of completely general 2D nodal FEM codes to handle arbitrary two dimensional
objects.
Development of a framework to mesh arbitrary two dimensional objects.
Derivation and validation of the Second Order Absorbing Boundary Condition (ABC) expres-
sions in homogeneous backgrounds, in an FEM model.
Study of comparison between First Order and Second Order ABCs, for various 2D objects,
including a double object scattering example.
Validation of the superiority of the Second Order ABC over the First Order ABC for the
objects considered, and a brief study of the limitations of the second order ABC.
Development of interface codes to use MATLAB in conjunction with DistMesh (an open source
library of geometric primitives and meshes) and COMSOL Multiphysics (a commercial FEM
modeling package, used this semester solely for meshing complex objects).
Work Done in the First Semester
Familiarization with the 2D Nodal Finite Element Method and methods of mesh truncation
(ABC and Perfectly Matched Layers ).
Development of a framework to mesh circular and rectangular objects.
Development of codes to solve Laplace and Poisson equations in 2D for electrostatic problems,
and extension of the code to solve the Helmoltz equation in 2D.
Derivation and validation of the First Absorbing Boundary Condition (ABC) expressions in
homogeneous backgrounds, in an FEM model.
Development of a program to solve for the total and scattered electric elds in the vicinity of
a PEC cylinder in air, using the FEM and a First Order ABC for mesh truncation.
Study of comparison between First Order ABC and PML via COMSOL Multiphysics (used
as an FEM Modeling package).
Validation of the improved performance of the PML over the First Order ABC for subsurface
scattering, through COMSOL Multiphysics.
11
Chapter 5
Basic Theory
The work done on this project centered around the forward problem, specically the implementa-
tion of a Finite Element Method-based framework for solving two dimensional partial dierential
equations (PDEs) that arise in time harmonic scattering problems in electromagnetics.
Time Harmonic analysis allows us to nd the solution to the problem for one spot excitation fre-
quency. The response due to a general excitation eld can be obtained by Fourier decomposition of
the excitation and determination of the response for each Fourier mode using the existing framework.
In a nutshell, the objective of the forward problem is to determine the scattered elds and to-
tal eld distribution in the near zone of a scatterer whose geometry is known apriori.
5.1 Scattering Boundary Value Problem
The scattering boundary value problem (BVP) in two dimensions is of two kinds:
1. Scalar problem
2. Vector problem
5.1.1 Scalar Problem
The objective of the 2D scalar problem is to solve the partial dierential equation,


x
_

x
_


y
_

y
_
+ = f(x, y) (x, y) (5.1)
subject to the boundary conditions
= p on
1
(5.2)
_

x
x +
y

y
y
_
n + = q on
2
(5.3)
where
denotes the principal unknown eld (electric or magnetic).

x

x
(x, y),
y

y
(x, y), (x, y) and f(x, y) are scalar functions of x and y.
=
1
+
2
denotes the contour or boundary enclosing the area .
n denotes the outward normal unit vector of .
, p and q are known parameters associated with the physical properties of the boundary. In
particular, p and q can be considered to be the boundary source or boundary excitation.
12
Boundary condition (4.1) is known as the Dirichlet condition, whereas boundary condition (4.2) is
known as the Robin condition or the generalized Neumann boundary condition.
For an open domain scattering problem, the appropriate boundary condition on the far eld is
the Sommerfeld Radiation condition [1]
lim
r
r
_

_
E
H
_
+ jk
0
r
_
E
H
__
= 0 (5.4)
which in two dimensions becomes
lim

_
E
z
H
z
_
+ jk
0
_
E
z
H
z
__
= 0 (5.5)
where =
_
x
2
+ y
2
, r =
_

2
+ z
2
and k
0
is the free space propagation wavenumber.
But for a numerical solution to this BVP, we cannot store information for on a com-
puter with nite memory size. The Sommerfeld Radiation condition as expressed in the form above
is no longer valid, since the domain has to be truncated by some articial boundary that is located
a nite distance away from the scatterer.
Hence, we need to enforce a suitable boundary condition on this articial boundary such that
a perfect absorbing surface is simulated. By the use of an articial boundary, we want to ensure
that the EM modes see a transparent surface and do not suer reection. This gives the impres-
sion that the domain is still unbounded whereas it is in fact nite, and hence representible on a
computer system with nite memory size. This is known as Mesh Truncation.
The boundary condition on the articial boundary which truncates the mesh, is imposed through
the second boundary condition, i.e. the generalized Neumann Boundary condition. It is known
as an Absorbing Boundary condition (ABC) and is described below. An alternative approach to
truncate the mesh involves the use of an articial absorbing layer known as a Perfectly Matched
Layer (PML), which represents an imaginary lossy medium through which electromagnetic elds
travel without signicant reection.
5.1.2 Vector Problem
The objective of the 2D vector problem is to solve the PDE
(F) + F = G(r) r (5.6)
subject to the boundary conditions
n F = F
1
(r) on
1
(5.7)
n (F) = F
2
(r) on
2
(5.8)
where
F denotes the principal unknown eld (electric or magnetic).
13
(x, y) and (x, y) are scalar functions of x and y.
G(r) is a known vector function.
F
1
(r) is a known vector function specifying the Dirichlet boundary condition on
1
.
F
2
(r) is a known vector function (possibly involving F) specifying the generalized vector
Neumann boundary condition on
2
.
In this study, only the scalar problem was examined. The vector problem involves a more complex
formulation of the ABC and PML, which needs to be formulated more precisely before it can be
simulated using a vector generalization of the FEM known as the Edge Element Method.
5.2 The Finite Element Method
The continuum BVP is described by the geometry, a PDE and a set of boundary conditions. As
we are interested in an approximate solution to the PDE, we resort to the weak formulation of the
BVP (in which the PDE is enforced locally at discrete points via a weaker integral equation). The
geometry is represented by a triangular mesh and a set of basis functions used to approximate
the unknown eld within each element of the mesh.
Since we employ triangular meshes, there are three such linear basis functions, which will be
used to interpolate the value of the principal known unknown eld within each triangular element
given its values at the three nodes (vertices) of the triangle. The weak form along with a continuity
condition is amenable to discretization via these chosen basis functions. This method of solving
a PDE approximately, is known as the Finite Element Method (FEM). A owchart of the FEM
solution process is shown below.
Figure 5.1: Flowchart of the Finite Element Method-based solution process
14
This discretization yields a set of linear equations, the solution to which gives the values of the
principal unknown eld at all the nodes of all triangular elements forming the mesh. Once the
nodal values are known, the value of the unknown eld at any point in the solution domain can be
determined by interpolation using the basis functions. The FEM can thus be used to nd the total
eld in the vicinity of a scatterer. Since the incident eld in a scattering scenario is known apriori,
the method can be used to determine the scattered eld as well.
In summary, the FEM consists of the following four major steps:
Discretization: breaking up the solution region into a nite number of elements (meshes).
Derivation of Governing Equations: derivation of governing equations for a typical ele-
ment.
Assembly: assembling of all elements in the solution region.
Solution: solving the system of equations obtained.
The mathematical details of the Finite Element Method and how it is to be set up are described in
Appendix A.
5.3 Meshing
Three approaches were used for meshing:
1. Concentric Ring Meshing: this approach was used for circular objects in 2D.
2. DistMesh based Meshing: this approach was used to mesh arbitrary objects in 2D for which
a signed distance function could be easily obtained analytically.
3. COMSOL based Meshing: for very complicated objects that cannot be described using signed
distance functions, the COMSOL Multiphysics interface with MATLAB was used as a com-
putational front-end for meshing.
5.3.1 Concentric Ring Meshing for circular objects
In order to solve for the total electric eld in the near region of a PEC Cylinder when an incident
plane wave strikes it, a meshing algorithm was evolved for circular solution domains. The details of
this meshing algorithm are described below, with reference to the particular geometry under study.
A PEC Cylinder of radius = a is centered at the origin. The solution domain extends from
= a to =
ABC
, where
ABC
is the radius of the circular boundary over which the Absorbing
Boundary Condition is to be enforced. The region from = 0 to =
ABC
is divided into N
ring
annular rings, with N
ring
given by
N
ring
=
_

ABC
a

3
h
2
_
(5.9)
where h is the discretization size. The dierential step change in the radial direction is given by
=

ABC
a
N
ring
(5.10)
15
At a xed (where = a : r :
ABC
), the angular separation between two successive nodes is
given by
=
2
N
pts
(5.11)
where N
pts
= 2/h is the total number of nodes on the boundary of the segment at radius . As
increases, the angular spacing between two successive nodes reduces, because the total number of
nodes on the boundary increases with its radius. By following this procedure, nodes are marked
on the solution domain, and triangulation using the MATLAB function delaunay populates the
annular regions by as many equilateral triangles of side length h as possible, with the remaining
region being lled up with skewed triangles.
Triangles located in the region interior to the PEC which are rendered by the triangulation sub-
routine, must be removed as this region is excluded from the solution domain. The local node
numbering generated by this subroutine is not always counterclockwise as required by the FEM for-
mulation (c.f. Figure 7.1), so a reordering of the nodes is carried out to bring them to the canonical
orientation. A generalization to dielectric objects is described below.
The inputs to the meshing algorithm are

cyl
(or a): the radius of the PEC

ABC
: the radius of the circular boundary over which the ABC is to be imposed
h : the discretization size (a measure of the equilateral triangle side, in units of wavelength)
The outputs of the meshing algorithm are
nNodes: Number of Nodes
nElements: Number of elements
N(e, i): Connectivity array (described in Appendix A).
x(i), y(i): x- and y-coordinates of the nodes.
A triangular mesh pattern for
cyl
= a = 0.5,
ABC
= 1.5 and h = 0.09 generated using the above
algorithm is shown below.
Figure 5.2: Triangular Mesh Pattern for h = 0.09
16
Points to note:
1. In order to generalize concentric ring meshing to non-PEC (i.e. dielectric) objects, all we need
to do is set a = 0 in equations (4.9 4.11), with the understanding that the region interior
to the dielectric cylinder is also to be meshed. Dierent values of h could be specied for the
two regions, if desired.
2. For a mesh to be a valid input to the FEM code block, it is important that the local node
numbering of each triangle be consistent with the counterclockwise numbering convention
described in Appendix A, failing with the FEM matrices become singular, resulting in severely
erroneous solutions.
5.3.2 DistMesh
DistMesh is an open source MATLAB-based meshing library for two- and three-dimensional objects,
written by Persson and Strang [3]. DistMesh uses a signed distance function d(x, y) in two
dimensions (or d(x, y, z) in three dimensions) as a shape descriptor. The property of this function
is that it is negative inside the region of interest (to be meshed) and non-negative outside. Hence,
a subdomain R
2
of interest can be described using the property
d(x, y) =
_
a negative quantity for (x, y)
a nonnegative quantity for (x, y) /
(5.12)
As a simple example, for an annular region
1
< <
2
, the distance function is
d(x, y) =

1
+
2
2

_
x
2
+ y
2

+

1

2
2
(5.13)
which is the same as
d(x, y) = max(d
1
(x, y), d
2
(x, y)) =
d
1
(x, y) d
2
(x, y)
2
+

d
1
(x, y) + d
2
(x, y)
2

(5.14)
where d
1,2
(x, y) =
_
x
2
+ y
2

1,2
are the distance functions for the inner and outer circles re-
spectively. This operation is equivalent to a set theoretic subtraction of two domains. That is, to
construct an annular region, we can begin with a circular region of radius
2
and remove the circular
region of radius
1
from it.
Generalizing this idea to arbitrary domains requires the introduction of two more analogous set
theoretic operations on a pair of regions: Union and Intersection.
Denoting the signed distance functions of regions A and B by d
A
(x, y) and d
B
(x, y) respectively,
the three operations required for constructing a sub-region from a larger region in two dimensions,
are listed below.
Union : d
A

B
(x, y) = min(d
A
(x, y), d
B
(x, y)) (5.15)
Dierence : d
A\B
(x, y) = max(d
A
(x, y), d
B
(x, y)) (5.16)
Intersection : d
A

B
(x, y) = max(d
A
(x, y), d
B
(x, y)) (5.17)
17
The operations mentioned above are described geometrically in the gure below.
Figure 5.3: Set Theoretic Operations on Regions using Signed Distance Functions
DistMesh uses an algorithm that combines a physical principle of force equilibrium in a truss struc-
ture with a mathematical representation of the geometry using signed distance functions [15]. The
iterative technique is based on the physical analogy between a simplex mesh and a truss structure.
Meshpoints are nodes of the truss. Assuming an appropriate force-displacement function for the
bars in the truss at each iteration, the algorithm solves for an equilibrium condition. The forces
move the nodes and iteratively, the Delaunay triangulation algorithm adjusts the topology.
The basic algorithm employed by DistMesh is described below, step-by-step.
1. Create a uniform distribution of nodes within the bounding box of the geometry, corresponding
to equilateral triangles.
2. Remove all nodes outside the desired geometry (using the signed distance functions negativity
as a criterion for interioricity).
3. Now, enter the main loop where the location of the nodes is iteratively improved until equi-
librium is reached.
(a) Perform a Delaunay triangulation on the existing node set to determine the topology of
the truss at this iteration.
(b) Now, evaluate the force function. If equilibrium is attained, break. otherwise, determine
the extent of movement of the nodes in this iteration and reiterate until equilibrium.
4. Determine the list of triangles which is a n
e
3 matrix (where n
e
is the total number of
triangular elements), and the node coordinates x and y, after removing duplicate entries.
5. Determine the the boundary edges, for imposing Dirichlet, Neumann and Mesh Truncation
conditions.
18
An example of a mesh generated using DistMesh is shown below. A circular object with a center
(0, 0.5) and radius 0.5 is placed inside the domain. The center of the original circular domain is
plotted in red to emphasize that the object is o-center.
Figure 5.4: Circular Mesh generated using DistMesh, with a discretization size 0.2.
It should be noted that while using DistMesh, one has to ensure that the numbering convention is
preserved. This is easily ensured by using the signed area of each triangular element as an indicator
of local ordering. If the signed area is negative, swapping the global node numbering of any two
nodes will result in a well ordered element for FEM purposes. Another issue that frequently crops
up while using DistMesh is the presence of multiple identical entries in the element connectivity
matrix. These have to be removed before the mesh is given as an input to the FEM code.
A major problem with DistMesh is that for certain geometries, the meshing algorithm may fail
to converge. This can happen if the domain has objects which have sharp corners. In such situa-
tions, it is desirable to re-specify the object at the corners and make it more smooth. This could
be achieved using Bezier curves or splines. Irrespective of the method used to specify the curve,
eventually every representation must yield an appropriate signed distance function d(x, y) which
results in a convergent mesh. This is not always possible, as one might expect, and hence we resort
to a more sophisticated meshing algorithm implemented in COMSOL Multiphysics.
5.3.3 COMSOL-based Meshing
COMSOL Multiphysics is a powerful FEM-solver, which comes in-built with a geometry drawing
tool and a MATLAB interface with geometric primitives as MATLAB commands. The use of COM-
SOL Multiphysics as an FEM solver was explored in the rst semester.
In this section, we restrict ourselves to the use of COMSOL as a mesh generator.
The advantage of COMSOL over DistMesh is that it can be used to adaptively remesh a sub-
domain more nely than the rest of the region. This is especially useful at corners and interfaces,
where DistMesh is likely to yield coarse meshes if at all it can avoid oscillations.
19
An example of a mesh generated for a complicated concave PEC object in 2D is shown below:
Figure 5.5: Mesh for a concave PEC object generated using COMSOL, with a discretization size
0.2.
The exact internal details of COMSOLs meshing algorithm are not known, and in this particular
case, COMSOL has been used more as a black box for meshing complicated objects, and transferring
the mesh to our own FEM codes, so that we have control over all the matrix elements. However, it
is known that COMSOL uses Delaunay Triangulation for meshing.
5.4 Mesh Truncation
In order to apply the nite element method to open-region scattering or radiation problems, the
innite solution domain must be truncated into a nite one. This is a fundamental requirement
of any computational solution due to the restriction of nite memory on a computational engine.
Geometric truncation implies the imposition of boundary conditions which force the solution to
evolve within the reduced geometry. However, such forced terminations can introduce additional
artifacts into the solution due to reection, scattering, etc. The problem then, is to determine such
a termination that does not introduce undesirable properties in the scattered elds of interest in the
solution domain, and at the same time, prevents them from diering considerably from the solution
in the physical unbounded space.
Now, assuming that all sources and objects are immersed in free space and located within a -
nite distance from the origin of a coordinate system, the electric and magnetic elds are required
to satisfy the Sommerfeld Radiation Condition [1],
lim
r
r
_

_
E
H
_
+ jk
0
r
_
E
H
__
= 0 (5.18)
which in two dimensions becomes
lim

_
E
z
H
z
_
+ jk
0
_
E
z
H
z
__
= 0 (5.19)
20
But this condition is no longer valid since the solution domain has been articially truncated by
some boundary which is located at a nite distance from the scatterer. So, we need to enforce
a suitable boundary condition on this articial boundary such that a perfect absorbing surface is
simulated. That is, the EM modes in the region see a transparent surface, and do not suer
reection. This gives the impression that the solution domain is unbounded whereas it is in fact
nite, and hence representible on a computer system with nite memory size.
The rst order absorbing boundary condition in two dimensions is given by,

sc

+
_
jk
0
+
1
2
_

sc
= 0 (5.20)
whereas the second order absorbing boundary condition is given by,

sc
n
+
_
jk
0
+

2

j
2
8(j k
0
)
_

sc

j
2(j k
0
)

sc
s
2
= 0 (5.21)
where /n denotes the derivative normal to the scattering surface (in 2D cylindrical coordinates,
n = ) and
2
/s
2
denotes the second order tangential derivative (in 2D cylindrical coordinates,
s = ). Also, = 1/ is the curvature of the 1-surface. This is the Bayliss-Gunzberger-Turkel
ABC [6]. In Appendix B, it is shown that the rst order ABC can be directly included in the
FEM formulation. With a suitable redenition of the intrinsic boundary condition in the FEM, the
second order ABC can also be similarly included, as described in Appendix C.
In two dimensions, the scattered eld in the far eld zone has the asymptotic form

sc
(, ) = A()
e
jk

(5.22)
The important feature of this asymptotic solution is that it falls of as 1/

and not exponentially


with distance. The rst order absorbing boundary condition (ABC) can be rewritten as

sc

=
_
jk
1
2
_

sc
(5.23)
The convergent expansion for the solution of the Helmoltz equation satisfying the Sommerfeld
radiation condition [1] is given by,

sc
(, ) = H
(2)
0
(k)

n=0
f
n
()

n
+ H
(2)
1
(k)

n=0
g
n
()

n
(5.24)
where H
(2)
0
and H
(2)
1
denote the zeroth- and rst-order Hankel functions of the second kind, respec-
tively. Using the asymptotic form for the Hankel functions, we can write this as

sc
(, ) =
e
jk

n=0
a
n
()

n
(5.25)
21
From this we can obtain the second order ABC by neglecting terms of order O(
9/2
) in the following
expression

sc

=
_
jk
1
2
+
1
8jk
2
+
1
8k
2

3
_

sc
+
_
1
2jk
2
+
1
2k
2

3
_

2

sc

2
+ O
_
1

9/2
_
(5.26)
There are limitations to the ABC however. Strictly, such an ABC can only be enforced on a
circular boundary. This is because of the ill-posed denition of a second order curvature term
over nonsmooth boundaries.
Further, since an ABC aims to model a reectionless surface, it cannot be very close to the scat-
terer. In fact, the farther away from the scatterer the ABC is imposed, the more accurate the
FEM solution will be. But doing so will increase the amount of data storage enormously. Although
in principle it is possible to reduce the problem size by using a higher order ABC, the tradeo
between space complexity and time complexity will remain since higher order ABCs will
require the computation of higher order eld derivatives, both tangential as well as normal.
Also, it is known that the Absorbing Boundary Condition runs into diculties with interfaces,
because of the typical assumption of a homogeneous region around the scatterer. Finally, the ABC
is perfectly absorbing only for a plane wave, which is not physically realizable.
Hence, we resort to another form of mesh truncation, known as a Perfectly Matched Layer (PML)
[8, 10, 11, 12]. Strictly, a PML is not a boundary condition but rather an additional domain that
absorbs incident radiation without producing reections.
Figure 5.6: (a) the unbounded problem, and (b) the geometry augmented with a PML.
The gure on the left indicates the geometry of the original BVP. On the right, the solution domain
has been truncated all round by the use of a perfectly absorbing layer that is reectionless. Thus,
we are looking for a layer of (articial) material to enclose our region of interest in such a way that
the elds under study in that region do not see this layer. This is a dicult problem in itself, as
a reectionless layer enclosing the entire solution domain is dicult to develop in the absence of
information about the very elds it must fail to reect. It should be noted that this layer is articial.
22
A PML is developed using a three-step process, described by Johnson [8] and illustrated in the
gure below:
Figure 5.7: The three step-process for setting up a PML
1. In innite space, we analytically continue the solutions and equations to a complex x contour.
This changes oscillating waves into exponentially decaying waves outside the region of interest
without reections.
2. Still in innite space, we perform a coordinate transformation to express the complex x as a
function of a real coordinate. In these new coordinates, we have real coordinates and complex
materials.
3. We truncate the domain of this new real coordinate inside the complex-material region: since
the solution is decaying there, as long as we truncate it after a long enough distance (where
the exponential tails are small), the boundary condition used will not signicantly impact the
nal solution. So, even hard-wall truncations are acceptable.
The hard-wall truncation at the outer surface of the layer can be eected using a simple Dirichlet
condition for a PEC, for example, incurring minimal (of course, unavoidable) reections there. It is
known [8] that the PML can be incorporated by the following dierential operator transformations

x

1
1 + i
x(x)

x
(5.27)

y

1
1 + i
y(y)

y
(5.28)
23
The articial PML material is seen to have both an electrical as well as a magnetic conductivity due
to the existence of terms corresponding to currents of electric and magnetic charges. Despite the
limitations of the PML (multiple angle absorption, numerical reections due to discretization, and
the existence of some inhomogeneous media where the PML fails to act as a reectionless layer), its
features and apparent simplicity in implementation over the standard homogeneous ABCs discussed
above are suggestive of its utility in the half-space subsurface scattering problem.
To summarize, imposing a PML for mesh truncation is equivalent to modifying the dierential
operator in the original BVP in a local region of the solution domain, so as to obtain an articial
medium with nite electric and magnetic conductivity (and absorption). This medium converts
oscillating complex exponentials into decaying real exponentials due to the analytic continuation
of space. To this extent, the PML is another way of enforcing an absorbing boundary condition,
but without forcing the scattered eld itself to satisfy a mixed boundary condition explicitly in
the solution domain. The PML formulation can be deduced from Maxwells equations by intro-
ducing a complex-valued coordinate transformation with the additional requirement that the wave
impedance should remain unaected.
In practice, the PML is typically used along with an absorbing boundary condition at its outer
(unphysical) boundary. While a hard Dirichlet condition can also be used to terminate the elds,
it acts as a reector for any elds that may leak into the PML region. As this is undesirable, an
absorbing boundary condition of the rst order can be used to avoid reections of any remnant
elds in the PML region. As demonstrated by the simulated results, a combination of PML and
ABC reduces the reections induced by mesh truncation more eectively than purely a rst order
ABC.
24
Chapter 6
Methodology Adopted
In this project, we focused on solving the forward problem to compute the scattered electric elds
and total eld distributions for the following scenarios:
1. Perfect Electric Conducting (PEC) cylinder placed in air (vacuum).
2. PEC concave object placed in air.
3. PEC square object placed in air.
4. Two PEC objects (concave + square) placed in air.
5. Dielectric cylinder placed in air.
6. PEC cylinder buried under the soil.
7. Dielectric cylinder buried under the soil.
Mesh truncation schemes used were the rst order ABC, the second order ABC and Perfectly
Matched Layers. Of these the rst four problems were solved by writing our own computer pro-
grams in MATLAB from scratch. For meshing circular and rectangular regions, we generated our
own codes. But for complicated geometries which can be described using signed distance functions,
DistMesh can be used for meshing. For still more complicated geometries, such as concave objects,
COMSOLs meshing subroutines were used.
For the rst four situations listed above, our own FEM codes were used with mesh truncation
provided by rst order and second order ABCs. Both DistMesh and COMSOL were used solely as
mesh generators in this class of problems. The mesh connectivity matrices generated by both these
libraries have to be suitably reordered for use in an FEM code. Therefore, interface code for both
DistMesh as well as COMSOL had to be written in MATLAB. The last three problems mentioned
above were formulated and simulated solely in COMSOL Multiphysics, an FEM-based modelling
and visualization program.
Emphasis was placed on PEC objects to examine the performance of various mesh truncation
schemes in the worst case scenario of a perfect reecting surface in the path of an incident
eld. Specically, PEC objects are near perfect reectors of the incident eld, and impose the sever-
est possible boundary condition on the tangential electric eld, that of forcing it to be identically
zero on their surfaces. Naturally, if a mesh truncation scheme works well in case of PECs, it should
work well in case of dielectrics.
A contour plot of the electric eld distribution for each of these cases is plotted in the next section.
In this section, we formulate the scattering problem. Meshing has been described in section 4.3 of
this report. The mathematical details of the Finite Element Method and the Absorbing Boundary
Conditions, are described thoroughly in Appendices A through C. We now state the forward prob-
lem formally for two inherently open region and closed region problems.
25
6.1 Statement of the Forward Problem (for Cylindrical PEC
Object in Air)
A perfect electric conductor, in the shape of a circular cylinder of radius a, is oriented in vacuum,
with its axis along the z axis. A plane z-polarized electromagnetic wave of wavelength = 2/k
0
,
with an electric eld amplitude E
0
impinges on the cylinder normally,
E
inc
= a
z
E
0
e
jk
0
x
= a
z
E
0
e
jk
0
cos
(6.1)
and is scattered. It is required to nd the total electric eld (incident + scattered) as a function of
the angle at a distance = from the center of the cylinder. It is given that a = /2 and E
0
= 1
V/m.
6.1.1 The Partial Dierential Equation for the Total Electric Field
The incident E eld is polarized along the z-direction, so the scattered E eld from the innitely
long cylinder is also polarized along the z-direction. Therefore, the total electric eld E will have
only a z-directed component: E = E a
z
, and there will be no z-variations in the eld:
E
z
z
= 0 = E = E
z
E
z
(x, y) (6.2)
Consider the following two time-Harmonic Maxwells equations,
E = j
0

r
H (6.3)
H = J + j
0

r
E (6.4)
Solving for H from (6.3) and substituting into (6.4), we get

1
j
0

_
1

r
E
_
= J + j
0

r
E (6.5)
Due to (6.2) we also have
E = a
x
E
z
y
a
y
E
z
x
(6.6)
The curl term on the left hand side of (6.5) can be written as

_
1

r
E
_
=

a
x
a
y
a
z

z
1
r
Ez
y

1
r
Ez
x
0

(6.7)
= a
z
_


x
_
1

r
E
z
x
_


y
_
1

r
E
z
y
__
(6.8)
where, the condition
r
/z = 0 has been used to arrive at the second equality. Substituting (6.8)
into (6.4) and simplifying, we get the Helmoltz equation

x
_
1

r
E
z
x
_
+

y
_
1

r
E
z
y
_
+ k
2
0

r
E
z
= j
0
J
z
(6.9)
26
where k
2
0
=
2

0
. The source free version of this equation (for J
z
= 0) has the same form as the
canonical scalar wave equation in the Galerkin formulation [1],


x
_

x
_


y
_

y
_
+ = f (6.10)
where,

x
=
y
=
1

r
(6.11)
= E
z
(6.12)
= k
2
0

r
(6.13)
f = 0 (6.14)
6.2 Statement of the Forward Problem (for Buried Mines)
Landmines are modelled as small abnormalities embedded in an otherwise uniform media with an
air-ground interface. These abnormalities are characterized by the electrical permittivity and the
conductivity , whose values dier from those of the host media.
The incident eld is modeled here as a plane polarized wave with the electric eld given by
E
inc
(r) = E
0
e
i

0
y
e
it
(6.15)
propagating in the negative y-direction in the half space {y > 0}. Here is the angular frequency
of the stimulus signal ( = 2f, where f 1 GHz). It is assumed that {y > 0} is air and {y < 0}
is ground, where the mine-like targets are located.
The PDE for the forward problem in two dimensions, is

2
E
z
+ k
2
(x, )E
z
= 0 (6.16)
where
k
2
=
_

2

0
for y > 0,

0
(1 + j tan ) for y < 0
(6.17)
and
tan =
(x, )
(x)
(6.18)
The free space wavenumber is k
0
=

0
, and the free space wavelength is =
2
Re(k)
=
2
k
0
.
27
6.2.1 Parameter Values
The simulations were carried out for two kinds of dielectric materials: dry and wet soil. All the
parameters listed below are taken from Gryazin et al [13] and Huici et al [14]. These parameters
have been listed for a frequency of 1 GHz, which is the frequency at which all the buried mine
simulations have been carried out.
Medium
r
(S/m) tan k
2
(m
2
) k (m
1
) (cm)
Air 1 0 0 439.2 20.9 30
Dry Soil 2.9 0.004 0.025 1273 + j31 35.7 + j0.43 17
Wet Soil (5% moisture) 4 0.049 0.22 1756 + j395 42 + j4.7 15
TNT 2.86 2.864 10
4
0.0018 1256 + j2.26 35.4 + j0.03 17.7
Table 1: Approximate values of
r
, tan , k
2
, k and for dierent soil moistures and TNT at f = 1 GHz.
Description of Quantities

r
: Relative permittivity of the medium.
(S/m): Conductivity.
tan : Loss tangent (given by eqn. 6.18).
k (m
1
): Propagation constant.
k
0
(m
1
): Propagation constant in free space.
(m): Free space wavelength. =
2
Re(k)
.
The values for TNT (Trinitrotoluene) are listed as being representative of a land mine buried in
the ground, as TNT is an explosive substance. Two kinds of soil, diering in moisture content (and
therefore in dielectric properties), have been considered here to examine the contrast with with the
buried mine can be imaged in both scenarios. The results of the simulations carried out in Comsol
Multiphysics, are mentioned in the Results section of this report. The contrast of the buried mine
is enhanced when it is buried under wet soil, as indicated by the scattered eld distribution.
28
Chapter 7
Results
7.1 Circular PEC Object centered at the origin
The rst object to be considered has a radius a = /2 where is the free space propagation wave-
length. The rst order ABC is imposed at 3/2, a wavelength away from the object. The incident
eld has the form E
0
e
jk
0
x
for E
0
= 1 V/m, k
0
= 2/. All distances are normalized with respect
to . So without loss of generality, = 1.
For this particular problem, the concentric ring based meshing algorithm described above was
used. A plot of the total electric eld as a function of the polar angle at a radius = , is shown
below on the left, for various values of the mesh discretization parameter h (expressed in units of
).
Figure 7.1: First and Second Order solutions for PEC Cylinder Scattering for discretization sizes
/2, /5, /10, and /25, all evaluated at = .
The same experiment was then repeated but with a second order ABC imposed on a mesh truncation
boundary, rather than the rst order condition. The corresponding plot of the total electric eld is
shown in the gure on the right above. This problem has an analytical solution [7], given by
E
z
(, ) = E
0

n=
j
n
_
J
n
(k
0
)
J
n
(k
0
a)
H
(2)
n
(k
0
a)
H
(2)
n
(k
0
)
_
e
jn
(7.1)
29
where E
z
denotes the z-component of the total electric eld, a is the radius of the PEC cylinder,
and and are the cylindrical polar coordinates. Here, J
n
denotes the Bessel Function of the First
Kind of order n and H
(2)
n
denotes the Hankel Function of the Second Kind of order n.
The absolute values of the exact, rst order and second order solutions are plotted in the gure
below, for a discretization size of /25, on the boundary = .
Figure 7.2: Analytical and FEM Solutions for the PEC Cylindrical Scatterer, at discretization /25,
evaluated at =
From the plots, we can infer that
1. Both 1
st
and 2
nd
order ABC solutions become smoother as the discretization size is lowered.
2. For a discretization size of /25, the 2
nd
order ABC-based solution almost coincides with the
analytical solution, whereas the 1
st
order ABC-based solution deviates from the analytical
solution more signicantly at very small angles ( 0
o
), moderately large angles (100
o
and
260
o
) and again at around 360
o
. The solution is naturally symmetric about the x-axis.
Clearly, the 2
nd
-order ABC-based solution more closely approximates the total electric eld than
the 1
st
-order ABC based solution.
30
7.2 Location of 2
nd
order ABC vs. that of 1
st
order ABC
The total electric eld was computed using both the 1
st
and 2
nd
order ABC. The 1
st
order ABC
was imposed at a distance = 2 whereas the 2
nd
order ABC was imposed at = 1.5, with the
discretization for both situations taken to be 0.04.
The total electric eld at = is plotted below, as a function of the polar angle. It is evi-
dent that both the numerical solutions are almost comparable, with the 2
nd
order solution more
closely approximating the exact (analytical) solution. This demonstrates that the 2
nd
order
ABC gives a more accurate solution even when imposed at a boundary closer to the
scatterer.
Figure 7.3: Electric Field at =
The table below illustrates the advantage gained by using the 2
nd
order ABC over the 1
st
order ABC.
As is evident from the numerical values, the 2
nd
order ABC yields a solution comparable to (if not
slightly better than) the 1
st
order ABC, despite using about half the number of nodes and elements.
Parameter First Order ABC at 2 Second Order ABC at 1.5
No. of nodes 1843 984
No. of elements 3511 1828
No. of Dirichlet Nodes 35 35
No. of ABC Nodes 140 105
Table 2: Comparison of matrix sizes for 1
st
and 2
nd
order ABC.
31
7.3 Circular PEC Object placed o center
The domain consists of a circular object of radius 0.5, centered at (0, 0.5). The mesh, polar and
contour plots of the eld are shown below. The contour plot conrms that the 2
nd
order solution
is smoother, and better preserves the symmetry of the object. The eld very close to the PEC is
expected to be very nearly zero, which is more evident when the 2
nd
order ABC is used for mesh
truncation.
Figure 7.4: Electric Fields near an o-center PEC Cylinder
Figure 7.5: Contour Plots of the Electric Field, using the 1
st
order ABC (left) and 2
nd
order ABC
(right)
32
7.4 Concave PEC Object
The object was modelled using two elliptical arcs centered at (0.2, 0), with semi-axes of length
a = 0.2, b = 0.5. The total electric eld was computed using the 1
st
and 2
nd
order ABCs, at
= is plotted on the right, above.
Figure 7.6: Electric Fields near a Concave PEC Object
Contour plots of the total electric eld in the vicinity of the concave PEC scatterer are plotted
below. Although mostly comparable, the electric eld in the near region of the PEC in the forward
scattering direction, is seen to spread backwards less in case of the 2
nd
order solution. This is
consistent with the fact that a PEC strongly suppresses forward scattering.
Figure 7.7: Electric Field Contours for Scattering from a Concave PEC Object, using the 1
st
order
ABC (left) and the 2
nd
order ABC (right).
33
7.5 Square PEC Object placed o center
A PEC object with a square cross-section of side 0.5 was placed with its bottom left corner at the
origin. The resulting mesh pattern is shown below.
Figure 7.8: Mesh for a Square PEC Object.
Contour plots of the total electric eld in the vicinity of the square object are plotted below. The
2
nd
order solution is seen to be more regular and smoother near the PEC, and also preserves the
symmetry of the object.
Figure 7.9: Electric Field Contours for Scattering from a Square PEC Object, using the 1
st
order
ABC (left) and the 2
nd
order ABC (right).
34
7.6 Two PEC Objects
The framework developed also allows us to examine the eld patterns due to the presence of multiple
objects - a more practical scenario. As an example, we consider two objects, as shown in the meshed
domain below. The domain consists of a concave object and a square of edge length 0.2 with the
top left corner at the origin.
Figure 7.10: Mesh for double PEC object scattering
Contour plots of the total electric eld are shown below. The 2
nd
order ABC-based solution is much
better than the one based on the 1
st
order ABC, because it is much more regular and smoother,
and evaluates a very small electric eld in the immediate vicinity of the scatterer, an observation
consistent with the properties of a PEC.
Figure 7.11: Contour Plots for Scattering from two PEC objects, using the 1
st
order ABC (left)
and 2
nd
order ABC (right)
35
7.7 Comparison between 1
st
order ABC and PML PEC Cylin-
der in Air
Comsol Multiphysics was used for simulation, and the 1
st
order ABC and PML were implemented
and compared at four frequencies: 0.5 GHz, 1 GHz, 1.5 GHz and 3 GHz. In this case, the excitation
plane wave is incident from the top. The results are shown below.
Figure 7.12: Scattered Fields from PEC Cylinder in Air: ABC vs PML
The solution is seen to be smoother with the PML in place, than just with the First Order ABC,
due to better absorbing characteristics of the PML. Comsol also plots the scattered eld within the
PEC, which is not plotted conventionally. This should be ignored.
36
7.8 Comparison between ABC and PML for Dielectric Cylin-
der in Air
In this case, a dielectric cylinder with relative permittivity
r
= 2.86 and conductivity = 2.864
10
4
S/m, is placed in air. As before, the excitation plane wave propagates along the negative
y-direction.
Figure 7.13: Scattering from Dielectric Cylinder in Air: ABC vs PML
As with the PEC, the solution is seen to be smoother with the PML in place, than just with the First
Order ABC, due to better absorbing characteristics of the PML. Comsol also plots the scattered
eld within the PEC, which is not plotted conventionally. This should be ignored.
37
7.9 The Subsurface Problem (Half Space Scattering)
In this case, a simplied version of the situation portrayed in Figure 1.1, was modeled and solved in
Comsol Multiphysics, for two possible objects buried under the soil (a PEC cylinder and a dielectric
cylinder), and two kinds of soil (dry and wet soil). The results are given below. In the subsurface
problem, we use the combined ABC-PML method throughout. The frequency of the incident wave
is 1.0 GHz in each case.
7.10 PEC Cylinder buried under Soil
A PEC Cylinder of radius r = 5 cm is placed at a depth of 10 cm below the surface of the soil. The
simulation was carried out for two kinds of soil, dry and wet. The mesh truncation scheme involves
using PML on the inner rectangular boundaries, and a rst order ABC on the outer rectangular
boundaries.
Figure 7.14: Scattering from PEC Cylinder buried under Soil (z-component of total eld for dry
soil (left) and wet soil (right).)
38
7.11 Dielectric Cylinder buried under Soil
A Dielectric Cylinder of relative permittivity
r
= 2.86, conductivity = 2.864 10
4
S/m having
a radius r = 5 cm is placed at a depth of 10 cm below the surface of the soil. The simulation was
carried out for two kinds of soil, dry and wet. The mesh truncation scheme involves using PML on
the inner rectangular boundaries, and a rst order ABC on the outer rectangular boundaries.
Figure 7.15: Scattering from Dielectric Cylinder buried under Soil (z-component of total eld for
dry soil (left) and wet soil (right).
It is observed that the contrast of the mine increases as the soil becomes more wet, whether the mine
is a PEC or a dielectric (TNT). This is consistent witht he increased conductivity and dielectric
constant of moist soil, tends to concentrate the scattered eld.
Note: The contour plots in sections 7.7-7.11 are reproduced after magnication in
Appendix D, for greater ease of viewing and clarity.
39
7.12 Scattering from a PEC Cylinder in Air using the First
Order ABC (Eect of varying Discretization)
For a PEC cylinder of radius /2, and an ABC boundary of radius 3/2, the analytical and FEM
solutions are compared at = , for dierent discretizations, to illustrate the eect of meshing.
The mesh pattern, a contour plot of the total electric eld in the region, and a graph of the FEM
and exact solution have been plotted for three discretization sizes, and the results are shown below.
Fig. a: Discretization Size= 0.2
Fig. b: Discretization Size= 0.09
Fig. c: Discretization Size= 0.04
It is seen that for
cyl
= a = 0.5,
ABC
= 1.5, the FEM solution is very nearly equal to the exact
solution for the discretization size 0.04. The entire source code for solving this problem is given in
the appendices of this report.
40
Chapter 8
Conclusions
A framework for solving the Laplace, Poisson and Helmoltz equations in two dimensions has been
constructed from scratch in MATLAB, comprising of meshing, preprocessing and FEM routines,
with a feature to impose Mixed Boundary Conditions, in particular, the 1
st
and 2
nd
order ABCs.
As a part of this project, a system for meshing of arbitrary shapes in two dimensions has been put
in place by combining our own codes with DistMesh and COMSOL for meshing.
Completely general FEM codes have been written to compute the total and scattered eld dis-
tributions in the near region of one or more scatterers in two dimensional domains. Results from
several electromagnetic scattering situations have been mentioned and discussed in this report,
comparing the 1
st
and 2
nd
order ABCs. Exact analytical expressions for 1
st
and 2
nd
order ABCs
have been derived in Appendices B and C. These are directly used in an FEM code, and allow the
programmer to have complete exibility while solving a problem computationally.
Using COMSOL Multiphysics as an FEM modelling package, contour plots of the scattered elds
for PEC and dielectric cylinders in air and soil were extracted by simulation, results of which have
been stated here.
Further work needs to be done to include codes for a generalized Perfectly Matched Layers in
this framework, and validate results obtained using COMSOL-based PMLs, so as to have com-
plete acesss to and control over all the element matrices and vectors in the formulation of the
Finite Element Method (Appendix A). The following inferences can be made from analytical and
computational studies:
1. The 2
nd
order ABC is better than the 1
st
order ABC as for mesh truncation, as it introduces
fewer artifacts in the computational solution, by capturing the curvature of the eld.
2. The 2
nd
order ABC can be imposed at a smaller distance from the scatterer, than
the 1
st
order ABC, without compromising delity of the solution.
3. The Second Order ABC used by us can be imposed only on circular boundaries.
We observed that the second order curvature term contributes to large oscillations in the eld,
when evaluated over nonsmooth countours, leading to severe errors in the results.
4. For circular objects, the concentric ring meshing algorithm, described in section 4.3.1 yields
better solutions than those provided by DistMesh and COMSOL. This is because of the
symmetry of the concentric ring mesh coinciding with the symmetry of the object geometry.
5. The PML-based mesh truncation scheme is better than the one using only a First Order ABC.
6. The contrast of scattered eld distribution in the near region of the scatterer is enhanced as
the moisture content in the soil increases.
41
References
1. J. Jin, The Finite Element Method in Electromagnetics. New York: John Wiley & Sons, 1993.
2. A.C. Polycarpou, Introduction to the Finite Element Method in Electromagnetics. San Rafael:
Morgan & Claypool Publishers, 2006.
3. P. Persson and G. Strang, DistMesh A Simple Mesh Generator in MATLAB, SIAM Review,
vol. 46, no. 2, pp. 329-345, June 2004.
4. J.L. Volakis, A. Chatterjee, and L.C. Kempel, Finite Element Method for Electromagnetics:
Antennas, Microwave Circuits, and Scattering Applications. Hyderabad: Universities Press
(India) Pvt. Ltd., 2001.
5. S. Kesavan, Topics in Functional Analysis and Applications. New Delhi: New-Age Intl., 2008.
6. A. Bayliss, M. Gunzburger and E. Turkel, Boundary conditions for the numerical solution of
elliptic equations in exterior regions, SIAM J. Appl. Math., vol. 42, no. 2, April 1982.
7. C.A. Balanis, Advanced Engineering Electromagnetics. New York: John Wiley & Sons, 1989.
8. Steven G. Johnson, Notes on Perfectly Matching Layers (PMLs) [MIT Course 18.369/18.336],
August 2007. [Online]. Available: http://www-math.mit.edu/~stevenj/18.369/pml.pdf.
9. J.L. Volakis and A. Chatterjee, A selective review of the nite element-ABC and the nite
element-boundary integral methods for electromagnetic scattering, Ann. Telecommun., vol.
50, no. 5-6, pg. 499-509, May 1995.
10. J.P. Brenger, A Perfectly Matched Layer for the absorption of electromagnetic waves, J.
Comput. Phys., vol. 114, no. 2, pp. 185-200, October 1994.
11. C.M. Rappaport and S. Winton, Using the PML ABC for air-soil wave interaction modeling
in the time and frequency domains, Intl J. of Susburf. Sensing Tech. and Appl., vol. 1, no.
3, pp. 289-304, July 2000.
12. J. Jin and W.C. Chew, Combining PML and ABC for the Finite-Element analysis of scat-
tering problems, Microwave Opt. Tech. Lett., vol. 12, no. 4, pp. 192-197, July 1996.
13. Y.A. Gryazin, M.A. Klibanov, and T.R. Lucas, Two numerical methods for an inverse problem
for the 2-D Helmoltz equation, J. Comput. Phys., vol. 184, no. 1, pp. 122-148, Jan. 2003.
14. M.A. Gonzalez-Huici, U. Uschkerat, and A. Hoerdt, Numerical simulation of electromagnetic-
wave propagation for land mine detection using GPR, Geoscience and Remote Sensing Sym-
posium, July 23-28, 2007, Barcelona, Spain. IGARSS 2007. IEEE International.
15. Allan P. Engsig-Karup, An introduction to Discontinuous-Galerkin FEM for partial dif-
ferential equations, August 2009. [Online]. Available: http://www2.imm.dtu.dk/~apek/
DGFEMCourse2009/Material.php.
42
Appendix A: Finite Element Method
Formulation
We now examine the steps in a 2D FEM solution in some detail. We will assume for now that
the meshing elements are triangular, with three nodes, which are the three vertices. The resulting
meshing scheme is known as Triangular Meshing. In the scalar situation, the objective is to solve
the boundary value problem,


x
_

x
_


y
_

y
_
+ = f (x, y) (8.1)
where is the unknown function,
x
,
y
, and are known parameters associated with the physical
properties of the domain , and f is the source or excitation function. The boundary conditions to
be considered are given by
= p on
1
(8.2)
and
_

x
x +
y

y
y
_
n + = q on
2
(8.3)
where =
1
+
2
denotes the contour or boundary enclosing , n is its outward normal unit vector,
and , p, and q are known parameters associated with the physical properties of the boundary. This
is the Mixed Boundary Condition, and is a generalization of the Dirichlet and Neumann boundary
condition.
With a suitable meshing in place that breaks up the solution domain into N triangular meshes, we
seek an approximation of =
e
within each element e (e = 1, 2, . . . , N):
(x, y)
N

e=1

e
(x, y) (8.4)
A common approximation for
e
within element e is the rst order polynomial expansion,

e
(x, y) = a
e
+ b
e
x + c
e
y (8.5)
where a
e
, b
e
and c
e
are constants to be determined. An additional property of
e
is that it vanishes
outside element e.
43
Element Governing Equations
Consider a typical triangular element as shown in the gure below. The triangular mesh network
is characterized by a connectivity array n(i, e). The nodes of the triangles are numbered using a
global index. The three nodes of each triangular element are assigned numbers 1 2 3 in a
counterclockwise fashion as shown in the gure. These are referred to as local indices. Thus,
n(i, e) stores the global node number of the local index i of element e.
Figure 8.1: A typical triangular element, with local node numbering shown.
The value of
e
at nodes 1, 2 and 3 are denoted by
e1
,
e2
and
e3
respectively. Using 8.5, we have
_
_

e1

e2

e1
_
_
=
_
_
1 x
1
y
1
1 x
2
y
2
1 x
3
y
3
_
_
_
_
a
e
b
e
c
e
_
_
(8.6)
The coecients can be determined by inverting this system, that is,
_
_
a
e
b
e
c
e
_
_
=
_
_
1 x
1
y
1
1 x
2
y
2
1 x
3
y
3
_
_
1
_
_

e1

e2

e1
_
_
(8.7)
Putting together, the scalar eld
e
in element e can be written as

e
=
_
1 x y

1
2A
_
_
(x
2
y
3
x
3
y
2
) (x
3
y
1
x
1
y
3
) (x
1
y
2
x
2
y
1
)
(y
2
y
3
) (y
3
y
1
) (y
1
y
2
)
(x
3
x
2
) (x
1
x
3
) (x
2
x
1
)
_
_
_
_

e1

e2

e1
_
_
(8.8)
or

e
=
3

i=1
N
e
i
(x, y)
e
i
(8.9)
44
where
N
e
1
(x, y) =
1
2A
[(x
2
y
3
x
3
y
2
) + (y
2
y
3
)x + (x
3
x
2
)y] (8.10)
N
e
2
(x, y) =
1
2A
[(x
3
y
1
x
1
y
3
) + (y
3
y
1
)x + (x
1
x
3
)y] (8.11)
N
e
3
(x, y) =
1
2A
[(x
1
y
2
x
2
y
1
) + (y
1
y
2
)x + (x
2
x
1
)y] (8.12)
and A is the area of the element e, given by
A =
1
2

1 x
1
y
1
1 x
2
y
2
1 x
3
y
3

=
1
2
[(x
2
x
1
)(y
3
y
1
) (x
3
x
1
)(y
2
y
3
)] (8.13)
The value of A is positive if the nodes are numbered counterclockwise (starting from any node)
as shown in the gure above. The N
e
i
s are known as element shape functions and satisfy the
following properties:
N
e
i
(x
e
j
, y
e
j
) =
ij
=
_
1, i = j
0, i = j
(8.14)
3

i=1
N
e
i
(x, y) = 1 (8.15)
Weak Form
The weak form of the dierential equation


x
_

x
_


y
_

x
_
+ = f (8.16)
is

_ _

e
_

x
w
x

x
+
y
w
y

y
_
dx dy +
_ _

e
wdx dy
_

e
w
_

x
n
x
+
y

y
n
y
_
dl
=
_ _

e
wf dx dy(8.17)
where n
x
and n
y
are the direction cosines of the normal to the surface. In the Galerkin approach,
the weight functions w(x, y) are taken to be equal to the triangular interpolation functions used in
the FEM.
1
1
The triangular shape functions are:
N
1
(, ) = 1
N
2
(, ) =
N
3
(, ) =
The primary unknown quantity is interpolated within an element e as

e
(x, y) =
3

j=1

e
j
N
j
(x, y)
Here
e
j
denotes the value of the unknown quantity at local node j of element e.
45
After appropriate discretization, the weak form becomes
_ _

e
_

x
_
N
i
x
_
_
3

j=1

e
j
N
j
x
_
+
y
_
N
i
y
_
_
3

j=1

e
j
N
j
y
__
dx dy
+
_ _

e
N
i
_
3

j=1

e
j
N
j
_
dx dy =
_ _

e
N
i
g dx dy
_

e
N
i
_

x
n
x
+
y

y
n
y
_
dl
for i = 1, 2, 3 (8.18)
where
e
is the solution domain corresponding to element e and
e
denotes the boundary curve of
element e (in this case, a triangle). This equation can be represented in a matrix form given by
_
_
M
e
11
M
e
12
M
e
13
M
e
21
M
e
22
M
e
23
M
e
31
M
e
32
M
e
33
_
_
_
_
_

e
1

e
2

e
3
_
_
_
+
_
_
T
e
11
T
e
12
T
e
13
T
e
21
T
e
22
T
e
23
T
e
31
T
e
32
T
e
33
_
_
_
_
_

e
1

e
2

e
3
_
_
_
=
_
_
_
g
e
1
g
e
2
g
e
3
_
_
_
+
_
_
_
p
e
1
p
e
2
p
e
3
_
_
_
(8.19)
where
M
e
ij
=
_ _

e
_

x
_
N
i
x
__
N
j
x
_
+
y
_
N
i
y
__
N
j
y
__
dx dy (8.20)
T
e
ij
=
_ _

e
N
i
N
j
dx dy (8.21)
g
e
i
=
_ _
N
i
f dx dy (8.22)
p
e
i
=
_

e
N
i
_

x
n
x
+
y

y
n
y
_
dl (8.23)
The matrix system (8.19) can be written more compactly as
_
_
K
e
11
K
e
12
K
e
13
K
e
21
K
e
22
K
e
23
K
e
31
K
e
32
K
e
33
_
_
_
_
_

e
1

e
2

e
3
_
_
_
=
_
_
_
b
e
1
b
e
2
b
e
3
_
_
_
(8.24)
where
K
e
ij
= M
e
ij
+ T
e
ij
(8.25)
b
e
i
= g
e
i
+ p
e
i
(8.26)
Element Matrices and Vectors
Let i j k be a cyclic permutation of 1 2 3. Then, the elements of matrices M and T are
given by the following expressions.
M
e
ii
=
_

x
(y
jk
)
2
4A
e
+
y
(x
kj
)
2
4A
e
_
(8.27)
M
e
ij
=
_

x
y
jk
y
ki
4A
e
+
y
x
kj
x
ik
4A
e
_
(8.28)
T
e
ij
=
A
e
12
(1 +
ij
) (8.29)
46
Here A
e
denotes the area of the triangular element e, and x
ij
= x
e
i
x
e
j
, y
ij
= y
e
i
y
e
j
. The elements
of vector g
e
are given by
g
e
1
=
fA
e
3
(8.30)
g
e
2
=
fA
e
3
(8.31)
g
e
3
=
fA
e
3
(8.32)
if f does not appreciably vary over the element. A more general set of matrix equations for a
geometry with N
e
elements and M
s
Dirichlet/Neumann segments is given by
Ne

e=1
([K
e
]{
e
} {b
e
}) +
Ms

e=1
([K
s
]{
s
} {b
s
}) = 0 (8.33)
where the matrices have been suitably augmented, and the individual elements are given by
K
e
ij
=
1
4A
e
(
e
x
b
e
i
b
e
j
+
e
y
c
e
i
c
e
j
) +
A
e
12

e
(1 +
ij
) for i, j = 1, 2, 3 (8.34)
b
e
i
=
__

e
f(x, y)N
e
i
(x, y)dx dy for i = 1, 2, 3 (8.35)
K
s
ij
=
_
1
0
N
s
i
N
s
j
l
s
d for i, j = 1, 2 (8.36)
b
s
i
=
_
1
0
qN
s
i
l
s
d for i = 1, 2 (8.37)
This alternate system of equations is more useful if more general boundary conditions
have to be imposed. The values of the other matrix and vector elements are dependent on whether
a rst order ABC (Appendix B) is used or a second order ABC (Appendix C). Assuming that the
matrix elements have been dened properly in accordance with the chosen absorbing boundary
condition, the remaining procedure is as follows.
Integration over an arbitrary triangular patch
The integral expression
b
e
i
=
__

e
f(x, y)N
e
i
(x, y)dx dy for i = 1, 2, 3 (8.38)
is zero in the total eld formulation because f = 0 there, but if one works in the scattered eld
formulation, this term arises frequently. Also, if or vary inside an element, we have to use the
integral expression for K
e
ij
itself, which involves a similar double integral. Since this integral is over
an arbitrary triangular patch, the x and y integrals are coupled. We now give a nonlinear transfor-
mation from an arbitrary triangular patch to a square which allows this integral to be carried out
very simply using numerical integration, for every element.
47
Consider the integral
_

e
g(x, y)dx dy. In order to simplify the numerical integration and not have
to consider various cases for the slopes of the edges of the triangular element, and its orientation
with respect to the axes, we dene the following nonlinear transformation
x(u, v) = (1 u)x
e
1
+ u[(1 v)x
e
2
+ vx
e
3
] (8.39)
y(u, v) = (1 u)y
e
1
+ u[(1 v)y
e
2
+ vy
e
3
] (8.40)
This transformation maps the arbitrarily shaped and oriented triangular region
e
in (x, y) space
to a square in (u, v) space, that is {(u, v) : 0 u 1, 0 v 1}. The Jacobian matrix of the
transformation is given by
J =
_
x
e
1
+ (1 v)x
e
2
+ vx
e
3
ux
e
2
+ ux
e
3
y
e
1
+ (1 v)y
e
2
+ vy
e
3
uy
e
2
+ uy
e
3
_
(8.41)
Hence, the integral becomes
__

e
g(x, y)dxdy =
_
1
u=0
_
1
v=0
g(x(u, v), y(u, v))|J|dudv (8.42)
where
|J|(u, v) = (x
e
1
+ (1 v)x
e
2
+ vx
e
3
)(uy
e
2
+ uy
e
3
) (y
e
1
+ (1 v)y
e
2
+ vy
e
3
)(ux
e
2
+ ux
e
3
) (8.43)
Dirichlet Boundary Conditions
Let the prescribed values of be stored in a vector C(i) and let there by N

nodes on
1
, whose
global node numbers are stored in a vector DBC(i). Then, the Dirichlet boundary condition is
enforced by setting
b
DBC(i)
= C(i), K
DBC(i),DBC(i)
= 1, K
DBC(i),j
= 0 for j = DBC(i) (8.44)
b
j
b
j
K
j,DBC(i)
C(i), K
j,DBC(i)
= 0 for j = DBC(i) (8.45)
for each i = 1, 2, . . . , N

. In this problem, C(i) = 0 i = 1, 2, . . . , N

.
Assembly of K
e
, K
s
into K
The rst step is the assembly of K
e
into K (for e = 1, 2, . . . nElements), the pseudocode for which
is given below.
Assemble K
e
into K
1 for e 1 to nElements
2 do
3 for i 1 to 3
4 do
5 for j 1 to 3
6 do K(N(e, i), N(e, j)) K(N(e, i), N(e, j)) + K
e
(i, j)
7 end for
8 end for
9 end for
48
The connectivity array for ABC segments, ns(i, s), denoted by NS(s, i) in the code, is constructed
once the segments s (for s = 1, 2, . . . , nSegABC) lying on the ABC boundary have been identied.
Each such segment s consists of two nodes, and so NS(s, i) serves a similar purpose for the ABC
as does N(e, i) for the Dirichlet condition and for general-purpose indexing of the nodes. The
pseudocode for assembling K
s
into K is given below.
Assemble K
s
into K
1 for s 1 to nSegABC
2 do
3 for i 1 to 2
4 do
5 for j 1 to 2
6 do K(NS(s, i), NS(s, j)) K(NS(s, i), NS(s, i)) + K
s
(i, j)
7 end for
8 end for
9 end for
Solution of the Linear System
After setting up K and b as described above, the nodal elds are determined by solving the linear
system,
Ku = b (8.46)
Using element shape functions, the unknown eld can be interpolated within any element given its
values at the three nodes of that element. A ne discretization of the solution domain yields a more
accurate solution for the nodal elds than a relatively coarse discretization. The interpolation can be
improved by increasing the number of points within each element at which the linear interpolation
scheme is employed. The code developed here allows the user to change both these parameters so
as to be able to rene the solution as required.
49
Appendix B: First Order Absorbing
Boundary Condition
The rst order Absorbing Boundary condition has the form

sc

+
_
jk
0
+
1
2
_

sc
= 0 (8.47)
The mixed boundary condition on a curve
2
is given by
_

x
a
x
+
y

y
a
y
_
a
n
+ = q (8.48)
which, in this case, is used to enforce the rst order absorbing boundary condition [3], given by

sc

+
_
jk
0
+
1
2
_

sc
= 0 (8.49)
Here,
sc
is the scattered eld. For this problem,
sc
= E
sc
z
= E
z
E
inc
z
. In free space
r
= 1, and
the -direction is normal to the outer boundary
2
on which the ABC is to be imposed. Therefore,
_
E
z
x
a
x
+
E
z
y
a
y
_
a
n
=
E
z

(8.50)
= jk
0
+
1
2
(8.51)
q = jk
0
E
inc
z
( a
x
a
n
) +
_
jk
0
+
1
2
_
E
inc
z
(8.52)
To summarize, a rst order ABC on boundary
2
can be imposed through the use of the
mixed boundary condition with the assignment of and q according to the above equations.
In the program, these boundary conditions are imposed on the discretized solution domain, after
determining the connectivity arrays n(e, i) and ns(s, i) [1]. The outer boundary
2
is chosen to be
a circular boundary with radius
ABC
.
In enforcing the ABC, there are three cases to consider for each element e, accordingly as which
one of the three edges lies on the ABC. These cases are listed below, along with the corresponding
values of p
e
i
(for i = 1, 2, 3) that must be assigned. Here l
ij
denotes the length of edge i j.
50
Figure 8.2: Case I: Edge 1 2 lies on the ABC boundary
Case 1: Edge 1 2 lies on the ABC boundary
p
e
1
= E
0
q
0
l
12
e
jk
0
x
e
1
_
1 jk
0
x
21
e
jk
0
x
21
(k
0
x
21
)
2
_
(8.53)
p
e
2
= E
0
q
0
l
12
e
jk
0
x
e
1
_
1 + (jk
0
x
21
+ 1)e
jk
0
x
21
(k
0
x
21
)
2
_
(8.54)
p
e
3
= 0 (8.55)
where
q
0
=
jk
0
(y
e
2
y
e
1
)
l
12
(8.56)
Case 2: Edge 3 1 lies on the ABC boundary
p
e
1
= E
0
q
0
l
12
e
jk
0
x
e
3
_
1 + (jk
0
x
13
+ 1)e
jk
0
x
13
(k
0
x
13
)
2
_
(8.57)
p
e
2
= 0 (8.58)
p
e
3
= E
0
q
0
l
13
e
jk
0
x
e
3
_
1 jk
0
x
13
e
jk
0
x
13
(k
0
x
13
)
2
_
(8.59)
where
q
0
=
jk
0
(y
e
1
y
e
3
)
l
13
(8.60)
Case 3: Edge 2 3 lies on the ABC boundary
p
e
1
= 0 (8.61)
p
e
2
= E
0
q
0
l
23
e
jk
0
x
e
2
_
1 jk
0
x
32
e
jk
0
x
32
(k
0
x
32
)
2
_
(8.62)
p
e
3
= E
0
q
0
l
12
e
jk
0
x
e
2
_
1 + (jk
0
x
32
+ 1)e
jk
0
x
32
(k
0
x
32
)
2
_
(8.63)
where
q
0
=
jk
0
(y
e
3
y
e
2
)
l
23
(8.64)
In the alternate formulation (8.33 8.37), the elements of K
s
are given by
K
s
(i, j) =
l
s
6
(1 +
ij
) (8.65)
51
Appendix C: Second Order Absorbing
Boundary Condition
In this appendix, the exact details of how the second order ABC is discretized and imposed on a
circular boundary, are described.
Let
2
denote the surface over which the second order absorbing boundary condition (2-ABC)
is to be imposed. The boundary condition of the third kind is given by
_

x
n
x
+
y

y
n
y
_
+ = q on
2
(8.66)
The absorbing boundary condition must be recast in this canonical form so as to determine the
elements of the vector p
e
(c.f. Appendix A). The 2-ABC is expressible in this form if we split as
=
inc
+
sc
, that is, as a sum of an incident eld and a scattered eld, and identify and q to
be given by
2
=
_
jk
0
+

2

j
2
8(j k
0
)

j
2(j k
0
)

2
s
2
_
(8.67)
q =

inc
n
+
_
jk
0
+

2

j
2
8(j k
0
)
_

inc

j
2(j k
0
)

inc
s
2
(8.68)
In order to incorporate the general boundary condition of the third kind, contributions from the
functional
F
b
=
_

2
_
1
2
q
_
d (8.69)
must be accounted for in the weak form given. Here, has been sandwiched by the unknown eld.
This is because is self-adjoint, assuming
2
to be a smooth closed contour, and is now an operator
rather than a scalar function as it was in case of the rst order ABC [1]. To further simplify the
analysis, we write
=
1
+
2

2
s
2
(8.70)
with

1
=
_
jk
0
+

2

j
2
8(j k
0
)
_
(8.71)

2
=
j
2(j k
0
)
(8.72)
2
It is assumed hereafter that
x
=
y
= .
52
We can write F
b
as
F
b
=
_

2
_
1
2
_

2
+
2

s
2
_
q
_
d (8.73)
=
_

2
_
1
2

1
2

2
_

s
_
2
q
_
d (8.74)
where integration by parts has been carried out on the second term of equation (8.73), assuming

2
is indeed a smooth closed contour. The negative sign here is incorrectly stated as a positive sign
in Jin [1]. The next step is to discretize F
b
over each element as was done for the 1-ABC:
F
b
=
Ms

s=1
F
s
b
(
s
) (8.75)
where F
s
b
denotes the integral over segment s. Dierentiating with respect to
s
i
gives the matrix
system
_
F
s
b

s
_
= [K
s
]{
s
} {b
s
} (8.76)
with the elements in [K
s
] and {b
s
} given by
K
s
ij
=
_
1
0
N
s
i
N
s
j
l
s
d i, j = 1, 2 (8.77)
b
s
i
=
_
1
0
qN
s
i
l
s
d i = 1, 2 (8.78)
with q given by (6.69). For the 2-ABC, the expression for K
s
ij
is given by
K
s
ij
=
_
1
0
_

1
l
s
N
s
i
N
s
j


2
l
s
N
s
i

N
s
j

_
d (8.79)
Here N
s
1
() = 1 and N
s
2
() = , so that N
s
1
() + N
s
2
() = 1. This gives us
K
s
11
= K
s
22
=
s
1
l
s
3
+

s
2
l
s
(8.80)
K
s
12
= K
s
21
=
s
1
l
s
6


s
2
l
s
(8.81)
Evaluation of p
e
i
There are three cases to consider while imposing the 2
nd
order ABC on a circular boundary, de-
pending on which edge of a triangular boundary element lies on the ABC contour. These three
cases are similar to those considered in the 1
nd
order ABC in Appendix B, but the expressions for
p
e
i
are considerably more complex because of the structure of the function q in (8.68), and the fact
that is now a dierential operator.
53
The unknown eld is = E
z
and
inc
= E
inc
z
= E
0
e
jk
0
x
. Now, q becomes
q(x, y) =
jk
0
E
0

xe
jk
0
x
+
_
jk
0
+

2

j
2
8(j k
0
)
_
E
0
e
jk
0
x

j
2(j k
0
)
_
jk
0
x

2

k
2
0
y
2

_
E
0
e
jk
0
x
(8.82)
Since p
e
i
involves line integrals of q, we can express the edge along which the line integral is to be
computed through the slope-intercept form of a straight line,
y = mx + c (8.83)
thereby converting q to a function of x alone along the edge under consideration. For simplication,
we dene
a =
jk
0
E
0

(8.84)

b =
_
jk
0
+

2

j
2
8(j k
0
)
_
E
0
(8.85)
c
1
=
k
0
E
0
2(j k
0
)
2
(8.86)
c
2
=
jk
2
0
E
0
2(j k
0
)
(8.87)
We assume that is constant over the edge (contour) of integration. This is an approximation
because is constant only over the circular ABC boundary, not over any edge of the polygon that is
the discretized version of this boundary. Such an approximation was made in case of the 1-ABC as
well. We expect that due to ne graining of the 2-ABC, this approximation will aect its accuracy
less than in case of the 1-ABC. However, this approximation is not so poor, because we can increase
the neness of the mesh, which would decrease the edge length of the approximate polygon and
make it closer to the actual circular boundary. With this assumption, a, b, c
1
and c
2
are global
constants and we have
q(x, y) = axe
jk
0
x
+

be
jk
0
x
+ c
1
xe
jk
0
x
+ c
2
y
2
e
jk
0
x
(8.88)
Further, substituting y = mx + c, we get
q(x) A
1
e
jk
0
x
+ A
2
xe
jk
0
x
+ A
3
x
2
e
jk
0
x
(8.89)
where
A
1
=

b + c
2
c
2
(8.90)
A
2
= 2c
2
cm + c
1
+ a (8.91)
A
3
= c
2
m
2
(8.92)
Case 1: Edge 1 2 lies on the ABC boundary
In this case,
m =
y
2
y
1
x
2
x
1
and c =
x
1
y
2
x
2
y
1
x
2
x
1
(8.93)
54
The line can be parametrized as
x = x
1
+ (x
2
x
1
) (8.94)
y = y
1
+ (y
2
y
1
) (8.95)
where [0, 1]. This allows us to recast q in the form
q() (

A
1
+

A
2
+

A
3

2
)e
jk
0
x
21

(8.96)
where

A
1
= (A
1
+ A
2
x
1
+ A
3
x
2
1
)e
jk
0
x
1
(8.97)

A
2
= (A
2
+ 2A
3
x
1
)x
21
e
jk
0
x
1
(8.98)

A
3
= A
3
x
2
21
e
jk
0
x
1
(8.99)
The integrals dening the elements of p
e
are:
p
e
1
=
_
1
0
(1 )q l
12
d (8.100)
p
e
2
=
_
1
0
q l
12
d (8.101)
p
e
3
= 0 (8.102)
Thus, the elements of p
e
are:
p
e
1
=
l
12
(k
0
x
21
)
4
_
2

A
3
(3 jk
0
x
21
) + k
0
x
21
_

A
1
k
0
x
21
(1 + jk
0
x
21
) +

A
2
(2j + k
0
x
21
)
_
+
e
jk
0
x
21
_
k
0
x
21
(

A
1
k
0
x
21
+

A
2
(2j + k
0
x
21
)) +

A
3
(6 + k
0
x
21
(4j + k
0
x
21
))
__
p
e
2
=
l
12
(k
0
x
21
)
4
_
6

A
3
+ k
0
x
21
(2j

A
2


A
1
k
0
x
21
) +
e
jk
0
x
21
_
6

A
3
2j(

A
2
+ 3

A
3
)k
0
x
21
+ (

A
1
+ 2

A
2
+ 3

A
3
)k
2
0
x
2
21
+ j(

A
1
+

A
2
+

A
3
)k
3
0
x
3
21
__
p
e
3
= 0
where x
ij
= x
i
x
j
. If x
21
= 0, we can write
q(y) = q
1
+ q
2
y
2
(8.103)
where
q
1
= axe
jk
0
x
1
+

be
jk
0
x
1
+ c
1
x
1
e
jk
0
x
1
(8.104)
q
2
= c
2
e
jk
0
x
1
(8.105)
55
In this case, the elements of p
e
become
p
e
1
= l
12
_
1
0
(1 )(q
1
+ q
2
(y
1
+ (y
2
y
1
))
2
)d
= l
12
_

q
1
2

q
2
y
2
1
4

q
2
y
1
y
2
6

q
2
y
2
2
12
_
p
e
2
= l
12
_
1
0
(q
1
+ q
2
(y
1
+ (y
2
y
1
))
2
)d
= l
12
_

q
1
2

q
2
y
2
1
12

q
2
y
1
y
2
6

q
2
y
2
2
4
_
p
e
3
= 0
Case 2: Edge 3 1 lies on the ABC boundary
In this case, the expressions listed for case 1 above, can be used by making the following transfor-
mations:
x
1
x
3
x
2
x
1
y
1
y
3
y
2
y
1
l
12
l
31
The slope and intercept are given by
m =
y
1
y
3
x
1
x
3
and c =
x
3
y
1
x
1
y
3
x
1
x
3
(8.106)
so that
q() (

A
1
+

A
2
+

A
3

2
)e
jk
0
x
13

(8.107)
where

A
1
= (A
1
+ A
2
x
3
+ A
3
x
2
3
)e
jk
0
x
3
(8.108)

A
2
= (A
2
+ 2A
3
x
3
)x
13
e
jk
0
x
3
(8.109)

A
3
= A
3
x
2
13
e
jk
0
x
3
(8.110)
with A
i
(i = 1, 2, 3), given by equations (8.97 8.99) and m and c given by equation (8.106). The
integrals dening the elements of p
e
are:
p
e
1
=
_
1
0
q l
31
d (8.111)
p
e
2
= 0 (8.112)
p
e
3
=
_
1
0
(1 )q l
31
d (8.113)
56
Thus, the elements of p
e
are:
p
e
1
=
l
31
(k
0
x
13
)
4
_
6

A
3
+ k
0
x
13
(2j

A
2


A
1
k
0
x
13
) +
e
jk
0
x
13
_
6

A
3
2j(

A
2
+ 3

A
3
)k
0
x
13
+ (

A
1
+ 2

A
2
+ 3

A
3
)k
2
0
x
2
13
+ j(

A
1
+

A
2
+

A
3
)k
3
0
x
3
13
__
p
e
2
= 0
p
e
3
=
l
31
(k
0
x
13
)
4
_
2

A
3
(3 jk
0
x
13
) + k
0
x
13
_

A
1
k
0
x
13
(1 + jk
0
x
13
) +

A
2
(2j + k
0
x
13
)
_
+
e
jk
0
x
13
_
k
0
x
13
(

A
1
k
0
x
13
+

A
2
(2j + k
0
x
13
)) +

A
3
(6 + k
0
x
13
(4j + k
0
x
13
))
__
If x
13
= 0, we can write
q(y) = q
1
+ q
2
y
2
(8.114)
where
q
1
= axe
jk
0
x
3
+

be
jk
0
x
3
+ c
1
x
3
e
jk
0
x
3
(8.115)
q
2
= c
2
e
jk
0
x
3
(8.116)
In this case, the elements of p
e
become
p
e
1
= l
31
_
1
0
(q
1
+ q
2
(y
3
+ (y
1
y
3
))
2
)d
= l
31
_

q
1
2

q
2
y
2
3
12

q
2
y
3
y
1
6

q
2
y
2
1
4
_
p
e
2
= 0
p
e
3
= l
31
_
1
0
(1 )(q
1
+ q
2
(y
3
+ (y
1
y
3
))
2
)d
= l
31
_

q
1
2

q
2
y
2
3
4

q
2
y
3
y
1
6

q
2
y
2
1
12
_
Case 3: Edge 2 3 lies on the ABC boundary
In this case, the expressions listed for case 1 above, can be used by making the following transfor-
mations:
x
1
x
2
x
2
x
3
y
1
y
2
y
2
y
3
l
12
l
23
The slope and intercept are given by
m =
y
3
y
2
x
3
x
2
and c =
x
2
y
3
x
3
y
2
x
3
x
2
(8.117)
57
so that
q() (

A
1
+

A
2
+

A
3

2
)e
jk
0
x
32

(8.118)
where

A
1
= (A
1
+ A
2
x
2
+ A
3
x
2
2
)e
jk
0
x
2
(8.119)

A
2
= (A
2
+ 2A
3
x
2
)x
32
e
jk
0
x
2
(8.120)

A
3
= A
3
x
2
32
e
jk
0
x
2
(8.121)
with A
i
(i = 1, 2, 3), given by equations (8.97 8.99) and m and c given by equation (8.117). The
integrals dening the elements of p
e
are:
p
e
1
= 0 (8.122)
p
e
2
=
_
1
0
(1 )q l
23
d (8.123)
p
e
3
=
_
1
0
q l
23
d (8.124)
Thus, the elements of p
e
are:
p
e
1
= 0
p
e
2
=
l
23
(k
0
x
32
)
4
_
2

A
3
(3 jk
0
x
32
) + k
0
x
32
_

A
1
k
0
x
32
(1 + jk
0
x
32
) +

A
2
(2j + k
0
x
32
)
_
+
e
jk
0
x
32
_
k
0
x
32
(

A
1
k
0
x
32
+

A
2
(2j + k
0
x
32
)) +

A
3
(6 + k
0
x
32
(4j + k
0
x
32
))
__
p
e
3
=
l
23
(k
0
x
32
)
4
_
6

A
3
+ k
0
x
32
(2j

A
2


A
1
k
0
x
32
) +
e
jk
0
x
32
_
6

A
3
2j(

A
2
+ 3

A
3
)k
0
x
32
+ (

A
1
+ 2

A
2
+ 3

A
3
)k
2
0
x
2
32
+ j(

A
1
+

A
2
+

A
3
)k
3
0
x
3
32
__
If x
32
= 0, we can write
q(y) = q
1
+ q
2
y
2
(8.125)
where
q
1
= axe
jk
0
x
2
+

be
jk
0
x
2
+ c
1
x
2
e
jk
0
x
2
(8.126)
q
2
= c
2
e
jk
0
x
2
(8.127)
In this case, the elements of p
e
become
p
e
1
= 0
p
e
2
= l
23
_
1
0
(1 )(q
1
+ q
2
(y
2
+ (y
3
y
2
))
2
)d
= l
23
_

q
1
2

q
2
y
2
2
4

q
2
y
2
y
3
6

q
2
y
2
3
12
_
p
e
3
= l
23
_
1
0
(q
1
+ q
2
(y
2
+ (y
3
y
2
))
2
)d
= l
23
_

q
1
2

q
2
y
2
2
12

q
2
y
2
y
3
6

q
2
y
2
3
4
_
58
Appendix D: COMSOL Results
Figure 8.3: Scattered Fields from PEC Cylinder in Air: ABC vs PML (Fig. 7.12)
59
Figure 8.4: Scattering from Dielectric Cylinder in Air: ABC vs PML (Fig. 7.13)
60
Figure 8.5: Scattering from PEC Cylinder buried under Soil (z-component of total eld for dry soil
(top) and wet soil (bottom).) (Fig. 7.14)
61
Figure 8.6: Scattering from Dielectric Cylinder buried under Soil (z-component of total eld for
dry soil (top) and wet soil (bottom). (Fig. 7.15)
62
Appendix E: MATLAB Codes for Meshing
2D Regions
In this appendix, we list code fragments for constructing meshes for the geometries considered in
this report. Each code fragment will generate the following quantities required by the FEM (c.f.
Appendix A):
Connectivity array N(e, i): this is a n
e
3 matrix, each row of which stores the global node
numbers of the three nodes making up element e. Here n
e
denotes the total number of
triangular elements in the mesh.
x and y coordinates of each node in the mesh.
8.1 Meshing Code for Cylinder
lambda = 1;
rCyl = 0.5
*
lambda; % Radius of the circular PEC cylinder in wavelengths
rABC = 1.5
*
lambda; % Radius of the outer circular ABC boundary in wavelengths
h = 0.04
*
lambda; % Discretization size in wavelengths
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CONSTRUCT TRIANGULAR MESH
%
% Constructs a mesh of the circular solution domain with as many
% equilateral triangles as possible. The rest of the domain is
% filled with skewed triangles.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nRing = ceil((rABCrCyl)/(sqrt(3)
*
h/2)); % No. of annular rings
dr = (rABCrCyl)/nRing; % Radial step size
% Define nodes on the periphery of each annular ring
nNodes = 0; % Total number of nodes
for j = 1:1:(nRing+1)
r = rCyl + (j1)
*
dr; % determine the radius of the j^th annular ring
nPoints = ceil(2
*
pi
*
r/h); % no. of nodes on the bdary of the j^th ring
dphi = 2
*
pi/nPoints; % incremental angle from one node to the next
for jj = 1:1:nPoints
nNodes = nNodes + 1; % increment total number of nodes
phi = (jj1)
*
dphi; % absolute angular coordinate of current
63
x(nNodes) = r
*
cos(phi); % xcoordinate of current node
y(nNodes) = r
*
sin(phi); % ycoordinate of current node
end
end
% Triangulate using Delaunay Triangulation
tri = delaunay(x, y);
% At this point, triplot(tri,x,y) shows that the region within the PEC
% has also been meshed, so we must eliminate the triangles in this region.
% Eliminate triangles within PEC
nElements = 0; % No of elements
% length(tri) = size(tri,1) = number of elements
% (before removal of elements interior to PEC)
for j = 1:1:length(tri)
rem = 0;
for jj = 1:1:3
r0 = sqrt(x(tri(j,jj))^2 + y(tri(j,jj))^2); % determine radius of pt
if (abs(rCyl r0) < 0.0001
*
rCyl) % check for interioricity
rem = rem + 1;
end
end
if (rem 2)
nElements = nElements + 1; % increment number of (valid) elements
N(nElements,:) = tri(j,:); % element connectivity array n(e, i)
end
end
% N(e, i) is the connectivity array
% The global node coordinates are stored in x and y
% To access the global node coordinates of node i of element e, use
% X = x(N(e,i)), Y = y(N(e,i))
% Delaunay Triangulation does not order nodes in a CCW orientation as
% required by the FEM algorithm. So, we have to reorient the local
% node numbering. The criterion is that if a triangle has a negative area
% computed using the expression for area when the nodes are CCW oriented,
% then the nodes must be renumbered.
for e=1:1:nElements
x21 = x(N(e,2)) x(N(e,1));
x31 = x(N(e,3)) x(N(e,1));
y21 = y(N(e,2)) y(N(e,1));
y31 = y(N(e,3)) y(N(e,1));
Ae = 0.5
*
(x21
*
y31 x31
*
y21);
if Ae < 0
% simple swap of node numbers
temp = N(e, 2);
N(e, 2) = N(e, 3);
N(e, 3) = temp;
end
end
64
% Plot the mesh
figure;
triplot(N, x, y);
title('Mesh');
xlabel('x (wavelengths)');
ylabel('y (wavelengths)');
axis([rABC rABC rABC rABC]);
axis square;
8.2 Meshing Code for O-center Cylinder
rABC = 1.5; % radius of ABC boundary (in wavelengths)
rCyl = 0.5; % radius of cylinder (in wavelengths)
cx = 0; % xcoordinate of center of cylinder
cy = 0.5; % ycoordinate of center of cylinder
h = 0.04; % discretization size (in wavelengths)
% Define geometry in distmesh
fs = sprintf('ddiff(dircle(p,0,0,%f),dcircle(p,%f,%f,%f))',rABC,cx,cy,rCyl);
fd = inline(fs,'p');
box=[rABC,rABC;rABC,rABC];
[p,N]=distmesh2d(fd,@huniform,h,box,[]); % call distmesh
[p,N]=fixmesh(p,N); % remove multiple points
% Delaunay Triangulation does not order nodes in a CCW orientation as
% required by the FEM algorithm. So, we have to reorient the local
% node numbering. The criterion is that if a triangle has a negative area
% computed using the expression for area when the nodes are CCW oriented,
% then the nodes must be renumbered.
for e=1:1:nElements
x21 = x(N(e,2)) x(N(e,1));
x31 = x(N(e,3)) x(N(e,1));
y21 = y(N(e,2)) y(N(e,1));
y31 = y(N(e,3)) y(N(e,1));
Ae = 0.5
*
(x21
*
y31 x31
*
y21);
if Ae < 0
% simple swap of node numbers
temp = N(e, 2);
N(e, 2) = N(e, 3);
N(e, 3) = temp;
end
end
8.3 Meshing Code for Square Object
clear fem; % Clear fem object (previously stored, if any)
rABC = 1.5; % radius of ABC boundary (in wavelengths)
65
aSq = 0.5; % side of square (in wavelengths)
h = 0.04; % discretization size (in wavelengths)
% Define geometry in comsol
fem.geom=circ2(rABC)rotate(rect2(sSq,aSq),0);
fem.mesh=meshinit(fem,'hmax',h);
figure,meshplot(fem);
axis([rABC rABC rABC rABC]);
axis square;
% Extract connectivity matrix and vertex coordianates from COMSOL's
% data structure
el = get(fem.mesh,'el');
N = el{3}.elem'; % connectivity matrix
pt = get(fem.mesh,'p');
p = pt';
x = p(:,1); % x coordinates
y = p(:,2); % y coordinates
% Delaunay Triangulation does not order nodes in a CCW orientation as
% required by the FEM algorithm. So, we have to reorient the local
% node numbering. The criterion is that if a triangle has a negative area
% computed using the expression for area when the nodes are CCW oriented,
% then the nodes must be renumbered.
for e=1:1:nElements
x21 = x(N(e,2)) x(N(e,1));
x31 = x(N(e,3)) x(N(e,1));
y21 = y(N(e,2)) y(N(e,1));
y31 = y(N(e,3)) y(N(e,1));
Ae = 0.5
*
(x21
*
y31 x31
*
y21);
if Ae < 0
% simple swap of node numbers
temp = N(e, 2);
N(e, 2) = N(e, 3);
N(e, 3) = temp;
end
end
8.4 Meshing Code for Concave Object
clear fem; % Clear fem object (previously stored, if any)
rABC = 1.5; % radius of ABC boundary (in wavelengths)
h = 0.04; % discretization size (in wavelengths)
% Define geometry in comsol
fem.geom = circ2(rABC) arc2(0.2,0,0.2,0.5,pi,pi/3,5
*
pi/3);
fem.mesh = meshinit(fem,'hmax',h);
figure,meshplot(fem);
axis([rABC rABC rABC rABC]);
axis square;
66
% Extract connectivity matrix and vertex coordianates from COMSOL's
% data structure
el = get(fem.mesh,'el');
N = el{3}.elem'; % connectivity matrix
pt = get(fem.mesh,'p');
p = pt';
x = p(:,1); % x coordinates
y = p(:,2); % y coordinates
% Delaunay Triangulation does not order nodes in a CCW orientation as
% required by the FEM algorithm. So, we have to reorient the local
% node numbering. The criterion is that if a triangle has a negative area
% computed using the expression for area when the nodes are CCW oriented,
% then the nodes must be renumbered.
for e=1:1:nElements
x21 = x(N(e,2)) x(N(e,1));
x31 = x(N(e,3)) x(N(e,1));
y21 = y(N(e,2)) y(N(e,1));
y31 = y(N(e,3)) y(N(e,1));
Ae = 0.5
*
(x21
*
y31 x31
*
y21);
if Ae < 0
% simple swap of node numbers
temp = N(e, 2);
N(e, 2) = N(e, 3);
N(e, 3) = temp;
end
end
8.5 Meshing Code for Two Objects
clear fem; % Clear fem object (previously stored, if any)
rABC = 1.5; % radius of ABC boundary (in wavelengths)
aSq = 0.5; % side of square (in wavelengths)
h = 0.04; % discretization size (in wavelengths)
% Define geometry in comsol
fem.geom=circ2(rABC)arc2(0.1,0.8,0.1,0.3,pi,pi/3,5
*
pi/3)rotate(rect2(0.2,0.2),3
*
pi/2);
fem.mesh=meshinit(fem,'hmax',h);
figure,meshplot(fem);
axis([rABC rABC rABC rABC]);
axis square;
% Extract connectivity matrix and vertex coordianates from COMSOL's
% data structure
el = get(fem.mesh,'el');
N = el{3}.elem'; % connectivity matrix
pt = get(fem.mesh,'p');
p = pt';
x = p(:,1); % x coordinates
y = p(:,2); % y coordinates
67
% Delaunay Triangulation does not order nodes in a CCW orientation as
% required by the FEM algorithm. So, we have to reorient the local
% node numbering. The criterion is that if a triangle has a negative area
% computed using the expression for area when the nodes are CCW oriented,
% then the nodes must be renumbered.
for e=1:1:nElements
x21 = x(N(e,2)) x(N(e,1));
x31 = x(N(e,3)) x(N(e,1));
y21 = y(N(e,2)) y(N(e,1));
y31 = y(N(e,3)) y(N(e,1));
Ae = 0.5
*
(x21
*
y31 x31
*
y21);
if Ae < 0
% simple swap of node numbers
temp = N(e, 2);
N(e, 2) = N(e, 3);
N(e, 3) = temp;
end
end
68
Appendix F: MATLAB FEM Codes
The code fragement in this section is to be executed after one of the meshing codes in Appendix D
has been executed, so that the mesh is well dened.
8.6 First Order ABC
% This program solves for the total electric field in a region bounded
% by a circular boundary, using the Nodal 2D Finite Element Method.
% The 1st order ABC is imposed on the boundary.
% It is assumed on entering this code that the mesh is well defined and
% p(:,1) = xcoordinates of vertices
% p(:,2) = ycoordinates of vertices
% N = node connectivity matrix (properly ordered)
% Define x and y coordinate vectors for use below
x = p(:,1);
y = p(:,2);
% Lets find boundary edges
be = boundedges(p,N);
hold on;
for i=1:length(be)
x1=x(be(i,1)); x2=x(be(i,2));
y1=y(be(i,1)); y2=y(be(i,2));
line([x1 x2],[y1 y2],'Color','b','LineWidth',1.5); % Plot the boundary edges
end
nDBC = 0; % no of Dirichlet Boundary Condition nodes
nABC = 0; % no of ABC nodes
nInt = 0; % no of internal nodes
nNodes=length(p); % total no of nodes
DBC(1) = 0;
% Determine the ABC and DBC nodes
for jj=1:1:nNodes
r0 = sqrt(x(jj)^2+y(jj)^2);
if(abs(rABCr0)<0.0001
*
rABC) % ABC will be imposed on a circle always
nABC=nABC+1;
ABC(nABC)=jj;
else % either an internal node or a node on the object (scatterer)
% if jj is an element of the be (bound edges) array
% then it is a node on the object hence a DBC node
69
% otherwise it is an internal node
index=ArrSearch(be,jj);
if(index = 1) % DBC node
nDBC=nDBC+1;
DBC(nDBC)=jj;
else % internal node
nInt=nInt+1;
INT(nInt)=jj;
end
end
end
% flag each node
% flag = 1 for ABC node
% = 0 for internal node
% = 1 for DBC node
flag = zeros(nElements,3);
for e=1:nElements
for i=1:3
index=ArrSearch(ABC,N(e,i));
if (index = 1)
flag(e,i) = 1; % ABC node
else
index=ArrSearch(DBC,N(e,i));
if(index = 1)
flag(e,i) = 1; % DBC node
else
flag(e,i) = 0; % internal node
end
end
end
end
% Create NS(s,i) array
nSegABC = 0;
for e=1:1:nElements
if flag(e,1) == 1 && flag(e,2) == 1
nSegABC = nSegABC + 1;
NS(nSegABC, 1) = N(e,1);
NS(nSegABC, 2) = N(e,2);
elseif flag(e,1) == 1 && flag(e,3) == 1
nSegABC = nSegABC + 1;
NS(nSegABC, 1) = N(e,1);
NS(nSegABC, 2) = N(e,3);
elseif flag(e,2) == 1 && flag(e,3) == 1
nSegABC = nSegABC + 1;
NS(nSegABC, 1) = N(e,2);
NS(nSegABC, 2) = N(e,3);
end
end
fprintf(' RESULTS \n\n');
70
fprintf('The number of nodes = %6i\n', nNodes);
fprintf('The number of elements = %6i\n', nElements);
fprintf('The number of nodes on a Dirichlet boundary = %6i\n', nDBC);
fprintf('The number of nodes on an ABC boundary = %6i\n', nABC);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEFINE INPUT PARAMETERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
lambda = 1;
rABC = 1.5
*
lambda; % Radius of the outer circular ABC boundary in wavelengths
h = 0.04
*
lambda; % Discretization size in wavelengths
E_0 = 1; % Amplitude of incident electric field (V/m)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEFINE CONSTANTS FOR EACH ELEMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
J = complex(0.,1.);
mur = 1; % Relative permeability (assuming vaccum)
epsr = 1; % Relative permittivity (asumming vacuum)
k_0 = 2
*
pi/lambda; % wavenumber
alpha = 1/mur;
kappa = 1/rABC;
gamma_1 = alpha
*
(J
*
k_0 + kappa/2 J
*
kappa^2/(8
*
(J
*
kappak_0)));
mu_r = zeros(1,nElements); % relative permeability
eps_r = zeros(1,nElements); % relative permittivity
alpha_x = zeros(1,nElements); % coefficient of second order x term in PDE
alpha_y = zeros(1,nElements); % coefficient of second order y term in PDE
beta = zeros(1,nElements); % coefficient of term linear in field in PDE
A = zeros(1,nElements); % area of element e
for e=1:1:nElements
mu_r(e) = mur;
eps_r(e) = epsr;
alpha_x(e) = 1/mur;
alpha_y(e) = 1/mur;
beta(e) = (k_0)
*
(k_0)
*
eps_r(e);
end
% Initialize global K matrix and the right hand side vector b
Kglobal = zeros(nNodes, nNodes);
btilde = zeros(nNodes, 1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FORMATION OF ELEMENT MATRICES AND ASSEMBLY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% coefficients of the linear interpolation functions
a = zeros(nElements,3);
b = zeros(nElements,3);
c = zeros(nElements,3);
71
be_tilde=zeros(1,nElements);
Klocal=zeros(nElements,3,3);
for e=1:1:nElements
x_21 = x(N(e,2)) x(N(e,1));
x_31 = x(N(e,3)) x(N(e,1));
x_32 = x(N(e,3)) x(N(e,2));
x_13 = x_31;
y_12 = y(N(e,1)) y(N(e,2));
y_21 = y_12;
y_31 = y(N(e,3)) y(N(e,1));
y_23 = y(N(e,2)) y(N(e,3));
A(e) = 0.5
*
(x_21
*
y_31 x_31
*
y_21);
x1 = x(N(e,1)); y1 = y(N(e,1));
x2 = x(N(e,2)); y2 = y(N(e,2));
x3 = x(N(e,3)); y3 = y(N(e,3));
a(e,1) = x2
*
y3x3
*
y2;
b(e,1) = y2y3;
c(e,1) = x3x2;
a(e,2) = x3
*
y1x1
*
y3;
b(e,2) = y3y1;
c(e,2) = x1x3;
a(e,3) = x1
*
y2x2
*
y1;
b(e,3) = y1y2;
c(e,3) = x2x1;
% Evaluate K^e matrix (element K matrix)
for i = 1:1:3
for j = 1:1:3
if (i == j)
ij = 1;
else
ij = 0;
end
Klocal(e,i,j) = (alpha_x(e)
*
b(e,i)
*
b(e,j)+
alpha_y(e)
*
c(e,i)
*
c(e,j))/(4
*
A(e))+
A(e)
*
beta(e)
*
(1+ij)/12;
end
end
% Evaluate b_tilde^e vector
for i = 1:1:3
fun = @(u,v)betilde(u,v,a(e,i),b(e,i),c(e,i),k_0,x1,x2,x3,y1,y2,y3);
% use for scattered field formulation (change eps and
% mu for dielectrics, etc.)
be_tilde(e,i) = (E_0
*
k_0
*
k_0
*
(1/mu_r(e)eps_r(e))/(2
*
A(e)))
72
*
dblquad(fun,0,1,0,1);
end
end
for e=1:nElements
% Assemble K^e into Kglobal and b^e into b
for i = 1:1:3
for j = 1:1:3
Kglobal(N(e,i),N(e,j)) = Kglobal(N(e,i),N(e,j)) + Klocal(e,i,j);
end
btilde(N(e,i)) = btilde(N(e,i)) + be_tilde(e,i);
end
end
% Construct Ks
Ks=zeros(nSegABC,2,2);
bs_tilde=zeros(nSegABC,2);
for s = 1:1:nSegABC
xdiff = x(NS(s,1)) x(NS(s,2));
ydiff = y(NS(s,1)) y(NS(s,2));
L_s = sqrt(xdiff^2 + ydiff^2);
x1 = x(NS(s,1)); x2 = x(NS(s,2));
y1 = y(NS(s,1)); y2 = y(NS(s,2));
for ii = 1:1:2
fun2 = @(ksi)bstilde1(ksi,ii,alpha,kappa,k_0,x1,x2,L_s,E_0);
bs_tilde(s,ii) = quad(fun2,0,1);
for jj = 1:1:2
if (ii == jj)
Ks(s,ii,jj) = gamma_1
*
L_s/3;
else
Ks(s,ii,jj) = gamma_1
*
L_s/6;
end
end
end
end
% Assemble Ks into K
for s = 1:1:nSegABC
for i = 1:1:2
for j = 1:1:2
Kglobal(NS(s,i),NS(s,j)) = Kglobal(NS(s,i),NS(s,j)) + Ks(s,i,j);
end
end
end
% Assemble bs into b
for s=1:1:nSegABC
for i=1:2
btilde(NS(s,i)) = btilde(NS(s,i)) + bs_tilde(s,i);
end
73
end
% Impose Dirichlet Boundary COndition
for i=1:1:nDBC
for j=1:1:nNodes
if (j = ABC(i))
btilde(j) = btilde(j) Kglobal(j, DBC(i))
*
0;
end
end
Kglobal(:,DBC(i)) = 0;
Kglobal(DBC(i),:) = 0;
Kglobal(DBC(i),DBC(i)) = 1;
btilde(DBC(i)) = 0;
end
% Solution of global matrix system
Ez = Kglobal\btilde;
% Generate solution over a grid and plot it
[xgrid, ygrid] = meshgrid(rABC:0.01
*
(2
*
rABC):rABC, rABC:0.01
*
(2
*
rABC):rABC);
Ezgrid = zeros(101,101);
for i = 1:1:101
for j = 1:1:101
for e = 1:1:nElements
x2p = x(N(e,2)) xgrid(i,j);
x3p = x(N(e,3)) xgrid(i,j);
y2p = y(N(e,2)) ygrid(i,j);
y3p = y(N(e,3)) ygrid(i,j);
A1 = 0.5
*
abs(x2p
*
y3p x3p
*
y2p);
x2p = x(N(e,2)) xgrid(i,j);
x1p = x(N(e,1)) xgrid(i,j);
y2p = y(N(e,2)) ygrid(i,j);
y1p = y(N(e,1)) ygrid(i,j);
A2 = 0.5
*
abs(x2p
*
y1p x1p
*
y2p);
x1p = x(N(e,1)) xgrid(i,j);
x3p = x(N(e,3)) xgrid(i,j);
y1p = y(N(e,1)) ygrid(i,j);
y3p = y(N(e,3)) ygrid(i,j);
A3 = 0.5
*
abs(x1p
*
y3p x3p
*
y1p);
x21 = x(N(e,2)) x(N(e,1));
x31 = x(N(e,3)) x(N(e,1));
y21 = y(N(e,2)) y(N(e,1));
y31 = y(N(e,3)) y(N(e,1));
Ae = 0.5
*
abs(x21
*
y31 x31
*
y21);
if abs(Ae(A1+A2+A3)) < 0.00001
*
Ae
ksi = (y31
*
(xgrid(i,j)x(N(e,1)))x31
*
(ygrid(i,j)y(N(e,1))))/(2
*
Ae);
ita = (y21
*
(xgrid(i,j)x(N(e,1)))+x21
*
(ygrid(i,j)y(N(e,1))))/(2
*
Ae);
74
N1 = 1 ksi ita;
N2 = ksi;
N3 = ita;
Ezgrid(i,j) = N1
*
Ez(N(e,1)) + N2
*
Ez(N(e,2)) + N3
*
Ez(N(e,3));
end
end
end
end
% Display contour plot of FEM solution
figure;
contourf(xgrid,ygrid,abs(Ezgrid));
xlabel('x (wavelengths)');
ylabel('y (wavelengths)');
axis([rABC rABC rABC rABC]);
title('Total Electric Field Contour Plot');
axis square;
colorbar;
% Evaluate exact solution at rho = (rCyl + rABC)/2
d2p=pi/180;
dist=lambda; % where to evaluate the field
Ez_eval=zeros(1,1441);
phi=zeros(1,1441);
for I=1:1441 %721
phi(I)=(I1)
*
0.25; %0.5;
xeval=dist
*
cos(phi(I)
*
d2p);
yeval=dist
*
sin(phi(I)
*
d2p);
for e=1:nElements
x2p=x(N(e,2))xeval;
x3p=x(N(e,3))xeval;
y2p=y(N(e,2))yeval;
y3p=y(N(e,3))yeval;
A1=0.5
*
abs(x2p
*
y3px3p
*
y2p);
x2p=x(N(e,2))xeval;
x1p=x(N(e,1))xeval;
y2p=y(N(e,2))yeval;
y1p=y(N(e,1))yeval;
A2=0.5
*
abs(x2p
*
y1px1p
*
y2p);
x1p=x(N(e,1))xeval;
x3p=x(N(e,3))xeval;
y1p=y(N(e,1))yeval;
y3p=y(N(e,3))yeval;
A3=0.5
*
abs(x1p
*
y3px3p
*
y1p);
x21=x(N(e,2))x(N(e,1));
x31=x(N(e,3))x(N(e,1));
y21=y(N(e,2))y(N(e,1));
y31=y(N(e,3))y(N(e,1));
Ae=0.5
*
(x21
*
y31x31
*
y21);
75
if abs(Ae(A1+A2+A3)) < 0.00001
*
Ae
ksi=(y31
*
(xevalx(N(e,1)))x31
*
(yevaly(N(e,1))))/(2
*
Ae);
ita=(y21
*
(xevalx(N(e,1)))+x21
*
(yevaly(N(e,1))))/(2
*
Ae);
N1=1ksiita;
N2=ksi;
N3=ita;
Ez_eval(I)=N1
*
Ez(N(e,1))+N2
*
Ez(N(e,2))+N3
*
Ez(N(e,3));
end
end
end
% Plot the analytical solution and the FEM solution at a distance 'dist'
figure;
plot(phi,abs(Ez_eval),'b'),legend('FEM (1^{st} order ABC)');
xlabel('Angle (degrees)');
ylabel('Electric Field (V/m)');
axis([0 360 0 2
*
E_0]);
grid on;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FUNCTIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% evaluate bsilde1(e,i) for the FIRST ORDER ABC (1 = FIRST ORDER ABC)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function f1 = bstilde1(ksi,m,alpha,kappa,k_0,x1,x2,L_s,E_0)
N = ksi;
if (m == 1)
N = 1ksi;
end
J = complex(0.,1.);
x = (1ksi).
*
x1 + ksi.
*
x2;
expfac = exp(J
*
k_0.
*
x);
f1 = alpha
*
(J
*
k_0 + 0.5
*
kappa J
*
k_0
*
kappa.
*
x).
*
N.
*
L_s
*
E_0.
*
expfac;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% evaluate btilde(e,i)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function f2 = betilde(u,v,a,b,c,k_0,x1,x2,x3,y1,y2,y3)
J = complex(0.,1.);
x = (1u).
*
x1 + u.
*
((1v).
*
x2 + v.
*
x3);
y = (1u).
*
y1 + u.
*
((1v).
*
y2 + v.
*
y3);
jacob = (x1+(1v).
*
x2+v.
*
x3).
*
(u.
*
y2+u.
*
y3)
(y1+(1v).
*
y2+v.
*
y3).
*
(u.
*
x2+u.
*
x3);
f2 = (a+b.
*
x+c.
*
y).
*
exp(J
*
k_0.
*
x).
*
jacob;
% simple linear array search
function index = ArrSearch(arr,val)
res = 1;
for ii=1:length(arr)
if (arr(ii)==val)
res=ii;
break;
76
end
end
index=res;
8.7 Second Order ABC
% This program solves for the total electric field in a region bounded
% by a circular boundary, using the Nodal 2D Finite Element Method.
% The 2nd order ABC is imposed on the boundary.
% It is assumed on entering this code that the mesh is well defined and
% p(:,1) = xcoordinates of vertices
% p(:,2) = ycoordinates of vertices
% N = node connectivity matrix (properly ordered)
% Define x and y coordinate vectors for use below
x = p(:,1);
y = p(:,2);
% Lets find boundary edges
be = boundedges(p,N);
hold on;
for i=1:length(be)
x1=x(be(i,1)); x2=x(be(i,2));
y1=y(be(i,1)); y2=y(be(i,2));
line([x1 x2],[y1 y2],'Color','b','LineWidth',1.5); % Plot the boundary edges
end
nDBC = 0; % no of Dirichlet Boundary Condition nodes
nABC = 0; % no of ABC nodes
nInt = 0; % no of internal nodes
nNodes=length(p); % total no of nodes
DBC(1) = 0;
% Determine the ABC and DBC nodes
for jj=1:1:nNodes
r0 = sqrt(x(jj)^2+y(jj)^2);
if(abs(rABCr0)<0.0001
*
rABC) % ABC will be imposed on a circle always
nABC=nABC+1;
ABC(nABC)=jj;
else % either an internal node or a node on the object (scatterer)
% if jj is an element of the be (bound edges) array
% then it is a node on the object hence a DBC node
% otherwise it is an internal node
index=ArrSearch(be,jj);
if(index = 1) % DBC node
nDBC=nDBC+1;
DBC(nDBC)=jj;
else % internal node
nInt=nInt+1;
INT(nInt)=jj;
end
end
77
end
% flag each node
% flag = 1 for ABC node
% = 0 for internal node
% = 1 for DBC node
flag = zeros(nElements,3);
for e=1:nElements
for i=1:3
index=ArrSearch(ABC,N(e,i));
if (index = 1)
flag(e,i) = 1; % ABC node
else
index=ArrSearch(DBC,N(e,i));
if(index = 1)
flag(e,i) = 1; % DBC node
else
flag(e,i) = 0; % internal node
end
end
end
end
% Create NS(s,i) array
nSegABC = 0;
for e=1:1:nElements
if flag(e,1) == 1 && flag(e,2) == 1
nSegABC = nSegABC + 1;
NS(nSegABC, 1) = N(e,1);
NS(nSegABC, 2) = N(e,2);
elseif flag(e,1) == 1 && flag(e,3) == 1
nSegABC = nSegABC + 1;
NS(nSegABC, 1) = N(e,1);
NS(nSegABC, 2) = N(e,3);
elseif flag(e,2) == 1 && flag(e,3) == 1
nSegABC = nSegABC + 1;
NS(nSegABC, 1) = N(e,2);
NS(nSegABC, 2) = N(e,3);
end
end
fprintf(' RESULTS \n\n');
fprintf('The number of nodes = %6i\n', nNodes);
fprintf('The number of elements = %6i\n', nElements);
fprintf('The number of nodes on a Dirichlet boundary = %6i\n', nDBC);
fprintf('The number of nodes on an ABC boundary = %6i\n', nABC);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEFINE INPUT PARAMETERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
lambda = 1;
78
rABC = 1.5
*
lambda; % Radius of the outer circular ABC boundary in wavelengths
h = 0.04
*
lambda; % Discretization size in wavelengths
E_0 = 1; % Amplitude of incident electric field (V/m)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEFINE CONSTANTS FOR EACH ELEMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
J = complex(0.,1.);
mur = 1; % Relative permeability (assuming vaccum)
epsr = 1; % Relative permittivity (asumming vacuum)
k_0 = 2
*
pi/lambda; % wavenumber
alpha = 1/mur;
kappa = 1/rABC;
gamma_1 = alpha
*
(J
*
k_0 + kappa/2 J
*
kappa^2/(8
*
(J
*
kappak_0)));
gamma_2 = J
*
alpha/(2
*
(J
*
kappak_0));
mu_r = zeros(1,nElements); % relative permeability
eps_r = zeros(1,nElements); % relative permittivity
alpha_x = zeros(1,nElements); % coefficient of second order x term in PDE
alpha_y = zeros(1,nElements); % coefficient of second order y term in PDE
beta = zeros(1,nElements); % coefficient of term linear in field in PDE
A = zeros(1,nElements); % area of element e
for e=1:1:nElements
mu_r(e) = mur;
eps_r(e) = epsr;
alpha_x(e) = 1/mur;
alpha_y(e) = 1/mur;
beta(e) = (k_0)
*
(k_0)
*
eps_r(e);
end
% Initialize global K matrix and the right hand side vector b
Kglobal = zeros(nNodes, nNodes);
btilde = zeros(nNodes, 1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FORMATION OF ELEMENT MATRICES AND ASSEMBLY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% coefficients of the linear interpolation functions
a = zeros(nElements,3);
b = zeros(nElements,3);
c = zeros(nElements,3);
be_tilde=zeros(1,nElements);
Klocal=zeros(nElements,3,3);
for e=1:1:nElements
x_21 = x(N(e,2)) x(N(e,1));
x_31 = x(N(e,3)) x(N(e,1));
x_32 = x(N(e,3)) x(N(e,2));
x_13 = x_31;
79
y_12 = y(N(e,1)) y(N(e,2));
y_21 = y_12;
y_31 = y(N(e,3)) y(N(e,1));
y_23 = y(N(e,2)) y(N(e,3));
A(e) = 0.5
*
(x_21
*
y_31 x_31
*
y_21);
x1 = x(N(e,1)); y1 = y(N(e,1));
x2 = x(N(e,2)); y2 = y(N(e,2));
x3 = x(N(e,3)); y3 = y(N(e,3));
a(e,1) = x2
*
y3x3
*
y2;
b(e,1) = y2y3;
c(e,1) = x3x2;
a(e,2) = x3
*
y1x1
*
y3;
b(e,2) = y3y1;
c(e,2) = x1x3;
a(e,3) = x1
*
y2x2
*
y1;
b(e,3) = y1y2;
c(e,3) = x2x1;
% Evaluate K^e matrix (element K matrix)
for i = 1:1:3
for j = 1:1:3
if (i == j)
ij = 1;
else
ij = 0;
end
Klocal(e,i,j) = (alpha_x(e)
*
b(e,i)
*
b(e,j)+alpha_y(e)
*
c(e,i)
*
c(e,j))/(4
*
A(e)) + A(e)
*
beta(e)
*
(1+ij)/12;
end
end
% Evaluate b_tilde^e vector
for i = 1:1:3
fun = @(u,v)betilde(u,v,a(e,i),b(e,i),c(e,i),k_0,x1,x2,x3,y1,y2,y3);
% use for scattered field formulation (change eps
% and mu for dielectrics, etc.)
be_tilde(e,i) = (E_0
*
k_0
*
k_0
*
(1/mu_r(e)eps_r(e))/(2
*
A(e)))
*
dblquad(fun,0,1,0,1);
end
end
for e=1:nElements
% Assemble K^e into Kglobal and b^e into b
for i = 1:1:3
for j = 1:1:3
Kglobal(N(e,i),N(e,j)) = Kglobal(N(e,i),N(e,j)) + Klocal(e,i,j);
80
end
btilde(N(e,i)) = btilde(N(e,i)) + be_tilde(e,i);
end
end
% Construct Ks
Ks=zeros(nSegABC,2,2);
bs_tilde=zeros(nSegABC,2);
for s = 1:1:nSegABC
xdiff = x(NS(s,1)) x(NS(s,2));
ydiff = y(NS(s,1)) y(NS(s,2));
L_s = sqrt(xdiff^2 + ydiff^2);
x1 = x(NS(s,1)); x2 = x(NS(s,2));
y1 = y(NS(s,1)); y2 = y(NS(s,2));
for ii = 1:1:2
fun2 = @(ksi)bstilde2(ksi,ii,alpha,kappa,k_0,x1,x2,y1,y2,L_s,E_0);
bs_tilde(s,ii) = quad(fun2,0,1);
for jj = 1:1:2
if (ii == jj)
Ks(s,ii,jj) = gamma_1
*
L_s/3 gamma_2/L_s;
else
Ks(s,ii,jj) = gamma_1
*
L_s/6 + gamma_2/L_s;
end
end
end
end
% Assemble Ks into K
for s = 1:1:nSegABC
for i = 1:1:2
for j = 1:1:2
Kglobal(NS(s,i),NS(s,j)) = Kglobal(NS(s,i),NS(s,j)) + Ks(s,i,j);
end
end
end
% Assemble bs into b
for s=1:1:nSegABC
for i=1:2
btilde(NS(s,i)) = btilde(NS(s,i)) + bs_tilde(s,i);
end
end
% Impose Dirichlet Boundary COndition
for i=1:1:nDBC
for j=1:1:nNodes
if (j = ABC(i))
btilde(j) = btilde(j) Kglobal(j, DBC(i))
*
0;
end
end
81
Kglobal(:,DBC(i)) = 0;
Kglobal(DBC(i),:) = 0;
Kglobal(DBC(i),DBC(i)) = 1;
btilde(DBC(i)) = 0;
end
% Solution of global matrix system
Ez = Kglobal\btilde;
% Generate solution over a grid and plot it
[xgrid, ygrid] = meshgrid(rABC:0.01
*
(2
*
rABC):rABC, rABC:0.01
*
(2
*
rABC):rABC);
Ezgrid = zeros(101,101);
for i = 1:1:101
for j = 1:1:101
for e = 1:1:nElements
x2p = x(N(e,2)) xgrid(i,j);
x3p = x(N(e,3)) xgrid(i,j);
y2p = y(N(e,2)) ygrid(i,j);
y3p = y(N(e,3)) ygrid(i,j);
A1 = 0.5
*
abs(x2p
*
y3p x3p
*
y2p);
x2p = x(N(e,2)) xgrid(i,j);
x1p = x(N(e,1)) xgrid(i,j);
y2p = y(N(e,2)) ygrid(i,j);
y1p = y(N(e,1)) ygrid(i,j);
A2 = 0.5
*
abs(x2p
*
y1p x1p
*
y2p);
x1p = x(N(e,1)) xgrid(i,j);
x3p = x(N(e,3)) xgrid(i,j);
y1p = y(N(e,1)) ygrid(i,j);
y3p = y(N(e,3)) ygrid(i,j);
A3 = 0.5
*
abs(x1p
*
y3p x3p
*
y1p);
x21 = x(N(e,2)) x(N(e,1));
x31 = x(N(e,3)) x(N(e,1));
y21 = y(N(e,2)) y(N(e,1));
y31 = y(N(e,3)) y(N(e,1));
Ae = 0.5
*
abs(x21
*
y31 x31
*
y21);
if abs(Ae(A1+A2+A3)) < 0.00001
*
Ae
ksi = (y31
*
(xgrid(i,j)x(N(e,1)))x31
*
(ygrid(i,j)y(N(e,1))))/(2
*
Ae);
ita = (y21
*
(xgrid(i,j)x(N(e,1)))+x21
*
(ygrid(i,j)y(N(e,1))))/(2
*
Ae);
N1 = 1 ksi ita;
N2 = ksi;
N3 = ita;
Ezgrid(i,j) = N1
*
Ez(N(e,1)) + N2
*
Ez(N(e,2)) + N3
*
Ez(N(e,3));
end
end
end
end
% Display contour plot of FEM solution
figure;
82
contourf(xgrid,ygrid,abs(Ezgrid));
xlabel('x (wavelengths)');
ylabel('y (wavelengths)');
axis([rABC rABC rABC rABC]);
title('Total Electric Field Contour Plot');
axis square;
colorbar;
% Evaluate exact solution at rho = (rCyl + rABC)/2
d2p=pi/180;
dist=lambda; % where to evaluate the field
Ez_eval=zeros(1,1441);
phi=zeros(1,1441);
for I=1:1441 %721
phi(I)=(I1)
*
0.25; %0.5;
xeval=dist
*
cos(phi(I)
*
d2p);
yeval=dist
*
sin(phi(I)
*
d2p);
for e=1:nElements
x2p=x(N(e,2))xeval;
x3p=x(N(e,3))xeval;
y2p=y(N(e,2))yeval;
y3p=y(N(e,3))yeval;
A1=0.5
*
abs(x2p
*
y3px3p
*
y2p);
x2p=x(N(e,2))xeval;
x1p=x(N(e,1))xeval;
y2p=y(N(e,2))yeval;
y1p=y(N(e,1))yeval;
A2=0.5
*
abs(x2p
*
y1px1p
*
y2p);
x1p=x(N(e,1))xeval;
x3p=x(N(e,3))xeval;
y1p=y(N(e,1))yeval;
y3p=y(N(e,3))yeval;
A3=0.5
*
abs(x1p
*
y3px3p
*
y1p);
x21=x(N(e,2))x(N(e,1));
x31=x(N(e,3))x(N(e,1));
y21=y(N(e,2))y(N(e,1));
y31=y(N(e,3))y(N(e,1));
Ae=0.5
*
(x21
*
y31x31
*
y21);
if abs(Ae(A1+A2+A3)) < 0.00001
*
Ae
ksi=(y31
*
(xevalx(N(e,1)))x31
*
(yevaly(N(e,1))))/(2
*
Ae);
ita=(y21
*
(xevalx(N(e,1)))+x21
*
(yevaly(N(e,1))))/(2
*
Ae);
N1=1ksiita;
N2=ksi;
N3=ita;
Ez_eval(I)=N1
*
Ez(N(e,1))+N2
*
Ez(N(e,2))+N3
*
Ez(N(e,3));
end
end
end
83
% Plot the analytical solution and the FEM solution at a distance 'dist'
figure;
plot(phi,abs(Ez_eval),'b'),legend('FEM (2^{nd} order ABC)');
xlabel('Angle (degrees)');
ylabel('Electric Field (V/m)');
axis([0 360 0 2
*
E_0]);
grid on;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FUNCTIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% evaluate bsilde2(e,i) for the SECOND ORDER ABC (2 = SECOND ORDER ABC)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function f1 = bstilde2(ksi,m,alpha,kappa,k_0,x1,x2,y1,y2,L_s,E_0)
N = ksi;
if (m == 1)
N = 1ksi;
end
J = complex(0.,1.);
x = (1ksi).
*
x1 + ksi.
*
x2;
y = (1ksi).
*
y1 + ksi.
*
y2;
expfac = exp(J
*
k_0.
*
x);
% second order expression for f
f1 = alpha
*
(J
*
k_0 + 0.5
*
kappa J
*
kappa^2/(8
*
(J
*
kappak_0))
J
*
k_0
*
kappa.
*
x
0.5
*
J
*
kappa^2/(J
*
kappak_0))
*
(J
*
k_0.
*
xk_0^2.
*
y.^2)).
*
N.
*
L_s
*
E_0.
*
expfac;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% evaluate btilde(e,i)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function f2 = betilde(u,v,a,b,c,k_0,x1,x2,x3,y1,y2,y3)
J = complex(0.,1.);
x = (1u).
*
x1 + u.
*
((1v).
*
x2 + v.
*
x3);
y = (1u).
*
y1 + u.
*
((1v).
*
y2 + v.
*
y3);
jacob = (x1+(1v).
*
x2+v.
*
x3).
*
(u.
*
y2+u.
*
y3)
(y1+(1v).
*
y2+v.
*
y3).
*
(u.
*
x2+u.
*
x3);
f2 = (a+b.
*
x+c.
*
y).
*
exp(J
*
k_0.
*
x).
*
jacob;
% simple linear array search
function index = ArrSearch(arr,val)
res = 1;
for ii=1:length(arr)
if (arr(ii)==val)
res=ii;
break;
end
end
index=res;
84

Vous aimerez peut-être aussi