42 constexpr int unknowns = 59;
43 constexpr int auxiliaryVariables = 0;
44 constexpr int numberOfDoFsPerAxisInCell = 30;
45 constexpr int haloSize = 3;
46 constexpr int numberOfDoFsPerAxisInCellWithHalos= 30+2*haloSize;
53 double oldQWithHalos[numberOfDoFsPerAxisInCellWithHalos*numberOfDoFsPerAxisInCellWithHalos*numberOfDoFsPerAxisInCellWithHalos*(unknowns+auxiliaryVariables)]={0};
54 double QOut[numberOfDoFsPerAxisInCell*numberOfDoFsPerAxisInCell*numberOfDoFsPerAxisInCell*(unknowns)]={0};
60 for (
int xx = -haloSize; xx < numberOfDoFsPerAxisInCell+haloSize; xx++)
61 for (
int yy = -haloSize; yy < numberOfDoFsPerAxisInCell+haloSize; yy++)
62 for (
int zz = -haloSize; zz < numberOfDoFsPerAxisInCell+haloSize; zz++){
63 currentPosition=gridCellIndex3d(xx,yy,zz);
64 for (
int i=0;i<3;i++){
65 volumeCoordinates(i) = x(i)-0.5*cellSize(i);
66 volumeCoordinates(i) += (
double(currentPosition(i))+0.5)*cellSize(i)/numberOfDoFsPerAxisInCell;
70 numberOfDoFsPerAxisInCellWithHalos);
73 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+ 0] = 1.0;
74 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+ 3] = 1.0;
75 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+ 5] = 1.0;
76 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+16] = 1.0;
77 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+54] = 1.0;
79 }
else if (scenario==1){
80 for (
int xx = -haloSize; xx < numberOfDoFsPerAxisInCell+haloSize; xx++)
81 for (
int yy = -haloSize; yy < numberOfDoFsPerAxisInCell+haloSize; yy++)
82 for (
int zz = -haloSize; zz < numberOfDoFsPerAxisInCell+haloSize; zz++){
83 currentPosition=gridCellIndex3d(xx,yy,zz);
84 for (
int i=0;i<3;i++){
85 volumeCoordinates(i) = x(i)-0.5*cellSize(i);
86 volumeCoordinates(i) += (
double(currentPosition(i))+0.5)*cellSize(i)/numberOfDoFsPerAxisInCell;
90 numberOfDoFsPerAxisInCellWithHalos);
94 double Theta, Gamma[3];
95 double alpha,
beta[3], b[3];
96 g =
new double* [3]; K =
new double* [3];
97 for (
int l=0;l<3;l++){
98 g[l]=
new double[3]; K[l]=
new double[3];
102 prepareFieldData(g, phi, K, trK, Theta, Gamma, alpha,
beta, b,
103 volumeCoordinates(0), volumeCoordinates(1), volumeCoordinates(2));
110 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+ 0] = g[0][0];
111 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+ 1] = g[0][1];
112 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+ 2] = g[0][2];
113 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+ 3] = g[1][1];
114 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+ 4] = g[1][2];
115 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+ 5] = g[2][2];
117 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+ 6] = K[0][0];
118 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+ 7] = K[0][1];
119 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+ 8] = K[0][2];
120 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+ 9] = K[1][1];
121 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+10] = K[1][2];
122 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+11] = K[2][2];
124 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+12] = Theta;
125 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+13] = Gamma[0];
126 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+14] = Gamma[1];
127 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+15] = Gamma[2];
129 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+16] = alpha;
130 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+17] =
beta[0];
131 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+18] =
beta[1];
132 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+19] =
beta[2];
133 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+20] = b[0];
134 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+21] = b[1];
135 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+22] = b[2];
137 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+53] = trK;
138 oldQWithHalos[CellIndexSerialised*(unknowns+auxiliaryVariables)+54] = phi;
148 static constexpr double CCZ4KOSigma=8.0;
149 static constexpr double CCZ4itau = 1.0;
150 static constexpr double CCZ4k1 = 0.1;
151 static constexpr double CCZ4k2 = 0.0;
152 static constexpr double CCZ4k3 = 0.5;
153 static constexpr double CCZ4eta = 1.0;
154 static constexpr double CCZ4f = 0.75;
155 static constexpr double CCZ4g = 0.0;
156 static constexpr double CCZ4xi = 1.0;
157 static constexpr double CCZ4e = 1.0;
158 static constexpr double CCZ4c = 1.0;
159 static constexpr double CCZ4mu = 0.2;
160 static constexpr double CCZ4ds = 1.0;
161 static constexpr double CCZ4sk = 1.0;
162 static constexpr double CCZ4bs = 1.0;
163 static constexpr int CCZ4LapseType = 1;
164 static constexpr int CCZ4SO = 1;
172 numberOfDoFsPerAxisInCell,
181 numberOfDoFsPerAxisInCell,
192 const double * __restrict__ Q,
198 double * __restrict__ F
203 const double * __restrict__ Q,
204 const double * __restrict__ deltaQ,
210 double * __restrict__ BTimesDeltaQ
212 double gradQSerialised[unknowns*3];
213 for (
int i=0; i<unknowns; i++) {
214 gradQSerialised[i+0*unknowns] = 0.0;
215 gradQSerialised[i+1*unknowns] = 0.0;
216 gradQSerialised[i+2*unknowns] = 0.0;
218 gradQSerialised[i+normal*unknowns] = deltaQ[i];
223 applications::exahype2::ccz4::ncp(BTimesDeltaQ, Q, gradQSerialised, normal, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4mu, CCZ4SO);
226 const double * __restrict__ Q,
231 double * __restrict__ S
234 applications::exahype2::ccz4::source(S,Q, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4itau, CCZ4eta, CCZ4k1, CCZ4k2, CCZ4k3, CCZ4SO);
248 double dataArrayOfGRChombo[25]={-3.1866, 0.365012, 3.35262, 0.0372327, 3.36914, 1.34624, 4.88302, 3.09191, 0.296349, -3.06936, 0.936401, -2.12479, 3.00939, 9.47752, 35.5824, -9.94656, 42.4051, -0.753163, 3.48535, -2.7644, 10.7661, 34.7114, -11.501, -9.21531, -0.359624};
253 for (
int i=0;i<3;i++){
320 double x,
double y,
double z
324 g[0][0] = 1.36778 + 2.39731 * x + 4.53541 * x * x +
325 19.9771 * x * y * y * y + 6.13801 * y * z +
326 5.65185 * z * z + 9.35842 * z * z * z * z;
327 g[0][1] = -0.07646 - 0.48786 * x - 0.75098 * x * x -
328 1.73683 * x * y * y * y + 1.71676 * y * z +
329 1.03662 * z * z + 0.35630 * z * z * z * z;
330 g[0][2] = -0.10083 + 0.12445 * x - 1.26649 * x * x -
331 1.95052 * x * y * y * y + 0.73091 * y * z -
332 1.49835 * z * z - 2.39024 * z * z * z * z;
333 g[1][1] = 0.84072 + 2.31163 * x + 3.32275 * x * x +
334 15.1662 * x * y * y * y + 8.48730 * y * z +
335 3.05098 * z * z + 17.8448 * z * z * z * z;
336 g[1][2] = -0.42495 - 0.33464 * x - 0.47012 * x * x -
337 7.38477 * x * y * y * y + 0.41896 * y * z -
338 1.36394 * z * z + 5.25894 * z * z * z * z;
339 g[2][2] = 0.60995 + 1.30428 * x + 3.86237 * x * x +
340 22.7614 * x * y * y * y + 6.93818 * y * z +
341 4.39250 * z * z + 19.0244 * z * z * z * z;
346 double detg = g[0][0] * g[1][1] * g[2][2] +
347 2 * g[0][1] * g[0][2] * g[1][2] -
348 g[0][0] * g[1][2] * g[1][2] -
349 g[1][1] * g[0][2] * g[0][2] -
350 g[2][2] * g[0][1] * g[0][1];
351 g_UU[0][0] = (g[1][1] * g[2][2] - g[1][2] * g[1][2]) / detg;
352 g_UU[0][1] = (g[0][2] * g[1][2] - g[0][1] * g[2][2]) / detg;
353 g_UU[0][2] = (g[0][1] * g[1][2] - g[0][2] * g[1][1]) / detg;
354 g_UU[1][1] = (g[0][0] * g[2][2] - g[0][2] * g[0][2]) / detg;
355 g_UU[1][2] = (g[0][1] * g[0][2] - g[0][0] * g[1][2]) / detg;
356 g_UU[2][2] = (g[0][0] * g[1][1] - g[0][1] * g[0][1]) / detg;
357 g_UU[1][0] = g_UU[0][1];
358 g_UU[2][0] = g_UU[0][2];
359 g_UU[2][1] = g_UU[1][2];
361 phi=std::pow(detg,-1./6.);
362 double phisq=phi*phi;
364 K[0][0] = -0.16238 - 0.74295 * x + 0.51595 * x * x -
365 6.60239 * x * y * y * y - 0.76401 * y * z -
366 1.81131 * z * z - 3.88228 * z * z * z * z;
367 K[0][1] = 0.15054 - 0.60088 * x - 0.15428 * x * x +
368 3.16779 * x * y * y * y - 2.00687 * y * z -
369 1.35442 * z * z - 0.67601 * z * z * z * z;
370 K[0][2] = -0.02174 - 0.36243 * x + 0.81531 * x * x +
371 4.34918 * x * y * y * y + 0.90419 * y * z -
372 0.85088 * z * z - 6.45097 * z * z * z * z;
373 K[1][1] = -0.47653 - 0.43889 * x + 0.87342 * x * x +
374 4.24684 * x * y * y * y + 0.26290 * y * z +
375 1.90095 * z * z + 3.69515 * z * z * z * z;
376 K[1][2] = 0.37472 + 0.03657 * x - 0.10327 * x * x -
377 0.95744 * x * y * y * y - 1.20800 * y * z -
378 0.43064 * z * z - 0.25419 * z * z * z * z;
379 K[2][2] = 0.34184 + 0.21495 * x - 0.73195 * x * x +
380 7.81626 * x * y * y * y + 2.48359 * y * z +
381 1.89657 * z * z - 4.10980 * z * z * z * z;
385 for (
int i=0;i<3;i++)
386 for (
int j=0;j<3;j++) trK += g_UU[i][j]*K[i][j];
388 for (
int i=0;i<3;i++)
389 for (
int j=0;j<3;j++) {
390 g[i][j]=phisq*g[i][j];
391 K[i][j]=phisq*(K[i][j]- 1./3. * trK * g[i][j]/phisq);
394 Theta = 0.27579 + 0.25791 * x + 1.40488 * x * x +
395 5.68276 * x * y * y * y +
396 3.04325 * y * z + 1.81250 * z * z +
397 1.01832 * z * z * z * z;
398 Gamma[0] = -0.49482 + 0.89227 * x + 0.05571 * x * x -
399 5.38570 * x * y * y * y + 0.13979 * y * z -
400 0.68588 * z * z - 4.39964 * z * z * z * z;
401 Gamma[1] = -0.09082 - 0.31017 * x + 1.06980 * x * x +
402 7.81524 * x * y * y * y - 1.65016 * y * z -
403 0.53352 * z * z - 3.20997 * z * z * z * z;
404 Gamma[2] = -0.42367 + 0.03891 * x - 0.87898 * x * x +
405 6.67657 * x * y * y * y - 3.44662 * y * z -
406 0.19655 * z * z + 2.97524 * z * z * z * z;
408 alpha = 0.73578 + 0.36898 * x + 0.64348 * x * x +
409 9.33487 * x * y * y * y +
410 0.99469 * y * z + 0.20515 * z * z +
411 8.88385 * z * z * z * z;
414 beta[0] = 0.00000 + 0.18795 * x - 0.52389 * x * x -
415 4.14079 * x * y * y * y +
416 0.73135 * y * z - 0.27057 * z * z +
417 3.24187 * z * z * z * z;
418 beta[1] = 0.00000 - 0.30316 * x - 0.15184 * x * x -
419 0.48815 * x * y * y * y +
420 2.45991 * y * z - 0.79248 * z * z +
421 7.14007 * z * z * z * z;
422 beta[2] = 0.00000 + 0.68835 * x - 0.52219 * x * x -
423 7.50449 * x * y * y * y -
424 2.35372 * y * z - 0.21476 * z * z +
425 4.36363 * z * z * z * z;
427 b[0] = -0.26928 + 0.35045 * x - 0.48884 * x * x +
428 2.72465 * x * y * y * y - 2.59022 * y * z -
429 0.27384 * z * z + 0.38748 * z * z * z * z;
430 b[1] = 0.40234 + 0.26741 * x + 1.94822 * x * x -
431 0.78276 * x * y * y * y + 2.12346 * y * z +
432 0.69086 * z * z - 4.47639 * z * z * z * z;
433 b[2] = 0.40313 + 0.00569 * x - 1.12452 * x * x -
434 5.49255 * x * y * y * y - 2.21932 * y * z +
435 0.49523 * z * z + 1.29460 * z * z * z * z;