On this page
Simulation Library
Downloadable Python starting points
The repository includes small, readable scripts that produce numerical output and plots:
- Array factor and beam steering
- Free-space link budget
- Lorentz-force particle tracking with a Boris pusher
- Driven dissipative two-level optical Bloch equations
- Ideal Halbach-cylinder field scaling
- Python examples README
Model-selection map
| Problem | First model | When a more complete model is needed |
|---|---|---|
| Plane-wave propagation | analytic phasor | layered/inhomogeneous medium |
| Transmission line | telegrapher equations | full-wave launch/discontinuity |
| Antenna array | array factor | mutual coupling / installed platform |
| Waveguide | modal solution | bends, irises, dielectric loading |
| Complex 3-D RF structure | FEM / FDTD / MoM | hybrid/asymptotic for huge electrical size |
| Charged particles | Lorentz ODE | collisions / space charge / PIC |
| Atomic two-level system | optical Bloch equations | hyperfine/Zeeman multilevel density matrix |
| Strong periodic atomic drive | dressed-state / Floquet | full dissipative Floquet master equation |
1. Plane wave
A minimal complex representation is
import numpy as np
z = np.linspace(0, 2, 1000)
f = 1e9
c = 299_792_458
beta = 2*np.pi*f/c
E = np.exp(-1j*beta*z)
| Checks include linear phase advance, constant $ | E | $ in a lossless medium, and wavelength $2\pi/\beta$. |
2. Transmission line and reflection
For a lossless line,
\[Z_{in}=Z_0\frac{Z_L+jZ_0\tan\beta l}{Z_0+jZ_L\tan\beta l}.\]Plots of $Z_{in}(l)$ and $\Gamma(l)$ on a Smith chart show the effect of electrical length directly.
3. Antenna array factor
For a linear array,
\[AF(\theta)=\sum_{n=0}^{N-1}w_ne^{jn(kd\sin\theta+\beta_s)}.\]Useful parameters include element count, spacing, steering phase, amplitude taper, phase/amplitude errors, grating lobes, and scan loss after multiplication by an element pattern.
A full-wave model becomes important when mutual coupling and finite element patterns matter.
4. Radar waveform
An FMCW model contains
transmit chirp → delayed/Doppler-shifted echo → mixer → beat signal → FFT → range/velocity estimate.
Range resolution can be checked against $c/(2B)$ and Doppler against $2v/\lambda$.
5. Lorentz-force particle tracking
Integrate
\[m\dot{\mathbf v}=q(\mathbf E+\mathbf v\times\mathbf B),\qquad \dot{\mathbf r}=\mathbf v.\]A Boris pusher is useful for long charged-particle trajectories in magnetic fields because it preserves gyromotion better than naive Euler stepping.
6. Monte Carlo transport + Shockley–Ramo
For particle $j$,
\[i_j=q_j\mathbf v_j\cdot\mathbf E_w.\]A complete transport calculation can include sampled creation positions and velocities, actual $\mathbf E$ and $\mathbf B$ fields, stochastic collisions, wall/electrode interactions, weighting-field interpolation, particle summation, and the measured $Z_T(\omega)$ of the readout electronics.
This separates transport physics from signal induction.
7. Optical Bloch equations
For a two-level atom,
\[\dot\rho=-\frac{i}{\hbar}[H,\rho]+\mathcal L(\rho).\]Useful consistency checks include the zero-drive limit, weak-drive Lorentzian response, saturation/power broadening, expected detuning symmetry, $\mathrm{Tr}\rho=1$, and physical populations.
8. Three-level EIT
| For a ladder system $ | g\rangle\rightarrow | e\rangle\rightarrow | r\rangle$, calculate steady-state $\rho_{ge}$ and use |
Realistic models may include Doppler averaging, transit time, laser linewidth, spatial Rabi variation, Zeeman structure and RF coupling.
9. Floquet / Shirley model
For a periodic Hamiltonian $H(t+T)=H(t)$, expand in photon replicas and diagonalize the enlarged Floquet Hamiltonian.
Useful outputs include quasienergies, bare-state overlap, target-state shift, avoided-crossing gaps, replica index $q$, pathway amplitudes, and eigenvector continuity by overlap between neighboring field points.
10. Magnetostatics and Halbach arrays
Solve
\[\nabla\cdot\mathbf B=0,\qquad \mathbf B=\mu_0(\mathbf H+\mathbf M).\]| For atomic sensing, useful post-processing includes both $ | B | $ and the distribution of Zeeman shifts across the illuminated vapor volume. |
11. FEM, FDTD and MoM
- FEM: bounded complex geometries, waveguides, cavities and dielectric structures.
- FDTD: broadband time-domain propagation and transients.
- MoM: open-region conducting surfaces, wires, radiation and scattering.
See Comparison Tables and Computational Methods.
12. Reproducibility checklist
Advanced simulation standards — verification before visualization
A numerical field picture is not a validated simulation. For every computed observable record the governing equations, boundary conditions, mesh or basis truncation, discretization order, solver tolerance, conserved quantities and computational cost.
Mesh-convergence method: calculate observable (Q(h)) at several element sizes (h), compare the asymptotic behavior against discretization order, and quantify discretization uncertainty separately from uncertainty in material properties. For an open-region EM problem, vary both the near-field mesh and absorbing-boundary/PML distance; a converged mesh can still produce an incorrect result if the boundary reflects energy.
Validation hierarchy: (1) compare against a closed-form limit, (2) compare an independent numerical formulation, (3) compare with calibrated physical measurements, and (4) perform sensitivity and uncertainty analysis. Agreement obtained only after fitting multiple unconstrained parameters is not independent validation.
Research extension: reconstruct scattered far fields from equivalent surface currents and compare them with a direct radiation calculation; investigate errors introduced by finite surface truncation.
Further reading: MIT Advanced Electromagnetism; A. Taflove and S. C. Hagness, Computational Electrodynamics.
Reproducible advanced laboratory models
- Magnetic cleanliness versus boom length: field from a dipole and background versus spacecraft sensor location.
- Coherent SDR channel timing: distinguish constant phase, channel delay and frequency drift.
- Direction finding with an antenna array: Bartlett AoA estimator and additive noise.
- Infrared radiometric photon budget: Planck radiance, passband integration, quantum efficiency and SNR.
The Advanced Engineering Learning Map connects these simulations to their governing equations and measurement methods.