From 53b97792176bdabb8bf8081f8ff18199d47f175d Mon Sep 17 00:00:00 2001 From: Bert Vandenbroucke <bert.vandenbroucke@ugent.be> Date: Fri, 3 Mar 2017 09:57:39 +0000 Subject: [PATCH] Formatting of previous commit. --- src/hydro/Gizmo/hydro.h | 8 ++-- src/hydro/Gizmo/hydro_gradients.h | 62 ++++++++++++++++++------------- src/hydro/Gizmo/hydro_iact.h | 2 +- src/hydro/Gizmo/hydro_io.h | 13 +++---- 4 files changed, 49 insertions(+), 36 deletions(-) diff --git a/src/hydro/Gizmo/hydro.h b/src/hydro/Gizmo/hydro.h index 42a10cae7f..9da1f63d8b 100644 --- a/src/hydro/Gizmo/hydro.h +++ b/src/hydro/Gizmo/hydro.h @@ -23,8 +23,8 @@ #include "approx_math.h" #include "equation_of_state.h" #include "hydro_gradients.h" -#include "riemann.h" #include "minmax.h" +#include "riemann.h" /** * @brief Computes the hydro time-step of a given particle @@ -240,7 +240,8 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( p->primitives.v[2] = momentum[2] / m; #ifdef EOS_ISOTHERMAL_GAS - p->primitives.P = const_isothermal_soundspeed*const_isothermal_soundspeed*p->primitives.rho; + p->primitives.P = const_isothermal_soundspeed * const_isothermal_soundspeed * + p->primitives.rho; #else float energy = p->conserved.energy; @@ -623,7 +624,8 @@ __attribute__((always_inline)) INLINE static float hydro_get_soundspeed( if (p->primitives.rho > 0.) { #ifdef EOS_ISOTHERMAL_GAS - return sqrtf(const_isothermal_internal_energy * hydro_gamma * hydro_gamma_minus_one); + return sqrtf(const_isothermal_internal_energy * hydro_gamma * + hydro_gamma_minus_one); #else return sqrtf(hydro_gamma * p->primitives.P / p->primitives.rho); #endif diff --git a/src/hydro/Gizmo/hydro_gradients.h b/src/hydro/Gizmo/hydro_gradients.h index ac99f072c8..a5c1e9038d 100644 --- a/src/hydro/Gizmo/hydro_gradients.h +++ b/src/hydro/Gizmo/hydro_gradients.h @@ -150,19 +150,25 @@ __attribute__((always_inline)) INLINE static void hydro_gradients_predict( Wi[0] * (pi->primitives.gradients.v[0][0] + pi->primitives.gradients.v[1][1] + pi->primitives.gradients.v[2][2])); - dWi[1] -= 0.5 * mindt * (Wi[1] * pi->primitives.gradients.v[0][0] + - Wi[2] * pi->primitives.gradients.v[0][1] + - Wi[3] * pi->primitives.gradients.v[0][2] + - const_isothermal_soundspeed*const_isothermal_soundspeed*pi->primitives.gradients.rho[0] / Wi[0]); - dWi[2] -= 0.5 * mindt * (Wi[1] * pi->primitives.gradients.v[1][0] + - Wi[2] * pi->primitives.gradients.v[1][1] + - Wi[3] * pi->primitives.gradients.v[1][2] + - const_isothermal_soundspeed*const_isothermal_soundspeed*pi->primitives.gradients.rho[1] / Wi[0]); - dWi[3] -= 0.5 * mindt * (Wi[1] * pi->primitives.gradients.v[2][0] + - Wi[2] * pi->primitives.gradients.v[2][1] + - Wi[3] * pi->primitives.gradients.v[2][2] + - const_isothermal_soundspeed*const_isothermal_soundspeed*pi->primitives.gradients.rho[2] / Wi[0]); - /* we don't care about P in this case */ + dWi[1] -= 0.5 * mindt * + (Wi[1] * pi->primitives.gradients.v[0][0] + + Wi[2] * pi->primitives.gradients.v[0][1] + + Wi[3] * pi->primitives.gradients.v[0][2] + + const_isothermal_soundspeed * const_isothermal_soundspeed * + pi->primitives.gradients.rho[0] / Wi[0]); + dWi[2] -= 0.5 * mindt * + (Wi[1] * pi->primitives.gradients.v[1][0] + + Wi[2] * pi->primitives.gradients.v[1][1] + + Wi[3] * pi->primitives.gradients.v[1][2] + + const_isothermal_soundspeed * const_isothermal_soundspeed * + pi->primitives.gradients.rho[1] / Wi[0]); + dWi[3] -= 0.5 * mindt * + (Wi[1] * pi->primitives.gradients.v[2][0] + + Wi[2] * pi->primitives.gradients.v[2][1] + + Wi[3] * pi->primitives.gradients.v[2][2] + + const_isothermal_soundspeed * const_isothermal_soundspeed * + pi->primitives.gradients.rho[2] / Wi[0]); +/* we don't care about P in this case */ #else dWi[0] -= 0.5 * mindt * (Wi[1] * pi->primitives.gradients.rho[0] + Wi[2] * pi->primitives.gradients.rho[1] + @@ -200,18 +206,24 @@ __attribute__((always_inline)) INLINE static void hydro_gradients_predict( Wj[0] * (pj->primitives.gradients.v[0][0] + pj->primitives.gradients.v[1][1] + pj->primitives.gradients.v[2][2])); - dWj[1] -= 0.5 * mindt * (Wj[1] * pj->primitives.gradients.v[0][0] + - Wj[2] * pj->primitives.gradients.v[0][1] + - Wj[3] * pj->primitives.gradients.v[0][2] + - const_isothermal_soundspeed*const_isothermal_soundspeed*pj->primitives.gradients.rho[0] / Wj[0]); - dWj[2] -= 0.5 * mindt * (Wj[1] * pj->primitives.gradients.v[1][0] + - Wj[2] * pj->primitives.gradients.v[1][1] + - Wj[3] * pj->primitives.gradients.v[1][2] + - const_isothermal_soundspeed*const_isothermal_soundspeed*pj->primitives.gradients.rho[1] / Wj[0]); - dWj[3] -= 0.5 * mindt * (Wj[1] * pj->primitives.gradients.v[2][0] + - Wj[2] * pj->primitives.gradients.v[2][1] + - Wj[3] * pj->primitives.gradients.v[2][2] + - const_isothermal_soundspeed*const_isothermal_soundspeed*pj->primitives.gradients.rho[2] / Wj[0]); + dWj[1] -= 0.5 * mindt * + (Wj[1] * pj->primitives.gradients.v[0][0] + + Wj[2] * pj->primitives.gradients.v[0][1] + + Wj[3] * pj->primitives.gradients.v[0][2] + + const_isothermal_soundspeed * const_isothermal_soundspeed * + pj->primitives.gradients.rho[0] / Wj[0]); + dWj[2] -= 0.5 * mindt * + (Wj[1] * pj->primitives.gradients.v[1][0] + + Wj[2] * pj->primitives.gradients.v[1][1] + + Wj[3] * pj->primitives.gradients.v[1][2] + + const_isothermal_soundspeed * const_isothermal_soundspeed * + pj->primitives.gradients.rho[1] / Wj[0]); + dWj[3] -= 0.5 * mindt * + (Wj[1] * pj->primitives.gradients.v[2][0] + + Wj[2] * pj->primitives.gradients.v[2][1] + + Wj[3] * pj->primitives.gradients.v[2][2] + + const_isothermal_soundspeed * const_isothermal_soundspeed * + pj->primitives.gradients.rho[2] / Wj[0]); #else dWj[0] -= 0.5 * mindt * (Wj[1] * pj->primitives.gradients.rho[0] + Wj[2] * pj->primitives.gradients.rho[1] + diff --git a/src/hydro/Gizmo/hydro_iact.h b/src/hydro/Gizmo/hydro_iact.h index c0ce7eca0f..0593408915 100644 --- a/src/hydro/Gizmo/hydro_iact.h +++ b/src/hydro/Gizmo/hydro_iact.h @@ -233,7 +233,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common( /* calculate the maximal signal velocity */ if (Wi[0] > 0.0f && Wj[0] > 0.0f) { #ifdef EOS_ISOTHERMAL_GAS - vmax = 2.*const_isothermal_soundspeed; + vmax = 2. * const_isothermal_soundspeed; #else vmax = sqrtf(hydro_gamma * Wi[4] / Wi[0]) + sqrtf(hydro_gamma * Wj[4] / Wj[0]); diff --git a/src/hydro/Gizmo/hydro_io.h b/src/hydro/Gizmo/hydro_io.h index 3e33d6c698..236106a1fb 100644 --- a/src/hydro/Gizmo/hydro_io.h +++ b/src/hydro/Gizmo/hydro_io.h @@ -70,7 +70,7 @@ void hydro_read_particles(struct part* parts, struct io_props* list, * @return Internal energy of the particle */ float convert_u(struct engine* e, struct part* p) { - if(p->primitives.rho > 0.){ + if (p->primitives.rho > 0.) { #ifdef EOS_ISOTHERMAL_GAS return const_isothermal_internal_energy; #else @@ -89,9 +89,9 @@ float convert_u(struct engine* e, struct part* p) { * @return Entropic function of the particle */ float convert_A(struct engine* e, struct part* p) { - if(p->primitives.rho > 0.){ - return p->primitives.P / pow_gamma(p->primitives.rho); - } else { + if (p->primitives.rho > 0.) { + return p->primitives.P / pow_gamma(p->primitives.rho); + } else { return 0.; } } @@ -158,9 +158,8 @@ void hydro_write_particles(struct part* parts, struct io_props* list, list[12] = io_make_output_field_convert_part("TotEnergy", FLOAT, 1, UNIT_CONV_ENERGY, parts, conserved.energy, convert_Etot); - list[13] = io_make_output_field("GravAcceleration", FLOAT, 3, UNIT_CONV_ACCELERATION, - parts, gravity.old_a); - + list[13] = io_make_output_field("GravAcceleration", FLOAT, 3, + UNIT_CONV_ACCELERATION, parts, gravity.old_a); } /** -- GitLab