diff --git a/src/chemistry/EAGLE/chemistry_io.h b/src/chemistry/EAGLE/chemistry_io.h index 3bbff92b9ac9a04dac178026a5b98938819bce1a..d7ee9dc213e327227a3d5cd35e96946ba4016a1b 100644 --- a/src/chemistry/EAGLE/chemistry_io.h +++ b/src/chemistry/EAGLE/chemistry_io.h @@ -115,7 +115,7 @@ INLINE static int chemistry_write_particles(const struct part* parts, * @return Returns the number of fields to write. */ INLINE static int chemistry_write_sparticles(const struct spart* sparts, - struct io_props* list) { + struct io_props* list) { /* List what we want to write */ list[0] = io_make_output_field("ElementAbundance", FLOAT, diff --git a/src/chemistry/GEAR/chemistry_io.h b/src/chemistry/GEAR/chemistry_io.h index 5bbd5476acb478bb58d40c62b7643771f5c86617..b29f7db65d3ab7dce4b0dcafed06c97a9e621bfe 100644 --- a/src/chemistry/GEAR/chemistry_io.h +++ b/src/chemistry/GEAR/chemistry_io.h @@ -96,7 +96,7 @@ INLINE static int chemistry_write_particles(const struct part* parts, * @return Returns the number of fields to write. */ INLINE static int chemistry_write_sparticles(const struct spart* sparts, - struct io_props* list) { + struct io_props* list) { /* List what we want to write */ list[0] = io_make_output_field( diff --git a/src/chemistry/none/chemistry_io.h b/src/chemistry/none/chemistry_io.h index b0c82066c30e14c9f634b7ac018aab758ac3c384..8373cb15b61f9239716cb1fed3f24e9fc30d99ab 100644 --- a/src/chemistry/none/chemistry_io.h +++ b/src/chemistry/none/chemistry_io.h @@ -64,7 +64,7 @@ INLINE static int chemistry_write_particles(const struct part* parts, * @return Returns the number of fields to write. */ INLINE static int chemistry_write_sparticles(const struct spart* sparts, - struct io_props* list) { + struct io_props* list) { /* update list according to hydro_io */ diff --git a/src/hydro/Gadget2/hydro_part.h b/src/hydro/Gadget2/hydro_part.h index 109092e7db57c43ff199c08173473b44c689160e..369eff881d5464a3ececca60cfedf077411e6d3d 100644 --- a/src/hydro/Gadget2/hydro_part.h +++ b/src/hydro/Gadget2/hydro_part.h @@ -34,8 +34,8 @@ #include "chemistry_struct.h" #include "cooling_struct.h" #include "logger.h" -#include "tracers_struct.h" #include "sftracers_struct.h" +#include "tracers_struct.h" /* Extra particle data not needed during the SPH loops over neighbours. */ struct xpart { diff --git a/src/parallel_io.c b/src/parallel_io.c index 9570bd2cab76e5086cf319ec16508ac976bcd15d..2c885fa7991c4cbc56e133cf803b290d9681ae3f 100644 --- a/src/parallel_io.c +++ b/src/parallel_io.c @@ -51,9 +51,9 @@ #include "kernel_hydro.h" #include "part.h" #include "part_type.h" +#include "sftracers_io.h" #include "stars_io.h" #include "tracers_io.h" -#include "sftracers_io.h" #include "units.h" #include "xmf.h" @@ -1145,8 +1145,8 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6], e->cooling_func); num_fields += tracers_write_particles(parts, xparts, list + num_fields, with_cosmology); - num_fields += sftracers_write_particles(parts, xparts, list + num_fields, - with_cosmology); + num_fields += sftracers_write_particles( + parts, xparts, list + num_fields, with_cosmology); break; @@ -1157,8 +1157,8 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6], case swift_type_stars: stars_write_particles(sparts, list, &num_fields); num_fields += chemistry_write_sparticles(sparts, list + num_fields); - num_fields += tracers_write_sparticles(sparts, list + num_fields, - with_cosmology); + num_fields += + tracers_write_sparticles(sparts, list + num_fields, with_cosmology); break; default: @@ -1484,7 +1484,7 @@ void write_output_parallel(struct engine* e, const char* baseName, stars_write_particles(sparts, list, &num_fields); num_fields += chemistry_write_sparticles(sparts, list + num_fields); num_fields += tracers_write_sparticles(sparts, list + num_fields, - with_cosmology); + with_cosmology); } else { /* Ok, we need to fish out the particles we want */ @@ -1503,7 +1503,7 @@ void write_output_parallel(struct engine* e, const char* baseName, stars_write_particles(sparts_written, list, &num_fields); num_fields += chemistry_write_sparticles(sparts, list + num_fields); num_fields += tracers_write_sparticles(sparts, list + num_fields, - with_cosmology); + with_cosmology); } } break; diff --git a/src/serial_io.c b/src/serial_io.c index c6182d5a44eb5dbd3d3b897fc686b9edd94ba81a..45746e565087f65c3a20606605d24f742cf7b4be 100644 --- a/src/serial_io.c +++ b/src/serial_io.c @@ -51,9 +51,9 @@ #include "kernel_hydro.h" #include "part.h" #include "part_type.h" +#include "sftracers_io.h" #include "stars_io.h" #include "tracers_io.h" -#include "sftracers_io.h" #include "units.h" #include "xmf.h" @@ -1115,7 +1115,7 @@ void write_output_serial(struct engine* e, const char* baseName, list + num_fields, with_cosmology); num_fields += sftracers_write_particles(parts_written, xparts_written, - list + num_fields, with_cosmology); + list + num_fields, with_cosmology); } } break; @@ -1150,9 +1150,10 @@ void write_output_serial(struct engine* e, const char* baseName, /* No inhibted particles: easy case */ Nparticles = Nstars; stars_write_particles(sparts, list, &num_fields); - num_fields += chemistry_write_sparticles(sparts, list + num_fields); + num_fields += + chemistry_write_sparticles(sparts, list + num_fields); num_fields += tracers_write_sparticles(sparts, list + num_fields, - with_cosmology); + with_cosmology); } else { /* Ok, we need to fish out the particles we want */ @@ -1169,9 +1170,10 @@ void write_output_serial(struct engine* e, const char* baseName, /* Select the fields to write */ stars_write_particles(sparts_written, list, &num_fields); - num_fields += chemistry_write_sparticles(sparts, list + num_fields); + num_fields += + chemistry_write_sparticles(sparts, list + num_fields); num_fields += tracers_write_sparticles(sparts, list + num_fields, - with_cosmology); + with_cosmology); } } break; diff --git a/src/sftracers/EAGLE/sftracers_io.h b/src/sftracers/EAGLE/sftracers_io.h index b8b94d3e96652bc9a35060649b4282d736451c0c..2fff68bcc42237cbeb67b211fe32134037b5529e 100644 --- a/src/sftracers/EAGLE/sftracers_io.h +++ b/src/sftracers/EAGLE/sftracers_io.h @@ -54,14 +54,11 @@ __attribute__((always_inline)) INLINE static int sftracers_write_particles( const struct part* parts, const struct xpart* xparts, struct io_props* list, const int with_cosmology) { - list[0] = io_make_output_field("SFR", FLOAT, 1, - UNIT_CONV_SFR, xparts, - sftracers_data.SFR); - - list[1] = io_make_output_field("sSFR", FLOAT, 1, - UNIT_CONV_SSFR, xparts, - sftracers_data.sSFR); + list[0] = io_make_output_field("SFR", FLOAT, 1, UNIT_CONV_SFR, xparts, + sftracers_data.SFR); + list[1] = io_make_output_field("sSFR", FLOAT, 1, UNIT_CONV_SSFR, xparts, + sftracers_data.sSFR); return 2; } diff --git a/src/sftracers/EAGLE/sftracers_struct.h b/src/sftracers/EAGLE/sftracers_struct.h index 4261086b25a38d9280d6e4705bc87a07e0957f41..ccc7ee55539e17f9d04dd3d8e7a743f44ac97745 100644 --- a/src/sftracers/EAGLE/sftracers_struct.h +++ b/src/sftracers/EAGLE/sftracers_struct.h @@ -28,7 +28,6 @@ struct sftracers_xpart_data { /*! Specific star formation rate */ float sSFR; - }; #endif /* SWIFT_SFTRACERS_STRUCT_EAGLE_H */ diff --git a/src/sftracers_struct.h b/src/sftracers_struct.h index 419d2dec86c1da59bbfba140ae2b4ad7d0e0a34e..e13e259d2ea56416f40e4ba1668e57e1e2ad8c10 100644 --- a/src/sftracers_struct.h +++ b/src/sftracers_struct.h @@ -1,6 +1,6 @@ /******************************************************************************* * This file is part of SWIFT. - * Copyright (c) 2019 Folkert Nobels (nobels@strw.leidenuniv.nl) + * Copyright (c) 2019 Folkert Nobels (nobels@strw.leidenuniv.nl) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published diff --git a/src/single_io.c b/src/single_io.c index 4d2d2219140c249226a41f9d1306609af486120e..c80c8a9940076d494e575ce98dc1bb422cfdc574 100644 --- a/src/single_io.c +++ b/src/single_io.c @@ -50,9 +50,9 @@ #include "kernel_hydro.h" #include "part.h" #include "part_type.h" +#include "sftracers_io.h" #include "stars_io.h" #include "tracers_io.h" -#include "sftracers_io.h" #include "units.h" #include "xmf.h" @@ -968,8 +968,8 @@ void write_output_single(struct engine* e, const char* baseName, N = Nstars; stars_write_particles(sparts, list, &num_fields); num_fields += chemistry_write_sparticles(sparts, list + num_fields); - num_fields += tracers_write_sparticles( - sparts, list + num_fields, with_cosmology); + num_fields += tracers_write_sparticles(sparts, list + num_fields, + with_cosmology); } else { /* Ok, we need to fish out the particles we want */ @@ -986,7 +986,8 @@ void write_output_single(struct engine* e, const char* baseName, /* Select the fields to write */ stars_write_particles(sparts_written, list, &num_fields); - num_fields += chemistry_write_sparticles(sparts_written, list + num_fields); + num_fields += + chemistry_write_sparticles(sparts_written, list + num_fields); num_fields += tracers_write_sparticles( sparts_written, list + num_fields, with_cosmology); } diff --git a/src/starformation/schaye08/starformation.h b/src/starformation/schaye08/starformation.h index 54715ad099c80e129b492a110f88dc0b15aa4566..bf5fc60b4b1c8e8878ab336a0316fb9952416bc9 100644 --- a/src/starformation/schaye08/starformation.h +++ b/src/starformation/schaye08/starformation.h @@ -218,26 +218,27 @@ INLINE static int star_formation_convert_to_star( if (star_formation_potential_to_become_star( starform, p, xp, phys_const, cosmo, hydro_props, us, cooling)) { /* Get the pressure */ - + const double pressure = starform->EOS_pressure_norm * pow(hydro_get_physical_density(p, cosmo) * p->chemistry_data.smoothed_metal_mass_fraction[0] / starform->EOS_density_norm / phys_const->const_proton_mass, starform->polytropic_index); - double SFRpergasmass; if (hydro_get_physical_density(p, cosmo) < starform->KS_high_den_thresh * phys_const->const_proton_mass) { /* Calculate the star formation rate */ - SFRpergasmass = starform->SF_normalization * - pow(pressure, starform->SF_power_law); - //SFRpergasmass = starform->KS_normalization * pow(starform->Msunpsquaredpc,-starform->KS_power_law)* - // pow(hydro_gamma * starform->fgas / phys_const->const_newton_G * pressure, (starform->KS_power_law-1.f)/2.f ); + SFRpergasmass = + starform->SF_normalization * pow(pressure, starform->SF_power_law); + // SFRpergasmass = starform->KS_normalization * + // pow(starform->Msunpsquaredpc,-starform->KS_power_law)* + // pow(hydro_gamma * starform->fgas / phys_const->const_newton_G * + // pressure, (starform->KS_power_law-1.f)/2.f ); } else { SFRpergasmass = starform->SF_high_den_normalization * - pow(pressure, starform->SF_high_den_power_law); + pow(pressure, starform->SF_high_den_power_law); } /* Store the SFR */ @@ -262,10 +263,10 @@ INLINE static int star_formation_convert_to_star( /* Check if it is the first time steps after star formation */ if (xp->sftracers_data.SFR > 0.f) { if (with_cosmology) { - xp->sftracers_data.SFR = - cosmo->a; + xp->sftracers_data.SFR = -cosmo->a; xp->sftracers_data.sSFR = 0.f; } else { - xp->sftracers_data.SFR = - e->time; + xp->sftracers_data.SFR = -e->time; xp->sftracers_data.sSFR = 0.f; } }