12
$\begingroup$

I generally use NDSolve for stiff non linear partial differential equations of 4th order. I find that a BDF1 method generally does well to placate my beast of a PDE.

I've also tried out "MaxSteps" to curtail my simulation to a certain number of time steps.

I understand that BDF and other methods for stiff equations are adaptive time step methods and I notice that "Fixed" step is not a valid option for BDF at least. Is there any way I could solve stiff equations with a fixed time step? I realize that NDSolve knows best but it would give me more flexibility to play around with the wonderful options in NDSolve if there were a way to use fixed time steps.

> My references:

this and this

> This is how I tried using "FixedStep":

Method -> {"FixedStep", "Method" -> {"BDF", "MaxDifferenceOrder" -> 1}}

Obviously this was incorrect as "BDF" isn't a submethod.

$\endgroup$
7
  • 1
    $\begingroup$ According to the documentation FixedStep only works with one-step integration methods, while I think BDF is/are multistep methods. So I think the problem is that BDF is not a valid submethod for FixedStep... $\endgroup$ Mar 30, 2012 at 9:02
  • $\begingroup$ @AlbertRetey sure. I understand that. But even adaptive time step methods are predicated on some condition. How do I control that condition? I am guessing in this case, its a stiffness-stability criterion that decides the time step. Is there some way I can look at the Jacobian matrix from NDSolve[...]? Anyone? $\endgroup$
    – dearN
    Mar 30, 2012 at 19:30
  • 1
    $\begingroup$ Sorry, I just wanted to express that I don't know any way to do what you want -- and tried to point out the fact that the documentation says that what you look for is probably not implemented, for reasons not uncovered... $\endgroup$ Mar 31, 2012 at 23:17
  • $\begingroup$ @AlbertRetey sure thing man! No beef! :P It would be great to figure a way out to actually meddle with the internals of mathematica like one can do with say ode15 in MATLAB! Thanks for helping! $\endgroup$
    – dearN
    Apr 1, 2012 at 3:17
  • $\begingroup$ actually I haven't been of much help yet :-). Just as a final remark: while the documentation says that FixedStep and BDF don't work together, I think that the NDSolve-framework should in principle allow to do something like that (after all you can define completely new Methods). The question is whether you are willing to spend the effort to implement that -- it would certainly be more effort than I can spend for an answer, sorry. $\endgroup$ Apr 2, 2012 at 10:04

1 Answer 1

11
$\begingroup$

To get a fixed step size with the BDF method you can lower the AccuracyGoal and PrecisionGoal to increase the adaptive step sizes and then use MaxStepSize to limit the step size to any value you want.

Get an example stiff system from the documentation:

Needs["DifferentialEquations`NDSolveProblems`"];
Needs["DifferentialEquations`NDSolveUtilities`"];
system = GetNDSolveProblem["VanderPol"];

Solve with the BDF method:

sols = NDSolve[system, {T, 0, 10}, Method -> "BDF"];
Plot[Evaluate[sols[[1, All, 2]]], {T, 0, 10.}, Frame -> True]

Mathematica graphics

Plot the step sizes:

StepDataPlot[sols] /. AbsolutePointSize[_] -> PointSize[Small]

Mathematica graphics

Solve again with low precision and accuracy goals and small MaxStepSize:

sols = NDSolve[system, {T, 0, 10}, Method -> "BDF", 
  PrecisionGoal -> 0, AccuracyGoal -> 0, MaxStepSize -> 1. 10^-5
];
Plot[Evaluate[sols[[1, All, 2]]], {T, 0, 10.}, Frame -> True]

Mathematica graphics

Now we have a fixed step size:

StepDataPlot[sols] /. AbsolutePointSize[_] -> PointSize[Small]

Mathematica graphics

We can increase the step size, but the result starts to diverge from the true solution:

sols2 = NDSolve[system, {T, 0, 10}, Method -> "BDF", 
   PrecisionGoal -> 0, AccuracyGoal -> 0, MaxStepSize -> 1. 10^-4
];
Plot[Evaluate[Flatten[{sols, sols2}][[All, 2]]], {T, 0, 10.}, Frame -> True]

Mathematica graphics

We still have a fixed step size, though:

StepDataPlot[sols2] /. AbsolutePointSize[_] -> PointSize[Small]

Mathematica graphics

$\endgroup$
2
  • $\begingroup$ Very neat! Would you mind telling how you figured out that lowering those settings did the trick? $\endgroup$ Jun 21, 2015 at 0:52
  • 4
    $\begingroup$ @Guesswho I've spent a lot of time using the BDF solver from the Sundials suite, which may be used by Mathematica as well (at least it is in the case of DAEs). There the adaptive step size is directly controlled by the precision and accuracy tolerances -- you can make the steps as large as you want by increasing the tolerances. $\endgroup$ Jun 21, 2015 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.