Commit b63664f4 authored by Matthieu Schaller's avatar Matthieu Schaller

Merge branch 'first_stars' into 'master'

First stars

See merge request swift/swiftsim!1160
parents b8dcf120 9f239167
#!/bin/bash
wget https://obswww.unige.ch/lastro/projects/Clastro/PySWIFTsim/chemistry-AGB+OMgSFeZnSrYBaEu-16072013.h5
wget https://obswww.unige.ch/lastro/projects/Clastro/PySWIFTsim/chemistry-PopIII.hdf5
......@@ -527,9 +527,12 @@ EAGLEFeedback:
# GEAR feedback model
GEARFeedback:
supernovae_energy_erg: 0.135e51 # Energy released by a single supernovae.
supernovae_energy_erg: 0.1e51 # Energy released by a single supernovae.
yields_table: chemistry-AGB+OMgSFeZnSrYBaEu-16072013.h5 # Table containing the yields.
yields_table: chemistry-PopIII.hdf5 # Table containing the yields of the first stars.
metallicity_max_first_stars: -1 # Maximal metallicity (in mass fraction) for a first star (-1 to deactivate).
discrete_yields: 0 # Should we use discrete yields or the IMF integrated one?
elements: [Fe, Mg, O, S, Zn, Sr, Y, Ba, Eu] # Elements to read in the yields table. The number of element should be one less than the number of elements (N) requested during the configuration (--with-chemistry=GEAR_N).
# Parameters related to AGN models -----------------------------------------------
......
......@@ -242,10 +242,17 @@ void feedback_evolve_spart(struct spart* restrict sp,
sp->feedback_data.enrichment_weight *= hi_inv_dim;
/* Pick the correct table. (if only one table, threshold is < 0) */
const float metal = chemistry_get_total_metal_mass_fraction_for_feedback(sp);
const float threshold = feedback_props->metallicity_max_first_stars;
const struct stellar_model* model =
metal < threshold ? &feedback_props->stellar_model_first_stars
: &feedback_props->stellar_model;
/* Compute the stellar evolution */
stellar_evolution_evolve_spart(sp, &feedback_props->stellar_model, cosmo, us,
phys_const, ti_begin, star_age_beg_step_safe,
dt);
stellar_evolution_evolve_spart(sp, model, cosmo, us, phys_const, ti_begin,
star_age_beg_step_safe, dt);
/* Transform the number of SN to the energy */
sp->feedback_data.energy_ejected =
......@@ -264,6 +271,9 @@ void feedback_struct_dump(const struct feedback_props* feedback, FILE* stream) {
stream, "feedback", "feedback function");
stellar_evolution_dump(&feedback->stellar_model, stream);
if (feedback->metallicity_max_first_stars != -1) {
stellar_evolution_dump(&feedback->stellar_model_first_stars, stream);
}
}
/**
......@@ -279,6 +289,10 @@ void feedback_struct_restore(struct feedback_props* feedback, FILE* stream) {
NULL, "feedback function");
stellar_evolution_restore(&feedback->stellar_model, stream);
if (feedback->metallicity_max_first_stars != -1) {
stellar_evolution_restore(&feedback->stellar_model_first_stars, stream);
}
}
/**
......@@ -289,4 +303,7 @@ void feedback_struct_restore(struct feedback_props* feedback, FILE* stream) {
void feedback_clean(struct feedback_props* feedback) {
stellar_evolution_clean(&feedback->stellar_model);
if (feedback->metallicity_max_first_stars != -1) {
stellar_evolution_clean(&feedback->stellar_model_first_stars);
}
}
......@@ -31,11 +31,14 @@ struct feedback_props {
/*! Energy per supernovae */
float energy_per_supernovae;
/*! filename of the chemistry table */
char filename[PARSER_MAX_LINE_SIZE];
/*! The stellar model */
struct stellar_model stellar_model;
/*! The stellar model for first stars */
struct stellar_model stellar_model_first_stars;
/* Metallicity limits for the first stars */
float metallicity_max_first_stars;
};
/**
......@@ -51,13 +54,36 @@ __attribute__((always_inline)) INLINE static void feedback_props_print(
return;
}
/* Print the name of the elements */
char txt[GEAR_CHEMISTRY_ELEMENT_COUNT * (GEAR_LABELS_SIZE + 2)] = "";
for (int i = 0; i < GEAR_CHEMISTRY_ELEMENT_COUNT; i++) {
if (i != 0) {
strcat(txt, ", ");
}
strcat(txt, stellar_evolution_get_element_name(
&feedback_props->stellar_model, i));
}
if (engine_rank == 0) {
message("Chemistry elements: %s", txt);
}
/* Print the feedback properties */
message("Energy per supernovae = %.2g",
feedback_props->energy_per_supernovae);
message("Yields table = %s", feedback_props->filename);
message("Yields table = %s", feedback_props->stellar_model.yields_table);
/* Print the stellar model */
stellar_model_print(&feedback_props->stellar_model);
/* Print the first stars */
if (feedback_props->metallicity_max_first_stars != -1) {
message("Yields table first stars = %s",
feedback_props->stellar_model_first_stars.yields_table);
stellar_model_print(&feedback_props->stellar_model_first_stars);
message("Metallicity max for the first stars (in mass fraction) = %g",
feedback_props->metallicity_max_first_stars);
}
}
/**
......@@ -81,13 +107,33 @@ __attribute__((always_inline)) INLINE static void feedback_props_init(
e_feedback /= units_cgs_conversion_factor(us, UNIT_CONV_ENERGY);
fp->energy_per_supernovae = e_feedback;
/* filename of the chemistry table */
parser_get_param_string(params, "GEARFeedback:yields_table", fp->filename);
/* filename of the chemistry tables. */
parser_get_param_string(params, "GEARFeedback:yields_table",
fp->stellar_model.yields_table);
/* Initialize the stellar model */
/* Initialize the stellar models. */
stellar_evolution_props_init(&fp->stellar_model, phys_const, us, params,
cosmo);
/* Now the same for first stars. */
fp->metallicity_max_first_stars = parser_get_opt_param_float(
params, "GEARFeedback:metallicity_max_first_stars", -1);
if (fp->metallicity_max_first_stars == -1) {
message("First stars are disabled.");
} else {
if (fp->metallicity_max_first_stars < 0) {
error(
"The metallicity threshold for the first stars is in mass fraction. "
"It cannot be lower than 0.");
}
message("Reading the stellar model for the first stars");
parser_get_param_string(params, "GEARFeedback:yields_table_first_stars",
fp->stellar_model_first_stars.yields_table);
stellar_evolution_props_init(&fp->stellar_model_first_stars, phys_const, us,
params, cosmo);
}
/* Print the stellar properties */
feedback_props_print(fp);
......
......@@ -333,15 +333,15 @@ void initial_mass_function_compute_coefficients(
*
* @param imf The #initial_mass_function.
* @param params The #swift_params.
* @param filename The filename of the chemistry table.
*/
void initial_mass_function_read_from_table(struct initial_mass_function *imf,
struct swift_params *params) {
struct swift_params *params,
const char *filename) {
hid_t file_id, group_id;
/* Open IMF group */
char filename[FILENAME_BUFFER_SIZE];
parser_get_param_string(params, "GEARFeedback:yields_table", filename);
h5_open_group(filename, "Data/IMF", &file_id, &group_id);
/* Read number of parts */
......@@ -381,58 +381,6 @@ void initial_mass_function_read_from_table(struct initial_mass_function *imf,
h5_close_group(file_id, group_id);
}
/**
* @brief Reads the parameters file and if required overwrites the parameters
* found in the yields table.
*
* @param imf The #initial_mass_function.
* @param params The #swift_params.
*/
void initial_mass_function_read_from_params(struct initial_mass_function *imf,
struct swift_params *params) {
/* Read the number of elements */
const int n_parts = parser_get_opt_param_int(
params, "GEARInitialMassFunction:number_function_part", imf->n_parts);
const int n_parts_changed = n_parts != imf->n_parts;
imf->n_parts = n_parts;
/* Reallocate the exponent memory */
if (n_parts_changed) {
free(imf->exp);
if ((imf->exp = (float *)malloc(sizeof(float) * imf->n_parts)) == NULL)
error("Failed to allocate the IMF exponents.");
}
/* Read the exponents */
const char *exponent_name = "GEARInitialMassFunction:exponents";
if (n_parts_changed) {
parser_get_param_float_array(params, exponent_name, imf->n_parts, imf->exp);
} else {
parser_get_opt_param_float_array(params, exponent_name, imf->n_parts,
imf->exp);
}
/* Reallocate the mass limits memory */
if (n_parts_changed) {
free(imf->mass_limits);
if ((imf->mass_limits =
(float *)malloc(sizeof(float) * (imf->n_parts + 1))) == NULL)
error("Failed to allocate the IMF masses.");
}
/* Read the mass limits */
const char *mass_limits_name = "GEARInitialMassFunction:mass_limits_msun";
if (n_parts_changed) {
parser_get_param_float_array(params, mass_limits_name, imf->n_parts + 1,
imf->mass_limits);
} else {
parser_get_opt_param_float_array(params, mass_limits_name, imf->n_parts + 1,
imf->mass_limits);
}
}
/**
* @brief Initialize the initial mass function.
*
......@@ -440,17 +388,16 @@ void initial_mass_function_read_from_params(struct initial_mass_function *imf,
* @param phys_const The #phys_const.
* @param us The #unit_system.
* @param params The #swift_params.
* @param filename The filename of the chemistry table.
*/
void initial_mass_function_init(struct initial_mass_function *imf,
const struct phys_const *phys_const,
const struct unit_system *us,
struct swift_params *params) {
struct swift_params *params,
const char *filename) {
/* Read the parameters from the yields table */
initial_mass_function_read_from_table(imf, params);
/* Overwrites the parameters if found in the params file */
initial_mass_function_read_from_params(imf, params);
initial_mass_function_read_from_table(imf, params, filename);
/* Write the masses in the correct attributes */
imf->mass_min = imf->mass_limits[0];
......
......@@ -41,14 +41,14 @@ void initial_mass_function_compute_coefficients(
struct initial_mass_function *imf);
void initial_mass_function_read_from_table(struct initial_mass_function *imf,
struct swift_params *params);
void initial_mass_function_read_from_params(struct initial_mass_function *imf,
struct swift_params *params);
struct swift_params *params,
const char *filename);
void initial_mass_function_init(struct initial_mass_function *imf,
const struct phys_const *phys_const,
const struct unit_system *us,
struct swift_params *params);
struct swift_params *params,
const char *filename);
void initial_mass_function_dump(const struct initial_mass_function *imf,
FILE *stream, const struct stellar_model *sm);
......
......@@ -124,15 +124,14 @@ lifetime_get_log_mass_from_lifetime(const struct lifetime* life, float log_time,
*
* @param lt The #lifetime.
* @param params The #swift_params.
* @param filename The filename of the chemistry table.
*/
__attribute__((always_inline)) INLINE static void lifetime_read_from_tables(
struct lifetime* lt, struct swift_params* params) {
struct lifetime* lt, struct swift_params* params, const char* filename) {
hid_t file_id, group_id;
/* Open IMF group */
char filename[256];
parser_get_param_string(params, "GEARFeedback:yields_table", filename);
h5_open_group(filename, "Data/LifeTimes", &file_id, &group_id);
/* Allocate the temporary array */
......@@ -156,28 +155,6 @@ __attribute__((always_inline)) INLINE static void lifetime_read_from_tables(
h5_close_group(file_id, group_id);
}
/**
* @brief Read lifetime parameters from params.
*
* @param lt The #lifetime.
* @param params The #swift_params.
*/
__attribute__((always_inline)) INLINE static void lifetime_read_from_params(
struct lifetime* lt, struct swift_params* params) {
/* Read quadratic terms */
parser_get_opt_param_float_array(params, "GEARLifetime:quadratic", 3,
lt->quadratic);
/* Read linear terms */
parser_get_opt_param_float_array(params, "GEARLifetime:linear", 3,
lt->linear);
/* Read constant terms */
parser_get_opt_param_float_array(params, "GEARLifetime:constant", 3,
lt->constant);
}
/**
* @brief Inititialize the Lifetime.
*
......@@ -185,16 +162,15 @@ __attribute__((always_inline)) INLINE static void lifetime_read_from_params(
* @param phys_const The #phys_const.
* @param us The #unit_system.
* @param params The #swift_params.
* @param filename The filename of the chemistry table.
*/
__attribute__((always_inline)) INLINE static void lifetime_init(
struct lifetime* lt, const struct phys_const* phys_const,
const struct unit_system* us, struct swift_params* params) {
const struct unit_system* us, struct swift_params* params,
const char* filename) {
/* Read params from yields table */
lifetime_read_from_tables(lt, params);
/* overwrite the parameters if found in the params */
lifetime_read_from_params(lt, params);
lifetime_read_from_tables(lt, params, filename);
/* Change units from yr into Myr */
const int dim = 3;
......
......@@ -382,42 +382,37 @@ const char* stellar_evolution_get_element_name(const struct stellar_model* sm,
void stellar_evolution_read_elements(struct stellar_model* sm,
struct swift_params* params) {
hid_t file_id, group_id;
/* Open IMF group */
h5_open_group(sm->yields_table, "Data", &file_id, &group_id);
/* Read the elements */
io_read_string_array_attribute(group_id, "elts", sm->elements_name,
GEAR_CHEMISTRY_ELEMENT_COUNT,
GEAR_LABELS_SIZE);
/* Check that we received correctly the metals */
if (strcmp(stellar_evolution_get_element_name(
sm, GEAR_CHEMISTRY_ELEMENT_COUNT - 1),
"Metals") != 0) {
/* Read the elements from the parameter file. */
int nval = -1;
char** elements;
parser_get_param_string_array(params, "GEARFeedback:elements", &nval,
&elements);
/* Check that we have the correct number of elements. */
if (nval != GEAR_CHEMISTRY_ELEMENT_COUNT - 1) {
error(
"The chemistry table should contain the metals in the last column "
"(found %s)",
stellar_evolution_get_element_name(sm,
GEAR_CHEMISTRY_ELEMENT_COUNT - 1));
"You need to provide %i elements but found %i. "
"If you wish to provide a different number of elements, "
"you need to compile with --with-chemistry=GEAR_N where N "
"is the number of elements + 1.",
GEAR_CHEMISTRY_ELEMENT_COUNT, nval);
}
/* Print the name of the elements */
char txt[GEAR_CHEMISTRY_ELEMENT_COUNT * (GEAR_LABELS_SIZE + 2)] = "";
for (int i = 0; i < GEAR_CHEMISTRY_ELEMENT_COUNT; i++) {
if (i != 0) {
strcat(txt, ", ");
/* Copy the elements into the stellar model. */
for (int i = 0; i < nval; i++) {
if (strlen(elements[i]) >= GEAR_LABELS_SIZE) {
error("Element name '%s' too long", elements[i]);
}
strcat(txt, stellar_evolution_get_element_name(sm, i));
strcpy(sm->elements_name + i * GEAR_LABELS_SIZE, elements[i]);
}
if (engine_rank == 0) {
message("Chemistry elements: %s", txt);
}
/* Cleanup. */
parser_free_param_string_array(nval, elements);
/* Cleanup everything */
h5_close_group(file_id, group_id);
/* Add the metals to the end. */
strcpy(
sm->elements_name + (GEAR_CHEMISTRY_ELEMENT_COUNT - 1) * GEAR_LABELS_SIZE,
"Metals");
}
/**
......@@ -435,10 +430,6 @@ void stellar_evolution_props_init(struct stellar_model* sm,
struct swift_params* params,
const struct cosmology* cosmo) {
/* Get filename. */
parser_get_param_string(params, "GEARFeedback:yields_table",
sm->yields_table);
/* Read the list of elements */
stellar_evolution_read_elements(sm, params);
......@@ -447,10 +438,11 @@ void stellar_evolution_props_init(struct stellar_model* sm,
parser_get_param_int(params, "GEARFeedback:discrete_yields");
/* Initialize the initial mass function */
initial_mass_function_init(&sm->imf, phys_const, us, params);
initial_mass_function_init(&sm->imf, phys_const, us, params,
sm->yields_table);
/* Initialize the lifetime model */
lifetime_init(&sm->lifetime, phys_const, us, params);
lifetime_init(&sm->lifetime, phys_const, us, params, sm->yields_table);
/* Initialize the supernovae Ia model */
supernovae_ia_init(&sm->snia, phys_const, us, params, sm);
......
......@@ -168,26 +168,32 @@ float supernovae_ia_get_number_per_unit_mass(const struct supernovae_ia *snia,
* @param snia The #supernovae_ia model.
* @param params The #swift_params.
* @param sm The #stellar_model.
* @param filename The filename of the chemistry table.
*/
void supernovae_ia_read_yields(struct supernovae_ia *snia,
struct swift_params *params,
const struct stellar_model *sm) {
const struct stellar_model *sm,
const char *filename) {
hid_t file_id, group_id;
const int number_labels = GEAR_CHEMISTRY_ELEMENT_COUNT + 2;
/* Open IMF group */
char filename[FILENAME_BUFFER_SIZE];
parser_get_param_string(params, "GEARFeedback:yields_table", filename);
h5_open_group(filename, "Data/SNIa/Metals", &file_id, &group_id);
/* Get the number of elements. */
const hid_t attr = H5Aopen(group_id, "elts", H5P_DEFAULT);
if (attr < 0) error("Error while opening attribute elts in Data/SNIa/Metals");
size_t nval = io_get_number_element_in_attribute(attr);
H5Aclose(attr);
/* Read the yields */
float *yields = (float *)malloc(sizeof(float) * number_labels);
io_read_array_attribute(group_id, "data", FLOAT, yields, number_labels);
float *yields = (float *)malloc(sizeof(float) * nval);
io_read_array_attribute(group_id, "data", FLOAT, yields, nval);
/* Read the labels */
char labels[(GEAR_CHEMISTRY_ELEMENT_COUNT + 2) * GEAR_LABELS_SIZE] = "";
io_read_string_array_attribute(group_id, "elts", labels, number_labels,
char *labels = malloc(nval * GEAR_LABELS_SIZE);
io_read_string_array_attribute(group_id, "elts", labels, nval,
GEAR_LABELS_SIZE);
/* Save the yields */
......@@ -195,7 +201,7 @@ void supernovae_ia_read_yields(struct supernovae_ia *snia,
for (int i = 0; i < GEAR_CHEMISTRY_ELEMENT_COUNT; i++) {
int found = 0;
/* Loop over SNIa yields labels */
for (int j = 0; j < number_labels; j++) {
for (size_t j = 0; j < nval; j++) {
const char *s1 = labels + j * GEAR_LABELS_SIZE;
const char *s2 = stellar_evolution_get_element_name(sm, i);
if (strcmp(s1, s2) == 0) {
......@@ -207,13 +213,14 @@ void supernovae_ia_read_yields(struct supernovae_ia *snia,
/* Check if found an element */
if (!found) {
error("Cannot find element %s in SNIa yields",
error("Cannot find element '%s' in SNIa yields",
stellar_evolution_get_element_name(sm, i));
}
}
/* Cleanup everything */
free(yields);
free(labels);
h5_close_group(file_id, group_id);
};
......@@ -242,15 +249,15 @@ void supernovae_ia_init_companion(struct supernovae_ia *snia) {
*
* @param snia The #supernovae_ia model.
* @param params The simulation parameters.
* @param filename The filename of the chemistry table.
*/
void supernovae_ia_read_from_tables(struct supernovae_ia *snia,
struct swift_params *params) {
struct swift_params *params,
const char *filename) {
hid_t file_id, group_id;
/* Open IMF group */
char filename[FILENAME_BUFFER_SIZE];
parser_get_param_string(params, "GEARFeedback:yields_table", filename);
h5_open_group(filename, "Data/SNIa", &file_id, &group_id);
/* Read the exponent of the IMF for companion */
......@@ -295,62 +302,6 @@ void supernovae_ia_read_from_tables(struct supernovae_ia *snia,
h5_close_group(file_id, group_id);
}
/**
* @brief Reads the supernovae Ia parameters from the parameters file.
*
* @param snia The #supernovae_ia model.
* @param params The simulation parameters.
*/
void supernovae_ia_read_from_params(struct supernovae_ia *snia,
struct swift_params *params) {
/* Read the exponent of the IMF for companion */
snia->companion_exponent = parser_get_opt_param_float(
params, "GEARSupernovaeIa:exponent", snia->companion_exponent);
/* Read the minimal mass for a white dwarf */
snia->mass_min_progenitor = parser_get_opt_param_float(
params, "GEARSupernovaeIa:min_mass_white_dwarf_progenitor",
snia->mass_min_progenitor);
/* Read the maximal mass for a white dwarf */
snia->mass_max_progenitor = parser_get_opt_param_float(
params, "GEARSupernovaeIa:max_mass_white_dwarf_progenitor",
snia->mass_max_progenitor);
/* Read the maximal mass of a red giant companion */
snia->companion[0].mass_max =
parser_get_opt_param_float(params, "GEARSupernovaeIa:max_mass_red_giant",
snia->companion[0].mass_max);
/* Read the minimal mass of a red giant companion */
snia->companion[0].mass_min =
parser_get_opt_param_float(params, "GEARSupernovaeIa:min_mass_red_giant",
snia->companion[0].mass_min);
/* Read the coefficient of the main sequence companion */
snia->companion[0].coef = parser_get_opt_param_float(
params, "GEARSupernovaeIa:coef_red_giant", snia->companion[0].coef);
/* Read the maximal mass of a main sequence companion */
snia->companion[1].mass_max = parser_get_opt_param_float(
params, "GEARSupernovaeIa:max_mass_main_sequence",
snia->companion[1].mass_max);
/* Read the minimal mass of a main sequence companion */
snia->companion[1].mass_min = parser_get_opt_param_float(
params, "GEARSupernovaeIa:min_mass_main_sequence",
snia->companion[1].mass_min);
/* Read the coefficient of the main sequence companion */
snia->companion[1].coef = parser_get_opt_param_float(
params, "GEARSupernovaeIa:coef_main_sequence", snia->companion[1].coef);
/* Read the mass of a white dwarf */
snia->mass_white_dwarf = parser_get_opt_param_float(
params, "GEARSupernovaeIa:white_dwarf_mass", snia->mass_white_dwarf);
}
/**
* @brief Initialize the #supernovae_ia structure.
*
......@@ -367,13 +318,10 @@ void supernovae_ia_init(struct supernovae_ia *snia,
const struct stellar_model *sm) {
/* Read the parameters from the tables */
supernovae_ia_read_from_tables(snia, params);
/* Read the parameters from the params file */
supernovae_ia_read_from_params(snia, params);
supernovae_ia_read_from_tables(snia, params, sm->yields_table);
/* Read the yields */
supernovae_ia_read_yields(snia, params, sm);
supernovae_ia_read_yields(snia, params, sm, sm->yields_table);
/* Get the IMF parameters */
snia->progenitor_exponent = initial_mass_function_get_exponent(
......
......@@ -37,15 +37,14 @@ float supernovae_ia_get_number_per_unit_mass(const struct supernovae_ia *snia,
void supernovae_ia_read_yields(struct supernovae_ia *snia,
struct swift_params *params,
const struct stellar_model *sm);
const struct stellar_model *sm,
const char *filename);
void supernovae_ia_init_companion(struct supernovae_ia *snia);
void supernovae_ia_read_from_tables(struct supernovae_ia *snia,
struct swift_params *params);
void supernovae_ia_read_from_params(struct supernovae_ia *snia,
struct swift_params *params);
struct swift_params *params,
const char *filename);
void supernovae_ia_init(struct supernovae_ia *snia,
const struct phys_const *phys_const,
......
......@@ -318,38 +318,20 @@ void supernovae_ii_read_yields(struct supernovae_ii *snii,
h5_close_group(file_id, group_id);
};
/**
* @brief Reads the supernovae II parameters from parameters file.
*
* @param snii The #supernovae_ii model.
* @param params The simulation parameters.
*/
void supernovae_ii_read_from_params(struct supernovae_ii *snii,
struct swift_params *params) {
/* Read the minimal mass of a supernovae */
snii->mass_min = parser_get_opt_param_float(
params, "GEARSupernovaeII:min_mass", snii->mass_min);
/* Read the maximal mass of a supernovae */
snii->mass_max = parser_get_opt_param_float(
params, "GEARSupernovaeII:max_mass", snii->mass_max);
}
/**
* @brief Reads the supernovae II parameters from tables.
*
* @param snii The #supernovae_ii model.
* @param params The simulation parameters.
* @param filename The filename of the chemistry table.
*/
void supernovae_ii_read_from_tables(struct supernovae_ii *snii,
struct swift_params *params) {
struct swift_params *params,
const char *filename) {
hid_t file_id, group_id;
/* Open IMF group */
char filename[FILENAME_BUFFER_SIZE];
parser_get_param_string(params, "GEARFeedback:yields_table", filename);
h5_open_group(filename, "Data/SNII", &file_id, &group_id);
/* Read the minimal mass of a supernovae */
......@@ -373,10 +355,7 @@ void supernovae_ii_init(struct supernovae_ii *snii, struct swift_params *params,
const struct stellar_model *sm) {
/* Read the parameters from the tables */
supernovae_ii_read_from_tables(snii, params);
/* Read the parameters from the params file */
supernovae_ii_read_from_params(snii, params);
supernovae_ii_read_from_tables(snii, params, sm->yields_table);
/* Read the supernovae yields */
supernovae_ii_read_yields(snii, params, sm, /* restart */ 0);
......
......@@ -60,7 +60,8 @@ void supernovae_ii_read_from_params(struct supernovae_ii *snii,
struct swift_params *params);
void supernovae_ii_read_from_tables(struct supernovae_ii *snii,
struct swift_params *params);
struct swift_params *params,
const char *filename);
void supernovae_ii_init(struct supernovae_ii *snii, struct swift_params *params,
const struct stellar_model *sm);
void supernovae_ii_dump(const struct supernovae_ii *snii, FILE *stream,
......
Markdown is supported
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