Skip to content

Limit growth by compression in the engine - #52

Closed
marpaia wants to merge 1 commit into
masterfrom
marpaia/crowded-growth-limit
Closed

marpaia wants to merge 1 commit into
masterfrom
marpaia/crowded-growth-limit

Conversation

@marpaia

@marpaia marpaia commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #51. This does not close it: it bounds the population of a confined colony, but it does not make the contact relaxation resolve a full space cleanly. See "Not fixed" below.

Problem

Growth and contact did not interact. Simulation.step committed growth before any relaxation ran, and relax_cell_mechanics integrated without length increments, so a colony with nowhere to go kept elongating into itself.

Changes

  • Native: Simulation::step(dt, GrowthLimitParameters). Before growth it finds the cell contacts of the starting geometry and takes each cell's deepest overlap with a neighbor, in units of that cell's radius. Elongation is unaffected up to free_overlap (default 0.1), falls linearly, and is zero from stall_overlap (default 0.4).
  • Accounting: the scaling is applied before species, coupled, and signal updates, so nutrient uptake tied to volume change is charged for the growth that happened.
  • Backends: the rule runs on host arrays after the backend's own growth and contact search, so CPU, Metal, and CUDA need no kernel changes.
  • Controller: MechanicsConfig gains growth_limit, growth_free_overlap, and growth_stall_overlap. The limit is off by default. A checkpoint without these fields resumes with it off.
  • Trap example: uses the engine limit in place of the rule in its regulation callback (same stall overlap, a fifth of a diameter). MODEL_VERSION is 6.
  • Docs: a "Growth under compression" section in the contact mechanics ADR, including the limits below.

Measurements

Closed 4 x 4 x 1.2 chamber (radius 0.4, divide above length 2), dt = 0.05, CPU, default gamma = 10:

Without the limit With the limit
Cells at step 200 256 9
Footprint / floor area at step 200 25.0 0.92
Cells at step 600 not run (doubling every ~14 steps) 9
Median contact overlap at step 600 0.28 radii
Worst pair at step 600 1.77 radii

Unconfined colony, gamma = 100, at 256 cells: 94% of the unlimited total length (761 against 806), with 90th-percentile overlap 0.24 radii against 0.41.

The trap example's steady-state test passes unchanged with the engine limit.

Verification

Check Result
Native tests, Metal-enabled build 30/30 pass
Python suite 529 passed, 38 skipped
pre-commit clean

New tests cover the linear band on CPU and Metal, cells out of contact, shrinkage, rejected parameters, nutrient charged in proportion to the growth kept, the config round trip and a payload without the new fields, the closed chamber filling and then holding, and an unconfined colony keeping at least 85% of its unlimited length.

Not fixed

  • A full space still holds deep overlaps. The regularized solve minimizes the sum of squared overlaps, which does not bound the largest one. The chamber above settles with one pair overlapping by 1.77 radii. A pair pushed past one radius has inverted (the cells have passed through each other or stacked in z) and the solve no longer separates it.
  • Stiff relaxation makes a full space creep. With gamma = 100 the same chamber keeps trading overlap between pairs, cells that come out shallow resume growing, and it reaches 16 cells and a footprint of 1.56 by t = 40.
  • The default gamma = 10 under-relaxes large colonies. By the time an unlimited unconfined colony reaches 1,024 cells (t = 10), the limited one at gamma = 10 holds 333, about a third of the total length, with a median overlap of 0.27 radii. The limit needs gamma near 100 to leave free growth alone, which is the setting that creeps when confined. No single setting does both, which is why the limit is opt-in and no default changed.
  • Tried and dropped: a per-pass cap on cell translation (it starves an expanding colony: 90th-percentile overlap rose from 0.03 to 0.38 radii), stiffer wall rows (the solve stops converging), and retracting growth by the solve's length correction (slows but never stalls).

Closing #51 needs a relaxation scheme that treats contacts as inequalities and keeps pairs from inverting. That is separate work.

  • CUDA is not compiled or run. No CUDA source changed; the CUDA parametrizations of the new tests were skipped here.

🤖 Generated with Claude Code

Growth and contact did not interact: Simulation.step committed growth
before any relaxation ran, so a colony with nowhere to go kept
elongating into itself. A closed chamber with room for about ten cells
held 256 fully overlapping cells after 200 steps.

Simulation.step(dt, GrowthLimitParameters) scales each cell's
elongation by its deepest overlap with a neighbor: unaffected up to
free_overlap cell radii, falling linearly to zero at stall_overlap. The
scaling is applied before species, coupled, and signal updates, so
uptake tied to volume change is charged for the growth that happened.
It runs on every backend through the backend's own contact search.

MechanicsConfig gains growth_limit, growth_free_overlap, and
growth_stall_overlap. The limit is off by default, and a controller
payload without these fields resumes with it off. The trap example uses
it in place of its own regulation-callback rule.

The limit depends on what relaxation can do. A full closed space can
still hold pairs overlapping by more than a radius, and with stiff
relaxation its population creeps upward; the contact mechanics design
records both.
@marpaia

marpaia commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator Author

Closing in favour of #54.

This change limited growth by measured overlap, on top of a relaxation that cannot keep cells apart in a full space. #54 replaces that approach: contact is solved with non-negative forces, and growth is part of the same solve, so a cell's elongation responds to the load on it and a full space stops growing. The trap example there uses the new solve in place of the overlap rule added here. The plan and literature are in #53.

@marpaia marpaia closed this Nov 13, 2026
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