Examples catalog¶
Executables are built when OpenPFC_BUILD_EXAMPLES=ON (default). Output directory is typically <build>/examples/ (exact path depends on the CMake generator and multi-config toolchains).
Prerequisites: Most examples need MPI and a working HeFFTe-linked OpenPFC build. Run with at least mpirun -n 1 unless the source states otherwise.
This page is for lookup and for choosing the next small executable to read. If you want a guided first run, use ../start_here_15_minutes.md. If you want the examples in a teaching sequence with more context, use ../tutorials/spectral_examples_sequence.md. The catalog below stays compact so it can answer “what is this target for?” without becoming another tutorial.
Curriculum (suggested order)¶
Use the first tier on your first day, then branch by topic. The original numbered examples remain available. The Quarto lessons now provide a thematic mathematical sequence; the heat implementations for targets 19 and 20 live under examples/heat/.
flowchart LR
subgraph t1 [Tier 1 — core stack]
A[02_domain_decomposition]
B[03_parallel_fft]
C[05_simulator]
D[12_cahn_hilliard]
end
subgraph t2 [Tier 2 — App / I/O / IC]
E[10_ui_register_ic]
F[11_write_results]
G[14_custom_field_initializer]
end
subgraph t3 [Tier 3 — fields and space]
H[15_finite_difference_heat]
I[17_custom_coordinate_system]
J[18_sobel_edge_detection]
end
subgraph t4 [Tier 4 — stepping and tools]
K[19_explicit_stepper_fd]
L[20_explicit_stepper_spectral]
N[21_adaptive_stepping]
O[22_external_coupling]
P[23_halo_microtiming]
M[fft_backend_benchmark]
end
A --> B --> C --> D
D --> E
D --> F
E --> G
D --> H --> J
D --> I
H --> K
H --> P
D --> L
K --> N
N --> O
C --> M
Tier |
Executables |
Focus |
|---|---|---|
1 — Core stack |
|
|
2 — Wiring |
|
Registration, writers, custom initial conditions |
3 — Fields and space |
|
Halos, coordinate interpretation, stencil-like field operations |
4 — Stepping and tools |
|
Explicit/adaptive steppers, external coupling, halo microtiming, ETD step doubling, halo throughput, backend comparison, profiling |
Narrative companion: getting_started/01-basics/README.md. Ordered source examples: api_examples_walkthrough.md.
Full catalog¶
Executable |
Source |
What it demonstrates |
|---|---|---|
|
|
Host/device FFT buffers, complete round-trip fields and collective participation |
|
|
|
|
|
Distributed FFT (HeFFTe) |
|
|
Backward-Euler spectral heat with a complete-field oracle |
|
|
Native time-loop hooks and the actual final clock interval |
|
|
|
|
|
Array helpers |
|
|
|
|
|
Higher-level FFT usage |
|
|
UI and field-modifier registration patterns |
|
|
Native VTK/binary snapshot series and metadata |
|
|
Conserved Cahn–Hilliard physics through native ETD1 |
|
|
physical wave numbers, Nyquist conventions and heat symbols |
|
|
MPI worker pattern |
|
|
MPI worker encapsulated in a class |
|
|
MPI timing |
|
|
Profiling and timer reporting |
|
|
Time-stepping utilities |
|
|
Results I/O variant |
|
|
Diffusion with a custom initial condition |
|
|
Native JSON/TOML settings loader and spectral session factory |
|
|
|
|
|
|
|
|
Custom field initializer |
|
|
Finite-difference heat with separated halos; see |
|
|
Strongly typed domain inputs |
|
|
Polar-defined Cartesian field and smooth origin limits |
|
|
Sobel-style field operations and edge detection |
|
|
Strong types with |
|
|
Explicit stepping with finite-difference operators |
|
|
Explicit stepping with spectral operators |
|
|
Adaptive Bogacki–Shampine 3(2) with |
|
|
Mock FEM loop: |
|
|
Timed |
|
|
ETD1 step doubling: a heat mode against |
|
|
Halo-only |
|
|
Periodic Allen–Cahn: cubic Galerkin projection with |
|
|
Issue #21 2-D vorticity–streamfunction Navier–Stokes (CPU). See |
|
|
Fixed-timestep grid refinement, common-grid Fourier restriction and a time-step control |
|
|
Fixed-grid IFRK4 time refinement with a finest-step reference and guarded order estimates |
|
|
Analytic Fourier face integrals, modal divergence and nodal-quadrature comparisons |
|
|
Issue #23 2-D incompressible visco-resistive MHD (CPU). See the retained flow README. |
|
|
Issue #229 3-D periodic Taylor–Green on the Fourier velocity (CPU). See |
|
|
Nonperiodic SBP diffusion, equivalent derivative/flux inputs and an exact weighted mass budget |
|
|
Six periodic elastic unit loads, engineering Voigt convention and independent layered tensor/local-field checks |
|
|
Q1 weak loads, eliminated Dirichlet nodes, distributed nodal multigrid-CG and an independent sine-mode oracle |
|
|
Analytic derivative, second/fourth-order FD, and Fourier convergence |
|
|
Exact linear Fourier propagator; compare spatial and temporal error |
|
|
Trefethen program 3: cardinal sinc reconstruction of three sampled signals |
|
|
Cotangent collocation matrix versus FFT derivatives of a hat and analytic profile |
|
|
Trefethen programs 2 and 7: regularity, aliasing and matrix/FFT convergence |
|
|
Trefethen program 6, Fourier/leapfrog transport, startup and exact characteristics |
|
|
Trefethen program 25, public RK tableaus and multistep root-locus references |
|
|
Program 9: Runge interpolation on equally spaced and Chebyshev nodes |
|
|
Program 10: nodal products and complex-plane magnitude contours |
|
|
Programs 11 and 18: Chebyshev matrix versus public LocalFFT coefficients |
|
|
Program 12: four regularity classes on Chebyshev grids |
|
|
Program 30: antiderivative boundary problem with native GMRES |
|
|
Programs 13, 32 and 33: homogeneous, lifted and mixed boundary conditions with GMRES |
|
|
Program 14 adapted to native Newton–GMRES, checked by an analytic solution and scalar root |
|
|
Runtime field RK4 staging, two-field oscillator and exact recurrence |
|
|
Two requested gradient packs, full halos and tuple scatter |
|
|
Generated pointwise algebra with exact derivative inputs and a shared source |
|
|
Collective checkpoint publication, fresh-state restart and discrete trajectory equivalence |
|
|
Give the grid a physical meaning |
|
|
Find the energies of a harmonic trap |
|
|
A periodic potential splits eigenvalues |
|
|
A grid has its own spectrum |
|
|
A zero weight is a constraint |
|
|
An asymmetric potential reshapes a membrane mode |
|
|
Solve a square without a giant Kronecker matrix |
|
|
A wave number can make a solve delicate |
|
|
Let the boundary drive the interior |
|
|
A contour turns an integral into a sum |
|
|
Use a hierarchy to correct different scales |
|
|
Build the clamped ends into the trial function |
|
|
Twenty-five clamped square-plate modes and repeated frequencies |
|
|
Small singular values reveal spectral sensitivity |
|
|
Complex generalized Orr–Sommerfeld spectra and near-neutral growth |
|
|
Fourier/Chebyshev disk modes and Bessel frequency checks |
|
|
Polar Poisson, manufactured fields and regularity-limited convergence |
|
|
A pulse meets the end of an interval |
|
|
Let a wave spread across a square |
|
|
A wave tank has two kinds of edge |
|
|
Let dispersion evolve exactly between stages |
|
|
Lift the boundary before evolving the interior |
|
|
A changing wall must enter the next derivative |
Flow prototype notes¶
The flow lessons retain their prototype executable names, build locations and verification criteria. Operational and historical notes remain in the 2-D flow README and 3-D Taylor–Green README. Application admission follows the apps policy.
Sources not built by default¶
The former 01_hello_world/world.cpp is now the runnable first_domain lesson under examples/geometry/first-domain/.
See also¶
quickstart.md— suggested order for the first runsgetting_started/01-basics/README.md— narrative tutorialapi_examples_walkthrough.md—docs/api/examples/in reading ordertutorials/README.md— VTK, HeFFTeplan_options, spectral sequence, and other guided workflows