Site Tools


fdtd-cuda-numerical-validation

Table of Contents

Numerical validation (2D FDTD)

Numerical validation checks both agreement between implementations and properties of the simulated physics. The repository's stability test checks bounded energy at Courant factor 0.99:

Simulation::Options opts;
opts.courant = 0.99;
Simulation sim(64, 64, opts);
const auto history = energy_history(sim, 20, 100);
for (const double e : history) {
    const double ratio = e / history.front();
    CAPTURE(ratio);
    REQUIRE(std::isfinite(ratio));
    CHECK(ratio < 1.01);
    CHECK(ratio > 0.99);
}

energy_history supplies repeated energy measurements. The assertions check finite energy within one percent of the initial value. A separate test deliberately exceeds the CFL limit with stability checking disabled and expects growth.

Other physical tests examine wave speed, closed-box energy, and PML reflection. Backend comparisons check fields and probes against serial results, using tolerances or exact comparisons as configured. Matching the serial backend alone cannot establish physical correctness because implementations can share a numerical mistake.

Source: test_physics.cpp.

fdtd-cuda-numerical-validation.md · Last modified: by 127.0.0.1