Skip to content
Snippets Groups Projects
Commit 5b56fc26 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Correct expression for potential of isothermal case.

parent 29a3692c
No related branches found
No related tags found
No related merge requests found
...@@ -132,7 +132,7 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration( ...@@ -132,7 +132,7 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
* @brief Computes the gravitational potential energy of a particle in an * @brief Computes the gravitational potential energy of a particle in an
* isothermal potential. * isothermal potential.
* *
* phi = 0.5 * vrot^2 * ln(r^2 + epsilon^2) * phi = -0.5 * vrot^2 * ln(r^2 + epsilon^2)
* *
* @param time The current time (unused here). * @param time The current time (unused here).
* @param potential The #external_potential used in the run. * @param potential The #external_potential used in the run.
...@@ -148,8 +148,8 @@ external_gravity_get_potential_energy( ...@@ -148,8 +148,8 @@ external_gravity_get_potential_energy(
const float dy = g->x[1] - potential->y; const float dy = g->x[1] - potential->y;
const float dz = g->x[2] - potential->z; const float dz = g->x[2] - potential->z;
return 0.5f * potential->vrot * potential->vrot * return -0.5f * potential->vrot * potential->vrot *
logf(dx * dx + dy * dy * dz * dz + potential->epsilon2); logf(dx * dx + dy * dy + dz * dz + potential->epsilon2);
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment