SMILE
v2.5
Schwarzschild Modelling Interactive expLoratory Environment
|
Tool: Measure the rate of energy diffusion in N-body simulation. More...
#include <stdlib.h>
#include <stdinc.h>
#include <getparam.h>
#include <io_nemo.h>
#include <vector>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_fit.h>
#include "massmodel.h"
#include "utils.h"
Macros | |
#define | TimeBit (1 << 0) |
#define | MassBit (1 << 1) |
#define | PotentialBit (1<<3) |
#define | DensBit (1<<15) |
Functions | |
int | my_fit_mul (const double *x, const size_t, const double *y, const size_t, const size_t num, double *coef1, double *, double *sumsq) |
a modification of linear regression fit with zero intercept, which is more robust against outliers | |
int | main (int argc, char **argv) |
Variables | |
string | defv [] |
string | usage =const_cast<char*>("plot average energy and angular momentum change vs. time as a function of energy bin (measure relaxation rate)") |
Tool: Measure the rate of energy diffusion in N-body simulation.
This program is used to determine the rate of energy diffusion of particles in an N-body simulation of a system that is assumed to be in self-consistent equilibrium, and compare it against analytical prediction from the theory of two-body relaxation.
Input file in the NEMO format contains multiple time snapshots. The program computes the squared change of particle energy, averaged over particles in a number of energy bins, as a function of time. For a diffusion process, this change should grow linearly with time, so a best-fit slope estimate is taken to be the energy diffusion rate. Output consists of the diffusion rates and their uncertainties, computed for each energy bin. It can be compared with the analytical estimate of diffusion coefficient from a smooth mass model, scaled to the appropriate number of particles.
string defv[] |