9 #define Z4c_APPLY_TO_FIELDS(function) \ 11 #define Z4c_APPLY_TO_FIELDS_ARGS(function, ...) \ 12 function(theta, __VA_ARGS__); 14 #define Z4c_APPLY_TO_FIELDS(function) 15 #define Z4c_APPLY_TO_FIELDS_ARGS(function, ...) 19 #define BSSN_APPLY_TO_SHIFT(function) \ 23 #define BSSN_APPLY_TO_SHIFT_ARGS(function, ...) \ 24 function(beta1, __VA_ARGS__); \ 25 function(beta2, __VA_ARGS__); \ 26 function(beta3, __VA_ARGS__); 27 #define BSSN_APPLY_TO_EXP_N(function) \ 29 #define BSSN_APPLY_TO_EXP_N_ARGS(function, ...) \ 30 function(expN, __VA_ARGS__); 32 #define BSSN_APPLY_TO_SHIFT(function) 33 #define BSSN_APPLY_TO_SHIFT_ARGS(function, ...) 34 #define BSSN_APPLY_TO_EXP_N(function) 35 #define BSSN_APPLY_TO_EXP_N_ARGS(function, ...) 39 #define BSSN_APPLY_TO_AUX_B(function) \ 43 #define BSSN_APPLY_TO_AUX_B_ARGS(function, ...) \ 44 function(auxB1, __VA_ARGS__); \ 45 function(auxB2, __VA_ARGS__); \ 46 function(auxB3, __VA_ARGS__); 48 #define BSSN_APPLY_TO_AUX_B(function) 49 #define BSSN_APPLY_TO_AUX_B_ARGS(function, ...) 53 #define BSSN_APPLY_TO_FIELDS_ARGS(function, ...) \ 54 function(DIFFgamma11, __VA_ARGS__); \ 55 function(DIFFgamma12, __VA_ARGS__); \ 56 function(DIFFgamma13, __VA_ARGS__); \ 57 function(DIFFgamma22, __VA_ARGS__); \ 58 function(DIFFgamma23, __VA_ARGS__); \ 59 function(DIFFgamma33, __VA_ARGS__); \ 60 function(DIFFphi, __VA_ARGS__); \ 61 function(A11, __VA_ARGS__); \ 62 function(A12, __VA_ARGS__); \ 63 function(A13, __VA_ARGS__); \ 64 function(A22, __VA_ARGS__); \ 65 function(A23, __VA_ARGS__); \ 66 function(A33, __VA_ARGS__); \ 67 function(DIFFK, __VA_ARGS__); \ 68 function(Gamma1, __VA_ARGS__); \ 69 function(Gamma2, __VA_ARGS__); \ 70 function(Gamma3, __VA_ARGS__); \ 71 function(DIFFalpha, __VA_ARGS__); \ 72 Z4c_APPLY_TO_FIELDS_ARGS(function, __VA_ARGS__) \ 73 BSSN_APPLY_TO_SHIFT_ARGS(function, __VA_ARGS__) \ 74 BSSN_APPLY_TO_AUX_B_ARGS(function, __VA_ARGS__) \ 75 BSSN_APPLY_TO_EXP_N_ARGS(function, __VA_ARGS__) 77 #define BSSN_APPLY_TO_FIELDS(function) \ 78 function(DIFFgamma11); \ 79 function(DIFFgamma12); \ 80 function(DIFFgamma13); \ 81 function(DIFFgamma22); \ 82 function(DIFFgamma23); \ 83 function(DIFFgamma33); \ 95 function(DIFFalpha); \ 96 Z4c_APPLY_TO_FIELDS(function) \ 97 BSSN_APPLY_TO_SHIFT(function) \ 98 BSSN_APPLY_TO_AUX_B(function) \ 99 BSSN_APPLY_TO_EXP_N(function) 101 #define BSSN_APPLY_TO_SOURCES(function) \ 114 #if USE_GENERALIZED_NEWTON 115 #define BSSN_APPLY_TO_GEN1_EXTRAS(function) \ 119 function(GNricciTF11); \ 120 function(GNricciTF22); \ 121 function(GNricciTF33); \ 122 function(GNricciTF12); \ 123 function(GNricciTF13); \ 124 function(GNricciTF23); \ 125 function(GND2Alpha); \ 126 function(GNDiDjRijTFoD2); 128 #define BSSN_APPLY_TO_GEN1_EXTRAS(function) \ 135 #define BSSN_APPLY_TO_IJ_PERMS(function) \ 144 #define BSSN_APPLY_TO_IJK_PERMS(function) \ 165 #define BSSN_ZERO_FIELD(field, reg, idx) \ 166 field->_array##reg[idx] = 0.0; 168 #define BSSN_ZERO_ARRAYS(reg, idx) \ 169 BSSN_APPLY_TO_FIELDS_ARGS(BSSN_ZERO_FIELD, reg, idx) 173 #define BSSN_ZERO_GEN1_FIELD(field) \ 174 field##_a[idx] = 0.0; 177 #define BSSN_ZERO_GEN1_EXTRAS() \ 178 BSSN_APPLY_TO_GEN1_EXTRAS(BSSN_ZERO_GEN1_FIELD) 181 #define BSSN_ZERO_SOURCES() \ 182 BSSN_APPLY_TO_SOURCES(BSSN_ZERO_GEN1_FIELD) 186 #define BSSN_RK_INITIALIZE_FIELD(field) \ 189 #define BSSN_RK_INITIALIZE \ 190 BSSN_APPLY_TO_FIELDS(BSSN_RK_INITIALIZE_FIELD) 194 #define BSSN_RK_EVOLVE_PT_FIELD(field) \ 195 field->_array_c[bd->idx] = ev_##field(bd); 197 #define BSSN_RK_EVOLVE_PT \ 198 BSSN_APPLY_TO_FIELDS(BSSN_RK_EVOLVE_PT_FIELD) 202 #define BSSN_FINALIZE_K_FIELD(field, n) \ 203 field->K##n##Finalize(); 205 #define BSSN_FINALIZE_K(n) \ 206 BSSN_APPLY_TO_FIELDS_ARGS(BSSN_FINALIZE_K_FIELD, n) 210 #define BSSN_SET_DT_FIELD(field, dt) \ 213 #define BSSN_SET_DT(dt) \ 214 BSSN_APPLY_TO_FIELDS_ARGS(BSSN_SET_DT_FIELD, dt) 221 #define BSSN_CALCULATE_CHRISTOFFEL(I, J, K) bd->G##I##J##K = 0.5*( \ 222 bd->gammai##I##1 * (bd->d##J##g##K##1 + bd->d##K##g##J##1 - bd->d1g##J##K) + \ 223 bd->gammai##I##2 * (bd->d##J##g##K##2 + bd->d##K##g##J##2 - bd->d2g##J##K) + \ 224 bd->gammai##I##3 * (bd->d##J##g##K##3 + bd->d##K##g##J##3 - bd->d3g##J##K) \ 227 #define BSSN_CALCULATE_CHRISTOFFEL_LOWER(I, J, K) bd->GL##I##J##K = 0.5*( \ 228 bd->d##J##g##K##I + bd->d##K##g##J##I - bd->d##I##g##J##K \ 231 #define BSSN_CALCULATE_DGAMMA(I, J, K) bd->d##I##g##J##K = derivative(bd->i, bd->j, bd->k, I, DIFFgamma##J##K->_array_a); 233 #define BSSN_CALCULATE_ACONT(I, J) bd->Acont##I##J = ( \ 234 bd->gammai##I##1*bd->gammai##J##1*bd->A11 + bd->gammai##I##2*bd->gammai##J##1*bd->A21 + bd->gammai##I##3*bd->gammai##J##1*bd->A31 \ 235 + bd->gammai##I##1*bd->gammai##J##2*bd->A12 + bd->gammai##I##2*bd->gammai##J##2*bd->A22 + bd->gammai##I##3*bd->gammai##J##2*bd->A32 \ 236 + bd->gammai##I##1*bd->gammai##J##3*bd->A13 + bd->gammai##I##2*bd->gammai##J##3*bd->A23 + bd->gammai##I##3*bd->gammai##J##3*bd->A33 \ 241 #define BSSN_CALCULATE_DIDJALPHA(I, J) bd->D##I##D##J##aTF = double_derivative(bd->i, bd->j, bd->k, I, J, DIFFalpha->_array_a) - ( \ 242 (bd->G1##I##J + 2.0*( (1==I)*bd->d##J##phi + (1==J)*bd->d##I##phi - bd->gamma##I##J*gammai1ldlphi))*bd->d1a + \ 243 (bd->G2##I##J + 2.0*( (2==I)*bd->d##J##phi + (2==J)*bd->d##I##phi - bd->gamma##I##J*gammai2ldlphi))*bd->d2a + \ 244 (bd->G3##I##J + 2.0*( (3==I)*bd->d##J##phi + (3==J)*bd->d##I##phi - bd->gamma##I##J*gammai3ldlphi))*bd->d3a \ 248 #define BSSN_CALCULATE_RICCI_UNITARY_TERM1(K, L, I, J) \ 249 bd->gammai##K##L*bd->d##K##d##L##g##I##J 251 #define BSSN_CALCULATE_RICCI_UNITARY_TERM2(K, I, J) \ 252 bd->gamma##K##I*derivative(bd->i, bd->j, bd->k, J, Gamma##K->_array_a) 254 #define BSSN_CALCULATE_RICCI_UNITARY_TERM3(K, I, J) \ 255 bd->Gammad##K*bd->GL##I##J##K 257 #define BSSN_CALCULATE_RICCI_UNITARY_TERM4(K, L, M, I, J) \ 259 bd->G##K##L##I*bd->GL##J##K##M + bd->G##K##L##J*bd->GL##I##K##M \ 261 + 0.5*(bd->G##K##I##M*bd->GL##K##L##J + bd->G##K##J##M*bd->GL##K##L##I) \ 264 #define BSSN_CALCULATE_RICCI_UNITARY(I, J) bd->Uricci##I##J = ( \ 266 COSMO_SUMMATION_2_ARGS(BSSN_CALCULATE_RICCI_UNITARY_TERM1, I, J) \ 269 COSMO_SUMMATION_1_ARGS(BSSN_CALCULATE_RICCI_UNITARY_TERM2, I, J) \ 270 + COSMO_SUMMATION_1_ARGS(BSSN_CALCULATE_RICCI_UNITARY_TERM2, J, I) \ 273 COSMO_SUMMATION_1_ARGS(BSSN_CALCULATE_RICCI_UNITARY_TERM3, I, J) \ 274 + COSMO_SUMMATION_1_ARGS(BSSN_CALCULATE_RICCI_UNITARY_TERM3, J, I) \ 276 + COSMO_SUMMATION_3_ARGS(BSSN_CALCULATE_RICCI_UNITARY_TERM4, I, J) \ 279 #define BSSN_CALCULATE_DIDJGAMMA_PERMS(I, J) \ 280 bd->d##I##d##J##g11 = double_derivative(bd->i, bd->j, bd->k, I, J, DIFFgamma11->_array_a); \ 281 bd->d##I##d##J##g12 = double_derivative(bd->i, bd->j, bd->k, I, J, DIFFgamma12->_array_a); \ 282 bd->d##I##d##J##g13 = double_derivative(bd->i, bd->j, bd->k, I, J, DIFFgamma13->_array_a); \ 283 bd->d##I##d##J##g22 = double_derivative(bd->i, bd->j, bd->k, I, J, DIFFgamma22->_array_a); \ 284 bd->d##I##d##J##g23 = double_derivative(bd->i, bd->j, bd->k, I, J, DIFFgamma23->_array_a); \ 285 bd->d##I##d##J##g33 = double_derivative(bd->i, bd->j, bd->k, I, J, DIFFgamma33->_array_a) 293 #define BSSN_DT_DIFFGAMMAIJ(I, J) ( \ 294 - 2.0*bd->alpha*bd->A##I##J \ 296 + upwind_derivative(bd->i, bd->j, bd->k, 1, DIFFgamma##I##J->_array_a, bd->beta1) \ 297 + upwind_derivative(bd->i, bd->j, bd->k, 2, DIFFgamma##I##J->_array_a, bd->beta2) \ 298 + upwind_derivative(bd->i, bd->j, bd->k, 3, DIFFgamma##I##J->_array_a, bd->beta3) \ 299 + bd->gamma##I##1*bd->d##J##beta1 + bd->gamma##I##2*bd->d##J##beta2 + bd->gamma##I##3*bd->d##J##beta3 \ 300 + bd->gamma##J##1*bd->d##I##beta1 + bd->gamma##J##2*bd->d##I##beta2 + bd->gamma##J##3*bd->d##I##beta3 \ 301 - (2.0/3.0)*bd->gamma##I##J*(bd->d1beta1 + bd->d2beta2 + bd->d3beta3) \ 304 #define BSSN_DT_DIFFGAMMAIJ(I, J) ( \ 305 - 2.0*bd->alpha*bd->A##I##J \ 309 # define BSSN_DT_AIJ_SECOND_ORDER_AA(I, J) ( \ 310 bd->gammai11*bd->A1##I*bd->A1##J + bd->gammai12*bd->A1##I*bd->A2##J + bd->gammai13*bd->A1##I*bd->A3##J \ 311 + bd->gammai21*bd->A2##I*bd->A1##J + bd->gammai22*bd->A2##I*bd->A2##J + bd->gammai23*bd->A2##I*bd->A3##J \ 312 + bd->gammai31*bd->A3##I*bd->A1##J + bd->gammai32*bd->A3##I*bd->A2##J + bd->gammai33*bd->A3##I*bd->A3##J \ 315 # define BSSN_DT_AIJ_SECOND_ORDER_KA(I, J) ( \ 316 (bd->K + 2.0*bd->theta)*bd->A##I##J \ 320 #define BSSN_DT_AIJ(I, J) ( \ 321 exp(-4.0*bd->phi)*( bd->alpha*(bd->ricciTF##I##J - 8.0*PI*bd->STF##I##J) - bd->D##I##D##J##aTF ) \ 322 + bd->alpha*(BSSN_DT_AIJ_SECOND_ORDER_KA(I,J) - 2.0*BSSN_DT_AIJ_SECOND_ORDER_AA(I,J)) \ 326 + upwind_derivative(bd->i, bd->j, bd->k, 1, A##I##J->_array_a, bd->beta1) \ 327 + upwind_derivative(bd->i, bd->j, bd->k, 2, A##I##J->_array_a, bd->beta2) \ 328 + upwind_derivative(bd->i, bd->j, bd->k, 3, A##I##J->_array_a, bd->beta3) \ 329 + bd->A##I##1*bd->d##J##beta1 + bd->A##I##2*bd->d##J##beta2 + bd->A##I##3*bd->d##J##beta3 \ 330 + bd->A##J##1*bd->d##I##beta1 + bd->A##J##2*bd->d##I##beta2 + bd->A##J##3*bd->d##I##beta3 \ 331 - (2.0/3.0)*bd->A##I##J*(bd->d1beta1 + bd->d2beta2 + bd->d3beta3) \ 334 #define BSSN_DT_AIJ(I, J) ( \ 335 exp(-4.0*bd->phi)*( bd->alpha*(bd->ricciTF##I##J - 8.0*PI*bd->STF##I##J) - bd->D##I##D##J##aTF ) \ 336 + bd->alpha*(BSSN_DT_AIJ_SECOND_ORDER_KA(I,J) - 2.0*BSSN_DT_AIJ_SECOND_ORDER_AA(I,J)) \ 340 #define BSSN_DT_GAMMAI(I) (BSSN_DT_GAMMAI_NOSHIFT(I) + BSSN_DT_GAMMAI_SHIFT(I)) 342 #define BSSN_DT_GAMMAI_SECOND_ORDER(I) ( \ 343 bd->G##I##11*bd->Acont11 + bd->G##I##22*bd->Acont22 + bd->G##I##33*bd->Acont33 \ 344 + 2.0*(bd->G##I##12*bd->Acont12 + bd->G##I##13*bd->Acont13 + bd->G##I##23*bd->Acont23) \ 345 + 6.0*(bd->Acont##I##1*bd->d1phi + bd->Acont##I##2*bd->d2phi + bd->Acont##I##3*bd->d3phi) \ 348 #define BSSN_DT_GAMMAI_NOSHIFT(I) ( \ 349 - 2.0*(bd->Acont##I##1*bd->d1a + bd->Acont##I##2*bd->d2a + bd->Acont##I##3*bd->d3a) \ 351 + BSSN_DT_GAMMAI_SECOND_ORDER(I) \ 353 2.0*(bd->gammai##I##1*bd->d1K + bd->gammai##I##2*bd->d2K + bd->gammai##I##3*bd->d3K) \ 354 + bd->gammai##I##1*bd->d1theta + bd->gammai##I##2*bd->d2theta + bd->gammai##I##3*bd->d3theta \ 356 - 2.0*bd->alpha*Z4c_K1_DAMPING_AMPLITUDE*( \ 357 bd->Gamma##I - bd->Gammad##I \ 359 - 8.0*PI*(bd->gammai##I##1*bd->S1 + bd->gammai##I##2*bd->S2 + bd->gammai##I##3*bd->S3) \ 364 #define BSSN_DT_GAMMAI_SHIFT(I) ( \ 368 + upwind_derivative(bd->i, bd->j, bd->k, 1, Gamma##I->_array_a, bd->beta1) \ 369 + upwind_derivative(bd->i, bd->j, bd->k, 2, Gamma##I->_array_a, bd->beta2) \ 370 + upwind_derivative(bd->i, bd->j, bd->k, 3, Gamma##I->_array_a, bd->beta3) \ 371 - bd->Gammad1*bd->d1beta##I - bd->Gammad2*bd->d2beta##I - bd->Gammad3*bd->d3beta##I \ 372 + (2.0/3.0) * bd->Gammad##I * (bd->d1beta1 + bd->d2beta2 + bd->d3beta3) \ 374 bd->gammai##I##1*double_derivative(bd->i, bd->j, bd->k, 1, 1, beta1->_array_a) + bd->gammai##I##1*double_derivative(bd->i, bd->j, bd->k, 2, 1, beta2->_array_a) + bd->gammai##I##1*double_derivative(bd->i, bd->j, bd->k, 3, 1, beta3->_array_a) + \ 375 bd->gammai##I##2*double_derivative(bd->i, bd->j, bd->k, 1, 2, beta1->_array_a) + bd->gammai##I##2*double_derivative(bd->i, bd->j, bd->k, 2, 2, beta2->_array_a) + bd->gammai##I##2*double_derivative(bd->i, bd->j, bd->k, 3, 2, beta3->_array_a) + \ 376 bd->gammai##I##3*double_derivative(bd->i, bd->j, bd->k, 1, 3, beta1->_array_a) + bd->gammai##I##3*double_derivative(bd->i, bd->j, bd->k, 2, 3, beta2->_array_a) + bd->gammai##I##3*double_derivative(bd->i, bd->j, bd->k, 3, 3, beta3->_array_a) \ 379 bd->gammai11*double_derivative(bd->i, bd->j, bd->k, 1, 1, beta##I->_array_a) + bd->gammai22*double_derivative(bd->i, bd->j, bd->k, 2, 2, beta##I->_array_a) + bd->gammai33*double_derivative(bd->i, bd->j, bd->k, 3, 3, beta##I->_array_a) \ 380 + 2.0*(bd->gammai12*double_derivative(bd->i, bd->j, bd->k, 1, 2, beta##I->_array_a) + bd->gammai13*double_derivative(bd->i, bd->j, bd->k, 1, 3, beta##I->_array_a) + bd->gammai23*double_derivative(bd->i, bd->j, bd->k, 2, 3, beta##I->_array_a)) \ 384 #define BSSN_DT_GAMMAI_SHIFT(I) 0.0 393 #define SET_DKM00(k) bd->d##k##m00 = DKM00(k); 395 -2.0*bd->alpha*bd->d##k##a \ 396 + bd->d##k##m11*bd->beta1*bd->beta1 + bd->d##k##m22*bd->beta2*bd->beta2 + bd->d##k##m33*bd->beta3*bd->beta3 \ 397 + 2.0*(bd->d##k##m12*bd->beta1*bd->beta2 + bd->d##k##m13*bd->beta1*bd->beta3 + bd->d##k##m23*bd->beta2*bd->beta3) \ 398 + 2.0*exp(4.0*bd->phi)*( \ 399 bd->gamma11*bd->d##k##beta1*bd->beta1 + bd->gamma12*bd->d##k##beta2*bd->beta1 + bd->gamma13*bd->d##k##beta3*bd->beta1 \ 400 + bd->gamma12*bd->d##k##beta1*bd->beta2 + bd->gamma22*bd->d##k##beta2*bd->beta2 + bd->gamma23*bd->d##k##beta3*bd->beta2 \ 401 + bd->gamma13*bd->d##k##beta1*bd->beta3 + bd->gamma23*bd->d##k##beta2*bd->beta3 + bd->gamma33*bd->d##k##beta3*bd->beta3 \ 405 #define SET_DKM0I(k, i) bd->d##k##m0##i = DKM0I(k, i); 406 #define DKM0I(k, i) \ 408 bd->gamma1##i * bd->d##k##beta##1 + bd->gamma2##i * bd->d##k##beta##2 + bd->gamma3##i * bd->d##k##beta##3 \ 409 + (bd->d##k##g1##i + 4.0*bd->d##k##phi*bd->gamma1##i) * bd->beta##1 \ 410 + (bd->d##k##g2##i + 4.0*bd->d##k##phi*bd->gamma2##i) * bd->beta##2 \ 411 + (bd->d##k##g3##i + 4.0*bd->d##k##phi*bd->gamma3##i) * bd->beta##3 \ 414 #define SET_DKMIJ(k, i, j) bd->d##k##m##i##j = DKMIJ(k, i, j); 415 #define DKMIJ(k, i, j) exp(4.0*bd->phi)*(bd->d##k##g##i##j + 4.0*bd->d##k##phi*bd->gamma##i##j); 420 #define SET_M00() bd->m00 = M00(); 422 -bd->alpha*bd->alpha + exp(4.0*bd->phi)*( \ 423 bd->gamma11*bd->beta1*bd->beta1 + bd->gamma22*bd->beta2*bd->beta2 + bd->gamma33*bd->beta3*bd->beta3 \ 424 + 2.0*(bd->gamma12*bd->beta1*bd->beta2 + bd->gamma13*bd->beta1*bd->beta3 + bd->gamma23*bd->beta2*bd->beta3) \ 427 #define SET_M0I(i) bd->m0##i = M0I(i); 428 #define M0I(i) exp(4.0*bd->phi)*(bd->gamma1##i*bd->beta1 + bd->gamma2##i*bd->beta2 + bd->gamma3##i*bd->beta3); 430 #define SET_MIJ(i, j) bd->m##i##j = MIJ(i, j); 431 #define MIJ(i, j) exp(4.0*bd->phi)*(bd->gamma##i##j); 435 #define SET_Mi00() bd->mi00 = Mi00(); 436 #define Mi00() -1.0/bd->alpha/bd->alpha; 438 #define SET_Mi0I(i) bd->mi0##i = Mi0I(i); 439 #define Mi0I(i) 1.0/bd->alpha/bd->alpha*bd->beta##i; 441 #define SET_MiIJ(i, j) bd->mi##i##j = MiIJ(i, j); 442 #define MiIJ(i, j) exp(-4.0*bd->phi)*(bd->gamma##i##j) - 1.0/bd->alpha/bd->alpha*bd->beta##i*bd->beta##j; 448 #define BSSN_RP_DG(I,J,L) \ 449 P*(4.0*bd->gamma##I##J*bd->d##L##phi+ bd->d##L##g##I##J) 451 #define BSSN_RP_DDG(I,J,L,M) \ 453 16.0*bd->gamma##I##J*bd->d##M##phi*bd->d##L##phi \ 454 + 4.0*(bd->d##L##g##I##J*bd->d##M##phi + bd->d##M##g##I##J*bd->d##L##phi + bd->gamma##I##J*bd->d##L##d##M##phi) \ 455 + bd->d##L##d##M##g##I##J \ 458 #define BSSN_RP_K(I,J) \ 459 P*(bd->A##I##J + 1.0/3.0*bd->gamma##I##J*bd->K) 461 #define BSSN_RP_DK(I,J,L) \ 463 4.0*(bd->A##I##J + 1.0/3.0*bd->gamma##I##J*bd->K)*bd->d##L##phi + derivative(bd->i, bd->j, bd->k, L, A##I##J->_array_a) \ 464 + 1.0/3.0*bd->K*bd->d##L##g##I##J + 1.0/3.0*bd->gamma##I##J*bd->d##L##K \ 467 #define BSSN_RP_GAMMA(I,J,K) \ 468 bd->G##I##J##K + 2.0*( \ 469 (I==J ? 1.0 : 0.0)*bd->d##K##phi \ 470 + (I==K ? 1.0 : 0.0)*bd->d##J##phi \ 471 - bd->gamma##J##K*(bd->gammai##I##1*bd->d1phi + bd->gammai##I##2*bd->d2phi + bd->gammai##I##3*bd->d3phi) \ 474 #define BSSN_RP_GAMMAL(I,J,K) P*( \ 475 bd->GL##I##J##K + 2.0*( \ 476 bd->gamma##I##J*bd->d##K##phi \ 477 + bd->gamma##I##K*bd->d##J##phi \ 478 - bd->gamma##J##K*bd->d##I##phi \ 487 #define BSSN_MI(I) exp(6.0*bd->phi)*( \ 488 - 2.0/3.0*bd->d##I##K \ 491 - 2.0/3.0*2.0*bd->d##I##theta \ 493 bd->gammai11*bd->A1##I*bd->d1phi + bd->gammai21*bd->A2##I*bd->d1phi + bd->gammai31*bd->A3##I*bd->d1phi \ 494 + bd->gammai12*bd->A1##I*bd->d2phi + bd->gammai22*bd->A2##I*bd->d2phi + bd->gammai32*bd->A3##I*bd->d2phi \ 495 + bd->gammai13*bd->A1##I*bd->d3phi + bd->gammai23*bd->A2##I*bd->d3phi + bd->gammai33*bd->A3##I*bd->d3phi \ 498 bd->gammai11*derivative(bd->i, bd->j, bd->k, 1, A1##I->_array_a) + bd->gammai12*derivative(bd->i, bd->j, bd->k, 2, A1##I->_array_a) + bd->gammai13*derivative(bd->i, bd->j, bd->k, 3, A1##I->_array_a) \ 499 + bd->gammai21*derivative(bd->i, bd->j, bd->k, 1, A2##I->_array_a) + bd->gammai22*derivative(bd->i, bd->j, bd->k, 2, A2##I->_array_a) + bd->gammai23*derivative(bd->i, bd->j, bd->k, 3, A2##I->_array_a) \ 500 + bd->gammai31*derivative(bd->i, bd->j, bd->k, 1, A3##I->_array_a) + bd->gammai32*derivative(bd->i, bd->j, bd->k, 2, A3##I->_array_a) + bd->gammai33*derivative(bd->i, bd->j, bd->k, 3, A3##I->_array_a) \ 501 - bd->Gammad1*bd->A1##I - bd->Gammad2*bd->A2##I - bd->Gammad3*bd->A3##I \ 502 - bd->GL11##I*bd->Acont11 - bd->GL21##I*bd->Acont21 - bd->GL31##I*bd->Acont31 \ 503 - bd->GL12##I*bd->Acont12 - bd->GL22##I*bd->Acont22 - bd->GL32##I*bd->Acont32 \ 504 - bd->GL13##I*bd->Acont13 - bd->GL23##I*bd->Acont23 - bd->GL33##I*bd->Acont33 \ 508 #define BSSN_MI_SCALE(I) exp(6.0*bd->phi)*( \ 509 std::abs(2.0/3.0*bd->d##I##K) \ 511 + std::abs(8*PI*(bd->S##I)) \ 512 + std::abs(2.0/3.0*2.0*bd->d##I##theta) \ 514 bd->gammai11*bd->A1##I*bd->d1phi + bd->gammai21*bd->A2##I*bd->d1phi + bd->gammai31*bd->A3##I*bd->d1phi \ 515 + bd->gammai12*bd->A1##I*bd->d2phi + bd->gammai22*bd->A2##I*bd->d2phi + bd->gammai32*bd->A3##I*bd->d2phi \ 516 + bd->gammai13*bd->A1##I*bd->d3phi + bd->gammai23*bd->A2##I*bd->d3phi + bd->gammai33*bd->A3##I*bd->d3phi \ 519 bd->gammai11*derivative(bd->i, bd->j, bd->k, 1, A1##I->_array_a) + bd->gammai12*derivative(bd->i, bd->j, bd->k, 2, A1##I->_array_a) + bd->gammai13*derivative(bd->i, bd->j, bd->k, 3, A1##I->_array_a) \ 520 + bd->gammai21*derivative(bd->i, bd->j, bd->k, 1, A2##I->_array_a) + bd->gammai22*derivative(bd->i, bd->j, bd->k, 2, A2##I->_array_a) + bd->gammai23*derivative(bd->i, bd->j, bd->k, 3, A2##I->_array_a) \ 521 + bd->gammai31*derivative(bd->i, bd->j, bd->k, 1, A3##I->_array_a) + bd->gammai32*derivative(bd->i, bd->j, bd->k, 2, A3##I->_array_a) + bd->gammai33*derivative(bd->i, bd->j, bd->k, 3, A3##I->_array_a) \ 522 - bd->Gammad1*bd->A1##I - bd->Gammad2*bd->A2##I - bd->Gammad3*bd->A3##I \ 523 - bd->GL11##I*bd->Acont11 - bd->GL21##I*bd->Acont21 - bd->GL31##I*bd->Acont31 \ 524 - bd->GL12##I*bd->Acont12 - bd->GL22##I*bd->Acont22 - bd->GL32##I*bd->Acont32 \ 525 - bd->GL13##I*bd->Acont13 - bd->GL23##I*bd->Acont23 - bd->GL33##I*bd->Acont33 \ 530 #define BSSN_GI_CALC(I) \ 531 bd->Gamma##I - bd->gammai11*bd->G##I##11 - bd->gammai22*bd->G##I##22 - bd->gammai33*bd->G##I##33 \ 532 - 2.0*(bd->gammai12*bd->G##I##12 + bd->gammai13*bd->G##I##13 + bd->gammai23*bd->G##I##23); 534 #define BSSN_GI_SCALE(I) \ 535 std::abs(bd->Gamma##I) + std::abs(bd->gammai11*bd->G##I##11 - bd->gammai22*bd->G##I##22 - bd->gammai33*bd->G##I##33 \ 536 - 2.0*(bd->gammai12*bd->G##I##12 + bd->gammai13*bd->G##I##13 + bd->gammai23*bd->G##I##23)); 539 #define BSSN_NORMALIZE_STDEV(C) \ 540 stdev_##C = sqrt(stdev_##C/(POINTS-1.0)); \ 541 stdev_##C##_scaled = sqrt(stdev_##C##_scaled/(POINTS-1.0)); 543 #define BSSN_NORMALIZE_MEAN(C) \ 544 mean_##C /= POINTS; \ 545 mean_##C##_scaled /= POINTS; 547 #define BSSN_INITIALIZE_CONSTRAINT_STAT_VARS(C) \ 548 real_t mean_##C = 0.0, stdev_##C = 0.0, max_##C = 0.0; \ 549 real_t mean_##C##_scale = 0.0; \ 550 real_t mean_##C##_scaled = 0.0, stdev_##C##_scaled = 0.0,\ 551 max_##C##_scaled = 0.0; 553 #define BSSN_STORE_CONSTRAINT_STAT_VARS(C) \ 554 C##_values[0] = mean_##C; \ 555 C##_values[1] = stdev_##C; \ 556 C##_values[2] = max_##C; \ 557 C##_values[3] = mean_##C##_scale; \ 558 C##_values[4] = mean_##C##_scaled; \ 559 C##_values[5] = stdev_##C##_scaled; \ 560 C##_values[6] = max_##C##_scaled; 562 #define BSSN_COMPUTE_CONSTRAINT_STAT_VARS(C, calcfn, scalefn) \ 563 real_t C##_val = calcfn(&bd); \ 564 real_t C##_scale = scalefn(&bd); \ 565 real_t C##_scaled = C##_val/C##_scale; 567 #define BSSN_COMPUTE_CONSTRAINT_STAT_VARS_VEC(C, calcfn, scalefn) \ 568 real_t C##_val = sqrt( pw2(calcfn(&bd, 1)) + pw2(calcfn(&bd, 2)) + pw2(calcfn(&bd, 3)) ); \ 569 real_t C##_scale = sqrt( pw2(scalefn(&bd, 1)) + pw2(scalefn(&bd, 2)) + pw2(scalefn(&bd, 3)) ); \ 570 real_t C##_scaled = C##_val/C##_scale; 572 #define BSSN_COMPUTE_CONSTRAINT_MEAN_VARS(C) \ 573 mean_##C += C##_val; \ 574 mean_##C##_scale += C##_scale; \ 575 mean_##C##_scaled += C##_scaled; 577 #define BSSN_COMPUTE_CONSTRAINT_STDEV_VARS(C) \ 578 stdev_##C += pw2(C##_val - mean_##C); \ 579 stdev_##C##_scaled += pw2(C##_scaled - mean_##C##_scaled); 581 #define BSSN_COMPUTE_CONSTRAINT_MAXES(C) \ 582 if(fabs(C##_val) > max_##C) \ 583 max_##C = fabs(C##_val); \ 584 if(fabs(C##_scaled) > max_##C##_scaled) \ 585 max_##C##_scaled = fabs(C##_scaled); 596 #define DIFFgamma21 DIFFgamma12 597 #define DIFFgamma31 DIFFgamma13 598 #define DIFFgamma32 DIFFgamma23 599 #define DIFFgammai21 DIFFgammai12 600 #define DIFFgammai31 DIFFgammai13 601 #define DIFFgammai32 DIFFgammai23 605 #define gamma21 gamma12 606 #define gamma31 gamma13 607 #define gamma32 gamma23 610 #define gammai21 gammai12 611 #define gammai31 gammai13 612 #define gammai32 gammai23 615 #define ricciTF21 ricciTF12 616 #define ricciTF31 ricciTF13 617 #define ricciTF32 ricciTF23 618 #define ricci21 ricci12 619 #define ricci31 ricci13 620 #define ricci32 ricci23 623 #define D2D1phi D1D2phi 624 #define D3D1phi D1D3phi 625 #define D3D2phi D2D3phi 628 #define D2D1aTF D1D2aTF 629 #define D3D1aTF D1D3aTF 630 #define D3D2aTF D2D3aTF 633 #define Acont21 Acont12 634 #define Acont31 Acont13 635 #define Acont32 Acont23 672 #define d1d1g21 d1d1g12 673 #define d1d1g31 d1d1g13 674 #define d1d1g32 d1d1g23 675 #define d1d2g21 d1d2g12 676 #define d1d2g31 d1d2g13 677 #define d1d2g32 d1d2g23 678 #define d1d3g21 d1d3g12 679 #define d1d3g31 d1d3g13 680 #define d1d3g32 d1d3g23 681 #define d2d2g21 d2d2g12 682 #define d2d2g31 d2d2g13 683 #define d2d2g32 d2d2g23 684 #define d2d3g21 d2d3g12 685 #define d2d3g31 d2d3g13 686 #define d2d3g32 d2d3g23 687 #define d3d3g21 d3d3g12 688 #define d3d3g31 d3d3g13 689 #define d3d3g32 d3d3g23 691 #define d2d1g11 d1d2g11 692 #define d2d1g12 d1d2g12 693 #define d2d1g13 d1d2g13 694 #define d2d1g22 d1d2g22 695 #define d2d1g23 d1d2g23 696 #define d2d1g33 d1d2g33 697 #define d3d1g11 d1d3g11 698 #define d3d1g12 d1d3g12 699 #define d3d1g13 d1d3g13 700 #define d3d1g22 d1d3g22 701 #define d3d1g23 d1d3g23 702 #define d3d1g33 d1d3g33 703 #define d3d2g11 d2d3g11 704 #define d3d2g12 d2d3g12 705 #define d3d2g13 d2d3g13 706 #define d3d2g22 d2d3g22 707 #define d3d2g23 d2d3g23 708 #define d3d2g33 d2d3g33 710 #define d2d1g21 d1d2g12 711 #define d2d1g31 d1d2g13 712 #define d2d1g32 d1d2g23 713 #define d3d1g21 d1d3g12 714 #define d3d1g31 d1d3g13 715 #define d3d1g32 d1d3g23 716 #define d3d2g21 d2d3g12 717 #define d3d2g31 d2d3g13 718 #define d3d2g32 d2d3g23 757 #if USE_GENERALIZED_NEWTON 758 #define ricciTF21 ricciTF12 759 #define ricciTF31 ricciTF13 760 #define ricciTF32 ricciTF23 762 #define GNTensor21 GNTensor12 763 #define GNTensor31 GNTensor13 764 #define GNTensor32 GNTensor23 766 #define GNTensor21_a GNTensor12_a 767 #define GNTensor31_a GNTensor13_a 768 #define GNTensor32_a GNTensor23_a