diff --git a/src/const.h b/src/const.h index 6c5edd440a067e809831ead6f7f280a3c03569b3..b1d8500bcaaae97c970719af01cf685b42e57ac9 100644 --- a/src/const.h +++ b/src/const.h @@ -21,9 +21,10 @@ #define SWIFT_CONST_H /* SPH Viscosity constants. */ -/* Cosmology defaults: a=0.8, b=1.5a. Planetary defaults: a=1.5, b=2.0a */ +/* Cosmology defaults: a=0.8, b=1.5. Planetary defaults: a=1.5, b=2.0 + * Note: beta is multiplied by alpha, as in e.g. Springel (2010) Eqn (33) */ #define const_viscosity_alpha 0.8f -#define const_viscosity_beta_over_alpha 1.5f +#define const_viscosity_beta 1.5f #define const_viscosity_alpha_min \ 0.1f /* Values taken from (Price,2004), not used in legacy gadget mode */ diff --git a/src/hydro/Default/hydro_iact.h b/src/hydro/Default/hydro_iact.h index e3548872fd0853ae02a818d99084247ed0835932..c903f5e692fd9876b99782f20582b7bc6ff1f637 100644 --- a/src/hydro/Default/hydro_iact.h +++ b/src/hydro/Default/hydro_iact.h @@ -227,7 +227,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_force( /* Compute signal velocity */ v_sig = pi->force.soundspeed + pj->force.soundspeed - - 2.f * const_viscosity_beta_over_alpha * omega_ij; + 2.f * const_viscosity_beta * omega_ij; /* Compute viscosity parameter */ alpha_ij = -0.5f * (pi->alpha + pj->alpha); @@ -337,7 +337,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( /* Compute signal velocity */ v_sig = pi->force.soundspeed + pj->force.soundspeed - - 2.f * const_viscosity_beta_over_alpha * omega_ij; + 2.f * const_viscosity_beta * omega_ij; /* Compute viscosity parameter */ alpha_ij = -0.5f * (pi->alpha + pj->alpha); diff --git a/src/hydro/Gadget2/hydro_iact.h b/src/hydro/Gadget2/hydro_iact.h index 87727e6c052e325f31f3568e775177951074f98a..e46ada9b75b89e91296b6fad43ba2093024c6164 100644 --- a/src/hydro/Gadget2/hydro_iact.h +++ b/src/hydro/Gadget2/hydro_iact.h @@ -493,7 +493,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_force( const float mu_ij = fac_mu * r_inv * omega_ij; /* This is 0 or negative */ /* Signal velocity */ - const float v_sig = ci + cj - 2.f * const_viscosity_beta_over_alpha * mu_ij; + const float v_sig = ci + cj - 2.f * const_viscosity_beta * mu_ij; /* Now construct the full viscosity term */ const float rho_ij = 0.5f * (rhoi + rhoj); @@ -616,7 +616,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( const float mu_ij = fac_mu * r_inv * omega_ij; /* This is 0 or negative */ /* Signal velocity */ - const float v_sig = ci + cj - 2.f * const_viscosity_beta_over_alpha * mu_ij; + const float v_sig = ci + cj - 2.f * const_viscosity_beta * mu_ij; /* Now construct the full viscosity term */ const float rho_ij = 0.5f * (rhoi + rhoj); @@ -741,7 +741,7 @@ runner_iact_nonsym_1_vec_force( vec_mul(ri.v, omega_ij.v)); /* This is 0 or negative */ /* Compute signal velocity */ - v_sig.v = vec_fnma(vec_set1(2.f * const_viscosity_beta_over_alpha), + v_sig.v = vec_fnma(vec_set1(2.f * const_viscosity_beta), mu_ij.v, vec_add(ci.v, cj.v)); /* Now construct the full viscosity term */ @@ -928,9 +928,9 @@ runner_iact_nonsym_2_vec_force( v_fac_mu.v, vec_mul(ri_2.v, omega_ij_2.v)); /* This is 0 or negative */ /* Compute signal velocity */ - v_sig.v = vec_fnma(vec_set1(2.f * const_viscosity_beta_over_alpha), + v_sig.v = vec_fnma(vec_set1(2.f * const_viscosity_beta), mu_ij.v, vec_add(ci.v, cj.v)); - v_sig_2.v = vec_fnma(vec_set1(2.f * const_viscosity_beta_over_alpha), + v_sig_2.v = vec_fnma(vec_set1(2.f * const_viscosity_beta), mu_ij_2.v, vec_add(ci.v, cj_2.v)); /* Now construct the full viscosity term */ diff --git a/src/hydro/GizmoMFM/hydro_iact.h b/src/hydro/GizmoMFM/hydro_iact.h index 2fc80ccb56fd86c5ac4445d9fb9dc94b6e6a6ca6..6c8d001441e7450a758cc704296b397f55c783ac 100644 --- a/src/hydro/GizmoMFM/hydro_iact.h +++ b/src/hydro/GizmoMFM/hydro_iact.h @@ -267,7 +267,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common( const float dvdotdx = min(dvdr, 0.0f); /* Get the signal velocity */ - vmax -= 2.f * const_viscosity_beta_over_alpha * dvdotdx * r_inv; + vmax -= 2.f * const_viscosity_beta * dvdotdx * r_inv; /* Store the signal velocity */ pi->timestepvars.vmax = max(pi->timestepvars.vmax, vmax); diff --git a/src/hydro/GizmoMFV/hydro_iact.h b/src/hydro/GizmoMFV/hydro_iact.h index cf5be8d4ec2cf7f6efa741710abf441d0b1adcf7..69b27abbbd5272f6e9552774e3592b2179549585 100644 --- a/src/hydro/GizmoMFV/hydro_iact.h +++ b/src/hydro/GizmoMFV/hydro_iact.h @@ -271,7 +271,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common( dvdotdx = min(dvdotdx, 0.f); /* Get the signal velocity */ - vmax -= 2.f * const_viscosity_beta_over_alpha * dvdotdx * r_inv; + vmax -= 2.f * const_viscosity_beta * dvdotdx * r_inv; /* Store the signal velocity */ pi->timestepvars.vmax = max(pi->timestepvars.vmax, vmax); diff --git a/src/hydro/Minimal/hydro_iact.h b/src/hydro/Minimal/hydro_iact.h index 549e69fbd0f94aeb298d8581a387a80547403b5b..f0aba6f97ab0ad569f25e19297b9b28f4fc89c99 100644 --- a/src/hydro/Minimal/hydro_iact.h +++ b/src/hydro/Minimal/hydro_iact.h @@ -184,7 +184,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_force( /* Compute sound speeds and signal velocity */ const float ci = pi->force.soundspeed; const float cj = pj->force.soundspeed; - const float v_sig = ci + cj - 2.f * const_viscosity_beta_over_alpha * mu_ij; + const float v_sig = ci + cj - 2.f * const_viscosity_beta * mu_ij; /* Construct the full viscosity term */ const float rho_ij = 0.5f * (rhoi + rhoj); @@ -300,7 +300,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( /* Compute sound speeds and signal velocity */ const float ci = pi->force.soundspeed; const float cj = pj->force.soundspeed; - const float v_sig = ci + cj - 2.f * const_viscosity_beta_over_alpha * mu_ij; + const float v_sig = ci + cj - 2.f * const_viscosity_beta * mu_ij; /* Construct the full viscosity term */ const float rho_ij = 0.5f * (rhoi + rhoj); diff --git a/src/hydro/Planetary/hydro_iact.h b/src/hydro/Planetary/hydro_iact.h index ec55069128afbc2404c50119f44f14ec303a2bb3..e0312b3190cedccbb9a8272351f94f4fbab819ad 100644 --- a/src/hydro/Planetary/hydro_iact.h +++ b/src/hydro/Planetary/hydro_iact.h @@ -189,7 +189,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_force( /* Compute sound speeds and signal velocity */ const float ci = pi->force.soundspeed; const float cj = pj->force.soundspeed; - const float v_sig = ci + cj - 2.f * const_viscosity_beta_over_alpha * mu_ij; + const float v_sig = ci + cj - 2.f * const_viscosity_beta * mu_ij; /* Now construct the full viscosity term */ const float rho_ij = 0.5f * (rhoi + rhoj); @@ -315,7 +315,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( const float cj = pj->force.soundspeed; /* Signal velocity */ - const float v_sig = ci + cj - 2.f * const_viscosity_beta_over_alpha * mu_ij; + const float v_sig = ci + cj - 2.f * const_viscosity_beta * mu_ij; /* Construct the full viscosity term */ const float rho_ij = 0.5f * (rhoi + rhoj); diff --git a/src/hydro/PressureEnergy/hydro_iact.h b/src/hydro/PressureEnergy/hydro_iact.h index 8cdeb699a273153aae12ed0a97ab2758dfd2eff5..4aba8a262732b55e10f10f11d93044864df9b305 100644 --- a/src/hydro/PressureEnergy/hydro_iact.h +++ b/src/hydro/PressureEnergy/hydro_iact.h @@ -244,7 +244,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_force( /* Compute sound speeds and signal velocity */ const float ci = pi->force.soundspeed; const float cj = pj->force.soundspeed; - const float v_sig = ci + cj - 2.f * const_viscosity_beta_over_alpha * mu_ij; + const float v_sig = ci + cj - 2.f * const_viscosity_beta * mu_ij; /* Balsara term */ const float balsara_i = pi->force.balsara; @@ -372,7 +372,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( /* Compute sound speeds and signal velocity */ const float ci = pi->force.soundspeed; const float cj = pj->force.soundspeed; - const float v_sig = ci + cj - 2.f * const_viscosity_beta_over_alpha * mu_ij; + const float v_sig = ci + cj - 2.f * const_viscosity_beta * mu_ij; /* Balsara term */ const float balsara_i = pi->force.balsara; diff --git a/src/hydro/PressureEntropy/hydro_iact.h b/src/hydro/PressureEntropy/hydro_iact.h index 839c20177aa34fdef275b0df13584be5cf64cbd3..64b42093c39b58fb48b182cc5aee64f67bbb4a98 100644 --- a/src/hydro/PressureEntropy/hydro_iact.h +++ b/src/hydro/PressureEntropy/hydro_iact.h @@ -259,7 +259,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_force( const float mu_ij = fac_mu * r_inv * omega_ij; /* This is 0 or negative */ /* Signal velocity */ - const float v_sig = ci + cj - 2.f * const_viscosity_beta_over_alpha * mu_ij; + const float v_sig = ci + cj - 2.f * const_viscosity_beta * mu_ij; /* Now construct the full viscosity term */ const float rho_ij = 0.5f * (rhoi + rhoj); @@ -373,7 +373,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( const float mu_ij = fac_mu * r_inv * omega_ij; /* This is 0 or negative */ /* Signal velocity */ - const float v_sig = ci + cj - 2.f * const_viscosity_beta_over_alpha * mu_ij; + const float v_sig = ci + cj - 2.f * const_viscosity_beta * mu_ij; /* Now construct the full viscosity term */ const float rho_ij = 0.5f * (rhoi + rhoj);