- #1

- 60

- 0

I've a little problem with my algorithm.

I have two grids: one for time and the other one for the radius.

I need to evaluate this equation:

[tex]\frac{d\beta(r,t)}{dt}=A\beta(r,t)^N[/tex]

I try solving this with a simple Runge Kutta II method, but I'm not convinced at all that this works properly.

Let's check my code:

k1 = deltaT*(-A*beta(i,j-1)**N

k2 = deltaT*(-A*(beta(i,j-1)+k1/2.)**N)

beta(i,j) = beta(i,j-1) + k2

What do you think about that?

This is not the simplest case, just the one you can read in Numerical Recipes ...

P.S.:

beta(i,j) mean beta at r_i and t_j

so i and j referes to radius and time grid respectively