Examples

Start with OpenPFC by example, a sequence of Quarto lessons with runnable C++ models under thematic directories: geometry/, fourier/, differentiation/, heat/, interpolation/, waves/, integration/, polynomials/, parallel/, coupling/, output/, diagnostics/, elliptic/, quadrature/, initialization/, configuration/, and phase-fields/. See index.qmd for the story and AUTHORING.md for local preview, numerical checks, and figure reproduction. The coverage inventory keeps the existing targets and all forty Trefethen programs visible, including work still pending.

Small programs that demonstrate the OpenPFC library. They are built when OpenPFC_BUILD_EXAMPLES=ON (CMake default).

Build

From the repository root (after satisfying INSTALL.md):

./scripts/build.sh

The default Tohtori CPU executables appear under builds/release/examples/.

Suggested first runs

With an installed SDK and CLI, start from the repository root:

(cd examples/geometry/first-domain && openpfc run model.cpp input.json --launcher=none)
(cd examples/initialization/patterns && openpfc run model.cpp input.json --source-root .. --launcher=none)
(cd examples/heat/implicit-euler && openpfc run model.cpp input.json --source-root .. --ranks=2 --launcher=mpirun)
(cd examples/phase-fields/cahn-hilliard && openpfc run model.cpp input.json --launcher=none)

The CLI prints each isolated attempt directory. Its results/ contains that run’s fields and diagnostics. The chapters explain the input parameters, expected behaviour and checks. Native executables built by scripts/build.sh can also be run from the repository root under builds/release/examples/; their relative results/ output then stays under the repository’s ignored output directory.

A research prototype (not part of the numbered teaching ladder) is ns2d_vorticity: 2-D vorticity–streamfunction Navier–Stokes (#21) and incompressible MHD (mhd2d, #23). See ns2d_vorticity/README.md. Conference figures for the accepted MHD windows: ns2d_vorticity/VISUALS.md. Bounded prototype under examples/. Promotion to apps/ follows the admission criteria.

Full catalog and curriculum

Every target registered in CMakeLists.txt is listed in ../docs/examples_catalog.md, including Tier 1–3 suggested order and a flowchart. Guided spectral sequence (04_diffusion_model → 05_simulator → 12_cahn_hilliard): ../docs/tutorials/spectral_examples_sequence.md.

See also