OpenPFC / A growing collection
The example collection: coverage and next steps
Follow what is taught, what is adapted, and what still needs a chapter.
There are 87 declared runnable example targets and 87 Quarto teaching chapters. The table includes older programs that have not yet been converted. Target counts exclude test executables; optional configurations can affect which targets a particular build enables.
Spectral Methods in MATLAB
The author’s collection contains forty programs. Currently 40 have a corresponding lesson. A link means that the lesson declares coverage of that experiment; the scope column states changes in method or presentation. It does not mean an unmodified MATLAB program was translated line for line. Pending rows remain in the inventory while applicability and implementation are assessed.
| Program | Experiment | Lesson and scope |
|---|---|---|
| 1 | convergence of fourth-order finite differences | Read the lesson. Original fourth-order finite-difference resolution family, with additional FD2 and FFT comparisons. |
| 2 | convergence of periodic spectral method (compare p1.m) | Read the lesson. Original even 2..100 collocation matrix sweep; FFT comparison added. |
| 3 | band-limited interpolation | Read the lesson. All three original sampled profiles and sinc reconstructions; exact nodal limits handled. |
| 4 | periodic spectral differentiation | Read the lesson. Original periodic cotangent differentiation of hat and analytic profiles. |
| 5 | repetition of p4.m via FFT | Read the lesson. FFT version of both program 4 profiles, compared against the matrix action. |
| 6 | variable coefficient wave equation | Read the lesson. Original variable-speed Gaussian experiment and book startup preset, with a consistent Taylor startup and characteristic reference added. |
| 7 | accuracy of periodic spectral differentiation | Read the lesson. All four original regularity profiles on even 6..50 grids, with matrix and FFT errors. |
| 8 | eigenvalues of harmonic oscillator -u”+x^2 u on R | Read the lesson. Original L=8 and N=6:6:36 harmonic oscillator, with kinetic matrix built using native LocalFFT. |
| 9 | polynomial interpolation in equispaced and Chebyshev pts | Read the lesson. Original degree-16 node comparison, using barycentric evaluation instead of monomial fitting. |
| 10 | polynomials and corresponding equipotential curves | Read the lesson. Original signed nodal products and complex-plane magnitude contours, evaluated directly from their roots. |
| 11 | Chebyshev differentation of a smooth function | Read the lesson. Original smooth profile at degrees 10 and 20, differentiated with the Chebyshev collocation matrix. |
| 12 | accuracy of Chebyshev spectral differentiation | Read the lesson. All four original profiles and degrees 1..50, with limiting bump values handled explicitly. |
| 13 | solve linear BVP u_xx = exp(4x), u(-1)=u(1)=0 | Read the lesson. Original degree-16 homogeneous Dirichlet collocation problem, solved with native GMRES. |
| 14 | solve nonlinear BVP u_xx = exp(u), u(-1)=u(1)=0 | Read the lesson. Original nonlinear collocation problem, using native Newton–GMRES instead of fixed-point iteration and an analytic reference. |
| 15 | solve eigenvalue BVP u_xx = lambda*u, u(-1)=u(1)=0 | Read the lesson. Original degree-36 Dirichlet spectrum and six selected modes, using an example-owned complex QR eigensolver. |
| 16 | Poisson eq. on [-1,1]x[-1,1] with u=0 on boundary | Read the lesson. Original degree-24 Chebyshev Poisson problem; native GMRES applies the tensor operator without forming a Kronecker matrix. |
| 17 | Helmholtz eq. u_xx + u_yy + (k^2)u = f | Read the lesson. Original k=9 degree-24 Helmholtz problem with a native tensor-action GMRES solve. |
| 18 | Chebyshev differentiation via FFT (compare p11.m) | Read the lesson. Same polynomial derivative via native LocalFFT cosine coefficients, with explicit O(N²) coefficient-sum evaluation and endpoint limits. |
| 19 | 2nd-order wave eq. on Chebyshev grid (compare p6.m) | Read the lesson. FFT-based Chebyshev wave with the original N=80 Gaussian, leapfrog startup and rounded save schedule; direct chain-rule second derivatives replace two successive chebfft calls. Taylor startup and an exact standing mode are additional checks. |
| 20 | 2nd-order wave eq. in 2D via FFT (compare p19.m) | Read the lesson. Original N=24 Chebyshev square, Gaussian and leapfrog startup. Native LocalFFT evaluates both tensor derivatives; initial Gaussian boundary tails are retained. Nodal plots replace cubic display interpolation; Taylor startup exposes the initial-velocity error. |
| 21 | eigenvalues of Mathieu operator -u_xx + 2qcos(2x)u | Read the lesson. Original N=42 and q=0:.2:15 Mathieu sweep; native LocalFFT plus example-owned symmetric Jacobi diagonalization. |
| 22 | 5th eigenvector of Airy equation u_xx = lambdaxu | Read the lesson. Original four-degree Airy experiment; explicitly eliminate the zero-weight constraint before a finite eigenproblem. |
| 23 | eigenvalues of perturbed Laplacian on [-1,1]x[-1,1] | Read the lesson. Original degree-16 perturbed-square Laplacian and four low modes with example-owned dense QR. |
| 24 | pseudospectra of Davies’s complex harmonic oscillator | Read the lesson. Original degree 70, half-length 6, all 69 eigenvalues and 26 by 21 complex grid with increments of two. Native Chebyshev derivatives; one-sided complex Jacobi singular values avoid normal equations. Complete original grid independently qualified. |
| 25 | stability regions for ODE formulas | Read the lesson. Original AB/AM/BDF root-locus families and RK stability boundaries; native RK tableaus plus example-owned multistep references. |
| 26 | eigenvalues of 2nd-order Chebyshev diff. matrix | Read the lesson. Original degree-60 spectrum and grid-scale mode; physical mode labelled and selected consistently as N/4. |
| 27 | Solve KdV eq. u_t + uu_x + u_xxx = 0 on [-pi,pi] by | Read the lesson. Original N=256 periodic two-pulse KdV experiment, timestep, unfiltered nonlinear product and zero odd Nyquist multipliers. Native complex-state RK4 integrates a global integrating factor, algebraically equivalent to the book’s per-step stage formula; complete fields and integral diagnostics are saved. |
| 28 | eigenmodes of Laplacian on the disk (compare p22.m) | Read the lesson. Original N25,M20 disk Laplacian, complete 240-mode spectrum with angular multiplicity, selected modes 1,3,6,10 and frequency ratios. Native Chebyshev derivatives and equivalent Fourier radial blocks; Bessel references and full-matrix qualification. Polar fields with nodal lines replace wireframe projection. |
| 29 | solve Poisson equation on the unit disk | Read the lesson. Original N31,M40 forcing and zero-boundary disk solution. Native FFT separation and GMRES solve the equivalent original polar matrix; exact separated and smooth manufactured references, N63 radial refinement and independent full-matrix qualification. Non-smooth pole forcing is explicit. |
| 30 | spectral integration, ODE style (compare p12.m) | Read the lesson. Original antiderivative collocation experiment for four profiles and degrees 1..50; native GMRES replaces the explicit inverse. |
| 31 | gamma function via complex integral, trapezoid rule | Read the lesson. Original 70-point circular gamma contour and complex rectangle; retain reciprocal estimates and explicitly mark poles. |
| 32 | solve u_xx = exp(4x), u(-1)=0, u(1)=1 (compare p13.m) | Read the lesson. Original nonzero Dirichlet problem with an affine lift and native GMRES. |
| 33 | solve linear BVP u_xx = exp(4x), u’(-1)=u(1)=0 | Read the lesson. Original mixed Neumann/Dirichlet problem with a derivative row and native GMRES. |
| 34 | Allen-Cahn eq. u_t = eps*u_xx+u-u^3, u(-1)=-1, u(1)=1 | Read the lesson. Original degree-20 Allen–Cahn equation, epsilon=.01, fixed endpoints, lifted full Chebyshev D2 and explicit Euler through t=100. Native EulerStepper advances the vector; barycentric interpolation replaces monomial display fitting. An operator-based timestep cap applies to refinements and preserves the original degree-20 default. |
| 35 | Allen-Cahn eq. as in p34.m, but with boundary condition | Read the lesson. Original degree-20 Allen–Cahn equation with u(1,t)=1+sin(t/5)^2, full Chebyshev D2, and explicit endpoint replacement after every Euler step through t=100. Native EulerStepper and barycentric display evaluation preserve the discrete evolution. An operator-based timestep cap applies to refinements and preserves the original degree-20 default. |
| 36 | Laplace eq. on [-1,1]x[-1,1] with nonzero BCs | Read the lesson. Original degree-24 nonzero-boundary Laplace problem; equivalent boundary elimination replaces identity boundary rows. |
| 37 | 2D “wave tank” with Neumann BCs for |y|=1 | Read the lesson. Original A=3, Nx=50, Ny=15 wave tank, Gaussian, nominal-step startup and Neumann reconstruction after each leapfrog update. FFT actions replace equivalent dense Fourier/Chebyshev matrices. Exact standing-mode and Taylor-start presets are additional checks. |
| 38 | solve u_xxxx = exp(x), u(-1)=u(1)=u’(-1)=u’(1)=0 | Read the lesson. Original degree-15 clamped fourth-order problem. Native Chebyshev nodes/derivatives construct the weighted operator; native GMRES replaces backslash, and barycentric reconstruction of the auxiliary polynomial preserves zero values and slopes. Complete values and slopes are checked against an independently determined analytic solution. |
| 39 | eigenmodes of biharmonic on a square with clamped BCs | Read the lesson. All 25 degree-17 clamped square-plate modes and relative frequencies; native Chebyshev D4 and the original interior D2 tensor operator. Symmetry blocks preserve repeated modes; constrained barycentric display replaces cubic image interpolation. |
| 40 | eigenvalues of Orr-Sommerfeld operator (compare p38.m) | Read the lesson. Original R=5772 and degrees 40,60,80,100; native Chebyshev D4/D2 construction and complete complex generalized spectra. Pivoted mass solves plus example-owned shifted QR replace a generalized eigensolver; original-pencil residuals and independent qualification are explicit. |
Existing runnable examples
| Target | Teaching chapter |
|---|---|
02_domain_decomposition |
Read the lesson |
03_parallel_fft |
Read the lesson |
04_diffusion_model |
Read the lesson |
05_simulator |
Read the lesson |
06_multi_index |
Read the lesson |
07_array |
Read the lesson |
08_discrete_fields |
Read the lesson |
09_parallel_fft_high_level |
Read the lesson |
10_ui_register_ic |
Read the lesson |
11_write_results |
Read the lesson |
12_cahn_hilliard |
Read the lesson |
14_custom_field_initializer |
Read the lesson |
15_finite_difference_heat |
Read the lesson |
16_strong_types_demo |
Read the lesson |
17_custom_coordinate_system |
Read the lesson |
18_sobel_edge_detection |
Read the lesson |
19_explicit_stepper_fd |
Read the lesson |
20_explicit_stepper_spectral |
Read the lesson |
21_adaptive_stepping |
Read the lesson |
22_external_coupling |
Read the lesson |
23_halo_microtiming |
Read the lesson |
24_adaptive_etd |
Read the lesson |
25_halo_bandwidth |
Read the lesson |
airy_eigenproblem |
Read the lesson |
allen_cahn_driven |
Read the lesson |
allen_cahn_fixed |
Read the lesson |
cardinal_interpolation |
Read the lesson |
chebyshev_eigenmodes |
Read the lesson |
chebyshev_wave_line |
Read the lesson |
chebyshev_wave_square |
Read the lesson |
checkpoint_restart |
Read the lesson |
clamped_beam |
Read the lesson |
clamped_plate |
Read the lesson |
coupled_fields_example |
Read the lesson |
davies_pseudospectra |
Read the lesson |
diffusion_model_with_custom_initial_condition |
Read the lesson |
disk_eigenmodes |
Read the lesson |
disk_poisson |
Read the lesson |
fft_backend_benchmark |
Read the lesson |
fft_kspace_helpers_example |
Read the lesson |
first_domain |
Read the lesson |
gamma_contour |
Read the lesson |
harmonic_oscillator |
Read the lesson |
heat_exponential |
Read the lesson |
json_read |
Read the lesson |
kdv_integrating_factor |
Read the lesson |
layered_homogenization |
Read the lesson |
mathieu_spectrum |
Read the lesson |
membrane_eigenmodes |
Read the lesson |
mhd2d |
Read the lesson |
mixed_wave_tank |
Read the lesson |
mpi_timers |
Read the lesson |
mpi_worker |
Read the lesson |
mpi_worker_inside_class |
Read the lesson |
multigrid_poisson |
Read the lesson |
nonlinear_spectral_course |
Read the lesson |
ns2d_flux_balance |
Read the lesson |
ns2d_spatial_refine |
Read the lesson |
ns2d_temporal_refine |
Read the lesson |
ns2d_vorticity |
Read the lesson |
orr_sommerfeld |
Read the lesson |
outward_diffusion_flux |
Read the lesson |
periodic_collocation |
Read the lesson |
periodic_differentiation |
Read the lesson |
polynomial_boundary_values |
Read the lesson |
polynomial_differentiation |
Read the lesson |
polynomial_integration |
Read the lesson |
polynomial_interpolation |
Read the lesson |
polynomial_nodal_polynomials |
Read the lesson |
polynomial_nonlinear_boundary |
Read the lesson |
polynomial_regularity |
Read the lesson |
profiling_timer_report |
Read the lesson |
q1_multigrid |
Read the lesson |
runtime_coupled_fields |
Read the lesson |
spectral_smoothness |
Read the lesson |
square_helmholtz |
Read the lesson |
square_laplace |
Read the lesson |
square_poisson |
Read the lesson |
stability_regions |
Read the lesson |
symbolic_coupled_rhs |
Read the lesson |
taylor_green3d |
Read the lesson |
time |
Read the lesson |
variable_transport |
Read the lesson |
world_helpers_example |
Read the lesson |
world_query_helpers_example |
Read the lesson |
world_strong_types_example |
Read the lesson |
write_results |
Read the lesson |
Additional sources
geometry/first-domain/model.cpp: Read the lessoncoupling/symbolic-rhs/generate.py: Read the lesson
Capability coverage
The machine-readable coverage inventory also tracks capability families. These links identify focused introductory lessons, not complete API coverage: a heat propagator does not demonstrate every exponential integrator, and a fixed-step restart does not establish an adaptive restart contract.
| Capability family | Current teaching chapters |
|---|---|
| geometry | decomposition, index-boxes, field-storage |
| distributed fields and MPI | coordinate-fields, finite-differences |
| local and distributed FFT | round-trip, field-layout |
| finite differences and spectral gradients | periodic, smoothness, stencils |
| conservative fluxes and nonperiodic boundaries | outward-flux |
| fixed and adaptive integration | finite-differences, stability, adaptive-rk, output-clock |
| multi-field runtime integration | runtime-fields, fixed-tuples, symbolic-rhs |
| exponential and adaptive ETD | exponential, adaptive-etd |
| initial conditions and modifiers | coordinate-fields, patterns, catalog |
| JSON/TOML validation and application sessions | session, catalog |
| field output and visualization | binary-field, vtk-series |
| checkpoints and restart | checkpoint-restart |
| Krylov and nonlinear solves | integration, boundary-values, nonlinear-boundary |
| geometric multigrid | multigrid, q1-multigrid |
| microelasticity and homogenization | layered-homogenization |
| coupling and transactional attempts | host-orchestrator, adaptive-rk, adaptive-etd |
| profiling and communication diagnostics | mpi-timing, profiling, halo-bandwidth |
| CUDA and HIP execution | backend-buffers |
| nonlinear models and incompressible flow | kdv, allen-cahn-fixed, allen-cahn-driven, cahn-hilliard, vorticity, spatial-refinement, temporal-refinement, flux-balance, magnetohydrodynamics, taylor-green-3d |
| finite elements and nodal solvers | q1-multigrid |
Every family needs an actual model, a useful mathematical story and appropriate runtime evidence.