20 double *s_x, *s_y, *s_z;
21 double al, A, Am1, be, B, phi, R, r, X;
22 int ivar, i, j, k, i3D, indx;
29 s_x =
new double[
n1*
n2*
n3]();
30 s_y =
new double[
n1*
n2*
n3]();
31 s_z =
new double[
n1*
n2*
n3]();
33 for (ivar = 0; ivar <
nvar; ivar++)
34 for (i = 0; i <
n1; i++)
35 for (j = 0; j <
n2; j++)
36 for (k = 0; k <
n3; k++)
40 al = Pih * (2 * i + 1) /
n1;
42 be = Pih * (2 * j + 1) /
n2;
44 phi = 2. * Pi * k /
n3;
62 for (ivar = 0; ivar <
nvar; ivar++)
63 for (i = 0; i <
n1; i++)
64 for (j = 0; j <
n2; j++)
65 for (k = 0; k <
n3; k++)
68 v.d0[indx]/=(-cos(Pih * (2 * i + 1) /
n1)-1.0);
73 debug_file=fopen(
"initial.dat",
"w");
75 for (ivar = 0; ivar <
nvar; ivar++)
76 for (i = 0; i <
n1; i++)
77 for (j = 0; j <
n2; j++)
79 al = Pih * (2 * i + 1) /
n1;
82 be = Pih * (2 * j + 1) /
n2;
86 U.
d0[0] = Am1 *
v.d0[indx];
87 U.
d1[0] =
v.d0[indx] + Am1 *
v.d1[indx];
88 U.
d2[0] = Am1 *
v.d2[indx];
89 U.
d3[0] = Am1 *
v.d3[indx];
90 U.
d11[0] = 2 *
v.d1[indx] + Am1 *
v.d11[indx];
91 U.
d12[0] =
v.d2[indx] + Am1 *
v.d12[indx];
92 U.
d13[0] =
v.d3[indx] + Am1 *
v.d13[indx];
93 U.
d22[0] = Am1 *
v.d22[indx];
94 U.
d23[0] = Am1 *
v.d23[indx];
95 U.
d33[0] = Am1 *
v.d33[indx];
101 rx3_To_xyz (
nvar, s_x[i3D], r, phi, &(s_y[indx]), &(s_z[indx]), U);
103 "%.16g %.16g %.16g %.16g %.16g %.16g %.16g %.16g %.16g %.16g "
104 "%.16g %.16g %.16g %.16g %.16g %.16g %.16g %.16g %.16g\n",
105 (
double)s_x[indx], (
double)s_y[indx],
108 (
double)(-cos(Pih * (2 * i + 1) /
n1)-1.0),
124 fprintf(debug_file,
"\n\n");
125 for (i=
n2-10; i<
n2; i++)
130 s_x[indx], 0.0, 0.0);
131 fprintf(debug_file,
"%.16g %.16g\n",
132 (
double)s_x[indx], (
double)d);
134 fprintf(debug_file,
"\n\n");
135 for (i=
n2-10; i<
n2-1; i++)
140 for (j=-10; j<10; j++)
143 s_x[indx]+(s_x[ip]-s_x[indx])*j/10,
145 fprintf(debug_file,
"%.16g %.16g\n",
146 (
double)(s_x[indx]+(s_x[ip]-s_x[indx])*j/10), (
double)d);
149 fprintf(debug_file,
"\n\n");
150 for (i = 0; i <
n1; i++)
151 for (j = 0; j <
n2; j++)
153 X = 2*(2.0*i/
n1-1.0);
158 rx3_To_xyz (
nvar, s_x[i3D], r, phi, &(s_y[indx]), &(s_z[indx]), U);
159 *U.
d0 = s_x[indx]*s_x[indx];
168 "%.16g %.16g %.16g %.16g %.16g %.16g %.16g %.16g %.16g %.16g %.16g\n",
169 (
double)s_x[indx], (
double)r, (
double)X, (
double)R, (
double)U.
d0[0],
198 int imin[3], imax[3];
203 static double *F = NULL;
215 TP_INFO (
"Solving puncture equation for BH-NS/NS-NS system");
217 TP_INFO (
"Solving puncture equation for BH-BH system");
222 for (
int j = 0; j < ntotal; j++)
255 double tmp, mp_adm_err, mm_adm_err;
261 TP_INFO (
"Attempting to find bare masses.");
262 TP_INFO (
"Target ADM masses: M_p=%g and M_m=%g",
263 (
double) M_p, (
double) M_m);
268 TP_INFO (
"Bare masses: mp=%.15g, mm=%.15g",
269 (
double)
mp, (
double)
mm);
282 mp_adm_err = fabs(M_p-
mp_adm);
283 mm_adm_err = fabs(M_m-
mm_adm);
284 TP_INFO (
"ADM mass error: M_p_err=%.15g, M_m_err=%.15g",
285 (
double)mp_adm_err, (
double)mm_adm_err);
289 tmp = -4*
par_b*( 1 + um + up + um*up ) +
290 sqrt(16*
par_b*M_m*(1 + um)*(1 + up) +
291 pow(-M_m + M_p + 4*
par_b*(1 + um)*(1 + up),2));
292 mp = (tmp + M_p - M_m)/(2.*(1 + up));
293 mm = (tmp - M_p + M_m)/(2.*(1 + um));
299 }
while ( (mp_adm_err >
adm_tol) ||
302 TP_INFO (
"Found bare masses.");
304 TP_INFO (
"Use input bare masses." );
317 for (
int i = 0; i <
n1; i++)
318 for (
int j = 0; j <
n2; j++)
319 for (
int k = 0; k <
n3; k++) _d0contig[ctr++] =
cf_v.d0[i +
n1 * (j +
n2 * k)];
325 for (
int i = 0; i <
_n1_low; i++)
326 for (
int j = 0; j <
_n2_low; j++)
327 for (
int k = 0; k <
_n3_low; k++) _d0contig_low[ctr++] =
cf_v.d0[i +
n1 * (j +
n2 * k)];
330 "The two puncture masses are mp=%.17g and mm=%.17g",
331 (
double)
mp, (
double)
mm);
346 TP_INFO (
"The total ADM mass is %g", (
double) admMass);
382 TP_ERROR (
"Illegal value for grid_setup_method.");
387 TP_ERROR(
"Please specify a lapse which we can use");
392 TP_INFO (
"Setting initial lapse to psi^%f profile.",
396 TP_INFO (
"Setting initial lapse to a Brownsville-style profile "
400 TP_INFO (
"Preparing interpolation of result");
423 TP_ERROR (
"You must call Run() before interpolating.");
427 double x=pos[0], y=pos[1], z=pos[2];
447 = sqrt((xx -
par_b)*(xx -
par_b) + yy*yy + zz*zz);
449 = sqrt((xx +
par_b)*(xx +
par_b) + yy*yy + zz*zz);
464 r_plus = pow (pow (r_plus, 4) + TP4, 0.25);
465 r_minus = pow (pow (r_minus, 4) + TP4, 0.25);
472 + 0.5 *
mm / r_minus + U;
474 ( M * (3./8 * pow(r, 4) / pow(TP_Extend_Radius, 5) - \
475 5./4 * pow(r, 2) / pow(TP_Extend_Radius, 3) + \
476 15./8 / TP_Extend_Radius))
479 + 0.5 * EXTEND(
mp,r_plus)
480 + 0.5 *
mm / r_minus + U;
484 + 0.5 * EXTEND(
mm,r_minus)
485 + 0.5 *
mp / r_plus + U;
487 double static_psi = 1;
494 TP_WARN(
"@todo: Old Lapse is not be possible, Q as input vector is undefined.");
499 double xp, yp, zp, rp, ir;
501 double p, px, py, pz, pxx, pxy, pxz, pyy, pyz, pzz;
504 pxx = pxy = pxz = 0.0;
505 pyy = pyz = pzz = 0.0;
511 rp = sqrt (xp*xp + yp*yp + zp*zp);
512 rp = pow (pow (rp, 4) + TP4, 0.25);
531 pxx += xp*xp*s5 + s3;
534 pyy += yp*yp*s5 + s3;
536 pzz += zp*zp*s5 + s3;
542 rp = sqrt (xp*xp + yp*yp + zp*zp);
543 rp = pow (pow (rp, 4) + TP4, 0.25);
562 pxx += xp*xp*s5 + s3;
565 pyy += yp*yp*s5 + s3;
567 pzz += zp*zp*s5 + s3;
601 for(
int i=0; i<
Qlen; i++) Q[i] = 0;
603 Q[
g11] = pow (psi1 / static_psi, 4);
606 Q[
g22] = pow (psi1 / static_psi, 4);
608 Q[
g33] = pow (psi1 / static_psi, 4);
610 const double oneoverpsisq = 1./(psi1*psi1);
611 Q[
K11] = Aij[0][0] * oneoverpsisq;
612 Q[
K12] = Aij[0][1] * oneoverpsisq;
613 Q[
K13] = Aij[0][2] * oneoverpsisq;
614 Q[
K22] = Aij[1][1] * oneoverpsisq;
615 Q[
K23] = Aij[1][2] * oneoverpsisq;
616 Q[
K33] = Aij[2][2] * oneoverpsisq;
620 ((1.0 -0.5*
mp /r_plus -0.5*
mm/r_minus)
621 /(1.0 +0.5*
mp /r_plus +0.5*
mm/r_minus));
625 ((1.0 -0.5*EXTEND(
mp, r_plus) -0.5*
mm/r_minus)
626 /(1.0 +0.5*EXTEND(
mp, r_plus) +0.5*
mm/r_minus));
630 ((1.0 -0.5*EXTEND(
mm, r_minus) -0.5*
mp/r_plus)
631 /(1.0 +0.5*EXTEND(
mp, r_minus) +0.5*
mp/r_plus));
658 TP_WARN(
"@TODO Rescale_Sources is in some other thorn and has not been copied");
660 Rescale_Sources(cctkGH,
661 cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2],
void free_derivs(derivs *v, int n)
void Derivatives_AB3(int nvar, int n1, int n2, int n3, derivs v)
bool runned
an internal check
void SpecCoef(int n1, int n2, int n3, int ivar, double *v, double *cf)
void Interpolate(const double *const pos, double *Q, bool low_res=false)
Interpolation function for an external caller.
void F_of_v(int nvar, int n1, int n2, int n3, derivs v, double *F, derivs u)
void Newton(int nvar, int n1, int n2, int n3, derivs v, double tol, int itmax)
void AB_To_XR(int nvar, double A, double B, double *X, double *R, derivs U)
void rx3_To_xyz(int nvar, double x, double r, double phi, double *y, double *z, derivs U)
void set_initial_guess(derivs v)
void BY_Aijofxyz(double x, double y, double z, double Aij[3][3])
double PunctTaylorExpandAtArbitPosition(int ivar, int nvar, int n1, int n2, int n3, derivs v, double x, double y, double z)
double PunctIntPolAtArbitPosition(int ivar, int nvar, int n1, int n2, int n3, derivs v, double x, double y, double z)
void allocate_derivs(derivs *v, int n)
double PunctEvalAtArbitPosition(double *v, int ivar, double A, double B, double phi, int nvar, int n1, int n2, int n3)
int Index(int ivar, int i, int j, int k, int nvar, int n1, int n2, int n3)
double PunctIntPolAtArbitPositionFast(derivs v, double x, double y, double z, bool low_res=false)
void C_To_c(int nvar, double X, double R, double *x, double *r, derivs U)
double * dvector(long nl, long nh)
void free_dvector(double *v, long nl, long nh)
This file contains aliases for making access to the long state vector Q as used eg.
void TP_INFO(const char *fmt,...)
void TP_ERROR(const char *fmt,...)
void TP_WARN(const char *fmt,...)
std::string grid_setup_method
bool use_external_initial_guess
static constexpr int npoints_phi
bool solve_momentum_constraint
std::string conformal_storage
static constexpr int npoints_A
static constexpr int npoints_B_low
static constexpr int npoints_phi_low
static constexpr int npoints_B
static constexpr int npoints_A_low
double initial_lapse_psi_exponent
std::string initial_lapse
bool do_initial_debug_output