Abstract
The lessons from the previous chapters are here applied to a very brief discussion of numerical techniques. First we show how to calculate the capacitance of three-dimensional structures; we then follow this with similar calculations of inductance. Both of these are well defined in the long wavelength approximation. We then describe how a full wave numerical solutions can be implemented using the popular method-of-moments. We follow this by discussing how to implement excitations or wave ports and how to implement boundary conditions between different dielectric layers.
6.1 Introduction
This chapter will take our experience from Chapters 4 and 5 and use some of these results to sketch how simulators work. We will not go into great detail, as it is somewhat outside the scope of the book, but from what we have learned so far we can draw some interesting conclusions about what will make a good simulator and how a poor one may be revealed. In fact, this chapter will show yet another application of estimation analysis, although the context is quite different. We will make simplifying assumptions and briefly discuss the solution and verify/evaluate the result. There are many details when implementing a real-world simulator that fall outside the scope of this book, and we provide the interested reader with avenues to explore further in the References section below.
We start with the simple case of electrostatics where we show how charge induced from a voltage can be solved by, in principle, quite simple methods. After that we investigate inductance simulations by calculating fields from current distributions. We proceed by showing some of the basic steps necessary to design a full-wave simulator, and what an excitation port is and how it is used. Finally, a brief overview of Matrix inversions is provided.
6.2 Basic Simulator Principles
All simulators follow the same basic principles: divide the subject matter (be it time or space) into smaller chunks, referred to as a grid or mesh. Assume that inside each chunk, the property of interest is not varying at all or is varying slowly, either a constant or some linear and perhaps some higher-order polynomial. Set up the governing equations with these approximations in mind and solve them (nearly always by inverting a matrix). Repeat by refining the grid until the desired accuracy has been reached. These same principles can be found in circuit simulators, Maxwell field solvers, system simulators, etc.
For our purpose, we would like to see how field solvers operate. We have seen in previous chapters that the field from current segments can be solved precisely and, as the reader has probably guessed by now, some field solvers work by dividing up the current-carrying conductors into smaller chunks where each chunk has a constant current. Similarly, if we want to know capacitance, we divide the surface of each conductor into smaller pieces where we assume voltage and charge is either constant or slowly varying in some cases.
6.3 Long Wavelength Simulators
Long wavelength simply means that the length scales of the problem are much smaller than any field wavelength, as we saw in Chapter 4. The vector potential, AA, will give rise to magnetic fields and thus inductance, whereas φφ will create electric field and capacitance. We will take a look at these effects in turn.
Capacitance Simulations in Three Dimensions
We know from Chapter 4 that the long-wavelength approximation means the length scales of the problem are much smaller than any wavelength of the fields. For the potential field, we have from (4.29) that
outside any conductor (where the charge is zero). This is simply Laplace’s equation in three dimensions. It may be tempting to attempt to solve this equation with a given set of boundary conditions. It certainly looks fairly innocuous, but the main difficulty one runs into is one of accuracy. The result of the simulation will be induced charge on the surfaces of various conductors. To calculate the charge will involve taking the second-order derivative of φφ at the surface. We know from the equation itself this derivative is zero outside. In order to implement something like this, the grid needs to be really fine and it will take a long time to solve. Instead, it is more efficient to start from (4.37) to calculate the induced charge. Here, we divide the conductors into smaller shapes where we assume the charge is constant, and using (4.37) we then calculate the potential this charge distribution produces at a certain point xx. We then simply go through all the conductors, calculate the voltage resulting from everything else, and end up with a matrix equation.
We will illustrate this process by making some simplifications to illustrate the main point. It is a good example of estimation analysis but the context is a little different from the rest of the book. The estimation analysis will here result in a set of pseudocodes that could be implemented. The reader must bear in mind that following these procedures will produce codes that work in principle. Building codes that are efficient and void of bugs is a whole different cup of tea and way outside the scope of the book.
Simplify
We now make a number of simplifications:
The conductors are perfect, so no charge will penetrate into the volume of the conductors, i.e., they are surface charges.
We divide each conductor surface into much smaller surface segments where the charge is constant: see Figure 6.1.
There is only one dielectric medium, so no dielectric boundaries need to be considered.
We will ignore the complication of self-interaction where a given charge impacts the voltage on its own segment (there is a singularity). This is an important effect and not that difficult to deal with, but for illustrative purposes we will not address this problem here.
Figure 6.1 Conductors in three dimensions where the surface is divided up into smaller areas within which the charge is constant.
Solve
Let us now define the problem by looking at the potential from a charge on a surface segment jj, at a point rr. We have from equation (4.37)

