diff --git a/src/Makefile.am b/src/Makefile.am index 831dc2d15ba0731cc24b7b893feb62329dbbb822..3f3afae3a26c92aee38315e6d3185c7bddaa109c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -64,7 +64,7 @@ AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c engine_maketasks.c proxy.c parallel_io.c units.c common_io.c single_io.c multipole.c version.c map.c \ kernel_hydro.c tools.c part.c partition.c clocks.c parser.c \ physical_constants.c potential.c hydro_properties.c \ - threadpool.c cooling.c sourceterms.c starformation.c \ + threadpool.c cooling.c starformation.c \ statistics.c runner_doiact_vec.c profiler.c dump.c logger.c \ part_type.c xmf.c gravity_properties.c gravity.c \ collectgroup.c hydro_space.c equation_of_state.c \ diff --git a/src/engine.c b/src/engine.c index 9ae8c8273d690b312b53e76dcacd88f20cb8e9b2..48bae63a3c81e7f094b17a5b54ba0927ec055ccb 100644 --- a/src/engine.c +++ b/src/engine.c @@ -4051,6 +4051,7 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params, struct pm_mesh *mesh, const struct external_potential *potential, struct cooling_function_data *cooling_func, + const struct star_formation *starform, const struct chemistry_global_data *chemistry) { /* Clean-up everything */ @@ -4113,6 +4114,7 @@ void engine_init(struct engine *e, struct space *s, struct swift_params *params, e->mesh = mesh; e->external_potential = potential; e->cooling_func = cooling_func; + e->star_formation = starform; e->chemistry = chemistry; e->parameter_file = params; e->cell_loc = NULL; @@ -5208,6 +5210,7 @@ void engine_struct_dump(struct engine *e, FILE *stream) { pm_mesh_struct_dump(e->mesh, stream); potential_struct_dump(e->external_potential, stream); cooling_struct_dump(e->cooling_func, stream); + starformation_struct_dump(e->star_formation, stream); chemistry_struct_dump(e->chemistry, stream); parser_struct_dump(e->parameter_file, stream); if (e->output_list_snapshots) @@ -5299,6 +5302,11 @@ void engine_struct_restore(struct engine *e, FILE *stream) { cooling_struct_restore(cooling_func, stream, e->cosmology); e->cooling_func = cooling_func; + struct star_formation *star_formation = (struct star_formation *)malloc(sizeof( + struct star_formation)); + starformation_struct_restore(star_formation, stream); + e->star_formation = star_formation; + struct chemistry_global_data *chemistry = (struct chemistry_global_data *)malloc( sizeof(struct chemistry_global_data)); diff --git a/src/runner.c b/src/runner.c index 10d80163e04400d716cc1301e09c8302c99056e8..e2c394714ae0575bdccfa6842568a93bfa488fca 100644 --- a/src/runner.c +++ b/src/runner.c @@ -491,24 +491,24 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) { if (part_is_active(p, e)) { - const float rho = hydro_get_physical_density(p, cosmo); + //const float rho = hydro_get_physical_density(p, cosmo); if (starformation_potential_to_become_star(starform, p, xp, constants, cosmo) ) { starformation_convert_to_gas(starform, p, xp, cosmo); } // MATTHIEU: Temporary star-formation law // Do not use this at home. - if (rho > 1.7e7 && e->step > 2) { + /*if (rho > 1.7e7 && e->step > 2) { message("Removing particle id=%lld rho=%e", p->id, rho); struct spart *sp = cell_convert_part_to_spart(e, c, p, xp); - /* Did we run out of fresh particles? */ + // Did we run out of fresh particles? if (sp == NULL) continue; - /* Set everything to a valid state */ + // Set everything to a valid state stars_init_spart(sp); - } + }*/ } } } diff --git a/src/starformation/none/starformation.h b/src/starformation/none/starformation.h index 953b1f038a9b1c36f9da328fd643df0f2ab3fd9d..e1a949fdc10537cb359591be20d333024250dd4a 100644 --- a/src/starformation/none/starformation.h +++ b/src/starformation/none/starformation.h @@ -46,7 +46,7 @@ struct star_formation {}; * @param cosmo the cosmological parameters and properties * * */ -static int starformation_potential_to_become_star( +int starformation_potential_to_become_star( const struct star_formation* starform, const struct parts* p, const struct xparts* xp, const struct phys_const* const phys_const, const struct cosmology* cosmo){ @@ -63,7 +63,7 @@ static int starformation_potential_to_become_star( * @param cosmo the cosmological properties * * */ -static void starformation_convert_to_gas( +void starformation_convert_to_gas( const struct star_formation* starform, const struct parts* p, const struct xparts* xp, const struct cosmology* cosmo) {} @@ -76,7 +76,7 @@ static void starformation_convert_to_gas( * @param starform the star formation law properties to initialize * * */ -static void starformation_init_backend( +void starformation_init_backend( struct swift_params* parameter_file, const struct phys_const* phys_const, const struct unit_system* us, const struct star_formation* starform) {} @@ -84,7 +84,7 @@ static void starformation_init_backend( * * @param starform the star formation law properties. * */ -static void starformation_print_backend( +void starformation_print_backend( const struct star_formation* starform){ message("Star formation law is 'No Star Formation'"); diff --git a/src/starformation/schaye08/starformation.h b/src/starformation/schaye08/starformation.h index aeb25d0e517adc9a54449145c24d0e5eb3cf558b..0034184a1f321c7ccb423c6b6596e069fca08460 100644 --- a/src/starformation/schaye08/starformation.h +++ b/src/starformation/schaye08/starformation.h @@ -86,7 +86,7 @@ struct star_formation { * @param cosmo the cosmological parameters and properties * * */ -static int starformation_potential_to_become_star( +int starformation_potential_to_become_star( const struct star_formation* starform, const struct parts* p, const struct xparts* xp, const struct phys_const* const phys_const, const struct cosmology* cosmo){ @@ -143,7 +143,7 @@ static int starformation_potential_to_become_star( * @param cosmo the cosmological properties * * */ -static void starformation_convert_to_gas( +void starformation_convert_to_gas( const struct star_formation* starform, const struct parts* p, const struct xparts* xp, const struct cosmology* cosmo ){ @@ -174,7 +174,7 @@ static void starformation_convert_to_gas( * @param starform the star formation law properties to initialize * * */ -static void starformation_init_backend( +void starformation_init_backend( struct swift_params* parameter_file, const struct phys_const* phys_const, const struct unit_system* us, const struct star_formation* starform) { @@ -286,7 +286,7 @@ static void starformation_init_backend( * * @param starform the star formation law properties. * */ -static void starformation_print_backend( +void starformation_print_backend( const struct star_formation* starform){ message("Star formation law is Schaye and Dalla Vecchia (2008)"