Skip to content
Snippets Groups Projects
Commit 23f1178d authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Code formatting

parent 3c31b2e2
No related branches found
No related tags found
1 merge request!307Fix cooling bug
...@@ -91,7 +91,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part( ...@@ -91,7 +91,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
/* Integrate cooling equation to enforce energy floor */ /* Integrate cooling equation to enforce energy floor */
/* Factor of 1.5 included since timestep could potentially double */ /* Factor of 1.5 included since timestep could potentially double */
if (u_old + (hydro_du_dt + cooling_du_dt) * 1.5f * dt < u_floor) { if (u_old + (hydro_du_dt + cooling_du_dt) * 1.5f * dt < u_floor) {
cooling_du_dt = -(u_old + 1.5f *dt * hydro_du_dt - u_floor) /(1.5f * dt); cooling_du_dt = -(u_old + 1.5f * dt * hydro_du_dt - u_floor) / (1.5f * dt);
} }
/* Update the internal energy time derivative */ /* Update the internal energy time derivative */
......
...@@ -334,6 +334,7 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra( ...@@ -334,6 +334,7 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
/* Predict the entropy */ /* Predict the entropy */
p->entropy += p->entropy_dt * dt; p->entropy += p->entropy_dt * dt;
/* Re-compute the pressure */ /* Re-compute the pressure */
const float pressure = gas_pressure_from_entropy(p->rho, p->entropy); const float pressure = gas_pressure_from_entropy(p->rho, p->entropy);
...@@ -376,12 +377,12 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra( ...@@ -376,12 +377,12 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
struct part *restrict p, struct xpart *restrict xp, float dt) { struct part *restrict p, struct xpart *restrict xp, float dt) {
/* Do not decrease the entropy by more than a factor of 2 */ /* Do not decrease the entropy by more than a factor of 2 */
if (p->entropy_dt < -0.5f * xp->entropy_full / dt) {
if (p->entropy_dt < -0.5f * xp->entropy_full / dt){ /* message("Warning! Limiting entropy_dt. Possible cooling error.\n
message("Warning! Limiting entropy_dt. Possible cooling error.\n entropy_full = %g \n entropy_dt * dt =%g \n", * entropy_full = %g \n entropy_dt * dt =%g \n", */
xp->entropy_full,p->entropy_dt * dt); /* xp->entropy_full,p->entropy_dt * dt); */
p->entropy_dt = -0.5f * xp->entropy_full / dt; p->entropy_dt = -0.5f * xp->entropy_full / dt;
} }
xp->entropy_full += p->entropy_dt * dt; xp->entropy_full += p->entropy_dt * dt;
/* Compute the pressure */ /* Compute the pressure */
...@@ -411,6 +412,7 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities( ...@@ -411,6 +412,7 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities(
/* We read u in the entropy field. We now get S from u */ /* We read u in the entropy field. We now get S from u */
xp->entropy_full = gas_entropy_from_internal_energy(p->rho, p->entropy); xp->entropy_full = gas_entropy_from_internal_energy(p->rho, p->entropy);
p->entropy = xp->entropy_full; p->entropy = xp->entropy_full;
/* Compute the pressure */ /* Compute the pressure */
const float pressure = gas_pressure_from_entropy(p->rho, p->entropy); const float pressure = gas_pressure_from_entropy(p->rho, p->entropy);
......
...@@ -68,8 +68,8 @@ ...@@ -68,8 +68,8 @@
*separation. *separation.
* @param partId The running counter of IDs. * @param partId The running counter of IDs.
*/ */
struct part *make_particles(size_t count, double *offset, double spacing, double h, struct part *make_particles(size_t count, double *offset, double spacing,
long long *partId) { double h, long long *partId) {
struct part *particles; struct part *particles;
if (posix_memalign((void **)&particles, part_align, if (posix_memalign((void **)&particles, part_align,
...@@ -279,7 +279,7 @@ void test_interactions(struct part test_part, struct part *parts, size_t count, ...@@ -279,7 +279,7 @@ void test_interactions(struct part test_part, struct part *parts, size_t count,
} }
const ticks tic = getticks(); const ticks tic = getticks();
/* Perform serial interaction */ /* Perform serial interaction */
#ifdef __ICC #ifdef __ICC
#pragma novector #pragma novector
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment