Abstract
We review numerical methods for simulations of cosmic ray (CR) propagation on galactic and larger scales. We present the development of algorithms designed for phenomenological and selfconsistent models of CR propagation in kinetic description based on numerical solutions of the Fokker–Planck equation. The phenomenological models assume a stationary structure of the galactic interstellar medium and incorporate diffusion of particles in physical and momentum space together with advection, spallation, production of secondaries and various radiation mechanisms. The selfconsistent propagation models of CRs include the dynamical coupling of the CR population to the thermal plasma. The CR transport equation is discretized and solved numerically together with the set of MHD equations in various approaches treating the CR population as a separate relativistic fluid within the twofluid approach or as a spectrally resolved population of particles evolving in physical and momentum space. The relevant processes incorporated in selfconsistent models include advection, diffusion and streaming propagation as well as adiabatic compression and several radiative loss mechanisms. We discuss, applications of the numerical models for the interpretation of CR data collected by various instruments. We present example models of astrophysical processes influencing galactic evolution such as galactic winds, the amplification of largescale magnetic fields and instabilities of the interstellar medium.
1 Introduction
1.1 Introduction
Cosmic rays (CRs) are charged particles with nonthermal energy distributions (Strong et al. 2007; Grenier et al. 2015; Gabici et al. 2019). There are both hadronic and leptonic cosmic rays among which protons and electrons are the most abundant particles. In the hadronic component the composition resembles approximately the element distribution in the universe (e.g. Blasi and Amato 2012; Gaisser et al. 2013), so protons and helium nuclei are by far most abundant and account for most of the energy stored in high energy particles. Heavier elements and in particular unstable isotopes are rare but provide valuable information on the dynamics of CRs and serve as clocks for CR acceleration and transport. CR electrons are usually negligible for the dynamics but provide important information on the magnetic field via loss processes that produce radio and synchrotron radiation (e.g. Gaisser 1991). Being highenergy charged particles, CRs mainly interact with the gas via the magnetic field (e.g. Zweibel 2013). The transport processes and the dynamical interaction with the gas are thus tightly coupled to plasma processes.
The integrated energy in hadronic CRs is large enough to have a dynamical impact. In the interstellar medium the CR proton energy is comparable to the thermal and kinetic counterpart (e.g. Ferrière 2001). On galactic scales there is evidence that CR protons are an important agent in driving galactic winds (see, e.g. Naab and Ostriker 2017; Zweibel 2017). In addition they might have an impact on the distribution of gas in the galactic disc and thus alter the star formation process on molecular cloud scales, even though their dynamical impact on molecular clouds is expected to be much weaker compared to other drivers in the ISM like radiation or supernovae. In the densest part of cloud cores, into which CR protons are able to penetrate they ionize and heat the gas (e.g. Padovani et al. 2020). If CRs are efficiently coupled to the gas or penetrate into regions dense enough such that direct particleparticle collisions become relevent, they provide a temperature floor, which directly impacts the fragmentation scale and the seeds of star formation.
1.2 Origin of CRs
Most of the CRs are believed to be produced in shocks via diffusive shock acceleration (DSA). Early theoretical models (Krymskii 1977; Axford et al. 1977; Bell 1978; Blandford and Ostriker 1978) as well as recent numerical simulations (e.g. Caprioli and Spitkovsky 2014) confirm this paradigm, see also Marcowith et al. (2020) for a recent review. In the Milky Way and most of the star forming galaxies supernova remnants (SNR) are by far the most abundant source of strong shocks that provide the conditions to accelerate CRs up to an energy of approximately \(10^{15}\,{\mathrm{eV}}\), so the particles up to that energy are likely to be of Galactic origin (Ackermann et al. 2013). CRs are however observed up to energies of \(10^{20}\) eV, which cannot be explained by SNe. Instead, Active Galactic Nuclei (AGN) are an alternative candidate to provide sufficiently energetic environments. In addition, the gyroradii of those ultahigh energy CRs are larger than the disk of the Milky Way. If coming from a local source within our Galaxy, the individual CRs could therefore be traced back to their origin with an anisotropic distribution on the sky. However, this is not the case and those ultra high energy CRs are thus of extragalactic origin (Kotera and Silk 2016).
The spectral distribution of CRs shows a peak or a flattening at a few GeV followed by a power law with remarkably little scatter. Up to energies of \(10^{15}\,{\mathrm{eV}}\) a spectrum with \(E^{2.7}\) is observed. Above that energy the scaling steepens, which leads to naming the kink at \(10^{15}\,{\mathrm{eV}}\) the "knee". At \(10^{20}\,{\mathrm{eV}}\) the spectrum flattens again, which is called the "ankle". At the highest energies the spectrum is less clear, mainly due to the small statistics. Due to the steep spectrum, most of the energy can be located in a narrow energy range of from 1 to 10 GeV per nucleon. Models accounting for the dynamical impact of CRs therefore focus on GeV protons.
1.3 Numerical approaches of CR transport and scope of this review
CRs span a large energetic range from particle energies just exceeding the thermal distribution (~ MeV) up to the GZK cutoff (e.g. Kotera and Olinto 2011; Amato and Blasi 2018; Gabici et al. 2019). Over this range in momentum the dynamical range of the particle distribution function spans approximately 10 orders of magnitude. Consequently, the effective (numerical) models that describe CRs and the interactions with their environment differ. First, we need to distinguish between a macroscopic and a microscopic perspective; we start with the macroscopic models.
For lowenergy CRs with small gyroradii we are often interested in the overall energy of CRs rather than the individual particle trajectories (e.g. Padovani et al. 2020). On the other hand, for ultrahighenergy CRs with gyroradii comparable to entire galactic discs the particles’ trajectory is of greater interest (Kotera and Olinto 2011). Equally important to the energy per particle is the fraction of CR energy compared to the other energies like the magnetic, thermal, radiation or kinetic one for the coupling between the CRs and their environment. If the integrated CR energy is much smaller that the other components, CRs can be treated as tracers without dynamical backreaction. Depending on the system under consideration the effective transport of the CR tracers can differ from advection with the gas, to diffusion and to free streaming.
This is basically always the case for CR electrons, so CRs can be treated as tracer particles or passive fluid. For the hadronic component we can identify three main regimes, which we outline in more detail in Sect. 1.4. The lowenergy CRs do not significantly contribute to the dynamics via their total pressure, so again a passive tracer fluid or tracer particles are appropriate. The regime around a GeV contains comparable energy densities to other components in galaxies, so the backreaction onto the dynamics needs to be included. There are several models of different complexity, which we outline in this review, ranging from simply adding another pressure to the hydrodynamical equations up to a more complex way of including plasma processes between CR particles and the hydromagnetic waves. The very steep spectrum results again in an overall negligible integrated energy above \(\sim 100\,{\mathrm{GeV}}\). The passive treatment is then again appropriate. However, the large gyroradii combined with the low number of particles favours the treatment as passive individual particles and their trajectories.
In the microscopic CR models the interaction of individual particles with the magnetic field is of interest in order to understand plasma processes. This approach is a different numerical class, known as particleincell methods, where the Lorentz force for each particle is computed and the particle distribution function is actually sampled by a large number of CRs. The complexity of this plasma approach exceeds the scope of this review and we would like to highlight the review by Marcowith et al. (2020).
The field of CR physics is large ranging from their acceleration at small spatial scales of individual shock fronts up to the trajectory of the highest energy CRs and their specific origin from extragalactic sources. Depending on the individual setups and environmental conditions, different models are chosen and combined. Among the three main types of models (particleincell, test particle models and an effective fluid description) we mainly cover the last one in different applications.
In this review we distinguish between the following numerical models:

We consider CR propagation described by the canonical Fokker–Planck equation in a static magnetic field, referred to as ‘phenomenological models’, which are discussed in Sects. 3.1 and 3.2.

In the second part we discuss models considering joint solutions of the Fokker–Planck equation for CRs combined with the equations of magnetohydrodynamics (MHD). These models are referred to as ‘selfconsistent models’ (Strong et al. 2007) and are discussed in Sects. 4.1–5.1. They can be further distinguished in two ways.

The first one covers a dynamical coupling of the CRs to the MHD system by simply including an additional pressure term related to cosmic rays. The interactions between CRs and magnetic fields are included as subgrid models with effective coupling coefficients, i.e. without including the streaming process explicitly in the system. This class of models however, has recently been extended to include spectrally resolved CRs.

The latest approach also considers CR generated Alfvén waves together with CR scattering off selfexcited waves (streaming) which additionally couple CRs to the energy equation of the thermal plasma through dissipation of Alfvén waves (cosmic ray heating).

1.4 Basics and approaches
We begin with some basic concepts of CR propagation, and relating these to observational data. Most of our knowledge of CR propagation comes via secondary CRs, with additional information from \(\gamma \)rays and synchrotron radiation. It is instructive to point out why secondary nuclei are an ideal probe of CR propagation: the fact that the primary nuclei are measured (albeit only near the solar position) means that the secondary production functions can be computed from primary spectra, crosssections and interstellar gas densities; the secondaries can then be ‘propagated’ and compared with observations.
Since it became known that CRs fill the Galaxy it has been clear that nuclear interactions imply that their composition contains information on their propagation (Bradt and Peters 1950). An important breakthrough was the advent of satellite measurements of isotopic Li, Be, B in the 1970’s (GarciaMunoz et al. 1975). Since then the subject has expanded continuously with models of increasing degrees of sophistication. The observation that the composition of CRs is different from that of solar, in that rare solarsystem nuclei like Boron are abundant in CR, proves the importance of propagation in the interstellar medium. Simplified estimates of the lifetime time of CRs in the interstellar medium conclude that there is a canonical column density of a few ‘few g cm^{−2}’ of traversed material before the CRs interact with the gas and lose their energy (see Sect. 2.1).
1.4.1 Particle versus kinetic versus fluid approach
One main distinction of CR transport is the difference between particle and fluid approaches. If the mean free path of CRs is small compared to the characteristic simulated scales, i.e. CRs scatter efficiently, they are often treated as a fluid. On the other hand, if the mean free path is comparable or larger than the system under consideration the trajectory of individual CRs need to be considered. Which approach is more appropriate depends on the spatial scales, the scattering frequency, and the energy of the CRs. To get an order of magnitude estimate of the typical scales we can investigate the gyroradius
where \(p_\perp \) is the momentum perpendicular to the magnetic field line, q is the absolute value of the charge and B is the magnetic field strength. Figure 1 shows the gyro radius of CR protons for different magnetic field strengths as a function of CR momentum together with typical sizes of astrophysical systems. The plot illustrates that for lowenergy CRs the gyroradii are perceptibly smaller than typical astrophysical objects. We would like to highlight that the gyroradius is not a definite measure for how the CRs need to be treated, but it nicely illustrates the separation of scales.
The confinement of CRs is more complicated and depends also on the total energy in CRs compared to the energy of the background system, i.e. whether CRs can be treated as tracer particles moving through the medium or whether CR themselves modify the magnetic field and gas properties. We can broadly separate three different regimes.
CR momenta \(\ll \)GeV/c The spectrum at low CR energies is not well constrained due to solar modulation (e.g. Webber 1998a; Potgieter 2013). The best data of the CR spectrum is based on Voyager (e.g. Cummings et al. 2016) and AMS02 (e.g. Aguilar et al. 2014b, a) measurements, which is still in our very local astrophysical neighbourhood. At low energies the cross section of CRs with gas atoms and molecules increases, which leads to efficient losses (Coulomb losses, ionisation losses). On typical scales above a few parsec the gas scatters efficiently and the integrated energy of CRs is low enough such that those CRs are often treated as a diffusing fluid. On scales of star forming regions and protoplanetary discs the individual trajectories might be of interest.
CR momenta between 0.1 and \(\sim \)10 GeV/c This regime of the CR spectrum is the most difficult one because the total integrated CR energy is dominated by the contribution of the GeV particles. With energy densities exceeding the magnetic one, CRs do not just scatter off a background system but heavily influence the magnetic field and—connected via MHD—the local turbulent and thermal properties. Typically the scattering is very efficient, which allows a fluid approach. However, the simple diffusion approximation is likely to be violated. The resulting transfer of energy and the CR losses are complicated by the interplay between Coulomb and ionisation losses, hadronic losses and the interactions between CRs and the magnetic field.
CR momenta above \(\sim \)10 GeV/c At higher momenta each CR is much more energetic than other particles in the universe. However, the spectrum is so steep that the total energy stored in those CRs is subdominant, so they are dynamically irrelevant. The low scattering efficiency makes those CRs a reliable probe of their travel through the magnetised universe. Therefore, in this energy regime CRs are often treated by following individual particles along their trajectories.
1.4.2 Grey versus spectrally resolved CR fluids
In order to account for the global effects of CRs in numerical models one often uses a grey approach, i.e. CR properties integrated over the full momentum range of the distribution function. In this simplified approach the CRs are treated as a fluid with global effective transport properties and interaction efficiencies. As in thermal gas dynamics an underlying spectrum needs to be assumed. Spectrally resolved methods allow for a more accurate treatment of the cooling.
1.5 The canonical CR propagation equation
The canonical CR propagation equation can be written as (Skilling 1971, 1975a, b, c)
where \(f=f({\varvec{ r }},p,t)\) is the CR density per unit momentum p at position \({\varvec{ r }}\) and at time t, \(f(p)\,dp = 4\pi p^2 f({\varvec{ p }})\,dp \) in terms of phasespace density \(f({\varvec{ p }})\), \(b_l\) represents mechanical and adiabatic losses and \(q({\varvec{ r }}, p, t)\) denotes the source terms. The effective CR advection velocity is
where \(v_0\) is the advection velocity of thermal plasma and
accounts for scattering of CR particles off selfexcited Alfvén waves with \({\varvec{ b }}\) denoting the unit vector aligned with magnetic field, and \(v_A\) is the Alfvén speed.
The waves are excited due to a resonant coupling with the streaming CR population. The condition for resonance is that the Dopplershifted wave frequency \(\omega  k v\) is an integral multiple of the cyclotron frequency \(n \varOmega \) (Kulsrud and Pearce 1969). For \(n=0\) the gyroresonance occurs for waves at the same phase velocity as the particle velocity. If the drift velocity of CRs exceeds the Alfvén speed, the instability occurs for the waves propagating in the same direction. CRs interacting with the wave traveling in the same direction are mainly scattered in pitch angle and give a small amount of energy to the wave. The effect is known as the streaming instability. Although the instability generates directly forward waves propagating along magnetic field in the same direction as cosmic rays, wavewave interactions imply the existence of backward waves, propagating in the opposite direction (Chin and Wentzel 1972; Skilling 1975a).
The spatial diffusion coefficient is generally anisotropic and thus described by a diffusion tensor
with ‘\({\varvec{ b }}{\varvec{ b }}\)’ meaning the dyadic product of vector \({\varvec{ b }}\). In one dimension or for isotropic diffusion this reduces to a diffusion coefficient, \(D_{xx}\), which is given by
where \(\nu _{\pm }\) means the collision frequency against forward (+) and backward (−) waves, v is particle velocity and \(\mu = {\varvec{ p }} \cdot {\varvec{ b }}/ p\) denotes the particle pitchangle cosine.
Diffusive reacceleration is described as diffusion in momentum space determined by the coefficient
where m is the particle mass and \(\gamma \) is its Lorentz factor.
CR sources are usually assumed to be concentrated near the Galactic disk and to have a radial distribution like for example supernova remnants (SNR). A source injection spectrum and its isotopic composition are required; the composition is usually initially based on primordial solar but can be determined iteratively from the CR data themselves for later comparison with solar. The spallation part of \(q({\varvec{ r }}, p,t ) \) depends on all progenitor species and their energydependent crosssections, and the gas density \(\rho ({\varvec{ r }})\); it is generally assumed that the spallation products have the same kinetic energy per nucleon as the progenitor. Kelectron capture and electron stripping can be included via the time scale for loss by fragmentation \(\tau _f\) and q. \(D_{xx}\) is in general a function of \(({\varvec{ r }}, \beta , p/Z)\) where \(\beta =v/c\) and Z is the charge, and p/Z determines the gyroradius in a given magnetic field; \(D_{xx}\) may be isotropic, or more realistically anisotropic, and may be influenced by the CR themselves (e.g. in wavedamping models). The coefficient \(D_{pp}\) is related to \(D_{xx}\) by \(D_{pp}D_{xx}\propto p^2\), with the proportionality constant depending on the theory of stochastic reacceleration (Berezinskii et al. 1990, Seo and Ptuskin 1994) as described in Sect. 2.5. \({\varvec{ v }}\) is a function of \({\varvec{ r }}\) and t. The term in \({\varvec{\nabla }}\cdot {\varvec{ v }}\) represents adiabatic momentum gain or loss in the nonuniform flow of gas with a frozenin magnetic field whose inhomogeneities scatter the CR. \(\tau _f\) depends on the total spallation crosssection and \(\rho ({\varvec{ r }})\). Observationally, the density \(\rho ({\varvec{ r }})\) can be based on surveys of atomic and molecular gas, but can also incorporate smallscale variations such as the region of low gas density surrounding the Sun. In hydrodynamical simulations, the density is naturally included in every computational cell. This equation only treats continuous momentumloss; catastrophic losses can be included via \(\tau _f\) and q. CR electrons, positrons and antiprotons propagation constitute just special cases of this equation, differing only in their energy losses and production rates.
The boundary conditions depend on the model; often \(f=0\) is assumed at the ‘halo boundary’ where particles escape into intergalactic space, but this obviously just an approximation (since the intergalactic flux is not zero) which can be relaxed for models with a physical treatment of the boundary.
Equation (2) is a timedependent equation; often the steadystate solution is required, which can be obtained either by setting \(\partial f / \partial t = 0\) or following the time dependence until a steady state is reached; the latter procedure is much easier to implement numerically. Depending on the model setup the timedependence of q can be neglected unless effects of nearby recent sources or the stochastic nature of sources are being studied. In hydrodynamical models, local sources are easily incorporated in regions of star formation or locally identitfied shocks. By starting with the solution for the heaviest primaries and using this source term to compute the spallation source for their products, the complete system can be solved including secondaries, tertiaries etc. Then the CR spectra at the solar position can be compared with direct observations, including solar modulation if required.
Source abundances are determined iteratively, comparing propagation calculations with data; for nuclei with very small source abundances, the source values are masked by secondaries and crosssection uncertainties and are therefore hard to determine. Webber (1998b) gives a ranking from ‘easy’ to ‘impossible’ for the possibility of getting the source abundances using Advanced Composition Explorer (ACE) data. A review of the highprecision abundances from ACE is in Wiedenbeck et al. (2001) and for Ulysses in Connell (2001). For a useful summary of the various astrophysical abundances relevant to interpreting CR abundances see Binns et al. (2005).
1.5.1 Streaming and diffusion
Equation (2) contains the term representing advection of the CR population with the velocity \({\varvec{u}}={\varvec{v}}_0+ {\varvec{v}}_s\), given by formula (3). This includes the streaming velocity along the direction pointing down the CR energy density gradient. This term originates from the consideration of the cyclotron resonance streaming instability, discovered by Kulsrud and Pearce (1969), which sets in when a population of CRs move with a bulk speed greater than the Alfvén speed \(v_{A}\). Even a slight anisotropy of CRs, which naturally arises in the presence of sources, causes unstable growth of the waves due to momentum transfer from the CRs to waves via pitchangle scattering. The streaming CRs transfer their energy to Alfvén waves and subsequently scatter off selfgenerated waves (see e.g. Wiener et al. 2013, for a detailed introduction). Streaming and diffusion are considered respectively as the first and second order effects in expansion of the distribution function in powers of inverse wave particle scattering frequency \(\nu \) (e.g. Skilling 1971; Wiener et al. 2017b).
The waves are subject to damping due to ionneutral friction, due to waveparticle interactions between thermal ions and the lowfrequency beat waves formed by two interfering Alfvén waves (nonlinear Landau damping) and due to the cascade of waves to smaller scales (turbulent damping) (see Thomas and Pfrommer 2019, for a brief summary on this topic). The system reaches equilibrium when the wave damping rate becomes equal to their growth rate due to the streaming instability. The scattering leads to isotropisation of the CR distribution in the reference frame comoving with the waves, implying that the CRs bulk velocity becomes equal to the Alfvén velocity plus a local fluid velocity.
Scattering of CR particles off Alfvén waves manifests itself as diffusion process in phase space, with spatial and momentum diffusion coefficients given respectively by formulae (6) and (7). Diffusion of CRs is intrinsically related to the streaming process which depends on local plasma conditions. In a more general case diffusion might be related also to an extrinsic turbulence driven by sources other than CRs. The effective diffusion coefficient depends on the dominant wave damping mechanism.
Wave damping means dissipation of wave energy and heating of the interstellar medium. The heating rate due to dissipation of Alfvén waves is
If the coupling of CRs is reduced, due to wave damping mechanisms, the effective propagation speed of the CR population might be higher than the Alfvén speed, however, it is argued that the heating rate is still given by the expression (8), because all momentum and energy transfer between the CRs and gas is mediated by hydromagnetic waves which propagate at the speed \({\varvec{v}}_A\) (e.g. Zweibel 2013).
The concept of CR diffusion explains why energetic charged particles have highly isotropic distributions and why they are retained well in the Galaxy. The Galactic magnetic field which tangles the trajectories of particles plays a crucial role in this process. Typical values of the diffusion coefficient found from fitting to CR data is \(D_{xx}\sim (3  5)\times 10^{28}\) \(\hbox {cm}^{2}\) \(\hbox {s}^{1}\) at an energy of \(\sim \)1 GeV per nucleon and it increases with magnetic rigidity as \(R^{0.3}R^{0.6}\) in different versions of the empirical diffusion model of CR propagation. Here, the magnetic rigidity is defined as \(R=pc/Ze\) with the momentum p and the charge Ze. In a given magnetic field configuration, particles with the same rigidity follow the same trajectory.
On the microscopic level the diffusion of CR results from particle scattering off random MHD waves and discontinuities. The effective “collision integral” for charged energetic particles moving in a magnetic field with small random fluctuations \(\delta B\ll B\) is given by the standard quasilinear theory of plasma turbulence (Kennel and Engelmann 1966). The waveparticle interaction is of resonant character so that an energetic particle is predominantly scattered by those irregularities of magnetic field which have their projection of the wave vector on the average magnetic field direction equal to \(k_{\parallel }=\pm s/\left( r_{\mathrm{g}}\mu \right) \), where \(\mu \) is the particle pitch angle. The integers \(s=0,1,2\ldots \) correspond to cyclotron resonances of different order. The efficiency of scattering depends on the polarization of the waves and on their distribution in \({\varvec{ k }}\)space. The firstorder resonance \(s=1\) is the most important for the isotropic and also for the onedimensional distribution of random MHD waves along the average magnetic field. In some cases—for the calculation of scattering at small \(\mu \) and for the calculation of perpendicular diffusion—the broadening of resonances and magnetic mirroring effects should be taken into account. The resulting spatial diffusion is strongly anisotropic locally and goes predominantly along the magnetic field lines. However, strong fluctuations of the magnetic field on large scales of \(L\sim 100\) pc, where the strength of the random field is several times higher than the average field strength, lead to the isotropization of global CR diffusion in the Galaxy. The rigorous treatment of this effect is not trivial, since the field is almost static and the strictly onedimensional diffusion along the magnetic field lines does not lead to nonzero diffusion perpendicular to \({\varvec{ B }}\), see Casse et al. (2002) and the references therein.
Following several detailed reviews of the theory of CR diffusion (Jokipii 1971; Toptygin 1985; Berezinskii et al. 1990; Schlickeiser 2002) the diffusion coefficient at \(r_{\mathrm {g}}<L\) can be roughly estimated as \(D_{xx}\approx \left( \delta B_{\mathrm {res}}/B\right) ^{2} vr_{\mathrm {g}}/3\), where \(\delta B_{\mathrm {res}}\) is the amplitude of the random field at the resonant wave number \(k_{\mathrm {res}}=1/r_{g}\). The spectral energy density of interstellar turbulence has a power law form \(w(k)dk\sim k^{2+a}dk\), \(a=1/3\) over a wide range of wave numbers \(1/(10^{20}\) cm\()<k<1/(10^{8}\) cm), see Elmegreen and Scalo (2004), and the strength of the random field at the main scale is \(\delta B\approx 5\) \(\mu \)G. This gives an estimate of the diffusion coefficient \(D_{xx}\approx \) \(2\times 10^{27}\beta R_{_{\mathrm {GV}}}^{1/3}\) cm^{2} s^{−1} for all CR particles with magnetic rigidities \(R<10^{8}\) GV, in a fair agreement with the empirical diffusion model (the version with distributed reacceleration). The scaling law \(D_{xx}\sim R^{1/3}\) is determined by the value of the exponent \(a=1/3\), typical for a Kolmogorov spectrum. Theoretically (Goldreich and Sridhar 1995) the Kolmogorov type spectrum might refer only to some part of the MHD turbulence which includes the (Alfvénic) structures strongly elongated along the magneticfield direction and which are not able to provide the significant scattering and required diffusion of cosmic rays. In parallel, the more isotropic (fast magnetosonic) part of the turbulence, with a smaller value of random field at the main scale and with the exponent \(a=1/2\) typical for the Kraichnan type turbulence spectrum, may exist in the interstellar medium (Yan and Lazarian 2004). The Kraichnan spectrum gives a scaling \(D_{xx}\sim R^{1/2}\) which is close to the highenergy asymptotic form of the diffusion coefficient obtained in the ‘plain diffusion’ version of the empirical propagation model. Thus the approach based on kinetic theory gives a proper estimate of the diffusion coefficient and predicts a powerlaw dependence of diffusion on magnetic rigidity, but the determination of the actual diffusion coefficient has to make use of fitting to models of CR propagation in the Galaxy.
1.5.2 Convection/advection
The transport of CRs is a combination of the locally advective contribution, where CRs are advected with the flow, plus the diffusive and/or streaming transport relative to the gas. Depending on the system under consideration convection and advection have been distinguished. From a hydrodynamical perspective the CRs are advected with the flow. Historically, global models of galaxies do not resolve the gas flow but cover the turbulent motions in the galaxy and the perturbations globally as a convective system. In the literature we therefore find both terminologies.
While the most frequently considered mode of CR transport is diffusion, the existence of galactic winds in many galaxies suggests that advective transport should also be important. Winds are common in galaxies and can be CRdriven (e.g. Naab and Ostriker 2017) CRs also play a dynamical role in galactic halos (Breitschwerdt et al. 1991, 1993). Convection not only transports CR, it can also produce adiabatic energy losses as the wind speed increases away from the disk. Convection was first considered by Jokipii (1976) and followed up by Owens and Jokipii (1977a, b), Jones (1978, 1979), Bloemen et al. (1993). Both 1zone and 2zone models have been studied: a 1zone model has convection and diffusion everywhere, a 2zone model has diffusion alone up to some distance from the plane, and diffusion plus convection beyond.
For onezone diffusion/convection models a good diagnostic is the energydependence of the secondarytoprimary ratio: a purely convective transport would have no energy dependence (apart from the velocitydependence of the reaction rate), contrary to what is observed. If the diffusion rate decreases with decreasing energy, any convection will eventually take over and cause the secondarytoprimary ratio to flatten at low energy: this is observed but convection does not reproduce e.g. the BorontoCarbon ratio (B/C) very well (Strong and Moskalenko 1998).
Ptuskin et al. (1997) studied a selfconsistent twozone model with a wind driven by CR and thermal gas in a rotating Galaxy. The CR propagation is entirely diffusive in a zone \(z< 1\) kpc, and diffusiveconvective outside. CR reaching the convective zone do not return, so it acts as a halo boundary with height varying with energy and Galactocentric radius. It is possible to explain the energydependence of the secondarytoprimary ratio with this model, and it is also claimed to be consistent with radioactive isotopes. The effect of a Galactic wind on the radial CR gradient has been investigated (Breitschwerdt et al. 2002); they constructed a selfconsistent model with the wind driven by CR, and with anisotropic diffusion. The convective velocities involved in the outer zone are large (~ 100 km s^{−1}) but this model is still consistent with radioactive CR nuclei which set a much lower limit (Strong and Moskalenko 1998), since this limit is only applicable in the inner zone. Observational support of such models would require direct evidence for a Galactic wind in the halo.
1.5.3 Reacceleration
In addition to spatial diffusion, the scattering of CR particles on randomly moving MHD waves leads to stochastic acceleration which is described in the transport equation as diffusion in momentum space with some diffusion coefficient \(D_{pp}\). One can estimate it as \(D_{pp}=p^{2}V_{\mathrm {a}}^{2}/\left( 9D_{xx}\right) \) where the Alfvén velocity \(V_{\mathrm {a}}\) is introduced as a characteristic velocity of weak disturbances propagating in a magnetic field, see Berezinskii et al. (1990), Schlickeiser (2002) for rigorous formulas.
2 Early models
2.1 CR propagation  basic relations and motivations
Assuming that CRs are accelerated from the ISM of our Galaxy, we expect a similar composition of CRs and the thermal gas in the ISM. However, their observed abundances show a relative overabundance of the light elements Li, Be, and B, which must be produced during their transport through the ISM. These elements are produced in spallation processes and are thus secondary particles. A classical measure of the ratio of stable secondaries to primaries is the B/C ratio, which depends on particle energy, but can be approximated to zeroth order to be \(\sim 0.3\). The grammage is the amount of material that the CRs have to pass through before they interact with an atom in the ISM,
The grammage can be related to the spallation products by comparing the travelled depth with the mean mass per particle in the ISM \(m_{\mathrm{ISM}}\) and the typical cross section for the spallation of carbon to boron,
Using typical numbers for the ISM we find a grammage of \(\sim 10\,\mathrm {g\,cm}^{2}\). At a disc surface density of approximately \(\varSigma _{\mathrm{gas}}\sim 10\,\mathrm {M}_\odot \,\mathrm {pc}^{2} = 2\times 10^{3}\,\mathrm {g\,cm}^{2}\) the CR must cross the disc \(10^3\) times, assuming that the grammage is accumulated by travelling through the disc. The associated travel or residence time, which can also be understood as the lifetime of a CR in the Galaxy or its escape time from the disc, is given by
for a gas scale height of \(h\sim 100\,\mathrm {pc}\) and a CR velocity \(v=c\).
The linear distance that a CR travels during the residence time is \(l=t_{\mathrm{res}}c\sim 500\,\mathrm {kpc}\), so much larger than galactic scales and the CRs need to be confined to the Galaxy. In order to estimate escape timescales of the CRs unstable secondaries provide a valuable tool. The longest lived and best measured unstable isotope is \(^{10}\)Be. Its decay time is \(t_{\mathrm{decay}}=1.39\,\mathrm {Myr}\), which is of the order of the residence time. The cross sections for the spallation of carbon into stable (\(^{9}\)Be) and unstable (\(^{10}\)Be) beryllium are similar, \(\sigma _{\mathrm {C}\rightarrow \mathrm {^{10}Be}}\sim \sigma _{\mathrm {C}\rightarrow \mathrm {^9Be}}\). This means that an initial abundance ratio (\(^{10}\)Be/\(^{9}\)Be) of unity at production decreases over time by \(t_{\mathrm{decay}}(^{10}\mathrm {Be})/t_{\mathrm{res}}\). Measurements of this ratio reveal a residence time of \(1020\,\mathrm {Myr}\), so larger than the residence time of CRs.
A simple transport equation along the vertical dimension reads
Here, N is the number density of CRs, \(Q_0\) is the CR source function, D is the diffusion coefficient, and \(\delta \) is the Dirac\(\delta \) distribution. By assuming steady state and an injection of CRs close to the midplane at \(z=0\), we can reduce the equation to
and find for \(z>0\)
where H is the size of the halo, which is poorly constrained to a value of approximately \(5\,\mathrm {kpc}\). The total grammage \(\chi =\overline{\rho }t_{\mathrm{res}} c\) will be reached by moving though the average density of the total volume (disc plus halo), \(\overline{\rho }=\mu m_{\mathrm{p}}n_{\mathrm{ISM}} h/H\), with a disc scale height of \(h=100\,\mathrm {pc}\), an average mean molecular weight of \(\mu =1.4\), and an average ISM density of \(1\,\mathrm {cm}^{3}\). The diffusion coefficient can be estimated to be
Even though these estimates are very simplified, they provide two valuable features of GeV CRs that remain valid even with much more complex assumptions. The first is that the CRs are distributed relatively smoothly through the ISM. Locally, the CR density varies, but much less than the gas structures, so molecular clouds are located in an almost uniform sea of GeV CRs. The second is that due to frequent scattering, the CR distribution is locally isotropic.
2.2 Weighted slabs and leaky boxes
The closely related leakybox and weighted slab formalisms have provided the basis for most of the literature interpreting CR data.
In the leakybox model, the diffusion and convection terms are approximated by the leakage term with some characteristic escape time of CR from the Galaxy. The escape time \(\tau _\mathrm{esc}\) may be a function of particle energy (momentum), charge, and mass number if needed, but it does not depend on the spatial coordinates. There are two cases when the leaky box equations can be obtained as a correct approximation to the diffusion model: (1) the model with fast CR diffusion in the Galaxy and particle reflection at the CR halo boundaries with some probability to escape (Ginzburg and Syrovatskii 1964), (2) the formulae for CR density in the Galactic disk in the flat halo model \((z_h \ll R)\) with thin source and gas disks (\(z_\mathrm{gas} \ll z_h)\) which are formally equivalent to the leakybox model formulae in the case when stable nuclei are considered (Ginzburg and Ptuskin 1976). The nuclear fragmentation is actually determined not by the escape time \(\tau _ {esc}\) but rather by the escape length in g \(\hbox {cm}^{2}\): \(x = v\rho \tau _\mathrm{esc}\) , where \(\rho \) is the average gas density of interstellar gas in a galaxy with the volume of the cosmic ray halo included.
The solution of a system of coupled transport equations for all isotopes involved in the process of nuclear fragmentation is required for studying CR propagation. A powerful method, the weightedslab technique, which consists of splitting the problem into astrophysical and nuclear parts was suggested for this problem (Davis 1960; Ginzburg and Syrovatskii 1964) before the modern computer epoch. The nuclear fragmentation problem is solved in terms of the slab model wherein the CR beam is allowed to traverse a thickness x of the interstellar gas and these solutions are integrated over all values of x weighted with a distribution function G(x) derived from an astrophysical propagation model. In its standard realization (Protheroe et al. 1981; GarciaMunoz et al. 1987) the weightedslab method breaks down for low energy CRs where one has strong energy dependence of nuclear cross sections, strong energy losses, and energy dependent diffusion. Furthermore, if the diffusion coefficient depends on the nuclear species the method has rather significant errors. After some modification (Ptuskin et al. 1996) the weightedslab method becomes rigorous for the important special case of separable dependence of the diffusion coefficient on particle energy (or rigidity) and position with no convective transport. The modified weightedslab method was applied to a few simple diffusion models in Jones et al. (2001a, 2001b). The weightedslab method can also be applied to the solution of the leakybox equations. It can easily be shown that the leakybox model has an exponential distribution of path lengths \(G(x) \propto \exp (x/X)\) with the mean grammage equal to the escape length X.
In a purely empirical approach, one can try to determine the shape of the distribution function G(x) which best fits the data on abundances of stable primary and secondary nuclei (Shapiro and Silberberg 1970). It has been established that the shape of G(x) is close to exponential: \(G(x) \propto \exp (x/X(R,\beta ))\), and this justifies the use of the leakybox model in this case. There are various calculations of G(x) (Stephens and Streitmatter 1998; Davis et al. 2000; Jones et al. 2001a, b).
The possible existence of truncation, a deficit at small path lengths (below a few g \(\hbox {cm}^{2}\) at energies near 1 GeV/n), relative to an exponential pathlength distribution, has been discussed for decades (Shapiro and Silberberg 1970; GarciaMunoz et al. 1987; Webber 1993; Duvernois et al. 1996). The problem was not solved mainly because of crosssectional uncertainties. In a consistent theory of CR diffusion and nuclear fragmentation in the cloudy interstellar medium, the truncation occurs naturally if some fraction of CR sources resides inside dense giant molecular clouds (Ptuskin and Soutoul 1990).
For radioactive nuclei, the classical approach is to compute the ‘surviving fraction’ which is the ratio of the observed abundance to that expected in the case of no decay. Often the result is given in the form of an effective mean gas density, to be compared with the average density in the Galaxy, but this density should not be taken at face value. The surviving fraction can better be related to physical parameters (Ptuskin and Soutoul 1998). None of these methods can face the complexities of propagation of CR electrons and positrons with their large energy and spatially dependent energy losses.
2.3 Explicit models
Finally the mathematical effort required to put the 3D Galaxy into a 1D formalism becomes overwhelming, and it seems better to work in physical space from the beginning: this approach is intuitively simple and easy to interpret. We can call these ‘explicit models’. The explicit solution approach including secondaries was pioneered by (Ginzburg and Ptuskin 1976) and applied to newer data by Webber et al. (1992), Bloemen et al. (1993) with analytical solutions for 2D diffusionconvection models with a cosmicray source distribution, which however had many restrictive approximations to make them tractable (no energy losses, simple gas model). More recently a semiempirical model which is 2D and includes energylosses and reacceleration has been developed (Maurin et al. 2001, 2002). This is a closedform solution expressed as a Green’s function to be integrated over the sources. It incorporates a radial CR source distribution, but the gas model is a simple constant density within the disk. Taillet et al. (2004) give an analytical solution for the timedependent case with a generalized gas distribution.
A ‘myriad sources model’ (Higdon and Lingenfelter 2003), which is actually a Green’s function method without energy losses, yields similar results to Strong et al. (2004) for the diffusion coefficient and halo size.
The most advanced explicit solutions to date are the fully numerical models described in other sections. Even this has limitations in treating some aspects (e.g. when particle trajectories become important at high energies) so one might ask whether a fully MonteCarlo approach (as is commonly done for energies \(>10^{15}\) eV) would not be better in the future, given increasing computing power. This would allow effects like fieldline diffusion (important for propagation perpendicular to the Galactic plane) to be explicitly included. However it is still challenging: a GeV particle diffusing with a mean free path of 1 pc in a Galaxy with 4 kpc halo height takes \(\sim \) \((4000/1)^2 \approx 10^7 \) scatterings to leave the Galaxy, which would even now need supercomputers to obtain adequate statistics. Hence we expect a numerical solution of the propagation equations to remain an important approach for the foreseeable future.
3 Phenomenological models
3.1 GALPROP
The GALPROP project (Strong and Moskalenko 1998) was invented with the following aims:

