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.

This is a very simple one-dimensional heat-conduct equation, the only special part of it is the piecewise initial condition:

    b = NDSolve[{D[tes[t, x], t] == D[tes[t, x], x, x] + Exp[-1/(tes[t, x])], 
                 tes[t, 0] == 1, tes[t, 1] == 1, 
                 tes[0, x] == Piecewise[{{-100 (x - 0.1)^2 + 2, 0 <= x <= 0.1}, 
                                        {2, 0.1 <= x <= 0.9}, 
                                        {-100 (x - 0.9)^2 + 2, 0.9 <= x <= 1}}]}, 
                {tes[t, x]}, {t, 0, 100}, {x, 0, 1}]

If you run the code, you will get this warning message:

NDSolve::mxsst: Using maximum number of grid points 10000 allowed by the MaxPoints or MinStepSize options for independent variable x

Why does this message come out? I read the help but I don't think my initial condition has that kind of fault: it's piecewise but smooth, right?


I'd like to add another sample here since its behavior makes a interesting contrast to the sample above:

c = NDSolve[{D[tes[t, x], t] == D[tes[t, x], x, x] + Exp[-1/(tes[t, x])],
             tes[t, 0] == 1, tes[t, 1] == 1, 
             tes[0, x] == Piecewise[{{-Exp[-1000 x] + 2, 0 <= x <= 0.1},
                                     {2, 0.1 <= x <= 0.9}, 
                                     {-Exp[-1000 (1 - x)] + 2, 0.9 <= x <= 1}}]},
            {tes[t, x]}, {t, 0, 100}, {x, 0, 1}]

This example choose Exp as the transition between initial condition and boundary conditions, in fact this initial condition is not even continous at x=0.1 and x=0.9 in the view of math, and I think the change of Exp is more drastic than the polynomial function, but it gets no warning message. Well, I should say, after all this time (notice the time I posted this question) I've already treat this as some kind of bug, but I still expect an in-depth explain for it.

share|improve this question
add comment

1 Answer 1

I still get a warning but I think it's less worrying if I use an alternative form of your initial condition :

b=NDSolve[{D[tes[t,x],t]==D[tes[t,x],x,x]+Exp[-1/(tes[t,x])],
   tes[t,0]==1,tes[t,1]==1,
   tes[0,x]==1+UnitStep[x-0] UnitStep[1-x]},{tes[t,x]},
   {t,0,100},{x,0,1}]

solution

share|improve this answer
    
Haha, yeah, in fact this is the original problem I'm trying to solve, but at last I found that mathematica seems to have a high require for…er…consistency (it seems that the concept "one-sided limit" " One-Sided Derivative" etc. are not available in NDSolve), and this is just the reason why I turned to the problem now you see. –  xzczd Jul 30 '12 at 14:44
add comment

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.