diff --git a/src/engine.c b/src/engine.c index 4a6460d8cd60f08264507d34611cc289f6e3da09..b73ad2e24f91426b87c0933f7987de9ff88991c9 100644 --- a/src/engine.c +++ b/src/engine.c @@ -2658,8 +2658,15 @@ void engine_init_particles(struct engine *e, int flag_entropy_ICs) { TIMER_TOC(timer_runners); /* Apply some conversions (e.g. internal energy -> entropy) */ - if (!flag_entropy_ICs) space_map_cells_pre(s, 0, cell_convert_hydro, NULL); - if (1) engine_launch(e, e->nr_threads, mask, submask); + if (!flag_entropy_ICs) { + + /* Apply the conversion */ + space_map_cells_pre(s, 0, cell_convert_hydro, NULL); + + /* Correct what we did (e.g. in PE-SPH, need to recompute rho_bar) */ + if (hydro_need_extra_init_loop) + engine_launch(e, e->nr_threads, mask, submask); + } clocks_gettime(&time2); diff --git a/src/part.h b/src/part.h index ca5eacc7e2c8c0df08a91047f617b5c61a2f0a1e..6832e0c6c2e0f2c324d90629447cf6a5e809d6fb 100644 --- a/src/part.h +++ b/src/part.h @@ -42,14 +42,19 @@ /* Import the right hydro particle definition */ #if defined(MINIMAL_SPH) #include "./hydro/Minimal/hydro_part.h" +#define hydro_need_extra_init_loop 0 #elif defined(GADGET2_SPH) #include "./hydro/Gadget2/hydro_part.h" +#define hydro_need_extra_init_loop 0 #elif defined(HOPKINS_PE_SPH) #include "./hydro/PressureEntropy/hydro_part.h" +#define hydro_need_extra_init_loop 1 #elif defined(DEFAULT_SPH) #include "./hydro/Default/hydro_part.h" +#define hydro_need_extra_init_loop 0 #elif defined(GIZMO_SPH) #include "./hydro/Gizmo/hydro_part.h" +#define hydro_need_extra_init_loop 0 #define EXTRA_HYDRO_LOOP #else #error "Invalid choice of SPH variant"