7
$\begingroup$
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.

$\endgroup$
2
$\begingroup$

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]
|improve this answer|||||
$\endgroup$
  • $\begingroup$ 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? $\endgroup$ – bbgodfrey Oct 7 '15 at 18:09
  • $\begingroup$ @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. $\endgroup$ – user21 Oct 7 '15 at 20:41
  • $\begingroup$ Unfortunately, I was not able to come up with an alternative to reducing the precision goal. $\endgroup$ – user21 Oct 8 '15 at 15:48
  • $\begingroup$ 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. $\endgroup$ – bbgodfrey Oct 8 '15 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.