PD20 — simulation source

The physics engine and its test suite, published in full.

The simulation source

The physics is published in full. Read it, run it, and check the numbers on this site against your own run.

Nothing here is a description of the model — it is the model. Every constant, every flux law and every citation is in these files, and the tests below are the ones that hold them to account.

What is not here. Two modules are withheld: they carry the control algorithm's gains and set-points, which are a pending patent matter. Everything the physics needs in order to be reproduced is published; what is withheld is how the device decides, not how the body and membrane behave. The published control interface is described on the main page.

Physics

FileLinesWhat it is
physics_core.py813Conservation substrate and the constitutive laws — every flux the model can perform, and the two primitives that make mass conservation structural.
physics_sim.py2284The integrator: peritoneal cavity geometry, membrane transport, whole-body physiology, the regeneration circuit, and the per-minute step.
physics_patient.py (source withheld)541The patient outside the device: diet, thirst, residual renal function, stool and insensible losses, endogenous acid production, and the fatal-condition checks. Runs against the withheld control module, so its source is not published.
physics_geometry.py249Ovoid cavity geometry — slab volumes, wall areas, fluid height and the hydrostatic column.

Tests

FileLinesWhat it is
test_oncotic_landis.py218Colloid osmotic pressure by Landis-Pappenheimer, and the transperitoneal gradient against the measured 22 mmHg.
test_conservation_guard.py (source withheld)41Water and every solute conserve to floating-point precision. Runs against the withheld control module, so its source is not published.
test_constants_literature.py238Every constant against its published range.
test_engine_equivalence.py62The integrator computes the same physics as the reference laws.
test_published_regression.py (source withheld)342The ten published patient outcomes still reproduce. Runs against the withheld control module, so its source is not published.
test_blindness_structural.py (source withheld)251No serum concentration reaches the control decision path. Runs against the withheld control module, so its source is not published.

3864 lines of published source in total. The withheld modules are physics_controller.py, physics_nn_controller.py.