We now calculate this voltage at a point in the center, riri, of another segment ii and sum over all segments. We find

This can be written as a matrix equation:
From the boundary condition we know the value of VV on all surfaces, and we can calculate GG and solve for ρρ. To get to capacitance, let us be a little more careful with notation. Let us assume we have NsegNseg conductor segments, each of which is subdivided into NsubNsub charge segments. We have a total number, Ntot = NsegNsubNtot=NsegNsub of charge segments. Let us denote by ρijρij charge segment jj on conductor segment ii. In order to find the capacitance between conductor segment ii and jj, we need to ground all segments except ii, which has a voltage of Vi = VVi=V. We solve (6.1) and calculate the capacitance from (4.48)

With this procedure one needs to go through all conductors and set each voltage to VV one at a time, keeping all others grounded, solve the equation, and calculate the resulting capacitance. It sounds easy enough and it sort of is, but the difficulty lies in the details. The integrand has a divergence when i = ji=j that is fairly strong and the accuracy required in the numerical integration can be excessive. Furthermore, the grid is critical and in order to set it up properly one has to have a deep understanding of how charge will distribute itself on the surfaces beforehand. However, the pseudocode is straightforward.
Pseudocode
Subroutine build_G(Mesh)
* Loop over Mesh to build Matrix G.
For i = 0,N do
For j = 0,N do
Integrate_element(r[i],r[j])
End for
End for
End build_GSubroutine CapacitanceSolver
Create_mesh(Mesh)
G = Build_G(Mesh)
Ginv = Invert_matrix(G)
For i = 1,N do
V = Define_voltages(Mesh)
rho = Multiply(Ginv,V)
C[i] = sum(rho) // Assuming the voltage V = 1.
End for
End CapacitanceSolver
Verify
Simulators are traditionally verified by having them solve known problems and comparing the solutions. We leave it as an exercise to the reader to implement a code and gain experience by learning by actually doing.
Evaluate
We are not going to go to the trouble of actually building codes here, but simply state that although this may sound really simple and in some meaning of the word it is, the problem comes when you want accuracy. The charge tends to want to sit at the edges of the conductors, similar to the current distributions we examined in Chapter 5. This means that around those edges the surface elements must become really small to resolve the charge distribution, adding up to quite a few elements for large geometries. Some serious tricks need to be employed to get to the bottom of this and make the problem manageable. The most successful simulators have in common that they have found clever ways to manage the grid-generating algorithms. This has made some inventors very wealthy indeed. The construction of the grid and the speed with which the matric, GG, is calculated are critical parts of building simulators. If this is done poorly it will take a long time to find a solution for a given accuracy.
Inductance Simulations in Three Dimensions
Inductance simulators can be made in a similar fashion, where we divide up the conductor into smaller current-carrying segments. The steps we need to go through are somewhat more complicated, and we will just sketch the procedure here. Far more details can be found in [3].
Simplify
We assume we are dealing with one long wire of a certain thickness and width that are much smaller than the conductor length. We chop the wire into small conductor segments where we assume several things:
The magnitude of the current in each conductor segment is the same, so there is no capacitive or other loss.
The current is uniform in a cross-section of the wire, in other words skin depth is not important. Each conductor segment can then cover the full cross-section of the wire.
These is only one magnetic medium, so no boundaries need to be considered.
We will ignore the complication of self-interaction where a given current segment impacts its own magnetic field (there is a singularity). This is an important effect and not that difficult to deal with, but for illustrative purposes we do not address this problem here.
Solve
Let us now define the problem by looking at the vector potential from a current on a conductor segment ii, at a point rr. We have from (4.36)

