Skip to content

SourceYang/CReDamp

Repository files navigation

Cosmic Ray Electron Simulation in the Intergalactic Medium (IGM)

This repository simulates the distribution of cosmic ray electrons within the intergalactic medium (IGM) and calculates the Landau damping rate caused by them to TeV electron-positron pair beams. For a detailed explanation, refer to our associated paper: Astrophysical Journal, AD3237.

Ensure you have Python 3 installed on your system. You may also need to install the required Python packages. It's recommended to use a virtual environment.

# Clone the repository
git clone https://github.com/SourceYang/CReDamp.git
cd CReDamp

To execute all related scripts with default redshift and energy resolution, along with source model settings, use the following command:

python exe.py --deltalin0 <value> --z <value>

Example

python exe.py --deltalin0 0 --z 2

This command will:

  1. Check for the existence of source_term_Khaire.txt. If it doesn't exist, it will run get_source.py to generate it.
  2. Execute IGM.py with the specified deltalin0 and z, saving results to the designated path.
  3. Execute damp_rate.py with the same parameters, generating CSV files and figures related to the damping rates.

Scripts Overview

1. exe.py

The main executable script that orchestrates the workflow by running other scripts based on the provided arguments.

Usage:

python exe.py --deltalin0 <value> --z <value>

2. get_source.py

Generates the source file source_term_Khaire.txt if it doesn't already exist.

  • Note: This process takes approximately 3 hours and is primarily affected by resolution settings.
  • Pre-generated File: A pre-generated source_term_Khaire.txt is included to save time. Use it unless you need a different resolution.

3. IGM.py

Generates five .npy files containing various physical quantities (row index for energy and column index for redshift):

  • energy_density_utot.npy: Total energy density.
  • energy_per_baryon_E_eV.npy: Energy per baryon in electron volts (eV).
  • number_of_electron_per_volume_N.npy: Number of electrons per volume per erg.
  • pressure_P_e.npy: Pressure in erg/cm³.
  • pressure_P_eV.npy: Pressure in eV/cm³.

4. damp_rate.py

Generates damping rate data and visualizations:

  • CSV Files:

    • damp_rate_largek_{z}_{deltalin0}.csv: Damping rates for k = 0.8 to 5 times omega_p/c.
    • damp_rate_zoomk_{z}_{deltalin0}.csv: Damping rates for k = 0.995 to 1.1 times omega_p/c.
  • Figures:

    • damp_rate_largek_{z}_{deltalin0}.pdf: Plot for large k range.
    • damp_rate_zoomk_{z}_{deltalin0}.pdf: Plot for zoomed k range.

Default Settings

  • Overdensity Evolution (--deltalin0): 0 (mean density)

    • Values:
      • > 0: Overdensity
      • < 0: Underdensity
  • Redshift (--z): 2

These defaults can be modified by providing different values through command-line arguments.

Additional script

  • temp_history.py Generating temperature and thermal pressure evolution
  • pre_IGMF.py Generating damp rate under pre-exist intergalactic magnectic field

Additional Information

  • Source File: The source_term_Khaire.txt file is generated by get_source.py and is essential for running the simulation. If you encounter issues with this file, ensure that get_source.py has executed successfully.

  • Output Directory: Results are saved in a directory structured as ./results/redshift{z}_density{deltalin0}_{timestr}. Ensure you have write permissions for the desired location.

  • Individual Script Descriptions: For more detailed information about each script, refer to the comments and documentation within the respective .py files.

  • Performance Considerations: Generating the source file can be time-consuming (around 3 hours). It's recommended to use the pre-generated file unless necessary to regenerate it.

Contact

For questions or support, please contact Yuanyuan Yang.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages