2
$\begingroup$

I have NDSolve` StateData from an NDSolve` ProcessEquations evaluation. I can NDSolve` Iterate from t0 to t1, but then my boundary condition (an interpolation function) runs out of data.

This interpolation function gets updated externally. I just want to continue iterating (t1 to t2) with the updated interpolation function. However, calling myStateData@"NumericalFunction" shows that NDSolve holds onto the old interpolation function, even though this function is defined with a delayed set i.e. myInterpFunction[t_]:=something[t]

Is there any way to update the functions inside of the state data?

Here is a simplified version of what I'm doing:

myStateData = NDSolve`ProcessEquations[
    {myPDE[x,t],
    (*boundary conditions*)
    T[xf, t] == myInterpolationFunction[t],
    T[0, t] == 0,
    (*Initial condition*)
    T[x, t0] == initialCondition[x]};
    T, t, {x, 0, xf}]

Then I need to solve so...

NDSolve`Iterate[myStateData,t1]

Then externally I update my boundary condition so that now it goes to t2 but when I evaluate

NDSolve`Iterate[myStateData,t2]

Mathematica returns an error saying that the interpolation function doesn't cover that range (t1 - t2) because it's holding onto the old interpolating function. In other words, looking at

myStateData@"NumericalFunction"

shows myInterpolationFunction has a domain of {t0,t1}

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$ – bbgodfrey Apr 12 '15 at 19:42
  • $\begingroup$ Please include your actual code, or a simplified version of it if practical, so that readers can understand what you are doing. $\endgroup$ – bbgodfrey Apr 12 '15 at 19:43
  • $\begingroup$ I've added simplified code. My interpolation function is good from "t0" to "t1", once I update the function to go to "t2" I need NDSolve to continue Iterating/integrating to t2 $\endgroup$ – Eric William Smith Apr 12 '15 at 19:51
  • $\begingroup$ Try myInterpolationFunction[t_?NumericQ] := something[t]. See also mathematica.stackexchange.com/questions/18393/… $\endgroup$ – Michael E2 Apr 12 '15 at 21:12
  • 1
    $\begingroup$ (If you did try it and it did not work, then I suggest it is because the problem is not sufficiently described in the question. There must be something in the missing details that causes an unanticipated problem.) $\endgroup$ – Michael E2 Apr 13 '15 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.