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.
Depending on which model you want to use, the corresponding input file is one of the following:
- input_MR_W1_PLANCK_LGals2020_DM.par
- input_MR_W1_PLANCK_LGals2020_MM.par
Note that these input files are for runs on the Millenium-I merger trees. If you want to run on Millennium-II instead, see below.
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
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
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 e.g. 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
- Open the output structure .py file you are using
- Remove BulgeMassRings by either setting it to "False" in the properties_used dictionary (at the bottom of the .py file), or directly commenting it out:
- # ('BulgeMassRings',numpy.float32,12),
Changing which properties are outputted
The L-Galaxies output structures define which properties are contained in the binary output files.
The standard output structures (compatible with python) provided in each of the L-Galaxies 2020 branches are described below.
"master" branch:
- LGalaxy_snapshots.py: This is the standard output structure for outputs generated out-of-the-box by the "master" branch of L-Galaxies 2020.
It assumes that snapshot mode has been selected and the standard set of model switches are turned on (see above).
- LGalaxy_galtree.py: This is the standard output structure for outputs generated with the GALAXYTREE switch turned on.
- LGalaxy_snapshots_extraSFHs.py: This is the output structure to use (in snapshot mode) if chemical enrichment histories for individual elements in galaxy rings are required
(i.e. if the OUTPUT_RINGS_EXTRA switch is turned on)
"Yates2023" branch:
- LGalaxy_snapshots_liteOutput.py: This is the standard output structure for outputs generated out-of-the-box by the "Yates2023" branch of L-Galaxies 2020.
It assumes that snapshot mode has been selected and the standard set of model switches are turned on (see above), including the LITE_OUTPUT switch, which reduces the number of properties outputted.
- LGalaxy_snapshots_normal.py: This output structure is for outputs generated in snapshot mode with the LITE_OUTPUT switched turned off.
- LGalaxy_ringSFHs.py: This is the output structure to use (in snapshot mode) if chemical enrichment histories for individual elements in galaxy rings are required
(i.e. if the OUTPUT_RINGS_EXTRA switch is turned on). Similar to the LGalaxy_snapshots_extraSFHs.py structure in the "master" branch.
You are also 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
- Open the output structure .py file you are using
- In the structure, add/comment-out the property you wish to be outputted/not outputted
For example, to remove BulgeMassRings, set it to "False" in the properties_used dictionary (at the bottom of the .py file), or directly comment it out:
- # ('BulgeMassRings',numpy.float32,12),
The property in question will now be included/removed from the output file generated by L-Galaxies 2020.
Note: The majority of errors occurring when trying to read-in L-Galaxies output binaries into a python script come from a mis-match between the actual output and the output structure.
Therefore, make sure you keep your output structure up-to-date with your code!
Processing binary_c data [Yates2023 branch only]
The Yates+23 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.
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).