The Pencil Code Newsletter

Issue 2020/1

July 17, 2020, Revision: 1.52

Contents

1 Preamble  1
2 Pencil Code User Meeting  1
3 Ongoing code developments  1
4 Manual update  2
5 Contribute to the newsletter  2
6 Not on pencil-code-discuss?  3
7 Top-ten commits: Jan–Jun  3
8 Scientific usage: updates  3
9 DOIs for simulation data  3
10 An MHD splinter meeting  4

1 Preamble

During the June 2020 meeting of the Pencil Code Steering Committee (PCSC) it was decided that the PCSC issues a regular newsletter about three times a year to update and remind the user community of important results and developments. The minutes and other material of the PCSC can be found on

http://www.nordita.org/~brandenb/pc/PCSC. Even near the end

of the skype meeting almost at 10 pm, the Sun was still high in the sky in Trondheim (Figure 1).

The range of content is still to be decided upon, but what has been mentioned includes recent developments on the code, the conclusions on recent discus-

sions in http://groups.google.com/g/pencil-code-discuss and

recent publications that have used or mentioned the Pencil Code.

2 Pencil Code User Meeting

We encourage all users to follow and chip in on the presentations at the upcoming Pencil Code User Meet-Figure 1: Axel’s screenshot at the end of the PCSC meeting showing the view from Nils’ window (Trondheim, Norway) and Matthias on the right on skype.

ing (PCUM) in Glasgow during 27–31 July 2020. If you forget the link, you can just say pc news to get

                                               the link, which is http://indico.fysik.su.se/event/6870/; see

Figure 2.

Figure 2: Web page where you can register for the meeting. Please register, even if you want to participate only in a few sessions.

3 Ongoing code developments

Python & HDF5. Simon Candelaresi, Fred Gent, and others have now replaced all Python routines with rewritten versions, following a series of improvements. A major one was the object-oriented approach which led to the transformation of simple functions into more powerful objects. Now all reading routines return an object with the data and some meta data. There have been improvements in the coding style, and a lot of additional comments have been added. The documentation has been greatly extended with every routine having now a full description. IO routines are much more efficient now, with, e.g., the slice reading routine showing a speed-up of 50 for large slice files (2GB+). There have been various additions, such as simulation objects, rvid box plots and particle routines. Lastly, all routines are Python 3 compatible.

Looking forward, they have implemented a powerful simulation object, which is under development to permit cloning and manipulating existing simulations, to launch arrays of simulations across ranges of parameters, and to assist data analysis of multiple simulations. As larger data sets become more common and feasible, the HDF5 format becomes essential both for computing and post-processing. So, data reading options include HDF5 or Fortran binary format, but also options which take advantage of the alternate low memory hdf5 object for reading data, and mpi4py to operate parallel data analysis of large data sets.

Since the syntax differs, backward compatibility is lost. Therefore, the old Python routines are kept in

python/pencil old. and can be imported via: import
pencil old as pco.

Shallow water. You may have wondered about recent check-ins about shallow water. Wlad Lyra clarified: “A student of mine (Ali Hyder) is using it to model the polar atmosphere of Jupiter. We added a sample that reproduces the speed of gravity waves.” For more info, contact Wlad or Ali, and maybe they’ll present something at the upcoming PCUM.

Code profiling. As part of a PRACE project, Jörn Warnecke and colleagues were asked to profile the Pencil Code. It turned out that the considered run (global convective dynamo in a shell) spends too much time in the functions mpi barrier and mpi allreduce. Solutions:

• In general, the tasks of a run can be automatically distributed across nodes in a way that slows down communication. To avoid this, set -m plane=⟨number of cores per node⟩ in the (sbatch) job submission script. Best results can be expected if this is a multiple of nprocx.

• Global operations like averages for conserving mass and angular momentum slow down a run noticeably when performed in every substep. By the new parameter it rmv in the run pars of run.in their frequency can now be controlled: The default it rmv=0 means “as usual” while for it rmv=n averages are only taken once every n th time step. it rmv=5 turned out to be enough to remove the bottleneck of the averages.

Both tricks together made a total speedup of two. More information and discussion on this is scheduled for the PCUM.

Python within IDL. If you are interested in using Python programs within IDL programs, you can do this through the IDL-to-Python bridge (for IDL version 8.6 or newer and Python 3.5 or newer), you may find inspiration from Christer’s pc d2 dimension.pro in

