Tensorium
Loading...
Searching...
No Matches
BSSNChiContext.hpp
Go to the documentation of this file.
1#pragma once
2
5#include "../Metric.hpp"
6#include "BSSNDerivatives.hpp"
7
8namespace tensorium_RG {
9
10template <typename T> struct ChiContext {
12 T dx, dy, dz;
14
15 // Contenu calculé
16 T chi;
19
20 static ChiContext<T> compute(const tensorium::Vector<T> &X_, T dx_, T dy_, T dz_,
21 const tensorium::Tensor<T, 2> &g_phys,
22 const tensorium::Tensor<T, 3> &d_g_phys,
23 const Metric<T> &metric_) {
24 using namespace tensorium;
25
26 ChiContext<T> ctx{.X = X_, .dx = dx_, .dy = dy_, .dz = dz_, .metric = metric_};
27
28 ctx.chi = compute_conformal_factor(metric_, g_phys);
29
30 auto scalar_func = [&](const Vector<T> &Xs) -> T {
31 T alpha;
32 Vector<T> beta(3);
33 Tensor<T, 2> g_tmp({3, 3});
34 metric_.BSSN(Xs, alpha, beta, g_tmp);
35 return compute_conformal_factor(metric_, g_tmp);
36 };
37
38 ctx.grad_chi = partial_scalar(X_, dx_, dy_, dz_, scalar_func);
40
41 return ctx;
42 }
43};
44
45} // namespace tensorium_RG
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
Definition BSSNAtildeTensor.hpp:10
tensorium::Vector< T > partial_scalar(const tensorium::Vector< T > &X, T dx, T dy, T dz, ScalarFunc &&func)
Definition BSSNDerivatives.hpp:119
void compute_second_derivatives_scalar(const tensorium::Vector< T > &X, T dx, T dy, T dz, ScalarFunc &&func, tensorium::Tensor< T, 2 > &out)
Definition BSSNDerivatives.hpp:442
Definition Derivate.hpp:24
Definition BSSNChiContext.hpp:10
tensorium::Vector< T > grad_chi
Definition BSSNChiContext.hpp:17
tensorium::Tensor< T, 2 > hessian_chi
Definition BSSNChiContext.hpp:18
T dx
Definition BSSNChiContext.hpp:12
T dy
Definition BSSNChiContext.hpp:12
T dz
Definition BSSNChiContext.hpp:12
static ChiContext< T > compute(const tensorium::Vector< T > &X_, T dx_, T dy_, T dz_, const tensorium::Tensor< T, 2 > &g_phys, const tensorium::Tensor< T, 3 > &d_g_phys, const Metric< T > &metric_)
Definition BSSNChiContext.hpp:20
const Metric< T > & metric
Definition BSSNChiContext.hpp:13
T chi
Definition BSSNChiContext.hpp:16
tensorium::Vector< T > X
Definition BSSNChiContext.hpp:11