IntegrateODE Oddities
jjweimer
Function DoKinetics(...)
// initialize parameters from a panel input state
...
IntegrateODE/M=1/U=100000/Q RxnAIP, kvalues, AIP
return 0
end
Function RxnAIP(pw, tt, yw, dydt)
wave pw, yw, dydt
variable tt
// extract parameters
variable k1f, k1r, k2
k1f = pw[0]; k1r = pw[1]; k2 = pw[2]
variable dydt0 = -(k1f*yw[0] - k1r*yw[1])
variable dydt2 = k2*yw[1]
dydt[0] = dydt0
dydt[1] = -dydt0 -dydt2
dydt[2] = dydt2
return 0
end
// initialize parameters from a panel input state
...
IntegrateODE/M=1/U=100000/Q RxnAIP, kvalues, AIP
return 0
end
Function RxnAIP(pw, tt, yw, dydt)
wave pw, yw, dydt
variable tt
// extract parameters
variable k1f, k1r, k2
k1f = pw[0]; k1r = pw[1]; k2 = pw[2]
variable dydt0 = -(k1f*yw[0] - k1r*yw[1])
variable dydt2 = k2*yw[1]
dydt[0] = dydt0
dydt[1] = -dydt0 -dydt2
dydt[2] = dydt2
return 0
end
I set the parameters via an external panel. All input controls on the panel are set to update only after mouse release, and all such updates result in a new call to DoKinetics(...). In most cases, the graph of the kinetic waves (AIP[][%A] ... AIP[][%P] update almost immediately. Some times though, when I change a parameter on the panel, I get the spinning black/white pie slice circle of death (MacOS 10.6.8, Igor 6.22A). This happens even when I change a parameter back to a previous value where the integration ran immediately. In other words, the instability case is unpredictable. I usually end up aborting (command-period) the IntegrateODE run. Thereafter, changing a different parameter sometimes "resets" the integration to happen again immediately. Every so often though, I just resolutely quit Igor and restart the experiment to get back an "instant integration" affect.
Any hints as to what might be happening? Any thoughts on how to fix the problem?
If you can't figure it out, send me an example.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
August 29, 2011 at 09:51 am - Permalink
I set this consistently at the top of the DoKinetics(...) function ...
Thanks. I'll play around with it a bit more and see what happens.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
August 29, 2011 at 10:07 am - Permalink
The example is now posted as Kinetic Reaction Demo. I've still not been able to understand fully why it hangs sometimes.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
September 10, 2011 at 10:33 am - Permalink
I haven't tested this, but I would bet a nickel that it's the problem.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
September 12, 2011 at 09:21 am - Permalink
Missed that one. A revision is posted. It appears no longer to hang indefinitely and only take longer in some possibly extreme cases of parameters.
Thanks!
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
September 13, 2011 at 09:14 am - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
September 13, 2011 at 10:51 am - Permalink