From b913d21eae0e91f542c724e2cc544f192238a81d Mon Sep 17 00:00:00 2001 From: Loic Hausammann <loic.hausammann@protonmail.ch> Date: Mon, 11 May 2020 18:06:23 +0100 Subject: [PATCH] GEAR: update doc --- .../SubgridModels/GEAR/feedback_table.dot | 178 ++++++++++++++++++ doc/RTD/source/SubgridModels/GEAR/index.rst | 24 ++- doc/RTD/source/conf.py | 5 + src/feedback/GEAR/lifetime.h | 2 +- 4 files changed, 205 insertions(+), 4 deletions(-) create mode 100644 doc/RTD/source/SubgridModels/GEAR/feedback_table.dot diff --git a/doc/RTD/source/SubgridModels/GEAR/feedback_table.dot b/doc/RTD/source/SubgridModels/GEAR/feedback_table.dot new file mode 100644 index 0000000000..b0bc7f4230 --- /dev/null +++ b/doc/RTD/source/SubgridModels/GEAR/feedback_table.dot @@ -0,0 +1,178 @@ + +digraph feedback { + subgraph cluster_data { + Data[shape="none", label=< + <table BORDER="0"> + <tr> + <td><u>Data</u></td> + </tr> + <tr> + <td>elts</td> + </tr> + <tr> + <td>MeanWDMass</td> + </tr> + <tr> + <td>SolarMassAbundances</td> + </tr> + </table>>]; + } + + subgraph cluster_imf { + IMF[shape="none", label=< + <table BORDER="0"> + <tr> + <td><u>IMF</u></td> + </tr> + <tr> + <td>n</td> + </tr> + <tr> + <td>as</td> + </tr> + <tr> + <td>ms</td> + </tr> + <tr> + <td>Mmin</td> + </tr> + <tr> + <td>Mmax</td> + </tr></table>>]; + } + subgraph cluster_lifetimes { + LifeTimes[label=<<u>LifeTimes</u>>,shape="none"]; + } + subgraph cluster_snii { + SNII[shape="none", label=< + <table BORDER="0"> + <tr> + <td><u>SNII</u></td> + </tr> + <tr> + <td>Mmin</td> + </tr> + <tr> + <td>Mmax</td> + </tr> + </table>>]; + } + + subgraph cluster_snia { + SNIa[shape="none", label=< + <table BORDER="0"> + <tr> + <td><u>SNIa</u></td> + </tr> + <tr> + <td>a</td> + </tr> + <tr> + <td>Mpl</td> + </tr> + <tr> + <td>Mpu</td> + </tr> + <tr> + <td>Mdu1</td> + </tr> + <tr> + <td>Mdl1</td> + </tr> + <tr> + <td>bb1</td> + </tr> + <tr> + <td>Mdu2</td> + </tr> + <tr> + <td>Mdl2</td> + </tr> + <tr> + <td>bb2</td> + </tr> + </table>>]; + } + + + subgraph cluster_snii_all { + graph[style="dotted"]; + snii_all[shape="none", label=< + <table BORDER="0"> + <tr> + <td><u>An array per element</u></td> + </tr> + <tr> + <td>min</td> + </tr> + <tr> + <td>step</td> + </tr> + </table>>]; + } + + subgraph cluster_snii_ej { + graph[style="dotted"]; + snii_ej[shape="none", label=< + <table BORDER="0"> + <tr> + <td><u>Ej</u></td> + </tr> + <tr> + <td>min</td> + </tr> + <tr> + <td>step</td> + </tr> + </table>>]; + } + + subgraph cluster_snii_ejnp { + graph[style="dotted"]; + snii_ejnp[shape="none", label=< + <table BORDER="0"> + <tr> + <td><u>Ejnp</u></td> + </tr> + <tr> + <td>min</td> + </tr> + <tr> + <td>step</td> + </tr> + </table>>]; + } + + subgraph cluster_coeff_z { + graph[style="dotted"]; + coeff_z[label=<<u>coeff_z</u>>, shape="none"]; + } + + subgraph cluster_snia_metals { + snia_metals[shape="none", label=< + <table BORDER="0"> + <tr> + <td><u>Metals</u></td> + </tr> + <tr> + <td>elts</td> + </tr> + <tr> + <td>data</td> + </tr> + </table>>]; + } + + Data->LifeTimes; + Data->IMF; + Data->SNII; + Data->SNIa; + + LifeTimes->coeff_z; + + SNII->snii_all; + SNII->snii_ej; + SNII->snii_ejnp; + + SNIa->snia_metals; +} \ No newline at end of file diff --git a/doc/RTD/source/SubgridModels/GEAR/index.rst b/doc/RTD/source/SubgridModels/GEAR/index.rst index 1aba2ca396..89ee949fb3 100644 --- a/doc/RTD/source/SubgridModels/GEAR/index.rst +++ b/doc/RTD/source/SubgridModels/GEAR/index.rst @@ -115,7 +115,7 @@ A star will be able to form if a randomly drawn number is below :math:`\frac{m_g Chemistry ~~~~~~~~~ -In the chemistry, we are using the smoothed metallicity scheme that consists in using the SPH to smooth the metallicity of each particle over the neighbors. It is worth to point the fact that we are not exchanging any metals but only smoothing it. The parameter ``GEARChemistry:initial_metallicity`` set the initial mass fraction of each element for all the particles and ``GEARChemistry:scale_initial_metallicity`` use the feedback table to scale the initial metallicity of each element according the Sun's composition. +In the chemistry, we are using the smoothed metallicity scheme that consists in using the SPH to smooth the metallicity of each particle over the neighbors. It is worth to point the fact that we are not exchanging any metals but only smoothing it. The parameter ``GEARChemistry:initial_metallicity`` set the (non smoothed) initial mass fraction of each element for all the particles and ``GEARChemistry:scale_initial_metallicity`` use the feedback table to scale the initial metallicity of each element according the Sun's composition. .. code:: YAML @@ -145,6 +145,7 @@ Initial mass function GEAR is using the IMF model from `Kroupa (2001) <https://ui.adsabs.harvard.edu/abs/2001MNRAS.322..231K/abstract>`_. We have a difference of 1 in the exponent due to the usage of IMF in mass and not in number. We also restrict the mass of the stars to be inside :math:`[0.05, 50] M_\odot`. +Here is the default model used, but it can be easily adapted through the initial mass function parameters: .. math:: \xi(m) \propto m^{-\alpha_i}\, \textrm{where}\, @@ -156,8 +157,6 @@ We also restrict the mass of the stars to be inside :math:`[0.05, 50] M_\odot`. \end{cases} - - Lifetime ^^^^^^^^ @@ -170,6 +169,7 @@ The lifetime of a star in GEAR depends only on two parameters: first its mass an c(Z) = -261.365 Z^2 + 17.073 Z + 9.8661 where :math:`\tau` is the lifetime in years, :math:`m` is the mass of the star (in solar mass) and Z the metallicity of the star. +The parameters previously given are the default ones, they can be modified in the parameters file. Supernovae II ^^^^^^^^^^^^^ @@ -215,6 +215,24 @@ Energy injection All the supernovae (type II and Ia) inject the same amount of energy into the surrounding gas (``GEARFeedback:supernovae_energy_erg``) and distribute it according to the hydro kernel. The same is done with the metals and the mass. + +Generating a new table +^^^^^^^^^^^^^^^^^^^^^^ + +The feedback table is an HDF5 file with the following structure: + +.. graphviz:: feedback_table.dot + +where the solid (dashed) squares represent a group (a dataset) with the name of the object underlined and the attributes written below. Everything is in solar mass or without units (e.g. mass fraction or unitless constant). +In ``Data``, the attribute ``elts`` is an array of string with the element names (the last should be ``Metals``, it corresponds to the sum of all the elements), ``MeanWDMass`` is the mass of the white dwarfs +and ``SolarMassAbundances`` is an array of float containing the mass fraction of the different element in the sun. +In ``IMF``, ``n + 1`` is the number of part in the IMF, ``as`` are the exponent (``n+1`` elements), ``ms`` are the mass limits between each part (``n`` elements) and +``Mmin`` (``Mmax``) is the minimal (maximal) mass of a star. +In ``LifeTimes``, the coefficient are given in the form of a single table (``coeff_z`` with a 3x3 shape). +In ``SNIa``, ``a`` is the exponent of the distribution of binaries, ``bb1`` and ``bb2`` are the coefficient :math:`b_i` and the other attributes follow the same names than in the SNIa formulas. +The ``Metals`` group from the ``SNIa`` contains the name of each elements (``elts``) and the metal mass fraction ejected by each supernovae (``data``) in the same order. They must contain the same elements than in ``Data``. +Finally for the ``SNII``, the mass limits are given by ``Mmin`` and ``Mmax``. For the yields, the datasets required are ``Ej`` (mass fraction ejected [processed]), ``Ejnp`` (mass fraction ejected [non processed]) and one dataset for each element present in ``elts``. The datasets should all have the same size, be uniformly sampled in log and contains the attributes ``min`` (mass in log for the first element) and ``step`` (difference of mass in log between two elements). + .. code:: YAML GEARFeedback: diff --git a/doc/RTD/source/conf.py b/doc/RTD/source/conf.py index c6659cb19b..e4cdb061be 100644 --- a/doc/RTD/source/conf.py +++ b/doc/RTD/source/conf.py @@ -41,6 +41,11 @@ extensions = [ 'sphinx.ext.todo', 'sphinx.ext.mathjax', 'sphinx.ext.githubpages', + 'sphinx.ext.graphviz' +] + +graphviz_dot_args=[ + "-Grankdir=LR" ] # Add any paths that contain templates here, relative to this directory. diff --git a/src/feedback/GEAR/lifetime.h b/src/feedback/GEAR/lifetime.h index f855827ad5..5025fb0904 100644 --- a/src/feedback/GEAR/lifetime.h +++ b/src/feedback/GEAR/lifetime.h @@ -133,7 +133,7 @@ __attribute__((always_inline)) INLINE static void lifetime_read_from_tables( /* Open IMF group */ char filename[256]; parser_get_param_string(params, "GEARFeedback:yields_table", filename); - h5_open_group(filename, "Data/LiveTimes", &file_id, &group_id); + h5_open_group(filename, "Data/LifeTimes", &file_id, &group_id); /* Allocate the temporary array */ float* tmp; -- GitLab