| 1 |
// Lorene headers |
| 2 |
#include "metric.h" |
| 3 |
#include "nbr_spx.h" |
| 4 |
#include "utilitaires.h" |
| 5 |
#include "graphique.h" |
| 6 |
|
| 7 |
using namespace Lorene ; |
| 8 |
|
| 9 |
int main() { |
| 10 |
|
| 11 |
// Construction of a multi-grid (Mg3d) |
| 12 |
// ----------------------------------- |
| 13 |
const int nz = 4 ; // Number of domains |
| 14 |
int nr = 33 ; // Number of collocation points in r in each domain |
| 15 |
int nt = 17 ; // Number of collocation points in theta in each domain |
| 16 |
int np = 4 ; // Number of collocation points in phi in each domain |
| 17 |
int symmetry_theta = SYM ; // symmetry with respect to the equatorial plane |
| 18 |
int symmetry_phi = SYM ; // symmetric with respect to (x,y) -> (-x,-y) |
| 19 |
bool compact = true ; |
| 20 |
assert(nz > 1) ; |
| 21 |
|
| 22 |
Mg3d mgrid(nz, nr, nt, np, symmetry_theta, symmetry_phi, compact) ; |
| 23 |
|
| 24 |
// Construction of an affine mapping (Map_af) |
| 25 |
// ------------------------------------------ |
| 26 |
|
| 27 |
// Boundaries of each domains |
| 28 |
double Rlim = 4. ; |
| 29 |
Tbl r_limits(nz+1) ; |
| 30 |
r_limits.set_etat_qcq() ; |
| 31 |
for (int i=0; i<nz; i++) |
| 32 |
r_limits.set(i) = double(i)/double(nz-1) *Rlim ; |
| 33 |
r_limits.set(nz) = __infinity ; |
| 34 |
|
| 35 |
Map_af map(mgrid, r_limits) ; |
| 36 |
|
| 37 |
// Definition of coordinate fields |
| 38 |
//-------------------------------- |
| 39 |
const Coord& xx = map.x ; |
| 40 |
const Coord& yy = map.y ; |
| 41 |
const Coord& zz = map.z ; |
| 42 |
const Coord& rr1 = map.r ; |
| 43 |
Scalar x(map) ; |
| 44 |
x = xx ; |
| 45 |
Scalar y(map) ; |
| 46 |
y = yy ; |
| 47 |
Scalar z(map) ; |
| 48 |
z = zz ; |
| 49 |
Scalar r_rho(map) ; |
| 50 |
r_rho = rr1 ; |
| 51 |
|
| 52 |
// Flat metric and both standard triads |
| 53 |
//------------------------------------- |
| 54 |
const Metric_flat& mets = map.flat_met_spher() ; |
| 55 |
const Base_vect_spher& bspher = map.get_bvect_spher() ; |
| 56 |
const Base_vect_cart& bcart = map.get_bvect_cart() ; //Cartesian base vector |
| 57 |
|
| 58 |
// Parameters for the Boyer-Lindquist (Kerr) BH |
| 59 |
//--------------------------------------------- |
| 60 |
double mass = 0.5 ; |
| 61 |
double kerr_a = 0.49999 ; |
| 62 |
|
| 63 |
// Define rho radial coordinate |
| 64 |
//----------------------------- |
| 65 |
Scalar rho(map) ; |
| 66 |
rho = 0.5*(r_rho*r_rho - kerr_a*kerr_a) + |
| 67 |
sqrt( 0.25*pow(r_rho*r_rho - kerr_a*kerr_a , 2) |
| 68 |
+ kerr_a*kerr_a*z*z ) ; |
| 69 |
rho = sqrt(rho) ; |
| 70 |
rho.std_spectral_base() ; |
| 71 |
rho.set_domain(0) = 1 ; |
| 72 |
|
| 73 |
// Define Ingoing null vector l_\mu |
| 74 |
//--------------------------------- |
| 75 |
Scalar hhh(map) ; |
| 76 |
hhh = mass*pow(rho,3) / ( pow(rho,4) + kerr_a*kerr_a*z*z ) ; |
| 77 |
hhh.set_outer_boundary(nz-1, 0) ; |
| 78 |
hhh.std_spectral_base() ; |
| 79 |
|
| 80 |
Vector lmu(map, COV, bcart) ; |
| 81 |
lmu.set(1) = (rho*x + kerr_a*y) / (rho*rho + kerr_a*kerr_a) ; |
| 82 |
lmu.set(2) = (rho*y - kerr_a*x) / (rho*rho + kerr_a*kerr_a) ; |
| 83 |
lmu.set(3) = z / rho ; |
| 84 |
for (int i=0; i<3; i++) |
| 85 |
lmu.set(i+1).set_outer_boundary(nz-1, 1) ; |
| 86 |
lmu.std_spectral_base() ; |
| 87 |
lmu.change_triad(bspher) ; // That's why we need at least 4 coefficients in phi! |
| 88 |
|
| 89 |
// Lapse |
| 90 |
//------ |
| 91 |
Scalar lapse(map) ; |
| 92 |
lapse = pow( 1. + 2.*hhh , -0.5 ) ; |
| 93 |
lapse.std_spectral_base() ; |
| 94 |
|
| 95 |
// 3-metric |
| 96 |
//--------- |
| 97 |
const Metric gam(mets.cov() + 2*hhh*lmu*lmu) ; |
| 98 |
|
| 99 |
//Shift |
| 100 |
//----- |
| 101 |
Vector beta = (2*hhh*lmu).up_down(gam) ; |
| 102 |
|
| 103 |
// Extrinsic curvature |
| 104 |
//-------------------- |
| 105 |
Sym_tensor k_dd = 0.5*gam.cov().derive_lie(beta) / lapse ; |
| 106 |
k_dd.dec_dzpuis(2) ; |
| 107 |
Sym_tensor k_uu = k_dd.up_down(gam) ; |
| 108 |
Scalar trK = k_dd.trace(gam) ; //trace of K_ij |
| 109 |
|
| 110 |
//------------------------------------------------ |
| 111 |
// Check of Einstein equations (3+1 form) |
| 112 |
//------------------------------------------------ |
| 113 |
|
| 114 |
cout << "Checking the Einstein equations in 3+1 form: " << endl ; |
| 115 |
cout << "(results in the nucleus are not relevant!)" << endl ; |
| 116 |
|
| 117 |
// Hamiltonian constraint |
| 118 |
//----------------------- |
| 119 |
Scalar ham_constr = gam.ricci_scal() ; |
| 120 |
ham_constr.dec_dzpuis(3) ; |
| 121 |
ham_constr += trK*trK - contract(k_uu, 0, 1, k_dd, 0, 1) ; |
| 122 |
maxabs(ham_constr, "Hamiltonian constraint: ") ; |
| 123 |
|
| 124 |
// Momentum constraint |
| 125 |
//------------------- |
| 126 |
Vector mom_constr = k_uu.divergence(gam) - trK.derive_con(gam) ; |
| 127 |
mom_constr.dec_dzpuis(2) ; |
| 128 |
maxabs(mom_constr, "Momentum constraint: ") ; |
| 129 |
|
| 130 |
// Evolution equations |
| 131 |
//-------------------- |
| 132 |
Sym_tensor evol_eq = lapse*gam.ricci() |
| 133 |
- lapse.derive_cov(gam).derive_cov(gam); |
| 134 |
evol_eq.dec_dzpuis() ; |
| 135 |
evol_eq += k_dd.derive_lie(beta) ; |
| 136 |
evol_eq.dec_dzpuis(2) ; |
| 137 |
evol_eq += lapse*(trK*k_dd - 2*contract(k_dd, 1, k_dd.up(0, gam), 0) ) ; |
| 138 |
maxabs(evol_eq, "Evolution equations: ") ; |
| 139 |
|
| 140 |
return EXIT_SUCCESS ; |
| 141 |
} |