diff --git a/configure.ac b/configure.ac index 6546f744ff4667e0230835105eb985f968b57607..bcd780c1d7e24a55a6ef30c5c10b7d39b0db0205 100644 --- a/configure.ac +++ b/configure.ac @@ -431,6 +431,7 @@ AC_ARG_WITH([grackle], [with_grackle="no"] ) if test "x$with_grackle" != "xno"; then + AC_PROG_FC AC_FC_LIBRARY_LDFLAGS if test "x$with_grackle" != "xyes" -a "x$with_grackle" != "x"; then GRACKLE_LIBS="-L$with_grackle/lib -lgrackle $FCLIBS" diff --git a/src/Makefile.am b/src/Makefile.am index 53fee78fba13ae7b0793f3283b91a0232c61fa60..3f2985702f3d831d9254475b0ce4634604494164 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -116,6 +116,8 @@ nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h cooling/none/cooling.h cooling/none/cooling_struct.h \ cooling/const_du/cooling.h cooling/const_du/cooling_struct.h \ cooling/const_lambda/cooling.h cooling/const_lambda/cooling_struct.h \ + cooling/grackle/cooling.h cooling/grackle/cooling_struct.h \ + cooling/grackle/grackle_wrapper.h \ memswap.h dump.h logger.h diff --git a/src/cooling/grackle/cooling.h b/src/cooling/grackle/cooling.h index 1430b9a18c15f4f8902d9f3f6c21c3bd76f2a74a..47919d75f0dad3142c04504139a590a2d4d635f5 100644 --- a/src/cooling/grackle/cooling.h +++ b/src/cooling/grackle/cooling.h @@ -47,7 +47,7 @@ * between step t0 and t1. */ -static INLINE double DoCooling_GRACKLE(double energy, double density, double dtime, double *ne, double Z, double a_now) +static INLINE double do_cooling_grackle(double energy, double density, double dtime, double *ne, double Z, double a_now) { @@ -57,7 +57,7 @@ static INLINE double DoCooling_GRACKLE(double energy, double density, double dti *********************************************************************/ if (wrap_do_cooling(density, &energy, dtime,Z, a_now) == 0) { - fprintf(stderr, "Error in do_cooling.\n"); + error("Error in do_cooling.\n"); return 0; } @@ -68,10 +68,6 @@ static INLINE double DoCooling_GRACKLE(double energy, double density, double dti } - - - - /** * @brief Apply the cooling function to a particle. * @@ -85,7 +81,7 @@ static INLINE double DoCooling_GRACKLE(double energy, double density, double dti */ __attribute__((always_inline)) INLINE static void cooling_cool_part( const struct phys_const* restrict phys_const, - const struct UnitSystem* restrict us, + const struct unit_system* restrict us, const struct cooling_function_data* restrict cooling, struct part* restrict p, struct xpart* restrict xp, float dt) { @@ -93,7 +89,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( /* Get current internal energy (dt=0) */ - const float u_old = hydro_get_internal_energy(p, 0.f); + const float u_old = hydro_get_internal_energy(p); /* Get current density */ const float rho = hydro_get_density(p); /* Actual scaling fractor */ @@ -108,7 +104,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( float u_new; float delta_u; - u_new = DoCooling_GRACKLE(u_old, rho, dt, &ne, Z, a_now); + u_new = do_cooling_grackle(u_old, rho, dt, &ne, Z, a_now); //u_new = u_old * 0.99; @@ -129,11 +125,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( /* Update the internal energy */ - hydro_set_internal_energy(p, u_new); - - - - + hydro_set_internal_energy_dt(p, delta_u / dt); } @@ -150,7 +142,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( __attribute__((always_inline)) INLINE static float cooling_timestep( const struct cooling_function_data* restrict cooling, const struct phys_const* restrict phys_const, - const struct UnitSystem* restrict us, const struct part* restrict p) { + const struct unit_system* restrict us, const struct part* restrict p) { return FLT_MAX; } @@ -188,7 +180,8 @@ __attribute__((always_inline)) INLINE static float cooling_get_radiated_energy( * @param cooling The cooling properties to initialize */ static INLINE void cooling_init_backend( - const struct swift_params* parameter_file, const struct UnitSystem* us, + const struct swift_params* parameter_file, + const struct unit_system* us, const struct phys_const* phys_const, struct cooling_function_data* cooling) { diff --git a/src/hydro/Gadget2/hydro_part.h b/src/hydro/Gadget2/hydro_part.h index 7b91047da9b2e2c640caef1f5789d9ba8f7f1c7d..c7deaf73608356c8a956d9130701baac1e740feb 100644 --- a/src/hydro/Gadget2/hydro_part.h +++ b/src/hydro/Gadget2/hydro_part.h @@ -45,9 +45,6 @@ struct xpart { /* Velocity at the last full step. */ float v_full[3]; - /* Radiated energy */ - float e_radcool; - /* Entropy at the last full step. */ float entropy_full;