From 57a6d48f72c657f5c6dbda8b29994285ae2ec12c Mon Sep 17 00:00:00 2001 From: Folkert Nobels <nobels@strw.leidenuniv.nl> Date: Thu, 20 Dec 2018 14:26:49 +0100 Subject: [PATCH] Convert mass density to number density in the effective equation of state --- src/runner.c | 3 +-- src/starformation/schaye08/starformation.h | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/runner.c b/src/runner.c index 099817e010..35a0982670 100644 --- a/src/runner.c +++ b/src/runner.c @@ -498,7 +498,7 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) { if (part_is_active(p, e)) { - /* Calculate the time step of the current particle*/ + /* Calculate the time step of the current particle for cosmo and no cosmo*/ double dt_star; if (with_cosmology) { const integertime_t ti_step = get_integer_timestep(p->time_bin); @@ -521,7 +521,6 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) { /* Copy the properties of the gas particle to the star particle */ star_formation_copy_properties(e, p, xp, sp, starform, constants, cosmo, with_cosmology); - // struct spart *sp = cell_conert_part_to_spart(c, p, ...); } } } diff --git a/src/starformation/schaye08/starformation.h b/src/starformation/schaye08/starformation.h index 3bc86cc21b..7efd203da0 100644 --- a/src/starformation/schaye08/starformation.h +++ b/src/starformation/schaye08/starformation.h @@ -204,14 +204,13 @@ INLINE static int star_formation_convert_to_star( if (dt_star == 0.f) return 0; - message("dt = %e", dt_star); - if (star_formation_potential_to_become_star( starform, p, xp, phys_const, cosmo, hydro_props, us, cooling)) { /* Get the pressure */ const double pressure = starform->EOS_pressure_norm * - pow(hydro_get_physical_density(p,cosmo) / starform->EOS_density_norm, starform->polytropic_index); + pow(hydro_get_physical_density(p,cosmo)*p->chemistry_data.smoothed_metal_mass_fraction[0] + / starform->EOS_density_norm/ phys_const->const_proton_mass, starform->polytropic_index); /* Calculate the propability of forming a star */ const double prop = starform->SF_normalization * @@ -223,7 +222,7 @@ INLINE static int star_formation_convert_to_star( /* Generate a random number between 0 and 1. */ const double randomnumber = rand_r(&seed) * starform->inv_RAND_MAX; - //message("Passed whole boundary thing! random number = %e, prop = %e time_bin %d dt_star %e", randomnumber, prop, p->time_bin,dt_star); + // message("Passed whole boundary thing! random number = %e, prop = %e dt_star %e", randomnumber, prop,dt_star); /* Calculate if we form a star */ return (prop > randomnumber); -- GitLab