1.
to enable simultaneous predictions of all relevant observations including CR nuclei, electrons and positrons, \(\gamma \)rays and synchrotron radiation,

2.
to overcome the limitations of analytical and semianalytical methods, taking advantage of advances in computing power, as CR, \(\gamma \)ray and other data become more accurate,

3.
to incorporate the best current information on Galactic structure and CR source distributions,

4.
to provide a publiclyavailable code as a basis for further expansion.
The first point was the real driving factor, the idea being that all data relate to the same system, the Galaxy, and one cannot for example allow a model which fits CR secondary/primary ratios while not fitting \(\gamma \)rays or not being compatible with the known interstellar gas distribution. There are so many simultaneous constraints, and that to find one model satisfying all of them is a challenge, which in fact has not been met up to now. GALPROP has been adopted as the standard for diffuse Galactic \(\gamma \)ray emission for NASA’s FermiLAT \(\gamma \)ray observatory.
We give a very brief summary of GALPROP; for details we refer the reader to the relevant papers (Strong and Moskalenko 1998; Moskalenko and Strong 1998; Strong et al. 2000; Moskalenko et al. 2002; Strong et al. 2004; Ptuskin et al. 2006) and two Annual Reviews articles, (Strong et al. 2007) with new developments described in Grenier et al. (2015). Developments of GALPROP have continued. It is maintained as public software^{Footnote 1} which includes an Explanatory Supplement describing the method in full detail. Recent developments are described in (Porter et al. 2017, 2019; Boschini et al. 2020b).
The CR propagation equation is solved numerically on a spatial grid, either in 2D with cylindrical symmetry in the Galaxy or in full 3D. The boundaries of the model in Galactocentric radius and height above the disk, and the grid spacing, are userdefinable. In addition there is a grid in momentum; momentum (not e.g. kinetic energy) is used because it is the natural quantity for propagation. Parameters for all processes in Eq. (2) can be controlled with input parameters. The distribution of CR sources can be freely chosen, typically to represent supernova remnants (SNR). Source spectral shape and isotopic composition (relative to protons) are input parameters. Interstellar gas distributions are based on current HI and CO surveys, and the interstellar radiation field (ISRF), for lepton energy losses and inverse Compton scattering is based on a separate detailed calculation. CR fragmentation and destruction crosssections are based on extensive compilations and parameterizations (Mashnik et al. 2004). The numerical solution proceeds in time until a steadystate is reached; a timedependent solution is also an option. Checks for convergence are implemented. Starting with the heaviest primary nucleus considered (e.g. \(^{64}\)Ni) the propagation solution is used to compute the source term for its spallation products, which are then propagated in turn, and so on down to protons, secondary electrons and positrons, and antiprotons. In this way secondaries, tertiaries etc. are included. (Production of \(^{10}\)B via the \(^{10}\)Bedecay channel is important and requires a second iteration of this procedure.) GALPROP includes Kcapture and electron stripping processes, where a nucleus with an electron (Hlike) is considered a separate species because of the difference in the lifetime. Since Hlike atoms have only one Kshell electron, the Kcapture decay halflife has to be increased by a factor of 2 compared to the measured halflife value.
Primary electrons are treated separately. Normalization of protons, helium and electrons to experimental data is provided (all other isotopes are determined by the source composition and propagation). \(\gamma \)rays and synchrotron are computed using interstellar gas survey data (for piondecay and bremsstrahlung) and the ISRF model (for inverse Compton). Spectra of all species on the chosen grid and the \(\gamma \)ray and synchrotron skymaps are output in a standard astronomical format for comparison with data. Extensions to GALPROP includes nonlinear wave damping (Ptuskin et al. 2006).
We remark that while GALPROP has the ambitious goal of being ‘realistic’, it is obvious that any such model can only be a crude approximation to reality. Some known limitations are: boundary condition (flux set to zero) at the halo boundary is not physical, only energies below \(10^{15}\) eV are treated (no trajectory calculations), spatially uniform source abundances are assumed, though stochastic sources in space and time are also implemented.
CR propagation is traditionally treated as a spatially smooth, steadystate process. Because of the rapid diffusion and long containment timescales in the Galaxy this is to first order a sufficient approximation, but there are cases where it breaks down. The rapid energy loss of electrons and positrons above about 100 GeV and the stochastic nature of their sources produces spatial and temporal variations. Supernovae are stochastic events and each SNR source of CR accelerates for only \(10^4  10^5\) years, which leaves an imprint on the distribution of electrons. This leads to large fluctuations in the CR electron/positron density at high energies, so that the lepton spectrum measured near the Sun may not be typical (Strong et al. 2004). These effects are much smaller for nucleons since there are essentially no energy losses except ionization at low energies, but they are still included. Such effects can influence the B/C ratio (Taillet et al. 2004; Büsching et al. 2005). A recent timedependent GALPROP model is described in Porter et al. (2019).
Here we give some technical details of the GALPROP package, taken from the GALPROP Explanatory Supplement supplied with the code. These can be compared with the other approaches described in this review.
Transport equation. GALPROP solves the transport equation with a given source distribution and boundary conditions for all cosmicray species. This includes Galactic wind (convection), diffusive reacceleration in the interstellar medium, energy losses, nuclear fragmentation, and decay. The numerical solution of the transport equation is based on an implicit secondorder scheme (e.g. Press et al. 1992). The spatial boundary conditions assume either zero CR density at the boundaries or, more physically plausible, free particle escape at the boundaries. Since we have a 3dimensional (R, z, p) or 4dimentional (x, y, z, p) problem (spatial variables plus momentum) we use “operator splitting” to handle the implicit solution.
The propagation equation is written in the form:
where \({\mathcal {N}}={\mathcal {N}}({\varvec{ r }},p,t)\) is the density per unit of total particle momentum, \({\mathcal {N}}(p)dp = 4\pi p^2 f({\varvec{ p }})\) in terms of phasespace density \(f({\varvec{ p }})\), \(q({\varvec{ r }}, p)\) is the source term, \(D_{xx}\) is the spatial diffusion coefficient, \({\varvec{ V }}\) is the convection velocity, reacceleration is described as diffusion in momentum space and is determined by the coefficient \(D_{pp}\), \({\dot{p}}\equiv dp/dt\) is the momentum loss rate, \(\tau _f\) is the time scale for fragmentation, and \(\tau _r\) is the time scale for the radioactive decay.
One can estimate \(D_{pp}=p^{2}V_{\mathrm {a}}^{2}/\left( 9 D_{xx}\right) \) where the Alfvén velocity \(V_{\mathrm {a}}\) is introduced as a characteristic velocity of weak disturbances propagating in a magnetic field, see (Berezinskii et al. 1990; Schlickeiser 2002) for rigorous formulas.
For a given halo size the diffusion coefficient as a function of momentum and the reacceleration or convection parameters is determined by borontocarbon ratio data. The spatial diffusion coefficient is taken as \(D_{xx}= \beta D_0(\rho /\rho _0)^{\delta }\) if necessary with a break (\(\delta =\delta _{1,2}\) below/above rigidity \(\rho _0\)), where the factor \(\beta \) (\(= v/c\)) is a consequence of a randomwalk process. For the case of reacceleration the momentumspace diffusion coefficient \(D_{pp}\) is related to the spatial coefficient \(D_{xx}\) where \(\delta =1/3\) for a Kolmogorov spectrum of interstellar turbulences. The convection velocity (in zdirection only) V(z) is assumed to increase linearly with distance from the plane (\(dV/dz>0\) for all z); this implies a constant adiabatic energy loss. Since the wind cannot blow in both directions at \(z=0\) this formulation requires a zero velocity there. A more general case where the wind starts at zero and reaches a constant value at a specified z has therefore been implemented using a tanh function.
The distribution of cosmicray sources is parameterized and usually chosen to follow the pulsar distribution from radio observations, since pulsars should be a good tracer of SNR, which are difficult to detect at large distances. The injection spectrum of nucleons is assumed to be a power law in momentum, \(dq(p)/dp \propto p^{\gamma }\). Energy losses for nuclei by ionization and Coulomb interactions are included, and for electrons by ionization, Coulomb interactions, bremsstrahlung, inverse Compton, and synchrotron. The code uses crosssection measurements and energy dependent fitting functions.
The code calculates the production and propagation of secondary antiprotons from pp collisions. Secondary positrons and electrons in cosmic rays are the final product of decay of charged pions and kaons which in turn created in collisions of cosmicray particles with gas. Pion production by \(pp,p{\text {H}e},\text {He}p,\text {HeHe}\) collisions are included.
The nuclei are aligned on the same kinetic energy per nucleon \(E_\mathrm{kin}\) since this simplifies the secondarytoprimary computation, where primaries produce secondaries of the same \(E_\mathrm{kin}\). However the basic CR density used has units of density per total momentum p since this is natural for propagation. The actual units used internally are \({c\over 4\pi } {\mathcal {N}}(p)\), where \({\mathcal {N}}(p) = d{\mathcal {N}}/dp\) in units of \(\hbox {cm}^{3}\) \(\hbox {MeV}^{1}\), i.e. \({\mathcal {N}}= 4\pi p^2 f(p)\).
When the flux \(I(E_\mathrm{kin})\) in cm^{−2} sr^{−1} s^{−1} (MeV/nucleon)\(^{1}\) is necessary, it can be simply obtained from
where A is the nucleus mass number. This follows from \(dp = {A\over \beta } dE_\mathrm{kin}\). The combined requirements of transport and fragmentation are thus elegantly met. The normal units for presentation of CR data are cm^{−2} sr^{−1} s^{−1} (MeV/nucleon)\(^{1}\), and with this scheme the conversion is trivial. The nucleus energy scales are logarithmic in \(E_\mathrm{kin}\).
3.1.1 Numerical solution of the propagation equation
Full explicit method. The diffusion, reacceleration, convection and loss terms in eq. (18) can all be finitedifferenced for each dimension (R, z, p) or (x, y, z, p) in the form
where all terms are functions of (R, z, p) or (x, y, z, p).
This is the fully timeexplicit method (Press et al. 1992) where the updating scheme is
which generalizes simply to any number of dimensions since all the quantities are known from the current step. It gives more accurate solutions, which tend to the exact solution according to the computed diagnostics, but are not unconditionally stable (while Crank–Nicolson is). For this reason it is only applicable for short enough timesteps. Since no solution of matrix equations is required, this method is faster than Crank–Nicolson for the same timesteps, and this compensates for the need for smaller steps.
Fully implicit method. The diffusion, reacceleration, convection and loss terms in eq. (18) can all be finitedifferenced for each dimension (R, z, p) or (x, y, z, p) in the form
where all terms are functions of (R, z, p) or (x, y, z, p).
This is the fully timeimplicit method where the updating scheme is
This method is unconditionally stable for all \(\alpha \) and \(\varDelta t\), but is only 1storder accurate in time.
The tridiagonal system of equations
is solved for the \({\mathcal {N}}_i^{t+\varDelta t}\) by standard methods. Note that for energy losses we use ‘upwind’ differencing to enhance stability, which is possible since we have only loss terms (adiabatic energy gain is not included here).
Crank–Nicolson method. Alternatively, the propagation equation can be finitedifferenced in the form
This is the Crank–Nicolson method where the updating scheme is
It thus uses a combination of implicit and explicit terms, forming the timeaverage of the differentials. Like the fully implicit method, this method is unconditionally stable for all \(\alpha \) and \(\varDelta t\), but is 2ndorder accurate in time, so that larger timesteps are possible than with the 1storder scheme.
The tridiagonal system of equations
or
is again solved for the \({\mathcal {N}}_i^{t+\varDelta t}\) by the standard method. Note that the RHS has all known quantities from the current timestep.
The Crank–Nicolson method described above applies to a onedimensional case; the application to 2 or 3 spatial and one momentum dimension requires a generalization. A straightforward expansion to more dimensions implies solving large matrix equations (no longer tridiagonal); instead the socalled ADI (alternating direction implicit) method is used, in which the implicit solution is applied to each dimension in turn. Each application uses just the operator for that dimension, so the tridiagonal scheme can still be used. This however is not completely valid since it solves a slightly different problem from that with the full operator; however for small enough timesteps the solution is accurate (see Section on Tests of GALPROP in the GALPROP Explanatory Supplement).
The explicit method, where the full operator can be used in each timestep without any overhead for solving matrix equations, is also useful for obtaining an accurate solution at the end of a run. Although it is not unconditionally stable, this does not matter provided the timesteps are small enough, which is in any case required for the implicit methods to maximise their accuracy. A suitable mix of explicit and implicit methods to obtain an accurate solution with minimum computing requirements, is the goal.
For 2D, three spatial boundary conditions
may be imposed at each iteration. This is not physically expected, although it is a common conventional assumption. More physically plausible is free escape at the boundaries, which is not the same. For this, it is sufficient simply to not impose the above conditions in the updating scheme, since the \(\alpha _1, \alpha _3\) coefficients do not act outside the boundaries, so there is no diffusive or convective flux inwards at the boundaries. The resulting solutions then have \({\mathcal {N}}>0\) at the boundaries. In future more physical boundary conditions could be implemented, e.g. specifying the outward streaming velocity or the escape probability at the boundaries. No boundary conditions are imposed or required at R = 0 or in p. Grid intervals are typically \(\varDelta R = 1\) kpc, \(\varDelta z = 0.1\) kpc; for p a logarithmic scale with ratio typically 1.2 is used. Although the model is symmetric around \(z = 0\) the solution is generated for \(z_h< z < z_h\) since this is required for the tridiagonal system to be valid.
For 3D, the spatial boundary conditions
may be imposed at each iteration, and free escape at the boundary is an option as for 2D. Again no boundary conditions are imposed in p. Grid intervals are typically \(\varDelta x= \varDelta y = 0.5\) kpc, \(\varDelta z = 0.1\) kpc.
Since we have a 3dimensional (R, z, p) problem we use ‘operator splitting’ to handle the implicit solution, as follows. We apply the implicit updating scheme alternately for the operator in each dimension in turn, keeping the other two coordinates fixed. The source and fragmentation, decay terms are used in every step, so to account for the 3 substeps, \({1\over 3} q_i\) and \(1\over 3\tau \) are used instead of \(q_i\), \(1/\tau \) for the source term and the fragmentation, decay terms respectively. The coefficients for 3 spatial dimension are the same except that R is replaced by (x,y) and the finite differencing coefficients have the same form as for z, and \({1\over 4} q_i\) and \(1\over 4\tau \) are used for the source term and the fragmentation, decay terms respectively, to account for the 4 substeps. With this scheme the solution can be done via the tridiagonal solution for each dimension in turn, as described in Press et al. (1992). The spatial 3D scheme is simpler than the 2D one since the diffusion operator is easier to formulate (x,y,z have the same form), and in addition it does not have the problem of the boundary condition at R=0. In the case of anisotropic diffusion, \(D_{zz}\) is used in the zdirection.
Finally all nuclei are normalized to the proton flux from the parameter file, using the relative abundances given as parameters. The value of \(E_\mathrm{kin}\) is taken as the reference value for the proton normalization. All results are output to FITS files for comparison with data and further analysis.
3.2 Other codes
Following the success of the GALPROP approach described above, other projects with similar goals were started. Here we just mention these without details, which can be found in the papers. The DRAGON project (Gaggero et al. 2014) and references therein which extends the CR propagation to anisotropic and spatiallydependent diffusion. DRAGON is also publicly available.^{Footnote 2} A more physical approach to diffusion with turbulence incorporated in DRAGON is given in Evoli and Yan (2014).
USINE is a semianalytical CRpropagation package, which has the advantage of speed for model parameter explorations, and which has been the basis of many recent investigations. USINE is publicly available^{Footnote 3} as described by Maurin (2020). It has been used for many years already (Putze et al. 2011) and references therein. It has recently been used to study secondary antiprotons (Boudaud et al. 2020) and the size of the Galactic CR halo (Weinrich et al. 2020).
The numerical packages mentioned have limitations in terms of both accuracy and speed, and hence the spatial resolution achievable. Hence their use has mainly been restricted to 2D models with cylindrical symmetry. A new approach is implemented in the PICARD model (Werner et al. 2013; Kissmann 2014), which is fully 3D in concept and has stateofthe art numerical techniques. This makes it possible to handle models with spiral structure at good (e.g. 10 pc) resolution with reasonable computer resources.
4 Selfconsistent models
4.1 The system of equations
To reduce the physical and computational complexity of the CR propagation problem numerous authors neglected the explicit consideration of the streaming process by eliminating the Alfvén waverelated component from the CR propagation speed \({\varvec{u}}\) in Eq. (2) and by defining the spatial and momentum diffusion coefficients as free parameters of the model. In phenomenological models the values of diffusion coefficient are deduced from secondary to primary CR abundances taken from observational data. Depending on particular needs Eq. (2) might be integrated directly or with the aid of its number density or energy density moments. The latter quantities enable construction of numerical solvers in a conservative manner, using finite volume methods both in spatial and in momentum dimensions. In the following considerations we neglect particle acceleration processes, therefore we assume \(D_{pp} = 0\). We also omit particle acceleration and radioactive decay.
4.1.1 CR number density
The number density of CR particles in an arbitrarily chosen range \([p_{\mathrm{L}}, p_{\mathrm{R}}]\) in momentum space is defined as
We multiply Eq. (2) by \(4\pi p^2\) and integrate over p to get the evolution equation for the particle number density
where \(Q^{\mathrm {LR}}\) is the spatial density of CR sources and \(\langle {{\mathbf {\mathsf{{D}}}}}_n\rangle \) is the momentumaveraged spatial diffusion tensor of the particle number density (see also Sect. 4.6). In the limit of \(p_{\mathrm{L}} = 0\) and \(p_{\mathrm{R}}=\infty \) we get the conventional form of the diffusionadvection equation for CR particle number density
4.1.2 CR energy density
The CR energy density in a section \(({p_{\mathrm{L}}},{p_{\mathrm{R}}})\) of the momentum axis is defined as
Again, we integrate Eq. (2) multiplied by \(4\pi p^2 T\) over p, where \(T\equiv \sqrt{p^2 c^2 + m^2 c^4}  m c^2\) is kinetic energy and m is the restmass of CR protons, electrons or other particles. The resulting equation for the CR energy density reads
where \(\langle {{\mathbf {\mathsf{{D}}}}}_e\rangle \) denotes the momentum averaged diffusion coefficient (see Sect. 4.6) of the CR energy and \(S^{\mathrm {LR}}\) sources of CR energy. The CR pressure contribution from particles in the momentum range \( [{p_\mathrm {L}},{p_{\mathrm{R}}}]\) is
In the limit of \(p_\mathrm {L} = 0\), \(p_{\mathrm{R}}=\infty \) and \(b_l=0\) we get the conventional form (see e.g. Schlickeiser and Lerche 1985) of the momentumintegrated diffusionadvection equation for the CR particle energy density
together with an adiabatic equation of state relating the momentum integrated CR pressure to CR energy density \(P_{cr} = (\gamma _{cr} 1) {e_{\text {cr}}}\) with adiabatic index equal to 4/3 for a relativistic gas or its value is in the range [4/3, 5/3] if the transrelativistic population of CR particles is significant.
4.2 Twofluid diffusionadvection models
The development of selfconsistent methods for the CR transport equation started with theoretical work by Drury and Voelk (1981), Axford et al. (1982) who integrated the kinetic equation (2) in momentum space to get a single equation for the total CR pressure. They supplemented the resulting equation to the set of fluid equations for the conventional gas. The two components, thermal gas and the population of the nonthermal CR particles were coupled by the CR pressure term. The resulting twofluid system was applied in analytical studies of hydrodynamic shock structure in the presence of CRs. These preliminary studies have shown that even for moderately strong shock waves most of the upstream energy flux in the background plasma is transferred to cosmic rays, and thus demonstrated the importance of the CR induced dynamical effects in the system composed of CRs and thermal plasma. Schlickeiser and Lerche (1985) used the twofluid system of equations for studies of the dynamics of interstellar gas in galactic disks.
Drury and Falle (1986) presented a first numerical algorithm to model the propagation of CRs together with thermal gas in 1D. The algorithm, based on the solution of an appropriate Riemann problem (see Sect. 4.3.1) has been used to study the stability of CRmodified shocks.
Kang and Jones (1990) extended the twofluid model of diffusive shock acceleration by inclusion of an insitu CR injection at steady state shocks. In a companion paper Jones and Kang (1990) presented the results of timedependent numerical simulations of CRmediated shocks based on the twofluid model. By means of the piecewise parabolic method (PPM) Colella and Woodward (1984) modelled the evolution of plane parallel, pistondriven shocks and spherical adiabatic blast waves. They investigated shocks that sweep up ambient cosmic rays as well as those that inject the cosmic rays directly. Jones and Kang (1993) developed a timedependent two fluid model of CR acceleration during the impact of shocks on dense twodimensional clouds.
Diffusive shock acceleration of relativistic protons and their dynamical feedback on the background flow was included in the twofluid model of Jones et al. (1994) who simulated the dynamical evolution of cosmic gas clouds moving supersonically through a uniform lowdensity medium. In their simulations more than 10% of the initial kinetic energy of the flow was converted into a combination of thermal and CR energy. The fraction of energy going to CRs exceeded in some cases the energy transfered to gas.
Frank et al. (1994) carried out numerical simulations with a new conservative total variation diminishing (TVD) MHD scheme based on a Godunovtype method by Ryu and Jones (1995), Ryu et al. (1995). They treated CRs as a massless, diffusive fluid governed by a conservation equation for the CR energy derived from the momentumdependent diffusionadvection equation (Skilling 1975a). The CR energy equation was solved using a second order monotonic advection and Crank–Nicolson scheme. The paper demonstrated first results of timedependent twofluid CR modified shock simulations in one spatial dimension.
Frank et al. (1995) performed dynamical simulations of oblique MHD cosmicray (CR)modified plane shock evolution. They solved the system of twofluid CRMHD equations and also a more complete system consisting of MHD equations and the momentum dependent diffusionadvection equation. The authors compare the results of twofluid and momentumdependent diffusionadvection approaches.
A comprehensive discussion of the strength and weakness of the twofluid model was presented by Kang and Jones (1997). They found a good agreement of the twofluid model with the dynamical properties of the more detailed diffusionadvection results. They also found that the validity of the twofluid formalism does not necessarily mean that steady state twofluid models provide a reliable tool for predicting the efficiency of particle acceleration in real shocks.
Hanasz and Lesch (2003) presented a new numerical algorithm for twofluid diffusionadvection propagation of CRs coupled dynamically with thermal plasma, with anisotropic, magnetic fieldaligned diffusion. The algorithm was implemented into the MHD code ZEUS3D (Stone and Norman 1992a, b). The paper focussed on the development of a stable algorithm for anisotropic diffusion of CRs along magnetic field vectors defined on a staggered mesh. Details of the anisotropic diffusion algorithm are presented in Sect. 5.2. The CR propagation algorithm, involving an explicit diffusion algorithm coupled to the MHD system, has been demonstrated to be stable within the standard CFL timestep restriction \(\varDelta t \le 0.5 (\varDelta x)^2/D \), where D is the diffusion coefficient. The algorithm was applied in simulations of the Parker instability triggered by cosmic rays injected by a SN remnant and subsequently in numerical experiments of the CRdriven dynamo process (Hanasz et al. 2004, 2009b) and in numerical models of CRdriven winds (Hanasz et al. 2013).
Snodin et al. (2006) realized that the usual Fickian approach to the diffusion, which assumes that the flux of the diffusive quantity is proportional to its instantaneous gradient, leads to several problems. They noted that the anisotropic part of CR diffusion tensor becomes singular at magnetic Xpoints, leading to infinite CR propagation speeds, and consequently limits the timestep of an explicit timestepping algorithm to zero. In order to ensure finite propagation speed they modified the equation for the diffusive flux to a nonFickian form motivated by the turbulent transport of passive scalars (Blackman and Field 2003). The resulting equation for the diffusive quantity was reduced to the form of telegraph equation containing an extra second timederivative, which acts as the displacement current in electrodynamics. The new term was included with an artificially reduced speed of light in order to reduce the propagation speed to numerically acceptable values.
4.3 Dynamical CR MHD models
4.3.1 Riemann problem
The aim of this section is to introduce the Riemann problem as well as the principle of the Godunov method to clarify the terms we use in subsequent sections. The basis for the dynamical CR models are the fluid equations for the thermal gas, which can be expressed in primitive (\(\rho \), u, P) or conserved quantities (\(\rho \), \(\rho u\), \(\epsilon \)). The differential equations of fluid dynamics in primitive form and one spatial dimension read
where we use the short notation \(q_t\equiv \partial q/\partial t\). The three equations describe the conservation of mass, momentum and total energy. We define \(e_{\rm tot}=\rho (\frac{1}{2}u^2+\epsilon )\), where \(\epsilon =\frac{p}{(\gamma 1)\rho }\) and \(\gamma =\frac{C_p}{C_v}\). The equivalent set of HD equations in conservative form is
where U is the vector of conservative quantities, F is the vector of corresponding fluxes. The equations of hydrodynamics are hyperbolic partial differential equations (see, e.g. LeVeque 2002; Toro 2009; Balsara 2017), whose time dependent solutions are given by the socalled charateristics. The characteristic curves are lines in spacelime along which U stays constant. Their slope is given by eigenvalues of the Jacobian \(\partial F_i / \partial x_j \). For the advection equation of quantity q with constant velocity u in one dimension,
the characteristcs are linear functions that simply translate the quantity q. More generally we find solutions by geometrical translation of the initial state to a given point along characteristic lines. In the full set of equations we find that besides advection the system is influenced by the pressure in the gas and the corresponding sound waves \(c_0 = \sqrt{\gamma P_{0} / \rho _{0}}\). The system yields three different characteristcs,
which are the ones for advection (\(\lambda _{0}\)), the advected fluid and a leftgoing sound wave (\(\lambda _{1}\)) as well as the advection and a rightgoing sound wave (\(\lambda _{+1}\)). The characteristics of this problem are illustrated in Fig. 2.
In numerical setups we discretize the domain into cells i and use the discretized form of conservation laws. Integration over a control volume—a finite section of space and time—leads to the evolution equation (Godunov method)
where \(U_i^n\) are averaged conservative quantities over the cell volume and \(F_{i\pm \frac{1}{2}}\) are the fluxes between cells averaged over the timestep.
The Riemann problem describes an initial value problem using a discontinuous initial state S with piecewise constant values on either side of the interface \(x_0\)
The time evolution is described by three types of wave structures, namely shocks, rarefaction waves and contact discontinuities. The solutions can be found by solving the socalled Rankine–Hugoniot jump conditions which represent conservation laws across discontinuities
which is explicitly written as
Using the Mach number
we can write the ratios of densities, pressures and temperatures as follows
Exact solutions can be found with some help of numerical root finding. In numerical practice it is computationally less expensive to compute approximate solutions which do not rely on root finding routines, but instead rely on purely algebraical methods, using explicitely Rankine–Hugoniot conditions (HLL). A particularly important setup is the Sod shock tube (Sod 1978) with the initial conditions
The most prominent example is a shock tube, with four important interfaces, which are illustrated in Fig. 3. From left to right we highlight the head and the tail of the rarefaction wave, the contact discontinuity as well as the shock front moving to the right.
The system described so far does not include magnetic fields, which extend the set of characteristics by magnetic waves. Despite the importance of the magnetic field for CRs in general we refrain from deriving the additional equations here. This setup is for one simple thermal fluid. CRs can be included in three different manners into this setup. The first and most simple inclusion is simply the advection of the CR fluid with the gas velocity. The second possibility includes the CR pressure into the jump condition and accounts for the possibility of two different adiabatic indices for the different fluids as described in Pfrommer et al. (2006). The third possibility does not just include CRs as an existing fluid, but includes the acceleration of CRs in a phenomenological way. A fraction of the dissipated energy at the shock is converted to CRs and treated as a source term in the shocked region. This approach is described in Pfrommer et al. (2017).
4.3.2 Extensions of the Riemann problem including CRs
To address the question of dynamical importance of shockinjected CRs during the structure formation in the \(\varLambda \)CDM universe (Pfrommer et al. 2006) derived a complete analytic solution of the Riemann shocktube problem (Sod 1978) for the medium composed of thermal gas and relativistic CR component in twofluid approximation. They applied their solution in smooth particle hydrodynamics (SPH) cosmological simulations designed for studies of CR energy injection at cosmological shocks.
Miniati (2007) added the number density moment of the CR propagation equation (2) to the system of HD equations and performed characteristics analysis of the system of quasilinear equations describing the dynamical evolution of thermal gas combined with a spectral evolution of a CR population. The study focussed on the hydrodynamical part of the momentumdependent algorithm (see Sect. 4.5 for details) for the evolution of CRs, introduced in the COSMOCR code (Miniati 2001). The CR population was approximated with a piecewise powerlaw distribution function. A set of conservation laws for the number density of CR particles in individual spectral bins, treated as passive scalars, has been supplemented to the system of conservation laws for thermal gas density, momentum and total (gas plus CR) energy density. The exchange of energy between the thermal fluid and the CR components is modeled with flux conserving methods both in configuration and in momentum space. The proposed numerical method is based on a combination of Glimm’s method (Glimm 1965) preserving the discontinuous character of shocks and a higher order Godunov method (Toro 2009) in the smooth flows.
Kudoh and Hanawa (2016) analyzed the CRMHD equations and proposed a fully conservative approach to the system of equations consisting of the set of MHD equations and the equation describing the number density of CR particles in a twofluid approach. They proposed a numerical scheme providing solutions that satisfy the Rankine–Hugoniot conditions. By using the CR concentration normalized to the thermal gas density \(\chi = \rho _{\text {c}r}/\rho \) they have shown that their conditions are equivalent to those obtained by Pfrommer et al. (2006). They derived the corresponding Roetype MHD solver (Roe 1981) for the full system of MHD equations (with the total energy including the energy of thermal gas, cosmic rays and magnetic fields) supplemented with the evolution equation for the CR concentration. They found that solutions obtained for different forms for the CR energy equations, with source terms \({\varvec{v}} \cdot \varvec{\nabla }p_{\mathrm cr} \) (Kuwabara et al. 2004) or \(P_{\text {c}r} \varvec{\nabla } \cdot \varvec{v}\) (Hanasz and Lesch 2003; Yang et al. 2012; Dubois and Commerçon 2016), differ from the Riemann solution between the shock front and the contact discontinuity. They find that the Rankine–Hugoniot relation is seriously violated when the CR pressure dominates in the postshocked gas.
Gupta et al. (2021) found that the standard CR twofluid model described in terms of three conservation laws (expressing conservation of mass, momentum and total energy) and one additional equation (for the CR pressure) cannot be cast in a satisfactory conservative form. The presence of nonconservative terms with spatial derivatives in the model equations prevents a unique weak solution behind a shock. Nevertheless, all methods converge to a unique result if the energy partition between the thermal and nonthermal fluids at the shock is prescribed a priori. This highlights the closure problem of the twofluid equations at shocks. They extended the analysis further and made a comprehensive comparison of different discretization strategies. They constructed a full classification of the available discretization options for the twofluid cosmicray hydrodynamics by comparison of numerical aspects of the ’\(p{\mathrm{d}}v\)’ and ’\(v{\mathrm{d}}p\)’ methods applied for different combinations of mathematically equivalent energy equations. They compared the cases of the gas energy equation with the CR energy equation, the total energy equation with the CR energy equation and total energy equation plus CR entropy equation in two variants including the operator split and unsplit method. After extensive numerical testing, they found that the numerical results are consistent for various reconstruction schemes only with the ’\(p{\mathrm{d}}v\)’ method in a fully unsplit fashion with v and \(p_{cr}\) computed from the HLL Riemann solver values of momentum and density states.
4.3.3 CR injection in SN shocks
A separate issue is how to properly inject CRs in astrophysical shocks. The standard approach is to follow the assumption of Diffusive Shock Acceleration theory (DSA), relating the injection efficiency of CRs at shocks to the Mach number of the shock (Kang and Jones 2007). They find that the shock Mach number can be determined using Rankine–Hugoniot boundary conditions across shocked cells (Miniati et al. 2000; Ryu et al. 2003a; Skillman et al. 2008; Vazza et al. 2009). Vazza et al. (2012a) implement an algorithm for CR energy injection in the ENZO code and apply an approach based on the differences of the gas and CR pressure between cells. Their algorithm selects candidate shocked cells by requiring that the flow in the cell is converging: \(\nabla v < 0\). Then the 3D distribution of cells around the candidate cell is analyzed along the three axes, and it is checked that the gas temperature T, and the gas pseudoentropy, \(S = p \rho ^{\gamma }\) change in the same direction, \(\nabla S \cdot \nabla \rho > 0 \) (Ryu et al. 2003a; Skillman et al. 2008; Vazza et al. 2009). The gradient of the temperature then sets the candidate postshock and preshock cells. The Mach number is then evaluated from the information of the pressure jump between cells given by the Rankine–Hugoniot condition
If the shock Mach number is known the energy flux of shock accelerated protons can be computed as
where \(\rho _u\) is the comoving upstream gas density and \(\eta (M)\) is a function of M (Kang and Jones 2007). The injected energy density of CRs within each cell results from integration of the CR energy flux over time step
where \(\rho \) is gas density in the cell, dx is the cell size and dt is the timestep. The method has been further extended by inclusion of the effects of the upstream CRtothermal ratio by Kang and Ryu (2013) and the magnetic obliquity by Pais et al. (2018).
Pfrommer et al. (2017) presented new methods to integrate the CR evolution equations coupled to magnetohydrodynamics on an unstructured moving mesh of the parallel AREPO code for cosmological simulations. They included an effective recipe for diffusive shock acceleration of CRs at resolved shocks based on Schaal and Springel (2015) and at supernova remnants in the interstellar medium. CR losses are included in terms of Coulomb and hadronic interactions, with CR streaming neglected. The accuracy of their model was demonstrated using simulations of planeparallel shock tubes that were compared to exact solutions of the Riemann shock tube problem for a composite of CRs and thermal gas with effective CR acceleration. Capabilities of the new algorithm have been verified in large scale cosmological simulations and in simulations of galaxy formation.
4.4 Unified Alfvén wave regulated CR transport
One of the first attempts to incorporate the Alfvén wave regulated CR transport introduced in Sect. 1.5.1 in numerical solutions of CR propagation was undertaken by Breitschwerdt et al. (1991) in studies of galactic wind driving mechanisms. Their system of equations, following the analytical work by MacKenzie and Völk (1982), included the set of stationary MHD equations extended with the CR propagation (energy balance) equation and with a separate equation for the energy density of the fluctuating field of Alfvén waves propagating down the CR pressure gradient. A further extension of the model by Dorfi and Breitschwerdt (2012) discussed time dependent nonstationary solutions of galactic winds.
Sharma et al. (2010) incorporated CR energy in the form derived by MacKenzie and Völk (1982)
where \(P_\mathrm {cr} \) is the cosmic ray pressure, \({\varvec{v}}\) is the plasma velocity and
is the streaming velocity with \({\varvec{v}}_a = \frac{ {\varvec{B}}}{\sqrt{4\pi \rho }}\) representing Alfvén velocity directed down the CR pressure gradient and \({{\varvec{b}}} = {{\varvec{B}}}/  {{\varvec{B}}} \) is the magnetic unit vector. Equation (63) describes the streaming of CR gas along the magnetic field direction down the gradient of its pressure.
Equation (63) is challenging for numerical algorithms because the standard upwind timeevolution algorithms with a CFLlimited timestep result in spurious oscillations at the grid scale. These oscillations arise due to unphysically large flux gradients near the minima and maxima and propagate through the computational domain. Using a hydrobased CFL (\(\varDelta t=C \varDelta x/v_s\)) leads to spurious oscillations which originate from the local extrema even for a smooth initial condition. Monotonicity can be achieved at high computational price for an upwind update by setting the timestep \(\varDelta t \propto \varDelta x^3 \). Numerical solutions of Eq. (63) are unstable even with implicit methods and regularization of the equation by an additional smoothing term, resembling incorporation of explicit viscosity in Euler’s equations is necessary.
Sharma et al. (2010) proposed to replace the discontinuous streaming velocity in Eq. (63) by its smooth approximation \(\tanh (v_s/\epsilon )\), where \(\epsilon \) is a small parameter. This operation introduces an additional diffusive term to the CR propagation equation with the diffusion coefficient \(v_s/\epsilon \) and numerical stability is achieved for the timestep limitation given by
It has been demonstrated that stable numerical solutions are achievable due to the regularization.
Uhlig et al. (2012) and later on Dubois et al. (2019) showed that streaming can be recasted into a diffusion term and be solved with an implicit solver for diffusion. The streaming transport term in the CR energy equation \({\varvec{\nabla }} \cdot [({e_{\text {cr}}}+ {P_{\text {cr}}}) {{\varvec{v}}}_s]\) becomes
and can be interpreted as anisotropic diffusive term, where \(D_s\) is the diffusion coefficient corresponding to the streaming of CRs along magnetic field lines. The streamingdiffusion process has been modeled with an anisotropic implicit diffusion algorithm and is an interesting alternative to the one proposed by Sharma et al. (2010). Characteristic for the solutions obtained with the two different approaches are the flattened extrema apparent in numerical tests, such as those initiated with sinusoidal perturbations (see Fig. 4).
To avoid the ad hoc smoothing Jiang and Oh (2018) proposed a new numerical algorithm based on the twomoment methods of radiative transfer under the reduced speed of light approximation. The system of equations for the propagation of CR energy density and flux reads
where \(V_m\) is the maximum speed at which CRs can propagate which, for practical reasons, is reduced with respect to the speed of light c. The authors demonstrated that their results are not sensitive to the exact value of \(V_m\) as long as it is much larger than the maximum Alfvén and flow velocities in the simulations. On the other hand \(V_m\) can be assumed much smaller than the speed of light, which is important for an effective mitigation of the CFL condition. Essential advantage of the method is that it ensures a stable evolution for isotropic and field aligned streaming and diffusion without any regularization procedure. The timestep given by the standard Courant condition scales linearly with resolution. The full set of equations consists of the standard set of conservative MHD equations extended with the set of the two Eq. (67) and with additional CRrelated source terms in the momentum and energy equations. The difference with respect to the approach by Sharma et al. (2010) is that the interaction coefficient (inverse CR diffusion coefficient) \(\sigma _\mathrm {cr}\) becomes zero when \({\varvec{\nabla }} P_\mathrm {cr}\) approaches zero. In this regime the term \(\frac{1}{V_m^2} \frac{{\partial }^{} {{\varvec{F}}_\mathrm {cr}}}{{\partial } {t}^{}}\) becomes important, which is the main difference between these two approaches. The flat extrema in the spatial CR distribution can be understood as the result of CR streaming outwards until the flat top develops. CRs cannot stream further to produce an inverted profile because that would require CRs to stream up their gradient. An important element of the approach is the closure relation between the CR pressure tensor and the CR energy density. Jiang and Oh (2018) assume that \({\varvec{P}}_\mathrm {cr} = {\varvec{I }}e_\mathrm {cr}/3\). This assumption is correct only when CRs are strongly coupled to the gas, but in the case of strong wave dumping CRs may stream freely and the CR pressure can be very anisotropic. The algorithm has been implemented in the publicly available MHD code Athena++ (Stone et al. 2020).
Thomas and Pfrommer (2019) developed a new macroscopic transport theory, which includes both diffusion and streaming of CRs in the selfconfinement picture. They incorporated resonant excitation of Alfvén waves through the gyroresonant instability by CRs streaming along magnetic field lines. CR scattering off these waves modulates the macroscopic CR transport. Their approach relies on the system of three equations including an equation for the CR energy density \(e_\mathrm {cr} \) and its flux density \(F_\mathrm {cr} \) in the Eddington approximation of radiative transport and the equation describing the evolution of the energy density of Alfvén waves \({e_{a,\pm }} \) excited by the streaming CRs. The ± signs denote co and counterpropagating waves with respect to the large scale magnetic field. The Alfvénwave regulated CR transport equations [eqs. (1016) in Thomas and Pfrommer (2019)] in the fluid (comoving) reference frame are
where \(e_\mathrm {cr}\) and \(F_\mathrm {cr}\), are measured with respect to the comoving (fluid) frame and the Alfvén wave energy density \(e_{a,\pm }\) is measured in the lab frame, \({\varvec{b}} = {\varvec{B}}/B\) is the unit vector directed along magnetic field and
are the Lorentz forces due to smallscale magnetic field fluctuations of Alfvén waves.
The subsystem is closed by the grey approximation for the CR diffusion coefficients linking the diffusion of CR energy density directly to the energy density of Alfvénic turbulence
where \(\varOmega = Ze B/(\gamma m c)\) is the relativistic gyrofrequency of a CR population with charge Ze and Lorentz factor \(\gamma \).
The scattering rate of CRs particles depends on the Alfvén wave energy density, so this energy density has to be dynamically evolved together with the propagation of CRs. The transport of Alfvén waves depends on several damping processes such as nonlinear Landau damping, ionneutral damping, turbulent and linear Landau damping as well as by subAlfvénically streaming CRs.
The CRAlfvénic subsystem is coupled to the set of ideal MHD equations in a manner ensuring energy and momentum conservation in the nonrelativistic limit of MHD
with the vector of conserved variables \(\mathbf {U}\), the fluxes \({{\mathbf {\mathsf{{F}}}}}\equiv {{\mathbf {\mathsf{{F}}}}}(\mathbf {U})\), and the source terms \(\mathbf {S}\). The three vectors can be described as (Thomas and Pfrommer 2019)
Here, \(\rho \) is the mass density, \({\varvec{ v }}\) is the velocity, and \(Q_{+}\), \(Q_{}\) are the source terms of thermal energy due to Alfvén wave energy losses. For the ionneutral damping \(Q_{\text {in}\pm } = \varGamma _{\text {in}} e_{a,\pm } \), where \(\varGamma _{\text {in}}\) is the damping rate for Alfvén waves due to ionneutral collisions. For the nonlinear Landau damping \(Q_{\text {nll}\pm } = \alpha e_{a,\pm }^2\), where the interaction coefficient \(\alpha = \frac{\sqrt{\pi }}{8}\frac{v_{\text {th}}}{e_B} \langle k \rangle \) is a function of thermal velocity, magnetic field energy density and an averaged wavenumber. The turbulent damping and linear Landau damping lead to \(Q_{\text {turb+ll}\pm } = (\varGamma _{\text {turb}}+\varGamma _{\text {ll} }) e_{a,\pm }\) with turbulent damping rate given by \(\varGamma _{\text {turb}} \simeq v_a \sqrt{k_{\parallel ,\text {min}} k_{\text {mhd,turb}}}\), where \(k_{\text {mhd,turb}}\) is the wavenumber at which the large scale MHD turbulence is driven and \(k_{\parallel ,\text {min} }\sim 1/r_L\), \(r_L\) is the Larmor radius [details see Thomas and Pfrommer (2019), and references therein].
Symbol \({\varvec{ g }}\) represents forces between CRs, Alfvén waves and the thermal gas:
where
are the Lorentz force due to the largescale magnetic field and the ponderomotive force respectively, and \(P_{\text {a},+} + P_{\text {a},} \) are the ponderomotive pressures.
The thermal and CR energy densities are given by \(e_\mathrm {th}\) and \(e_\mathrm {cr}\), respectively. The total pressure P and the total energy density excluding CRs are
The system of the equations is closed using an equation of state for both the thermal as well as the CR fluid,
The adiabatic indices are usually set to the canonical value of \(\gamma _\mathrm {th}=5/3\) and to \(\gamma _\mathrm {cr}=4/3\) implying a fully relativistic fluid.
Thomas and Pfrommer (2019) presented numerical solutions of the new CRAlfvén wave subsystem in one spatial dimension along the magnetic field. The inclusion of the nonequilibrium kinetic effects in the Alfvén wave propagation advances significantly the treatment of CR propagation over the approaches assuming a fixed Alfvén wave background. One of the tests reported by the authors exhibits the expected property of the system that the nonlinear Landau damping process reduces the wave energy, increases the CR flux density and makes the CR transport more diffusive. The formalism itself does not depend on free parameters, since the CR diffusion and the wave Landau damping coefficients are given by MHD quantities and the characteristic gyrofrequency of CR population in the grey approximation. The only tunable parameter—the reduced speed of light—is chosen so that the solution does not depend on its specific value.
The aproach by Thomas and Pfrommer (2019) recovers the equations of Sharma et al. (2010) in the steadystate limit. The major difference between the formalisms of Jiang and Oh (2018) and Thomas and Pfrommer (2019) is that the diffusion coefficient of CRs in the first case is reconstructed from the distribution of \(e_\mathrm {cr}\)
while in the latter case it is related to the energy density of Alfvén waves and may be influenced by various damping processes, such as Landau damping, inaccessible directly in the former approach. The results obtained with the method by Jiang and Oh (2018) are almost identical to those obtained with the Thomas and Pfrommer (2019) in a test case initiated with a Gaussian profile of CR energy density, however a similar test involving the Gaussian profile superposed to an initial uniform CR background, shown in Fig. 5 indicates advantages of the separate treatment of Alfveń wave component in the method proposed by Thomas and Pfrommer (2019).
Another interesting alternative for the direct incorporation of the streaming process on large galactic scales has been proposed by Krumholz et al. (2020) who develop theoretical models of CR propagation, relating CR diffusion to the streaming process in magnetic field line random walk (FLRW). They describe the FLRW as the macroscopic diffusion coefficient to indicate that (1) the averaging is done over scales larger than the coherence length of MHD turbulence, (2) the process relies on the Alfvén wave regulated transport, which arises from the firstorder term in distribution of pitch angles, while diffusion of CR relative to the bulk flow represents a secondorder microscopic diffusion. They present an explicit formula for the CR parallel diffusion coefficient (their Eq. 20) and show its dependence on energy (their Fig. 2) for three starbust galaxies and the Milky Way. They apply the computed diffusion coefficient to a simple model of CR escape and loss, and show that the resulting \(\gamma \)ray spectra are in good agreement with the observed spectra of the starbursts NGC 253, M82, and Arp 220. The model reproduces relatively hard GeV \(\gamma \)ray spectra and softer TeV spectra without the need for any finetuning of advective escape times or the shape of the CR injection spectrum.
4.5 Momentumdependent diffusionadvection models
Up to now we have discussed numerical treatments of the diffusionadvection equation (2) integrated over momentum space which leads us to the twofluid approaches applied for the combination of a thermal fluid and CRs treated as a relativistic fluid. Neglecting the evolution of the whole CR population in momentum space is a significant simplification.
However, the Fokker–Planck equation (2) can be also discretized and solved numerically in both spatial and momentum spaces to determine a timeevolution of the distribution function \(f({\varvec{x}}, p)\) in a way similar to the approaches implemented in GALPROP (Strong and Moskalenko 1998), PICARD (Kissmann 2014), DRAGON2 (Evoli et al. 2017), but with dynamical coupling to the thermal plasma taken into account.
Including the additional momentum dimensions in full generality becomes computationally demanding because the space of independent variables expands from three to six dimensions. A practical option is to reduce the problem to four dimensions by assuming that the distribution function is isotropic. A standard discretization with piecewise constant values for f requires relatively high spectral resolution in order to obtain accurate results. Because of a typically high dynamical range of the powerlow distribution function a few hundred bins are necessary to achieve a reasonable accuracy of the numerical integration (see e.g. Winner et al. 2019; Girichidis et al. 2020b).
Falle and Giddings (1987) and Bell (1987) used partial differential equation solvers to investigate the timedependent structure of plane parallel shocks propagating parallel to the largescale magnetic field. They solved the CR transport equation (2) in momentum space, together with the transport of gas and CRs in one spatial dimension. They used firstorder Godunov methods to evolve the gas in a conservative manner together with a nonconservative treatment of the CR population represented by the function \(g=p^4 f\) on a uniform grid of the independent variable \(y=\ln p\). The effectively smaller dynamical range of g resulted in a possibility to reduce resolution of the momentum grid. These authors applied a Lagrangian formalism for advection and diffusion of the CR spectrum and used the CrankNicholson method. They included injection of particles at the shock position and assumed a momentumdependent CR diffusion coefficient.
Another way to reduce the computational cost is to consider CRs as a passive component needed only for observational diagnostics of the simulated object. In this case a smaller spatial resolution of synthetic images is usually sufficient, therefore the spectrum can be evolved for a relatively small set of Lagrangian particles. If dynamical impact of CRs on the thermal fluid is to be taken into account, the spectrum is needed for each computational element of the spatial grid. This would imply the need to process hundreds of momentum bins on multidimensional spatial grids leading to very high computational costs of numerical models.
To mitigate the computational demands several methods have been proposed to solve the Fokker–Planck equation using a piecewise powerlaw representation. The currently popular methods can be classified as onemoment and twomoment approaches, involving number density \({n_{\text {cr}}}\) and/or energy density \({e_{\text {cr}}}\) moments of the distribution function f defined in Sect. 4.1.
4.5.1 Onemoment approaches
To achieve a more accurate evolution of the spectrum with a lower number of momentum bins one needs an accurate representation of the spectrum within a single bin. Since the observed spectra of CRs are powerlaws to a good approximation, a natural choice is the numerical representation by the piecewise powerlow distribution function. Jun and Jones (1999) assumed a piecewise powerlaw electron spectrum of the type
where edges of ith bin are placed at \(p_{i1/2}\) and the logarythmic slope \(q_i\) is attributed to bin centers. They used the number density as the dependent variable representing CRs
to obtain the number density moment of the CR discretized transport equation (2). They noted that only a few bins may capture the basic structure of the spectrum. They assumed a continuous spectrum at the bin boundaries. By imposing the same values of the slope \(q_i\) for two lowest bins in the log of momentum space one can solve, with the use of continuity assumption, the system of equations recursively for the entire spectrum.
The method has been combined with the ideal MHD equations for an adiabatic plasma, solved using the ZEUS3D Eulerian code (Stone and Norman 1992a, b; Jun et al. 1994). The advection equation for the electron number density was solved by the standard fluid transport algorithm and the adiabatic compression term was updated implicitly for the timecentered number density of electrons in each momentum bin. The CR electrons were treated as a passive population without a significant pressure affecting the thermal plasma component. The diffusion term in the CR propagation and the synchrotron losses were ignored. The code has been used to study the MHD evolution of a Type Ia supernova remnant with CR electrons and for SN interactions with clouds in two spatial dimensions.
Using the piecewisepowerlaw approximation within another code Jones et al. (1999) solved the equations of ideal nonrelativistic magnetohydrodynamics (MHD) in cylindrical coordinates. Tregillis et al. (2001) used the method combined with 3D MHD simulations of electron transport in radiogalaxies.
The code is an MHD extension of the Harten (1983) conservative, secondorder finite difference total variation diminishing scheme, as detailed in Ryu and Jones (1995), Ryu et al. (1995, 1998). The electron transport equation was derived from the general momentumdependent diffusion advection equation (2) with the effects of spatial diffusion neglected. To properly treat the particle density at shock discontinuities their algorithm evolved the normalized concentration of relativistic particles \(b_i = n_i/\rho \), where \(\rho \) is the gas density.
The onemoment piecewise powerlaw method proposed by Jun and Jones (1999) is relatively straightforward and computationally inexpensive, however, there is a fundamental problem with a continuous description of f in particular for a locally varying spectrum. Numerical tests (Girichidis et al. 2020b) show that if energy is injected at one part of the spectrum, the continuity assumption enforces changes of the local slope across the entire spectrum. The resulting continuous representation then alternates between a concave and a convex spectrum. Artificial oscillations superposed to the initially smooth spectrum have a tendency to grow towards high energy bins revealing a numerical instability of the scheme. To avoid these oscillations, the energy in all bins need to be adjusted. The problem is less severe for a small number of bins, equal or less than 10. An alternative for the continuous spectrum is the discontinuous modeling, which requires to constrain two degrees of freedom. Within the onemoment approach one may consider the additional restriction imposing a constant curvature of the spectrum through the relation \(q_{i+1}  q_i = q_i  q_{i1} \), which turns out to be suitable only for CR nucleons, but not for the fast cooling electrons (Miniati 2001).
An interesting onemoment approach to the propagation of CR electrons, not affected by the numerical instability described above, was proposed by Mimica et al. (2009) and implemented in SPEV code and followed by Vaidya et al. (2018) who incorporated their algorithm in the PLUTO code. These authors presented a hybrid framework which describes the spectral evolution of highly energetic particles by means of (meshless) Lagrangian macroparticles embedded in a classical or relativistic MHD fluid. The main purpose of this work was the inclusion of subgrid microphysical processes at macroscopic astrophysical scales where the fluid approximation is adequate. The MHD equations were integrated by means of standard Godunovtype finitevolume schemes, while propagation of macroparticles representing CRs is described by the relativistic version of the cosmicray transport equation (2). In the numerical implementation the number density moment of the equation corresponding to Eq. (32) was solved for the CR particle number density normalized to the fluid number density \(\chi _p = n_p/n\) (Vaidya et al. 2018). Spatial diffusion of CR particles as well as backreaction from particle to the fluid were not included. The novel aspect of their approach is the Lagrangian approach in momentum space assuming that bin edge positions drift in accordance with the flow of particles in momentum space due to actual cooling and heating processes. Position changes of binedges were calculated by means of the method of characteristics in momentum space reducing the problem to the set of ordinary differential equations for each Lagrangian particle moving in physical coordinate space. The Lagrangian discretization in momentum space implies that the particle number within each bins remains constant. The powerlaw index q needed for computing of synchrotron emissivity was computed a posteriori.
4.5.2 Twomoment approaches
Another method proposed by Miniati (2001) binds the pair of distribution function parameters \((f_{i  1/2}, q_i)\) to its two moments: number density \(n_i\) and energy density \(e_i\). In absence of energy loss processes (radiative and adiabatic losses) these two moments are conservative quantities and therefore they are suitable for an accurate evolution with conservative transport schemes in both the spatial and momentum domains. A summary of the twomoment piecewise powerlaw method is presented in Sect. 5.3.
Using a similar approach Jones and Kang (2005) modelled the propagation of CRs including advection plus diffusion in space and advection in momentum. The propagation equation does not include any strong cooling effects, such as the ionization or synchrotron cooling which act predominantly on one of the edges of the spectrum. Therefore the spectrum can be processed in an arbitrarily chosen range of momentum space, with the momentum boundary condition setting the particle number density to zero at the high energy end. At the low energy range of the spectrum the distribution was matched to the thermal particle distribution. The authors refer to the method as to “CoarseGrained Momentum finite Volume” or “CGMV”. It extends the ideas introduced in Jones et al. (1999), Miniati (2001) for the case of CR transport across an Eulerian grid including advection and diffusion.
Jones and Kang (2005) extended the CGMV method so that it can be applied to the treatment of fully nonlinear CR modified shocks. The algorithm has been implemented in the CRASH code which is based on the high order Godunovlike shock tracking algorithm. The hydrodynamics routine in that code employs a nonlinear Riemann solver to follow shock discontinuities within the zones of an initially uniform grid. Thus, gas subshocks in CRmodified shocks remain discontinuous throughout a simulation, allowing CR transport to be modeled down almost to the scale of the physical shock thickness. CRASH also employs adaptive mesh refinement (AMR) around shocks in order to reduce the computational effort on the spatial grid.
With the aim of studying the Fermi bubbles (kpcscale gammaray features centred on the Galactic Centre) Yang and Ruszkowski (2017) develop a new CRSPEC module for FLASH code to track the CR spectrum during MHD simulations. They construct a scenario for the Fermi bubbles resulting from AGN jet activity in the center of Milky Way. The specific features of the Fermi bubble’s spectra including their spatial uniformity, shapes of the spectra and high energy cutoff at 110 GeV suggest a leptonic origin. The physical nature of the problem requires, therefore, a method to evolve the spectra of CR electrons dynamically together with the fluiddynamical evolution of the expanding bubble. The method they adopted to trace the CR electrons spectral evolution follows the piecewise powerlaw approach by Miniati (2001). They solve the twomoment set of equations for a population of CR electrons advected along trajectories of a set of tracer particles while CR diffusion neglected. They assumed a hydrodynamical evolution of the thermal component and a fixed magnetic field taken from GALPROP models. In this sense their approach represents a intermediate step between the CR propagation in a fixed plasma background and the selfconsistent models.
Winner et al. (2019) presented an efficient postprocessing code for Cosmic Ray Electron Spectra that are evolved in Time (CREST) on Lagrangian tracer particles. The novel element of their method is the division of the overall spectrum into three parts treated with different methods. They note that for very low momenta the timescale related to the Coulomb cooling process becomes shorter than the typical time step of MHD simulations. Similarly, for very high momenta the synchrotron and inverse Compton energy losses proceed on arbitrarily short timescales. In order to efficiently calculate the CR electron spectrum with time steps similar to the MHD time step, they use analytical solutions for low and high momenta together with the fully numerical treatment for intermediate momenta. The situation is outlined in Fig. 6.
The analytical approach relies on the consideration of the momentum losses corresponding to the cooling terms in the CR transport equation (2). The momentum losses integrated over a time step lead to the change of the distribution function due to the cooling which shifts particles with from \(p_{\mathrm{ini}}\) to p within \(\varDelta t\)
The cooled spectrum can be interpreted as a momentum shift of the initial spectrum at time \(t_0\) multiplied with a momentumdependent cooling factor. In the central part of the spectrum the CR transport equation (2) is solved with the aid of direct numerical integration relying on the operator split technique. The spectrum is calculated on a discrete momentum grid with piecewise constant values. A cubic interpolation function is used to calculate the analytic solution after a time step \(\varDelta t\).
The combination of analytical and numerical methods enables the integration of the spectra on reasonably large MHD time steps. The hybrid analyticalnumerical method is implemented in the CREST module and coupled to the cosmological MHD code AREPO (Springel 2010; Pakmor et al. 2016c) with CR protons modeled as a relativistic fluid with a constant adiabatic index of 4/3 in a twofluid approximation (Pfrommer et al. 2017). The coupling of CR propagation to the MHD system is done with the aid of Lagrangian tracer particles, which trace the velocity field (Genel et al. 2013) and are passively advected with the gas. The CR electron transport equation is solved for each particle in a postprocessing routine on every MHD time step. The hybrid technique enables modeling of the spectral CR electron evolution such as adiabatic expansion and compression, Coulomb losses, radiative losses: inverse Compton, bremsstrahlung and synchrotron processes, diffusive shock acceleration and reacceleration, and FermiII reaccelleration. The authors demonstrate that the CR electron spectra are efficiently and accurately evolved in shocktube and SedovTaylor blast wave simulations. This technique opens up the possibility to produce selfconsistent synthetic observables of nonthermal emission processes in various astrophysical environments like SNR (Winner et al. 2020).
A similar technique based on a combination of the numerical integration with the aid of piecewise powerlaw method and the analytical prescription of the Coulomb cooling has been applied by Girichidis et al. (2020b). The analytical solution helps to overcome the excessive shortening of the integration timestep whenever the cooling timescale is significantly shorter than the hydrodynamical timescale. The numerical integration scheme incorporated the twomoment approach by Miniati (2001). The original algorithm was modified in the part responsible for cooling losses, that were computed through a modification of interbin fluxes, rather than by inclusion of source terms (incorporated through the ’R’term in the original approach, see Sect. 5) to the evolution equation for the spectral energy density of CRs. The modification enables a more accurate computation of the spectral slope and is a lessdiffusive alternative for the propagation of CR population in momentum space. Tests of the algorithm have confirmed that a combination of injection and cooling of CRs including Coulomb and hadronic losses shows a very good agreement with theoretical steady state spectra.
Solutions of the CR transport equation (2) including advection, diffusion and spectral evolution coupled with the MHD evolution of the thermal plasma turn out to be challenging. Up to now only approaches restricted to a subset of physically relevant processes have been successful. The GALPROPtype codes include an extensive set of physical interactions of CR particles under the assumption of fixed magnetic field, the CGMV method of Jones and Kang (2005) is capable of modeling spectral evolution together with diffusion, advection and dynamical coupling of the CR population to the thermal plasma, but cannot cope with the fast cooling processes. Other implementations (Miniati 2001; Winner et al. 2019) engaging Lagrangian test particles include particle acceleration and various cooling processes, but ignore diffusion and dynamical coupling to thermal plasma.
Limitations of the original CGMV method become severe in the presence of fast cooling processes, such as synchrotron emission, which naturally tends to evacuate all particles from high energy bins, producing steep spectra near the upper cutoff. To avoid these limitations Ogrodnik et al. (2021) extended the CGMV method with movable boundaries, which change in response to CR momentum gains or losses near the extremes of the population distribution. The extension relies on an operational definition of spectral cutoffs which define spectral boundaries of the spectrum. The extension involves a special treatment of momentum bins containing spectral cutoffs. Contrary to the regular bins of fixed width, those bins have variablewidth, and their outer edges coincide with spectral cutoffs.
The CR spectra may have different cutoffs in each spatial grid cell, because local cooling conditions (magnetic and velocity fields) are generally different. Due to advective and diffusive propagation of the CRs across the spatial grid, different populations of particles mix in every cell. The essential part of the numerical problem is to estimate an effective cutoff for the mixture of different populations inflowing from neighboring cells with different cutoffs. The cutoff positions are estimated from the particle number density and energy density in the outer bins for an assumed value of an additional parameter \(e_\text {small} \) representing the smallest physically significant level of CR spectral energy density. Estimation of cutoff positions from the number density and energy density moments enables a numerically stable computation of powerlaw indexes in the active bins, especially those containing the cutoffs, what would not be possible in the case of fixed boundary conditions in momentum space.
The algorithm is designed to follow spectral evolution of CRs coupled with an MHD system on Eulerian grids and is particularly useful for modeling of CR electron population subject to strong synchrotron and inverse Compton cooling in the highenergy part of the spectrum. The algorithm is suitable for studies of CR electron spectrum evolution in MHD simulations of the galactic interstellar medium.
4.5.3 Advances in theory of CR propagation
An important development has been to explicitly compute the trajectories of charged particles numerically in the magnetised ISM, thus going beyond the analytical approximations of e.g. the quasilinear theory. In principle this involves just the Lorentz force and Maxwell’s equations, i.e. very basic physics. This approach was pioneered by Giacalone and Jokipii (1994, 1999). The turbulent magnetic field is modelled as a superposition of modes with a powerlaw spectrum, using Alfvén waves. The trajectories are computed for large numbers of particles, and then statistical properties—diffusion tensors etc—are calculated (e.g. Reville et al. 2008). The diffusion coefficient perpendicular to the Bfield is found to be much smaller than the parallel coefficient. Casse et al. (2002) extended this approach to higher energies and a wider range of environments, including SNR, superbubbles and radiogalaxies.
Desiati and Zweibel (2014) show that even simple magnetic nonuniformities combined with pitch angle scattering can enhance cross field line transport by several orders of magnitude, while pitch angle scattering is unnecessary for enhanced transport if the field is chaotic. Perpendicular diffusion remains relatively small compared to parallel diffusion. Snodin et al. (2016) study CR diffusion by means of particle simulations in turbulent magnetic fields. They obtain direct estimates of the diffusion tensor from test particle simulations in random magnetic fields, with the Larmor radius scale being fully resolved and find that diffusion coefficients obtained are consistent with existing transport theories that include the random walk of magnetic lines. Shukurov et al. (2017) calculate cosmicray diffusivity in intermittent dynamogenerated magnetic fields using test particle simulations. The results are compared with those obtained from nonintermittent magnetic fields having identical power spectra. The presence of magnetic intermittency significantly enhances cosmicray diffusion over a wide range of particle energies. The authors demonstrate that the results can be interpreted in terms of a correlated random walk. Seta et al. (2018) use test particle simulations, tracing the propagation of charged particles (protons) through a random magnetic field, to study the cosmic ray distribution at scales comparable to the correlation scale of the turbulent flow in the interstellar medium (~ 100 pc in spiral galaxies). They find that there is no spatial correlation between the cosmic ray number density and the magnetic field energy density. Lowenergy cosmic rays can become trapped between magnetic mirrors, whose location depends more on the structure of the field lines than on the field strength. These results are relevant for interpreting synchrotron emission data which often assume energy equipartition of CRs with the magnetic field energy.
Meanwhile observationbased models of the Galactic magnetic fields and related theory are improving, and these can be input to CR propagation studies, as addressed elsewhere in this review.
4.6 Spatial diffusion of spectrally resolved CRs
In contrast to advection, spatial diffusion includes an interaction of spatial and spectral changes. Being energy conserving, spatial diffusion itself does not transfer CRs in momentum space at one position in space, i.e., \(\partial f/\partial p=0_{x}\). But the transport of number and energy density to neighbouring cells depend on the spatial derivatives of f. Depending on the values in neighbouring fluid elements and combined with a different diffusion tensor for n and e will result in changes of both amplitude \(f_{i1/2}\) and slope \(q_i\) within one spectral bin, and with that the other physical processes in the following evolution. We derive the terms for number and energy density separately. For the former one the spatial diffusion in momentum range \([p_1, p_2]\) is given by
with the diffusion tensor \({{\mathbf {\mathsf{{D}}}}}\),
The components include the orientation of the magnetic fields. The components are chosen to be (Ryu et al. 2003b),
with normalised components of the magnetic field, \(b_i=B_i/{\varvec{ B }}\). The dependency on momentum is expressed as
with \(p_{10} = 10\,\mathrm {GeV/c}\). Parallel and perpendicular diffusion coefficients with respect to the magnetic field are denoted as \(D_{\parallel ,10}\) and \(D_{\perp ,10}\). Equation (86) can be solved directly by replacing the individual components yielding
Here, \(\partial _k=\partial /\partial k\) is the partial derivative with \(k\in \{x, y, z\}\), so the spatial derivatives of f need to be taken into account. Alternatively, we can write
where the equation formally takes the form of a simple diffusion equation with only a modified diffusion tensor \(\left\langle {{\mathbf {\mathsf{{D}}}}}_n\right\rangle \). The individual components of the diffusion tensor take the form
For \(D_{ij}=D'_{ij}(p/p_{10})^\alpha \) we find
In an analogous way we treat the energy density,
with the modified diffusion coefficients
which can be rewritten to include the scaling with momentum
The full computation of the spectrally resolved diffusion involves many derivatives and introduces numerical errors. The usual approach of applying limiters is a very powerful method for conserved quantities. For a simple numerical representation of the particle distribution function, e.g. a piecewise constant representation, a limiter can simply be applied. But if more complex representations are chosen like piecewise powerlaws as in e.g. Girichidis et al. (2019), the derivatives include the terms that scale with the spatial derivative of the amplitude as well as the derivative of the slope. Applying limiters to those individual terms are not simply applicable as the quantities are not conserved. A simple approximate solution to the full problem described above is derived in Jones and Kang (2005), where the number density weighted diffusion coefficient reads
The corresponding energy weighted counterpart can be expressed as
with \(g_{i}\left\langle D / p^{2}\right\rangle _{i}=\int _{p_{i}}^{p_{i+1}} p D f \mathrm {d} p\) .
5 Numerical details
5.1 Numerical treatment of CR diffusion
Numerically solving diffusive CR transport faces two main challenges. First of all, the diffusion equation is an elliptic PDE, which means that the solution propagates infinitely fast, i.e. the domain of dependence is the entire domain. Ideally, one would like to solve the diffusion equation with an implicit algorithm including the entire domain. However, this is numerically demanding and approximate solutions are favoured. The solution using an explicit algorithm requires to satisfy the explicit von Neumann stability criterion with a maximum integration time step
where \(\varDelta x\) is the resolution of an individual cell and D is the diffusion coefficient. The second complication is that the diffusion of CRs is highly anisotropic with the largest diffusion parallel to the magnetic field lines. The diffusion coefficient thus extends to a diffusion tensor, with coefficients describing the orientation of a flow with respect to the magnetic field orientation. For an explicit algorithm the time step criterion changes to
in the case of a dimensional split numerical scheme, where \(D_\parallel \) and \(D_\perp \) are the parallel and perpendicular diffusion coefficients, repsectively, and \(C_{\text {cr} } < 1 \) is the Courant number (e.g. Hanasz and Lesch 2003). In the case of an unsplit scheme the numerical coefficient changes to 0.3. Whereas the implicit solution for isotropic diffusion can simply be computed using the Green’s function, the anisotropic case does not have a simple form of the Green’s function. Therefore, iterative methods are used.
5.2 Anisotropic diffusion on a regular mesh
In this section we present details of the implementation of the anisotropic diffusion algorithm presented by Hanasz and Lesch (2003). The algorithm has been designed for the staggered mesh setup of the ZEUS3D MHD code, with the MHD algorithm involving the constraint transport (CT) (Evans & Hawley 1988) method to ensure the divergencefree evolution of the magnetic field. The staggered mesh locates the individual components of the magnetic field on different faces of grid cells: \(B_x\) on yz faces, \(B_y\) on xz faces and \(B_z\) on xy. The CR energy density is located in cell centers and fluxes of CRs are located on cell faces. Different centering of the relevant quantities implies the need of interpolation ensuring numerical stability of the anisotropic diffusion algorithm.
The CR diffusion tensor \({{\mathbf {\mathsf{{D}}}}}\) depends on the spatially variable magnetic field \({\varvec{ B }}\). Let us consider the diffusive part of the diffusion–advection equation (37) with the diffusion tensor given by Eq. (88):
In the discrete representation, the 3dimensional conservation law reads
where \(e_{\text {cr} ,i,j,k}^n \) and \(e_{\text {cr} ,i,j,k}^{n+1} \) are volume averaged CR energy densities in the cell i, j, k, and \(F_{\text {cr} ,i\frac{1}{2},j,k}\), \(F_{\text {cr} ,i+\frac{1}{2},j,k}\) are the CR fluxes through the left and right cell boundaries, in xdirection. The fluxes appearing in equation (103) should be understood as timeaveraged fluxes through respective cell boundaries. If we approximate these fluxes by their values computed at the time–level \(t^n\), then we obtain an explicit algorithm for the numerical integration of the CR diffusion equation. To compute the diffusion tensor components at cell faces, we need all components of the unit vector \({\varvec{ n }}\), parallel to \({\varvec{ B }}\) at each cell face. We start with computing magnetic field aligned unit vectors at cell–faces perpendicular to the xaxis:
and then do the same for the other faces. The magnetic field component \(B^x\) is already located at proper faces, but the location of \(B^y\) and \(B^z\) is different, thus an interpolation is necessary. The linearly interpolated magnetic field vector located at \((x_{i\frac{1}{2}},y_j,z_k)\) is therefore
The interpolation scheme for \(B_y\), at the cell–face perpendicular to xaxis, is shown in Fig. 7.
To compute the diffusive fluxes of CRs across cell faces, one needs all components of the CR energy density gradient at each cell face. The components of \(\nabla {e_{\text {cr} }}\), perpendicular to cell faces, are centered at cell–faces, e.g.:
however, an interpolation is needed for the remaining components of CR energy–density gradient. The procedure follows in three steps, as depicted in Fig. 8:

1.
interpolation of \(e_{\text {cr} }\) to centers of cell faces (1)

2.
computation of left– and right finite differences of \(e_{\text {cr} }\), with respect to coordinates parallel to cell faces, at positions (2)
$$\begin{aligned} \partial _{y,l} e_{\text {cr} } \equiv \frac{1}{2\varDelta y}\left( (e_{{\text {cr} },i1,j ,k} {+} e_{{\text {cr} },i ,j ,k }) {} (e_{{\text {cr} },i1,j1,k} {+} e_{{\text {cr} },i ,j1,k})\right) , \end{aligned}$$(107)$$\begin{aligned} \partial _{y,r} e_{\text {cr} } \equiv \frac{1}{2\varDelta y}\left( (e_{{\text {cr} },i1,j+1,k} {+} e_{{\text {cr} },i ,j+1,k}) {}(e_{{\text {cr} },i1,j ,k}{+} e_{{\text {cr} },i ,j ,k})\right) . \end{aligned}$$(108) 
3.
computation of face–centered slopes at positions (3) monotonized with the aid of van Leer slope limiter
$$\begin{aligned} \left( \partial _y {e_{\text {cr} }}\right) _{(i\frac{1}{2},j,k)}\simeq {\frac{1}{4}\left( \partial _{y,l} e_{\text {cr} }+\partial _{y,r} e_{\text {cr} }) (1 + \mathrm{sign}(1, \partial _{y,l} e_{\text {cr} } \ \partial _{y,r} e_{\text {cr} })\right) }. \end{aligned}$$(109)
We note that the monotonization of \(\nabla e_{\text {cr} }\) components (step 3.), parallel to the considered cell faces, is essential for stability of the overall (CR+MHD) algorithm.
The same procedure is applied to get the monotonized slope of \(e_{\text {cr} }\) in the z–direction.
Computation of \(({\varvec{\nabla }}e_{\text {cr} })_{i,j\frac{1}{2},k}\) and \(({\varvec{\nabla }}e_{\text {cr} })_{i,j,k\frac{1}{2}}\) follows in the analogous way.
Another variant of transverse flux computation, designed to avoid negative CR energy densities when there is a large gradient, has been applied by Yang et al. (2012) following Sharma and Hammett (2007). Their implementation relies on a double use of one of the slopelimiters such as minmod, van Leer or monotonized central (MC) limiter.
At this point we are ready to compute all CR–fluxes \({\varvec{ F }}_{\text {cr} } = {{\mathbf {\mathsf{{D}}}}} {\varvec{\nabla }}e_{\text {cr} }\) at all cell–faces. We apply the directional–splitting technique to compute the total diffusive change of CR–energy density, in a single timestep. Subsequent updates of CR–energy density proceed in a directionally split manner:
where \(e_{\text {cr} ,i,j,k}^{n+a}\) is CRenergy density after the advection step, \(e_{\text {cr} ,i,j,k}^{n+b}\) and \(e_{\text {cr} ,i,j,k}^{n+}\) are CRenergy densities after these quantities have been updated in x and ydirections, respectively
For more recent models of finite difference and finite volume algorithms for anisotropic diffusion we would like to point to van Es et al. (2014, 2016).
5.2.1 A semiimplicit extension
Sharma and Hammett (2011) consider purely parallel diffusion along the magnetic field lines, i.e. \(D_\perp =0\),
Defining the components of the diffusion operator on the right hand side of Eq. (114) as
then the method can be formulated as
An extension to adaptive mesh refinement using an implicit scheme was introduced by Dubois and Commerçon (2016) in the Ramses code (Teyssier 2002). In their algorithm the general anisotropic diffusion is split into an isotropic component and a component parallel to the magnetic field,
The updated CR energy in cell i, j is given (in 2D) by
for cell position i, j. These quantities are evaluated with the centred symmetric scheme proposed by Günter et al. (2005) for the anisotropic part of the flux. The anisotropic flux at cell interfaces \(F^\mathrm{ani}_{i\pm 1/2,j}\) and \(F^\mathrm{ani}_{i,j\pm 1/2}\) are evaluated from their cell corner fluxes \(F^\mathrm{ani}_{i\pm 1/2,j\pm 1/2}\), thus
The anisotropic cell corner flux is
where barred quantities are arithmetic averages over the cells connected to the corner.
The authors use the diffusion algorithm introduced in Commerçon et al. (2014) including AMR and adaptive timestepping on a levelbylevel basis. Each refinement level \(\ell \) is evolved with a corresponding time step \(\varDelta t^\ell \), where each time step is twice as large for each coarser level \(\ell 1\), \(\varDelta t^\ell =\varDelta t^{\ell 1}/2\). This means that level \(\ell \) evolves with two consecutive time steps before one time step of level \(\ell 1\) is applied. Each level of refinement \(\ell \) is connected to two types of nonuniform interfaces, namely the finetocoarse interface (between level \(\ell \) and \(\ell 1\)) and the coarsetofine interface (between level \(\ell \) and \(\ell +1\)). Dubois and Commerçon (2016) use Dirichlet boundary conditions, where the cell values at level boundaries are imposed. On the other hand, for Neumann boundary conditions the fluxes are imposed, which are needed to guarantee energy conservation similar to hydrodynamical solvers.
At the interface from finetocoarse, Dubois and Commerçon (2016) use the values of \(\ell 1\) at time n as an imposed boundary condition for level \(\ell \). They use the minmod scheme (van Leer 1979) and interpolate the values of level \(\ell 1\) on a finer virtual grid at level \(\ell \) to determine the finetocoarse boundary. For the coarsetofine interface they use values of \(\ell +1\) at time \(n+1\) as the imposed boundary conditions for level \(\ell \). The value of the boundary coarse cell at level \(\ell \) is restricted to the average value of the \(2^{dim}\) cells of level \(\ell +1\) to impose the coarsetofine boundary. Equation 119 remains correct since the diffusion solver only deals with data estimated at the same level of refinement. The combination of Dirichlet boundary conditions at the level interfaces and the interpolation or restriction operations does not break the symmetry of matrix A. The imposed values of neighbouring cells at different levels of refinement enter the righthand side (in vector \({\varvec{ c }}\)) of the above matrix system \(A{\varvec{ x }}={\varvec{ c }}\).
5.2.2 Diffusion on a Voronoi mesh
Pakmor et al. (2016a) implement the diffusion of the CR strictly along the magnetic field lines
with the CR energy density \(e_\mathrm {cr}\) and the parallel diffusion coefficient \(D_\parallel \). Similar to Günter et al. (2005) and Sharma and Hammett (2007) they compute the gradient estimates at the centre of an interface between cells based on the gradient estimates at the corners. In three dimensions every corner of a Voronoi cell connects to four adjacent cells. The residual of the gradient fit reads
with the unknown value at the corner of a cell \(\phi \left( {\varvec{ c }} \right) \), the gradient at the corner position \({\varvec{ c }}\), \({\varvec{\nabla }}\phi \), and the value at the centre of the cell \({\varvec{ s }}_i\), \(\phi ({\varvec{ s }}_i)\). The residual can be rewritten in matrix form
where \({\varvec{ r }}\), \({\varvec{ q }}\), and \({\varvec{ Y }}\) are Nvectors (\(N=4\)), and \({{\mathbf {\mathsf{{X}}}}}\) is an \(N\times N\) matrix. The individual components are defined as
The residual is then minimized by solving
There is a unique solution for \({\varvec{ q }}\) with zero residual because \({{\mathbf {\mathsf{{X}}}}}\) is a square matrix. In order to solve for \({\varvec{ q }}\) a multiplication with \(\left( {{\mathbf {\mathsf{{X}}}}}^T\ {{\mathbf {\mathsf{{X}}}}} \right) ^{1}\) from the left is used, which yields
with \({{\mathbf {\mathsf{{M}}}}} = \left( {{\mathbf {\mathsf{{X}}}}}^T\ {{\mathbf {\mathsf{{X}}}}} \right) ^{1} \ {{\mathbf {\mathsf{{X}}}}}^T\). Here, \({{\mathbf {\mathsf{{M}}}}}\) only depends on the geometry of the mesh. The vector \({\varvec{ Y }}\) only contains values at the cell centers. Therefore, \({{\mathbf {\mathsf{{M}}}}}\) only needs to be computed once every timestep as the geometry of the mesh does not change. One can obtain the value as well as the gradient of any quantity at a corner from a simple matrixvector multiplication. Moreover, Eq. (125) shows the linear dependence of the gradient at the corner on the values in the adjacent cells. This fact is needed for the implicit time integration.
The estimate of the gradient is given by
The solution is obtained by a semiimplicit time integration,
In a second step, the CR energy is advanced according to the fluxes associated with the normal component of the CR energy density gradients computed at the interfaces. This is done with an implicit backward Euler step:
The term \({\varvec{\nabla }}e_{{\mathrm {cr,n}},ij}^{n+1}\) scales linearly with the CR energy densities. This yields a system of coupled linear equations, which can be solved using a matrix solver. Pakmor et al. (2016a) solve the linear system in a twostep procedure using the solvers from the hypre library (Falgout and Yang 2002).
5.3 Numerical scheme for selfconsistent, spectral CR transport
Here we summarise the general framework formulated by Miniati (2001), which we extend to middly relativistic and nonreativistic ranges of CR momenta.
5.3.1 Evolution of the isotropic CR spectrum on the momentum grid
We assume a piecewise powerlaw, isotropic (in momentum space) distribution function
where the distribution function amplitudes \( f_{{i\frac{1}{2}}}\) are defined on left edges of momentum bins \(p_{i\frac{1}{2}}\) and the spectral indices \({q_i}\) are attributed to bin interiors.
The number density of particles in a single momentum bin is
The particle density equation in the discretised form (spatial propagation terms and local sources are neglected here) reads
where b(p) is the loss term. We integrate Eq. (132) over the timestep interval
where \(\varDelta n_{i+\frac{1}{2}}^{\varDelta t}\) and \(\varDelta n_{i\frac{1}{2}}^{\varDelta t}\) are particle numbers transferred through bin boundaries at \(p_{i \pm \frac{1}{2}}\) during the time interval \(\varDelta t\).
The discrete form of the particle number becomes
We shall approximate kinetic energy of CR particles
by another piecewise powerlaw function defined for each momentum bin separately
where the function amplitudes \( g_{{i\frac{1}{2}}}\) are defined on left edges of momentum bins \(p_{i\frac{1}{2}}\) and the power indices \({s_i}\) are attributed to bin interiors. The amplitudes \(g_{{i\frac{1}{2}}}\) are computed directly by evaluation of \(g(p_{{i\frac{1}{2}}})\) on bin edges and the corresponding slopes \({s_i}\) are
Thus, the general relation between energy and distribution function amplitudes is
Energy equation in the discretised form reads
The energy loss term (the integral) on the righthand side of (139) contains the derivative of kinetic energy
Since T(p) is approximated by a powerlaw function we can use Eq. (136) to represent its derivative
We substitute the second righthand side term in equation (139), by \(e_i R_i\):
where \(R_{i}\) expresses the energy loss rate per unit energy
For adiabatic cooling
To deal with the full (relativistic and nonrelativistic) energy range we substitute (141) in (143)
where the dots stand for other cooling mechanisms. By elimination of the energy density we find that
We integrate now Eq. (142) over the timestep interval
where \(\varDelta e_{i+\frac{1}{2}}^{\varDelta t}\) and \(\varDelta e_{i\frac{1}{2}}^{\varDelta t}\) are particle energies transfered through bin boundaries at \(p_{i \pm \frac{1}{2}}\) during the time interval \(\varDelta t\).
We assume that variations of \(R_{i}\) over the timestep are negligible, thus we approximate the integral on the r.h.s. of (147) as:
Hence
The following part of this section will detail the calculation of the \(\varDelta n_{i1/2}^{\varDelta t}\) and \(\varDelta e_{i1/2}^{\varDelta t}\) terms, which involves fluxes of particles and their energies through bin boundaries. The procedure relies by construction on the upwind computation of the fluxes in momentum space.
Computation of upstream momentum \(p_{\text {u}}\). Particles loose or gain momentum due to physical effects underlying the source term b(p) in Eq. (139)
We integrate (150) for the case of the adiabatic process
Our aim is to find the value of the momentum \(p_{\text {u}}\) at t that becomes \(\ln (p_{i\frac{1}{2}})\) at \(t+\varDelta t\)
and finally we find
Taylor expansion up to the 1st order in \(\varDelta t\) results in:
Computation of upwind quantities \(\varDelta n^{\varDelta t}_{{\text {u}}, {i\frac{1}{2}}} \). In the case of cooling the number of particles transferred from ith bin through the left binface is
In the case of heating the the number of particles transferred from ith bin through the right binface is
Computation of upwind quantities \(\varDelta e^{\varDelta t}_{\text {u}}\). In the case of cooling the the amount of particle energy transferred from ith bin through the left binface:
In the case of heating the amount of particle energy transferred from ith bin through the right binface:
5.3.2 Conversion between quantities
The spectral behaviour is best computed using the Fokker–Planck equation using the amplitudes f and the slopes q. For the coupling to hydrodynamical simulations is more convenient to use number density and energy density. Both sets of quantities (f, q and n, e) contain equivalent information, so it is possible to use f and q for the spectral evolution and then convert to n and e for the coupled part to hydrodynamics. The computation of n and e based on f and q is straight forward. The backward conversion can be done by solving the ratio of \(e_i/n_i\) for \(q_i\). The amplitude \(f_{i1/2}\) cancels in the ratio and the solution for \(q_i\) is unique.
6 Astrophysical applications
6.1 Modeling galactic CR propagation with GALPROP
6.1.1 Examples of GALPROP model predictions
Figure 9 shows example predictions for a typical GALPROP model: protons, secondarytoprimary boron/carbon ratio, primary electrons and secondary positrons. This model includes diffusive reacceleration, and breaks in both primary injection spectra and diffusion coefficient. The halo height is 4 kpc. The predictions are for the solar position in the Galaxy (though predictions are made for the entire Galaxy). The parameters can be found in the GALPROP parameter file with name galdef_54_reltest23 supplied with the code. Interstellar and example modulated results (simple forcefield approximation) are shown. Sample data are also shown for comparison; the fit is reasonable, although no attempt has been made to use the latest available data, nor is any attempt made here to fit the data; this is covered in literature (Grenier et al. 2015; Boschini et al. 2020a, b).
Figure 10 shows sample allsky maps from hadronic interactions with the interstellar gas, and synchrotron radiation from electrons and positrons on the magnetic field. The gammaray maps are generated by GALPROP using the computed p and He spectra over the Galaxy, and hadronic crosssections and the GALPROP neutral, molecular and ionized hydrogen and Helium model, and integration over the lineofsight from the solar position. The synchrotron maps use the electron and positron spectra over the Galaxy, the magnetic field model, and the full formula for synchrotron including the directional variation with respect to the magnetic field for the regular component. Such models can be directly compared to gammaray observations e.g. by the FermiLAT instrument and radio surveys by radiotelescopes and the Planck satellite.
6.1.2 Diffusive reacceleration and alternatives
Diffusive reacceleration has been a process frequently included since it explains B/C without an adhoc break in \(D_{xx}(p)\) and is compatible with the Kolmogorov index 0.33 in this term. It is simply diffusion in momentum due to the gain and loss of momentum off moving scatterers; hence there is a basic relation between \(D_{pp}\) and \(D_{xx}\) (see e.g. Strong et al. 2007). However the question remains of the actual importance of this process in the insterstellar medium. In fact in the models with large reacceleration, a significant amount of energy is being injected into CR from the ISM, so that CR acceleration involves more than just the standard sources like SNR. The source of this energy poses a problem. The issue has been recently addressed by Thornbury and Drury (2014). This article has a useful and clear derivation of the reacceleration formula and clarifies its relation to the original Fermi secondorder mechanism. In future the energetics involved should be studied in more detail. Reacceleration at the level often invoked seems incompatible with lowfrequency synchrotron spectrum which is sensitive to the electron and positron spectra around a few GeV.
On the other hand, pure diffusion models without reacceleration do have a problem to reproduce B/C without either a very large break in \(D_{xx}(p)\) (Strong and Moskalenko 1998) or an additional velocity dependence in \(D_{xx}(p)\) (Ptuskin et al. 2006); the latter paper also invokes dissipation of MHD waves as an alternative way to produce the required \(D_{xx}(p)\). The use of B/C depends however critically on the level of solar modulation used to convert the interstellar ratio to the observed one; a lower level of modulation than the value \(\approx \)500 MV often adopted would ease the tension. Lave et al. (2013) compare both reacceleration and pure diffusion models with B/C data including the latest ACE data at a few 100 MeV; a modulation potential of 250 MV is adopted there. More likely convection plays a role in the subGeV/nucleon range as well, since it gives an energyindependent escape time.
It is also possible to include the effect of CR on the diffusion coefficient Ptuskin et al. (2006). They studied the possibility that the nonlinear MHD cascade sets the powerlaw spectrum of turbulence that scatters charged energetic particles. They found that the dissipation of waves due to the resonant interaction with cosmicray particles may terminate the Kraichnantype cascade below wavelengths 10^{13} cm. The effect of this wave dissipation has been incorporated in the GALPROP numerical propagation code in order to asses the impact on measurable astrophysical data. The energy dependence of the cosmicray diffusion coefficient found in the resulting selfconsistent model may explain the peaks in the secondary to primary nuclei ratios observed at about 1 GeV nucleon^{−1}.
6.2 CRs in star formation
Star formation occurs in the densest and coldest regions of the turbulent interstellar medium (Mac Low and Klessen 2004; McKee and Ostriker 2007; Girichidis et al. 2020a). Typical densities of star forming cores exceed \(10^6\,\mathrm {cm}^{3}\) where the gas is as cold as \(\sim 10\,\mathrm {K}\). The spatial extents are small fractions of parsecs. The role of CRs in these regions includes several aspects. As CRs penetrate deeply into the protostellar cores, they deposit energy into regions which are opaque to electromagnetic radiation (see e.g. recent review by Padovani et al. 2020). This effectively sets a minimum temperature on the gas temperature in dense gas. As the Jeans mass scales with the temperature as \(T^{3/2}\) the impact of CRs on the fragmentation might be dynamically relevant. The second aspect is the impact on the chemical composition. With their high energy, CRs are able to unbind and ionize many molecules. The changes in the chemical reactions alter the observable tracers and contain valuable information on the local conditions (e.g. Bisbas et al. 2017). In the context of star formation the main focus is on lowenergy CRs because of their enhanced cross section with the thermal particles. Integrated, the CR energy density in the lowenergy component is generally not comparable to the other energy densities. Consequently, the CR pressure is also not directly driving the motions of the gas and to first order CRs can be treated as tracer particles or a tracer fluid.
Overall, the time scales for CR transport through star forming regions are much shorter than the dynamical times scales of the gas. This means that adiabatic gains and losses of CRs can be neglected contrary to galactic scales where advective and diffusive time scales are comparable. Given the strong magnetic field strengths of ~ mG (Crutcher 2012) and the low energy of CRs (\(\lesssim \mathrm {GeV}\)) the gyroradii are smaller than the spatial extents of star forming cores and the CRs can be followed collectively following the magnetic field lines along the path s.
The distribution function is generally a function of the pitch angle, which depends on the local strength of the regular magnetic field, and CR scattering that occurs due to resonant CR interactions with magnetohydrodynamic (MHD) turbulence and gas nuclei. Depending on the degree of pitch angle scattering, there are two CR transport regimes—free streaming and diffusive (Padovani et al. 2018; Silsbee and Ivlev 2019; Padovani et al. 2020). The freestreaming approximation [also known as the continuous slowingdown approximation, CSDA, (see e.g. Takayanagi 1973; Padovani et al. 2009)] is the most common approach used to calculate the propagation of CRs in molecular clouds. Scattering processes are inefficient in this regime, so that the resulting mean squared deviation of the pitch angle along a CR track is small, so \(\mu \) is conserved. The dominant regime of CR transport in regions surrounding dense cores embedded within molecular clouds is debated. MHD turbulence in these regions can resonantly scatter the pitch angles of penetrating CRs (Kulsrud and Pearce 1969), leading to spatial diffusion. The spectrum of MHD turbulence determines the magnitude of the CR diffusion coefficient and its dependence on the particle energy (Schlickeiser et al. 2016; Silsbee and Ivlev 2019). However, MHD turbulence can also be driven by anisotropy in the CR distribution function (Skilling and Strong 1976; Morlino and Gabici 2015; Ivlev et al. 2018), which arises in response to CR absorption in dense cores.
Observationally, the ionisation rate of CRs can be connected to observations of \(\hbox {H}_3^+\), whose chemical formation chain is primarily regulated by CRs (see, e.g. Indriolo et al. 2007; Indriolo and McCall 2012).
6.3 CRs in the interstellar medium
In this section we discuss the interactions of CRs with the interstellar medium. This covers the effects in the immediate surroundings of a supernova, the heating in the interstellar medium, and the dynamical impact within the ISM. The interactions on larger scales like the impact on galactic outflows are discussed further below. We will not cover the acceleration mechanism in SN remnant shocks as this involves the kinetic approach of CRs and is beyond the scope of this review.
Simulations of the interstellar medium allow to resolve the different thermal phases of the gas including the degree of ionisation. The spatial resolution also allows to resolve MHD shocks. On the one hand this allows to investigate in more detail the coupling of CRs with the thermal gas. On the other hand CRs can be injected at the position of the shock and allow a more consistent injection mechanism.
In the ISM the transport speeds of CRs and the local tubulent motions can be comparable, so the local conditions determine whether the CRs diffuse faster than they are advected or vice versa. Commerçon et al. (2019) perfom simulations of the turbulent ISM and find that for most cases the effective diffusion speeds are dominating. As a result, no significant CR pressure gradient can build up and no dynamical effects are expected on scales of a few tens of parsecs.
Pfrommer et al. (2017) extend the twofluid shock tube by CR injection at the shock and applies an onthefly shock finder (Schaal and Springel 2015) in several idealised setups such as a Sedov explosion (Sedov 1959) using the Arepo code (Springel 2010). Pais et al. (2018) added an obliquitydependent injection efficiency with respect to the magnetic field orientation and investigated the impact of CRs injected in the shock region on the Sedov explosion finding that the solution remains selfsimilar because the ellipticity of the propagating blast wave stays constant over time. Furthermore, their comparison to observed SN remnants suggests a lower injection efficiency of only 5 per cent rather than the canonical 10 per cent of the SN energy. This result is independent of the assumed magnetic coherence length.
Dubois et al. (2019) use a similar approach to inject CRs at the loci of the MHD shocks with an onthefly shock finder in the larger boxes of the interstellar medium using Ramses. The efficiency is also coupled to the upstream magnetic obliquity. Their models include CR streaming as well as ansiotropic diffusion. Similar to Pais et al. (2018) they find supernova bubbles with large polar caps in case of a homogeneous background magnetic field, and a patchy structure of the CR distribution in case of inhomogeneous background fields. The application in a turbulent box shows that the presence of shockinjected CRs significantly modifies the structure of the gas.
A more idealized study by Wiener et al. (2017a) investigates a stream of CRs interacting with cold clouds in a hot dilute environment. Using onedimensional models including CR streaming they find that the bottleneck effect, which occurs when a population of CRs undergoes the streaming instability, will accelerate and heat the gas cloud. Corresponding twodimensional models including radiative cooling of the clouds (Wiener et al. 2019) confirm the acceleration of clouds by CRs, but reveal that the thermal impact might dominate. The cooling effect will keep the clouds intact to CR wave heating.
6.4 CR driven largescale instabilities of the ISM
Observational data indicate that gas, magnetic fields and CRs appear in approximate energetic equipartition, which is interpreted as the effect of dynamical coupling of the diverse components of the interstellar medium. The stability of a system in vertical equilibrium
without CRs was analysed in Newcomb (1961); the inclusion of CRs dates back to Parker (1966). Zweibel and Kulsrud (1975) generalized the model for a family equilibria. The dynamical role of CRs was first recognized by Parker (1966), who noted that vertically stratified ISM consisting of thermal gas, magnetic fields and CRs is unstable due to buoyancy of the weightless components, i.e., the magnetic fields and the CRs.
The physical mechanism of the instability stems from the fact that two weightless components—magnetic fields and cosmic rays—contribute to the total pressure of the gravitationally stratified interstellar medium. The thermal gas component is inflated by these nonthermal pressure contributions. The system is prone to a kind of convective instability tending to expel the weightless components from the system and therefore to reduce potential energy of the thermal gas. Linear stability analysis demonstrates that smallamplitude vertical corrugations of magnetic field lines lead to gas motions down to valleys of magnetic fields unweighting tops of the field lines and therefore enhancing the upward motion of the upper parts of the corrugations and a downward motion of gas into the valleys.
The instability, hereafter named Parker instability, was recognized as a plausible mechanism leading to the formation of clouds of gas collecting in valleys of the largescale galactic magnetic fields (Parker 1967; Blitz and Shu 1980). Parker (1992) proposed, furthermore, that the instability enhanced by continues replenishment of CRs in supernova remnants may lead to an amplification of largescale magnetic fields in galaxies.
Numerous papers addressing the Parker instability in the ISM by means of linear stability analysis adopted a simplifying assumption that the diffusive propagation of CRs is fast enough to ensure a constant pressure of CRs along magnetic field lines. Ryu et al. (2003b) performed a linear analysis of the Parker instability for the medium composed of thermal gas, horizontal magnetic field and anisotropicaly diffusing CRs. The relevant set of equations consisted of the set of ideal MHD equations and the diffusionadvection equation equivalent to Eq. (37) with the diffusion tensor in the form of Eq. (88) describing the magneticfield aligned anisotropic propagation of CRs. Their results have shown a strong dependence of the growth rate of the Parker instability on the value of the parallel diffusion coefficient. Lower diffusion coefficients turned out to reduce the growth rate of the instability with respect to the case of constant CR pressure along magnetic field lines, representing the limit of an infinite diffusion coefficient.
The nonlinear evolution of the Parker instability with CRs was addressed by Hanasz and Lesch (2003), who extended the ZEUS 3D code with a stable numerical algorithm combining anisotropic diffusion and advection of CRs and coupled the momentumintegrated diffusion equation with the MHD system equations describing a thermal plasma (see Sect. 4.2). Numerical simulations have shown that the growth rate of the Parker instability depends essentially on the adopted value of the CR diffusion coefficient and that results differ from predictions made on the grounds of linear stability analysis. The difference was plausibly caused by a different triggering mechanism of the instability, which in Ryu et al. (2003b) relied on excitation of a specific ’idealized’ eigenmodes, while in (Hanasz and Lesch 2003) the instability was excited by an instantaneous injection of CRs in a SN remnant.
The linear and nonlinear analysis of the effects of CR diffusion on the Parker instability was subsequently extended by Kuwabara et al. (2004) who have shown that the growth rate of the Parker instability becomes smaller if the coupling between CRs and thermal gas is stronger (i.e., if the CR diffusion coefficient is smaller). MHD simulations of the Parker instability with an appropriate perturbation confirmed this result. Similar conclusions were derived from studies of Parker–Jeans instability with anisotropic CR diffusion (Kuwabara and Ko 2006). The system is less unstable when the CR diffusion coefficient is smaller (i.e., the coupling between the CRs and plasma is stronger) and if the CR pressure is larger. This conclusion is consistent with the fact that Jeans instability and Parker instability are less unstable when the pressure is higher. In the nonlinear regime the Parker–Jeans instability leads to the formation of gas filaments whose orientation depends on the parallel diffusion coefficient (Kuwabara and Ko 2020). When the diffusion coefficient is large gas filaments form preferentially perpendicular to the magnetic field and when the diffusion coefficient is small the filaments are aligned parallel to the magnetic field.
Rodrigues et al. (2016) examined the evolution of the Parker instability in galactic disks using 3D numerical simulations. They have found that the instability develops a multimodal 3D structure, which cannot be quantitatively predicted from the earlier linearized studies. They calculated synthetic polarized intensity and Faraday rotation measure (RM) maps, and the associated structure functions. They suggested that correlation scales inferred from RM maps can be used to probe the cosmicray content of galaxies.
Heintz and Zweibel (2018) performed a stability analysis of a stratified layer for three different cosmicray transport models: decoupled, corresponding to the classic Parker instability, coupled with \(\gamma _c=4/3\) but not streaming, named as modified Parker instability, and coupled with streaming at the Alfvén speed. They demonstrated that cosmicray heating of the gas is responsible for the destabilization of the system and concluded that Parker instability with cosmicray streaming may play an important role in cosmicray feedback. Heintz et al. (2020) expanded the work by including radiative cooling. Heating due to CR streaming has a destabilizing effect which affects significantly the nonlinear regime of the Parker instability. While cooling depressurizes the dense gas, streaming CRs heat and inflate the diffuse extraplanar gas, greatly modifying the phase structure of the medium. The fastest growth affects typically the modes characterized by short wavelengths in the horizontal direction perpendicular to the background magnetic field.
6.5 Cosmic ray driven galactic dynamo
The idea of the CRdriven dynamo was originally raised by Parker (1992), who postulated that the buoyancy of CRs together with the Coriolisforce, galactic differential rotation and magnetic reconnection can lead to efficient amplification of galactic magnetic fields.
Preliminary numerical experiments pursued with the aid of the thin fluxtube approximation (Hanasz and Lesch 2000) have shown that the buoyancy of CRs injected in SN remnants may lead, in the presence of the Coriolis force, to an efficient generation of the poloidal magnetic field component out of the initial azimuthal magnetic field (named as \(\alpha \)effect) and to the diffusive transport of magnetic flux in the vertical direction. The CRinduced diffusive transport coefficients for the large mean magnetic field, plugged into the meanfield dynamo equation (Lesch and Hanasz 2003), (see also Kowal et al. 2006) resulted in exponentially growing solutions, confirming the Parker’s conjecture that CRs may efficiently drive the dynamo action on galactic scales.
First MHD numerical simulation models (Hanasz et al. 2004, 2006, 2009a; Siejkowski et al. 2010) of the CRdriven dynamo were realized in a local, rectangular patch of galactic disk with shearing boundary conditions and rotational pseudoforces (tidal and Coriolis forces) incorporated to study the magnetic field evolution in rotating galactic disks.
The first global model of the CRdriven dynamo in a Milky Waytype galaxy (Hanasz et al. 2009b) assumed that: (1) Supernovae convert 10% of their explosion kinetic energy into cosmic rays. (2) A weak initial magnetic field of stellar origin was suppled to the system in selected (plerionic type) SN remnants. (3) Differential rotation of the interstellar gas results from an assumed analytical model of an axisymmetric galactic gravitational potential (e.g. Allen and Santillan 1991) or from a computational model of an Nbody galactic disk ( Wóltański 2015). (4) The initial gas distribution follows the global Milky Way model by Ferriere (1998).
Magnetic field amplification originating from the smallscale, randomly oriented dipolar magnetic fields is apparent through the exponential growth by several orders of magnitude of both the magnetic flux and the magnetic energy. The growth of magnetic field saturates at about \(t = 4\,\mathrm{ Gyr}\), reaching values of \(35\,{\mu {\rm G }}\) in the disk. During the amplification phase, magnetic flux and total magnetic energy grow by about 6 and 10 orders of magnitude, respectively. The average efolding time of magnetic flux amplification is approximately equal to \(270 \ {\mathrm{ Myr}}\), corresponding to the orbital rotation period at the galactocentric radius (\(\approx 10\,{\mathrm{ kpc}}\)). The magnetic field originated from randomly oriented magnetic dipoles was initially chaotic, as shown in Fig. 11. Later on, the toroidal magnetic field component formed a spiral structure revealing reversals in the plane of the disk. The Magnetic field structure evolved gradually by increasing its correlation scale. The toroidal magnetic field component became almost uniform inside the disk around \(t=2.5\,\mathrm{ Gyr}\). The volume occupied by the wellordered magnetic field expanded continuously until the end of the simulation.
To visualise the magnetic field structure in a manner resembling radio observations of external galaxies, synthetic radio maps of the synchrotron radioemission were deduced in a simplified way from the distribution of CR protons. The polarised intensity of synchrotron emission is shown in Fig. 12 together with polarisation vectors. Electric vectors, computed on the basis of integrated Stokes parameters, are rotated by \(90^{\circ }\) to reproduce the magnetic field direction projected onto the plane of sky. Polarisation vectors, indicating the mean magnetic field direction, reveal a regular spiral structure in the faceon view, and the socalled Xshaped structure in the edgeon view. A particular similarity can be noticed between the edgeon synthetic radio map and the radio maps of observed edgeon galaxies such as NGC 891 (Krause 2009).
KulpaDybeł et al. (2011) added an analytical elliptical component to the axisymmetric gravitational potential. In the presence of the bar perturbation the CRdriven dynamo reveals new properties, such as the presence of a ringlike structure as well as a shift of the magnetic arms with respect to the crests of spiral density waves. Wóltański (2015) used Nbody simulations to compute gravitational field of a nonaxisymmetric disk with spiral density wave perturbations. Density waves were excited in the disk by addition of a small satellite galaxy. The amplification of magnetic flux by the CRdriven dynamo leads the largescale magnetic field to the saturation level around \(10\, \mu {\rm G }\) with local maxima reaching \(2030 \, \mu {\rm G }\), located near the spiral crests of gas density. Magnetic field vectors are parallel to the gaseous spiral arms as it is observed in real galaxies (Fletcher et al. 2011). The strongest magnetic fields are generated in between gaseous spiral arms (KulpaDybeł et al. 2011, 2015) similarly to magnetic arms observed in some galaxies, such as: NGC 6946 (Beck 2007) and IC 343 (Beck 2015).
The edgeon synchrotron radio maps of the galaxy exhibit polarized synchrotron emission, extending several kiloparsecs above and below the disk. Similar structures are common in radioimages of edge on galaxies (see e.g Krause 2009; Soida et al. 2011; Mora and Krause 2013). The Xtype structures are present in all global models of CRdriven galactic dynamo (Hanasz et al. 2009b; KulpaDybeł et al. 2011, 2015). Globalgalactic winds accompanying the magnetic field amplification are present in practically all numerical realizations of the CRdriven dynamo. The commonly present CRdriven winds leaving galaxies imply magnetic field transport out of the disk and effective magnetisation of intergalactic space. This process is particularly efficient in dwarf galaxies (Siejkowski et al. 2014).
An interesting observation has been made by Butsky et al. (2017) who performed numerical simulations of an isolated galaxy with a stellar feedback prescription in which thermal energy and magnetic energy are supplied by supernova explosions, but CRs are not included. They noted that, similarly to the model of the CRdriven dynamo, the magnetic field reaches equipartition levels over gigayear timescales and raised the question of the relative importance of the two primary types of energy supplied by supernovae: turbulence driven by the thermal expansion of the remnants themselves, or energy released as CRs, since either by itself appears to be sufficient.
6.6 Cosmic ray driven galactic winds
As supernovae drive strong shocks into the interstellar medium (ISM), some fraction of the explosion energy is consumed to accelerate ionised particles to relativistic energies, which are then injected into the ISM (Krymskii 1977; Bell 1978; Blandford and Ostriker 1978). This relativistic fluid is coupled to the galactic magnetic field and, in particular the hadronic component, is less prone to energy losses than the gaseous component of the ISM.
The idea of CR wind driving has been proposed by Ipavich (1975) and developed by numerous authors including Breitschwerdt et al. (1991, 1993), Zirakashvili et al. (1996), Ptuskin et al. (1997), Breitschwerdt et al. (2002), Uhlig et al. (2012), Dorfi and Breitschwerdt (2012), who find that CRs together with magnetic fields and thermal pressure can contribute to the galactic winds phenomenon. Everett et al. (2008) applied a wind model, driven by combined cosmicray and thermalgas pressure, to the Milky Way, and shown that the observed Galactic diffuse soft Xray emission can be better explained by a wind than by previous static gas models. They find that cosmicray pressure is essential to driving the observed wind.
CRs are strongly coupled to magnetic fields and their mutual interaction should be followed in a selfconsistent way. Hanasz et al. (2004, 2009b), Siejkowski et al. (2010), KulpaDybeł et al. (2011) and Heintz and Zweibel (2018) have shown that CRs induce buoyancy effects in the ISM, leading to the breakout of magnetic fields from galactic disks (Parker 1992). Plausibly, such processes are also relevant for starforming galaxies at high redshift which are observed to have significant magnetic fields at the level of tens of µG (Bernet et al. 2008). Recent observations even demonstrate the existence of large magnetic fields up 50 kpc away from the galaxy, indicating strong largescale magnetised winds (Bernet et al. 2013).
6.6.1 1D models
An early popular model for investigating the impact of CRs on galactic winds are onedimensional models. Usually, they focus on large scales compared to the details of galactic substructure, such that details of the interstellar medium and substructures inside the galaxy are neglected. The infinitesimally thin disc is modelled as the source of CRs. The simplified geometry does not allow for details of the magnetic field or turbulence to be included, but under the assumption of external confinement of CRs by isotropic turbulent motions or a magnetic field model the radial dynamics of a wind including CRs can be modelled. The first application of CRs hydrodynamics in the context of galactic winds was performed by Breitschwerdt et al. (1991) assuming a steady state flow along magnetic flux tubes. They found that CRs can drive supersonic mass loss for a wide range of parameters. Exploring the parameter space of thermal and CR pressure on the mass loss has been done by Everett et al. (2008) finding that in the Milky Way CRs and thermal pressure contribute equally to the outflow. Extensions of the models to timedependent winds Dorfi and Breitschwerdt (2012) confirm asymptotic solutions of previous steady state problems and also offer an explanation to the observed galactic CR spectrum. More recent models include a full CR spectrum in a semianalytic model of advective and diffusive CR transport (Recchia et al. 2016b, a, 2017). Whereas the qualitative results of winds are reproduced, the inferred spectra are in tension with observed ones.
6.6.2 3D models
Three dimensional models of the interstellar medium and galaxies including CRs allow for a more natural combination of turbulent motions, a dynamical magnetic field evolution and the interactions with CRs. However, the numerical cost only allows for reduced CR physics and a small parameter range to be explored. Jubelgas et al. (2008) conduct simulations of isolated galaxies including the feedback of the diffusive CR component included in the GADGET code. They find that CRs can significantly reduce the star formation efficiencies of small galaxies, with virial velocities below \(\sim 80 \text{ km }\,\mathrm{ s}^{1}\), an effect that becomes progressively stronger towards lowmass scales. Yang et al. (2012) simulate the onset of a CRdriven outflow comparable to the Milky Way Fermi bubbles using anisotropic CR diffusion. Uhlig et al. (2012) use SPH simulations of entire isolated galaxies to test the wind dynamics including CRs including CR heating due to streaming. Without magnetic fields, the simulations approximated the Alfvén velocity by the sound speed and only focus on isotropic transport. Similar approaches have been employed by Booth et al. (2013), Salem and Bryan (2014) using isotropic CR diffusion. Both studies find that CRs are able to drive winds, but only for some fraction of the probed parameter space. Booth et al. (2013) note that the effects of CRdriven winds are much larger in dwarf galaxies compared to their Milky Way models, which is still affected by CRs. More recent simulations by Dashyan and Dubois (2020) investigate in more detail the impact of CR on dwarf systems with different CR transport mechanisms. They report a stronger impact on the different transport mechanism than the effective diffusion coefficient.
In a similar framework Salem et al. (2016) investigate the impact of CRs on a forming \(10^{12} { M_{\odot }}\) halo. They find that CRinclusive runs, contrasted with a run with star formation and energetic feedback, but no CRs, substantially enrich the circumgalactic medium with metals due to robust and persistent outflows from the disk. The CRinclusive models reveal more diffuse gas at lower temperatures, down to \(10^{4} \text{ K }\), than the nonCR cases. The CR inclusion leads to a better match of HI, SiIV, CII, and OIV line intensities than the case without CRs. Comparison of gammaray luminosity to observational data favor CR diffusion coefficients close to the Milky Way canonical values \(3\cdot 10^{28}\, \text{cm}^2 \,\mathrm{ s}^{1}\).
Galaxy simulations including magnetic fields and anisotropic CR diffusion are performed by Hanasz et al. (2013). Their models are not only able to drive galactic winds with mass loading factors of order unity but also sustain a CRdriven dynamo with magnetic field strength at a several µG level. Pakmor et al. (2016b) compare isotropic and anisotropic diffusion models finding that anisotropic diffusion leads to more realistic magnetic field strengths than in the isotropic case. Including CR streaming in galactic models was investigated by Wiener et al. (2017b), Ruszkowski et al. (2017b). Butsky and Quinn (2018) compare the role of isotropic and anisotropic diffusion and streaming mechanisms for shaping the structure of circumgalactic medium (CGM). They find that all three transport mechanisms result in strong, metalrich outflows but differ in the temperature and ionization structure of their CGM. Isotropic diffusion results in a spatially uniform, warm CGM that underpredicts the column densities of low ions. Anisotropic diffusion develops a reservoir of cool gas that extends farther from the galactic center, but disperses rapidly with distance. CR streaming projects cool gas out to radii of 200 kpc, supporting a truly multiphase medium.
A systematic parameter study of the impact of CR for different halo masses was performed by Jacob et al. (2018) finding that CRs only have a significant effect on the launching of a wind for halo masses below \(10^{12}\,\mathrm {M}_\odot \). The combined effects of AGN and CRs has been simulated by Wang et al. (2020) in isolated galaxies, where the authors argue that CR streaming and the corresponding heating has to be included in order to prevent too efficient cooling of the circumgalactic medium.
Besides the isolated disc setups, recent models include CR transport in cosmological zoom simulations, in which individual galaxies are evolved with high resolution. Buck et al. (2020) rerun simulations from the AURIGA project including CRs. They limit the transport coefficients to the Alfvén speed and include the corresponding heating effect, which changes the structure of the outflow. The modified structure of the circumgalactic medium results in a different distribution of angular momentum and thereby alters the stellar and gaseous disk. In a similar cosmologial setup Hopkins et al. (2021) compare a large variety of subgrid models for CR confinements, which are connected to the MHD equations using effective transport coefficients in the diffusion, the streaming as well as combined unified CR transport. Besides the moderate effect that CRs have on the galactic winds, their models favour effective diffusion coefficients that range from \(10^{29}10^{33}\,\mathrm {cm}^2\,\mathrm {s}^{1}\), which is based on the comparison with gammaray emission.
The details of how CR winds are driven and in particular the relative importance and dynamical interplay between SNdriven motions and CR dynamics cannot be investigated in full galactic models at the current resolutions. Instead simulations of a smaller fraction of the galaxy are needed. Girichidis et al. (2016, 2018) and Peters et al. (2015) compare thermally and CR driven winds in more sophisticated model of the ISM, which includes a chemical evolution to accurately model the phases of the ISM. The models confirm that CRs alone are able to drive and support an outflow with mass loading of order unity. The CR driven outflows are denser, cooler and smoother than their thermally driven counterparts. Figure 13 illustrates the difference between outflows that are only driven by thermal energy injection by SNe (lefthand panel) and the outflows driven 10% of the energy injected as CRs (three righthand panels). The two central panels show two different diffusion coefficients. The column density on the righthand side depicts the structure of the ISM if all SNe explode in dense regions. The resulting strong overcooling illustrates that CRs alone are able to lift gas out of the disk. Similar models by Simpson et al. (2016) compare simulations with advection only and advection plus diffusion. They conclude that diffusion is needed in order to drive an outflow. The decoupling of CR and the thermal gas in a neutral environment leads to a broader spatial distribution of cosmic rays and higher wind speed compared to the uniformly applied advectiondiffusion approach (Farber et al. 2018). A more sophisticated, locally determined coupling between CRs and the gas confirms these results (Holguin et al. 2019).
6.7 Cosmic rays in galaxy clusters
CRs are also expected to affect galaxy clusters. One particularly important aspect is the possible heating effect provided by CR protons from AGN. Simulations including CR protons produced at shocks reveal that they could provide a substantial additional pressure in the intracluster medium (Miniati et al. 2001b). A followup study included CR electrons as an additional nonthermal component (Miniati et al. 2001a). In both cases the CRs are transported with the gas and include cooling effects. Simulations including diffusion of CR protons that are injected in shock regions close to the AGN find large Xray cavities and radio lobes in the hot diffuse gas of the central regions of galaxy clusters. The cavities are longlived if the diffusion coefficient does not exceed \(10^{28}\,\mathrm {cm}^2\,\hbox {s}^{1}\) (Mathews and Brighenti 2007, 2008; Ruszkowski et al. 2008). A range of galaxy clusters and shock related CR injection models has been performed by Pfrommer et al. (2007) omitting CR diffusion. They find that CRs can be efficiently accelerated in strong structure formation shocks such as accretion and merger shocks. The high relative fraction of CR pressure in the central region increases the compressibility and allows for more star formation. A detailed discussion on the differences between CR advection, diffusion and streaming by Enßlin et al. (2011) suggest that the details of the transport mechanisms are essential to understand the nonthermal signatures of clusters. Hydrodynamical simulations including CR streaming and the resulting heating effect have been run by Ruszkowski et al. (2017a) find that the CR can efficiently heat the gas and provide a viable channel for the AGN energy thermalization. More recently, Ehlert et al. (2018) couple CRs to an AGN jet model and simulate galaxy clusters including a simplified streaming approach. They introduce an effective CR diffusion coefficient \(\kappa _{\mathrm {cr}}\sim l_{\mathrm {cr}}v_{\mathrm {A}}\) with the CR gradient length \(l_{\mathrm {cr}}\) and the Alfvén speed \(v_{\mathrm {A}}\), which emulates the combined effects of streaming and spatial diffusion (Sharma et al. 2009; Wiener et al. 2017b). They conclude that the CRinduced Alfvén heating matches the CR heating rates needed to solve the cooling flow problem. Vazza et al. (2012b) model CRs in galaxy clusters by injecting them in numerically identified shocks and advect them with the gas flow. The simulations reveal a small but not dominant impact of CRs on the evolution with changes at the percent level for the temperature, pressure and density distribution.
One of the first attempts to investigate the spectrum of relativistic electrons in cosmological shocks has been made by Keshet et al. (2003) who studies the radiation emitted due to inverse Compton process by shockaccelerated electrons in hydrodynamic cosmological simulations of a Lambda cold dark matter (\(\varLambda \)CDM) universe. They performed a posteriori detection and analysis of shocks forming in cosmological simulations to predict the spectrum of CR electrons and the spectrum of \(\gamma \)ray photons emitted from cosmological shocks. They subsequently constructed allsky maps of \(\gamma \)ray emission from the nearby universe.
Pfrommer et al. (2006) derived an analytic solution to the onedimensional Riemann shock tube problem for a composite plasma of CRs and thermal gas. They applied their solution to study the properties of structure formation shocks in highresolution hydrodynamic simulations of the \(\varLambda \)CDM universe. They found that most of the energy is dissipated in weak internal shocks with Mach numbers \(M \sim 2\). They recognized the dynamical importance of shockinjected CRs which is comparatively large in the lowdensity, peripheral halo infaling regions, buts is less important for the weaker flow shocks ocuring in central highdensity regions of haloes. They raised questions of cosmological implications of the CRs component and for observational signatures of this radiation.
In the context of AGN feedback Sijacki et al. (2008) include CRs together with thermal feedback. The twocomponent fluid with an effectively softer equation of state and the less efficient cooling for CRs compared to the thermal gas allows CR supported bubbles to rise to the outskirts of the clusters and leak into the surrounding intergalactic medium. However, neither the accretion rates onto the black hole nor the star formation rate are significanty affected by the nonthermal component.
7 Conclusions and outlook
We have reviewed the numerical treatment of CRs assuming a fluid description of this highenergy component. We identified three main approaches in treating CRs numerically. The first is a spectrally resolved approach with a focus on the physical processes of CRs like the primary CRs and the production of secondaries. The most prominent code that represents this approach is Galprop with more recent frameworks Dragon and Picard. The second numerical model focuses on the dynamical coupling of CRs and the thermal gas in (magneto)hydrodynamical simulations. Here, CRs take the role of dynamical drivers of hydrodynamical flows. In the context of the interstellar medium and galaxy formation CRs are an important additional reservoir of energy. The numerical complexity in this approach is more in the interaction between the two fluids. Simple linear diffusion models are challenged by more complex models that account for the CR streaming instability and couple CRs to the gas including more plasma effects. A third approach tries to spectrally resolve CRs and at the same time include the dynamical impact onto the gas dynamics. The numerical and computational complexity forces this approach to be limited in both spectral complexity and multiple species of CRs and in the details of plasma interactions of relativistic and thermal gas.
Depending on the application the currently developed models still face major limitations. In the interstellar medium and for the dynamics of galaxies all three approaches would need to be merged and coupled. For the connection with observations—in particular for a comparison with the Milky Way—a detailed modeling of secondaries is of major importance. Similarly, a spectrally resolved modeling of CR electrons as tracers of local thermal and CR properties are key to understand the galaxies. The structure of the magnetic field in galaxies is strongly connected to the dynamics of CRs. Magnetohydrodynamical simulations naturally include an evolving magnetic field that follows and/or shapes spiral structures and interacts with dynamos and local instabilities of the gas like Parker loops. The combined CRMHD models using a single CRs fluid approach reveal that CRs can be dynamically important for shaping the magnetic field, structuring the interstellar medium, and driving galactic outflows and winds. However, the relative importance of CRs compared to other processes in galaxies as well as which details of CR physics are the crucial ones to resolve, include and simulate are still strongly debated. Currently, there is converging consensus that CRs—in particular the dynamically more relevant CR protons—should be coupled to the thermal gas and treated in a timedependent manner. The missing physical aspects in this approach like a spectral CR description and the inclusion of multiple species and secondaries are on the agenda for the near future.
References
Ackermann M, Ajello M, Allafort A et al (2013) Detection of the characteristic Piondecay signature in supernova remnants. Science 339:807–811. https://doi.org/10.1126/science.1231160. arXiv:1302.3307 [astroph.HE]
Aguilar M, Aisa D, Alpat B et al [AMS Collaboration] (2014a) Precision measurement of the (e^{+}+e^{−}) flux in primary cosmic rays from 0.5 GeV to 1 TeV with the alpha magnetic spectrometer on the international space station. Phys Rev Lett 113(22):221102. https://doi.org/10.1103/PhysRevLett.113.221102
Aguilar M, Aisa D, Alvino A et al [AMS Collaboration] (2014b) Electron and positron fluxes in primary cosmic rays measured with the alpha magnetic spectrometer on the international space station. Phys Rev Lett 113(12):121102. https://doi.org/10.1103/PhysRevLett.113.121102
Allen C, Santillan A (1991) An improved model of the galactic mass distribution for orbit computations. Rev Mex Astron Astrofis 22:255–263
Amato E, Blasi P (2018) Cosmic ray transport in the Galaxy: a review. Adv Space Res 62(10):2731–2749. https://doi.org/10.1016/j.asr.2017.04.019. arXiv:1704.05696 [astroph.HE]
Axford WI, Leer E, Skadron G (1977) The acceleration of cosmic rays by shock waves. In: 15th international cosmic ray conference, vol. 11. Bulgarian Academy of Sciences, pp 132–137
Axford WI, Leer E, McKenzie JF (1982) The structure of cosmic ray shocks. Astron Astrophys 111:317–325
Balsara DS (2017) Higherorder accurate spacetime schemes for computational astrophysics—Part I: finite volume methods. Living Rev Comput Astrophys 3:2. https://doi.org/10.1007/s4111501700028
Beck R (2007) Magnetism in the spiral galaxy NGC 6946: magnetic arms, depolarization rings, dynamo modes, and helical fields. Astron Astrophys 470:539–556. https://doi.org/10.1051/00046361:20066988. arXiv:0705.4163
Beck R (2015) Magnetic fields in the nearby spiral galaxy IC 342: a multifrequency radio polarization study. Astron Astrophys 578:A93. https://doi.org/10.1051/00046361/201425572. arXiv:1502.05439
Bell AR (1978) The acceleration of cosmic rays in shock fronts. I. MNRAS 182:147–156. https://doi.org/10.1093/mnras/182.2.147
Bell AR (1987) The nonlinear selfregulation of cosmic ray acceleration at shocks. MNRAS 225:615–626. https://doi.org/10.1093/mnras/225.3.615
Berezinskii VS, Bulanov SV, Dogiel VA, Ptuskin VS (1990) Astrophysics of cosmic rays, edited by VL Ginzburg. NorthHolland, Amsterdam
Bernet ML, Miniati F, Lilly SJ, Kronberg PP, DessaugesZavadsky M (2008) Strong magnetic fields in normal galaxies at high redshift. Nature 454:302–304. https://doi.org/10.1038/nature07105. arXiv:0807.3347
Bernet ML, Miniati F, Lilly SJ (2013) The extent of magnetic fields around galaxies out to \(z \sim 1\). Astrophys J 772:L28. https://doi.org/10.1088/20418205/772/2/L28. arXiv:1307.2250
Binns WR, Wiedenbeck ME, Arnould M, Cummings AC, George JS, Goriely S, Israel MH, Leske RA, Mewaldt RA, Meynet G, Scott LM, Stone EC, von Rosenvinge TT (2005) CosmicRay Neon, WolfRayet stars, and the superbubble origin of galactic cosmic rays. Astrophys J 634:351–364. https://doi.org/10.1086/496959
Bisbas TG, van Dishoeck EF, Papadopoulos PP, Szűcs L, Bialy S, Zhang ZY (2017) Cosmicray induced destruction of CO in starforming galaxies. Astrophys J 839:90. https://doi.org/10.3847/15384357/aa696d. arXiv:1703.08598
Blackman EG, Field GB (2003) A new approach to turbulent transport of a mean scalar. Phys Fluids 15(11):L73–L76. https://doi.org/10.1063/1.1613281. arXiv:astroph/0302013 [astroph]
Blandford RD, Ostriker JP (1978) Particle acceleration by astrophysical shocks. Astrophys J 221:L29–L32. https://doi.org/10.1086/182658
Blasi P, Amato E (2012) Diffusive propagation of cosmic rays from supernova remnants in the Galaxy. I: spectrum and chemical composition. JCAP 2012(1):010. https://doi.org/10.1088/14757516/2012/01/010. arXiv:1105.4521 [astroph.HE]
Blitz L, Shu FH (1980) The origin and lifetime of giant molecular cloud complexes. Astrophys J 238:148–157. https://doi.org/10.1086/157968
Bloemen JBGM, Dogiel VA, Dorman VL, Ptuskin VS (1993) Galactic diffusion and wind models of cosmicray transport. I—Insight from CR composition studies and gammaray observations. Astron Astrophys 267:372–387
Booth CM, Agertz O, Kravtsov AV, Gnedin NY (2013) Simulations of disk galaxies with cosmic ray driven galactic winds. Astrophys J 777(1):L16. https://doi.org/10.1088/20418205/777/1/L16. arXiv:1308.4974 [astroph.GA]
Boschini MJ, Della Torre S, Gervasi M, Grandi D, Jóhannesson G, La Vacca G, Masi N, Moskalenko IV, Pensotti S, Porter TA, Quadrani L, Rancoita PG, Rozza D, Tacconi M (2020a) Inference of the local interstellar spectra of cosmicray nuclei \(Z \le 28\) with the GalPropHelMod framework. Astrophys J Suppl 250(2):27. https://doi.org/10.3847/15384365/aba901. arXiv:2006.01337 [astroph.HE]
Boschini MJ, Della Torre S, Gervasi M, Grandi D, Jøhannesson G, La Vacca G, Masi N, Moskalenko IV, Pensotti S, Porter TA, Quadrani L, Rancoita PG, Rozza D, Tacconi M (2020b) Deciphering the local interstellar spectra of secondary nuclei with the Galprop/Helmod framework and a hint for primary lithium in cosmic rays. Astrophys J 889(2):167. https://doi.org/10.3847/15384357/ab64f1. arXiv:1911.03108 [astroph.HE]
Boudaud M, Génolini Y, Derome L, Lavalle J, Maurin D, Salati P, Serpico PD (2020) AMS02 antiprotons’ consistency with a secondary astrophysical origin. Phys Rev Res 2(2):023022. https://doi.org/10.1103/PhysRevResearch.2.023022
Bradt HL, Peters B (1950) Abundance of lithium, beryllium, boron, and other light nuclei in the primary cosmic radiation and the problem of cosmicray origin. Phys Rev 80:943–953. https://doi.org/10.1103/PhysRev.80.943
Breitschwerdt D, McKenzie JF, Voelk HJ (1991) Galactic winds. I—Cosmic ray and wavedriven winds from the Galaxy. Astron Astrophys 245:79–98
Breitschwerdt D, McKenzie JF, Voelk HJ (1993) Galactic winds. II—Role of the diskhalo interface in cosmic ray driven galactic winds. Astron Astrophys 269:54–66
Breitschwerdt D, Dogiel VA, Völk HJ (2002) The gradient of diffuse gammaray emission in the Galaxy. Astron Astrophys 385:216–238. https://doi.org/10.1051/00046361:20020152
Buck T, Pfrommer C, Pakmor R, Grand RJJ, Springel V (2020) The effects of cosmic rays on the formation of Milky Waymass galaxies in a cosmological context. MNRAS 497(2):1712–1737. https://doi.org/10.1093/mnras/staa1960. arXiv:1911.00019 [astroph.GA]
Büsching I, Kopp A, Pohl M, Schlickeiser R, Perrot C, Grenier I (2005) Cosmicray propagation properties for an origin in supernova remnants. Astrophys J 619:314–326. https://doi.org/10.1086/426537
Butsky IS, Quinn TR (2018) The role of cosmicray transport in shaping the simulated circumgalactic medium. Astrophys J 868(2):108. https://doi.org/10.3847/15384357/aaeac2. arXiv:1803.06345 [astroph.GA]
Butsky I, Zrake J, Kim Jh, Yang HI, Abel T (2017) Ab initio simulations of a supernovadriven galactic dynamo in an isolated disk galaxy. Astrophys J 843(2):113. https://doi.org/10.3847/15384357/aa799f. arXiv:1610.08528 [astroph.GA]
Caprioli D, Spitkovsky A (2014) Simulations of ion acceleration at nonrelativistic shocks. I. Acceleration efficiency. Astrophys J 783(2):91. https://doi.org/10.1088/0004637X/783/2/91. arXiv:1310.2943 [astroph.HE]
Casse F, Lemoine M, Pelletier G (2002) Transport of cosmic rays in chaotic magnetic fields. Phys Rev D 65(2):023002. https://doi.org/10.1103/PhysRevD.65.023002. astroph/0109223
Chin YC, Wentzel DG (1972) Nonlinear dissipation of Alfvén waves. Astrophys Space Sci 16(3):465–477. https://doi.org/10.1007/BF00642346
Colella P, Woodward PR (1984) The piecewise parabolic method (PPM) for gasdynamical simulations. J Comput Phys 54:174–201. https://doi.org/10.1016/00219991(84)901438
Commerçon B, Debout V, Teyssier R (2014) A fast, robust, and simple implicit method for adaptive timestepping on adaptive meshrefinement grids. Astron Astrophys 563:A11. https://doi.org/10.1051/00046361/201322858. arXiv:1401.1112 [astroph.IM]
Commerçon B, Marcowith A, Dubois Y (2019) Cosmicray propagation in the bistable interstellar medium. I. Conditions for cosmicray trapping. Astron Astrophys 622:A143. https://doi.org/10.1051/00046361/201833809. arXiv:1811.11509 [astroph.GA]
Connell JJ (2001) Cosmicray composition as observed by Ulysses. Space Sci Rev 99:41–50. https://doi.org/10.1023/A:1013820309913
Crutcher RM (2012) Magnetic fields in molecular clouds. Annu Rev Astron Astrophys 50:29–63. https://doi.org/10.1146/annurevastro081811125514
Cummings AC, Stone EC, Heikkila BC, Lal N, Webber WR, Jóhannesson G, Moskalenko IV, Orlando E, Porter TA (2016) Galactic cosmic rays in the local interstellar medium: voyager 1 observations and model results. Astrophys J 831(1):18. https://doi.org/10.3847/0004637X/831/1/18
Dashyan G, Dubois Y (2020) Cosmic ray feedback from supernovae in dwarf galaxies. Astron Astrophys 638:A123. https://doi.org/10.1051/00046361/201936339. arXiv:2003.09900 [astroph.GA]
Davis L Jr (1960) On the diffusion of cosmic rays in the galaxy. In: Syrovatsky SI (ed) 6th international cosmic ray conference, vol 3, p 220
Davis AJ, Mewaldt RA, Binns WR, Christian ER, Cummings AC, George JS, Hink PL, Leske RA, von Rosenvinge TT, Wiedenbeck ME, Yanasak NE (2000) On the low energy decrease in galactic cosmic ray secondary/primary ratios. In: Mewaldt RA, Jokipii JR, Lee MA, Möbius E, Zurbuchen TH (eds) Acceleration and transport of energetic particles observed in the heliosphere. AIP conference proceedings, American Institute of Physics, New York, p 421. https://doi.org/10.1063/1.1324351
Desiati P, Zweibel EG (2014) The transport of cosmic rays across magnetic fieldlines. Astrophys J 791(1):51. https://doi.org/10.1088/0004637X/791/1/51. arXiv:1402.1475 [astroph.HE]
Dorfi EA, Breitschwerdt D (2012) Timedependent galactic winds. I. Structure and evolution of galactic outflows accompanied by cosmic ray acceleration. Astron Astrophys 540:A77. https://doi.org/10.1051/00046361/201118082. arXiv:1304.1311 [astroph.HE]
Drury LO, Falle SAEG (1986) On the stability of shocks modified by particle acceleration. MNRAS 223:353. https://doi.org/10.1093/mnras/223.2.353
Drury LO, Voelk JH (1981) Hydromagnetic shock structure in the presence of cosmic rays. Astrophys J 248:344–351. https://doi.org/10.1086/159159
Dubois Y, Commerçon B (2016) An implicit scheme for solving the anisotropic diffusion of heat and cosmic rays in the RAMSES code. Astron Astrophys 585:A138. https://doi.org/10.1051/00046361/201527126. arXiv:1509.07037 [astroph.GA]
Dubois Y, Commerçon B, Ar Marcowith, Brahimi L (2019) Shockaccelerated cosmic rays and streaming instability in the adaptive mesh refinement code Ramses. Astron Astrophys 631:A121. https://doi.org/10.1051/00046361/201936275. arXiv:1907.04300 [astroph.GA]
Duvernois MA, Simpson JA, Thayer MR (1996) Interstellar propagation of cosmic rays: analysis of the Ulysses primary and secondary elemental abundances. Astron Astrophys 316:555–563
Ehlert K, Weinberger R, Pfrommer C, Pakmor R, Springel V (2018) Simulations of the dynamics of magnetized jets and cosmic rays in galaxy clusters. MNRAS 481(3):2878–2900. https://doi.org/10.1093/mnras/sty2397. arXiv:1806.05679 [astroph.CO]
Elmegreen BG, Scalo J (2004) Interstellar turbulence I: observations and processes. Annu Rev Astron Astrophys 42:211–273. https://doi.org/10.1146/annurev.astro.41.011802.094859
Enßlin T, Pfrommer C, Miniati F, Subramanian K (2011) Cosmic ray transport in galaxy clusters: implications for radio halos, gammaray signatures, and cool core heating. Astron Astrophys 527:A99. https://doi.org/10.1051/00046361/201015652. arXiv:1008.4717 [astroph.CO]
Evans CR, Hawley JF (1988) Simulation of magnetohydrodynamic flows: a constrained transport model. Astrophys J 332:659. https://doi.org/10.1086/166684
Everett JE, Zweibel EG, Benjamin RA, McCammon D, Rocks L, John Gallagher IS (2008) The Milky Way’s KiloparsecScale wind: a hybrid cosmicray and thermally driven outflow. Astrophys J 674(1):258–270. https://doi.org/10.1086/524766. arXiv:0710.3712 [astroph]
Evoli C, Yan H (2014) Cosmic ray propagation in galactic turbulence. Astrophys J 782:36. https://doi.org/10.1088/0004637X/782/1/36. arXiv:1310.5732 [astroph.HE]
Evoli C, Gaggero D, Vittino A, Di Bernardo G, Di Mauro M, Ligorini A, Ullio P, Grasso D (2017) Cosmicray propagation with DRAGON2: I. numerical solver and astrophysical ingredients. JCAP 2:015. https://doi.org/10.1088/14757516/2017/02/015. arXiv:1607.07886 [astroph.HE]
Falgout RD, Yang UM (2002) hypre: A library of high performance preconditioners. In: Sloot PMA, Hoekstra AG, Tan CJK, Dongarra JJ (eds) Computational science—ICCS 2002. Lecture notes in computer science, vol 2331. Springer, Berlin, pp 632–641. https://doi.org/10.1007/3540477896_66
Falle SAEG, Giddings JR (1987) Timedependent cosmic ray modified shocks. MNRAS 225:399–423. https://doi.org/10.1093/mnras/225.2.399
Farber R, Ruszkowski M, Yang HYK, Zweibel EG (2018) Impact of cosmicray transport on galactic winds. Astrophys J 856:112. https://doi.org/10.3847/15384357/aab26d. arXiv:1707.04579 [astroph.HE]
Ferriere K (1998) Global model of the interstellar medium in our galaxy with new constraints on the hot gas component. Astrophys J 497:759. https://doi.org/10.1086/305469
Ferrière KM (2001) The interstellar environment of our galaxy. Rev Mod Phys 73:1031–1066. https://doi.org/10.1103/RevModPhys.73.1031. astroph/0106359
Fletcher A, Beck R, Shukurov A, Berkhuijsen EM, Horellou C (2011) Magnetic fields and spiral arms in the galaxy M51. MNRAS 412:2396–2416. https://doi.org/10.1111/j.13652966.2010.18065.x. arXiv:1001.5230 [astroph.CO]
Frank A, Jones TW, Ryu D (1994) Oblique magnetohydrodynamic cosmicraymodified shocks: Twofluid numerical simulations. Astrophys J Suppl 90:975–980. https://doi.org/10.1086/191935. astroph/9404073
Frank A, Jones TW, Ryu D (1995) Timedependent simulation of oblique MHD cosmicray shocks using the twofluid model. Astrophys J 441:629–643. https://doi.org/10.1086/175388
Gabici S, Evoli C, Gaggero D, Lipari P, Mertsch P, Orlando E, Strong A, Vittino A (2019) The origin of Galactic cosmic rays: challenges to the standard paradigm. Int J Mod Phys D 28(15):1930022–339. https://doi.org/10.1142/S0218271819300222. arXiv:1903.11584 [astroph.HE]
Gaggero D, Maccione L, Grasso D, Di Bernardo G, Evoli C (2014) PAMELA and AMS02 e\(^{+}\) and e\(^{}\) spectra are reproduced by threedimensional cosmicray modeling. Phys Rev D 89(8):083007. https://doi.org/10.1103/PhysRevD.89.083007. arXiv:1311.5575 [astroph.HE]
Gaisser TK (1991) Cosmic rays and particle physics. Cambridge University Press, Cambridge
Gaisser TK, Stanev T, Tilav S (2013) Cosmic ray energy spectrum from measurements of air showers. Front Phys 8(6):748–758. https://doi.org/10.1007/s1146701303197. arXiv:1303.3565 [astroph.HE]
GarciaMunoz M, Mason GM, Simpson JA (1975) The isotopic composition of galactic cosmicray lithium, beryllium, and boron. Astrophys J 201:L145–L148
GarciaMunoz M, Simpson JA, Guzik TG, Wefel JP, Margolis SH (1987) Cosmicray propagation in the Galaxy and in the heliosphere—the pathlength distribution at low energy. Astrophys J Suppl 64:269–304. https://doi.org/10.1086/191197
Genel S, Vogelsberger M, Nelson D, Sijacki D, Springel V, Hernquist L (2013) Following the flow: tracer particles in astrophysical fluid simulations. MNRAS 435(2):1426–1442. https://doi.org/10.1093/mnras/stt1383. arXiv:1305.2195 [astroph.IM]
Giacalone J, Jokipii JR (1994) Chargedparticle motion in multidimensional magneticfield turbulence. Astrophys J 430:L137–L140. https://doi.org/10.1086/187457
Giacalone J, Jokipii JR (1999) The transport of cosmic rays across a turbulent magnetic field. Astrophys J 520:204–214. https://doi.org/10.1086/307452
Ginzburg VL, Ptuskin VS (1976) On the origin of cosmic rays: some problems in highenergy astrophysics. Rev Mod Phys 48:161–189
Ginzburg VL, Syrovatskii SI (1964) The origin of cosmic rays. Macmillan, New York
Girichidis P, Naab T, Walch S, Hanasz M, Mac Low MM, Ostriker JP, Gatto A, Peters T, Wünsch R, Glover SCO, Klessen RS, Clark PC, Baczynski C (2016) Launching cosmicraydriven outflows from the magnetized interstellar medium. Astrophys J 816:L19. https://doi.org/10.3847/20418205/816/2/L19. arXiv:1509.07247
Girichidis P, Naab T, Hanasz M, Walch S (2018) Cooler and smoother—the impact of cosmic rays on the phase structure of galactic outflows. MNRAS 479:3042–3067. https://doi.org/10.1093/mnras/sty1653. arXiv:1805.09333
Girichidis P, Pfrommer C, Hanasz M, Naab T (2019) Spectrally resolved cosmic ray hydrodynamics—I. Spectral scheme. MNRAS, p 2648. https://doi.org/10.1093/mnras/stz2961. arXiv:1909.12840 [astroph.HE]
Girichidis P, Offner SSR, Kritsuk AG, Klessen RS, Hennebelle P, Kruijssen JMD, Krause MGH, Glover SCO, Padovani M (2020a) Physical processes in star formation. Space Sci Rev 216(4):68. https://doi.org/10.1007/s11214020006938. arXiv:2005.06472 [astroph.GA]
Girichidis P, Pfrommer C, Hanasz M, Naab T (2020b) Spectrally resolved cosmic ray hydrodynamics—I. Spectral scheme. MNRAS 491(1):993–1007. https://doi.org/10.1093/mnras/stz2961. arXiv:1909.12840 [astroph.HE]
Glimm J (1965) Solutions in the large for nonlinear hyperbolic systems of equations. Commun Pure Appl Math 18(4):697–715. https://doi.org/10.1002/cpa.3160180408
Goldreich P, Sridhar S (1995) Toward a theory of interstellar turbulence. II. Strong Alfvénic turbulence. Astrophys J 438:763–775. https://doi.org/10.1086/175121
Grenier IA, Black JH, Strong AW (2015) The nine lives of cosmic rays in galaxies. Annu Rev Astron Astrophys 53:199–246. https://doi.org/10.1146/annurevastro082214122457
Günter S, Yu Q, Krüger J, Lackner K (2005) Modelling of heat transport in magnetised plasmas using nonaligned coordinates. J Comput Phys 209(1):354–370. https://doi.org/10.1016/j.jcp.2005.03.021
Gupta S, Sharma P, Mignone A (2021) A numerical approach to the nonuniqueness problem of cosmic ray twofluid equations at shocks. MNRAS 502(2):2733–2749. https://doi.org/10.1093/mnras/stab142. arXiv:1906.07200 [astroph.HE]
Hanasz M, Lesch H (2000) Cosmicray evolution in parkerunstable galactic magnetic fields. Astrophys J 543:235–244. https://doi.org/10.1086/317077
Hanasz M, Lesch H (2003) Incorporation of cosmic ray transport into the ZEUS MHD code. Application for studies of Parker instability in the ISM. Astron Astrophys 412:331–339. https://doi.org/10.1051/00046361:20031433
Hanasz M, Kowal G, OtmianowskaMazur K, Lesch H (2004) Amplification of galactic magnetic fields by the cosmicraydriven dynamo. Astrophys J 605:L33–L36. https://doi.org/10.1086/420697
Hanasz M, OtmianowskaMazur K, Kowal G, Lesch H (2006) Cosmic ray driven dynamo in galactic disks: effects of resistivity, SN rate and spiral arms. Astron Nachr 327:469. https://doi.org/10.1002/asna.200610559
Hanasz M, OtmianowskaMazur K, Kowal G, Lesch H (2009a) Cosmicraydriven dynamo in galactic disks. A parameter study. Astron Astrophys 498:335–346. https://doi.org/10.1051/00046361/200810279. arXiv:0812.3906
Hanasz M, Wóltański D, Kowalik K (2009b) Global galactic dynamo driven by cosmic rays and exploding magnetized stars. Astrophys J 706:L155–L159. https://doi.org/10.1088/0004637X/706/1/L155. arXiv:0907.4891 [astroph.GA]
Hanasz M, Lesch H, Naab T, Gawryszczak A, Kowalik K, Wóltański D (2013) Cosmic rays can drive strong outflows from gasrich highredshift disk galaxies. Astrophys J 777:L38. https://doi.org/10.1088/20418205/777/2/L38. arXiv:1310.3273
Harten A (1983) High resolution schemes for hyperbolic conservation laws. J Comput Phys 49(3):357–393. https://doi.org/10.1016/00219991(83)901365
Heintz E, Zweibel EG (2018) The parker instability with cosmicray streaming. Astrophys J 860(2):97. https://doi.org/10.3847/15384357/aac208. arXiv:1803.00584 [astroph.HE]
Heintz E, Bustard C, Zweibel EG (2020) The role of the parker instability in structuring the interstellar medium. Astrophys J 891(2):157. https://doi.org/10.3847/15384357/ab7453. arXiv:1910.03588 [astroph.GA]
Higdon JC, Lingenfelter RE (2003) The myriadsource model of cosmic rays. I. Steady state age and path length distributions. Astrophys J 582:330–341. https://doi.org/10.1086/344510
Holguin F, Ruszkowski M, Lazarian A, Farber R, Yang HYK (2019) Role of cosmicray streaming and turbulent damping in driving galactic winds. MNRAS 490(1):1271–1282. https://doi.org/10.1093/mnras/stz2568. arXiv:1807.05494 [astroph.HE]
Hopkins PF, Squire J, Chan TK, Quataert E, Ji S, Kereš D, FaucherGiguère CA (2021) Testing physical models for cosmic ray transport coefficients on galactic scales: selfconfinement and extrinsic turbulence at \({{\sim }}\)GeV energies. MNRAS 501(3):4184–4213. https://doi.org/10.1093/mnras/staa3691. arXiv:2002.06211 [astroph.HE]
Indriolo N, McCall BJ (2012) Investigating the cosmicray ionization rate in the galactic diffuse interstellar medium through observations of H\(^{+}_{3}\). Astrophys J 745(1):91. https://doi.org/10.1088/0004637X/745/1/91. arXiv:1111.6936 [astroph.GA]
Indriolo N, Geballe TR, Oka T, McCall BJ (2007) H\(^{+}_{3}\) in diffuse interstellar clouds: a tracer for the cosmicray ionization rate. Astrophys J 671(2):1736–1747. https://doi.org/10.1086/523036. arXiv:0709.1114 [astroph]
Ipavich FM (1975) Galactic winds driven by cosmic rays. Astrophys J 196:107–120. https://doi.org/10.1086/153397
Ivlev AV, Dogiel VA, Chernyshov DO, Caselli P, Ko CM, Cheng KS (2018) Penetration of cosmic rays into dense molecular clouds: role of diffuse envelopes. Astrophys J 855(1):23. https://doi.org/10.3847/15384357/aaadb9. arXiv:1802.02612 [astroph.HE]
Jacob S, Pakmor R, Simpson CM, Springel V, Pfrommer C (2018) The dependence of cosmic raydriven galactic winds on halo mass. MNRAS 475(1):570–584. https://doi.org/10.1093/mnras/stx3221. arXiv:1712.04947 [astroph.GA]
Jiang YF, Oh SP (2018) A new numerical scheme for cosmicray transport. Astrophys J 854(1):5. https://doi.org/10.3847/15384357/aaa6ce. arXiv:1712.07117 [astroph.HE]
Jokipii JR (1971) Propagation of cosmic rays in the solar wind. Rev Geophys Space Phys 9:27
Jokipii JR (1976) Consequences of a lifetime greater than 10 to the 7th power years for galactic cosmic rays. Astrophys J 208:900–902
Jones FC (1978) The history of cosmic rays in a dynamical halo: a retrodictive probability approach. Astrophys J 222:1097–1103. https://doi.org/10.1086/156226
Jones FC (1979) The dynamical halo and the variation of cosmicray path length with energy. Astrophys J 229:747–752. https://doi.org/10.1086/157010
Jones TW, Kang H (1990) Timedependent evolution of cosmicraymediated shocks in the twofluid model. Astrophys J 363:499–514. https://doi.org/10.1086/169361
Jones TW, Kang H (1993) Cosmicray acceleration during the impact of shocks on dense clouds. Astrophys J 402:560–573. https://doi.org/10.1086/172158
Jones TW, Kang H (2005) An efficient numerical scheme for simulating particle acceleration in evolving cosmicray modified shocks. Astropart Phys 24:75–91. https://doi.org/10.1016/j.astropartphys.2005.05.006
Jones TW, Kang H, Tregillis IL (1994) Cosmic bullets as particle accelerators and radio sources. Astrophys J 432:194–206. https://doi.org/10.1086/174560
Jones TW, Ryu D, Engel A (1999) Simulating electron transport and synchrotron emission in radio galaxies: shock acceleration and synchrotron aging in axisymmetric flows. Astrophys J 512:105–124. https://doi.org/10.1086/306772. arXiv:astroph/9809081
Jones FC, Lukasiak A, Ptuskin V, Webber W (2001a) The modified weighted slab technique: models and results. Astrophys J 547:264–271. https://doi.org/10.1086/318358
Jones FC, Lukasiak A, Ptuskin VS, Webber WR (2001b) Kcapture cosmic ray secondaries and reacceleration. Adv Space Res 27:737–741
Jubelgas M, Springel V, Enßlin T, Pfrommer C (2008) Cosmic ray feedback in hydrodynamical simulations of galaxy formation. Astron Astrophys 481:33–63. https://doi.org/10.1051/00046361:20065295. astroph/0603485
Jun BI, Jones TW (1999) Radio emission from a young supernova remnant interacting with an interstellar cloud: magnetohydrodynamic simulation with relativistic electrons. Astrophys J 511:774–791. https://doi.org/10.1086/306694
Jun BI, Clarke DA, Norman ML (1994) The evolution of cosmicraymediated magnetohydrodynamic shocks: a twofluid approach. Astrophys J 429:748. https://doi.org/10.1086/174358
Kang H, Jones TW (1990) Diffusive cosmicray acceleration—twofluid models with in situ injection. Astrophys J 353:149–158. https://doi.org/10.1086/168601
Kang H, Jones TW (1997) Diffusive shock acceleration in oblique magnetohydrodynamic shocks: comparison with Monte Carlo methods and observations. Astrophys J 476:875. https://doi.org/10.1086/303646
Kang H, Jones TW (2007) Selfsimilar evolution of cosmicraymodified quasiparallel plane shocks. Astropart Phys 28(2):232–246. https://doi.org/10.1016/j.astropartphys.2007.05.007. arXiv:0705.3274 [astroph]
Kang H, Ryu D (2013) Diffusive shock acceleration at cosmological shock waves. Astrophys J 764(1):95. https://doi.org/10.1088/0004637X/764/1/95. arXiv:1212.3246 [astroph.HE]
Kennel CF, Engelmann F (1966) Velocity space diffusion from weak plasma turbulence in a magnetic field. Phys Fluids 9(12):2377–2388. https://doi.org/10.1063/1.1761629
Keshet U, Waxman E, Loeb A, Springel V, Hernquist L (2003) Gamma rays from intergalactic shocks. Astrophys J 585(1):128–150. https://doi.org/10.1086/345946. arXiv:astroph/0202318 [astroph]
Kissmann R (2014) PICARD: a novel code for the Galactic Cosmic Ray propagation problem. Astropart Phys 55:37–50. https://doi.org/10.1016/j.astropartphys.2014.02.002. arXiv:1401.4035 [astroph.HE]
Kotera K, Olinto AV (2011) The astrophysics of ultrahighenergy cosmic rays. Annu Rev Astron Astrophys 49(1):119–153. https://doi.org/10.1146/annurevastro081710102620. arXiv:1101.4256 [astroph.HE]
Kotera K, Silk J (2016) Ultrahighenergy Cosmic Rays and Black Hole Mergers. Astrophys J 823(2):L29. https://doi.org/10.3847/20418205/823/2/L29. arXiv:1602.06961 [astroph.HE]
Kowal G, OtmianowskaMazur K, Hanasz M (2006) Dynamo coefficients in Parker unstable disks with cosmic rays and shear. The new methods of estimation. Astron Astrophys 445:915–929. https://doi.org/10.1051/00046361:20053582
Krause M (2009) Magnetic fields and star formation in spiral galaxies. Rev Mex Astron Astrofis Conf Ser Rev Mex Astron Astrofis 36:25–29 (arXiv:0806.2060
Krumholz MR, Crocker RM, Xu S, Lazarian A, Rosevear MT, BedwellWilson J (2020) Cosmic ray transport in starburst galaxies. MNRAS 493(2):2817–2833. https://doi.org/10.1093/mnras/staa493. arXiv:1911.09774 [astroph.HE]
Krymskii GF (1977) A regular mechanism for the acceleration of charged particles on the front of a shock wave. Akad Nauk SSSR Dokl 234:1306–1308
Kudoh Y, Hanawa T (2016) A new scheme to solve the twofluid cosmicray magnetohydrodynamic equations. J Phys Conf Ser 719:012021. https://doi.org/10.1088/17426596/719/1/012021
KulpaDybeł K, OtmianowskaMazur K, KuleszaZydzik B, Hanasz M, Kowal G, Wóltański D, Kowalik K (2011) Global simulations of the magnetic field evolution in barred galaxies under the influence of the cosmicraydriven dynamo. Astrophys J 733:L18. https://doi.org/10.1088/20418205/733/2/L18. arXiv:1106.0283 [astroph.GA]
KulpaDybeł K, Nowak N, OtmianowskaMazur K, Hanasz M, Siejkowski H, KuleszaZydzik B (2015) The effect of supernova rate on the magnetic field evolution in barred galaxies. Astron Astrophys 575:A93. https://doi.org/10.1051/00046361/201323113
Kulsrud R, Pearce WP (1969) The effect of waveparticle interactions on the propagation of cosmic rays. Astrophys J 156:445. https://doi.org/10.1086/149981
Kuwabara T, Ko CM (2006) ParkerJeans instability of gaseous disks including the effect of cosmic rays. Astrophys J 636:290–302. https://doi.org/10.1086/498056
Kuwabara T, Ko CM (2020) Dynamics of the ParkerJeans instability of gaseous disks including the effect of cosmic rays. Astrophys J 899(1):72. https://doi.org/10.3847/15384357/aba04c. arXiv:2008.06117 [astroph.HE]
Kuwabara T, Nakamura K, Ko CM (2004) Nonlinear parker instability with the effect of cosmicray diffusion. Astrophys J 607:828–839. https://doi.org/10.1086/383611
Lave KA, Wiedenbeck ME, Binns WR, Christian ER, Cummings AC, Davis AJ, de Nolfo GA, Israel MH, Leske RA, Mewaldt RA, Stone EC, von Rosenvinge TT (2013) Galactic CosmicRay energy spectra and composition during the 2009–2010 solar minimum period. Astrophys J 770:117. https://doi.org/10.1088/0004637X/770/2/117
Lesch H, Hanasz M (2003) Strong magnetic fields and cosmic rays in very young galaxies. Astron Astrophys 401:809–816. https://doi.org/10.1051/00046361:20030212
LeVeque RJ (2002) Finite volume methods for hyperbolic problems. Cambridge Texts in Applied Mathematics. Cambridge University Press, Cambridge. https://doi.org/10.1017/CBO9780511791253
Mac Low MM, Klessen RS (2004) Control of star formation by supersonic turbulence. Rev Mod Phys 76:125–194. https://doi.org/10.1103/RevModPhys.76.125
MacKenzie JF, Völk HJ (1982) Nonlinear theory of cosmic ray shocks including selfgenerated Alfvén waves. Astron Astrophys 116:191–200
Marcowith A, Ferrand G, Grech M, Meliani Z, Plotnikov I, Walder R (2020) Multiscale simulations of particle acceleration in astrophysical systems. Living Rev Comput Astrophys 6:1. https://doi.org/10.1007/s4111502000076. arXiv:2002.09411 [astroph.HE]
Mashnik SG, Gudima KK, Moskalenko IV, Prael RE, Sierk AJ (2004) CEM2K and LAQGSM codes as event generators for spaceradiationshielding and cosmicraypropagation applications. Adv Space Res 34:1288–1296. https://doi.org/10.1016/j.asr.2003.08.057
Mathews WG, Brighenti F (2007) Creation of Xray cavities in galaxy clusters with cosmic rays. Astrophys J 660:1137–1145. https://doi.org/10.1086/513691. astroph/0701712
Mathews WG, Brighenti F (2008) Creation of the Xray cavity jet and its radio lobe in M87/Virgo with cosmic rays: relevance to relic radio sources. Astrophys J 676:880–888. https://doi.org/10.1086/527429. arXiv:0711.4384
Maurin D (2020) USINE: semianalytical models for Galactic cosmicray propagation. Comput Phys Commun 247:106942. https://doi.org/10.1016/j.cpc.2019.106942
Maurin D, Donato F, Taillet R, Salati P (2001) Cosmic rays below \(Z = 30\) in a diffusion model: new constraints on propagation parameters. Astrophys J 555:585–596. https://doi.org/10.1086/321496
Maurin D, Taillet R, Donato F (2002) New results on source and diffusion spectral features of Galactic cosmic rays: I B/C ratio. Astron Astrophys 394:1039–1056. https://doi.org/10.1051/00046361:20021176
McKee CF, Ostriker EC (2007) Theory of star formation. Annu Rev Astron Astrophys 45(1):565–687. https://doi.org/10.1146/annurev.astro.45.051806.110602. arXiv:0707.3514 [astroph]
Mimica P, Aloy MA, Agudo I, Martí JM, Gómez JL, Miralles JA (2009) Spectral evolution of superluminal components in parsecscale jets. Astrophys J 696(2):1142–1163. https://doi.org/10.1088/0004637X/696/2/1142. arXiv:0811.1143 [astroph]
Miniati F (2001) COSMOCR: a numerical code for cosmic ray studies in computational cosmology. Comput Phys Commun 141:17–38. https://doi.org/10.1016/S00104655(01)002934
Miniati F (2007) Glimm–Godunov’s method for cosmicrayhydrodynamics. J Comput Phys 227:776–796. https://doi.org/10.1016/j.jcp.2007.08.013. astroph/0611499
Miniati F, Ryu D, Kang H, Jones TW, Cen R, Ostriker JP (2000) Properties of cosmic shock waves in largescale structure formation. Astrophys J 542(2):608–621. https://doi.org/10.1086/317027. arXiv:astroph/0005444 [astroph]
Miniati F, Jones TW, Kang H, Ryu D (2001a) Cosmicray electrons in groups and clusters of galaxies: primary and secondary populations from a numerical cosmological simulation. Astrophys J 562:233–253. https://doi.org/10.1086/323434
Miniati F, Ryu D, Kang H, Jones TW (2001b) Cosmicray protons accelerated at cosmological shocks and their impact on groups and clusters of galaxies. Astrophys J 559:59–69. https://doi.org/10.1086/322375
Mora SC, Krause M (2013) Magnetic field structure and halo in NGC 4631. Astron Astrophys 560:A42. https://doi.org/10.1051/00046361/201321043. arXiv:1312.3648 [astroph.GA]
Morlino G, Gabici S (2015) Cosmic ray penetration in diffuse clouds. MNRAS 451:L100–L104. https://doi.org/10.1093/mnrasl/slv074. arXiv:1503.02435 [astroph.HE]
Moskalenko IV, Strong AW (1998) Production and propagation of cosmicray positrons and electrons. Astrophys J 493:694–707. https://doi.org/10.1086/305152. astroph/9710124
Moskalenko IV, Strong AW, Ormes JF, Potgieter MS (2002) Secondary antiprotons and propagation of cosmic rays in the galaxy and heliosphere. Astrophys J 565:280–296. https://doi.org/10.1086/324402
Naab T, Ostriker JP (2017) Theoretical challenges in galaxy formation. Annu Rev Astron Astrophys 55:59–109. https://doi.org/10.1146/annurevastro081913040019. arXiv:1612.06891
Newcomb WA (1961) Convective instability induced by gravity in a plasma with a frozenin magnetic field. Phys Fluids 4(4):391–396. https://doi.org/10.1063/1.1706342
Ogrodnik MA, Hanasz M, Wóltański D (2021) Implementation of cosmic ray energy spectrum (CRESP) algorithm in PIERNIK MHD code. I. Spectrally resolved propagation of cosmic ray el