**Piernik Code**

**main git repository**

**Developers**

**Publications**

**Results**

**Documentation (1.0)**

**Download the code**

## Piernik MHD code webpage

PIERNIK is a grid-based MHD code using conservative numerical schemes: relaxing TVD scheme (Pen et al., 2003; Trac & Pen, 2003) and the recently implemented HLLD approximate Riemann MHD solver (Miyoshi & Kusano, 2005) combined with the Dedner et al. (2002) divergence cleaning algorithm. The code relies on a dimensionally split, second order algorithm in space and time. The functionality of PIERNIK includes the capability to model multiple fluids: gas, dust, magnetic field, cosmic rays, and their mutual interactions. PIERNIK is parallelized on the base of MPI library and its dataIO communication utilizes parallel HDF5 output.

PIERNIK is equipped with advanced algorithms enabling multi-scale numerical experiments: Adaptive Mesh Refinement (AMR) and a Multigrid (MG) solver. The AMR algorithm allows to reach much bigger effective resolutions than it was possible with uniform grid. The MG, on the other hand, is one of the fastest known methods to solve parabolic and elliptic differential equations, which in our case are used to describe self-gravity of the fluid and diffusion of cosmic rays. The multigrid solver is combined with a Multipole solver to treat properly isolated boundaries in numerical solutions of Poisson’s equation. Combination of the MHD Riemann solver, AMR, multigrid and multipole algorithms make PIERNIK a perect tool for numerical simulations of multi-physics phenomena in gaseous disks of galaxies.

Moreover, PIERNIK has recently been equipped with the N-body module based on the Particle-Mesh method using the Triangular Shaped Clouds and multigrid algorithms together with the leapfrog time-integration scheme. The N-body algorithm enables simulations of a selfgravitating system consisting of a large number of particles, representing stars or dark matter, along with gas, magnetic fields and cosmic rays.

PIERNIK has recently been equipped with a fully novel and unique module CRESP (Cosmic Ray Energy SPectrum) for momentum-dependent propagation of cosmic rays. The algorithm is designated for studies of CR energy spectrum evolution in MHD simulations of galactic interstellar medium. The base algorithm for CR transport relies on the two-moment piece-wise power-law method Miniati (2001); Jones & Kang (2005); Girichidis et al. (2020), known also as Coarse Grained Momentum Final Volume (CGMV), for solving the Fokker-Planck CR transport equation, with a low number of momentum-bins extending over several decades of the momentum coordinate. We extended CGMV
with a novel feature which allows momentum boundaries to change in response to CR momentum gains or losses near the extremes of the population distribution. The code supports anisotropic, magnetic field-aligned, momentum dependent diffusive transport of cosmic rays Hanasz & Lesch (2003).

An example of physical systems requiring this kind of multiphysics and multifluid modeling are galaxies (Hanasz et al., 2009, 2013) composed of stellar and dark matter particles, interstellar gas, magnetic fields and cosmic ray particles accelerated to relativistic energies in supernova remnants. Other applications of PIERNIK code include studies of planet formation in protoplanetary disks (Kowalik et al., 2013) and modelling winds and accretion in symbiotic stellar systems (de Val-Borro et al., 2017).

## References

de Val-Borro, M., Karovska, M., Sasselov, D. D., & Stone, J. M.: 2017, MNRAS **468(3)**, 3408

Dedner, A., Kemm, F., Kröner, D., Munz, C.-D., Schnitzer, T., & Wesenberg, M.: 2002, Journal of Computational Physics **175(2)**, 645

Girichidis, P., Pfrommer, C., Hanasz, M., & Naab, T.: 2020, MNRAS **491(1)**, 993

Hanasz, M. & Lesch, H.: 2003, A&A **412**, 331

Hanasz, M., Lesch, H., Naab, T., Gawryszczak, A., Kowalik, K., & Wóltański, D.: 2013, ApJ **777(2)**, L38

Hanasz, M., Wóltański, D., & Kowalik, K.: 2009, ApJ **706(1)**, L155

Jones, T. W. & Kang, H.: 2005, Astroparticle Physics **24**, 75

Kowalik, K., Hanasz, M., Wóltański, D., & Gawryszczak, A.: 2013, MNRAS **434(2)**, 1460

Miniati, F.: 2001, Computer Physics Communications **141**, 17

Miyoshi, T. & Kusano, K.: 2005, Journal of Computational Physics **208**, 315

Pen, U.-L., Arras, P., & Wong, S.: 2003, ApJS **149**, 447

Trac, H. & Pen, U.-L.: 2003, PASP **115**, 303