7
pde = {D[Q[t, ϕ, θ], t] == -Cos[θ]*D[Q[t, ϕ, θ], ϕ] + Sin[θ]*D[Q[t, ϕ, θ], θ, ϕ]/2, 
   Q[t, 0, θ] == Q[t, 2*Pi, θ], Q[t, ϕ, 0] == 0,  
   Q[0, ϕ, θ] == ((1 - Cos[ϕ]*Sin[θ])^2 - 1)/4};
sol = NDSolveValue[pde, Q, {t, 0, 5}, {ϕ, 0, 2*Pi}, {θ, 0, Pi}, MaxStepSize -> {.01, .25, .25}]

generates the message

Warning: scaled local spatial error estimate of 7560.422997509231` at t = 5.` in the direction of independent variable \[Phi] is much greater than the prescribed error tolerance. Grid spacing with 27 points may be too large to achieve the desired accuracy or precision. A singularity may have formed or a smaller grid spacing can be specified using the MaxStepSize or MinPoints method options. >>

and exhibits rapid numerically unstable growth. By t = 5, sol is as large as 4.23527*10^8, even though the analytical solution is known to be less than one in absolute value.

The warning message not withstanding, increasing resolution in ϕ or θ increases the instability growth rate. I have tried a number of Methods, including "Adams", "BDF", "ExplicitRungeKutta", "ImplicitRungeKutta", and "Extrapolaton" without substantive improvement.

I would appreciate advice on how to obtain a stable solution.

Note: Although this particular problem is solvable analytically, it is meant as a prototype for more general problems involving D[Q[t, ϕ, θ], θ, ϕ] that are not solvable analytically.

bbgodfrey
  • 61,439
  • 17
  • 89
  • 156

1 Answers1

2

One option is to reduce the PrecisionGoal by a fair bit.

pde = {D[Q[t, ϕ, θ], t] == -Cos[θ]*D[Q[t, ϕ, θ], ϕ] + Sin[θ]*D[Q[t, ϕ, θ], θ, ϕ]/2, 
    Q[t, 0, θ] == Q[t, 2*Pi, θ], Q[t, ϕ, 0] == 0, 
    Q[0, ϕ, θ] == ((1 - Cos[ϕ]*Sin[θ])^2 - 1)/4}; 
sol = NDSolveValue[pde, Q, {t, 0, 5}, {ϕ, 0, 2*Pi}, {θ, 0, Pi}, PrecisionGoal -> 2]
bbgodfrey
  • 61,439
  • 17
  • 89
  • 156
user21
  • 39,710
  • 8
  • 110
  • 167
  • This computation is even more unstable than the one in my question. Is it possible that one of the NDSolveValue parameters was copied incorrectly into the answer? – bbgodfrey Oct 07 '15 at 18:09
  • @bbgodfrey, I am sorry: What I posted is nonsense. It's a bit late here and I'll have a look tomorrow. The only thing I found so far is to reduce the PrecisionGoal->2 not ideal which I put in the answer now. – user21 Oct 07 '15 at 20:41
  • Unfortunately, I was not able to come up with an alternative to reducing the precision goal. – user21 Oct 08 '15 at 15:48
  • The solution still is unstable, although growing more slowly to of order 1000. It appears that the low PrecisionGoal causes NDSolve to use a very course mesh, which reduces the numerical instability growth rate. Thanks for trying, though. – bbgodfrey Oct 08 '15 at 16:01