Schulik/aiolos

Gravity bug

Closed this issue · 3 comments

The enclosed mass calculation is not correct - it does not include contributions from previous cells unless self-gravity is turned on. Also, the mass in a single volume should be computed as density * volume, i.e. density * (r_{i+1}^3 - r_i^3) / 3. Factors of 4 * pi can be ignored entirely in a spherical code. See here:

enclosed_mass[i] = enclosed_mass[i-1] + 4. * 3.141592 * x_i12[i] * x_i12[i] * (x_i[i]-x_i[i-1]) * u[i].u1; //Straightfoward integration of the poisson equation

I fixed that yesterday actually, is that out of date in the spherical branch??

Updating the mass only in the case of self-gravity is intentional - because in all cases phi = grav(r, m(r)); but I guess we can switch that to an if-clause with grav(r,m(0)) and grav(r,m(r))

Ok - looks like I had an out of date version