diff --git a/src/clocks.c b/src/clocks.c index cc0179cf055ef62150a3fb72eab3bb0c74c802a2..cac0131acade08e41ee7ed4a22fabde49e197060 100644 --- a/src/clocks.c +++ b/src/clocks.c @@ -113,7 +113,7 @@ void clocks_set_cpufreq(unsigned long long freq) { * * @result the CPU frequency. */ -unsigned long long clocks_get_cpufreq() { +unsigned long long clocks_get_cpufreq(void) { if (clocks_cpufreq > 0) return clocks_cpufreq; @@ -132,7 +132,7 @@ unsigned long long clocks_get_cpufreq() { * file (probably a overestimate) or finally just use a value of 1 with * time units of ticks. */ -static void clocks_estimate_cpufreq() { +static void clocks_estimate_cpufreq(void) { #ifdef HAVE_CLOCK_GETTIME /* Try to time a nanosleep() in ticks. */ @@ -241,7 +241,7 @@ ticks clocks_to_ticks(double ms) { * * @result the current time units. */ -const char *clocks_getunit() { return clocks_units[clocks_units_index]; } +const char *clocks_getunit(void) { return clocks_units[clocks_units_index]; } /** * @brief returns the time since the start of the execution in seconds @@ -252,7 +252,7 @@ const char *clocks_getunit() { return clocks_units[clocks_units_index]; } * * @result the time since the start of the execution */ -const char *clocks_get_timesincestart() { +const char *clocks_get_timesincestart(void) { static char buffer[40]; @@ -274,7 +274,7 @@ const char *clocks_get_timesincestart() { * @result cpu time used in sysconf(_SC_CLK_TCK) ticks, usually 100/s not our * usual ticks. */ -double clocks_get_cputime_used() { +double clocks_get_cputime_used(void) { struct tms tmstic; times(&tmstic); diff --git a/src/collectgroup.c b/src/collectgroup.c index f9690d0db6d8bb626587cdb596109d6250395e89..2820ac74851912cc6b0c7d7679a7189dd94b0a7e 100644 --- a/src/collectgroup.c +++ b/src/collectgroup.c @@ -60,7 +60,7 @@ static MPI_Op mpicollectgroup1_reduce_op; /** * @brief Perform any once only initialisations. Must be called once. */ -void collectgroup_init() { +void collectgroup_init(void) { #ifdef WITH_MPI /* Initialise the MPI types. */ @@ -211,7 +211,7 @@ static void mpicollectgroup1_reduce(void *in, void *inout, int *len, /** * @brief Registers any MPI collection types and reduction functions. */ -static void mpicollect_create_MPI_type() { +static void mpicollect_create_MPI_type(void) { if (MPI_Type_contiguous(sizeof(struct mpicollectgroup1), MPI_BYTE, &mpicollectgroup1_type) != MPI_SUCCESS || diff --git a/src/debug.c b/src/debug.c index 93d14952f523be5f1d1fa90484e9e7951f8e3f6e..05c21de0a73bba3a5e867a4265de0a5c14736a14 100644 --- a/src/debug.c +++ b/src/debug.c @@ -642,7 +642,7 @@ void getProcMemUse(long *size, long *resident, long *share, long *trs, /** * @brief Print the current memory use of the process. A la "top". */ -void printProcMemUse() { +void printProcMemUse(void) { long size; long resident; long share; diff --git a/src/hydro/GizmoMFV/hydro_io.h b/src/hydro/GizmoMFV/hydro_io.h index c1b151230f3198a30d6696e36a2704156804fdce..18f023acbaad7bddbc4b1531d47987b5faf3bac9 100644 --- a/src/hydro/GizmoMFV/hydro_io.h +++ b/src/hydro/GizmoMFV/hydro_io.h @@ -239,6 +239,6 @@ void hydro_write_flavour(hid_t h_grpsph) { * * @return 1 if entropy is in 'internal energy', 0 otherwise. */ -int writeEntropyFlag() { return 0; } +int writeEntropyFlag(void) { return 0; } #endif /* SWIFT_GIZMO_MFV_HYDRO_IO_H */ diff --git a/src/hydro/MinimalMultiMat/hydro_io.h b/src/hydro/MinimalMultiMat/hydro_io.h index 2a5eeb6a54d079ae72e1591116a8984b0d7a6f38..a1b6afa785aee3d5e0bfd8043e259ff65ccfcc70 100644 --- a/src/hydro/MinimalMultiMat/hydro_io.h +++ b/src/hydro/MinimalMultiMat/hydro_io.h @@ -204,6 +204,6 @@ void hydro_write_flavour(hid_t h_grpsph) { * * @return 1 if entropy is in 'internal energy', 0 otherwise. */ -int writeEntropyFlag() { return 0; } +int writeEntropyFlag(void) { return 0; } #endif /* SWIFT_MINIMAL_MULTI_MAT_HYDRO_IO_H */ diff --git a/src/hydro/PressureEnergy/hydro_io.h b/src/hydro/PressureEnergy/hydro_io.h index 776e7653ac3152e1594f25a33796a470dfcf69d3..521f0ba28efc18716e6fb46c24a9d86bbf6d9d5a 100644 --- a/src/hydro/PressureEnergy/hydro_io.h +++ b/src/hydro/PressureEnergy/hydro_io.h @@ -191,6 +191,6 @@ void hydro_write_flavour(hid_t h_grpsph) { * * @return 1 if entropy is in 'internal energy', 0 otherwise. */ -int writeEntropyFlag() { return 0; } +int writeEntropyFlag(void) { return 0; } #endif /* SWIFT_MINIMAL_HYDRO_IO_H */ diff --git a/src/hydro/Shadowswift/hydro.h b/src/hydro/Shadowswift/hydro.h index e4ea0d971cd89862d3ea6b99f0b04930666a154a..36078798cdd1ac68a456134fd7887408752f18c9 100644 --- a/src/hydro/Shadowswift/hydro.h +++ b/src/hydro/Shadowswift/hydro.h @@ -20,6 +20,7 @@ #include <float.h> #include "adiabatic_index.h" #include "approx_math.h" +#include "cosmology.h" #include "equation_of_state.h" #include "hydro_gradients.h" #include "hydro_properties.h" @@ -35,7 +36,8 @@ */ __attribute__((always_inline)) INLINE static float hydro_compute_timestep( const struct part* restrict p, const struct xpart* restrict xp, - const struct hydro_props* restrict hydro_properties) { + const struct hydro_props* restrict hydro_properties, + const struct cosmology* restrict cosmo) { const float CFL_condition = hydro_properties->CFL_condition; @@ -158,7 +160,7 @@ __attribute__((always_inline)) INLINE static void hydro_init_part( * @param p The particle to act upon. */ __attribute__((always_inline)) INLINE static void hydro_end_density( - struct part* restrict p) { + struct part* restrict p, const struct cosmology* cosmo) { float volume; float m, momentum[3], energy; @@ -246,7 +248,8 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( * @param xp The extended particle data to act upon */ __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( - struct part* restrict p, struct xpart* restrict xp) { + struct part* restrict p, struct xpart* restrict xp, + const struct cosmology* cosmo) { /* Some smoothing length multiples. */ const float h = p->h; @@ -273,7 +276,8 @@ __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours( * @param xp The extended particle data to act upon. */ __attribute__((always_inline)) INLINE static void hydro_prepare_force( - struct part* restrict p, struct xpart* restrict xp) { + struct part* restrict p, struct xpart* restrict xp, + const struct cosmology* cosmo) { /* Initialize time step criterion variables */ p->timestepvars.vmax = 0.0f; @@ -346,7 +350,7 @@ __attribute__((always_inline)) INLINE static void hydro_reset_predicted_values( * @param xp The extended particle data to act upon. */ __attribute__((always_inline)) INLINE static void hydro_convert_quantities( - struct part* p, struct xpart* xp) {} + struct part* p, struct xpart* xp, const struct cosmology* cosmo) {} /** * @brief Extra operations to be done during the drift @@ -358,7 +362,7 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities( * @param dt The drift time-step. */ __attribute__((always_inline)) INLINE static void hydro_predict_extra( - struct part* p, struct xpart* xp, float dt) {} + struct part* p, struct xpart* xp, float dt_drift, float dt_therm) {} /** * @brief Set the particle acceleration after the flux loop. @@ -366,7 +370,7 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra( * @param p Particle to act upon. */ __attribute__((always_inline)) INLINE static void hydro_end_force( - struct part* p) {} + struct part* p, const struct cosmology* cosmo) {} /** * @brief Extra operations done during the kick @@ -378,7 +382,8 @@ __attribute__((always_inline)) INLINE static void hydro_end_force( * @param dt Physical time step. */ __attribute__((always_inline)) INLINE static void hydro_kick_extra( - struct part* p, struct xpart* xp, float dt) { + struct part* p, struct xpart* xp, float dt, const struct cosmology* cosmo, + const struct hydro_props* hydro_props) { float vcell[3]; @@ -553,8 +558,13 @@ __attribute__((always_inline)) INLINE static float hydro_get_mass( * @param v (return) The velocities at the current time. */ __attribute__((always_inline)) INLINE static void hydro_get_drifted_velocities( - const struct part* restrict p, const struct xpart* xp, float dt, - float v[3]) {} + const struct part* restrict p, const struct xpart* xp, float dt_kick_hydro, + float dt_kick_grav, float v[3]) { + + v[0] = p->v[0]; + v[1] = p->v[1]; + v[2] = p->v[2]; +} /** * @brief Returns the density of a particle @@ -621,3 +631,171 @@ __attribute__((always_inline)) INLINE static void hydro_set_entropy( p->primitives.P = gas_pressure_from_entropy(p->primitives.rho, S); } } + +/** + * @brief Sets the mass of a particle + * + * @param p The particle of interest + * @param m The mass to set. + */ +__attribute__((always_inline)) INLINE static void hydro_set_mass( + struct part* restrict p, float m) { + + p->conserved.mass = m; +} + +/** + * @brief Overwrite the initial internal energy of a particle. + * + * Note that in the cases where the thermodynamic variable is not + * internal energy but gets converted later, we must overwrite that + * field. The conversion to the actual variable happens later after + * the initial fake time-step. + * + * @param p The #part to write to. + * @param u_init The new initial internal energy. + */ +__attribute__((always_inline)) INLINE static void +hydro_set_init_internal_energy(struct part* p, float u_init) { + + p->conserved.energy = u_init * p->conserved.mass; +#ifdef GIZMO_TOTAL_ENERGY + /* add the kinetic energy */ + p->conserved.energy += 0.5f * p->conserved.mass * + (p->conserved.momentum[0] * p->primitives.v[0] + + p->conserved.momentum[1] * p->primitives.v[1] + + p->conserved.momentum[2] * p->primitives.v[2]); +#endif + p->primitives.P = hydro_gamma_minus_one * p->primitives.rho * u_init; +} + +/** + * @brief Returns the comoving internal energy of a particle + * + * @param p The particle of interest. + */ +__attribute__((always_inline)) INLINE static float +hydro_get_comoving_internal_energy(const struct part* restrict p) { + + if (p->primitives.rho > 0.) + return gas_internal_energy_from_pressure(p->primitives.rho, + p->primitives.P); + else + return 0.; +} + +/** + * @brief Returns the comoving entropy of a particle + * + * @param p The particle of interest. + */ +__attribute__((always_inline)) INLINE static float hydro_get_comoving_entropy( + const struct part* restrict p) { + + if (p->primitives.rho > 0.) { + return gas_entropy_from_pressure(p->primitives.rho, p->primitives.P); + } else { + return 0.; + } +} + +/** + * @brief Returns the sound speed of a particle + * + * @param p The particle of interest. + */ +__attribute__((always_inline)) INLINE static float +hydro_get_comoving_soundspeed(const struct part* restrict p) { + + if (p->primitives.rho > 0.) + return gas_soundspeed_from_pressure(p->primitives.rho, p->primitives.P); + else + return 0.; +} + +/** + * @brief Returns the comoving pressure of a particle + * + * @param p The particle of interest + */ +__attribute__((always_inline)) INLINE static float hydro_get_comoving_pressure( + const struct part* restrict p) { + + return p->primitives.P; +} + +/** + * @brief Returns the comoving density of a particle + * + * @param p The particle of interest + */ +__attribute__((always_inline)) INLINE static float hydro_get_comoving_density( + const struct part* restrict p) { + + return p->primitives.rho; +} + +/** + * @brief Returns the physical internal energy of a particle + * + * @param p The particle of interest. + * @param cosmo The cosmological model. + */ +__attribute__((always_inline)) INLINE static float +hydro_get_physical_internal_energy(const struct part* restrict p, + const struct cosmology* cosmo) { + + return cosmo->a_factor_internal_energy * + hydro_get_comoving_internal_energy(p); +} + +/** + * @brief Returns the physical internal energy of a particle + * + * @param p The particle of interest. + * @param cosmo The cosmological model. + */ +__attribute__((always_inline)) INLINE static float hydro_get_physical_entropy( + const struct part* restrict p, const struct cosmology* cosmo) { + + /* Note: no cosmological conversion required here with our choice of + * coordinates. */ + return hydro_get_comoving_entropy(p); +} + +/** + * @brief Returns the physical sound speed of a particle + * + * @param p The particle of interest. + * @param cosmo The cosmological model. + */ +__attribute__((always_inline)) INLINE static float +hydro_get_physical_soundspeed(const struct part* restrict p, + const struct cosmology* cosmo) { + + return cosmo->a_factor_sound_speed * hydro_get_comoving_soundspeed(p); +} + +/** + * @brief Returns the comoving pressure of a particle + * + * @param p The particle of interest. + * @param cosmo The cosmological model. + */ +__attribute__((always_inline)) INLINE static float hydro_get_physical_pressure( + const struct part* restrict p, const struct cosmology* cosmo) { + + return cosmo->a_factor_pressure * p->primitives.P; +} + +/** + * @brief Returns the physical density of a particle + * + * @param p The particle of interest + * @param cosmo The cosmological model. + */ +__attribute__((always_inline)) INLINE static float hydro_get_physical_density( + const struct part* restrict p, const struct cosmology* cosmo) { + + return cosmo->a3_inv * p->primitives.rho; +} diff --git a/src/hydro/Shadowswift/hydro_gradients.h b/src/hydro/Shadowswift/hydro_gradients.h index 1aea49790d998d3912a80fa1376cbd1e183f26f7..285d889a1a6e10662a06979f69290aabd4206059 100644 --- a/src/hydro/Shadowswift/hydro_gradients.h +++ b/src/hydro/Shadowswift/hydro_gradients.h @@ -51,8 +51,8 @@ __attribute__((always_inline)) INLINE static void hydro_gradients_init( * @param pj Particle j. */ __attribute__((always_inline)) INLINE static void hydro_gradients_collect( - float r2, float* dx, float hi, float hj, struct part* pi, struct part* pj) { -} + float r2, const float* dx, float hi, float hj, struct part* restrict pi, + struct part* restrict pj) {} /** * @brief Gradient calculations done during the neighbour loop: non-symmetric @@ -66,8 +66,9 @@ __attribute__((always_inline)) INLINE static void hydro_gradients_collect( * @param pj Particle j. */ __attribute__((always_inline)) INLINE static void -hydro_gradients_nonsym_collect(float r2, float* dx, float hi, float hj, - struct part* pi, struct part* pj) {} +hydro_gradients_nonsym_collect(float r2, const float* dx, float hi, float hj, + struct part* restrict pi, + const struct part* restrict pj) {} /** * @brief Finalize the gradient variables after all data have been collected @@ -84,8 +85,8 @@ __attribute__((always_inline)) INLINE static void hydro_gradients_finalize( * gradients_none does nothing, since all gradients are zero -- are they?). */ __attribute__((always_inline)) INLINE static void hydro_gradients_predict( - struct part* pi, struct part* pj, float hi, float hj, float* dx, float r, - float* xij_i, float* Wi, float* Wj, float mindt) { + struct part* pi, struct part* pj, float hi, float hj, const float* dx, + float r, float* xij_i, float* Wi, float* Wj, float mindt) { float dWi[5], dWj[5]; float xij_j[3]; diff --git a/src/hydro/Shadowswift/hydro_gradients_shadowfax.h b/src/hydro/Shadowswift/hydro_gradients_shadowfax.h index 9ca40a604da3dc12bbb48ac033cd078f0561d8ab..d131731907806536e86a03921b1c701f287077f1 100644 --- a/src/hydro/Shadowswift/hydro_gradients_shadowfax.h +++ b/src/hydro/Shadowswift/hydro_gradients_shadowfax.h @@ -65,7 +65,7 @@ __attribute__((always_inline)) INLINE static void hydro_gradients_init( * @param grad Current value of the gradient for the quantity (is updated). */ __attribute__((always_inline)) INLINE void hydro_gradients_single_quantity( - float qL, float qR, float *cLR, float *xLR, float rLR, float A, + float qL, float qR, float *cLR, const float *xLR, float rLR, float A, float *grad) { grad[0] += A * ((qR - qL) * cLR[0] / rLR - 0.5f * (qL + qR) * xLR[0] / rLR); @@ -84,7 +84,8 @@ __attribute__((always_inline)) INLINE void hydro_gradients_single_quantity( * @param pj Particle j. */ __attribute__((always_inline)) INLINE static void hydro_gradients_collect( - float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) { + float r2, const float *dx, float hi, float hj, struct part *pi, + struct part *pj) { float A, midpoint[3]; @@ -148,8 +149,8 @@ __attribute__((always_inline)) INLINE static void hydro_gradients_collect( * @param pj Particle j. */ __attribute__((always_inline)) INLINE static void -hydro_gradients_nonsym_collect(float r2, float *dx, float hi, float hj, - struct part *pi, struct part *pj) { +hydro_gradients_nonsym_collect(float r2, const float *dx, float hi, float hj, + struct part *pi, const struct part *pj) { float A, midpoint[3]; diff --git a/src/hydro/Shadowswift/hydro_iact.h b/src/hydro/Shadowswift/hydro_iact.h index 15219bf879ea7d34a8a45be217ef81107d3392e6..9ac1debf3184c25603412867c41c62a1131345f3 100644 --- a/src/hydro/Shadowswift/hydro_iact.h +++ b/src/hydro/Shadowswift/hydro_iact.h @@ -35,7 +35,8 @@ * @param pj Particle j. */ __attribute__((always_inline)) INLINE static void runner_iact_density( - float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) { + float r2, const float *dx, float hi, float hj, struct part *restrict pi, + struct part *restrict pj, float a, float H) { float mindx[3]; @@ -59,7 +60,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_density( * @param pj Particle j. */ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density( - float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) { + float r2, const float *dx, float hi, float hj, struct part *restrict pi, + const struct part *restrict pj, float a, float H) { voronoi_cell_interact(&pi->cell, dx, pj->id); } @@ -78,7 +80,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density( * @param pj Particle j. */ __attribute__((always_inline)) INLINE static void runner_iact_gradient( - float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) { + float r2, const float *dx, float hi, float hj, struct part *restrict pi, + struct part *restrict pj, float a, float H) { hydro_gradients_collect(r2, dx, hi, hj, pi, pj); } @@ -98,7 +101,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_gradient( * @param pj Particle j. */ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_gradient( - float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) { + float r2, const float *dx, float hi, float hj, struct part *restrict pi, + struct part *restrict pj, float a, float H) { hydro_gradients_nonsym_collect(r2, dx, hi, hj, pi, pj); } @@ -129,8 +133,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_gradient( * @param pj Particle j. */ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common( - float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj, - int mode) { + float r2, const float *dx, float hi, float hj, struct part *restrict pi, + struct part *restrict pj, int mode, float a, float H) { float r = sqrtf(r2); int k; @@ -322,9 +326,10 @@ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common( * @param pj Particle j. */ __attribute__((always_inline)) INLINE static void runner_iact_force( - float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) { + float r2, const float *dx, float hi, float hj, struct part *restrict pi, + struct part *restrict pj, float a, float H) { - runner_iact_fluxes_common(r2, dx, hi, hj, pi, pj, 1); + runner_iact_fluxes_common(r2, dx, hi, hj, pi, pj, 1, a, H); } /** @@ -341,7 +346,8 @@ __attribute__((always_inline)) INLINE static void runner_iact_force( * @param pj Particle j. */ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force( - float r2, float *dx, float hi, float hj, struct part *pi, struct part *pj) { + float r2, const float *dx, float hi, float hj, struct part *restrict pi, + struct part *restrict pj, float a, float H) { - runner_iact_fluxes_common(r2, dx, hi, hj, pi, pj, 0); + runner_iact_fluxes_common(r2, dx, hi, hj, pi, pj, 0, a, H); } diff --git a/src/hydro/Shadowswift/hydro_io.h b/src/hydro/Shadowswift/hydro_io.h index 244cad3f85ce622dd8816e43e754b8391bcd2335..4a15ec845dd3913b10c1b6579290f2ec6bdb4e84 100644 --- a/src/hydro/Shadowswift/hydro_io.h +++ b/src/hydro/Shadowswift/hydro_io.h @@ -64,7 +64,8 @@ void hydro_read_particles(struct part* parts, struct io_props* list, * @param p Particle. * @return Internal energy of the particle */ -void convert_u(const struct engine* e, const struct part* p, float* ret) { +void convert_u(const struct engine* e, const struct part* p, + const struct xpart* xp, float* ret) { ret[0] = hydro_get_internal_energy(p); } @@ -75,7 +76,8 @@ void convert_u(const struct engine* e, const struct part* p, float* ret) { * @param p Particle. * @return Entropic function of the particle */ -void convert_A(const struct engine* e, const struct part* p, float* ret) { +void convert_A(const struct engine* e, const struct part* p, + const struct xpart* xp, float* ret) { ret[0] = hydro_get_entropy(p); } @@ -86,7 +88,8 @@ void convert_A(const struct engine* e, const struct part* p, float* ret) { * @param p Particle. * @return Total energy of the particle */ -void convert_Etot(const struct engine* e, const struct part* p, float* ret) { +void convert_Etot(const struct engine* e, const struct part* p, + const struct xpart* xp, float* ret) { #ifdef SHADOWFAX_TOTAL_ENERGY return p->conserved.energy; #else @@ -105,7 +108,7 @@ void convert_Etot(const struct engine* e, const struct part* p, float* ret) { } void convert_part_pos(const struct engine* e, const struct part* p, - double* ret) { + const struct xpart* xp, double* ret) { if (e->s->periodic) { ret[0] = box_wrap(p->x[0], 0.0, e->s->dim[0]); @@ -125,14 +128,15 @@ void convert_part_pos(const struct engine* e, const struct part* p, * @param list The list of i/o properties to write. * @param num_fields The number of i/o fields to write. */ -void hydro_write_particles(struct part* parts, struct io_props* list, - int* num_fields) { +void hydro_write_particles(const struct part* parts, const struct xpart* xparts, + struct io_props* list, int* num_fields) { *num_fields = 13; /* List what we want to write */ - list[0] = io_make_output_field_convert_part( - "Coordinates", DOUBLE, 3, UNIT_CONV_LENGTH, parts, convert_part_pos); + list[0] = io_make_output_field_convert_part("Coordinates", DOUBLE, 3, + UNIT_CONV_LENGTH, parts, xparts, + convert_part_pos); list[1] = io_make_output_field("Velocities", FLOAT, 3, UNIT_CONV_SPEED, parts, primitives.v); list[2] = io_make_output_field("Masses", FLOAT, 1, UNIT_CONV_MASS, parts, @@ -141,7 +145,7 @@ void hydro_write_particles(struct part* parts, struct io_props* list, parts, h); list[4] = io_make_output_field_convert_part("InternalEnergy", FLOAT, 1, UNIT_CONV_ENERGY_PER_UNIT_MASS, - parts, convert_u); + parts, xparts, convert_u); list[5] = io_make_output_field("ParticleIDs", ULONGLONG, 1, UNIT_CONV_NO_UNITS, parts, id); list[6] = io_make_output_field("Acceleration", FLOAT, 3, @@ -153,11 +157,11 @@ void hydro_write_particles(struct part* parts, struct io_props* list, list[9] = io_make_output_field("GradDensity", FLOAT, 3, UNIT_CONV_DENSITY, parts, primitives.gradients.rho); list[10] = io_make_output_field_convert_part( - "Entropy", FLOAT, 1, UNIT_CONV_ENTROPY, parts, convert_A); + "Entropy", FLOAT, 1, UNIT_CONV_ENTROPY, parts, xparts, convert_A); list[11] = io_make_output_field("Pressure", FLOAT, 1, UNIT_CONV_PRESSURE, parts, primitives.P); list[12] = io_make_output_field_convert_part( - "TotEnergy", FLOAT, 1, UNIT_CONV_ENERGY, parts, convert_Etot); + "TotEnergy", FLOAT, 1, UNIT_CONV_ENERGY, parts, xparts, convert_Etot); } /** diff --git a/src/hydro/Shadowswift/hydro_part.h b/src/hydro/Shadowswift/hydro_part.h index 4f28d7bdc1c4779a9e6f15c3fb789c3f65f32890..a7cc9daf0839216f098ac05c2267adc60ea11fb0 100644 --- a/src/hydro/Shadowswift/hydro_part.h +++ b/src/hydro/Shadowswift/hydro_part.h @@ -35,6 +35,9 @@ struct xpart { /* Velocity at the last full step. */ float v_full[3]; + /* Gravitational acceleration at the last full step. */ + float a_grav[3]; + /* Additional data used to record cooling information */ struct cooling_xpart_data cooling_data; diff --git a/src/hydro/Shadowswift/hydro_slope_limiters_cell.h b/src/hydro/Shadowswift/hydro_slope_limiters_cell.h index a7b3f7511fa7cd247fd9d2399cd200d8d943630e..d746ffc59538fcc625a2e095245adfd7a946a95e 100644 --- a/src/hydro/Shadowswift/hydro_slope_limiters_cell.h +++ b/src/hydro/Shadowswift/hydro_slope_limiters_cell.h @@ -50,7 +50,8 @@ __attribute__((always_inline)) INLINE static void hydro_slope_limit_cell_init( * @param r Distance between particle i and particle j. */ __attribute__((always_inline)) INLINE static void -hydro_slope_limit_cell_collect(struct part* pi, struct part* pj, float r) { +hydro_slope_limit_cell_collect(struct part* pi, const struct part* pj, + float r) { /* basic slope limiter: collect the maximal and the minimal value for the * primitive variables among the ngbs */ diff --git a/src/part.c b/src/part.c index 1b696a8cbc135fd2c128b5ad705a0e6e24a2d5c8..050e10e9cdd0ab56adcd34ba3e6f2d35c274f14a 100644 --- a/src/part.c +++ b/src/part.c @@ -259,7 +259,7 @@ MPI_Datatype multipole_mpi_type; /** * @brief Registers MPI particle types. */ -void part_create_mpi_types() { +void part_create_mpi_types(void) { /* This is not the recommended way of doing this. One should define the structure field by field diff --git a/src/statistics.c b/src/statistics.c index 62a4f9a1420e88712e8fb527fc4d3db7f4b0abc0..bdca6cfb4ef84bb64aa4776bfc600b0727e0d606 100644 --- a/src/statistics.c +++ b/src/statistics.c @@ -396,7 +396,7 @@ void stats_add_MPI(void *in, void *inout, int *len, MPI_Datatype *datatype) { /** * @brief Registers MPI #statistics type and reduction function. */ -void stats_create_MPI_type() { +void stats_create_MPI_type(void) { /* This is not the recommended way of doing this. One should define the structure field by field diff --git a/src/timers.c b/src/timers.c index fec111dd939528bd0648609d8a1f5f83e595ec02..e3beda71310b6a177833db73e207179e5a4b5468 100644 --- a/src/timers.c +++ b/src/timers.c @@ -110,7 +110,7 @@ void timers_reset(unsigned long long mask) { * @brief Re-set all the timers. * */ -void timers_reset_all() { timers_reset(timers_mask_all); } +void timers_reset_all(void) { timers_reset(timers_mask_all); } /** * @brief Outputs all the timers to the timers dump file. @@ -145,4 +145,4 @@ void timers_open_file(int rank) { /** * @brief Close the file containing the timer info. */ -void timers_close_file() { fclose(timers_file); } +void timers_close_file(void) { fclose(timers_file); }