STEP 7: Changing the model [OPTIONAL]
Default vs. Modified model
Input files (i.e. the .par files) are provided for the Default Model (DM) and Modified Model (MM) versions of L-Galaxies 2020 (see Yates+21a for details).
In brief, the Default Model allows the majority of material released by supernovae and stellar winds to mix with the ambient ColdGas before some is blown out as galactic winds.
The Modified Model allows the majority of this newly-released material to be directly ejected into the surrounding HotGas, without first mixing with the ColdGas.
The Modified Model is recommended, as it more accurately reproduces the chemical evolution of galaxies and their surroundings above redshift 0 (see Yates+21a).
You can select the Default Model or Modified Model by using the an input file with a "DM" or "MM" suffix, respectively.
Millennium-I vs. Millennium-II
By default, L-Galaxies 2020 will try to run on Millennium-I merger trees. To switch to Millennium-II, make sure you've downloaded some Millennium-II treefiles (see STEP 2), and then do the following:
- Open the My_Makefile_options file in the project root directory
- Uncomment the MRII switch
- Save and close My_Makefile_options
- Use the default model (DM) or modified model (MM) Millennium-II input files as the argument when running the code (see STEP 5 above):
- input_MRII_W1_PLANCK_LGals2020_DM.par
- input_MRII_W1_PLANCK_LGals2020_MM.par
Snapshot vs. Galaxytree mode
Snapshot mode (the default for L-Galaxies 2020) will only output data for a user-defined set of redshifts (i.e. snapshots).
Galaxytree mode will instead output data from all snapshots, along with the IDs needed to link a given galaxy to its progenitors and descendents (note that this generates much larger output files).
To use/modify snapshot mode:
- Open desired_output_redshifts.txt in the /inputs folder
- Add the redshifts you wish to be outputted to the top of this file, one on each line, with an empty line at the end of your list (L-Galaxies will match these to their nearest snapshots automatically)
- Open the My_Makefile_options file in the project root directory
- Set the NOUT parameter to equal the number of redshifts you set to be outputted in desired_output_redshifts.txt
- Make sure that the GALAXYTREE switch is commented-out
- Save and close My_Makefile_options
- Compile and run L-Galaxies 2020 as described in STEP 5
To use galaxytree mode:
- Open the My_Makefile_options file in the project root directory
- Uncomment the GALAXYTREE switch
- Save and close My_Makefile_options
- Compile and run L-Galaxies 2020 as described in STEP 5
MCMC mode
For detailed instructions on how to run L-Galaxies in MCMC mode, in order to retune model parameters,
see the MCMC instructions kindly provided by Marcel van Daalen.
Changing the output file name
- Open the input file you wish to use (see above) in the /inputs folder
- Change FileNameGalaxies to an appropriate name. This will be the prefix in the name of the output file(s) that L-Galaxies generates.
- Save and close the input file
- Compile and run L-Galaxies 2020 as described in STEP 5
- Remember to modify the variables used to read-in L-Galaxies outputs in main_lgals.py too (e.g. the VERSION variable).
Changing the treefiles used
- Open the input file you wish to use (see above) in the /inputs folder
- Set FirstFile to the first treefile you wish to use
- Set LastFile to the last treefile you wish to use
- Save and close the input file
- Compile and run L-Galaxies 2020 as described in STEP 5
- Remember to modify the variables used to read-in L-Galaxies outputs in main_lgals.py too (i.e. FirstFile and LastFile).
To run L-Galaxies 2020 on the full set of Millennium-I or II trees, set FirstFile to 0 and LastFile to 511.
For testing purposes on Millennium-I, treefile 5 alone is normally sufficient.
For quick but statistically-significant runs on Millennium-I, treefiles 0-9 are normally sufficient.
For quick but statistically-significant runs on Millennium-II, treefiles 40-79 are normally sufficient.
Model switches
L-Galaxies 2020 comes with a series of pre-defined model options (or "switches") that change the physics models used, the treefiles used, which properties are tracked/outputted, etc.
These switches are defined in the My_Makefile_options file in the project root directory.
There meanings should be quite self explanatory, but if you are unsure, feel free to ask!
You are also able to add your own switches to your version of the code.
These should be defined in My_Makefile_options and then utilised in the necessary code files via "ifdef statements" (or equivalent).
For example, to create a switch which prevents the property BulgeMassRings from being outputted:
- Open My_Makefile_options in the project root directory
- Add the following line:
- OPT += -DNO_BULGEMASSRINGS_OUTPUT
- Save and close My_Makefile_options
- Put the following ifdef statement around the instances of BulgeMassRings in h_galaxy_output.h and save.c (see below for more details):
- #ifndef NO_BULGEMASSRINGS_OUTPUT
- ...
- #endif //NO_BULGEMASSRINGS_OUTPUT
- Save and close the code files
If working with binary output files, this modification will be automatically updated in the python structure saved in /AuxCode/Python/ as auto_LGalaxy_struct.py during compilation.
Changing which properties are outputted
You are free to customise which properties are actually outputted by L-Galaxies 2020.
This is done as follows:
- Open h_galaxy_output.h in the /code folder
- In the GALAXY_OUTPUT structure, add/comment-out the property you wish to be outputted/not outputted
For example, to remove BulgeMassRings, either put it in a newly-defined #ifndef (see above) or directly comment it out:
- // float BulgeMassRings[RNUM];
- Save and close h_galaxy_output.h
- Open save.c in the /code folder
- In the prepare_galaxy_for_output() function, add/comment-out the property you wish to be outputted/not outputted
For example, to remove BulgeMassRings, either put it in a newly-defined #ifndef (see above) or directly comment it out:
- // o->BulgeMassRings[ll] = g->BulgeMassRings[ll];
- Save and close save.c
If running with the HDF5_OUTPUT switch on, all your modifications will automatically be known by main_lgals.py when reading-in your newly-generated output files.
If running with binary output files, as mentioned above, the python structure required is automatically saved in /AuxCode/Python/ as auto_LGalaxy_struct.py during compilation.
However, if you are working with a manually-edited python structure of your own, make sure to modify it to reflect the new set of properties you are outputting.
Note: The majority of errors occurring when trying to read-in L-Galaxies output binaries come from a mis-match between the actual output contents and the python structure!
Therefore, make sure you keep your output structure up-to-date with your code!
Processing binary_c data [Yates2023 branch only]
The Yates23 version of L-Galaxies allows the inclusion of chemical yields and supernova rates from stellar populations containing binary stars,
by utilising the binary stellar evolution (BSE) calculations made by the binary_c code.
To do this, "ensemble" outputs from binary_c are loaded and converted into yield tables that can be read by L-Galaxies.
Standard versions of these tables are already generated and stored in the /YieldTables/binary_c_yields/default folder.
However, if a different set of chemical elements is required (N.B. only 'H','He','C','N','O','Ne','Mg','Si','S','Ca', and 'Fe'
are loaded by default), or if you want to use a new set of binary_c ensembles, then new yield tables can be easily generated
by executing the process_binaryc_outputs.py script found in the /AuxCode/Python folder.
To change the chemical elements/isotoptes considered, simply modify the elements list under "INPUT VARIABLES" in
process_binaryc_outputs.py. A new h_metals.h header file will automatically be written in the /code
folder, which allows the new list of elements/isotopes chosen to be tracked in L-Galaxies.
To generate yield tables for a new set of binary_c ensembles, simply place the new ensemble .json files into the
/YieldTables/binary_c_yields/new/ensembles folder and turn on the USE_NEW_ENSEMBLES switch in
process_binaryc_outputs.py before running this script.
For more information on how to handle binary_c data with L-Galaxies, feel free to drop me an email (r.yates3 -at- herts.ac.uk).