Rosenbrock method ODE : Abrupt increase during First iteration

2 replies · 4K views · last reply
gurbir_s
Messages
11
Reaction score
4
TL;DR
I am using Rosenbrock4 method from Odeint library in C++ to solve a set of differential equations. However, I see that it gives an unusual change in the result for first iteration but afterwards, gives good results. How can I solve it?
The set of equations is
System of six coupled differential equations, numbered (31) to (36), for the variables X_n, X_p, X_d, X_3, X_l and X_4, each equation with a time derivative on the left side.

I have first tried to solve only first two equations (removing the components of other 4 equations from them.)

This is the output, where first column is the time, 2nd - X_p, and 3rd - X_n

Plain text table of numerical ODE solver output with three columns: time in scientific notation (about 1.09e+12 down to 9.733e+11), then two decimal values in the second and third columns that sum to 1 at each row.
 
berkeman said:
How are you setting your initial conditions for this solution?
The ##X_i##'s are elemental abundances during Big Bang Nucleosynthesis. I set the initial conditions equal to their thermal equilibrium values at that point.

I don't know how, but the problem got solved automatically while I was trying to solve another problem. Idk how. Thanks for your reply.