Integrator Creation
Creating an Integrator
Section titled “Creating an Integrator”sim_create_context_integrator(ctx, name, config) -> integratornameis one of:euler,euler_deterministic,heun,rk4,rkf45,backward_euler,crank_nicolson,subordination.configis optional; unspecified fields use defaults inlua_api.c.
Key config fields:
initial_dt(default 0.1),min_dt(1e-4),max_dt(1.0)tolerance(1e-3),safety(0.9)adaptive(false unless the method enables it),enable_stochastic(false)stochastic_strength,random_seedworkspace_hint(optional state length hint)
Attach with sim_set_integrator(ctx, integrator). The handle is kept alive via a Lua registry ref until you call sim_detach_integrator or sim_shutdown.
Integrator Catalog
Section titled “Integrator Catalog”- euler: explicit Euler; fixed step only.
- euler_deterministic: Euler with deterministic noise handling; fixed step.
- heun: Heun’s method (improved Euler); fixed step.
- rk4: Classical 4th-order Runge–Kutta; fixed step.
- rkf45: Dormand–Prince RK45 with adaptive stepping (uses
tolerance,safety,min_dt,max_dt). - backward_euler: Implicit Euler; stable on stiff problems; fixed step.
- crank_nicolson: Implicit trapezoidal rule; A-stable; fixed step.
- subordination: Two-stage integrator handling fractional/subordinated clocks; respects stochastic parameters.