2
$\begingroup$

I have been trying to solve this system of differential equations:

eq1 = D[ϕ[X], {X, 2}] - 2./3*D[ϕ[X], X]^2 + 1. - 
   8.*Pi*Exp[2.*ϕ[X]]*(D[ν[X], {X, 2}]/(12.*Pi) + (D[ν[X], X])^2/(24.*Pi));
eq2 = -D[ν[X], X]*D[ϕ[X], X] + 4./3*D[ϕ[X], X]^2 - 1. - 
   8.*Pi*Exp[2.*ϕ[X]]*(-D[ν[X], X]^2/(24.*Pi));

sol = NDSolve[{
   eq1 == 0, eq2 == 0,
   ϕ[1.] == -0.6506712457245407, ν[1.] == -0.7061222993948587,
   ϕ'[1.] == -1.1423912339336473}, 
   {ϕ, ν}, {X, 0.01, 1}, 
   MaxSteps -> Infinity, 
   Method -> {"EquationSimplification" -> "Residual"}, 
   Method -> "StiffnessSwitching"
]

and I can't figure out how to fix the error

NDSolve::ndcf: Repeated convergence test failure at X == 0.707883; unable to continue.

I would greatly appreciate if you could help me resolve this problem.

$\endgroup$
0

1 Answer 1

5
$\begingroup$

Let's help NDSolve a bit by differentiating eq2 and writing down the initial condition for D[ν[X], X] explicitly:

eq1 = D[ϕ[X], {X, 2}] - 1/3  2.  D[ϕ[X], X]^2 + 1. - 
      8. π Exp[2. ϕ[X]] (D[ν[X], {X, 2}]/(12. π) + D[ν[X], X]^2/(24. π));

eq2 = -D[ν[X], X] D[ϕ[X], X] + 1/3 4. D[ϕ[X], X]^2 - 1. - 
     (8. π Exp[2. ϕ[X]] (-D[ν[X], X]^2))/(24. π);

ic = {ϕ[1.] == -0.6506712457245407, 
      ν[1.] == -0.7061222993948587, ϕ'[1.] == -1.1423912339336473};

newic = Equal @@@ Flatten[Solve[eq2 == 0, D[ν[X], X]]] /. X -> 1. /. Rule @@@ ic
(* {ν'[1.] == -11.9071, ν'[1.] == -0.685106} *)

sollst = (NDSolveValue[{eq1 == 0, D[eq2, X] == 0, 
                        ic, #1}, {ϕ, ν}, {X, 0.01, 1}] &) /@ newic

sollst // Map@ListLinePlot

enter image description here

$\endgroup$
5
  • 1
    $\begingroup$ (+1) It is not clear why NDSolve can't solve this system directly as it is. Without any options NDSolve computes one branch of solution only up to X == 0.434532. $\endgroup$ Dec 20, 2023 at 7:50
  • 1
    $\begingroup$ @AlexTrounev I think it's because the pre-processor of NDSolve isn't clever enough to transform the system to a standard ODE system (the pre-processor of NDSolve never tries to differentiate the equation), and NDSolve's DAE solver is generally weaker than its ODE solver. $\endgroup$
    – xzczd
    Dec 20, 2023 at 8:10
  • $\begingroup$ @AlexTrounev It is straightforward to eliminate ν[X], converting this DAE system to a single ODE, but even then I encounter the error you did at X == 0.434532 for the second soluton under some circumstances, for instance by increasing WorkingPrecision. Part of the problem is that 1/(-9 + 16 E^(2 ϕ[X]) occurs in the transformed ODE, and that quantity becomes large at x = 0.668118. But, I believe that something else also causes the second solution to be very sensitive. $\endgroup$
    – bbgodfrey
    Dec 20, 2023 at 16:06
  • $\begingroup$ @bbgodfrey Sorry, but I didn't do anything. :) I took options from NDSolve and it computed solution up to X == 0.434532, while with options it stops at X == 0.707883. It is not clear why NDSolve can't compute second branch of solution automatically. $\endgroup$ Dec 21, 2023 at 1:29
  • $\begingroup$ Thanks a lot! This solved my problem. $\endgroup$ Dec 23, 2023 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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