Skip to content

A per-species atol built from initial values still misses a species that decays below it: expose CVodeWFtolerances (the over-time half of #196) #213

Description

@wshlavacek

Summary

#196 gave the state axis a per-species absolute tolerance (CVodeSVtolerances), which removes the
cross-species compromise: a model whose species span decades no longer has to pick one number
that is a tolerance for the largest and the smallest at once.

It does not touch the within-species, over-time version of the same problem. A tolerance built
from a species' magnitude at t=0 is still one number for that species for the whole run, and a
species that starts at order one and decays to something tiny outgrows it. Below its own atol the
species stops being error-controlled — the same failure #196 documents, arrived at through time
rather than through the species list.

CVODE's construct for this is CVodeWFtolerances, a user-supplied error-weight function: instead of
handing the integrator a fixed atol vector, you hand it a callback that computes ewt(y) at the
state actually being integrated. #196 named it explicitly as the right tool and explicitly deferred
it:

That is a within-species, over-time mismatch rather than a cross-species one, and the construct
for it is CVodeWFtolerances (a user-supplied error-weight function), which the binary also links.
Worth knowing about; not worth doing first.

The symbol is present in the built extension, so this is reachable without touching the vendored
SUNDIALS build:

$ nm .../bngsim/_bngsim_core.cpython-312-darwin.so | grep CVodeWFtolerances
00000000000873d8 T _CVodeWFtolerances

Evidence

Bruno_JExpBot2016 is the measured case, and it was chosen because no initial-value heuristic
touches it
: its initial conditions are all order one, so atol="auto" derives essentially one
number for every species and the #196 vector is a no-op. Its objective still moves by 1.3e-05
between atol=1e-8 and a converged tail near 1e-16.

That is the whole shape of the gap: a model the cross-species fix cannot help by construction, still
sensitive to atol, because the sensitivity is to when rather than to which species.

Why it is not urgent

Stated plainly so this is not over-prioritized:

Suggested direction

Deliberately loose; the design is the open part.

Not in scope

Anything the per-species vector already solves. This is specifically for models where the vector is
a no-op because every species starts at a similar magnitude, and the run is still atol-sensitive.

Related: #196 (which deferred this by name), lanl/PyBNF#549 (adopting the cross-species half).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions