Skip to main content

Module events

Module events 

Source
Expand description

Event directions and their location: zero crossings of g(t, y) found on an integrator’s dense output and polished with Brent’s method.

An event is a sign change of a scalar function g(t, y) across an accepted step, in the direction the event asks for. A system declares its events through crate::integrator::OdeSystem::event_count and its sibling methods. crate::integrator::Integrator::advance evaluates every event function at the end of each accepted step and locates the earliest crossing on the step’s dense output with find_root to EVENT_TIME_RESOLUTION_S. The integration stops at the end of the final bracket on the far side of the crossing, with the dense output’s state there. Every event past its zero at that state is reported together, so coincident events are never lost, and none of them is reported again when the integration resumes.

Crossings are seen only as sign changes between step ends: a function that crosses zero and comes back inside one step goes unseen. Bound the step (Adaptive::max_step_s) when that matters.

Method: docs/physics/integration.md.

Enums§

Direction
Which sign changes of g count as an event.
RootError
Why find_root found no root.

Constants§

EVENT_TIME_RESOLUTION_S
The time resolution of event location, in seconds. Roots are polished to within this (plus four units of rounding in t) of the dense output’s zero; the accuracy of the event itself is the integration’s.

Functions§

find_root
A zero of f in [a, b] by Brent’s method, given f(a) and f(b) of opposite signs (or one of them zero).