781
Views
1
CrossRef citations to date
0
Altmetric
Introduction

Introduction

ORCID Icon, ORCID Icon & ORCID Icon

Rudimentary elements of the Pencil Code were originally developed at the Helmholtz Institute for Supercomputational Physics in Golm, Germany. It began during the Summer School “Tools to Simulate Turbulence on Supercomputers” held 27 August – 21 September 2001 within the premises of the Albert Einstein Institute in Golm; see its annual report (Nicolai Citation2001). The spatial and temporal discretisation schemes used in the code are described by Brandenburg and Dobler (Citation2002) and Brandenburg (Citation2003), which have become the most commonly quoted sources with reference to the Pencil Code. In the meantime, however, more than seventy people have contributed to the further development of the code,Footnote1 such that some revised and more comprehensive references are badly needed. It is towards this end that we present this special issue in Geophysical and Astrophysical Fluid Dynamics (GAFD) to discuss specific applications and their numerical aspects, especially relating to newly emerging research topics.

Early applications of the Pencil Code were in dynamo theory of forced turbulence in Cartesian domains (Haugen et al. Citation2003Citation2004aCitation2004b). Subsequently, continued code developments have extended its scope in many different directions. On one hand, cylindrical and spherical geometries have been employed in applications ranging from mean-field and forced turbulence simulations (Mitra et al. Citation2009Citation2010, Kemel et al. Citation2011) to convectively driven dynamos (Käpylä et al. Citation2010Citation2012Citation2013) and circumstellar disks (Lyra and Mac Low Citation2012, Lyra et al. Citation2015Citation2016). On the other hand, Cartesian geometries have been used in more complex physical settings ranging from technical applications to a broad spectrum of astrophysical applications. This special issue of GAFD gives insight into some of the problems with which members of the Pencil Code community are currently concerned. Some of the topics relate to the necessary physical setup, in order to address specific questions in the most appropriate manner, while others concern the solutions to numerical challenges that have been encountered in the process of solving various problems.

Specifically, we begin the special issue by addressing the global convection-driven dynamo problem in spherical geometry. The actual implementation of spherical geometry has been described in an earlier paper by Mitra et al. (Citation2009), which involves replacing partial derivatives by covariant derivatives. As an example, the traceless rate-of-strain tensor is generalised by substituting (1) 12(ui,j+uj,i)13δijuk,k12(ui;j+uj;i)13δijuk;k,(1) where commas and semicolons denote partial and covariant derivatives, respectively. The physical challenge of addressing global spherical dynamo problems concerns the vast separation of time scales from minutes in the surface granulation to years in deep layers governed by the geometric mean of dynamical and Kelvin-Helmholtz time scales (Spiegel Citation1987). This problem is approached by modifying the physical setup such that a model star has time scales that are compressed to a much narrower range. This can lead to artifacts that need to be studied in detail. Addressing this question is the topic of the paper by Käpylä et al. (Citation2020).

Among the technical applications of the Pencil Code are the presence of solid objects within the fluid flow, such as, e.g. a cylinder in a cross flow, and the use of more complex boundary conditions. In this connection, Aarnes et al. (Citation2020) have compared two different approaches for handling solid bodies within a fluid flow. One is the immersed boundary method and the other is the overset grid method. Both are implemented in the code and have been compared with regard to performance and accuracy. The overset grid method is found to be superior to the immersed boundary method and has now been used to study particle impaction on a cylinder in a cross flow (Aarnes et al. Citation2019).

Another technical application concerns hydrogen–oxygen combustion in rockets, for example, but this can sometimes also lead to detonation. Simulating this is a challenging problem, whose success depends crucially on being able to resolve the pressure and chemical reaction fronts well enough so that they do not separate and detach from each other, which can quench the detonation. This has been addressed in the paper by Qian et al. (Citation2020). Here, solutions with the Pencil Code have been resolved with mesh widths down to 0.2 micrometers in a one-dimensional domain of 10 cm length. This corresponds to a computational work load of half a million mesh points and several days of wall clock time on 2048 processors.

