Computational Electromagnetics
Computational Electromagnetics
An introduction to Maxwell solvers, numerical formulation, observables, and their connection to real electromagnetic design problems.
This page follows a clear progression: 1D FDTD → 1D FEM → 2D FDTD → 2D FEM.
The emphasis is on the physical meaning of each formulation, how the numerical model is constructed,
what kind of output it produces, and how that output is used in engineering and industrial practice.
Core principle. In computational electromagnetics, the real output is not a colorful field image by itself.
The real output is a quantity that can support design, diagnosis, comparison, or performance evaluation.
Maxwell equations
1D FDTD
1D FEM
2D FDTD
2D FEM
Boundary conditions
Observables
Validation
Main focus
- Explain the governing ideas behind FDTD and FEM.
- Show how simple 1D models grow into 2D scattering and wave problems.
- Clarify the role of sources, materials, and absorbing boundaries.
- Connect simulation output to reflection, transmission, resonance, and field response.
Where these methods are used
- Antennas, radomes, and scattering control in RF systems.
- Waveguides, resonators, filters, and microwave packaging.
- Photonic structures, coatings, thin films, and optical materials.
- EMC, shielding, sensing, and device-level field management.
1. Maxwell equations and constitutive relations
All computational electromagnetics starts from Maxwell’s equations. What changes from solver to solver is
how these equations are approximated and what class of geometry or observable is targeted.
\[
\nabla \times \mathbf{E} = -\frac{\partial \mathbf{B}}{\partial t}, \qquad
\nabla \times \mathbf{H} = \mathbf{J} + \frac{\partial \mathbf{D}}{\partial t},
\]
\[
\nabla \cdot \mathbf{D} = \rho, \qquad
\nabla \cdot \mathbf{B} = 0.
\]
For linear isotropic media:
\[
\mathbf{D} = \varepsilon \mathbf{E}, \qquad
\mathbf{B} = \mu \mathbf{H}, \qquad
\mathbf{J} = \sigma \mathbf{E}.
\]
In optics and broadband RF, the medium is often spatially inhomogeneous and may also be dispersive,
so \(\varepsilon\) becomes either position-dependent, frequency-dependent, or both. This is precisely where
analytical solutions become restricted and numerical electromagnetics becomes necessary.
2. Why computational electromagnetics?
Analytical solutions to Maxwell’s equations exist only for limited classes of geometry, material distribution,
and boundary condition. Once the structure becomes spatially inhomogeneous, temporally broadband, or geometrically
irregular, the electromagnetic problem must be approximated numerically.
Computational electromagnetics is not merely about obtaining a field plot. It is about converting a physical
boundary-value or initial-value problem into a discrete system whose numerical solution approximates a measurable
electromagnetic response.
Start from 1D
In 1D, the full structure of the numerical problem remains visible: the equations, the grid or elements, the boundary treatment, and the extracted response.
Move to 2D
In 2D, the model begins to represent diffraction, scattering, wavefront distortion, and geometry-dependent field redistribution.
Compare FDTD and FEM
The comparison makes clear how time-domain propagation and frequency-domain boundary-value analysis answer different classes of engineering questions.
3. Observables, not decorative field maps
Raw fields are necessary, but they are almost never the final answer. The actual target is an observable
that can support interpretation, design, or validation.
Reflection / Transmission
Used in slab problems, coatings, filters, and waveguide interfaces.
S-parameters
Natural language of port-based devices in RF and microwave engineering.
Resonance / Q
Used for cavities, resonators, and geometry-dependent storage of energy.
Field response
Useful when the quantity of interest is local, but only when interpreted with proper normalization and geometry context.
\[
A = 1 - R - T
\]
Do not confuse visibility with validity. A bright hot spot in \(|\mathbf{E}|\) may say little about matching,
efficiency, or loss unless the observable extraction is mathematically correct.
4. Numerical progression used in this page
The sequence below is intentionally narrow. The point is not to survey every electromagnetic solver, but to build
numerical understanding through a controlled progression.
| Method |
Domain formulation |
Discretization |
Main strength |
Main limitation |
Minimal example |
| 1D FDTD |
Time domain |
Uniform staggered grid |
Broadband response from one pulse; excellent physical intuition |
Requires time stepping and absorbing boundaries for open problems |
Plane wave incident on dielectric slab |
| 1D FEM |
Frequency domain |
Element-based weak form |
Clear boundary-value formulation; direct harmonic solution |
Broadband response requires repeated solves |
Layered dielectric interval |
| 2D FDTD |
Time domain |
Structured Cartesian grid |
Natural for transient propagation, scattering, and pulse excitation |
Global meshing cost and CFL stability limit |
TM-like pulse scattering with and without ABC |
| 2D FEM |
Frequency domain |
Triangular mesh |
Flexible geometry and local mesh refinement |
Less natural for broadband transient intuition |
2D Helmholtz problem with dielectric inclusion |
This progression is useful in both academia and industry: the solver is selected from the structure of the problem, the output that matters, and the type of design decision that must be made.
5. From numerical model to engineering application
The practical value of computational electromagnetics lies in the link between the numerical model and an engineering decision.
A solver is used to estimate how a structure reflects, transmits, stores, radiates, concentrates, or suppresses electromagnetic energy.
That estimated response then guides design choices in materials, geometry, thickness, spacing, packaging, or shielding.
RF and microwave
Antennas, radomes, waveguide components, filters, radar scattering, and EMC performance.
Electronics packaging
Interconnect coupling, signal integrity, package resonances, and field leakage in high-speed systems.
Optics and photonics
Thin films, resonant structures, absorbers, sensors, integrated photonics, and optical materials.
Materials and shielding
Field attenuation, absorber design, impedance matching, thermal-loading estimates, and shielding effectiveness.
In industrial work, the simulation is rarely the final product. The simulation supports a decision: which material stack to choose,
where to refine a geometry, how to reduce reflection, how to control coupling, or whether a design meets a required performance window.
A solver does not automatically create engineering value. The value appears only when the model, the boundary conditions, the material data,
and the extracted observable are all aligned with the real application.
6. 1D finite-difference time-domain (FDTD)
In 1D FDTD, electric and magnetic field components are staggered in both space and time. This produces the
canonical leapfrog update scheme and makes wave propagation physically transparent to students at a very early stage.
\[
H_{i+\frac{1}{2}}^{n+\frac{1}{2}} =
H_{i+\frac{1}{2}}^{n-\frac{1}{2}}
+ \frac{\Delta t}{\mu \Delta x}\left(E_{i+1}^{n} - E_i^{n}\right),
\]
\[
E_i^{n+1} =
E_i^n +
\frac{\Delta t}{\varepsilon_i \Delta x}
\left(H_{i+\frac{1}{2}}^{n+\frac{1}{2}} - H_{i-\frac{1}{2}}^{n+\frac{1}{2}}\right).
\]
\[
\Delta t \le \frac{\Delta x}{c}
\]
Minimal example: dielectric slab
- A Gaussian pulse is launched from the left.
- The wave propagates through free space and meets a dielectric slab.
- Part of the pulse reflects and part transmits.
- Monitor signals are Fourier transformed to obtain \(R(\omega)\) and \(T(\omega)\), which are the same quantities used to assess layered devices, coatings, and material interfaces.
\[
s(t) = \exp\left[-\left(\frac{t-t_0}{\tau}\right)^2\right]\sin(\omega_0 t)
\]
In FDTD, the mesh is not merely geometric. It controls phase error, dispersion, and the maximum stable time step.
// 1D FDTD skeleton
for (n = 0; n < Nt; ++n) {
update_H();
update_E();
inject_source();
apply_boundary_conditions();
record_monitors();
}
This type of model underlies practical work on dielectric stacks, transmission through layers, absorber concepts, and signal propagation through material interfaces.
7. 1D finite element method (FEM)
In 1D FEM, the governing equation is converted into a weak form and then assembled element by element into a global
linear system. This is where students first see clearly that FEM is a boundary-value formulation rather than a time-marching scheme.
\[
\frac{d}{dx}\left(\frac{1}{\mu}\frac{dE}{dx}\right) + \omega^2 \varepsilon(x) E = f(x)
\]
\[
\int_{\Omega} \frac{d v}{d x}\frac{1}{\mu}\frac{dE}{d x}\,dx
- \omega^2 \int_{\Omega} v\,\varepsilon(x)\,E\,dx
= \int_{\Omega} v\,f\,dx
\]
Minimal example: layered dielectric interval
- The domain is discretized into line elements.
- Each element carries its own material parameter.
- The local matrices are assembled into a sparse global system.
- Boundary conditions complete the problem statement.
The contrast with FDTD is especially useful in practice: FDTD is often chosen for broadband pulse behavior, while FEM is often chosen when one operating frequency, a resonant condition, or a geometrically irregular device is the main concern.
// 1D FEM frequency-domain skeleton
assemble_global_matrix();
assemble_source_vector();
apply_boundary_conditions();
solve_linear_system();
postprocess_field();
8. 2D finite-difference time-domain (FDTD)
Once the problem becomes genuinely two-dimensional, propagation is no longer just left-to-right. Waves can diffract,
scatter from inclusions, and interact with the computational boundary in ways that are immediately visible.
\[
H_x^{n+\frac{1}{2}} = H_x^{n-\frac{1}{2}} - \frac{\Delta t}{\mu \Delta y}\left(E_z^n(i,j+1)-E_z^n(i,j)\right),
\]
\[
H_y^{n+\frac{1}{2}} = H_y^{n-\frac{1}{2}} + \frac{\Delta t}{\mu \Delta x}\left(E_z^n(i+1,j)-E_z^n(i,j)\right),
\]
\[
E_z^{n+1} = E_z^n +
\frac{\Delta t}{\varepsilon}\left[
\frac{H_y^{n+\frac{1}{2}}(i,j)-H_y^{n+\frac{1}{2}}(i-1,j)}{\Delta x}
-
\frac{H_x^{n+\frac{1}{2}}(i,j)-H_x^{n+\frac{1}{2}}(i,j-1)}{\Delta y}
\right].
\]
Minimal example: pulse scattering in 2D
- A compact Gaussian source launches a transient field.
- A dielectric inclusion or PEC object scatters the pulse.
- With no absorbing boundary, edge reflections return into the domain.
- With a simple ABC or PML-type layer, outgoing waves are suppressed.
This is the point at which students must stop treating boundary conditions as a coding detail. In an open-region problem, the boundary is part of the model.
// 2D TM-like FDTD skeleton
for (n = 0; n < Nt; ++n) {
update_Hx_Hy();
update_Ez();
inject_source();
apply_boundary_conditions(); // none / Mur / PML-type
record_snapshots_or_monitors();
}
9. 2D finite element method (FEM)
In 2D FEM, the geometry can be represented by triangles rather than a uniform Cartesian grid. This is where
mesh flexibility becomes visible and students begin to understand why FEM is attractive for irregular geometries,
boundary-value problems, resonators, and multiphysics coupling.
\[
\nabla \cdot \left( \nabla u \right) + k_0^2 \varepsilon_r(x,y)\,u = f(x,y)
\]
\[
\int_{\Omega} \nabla v \cdot \nabla u\, d\Omega
- k_0^2 \int_{\Omega} \varepsilon_r(x,y)\, v u\, d\Omega
= \int_{\Omega} v f\, d\Omega
\]
Minimal example: 2D Helmholtz problem with dielectric inclusion
- The domain is split into triangles.
- Material is assigned element by element from the element centroid.
- A sparse linear system is assembled from local element matrices.
- The solution reveals how geometry and material distribution shape the field.
The central lesson is not merely that FEM can solve the problem. It is that the geometry itself now participates in how the mesh is built and how the numerical error is distributed.
// 2D FEM skeleton
generate_triangular_mesh();
assemble_element_matrices();
assemble_global_sparse_system();
apply_boundary_conditions();
solve_frequency_domain_problem();
postprocess_field();
10. Boundary conditions and absorbing boundaries
Boundary conditions are not a secondary implementation detail. They are part of the mathematical statement of the
electromagnetic problem. A finite computational domain must represent either a closed system, a symmetry plane,
a periodic extension, or an approximation to open space.
PEC / PMC
Useful for ideal conductors or symmetry reductions, but physically inappropriate for open radiation problems.
Simple ABC
Useful pedagogically in 1D or simple 2D examples to show how boundary reflections can be reduced, though not perfectly eliminated.
PML / CPML
The standard tool for truncating open domains. Its job is to absorb outgoing waves without sending them back into the useful physical region.
Critical point. In engineering work, a poor boundary treatment can contaminate scattering, reflection, and radiation predictions.
Open-region behavior must be represented deliberately, not assumed.
11. Practical simulation workflow
- Define geometry and its important scale hierarchy.
- Assign physically justified material models.
- Choose source, ports, and boundary conditions.
- Select the formulation that matches the problem class.
- Choose discretization consistent with wavelength and smallest critical geometric scale.
- Run the solver and extract observables rather than only plotting fields.
- Perform convergence, cross-checks, or analytical comparison.
12. Validation and common failure modes
Validation is not a decorative final slide. It is part of the method.
Analytical checks
- 1D Fresnel reflection at a dielectric interface
- Layered-medium intuition for the 1D slab
- Mode or resonance checks in simple cavities
Convergence checks
- mesh refinement
- time-step sensitivity
- domain-size sensitivity
- boundary-distance sensitivity
Cross-validation
- 1D FDTD vs analytical interface result
- 1D FDTD vs 1D FEM for the same material profile
- 2D FDTD without ABC vs with ABC
Model failure. Wrong \(\varepsilon\), ignored loss, unrealistic geometry, or a problem statement that does not match the intended experiment.
Discretization failure. Too coarse a mesh, unstable time step, poor element quality, or insufficient resolution at interfaces.
Boundary failure. Artificial reflection from truncated boundaries or a boundary condition that does not represent the physical setting.
Post-processing failure. Wrong normalization, early signal truncation, or comparing decorative field maps instead of observables.
Minimal convergence logic
\[
\delta_Q^{(k)} = \frac{|Q_{k+1}-Q_k|}{|Q_{k+1}| + 10^{-16}}
\]
Replace \(Q\) by any meaningful observable: resonant frequency, transmission peak, reflected power, or local field norm.
The point is not endless refinement. The point is to show that the chosen discretization no longer changes the answer in a consequential way.
13. Example codes and mini-projects
These example programs are intentionally compact. They show the numerical structure of each method clearly and can be used as a starting point for more realistic RF, microwave, photonics, EMC, shielding, sensing, and packaging problems.
Code 1
1D FDTD slab. Gaussian pulse, dielectric slab, monitor signals, and FFT-based reflection/transmission extraction.
Download fdtd_1d_slab.py
Code 2
1D FEM layered medium. Linear elements, piecewise material profile, global sparse solve, and field visualization.
Download fem_1d_layered.py
Code 3
2D FDTD without ABC. Shows how edge reflection contaminates an open-region transient problem when no absorbing treatment is used.
Download fdtd_2d_no_abc.py
Code 4
2D FDTD with Mur ABC. A simple absorbing-boundary implementation that already shows the logic of open-region truncation.
Download fdtd_2d_mur_abc.py
Suggested extensions
- extract reflection and transmission
- compare no-ABC and ABC results
- change dielectric contrast
- refine mesh or time step
- connect the result to a device use case
These codes are small enough to study line by line, but they already map directly onto practical workflows used in absorber design, waveguide analysis, antenna environments, EMC studies, photonic components, and package-level field prediction.