Skip to content

Commit

Permalink
Add spin_mass_dependence option to dark_matter_halo group
Browse files Browse the repository at this point in the history
The option defaults to false, and indicates whether the lognormal
distribution used to draw lambda values should use a fix value of 0.03,
or a dynamic value based on the halo spin distribution following Kim et
al. (2015), as its m parameter (the natural logarithm of the
distribution's mean).

The Lagos et al. (2023) paper used this dependency, and therefore we're
also updating the sample configuration file that reflects that paper to
ensure reproducibility.

Signed-off-by: Rodrigo Tobar <[email protected]>
  • Loading branch information
rtobar committed Jan 17, 2024
1 parent 0f5a785 commit 0cf9462
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/dark_matter_halos.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class DarkMatterHaloParameters {
use_converged_lambda_catalog = true, the latter will be done only for halos that have a number of particles below min_part_convergence.
**/
bool random_lambda = false;
bool spin_mass_dependence = false;
bool use_converged_lambda_catalog = false;
int min_part_convergence = 100;

Expand Down
1 change: 1 addition & 0 deletions sample.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ redshift_file = /path/to/simulation/redshifts.txt
halo_profile = nfw
lambda_random = true
size_model = Mo98
spin_mass_dependence = false

[gas_cooling]
lambdamodel = cloudy
Expand Down
1 change: 1 addition & 0 deletions sample_lagos23.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ halo_profile = nfw
size_model = mo98
lambda_random = true
concentration_model = duffy08
spin_mass_dependence = true

[simulation]
sim_name = mini-SURFS
Expand Down
7 changes: 5 additions & 2 deletions src/dark_matter_halos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,12 @@ float DarkMatterHalos::halo_lambda (const Subhalo &subhalo, float m, double z, d
lambda = 1;
}

double lambda_cen_mhalo = 0.03;
if (params.spin_mass_dependence) {
// use a very weak dependence on Mhalo for the spin distribution, following Kim et al. (2015): arxiv:1508.06037
lambda_cen_mhalo = 0.00895651600584195 * std::log10(m) - 0.07580254755439589;
}
// Prime the generator with a known seed to allow for reproducible runs
// using a very weak dependence on Mhalo for the spin distribution, following Kim et al. (2015): arxiv:1508.06037
double lambda_cen_mhalo = 0.00895651600584195 * std::log10(m) - 0.07580254755439589;
std::default_random_engine generator(exec_params.get_seed(subhalo));
std::lognormal_distribution<double> distribution(std::log(lambda_cen_mhalo), std::abs(std::log(0.5)));
auto lambda_random = distribution(generator);
Expand Down

0 comments on commit 0cf9462

Please sign in to comment.