Reference
Nbody2D.Nbody2DNbody2D.BVHNbody2D.BoxNbody2D.CausticSkeletonNbody2D.CosmologyNbody2D.GridIndexNbody2D.PMWorkspaceNbody2D.PS_DTFENbody2D.StateNbody2D.cGRFNbody2D.gridcellNbody2D.CICNbody2D.CIC!Nbody2D.Caustics!Nbody2D.DriftNbody2D.Drift!Nbody2D.EulerianNbody2D.EulerianNbody2D.EulerianNbody2D.EulerianNbody2D.EulerianNbody2D.GRFNbody2D.GRFNbody2D.Grad2Nbody2D.Grad2!Nbody2D.Interp2DNbody2D.Interp2DNbody2D.KickNbody2D.Kick!Nbody2D.LagrangianGridNbody2D.LeapFrogNbody2D.LeapFrogSnapshotsNbody2D.LeapFrogStep!Nbody2D.PolygoniseA!Nbody2D.PolygoniseA!Nbody2D.PolygoniseA2!Nbody2D.PolygoniseA2!Nbody2D.PolygoniseD!Nbody2D.PolygoniseD4!Nbody2D.VertexInterpNbody2D.ZeldovichNbody2D.adotNbody2D.cell_trianglesNbody2D.constraintGRFNbody2D.convolveNbody2D.derivativeNbody2D.derivativeNbody2D.derivativeNbody2D.directional_derivative_1Nbody2D.directional_derivative_2Nbody2D.eigenFields123Nbody2D.first_eigenNbody2D.generalizedMomentNbody2D.gradientNbody2D.growing_modeNbody2D.growing_mode_derivativeNbody2D.growing_mode_normNbody2D.hessianNbody2D.interp_weightsNbody2D.interpolation_cubicNbody2D.laplacianNbody2D.lattice_trianglesNbody2D.locateNbody2D.meanNbody2D.meanFieldNbody2D.measureConstraintsNbody2D.nstepsNbody2D.numberOfStreamsNbody2D.numberOfStreams_gridNbody2D.plotMeshNbody2D.plotMesh!Nbody2D.plotSkeletonNbody2D.plotSkeleton!Nbody2D.ps_densityNbody2D.ps_density_gridNbody2D.ps_velocityNbody2D.rasteriseNbody2D.smoothNbody2D.stream_densityNbody2D.stream_densityNbody2D.stream_velocityNbody2D.streamsNbody2D.unwrap_sNbody2D.unwrap_triangleNbody2D.varianceFieldNbody2D.velocitySumNbody2D.wrap1
Nbody2D.Nbody2D — Module
A simple two-dimensional cosmological N-body code.Nbody2D.BVH — Method
BVH(estimator::PS_DTFE, depth)The bounding volume hierarchy of the estimator's triangles, as used before the cell index; for debugging, for instance with findBox and findIntersections(p, tree, estimator.positions, estimator.corners).
Nbody2D.Box — Type
The cosmological box, setting the volume of the box L^2 and the number of particles N^2.Nbody2D.CausticSkeleton — Type
Caustic skeleton
Nbody2D.Cosmology — Type
The cosmological background in which the N-body simulation runs with the current Hubble rate H0, the matter density OmegaM, dark energy density OmegaL and the curvature component OmegaK.Nbody2D.GridIndex — Type
GridIndexUniform G×G cell index of the triangles over the box [0, L)², in compressed form: the triangles whose bounding box overlaps cell k are tris[offsets[k]:offsets[k + 1] - 1], with cell k = i + (j - 1) G for x in cell i and y in cell j.
Nbody2D.PMWorkspace — Type
Preallocated grids and FFT plans for the particle-mesh force on the force grid `box`.Nbody2D.PS_DTFE — Type
PS_DTFE(state_initial, state_final, box; G = n)
PS_DTFE(state_initial, state_final, depth, box)Phase-space Delaunay tessellation field estimator. The particles are connected by the regular triangulation of their Lagrangian lattice (lattice_triangles), every triangle is unwrapped across the periodic boundaries on its own (unwrap_triangle), and triangles crossing the edge of the box are stored together with their periodic copies.
Triangles are located with a uniform G×G cell index (GridIndex); by default G is the size n of the particle lattice. The second form, with a depth, is kept for compatibility: the depth is not used for the queries, and a bounding volume hierarchy for debugging can be built with BVH(estimator, depth).
Query points are taken modulo the box. A point lying exactly on an edge or vertex of the tessellation is counted in every triangle that contains it. Fields can be evaluated at arbitrary points (ps_density, numberOfStreams, ps_velocity, velocitySum) or, much faster, on regular grids (ps_density_grid, numberOfStreams_grid).
Nbody2D.State — Type
The state of the N-body simulation in phase-space.Nbody2D.cGRF — Type
Constrained Gaussian random field object
Nbody2D.gridcell — Type
Gridcell with attributes
Nbody2D.CIC! — Method
Cloud-in-Cell density estimator on an N×N grid with spacing res, written to delta.Nbody2D.CIC — Method
Cloud-in-Cell density estimator.Nbody2D.Caustics! — Method
Compute the caustics
Nbody2D.Drift! — Method
In-place drift step, X += Drift(a, δa, P, cosmology).
Nbody2D.Drift — Method
A drift step.Nbody2D.Eulerian — Method
Push the skeleton from Lagrangian to Eulerian space
Nbody2D.Eulerian — Method
Push the skeleton from Lagrangian to Eulerian space
Nbody2D.Eulerian — Method
Push the skeleton from Lagrangian to Eulerian space
Nbody2D.Eulerian — Method
Push the skeleton from Lagrangian to Eulerian space
Nbody2D.Eulerian — Method
Push the skeleton from Lagrangian to Eulerian space
Nbody2D.GRF — Method
Generate an unconstrained Gaussian random field.Nbody2D.GRF — Method
Generate an unconstrained Gaussian random field.
Nbody2D.Grad2! — Function
Fourth-order finite difference gradient along dimension i (in grid units), multiplied by scale and written to out.Nbody2D.Grad2 — Method
Finite diference gradientNbody2D.Interp2D — Method
Two dimensional interpolation at the rows of x.
Nbody2D.Interp2D — Method
Two dimensional interpolation.Nbody2D.Kick! — Method
In-place kick step, P -= Kick(a, δa, X, ws.box, ws.mass, cosmology).Nbody2D.Kick — Method
A kick step.Nbody2D.LagrangianGrid — Method
Lagrangian gridNbody2D.LeapFrog — Method
The Leap Frog integrator. The returned positions are at state.time = af, the momenta half a step later at af + δa/2.Nbody2D.LeapFrogSnapshots — Method
The Leap Frog integrator, returning the state after every step (at ai + δa, ai + 2δa, ..., af).Nbody2D.LeapFrogStep! — Method
A leap frog step moving the positions from a to a + δa and the momenta from a + δa/2 to a + 3δa/2.Nbody2D.PolygoniseA! — Method
Compute the cusp (A3), swallowtail (A4) and butterfly (A5) caustics
Nbody2D.PolygoniseA! — Method
Compute the cusp (A3), swallowtail (A4) and butterfly (A5) caustics
Nbody2D.PolygoniseA2! — Method
Compute the fold (A2) caustics
Nbody2D.PolygoniseA2! — Method
Compute the fold (A2) caustics
Nbody2D.PolygoniseD! — Method
Compute the umbilic (D4) caustics
Nbody2D.PolygoniseD4! — Method
Compute the umbilic (D4) caustics
Nbody2D.VertexInterp — Method
Interpolate a vertex along a line
Nbody2D.Zeldovich — Method
Evaluate the Zel'dovich approximation, x = q - D(a) ∇ϕ, with the positions at a_pos and the momenta p = a² da/dt dx/da at a_vel.Nbody2D.adot — Method
The derivative of the scale factor.Nbody2D.cell_triangles — Method
Triangles whose bounding box overlaps the cell of the point (x, y) in [0, L)².
Nbody2D.constraintGRF — Method
Generate an unconstrained, constrained Gaussian random field pair.
Nbody2D.convolve — Method
Convolution.
Nbody2D.derivative — Method
Finite difference order dx^4
Nbody2D.derivative — Method
Finite difference order dx^6
Nbody2D.derivative — Method
Finite difference order dx^2
Nbody2D.directional_derivative_1 — Method
Evaluate the first order directional derivative v₁⋅∇λ₁
Nbody2D.directional_derivative_2 — Method
Evaluate the second order directional derivative v₁⋅∇(v₁⋅∇λ₁)
Nbody2D.eigenFields123 — Method
Evaluate first eigenvalue and eigenvector field
Nbody2D.first_eigen — Method
Evaluate first eigenvalue and eigenvector
Nbody2D.generalizedMoment — Method
Generalized moment of the power spectrum P(k), smoothed on the scale σ.
Nbody2D.gradient — Method
Gradient of a scalar field
Nbody2D.growing_mode — Method
The growing mode.Nbody2D.growing_mode_derivative — Method
The derivative of the growing mode with respect to the scale factor.Nbody2D.growing_mode_norm — Method
The normalization of the growing mode.Nbody2D.hessian — Method
Hessian of a scalar field
Nbody2D.interp_weights — Method
Grid indices and bilinear weights of the point (x1, x2) in grid units on a periodic N×N grid.
Nbody2D.interpolation_cubic — Method
Cubic interpolation of a regular grid
Nbody2D.laplacian — Method
Laplace operator.
Nbody2D.lattice_triangles — Method
lattice_triangles(N)Triangulation of the periodic N×N Lagrangian lattice. Every cell is split along the same diagonal, into (i, j)–(i+1, j)–(i+1, j+1) and (i, j)–(i+1, j+1)–(i, j+1), so that every particle is a vertex of exactly six triangles. Particle (i, j) has index i + (j - 1) N, matching reshape(state.position, :, 2).
Nbody2D.locate — Method
Offset (dx, dy) of (x, y) from the first corner of triangle t, and whether the point lies in the triangle.
Nbody2D.mean — Method
Mean of an Array.
Nbody2D.meanField — Method
The mean field given the constraints c.
Nbody2D.measureConstraints — Method
Measure the constraints.
Nbody2D.nsteps — Method
Number of leap frog steps from ai to af.
Nbody2D.numberOfStreams — Method
Number of streams at the point p.
Nbody2D.numberOfStreams_grid — Method
numberOfStreams_grid(xs, ys, estimator)Number of streams on the regular grid xs × ys, as a matrix with rows y and columns x; equal to [numberOfStreams([x, y], estimator) for y in ys, x in xs], but computed by rasterising the triangles.
Nbody2D.plotMesh — Function
Mesh plot of the N-body simulation
Nbody2D.plotMesh! — Function
Mesh plot of the N-body simulation
Nbody2D.plotSkeleton — Function
Plot Caustic Skeleton
Nbody2D.plotSkeleton! — Function
Plot Caustic Skeleton
Nbody2D.ps_density — Method
Density at the point p, summed over all streams.
Nbody2D.ps_density_grid — Method
ps_density_grid(xs, ys, estimator)Density on the regular grid xs × ys, as a matrix with rows y and columns x; equal to [ps_density([x, y], estimator) for y in ys, x in xs], but computed by rasterising the triangles.
Nbody2D.ps_velocity — Method
ps_velocity(p, estimator)Momentum p = a² dx/dt of every stream at the point p, one row per stream; divide by the scale factor a for the peculiar velocity.
Nbody2D.rasterise — Method
rasterise(estimator, xs, ys)Density and number of streams on the regular grid xs × ys (rows y, columns x), by looping once over the triangles and over the grid points inside each of them. The grid may extend beyond the box: every triangle is placed at all its periodic images that overlap the grid, so the result equals the point queries at mod.(p, L).
Nbody2D.smooth — Method
Smooth an Array.
Nbody2D.stream_density — Method
Density, linearly interpolated on triangle s at the point p.
Nbody2D.stream_density — Method
Density of triangle t at the offset (dx, dy) from its first corner.
Nbody2D.stream_velocity — Method
Momentum p = a² dx/dt, linearly interpolated on triangle s at the point p.
Nbody2D.streams — Method
Triangles containing the point p (taken modulo the box).
Nbody2D.unwrap_s — Method
unwrap_s(s, L)Cosmological N-body simulations normally work with periodic boundary conditions. This function undoes the wrapping of particles around the box in the displacement field, assuming the particles did not travel more than half the size of the box.
Nbody2D.unwrap_triangle — Method
unwrap_triangle(x, sim, L)Eulerian corners of the triangle with particle indices sim (rows of x). The second and third corners are placed at the periodic image nearest to the first corner, and the first corner is shifted into [0, L)². This only assumes that the edges of the triangle are shorter than L/2, so particles may have wrapped around the box any number of times.
Nbody2D.varianceField — Method
The variance field of the constraints.
Nbody2D.velocitySum — Method
Stream-density weighted momentum p = a² dx/dt at the point p.
Nbody2D.wrap1 — Method
Periodic index in 1:N, with a fast path for indices that are already in range or one period out.