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 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?

share|improve this question
    
MaximumStepFraction is not mentioned in Mathematica’s documentation, and a Google search of the two terms together turns up your question as the only mention. Can you include some actual code, so we can see how you use it? –  F'x Mar 28 '12 at 16:35
    
@F'x I apologize. I am getting careless. I meant MaxStepFraction and NOT MaximumStepFraction. I've also included some more thoughts about this option in EDIT 2. –  drN Mar 28 '12 at 16:45

1 Answer 1

up vote 5 down vote accepted

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:

share|improve this answer
    
This makes sense, thank you. –  drN Mar 28 '12 at 17:48

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.