The differential equation should reflect the fact that θ
ranges between 0
and Pi
. Because the spherical coordinate system becomes degenerate at these two pole, Q
should be independent of ϕ
there. Thus, from the differential equation, Q
is time-independent at the poles. Hence, the boundary values of Q
at 0
and Pi
are the initial values there. Based on these considerations, the code becomes
pde = {D[Q[t, ϕ, θ], t] == -Cos[θ]*D[Q[t, ϕ, θ], ϕ] + 1/M*Sin[θ]*D[Q[t, ϕ, θ], θ, ϕ],
Q[t, 0, θ] == Q[t, 2*Pi, θ],
Q[t, ϕ, 0] == (1 + z0) 2^-M, Q[t, ϕ, Pi] == (1 - z0) 2^-M,
Q[0, ϕ, θ] == 2^-M*(1 + Cos[θ]*z0 + Cos[ϕ0 - ϕ]*Sin[θ]*Sqrt[1 - z0^2])^M};
sol1 = NDSolveValue[pde, Q, {t, 0, tmax}, {ϕ, 0, 2*Pi}, {θ, 0, Pi}];
The solution can be displayed in a number of ways. For instance,
Manipulate[Plot3D[sol1[t, ϕ, θ], {ϕ, 0, 2 Pi}, {θ, 0, Pi}, PlotRange -> All,
AxesLabel -> {ϕ, θ, Q}, AxesStyle -> Directive[Bold, Black, FontSize -> 16]],
{t, 0, 10, Appearance -> "Labeled"}, ContinuousAction -> False]
A sample plot, for t = 10
, is
Kuba: couldn't resist :)
First, solved till t=40
.
Manipulate[
SphericalPlot3D[ 1 + sol1[t, ϕ, θ], {θ, 0, Pi}, {ϕ, 0, 2 Pi},
ImageSize -> 500, PlotRange -> 2, BoxRatios -> 1,
ColorFunction -> (Blend["TemperatureMap", #6] &)], {t, 0, 20, .1,
Appearance -> "Labeled"}, ContinuousAction -> False]
Update
As noted by the OP in his addition to the Question, the numerical solution presented above agrees only qualitatively with his analytical solution. The accuracy of the numerical solution can be improved by reducing MaxStepSize
and making the usual transformation, ` x = Cos[θ]. The revised equations
pde1 = {D[Q[t, ϕ, x], t] + D[x Q[t, ϕ, x] + (1 - x^2) D[Q[t, ϕ, x], x]/M, ϕ] == 0,
Q[t, 0, x] == Q[t, 2*Pi, x], Q[t, ϕ, 1] == ((1 + z0)/2)^M ,
Q[0, ϕ, x] == ((1 + x*z0 + Cos[ϕ0 - ϕ]*Sqrt[1 - x^2]*Sqrt[1 - z0^2])/2)^M};
sol1 = NDSolveValue[pde1, Q, {t, 0, tmax}, {ϕ, 0, 2*Pi}, {x, -1, 1},
MaxStepSize -> {.005, .12, .054}]
now yield for t = 10
the plot
which agrees well with the analytical result. In fact, numerical and analytical results agree (at least for M = 50
) up to about t = 15
, above which they drift apart. Thus, at t = 20
the numerical result is
whereas the corresponding analytical result consists of eight identical, uniformly spaced solitons.
The numerical results are most sensitive to MaxStepSize
for x
. Unfortunately, reducing it below 0.054
triggers a numerical instability. I have tried numerous options for Method
without improving the outcome. Of course, there may be other options that I have not tried that may produce superior results. Note, though, that I have found no sample problem in the voluminous NDSolve
documentation that includes a term of the form D[Q[t, ϕ, x], x, ϕ]
, which appears to make this problem distinctive.
θ
, in traditional math notation? BTW I think it'll be better if you mention some background information of your PDE. $\endgroup$