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;
147 static constexpr double CCZ4KOSigma=8.0;
148 static constexpr double CCZ4itau = 1.0;
149 static constexpr double CCZ4k1 = 0.1;
150 static constexpr double CCZ4k2 = 0.0;
151 static constexpr double CCZ4k3 = 0.5;
152 static constexpr double CCZ4eta = 1.0;
153 static constexpr double CCZ4f = 0.75;
154 static constexpr double CCZ4g = 0.0;
155 static constexpr double CCZ4xi = 1.0;
156 static constexpr double CCZ4e = 1.0;
157 static constexpr double CCZ4c = 1.0;
158 static constexpr double CCZ4mu = 0.2;
159 static constexpr double CCZ4ds = 1.0;
160 static constexpr double CCZ4sk = 1.0;
161 static constexpr double CCZ4bs = 1.0;
162 static constexpr int CCZ4LapseType = 1;
163 static constexpr int CCZ4SO = 1;
171 numberOfDoFsPerAxisInCell,
180 numberOfDoFsPerAxisInCell,
191 const double * __restrict__ Q,
197 double * __restrict__ F
202 const double * __restrict__ Q,
203 const double * __restrict__ deltaQ,
209 double * __restrict__ BTimesDeltaQ
211 double gradQSerialised[unknowns*3];
212 for (
int i=0; i<unknowns; i++) {
213 gradQSerialised[i+0*unknowns] = 0.0;
214 gradQSerialised[i+1*unknowns] = 0.0;
215 gradQSerialised[i+2*unknowns] = 0.0;
217 gradQSerialised[i+normal*unknowns] = deltaQ[i];
222 applications::exahype2::ccz4::ncp(BTimesDeltaQ, Q, gradQSerialised, normal, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4mu, CCZ4SO);
225 const double * __restrict__ Q,
230 double * __restrict__ S
233 applications::exahype2::ccz4::source(S,Q, CCZ4LapseType, CCZ4ds, CCZ4c, CCZ4e, CCZ4f, CCZ4bs, CCZ4sk, CCZ4xi, CCZ4itau, CCZ4eta, CCZ4k1, CCZ4k2, CCZ4k3, CCZ4SO);
247 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};
252 for (
int i=0;i<3;i++){
319 double x,
double y,
double z
323 g[0][0] = 1.36778 + 2.39731 * x + 4.53541 * x * x +
324 19.9771 * x * y * y * y + 6.13801 * y * z +
325 5.65185 * z * z + 9.35842 * z * z * z * z;
326 g[0][1] = -0.07646 - 0.48786 * x - 0.75098 * x * x -
327 1.73683 * x * y * y * y + 1.71676 * y * z +
328 1.03662 * z * z + 0.35630 * z * z * z * z;
329 g[0][2] = -0.10083 + 0.12445 * x - 1.26649 * x * x -
330 1.95052 * x * y * y * y + 0.73091 * y * z -
331 1.49835 * z * z - 2.39024 * z * z * z * z;
332 g[1][1] = 0.84072 + 2.31163 * x + 3.32275 * x * x +
333 15.1662 * x * y * y * y + 8.48730 * y * z +
334 3.05098 * z * z + 17.8448 * z * z * z * z;
335 g[1][2] = -0.42495 - 0.33464 * x - 0.47012 * x * x -
336 7.38477 * x * y * y * y + 0.41896 * y * z -
337 1.36394 * z * z + 5.25894 * z * z * z * z;
338 g[2][2] = 0.60995 + 1.30428 * x + 3.86237 * x * x +
339 22.7614 * x * y * y * y + 6.93818 * y * z +
340 4.39250 * z * z + 19.0244 * z * z * z * z;
345 double detg = g[0][0] * g[1][1] * g[2][2] +
346 2 * g[0][1] * g[0][2] * g[1][2] -
347 g[0][0] * g[1][2] * g[1][2] -
348 g[1][1] * g[0][2] * g[0][2] -
349 g[2][2] * g[0][1] * g[0][1];
350 g_UU[0][0] = (g[1][1] * g[2][2] - g[1][2] * g[1][2]) / detg;
351 g_UU[0][1] = (g[0][2] * g[1][2] - g[0][1] * g[2][2]) / detg;
352 g_UU[0][2] = (g[0][1] * g[1][2] - g[0][2] * g[1][1]) / detg;
353 g_UU[1][1] = (g[0][0] * g[2][2] - g[0][2] * g[0][2]) / detg;
354 g_UU[1][2] = (g[0][1] * g[0][2] - g[0][0] * g[1][2]) / detg;
355 g_UU[2][2] = (g[0][0] * g[1][1] - g[0][1] * g[0][1]) / detg;
356 g_UU[1][0] = g_UU[0][1];
357 g_UU[2][0] = g_UU[0][2];
358 g_UU[2][1] = g_UU[1][2];
360 phi=std::pow(detg,-1./6.);
361 double phisq=phi*phi;
363 K[0][0] = -0.16238 - 0.74295 * x + 0.51595 * x * x -
364 6.60239 * x * y * y * y - 0.76401 * y * z -
365 1.81131 * z * z - 3.88228 * z * z * z * z;
366 K[0][1] = 0.15054 - 0.60088 * x - 0.15428 * x * x +
367 3.16779 * x * y * y * y - 2.00687 * y * z -
368 1.35442 * z * z - 0.67601 * z * z * z * z;
369 K[0][2] = -0.02174 - 0.36243 * x + 0.81531 * x * x +
370 4.34918 * x * y * y * y + 0.90419 * y * z -
371 0.85088 * z * z - 6.45097 * z * z * z * z;
372 K[1][1] = -0.47653 - 0.43889 * x + 0.87342 * x * x +
373 4.24684 * x * y * y * y + 0.26290 * y * z +
374 1.90095 * z * z + 3.69515 * z * z * z * z;
375 K[1][2] = 0.37472 + 0.03657 * x - 0.10327 * x * x -
376 0.95744 * x * y * y * y - 1.20800 * y * z -
377 0.43064 * z * z - 0.25419 * z * z * z * z;
378 K[2][2] = 0.34184 + 0.21495 * x - 0.73195 * x * x +
379 7.81626 * x * y * y * y + 2.48359 * y * z +
380 1.89657 * z * z - 4.10980 * z * z * z * z;
384 for (
int i=0;i<3;i++)
385 for (
int j=0;j<3;j++) trK += g_UU[i][j]*K[i][j];
387 for (
int i=0;i<3;i++)
388 for (
int j=0;j<3;j++) {
389 g[i][j]=phisq*g[i][j];
390 K[i][j]=phisq*(K[i][j]- 1./3. * trK * g[i][j]/phisq);
393 Theta = 0.27579 + 0.25791 * x + 1.40488 * x * x +
394 5.68276 * x * y * y * y +
395 3.04325 * y * z + 1.81250 * z * z +
396 1.01832 * z * z * z * z;
397 Gamma[0] = -0.49482 + 0.89227 * x + 0.05571 * x * x -
398 5.38570 * x * y * y * y + 0.13979 * y * z -
399 0.68588 * z * z - 4.39964 * z * z * z * z;
400 Gamma[1] = -0.09082 - 0.31017 * x + 1.06980 * x * x +
401 7.81524 * x * y * y * y - 1.65016 * y * z -
402 0.53352 * z * z - 3.20997 * z * z * z * z;
403 Gamma[2] = -0.42367 + 0.03891 * x - 0.87898 * x * x +
404 6.67657 * x * y * y * y - 3.44662 * y * z -
405 0.19655 * z * z + 2.97524 * z * z * z * z;
407 alpha = 0.73578 + 0.36898 * x + 0.64348 * x * x +
408 9.33487 * x * y * y * y +
409 0.99469 * y * z + 0.20515 * z * z +
410 8.88385 * z * z * z * z;
413 beta[0] = 0.00000 + 0.18795 * x - 0.52389 * x * x -
414 4.14079 * x * y * y * y +
415 0.73135 * y * z - 0.27057 * z * z +
416 3.24187 * z * z * z * z;
417 beta[1] = 0.00000 - 0.30316 * x - 0.15184 * x * x -
418 0.48815 * x * y * y * y +
419 2.45991 * y * z - 0.79248 * z * z +
420 7.14007 * z * z * z * z;
421 beta[2] = 0.00000 + 0.68835 * x - 0.52219 * x * x -
422 7.50449 * x * y * y * y -
423 2.35372 * y * z - 0.21476 * z * z +
424 4.36363 * z * z * z * z;
426 b[0] = -0.26928 + 0.35045 * x - 0.48884 * x * x +
427 2.72465 * x * y * y * y - 2.59022 * y * z -
428 0.27384 * z * z + 0.38748 * z * z * z * z;
429 b[1] = 0.40234 + 0.26741 * x + 1.94822 * x * x -
430 0.78276 * x * y * y * y + 2.12346 * y * z +
431 0.69086 * z * z - 4.47639 * z * z * z * z;
432 b[2] = 0.40313 + 0.00569 * x - 1.12452 * x * x -
433 5.49255 * x * y * y * y - 2.21932 * y * z +
434 0.49523 * z * z + 1.29460 * z * z * z * z;