# Persistent parallel region (1D FDTD) A **persistent parallel region** keeps the thread team active across all time steps in one kernel call. The repository places `omp parallel` outside the time loop: ```c #pragma omp parallel \ default(none) \ firstprivate(Hy, Ez, Ch1, Ch2, Ce1, Ce2, width, nsteps) \ shared(sim) { for (size_t n = 0; n < nsteps; n++) { // Update Hy #pragma omp for schedule(static) for (size_t k = 0; k < width - 1; k++) { Hy[k] = Ch1[k] * Hy[k] + Ch2[k] * (Ez[k + 1] - Ez[k]); } // Update Ez #pragma omp for schedule(static) for (size_t k = 1; k < width; k++) { Ez[k] = Ce1[k] * Ez[k] + Ce2[k] * (Hy[k] - Hy[k - 1]); } // Inject Ez source #pragma omp single { Fdtd_EzSourcesApply(sim->fsim_sources, sim); Fdtd_EzStateNextStep(sim->fsim_state); } } } ``` Every thread executes the outer loop, while the two `omp for` directives distribute spatial work. Their barriers separate field phases; `single` applies sources and advances the counter once. The team joins only after the time loop finishes. This avoids entering a new parallel region for every field phase, but does not remove the per-step synchronization costs. A later `Fdtd_EzSimRun()` call enters another region; the runtime may reuse its worker threads. Source: [fdtd_ez_kernels.c](https://github.com/yanevskiv/fdtd-openmp/blob/main/src/fdtd/Ez/fdtd_ez_kernels.c).