Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
1  
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... –  Albert Retey Mar 30 '12 at 9:02
    
@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? –  drN Mar 30 '12 at 19:30
1  
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... –  Albert Retey Mar 31 '12 at 23:17
    
@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! –  drN Apr 1 '12 at 3:17
    
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. –  Albert Retey Apr 2 '12 at 10:04

1 Answer 1

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

share|improve this answer
    
Very neat! Would you mind telling how you figured out that lowering those settings did the trick? –  Guess who it is. Jun 21 at 0:52
2  
@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. –  Simon Rochester Jun 21 at 1:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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