With this expression we can now calculate the partial inductance matrix, Li, jLi,j, between segments i, ji,j, using (4.46) and
We find

We refer to the case i ≠ ji≠j as the mutual inductance and i = ji=j as the self-inductance, similar to what we discussed earlier. Here we see explicitly the convenient fact that when the two currents are perpendicular to each other their mutual inductance is zero. If we decide not to divide the conductors – perhaps they are really thin, or frequency is low – we will be done here. We merely have to sum up all the elements to get the total inductance of the wire.

Notice the similarities in the expressions here compared with the previous section with the capacitance solver, where we summed over all charges and divided by the voltage difference to get the total capacitance between two conductors. There are a couple of important differences. For example, for the inductance case, we assume just one wire with a certain fixed current going through all segments. This greatly simplifies the analysis and we can just calculate the coupling without having to solve a matrix equation. The normal duality of capacitance and inductance is hidden due to these different assumptions.
But we can take this one step further and look at the situation where skin effect is important. We make some additional simplifications:
The conductors are close to ideal so the current will only flow within a certain surface depth. There is no resistive loss.
We divide the surface of each conductor segment into much smaller surface segments within which we assume the current is constant. For simplicity, the number of subsegments is the same for all conductor segments.
For a conductor segment, we assume the voltage drop across all surface segments is constant.
By subdividing the conductor segments into smaller segments where the current inside each is constant, we find similarly to before

This defines the inductance matrix between each small surface segment. This is not quite what we want. We need the partial inductance for a particular conductor segment, which we can then sum up to find the total inductance of the whole structure, and we do not know the size of the current in each surface segment a priori. In order to move along we need to be a little more careful with the definition of the index notation. A surface segment, ii, belongs to a certain conductor kk and inside this conductor segment it has a subindex, ll. We then have the total number of current segments, NtotalNtotal is the total number of conductor segments, NsegNseg, times the total number of surface-segments, NsubNsub.
A particular current segment ii is then referred to as klkl. Likewise for the index jj we refer to a particular conductor segment mm and a subsegment nn (see Figure 6.2).
Figure 6.2 A cross-section of a conductor with subsegments where the mutual inductance integral is indicated.
We now know the partial inductance for each segment, and since we also know the total current we can calculate the voltage drop across each segment assuming a particular frequency ωω and using ohm’s law,

with Zkl, mnZkl,mn denoting the impedance matrix. This is just a matrix equation, and we can take the inverse to find the individual currents for each surface segment

where Ymn, klYmn,kl is the admittance matrix. We start to see the resemblance to the capacitance calculation in section “Capacitance Simulations in Three Dimensions.” We can now take advantage of one of our simplifications, that the sum of all currents within a conductor segment is constant, conductor segment to conductor segment,

We get

The matrix ym, kym,k is the admittance matrix between conductor segment mm and kk. After a simple inversion we find finally the impedance matrix between conductor segments.
And we can find the total inductance by

Pseudocode
Subroutine build_Zij(Mesh)
* Build Matrix by looping over the Mesh
For i = 0,N do
For j = 0,M do
Integrate_element(r[i],r[j])
End for
End for
End build_AijSubroutine InductanceSolver
Create_mesh(Mesh)
Zij = Build_Zij(Mesh)
Yij = Matrix_Inverse(Zij)
yij = Contract_subsegments(Yij)
zij = Matrix_Inverse(yij)
End InductanceSolver
Evaluate
Compared with the capacitance calculation, this is somewhat more complicated, and a few more steps need to be taken if the detailed surface current distribution needs to be known. However, the same caveats we listed in section “Capacitance Simulations in Three Dimensions” apply here. Building an efficient mesh, or grid, is challenging, since the currents tend to crowd near the edges as we outlined in Chapter 5, Figures 5.30 and 5.31. Another observation is that the duality we highlighted in Chapter 4 between capacitance and inductance is nontrivial to take advantage of, in that the capacitance calculation used the fact that the values of the potential, φφ, are known, and a fairly straightforward matrix equation can be set up. For the inductance case there is no boundary condition on the corresponding vector potential, AA. Instead, the boundary condition is set by the total current, so a few more steps need to be taken to solve for the inductance.
6.4 Method of Moments
In the previous section we calculated the capacitance and inductance separately through their induced charges and currents. This is a great simplification and useful in the long-wavelength approximation where such concepts are well defined. In the short wavelength regime, or more popularly the full-wave regime, it is no longer possible to separate the charges and currents and we need to solve for both at once. We will briefly describe here how this can be done with the popular method of moments.
Simplify
We make the following simplifications:
The currents are constant and in a given direction within a small segment.
There is no local charge buildup, so that all currents going out of one segment enter the next segment.
We ignore again the problem of self-interaction due to space limitations.
We only consider waves that are outgoing, ~e−jkr~e−jkr.
We can now divide all currents into small current segments and write the current as:

where InIn has magnitude 1 and is the direction of the local segment and anan are the magnitudes.
Solve
We get using this expression for the currents in the electric field equation (4.8) where we can write φφ in terms of AA via (4.12)

where we have used the full-wave 3D solutions of A, φA,φ to Maxwell’s equations.
The electric field is the field resulting from the currents, commonly referred to as a scattered field, EsEs. If we have an incident known field, EiEi, we can apply the boundary condition that the total tangential components need to vanish on the surface of the conductor. For the part of the conductor where the incident field comes in, we have n × Ei = − n × Esn×Ei=−n×Es, for the rest of the conductor the tangential portion of the field, n × Es = 0n×Es=0, where nn is the normal unit vector from the surface. We assign
and find

We can consider the situation where we have an inductor, or transmission line, where the end stub has a forced incident electric field that is parallel to the conductor surface. In this way the incident field in the previous equation has a nonzero component. This equation is known as the EFIE (electric field integral equation). Similarly we can derive the MFIE (magnetic field integral equation); this equation will not contain any different information from the EFIE, but it can sometimes be of use.
This is one equation with an, 1 ≤ n ≤ Nan,1≤n≤N unknown coefficients. To solve this we can multiply by testing functions/integrals, ∫fm dr∫fmdr, whereby the boundary conditions can be evaluated at certain points using delta functions as testing functions; or, by other choices of testing functions, one can evaluate the boundary conditions over a region. One common choice is to use same testing functions as the current elements, In(r)Inr. This is known as Galerkin’s method. In this way we integrate along the surface of the conductor where the boundary conditions are known. If we multiply the above EFIE equation with ∫Im dr∫Imdr we get:

This is now a matrix equation:
where bm = ∫ Im(r) ⋅ n × Ei(r) drbm=∫Imr⋅n×Eirdr integrated along the surface of the conductor, and

