diff --git a/src/Makefile.am b/src/Makefile.am index 020fcb1722e5eea66cc50d91e8cbd9c705856883..f405e613293ca40214006f3268bd011e60f5cef0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -63,7 +63,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 ce9153e8c856330b2d60c97a01b36f5c7af670a4..d032349a0f287e9dfb87d9b73b3db2e0f2d8c93d 100644 --- a/src/engine.c +++ b/src/engine.c @@ -4054,6 +4054,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 */ @@ -4116,6 +4117,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; @@ -5227,6 +5229,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) @@ -5318,6 +5321,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 bd6919411d7f2560fd211ddd25536b33835d072b..686dbc0f16ee7294bf83cabb6e7f6476532d106b 100644 --- a/src/runner.c +++ b/src/runner.c @@ -491,7 +491,7 @@ 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); 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 eb569083b9502c2906ab8419e97ad4b5ab9f4b00..eac1c0710f895602d6fffb55c86e53862fce8650 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) { @@ -316,7 +316,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)"