Skip to content
BeamZ BeamZ

Yee-update

The Yee scheme staggers electric and magnetic fields in space and time. Each curl is evaluated at the position of the field it updates.

A staggered grid

On a uniform Cartesian grid, one common indexing convention is:

Component Position in grid units Time
ExE_x (i+12,j,k)(i+\tfrac12,j,k) nΔtn\Delta t
EyE_y (i,j+12,k)(i,j+\tfrac12,k) nΔtn\Delta t
EzE_z (i,j,k+12)(i,j,k+\tfrac12) nΔtn\Delta t
HxH_x (i,j+12,k+12)(i,j+\tfrac12,k+\tfrac12) (n+12)Δt(n+\tfrac12)\Delta t
HyH_y (i+12,j,k+12)(i+\tfrac12,j,k+\tfrac12) (n+12)Δt(n+\tfrac12)\Delta t
HzH_z (i+12,j+12,k)(i+\tfrac12,j+\tfrac12,k) (n+12)Δt(n+\tfrac12)\Delta t

Electric components lie along cell edges; magnetic components lie at face centers. Translating the entire lattice gives equivalent conventions. BeamZ uses component-specific Yee supports; arrays for different components need not have identical shapes.

Staggering makes a centered derivative local. For example,

∂yEz∣i,j+1/2,k+1/2≈Ez(i,j+1,k+1/2)−Ez(i,j,k+1/2)Δy.\left.\partial_y E_z\right|_{i,j+1/2,k+1/2} \approx\frac{E_z(i,j+1,k+1/2)-E_z(i,j,k+1/2)}{\Delta y}.

Both samples are half a cell from the evaluation point. In smooth media this derivative has second-order spatial accuracy. The staggered construction originates in Yee’s 1966 paper.

From derivatives to updates

Let ∇h×\nabla_h\times denote the discrete curl. Centering the time derivatives in the two evolution equations, first in a lossless medium, gives

Hn+1/2=Hn−1/2−Δtμ∇h×En\boxed{\mathbf H^{n+1/2}=\mathbf H^{n-1/2} -\frac{\Delta t}{\mu}\nabla_h\times\mathbf E^n}En+1=En+Δtε(∇h×Hn+1/2−Jsn+1/2).\boxed{\mathbf E^{n+1}=\mathbf E^n +\frac{\Delta t}{\varepsilon} \left(\nabla_h\times\mathbf H^{n+1/2}-\mathbf J_{\mathrm s}^{n+1/2}\right)}.

Evaluate coefficients at the component being updated. Advance H\mathbf H and its corrections, then E\mathbf E and its corrections. For scalar nondispersive materials, this leapfrog requires no global linear solve.

A complete two dimensional example

For fields invariant along zz, the TMz system contains Ez,Hx,HyE_z,H_x,H_y. Choose EzE_z at (i,j)(i,j), HxH_x at (i,j+1/2)(i,j+1/2), and HyH_y at (i+1/2,j)(i+1/2,j). For a source-free, lossless interior:

Hx,i,j+1/2n+1/2=Hx,i,j+1/2n−1/2−Δtμx,i,j+1/2Ez,i,j+1n−Ez,i,jnΔy,H_{x,i,j+1/2}^{n+1/2}=H_{x,i,j+1/2}^{n-1/2} -\frac{\Delta t}{\mu_{x,i,j+1/2}} \frac{E_{z,i,j+1}^{n}-E_{z,i,j}^{n}}{\Delta y},Hy,i+1/2,jn+1/2=Hy,i+1/2,jn−1/2+Δtμy,i+1/2,jEz,i+1,jn−Ez,i,jnΔx,H_{y,i+1/2,j}^{n+1/2}=H_{y,i+1/2,j}^{n-1/2} +\frac{\Delta t}{\mu_{y,i+1/2,j}} \frac{E_{z,i+1,j}^{n}-E_{z,i,j}^{n}}{\Delta x},Ez,i,jn+1=Ez,i,jn+Δtεz,i,j(Hy,i+1/2,jn+1/2−Hy,i−1/2,jn+1/2Δx−Hx,i,j+1/2n+1/2−Hx,i,j−1/2n+1/2Δy).\begin{aligned} E_{z,i,j}^{n+1}=E_{z,i,j}^{n} +\frac{\Delta t}{\varepsilon_{z,i,j}}\bigg(& \frac{H_{y,i+1/2,j}^{n+1/2}-H_{y,i-1/2,j}^{n+1/2}}{\Delta x}\\ &-\frac{H_{x,i,j+1/2}^{n+1/2}-H_{x,i,j-1/2}^{n+1/2}}{\Delta y}\bigg). \end{aligned}

The subscripts on εz,μx,μy\varepsilon_z,\mu_x,\mu_y identify the field supports. Even an isotropic material may have different effective coefficients on these supports at an interface. The complementary TEz system contains Hz,Ex,EyH_z,E_x,E_y; neither reduced system describes arbitrary three dimensional polarization coupling.

Conductivity

Center the Ohmic term at the midpoint using (En+1+En)/2(\mathbf E^{n+1}+\mathbf E^n)/2. Rearranging gives

En+1=CaEn+Cb(∇h×Hn+1/2−Jsn+1/2),\mathbf E^{n+1}=C_a\mathbf E^n+ C_b\left(\nabla_h\times\mathbf H^{n+1/2}-\mathbf J_{\mathrm s}^{n+1/2}\right),Ca=1−σΔt/(2ε)1+σΔt/(2ε),Cb=Δt/ε1+σΔt/(2ε).C_a=\frac{1-\sigma\Delta t/(2\varepsilon)}{1+\sigma\Delta t/(2\varepsilon)}, \qquad C_b=\frac{\Delta t/\varepsilon}{1+\sigma\Delta t/(2\varepsilon)}.

Setting σ=0\sigma=0 recovers the lossless update. BeamZ precomputes these decay and curl coefficients. CPML introduces additional derivative corrections, described on the CPML page.

Stability and resolution

For the standard explicit Yee scheme with positive scalar, nondispersive materials on a uniform grid, the Courant limit is

Δt≤1vmax⁡Δx−2+Δy−2+Δz−2.\Delta t\leq\frac{1}{v_{\max} \sqrt{\Delta x^{-2}+\Delta y^{-2}+\Delta z^{-2}}}.

Omit invariant directions in one or two dimensions. With equal spacing hh in dd dimensions, Δt≤h/(vmax⁡d)\Delta t\le h/(v_{\max}\sqrt d). Use the fastest material wave speed in the domain, not the slower speed in a high-index core. A Courant factor below one provides margin.

Stability does not guarantee accuracy: numerical phase velocity depends on wavelength and direction. Resolve the shortest material wavelength and refine until the measured quantity converges. Interfaces can reduce convergence order.

BeamZ also supports rectilinear graded grids. There the derivatives use local edge or center distances and the solver computes a corresponding stability bound; replacing all those distances by an average spacing is incorrect.

Continue to Rasterization.