Repository navigation
Let models change the inlet media during a run - #50
Merged
Merged
Conversation
The media entering a device had one fixed composition for the whole run: a fixed boundary's values were set when the signal grid was configured and nothing could replace them, so a model could not switch reservoirs, pulse an inducer, or ramp a nutrient. SignalGrid::set_boundary_values and Simulation.set_signal_boundary_values replace the per-signal values of a fixed boundary between steps. The boundary kind does not change, so the transport operator keeps its structure, and every backend already reads the values from the grid on each step. The values are part of the checkpointed grid. Device helpers gain set_inlet_values, and InletSchedule describes a composition that switches or ramps over model time.
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.
Fixes #8.
Problem
The media entering a device had one composition for the whole run.
apply_to_gridset a fixed inlet boundary, and the solved flow carried it in, but nothing could replace a fixed boundary's values afterconfigure_signal_grid. A model could not switch reservoirs, pulse an inducer, or ramp a nutrient, which is most of what a microfluidic experiment does at its inlet.Changes
SignalGrid::set_boundary_values(face, values)andSimulation::set_signal_boundary_valuesreplace the per-signal values of a fixed boundary between steps. A newGridFaceenum names the six faces. Only the values change, never the boundary kind, so the transport operator keeps its structure.Simulation.set_signal_boundary_values(GridFace, values)is bound, andGridFaceis exported.set_inlet_values(simulation, values)on the trap devices, andInletSchedulefor a composition that switches or ramps over model time (InletSchedule.pulsefor the common case).No backend kernel changes were needed: CPU, Metal, and CUDA already read the fixed values from the grid on every step. The values live in the grid spec, so checkpoints carry them without a format change.
Verification
New tests:
InletScheduleswitching, ramping, pulse, and validation.Not covered
outlet_values=[0.0], which also acts as a diffusive sink at the outlet. A proper outflow boundary needs kernel changes on all three backends and is left for a follow-up.🤖 Generated with Claude Code