Peano
Loading...
Searching...
No Matches
brill-lindquist-grid.h
Go to the documentation of this file.
1#ifndef APPARENT_HORIZON_FINDER_TEST_BRILL_LINDQUIST_GRID_H_
2#define APPARENT_HORIZON_FINDER_TEST_BRILL_LINDQUIST_GRID_H_
3
4#include "../ahf-data.h"
5#include "../spacetimes.h"
6
7#include <array>
8#include <stdexcept>
9
11
23 const BrillLindquist& spacetime,
24 double halfWidth,
25 int cellsPerAxis
26) {
27 if (!(halfWidth > 0.0) || cellsPerAxis < 2) {
28 throw std::invalid_argument("MakeBrillLindquistGrid: invalid grid");
29 }
30 const double spacing = 2.0 * halfWidth / cellsPerAxis;
32 const std::size_t cells = static_cast<std::size_t>(cellsPerAxis);
33 grid.coordinates.reserve(cells * cells * cells);
34 for (int i = 0; i < cellsPerAxis; ++i) {
35 for (int j = 0; j < cellsPerAxis; ++j) {
36 for (int k = 0; k < cellsPerAxis; ++k) {
37 const FieldVector<double> x{
38 -halfWidth + (i + 0.5) * spacing,
39 -halfWidth + (j + 0.5) * spacing,
40 -halfWidth + (k + 0.5) * spacing};
41 const double psi = spacetime.psi(x);
42 grid.coordinates.push_back({x[0], x[1], x[2]});
43 const std::array<double, NumberOfCompactFields> row{
44 1.0, 0.0, 0.0, 1.0, 0.0, 1.0,
45 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
46 0.0, 1.0 / (psi * psi)};
47 grid.values.insert(grid.values.end(), row.begin(), row.end());
48 }
49 }
50 }
51 return grid;
52}
53
54} // namespace exahype2::ccz4::ahf::tests
55
56#endif
GridData MakeBrillLindquistGrid(const BrillLindquist &spacetime, double halfWidth, int cellsPerAxis)
Brill-Lindquist data at the cell centres of a regular grid on [-halfWidth, halfWidth]^3: gammaTilde =...
std::array< T, 3 > FieldVector
Analytic spacetimes and the geometry they induce.
Definition spacetimes.h:37
Brill-Lindquist multi-puncture initial data (time symmetric, K_ij = 0).
Definition spacetimes.h:201
T psi(const FieldVector< T > &X) const
Definition spacetimes.h:204
Pointwise Cartesian grid data.
Definition ahf-data.h:429