diff --git a/src/hydro/PressureEnergyMorrisMonaghanAV/hydro.h b/src/hydro/PressureEnergyMorrisMonaghanAV/hydro.h index e21750bdf24f19b0f784b8652bcb5a18a6a89e8f..3f4578b7bd05ec292d59535474a56c635e4bfb9c 100644 --- a/src/hydro/PressureEnergyMorrisMonaghanAV/hydro.h +++ b/src/hydro/PressureEnergyMorrisMonaghanAV/hydro.h @@ -640,14 +640,14 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force( /* Artificial viscosity updates */ - /* TODO: Actually work out why this cosmology factor is correct - * and update the SPH / cosmology theory documents. */ + /* We perform all of this in physical space. */ + const float h_inv_physical = cosmo->a_inv * h_inv; + const float soundspeed_physical = cosmo->a_factor_sound_speed * soundspeed; - /* We divide by a^2 here to make this transform under cosmology the - * same as the velocity (which in SWIFT has an extra 1/a^2 factor. - * See the cosmology theory documents for more information. */ + /* Decay rate */ const float inverse_tau = - (hydro_props->viscosity.length * cosmo->a2_inv) * soundspeed * h_inv; + hydro_props->viscosity.length * soundspeed_physical * h_inv_physical; + /* Source term (div v) is already in physical co-ordinates for this scheme */ const float source_term = -1.f * min(p->density.div_v, 0.f); /* Compute da/dt */