Commit 418f31a2 authored by Josh Borrow's avatar Josh Borrow
Browse files

More efficient computation of the soundspeed

parent 9c3ace73
...@@ -153,7 +153,9 @@ hydro_get_comoving_soundspeed(const struct part *restrict p) { ...@@ -153,7 +153,9 @@ hydro_get_comoving_soundspeed(const struct part *restrict p) {
/* Compute the sound speed -- see theory section for justification */ /* Compute the sound speed -- see theory section for justification */
/* IDEAL GAS ONLY -- P-U does not work with generic EoS. */ /* IDEAL GAS ONLY -- P-U does not work with generic EoS. */
return sqrtf(p->u * p->u * p->rho / p->pressure_bar); const float square_rooted = sqrtf(p->rho / p->pressure_bar);
return p->u * hydro_gamma_minus_one * square_rooted;
} }
/** /**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment