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

Some general documentation and physical constants updates coming from the...

Some general documentation and physical constants updates coming from the eagle-cooling-matthieu branch.
parent 30bff542
Branches
Tags
No related merge requests found
...@@ -766,8 +766,8 @@ INPUT += @top_srcdir@/src/stars/Default ...@@ -766,8 +766,8 @@ INPUT += @top_srcdir@/src/stars/Default
INPUT += @top_srcdir@/src/riemann INPUT += @top_srcdir@/src/riemann
INPUT += @top_srcdir@/src/potential/point_mass INPUT += @top_srcdir@/src/potential/point_mass
INPUT += @top_srcdir@/src/equation_of_state/ideal_gas INPUT += @top_srcdir@/src/equation_of_state/ideal_gas
INPUT += @top_srcdir@/src/cooling/none INPUT += @top_srcdir@/src/cooling/EAGLE
INPUT += @top_srcdir@/src/chemistry/none INPUT += @top_srcdir@/src/chemistry/EAGLE
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
...@@ -1993,6 +1993,7 @@ PREDEFINED = "__attribute__(x)= " ...@@ -1993,6 +1993,7 @@ PREDEFINED = "__attribute__(x)= "
PREDEFINED += HAVE_HDF5 PREDEFINED += HAVE_HDF5
PREDEFINED += WITH_MPI PREDEFINED += WITH_MPI
PREDEFINED += WITH_VECTORIZATION PREDEFINED += WITH_VECTORIZATION
PREDEFINED += __GNUC__
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The # tag can be used to specify a list of macro names that should be expanded. The
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
* *
* Note that this turns into a no-op but gives information to the compiler. * Note that this turns into a no-op but gives information to the compiler.
* *
* @param type The type of the array.
* @param array The array. * @param array The array.
* @param alignment The alignment in bytes of the array. * @param alignment The alignment in bytes of the array.
*/ */
......
...@@ -98,9 +98,12 @@ chemistry_part_has_no_neighbours(struct part* restrict p, ...@@ -98,9 +98,12 @@ chemistry_part_has_no_neighbours(struct part* restrict p,
* @brief Sets the chemistry properties of the (x-)particles to a valid start * @brief Sets the chemistry properties of the (x-)particles to a valid start
* state. * state.
* *
* @param phys_const The physical constants in internal units.
* @param us The internal system of units.
* @param cosmo The current cosmological model.
* @param data The global chemistry information.
* @param p Pointer to the particle data. * @param p Pointer to the particle data.
* @param xp Pointer to the extended particle data. * @param xp Pointer to the extended particle data.
* @param data The global chemistry information.
*/ */
__attribute__((always_inline)) INLINE static void chemistry_first_init_part( __attribute__((always_inline)) INLINE static void chemistry_first_init_part(
const struct phys_const* restrict phys_const, const struct phys_const* restrict phys_const,
...@@ -137,7 +140,7 @@ static INLINE void chemistry_init_backend(struct swift_params* parameter_file, ...@@ -137,7 +140,7 @@ static INLINE void chemistry_init_backend(struct swift_params* parameter_file,
for (int elem = 0; elem < chemistry_element_count; ++elem) { for (int elem = 0; elem < chemistry_element_count; ++elem) {
char buffer[50]; char buffer[50];
sprintf(buffer, "EAGLEChemistry:InitAbundance_%s", sprintf(buffer, "EAGLEChemistry:InitAbundance_%s",
chemistry_get_element_name(elem)); chemistry_get_element_name((enum chemistry_element)elem));
data->initial_metal_mass_fraction[elem] = data->initial_metal_mass_fraction[elem] =
parser_get_param_float(parameter_file, buffer); parser_get_param_float(parameter_file, buffer);
......
...@@ -101,7 +101,7 @@ INLINE static int chemistry_write_particles(const struct part* parts, ...@@ -101,7 +101,7 @@ INLINE static int chemistry_write_particles(const struct part* parts,
/** /**
* @brief Writes the current model of SPH to the file * @brief Writes the current model of SPH to the file
* @param h_grpsph The HDF5 group in which to write * @param h_grp The HDF5 group in which to write
*/ */
INLINE static void chemistry_write_flavour(hid_t h_grp) { INLINE static void chemistry_write_flavour(hid_t h_grp) {
...@@ -109,7 +109,8 @@ INLINE static void chemistry_write_flavour(hid_t h_grp) { ...@@ -109,7 +109,8 @@ INLINE static void chemistry_write_flavour(hid_t h_grp) {
for (int elem = 0; elem < chemistry_element_count; ++elem) { for (int elem = 0; elem < chemistry_element_count; ++elem) {
char buffer[20]; char buffer[20];
sprintf(buffer, "Element %d", elem); sprintf(buffer, "Element %d", elem);
io_write_attribute_s(h_grp, buffer, chemistry_get_element_name(elem)); io_write_attribute_s(h_grp, buffer, chemistry_get_element_name(
(enum chemistry_element)elem));
} }
} }
#endif #endif
......
...@@ -79,9 +79,12 @@ __attribute__((always_inline)) INLINE static float cooling_timestep( ...@@ -79,9 +79,12 @@ __attribute__((always_inline)) INLINE static float cooling_timestep(
* @brief Sets the cooling properties of the (x-)particles to a valid start * @brief Sets the cooling properties of the (x-)particles to a valid start
* state. * state.
* *
* @param phys_const The physical constants in internal units.
* @param us The internal system of units.
* @param cosmo The current cosmological model.
* @param cooling The properties of the cooling function.
* @param p Pointer to the particle data. * @param p Pointer to the particle data.
* @param xp Pointer to the extended particle data. * @param xp Pointer to the extended particle data.
* @param cooling The properties of the cooling function.
*/ */
__attribute__((always_inline)) INLINE static void cooling_first_init_part( __attribute__((always_inline)) INLINE static void cooling_first_init_part(
const struct phys_const* restrict phys_const, const struct phys_const* restrict phys_const,
......
...@@ -41,7 +41,7 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour( ...@@ -41,7 +41,7 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
/** /**
* @brief Specifies which particle fields to write to a dataset * @brief Specifies which particle fields to write to a dataset
* *
* @param parts The particle array. * @param xparts The extended data particle array.
* @param list The list of i/o properties to write. * @param list The list of i/o properties to write.
* @param cooling The #cooling_function_data * @param cooling The #cooling_function_data
* *
......
...@@ -614,7 +614,7 @@ double cosmology_get_therm_kick_factor(const struct cosmology *c, ...@@ -614,7 +614,7 @@ double cosmology_get_therm_kick_factor(const struct cosmology *c,
* @brief Compute the cosmic time (in internal units) between two points * @brief Compute the cosmic time (in internal units) between two points
* on the integer time line. * on the integer time line.
* *
* @brief c The current #cosmology. * @param c The current #cosmology.
* @param ti_start the (integer) time of the start. * @param ti_start the (integer) time of the start.
* @param ti_end the (integer) time of the end. * @param ti_end the (integer) time of the end.
*/ */
......
...@@ -78,6 +78,11 @@ void phys_const_init(const struct unit_system *us, struct swift_params *params, ...@@ -78,6 +78,11 @@ void phys_const_init(const struct unit_system *us, struct swift_params *params,
const_thomson_cross_section_cgs / const_thomson_cross_section_cgs /
units_general_cgs_conversion_factor(us, dimension_thomson); units_general_cgs_conversion_factor(us, dimension_thomson);
const float dimension_stefan[5] = {1, 0, -3, 0, -4};
internal_const->const_stefan_boltzmann =
const_stefan_boltzmann_cgs /
units_general_cgs_conversion_factor(us, dimension_stefan);
const float dimension_ev[5] = {1, 2, -2, 0, 0}; const float dimension_ev[5] = {1, 2, -2, 0, 0};
internal_const->const_electron_volt = internal_const->const_electron_volt =
const_electron_volt_cgs / const_electron_volt_cgs /
...@@ -116,6 +121,11 @@ void phys_const_init(const struct unit_system *us, struct swift_params *params, ...@@ -116,6 +121,11 @@ void phys_const_init(const struct unit_system *us, struct swift_params *params,
internal_const->const_light_year = internal_const->const_light_year =
const_light_year_cgs / const_light_year_cgs /
units_general_cgs_conversion_factor(us, dimension_length); units_general_cgs_conversion_factor(us, dimension_length);
const float dimension_temperature[5] = {0, 0, 0, 0, 1};
internal_const->const_T_CMB_0 =
const_T_CMB_0_cgs /
units_general_cgs_conversion_factor(us, dimension_temperature);
} }
/** /**
......
...@@ -58,6 +58,9 @@ struct phys_const { ...@@ -58,6 +58,9 @@ struct phys_const {
/*! Thomson cross-section */ /*! Thomson cross-section */
double const_thomson_cross_section; double const_thomson_cross_section;
/*! Stefan-Boltzmann constant */
double const_stefan_boltzmann;
/*! Charge of the electron */ /*! Charge of the electron */
double const_electron_charge; double const_electron_charge;
...@@ -87,6 +90,9 @@ struct phys_const { ...@@ -87,6 +90,9 @@ struct phys_const {
/*! Mass of the Earth */ /*! Mass of the Earth */
double const_earth_mass; double const_earth_mass;
/*! Temperature of the CMB at present day */
double const_T_CMB_0;
}; };
void phys_const_init(const struct unit_system* us, struct swift_params* params, void phys_const_init(const struct unit_system* us, struct swift_params* params,
......
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
* where all the constants are defined in the system of units specified * where all the constants are defined in the system of units specified
* in the parameter file. * in the parameter file.
* *
* Of special interest if the value of G which is 0.03% different from the
* default value adopted by Gadget-2 (G = 6.672e-8).
*
* All values are taken from C. Patrignani et al. (Particle Data Group), Chin. * All values are taken from C. Patrignani et al. (Particle Data Group), Chin.
* Phys. C, 40, 100001 (2016) and 2017 update. * Phys. C, 40, 100001 (2016) and 2017 update.
* http://pdg.lbl.gov/2017/reviews/rpp2017-rev-phys-constants.pdf * http://pdg.lbl.gov/2017/reviews/rpp2017-rev-phys-constants.pdf
...@@ -56,6 +59,9 @@ const double const_avogadro_number_cgs = 6.022140857e23; ...@@ -56,6 +59,9 @@ const double const_avogadro_number_cgs = 6.022140857e23;
/*! Thomson cross-section [cm^2] */ /*! Thomson cross-section [cm^2] */
const double const_thomson_cross_section_cgs = 6.6524587158e-25; const double const_thomson_cross_section_cgs = 6.6524587158e-25;
/*! Stefan-Boltzmann constant [g s^-3 K^-4] */
const double const_stefan_boltzmann_cgs = 5.670367e-5;
/*! Elementary charge [A s^-1] */ /*! Elementary charge [A s^-1] */
const double const_electron_charge_cgs = 1.6021766208e-19; const double const_electron_charge_cgs = 1.6021766208e-19;
...@@ -86,4 +92,7 @@ const double const_solar_mass_cgs = 1.98848e33; ...@@ -86,4 +92,7 @@ const double const_solar_mass_cgs = 1.98848e33;
/*! Mass of the Earth [g] */ /*! Mass of the Earth [g] */
const double const_earth_mass_cgs = 5.9724e27; const double const_earth_mass_cgs = 5.9724e27;
/*! Temperature of the CMB at present day [K] */
const double const_T_CMB_0_cgs = 2.72556;
#endif /* SWIFT_PHYSICAL_CONSTANTS_CGS_H */ #endif /* SWIFT_PHYSICAL_CONSTANTS_CGS_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment