
this paper, we will focus on particle based codes, but
this method could certainly be adapted for Adaptive
Mesh Refinements (AMR) or to any other general
method. In practice, the CSDS is implemented as a
stand-alone module around the open-source cosmo-
logical code Swift1(Schaller et al. 2016, 2018).
The paper is organized as follows. In section 2,
we describe in details the theory behind the CSDS.
In section 3, the implementation within Swift is pro-
vided followed by section 4 where the reading strat-
egy is explained. Our results are separated in two
sections (5 and 7). The first one presents the effi-
ciency of the CSDS and the second one shows some
examples of applications.
The implementation presented in this paper is fully
open-source and included as part of the Swift repos-
itory2.
2. The Continuous Simulation Data Stream
The Continuous Simulation Data Stream (CSDS)
is a new output strategy and mechanism aimed at re-
placing or supplementing, at least partially, the tra-
ditional snapshot system. Its main advantage resides
in the writing of each individual resolution element
in their own mini logbook. It hence allows to cap-
ture their evolution according to their own time-scale
and not only at the fixed time resolution set globally
by traditional snapshots. Thus, it perfectly adapts
to simulations using individual localized time-step
sizes and can achieve extremely high time resolu-
tion while keeping the output size reasonable. Cap-
turing the detailed progression of the elements using
the smallest time-step bin would require a prohibitive
number of fixed-time snapshots; whilst our mecha-
nism allows us to track this evolution precisely.
2.1. Overview of the different components
To achieve this high resolution, the CSDS uses a
single file, called the logfile, that describes the whole
evolution of the simulation. Within this file, all the
1www.swiftsim.com
2For the csds-reader, we used version 1.5 (available
at https://gitlab.cosma.dur.ac.uk/lhausammann/
csds-reader) in this paper. More specifically, all the plots
and numbers shown in this paper were obtained using commit
d078e2dd of Swift and commit c073baf0 of the reader code.
information is written in the form of per-particle records
(except for the header containing some general meta-
data). This approach allows to write the particles
individually and at their own timescale without any
need to synchronize them during the simulation. When
reading the CSDS for analysis, a synchronization is
still required and done through an interpolation.
To construct the logfile, a general header is writ-
ten during the initialization of the simulation. Then,
a time record for the initial step is written followed
by a particle record for all the particles in the vol-
ume (i.e. this corresponds to the initial conditions).
The particles then carry a clock (see below) giving
them an individual dump frequency. At each step of
the simulation, the CSDS writes a time record and a
particle record for the particles whose timer is up.
At the end of the simulation, all the particles are
written one final time and a time record concludes
the logfile. Users can hence reconstruct the entire
history of a given particle by hoping from record to
record through the logfile. If a user requests details
about a given particle in-between two time-records,
interpolation is used. The accuracy (faithfulness) of
the whole mechanism is entirely dictated by the fre-
quency of the dump of each particle. We note, for in-
stance, that for the simulation shown on Fig 1, a large
fraction of particles would not need any records be-
tween their initial and final dump as their trajectories
can be well recovered just by interpolation.
To simplify the reading of the logfile, the CSDS
uses a set of index files that describe the state of the
simulation at a given time. While this mimics the be-
havior of snapshots, they tend to be smaller as they
only contain, for each particle, the last known loca-
tion within the logfile and IDs of the particles. The
index files contain also the history of the particles
created and deleted during the simulation (e.g. for
MPI exchanges, star formation and black hole inter-
actions for cosmological simulations). Theses files
are generated after the simulation and, from our ex-
perience, a small number (∼10) of index files is suf-
ficient to achieve good analysis performance.
Finally, we also include a metadata file that con-
tains details on the simulation (e.g. units, cosmolog-
ical model, subgrid parameters). This file will not be
discussed further as the details are not important to
the CSDS mechanism.
3