idl/modules/particles/d2 dimension/, which you
can call with pc d2 dimension, pvars, /allpython.

However, IDL needs to be launched from an environment where Python invokes a version that is supported by the used version of IDL. Christer Sandin

<christersandin@yahoo.se> knows the details.

HDF5. The HDF5 format is now in production for more than a year. If anybody notices any bugs or anything weird, please give feedback to Philippe Bourdin

<Philippe.Bourdin@oeaw.ac.at>. One change is al-

ready envisaged: to enable the use of the persistent variables as global datasets, so that changing the number of processors (and data distribution) becomes possible. Transition to HDF5 is facilitated by the possibility to choose different schemes for data in- and output: If one wants to restart from distributed Fortran binary data, but to write all output in HDF5 format, set

   IO = io_hdf5
   IO_IN = io_dist

and recompile. Further restarts will ignore IO IN even without recompilation (by the lock file IO LOCK). The IO schemes can be freely combined, but “returning from HDF5” is yet experimental. When using this feature, copying data for restart can be replaced by linking: use pc copyvar with -s (much faster for big models).

4 Manual update

Incidently, please spend some time reviewing and improving the manual. As discussed at the last PCSC, we plan to assign a DOI number to it during the next PCUM, and those who have contributed should be listed as authors.

5 Contribute to the newsletter

Just send an email to Axel Brandenburg

<brandenb@nordita.org> or Matthias Rheinhardt
<matthias.rheinhardt@aalto.fi>. We might edit

the material to make it suitable and will let you proofread what we have done with it. The next newsletter will be published about a month after the PCUM.

6 Not on pencil-code-discuss?

There are currently 141 members on pencil-code-discuss,^{1} but not even all the developers appear on this list. They would not know what they miss, so if you see somebody missing, please tell them. Normally, everybody would sign up oneself.

7 Top-ten commits: Jan–Jun

The code is soon 20 year old, and still there is a lot of development going on, for the benefit of everybody in the community. On GitHub, you can explore yourself^{2} and slide with your pointer a time window where you want to see the developments; see Figure 3 for the entries between January and June 2020. For the entire data record, there are currently 34 contributors who have done at least 34 commits, so the h index of the Pencil Code is – in this sense – 34.

It has happened before, that contributors dropped out of the list because of some mistake by GitHub, but they were able to correct this. If you notice issues with your entry on GitHub, please email them.

8 Scientific usage: updates

The bibtex file. As many of you know, there is a document where we collect all the papers that make use of the Pencil Code.^{3} The papers and the corresponding bibtex entries are found with ADS full text search. Unfortunately, ADS does not include papers in Combustion and Flame, and some other journals, and sometimes the Pencil Code is used, but not mentioned explicitly. If you find such cases, please email us the bibtex entry, or just add it yourself to

pencil-code/doc/citations/ref.bib.

Papers during January–June. The bibtex file is checked in on GitHub^{4} and used to assemble citations not only by year, but also by topic. The list of papers is now so long that most of the new entries remain easily unnoticed. For convenience, the papers from January to June 2020, so far 37, are assembled in the references at end. The number of papers is unusually high, but explainable by the fact that the special issue in GAFD appeared in this time frame; see also Brandenburg et al. (2020a) for the editorial.

Figure 3: Top-ten commits since January

9 DOIs for simulation data

Scientists who are supported by the Swedish Research Council are required to make their data publicly accessible.^{5} For the time being, a workable solution for Pencil Code users is to give DOI numbers to the run directories separately for each paper. There are already several examples;^{6} see Figure 4. Even the Pencil

                                               Code itself has one; DOI.org/10.5281/zenodo.2315093 gives

a tarball of version v2018.12.16, but also a reference to the life github site. (A code DOI was requested by Figure 4: Zenodo page showing data sets with DOI

1 http://groups.google.com/g/pencil-code-discuss/members

2 http://github.com/pencil-code/pencil-code/graphs/contributors

3 http://www.nordita.org/~brandenb/pencil-code/PCSC/citations.pdf

4 http://github.com/pencil-code/pencil-code/tree/master/doc/citations

5 http://www.vr.se/english/mandates/open-science/open-access-to-research-data.html 6 search for "Pencil Code" on http://zenodo.org DOI.org/10.5281/zenodo.3897954, DOI.org/10.5281/zenodo.3886562, DOI.org/10.5281/zenodo.3841900, DOI.org/10.5281/zenodo.3692072, DOI.org/10.5281/zenodo.3534739, DOI.org/10.5281/zenodo.3526056.

number for DOI.org/10.5281/zenodo.3841900.

Atmospheric Chemistry & Physics.^{7})

If you have data for a paper in ApJ or any other AAS journal, you may be contacted by August Muench

<august.muench@aas.org>. You will also have the op-

portunity to hear and talk to him on Monday of the PCUM.

10 An MHD splinter meeting

Maarit Käpylä informed us about the splinter meet-

ing (;http://ag2020.astronomische-gesellschaft.de/view_splinter.php?session=Magnetic;)

on “Cosmic magnetic fields” that is being organized as part of the virtual annual meeting of the German Astronomical Society during September 21-25, 2020. The deadline for abstracts is July 31, 2020.

The goal of this splinter meeting is to review the current studies of the generation and the consequences of cosmic magnetic fields. The aim is to bring together experts in observation, theory and modelling of cosmic magnetic fields at various scales.

References

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

7 http://ui.adsabs.harvard.edu/abs/2019ACP....19..639L

immersed boundary method and overset grids. Geophys. Astrophys. Fluid Dynam., 2020, 114, 35–57.

Adrover-González, A. and Terradas, J., 3D numerical simulations of oscillations in solar prominences. Astron. Astrophys., 2020, 633, A113.

Bhatnagar, A., Statistics of relative velocity for particles settling under gravity in a turbulent flow. Phys. Rev. E, 2020, 101, 033102.

Bourdin, P.A., Driving solar coronal MHD simulations on highperformance computers. Geophys. Astrophys. Fluid Dynam., 2020, 114, 235–260.

Brandenburg, A., Candelaresi, S. and Gent, F.A., Introduction to The Physics and Algorithms of the Pencil Code. Geophys. Astrophys. Fluid Dynam., 2020a, 114, 1–7.

Brandenburg, A., Hall cascade with fractional magnetic helicity in neutron star crusts., 2020a, arXiv:2006.12984.

Brandenburg, A., Piecewise quadratic growth during the 2019 novel coronavirus epidemic., 2020b, arXiv:2002.03638.

Brandenburg, A. and Boldyrev, S., The Turbulent Stress Spectrum in the Inertial and Subinertial Ranges. Astrophys. J., 2020, 892, 80.

Brandenburg, A. and Brüggen, M., Hemispheric Handedness in the Galactic Synchrotron Polarization Foreground. Astrophys. J. Lett., 2020, 896, L14.

Brandenburg, A. and Chen, L., The nature of mean-field generation in three classes of optimal dynamos. J. Plasma Phys., 2020, 86, 905860110.

Brandenburg, A. and Das, U., The time step constraint in radiation hydrodynamics. Geophys. Astrophys. Fluid Dynam., 2020, 114, 162–195.

Brandenburg, A., Durrer, R., Huang, Y., Kahniashvili, T., Mandal, S. and Mukohyama, S., Primordial magnetic helicity evolution with homogeneous magnetic field from inflation., 2020b, arXiv:2005.06449.

Brandenburg, A. and Furuya, R.S., Application of a helicity proxy to edge-on galaxies., 2020, arXiv:2003.07284.

Brandenburg, A. and Scannapieco, E., Magnetic Helicity Dissipation and Production in an Ideal MHD Code. Astrophys. J., 2020, 889, 55.

Candelaresi, S. and Del Sordo, F., Stabilizing Effect of Magnetic Helicity on Magnetic Cavities in the Intergalactic Medium. Astrophys. J., 2020, 896, 86.

Chatterjee, P., Testing Alfvén wave propagation in a “realistic” setup of the solar atmosphere. Geophys. Astrophys. Fluid Dynam., 2020, 114, 213–234.

Eriksson, L.E.J., Johansen, A. and Liu, B., Pebble drift and planetesimal formation in protoplanetary discs with embedded planets. Astron. Astrophys., 2020, 635, A110.

Gent, F.A., Mac Low, M.M., Käpylä, M.J., Sarson, G.R. and Hollins, J.F., Modelling supernova-driven turbulence. Geophys. Astrophys. Fluid Dynam., 2020, 114, 77–105.

Gerbig, K., Murray-Clay, R.A., Klahr, H. and Baehr, H., Requirements for Gravitational Collapse in Planetesimal Formation—The Impact of Scales Set by Kelvin-Helmholtz and Nonlinear Streaming Instability. Astrophys. J., 2020, 895, 91.

Jakab, P. and Brandenburg, A., The effect of a dynamo-generated field on the Parker wind., 2020, arXiv:2006.02971.

Kahniashvili, T., Brandenburg, A., Kosowsky, A., Mandal, S. and Roper Pol, A., Magnetism in the Early Universe; in IAU General Assembly, Mar., 2020, pp. 295–298.

Käpylä, M.J., Álvarez Vizoso, J., Rheinhardt, M., Brandenburg, A., Käpylä, P. and Singh, N.K., On the existence of shear-current effects in magnetized burgulence., 2020a, arXiv:2006.05661.

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. Astrophys. Fluid Dynam., 2020b, 114, 8–34.

Li, X.Y., Brandenburg, A., Svensson, G., Haugen, N.E.L., Mehlig, B. and Rogachevskii, I., Condensational and Collisional Growth of Cloud Droplets in a Turbulent Environment. J. Atmos. Sci., 2020, 77, 337–353.

Li, X.Y. and Mattsson, L., Coagulation of inertial particles in supersonic turbulence., 2020, arXiv:2002.12172.

Navarrete, F.H., Schleicher, D.R.G., Käpylä, P.J., Schober, J., Völschow, M. and Mennickent, R.E., Magnetohydrodynamical origin of eclipsing time variations in post-common-envelope binaries for solar mass secondaries. Month. Not. Roy. Astron. Soc., 2020, 491, 1043–1056.

Pusztai, I., Juno, J., Brandenburg, A., TenBarge, J.M., Hakim, A., Francisquez, M. and Sundström, A., Dynamo in weakly collisional non-magnetized plasmas impeded by Landau damping of magnetic fields. Phys. Rev. Lett., 2020, 124, arXiv:2001.11929.

Qian, C., Wang, C., Liu, J., Brand enburg, A., Haugen, N.E.L. and Liberman, M.A., Convergence properties of detonation simulations. Geophys. Astrophys. Fluid Dynam., 2020, 114, 58–76.

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. Astrophys. Fluid Dynam., 2020, 114, 130–161.

Santos-Lima, R., Guerrero, G., de Gouveia Dal Pino, E.M. and Lazarian, A., Diffusion of large-scale magnetic fields by reconnection in MHD turbulence., 2020, arXiv:2005.07775.

Schober, J., Brandenburg, A. and Rogachevskii, I., Chiral fermion asymmetry in high-energy plasma simulations. Geophys. Astrophys. Fluid Dynam., 2020a, 114, 106–129.

Schober, J., Fujita, T. and Durrer, R., Generation of chiral asymmetry via helical magnetic fields. Phys. Rev. D, 2020b, 101, 103028.

Seta, A., Bushby, P.J., Shukurov, A. and Wood, T.S., Saturation mechanism of the fluctuation dynamo at Pr_{M} ≥ 1. Phys. Rev. Fluids, 2020, 5, 043702.

Singh, N.K., Raichur, H., Käpylä, M.J., Rheinhardt, M., Brand enburg, A. and Käpylä, P.J., f-mode strengthening from a localised bipolar subsurface magnetic field. Geophys. Astrophys. Fluid Dynam., 2020, 114, 196–212.

Viviani, M. and Käpylä, M.J., Physically motivated heat conduction treatment in simulations of solar-like stars: effects on dynamo transitions., 2020, arXiv:2006.04426.

Warnecke, J. and Bingert, S., Non-Fourier description of heat flux evolution in 3D MHD simulations of the solar corona. Geophys. Astrophys. Fluid Dynam., 2020, 114, 261–281.

Willamo, T., Hackman, T., Lehtinen, J.J., Käpylä, M.J., Olspert, N., Viviani, M. and Warnecke, J., Shapes of stellar activity cycles. Astron. Astrophys., 2020, 638, A69.

Zhang, H., Luo, K., Haugen, N.E.L., Mao, C. and Fan, J., Drag force for a burning particle. Comb. Flame, 2020, 217, 188–199.

This Pencil Code Newsletter was edited by

Axel  Brandenburg  <brandenb@nordita.org>,

Nordita, KTH Royal Institute of Technology and Stockholm University, Roslagstullsbacken 23, 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 for

the online version.