Trying to use named tuple parameter list with callback in DifferentialEquations

I’m doing some work with ODEs using DifferentialEquations.jl (really fantastic tool, BTW!) and I would like to have named fields for my parameters so that when I change them in affect functions I can use integrator.p.somethingmeaningful rather than integrator.p[4]. However, named tuples don’t work (or rather they work until I hit a condition) because the affect function can’t change them. I tried a mutable struct but then I got an iteration error on said struct.

Is there a recommended way to do this or can someone point me to an example?

If one of those approaches should work I’ll try to make a simpler example so I can post the code without asking folks to wade through too much irrelevant stuff.

Thanks! gives you something like a mutable named tuple.

1 Like

LVector is exactly what I was looking for - my affect functions are much more readable now (and won’t all break if I add or delete some parameters from my model).