Message Boards Message Boards

Singularity or Stiff system suspected in NDSolve integration

Posted 1 year ago

Hello,

I have a system of two differential equations. The system is derived through Hamilton's equations from a specific Hamiltonian. I have been trying to integrate the system for 10^8 years. However, after 10^6 years the integration is failing and I am getting an error saying:

"at t = 2.472503629*10^6, the step size is effectively zero. Singularity or stiff system suspected."

When I integrate up to 10^6 years, the integration goes fine. However, I am trying to graph the full phase space of the system. The entire phase space requires integration up to ~ 10^8 years or more.

I have attached the notebook that I am using to integrate the system.

I would appreciate any help with that.

Thanks!

POSTED BY: Rua Sulaiman

Plotting a solution may give you a hint:

With[{p = 1},
 {xSol, oSol} = 
  NDSolveValue[{x'[t] == p1[x, o, t], o'[t] == n1[x, o, t],
    x[0] == initial[[p]], o[0] == Pi},
   {x, o}, {t, 0, time}]]
{Plot[xSol[t], {t, 0, 2.5*^6}, PlotRange -> {-1, 1}],
 Plot[oSol[t], {t, 0, 2.5*^6}, PlotRange -> {-1, 6}]}
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract