Skip to content

Chombo: field viewer ("View in 3D") without Python — pure-Java volume and membrane VTU writers - #2157

Merged
jcschaff merged 7 commits into
masterfrom
viz/chombo-java-vtu
Oct 5, 2026
Merged

jcschaff merged 7 commits into
masterfrom
viz/chombo-java-vtu

Conversation

@jcschaff

@jcschaff jcschaff commented Oct 3, 2026

Copy link
Copy Markdown
Member

Summary

The browser field viewer could not open any stored Chombo result: like MovingBoundary before #2155, the Chombo VTU grids came only from the Python VTK service, which the data server is never given (vcell.vtk.pythonDir). This PR writes them in Java, following #2155's design, and fixes what stood between a real Chombo run and the viewer.

  • Pure-Java writers (VtkService.writeChomboVolumeVtkGridAndIndexData / writeChomboMembraneVtkGridAndIndexData, concrete on the base class, used on the desktop and the server with no Python fallback). VtuWriter gains:
  • Hdf5PostProcessor rejects statistic name 'mean' (written by the chombo solver) and aborts all data access for the run #1894 fixed: Hdf5PostProcessor reads Chombo's <var>_mean statistic as the average. Before this, every Chombo result failed to open, fresh runs included.
  • Directories: a desktop quick run (LocalVCDataIdentifier) uses its own directory. Server paths are unchanged.
  • Field viewer:
    • /grid reports the embedding dimension. A 3D membrane (triangles only) used to come back as dimension: 2, so the viewer drew it top-down in the plane, like a 2D run. It is now drawn as a surface in 3D.
    • /timeseries&snap=nearest snaps probes onto a Chombo membrane variable's lines or triangles.
    • No viewer JS change was needed.

Evidence

Real data. I ran two Chombo runs locally with the vcell-chombo solver bundle (localsolvers/mac64/vcell-chombo), from Solver_Suite_6_2.vcml: "chombo 2D" (8×8 disk) and "chombo 3d" (8×8×8 ball: 56 voxels, 224 cut-cell polyhedra, 888 membrane triangles). Both are committed as a fixture (about 540 KB) in vcell-core/src/test/resources/org/vcell/vis/chombo/. The s2 (membrane) and RanC_nuc (volume) initial conditions encode the voxel each value was computed in, so the tests can check that each value is paired with the right cell. The dev cluster wasn't reachable from here, so no archived /simdata run was used.

Python equivalence (ChomboVtuPythonEquivalenceTest, real pythonVtk via Poetry, VTK 9.4.1), on VisMeshes built by ChomboMeshMapping from both runs. Java and Python produce identical cells, cell types, connectivity and polyhedron faces. The index files match byte for byte, and points agree to Float32 precision (max |dx| ≈ 4.6e-7):

Chombo 105373152 volume:   65 points, 32 cells, 32 indices
Chombo 105373152 membrane: 20 points, 20 cells, 20 indices
Chombo 104116603 volume:   907 points, 280 cells (224 polyhedra), 280 indices
Chombo 104116603 membrane: 446 points, 888 cells, 888 indices

Tests (each fails on the old code)

