diff --git a/src/star_formation/EAGLE/star_formation.h b/src/star_formation/EAGLE/star_formation.h index eb6a74cbd324c1efb8d545f456d66f3c0ad01a9c..55f1c8d4271b16f63ce00e6d6cac9eaee5a778a6 100644 --- a/src/star_formation/EAGLE/star_formation.h +++ b/src/star_formation/EAGLE/star_formation.h @@ -690,6 +690,7 @@ star_formation_first_init_part(const struct phys_const* restrict phys_const, * @param data The global star_formation information. */ __attribute__((always_inline)) INLINE static void star_formation_init_part( - struct part* restrict p, struct xpart* restrict xp, const struct star_formation* data) {} + struct part* restrict p, struct xpart* restrict xp, + const struct star_formation* data) {} #endif /* SWIFT_EAGLE_STAR_FORMATION_H */ diff --git a/src/star_formation/EAGLE/star_formation_logger.h b/src/star_formation/EAGLE/star_formation_logger.h index e992e5d1442e8a0471d9f47ca3d1b93b40d734b5..a843f63ce518aa9be6b1d389d42cf71c8608b903 100644 --- a/src/star_formation/EAGLE/star_formation_logger.h +++ b/src/star_formation/EAGLE/star_formation_logger.h @@ -88,11 +88,11 @@ INLINE static void star_formation_logger_add( } /** - * @brief add a star formation history struct to the engine star formation history - * accumulator struct + * @brief add a star formation history struct to the engine star formation + * history accumulator struct * - * @param sf_add the star formation accumulator struct which we want to add to the star - * formation history + * @param sf_add the star formation accumulator struct which we want to add to + * the star formation history * @param sf_update the star formation structure which we want to update */ INLINE static void star_formation_logger_add_to_accumulator( @@ -145,7 +145,6 @@ INLINE static void star_formation_logger_accumulator_init( sfh->SFR_inactive = 0.f; } - /** * @brief Write the final SFH to a file * diff --git a/src/star_formation/EAGLE/star_formation_logger_struct.h b/src/star_formation/EAGLE/star_formation_logger_struct.h index b677ee6bc76933f20975df1e2d54fc432aa45f51..c03a00c97ead46f552350a43574c5bbe7ac6df1b 100644 --- a/src/star_formation/EAGLE/star_formation_logger_struct.h +++ b/src/star_formation/EAGLE/star_formation_logger_struct.h @@ -34,7 +34,6 @@ struct star_formation_history { float SFRdt_active; }; - /* Starformation history struct for the engine. Allows to integrate in time some values. Nothing to do in EAGLE => copy of star_formation_history */ @@ -52,5 +51,4 @@ struct star_formation_history_accumulator { float SFRdt_active; }; - #endif /* SWIFT_EAGLE_STAR_FORMATION_LOGGER_STRUCT_H */ diff --git a/src/star_formation/GEAR/star_formation.h b/src/star_formation/GEAR/star_formation.h index a1d9dda2a0736bde67167f4e11e2de4fcb8c72cc..ac423a51865609460e870f65b1eeeb266182e2ef 100644 --- a/src/star_formation/GEAR/star_formation.h +++ b/src/star_formation/GEAR/star_formation.h @@ -59,8 +59,8 @@ INLINE static int star_formation_is_star_forming( const struct cooling_function_data* restrict cooling, const struct entropy_floor_properties* restrict entropy_floor) { - const float temperature = - cooling_get_temperature(phys_const, hydro_props, us, cosmo, cooling, p, xp); + const float temperature = cooling_get_temperature(phys_const, hydro_props, us, + cosmo, cooling, p, xp); const float temperature_max = starform->maximal_temperature; @@ -80,9 +80,12 @@ INLINE static int star_formation_is_star_forming( const float mu = hydro_props->mu_neutral; /* Compute the density criterion */ - const float coef = M_PI_4 / (phys_const->const_newton_G * n_jeans_2_3 * h * h); - const float density_criterion = coef * (hydro_gamma * phys_const->const_boltzmann_k * temperature - / (mu * phys_const->const_proton_mass) + sigma2); + const float coef = + M_PI_4 / (phys_const->const_newton_G * n_jeans_2_3 * h * h); + const float density_criterion = + coef * (hydro_gamma * phys_const->const_boltzmann_k * temperature / + (mu * phys_const->const_proton_mass) + + sigma2); /* Check the density criterion */ return density > density_criterion; @@ -91,7 +94,8 @@ INLINE static int star_formation_is_star_forming( /** * @brief Compute the star-formation rate of a given particle. * - * Nothing to do here. Everything is done in #star_formation_should_convert_to_star. + * Nothing to do here. Everything is done in + * #star_formation_should_convert_to_star. * * @param p #part. * @param xp the #xpart. @@ -123,7 +127,7 @@ INLINE static int star_formation_should_convert_to_star( const struct engine* e, const double dt_star) { const struct phys_const* phys_const = e->physical_constants; - const struct cosmology *cosmo = e->cosmology; + const struct cosmology* cosmo = e->cosmology; /* Check that we are running a full time step */ if (dt_star == 0.) { @@ -135,12 +139,14 @@ INLINE static int star_formation_should_convert_to_star( const float density = hydro_get_physical_density(p, cosmo); /* Compute the probability */ - const float inv_free_fall_time = sqrtf(density * 32.f * G * 0.33333333f * M_1_PI); - const float prob = 1.f - exp(-starform->star_formation_efficiency * inv_free_fall_time * dt_star); + const float inv_free_fall_time = + sqrtf(density * 32.f * G * 0.33333333f * M_1_PI); + const float prob = 1.f - exp(-starform->star_formation_efficiency * + inv_free_fall_time * dt_star); /* Roll the dice... */ const float random_number = - random_unit_interval(p->id, e->ti_current, random_number_star_formation); + random_unit_interval(p->id, e->ti_current, random_number_star_formation); /* Can we form a star? */ return random_number < prob; @@ -203,9 +209,8 @@ INLINE static void star_formation_copy_properties( sp->birth.density = hydro_get_physical_density(p, cosmo); /* Store the birth temperature*/ - sp->birth.temperature = - cooling_get_temperature(phys_const, hydro_props, us, - cosmo, cooling, p, xp); + sp->birth.temperature = cooling_get_temperature(phys_const, hydro_props, us, + cosmo, cooling, p, xp); } /** @@ -227,11 +232,13 @@ INLINE static void starformation_print_backend( * @param cosmo The current cosmological model. */ __attribute__((always_inline)) INLINE static void star_formation_end_density( - struct part* restrict p, const struct star_formation* sf, const struct cosmology* cosmo) { + struct part* restrict p, const struct star_formation* sf, + const struct cosmology* cosmo) { // TODO move into pressure floor /* To finish the turbulence estimation we devide by the density */ - p->sf_data.sigma2 /= pow_dimension(p->h) * hydro_get_physical_density(p, cosmo); + p->sf_data.sigma2 /= + pow_dimension(p->h) * hydro_get_physical_density(p, cosmo); /* Add the cosmological factor */ p->sf_data.sigma2 *= cosmo->a * cosmo->a; @@ -285,11 +292,10 @@ star_formation_first_init_part(const struct phys_const* restrict phys_const, const struct cosmology* restrict cosmo, const struct star_formation* data, struct part* restrict p, - struct xpart* restrict xp) { + struct xpart* restrict xp) { /* Nothing special here */ star_formation_init_part(p, xp, data); } - #endif /* SWIFT_GEAR_STAR_FORMATION_H */ diff --git a/src/star_formation/GEAR/star_formation_iact.h b/src/star_formation/GEAR/star_formation_iact.h index 80de6422757e8f7d22e5691a70e5e9d21adb09b1..7325b92af2840b317cf1a924a1e509b34bdffba3 100644 --- a/src/star_formation/GEAR/star_formation_iact.h +++ b/src/star_formation/GEAR/star_formation_iact.h @@ -51,11 +51,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_star_formation( kernel_eval(sqrt(r2) / hj, &wj); /* Delta v */ - float dv[3] = { - pi->v[0] - pj->v[0], - pi->v[1] - pj->v[1], - pi->v[2] - pj->v[2] - }; + float dv[3] = {pi->v[0] - pj->v[0], pi->v[1] - pj->v[1], pi->v[2] - pj->v[2]}; /* Norms at power 2 */ const float norm_v2 = dv[0] * dv[0] + dv[1] * dv[1] + dv[2] * dv[2]; @@ -92,11 +88,7 @@ runner_iact_nonsym_star_formation(float r2, const float *dx, float hi, float hj, kernel_eval(sqrt(r2) / hi, &wi); /* Delta v */ - float dv[3] = { - pi->v[0] - pj->v[0], - pi->v[1] - pj->v[1], - pi->v[2] - pj->v[2] - }; + float dv[3] = {pi->v[0] - pj->v[0], pi->v[1] - pj->v[1], pi->v[2] - pj->v[2]}; /* Norms at power 2 */ const float norm_v2 = dv[0] * dv[0] + dv[1] * dv[1] + dv[2] * dv[2]; diff --git a/src/star_formation/GEAR/star_formation_io.h b/src/star_formation/GEAR/star_formation_io.h index a0fa0935caab13fa20899653aecb8dfcf53e4700..3e021f7844c1deaeca40d7144d6f7b69cb6c2bdb 100644 --- a/src/star_formation/GEAR/star_formation_io.h +++ b/src/star_formation/GEAR/star_formation_io.h @@ -38,11 +38,10 @@ __attribute__((always_inline)) INLINE static int star_formation_write_particles( const struct part* parts, const struct xpart* xparts, struct io_props* list) { -/* Nothing to write here */ + /* Nothing to write here */ return 0; } - /** * @brief initialization of the star formation law * @@ -60,20 +59,19 @@ INLINE static void starformation_init_backend( // TODO move into pressure floor starform->n_jeans_2_3 = parser_get_param_float(parameter_file, "GEARStarFormation:NJeans"); - starform->n_jeans_2_3 = pow(starform->n_jeans_2_3, 2./3.); + starform->n_jeans_2_3 = pow(starform->n_jeans_2_3, 2. / 3.); /* Star formation efficiency */ starform->star_formation_efficiency = parser_get_param_double( parameter_file, "GEARStarFormation:star_formation_efficiency"); /* Maximum temperature for star formation */ - starform->maximal_temperature = - parser_get_param_double(parameter_file, - "GEARStarFormation:maximal_temperature"); + starform->maximal_temperature = parser_get_param_double( + parameter_file, "GEARStarFormation:maximal_temperature"); /* Apply unit change */ starform->maximal_temperature *= - units_cgs_conversion_factor(us, UNIT_CONV_TEMPERATURE); + units_cgs_conversion_factor(us, UNIT_CONV_TEMPERATURE); } #endif /* SWIFT_STAR_FORMATION_GEAR_IO_H */ diff --git a/src/star_formation/GEAR/star_formation_logger.h b/src/star_formation/GEAR/star_formation_logger.h index 45d39b18439cf94a66e4875de460836b8f9cd0da..84475909c0f524a4f930a48dbcc3b0943719f8b0 100644 --- a/src/star_formation/GEAR/star_formation_logger.h +++ b/src/star_formation/GEAR/star_formation_logger.h @@ -166,8 +166,6 @@ INLINE static void star_formation_logger_log_inactive_part( const struct part *p, const struct xpart *xp, struct star_formation_history *sf) {} - - /** * @brief add a star formation history struct to an other star formation history * struct diff --git a/src/star_formation/GEAR/star_formation_logger_struct.h b/src/star_formation/GEAR/star_formation_logger_struct.h index f694cda64364050f270fa34f59479c37e7492b2d..63e3af06a7cd5af375662a1ba28dc5000a69dc3f 100644 --- a/src/star_formation/GEAR/star_formation_logger_struct.h +++ b/src/star_formation/GEAR/star_formation_logger_struct.h @@ -32,7 +32,8 @@ struct star_formation_history { }; /** - * Structure containing the global star formation information (including time integrated variables). + * Structure containing the global star formation information (including time + * integrated variables). */ struct star_formation_history_accumulator { /*! Total stellar mass from the begining of the simulation */ diff --git a/src/star_formation/GEAR/star_formation_struct.h b/src/star_formation/GEAR/star_formation_struct.h index 960ccda293249df7ae0055aadc7ff9f472f3ab4a..2e9a7548f83ca6ae9bb78ee7bcf4be69a0a31489 100644 --- a/src/star_formation/GEAR/star_formation_struct.h +++ b/src/star_formation/GEAR/star_formation_struct.h @@ -25,7 +25,6 @@ */ struct star_formation_xpart_data {}; - struct star_formation_part_data { // TODO move it to the pressure floor /*! Estimation of local turbulence (squared) */ @@ -38,7 +37,8 @@ struct star_formation_part_data { struct star_formation { // TODO move it to pressure floor - /*! Number of particle required to resolved the Jeans criterion (at power 2/3) */ + /*! Number of particle required to resolved the Jeans criterion (at power 2/3) + */ float n_jeans_2_3; /*! Maximal temperature for forming a star */ diff --git a/src/star_formation/none/star_formation.h b/src/star_formation/none/star_formation.h index 6ef1c11068abd6a088a3d3fb0d50fad13c871e83..3275e1a4c43ce232d73dbb2f331c1c6e81118ec1 100644 --- a/src/star_formation/none/star_formation.h +++ b/src/star_formation/none/star_formation.h @@ -219,6 +219,7 @@ star_formation_first_init_part(const struct phys_const* restrict phys_const, * @param data The global star_formation information. */ __attribute__((always_inline)) INLINE static void star_formation_init_part( - struct part* restrict p, struct xpart* restrict xp, const struct star_formation* data) {} + struct part* restrict p, struct xpart* restrict xp, + const struct star_formation* data) {} #endif /* SWIFT_NONE_STAR_FORMATION_H */ diff --git a/src/star_formation/none/star_formation_logger.h b/src/star_formation/none/star_formation_logger.h index 0a90bd48698cd56ec30efa76778ac791ab06c2c1..552df0c6cae533d1eb2678cb23dd675e0a058715 100644 --- a/src/star_formation/none/star_formation_logger.h +++ b/src/star_formation/none/star_formation_logger.h @@ -59,13 +59,12 @@ INLINE static void star_formation_logger_add( struct star_formation_history *sf_update, const struct star_formation_history *sf_add) {} - /** - * @brief add a star formation history accumulator struct to an other star formation history - * struct + * @brief add a star formation history accumulator struct to an other star + * formation history struct * - * @param sf_add the star formation accumulator struct which we want to add to the star - * formation history + * @param sf_add the star formation accumulator struct which we want to add to + * the star formation history * @param sf_update the star formation structure which we want to update */ INLINE static void star_formation_logger_add_to_accumulator( diff --git a/src/star_formation/none/star_formation_logger_struct.h b/src/star_formation/none/star_formation_logger_struct.h index c80d6b6f3f6ff6b960ddcedf9288e6e0579ab706..b60c64f2eb47894db828a1bde0ca20803892c7db 100644 --- a/src/star_formation/none/star_formation_logger_struct.h +++ b/src/star_formation/none/star_formation_logger_struct.h @@ -22,7 +22,6 @@ /* Starformation history struct */ struct star_formation_history {}; - /* Starformation history accumulator struct. This structure is only defined in the engine and allows the user to integrate some quantities over time. diff --git a/src/stars/GEAR/stars_io.h b/src/stars/GEAR/stars_io.h index 4551d8af2cfdba1a74af72f14867f562c8df1918..a538a2ba10a0e2f451c94e11187ba0cc8777d928 100644 --- a/src/stars/GEAR/stars_io.h +++ b/src/stars/GEAR/stars_io.h @@ -76,10 +76,11 @@ INLINE static void stars_write_particles(const struct spart *sparts, sparts, h); list[5] = io_make_output_field("BirthTime", FLOAT, 1, UNIT_CONV_TIME, sparts, birth_time); - list[6] = io_make_output_field("BirthDensity", FLOAT, 1, UNIT_CONV_DENSITY, sparts, - birth.density); - list[7] = io_make_output_field("BirthTemperature", FLOAT, 1, UNIT_CONV_TEMPERATURE, sparts, - birth.temperature); + list[6] = io_make_output_field("BirthDensity", FLOAT, 1, UNIT_CONV_DENSITY, + sparts, birth.density); + list[7] = + io_make_output_field("BirthTemperature", FLOAT, 1, UNIT_CONV_TEMPERATURE, + sparts, birth.temperature); list[8] = io_make_output_field("BirthMass", FLOAT, 1, UNIT_CONV_MASS, sparts, birth.mass);