diff --git a/src/hydro/PressureEnergy/hydro_io.h b/src/hydro/PressureEnergy/hydro_io.h index 78967faec218f0efffbb624c4e8d25af214aad94..203949f203a66e6bc83ebb95f6648dde71678e94 100644 --- a/src/hydro/PressureEnergy/hydro_io.h +++ b/src/hydro/PressureEnergy/hydro_io.h @@ -136,6 +136,15 @@ INLINE static void convert_part_vel(const struct engine* e, ret[2] *= cosmo->a_inv; } +INLINE static void convert_part_potential(const struct engine* e, + const struct part* p, + const struct xpart* xp, float* ret) { + if (p->gpart != NULL) + ret[0] = gravity_get_comoving_potential(p->gpart); + else + ret[0] = 0.f; +} + /** * @brief Specifies which particle fields to write to a dataset * @@ -148,7 +157,7 @@ INLINE static void hydro_write_particles(const struct part* parts, struct io_props* list, int* num_fields) { - *num_fields = 9; + *num_fields = 10; /* List what we want to write */ list[0] = io_make_output_field_convert_part("Coordinates", DOUBLE, 3, @@ -172,6 +181,9 @@ INLINE static void hydro_write_particles(const struct part* parts, list[8] = io_make_output_field_convert_part("Entropy", FLOAT, 1, UNIT_CONV_ENTROPY_PER_UNIT_MASS, parts, xparts, convert_S); + list[9] = io_make_output_field_convert_part("Potential", FLOAT, 1, + UNIT_CONV_POTENTIAL, parts, + xparts, convert_part_potential); } /**