Helmholtz 3D convergence study#

This notebook runs a compact q-order sweep for the 3D Helmholtz volume potential using a Laplace near-field table plus online Helmholtz-Laplace smooth correction, and reports a manufactured-source PDE residual on an interior calculus patch.

import pathlib
import sys

cwd = pathlib.Path.cwd()
if (cwd / "volumential").exists():
    repo_root = cwd
elif (cwd.parent / "volumential").exists():
    repo_root = cwd.parent
else:
    repo_root = cwd

sys.path.insert(0, str(repo_root))
sys.path.insert(0, str((repo_root / "examples").resolve()))

from helmholtz3d import run_convergence_study
results = run_convergence_study(smoke_mode=True)
results
try:
    import matplotlib.pyplot as plt
except ImportError:
    plt = None

if plt is not None:
    q_orders = [entry["q_order"] for entry in results]
    rel_pde_residual = [entry["rel_pde_residual"] for entry in results]

    plt.figure(figsize=(5, 3))
    plt.semilogy(q_orders, rel_pde_residual, marker="o")
    plt.xlabel("Quadrature order")
    plt.ylabel("rel PDE residual")
    plt.title("Helmholtz3D convergence (smoke)")
    plt.grid(True, which="both", linestyle=":")
    plt.show()
else:
    print("matplotlib not available; skipping plot")