Table of Contents

Simulation kernels (1D FDTD)

Simulation kernels implement the same field updates with different execution strategies. The public run function dispatches according to the selected acceleration mode:

void Fdtd_EzSimRun(Fdtd_EzSim *sim, size_t nsteps)
{
    switch (sim->fsim_state->fs_accel) {
        case FDTD_ACCEL_NONE: {
            Fdtd_KernelSerial_EzSimRun(sim, nsteps);
        } break;
        case FDTD_ACCEL_OPENMP: {
            Fdtd_KernelOpenMP_EzSimRun(sim, nsteps);
        } break;
    }
}

Both receive the same simulation object and requested step count. Switching modes changes execution, without rebuilding the fields or material representation.

Use Fdtd_EzSimSetAccel(sim, FDTD_ACCEL_OPENMP) to select the parallel path, or --set-accel=openmp in the driver. The serial kernel supplies a baseline; the OpenMP kernel distributes spatial updates and synchronizes their phases.

Source: fdtd_ez_sim.c.