Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following code for a 2d heat c equation:

 soln = NDSolve[{        D[y[r, f, t], r, r] + 
                   (1/r)*D[y[r, f, t], r] +
                 (1/r^2)*D[y[r, f, t], f, f] == 
                                (1/1.27*10^-4)*D[y[r, f, t], t], 
          y[r, f, 0] == 0, 
          y[10^-2, f, t] == 0,
          (D[y[r, f, t], r] /. 
               r -> 2*10^-6) == -(1/(3.14*10^-8))*(1 + Sin[2*2*3.14*t/2]), 
          (D[y[r, f, t], f] /. f -> 0) == -(10/238)*y[r, 0, t], 
          (D[y[r, f, t], f] /. f -> 3.14/2) == 0}, 
                    y, {r, 2*10^-6, 10^-2}, {f, 0, 3.14/2}, {t, 0, 1}]

and I'm getting the two following error messages:

Warning: Boundary and initial conditions are inconsistent

NDSolve::mxst:Maximim number of 10000 steps reached at the point t==1.629*10^-10 NDSolve::eerr:Scaled local spatial error estimate of 4203.0461 at t=1.840*10^-8 in the direction of independent variable r is much greater than prescribed error tolerance. Grid spacing with 51 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

I saw an answer for the first one so i'm pretty ok with that but the second one is giving me trouble limitting the useful time domain.I cannot figure out why I'm getting this. Any help will be greatly appreciated! Claudiu

share|improve this question
It's possible that the techniques outlined in the answer to this question might help. – Mark McClure Mar 3 '14 at 14:13
If you set your time domain very small {t,0,10^-9} you will get "a" solution, which is blowing up at r=.1,f=0. Take a look at that and think why your bcs are driving a singularity at the corner. Describing the physical problem in your question might be useful if you need more help. – george2079 Mar 3 '14 at 15:34
@MarkMcClure notice you mention finite elements in the linked answer - have you seen this: "Method" -> {"PDEDiscretization" -> "FiniteElement"} ? It doesn't work and isn't documented that i can find. – george2079 Mar 3 '14 at 19:22
@george2079 The new reference site is set up to hold lots of new information of finite element methods. Most of these pages don't yet exist, but presumably will in the near future: – Mark McClure Mar 3 '14 at 21:55
Thanks looking forward to seeing those docs. @user12353 my feeling is you have formulated this correctly and NDSolve is simply not up to the task. – george2079 Mar 4 '14 at 16:19

Partial answer: the inconsistent boundary condition is that you are specifying df/dr non zero for all t, which is inconsistent with the zero (hence df/dr=0) initial condition.

Ive modified the third condition as:

    (D[y[r, f, t], r] /. 
           r -> 2*10^-6) == -(1/(Pi 10^-8))
                (1 +  Sin[2 Pi t]) Piecewise[{{t 10, t < 1/10  }, {1, True}}]

"ramping up" that BC from zero eliminates the inconsistency warning. However, the solution is still diverging in the corners:

 Plot3D[(y /. soln[[1]])[r, f, 1*^-8] , {r, 2*^-6, 10*^-2}, {f, 0, 
       3.14/2}, PlotRange -> {-100, 1000}]

enter image description here

share|improve this answer

Your Answer


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.