Indian Institute of Technology Kanpur Department of Electrical

advertisement
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
Certificate
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
5.1 Scattering Boundary Value Problem . . . . . . . . .
5.1.1 Scalar Problem . . . . . . . . . . . . . . . .
5.1.2 Vector Problem . . . . . . . . . . . . . . . .
5.2 The Finite Element Method . . . . . . . . . . . . .
5.3 Meshing . . . . . . . . . . . . . . . . . . . . . . . .
5.3.1 Concentric Ring Meshing for circular objects
5.3.2 DistMesh . . . . . . . . . . . . . . . . . . .
5.3.3 COMSOL-based Meshing . . . . . . . . . . .
5.4 Mesh Truncation . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
12
12
12
13
14
15
15
17
19
20
.
.
.
.
25
26
26
27
28
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
6 Methodology Adopted
6.1 Statement of the Forward Problem (for Cylindrical PEC Object in Air)
6.1.1 The Partial Differential Equation for the Total Electric Field . .
6.2 Statement of the Forward Problem (for Buried Mines) . . . . . . . . . .
6.2.1 Parameter Values . . . . . . . . . . . . . . . . . . . . . . . . . .
1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
7 Results
7.1 Circular PEC Object centered at the origin . . . . . . . . . . . . . . . . . . . . . . .
7.2 Location of 2nd order ABC vs. that of 1st order ABC . . . . . . . . . . . . . . . . .
7.3 Circular PEC Object placed off center . . . . . . . . . . . . . . . . . . . . . . . . .
7.4 Concave PEC Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.5 Square PEC Object placed off center . . . . . . . . . . . . . . . . . . . . . . . . . .
7.6 Two PEC Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.7 Comparison between 1st order ABC and PML PEC Cylinder in Air . . . . . . . . .
7.8 Comparison between ABC and PML for Dielectric Cylinder in Air . . . . . . . . . .
7.9 The Subsurface Problem (Half Space Scattering) . . . . . . . . . . . . . . . . . . . .
7.10 PEC Cylinder buried under Soil . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.11 Dielectric Cylinder buried under Soil . . . . . . . . . . . . . . . . . . . . . . . . . .
7.12 Scattering from a PEC Cylinder in Air using the First Order ABC (Effect of varying
Discretization) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
29
31
32
33
34
35
36
37
38
38
39
8 Conclusions
41
References
42
Appendix A: Finite Element Method Formulation
Weak Form . . . . . . . . . . . . . . . . . . . . . . .
Element Matrices and Vectors . . . . . . . . . . . . .
Integration over an arbitrary triangular patch . . . .
Enforcement of Dirichlet Conditions . . . . . . . . . .
Assembly of Matrix Elements . . . . . . . . . . . . .
Solution of the Linear System . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
40
43
45
46
47
48
48
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
8.1 Meshing Code for Cylinder . . . . . . . . . .
8.2 Meshing Code for Off-center Cylinder . . . .
8.3 Meshing Code for Square Object . . . . . .
8.4 Meshing Code for Concave Object . . . . . .
8.5 Meshing Code for Two Objects . . . . . . .
.
.
.
.
.
63
63
65
65
66
67
Appendix F: MATLAB FEM Codes
8.6 First Order ABC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.7 Second Order ABC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
69
69
77
2
Regions
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Certificate
This is to certify that the work contained in this report entitled “Finite Element Modelling of Radiation 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 problem 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 first 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 flexibility).
• 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 different 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 finite 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
1.2
1.3
Basic geometry of a Landmine Detection Problem . . . . . . . . . . . . . . . . . . .
Block Diagram of the Forward Scattering Problem . . . . . . . . . . . . . . . . . . .
Block Diagram of the Inverse Scattering Problem . . . . . . . . . . . . . . . . . . .
5.1
5.2
5.3
5.4
5.5
5.6
5.7
Flowchart of the Finite Element Method-based
Triangular Mesh Pattern for h = 0.09 . . . . .
Set Theoretic Operations on Regions . . . . .
Circular Mesh generated using DistMesh . . .
Mesh for a Concave PEC Object . . . . . . .
The unbounded and PML-bounded problems .
The three step-process for setting up a PML .
7.1
7.2
7.3
7.4
7.5
7.6
7.7
7.8
7.9
7.10
7.11
7.12
7.13
7.14
7.15
8.1
8.2
8.3
8.4
8.5
8.6
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
14
16
18
19
20
22
23
First and Second Order Solutions for PEC Cylinder Scattering .
Analytical and FEM Solutions for the PEC Cylindrical Scatterer
1st order ABC versus 2nd order ABC . . . . . . . . . . . . . . .
Electric Fields near an off-center PEC Cylinder . . . . . . . . .
Scattering from an off-center PEC Cylinder . . . . . . . . . . .
Electric Fields near a Concave PEC Object . . . . . . . . . . . .
Scattering from a Concave PEC Object . . . . . . . . . . . . . .
Square PEC Object Mesh . . . . . . . . . . . . . . . . . . . . .
Scattering from a Square PEC Object . . . . . . . . . . . . . . .
Mesh for two PEC objects . . . . . . . . . . . . . . . . . . . . .
Scattering from Two PEC Objects . . . . . . . . . . . . . . . . .
Scattered Fields from PEC Cylinder in Air: ABC vs PML . . .
Scattering from Dielectric Cylinder in Air: ABC vs PML . . . .
Scattering from PEC Cylinder buried under Soil . . . . . . . . .
Scattering from Dielectric Cylinder buried under Soil . . . . . .
. . . . .
at λ/25
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
29
30
31
32
32
33
33
34
34
35
35
36
37
38
39
FEM Local Node Numbering Convention . . . . . . . . . .
Evaluation of ABC matrix elements . . . . . . . . . . . . .
Scattered Fields from PEC Cylinder in Air: ABC vs PML
Scattering from Dielectric Cylinder in Air: ABC vs PML .
Scattering from PEC Cylinder buried under Soil . . . . . .
Scattering from Dielectric Cylinder buried under Soil . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
44
51
59
60
61
62
6
solution
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
process
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
7
8
8
.
.
.
.
.
.
.
.
.
.
.
.
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 electromagnetic fields scattered by the object(s) of interest, to construct a contour map of the total
electromagnetic field distribution in the near region of the scatterer(s). From this contour map and
the field data, it is usually possible to recover important details of the structure, using reconstruction algorithms.
Important examples of subsurface imaging are landmine detection, tumor detection, geophysical
and oil exploration. The basic problem is conveyed effectively by the following illustration:
Figure 1.1: Basic geometry of a Landmine Detection Problem
The figure 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 explosion, and the structural (material) content can give hints for identifying it so as to enable the use
of specifically practical methods to defuse it.
An analogous situation arises in biomedical imaging, where structural information about a tumor 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 fields), given the values of the parameters
defining 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 fields)
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 imaging referred to here involves propagating electromagnetic waves of known frequency and amplitude
on the ground, measuring the fields 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 motivated earlier, subsurface reconstruction is an inverse scattering problem.
The objective of this project is towards the development of a computational model for studying 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 infinity.
Inverse scattering solutions typically need forward scattering models. Specifically, it is desirable
to have complete control over the implementation aspects of the forward problem model, for instance 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 COMSOL 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 first 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 Maxwell’s 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 Conditions) 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 formulation of Jin [1] was identified 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], Bérenger [10], Rappaport and Winton [11], and Jin and Chew [12], was studied. For the 1st and 2nd 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 fields, as given by Balanis [7], and by
results for the 1st order ABC given by Polycarpou [2]. Certain mistakes in Jin’s formulation of the
2nd 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 COMSOL’s meshing subroutines.
For this purpose, the documentation of COMSOL was studied to gain access to the internal mesh
storage structure. Both COMSOL’s 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) expressions 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 fields 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, specifically the implementation of a Finite Element Method-based framework for solving two dimensional partial differential
equations (PDEs) that arise in time harmonic scattering problems in electromagnetics.
Time Harmonic analysis allows us to find the solution to the problem for one spot excitation frequency. The response due to a general excitation field 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 fields and total field 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 differential equation,
∂
∂φ
∂φ
∂
αx
−
αy
+ βφ = f (x, y)
∀ (x, y) ∈ Ω
−
∂x
∂x
∂y
∂y
(5.1)
subject to the boundary conditions
φ = p
on
Γ1
(5.2)
∂φ
∂φ
x̂ + αy ŷ · n̂ + γφ = q
∂x
∂y
on
Γ2
(5.3)
αx
where
•
•
•
•
•
φ denotes the principal unknown field (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 field is
the Sommerfeld Radiation condition [1]
E
E
lim r ∇ ×
+ jk0 r̂ ×
=0
(5.4)
H
H
r→∞
which in two dimensions becomes
lim
√
ρ→∞
where ρ =
p
x2 + y 2 , r =
∂
ρ
∂ρ
Ez
Hz
+ jk0
Ez
Hz
=0
(5.5)
p
ρ2 + z 2 and k0 is the free space propagation wavenumber.
But for a numerical solution to this BVP, we cannot store information for ρ → ∞ on a computer with finite 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 artificial boundary that is located
a finite distance away from the scatterer.
Hence, we need to enforce a suitable boundary condition on this artificial boundary such that
a perfect absorbing surface is simulated. By the use of an artificial boundary, we want to ensure
that the EM modes see a “transparent” surface and do not suffer reflection. This gives the impression that the domain is still unbounded whereas it is in fact finite, and hence representible on a
computer system with finite memory size. This is known as Mesh Truncation.
The boundary condition on the artificial 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 artificial absorbing layer known as a Perfectly Matched
Layer (PML), which represents an imaginary lossy medium through which electromagnetic fields
travel without significant reflection.
5.1.2
Vector Problem
The objective of the 2D vector problem is to solve the PDE
− ∇ × (α∇ × F ) + βF = G(r)
∀r ∈ Ω
(5.6)
Γ1
Γ2
(5.7)
(5.8)
subject to the boundary conditions
n̂ × F = F 1 (r)
n̂ × (∇ × F ) = F 2 (r)
on
on
where
• F denotes the principal unknown field (electric or magnetic).
13
•
•
•
•
α ≡ α(x, y) and β ≡ β(x, y) are scalar functions of x and y.
G(r) is a known vector function.
F1 (r) is a known vector function specifying the Dirichlet boundary condition on Γ1 .
F2 (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 field 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 field 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 flowchart 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 field at all the nodes of all triangular elements forming the mesh. Once the
nodal values are known, the value of the unknown field at any point in the solution domain can be
determined by interpolation using the basis functions. The FEM can thus be used to find the total
field in the vicinity of a scatterer. Since the incident field in a scattering scenario is known apriori,
the method can be used to determine the scattered field as well.
In summary, the FEM consists of the following four major steps:
• Discretization: breaking up the solution region into a finite number of elements (meshes).
• Derivation of Governing Equations: derivation of governing equations for a typical element.
• 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 computational front-end for meshing.
5.3.1
Concentric Ring Meshing for circular objects
In order to solve for the total electric field 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 Nring
annular rings, with Nring given by
'
&
ρABC − a
√ h
(5.9)
Nring =
32
where h is the discretization size. The differential step change in the radial direction is given by
∆ρ =
ρABC − a
Nring
15
(5.10)
At a fixed ρ (where ρ = a : ∆r : ρABC ), the angular separation between two successive nodes is
given by
2π
∆φ =
(5.11)
Npts
where Npts = d2πρ/he 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 filled up with skewed triangles.
Triangles located in the region interior to the PEC which are rendered by the triangulation subroutine, 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 formulation (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
•
•
•
•
nN odes: 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. Different values of h could be specified 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 Ω ⊂ R2 of interest can be described using the property
a negative quantity
for (x, y) ∈ Ω
d(x, y) =
(5.12)
a nonnegative quantity for (x, y) ∈
/Ω
As a simple example, for an annular region ρ1 < ρ < ρ2 , the distance function is
d(x, y) =
ρ1 − ρ2
ρ1 + ρ2 p 2
− x + y2 +
2
2
(5.13)
which is the same as
d(x, y) = max(d1 (x, y), −d2 (x, y)) =
d1 (x, y) + d2 (x, y)
d1 (x, y) − d2 (x, y)
+
2
2
(5.14)
p
where d1,2 (x, y) = x2 + y 2 − ρ1,2 are the distance functions for the inner and outer circles respectively. 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 dA (x, y) and dB (x, y) respectively,
the three operations required for constructing a sub-region from a larger region in two dimensions,
are listed below.
Union :
Difference :
Intersection :
dA S B (x, y) = min(dA (x, y), dB (x, y))
dA\B (x, y) = max(dA (x, y), −dB (x, y))
dA T B (x, y) = max(dA (x, y), dB (x, y))
17
(5.15)
(5.16)
(5.17)
The operations mentioned above are described geometrically in the figure 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 structure 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 function’s negativity
as a criterion for interioricity).
3. Now, enter the main loop where the location of the nodes is iteratively improved until equilibrium 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 ne × 3 matrix (where ne 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 off-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 situations, 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 COMSOL Multiphysics as an FEM solver was explored in the first 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 subdomain more finely 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 COMSOL’s 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 finite element method to open-region scattering or radiation problems, the
infinite solution domain must be truncated into a finite one. This is a fundamental requirement
of any computational solution due to the restriction of finite 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 reflection, scattering, etc. The problem then, is to determine such
a termination that does not introduce undesirable properties in the scattered fields of interest in the
solution domain, and at the same time, prevents them from differing 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 finite distance from the origin of a coordinate system, the electric and magnetic fields are required
to satisfy the Sommerfeld Radiation Condition [1],
E
E
lim r ∇ ×
+ jk0 r̂ ×
=0
(5.18)
H
H
r→∞
which in two dimensions becomes
lim
ρ→∞
√
∂
ρ
∂ρ
Ez
Hz
+ jk0
20
Ez
Hz
=0
(5.19)
But this condition is no longer valid since the solution domain has been artificially truncated by
some boundary which is located at a finite distance from the scatterer. So, we need to enforce
a suitable boundary condition on this artificial boundary such that a perfect absorbing surface is
simulated. That is, the EM modes in the region see a “transparent” surface, and do not suffer
reflection. This gives the impression that the solution domain is unbounded whereas it is in fact
finite, and hence representible on a computer system with finite memory size.
The first order absorbing boundary condition in two dimensions is given by,
1
∂φsc
+ jk0 +
φsc = 0
∂ρ
2ρ
whereas the second order absorbing boundary condition is given by,
∂φsc
κ
jκ2
j
∂ 2 φsc
+ jk0 + −
φsc −
=0
∂n
2 8(jκ − k0 )
2(jκ − k0 ) ∂s2
(5.20)
(5.21)
where ∂/∂n denotes the derivative normal to the scattering surface (in 2D cylindrical coordinates,
n = ρ) and ∂ 2 /∂s2 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 first order ABC can be directly included in the
FEM formulation. With a suitable redefinition 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 field in the far field zone has the asymptotic form
e−jkρ
φsc (ρ, ϕ) = A(φ) √
ρ
(5.22)
√
The important feature of this asymptotic solution is that it falls of as 1/ ρ and not exponentially
with distance. The first order absorbing boundary condition (ABC) can be rewritten as
1
∂φsc
= −jk −
φsc
(5.23)
∂ρ
2ρ
The convergent expansion for the solution of the Helmoltz equation satisfying the Sommerfeld
radiation condition [1] is given by,
sc
φ (ρ, ϕ) =
(2)
H0 (kρ)
∞
X
fn (ϕ)
n=0
(2)
ρn
+
(2)
H1 (kρ)
∞
X
gn (ϕ)
n=0
ρn
(5.24)
(2)
where H0 and H1 denote the zeroth- and first-order Hankel functions of the second kind, respectively. Using the asymptotic form for the Hankel functions, we can write this as
∞
e−jkρ X an (ϕ)
φ (ρ, ϕ) = √
ρ n=0 ρn
sc
21
(5.25)
From this we can obtain the second order ABC by neglecting terms of order O(ρ−9/2 ) in the following
expression
2 sc
∂φsc
1
1
1
1
1
∂ φ
1
sc
= −jk −
+
+
φ +
+
+O
(5.26)
∂ρ
2ρ 8jkρ2 8k 2 ρ3
2jkρ2 2k 2 ρ3 ∂ϕ2
ρ9/2
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 definition of a second order curvature term
over nonsmooth boundaries.
Further, since an ABC aims to model a reflectionless surface, it cannot be very close to the scatterer. 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 tradeoff
between space complexity and time complexity will remain since higher order ABCs will
require the computation of higher order field derivatives, both tangential as well as normal.
Also, it is known that the Absorbing Boundary Condition runs into difficulties 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 reflections.
Figure 5.6: (a) the unbounded problem, and (b) the geometry augmented with a PML.
The figure 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 reflectionless. Thus,
we are looking for a layer of (artificial) material to enclose our region of interest in such a way that
the fields under study in that region do not “see” this layer. This is a difficult problem in itself, as
a reflectionless layer enclosing the entire solution domain is difficult to develop in the absence of
information about the very fields it must fail to reflect. It should be noted that this layer is artificial.
22
A PML is developed using a three-step process, described by Johnson [8] and illustrated in the
figure below:
Figure 5.7: The three step-process for setting up a PML
1. In infinite 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 reflections.
2. Still in infinite 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 significantly impact the
final solution. So, even hard-wall truncations are acceptable.
The hard-wall truncation at the outer surface of the layer can be effected using a simple Dirichlet
condition for a PEC, for example, incurring minimal (of course, unavoidable) reflections there. It is
known [8] that the PML can be incorporated by the following differential operator transformations
1
∂
∂
→
σ
(x)
x
∂x
1 + i ω ∂x
∂
1
∂
→
σ
(y)
∂y
1 + i y ∂y
ω
23
(5.27)
(5.28)
The artificial 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 reflections due to discretization, and
the existence of some inhomogeneous media where the PML fails to act as a reflectionless 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 differential
operator in the original BVP in a local region of the solution domain, so as to obtain an artificial
medium with finite 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 field itself to satisfy a mixed boundary condition explicitly in
the solution domain. The PML formulation can be deduced from Maxwell’s equations by introducing a complex-valued coordinate transformation with the additional requirement that the wave
impedance should remain unaffected.
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 fields,
it acts as a reflector for any fields that may leak into the PML region. As this is undesirable, an
absorbing boundary condition of the first order can be used to avoid reflections of any remnant
fields in the PML region. As demonstrated by the simulated results, a combination of PML and
ABC reduces the reflections induced by mesh truncation more effectively than purely a first order
ABC.
24
Chapter 6
Methodology Adopted
In this project, we focused on solving the forward problem to compute the scattered electric fields
and total field distributions for the following scenarios:
1.
2.
3.
4.
5.
6.
7.
Perfect Electric Conducting (PEC) cylinder placed in air (vacuum).
PEC concave object placed in air.
PEC square object placed in air.
Two PEC objects (concave + square) placed in air.
Dielectric cylinder placed in air.
PEC cylinder buried under the soil.
Dielectric cylinder buried under the soil.
Mesh truncation schemes used were the first order ABC, the second order ABC and Perfectly
Matched Layers. Of these the first four problems were solved by writing our own computer programs 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,
COMSOL’s meshing subroutines were used.
For the first four situations listed above, our own FEM codes were used with mesh truncation
provided by first 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 reflecting surface in the path of an incident
field. Specifically, PEC objects are near perfect reflectors of the incident field, and impose the severest possible boundary condition on the tangential electric field, 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 field 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 problem 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π/k0 ,
with an electric field amplitude E0 impinges on the cylinder normally,
(6.1)
Einc = âz E0 e−jk0 x = âz E0 e−jk0 ρ cos φ
and is scattered. It is required to find the total electric field (incident + scattered) as a function of
the angle φ at a distance ρ = λ from the center of the cylinder. It is given that a = λ/2 and E0 = 1
V/m.
6.1.1
The Partial Differential Equation for the Total Electric Field
The incident E field is polarized along the z-direction, so the scattered E field from the infinitely
long cylinder is also polarized along the z-direction. Therefore, the total electric field E will have
only a z-directed component: E = E aˆz , and there will be no z-variations in the field:
∂Ez
= 0 =⇒ E = Ez ≡ Ez (x, y)
∂z
(6.2)
Consider the following two time-Harmonic Maxwell’s equations,
(6.3)
(6.4)
∇ × E = −jωµ0 µr H
∇ × H = J + jω0 r E
Solving for H from (6.3) and substituting into (6.4), we get
1
1
−
∇×
∇ × E = J + jω0 r E
jωµ0
µr
Due to (6.2) we also have
∇ × E = âx
(6.5)
∂Ez
∂Ez
− ây
∂y
∂x
(6.6)
The curl term on the left hand side of (6.5) can be written as
∇×
1
∇×E
µr
=
âx
ây
âz
∂
∂x
1 ∂Ez
µr ∂y
∂
∂y
z
− µ1r ∂E
∂x
∂
∂z
= âz
∂
−
∂x
1 ∂Ez
µr ∂x
(6.7)
0
∂
−
∂y
1 ∂Ez
µr ∂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
∂
1 ∂Ez
∂
1 ∂Ez
+
+ k02 r Ez = jωµ0 Jz
(6.9)
∂x µr ∂x
∂y µr ∂y
26
where k02 = ω 2 µ0 0 . The source free version of this equation (for Jz = 0) has the same form as the
canonical scalar wave equation in the Galerkin formulation [1],
∂
∂Φ
∂
∂Φ
−
αx
−
αy
+ βΦ = f
(6.10)
∂x
∂x
∂y
∂y
where,
αx = αy = −
1
µr
(6.11)
(6.12)
(6.13)
(6.14)
Φ = Ez
β = k02 r
f = 0
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 differ from those of the host media.
The incident field is modeled here as a plane polarized wave with the electric field given by
Einc (r) = E0 eiω
√
µ0 0 ·y
(6.15)
· e−iωt
propagating in the negative y-direction in the half space {y > 0}. Here ω is the angular frequency
of the stimulus signal (ω = 2πf , 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
(6.16)
∇2 Ez + k 2 (x, ω)Ez = 0
where
2
k =
ω 2 µr r 0
ω 2 µr r 0 (1 + j tan δ)
and
tan δ =
for y > 0,
for y < 0
(6.17)
σ(x, ω)
ω(x)
√
The free space wavenumber is k0 = ω µ0 0 , and the free space wavelength is λ =
27
(6.18)
2π
Re(k)
=
2π
.
k0
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
Air
Dry Soil
Wet Soil (5% moisture)
TNT
tan δ
k2 (m−2 )
k (m−1 )
0
439.2
20.9
0.025
1273 + j31 35.7 + j0.43
0.22
1756 + j395
42 + j4.7
0.0018 1256 + j2.26 35.4 + j0.03
r
σ (S/m)
1
0
2.9
0.004
4
0.049
2.86 2.864 × 10−4
λ (cm)
30
17
15
17.7
Table 1: Approximate values of r , tan δ, k 2 , k and λ for different 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.
k0 (m−1 ): Propagation constant in free space.
2π
λ (m): Free space wavelength. λ = 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, differing 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 field distribution.
28
Chapter 7
Results
7.1
Circular PEC Object centered at the origin
The first object to be considered has a radius a = λ/2 where λ is the free space propagation wavelength. The first order ABC is imposed at 3λ/2, a wavelength away from the object. The incident
field has the form E0 e−jk0 x for E0 = 1 V /m, k0 = 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 field 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 first order condition. The corresponding plot of the total electric field is
shown in the figure on the right above. This problem has an analytical solution [7], given by
"
#
∞
X
Jn (k0 a) (2)
−n
Ez (ρ, θ) = E0
j
Jn (k0 ρ) − (2)
Hn (k0 ρ) ejnθ
(7.1)
Hn (k0 a)
n=−∞
29
where Ez denotes the z-component of the total electric field, a is the radius of the PEC cylinder,
and ρ and θ are the cylindrical polar coordinates. Here, Jn denotes the Bessel Function of the First
(2)
Kind of order n and Hn denotes the Hankel Function of the Second Kind of order n.
The absolute values of the exact, first order and second order solutions are plotted in the figure
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 1st and 2nd order ABC solutions become smoother as the discretization size is lowered.
2. For a discretization size of λ/25, the 2nd order ABC-based solution almost coincides with the
analytical solution, whereas the 1st order ABC-based solution deviates from the analytical
solution more significantly at very small angles (≈ 0o ), moderately large angles (100o and
260o ) and again at around 360o . The solution is naturally symmetric about the x-axis.
Clearly, the 2nd -order ABC-based solution more closely approximates the total electric field than
the 1st -order ABC based solution.
30
7.2
Location of 2nd order ABC vs. that of 1st order ABC
The total electric field was computed using both the 1st and 2nd order ABC. The 1st order ABC
was imposed at a distance ρ = 2λ whereas the 2nd order ABC was imposed at ρ = 1.5λ, with the
discretization for both situations taken to be 0.04λ.
The total electric field at ρ = λ is plotted below, as a function of the polar angle. It is evident that both the numerical solutions are almost comparable, with the 2nd order solution more
closely approximating the exact (analytical) solution. This demonstrates that the 2nd 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 2nd order ABC over the 1st order ABC.
As is evident from the numerical values, the 2nd order ABC yields a solution comparable to (if not
slightly better than) the 1st 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 1st and 2nd order ABC.
31
7.3
Circular PEC Object placed off 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 field are shown below. The contour plot confirms that the 2nd order solution
is smoother, and better preserves the symmetry of the object. The field very close to the PEC is
expected to be very nearly zero, which is more evident when the 2nd order ABC is used for mesh
truncation.
Figure 7.4: Electric Fields near an off-center PEC Cylinder
Figure 7.5: Contour Plots of the Electric Field, using the 1st order ABC (left) and 2nd 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 field was computed using the 1st and 2nd 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 field in the vicinity of the concave PEC scatterer are plotted
below. Although mostly comparable, the electric field in the near region of the PEC in the forward
scattering direction, is seen to spread backwards less in case of the 2nd 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 1st order
ABC (left) and the 2nd order ABC (right).
33
7.5
Square PEC Object placed off 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 field in the vicinity of the square object are plotted below. The
2nd 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 1st order
ABC (left) and the 2nd order ABC (right).
34
7.6
Two PEC Objects
The framework developed also allows us to examine the field 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 field are shown below. The 2nd order ABC-based solution is much
better than the one based on the 1st order ABC, because it is much more regular and smoother,
and evaluates a very small electric field 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 1st order ABC (left)
and 2nd order ABC (right)
35
7.7
Comparison between 1st order ABC and PML PEC Cylinder in Air
Comsol Multiphysics was used for simulation, and the 1st 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 field within the
PEC, which is not plotted conventionally. This should be ignored.
36
7.8
Comparison between ABC and PML for Dielectric Cylinder 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
field 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 simplified 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 first order ABC on the outer rectangular
boundaries.
Figure 7.14: Scattering from PEC Cylinder buried under Soil (z-component of total field 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 first order ABC on the outer rectangular boundaries.
Figure 7.15: Scattering from Dielectric Cylinder buried under Soil (z-component of total field 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 field.
Note: The contour plots in sections 7.7-7.11 are reproduced after magnification 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 (Effect 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 different discretizations, to illustrate the effect of meshing.
The mesh pattern, a contour plot of the total electric field 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 1st and 2nd 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 field distributions 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 1st and 2nd order ABCs. Exact analytical expressions for 1st and 2nd 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 flexibility while solving a problem computationally.
Using COMSOL Multiphysics as an FEM modelling package, contour plots of the scattered fields
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 complete 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 2nd order ABC is better than the 1st order ABC as for mesh truncation, as it introduces
fewer artifacts in the computational solution, by capturing the curvature of the field.
2. The 2nd order ABC can be imposed at a smaller distance from the scatterer, than
the 1st order ABC, without compromising fidelity 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 field,
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 field 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 Int’l., 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 finite element-ABC and the finite
element-boundary integral methods for electromagnetic scattering,” Ann. Telecommun., vol.
50, no. 5-6, pg. 499-509, May 1995.
10. J.P. Bérenger, “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,” Int’l 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 scattering 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 electromagneticwave propagation for land mine detection using GPR,” Geoscience and Remote Sensing Symposium, July 23-28, 2007, Barcelona, Spain. IGARSS 2007. IEEE International.
15. Allan P. Engsig-Karup, “An introduction to Discontinuous-Galerkin FEM for partial differential 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
−
αy
+ βφ = f
(x, y) ∈ Ω
(8.1)
∂x
∂x
∂y
∂y
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 ŷ · n̂ + γφ = q on Γ2
∂x
∂y
(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
X
φe (x, y)
(8.4)
e=1
A common approximation for φe within element e is the first order polynomial expansion,
φe (x, y) = ae + be x + ce y
(8.5)
where ae , be and ce 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 figure 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 figure. 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
 e 
 e1  
a
1 x1 y 1
φ
 φe2  =  1 x2 y2   be 
(8.6)
e
e1
c
1 x3 y 3
φ
The coefficients can be determined by inverting this system, that is,
−1  e1 
 e  
φ
1 x1 y 1
a
 be  =  1 x2 y2   φe2 
1 x3 y 3
φe1
ce
Putting together, the scalar field φe in element e can be written as

  e1 
(x2 y3 − x3 y2 ) (x3 y1 − x1 y3 ) (x1 y2 − x2 y1 )
φ
1
e



1
x
y
(y
−
y
)
(y
−
y
)
(y
−
y
)
φe2 
φ =
2
3
3
1
1
2
2A
(x3 − x2 )
(x1 − x3 )
(x2 − x1 )
φe1
or
φe =
3
X
Nie (x, y)φei
i=1
44
(8.7)
(8.8)
(8.9)
where
1
[(x2 y3 − x3 y2 ) + (y2 − y3 )x + (x3 − x2 )y]
2A
1
N2e (x, y) =
[(x3 y1 − x1 y3 ) + (y3 − y1 )x + (x1 − x3 )y]
2A
1
[(x1 y2 − x2 y1 ) + (y1 − y2 )x + (x2 − x1 )y]
N3e (x, y) =
2A
and A is the area of the element e, given by
(8.10)
N1e (x, y) =
1
A=
2
1 x1 y1
1 x2 y2
1 x3 y3
=
(8.11)
(8.12)
1
[(x2 − x1 )(y3 − y1 ) − (x3 − x1 )(y2 − y3 )]
2
(8.13)
The value of A is positive if the nodes are numbered counterclockwise (starting from any node)
as shown in the figure above. The Nie ’s are known as element shape functions and satisfy the
following properties:
1, i = j
e e e
Ni (xj , yj ) = δij =
(8.14)
0, i 6= j
3
X
(8.15)
Nie (x, y) = 1
i=1
Weak Form
The weak form of the differential equation
∂φ
∂
∂φ
∂
−
αx
−
αy
+ βφ = f
∂x
∂x
∂y
∂x
(8.16)
is
Z Z
−
Z Z
I
∂w ∂φ
∂φ
∂φ
∂w ∂φ
+ αy
dx dy +
βwφ dx dy −
w αx nx + αy ny dl
αx
∂x ∂x
∂y ∂y
∂x
∂y
Ωe
Γe
Ωe
Z Z
w f dx dy(8.17)
=
Ωe
where nx and ny 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:
1−ξ−η
N1 (ξ, η)
=
N2 (ξ, η)
= ξ
N3 (ξ, η)
= η
The primary unknown quantity φ is interpolated within an element e as
φe (x, y) =
3
X
φej Nj (x, y)
j=1
Here
φej
denotes the value of the unknown quantity at local node j of element e.
45
After appropriate discretization, the weak form becomes
!
!#
X
X
Z Z " 3
3
∂Ni
∂Ni
e ∂Nj
e ∂Nj
φj
+ αy
φj
dx dy
αx
∂x
∂x
∂y
∂y
Ωe
j=1
j=1
!
Z Z
Z Z
I
3
X
∂φ
∂φ
e
+
βNi
φj Nj dx dy =
Ni g dx dy −
Ni αx nx + αy ny dl
∂x
∂y
e
e
Ωe
Ω
Γ
j=1
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
 e   e   e 
 e   e
 e
e
e
e
e
T13
T11 T12
M13
M11 M12
 φ1   g1   p1 
 φ1 
e 
e
e
e 
e
e
 M21
pe2
g2e
φe2
T23
T22
φe2
M23
M22
(8.19)
+
=
+  T21







e 
e
e
e
e
e
e
e
e
e
p3
g3
φ3
T31 T32 T33
φ3
M31 M32 M33
where
Mije
=
pei
αx
e
Tije =
gie
Z Z
Z ZΩ
∂Ni
∂x
∂Nj
∂x
+ αy
∂Ni
∂y
∂Nj
∂y
dx dy
(8.20)
(8.21)
βNi Nj dx dy
Z
e
ZΩ
=
Ni f dx dy
I
∂φ
∂φ
=
Ni αx nx + αy ny dl
∂x
∂y
Γe
The matrix system (8.19) can be written more compactly as
 e   e 
 e
e
e
K11 K12
K13
 φ1   b1 
e 
e
e
 K21
be2
φe2
K23
K22
=




e
e
e
be3
φe3
K33
K32
K31
(8.22)
(8.23)
(8.24)
where
Kije = Mije + Tije
bei = gie + pei
(8.25)
(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.
(yjk )2
(xkj )2
e
Mii = αx
+ αy
(8.27)
4Ae
4Ae
yjk yki
xkj xik
e
Mij = αx
+ αy
(8.28)
4Ae
4Ae
βAe
Tije =
(1 + δij )
(8.29)
12
46
Here Ae denotes the area of the triangular element e, and xij = xei − xej , yij = yie − yje . The elements
of vector g e are given by
f Ae
3
f Ae
=
3
f Ae
=
3
g1e =
(8.30)
g2e
(8.31)
g3e
(8.32)
if f does not appreciably vary over the element. A more general set of matrix equations for a
geometry with Ne elements and Ms Dirichlet/Neumann segments is given by
Ne
Ms
X
X
([K e ]{φe } − {be }) +
([K s ]{φs } − {bs }) = 0
e=1
(8.33)
e=1
where the matrices have been suitably augmented, and the individual elements are given by
Kije =
bei =
1
Ae e
e e e
e e e
(α
b
b
+
α
c
c
)
+
β (1 + δij )
x i j
y i j
e
12
Z4A
Z
f (x, y)Nie (x, y)dx dy
for i, j = 1, 2, 3
for i = 1, 2, 3
(8.34)
(8.35)
Ωe
Kijs
Z
1
γNis Njs ls dξ
=
for i, j = 1, 2
(8.36)
0
bsi
Z
=
1
γqNis ls dξ
for i = 1, 2
(8.37)
0
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 first order ABC (Appendix B) is used or a second order ABC (Appendix C). Assuming that the
matrix elements have been defined properly in accordance with the chosen absorbing boundary
condition, the remaining procedure is as follows.
Integration over an arbitrary triangular patch
The integral expression
bei
ZZ
=
f (x, y)Nie (x, y)dx dy
for i = 1, 2, 3
(8.38)
Ωe
is zero in the total field formulation because f = 0 there, but if one works in the scattered field
formulation, this term arises frequently. Also, if α or β vary inside an element, we have to use the
integral expression for Kije 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 transformation 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
R
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 define the following nonlinear transformation
x(u, v) = (1 − u)xe1 + u [(1 − v)xe2 + vxe3 ]
y(u, v) = (1 − u)y1e + u [(1 − v)y2e + vy3e ]
(8.39)
(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
−xe1 + (1 − v)xe2 + vxe3 −uxe2 + uxe3
J=
(8.41)
−y1e + (1 − v)y2e + vy3e −uy2e + uy3e
Hence, the integral becomes
ZZ
Z
g(x, y)dxdy =
1
u=0
Ωe
Z
1
g(x(u, v), y(u, v))|J|dudv
(8.42)
v=0
where
|J|(u, v) = (−xe1 + (1 − v)xe2 + vxe3 )(−uy2e + uy3e ) − (−y1e + (1 − v)y2e + vy3e )(−uxe2 + uxe3 ) (8.43)
Dirichlet Boundary Conditions
Let the prescribed values of φ be stored in a vector C(i) and let there by N 0 nodes on Γ1 , whose
global node numbers are stored in a vector DBC(i). Then, the Dirichlet boundary condition is
enforced by setting
bDBC(i) = C(i),
KDBC(i),DBC(i) = 1,
bj ← bj − Kj,DBC(i) C(i),
for j 6= DBC(i)
KDBC(i),j = 0
Kj,DBC(i) = 0
for j 6= DBC(i)
(8.44)
(8.45)
for each i = 1, 2, . . . , N 0 . In this problem, C(i) = 0 ∀ i = 1, 2, . . . , N 0 .
Assembly of K e , K s into K
The first 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 N S(s, i) in the code, is constructed
once the segments s (for s = 1, 2, . . . , nSegABC) lying on the ABC boundary have been identified.
Each such segment s consists of two nodes, and so N S(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(N S(s, i), N S(s, j)) ← K(N S(s, i), N S(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 fields are determined by solving the linear
system,
Ku = b
(8.46)
Using element shape functions, the unknown field can be interpolated within any element given its
values at the three nodes of that element. A fine discretization of the solution domain yields a more
accurate solution for the nodal fields 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 refine the solution as required.
49
Appendix B: First Order Absorbing
Boundary Condition
The first order Absorbing Boundary condition has the form
∂φsc
1
+ jk0 +
φsc = 0
∂ρ
2ρ
The mixed boundary condition on a curve Γ2 is given by
∂Φ
∂Φ
aˆx + αy
aˆy · aˆn + γΦ = q
αx
∂x
∂y
(8.47)
(8.48)
which, in this case, is used to enforce the first order absorbing boundary condition [3], given by
1
∂Φsc
+ jk0 +
Φsc = 0
(8.49)
∂ρ
2ρ
Here, Φsc is the scattered field. For this problem, Φsc = Ezsc = Ez − Ezinc . In free space µr = 1, and
the ρ-direction is normal to the outer boundary Γ2 on which the ABC is to be imposed. Therefore,
∂Ez
∂Ez
∂Ez
aˆx +
aˆy · aˆn =
(8.50)
∂x
∂y
∂ρ
1
γ = jk0 +
(8.51)
2ρ
1
inc
q = −jk0 Ez (aˆx · aˆn ) + jk0 +
Ezinc
(8.52)
2ρ
To summarize, a first 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 pei (for i = 1, 2, 3) that must be assigned. Here lij 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
1 − jk0 x21 − e−jk0 x21
e
−jk0 xe1
p1 = E0 q0 l12 e
(k0 x21 )2
−1 + (jk0 x21 + 1)e−jk0 x21
e
−jk0 xe1
p2 = E0 q0 l12 e
(k0 x21 )2
pe3 = 0
(8.53)
(8.54)
(8.55)
where
jk0 (y2e − y1e )
l12
Case 2: Edge 3 → 1 lies on the ABC boundary
−1 + (jk0 x13 + 1)e−jk0 x13
e
−jk0 xe3
p1 = E0 q0 l12 e
(k0 x13 )2
pe2 = 0
1 − jk0 x13 − e−jk0 x13
e
−jk0 xe3
p3 = E0 q0 l13 e
(k0 x13 )2
q0 = γ −
(8.56)
(8.57)
(8.58)
(8.59)
where
jk0 (y1e − y3e )
l13
Case 3: Edge 2 → 3 lies on the ABC boundary
q0 = γ −
(8.61)
pe1 = 0
pe2
pe3
(8.60)
1 − jk0 x32 − e−jk0 x32
−jk0 xe2
= E0 q0 l23 e
(k0 x32 )2
−1 + (jk0 x32 + 1)e−jk0 x32
−jk0 xe2
= E0 q0 l12 e
(k0 x32 )2
(8.62)
(8.63)
where
jk0 (y3e − y2e )
l23
In the alternate formulation (8.33 − 8.37), the elements of K s are given by
q0 = γ −
(8.64)
ls
K s (i, j) = γ (1 + δij )
6
(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 nx + αy ny + γφ = q
on Γ2
(8.66)
∂x
∂y
The absorbing boundary condition must be recast in this canonical form so as to determine the
elements of the vector pe (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 field and a scattered field, and identify γ and q to
be given by2
jκ2
j
∂2
κ
−
(8.67)
γ = α jk0 + −
2 8(jκ − k0 ) 2(jκ − k0 ) ∂s2
κ
jκ2
jα
∂ 2 φinc
∂φinc
inc
+ α jk0 + −
φ −
(8.68)
q = α
∂n
2 8(jκ − k0 )
2(jκ − k0 ) ∂s2
In order to incorporate the general boundary condition of the third kind, contributions from the
functional
Z 1
φγφ − qφ dΓ
(8.69)
Fb =
2
Γ2
must be accounted for in the weak form given. Here, γ has been “sandwiched” by the unknown field.
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 first order ABC [1]. To further simplify the
analysis, we write
γ = γ1 + γ2
∂2
∂s2
(8.70)
with
κ
jκ2
= α jk0 + −
2 8(jκ − k0 )
jα
= −
2(jκ − k0 )
γ1
γ2
2
It is assumed hereafter that αx = αy = α.
52
(8.71)
(8.72)
We can write Fb as
Fb
Z 1
∂ 2φ
2
=
γ1 φ + γ2 φ 2 − qφ dΓ
∂s
Γ2 2
#
2
Z "
1
1
∂φ
=
γ1 φ2 − γ2
− qφ dΓ
2
2
∂s
Γ2
(8.73)
(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 Fb over each element as was done for the 1-ABC:
Fb =
Ms
X
Fbs (φs )
(8.75)
s=1
where Fbs denotes the integral over segment s. Differentiating with respect to φsi gives the matrix
system
s
∂Fb
= [K s ]{φs } − {bs }
(8.76)
∂φs
with the elements in [K s ] and {bs } given by
Z 1
s
Kij =
γNis Njs ls dξ
i, j = 1, 2
0
Z 1
s
bi =
qNis ls dξ
i = 1, 2
(8.77)
(8.78)
0
with q given by (6.69). For the 2-ABC, the expression for Kijs is given by
Kijs
Z
=
0
1
γ2 ∂Nis ∂Njs
s s s
dξ
γ1 l Ni Nj − s
l ∂ξ ∂ξ
(8.79)
Here N1s (ξ) = 1 − ξ and N2s (ξ) = ξ, so that N1s (ξ) + N2s (ξ) = 1. This gives us
ls γ2s
+ s
3
l
s
s
l
γ
= γ1s − s2
6
l
s
s
K11
= K22
= γ1s
(8.80)
s
s
K12
= K21
(8.81)
Evaluation of pei
There are three cases to consider while imposing the 2nd order ABC on a circular boundary, depending on which edge of a triangular boundary element lies on the ABC contour. These three
cases are similar to those considered in the 1nd order ABC in Appendix B, but the expressions for
pei are considerably more complex because of the structure of the function q in (8.68), and the fact
that γ is now a differential operator.
53
The unknown field is φ = Ez and φinc = Ezinc = E0 e−jk0 x . Now, q becomes
κ
jκ2
jα
jk0 x k02 y 2
jk0 E0 α −jk0 x
−jk0 x
xe
+α jk0 + −
E0 e
−
E0 e−jk0 x
q(x, y) = −
−
ρ
2 8(jκ − k0 )
2(jκ − k0 )
ρ2
ρ
(8.82)
e
Since pi 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,
(8.83)
y = mx + c
thereby converting q to a function of x alone along the edge under consideration. For simplification,
we define
jk0 αE0
(8.84)
a = −
ρ
κ
jκ2
b̃ = α jk0 + −
E0
(8.85)
2 8(jκ − k0 )
αk0 E0
(8.86)
c1 =
2(jκ − k0 )ρ2
jαk02 E0
c2 =
(8.87)
2(jκ − k0 )ρ
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 fine graining of the 2-ABC, this approximation will affect its accuracy
less than in case of the 1-ABC. However, this approximation is not so poor, because we can increase
the fineness 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, c1 and c2 are global
constants and we have
q(x, y) = axe−jk0 x + b̃e−jk0 x + c1 xe−jk0 x + c2 y 2 e−jk0 x
(8.88)
Further, substituting y = mx + c, we get
q(x) ≡ A1 e−jk0 x + A2 xe−jk0 x + A3 x2 e−jk0 x
(8.89)
A1 = b̃ + c2 c2
A2 = 2c2 cm + c1 + a
A3 = c2 m2
(8.90)
(8.91)
(8.92)
where
Case 1: Edge 1 → 2 lies on the ABC boundary
In this case,
m=
y2 − y1
x2 − x1
and
c=
54
x1 y2 − x2 y1
x2 − x1
(8.93)
The line can be parametrized as
x = x1 + ξ(x2 − x1 )
y = y1 + ξ(y2 − y1 )
(8.94)
(8.95)
where ξ ∈ [0, 1]. This allows us to recast q in the form
q(ξ) ≡ (Ã1 + Ã2 ξ + Ã3 ξ 2 )e−jk0 x21 ξ
(8.96)
Ã1 = (A1 + A2 x1 + A3 x21 )e−jk0 x1
Ã2 = (A2 + 2A3 x1 )x21 e−jk0 x1
Ã3 = A3 x221 e−jk0 x1
(8.97)
(8.98)
(8.99)
where
The integrals defining the elements of pe are:
pe1
Z
1
= −
(1 − ξ)q l12 dξ
(8.100)
ξ q l12 dξ
(8.101)
0
pe2
Z
= −
1
0
(8.102)
pe3 = 0
Thus, the elements of pe are:
n
o
l12 h
2
Ã
(3
−
jk
x
)
+
k
x
Ã
k
x
(−1
+
jk
x
)
+
Ã
(2j
+
k
x
)
+
3
0
21
0
21
1
0
21
0
21
2
0
21
(k0 x21 )4
n
oi
e−jk0 x21 k0 x21 (Ã1 k0 x21 + Ã2 (−2j + k0 x21 )) + Ã3 (−6 + k0 x21 (−4j + k0 x21 ))
l12 h
6Ã3 + k0 x21 (2j Ã2 − Ã1 k0 x21 ) +
= −
(k0 x21 )4
n
oi
e−jk0 x21 −6Ã3 − 2j(Ã2 + 3Ã3 )k0 x21 + (Ã1 + 2Ã2 + 3Ã3 )k02 x221 + j(Ã1 + Ã2 + Ã3 )k03 x321
pe1 =
pe2
pe3 = 0
where xij = xi − xj . If x21 = 0, we can write
q(y) = q1 + q2 y 2
(8.103)
q1 = axe−jk0 x1 + b̃e−jk0 x1 + c1 x1 e−jk0 x1
q2 = c2 e−jk0 x1
(8.104)
(8.105)
where
55
In this case, the elements of pe become
Z 1
e
(1 − ξ)(q1 + q2 (y1 + ξ(y2 − y1 ))2 )dξ
p1 = −l12
0
q1 q2 y12 q2 y1 y2 q2 y22
= l12 − −
−
−
2
4
6
12
Z 1
ξ(q1 + q2 (y1 + ξ(y2 − y1 ))2 )dξ
pe2 = −l12
0
q1 q2 y12 q2 y1 y2 q2 y22
= l12 − −
−
−
2
12
6
4
e
p3 = 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 transformations:
→
→
→
→
→
x1
x2
y1
y2
l12
x3
x1
y3
y1
l31
The slope and intercept are given by
m=
so that
y1 − y3
x1 − x3
and
c=
x3 y1 − x1 y3
x1 − x3
(8.106)
q(ξ) ≡ (Ã1 + Ã2 ξ + Ã3 ξ 2 )e−jk0 x13 ξ
(8.107)
Ã1 = (A1 + A2 x3 + A3 x23 )e−jk0 x3
Ã2 = (A2 + 2A3 x3 )x13 e−jk0 x3
Ã3 = A3 x213 e−jk0 x3
(8.108)
(8.109)
(8.110)
where
with Ai (i = 1, 2, 3), given by equations (8.97 − 8.99) and m and c given by equation (8.106). The
integrals defining the elements of pe are:
Z 1
e
p1 = −
ξ q l31 dξ
(8.111)
0
pe2
(8.112)
= 0
pe3 = −
Z
1
(1 − ξ)q l31 dξ
0
56
(8.113)
Thus, the elements of pe are:
l31 h
e
p1 = −
6Ã3 + k0 x13 (2j Ã2 − Ã1 k0 x13 ) +
(k0 x13 )4
n
oi
e−jk0 x13 −6Ã3 − 2j(Ã2 + 3Ã3 )k0 x13 + (Ã1 + 2Ã2 + 3Ã3 )k02 x213 + j(Ã1 + Ã2 + Ã3 )k03 x313
pe2 = 0
pe3
n
o
l31 h
=
2Ã3 (3 − jk0 x13 ) + k0 x13 Ã1 k0 x13 (−1 + jk0 x13 ) + Ã2 (2j + k0 x13 ) +
(k0 x13 )4
n
oi
e−jk0 x13 k0 x13 (Ã1 k0 x13 + Ã2 (−2j + k0 x13 )) + Ã3 (−6 + k0 x13 (−4j + k0 x13 ))
If x13 = 0, we can write
q(y) = q1 + q2 y 2
(8.114)
q1 = axe−jk0 x3 + b̃e−jk0 x3 + c1 x3 e−jk0 x3
q2 = c2 e−jk0 x3
(8.115)
(8.116)
where
In this case, the elements of pe become
Z 1
e
p1 = −l31
ξ(q1 + q2 (y3 + ξ(y1 − y3 ))2 )dξ
0
q1 q2 y32 q2 y3 y1 q2 y12
−
−
= l31 − −
2
12
6
4
e
p2 = 0
Z 1
e
p3 = −l31
(1 − ξ)(q1 + q2 (y3 + ξ(y1 − y3 ))2 )dξ
0
q1 q2 y32 q2 y3 y1 q2 y12
= l31 − −
−
−
2
4
6
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 transformations:
x1
x2
y1
y2
l12
→
→
→
→
→
x2
x3
y2
y3
l23
The slope and intercept are given by
m=
y3 − y2
x3 − x2
and
c=
57
x2 y3 − x3 y2
x3 − x2
(8.117)
so that
q(ξ) ≡ (Ã1 + Ã2 ξ + Ã3 ξ 2 )e−jk0 x32 ξ
(8.118)
Ã1 = (A1 + A2 x2 + A3 x22 )e−jk0 x2
Ã2 = (A2 + 2A3 x2 )x32 e−jk0 x2
Ã3 = A3 x232 e−jk0 x2
(8.119)
(8.120)
(8.121)
where
with Ai (i = 1, 2, 3), given by equations (8.97 − 8.99) and m and c given by equation (8.117). The
integrals defining the elements of pe are:
(8.122)
pe1 = 0
pe2 = −
Z
1
(1 − ξ)q l23 dξ
(8.123)
ξ q l23 dξ
(8.124)
0
Z
pe3
= −
1
0
Thus, the elements of pe are:
pe1 = 0
n
o
l23 h
2
Ã
(3
−
jk
x
)
+
k
x
Ã
k
x
(−1
+
jk
x
)
+
Ã
(2j
+
k
x
)
+
3
0 32
0 32
1 0 32
0 32
2
0 32
(k0 x32 )4
n
oi
e−jk0 x32 k0 x32 (Ã1 k0 x32 + Ã2 (−2j + k0 x32 )) + Ã3 (−6 + k0 x32 (−4j + k0 x32 ))
l23 h
6Ã3 + k0 x32 (2j Ã2 − Ã1 k0 x32 ) +
= −
(k0 x32 )4
n
oi
−jk0 x32
2 2
3 3
e
−6Ã3 − 2j(Ã2 + 3Ã3 )k0 x32 + (Ã1 + 2Ã2 + 3Ã3 )k0 x32 + j(Ã1 + Ã2 + Ã3 )k0 x32
pe2 =
pe3
If x32 = 0, we can write
q(y) = q1 + q2 y 2
(8.125)
q1 = axe−jk0 x2 + b̃e−jk0 x2 + c1 x2 e−jk0 x2
q2 = c2 e−jk0 x2
(8.126)
(8.127)
where
In this case, the elements of pe become
pe1 = 0
pe2
pe3
Z
1
= −l23
(1 − ξ)(q1 + q2 (y2 + ξ(y3 − y2 ))2 )dξ
0
q1 q2 y22 q2 y2 y3 q2 y32
−
−
= l23 − −
2
4
6
12
Z 1
= −l23
ξ(q1 + q2 (y2 + ξ(y3 − y2 ))2 )dξ
0
q1 q2 y22 q2 y2 y3 q2 y32
= l23 − −
−
−
2
12
6
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 field 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 field 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 ne × 3 matrix, each row of which stores the global node
numbers of the three nodes making up element e. Here ne 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
rCyl =
rABC =
h
=
= 1;
0.5*lambda;
1.5*lambda;
0.04*lambda;
% Radius of the circular PEC cylinder in wavelengths
% Radius of the outer circular ABC boundary in wavelengths
% 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((rABC−rCyl)/(sqrt(3)*h/2)); % No. of annular rings
dr
= (rABC−rCyl)/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 + (j−1)*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 = (jj−1)*dphi;
% absolute angular coordinate of current
63
x(nNodes) = r*cos(phi); % x−coordinate of current node
y(nNodes) = r*sin(phi); % y−coordinate 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 re−numbered.
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
rABC
rCyl
cx
cy
h
Meshing Code for Off-center Cylinder
=
=
=
=
=
1.5;
0.5;
0;
0.5;
0.04;
%
%
%
%
%
radius of ABC boundary (in wavelengths)
radius of cylinder (in wavelengths)
x−coordinate of center of cylinder
y−coordinate of center of cylinder
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 re−numbered.
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 re−numbered.
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 re−numbered.
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 re−numbered.
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 defined.
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) = x−coordinates of vertices
%
p(:,2) = y−coordinates 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(rABC−r0)<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 6= −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 6= −1)
flag(e,i) = 1; % ABC node
else
index=ArrSearch(DBC,N(e,i));
if(index 6= −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
fprintf('The
fprintf('The
fprintf('The
number
number
number
number
of
of
of
of
nodes
elements
nodes on a Dirichlet boundary
nodes on an ABC boundary
=
=
=
=
%6i\n',
%6i\n',
%6i\n',
%6i\n',
nNodes);
nElements);
nDBC);
nABC);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEFINE INPUT PARAMETERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
lambda
rABC =
h
=
E_0 =
= 1;
1.5*lambda; % Radius of the outer circular ABC boundary in wavelengths
0.04*lambda; % Discretization size in wavelengths
1;
% Amplitude of incident electric field (V/m)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEFINE CONSTANTS FOR EACH ELEMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
J = complex(0.,1.);
mur
= 1; % Relative
epsr
= 1; % Relative
k_0
= 2*pi/lambda; %
alpha
= −1/mur;
kappa
= 1/rABC;
gamma_1 = alpha*(J*k_0 +
mu_r
eps_r
alpha_x
alpha_y
beta
A
=
=
=
=
=
=
permeability (assuming vaccum)
permittivity (asumming vacuum)
wavenumber
kappa/2 − J*kappa^2/(8*(J*kappa−k_0)));
zeros(1,nElements);
zeros(1,nElements);
zeros(1,nElements);
zeros(1,nElements);
zeros(1,nElements);
zeros(1,nElements);
% relative permeability
% relative permittivity
% coefficient of second order x term in PDE
% coefficient of second order y term in PDE
% coefficient of term linear in field in PDE
% 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
a
b
c
coefficients of the linear interpolation functions
= zeros(nElements,3);
= zeros(nElements,3);
= 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_21
y_31
y_23
A(e)
=
=
=
=
y(N(e,1)) − y(N(e,2));
−y_12;
y(N(e,3)) − y(N(e,1));
y(N(e,2)) − y(N(e,3));
= 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*y3−x3*y2;
b(e,1) = y2−y3;
c(e,1) = x3−x2;
a(e,2) = x3*y1−x1*y3;
b(e,2) = y3−y1;
c(e,2) = x1−x3;
a(e,3) = x1*y2−x2*y1;
b(e,3) = y1−y2;
c(e,3) = x2−x1;
% 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 6= 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
x3p
y2p
y3p
A1
=
=
=
=
=
x(N(e,2)) − xgrid(i,j);
x(N(e,3)) − xgrid(i,j);
y(N(e,2)) − ygrid(i,j);
y(N(e,3)) − ygrid(i,j);
0.5*abs(x2p*y3p − x3p*y2p);
x2p
x1p
y2p
y1p
A2
=
=
=
=
=
x(N(e,2)) − xgrid(i,j);
x(N(e,1)) − xgrid(i,j);
y(N(e,2)) − ygrid(i,j);
y(N(e,1)) − ygrid(i,j);
0.5*abs(x2p*y1p − x1p*y2p);
x1p
x3p
y1p
y3p
A3
=
=
=
=
=
x(N(e,1)) − xgrid(i,j);
x(N(e,3)) − xgrid(i,j);
y(N(e,1)) − ygrid(i,j);
y(N(e,3)) − ygrid(i,j);
0.5*abs(x1p*y3p − x3p*y1p);
x21
x31
y21
y31
Ae
=
=
=
=
=
x(N(e,2)) − x(N(e,1));
x(N(e,3)) − x(N(e,1));
y(N(e,2)) − y(N(e,1));
y(N(e,3)) − y(N(e,1));
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)=(I−1)*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*y3p−x3p*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*y1p−x1p*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*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*(x21*y31−x31*y21);
75
if abs(Ae−(A1+A2+A3)) < 0.00001*Ae
ksi=(y31*(xeval−x(N(e,1)))−x31*(yeval−y(N(e,1))))/(2*Ae);
ita=(−y21*(xeval−x(N(e,1)))+x21*(yeval−y(N(e,1))))/(2*Ae);
N1=1−ksi−ita;
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 = 1−ksi;
end
J = complex(0.,1.);
x = (1−ksi).*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 = (1−u).*x1 + u.*((1−v).*x2 + v.*x3);
y = (1−u).*y1 + u.*((1−v).*y2 + v.*y3);
jacob = (−x1+(1−v).*x2+v.*x3).*(−u.*y2+u.*y3)−
(−y1+(1−v).*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) = x−coordinates of vertices
%
p(:,2) = y−coordinates 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(rABC−r0)<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 6= −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 6= −1)
flag(e,i) = 1; % ABC node
else
index=ArrSearch(DBC,N(e,i));
if(index 6= −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('
fprintf('The
fprintf('The
fprintf('The
fprintf('The
number
number
number
number
RESULTS
of nodes
of elements
of nodes on a Dirichlet boundary
of nodes on an ABC boundary
=
=
=
=
\n\n');
%6i\n', nNodes);
%6i\n', nElements);
%6i\n', nDBC);
%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*kappa−k_0)));
gamma_2 = −J*alpha/(2*(J*kappa−k_0));
mu_r
eps_r
alpha_x
alpha_y
beta
A
=
=
=
=
=
=
zeros(1,nElements);
zeros(1,nElements);
zeros(1,nElements);
zeros(1,nElements);
zeros(1,nElements);
zeros(1,nElements);
% relative permeability
% relative permittivity
% coefficient of second order x term in PDE
% coefficient of second order y term in PDE
% coefficient of term linear in field in PDE
% 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
a
b
c
coefficients of the linear interpolation functions
= zeros(nElements,3);
= zeros(nElements,3);
= 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_21
y_31
y_23
A(e)
=
=
=
=
y(N(e,1)) − y(N(e,2));
−y_12;
y(N(e,3)) − y(N(e,1));
y(N(e,2)) − y(N(e,3));
= 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*y3−x3*y2;
b(e,1) = y2−y3;
c(e,1) = x3−x2;
a(e,2) = x3*y1−x1*y3;
b(e,2) = y3−y1;
c(e,2) = x1−x3;
a(e,3) = x1*y2−x2*y1;
b(e,3) = y1−y2;
c(e,3) = x2−x1;
% 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 6= 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))
btilde(DBC(i)) = 0;
= 1;
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
x1p
y2p
y1p
A2
=
=
=
=
=
x(N(e,2)) − xgrid(i,j);
x(N(e,1)) − xgrid(i,j);
y(N(e,2)) − ygrid(i,j);
y(N(e,1)) − ygrid(i,j);
0.5*abs(x2p*y1p − x1p*y2p);
x1p
x3p
y1p
y3p
A3
=
=
=
=
=
x(N(e,1)) − xgrid(i,j);
x(N(e,3)) − xgrid(i,j);
y(N(e,1)) − ygrid(i,j);
y(N(e,3)) − ygrid(i,j);
0.5*abs(x1p*y3p − x3p*y1p);
x21
x31
y21
y31
Ae
=
=
=
=
=
x(N(e,2)) − x(N(e,1));
x(N(e,3)) − x(N(e,1));
y(N(e,2)) − y(N(e,1));
y(N(e,3)) − y(N(e,1));
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)=(I−1)*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*y3p−x3p*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*y1p−x1p*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*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*(x21*y31−x31*y21);
if abs(Ae−(A1+A2+A3)) < 0.00001*Ae
ksi=(y31*(xeval−x(N(e,1)))−x31*(yeval−y(N(e,1))))/(2*Ae);
ita=(−y21*(xeval−x(N(e,1)))+x21*(yeval−y(N(e,1))))/(2*Ae);
N1=1−ksi−ita;
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 = 1−ksi;
end
J = complex(0.,1.);
x = (1−ksi).*x1 + ksi.*x2;
y = (1−ksi).*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*kappa−k_0))
− J*k_0*kappa.*x −
0.5*J*kappa^2/(J*kappa−k_0))*(J*k_0.*x−k_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 = (1−u).*x1 + u.*((1−v).*x2 + v.*x3);
y = (1−u).*y1 + u.*((1−v).*y2 + v.*y3);
jacob = (−x1+(1−v).*x2+v.*x3).*(−u.*y2+u.*y3)−
(−y1+(1−v).*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
Download