Floquet Alfvén Continuum Solver¶
FACS computes Alfvén and coupled Alfvén–sound continua from axisymmetric
GEQDSK equilibria. It provides a C++ library, a native command-line tool, and
a browser app with interactive Floquet diagnostics. The browser supports
WebAssembly and approximate WebGPU backends, including paired f32 precision.
Native quick start¶
Use CMake 3.15 or newer and a C++20 compiler. From the repository root:
git submodule update --init --recursive
cmake -S . -B build/debug -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON
cmake --build build/debug -j
ctest --test-dir build/debug --output-on-failure
Calculate a coupled continuum and save its sampled Floquet analysis:
./build/debug/facs equilibrium.g --model coupled --omega-max 0.5 \
--toroidal-modes 3,5 --output continuum.txt \
--floquet-output floquet-analysis.txt
Replace equilibrium.g with a GEQDSK g-file. Coupled calculations require
positive pressure on each sampled surface. Frequencies use v_A,0/R_0 units.
The default model is Alfvénic only; omit --model coupled to use it.
See the command-line guide for options and sampling controls.
Plot results¶
python3 -m pip install -r script/requirements.txt
python3 script/plot_facs.py continuum continuum.txt --analysis floquet-analysis.txt \
--color-by local -o continuum.png
The output guide covers text, JSON, and HDF5/NetCDF files. See Python tools for readers, plotting APIs, and benchmarks.
Browser build¶
Activate Emscripten 5.0.7 or newer, then run:
./build_web.sh
Serve build/pages/ with COOP and COEP headers to enable shared Wasm memory.
WebGPU requires a working browser adapter and HTTPS or localhost.
See build and hosting details,
the browser guide, and Cloudflare deployment.
Documentation¶
Start with the documentation index.
| Guide | Contents |
|---|---|
| Build and test | Native and browser dependencies, tests, and bundled equilibria. |
| Command line | Options, accuracy controls, threads, and progress. |
| Browser | Plots, zoom refinement, Floquet solutions, and screenshots. |
| Library API | CMake targets, reusable equilibria, callbacks, and coordinate conventions. |
| Output formats | File layouts, downloads, plotting, and binary writer. |
| Theory, algorithms, numerical details | Equations, implementation, tolerances, and convergence checks. |
| WebGPU and measurements | GPU buffers, precision, fallback, rendering, and measured costs. |
| Deployment | Cloudflare Pages and GitHub Actions. |
Source layout¶
lib/: solver library and shared application support.cli/andweb/: native and browser frontends.libmeq/: equilibrium submodule and its spline dependency.webui/: shared browser controls, styles, and themes (submodule).script/: readers, plots, benchmarks, and documentation builder.test/: regression tests;doc/: guides and numerical reference.