Boundary conditions control returning waves at the finite grid ends. These alternative driver commands select an absorbing layer or the reflecting configuration:
# Absorb outgoing waves in 20-cell end regions. $ dist/bin/fdtd \ --set-width=200 --set-pml=20 \ --add-pulse --run=200 absorbed.csv # Remove boundary losses and observe reflections. $ dist/bin/fdtd \ --set-width=200 --set-pec=20 \ --add-pulse --run=200 reflected.csv
The PML sets graded electric and magnetic conductivities. The PEC option clears losses in selected end regions. Both refresh coefficients and use the same field loops.
The grid termination itself holds Ez[0] and the last $H_y$ element outside their update loops. The reflecting option therefore does not enforce symmetric zero-electric-field walls. Compare the resulting fields after the pulse has had time to reach a boundary and return.