Skip to main content

options - What does MaxStepFraction do?


I find that with NDSolve[...] while solving a partial differential equation, changing the MaxStepFraction from 1/10 to say 1/60, improves convergence.


Without going into too many details about the PDE itself, is the MaxStepFraction the grid sized used? I generally find that when I use a large step fraction of say 1/30 instead of 1/60, I get an error message that says:



NDSolve::eerr: Warning: Scaled local spatial error estimate of 1484.278641749214at t = 240279.84981818125 in the direction of independent variable x is much greater than prescribed error tolerance. Grid spacing with 31 points may be too large to achieve the desired accuracy or precision. A singularity may have formed or you may want to specify a smaller grid spacing using the MaxStepSize or MinPoints method options. >>



Am I to understand that for a large step fraction, my equation either get's stiff (as the step size is large/grid is too coarse)?



EDIT 1:


My 4th order non-linear PDE generally looks like:


h_t + N(h[t,x],h[t,x]^2,h[t,x]^3,h[t,x]^4) = 0


Where N(...) is the non-linear portion.


EDIT 2:


I used


Needs["DifferentialEquations`InterpolatingFunctionAnatomy`"];

and


hGrid = InterpolatingFunctionGrid[hSol];  

{nX, nY, nT} =Drop[Dimensions[hGrid], -1]

Where hSol is my interpolating function result that NDSolve provides, and found that nx,ny and nT are respectively: 41,41,298 when I used MaxStepFraction->1/40. So I am guessing, that MaxStepFraction-> does define the spatial grid.


Any thoughts? Comments?



Answer



The documentation is fairly clear on this:



MaxStepFraction is an option to functions like NDSolve that specifies the maximum fraction of the total range to cover in a single step.



In simpler terms, you can think of MaxStepFraction as the inverse of the number of intervals in the total range, whereas MaxStepSize is the length of an interval. The following graphic should make the difference clear:



enter image description here


So in other words, setting MaxStepFraction = 1/10 and setting MaxStepSize = L/10 will give you the same result. The documentation linked above also has an example that demonstrates this:


Comments