The numerical handling of shocks with artificial viscosity is a main topic of the paper by Gent et al. (Citation2020). In addition to presenting several one-dimensional Riemann shock tube problems, the authors also show the detailed analysis of the evolution of individual three-dimensional supernova remnants. These results are relevant to the numerical treatment of interstellar turbulence driven by supernova explosions, in which thousands of such events are required over millions of years and longer. Spatial and temporal resolution cannot therefore be unlimited, and the study assesses the physical veracity of coarse grain models practicable for inclusion in such turbulence simulations.

On cosmological scales, Schober et al. (Citation2020) focus on relativistic plasmas in the early universe. A relativistic plasma is one where the chirality of fermions can play a dominant role and produce additional effects analogous to the α effect in mean-field electrodynamics (Moffatt Citation1978, Krause and Rädler Citation1980), but now at the fully microphysical level. This leads to modifications of the governing magnetohydrodynamic (MHD) equations that have been solved with the Pencil Code during the last few years (Brandenburg et al. Citation2017, Rogachevskii et al. Citation2017, Schober et al. Citation2018). In this issue, Schober and collaborators invoke yet another effect, called the chiral separation effect, and describe its implementation and tests.

Again on cosmological scales, Roper Pol et al. (Citation2020) discuss for the first time the direct numerical solution of gravitational waves from hydrodynamic and MHD turbulence driven during the electroweak phase transition, when the Universe was just some 1011s old. The authors identify an important problem that concerns the numerical accuracy of the gravitational wave spectrum at large wavenumbers. A brute force approach would require time steps that are about 20 times shorter than what is expected based on the usual Courant-Friedrich-Levy condition. To avoid this serious restriction, they solve the gravitational wave equation analytically in Fourier space between two subsequent time steps. Their approach leads to a speed-up by about a factor of ten.

Another problem related to the time step is tackled in the paper by Brandenburg and Das (Citation2020), where the authors solve the radiation hydrodynamics equations with the Pencil Code for hot stars, in which the radiation pressure becomes important, and for accretion disks around white dwarfs. Their paper gives a detailed characterisation of the empirical time step constraints in a broad range of different circumstances and also comparisons with theory.

Returning to the Sun, several applications with the Pencil Code have previously determined the oscillation frequencies in stratified layers (Singh et al. Citation2014Citation2015). In their new work, Singh et al. (Citation2020) present results for a more complicated magnetic field geometry. In particular, they find that the unstable Bloch modes reported previously (Singh et al. Citation2014) are now absent when more realistic localised flux concentrations are considered.

Chatterjee (Citation2020) considers realistic solar setups of the solar atmosphere and solves for the generation, propagation, and dissipation of Alfvén waves in the solar atmosphere. The displacement current is retained to limit the propagation speed and thus the time step. This is done by using the Boris correction (Boris Citation1970), which treats the displacement current in a semi-relativistic manner and was implemented in the Pencil Code by Chatterjee.

Bourdin (Citation2020) considers realistic coronal setups and discusses the use of a novel boundary condition to treat non-vertical and non-potential magnetic fields. He also discusses the scalability of the code, with the introduction of the extendable HDF5 file format and input-output strategies that are better suited for modern supercomputers.

Warnecke and Bingert (Citation2020) further improved such a model of the solar corona by using the Boris correction implemented by Chatterjee (Citation2020) and further characterise its properties in their work on non-Fickian or non-Fourier heat conduction using the telegraph equation. This approach is analogous to what was done previously to solve for cosmic ray diffusion in the interstellar medium (Snodin et al. Citation2006) with a very large diffusion coefficient, which would severely limit the time step. As in earlier work (Blackman and Field Citation2003, Brandenburg et al. Citation2004, Rempel Citation2017), the authors also found a significantly increased time step, which resulted in a speed-up of the code.

As already alluded to in the opening paragraphs, this special issue gives only a glimpse at some of the applications of the Pencil Code to a diverse range of problems. There are many other papers, where further aspects of the code are presented. As an example, we mention the work of Johansen et al. (Citation2007Citation2011Citation2012) and Lyra et al. (Citation2008Citation2009Citation2015Citation2016) on planet formation and papers by Li et al. (Citation2017Citation2018Citation2019) on raindrop formation. These papers discuss the computation of inertial particles in a turbulent flow with applications to astrophysics and meteorology. A complete list of the currently 527 papers that refer to the Pencil Code was presented by Brandenburg (Citation2019b) at the Pencil Code User Meeting 2019 in Espoo (Finland).

The code has also been used to compute turbulent front propagation, which results in a spatial generalisation to reaction-diffusion equations describing the emergence of homochirality (Brandenburg and Multamäki Citation2004). Interestingly, one tends to think of the Pencil Code as a tool for solving partial differential equations, but even this is not always the case and one may just solve ordinary differential equations (ODEs). An advantage of employing the Pencil Code technology lies in the ease at which many ODEs can be solved at the same time on many processors. This can become a significant advantage for solving many realizations of stochastic differential equations, as done in a recent alternative approach to solving astrobiological reaction equations to describe the evolution toward homochirality (Brandenburg Citation2019a).

Another major Pencil Code activity of the past decade concerns the test-field method. This has been reviewed on an earlier occasion (Brandenburg et al. Citation2010) and has also been applied to convection-driven turbulent dynamos in spherical geometry (Warnecke et al. Citation2018). Solving not just one set of test fields, but different ones in isolation or simultaneously is particularly straightforward with the Pencil Code owing to its modularity (Brandenburg et al. Citation2012). Similarly, exploring the parallels between direct numerical simulations and mean-field simulations has played a major role in the investigation of the negative effective magnetic pressure instability (Kemel et al. Citation2012Citation2013). Here the exploration of both approaches is particularly useful for understanding relevant parameter regimes, for example.

In conclusion, we hope that this special issue does some justice to the community of Pencil Code users, and especially the developers who all work primarily toward their own research goals, but they do so in such a way that their efforts benefit the other users in a constructive manner. This is made feasible through sets of automated test runs that verify the integrity of the code hourly, daily, and even after every single update to the code. At the time of writing this editorial, 30,431 updates or commits have been made by the code developers. In fact, 34 developers have done more that 34 commits, which is like an h index of the Pencil Code. This underlines the special role of this code development as a community effort in sharing and utilising each others work.

Notes

