Commit bac24275 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Code formatting

parent 66004dea
......@@ -458,7 +458,7 @@ __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
* @param p The particle to act upon
* @param xp The extended particle data to act upon
* @param cosmo The current cosmological model.
* @param hydro_props Hydrodynamic properties.
* @param hydro_props Hydrodynamic properties.
* @param dt_alpha The time-step used to evolve non-cosmological quantities such
* as the artificial viscosity.
*/
......@@ -505,8 +505,10 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
/* const float S = max(-normDiv_v, 0.f); */
/* Compute the particle's viscosity parameter time derivative */
/* const float alpha_dot = (hydro_props->viscosity.alpha_max) - p->alpha) / tau + */
/* (hydro_props->viscosity.alpha_max - p->alpha) * S; */
/* const float alpha_dot = (hydro_props->viscosity.alpha_max) - p->alpha) /
* tau + */
/* (hydro_props->viscosity.alpha_max - p->alpha) * S;
*/
/* Update particle's viscosity paramter */
/* p->alpha += alpha_dot * (p->ti_end - p->ti_begin) * timeBase; */ // MATTHIEU
......
......@@ -472,7 +472,7 @@ __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
* @param p The particle to act upon
* @param xp The extended particle data to act upon
* @param cosmo The current cosmological model.
* @param hydro_props Hydrodynamic properties.
* @param hydro_props Hydrodynamic properties.
* @param dt_alpha The time-step used to evolve non-cosmological quantities such
* as the artificial viscosity.
*/
......@@ -504,7 +504,8 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
const float P_over_rho2 = pressure * rho_inv * rho_inv;
/* Compute the Balsara switch */
/* Pre-multiply in the AV factor; hydro_props are not passed to the iact functions */
/* Pre-multiply in the AV factor; hydro_props are not passed to the iact
* functions */
const float balsara =
hydro_props->viscosity.alpha * abs_div_v /
(abs_div_v + curl_v + 0.0001f * fac_mu * soundspeed / p->h);
......
......@@ -742,9 +742,9 @@ runner_iact_nonsym_1_vec_force(
/* Now construct the full viscosity term */
rho_ij.v = vec_mul(vec_set1(0.5f), vec_add(pirho.v, pjrho.v));
visc.v = vec_div(vec_mul(vec_set1(-0.25f),
vec_mul(v_sig.v, vec_mul(mu_ij.v, balsara.v))),
rho_ij.v);
visc.v = vec_div(
vec_mul(vec_set1(-0.25f), vec_mul(v_sig.v, vec_mul(mu_ij.v, balsara.v))),
rho_ij.v);
/* Now, convolve with the kernel */
visc_term.v =
......@@ -933,9 +933,9 @@ runner_iact_nonsym_2_vec_force(
rho_ij.v = vec_mul(vec_set1(0.5f), vec_add(pirho.v, pjrho.v));
rho_ij_2.v = vec_mul(vec_set1(0.5f), vec_add(pirho.v, pjrho_2.v));
visc.v = vec_div(vec_mul(vec_set1(-0.25f),
vec_mul(v_sig.v, vec_mul(mu_ij.v, balsara.v))),
rho_ij.v);
visc.v = vec_div(
vec_mul(vec_set1(-0.25f), vec_mul(v_sig.v, vec_mul(mu_ij.v, balsara.v))),
rho_ij.v);
visc_2.v =
vec_div(vec_mul(vec_set1(-0.25f),
vec_mul(v_sig_2.v, vec_mul(mu_ij_2.v, balsara_2.v))),
......
......@@ -451,13 +451,13 @@ __attribute__((always_inline)) INLINE static void hydro_end_gradient(
* @param p The particle to act upon
* @param xp The extended particle data to act upon
* @param cosmo The current cosmological model.
* @param hydro_props Hydrodynamic properties.
* @param hydro_props Hydrodynamic properties.
* @param dt_alpha The time-step used to evolve non-cosmological quantities such
* as the artificial viscosity.
*/
__attribute__((always_inline)) INLINE static void hydro_prepare_force(
struct part *restrict p, struct xpart *restrict xp,
const struct cosmology *cosmo, const struct hydro_props *hydro_props,
struct part* restrict p, struct xpart* restrict xp,
const struct cosmology* cosmo, const struct hydro_props* hydro_props,
const float dt_alpha) {
/* Initialise values that are used in the force loop */
......
......@@ -476,13 +476,13 @@ __attribute__((always_inline)) INLINE static void hydro_end_gradient(
* @param p The particle to act upon
* @param xp The extended particle data to act upon
* @param cosmo The current cosmological model.
* @param hydro_props Hydrodynamic properties.
* @param hydro_props Hydrodynamic properties.
* @param dt_alpha The time-step used to evolve non-cosmological quantities such
* as the artificial viscosity.
*/
__attribute__((always_inline)) INLINE static void hydro_prepare_force(
struct part *restrict p, struct xpart *restrict xp,
const struct cosmology *cosmo, const struct hydro_props *hydro_props,
struct part* restrict p, struct xpart* restrict xp,
const struct cosmology* cosmo, const struct hydro_props* hydro_props,
const float dt_alpha) {
/* Initialise values that are used in the force loop */
......
......@@ -485,7 +485,7 @@ __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
* @param p The particle to act upon
* @param xp The extended particle data to act upon
* @param cosmo The current cosmological model.
* @param hydro_props Hydrodynamic properties.
* @param hydro_props Hydrodynamic properties.
* @param dt_alpha The time-step used to evolve non-cosmological quantities such
* as the artificial viscosity.
*/
......@@ -516,7 +516,8 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
1.f / (1.f + hydro_dimension_inv * p->h * p->density.rho_dh * rho_inv);
/* Compute the Balsara switch */
/* Pre-multiply in the AV factor; hydro_props are not passed to the iact functions */
/* Pre-multiply in the AV factor; hydro_props are not passed to the iact
* functions */
const float balsara =
hydro_props->viscosity.alpha * abs_div_v /
(abs_div_v + curl_v + 0.0001f * fac_mu * soundspeed / p->h);
......
......@@ -488,7 +488,7 @@ __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
* @param p The particle to act upon
* @param xp The extended particle data to act upon
* @param cosmo The current cosmological model.
* @param hydro_props Hydrodynamic properties.
* @param hydro_props Hydrodynamic properties.
* @param dt_alpha The time-step used to evolve non-cosmological quantities such
* as the artificial viscosity.
*/
......@@ -527,7 +527,7 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
grad_h_term = 0.f;
}
/* Compute the Balsara switch */
/* Compute the Balsara switch */
#ifdef PLANETARY_SPH_NO_BALSARA
const float balsara = hydro_props->viscosity.alpha;
#else
......
......@@ -310,8 +310,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_force(
/* Construct the full viscosity term */
const float rho_ij = 0.5f * (rhoi + rhoj);
const float visc = -0.25f * v_sig * mu_ij *
(balsara_i + balsara_j) / rho_ij;
const float visc = -0.25f * v_sig * mu_ij * (balsara_i + balsara_j) / rho_ij;
/* Convolve with the kernel */
const float visc_acc_term = 0.5f * visc * (wi_dr + wj_dr) * r_inv;
......
......@@ -524,7 +524,7 @@ __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
* @param p The particle to act upon
* @param xp The extended particle data to act upon
* @param cosmo The current cosmological model.
* @param hydro_props Hydrodynamic properties.
* @param hydro_props Hydrodynamic properties.
* @param dt_alpha The time-step used to evolve non-cosmological quantities such
* as the artificial viscosity.
*/
......
......@@ -478,7 +478,7 @@ __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
* @param p The particle to act upon
* @param xp The extended particle data to act upon
* @param cosmo The current cosmological model.
* @param hydro_props Hydrodynamic properties.
* @param hydro_props Hydrodynamic properties.
* @param dt_alpha The time-step used to evolve non-cosmological quantities such
* as the artificial viscosity.
*/
......
......@@ -295,13 +295,13 @@ __attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
* @param p The particle to act upon
* @param xp The extended particle data to act upon
* @param cosmo The current cosmological model.
* @param hydro_props Hydrodynamic properties.
* @param hydro_props Hydrodynamic properties.
* @param dt_alpha The time-step used to evolve non-cosmological quantities such
* as the artificial viscosity.
*/
__attribute__((always_inline)) INLINE static void hydro_prepare_force(
struct part *restrict p, struct xpart *restrict xp,
const struct cosmology *cosmo, const struct hydro_props *hydro_props,
struct part* restrict p, struct xpart* restrict xp,
const struct cosmology* cosmo, const struct hydro_props* hydro_props,
const float dt_alpha) {
/* Initialize time step criterion variables */
......
......@@ -121,20 +121,18 @@ void hydro_props_init(struct hydro_props *p,
/* Read the artificial viscosity parameters from the file, if they exist */
p->viscosity.alpha = parser_get_opt_param_float(
params, "SPH:viscosity_alpha", hydro_props_default_viscosity_alpha
);
p->viscosity.alpha_max = parser_get_opt_param_float(
params, "SPH:viscosity_alpha_max", hydro_props_default_viscosity_alpha_max
);
params, "SPH:viscosity_alpha", hydro_props_default_viscosity_alpha);
p->viscosity.alpha_min = parser_get_opt_param_float(
params, "SPH:viscosity_alpha_min", hydro_props_default_viscosity_alpha_min
);
p->viscosity.alpha_max =
parser_get_opt_param_float(params, "SPH:viscosity_alpha_max",
hydro_props_default_viscosity_alpha_max);
p->viscosity.alpha_min =
parser_get_opt_param_float(params, "SPH:viscosity_alpha_min",
hydro_props_default_viscosity_alpha_min);
p->viscosity.length = parser_get_opt_param_float(
params, "SPH:viscosity_length", hydro_props_default_viscosity_length
);
params, "SPH:viscosity_length", hydro_props_default_viscosity_length);
/* Compute the initial energy (Note the temp. read is in internal units) */
/* u_init = k_B T_init / (mu m_p (gamma - 1)) */
......@@ -188,10 +186,11 @@ void hydro_props_print(const struct hydro_props *p) {
message("Hydrodynamic integration: CFL parameter: %.4f.", p->CFL_condition);
message("Artificial viscosity parameters set to alpha: %.3f, max: %.3f, "
"min: %.3f, length: %.3f.",
p->viscosity.alpha, p->viscosity.alpha_max,
p->viscosity.alpha_min, p->viscosity.length);
message(
"Artificial viscosity parameters set to alpha: %.3f, max: %.3f, "
"min: %.3f, length: %.3f.",
p->viscosity.alpha, p->viscosity.alpha_max, p->viscosity.alpha_min,
p->viscosity.length);
message(
"Hydrodynamic integration: Max change of volume: %.2f "
......@@ -211,7 +210,6 @@ void hydro_props_print(const struct hydro_props *p) {
if (p->minimal_temperature != hydro_props_default_min_temp)
message("Minimal gas temperature set to %f", p->minimal_temperature);
// Matthieu: Temporary location for this i/o business.
#ifdef PLANETARY_SPH
......@@ -265,7 +263,7 @@ void hydro_props_print_snapshot(hid_t h_grpsph, const struct hydro_props *p) {
* @brief Initialises a hydro_props struct with somewhat useful values for
* the automated test suite. This is not intended for production use,
* but rather to fill for the purposes of mocking.
*
*
* @param p the struct
*/
void hydro_props_init_no_hydro(struct hydro_props *p) {
......@@ -280,7 +278,7 @@ void hydro_props_init_no_hydro(struct hydro_props *p) {
p->max_smoothing_iterations = hydro_props_default_max_iterations;
p->CFL_condition = 0.1;
p->log_max_h_change = logf(powf(1.4, hydro_dimension_inv));
/* These values are inconsistent and in a production run would probably lead
to a crash. Again, this function is intended for mocking use in unit tests
and is _not_ to be used otherwise! */
......@@ -290,12 +288,13 @@ void hydro_props_init_no_hydro(struct hydro_props *p) {
p->initial_internal_energy = 0.f;
p->hydrogen_mass_fraction = 0.755;
p->hydrogen_ionization_temperature = hydro_props_default_H_ionization_temperature;
p->hydrogen_ionization_temperature =
hydro_props_default_H_ionization_temperature;
p->viscosity.alpha = hydro_props_default_viscosity_alpha;
p->viscosity.alpha_max= hydro_props_default_viscosity_alpha_max;
p->viscosity.alpha_min= hydro_props_default_viscosity_alpha_min;
p->viscosity.length= hydro_props_default_viscosity_length;
p->viscosity.alpha_max = hydro_props_default_viscosity_alpha_max;
p->viscosity.alpha_min = hydro_props_default_viscosity_alpha_min;
p->viscosity.length = hydro_props_default_viscosity_length;
}
/**
......
......@@ -170,8 +170,7 @@ void clean_up(struct cell *ci) {
/**
* @brief Initializes all particles field to be ready for a density calculation
*/
void zero_particle_fields_density(struct cell *c,
const struct cosmology *cosmo,
void zero_particle_fields_density(struct cell *c, const struct cosmology *cosmo,
const struct hydro_props *hydro_props) {
for (int pid = 0; pid < c->hydro.count; pid++) {
hydro_init_part(&c->hydro.parts[pid], NULL);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment