PyIMR 0.1.0
First tagged release. Nothing was released before it, so this describes what the package is
rather than how it differs from something you might be running.
Solving
pyimr.simulate takes a validated, dimensional SimulationConfig and returns immutable
physical histories. The material is an explicit typed value, not an integer selector and a
shared bag of parameters.
- Six radial equations: Rayleigh-Plesset, Keller-Miksis pressure and enthalpy, Gilmore, each
against Tait or Mie-Gruneisen. - Bubble and medium thermal transport, vapour transport, and forcing that is constant,
Gaussian, histotripsy, a Heaviside step, or a sampled pressure history. - Materials: closed-form Kelvin-Voigt, quadratic Kelvin-Voigt, Zener, quadratic Zener,
Oldroyd-B and linear Maxwell; composable hyperelastic and generalised-Newtonian laws;
distributed Giesekus and linear PTT memory. max_stepsbounds one solve. A parameter set whose bubble collapses to a fraction of a
percent of its maximum and then creeps will spend any budget it is given, while the healthy
points around it finish in under 7e3 steps.
Choosing settings by measuring, not by folklore
pyimr.resolution.choose_resolutionpicksthermal,Ntand tolerance from a requested
accuracy, measured on the caller's own problem. Requirements depend on record length,
material stiffness and the observable being fitted, so a setting adequate for one collapse
can be 4x wrong over five.pyimr.diagnoseclassifies a failing configuration asbudget,domain,
ill-conditionedorunresolved.maximum number of solver steps was reachedis the same
message for all of them, and they want opposite responses.pyimr.noise.predicted_spreaduses trial-to-trial scatter as a prediction target rather
than only as a noise scale. A model predicting far more scatter than a repeated experiment
shows is excluded by the data whatever its chi-squared.
Inference and model selection
Forward sensitivities through the production right-hand side, a prepared likelihood with
analytic Jacobians, multistart fitting, a PyMC bridge, expected-information-gain design, and
ensemble and variational state estimation. pyimr.selection compares seventeen nested
constitutive candidates by marginal likelihood, with the noise scale marginalised under a
half-Cauchy prior and a redundancy prior that down-weights parameters where a model merely
reproduces a simpler one it contains.
Running many solves
pyimr.parallel.worker_poolconfines each worker to one core. XLA sizes its thread pool
from the affinity mask, so sixteen unconfined workers on a 128-core host took roughly 6500
threads between them: it never failed, it thrashed.pyimr.store.ResultStorecaches solves on the content of(times, config), failures
included, so re-running an unchanged study is nearly free.- A parameter sweep compiles one program rather than one per point, for every material except
Ogden, whose variable-length tuples cannot travel as a fixed-width vector.
Validation
The suite pins IMRv2 trajectories across radial equations, forcing, vapour, heat and mass
transfer and the specialised constitutive models, and separately checks closed forms,
reduction limits, and every analytic tangent against independent centered differences.
PyIMR diverges from IMRv2 where upstream is wrong: eight defects found at dea31cd, each
reproduced in MATLAB and each correction validated against something other than upstream. One
divergence is numerical rather than a defect fix, the Zener and QuadraticZener
acceleration coefficient. See docs/upstream.md.
Install
pip install "git+https://github.com/sbryngelson/PyIMR@v0.1.0"
Not on PyPI yet.