Tensorium
Loading...
Searching...
No Matches
BSSNMetricUtils.hpp
Go to the documentation of this file.
1#pragma once
2
5#include "../Metric.hpp"
6#include <cassert>
7#include <cstddef>
8
9namespace tensorium_RG {
10
28template <typename T>
30 size_t Nx, size_t Ny, size_t Nz, T dx, T dy,
31 T dz) {
32 tensorium::Tensor<T, 5> gamma_tilde_field({Nx, Ny, Nz, 3, 3});
33
35 X(0) = T(0);
36
37 for (size_t i = 0; i < Nx; ++i) {
38 T x = i * dx;
39 for (size_t j = 0; j < Ny; ++j) {
40 T y = j * dy;
41 for (size_t k = 0; k < Nz; ++k) {
42 T z = k * dz;
43
44 X(1) = x;
45 X(2) = y;
46 X(3) = z;
47
48 tensorium::Tensor<T, 2> gamma(3, 3), gamma_tilde(3, 3);
50 T alpha, chi;
51
52 metric.BSSN(X, alpha, beta, gamma);
54 metric.compute_conformal_metric(gamma, chi, gamma_tilde);
55
56 for (size_t a = 0; a < 3; ++a)
57 for (size_t b = 0; b < 3; ++b)
58 gamma_tilde_field(i, j, k, a, b) = gamma_tilde(a, b);
59 }
60 }
61 }
62
63 return gamma_tilde_field;
64}
65
66} // namespace tensorium_RG
static FrontendPluginRegistry::Add< TensoriumPluginAction > X("tensorium-dispatch", "Handle #pragma tensorium directives")
Register the plugin under the name "tensorium-dispatch".
Multi-dimensional tensor class with fixed rank and SIMD support.
Definition Tensor.hpp:25
A callable 4D metric class for general relativity (Minkowski, Schwarzschild, Kerr,...
Definition Metric.hpp:27
void compute_conformal_metric(const tensorium::Tensor< T, 2 > &gamma, T chi, tensorium::Tensor< T, 2 > &gamma_tilde) const
Definition Metric.hpp:109
T compute_conformal_factor(const tensorium::Tensor< T, 2 > &gamma) const
Definition Metric.hpp:101
void BSSN(const tensorium::Vector< T > &X, T &alpha, tensorium::Vector< T > &beta, tensorium::Tensor< T, 2 > &gamma) const
Extract BSSN 3+1 variables (lapse, shift, and spatial metric)
Definition Metric.hpp:83
Definition BSSNAtildeTensor.hpp:10
tensorium::Tensor< T, 5 > generate_conformal_metric_field(const tensorium_RG::Metric< T > &metric, size_t Nx, size_t Ny, size_t Nz, T dx, T dy, T dz)
Generate the conformal 3-metric field on a 3D grid.
Definition BSSNMetricUtils.hpp:29