| 1 |
/* |
| 2 |
* Main code for time evolving Einstein equations |
| 3 |
* in Dirac gauge. |
| 4 |
* |
| 5 |
*/ |
| 6 |
|
| 7 |
/* |
| 8 |
* Copyright (c) 2004 Eric Gourgoulhon & Jerome Novak |
| 9 |
* |
| 10 |
* This file is part of LORENE. |
| 11 |
* |
| 12 |
* LORENE is free software; you can redistribute it and/or modify |
| 13 |
* it under the terms of the GNU General Public License version 2 |
| 14 |
* as published by the Free Software Foundation. |
| 15 |
* |
| 16 |
* LORENE is distributed in the hope that it will be useful, |
| 17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 |
* GNU General Public License for more details. |
| 20 |
* |
| 21 |
* You should have received a copy of the GNU General Public License |
| 22 |
* along with LORENE; if not, write to the Free Software |
| 23 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 |
* |
| 25 |
*/ |
| 26 |
|
| 27 |
char einstein_C[] = "$Header: /cvsroot/Lorene/Codes/Einstein/einstein.C,v 1.16 2014/10/13 08:53:55 j_novak Exp $" ; |
| 28 |
|
| 29 |
/* |
| 30 |
* $Id: einstein.C,v 1.16 2014/10/13 08:53:55 j_novak Exp $ |
| 31 |
* $Log: einstein.C,v $ |
| 32 |
* Revision 1.16 2014/10/13 08:53:55 j_novak |
| 33 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 34 |
* |
| 35 |
* Revision 1.15 2014/10/06 15:09:44 j_novak |
| 36 |
* Modified #include directives to use c++ syntax. |
| 37 |
* |
| 38 |
* Revision 1.14 2004/04/05 14:46:33 e_gourgoulhon |
| 39 |
* The graphical functions are now declared in graphique.h and |
| 40 |
* are included in Lorene's library. |
| 41 |
* |
| 42 |
* Revision 1.13 2004/04/05 07:00:49 e_gourgoulhon |
| 43 |
* Corrected minor error in the computation of taa: ff --> tgam. |
| 44 |
* |
| 45 |
* Revision 1.12 2004/03/31 20:28:57 e_gourgoulhon |
| 46 |
* Update to take into account the new prototypes of |
| 47 |
* Evolution_std<TyT>::Evolution_std<TyT> and |
| 48 |
* Evolution_std<TyT>::update. |
| 49 |
* Test of shift equation. |
| 50 |
* |
| 51 |
* Revision 1.11 2004/03/11 12:09:32 e_gourgoulhon |
| 52 |
* Use of new method Scalar::visu_section_anim to produce outputs for |
| 53 |
* movies. |
| 54 |
* |
| 55 |
* Revision 1.10 2004/03/08 00:36:27 e_gourgoulhon |
| 56 |
* Added output for OpenDX (visu_section). |
| 57 |
* Initial amplitude = 1e-3. |
| 58 |
* |
| 59 |
* Revision 1.9 2004/03/06 21:16:38 e_gourgoulhon |
| 60 |
* First version with all equations implemented, with full sources, |
| 61 |
* including the time derivatives. |
| 62 |
* The only missing part is the trace of h. |
| 63 |
* |
| 64 |
* Revision 1.8 2004/03/05 15:11:18 e_gourgoulhon |
| 65 |
* Use of new method Scalar::smooth_decay on khi_jp1. |
| 66 |
* |
| 67 |
* Revision 1.7 2004/03/04 22:19:25 e_gourgoulhon |
| 68 |
* All sources completed (except for the time derivatives and |
| 69 |
* shift terms in the source for h). |
| 70 |
* |
| 71 |
* Revision 1.6 2004/03/04 16:25:56 e_gourgoulhon |
| 72 |
* Still in progress... |
| 73 |
* |
| 74 |
* Revision 1.5 2004/03/03 11:35:25 e_gourgoulhon |
| 75 |
* First version with Evolution_std's and d'Alembert. |
| 76 |
* |
| 77 |
* Revision 1.4 2004/03/02 14:54:17 e_gourgoulhon |
| 78 |
* Started to encode source for h from new equations. |
| 79 |
* |
| 80 |
* Revision 1.3 2004/02/27 21:17:26 e_gourgoulhon |
| 81 |
* Still in progress... |
| 82 |
* |
| 83 |
* Revision 1.2 2004/02/19 22:16:42 e_gourgoulhon |
| 84 |
* Sources of equations for Q, N and beta completed. |
| 85 |
* |
| 86 |
* Revision 1.1 2004/02/18 19:16:28 e_gourgoulhon |
| 87 |
* First version: c'est loin d'etre pret tout ca !!! |
| 88 |
* |
| 89 |
* |
| 90 |
* $Header: /cvsroot/Lorene/Codes/Einstein/einstein.C,v 1.16 2014/10/13 08:53:55 j_novak Exp $ |
| 91 |
* |
| 92 |
*/ |
| 93 |
|
| 94 |
// C++ headers |
| 95 |
#include "headcpp.h" |
| 96 |
|
| 97 |
// C headers |
| 98 |
#include <cstdlib> |
| 99 |
#include <cmath> |
| 100 |
#include <cstring> |
| 101 |
|
| 102 |
// Lorene headers |
| 103 |
#include "metric.h" |
| 104 |
#include "evolution.h" |
| 105 |
#include "param.h" |
| 106 |
#include "nbr_spx.h" |
| 107 |
#include "utilitaires.h" |
| 108 |
#include "graphique.h" |
| 109 |
|
| 110 |
using namespace Lorene ; |
| 111 |
|
| 112 |
int main() { |
| 113 |
|
| 114 |
//====================================================================== |
| 115 |
// Parameters of the computation |
| 116 |
//====================================================================== |
| 117 |
|
| 118 |
double pdt = 0.01 ; |
| 119 |
int jmax = 1000 ; |
| 120 |
int jstop = jmax ; |
| 121 |
bool compute_source = true ; |
| 122 |
|
| 123 |
double relativistic_init = 0. ; // 0 = flat space |
| 124 |
double ampli_h_init = 0.001 ; // 0 = flat space |
| 125 |
|
| 126 |
|
| 127 |
//====================================================================== |
| 128 |
// Construction and initialization of the various objects |
| 129 |
//====================================================================== |
| 130 |
|
| 131 |
// Setup of a multi-domain grid (Lorene class Mg3d) |
| 132 |
// ------------------------------------------------ |
| 133 |
|
| 134 |
int nz = 4 ; // Number of domains |
| 135 |
int nr = 17 ; // Number of collocation points in r in each domain |
| 136 |
int nt = 9 ; // Number of collocation points in theta in each domain |
| 137 |
int np = 8 ; // Number of collocation points in phi in each domain |
| 138 |
int symmetry_theta = SYM ; // symmetry with respect to the equatorial plane |
| 139 |
int symmetry_phi = SYM ; // no symmetry in phi |
| 140 |
bool compact = true ; // external domain is compactified |
| 141 |
|
| 142 |
// Multi-domain grid construction: |
| 143 |
Mg3d mgrid(nz, nr, nt, np, symmetry_theta, symmetry_phi, compact) ; |
| 144 |
|
| 145 |
cout << mgrid << endl ; |
| 146 |
|
| 147 |
|
| 148 |
// Setup of an affine mapping : grid --> physical space (Lorene class Map_af) |
| 149 |
// -------------------------------------------------------------------------- |
| 150 |
|
| 151 |
// radial boundaries of each domain: |
| 152 |
double r_limits[] = {0., 1., 2., 4., __infinity} ; |
| 153 |
assert( nz == 4 ) ; // since the above array described only 3 domains |
| 154 |
|
| 155 |
Map_af map(mgrid, r_limits) ; // Mapping construction |
| 156 |
|
| 157 |
cout << map << endl ; |
| 158 |
|
| 159 |
// Flat metric f |
| 160 |
// ------------- |
| 161 |
|
| 162 |
const Metric_flat& ff = map.flat_met_spher() ; |
| 163 |
|
| 164 |
// Triad orthonormal with respect to the flat metric f |
| 165 |
// ---------------------------------------------------- |
| 166 |
|
| 167 |
const Base_vect_spher& otriad = map.get_bvect_spher() ; |
| 168 |
|
| 169 |
|
| 170 |
// Set up of tensor h |
| 171 |
// ------------------ |
| 172 |
|
| 173 |
Sym_tensor_trans hh_init(map, otriad, ff) ; // hh is a transverse tensor |
| 174 |
// with respect to the flat metric |
| 175 |
// thanks to Dirac gauge |
| 176 |
|
| 177 |
// Test with the tensor h^{ij} = D^i D^j Phi with Lap(Phi) = 0 |
| 178 |
|
| 179 |
const Coord& x = map.x ; |
| 180 |
const Coord& y = map.y ; |
| 181 |
// const Coord& z = map.z ; |
| 182 |
const Coord& r = map.r ; |
| 183 |
//const Coord& cost = map.cost ; |
| 184 |
//const Coord& sint = map.sint ; |
| 185 |
//const Coord& cosp = map.cosp ; |
| 186 |
// const Coord& sinp = map.sinp ; |
| 187 |
|
| 188 |
Scalar khi_init(map) ; |
| 189 |
|
| 190 |
khi_init = ampli_h_init * exp( - r*r ) * x*y ; |
| 191 |
|
| 192 |
//khi_init = ampli_h_init * (3*cost*cost-1) / |
| 193 |
// ( (r*r + 1./(r*r)) * sqrt(1.+r*r) ) ; |
| 194 |
khi_init.std_spectral_base() ; |
| 195 |
|
| 196 |
khi_init.smooth_decay(2, 1) ; |
| 197 |
|
| 198 |
//## |
| 199 |
// des_meridian(khi_init, 0., 3., "khi_init before", 1) ; |
| 200 |
// arrete() ; |
| 201 |
// khi_init.smooth_decay(3, 4) ; |
| 202 |
// khi_init.spectral_display("khi_init") ; |
| 203 |
// des_meridian(khi_init, 0., 3., "khi_init after", 2) ; |
| 204 |
// arrete() ; |
| 205 |
//## |
| 206 |
|
| 207 |
Scalar mu_init(map) ; |
| 208 |
mu_init = 0. * ampli_h_init / (1+r*r*r*r*r*r) ; |
| 209 |
mu_init.std_spectral_base() ; |
| 210 |
mu_init.mult_r() ; |
| 211 |
mu_init.mult_r() ; |
| 212 |
mu_init.mult_r() ; |
| 213 |
mu_init.mult_cost() ; |
| 214 |
|
| 215 |
//## |
| 216 |
// des_meridian(mu_init, 0., 3., "mu_init before", 1) ; |
| 217 |
// arrete() ; |
| 218 |
// mu_init.smooth_decay(3, 4) ; |
| 219 |
// mu_init.spectral_display("mu_init") ; |
| 220 |
// des_meridian(mu_init, 0., 3., "mu_init after", 2) ; |
| 221 |
// arrete() ; |
| 222 |
//## |
| 223 |
|
| 224 |
|
| 225 |
Sym_tensor_tt htt_init(map, otriad, ff) ; // htt is the TT part of hh |
| 226 |
|
| 227 |
htt_init.set_khi_mu(khi_init, mu_init) ; |
| 228 |
|
| 229 |
hh_init = htt_init ; |
| 230 |
|
| 231 |
// des_meridian(hh_init, 0., 5., "hh_init") ; |
| 232 |
maxabs( hh_init.divergence(ff), "Divergence of hh_init") ; |
| 233 |
maxabs( hh_init.trace(ff), "Trace of hh_init") ; |
| 234 |
|
| 235 |
arrete() ; |
| 236 |
|
| 237 |
// Set up of field Q = Psi^2 N |
| 238 |
// --------------------------- |
| 239 |
|
| 240 |
Scalar qq_init(map) ; |
| 241 |
Scalar tmp(map) ; |
| 242 |
|
| 243 |
qq_init = 1. - relativistic_init / (1. + r*r) ; |
| 244 |
|
| 245 |
qq_init.std_spectral_base() ; // sets standard spectral bases |
| 246 |
|
| 247 |
|
| 248 |
// Set up of conformal metric gamma_tilde |
| 249 |
// -------------------------------------- |
| 250 |
|
| 251 |
Metric tgam( ff.con() ) ; // construction from the flat metric |
| 252 |
|
| 253 |
tgam = ff.con() + hh_init ; // initialization [ Eq. (51) ] |
| 254 |
|
| 255 |
|
| 256 |
// Set up of shift vector beta |
| 257 |
// --------------------------- |
| 258 |
|
| 259 |
Vector beta_init(map, CON, otriad ) ; |
| 260 |
beta_init.set_etat_zero() ; |
| 261 |
|
| 262 |
// Set up of lapse function N |
| 263 |
// -------------------------- |
| 264 |
|
| 265 |
Scalar nn_init(map) ; |
| 266 |
|
| 267 |
nn_init = 1. - relativistic_init / sqrt(1. + r*r) ; |
| 268 |
|
| 269 |
nn_init.std_spectral_base() ; // sets standard spectral bases |
| 270 |
|
| 271 |
// Working stuff |
| 272 |
// ------------- |
| 273 |
|
| 274 |
Scalar tmp0(map) ; |
| 275 |
Sym_tensor sym_tmp(map, CON, otriad) ; |
| 276 |
|
| 277 |
//====================================================================== |
| 278 |
// Start of time evolution |
| 279 |
//====================================================================== |
| 280 |
|
| 281 |
double ttime = 0. ; |
| 282 |
int jtime = 0 ; |
| 283 |
|
| 284 |
Evolution_std<Scalar> nn_time(nn_init, 3) ; |
| 285 |
Evolution_std<Vector> beta_time(beta_init, 3) ; |
| 286 |
Evolution_std<Scalar> qq_time(qq_init, 3) ; |
| 287 |
Evolution_std<Sym_tensor_trans> hh_time(hh_init, 3) ; |
| 288 |
Evolution_std<Scalar> khi_time(khi_init, 3) ; |
| 289 |
Evolution_std<Scalar> mu_time(mu_init, 3) ; |
| 290 |
|
| 291 |
ttime += pdt ; |
| 292 |
jtime++ ; |
| 293 |
nn_time.update(nn_init, jtime, ttime) ; |
| 294 |
beta_time.update(beta_init, jtime, ttime) ; |
| 295 |
qq_time.update(qq_init, jtime, ttime) ; |
| 296 |
hh_time.update(hh_init, jtime, ttime) ; |
| 297 |
khi_time.update(khi_init, jtime, ttime) ; |
| 298 |
mu_time.update(mu_init, jtime, ttime) ; |
| 299 |
|
| 300 |
ttime += pdt ; |
| 301 |
jtime++ ; |
| 302 |
nn_time.update(nn_init, jtime, ttime) ; |
| 303 |
beta_time.update(beta_init, jtime, ttime) ; |
| 304 |
qq_time.update(qq_init, jtime, ttime) ; |
| 305 |
hh_time.update(hh_init, jtime, ttime) ; |
| 306 |
khi_time.update(khi_init, jtime, ttime) ; |
| 307 |
mu_time.update(mu_init, jtime, ttime) ; |
| 308 |
|
| 309 |
|
| 310 |
// Parameters for the d'Alembert equations |
| 311 |
// ---------------------------------------- |
| 312 |
int bc = 2 ; // type of boundary condition : 2 = Bayliss & Turkel outgoing wave |
| 313 |
|
| 314 |
Param par_khi ; |
| 315 |
par_khi.add_double(pdt) ; |
| 316 |
par_khi.add_int(bc) ; |
| 317 |
int *workflag_khi = new int(0) ; // working flag |
| 318 |
par_khi.add_int_mod(*workflag_khi) ; |
| 319 |
|
| 320 |
Param par_mu ; |
| 321 |
par_mu.add_double(pdt) ; |
| 322 |
par_mu.add_int(bc) ; |
| 323 |
int *workflag_mu = new int(0) ; // working flag |
| 324 |
par_mu.add_int_mod(*workflag_mu) ; |
| 325 |
|
| 326 |
|
| 327 |
for (jtime = 2; jtime <= jmax; jtime++) { |
| 328 |
|
| 329 |
cout << |
| 330 |
"==============================================================\n" |
| 331 |
<< " step: " << jtime << " time = " << ttime << endl |
| 332 |
<< "==============================================================\n" ; |
| 333 |
|
| 334 |
// Values at time step jtime: |
| 335 |
const Scalar& nn = nn_time[jtime] ; |
| 336 |
const Vector& beta = beta_time[jtime] ; |
| 337 |
const Scalar& qq = qq_time[jtime] ; |
| 338 |
const Sym_tensor_trans& hh = hh_time[jtime] ; |
| 339 |
|
| 340 |
// Time derivatives: |
| 341 |
Scalar nn_point = nn_time.time_derive(jtime) ; |
| 342 |
nn_point.inc_dzpuis(2) ; // dzpuis : 0 -> 2 |
| 343 |
|
| 344 |
Vector beta_point = beta_time.time_derive(jtime) ; |
| 345 |
beta_point.inc_dzpuis(2) ; // dzpuis : 0 -> 2 |
| 346 |
|
| 347 |
Sym_tensor_trans hh_point = hh_time.time_derive(jtime) ; |
| 348 |
hh_point.inc_dzpuis(2) ; // dzpuis : 0 -> 2 |
| 349 |
|
| 350 |
// Sources of the Einstein equations: |
| 351 |
Scalar source_nn(map) ; |
| 352 |
Vector source_beta(map, CON, otriad) ; |
| 353 |
Scalar source_qq(map) ; |
| 354 |
Sym_tensor source_hh(map, CON, otriad) ; |
| 355 |
|
| 356 |
if (compute_source) { |
| 357 |
//============================================== |
| 358 |
// Definition of references on derivatives: |
| 359 |
// the source objects should not be modified |
| 360 |
// in this scope |
| 361 |
//============================================== |
| 362 |
|
| 363 |
Scalar psi = sqrt(qq / nn) ; |
| 364 |
psi.std_spectral_base() ; |
| 365 |
|
| 366 |
Scalar ln_psi = log( psi ) ; |
| 367 |
ln_psi.std_spectral_base() ; |
| 368 |
Scalar psi2 = psi * psi ; |
| 369 |
Scalar psi4 = psi2 * psi2 ; |
| 370 |
|
| 371 |
const Sym_tensor& tgam_dd = tgam.cov() ; // {\tilde \gamma}_{ij} |
| 372 |
const Sym_tensor& tgam_uu = tgam.con() ; // {\tilde \gamma}^{ij} |
| 373 |
const Tensor_sym& dtgam = tgam_dd.derive_cov(ff) ; |
| 374 |
// D_k {\tilde \gamma}_{ij} |
| 375 |
const Tensor_sym& dhh = hh.derive_cov(ff) ; // D_k h^{ij} |
| 376 |
const Vector& dln_psi = ln_psi.derive_cov(ff) ; // D_i ln(Psi) |
| 377 |
const Vector& tdln_psi_u = ln_psi.derive_con(tgam) ; // tD^i ln(Psi) |
| 378 |
const Vector& dnn = nn.derive_cov(ff) ; // D_i N |
| 379 |
const Vector& tdnn_u = nn.derive_con(tgam) ; // tD^i N |
| 380 |
const Vector& dqq = qq.derive_cov(ff) ; // D_i Q |
| 381 |
const Scalar& div_beta = beta.divergence(ff) ; // D_k beta^k |
| 382 |
|
| 383 |
// Conformal Killing operator applied to beta |
| 384 |
// ------------------------------------------ |
| 385 |
Sym_tensor l_beta(map, CON, otriad) ; // (L beta)^{ij} |
| 386 |
for (int i=1; i<=3; i++) { |
| 387 |
for (int j=1; j<=i; j++) { |
| 388 |
l_beta.set(i,j) = beta.derive_con(ff)(i,j) |
| 389 |
+ beta.derive_con(ff)(j,i) |
| 390 |
- 0.6666666666666666* div_beta * ff.con()(i,j) ; |
| 391 |
} |
| 392 |
} |
| 393 |
|
| 394 |
// Conformal extrinsic curvature A |
| 395 |
// ------------------------------- |
| 396 |
Sym_tensor aa(map, CON, otriad) ; // A^{ij} |
| 397 |
|
| 398 |
aa = ( hh_point - hh.derive_lie(beta) + l_beta |
| 399 |
- 0.6666666666666666 * div_beta * hh ) / (2.*nn) ; |
| 400 |
|
| 401 |
Sym_tensor taa(map, COV, otriad) ; // {\tilde A}_{ij} |
| 402 |
taa = aa.up_down(tgam) ; |
| 403 |
|
| 404 |
des_meridian(aa(2,3), 0., 5., "A\\u\\gh\\gf\\d", 20) ; |
| 405 |
des_meridian(aa(3,3), 0., 5., "A\\u\\gf\\gf\\d", 21) ; |
| 406 |
|
| 407 |
|
| 408 |
// Source for Q [ Eq. (76) ] |
| 409 |
// ------------ |
| 410 |
|
| 411 |
Scalar aa_quad = contract(taa, 0, 1, aa, 0, 1) ; |
| 412 |
|
| 413 |
source_qq = 0.75 * psi4 * qq * aa_quad ; |
| 414 |
|
| 415 |
tmp = contract( hh, 0, 1, dqq.derive_cov(ff), 0, 1 ) ; |
| 416 |
tmp.inc_dzpuis() ; |
| 417 |
|
| 418 |
source_qq -= tmp ; |
| 419 |
|
| 420 |
tmp = 0.0625 * contract( dhh, 0, 1, dtgam, 0, 1 ).trace(tgam) |
| 421 |
- 0.125 * contract( dhh, 0, 1, dtgam, 0, 2 ).trace(tgam) |
| 422 |
+ 2.* contract( contract( tgam_uu, 0, dln_psi, 0), 0, |
| 423 |
dln_psi, 0 ) ; |
| 424 |
|
| 425 |
tmp0 = 2. * contract( tgam_uu, 0, 1, |
| 426 |
dln_psi * dnn, 0, 1) ; |
| 427 |
|
| 428 |
source_qq += psi2 * ( nn * tmp + tmp0 ) ; |
| 429 |
|
| 430 |
// source_qq.spectral_display("source_qq") ; |
| 431 |
|
| 432 |
|
| 433 |
// Source for N [ Eq. (80) ] |
| 434 |
// ------------ |
| 435 |
|
| 436 |
source_nn = psi4 * nn * aa_quad ; |
| 437 |
|
| 438 |
tmp = contract( hh, 0, 1, dnn.derive_cov(ff), 0, 1 ) ; |
| 439 |
tmp.inc_dzpuis() ; |
| 440 |
|
| 441 |
source_nn -= tmp + tmp0 ; |
| 442 |
|
| 443 |
// source_nn.spectral_display("source_nn") ; |
| 444 |
|
| 445 |
// Source for beta [ Eq. (79) ] |
| 446 |
// --------------- |
| 447 |
|
| 448 |
source_beta = 2. * ( contract(aa, 1, |
| 449 |
dnn - 6.*nn * dln_psi, 0) |
| 450 |
- nn * contract(tgam.connect().get_delta(), 1, 2, aa, 0, 1) ) ; |
| 451 |
|
| 452 |
Vector vtmp = contract(hh, 0, 1, |
| 453 |
beta.derive_cov(ff).derive_cov(ff), 1, 2) |
| 454 |
+ 0.3333333333333333 * |
| 455 |
contract(hh, 1, div_beta.derive_cov(ff), 0) ; |
| 456 |
vtmp.inc_dzpuis() ; // dzpuis: 3 -> 4 |
| 457 |
|
| 458 |
source_beta -= vtmp ; |
| 459 |
|
| 460 |
// source_beta.spectral_display("source_beta") ; |
| 461 |
|
| 462 |
|
| 463 |
// Quadratic part of the Ricci tensor of gam_tilde |
| 464 |
// ------------------------------------------------ |
| 465 |
|
| 466 |
Sym_tensor ricci_star(map, CON, otriad) ; |
| 467 |
|
| 468 |
ricci_star = contract(hh, 0, 1, dhh.derive_cov(ff), 2, 3) ; |
| 469 |
|
| 470 |
ricci_star.inc_dzpuis() ; // dzpuis : 3 --> 4 |
| 471 |
|
| 472 |
|
| 473 |
for (int i=1; i<=3; i++) { |
| 474 |
for (int j=1; j<=i; j++) { |
| 475 |
tmp = 0 ; |
| 476 |
for (int k=1; k<=3; k++) { |
| 477 |
for (int l=1; l<=3; l++) { |
| 478 |
tmp += dhh(i,k,l) * dhh(j,l,k) ; |
| 479 |
} |
| 480 |
} |
| 481 |
sym_tmp.set(i,j) = tmp ; |
| 482 |
} |
| 483 |
} |
| 484 |
ricci_star -= sym_tmp ; |
| 485 |
|
| 486 |
for (int i=1; i<=3; i++) { |
| 487 |
for (int j=1; j<=i; j++) { |
| 488 |
tmp = 0 ; |
| 489 |
for (int k=1; k<=3; k++) { |
| 490 |
for (int l=1; l<=3; l++) { |
| 491 |
for (int m=1; m<=3; m++) { |
| 492 |
for (int n=1; n<=3; n++) { |
| 493 |
|
| 494 |
tmp += 0.5 * tgam_uu(i,k)*tgam_uu(j,l) * dhh(m,n,k) * dtgam(m,n,l) |
| 495 |
+ tgam_dd(n,l) * dhh(m,n,k) * ( tgam_uu(i,k) * dhh(j,l,m) |
| 496 |
+ tgam_uu(j,k) * dhh(i,l,m) ) |
| 497 |
- tgam_dd(k,l) * tgam_uu(m,n) * dhh(i,k,m) * dhh(j,l,n) ; |
| 498 |
} |
| 499 |
} |
| 500 |
} |
| 501 |
} |
| 502 |
sym_tmp.set(i,j) = tmp ; |
| 503 |
} |
| 504 |
} |
| 505 |
ricci_star += sym_tmp ; |
| 506 |
|
| 507 |
ricci_star = 0.5 * ricci_star ; |
| 508 |
|
| 509 |
// des_meridian(ricci_star(1,1), 0., 4., "Ricci_star^rr", 12) ; |
| 510 |
|
| 511 |
// Curvature scalar of conformal metric : |
| 512 |
// ------------------------------------- |
| 513 |
|
| 514 |
Scalar tricci_scal = |
| 515 |
0.25 * contract( tgam_uu, 0, 1, |
| 516 |
contract(dhh, 0, 1, dtgam, 0, 1), 0, 1 ) |
| 517 |
- 0.5 * contract( tgam_uu, 0, 1, |
| 518 |
contract(dhh, 0, 1, dtgam, 0, 2), 0, 1 ) ; |
| 519 |
|
| 520 |
// Full quadratic part of source for h : S^{ij} |
| 521 |
// -------------------------------------------- |
| 522 |
|
| 523 |
Sym_tensor ss(map, CON, otriad) ; |
| 524 |
|
| 525 |
sym_tmp = nn * (ricci_star + 8.* tdln_psi_u * tdln_psi_u) |
| 526 |
+ 4.*( tdln_psi_u * tdnn_u + tdnn_u * tdln_psi_u ) |
| 527 |
- 0.3333333333333333 * ( |
| 528 |
nn * (tricci_scal |
| 529 |
+ 8.* contract(dln_psi, 0, tdln_psi_u, 0) ) |
| 530 |
+ 8.* contract(dln_psi, 0, tdnn_u, 0) ) * tgam_uu ; |
| 531 |
|
| 532 |
ss = sym_tmp / psi4 ; |
| 533 |
|
| 534 |
sym_tmp = contract( tgam_uu, 1, |
| 535 |
contract(tgam_uu, 1, dqq.derive_cov(ff), 0), 1) ; |
| 536 |
|
| 537 |
sym_tmp.inc_dzpuis() ; // dzpuis : 3 --> 4 |
| 538 |
|
| 539 |
for (int i=1; i<=3; i++) { |
| 540 |
for (int j=1; j<=i; j++) { |
| 541 |
tmp = 0 ; |
| 542 |
for (int k=1; k<=3; k++) { |
| 543 |
for (int l=1; l<=3; l++) { |
| 544 |
tmp += ( hh(i,k)*dhh(l,j,k) + hh(k,j)*dhh(i,l,k) |
| 545 |
- hh(k,l)*dhh(i,j,k) ) * dqq(l) ; |
| 546 |
} |
| 547 |
} |
| 548 |
sym_tmp.set(i,j) += 0.5 * tmp ; |
| 549 |
} |
| 550 |
} |
| 551 |
|
| 552 |
tmp = qq.derive_con(tgam).divergence(tgam) ; |
| 553 |
tmp.inc_dzpuis() ; // dzpuis : 3 --> 4 |
| 554 |
|
| 555 |
sym_tmp -= 0.3333333333333333 * tmp * tgam_uu ; |
| 556 |
|
| 557 |
ss -= sym_tmp / (psi4*psi2) ; |
| 558 |
|
| 559 |
for (int i=1; i<=3; i++) { |
| 560 |
for (int j=1; j<=i; j++) { |
| 561 |
tmp = 0 ; |
| 562 |
for (int k=1; k<=3; k++) { |
| 563 |
for (int l=1; l<=3; l++) { |
| 564 |
tmp += tgam_dd(k,l) * aa(i,k) * aa(j,l) ; |
| 565 |
} |
| 566 |
} |
| 567 |
sym_tmp.set(i,j) = 2. * tmp ; |
| 568 |
} |
| 569 |
} |
| 570 |
|
| 571 |
ss += nn * sym_tmp ; |
| 572 |
|
| 573 |
// Source for h |
| 574 |
// ------------ |
| 575 |
|
| 576 |
Sym_tensor lbh = hh.derive_lie(beta) ; |
| 577 |
|
| 578 |
source_hh = (nn*nn/psi4 - 1.) * hh.derive_con(ff).divergence(ff) |
| 579 |
+ 2.* hh_point.derive_lie(beta) - lbh.derive_lie(beta) ; |
| 580 |
source_hh.inc_dzpuis() ; |
| 581 |
|
| 582 |
source_hh += 2.* nn * ss ; |
| 583 |
|
| 584 |
//## Provisory: waiting for the Lie derivative to allow |
| 585 |
// derivation with respect to a vector with dzpuis != 0 |
| 586 |
vtmp = beta_point ; |
| 587 |
vtmp.dec_dzpuis(2) ; |
| 588 |
sym_tmp = hh.derive_lie(vtmp) ; |
| 589 |
sym_tmp.inc_dzpuis(2) ; |
| 590 |
|
| 591 |
source_hh += sym_tmp |
| 592 |
+ 1.3333333333333333 * div_beta* (hh_point - lbh) |
| 593 |
+ 2. * (nn_point - nn.derive_lie(beta)) * aa ; |
| 594 |
|
| 595 |
|
| 596 |
for (int i=1; i<=3; i++) { |
| 597 |
for (int j=1; j<=i; j++) { |
| 598 |
tmp = 0 ; |
| 599 |
for (int k=1; k<=3; k++) { |
| 600 |
tmp += ( hh.derive_con(ff)(k,j,i) |
| 601 |
+ hh.derive_con(ff)(i,k,j) |
| 602 |
- hh.derive_con(ff)(i,j,k) ) * dqq(k) ; |
| 603 |
} |
| 604 |
sym_tmp.set(i,j) = tmp ; |
| 605 |
} |
| 606 |
} |
| 607 |
|
| 608 |
source_hh -= nn / (psi4*psi2) * sym_tmp ; |
| 609 |
|
| 610 |
tmp = beta_point.divergence(ff) - div_beta.derive_lie(beta) ; |
| 611 |
tmp.inc_dzpuis() ; |
| 612 |
source_hh += 0.6666666666666666* ( tmp |
| 613 |
- 0.6666666666666666* div_beta * div_beta ) * hh ; |
| 614 |
|
| 615 |
|
| 616 |
// (L beta_point)^ij --> sym_tmp |
| 617 |
for (int i=1; i<=3; i++) { |
| 618 |
for (int j=1; j<=i; j++) { |
| 619 |
sym_tmp.set(i,j) = beta_point.derive_con(ff)(i,j) |
| 620 |
+ beta_point.derive_con(ff)(j,i) |
| 621 |
- 0.6666666666666666* |
| 622 |
beta_point.divergence(ff) * ff.con()(i,j) ; |
| 623 |
} |
| 624 |
} |
| 625 |
sym_tmp -= l_beta.derive_lie(beta) ; |
| 626 |
sym_tmp.inc_dzpuis() ; |
| 627 |
|
| 628 |
source_hh += 0.6666666666666666* div_beta * l_beta - sym_tmp ; |
| 629 |
|
| 630 |
// des_meridian(source_hh(1,1), 0., 2., "source_hh^rr", 10) ; |
| 631 |
|
| 632 |
source_hh.spectral_display("source_hh") ; |
| 633 |
maxabs(source_hh, "Maxabs source_hh") ; |
| 634 |
|
| 635 |
maxabs( source_hh.divergence(ff), "Divergence of source_hh") ; |
| 636 |
maxabs( source_hh.transverse(ff).divergence(ff), |
| 637 |
"Divergence of source_hh_transverse") ; |
| 638 |
maxabs( source_hh.transverse(ff).trace(ff), |
| 639 |
"Trace of source_hh_transverse") ; |
| 640 |
|
| 641 |
arrete(jtime%jstop) ; |
| 642 |
|
| 643 |
} |
| 644 |
else{ |
| 645 |
source_hh.set_etat_zero() ; |
| 646 |
} |
| 647 |
//============================================== |
| 648 |
// End of scope for references on derivatives |
| 649 |
//============================================== |
| 650 |
|
| 651 |
//============================================= |
| 652 |
// Resolution of elliptic equations |
| 653 |
//============================================= |
| 654 |
|
| 655 |
// Resolution of the Poisson equation for the lapse |
| 656 |
// ------------------------------------------------ |
| 657 |
|
| 658 |
Scalar nn_jp1 = source_nn.poisson() + 1. ; |
| 659 |
|
| 660 |
//des_meridian(nn_jp1, 0., 5., "N", 40) ; |
| 661 |
|
| 662 |
// Resolution of the Poisson equation for Q |
| 663 |
// ----------------------------------------- |
| 664 |
|
| 665 |
Scalar qq_jp1 = source_qq.poisson() + 1. ; |
| 666 |
|
| 667 |
// des_meridian(qq_jp1, 0., 5., "Q", 41) ; |
| 668 |
|
| 669 |
// Resolution of the vector Poisson equation for the shift |
| 670 |
//--------------------------------------------------------- |
| 671 |
|
| 672 |
Vector beta_jp1 = source_beta.poisson(0.3333333333333333, 0) ; |
| 673 |
des_meridian(beta_jp1(1), 0., 5., "\\gb\\ur\\d", 42) ; |
| 674 |
des_meridian(beta_jp1(2), 0., 5., "\\gb\\u\\gh\\d", 43) ; |
| 675 |
des_meridian(beta_jp1(3), 0., 5., "\\gb\\u\\gf\\d", 44) ; |
| 676 |
|
| 677 |
// Test: |
| 678 |
Vector test_beta = (beta_jp1.derive_con(ff)).divergence(ff) |
| 679 |
+ 0.3333333333333333 * (beta_jp1.divergence(ff)).derive_con(ff) ; |
| 680 |
test_beta.inc_dzpuis() ; |
| 681 |
cout << "Relative error in the resolution of the shift equation: \n" ; |
| 682 |
diffrel(test_beta, source_beta) ; |
| 683 |
diffrelmax(test_beta, source_beta) ; |
| 684 |
// arrete() ; |
| 685 |
|
| 686 |
|
| 687 |
//============================================= |
| 688 |
// Resolution of wave equation for h |
| 689 |
//============================================= |
| 690 |
|
| 691 |
const Sym_tensor_tt& source_htt = source_hh.transverse(ff).tt_part() ; |
| 692 |
|
| 693 |
//## Sym_tensor_tt source_htt(map, otriad, ff) ; |
| 694 |
//## source_htt.set_etat_zero() ; |
| 695 |
|
| 696 |
maxabs( source_htt.divergence(ff), "Divergence of source_htt") ; |
| 697 |
maxabs( source_htt.trace(ff), "Trace of source_hhtt") ; |
| 698 |
|
| 699 |
const Scalar& khi_source = source_htt.khi() ; |
| 700 |
|
| 701 |
const Scalar& mu_source = source_htt.mu() ; |
| 702 |
|
| 703 |
// des_meridian(khi_source, 0., 2., "khi_source", 11) ; |
| 704 |
|
| 705 |
Scalar khi_jp1 = khi_time[jtime].avance_dalembert(par_khi, |
| 706 |
khi_time[jtime-1], khi_source) ; |
| 707 |
khi_jp1.smooth_decay(2,2) ; |
| 708 |
|
| 709 |
// des_meridian(khi_jp1, 0., 5., "khi_jp1", 12) ; |
| 710 |
|
| 711 |
// const Scalar* khides[] = {&khi_jp1, &(khi_time[jtime]), |
| 712 |
// &(khi_time[jtime-1])} ; |
| 713 |
// double thetades[] = {0., 0., 0.} ; |
| 714 |
// double phides[] = {0., 0., 0.} ; |
| 715 |
// des_profile_mult(khides, 3, 0., 4., thetades, phides, 1, false, "khi") ; |
| 716 |
|
| 717 |
maxabs(khi_jp1 - khi_time[jtime], "Variation of khi") ; |
| 718 |
|
| 719 |
Scalar mu_jp1 = mu_time[jtime].avance_dalembert(par_mu, |
| 720 |
mu_time[jtime-1], mu_source) ; |
| 721 |
mu_jp1.smooth_decay(2,2) ; |
| 722 |
|
| 723 |
// des_meridian(mu_jp1, 0., 5., "mu_jp1", 14) ; |
| 724 |
|
| 725 |
|
| 726 |
Sym_tensor_tt htt_jp1(map, otriad, ff) ; |
| 727 |
|
| 728 |
htt_jp1.set_khi_mu(khi_jp1, mu_jp1) ; |
| 729 |
|
| 730 |
Sym_tensor_trans hh_jp1 = htt_jp1 ; //## the trace should be added |
| 731 |
|
| 732 |
// des_meridian(hh_jp1, 0., 5., "hh") ; |
| 733 |
des_meridian(hh(2,3), 0., 5., "h\\u\\gh\\gf\\d", 30) ; |
| 734 |
des_meridian(hh(3,3), 0., 5., "h\\u\\gf\\gf\\d", 31) ; |
| 735 |
|
| 736 |
// hh(2,3).visu_section('z', 0., -4., 4., -4., 4., "h^tp", "h_tp") ; |
| 737 |
|
| 738 |
hh(3,3).visu_section_anim('z', 0., -4., 4., -4., 4., jtime, ttime, 4, |
| 739 |
"h^pp", "hpp") ; |
| 740 |
|
| 741 |
cout << "Next step : " << jtime + 1 << endl ; |
| 742 |
arrete(jtime%jstop) ; |
| 743 |
|
| 744 |
// Next time step |
| 745 |
// -------------- |
| 746 |
|
| 747 |
ttime += pdt ; |
| 748 |
|
| 749 |
nn_time.update(nn_jp1, jtime+1, ttime) ; |
| 750 |
beta_time.update(beta_jp1, jtime+1, ttime) ; |
| 751 |
qq_time.update(qq_jp1, jtime+1, ttime) ; |
| 752 |
hh_time.update(hh_jp1, jtime+1, ttime) ; |
| 753 |
khi_time.update(khi_jp1, jtime+1, ttime) ; |
| 754 |
mu_time.update(mu_jp1, jtime+1, ttime) ; |
| 755 |
|
| 756 |
} |
| 757 |
|
| 758 |
|
| 759 |
par_khi.clean_all() ; |
| 760 |
par_mu.clean_all() ; |
| 761 |
|
| 762 |
return EXIT_SUCCESS ; |
| 763 |
} |
| 764 |
|