Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
diagnostics_log.hpp File Reference

The conserved quantities of a run, as they change, in a format anything can read. More...

#include <filesystem>
#include <fstream>
#include <optional>
#include "orrery/core/diagnostics.hpp"
#include "orrery/core/types.hpp"

Go to the source code of this file.

Classes

class  orrery::sim::DiagnosticsLog
 Appends one row per measurement to a CSV file. More...

Detailed Description

The conserved quantities of a run, as they change, in a format anything can read.

This is the output the project's headline claims are made from. Whether a symplectic integrator holds its energy inside a bounded envelope while RK4 drifts is a statement about a column of numbers, and the test suite makes it over a few hundred steps in memory. A run of a few million steps has to write them somewhere, and what reads them afterwards is a plotting script rather than a C++ program, so the format is CSV with a header row and nothing clever in it.

Two columns are worth pointing at.

relative_energy_error is the quantity every energy plot in the project is actually of: the total energy less the total energy at the first row, divided by the magnitude of that first value. It is computed here rather than left to the reader because the alternative is every script that reads one of these files having its own idea of which row was the reference.

virial_ratio is 2T/|U|, the convention core/diagnostics.hpp fixes for the whole project. It is one for a self-gravitating system in equilibrium, and watching a sampled Plummer sphere hold it is how a run says it started where it claimed to.

Numbers are written to the full precision of the build, so a value read back from the file is the value that was measured. A diagnostics stream rounded to six digits would report an energy that is conserved to six digits whatever the integrator did.