We simply invert this matrix equation and find the currents resulting from the external stimulus, EiEi. When the currents are known, we can use them to calculate the vector potential AA and the potential φφ. From these two we can now calculate the electromagnetic field at any point in 3D space.
This is a short outline of how one can write Maxwell’s equations in a form that is amenable to numerical implementation. A similar discussion can be found in [2], where far more detail regarding the method and numerical implementation can be found. The convenient aspect of using the method of moments is that you only need to create a mesh where the currents could be flowing. There is no need to grid the whole three-dimensional space. The acceleration in terms of necessary computations can be quite extensive and it is nowadays a very popular simulation algorithm. Similarly to earlier, it is quite straightforward to write a code that can solve this equation, but the difficulty lies in creating efficient grids, dealing with the potential divergence in the evaluation of integrals, and building up the matrix elements efficiently.
On the Use of Ports
Ports are used to provide input stimulus to the structure. There are several ways to do this, including delta gap source ports and wave ports. We will describe them briefly but not go into implementation details.
Delta Gap Source
A delta gap source is an impressed electric field between two conductors (see Figure 6.3). This field is then used as the external field in, for example, the method of moments. It is the simplest of the ports commonly used. For the integrated circuit designer it is quite relevant because of the small size of the active devices that connect to the conductors. For microwave applications it is much less common.
Figure 6.3 A simple 2D projection of two conductors with a field impressed between them. This is the incoming field and the way it is often pictured in the simulation setup.
Wave Port
A wave port is often defined on the boundaries of the system under consideration. Simply put, the fields are solved assuming two-dimensional symmetry on the boundary, as in Chapters 4 and 5. The intention is to mimic, say, a coaxial cable where there is an electromagnetic wave running, and it will look approximately like a field where the electric and magnetic field vectors are perpendicular to the direction of travel, hence the two-dimensional solution. Such a solution is then simply used as the boundary condition for the system under consideration. One can imagine modeling the input connector to a printed circuit board or some such application where this wave port model is a natural approximation. This type of port is very common in microwave applications.
Matrix Solvers
We have encountered matrix equations a couple of times in this chapter, and for completeness we will briefly mention how one can go about solving such equations. Basically it involves inverting the matrix and multiplying it with the right-hand side (rhs). Matrix inversion is a very active research field, and algorithms that were popular 20 years ago have been superseded by much more efficient methods. If one is interested in finding a modern implementation, an internet search is recommended. Many research groups publish their code in the public domain, so one can easily download and use it in one’s own implementation, but there can be licensing limitations for commercial use. If one is interested in writing one’s own code, there are broadly speaking two classes of solvers: direct matrix manipulations (exemplified by Gaussian elimination, LU decomposition) and iterative methods.
Gaussian Elimination
With Gaussian elimination one simply reorders the equations through various multiplications/divisions and row additions/subtractions to end up with a single unknown in one of the equations, which can then be solved with simple back substitution. This is then solved and the process repeats with the now reduced set of equations. For more details see [2, 6]. This generally works but requires one to redo all the work for each rhs.
LU Decomposition
Here one eliminates the problem of the rhs by writing the matrix as a product of two other matrices, L,U such that A = LUA=LU. The LL matrix has the lower left triangle field including the diagonal, and UU has the upper right triangle field with zeros in the diagonal. This way of writing the equation results in another way of doing back substitution as earlier, but it no longer depends on the rhs, and as long as the matrix is not changing it is often a better method. References [2, 6] have more details.
Iterative Methods
What have really impacted the speed of the matrix inversion algorithms are iterative methods that can be very advantageous for large systems. The basic idea is to start with a guess, x0x0 to the solution of Ax = bAx=b. The idea is to come up with a way to minimize the residual y = A(x − x0)y=Ax−x0 by somehow calculating a new solution from x1 = x0 + βz0x1=x0+βz0, where z0z0 is some cleverly chosen direction. This goes on until the desired accuracy (size of |y|y) has been reached. There are a number of different ways of doing this, including conjugate gradient and biconjugate gradient methods (see [2, 6]). One class of remarkably easy to implement and efficient methods that work best for sparse matrices (frequently encountered in circuit systems) are the Krylov Subspace methods. See [7] for a good discussion on these techniques.
Verify
The procedure we have sketched here is similar to what is discussed in much more detail in [2].
Evaluate
We arrived at the matrix equation through somewhat broad strokes, and the details of implementing such expressions in a code is outside the scope of this book. It is encouraging that the core of a simulator’s operation can be understood from fairly simple arguments. It should be clear that given certain boundary conditions in terms of electric fields, we get as a result currents at various locations. It is then natural to think of the output of the simulator as Y-parameters that are defined as a current resulting from a voltage stimulus. What we are interested in as a final output is likely S-parameters, since measurement equipment is mostly set up to produce such. In [5] there is a good description of how to generate S-parameters given Y-parameters.
6.5 Summary
We have studied in a broad sense how electromagnetic field solvers can be implemented. We first looked at capacitance and inductance solvers appropriate for low frequencies, then outlined how a full wave simulator might be set up in terms of equations. Throughout the chapter we adapted the estimation analysis way of thinking. The details concerning code implementations are outside the scope of this book.
6.6 Exercises
1. Build a code that can solve for capacitances in either two or three dimensions. In particular, pay attention to the self-interacting terms. How would you avoid the potential singularity issue? For support codes such as integration algorithms and matrix solvers, there are plenty of online resources.
a. How should the mesh (grid) be set up? Where is the charge accumulating?
2. Do likewise for inductance.
6.7 References






