Class for evolving non-interacting matter particles. More...
#include <particles.h>
Public Member Functions | |
void | init (idx_t n_particles) |
Create random particles. More... | |
void | addParticle (Particle< real_t > particle) |
Add an individual particle. More... | |
particle_vec * | getParticleVec () |
real_t | getFractionalIndex (real_t x) |
Compute non-integer index at a point. | |
idx_t | getIndexBelow (real_t x) |
Returns the index "below" a point (floor of getFractionalIndex) More... | |
idx_t | getNearestIndex (real_t x) |
Returns the index nearest a point (rounds getFractionalIndex) | |
void | setX_d (real_t X[3], real_t x_d[3]) |
Sets a fractional distance between grid points. More... | |
ParticleMetricPrimitives< real_t > | interpolatePrimitivesFromCorners (ParticleMetricPrimitives< real_t > corner_pp_in[2][2][2], real_t x_d[3]) |
Linearly interpolate metric quantities from corners of a "box". More... | |
ParticleMetricPrimitives< real_t > | interpolatePrimitivesFromCornersIncomplete (ParticleMetricPrimitives< real_t > corner_pp_in[2][2][2], real_t x_d[3]) |
Only set some metric components. More... | |
real_t | linearInterpolation (real_t C000, real_t C001, real_t C010, real_t C011, real_t C100, real_t C101, real_t C110, real_t C111, real_t x_d[3]) |
ParticleMetricPrimitives< real_t > | getInterpolatedPrimitivesIncomplete (Particle< real_t > *p, map_t &bssn_fields) |
Interpolate some metric primitives required for geodesic integration. More... | |
ParticleMetricPrimitives< real_t > | getInterpolatedPrimitives (Particle< real_t > *p, map_t &bssn_fields) |
Interpolate metric primitives required for geodesic integration. More... | |
void | RKStep (ParticleRegister< real_t > *pr, real_t h, real_t RK_sum_coeff, map_t &bssn_fields) |
Implementation for evaluating a single RK step. More... | |
void | RK1Step (map_t &bssn_fields) |
void | RK2Step (map_t &bssn_fields) |
void | RK3Step (map_t &bssn_fields) |
void | RK4Step (map_t &bssn_fields) |
void | stepInit (map_t &bssn_fields) |
void | regSwap_c_a () |
void | stepTerm () |
real_t | getKernelWeight (real_t r, real_t r_s) |
void | addParticlesToBSSNSrc (BSSN *bssnSim) |
void | addParticleToBSSNSrc (Particle< real_t > *p_c, map_t &bssn_fields) |
Private Attributes | |
particle_vec * | particles |
Class for evolving non-interacting matter particles.
Class stores a (private) vector of particles, and contains routines for particle evolution, interpolation, and interactions with GR (BSSN) fields.
void cosmo::Particles::addParticle | ( | Particle< real_t > | particle | ) |
Add an individual particle.
Add an individual particle to the internal list of particles
particle | Particle struct |
void cosmo::Particles::addParticlesToBSSNSrc | ( | BSSN * | bssnSim | ) |
Set bssn _a source registers using data from particle _c register
idx_t cosmo::Particles::getIndexBelow | ( | real_t | x | ) |
Returns the index "below" a point (floor of getFractionalIndex)
ParticleMetricPrimitives< real_t > cosmo::Particles::getInterpolatedPrimitives | ( | Particle< real_t > * | p, |
map_t & | bssn_fields | ||
) |
Interpolate metric primitives required for geodesic integration.
Interpolate metric primitives (eg, variables in a ParticleMetricPrimitives struct) required for geodesic integration near a particular particle.
p | Instance of particle to compute interpolated metric quantities near (Particle type). |
bssn_fields | Map from bssn class to fields. |
ParticleMetricPrimitives< real_t > cosmo::Particles::getInterpolatedPrimitivesIncomplete | ( | Particle< real_t > * | p, |
map_t & | bssn_fields | ||
) |
Interpolate some metric primitives required for geodesic integration.
Interpolate some metric primitives (eg, only some variables in a ParticleMetricPrimitives struct: alpha, phi, gamma_ij) required for geodesic integration near a particular particle. See also: getInterpolatedPrimitives
p | Instance of particle to compute interpolated metric quantities near (Particle type). |
bssn_fields | Map from bssn class to fields. |
void cosmo::Particles::init | ( | idx_t | n_particles | ) |
Create random particles.
Add particles with randomized positions, zero velocity, and unit mass to internal particles vector.
n_particles | number of particles to create |
ParticleMetricPrimitives< real_t > cosmo::Particles::interpolatePrimitivesFromCorners | ( | ParticleMetricPrimitives< real_t > | corner_pp_in[2][2][2], |
real_t | x_d[3] | ||
) |
Linearly interpolate metric quantities from corners of a "box".
Linearly interpolate metric quantities from corners of a "box"
corner_pp_in | A 2x2x2 array containing metric values at corners of the "box" |
x_d | fractional position between corners inside the "box" to interpolate values at (see setX_d) |
ParticleMetricPrimitives< real_t > cosmo::Particles::interpolatePrimitivesFromCornersIncomplete | ( | ParticleMetricPrimitives< real_t > | corner_pp_in[2][2][2], |
real_t | x_d[3] | ||
) |
Only set some metric components.
Only set some metric components: gamma_ij, rootdetg, and alpha see also: getInterpolatedPrimitivesIncomplete
corner_pp_in | 2x2x2 array of metric primitives at corners (incomplete) |
void cosmo::Particles::RKStep | ( | ParticleRegister< real_t > * | pr, |
real_t | h, | ||
real_t | RK_sum_coeff, | ||
map_t & | bssn_fields | ||
) |
Implementation for evaluating a single RK step.
General implementation for computing one of the RK steps: y_p; y_a = y_c = yp; y_f = 0 (TODO) y_a = y_p
y_c = y_p + dt/2 * f(y_a) // RK1 step y_f += y_c y_a <-> y_c
y_c = y_p + dt/2 * f(y_a) // RK2 step y_f += 2 y_c y_a <-> y_c
y_c = y_p + dt * f(y_a) // RK3 step y_f += y_c y_a <-> y_c
y_c = y_p + dt/2 * f(y_a) // RK4 step y_f += y_c y_a <-> y_c
(y_f = 5y_p + 1/2 K1 + K2 + K3 + 1/2 K4) y_f = y_f / 3 - 2/3 y_p // finalize y_f <-> y_p
Using Baumgarte & Shapiro, 5.223-5.225
For a single RK step, we can just do: y_c = y_p + h * f(y_a) and y_f += RK_sum_coeff * y_c
pr | Register of particles to integrate | |
[in] | h | step size for particular RK step |
[in] | RK_sum_coeff | coefficient when adding RK step |
bssn_fields | Map from bssn class to fields. |
void cosmo::Particles::setX_d | ( | real_t | X[3], |
real_t | x_d[3] | ||
) |
Sets a fractional distance between grid points.
Stores the fractional distance between grid points of a given point. Eg, for dx = 0.5, the value 1.23 is 46/100 the way between gridpoints at 1.0 and 1.5, so 0.46 is computed. Following this, supplying the point (1.23, 4.56, 7.89) as an argument for X would cause x_d to be set to (0.46, 0.12, 0.78)
X | true position |
x_d | fractional position (passed by reference; values are mutated) |