I'm trying to solve a pair of coupled ODE's. I need to place four Dirichlet boundary conditions (at R = 0
and R = ∞
for each dependent variable), and
my independent variable R
runs over R > 0
. I'm approximating these boundary conditions with a large and a small value of R
to avoid a singularity at R = 0
.
I know the system has a well behaved, smooth solution for X
and P
. (In fact X
is monotonically increasing and P
is monotonically decreasing and both should be virtually constant by about R = 10
.)
When I run NDSolve
however, Mathematica throws
NDSolve::ndsz: At R == 0.034300651057220126`, step size is effectively zero; singularity or stiff system suspected.
I don't believe this system should be stiff, and there shouldn't be any singularities in the range I'm evaluating over.
I have tried modifying the working precision, the number of steps, the method, the starting step size, all to no avail.
Any help would be appreciated.
eqn1 = -X''[R] - X'[R]/R + (P[R]^2 X[R])/R^2 + 1/2 X[R] (X[R]^2 - 1) == 0
eqn2 = -P''[R] + P'[R]/R + (X[R]^2 P[R]) == 0
inf = 100;
zero = 0.0001;
eqns := {eqn1, eqn2};
bcs = { X[inf] == 1,
P[inf] == 0,
X[zero] == 0,
P[zero] == 1}
sol = NDSolve[eqns~Join~bcs, {X, P}, {R, zero, inf}, Method -> Automatic]
p1 = Plot[Evaluate[X[R] /. sol], {R, zero, 10}, PlotRange -> All];
p2 = Plot[Evaluate[P[R] /. sol], {R, zero, 10}, PlotRange -> All];
Show[p1, p2]
r == 0
and the asymptotic solution at larger
. The problem then becomes connecting the two. $\endgroup$ – bbgodfrey May 25 '18 at 22:55