Tensorium
Loading...
Searching...
No Matches
BSSNContractedChristoffel.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "../Metric.hpp"
4#include "BSSNDerivatives.hpp"
5
6namespace tensorium_RG {
7
8template <typename T> class BSSNContractedGamma {
9 public:
26 const tensorium_RG::Metric<T> &metric, T dx, T dy, T dz,
27 T chi) {
28 tensorium::Vector<T> d_chi(3);
29
30 tensorium_RG::compute_partial_derivatives_scalar<T>(
31 X, dx, dy, dz,
32 [&](const tensorium::Vector<T> &Xs) {
33 T a_tmp;
34 tensorium::Vector<T> b_tmp(3);
35 tensorium::Tensor<T, 2> g_tmp({3, 3});
36 metric.BSSN(Xs, a_tmp, b_tmp, g_tmp);
37 return compute_conformal_factor(metric, g_tmp);
38 },
39 d_chi);
40
42 for (size_t j = 0; j < 3; ++j)
43 out[j] = -1.5 * d_chi[j] / chi;
44
45 return out;
46 }
47
49 const tensorium_RG::Metric<T> &metric,
50 tensorium::Tensor<T, 5> &dGamma_contract) {
51 auto shape = dGamma_contract.shape();
52 const size_t NX = shape[0], NY = shape[1], NZ = shape[2];
53
54 for (size_t i = 0; i < NX; ++i)
55 for (size_t j = 0; j < NY; ++j)
56 for (size_t k = 0; k < NZ; ++k) {
57 tensorium::Vector<T> Xs = {X(0) + dx * (i - NX / 2), X(1) + dy * (j - NY / 2),
58 X(2) + dz * (k - NZ / 2)};
59
60 T alpha;
63 metric.BSSN(Xs, alpha, beta, gamma);
64
65 T chi = compute_conformal_factor(metric, gamma);
66
67 tensorium::Vector<T> gamma_contract =
69
70 for (size_t a = 0; a < 3; ++a)
71 for (size_t b = 0; b < 3; ++b)
72 dGamma_contract(i, j, k, a, b) = (a == b) ? gamma_contract[a] : T(0);
73 }
74 }
75};
76
77} // 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
std::array< size_t, Rank > shape() const
Definition Tensor.hpp:62
Definition BSSNContractedChristoffel.hpp:8
static tensorium::Vector< T > compute(const tensorium::Vector< T > &X, const tensorium_RG::Metric< T > &metric, T dx, T dy, T dz, T chi)
Compute the contracted Christoffel symbol .
Definition BSSNContractedChristoffel.hpp:25
void compute_contracted_christoffel(const tensorium::Vector< T > &X, T dx, T dy, T dz, const tensorium_RG::Metric< T > &metric, tensorium::Tensor< T, 5 > &dGamma_contract)
Definition BSSNContractedChristoffel.hpp:48
A callable 4D metric class for general relativity (Minkowski, Schwarzschild, Kerr,...
Definition Metric.hpp:27
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