From cfa8ac1b91b4bee76fcbe7f7bd205dd33942cecf Mon Sep 17 00:00:00 2001
From: Jacob Kegerreis <jacob.kegerreis@durham.ac.uk>
Date: Sun, 7 Oct 2018 13:26:01 +0100
Subject: [PATCH] Rename viscosity beta

---
 src/const.h                            |  5 +++--
 src/hydro/Default/hydro_iact.h         |  4 ++--
 src/hydro/Gadget2/hydro_iact.h         | 10 +++++-----
 src/hydro/GizmoMFM/hydro_iact.h        |  2 +-
 src/hydro/GizmoMFV/hydro_iact.h        |  2 +-
 src/hydro/Minimal/hydro_iact.h         |  4 ++--
 src/hydro/Planetary/hydro_iact.h       |  4 ++--
 src/hydro/PressureEnergy/hydro_iact.h  |  4 ++--
 src/hydro/PressureEntropy/hydro_iact.h |  4 ++--
 9 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/src/const.h b/src/const.h
index 6c5edd440a..b1d8500bca 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 e3548872fd..c903f5e692 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 87727e6c05..e46ada9b75 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 2fc80ccb56..6c8d001441 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 cf5be8d4ec..69b27abbbd 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 549e69fbd0..f0aba6f97a 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 ec55069128..e0312b3190 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 8cdeb699a2..4aba8a2627 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 839c20177a..64b42093c3 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);
-- 
GitLab