Repository navigation
Field viewer: draw the particles of hybrid PDE/particle runs - #2160
Merged
Merged
Conversation
A results bundle may carry molecule positions next to its fields: a root
.zattrs key "particles" = {schema: 1, species: {name: {xyz, count}}}, with
xyz (T, cap, 3) and count (T, 1) stored like the field arrays (float64, one
row per chunk). viva-pde-particle's co-simulations write it.
- FenicsBundle reads the extension (getParticleSpecies, particles(species,
row)) with its existing row reader; a newer extension schema is ignored.
- FieldViewerServer: /info lists particleSpecies; new /particles?time=&max=
returns each species' positions at one time (at most max per species,
default 20,000, evenly strided) and its molecule count.
- webapp-viewer: a Particles toggle with a colour-keyed legend; each species
is drawn as point sprites over the field, refetched per time step, and the
molecules beyond an active cut are hidden as the mesh there is.
- Tests: FenicsBundleParticlesTest (reader and endpoints) and
test_particles.py (browser, all three engines) over a new fixture,
receptor_3d.fenics with two species added.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets the field viewer show the molecules of a hybrid PDE/particle simulation over its fields. The source is a results bundle (vcell-fenics ADR 010) that also records molecule positions. viva-pde-particle's process-bigraph co-simulations (PDE engine + Smoldyn) write these bundles, through its
SpatialRecorder.The bundle extension
A second root
.zattrskey sits next to thevcell_fenicsmanifest:Per species there are two arrays, stored exactly like the field arrays (little-endian float64, one row per chunk, zlib), so
FenicsBundle's existing row reader reads them:xyz:(T, cap, 3)lab-frame positions, NaN past the row's count;count:(T, 1).Rows are global output rows. A bundle without the key has no particles. A newer extension schema is ignored rather than refused, so the fields stay viewable.
Changes
FenicsBundle(vcell-core):getParticleSpecies()andparticles(species, row).FieldViewerServer/FenicsBundleViews:/infolistsparticleSpecieswhen there are any./particles?time=&max=: each species' positions at one time, at mostmaxper species (default 20,000, evenly strided), pluscountandshown.webapp-viewer:renderPointsAsSpheresOn, size 5) in colours that stay distinct from the blue→red field LUT.docs/3d-renderer-design.md(the extension and the endpoint),webapp-viewer/test/README.md.Not covered
Finite-volume hybrid runs (vcell-fvsolver with embedded Smoldyn) save particle counts per voxel, not positions, so they don't get the layer. That would need the solver to save positions, or a binned display.
Tests
Fixture:
receptor_3d_particles.fenicsis the existingreceptor_3d.fenics(manifest and fields byte-identical) with species A (12, 8, 4 molecules at the three times) and B (3 at each), placed insidecyto_dom's tetrahedra.Java: new
FenicsBundleParticlesTestcovers the reader,/info,/particles, themaxstriding, and the 400/404 cases. It passes, along withFenicsBundleViewsTest,FenicsBundleTestandFieldViewerServerFvTest(31 tests).Browser: new
test_particles.pychecks:It is registered as fixture
fenicsParticles(sim 557) inFieldViewerFixtureServer. The full browser suite passes: 225 tests across Chromium, WebKit and Firefox.Manual check: a viva-pde-particle co-simulation of a ball (Netgen P1 mesh + Smoldyn, 15,611 molecules at t = 0.5 s) renders with the particles over B and the cut applied (8,886 drawn).
🤖 Generated with Claude Code