MP-Gadget
5.0.1.dev1-76bc7d4726-dirty
|
#include <math.h>
#include <mpi.h>
#include <string.h>
#include <omp.h>
#include <gsl/gsl_interp.h>
#include "physconst.h"
#include "slotsmanager.h"
#include "partmanager.h"
#include "treewalk.h"
#include "hydra.h"
#include "drift.h"
#include "walltime.h"
#include "fof.h"
#include "utils/endrun.h"
#include "utils/paramset.h"
#include "utils/mymalloc.h"
#include "cooling_qso_lightup.h"
Go to the source code of this file.
Classes | |
struct | TreeWalkQueryQSOLightup |
struct | qso_lightup_params |
struct | QSOPriv |
Macros | |
#define | E0_HeII 54.4 /* HeII ionization potential in eV*/ |
#define | HEMASS 4.002602 /* Helium mass in amu*/ |
#define | QSO_GET_PRIV(tw) ((struct QSOPriv *) (tw->priv)) |
Functions | |
void | set_qso_lightup_par (struct qso_lightup_params qso) |
void | set_qso_lightup_params (ParameterSet *ps) |
static double | Q_inst (double Emax, double alpha_q) |
static void | load_heii_reion_hist (const char *reion_hist_file) |
void | init_qso_lightup (char *reion_hist_file) |
double | get_long_mean_free_path_heating (double redshift) |
static double | gaussian_rng (double mu, double sigma, const int64_t seed) |
static int | build_qso_candidate_list (int **qso_cand, FOFGroups *fof) |
static int | count_QSO_halos (int ncand, int64_t *ncand_tot, MPI_Comm Comm) |
static int | choose_QSO_halo (int64_t ncand, int64_t *ncand_before, int64_t *ncand_tot, int64_t randseed) |
static double | gas_ionization_fraction (void) |
static int | ionize_single_particle (int other, double a3inv, double uu_in_cgs) |
static void | ionize_ngbiter (TreeWalkQueryQSOLightup *I, TreeWalkResultBase *O, TreeWalkNgbIterBase *iter, LocalTreeWalk *lv) |
static void | ionize_copy (int place, TreeWalkQueryQSOLightup *I, TreeWalk *tw) |
static int64_t | ionize_all_part (int qso_ind, int *qso_cand, struct QSOPriv priv, ForceTree *tree) |
static void | turn_on_quasars (double atime, FOFGroups *fof, DomainDecomp *ddecomp, Cosmology *CP, double uu_in_cgs, FILE *FdHelium) |
void | do_heiii_reionization (double atime, FOFGroups *fof, DomainDecomp *ddecomp, Cosmology *CP, double uu_in_cgs, FILE *FdHelium) |
int | need_change_helium_ionization_fraction (double atime) |
int | during_helium_reionization (double redshift) |
int | qso_lightup_on (void) |
Variables | |
static struct qso_lightup_params | QSOLightupParams |
static double | qso_inst_heating |
static int | Nreionhist |
static double * | He_zz |
static double * | XHeIII |
static double * | LMFP |
static gsl_interp * | HeIII_intp |
static gsl_interp * | LMFP_intp |
static double | last_zz |
static double | last_long_mfp_heating |
#define E0_HeII 54.4 /* HeII ionization potential in eV*/ |
This file implements the quasar heating model of Upton-Sanderbeck et al 2019 (in prep). A black hole particle with the right mass is chosen at random and an ionizing bubble created around it. Particles within that bubble are marked as ionized and heated according to emissivity. New bubbles are created until the total HeIII fraction matches the value in the external table. There is also a uniform background heating rate for long mean-free-path photons with very high energies. This heating is added only to not-yet-ionized particles, and is done in cooling_rates.c. Whatever UVB you use should not include these photons.
The text file contains the reionization history and is generated from various physical processes implemented in a python file. The text file fixes the end of helium reionization (which is reasonably well-known). The code has the start time of reionization as a free parameter: if this start of reionization is late then there will be a strong sudden burst of heating.
(Loosely) based on lightup_QSOs.py from https://github.com/uptonsanderbeck/helium_reionization HeII_heating.py contains the details of the reionization history and how it is generated.
This code should run only during a PM timestep, when all particles are active We lose time resolution but I cannot think of another way to ensure cooling is modelled correctly.
Definition at line 47 of file cooling_qso_lightup.c.
#define HEMASS 4.002602 /* Helium mass in amu*/ |
Definition at line 48 of file cooling_qso_lightup.c.
#define QSO_GET_PRIV | ( | tw | ) | ((struct QSOPriv *) (tw->priv)) |
Definition at line 413 of file cooling_qso_lightup.c.
|
static |
Definition at line 282 of file cooling_qso_lightup.c.
References FOFGroups::Group, Group::Mass, mymalloc, myrealloc, FOFGroups::Ngroups, qso_lightup_params::qso_candidate_max_mass, qso_lightup_params::qso_candidate_min_mass, and QSOLightupParams.
Referenced by turn_on_quasars().
|
static |
Definition at line 340 of file cooling_qso_lightup.c.
References get_random_number().
Referenced by turn_on_quasars().
|
static |
Definition at line 309 of file cooling_qso_lightup.c.
References NTask, ta_free, ta_malloc, and ThisTask.
Referenced by turn_on_quasars().
void do_heiii_reionization | ( | double | atime, |
FOFGroups * | fof, | ||
DomainDecomp * | ddecomp, | ||
Cosmology * | CP, | ||
double | uu_in_cgs, | ||
FILE * | FdHelium | ||
) |
Definition at line 640 of file cooling_qso_lightup.c.
References CP, QSOPriv::fof, He_zz, qso_lightup_params::heIIIreion_start, Nreionhist, qso_lightup_params::QSOLightupOn, QSOLightupParams, turn_on_quasars(), QSOPriv::uu_in_cgs, and walltime_measure.
Referenced by run().
int during_helium_reionization | ( | double | redshift | ) |
Definition at line 667 of file cooling_qso_lightup.c.
References He_zz, qso_lightup_params::heIIIreion_start, Nreionhist, qso_lightup_params::QSOLightupOn, and QSOLightupParams.
Referenced by run().
|
static |
Definition at line 359 of file cooling_qso_lightup.c.
References slots_manager_type::info, MPI_INT64, part_manager_type::NumPart, P, PartManager, slot_info::size, SlotsManager, and sumup_large_ints().
Referenced by need_change_helium_ionization_fraction(), and turn_on_quasars().
|
static |
Definition at line 271 of file cooling_qso_lightup.c.
References get_random_number(), and sigma.
Referenced by ionize_ngbiter().
double get_long_mean_free_path_heating | ( | double | redshift | ) |
Definition at line 249 of file cooling_qso_lightup.c.
References He_zz, qso_lightup_params::heIIIreion_start, last_long_mfp_heating, last_zz, LMFP, LMFP_intp, Nreionhist, qso_lightup_params::QSOLightupOn, and QSOLightupParams.
Referenced by get_lambdanet().
void init_qso_lightup | ( | char * | reion_hist_file | ) |
Definition at line 238 of file cooling_qso_lightup.c.
References load_heii_reion_hist(), qso_lightup_params::QSOLightupOn, and QSOLightupParams.
Referenced by init_cooling().
|
static |
Definition at line 473 of file cooling_qso_lightup.c.
References TreeWalk::ev_label, TreeWalk::fill, TreeWalk::haswork, ionize_copy(), ionize_ngbiter(), QSOPriv::N_ionized, TreeWalk::ngbiter, TreeWalk::ngbiter_type_elsize, TreeWalk::postprocess, TreeWalk::priv, TreeWalk::query_type_elsize, TreeWalk::reduce, TreeWalk::result_type_elsize, ta_free, ta_malloc, TreeWalk::tree, treewalk_run(), treewalk_visit_ngbiter(), and TreeWalk::visit.
Referenced by turn_on_quasars().
|
static |
Definition at line 453 of file cooling_qso_lightup.c.
References TreeWalkQueryQSOLightup::base, Group::base, Group::CM, FOFGroups::Group, TreeWalkQueryQSOLightup::ID, BaseGroup::MinID, TreeWalkQueryBase::Pos, and QSO_GET_PRIV.
Referenced by ionize_all_part().
|
static |
Ionize and heat the particles
Definition at line 419 of file cooling_qso_lightup.c.
References gaussian_rng(), TreeWalkNgbIterBase::Hsml, TreeWalkQueryQSOLightup::ID, ionize_single_particle(), TreeWalkNgbIterBase::mask, qso_lightup_params::mean_bubble, NGB_TREEFIND_ASYMMETRIC, TreeWalkNgbIterBase::other, P, QSO_GET_PRIV, QSOLightupParams, TreeWalkNgbIterBase::symmetric, LocalTreeWalk::tw, and qso_lightup_params::var_bubble.
Referenced by ionize_all_part().
|
static |
Definition at line 380 of file cooling_qso_lightup.c.
References GAMMA_MINUS1, HEMASS, HYDROGEN_MASSFRAC, P, PROTONMASS, qso_inst_heating, and SPHP.
Referenced by ionize_ngbiter(), and turn_on_quasars().
|
static |
Definition at line 137 of file cooling_qso_lightup.c.
References endrun(), He_zz, HeIII_intp, qso_lightup_params::heIIIreion_start, LMFP, LMFP_intp, message(), mymalloc, Nreionhist, Q_inst(), qso_inst_heating, QSOLightupParams, ThisTask, and XHeIII.
Referenced by init_qso_lightup().
int need_change_helium_ionization_fraction | ( | double | atime | ) |
Definition at line 657 of file cooling_qso_lightup.c.
References gas_ionization_fraction(), He_zz, HeIII_intp, and XHeIII.
Referenced by run().
|
static |
Definition at line 113 of file cooling_qso_lightup.c.
References E0_HeII, and eVinergs.
Referenced by load_heii_reion_hist().
int qso_lightup_on | ( | void | ) |
Definition at line 682 of file cooling_qso_lightup.c.
References qso_lightup_params::QSOLightupOn, and QSOLightupParams.
Referenced by open_outputfiles().
void set_qso_lightup_par | ( | struct qso_lightup_params | qso | ) |
Definition at line 88 of file cooling_qso_lightup.c.
References QSOLightupParams.
void set_qso_lightup_params | ( | ParameterSet * | ps | ) |
Definition at line 94 of file cooling_qso_lightup.c.
References qso_lightup_params::heIIIreion_finish_frac, qso_lightup_params::mean_bubble, param_get_double(), param_get_int(), qso_lightup_params::qso_candidate_max_mass, qso_lightup_params::qso_candidate_min_mass, qso_lightup_params::QSOLightupOn, QSOLightupParams, ThisTask, and qso_lightup_params::var_bubble.
Referenced by read_parameter_file().
|
static |
Definition at line 520 of file cooling_qso_lightup.c.
References QSOPriv::a3inv, part_manager_type::BoxSize, build_qso_candidate_list(), choose_QSO_halo(), Group::CM, count_QSO_halos(), CP, part_manager_type::CurrentParticleOffset, endrun(), QSOPriv::fof, force_tree_free(), force_tree_rebuild_mask(), gas_ionization_fraction(), GASMASK, GRAVITY, FOFGroups::Group, He_zz, HeIII_intp, qso_lightup_params::heIIIreion_finish_frac, HUBBLE, Cosmology::HubbleParam, slots_manager_type::info, ionize_all_part(), ionize_single_particle(), qso_lightup_params::mean_bubble, message(), MPI_INT64, myfree, part_manager_type::NumPart, Cosmology::OmegaBaryon, P, PartManager, QSOLightupParams, slot_info::size, SlotsManager, sumup_large_ints(), FOFGroups::TotNgroups, QSOPriv::uu_in_cgs, walltime_measure, and XHeIII.
Referenced by do_heiii_reionization().
|
static |
Definition at line 81 of file cooling_qso_lightup.c.
Referenced by do_heiii_reionization(), during_helium_reionization(), get_long_mean_free_path_heating(), load_heii_reion_hist(), need_change_helium_ionization_fraction(), and turn_on_quasars().
|
static |
Definition at line 84 of file cooling_qso_lightup.c.
Referenced by load_heii_reion_hist(), need_change_helium_ionization_fraction(), and turn_on_quasars().
|
static |
Definition at line 245 of file cooling_qso_lightup.c.
Referenced by get_long_mean_free_path_heating().
|
static |
Definition at line 244 of file cooling_qso_lightup.c.
Referenced by get_long_mean_free_path_heating().
|
static |
Definition at line 83 of file cooling_qso_lightup.c.
Referenced by get_long_mean_free_path_heating(), and load_heii_reion_hist().
|
static |
Definition at line 85 of file cooling_qso_lightup.c.
Referenced by get_long_mean_free_path_heating(), and load_heii_reion_hist().
|
static |
Definition at line 80 of file cooling_qso_lightup.c.
Referenced by do_heiii_reionization(), during_helium_reionization(), get_long_mean_free_path_heating(), and load_heii_reion_hist().
|
static |
Definition at line 79 of file cooling_qso_lightup.c.
Referenced by ionize_single_particle(), and load_heii_reion_hist().
|
static |
Definition at line 1 of file cooling_qso_lightup.c.
Referenced by build_qso_candidate_list(), do_heiii_reionization(), during_helium_reionization(), get_long_mean_free_path_heating(), init_qso_lightup(), ionize_ngbiter(), load_heii_reion_hist(), qso_lightup_on(), set_qso_lightup_par(), set_qso_lightup_params(), and turn_on_quasars().
|
static |
Definition at line 82 of file cooling_qso_lightup.c.
Referenced by load_heii_reion_hist(), need_change_helium_ionization_fraction(), and turn_on_quasars().