Skip to content

ADC-376 export hyqmom15 campaign to ParaView (.vti + .pvd) - #49

Merged
wolf75222 merged 6 commits into
masterfrom
adc-376-paraview
Jun 21, 2026
Merged

ADC-376 export hyqmom15 campaign to ParaView (.vti + .pvd)#49
wolf75222 merged 6 commits into
masterfrom
adc-376-paraview

Conversation

@wolf75222

@wolf75222 wolf75222 commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Make the hyqmom15 campaign viewable in ParaView, two ways.

1) Native adc_cpp VTK in the run

_run_and_record now also calls sim.write(format="vtk", step=k) — adc_cpp's native writer emits one ImageData .vti per snapshot (CellData mom_<moment> + phi), opened directly by ParaView/VisIt. This is the easy, native path; every future run produces step_*.vti per case alongside the npz.

2) to_paraview.py — optional enriched export

The native writer emits raw moments; this converter (from the npz) adds physics-ready cell fields — density, ux/uy + speed, the realizability margin lam_min — and a <case>.pvd time collection (real t values) under paraview/. Useful for nicer viz and to convert existing npz (e.g. a run made before the native write landed).

On "parallel": runs are single-rank (no MPI) → each snapshot is one grid → a single .vti is correct. Parallel pieces (.pvti) would only apply to an MPI-distributed run.

Validation

ruff clean; check_campaign 7/7. The enriched exporter's round-trip was verified bit-exact with pyvista (density Δ=0, orientation checked on a non-square grid, byte-exact at Np=256); 2-agent review cleared it. The native write uses adc_cpp's documented default VTK format; exercised on the next ROMEO run.

Part of ADC-376.

The campaign writes npz snapshots that ParaView cannot open. Add
to_paraview.py: convert each case to a VTK time series on the uniform
[-0.5,0.5]^2 grid -- one ImageData .vti per snapshot (cell data: density,
ux/uy + speed, phi, the realizability margin lam_min, the 15 moments) plus
a .pvd collection ParaView opens as an animation. The runs are single-rank
so each snapshot is one grid; parallel .pvti pieces would only apply to an
MPI-distributed run. Hand-written VTK XML (base64 binary), no VTK/pyvista
dependency. Chain it into the finalize sbatch + README + a build-free
check; the round-trip was verified bit-exact via pyvista.
Review nits: ux/uy now read 0 in sub-density-floor cells instead of the
raw moment, and an explicit --case that matches no snapshots exits 1
instead of silently reporting success.
Each snapshot now also calls sim.write(format='vtk') -> a native ImageData
.vti (CellData mom_<moment> + phi) ParaView/VisIt open directly, alongside
the npz. to_paraview.py stays as the optional enriched export (derived
density/velocity/realizability fields + a .pvd time collection).
Running the analysis on real campaign output surfaced it: the new
paraview/ output dir was picked up as a case, adding a spurious
'## paraview / no snapshots' section to rapport.md. Exclude figures/h5/
paraview consistently across make_rapport, export_h5, and the plot tools.
…tron

The full run showed dicotron loses realizability without the projector
(lam_min -4e5, all cells non-realizable, M00 floored) -- the rollup needs
relaxation15, which the campaign ran with projection=False. Thread a
--projection flag through run_campaign/run_one/_run_diocotron to
build_periodic_sim, which now passes projection=True to build_moment_model
(native build_projection, distinct .so). Lets us re-run dicotron with the
projector and show it stays realizable.
The old README had grown to 582 lines of historical and issue-tracking
cruft. Rewrite it following the project docguide (minimum viable, write
for humans, link instead of duplicating): what the package is, quick
start, the model API, the five cases, a short validation summary that
points to matlab_ref/REFERENCE.md, realizability and the native
projector, the analysis/ParaView toolchain, the campaign results, and the
layout. 154 lines, en-US, ASCII, no issue-tracker references.
@wolf75222
wolf75222 merged commit 8b18dd3 into master Jun 21, 2026
3 checks passed
@wolf75222
wolf75222 deleted the adc-376-paraview branch June 21, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant