The Pencil Code Newsletter

Issue 2023/2

June 21, 2023, Revision: 1.37

Contents

1 Last April Fool’s Day  1
2 New Nature Astronomy paper  1
3 Realizability  2
4 PC steering committee  3
5 Website outage  3
6 Code developments  3
6.1 Saving memory for df . . . . . . . . . . 4
6.2 pc start configuration file . . . . . . . . 4
6.3 Specific heats . . . . . . . . . . . . . . . 4
6.4 Parallel remeshing . . . . . . . . . . . . 4
6.5 Auto-tests . . . . . . . . . . . . . . . . . 4
7 Meetings  4
7.1 Pencil Code User Meeting 2023 . . . . . 4
7.2 Turbulence in Astrophysical ... . . . . . 4
7.3 Stellar convection: modelling, ... . . . . 4
8 Papers since April 2023  4

1 Last April Fool’s Day

As in 2021, the publication of the first newsletter of this year fell on April Fool’s Day. The item about Artificial Intelligence facilitating the maintenance of the code was unfortunately a joke.

2 New Nature Astronomy paper

In a recent paper in Nature Astronomy (https://www

.nature.com/articles/s41550-023-01975-1), Jörn

Warnecke, Maarit J. Korpi-Lagg, Matthias Rheinhardt, and Fred Gent reported on Pencil Code runs with a resolution of 4096^{3} mesh points. This allowed the authors to reach Reynolds numbers, Re = u_{rms}/νk_{f}, of up to 33,000 and magnetic Prandtl numbers (Pr_{M}) down to 0.0025. This high resolution is indeed needed to answer the question, whether a smallscale dynamo (SSD) is possible at the extremely low Figure 1: Small-scale dynamo growth rate as function of the fluid and magnetic Reynolds numbers (Re and Re_{M}). The diamonds represent the results of this work and the triangles those of Brandenburg et al. (2018, MNRAS 479, 2827). The color coding indicates the value of the normalized growth rate λτ with τ = 1/u_{rms}k_{f}, a rough estimate for the turnover time. Dotted lines indicate constant magnetic Prandtl number Pr_{M}. White circles indicate zero growth rate for certain Pr_{M}, obtained from fitting the critical magnetic Reynolds number. The green dashed line shows the power-law fit of the critical Re_{M} for Pr_{M} ≤ 0.08

Pr_{M} that are present in the Sun and other stars. The authors found that the SSD not only turns out to be possible for Pr_{M} down to 0.0031, but it also becomes increasingly easier to excite for Pr_{M} below about 0.05, see Figure 1. This behavior is related to the known hydrodynamic phenomenon called the bottleneck effect. Extrapolating the results to solar values of Pr_{M} ≈ 10^{−5}, the authors find that an SSD would be possible under such conditions.

The study of the Nature Astronomy paper is currently being extended to even higher resolutions using the GPU code Astaroth, achieving speed-ups of 20–60 compared to the Pencil code. This solver enables them to determine not only the critical magnetic Reynolds number, but also the saturation field strengths at low Pr_{M}; see Figure 2 for an illustration of the magnetic field.

The paper was highlighted by Steven Tobias in a Nature Astronomy news & view item https://www

.nature.com/articles/s41550-023-01971-5 and

even in the New York Times https://www.nytimes.

com/interactive/2023/06/20/science/summer-sol

stice-sun.html.

Figure 2: Visualization of the magnetic field in a logarithmic scale for simulation with 4096^{3} mesh points, Re=33.000 and Pr_{M}=0.005.

3 Realizability

Inverse cascading is known to occur in helical hydromagnetic turbulence because of magnetic helicity conservation and in non-helical turbulence because of the conservation of the Hosking integral. (For readers of the previous newsletter, this name should not be entirely new!) Magnetic helicity can also be canceled by fermion chirality such that there is also no net chirality, and again, the suitably adapted Hosking integral is conserved and there is inverse cascading (Brandenburg et al., 2023c). But Figure 3, which is taken from a recent preprint of such work (Brandenburg et al., 2023b), showed that the realizability condition is violated, and kH_{M}(k) was found to exceed 2E_{M}(k). This is mathematically impossible. Here we demonstrate that it is the result of the finite discretization error in the current implementation of the Pencil Code.

The magnetic helicity and energy spectra, H_{M}(k) and E_{M}(k), respectively, satisfy the realizability condition:

−1 ≤ \frac{kH_{M}(k)}{2E_{M}(k)} ≤ 1.  (1)

The spectra H_{M}(k) and E_{M}(k) are normalized such that ∫ H_{M}(k) dk = ⟨A · B⟩ and ∫ E_{M}(k) dk = ⟨B^{2}⟩/2. The spectra are obtained from the magnetic vector potential A(x, t) by computing B = ∇ × A using the Figure 3: Magnetic energy (solid lines) and normalized helicity spectra kH_{M}(k)/2 (dotted lines with red and blue symbols for positive and negative helicity spectra, respectively) for Run O at times t = 0.3, 460, 1500, 4600, 15,000, and 46,000. The peaks of the red curves evolve underneath an envelope ∝ k^{3/2}, which is characteristic of Hosking. Taken from arXiv:2304.06612v1; the figure in the revised version will be different.

standard derivative routines. At high wavenumbers close to the Nyquist wavenumber, k_{Ny} = π/δx, where δx is the mesh spacing, the numerical derivatives give values that are somewhat too low; see Section H.1 and Figure 30 of the manual. This affects the denominator in Eq. (1) more than the numerator, because B enters there quadratically. This could explain why kH_{M}(k) was found to exceed 2E_{M}(k).

To check this, Matthias suggested during the last Pencil Code office hours to verify this using the 10th order derivative routines. This can easily be done by setting DERIV=deriv 10th. Likewise, we can put DERIV=deriv 2nd. The results are shown in Figure 4, where we show r(k) = kH_{M}(k)/2E_{M}(k) as a function of k/k_{Ny}. The second panel shows r(k) in a semilogarithmic representation.

Not surprisingly, the second-order accurate scheme gives large departures where r(k) can reach values of around 2.4, so the error is 240%. As expected, the 10th order accurate scheme is clearly better (error about 30%) than the usual 6th order scheme (error about 50%), which is the default.

It would be possible to compute the derivatives for B using multiplications by ik. In practice, however, the residual error is not very important, that’s why this has not yet been done.

Figure 4: r(k/k_{Ny}) using the Pencil Code at 2nd, 6th, and 10th order. The second panel shows the same in a semilogarithmic plot to emphasize that the damage is relatively small and restricted only to the very smallest scales.

4 PC steering committee

We had a Pencil Code Steering Committee (PCSC) meeting on June 12, 2023. The minutes of the meeting

                                               are on http://norlx65.nordita.org/~brandenb/pe
                                               ncil-code/PCSC/minutes/2023_06_12.txt.

5 Website outage

The Nordita website is still down, and this also affected the Pencil Code homepage. The Pencil Code pages have now been decoupled and we are grateful to Philippe Bourdin for his help in setting them up on

                                               another server; see http://pencil-code.nordita.or

g/. The website is now also available via the encrypted https connection.

6 Code developments

As usual, we find the latest code developments

                                               on https://github.com/pencil-code/pencil-code

/commits/master. The green and red check marks indicate whether the travis test went through or not;

see https://app.travis-ci.com/github/pencil-co
de/pencil-code.

6.1 Saving memory for df

As in run.f90 for nt=0, now also in start.f90 the

array of the PDE right-hand sides, df, is only allocated when needed.

6.2 pc start configuration file

pc run now inherits all the parameters of pc start, which allows one to provide a configuration file at start-

ing (-f <config file>).

6.3 Specific heats

At the moment, the Pencil Code suffers from the fact that arbitrary combinations of energy and equation-of-state modules are in many cases not meaningful. One of the major problems is that many modules use γ, c_{p}, or c_{v} as constants, although in general they are fields. A major revision of the code in this respect should be planned during the upcoming User Meeting. At the moment, if proper pencils (as during boundary conditions evaluation) or auxiliary variables are not available, these values are provided by the generic function get gamma etc of the eos modules in the form of the constants valid for an ideal monatomic gas, accompanied with a warning in case this is actually wrong. From eos idealgas.f90, however, the correct values are returned.

6.4 Parallel remeshing

The remeshing code, which has been parallelized recently, has been modified to read the snapshot chunks from distributed I/O in a strictly serial way, with even a waiting time of 0.4 sec between consecutive reads (hardcoded at the moment). This became necessary in order to deal with an unstable machine like LUMI.

6.5 Auto-tests

The results of the hourly auto-test are, as usual,

on: http://norlx51.nordita.org/~brandenb/pen
cil-code/tests/hourly/ Already some time ago,

Philippe implemented an important new functionality that allows us to see which last check-in caused a particular auto-test to break! You just follow the indicated link.

7 Meetings

7.1 Pencil Code User Meeting 2023

If you haven’t booked yet, you can perhaps still do it.

The details are on http://pencil-code.nordita.org

/UserMeetings/2023/. Vartika Pandey and Johannes Tschernitz, both from the IGAM/Graz, belong to the local organizing committee. There is a special deal with Hotel Daniel for 79 Euro/night; see the link from the meeting page. An even cheaper option, bookable via hotels.com, is the hostel at Hauptbahnhof, which costs just 20 bucks, plus tax.

Important: if you just want to listen in to some talks, it would be good to register, so we have your details, and it is good for the statistics!

7.2 Turbulence in Astrophysical ...

During January 8 – March 15, 2024, there will be a program at the KITP in Santa Barbara on “Turbulence in Astrophysical Environments”; see https://www.kitp

.ucsb.edu/activities/uniturb24. Associated with

this is a one-week conference on “Turbulence in the Universe” starting on Feb 20, 2024; see https://www.

kitp.ucsb.edu/activities/uniturb-c24 The regis-

tration deadline is Jan 21, 2024.

7.3 Stellar convection: modelling, ...

During August 26 – September 20, there will be the Nordita program “Stellar convection: modelling, theory and observations”; see https://indico.fysi k.su.se/event/8136/. For more information, contact the organizers: Petri Käpylä <pkapyla@leibni

z-kis.de>, Isabelle Baraffe <I.Baraffe@exeter.ac.
uk>, Markus Roth <mroth@tls-tautenburg.de>, or
Hideyuki Hotta <hotta.h@isee.nagoya-u.ac.jp>.

8 Papers since April 2023

As usual, we look here at new papers that make use of the Pencil Code. Since the last newsletter of April 1st, 14 new papers have appeared on the arXiv, and 11 others, some of which were just preprints and have now been published. We list both here, 25 altogether. A browsable ADS list of all Pencil Code papers

can be found on: https://ui.adsabs.harvard.ed
u/public-libraries/iGR7N570Sy6AlhDMQRTe_A. If

something is missing in those entries, you can also

include it yourself in: https://github.com/pencil-

code/pencil-code/blob/master/doc/citations/re

f.bib, or otherwise just email brandenb@nordita.org. A compiled version of this file is available as https:/

/github.com/pencil-code/website/blob/master/d

oc/citations.pdf, where we also list a total of now 102 code comparison papers in the last section “Code comparison & reference”. Those are not included in our list below, nor among the now total number of 630 research papers that use the Pencil Code.

References

Brandenburg, A., Clarke, E., Kahniashvili, T., Long, A.J. and Sun, G., Relic Gravitational Waves from the Chiral Plasma Instability in the Standard Cosmological Model. arXiv e-prints, 2023a, arXiv:2307.09385.

Brandenburg, A., Kamada, K., Mukaida, K., Schmitz, K. and Schober, J., Chiral magnetohydrodynamics with zero total chirality. arXiv e-prints, 2023b, arXiv:2304.06612.

Brandenburg, A., Kamada, K. and Schober, J., Decay law of magnetic turbulence with helicity balanced by chiral fermions. Phys. Rev. Res., 2023c, 5, L022028.

Brandenburg, A. and Larsson, G., Turbulence with Magnetic Helicity That Is Absent on Average. Atmosphere, 2023, 14, 932.

Brandenburg, A. and Protiti, N.N., Electromagnetic conversion into kinetic and thermal energies. arXiv e-prints, 2023, arXiv:2308.00662.

Brandenburg, A., Sharma, R. and Vachaspati, T., Inverse cascading for initial MHD turbulence spectra between Saffman and Batchelor. arXiv e-prints, 2023d, arXiv:2307.04602.

Candelaresi, S. and Beck, C., Twisted magnetic knots and links. Phys. Plasmas, 2023, 30, 082102.

Elias-López, A., Del Sordo, F. and Viganò, D., Vorticity and magnetic dynamo from subsonic expansion waves. arXiv e-prints, 2023, arXiv:2304.11929.

Ganti, H., Bravo, L. and Khare, P., Interactions between high hydrogen content syngas-air premixed flames and homogeneous isotropic turbulence: Flame thickening. Phys. Fluids, 2023, 35, 075150.

Gent, F.A., Mac Low, M.M. and Korpi-Lagg, M.J., Transition from small-scale to large-scale dynamo in a supernova-driven, multiphase medium. arXiv eprints, 2023, arXiv:2306.07051.

Hackman, T., Kochukhov, O., Viviani, M., Warnecke, J., Korpi-Lagg, M.J. and Lehtinen, J.J., From convective stellar dynamo simulations to Zeeman-Doppler images. arXiv e-prints, 2023, arXiv:2306.07838.

He, Y., Roper Pol, A. and Brandenburg, A., Modified propagation of gravitational waves from the early radiation era. J.. Cosmol. Astropart. Phys., 2023, 2023, 025.

Käpylä, P.J., Browning, M.K., Brun, A.S., Guerrero, G. and Warnecke, J., Simulations of solar and stellar dynamos and their theoretical interpretation. arXiv e-prints, 2023, arXiv:2305.16790.

Karak, B.B., Models for the long-term variations of solar activity. Living Rev. Solar Phys., 2023, 20, 3.

Lipatnikov, A.N. and Sabelnikov, V.A., Influence of small-scale turbulence on internal flamelet structure. Phys. Fluids, 2023, 35, 055128.

Lyra, W., Stability Analysis for General Order Central Finite-difference Hyperdiffusivity with Time Integrators of Arbitrary Accuracy. Res. Not. Am. Astron. Soc., 2023, 7, 69.

Mizerski, K.A., Yokoi, N. and Brandenburg, A., Crosshelicity effect on α-type dynamo in non-equilibrium turbulence. J. Plasma Phys., 2023, 89, 905890412.

Mondal, T. and Bhat, P., A unified treatment of mean-field dynamo and angular-momentum transport in magnetorotational instability-driven turbulence. arXiv e-prints, 2023, arXiv:2307.01281.

Navarrete, F.H., Käpylä, P.J., Schleicher, D.R.G. and Banerjee, R., Effects of the centrifugal force on stellar dynamo simulations. arXiv e-prints, 2023, arXiv:2305.01312.

Ortiz-Rodríguez, C.A., Käpylä, P.J., Navarrete, F.H., Schleicher, D.R.G., Mennickent, R.E., Hidalgo, J.P. and Toro, B., Simulations of dynamo action in slowly rotating M dwarfs: Dependence on dimensionless parameters. arXiv e-prints, 2023, arXiv:2305.16447.

Pavaskar, P., Yan, H. and Cho, J., Magnetic field measurement from the Davis-Chandrasekhar-Fermi method employed with atomic alignment. Month. Not. Roy. Astron. Soc., 2023, 523, 1056–1066.

Schober, J., Rogachevskii, I. and Brandenburg, A., Chiral magnetic anomaly and dynamos from spatial chemical potential fluctuations. arXiv e-prints, 2023, arXiv:2307.15118.

Tharakkal, D., Shukurov, A., Gent, F.A., Sarson, G.R. and Snodin, A., Steady states of the Parker instability: the effects of rotation. arXiv e-prints, 2023, arXiv:2305.03318.

Warnecke, J., Korpi-Lagg, M.J., Gent, F.A. and Rheinhardt, M., Numerical evidence for a small-scale dynamo approaching solar magnetic Prandtl numbers. Nat. Astron., 2023.

Zhu, J.Z. and Shi, P.X., Helical and nonhelical (magneto-)Burgers turbulence: I. Compressibility reduction and beyond. arXiv e-prints, 2023, arXiv:2307.05490.

This Pencil Code Newsletter was edited by

Axel  Brandenburg  <brandenb@nordita.org>,

Nordita, KTH Royal Institute of Technology and Stockholm University, SE-10691 Stockholm, Sweden; and Matthias Rheinhardt

<matthias.rheinhardt@aalto.fi>,  Department

of Computer Science, Aalto University, PO Box 15400, FI-00076 Aalto, Finland. See http://www.nordita.

org/~brandenb/pencil-code/newsletter or https

://github.com/pencil-code/website/tree/master

/NewsLetters for the online version as well as back issues.