From 43c7bfba88bdc9613fc567f7437a92ebfe328045 Mon Sep 17 00:00:00 2001
From: Folkert Nobels <nobels@strw.leidenuniv.nl>
Date: Wed, 19 Dec 2018 13:19:33 +0100
Subject: [PATCH] Resolve misleading rho_crit and update parameter file

---
 examples/parameter_example.yml             | 7 +++----
 src/starformation/schaye08/starformation.h | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml
index 9a602a9658..f63158074c 100644
--- a/examples/parameter_example.yml
+++ b/examples/parameter_example.yml
@@ -294,11 +294,10 @@ SchayeSF:
   SchmidtLawExponent:               1.4     # The power law of the Kennicutt-Schmidt law
   SchmidtLawHighDensExponent:       2.0     # The high density exponent for the Kennicutt-Schmidt law
   SchmidtLawHighDens_thresh_HpCM3:  1e3
-  Schaye2004:                       1       # whether to use the metallicity dependent critical star formation of Schaye (2004) (1) or not (0).
-  thresh_norm_HpCM3:                0.1      # Critical sf normalization to use (is not a normalization when Schaye2004=0, than it is the value.
+  thresh_norm_HpCM3:                0.1      # Critical sf normalization to use 
   thresh_max_norm_HpCM3:            10.0    # Maximum norm of the critical sf density
-  MetDep_Z0:                        0.002   # Scale metallicity to use for the equation (not used for Schaye2004=0)
-  MetDep_SFthresh_Slope:            -0.64   # Scaling of the critical density with the metallicity (not used for Schaye2004=0)
+  MetDep_Z0:                        0.002   # Scale metallicity to use for the equation 
+  MetDep_SFthresh_Slope:            -0.64   # Scaling of the critical density with the metallicity 
   thresh_MaxPhysDensOn:             0       # Default is 0.
   thresh_MaxOverDens_HpCM3:         1e5     # Density at which the SF law changes
   EOS_Jeans_GammaEffective:         1.33333 # The polytropic index
diff --git a/src/starformation/schaye08/starformation.h b/src/starformation/schaye08/starformation.h
index b5ed12c203..86f36458aa 100644
--- a/src/starformation/schaye08/starformation.h
+++ b/src/starformation/schaye08/starformation.h
@@ -144,7 +144,7 @@ INLINE static int star_formation_potential_to_become_star(
 
   /* Read the critical overdensity factor and the critical density of
    * the universe to determine the critical density to form stars*/
-  const double rho_crit = cosmo->critical_density * starform->min_over_den;
+  const double rho_crit_times_min_over_den = cosmo->critical_density * starform->min_over_den;
 
   /* double tempp = cooling_get_temperature() */
   double tempp;
@@ -155,7 +155,7 @@ INLINE static int star_formation_potential_to_become_star(
    * threshold is reached or if the metallicity dependent
    * threshold is reached, after this we calculate if the
    * temperature is appropriate */
-  if (p->rho > rho_crit) {
+  if (p->rho > rho_crit_times_min_over_den) {
     /* In this case there are actually multiple possibilities
      * because we also need to check if the physical density exceeded
      * the appropriate limit */
-- 
GitLab