# Boundary conditions (2D FDTD) **Boundary conditions** define how field updates behave at the edge of the simulation grid. A finite grid cannot represent all of space, so its edge must either reflect outgoing waves or absorb them before they reach the outer wall. FDTD CUDA selects the condition through `Simulation::Options::boundary`. The serial, OpenMP, and CUDA backends all implement the same choices: [[fdtd-cuda-pec|PEC]] holds edge $E_z$ at zero, [[fdtd-cuda-pmc|PMC]] updates edge $E_z$ with zero magnetic field outside the domain, and [[fdtd-cuda-pml|PML]] places an absorbing layer before a PEC wall. ```cpp fdtd::TMz::Simulation::Options options; options.boundary = fdtd::TMz::Boundary::Pml; fdtd::TMz::Simulation sim(256, 256, options); ``` PEC is the default. The driver exposes the choice through `--boundary pec`, `--boundary pmc`, or `--boundary pml`. This choice affects what a probe sees: a pulse can return after reflection from a wall, while a PML reduces the returning signal. Boundary handling also determines which edge cells can accept sources.