# StepMonitor not working inside ParametricNDSolveValue

Here is a toy example:

currentTimeStep = 0;
Dynamic[currentTimeStep]
pfun = ParametricNDSolveValue[
{y'[t] == a y[t], y[0] == 1}, y, {t, 0, 10000}, {a},
StepMonitor :> (currentTimeStep = t;), MaxSteps -> 100000
];
pfun[1]


As you can see from the value of currentTimeStep, the variable is most of the time left without a numerical value. Is there a way to look at the current status of computation when using ParameticNDSolveValue?

-
I filed this as a bug. Thanks. – user21 May 8 '13 at 8:08

@ruebenko confirmed that this is a bug.

Here's a workaround:

currentTimeStep = 0;

monitor[t_?NumericQ] := (currentTimeStep = t; 1)

pfun = ParametricNDSolveValue[{y'[t] == a monitor[t] y[t], y[0] == 1},
y, {t, 0, 10000}, {a}, MaxSteps -> 100000];

Dynamic[currentTimeStep]

pfun[1]

-