test on old code
ChomboVtuWriterTest (2D, 3D): every volume and membrane value pairs with its cell; membrane on the sphere/circle required System property "vcell.vtk.pythonDir" not defined (and No Statistic with name mean before #1894's fix)
ChomboVtuPythonEquivalenceTest (2D, 3D) same
ChomboServerVtuPathTest: data server path, pythonDir unset same
Hdf5PostProcessorTest.testReadChomboStatistics No Statistic with name mean
FieldViewerServerChomboLocalRunTest (2D, 3D): /info lists _Membrane; /grid is a triangle surface in 3D with physical coordinates; /field pairs one value per triangle (and per volume cell); /timeseries snaps a click onto the membrane 3D: dimension 2; 2D: the membrane click misses (no snap); with the old core, pythonDir not defined
browser test_chombo_membranes.py (new chomboRun2d/chomboRun3d fixtures; Chromium, WebKit, Firefox: 12 passed) 3D membrane renders in 2D mode ("drag to pan")

Locally:

  • mvn clean install dependency:copy-dependencies -DskipTests passes.
  • vcell-core org.vcell.vis.**, Hdf5PostProcessorTest, CartesianMeshChomboTest and cbit.vcell.solvers.mb.* pass.
  • vcell-client org.vcell.client.viz.* passes (all 12 classes).

Nothing serialized over the API changed, so I didn't run validate-openapi-spec.sh.

Not done / gaps

  • No desktop end-to-end check through the debug bridge: the dev cluster was unreachable from this machine. The desktop path (LocalDataSetController → FieldViewerServer → browser) is covered by the local-run tests and the browser fixtures.
  • Membrane kymographs over the VTU seam are still refused. On a 2D Chombo membrane the viewer offers the curve tool, and the server then rejects the request.
  • Not exercised here: multi-level (refined) Chombo meshes. Both fixture runs have one level. chomboToPhysical uses the solver mesh's size, while ChomboMeshMapping uses the finest level's.

🤖 Generated with Claude Code

jcschaff and others added 7 commits October 3, 2026 02:41
Two small runs of Solver_Suite_6_2.vcml (test resource models/) made with
the vcell-chombo bundle's VCellChombo2D_x64/VCellChombo3D_x64: "chombo 2D"
(sim 105373152, a disk of radius 3 on an 8 x 8 mesh) and "chombo 3d" (sim
104116603, a ball of radius 4 on 8 x 8 x 8: whole voxels, cut cells and a
triangulated membrane), saved at t = 0, 0.5, 1. The initial conditions of
s2 (membrane, rate 0) and RanC_nuc (volume, x1e-8) were set to
floor(x/1.25) + 100 floor(y/1.25) + 10000 floor(z/1.25), so a value names
the voxel it was computed in. The .fvinput files are the solver inputs
(the 2D run needed dt = 0.01). The .log and .zip are forced past
.gitignore: the reader needs them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The Chombo solver writes each variable's statistics as <var>_mean,
_total, _min, _max. StatisticType.fromName rejected "mean", and since the
post-processing file is read whenever a run's data is opened, every Chombo
result failed to open ("No Statistic with name mean"), fresh runs
included. Fixes #1894.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The Chombo volume and membrane grids came only from the Python VTK
service, which the data server is never given (vcell.vtk.pythonDir), so
every Chombo field-viewer request failed, as MovingBoundary's did before
#2155. writeChomboVolumeVtkGridAndIndexData and
writeChomboMembraneVtkGridAndIndexData are now concrete on the VtkService
base class, for every service, with no Python fallback.

VtuWriter writes, as the Python service did:
- the volume: polygons (2D); whole voxels, then tetrahedra, then the cut
  cells as VTK_POLYHEDRON with their own faces (3D), in VTK 9.4's layout
  (file version 2.3, face_connectivity/face_offsets/polyhedron_to_faces/
  polyhedron_offsets, connectivity the distinct point ids ascending);
- the membrane: the surface points, one VTK_LINE per line (2D) or one
  VTK_TRIANGLE per surface triangle (3D);
with the ChomboIndexData in cell order.

ChomboVtuPythonEquivalenceTest runs the real Python service on the
VisMeshes ChomboMeshMapping builds from real 2D and 3D runs: identical
cells, types, connectivity, polyhedron faces and index files (byte for
byte), points to Float32 precision. ChomboVtuWriterTest checks, through
ChomboVtkFileWriter, that every volume and membrane value pairs with its
cell (the fixture's values name the voxel they were computed in).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
getVtuMeshData(ChomboFiles, ...) read vcell.primarySimdatadir.internal,
which exists only on the server, so the desktop could not serve a local
Chombo run's values. A LocalVCDataIdentifier (a quick run) now uses its
own directory for the meshes and the values; any other identifier takes
the same server path as before.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
DataServerImpl over a DataSetControllerImpl, a server-run identifier, the
results under vcell.primarySimdatadir.internal/<owner>/ and
vcell.vtk.pythonDir unset, as in the deployed data container: both real
runs serve their volume and membrane meshes and one value per cell at
every time, written beside the run, with nothing handed to Python. Before
the Java writers this failed with "required System property
vcell.vtk.pythonDir not defined".

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…anes

/grid reported a VTU-mode grid's dimension from its cell types, so a 3D
Chombo membrane (triangles only) came back as 2D and the viewer drew it
top-down in the plane, as a 2D run. It now reports the embedding
dimension (volume cells, or points that span z), as FEniCSx bundles do.
/timeseries&snap=nearest now snaps a click onto a Chombo membrane
variable's lines or triangles (the viewer sends it for every body-fitted
probe), and a 3D membrane's points no longer take a 2D plane's z.

FieldViewerServerChomboLocalRunTest serves the real 2D and 3D runs as the
desktop serves a quick run (LocalDataSetController, no server properties,
no Python): /info lists the _Membrane domain, /grid is a triangle surface
in 3D (segments in 2D) in microns on the sphere (circle), /field pairs one
value with each membrane and volume cell, and /timeseries snaps a click
beside the membrane onto it. The browser fixtures chomboRun2d/chomboRun3d
serve the same runs; test_chombo_membranes.py checks the 3D membrane is
drawn and probed in 3D, the cut-cell volume, and switching between them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Section 4 now describes the pure-Java volume and membrane writers, their
VTU layout (polyhedra in VTK 9.4's form), the directories, the field
viewer's membrane handling and the test fixture. Reading no longer needs
linux/amd64 (jhdf), the "mean" statistic is read (#1894), and a solver
bundle now ships.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@jcschaff
jcschaff merged commit 233765f into master Oct 5, 2026
10 checks passed
jcschaff added a commit that referenced this pull request Oct 5, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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