diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml index 03b2b1ac52e083ac4ec7ad852dc9a95d5320b61f..efbd105bdea21c2dfd88d7a6bce7a97099e37f44 100644 --- a/examples/parameter_example.yml +++ b/examples/parameter_example.yml @@ -302,6 +302,9 @@ SchayeSF: MetDep_SFthresh_Slope: -0.64 # (optional) Scaling of the critical density with the metallicity (not used for Schaye2004=0) thresh_MaxPhysDensOn: 0 # (optional) Default is 0. thresh_MaxOverDens_HpCM3: 1e5 # (optional) Density at which the SF law changes + EOS_Jeans_GammaEffective: 1.33333 # (optional) The polytropic index + EOS_Jeans_PressureNorm: 1e3 # (optional) No idea how this works + EOS_JEANS_den0: .1 # (optional) No idea what the value is. # Structure finding options (requires velociraptor) StructureFinding: diff --git a/src/runner.c b/src/runner.c index baa23990912764e14561b37000ee95ab32f66f43..7006cc0aad8928779add0c2478f9d63e90c8b9f3 100644 --- a/src/runner.c +++ b/src/runner.c @@ -496,6 +496,7 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) { // THIS IS A VERY WEAK SEED, WE NEED TO IMPROVE THIS testseed = p->id + timer; if (starformation_potential_to_become_star(starform, p, xp, constants, cosmo) ) { + message("Found particle that can form star!"); starformation_convert_to_gas(starform, p, xp, cosmo, testseed); } // MATTHIEU: Temporary star-formation law diff --git a/src/starformation/schaye08/starformation.h b/src/starformation/schaye08/starformation.h index 38cad651226d7c5b8b78a5fb7162fb1e6351f996..63f5692231ce9a21b5a6a29d180edd963d47528b 100644 --- a/src/starformation/schaye08/starformation.h +++ b/src/starformation/schaye08/starformation.h @@ -96,6 +96,14 @@ struct star_formation { /*! Metallicity dependent critical density from Schaye (2004) */ int schaye04; + /*! Polytropic index */ + double polytropic_index; + + /*! EOS pressure norm */ + double EOS_pressure_norm; + + /*! EOS density norm */ + double EOS_den0; }; /* @@ -136,7 +144,7 @@ INLINE static int starformation_potential_to_become_star( /* Check if it exceeded the maximum density */ if (p->rho > starform->den_crit_max) { /* double tempp = cooling_get_temperature() */ - tempp = 1e4; + tempp = 5e3; /* Check the last criteria, if the temperature is satisfied */ if (tempp < starform->T_crit) { return 1; @@ -151,7 +159,7 @@ INLINE static int starformation_potential_to_become_star( double den_crit_current = starform->den_crit * pow(Z/starform->Z0, starform->n_Z0); if (p->rho > den_crit_current) { /* double tempp = cooling_get_temperature() */ - tempp = 1e4; + tempp = 5e3; /* Check the last criteria, if the temperature is satisfied */ if (tempp < starform->T_crit) { return 1; @@ -184,7 +192,8 @@ INLINE static void starformation_convert_to_gas( ){ /* Get the pressure */ - const double pressure = hydro_get_physical_pressure(p, cosmo); + const double pressure = starform->EOS_pressure_norm + * pow(p->rho/starform->EOS_den0, starform->polytropic_index); /* Calculate the propability of forming a star */ const double prop = starform->SF_normalization * pow(pressure, @@ -195,6 +204,7 @@ INLINE static void starformation_convert_to_gas( /* Calculate if we form a star */ if (prop > randomnumber) { + /* How to implement the convert_part_to_spart */ message("Create a STAR!!"); } } @@ -387,6 +397,15 @@ INLINE static void starformation_init_backend( /* !!!DONT FORGET TO DO THE CORRECT UNIT CONVERSION!!!*/ starform->den_crit_star = starform->den_crit / pow(starform->Z0, starform->n_Z0) * conversion_numb_density; + + /* Load the equation of state for this model */ + starform->polytropic_index = parser_get_param_double( + parameter_file, "SchayeSF:EOS_Jeans_GammaEffective"); + starform->EOS_pressure_norm = parser_get_param_double( + parameter_file, "SchayeSF:EOS_Jeans_PressureNorm"); + starform->EOS_den0 = parser_get_param_double( + parameter_file, "SchayeSF:EOS_JEANS_den0"); + } /* @brief Prints the used parameters of the star formation law