References

  • Aarnes, J.R., Haugen, N.E.L. and Andersson, H.I., High-order overset grid method for detecting particle impaction on a cylinder in a cross flow. Int. J. Comp. Fluid Dynam. 2019, 33, 43–58. doi: 10.1080/10618562.2019.1593385
  • Aarnes, J.R., Jin, T., Mao, C., Haugen, N.E.L., Luo, K. and Andersson, H.I., Treatment of solid objects in the Pencil Code using an immersed boundary method and overset grids. Geophys. Astro. Fluid 2020, 114, 35–57. doi:10.1080/03091929.2018.1492720.
  • Blackman, E.G. and Field, G.B., A simple mean field approach to turbulent transport. Phys. Fluids 2003, 15, L73–L76. doi: 10.1063/1.1613281
  • Boris, J.P., A physically motivated solution of the Alfvén problem. NRL Memorandum Report, 2167, 1970.
  • Bourdin, P.-A., Driving solar coronal MHD simulations on high-performance computers. Geophys. Astro. Fluid 2020, 114, 235–260. doi:10.1080/03091929.2019.1643849.
  • Brandenburg, A., Computational aspects of astrophysical MHD and turbulence. In Advances in Nonlinear Dynamos (The Fluid Mechanics of Astrophysics and Geophysics), edited by A. Ferriz-Mas and M. Núñez, Vol. 9, pp. 269–344, 2003 ( London and New York: Taylor & Francis).
  • Brandenburg, A., The limited roles of autocatalysis and enantiomeric cross-inhibition in achieving homochirality in dilute systems. Orig. Life Evol. Biosph. 2019a, 49, 49–60. doi: 10.1007/s11084-019-09579-4
  • Brandenburg, A. (2019b). Scientific usage of the Pencil Code. doi:10.5281/zenodo.3466444.
  • Brandenburg, A. and Dobler, W., Hydromagnetic turbulence in computer simulations. Comp. Phys. Comm. 2002, 147, 471–475. doi: 10.1016/S0010-4655(02)00334-X
  • Brandenburg, A. and Multamäki, T., How long can left and right handed life forms coexist? Int. J. Astrobiol. 2004, 3, 209–219. doi: 10.1017/S1473550404001983
  • Brandenburg, A. and Das, U., The time step constraint in radiation hydrodynamics. Geophys. Astro. Fluid 2020, 114, 162–195. doi:10.1080/03091929.2019.1676894.
  • Brandenburg, A., Käpylä, P.J. and Mohammed, A., Non-Fickian diffusion and tau-approximation from numerical turbulence. Phys. Fluids 2004, 16, 1020–1027. doi: 10.1063/1.1651480
  • Brandenburg, A., Chatterjee, P., Del Sordo, F., Hubbard, A., Käpylä, P.J. and Rheinhardt, M., Turbulent transport in hydromagnetic flows. Phys. Scr. 2010, T142, 014028. doi: 10.1088/0031-8949/2010/T142/014028
  • Brandenburg, A., Rädler, K.-H. and Kemel, K., Mean-field transport in stratified and/or rotating turbulence. Astron. Astrophys. 2012, 539, A35. doi: 10.1051/0004-6361/201117871
  • Brandenburg, A., Schober, J., Rogachevskii, I., Kahniashvili, T., Boyarsky, A., Fröhlich, J., Ruchayskiy, O. and Kleeorin, N., The turbulent chiral magnetic cascade in the early universe. Astrophys. J. Lett. 2017, 845, L21. doi: 10.3847/2041-8213/aa855d
  • Chatterjee, P., Testing Alfvén wave propagation in a “realistic” set-up of the solar atmosphere. Geophys. Astro. Fluid 2020, 114, 213–234. doi:10.1080/03091929.2019.1672676.
  • Gent, F.A., Mac Low, M.-M., Käpylä, M.J., Sarson, G.R. and Hollins, J.F., Modelling supernova-driven turbulence. Geophys. Astro. Fluid 2020, 114, 77–105. doi:10.1080/03091929.2019.1634705.
  • Haugen, N.E.L., Brandenburg, A. and Dobler, W., Is nonhelical hydromagnetic turbulence peaked at small scales? Astrophys. J. Lett. 2003, 597, L141–L144. doi: 10.1086/380189
  • Haugen, N.E.L., Brandenburg, A. and Dobler, W., Simulations of nonhelical hydromagnetic turbulence. Phys. Rev. E 2004a, 70, 016308.
  • Haugen, N.E.L., Brandenburg, A. and Mee, A.J., Mach number dependence of the onset of dynamo action. Month. Not. Roy. Astron. Soc. 2004b, 353, 947–952. doi: 10.1111/j.1365-2966.2004.08127.x
  • Johansen, A., Oishi, J.S., Mac Low, M.M., Klahr, H., Henning, T. and Youdin, A., Rapid planetesimal formation in turbulent circumstellar disks. Nature 2007, 448, 1022–1025. doi: 10.1038/nature06086
  • Johansen, A., Klahr, H. and Henning, Th., High-resolution simulations of planetesimal formation in turbulent protoplanetary discs. Astron. Astrophys. 2011, 529, A62. doi: 10.1051/0004-6361/201015979
  • Johansen, A., Youdin, A.N. and Lithwick, Y., Adding particle collisions to the formation of asteroids and Kuiper belt objects via streaming instabilities. Astron. Astrophys. 2012, 537, A125. doi: 10.1051/0004-6361/201117701
  • Käpylä, P.J., Korpi, M.J., Brandenburg, A., Mitra, D. and Tavakol, R., Convective dynamos in spherical wedge geometry. Astron. Nachr. 2010, 331, 73–81. doi: 10.1002/asna.200911252
  • Käpylä, P.J., Mantere, M.J. and Brandenburg, A., Cyclic magnetic activity due to turbulent convection in spherical wedge geometry. Astrophys. J. Lett. 2012, 755, L22. doi: 10.1088/2041-8205/755/1/L22
  • Käpylä, P.J., Mantere, M.J., Cole, E., Warnecke, J. and Brandenburg, A., Effects of strong stratification on equatorward dynamo wave propagation. Astrophys. J. 2013, 778, 41. doi: 10.1088/0004-637X/778/1/41
  • Käpylä, P.J., Gent, F.A., Olspert, N., Käpylä, M.J. and Brandenburg, A., Sensitivity to luminosity, centrifugal force, and boundary conditions in spherical shell convection. Geophys. Astro. Fluid 2020, 114, 8–34. doi:10.1080/03091929.2019.1571586.
  • Kemel, K., Brandenburg, A. and Ji, H., A model of driven and decaying magnetic turbulence in a cylinder. Phys. Rev. E 2011, 84, 056407. doi: 10.1103/PhysRevE.84.056407
  • Kemel, K., Brandenburg, A., Kleeorin, N., Mitra, D. and Rogachevskii, I., Spontaneous formation of magnetic flux concentrations in stratified turbulence. Solar Phys. 2012, 280, 321–333. doi: 10.1007/s11207-012-9949-0
  • Kemel, K., Brandenburg, A., Kleeorin, N., Mitra, D. and Rogachevskii, I., Active region formation through the negative effective magnetic pressure instability. Solar Phys. 2013, 287, 293–313. doi: 10.1007/s11207-012-0031-8
  • Krause, F. and Rädler, K.-H., Mean-field Magnetohydrodynamics and Dynamo Theory, 1980 (Pergamon Press: Oxford).
  • Li, X.-Y., Brandenburg, A., Haugen, N.E.L. and Svensson, G., Eulerian and Lagrangian approaches to multidimensional condensation and collection. J. Adv. Model. Earth Syst. 2017, 9, 1116–1137. doi: 10.1002/2017MS000930
  • Li, X.-Y., Brandenburg, A., Svensson, G., Haugen, N.E.L., Mehlig, B. and Rogachevskii, I., Effect of turbulence on collisional growth of cloud droplets. J. Atmosph. Sci. 2018, 75, 3469–3487. doi: 10.1175/JAS-D-18-0081.1
  • Li, X.-Y., Svensson, G., Brandenburg, A. and Haugen, N.E.L., Cloud droplet growth due to supersaturation fluctuations in stratiform clouds. Atmosph. Chem. Phys. 2019, 19, 639–648. doi: 10.5194/acp-19-639-2019
  • Lyra, W. and Mac Low, M.-M., Rossby wave instability at dead zone boundaries in three-dimensional resistive magnetohydrodynamical global models of protoplanetary disks. Astrophys. J. 2012, 756, 62. doi: 10.1088/0004-637X/756/1/62
  • Lyra, W., Johansen, A., Klahr, H. and Piskunov, N., Embryos grown in the dead zone. Assembling the first protoplanetary cores in low mass self-gravitating circumstellar disks of gas and solids. Astron. Astrophys. 2008, 491, L41–L44. doi: 10.1051/0004-6361:200810626
  • Lyra, W., Johansen, A., Klahr, H. and Piskunov, N., Standing on the shoulders of giants. Trojan Earths and vortex trapping in low mass self-gravitating protoplanetary disks of gas and solids. Astron. Astrophys. 2009, 493, 1125–1139. doi: 10.1051/0004-6361:200810797
  • Lyra, W., Turner, N.J. and McNally, C.P., Rossby wave instability does not require sharp resistivity gradients. Astron. Astrophys. 2015, 574, A10. doi: 10.1051/0004-6361/201424919
  • Lyra, W., Richert, A.J.W., Boley, A., Turner, N.J., Mac Low, M.-M., Okuzumi, S. and Flock, M., On shocks driven by high-mass planets in radiatively inefficient disks. II. Three-dimensional global disk simulations. Astrophys. J. 2016, 817, 102. doi: 10.3847/0004-637X/817/2/102
  • Mitra, D., Tavakol, R., Brandenburg, A. and Moss, D., Turbulent dynamos in spherical shell segments of varying geometrical extent. Astrophys. J. 2009, 697, 923–933. doi: 10.1088/0004-637X/697/1/923
  • Mitra, D., Tavakol, R., Käpylä, P.J. and Brandenburg, A., Oscillatory migrating magnetic fields in helical turbulence in spherical domains. Astrophys. J. Lett. 2010, 719, L1–L4. doi: 10.1088/2041-8205/719/1/L1
  • Moffatt, H.K., Magnetic Field Generation in Electrically Conducting Fluids, 1978 (Cambridge University Press: Cambridge).
  • Nicolai, H. (2001). Annual report. Max-Planck-Institut für Gravitationsphysik, Albert-Einstein-Institut.
  • Qian, C., Wang, C., Liu, J., Brandenburg, A., Haugen, N.E.L. and Liberman, M.A., Convergence properties of detonation simulations. Geophys. Astro. Fluid 2020, 114, 58–76. doi:10.1080/03091929.2019.1668382.
  • Rempel, M., Extension of the MURaM radiative MHD code for coronal simulations. Astrophys. J. 2017, 834, 10. doi: 10.3847/1538-4357/834/1/10
  • Rogachevskii, I., Ruchayskiy, O., Boyarsky, A., Fröhlich, J., Kleeorin, N., Brandenburg, A. and Schober, J., Laminar and turbulent dynamos in chiral magnetohydrodynamics. I. Theory. Astrophys. J. 2017, 846, 153. doi: 10.3847/1538-4357/aa886b
  • Roper Pol, A., Brandenburg, A., Kahniashvili, T., Kosowsky, A. and Mandal, S., The timestep constraint in solving the gravitational wave equations sourced by hydromagnetic turbulence. Geophys. Astro. Fluid 2020, 114, 130–161. doi:10.1080/03091929.2019.1653460.
  • Schober, J., Brandenburg, A. and Rogachevskii, I., Chiral fermion asymmetry in high-energy plasma simulations. Geophys. Astro. Fluid 2020, 114, 106–129. doi:10.1080/03091929.2019.1591393.
  • Schober, J., Rogachevskii, I., Brandenburg, A., Boyarsky, A., Fröhlich, J., Ruchayskiy, O. and Kleeorin, N., Laminar and turbulent dynamos in chiral magnetohydrodynamics. II. Simulations. Astrophys. J. 2018, 858, 124. doi: 10.3847/1538-4357/aaba75
  • Singh, N.K., Brandenburg, A. and Rheinhardt, M., Fanning out of the solar f-mode in presence of nonuniform magnetic fields?. Astrophys. J. Lett. 2014, 795, L8. doi: 10.1088/2041-8205/795/1/L8
  • Singh, N.K., Brandenburg, A., Chitre, S.M. and Rheinhardt, M., Properties of p- and f-modes in hydromagnetic turbulence. Month. Not. Roy. Astron. Soc. 2015, 447, 3708–3722. doi: 10.1093/mnras/stu2540
  • Singh, N.K., Raichur, H., Käpylä, M.J., Rheinhardt, M., Brandenburg, A. and Käpylä, P.J., f-mode strengthening from a localised bipolar subsurface magnetic field. Geophys. Astro. Fluid 2020, 114, 196–212. doi:10.1080/03091929.2019.1653461.
  • Snodin, A.P., Brandenburg, A., Mee, A.J. and Shukurov, A., Simulating field-aligned diffusion of a cosmic ray gas. Month. Not. Roy. Astron. Soc. 2006, 373, 643–652. doi: 10.1111/j.1365-2966.2006.11034.x
  • Spiegel, E.A. (1987). Hydrostatic adjustment time of the solar subconvective layer. In The Internal Solar Angular Velocity, edited by B. R. Durney and S. Sofia, pp. 321–327 (Dordrecht: Reidel).
  • Warnecke, J. and Bingert, S., Non-Fourier description of heat flux evolution in 3D MHD simulations of the solar corona. Geophys. Astro. Fluid 2020, 114, 261–281. doi:10.1080/03091929.2019.1670173.
  • Warnecke, J., Rheinhardt, M., Käpylä, P.J., Käpylä, M.J. and Brandenburg, A., Turbulent transport coefficients in spherical wedge dynamo simulations of solar-like stars. Astron. Astrophys. 2018, 609, A51. doi: 10.1051/0004-6361/201628136

Reprints and Corporate Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

To request a reprint or corporate permissions for this article, please click on the relevant link below:

Academic Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

Obtain permissions instantly via Rightslink by clicking on the button below:

If you are unable to obtain permissions via Rightslink, please complete and submit this Permissions form. For more information, please visit our Permissions help page.