From 377e9bcbb56a74f975ce52c46bda080e383b4c7a Mon Sep 17 00:00:00 2001
From: Folkert Nobels <nobels@strw.leidenuniv.nl>
Date: Mon, 4 Feb 2019 13:29:47 +0100
Subject: [PATCH] Add temperature constant exp10(Tdex) to be used in the
 criteria

---
 src/star_formation/EAGLE/star_formation.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/star_formation/EAGLE/star_formation.h b/src/star_formation/EAGLE/star_formation.h
index c55b02ae5e..c52d7f9739 100644
--- a/src/star_formation/EAGLE/star_formation.h
+++ b/src/star_formation/EAGLE/star_formation.h
@@ -70,6 +70,9 @@ struct star_formation {
   /*! Dalla Vecchia & Schaye temperature criteria */
   double temperature_margin_threshold_dex;
 
+  /*! 10^Tdex of Dalla Vecchia & SChaye temperature criteria */
+  double ten_to_temperature_margin_threshold_dex;
+  
   /*! gas fraction */
   double fgas;
 
@@ -259,7 +262,7 @@ INLINE static int star_formation_is_star_forming(
 
   /* Check the Scahye & Dalla Vecchia 2012 EOS-based temperature critrion */
   return (temperature <
-          temperature_eos * exp10(starform->temperature_margin_threshold_dex));
+          temperature_eos * starform->ten_to_temperature_margin_threshold_dex);
 }
 
 /**
@@ -554,6 +557,9 @@ INLINE static void starformation_init_backend(
   starform->temperature_margin_threshold_dex = parser_get_opt_param_double(
       parameter_file, "EAGLEStarFormation:KS_temperature_margin_dex", FLT_MAX);
 
+  starform->ten_to_temperature_margin_threshold_dex = exp10(
+      starform->temperature_margin_threshold_dex);
+
   /* Read the normalization of the metallicity dependent critical
    * density*/
   starform->density_threshold_HpCM3 = parser_get_param_double(
-- 
GitLab