PG2P3JQPLWZRLCAJ7JY2B7G7AM5DHOE2CJUKIPWREI3NAUKZF3TAC
YIQN7NJTGEVKW7JZHL6CTH6EPCIXCNBYNURIGXPYZAOUX3VAJQMAC
4UAVM7QNVW2KOPZCOWOCKMBIPDNDDIUOLNO5EFIWWHKKJ53ALSDAC
33IC3UHCEPZLGS5ACS2JXHGT6CRU5LXU6PM6RDHCERPOIELVRVXQC
722HZ7UFINNE3YKSYKP2NHZ5XEG5QQLQHSKC7PREJZR3EX6RDYUAC
FEMASUBNU32NSG4DNXZX54CGCA57PVRGYO46L3A6F2EJ4BCSJ3SAC
TOBGHRPKEPSXDN56WGSZNWOMCBVJ4KUSLWYWI56MC2RR3MM3KLZAC
2DKSL6DKZAIYQUJGDULORCKU5K4Z5Z3W4RIKQYDSLKMCNQNDZFBAC
BVR7DVINVPQG7PA6Z7QYVYNQ43YZL7XCC6AOMSMWMGAAB2Q43STAC
NGD6QWRDHWBMQXL2YXZVF3BFQALSII3LH6BMIOFL7VFMGPLHCZEQC
HNQLJR6ZWME6VBJ2Y7PSENLJPXC7INSS7NC2CKIWQAC776CQ74TQC
for (int tl = 0; tl < restrict_tl; ++tl)
amrex::average_down(*finegroupdata.mfab.at(tl), *groupdata.mfab.at(tl),
ghext->amrcore->Geom(level + 1),
ghext->amrcore->Geom(level), 0, groupdata.numvars,
reffact);
for (int tl = 0; tl < restrict_tl; ++tl) {
if (groupdata.indextype == array<int, dim>{0, 0, 0})
amrex::average_down_nodal(*finegroupdata.mfab.at(tl),
*groupdata.mfab.at(tl), reffact);
else if (groupdata.indextype == array<int, dim>{1, 0, 0} ||
groupdata.indextype == array<int, dim>{0, 1, 0} ||
groupdata.indextype == array<int, dim>{0, 0, 1})
amrex::average_down_edges(*finegroupdata.mfab.at(tl),
*groupdata.mfab.at(tl), reffact);
else if (groupdata.indextype == array<int, dim>{1, 1, 0} ||
groupdata.indextype == array<int, dim>{1, 0, 1} ||
groupdata.indextype == array<int, dim>{0, 1, 1})
amrex::average_down_faces(*finegroupdata.mfab.at(tl),
*groupdata.mfab.at(tl), reffact);
else if (groupdata.indextype == array<int, dim>{1, 1, 1})
amrex::average_down(*finegroupdata.mfab.at(tl), *groupdata.mfab.at(tl),
// ghext->amrcore->Geom(level + 1),
// ghext->amrcore->Geom(level),
0, groupdata.numvars, reffact);
else
assert(0);
}
rho_p[p.idx] - dt * ((momx_p[p.idx + di] - momx_p[p.idx]) / p.dx +
(momy_p[p.idx + dj] - momy_p[p.idx]) / p.dy +
(momz_p[p.idx + dk] - momz_p[p.idx]) / p.dz);
rho_p[p.idx] - dt * ((momx_p[p.idx + di] - momx_p[p.idx]) / dx +
(momy_p[p.idx + dj] - momy_p[p.idx]) / dy +
(momz_p[p.idx + dk] - momz_p[p.idx]) / dz);
CCTK_REAL width "width"
{
(0.0:* :: ""
} 0.1
return {.phi = cos(omega * t - kx * x - ky * y - kz * z),
.ax = omega / kx * cos(omega * t - kx * x - ky * y - kz * z),
.ay = 0,
.az = 0};
T phi = cos(omega * t - kx * x - ky * y - kz * z);
return {.phi = phi, .ax = omega / kx * phi, .ay = 0, .az = 0};
}
// Plane wave with Gaussian profile
template <typename T> potential<T> gaussian_wave(T t, T x, T y, T z) {
DECLARE_CCTK_PARAMETERS;
T kx = M_PI * spatial_frequency_x;
T ky = M_PI * spatial_frequency_y;
T kz = M_PI * spatial_frequency_z;
T omega = sqrt(pow(kx, 2) + pow(ky, 2) + pow(kz, 2));
T phi = exp(-pow(sin(omega * t - kx * x - ky * y - kz * z) / width, 2) / 2);
return {.phi = phi, .ax = omega / kx * phi, .ay = 0, .az = 0};
xderiv(plane_wave<CCTK_REAL>, p.dx)(t, p.x, p.y, p.z).ay -
yderiv(plane_wave<CCTK_REAL>, p.dy)(t, p.x, p.y, p.z).ax;
xderiv(plane_wave<CCTK_REAL>, dx)(t, p.x, p.y, p.z).ay -
yderiv(plane_wave<CCTK_REAL>, dy)(t, p.x, p.y, p.z).ax;
});
Loop::loop_all<0, 0, 0>(
cctkGH, [&](const Loop::PointDesc &p) { rho_(p.i, p.j, p.k) = 0.0; });
Loop::loop_all<1, 0, 0>(
cctkGH, [&](const Loop::PointDesc &p) { jx_(p.i, p.j, p.k) = 0.0; });
Loop::loop_all<0, 1, 0>(
cctkGH, [&](const Loop::PointDesc &p) { jy_(p.i, p.j, p.k) = 0.0; });
Loop::loop_all<0, 0, 1>(
cctkGH, [&](const Loop::PointDesc &p) { jz_(p.i, p.j, p.k) = 0.0; });
} else if (CCTK_EQUALS(initial_condition, "Gaussian wave")) {
Loop::loop_all<0, 0, 0>(cctkGH, [&](const Loop::PointDesc &p) {
phi_(p.i, p.j, p.k) = gaussian_wave(t + dt / 2, p.x, p.y, p.z).phi;
});
Loop::loop_all<1, 0, 0>(cctkGH, [&](const Loop::PointDesc &p) {
ax_(p.i, p.j, p.k) = gaussian_wave(t, p.x, p.y, p.z).ax;
});
Loop::loop_all<0, 1, 0>(cctkGH, [&](const Loop::PointDesc &p) {
ay_(p.i, p.j, p.k) = gaussian_wave(t, p.x, p.y, p.z).ay;
});
Loop::loop_all<0, 0, 1>(cctkGH, [&](const Loop::PointDesc &p) {
az_(p.i, p.j, p.k) = gaussian_wave(t, p.x, p.y, p.z).az;
});
Loop::loop_all<1, 0, 0>(cctkGH, [&](const Loop::PointDesc &p) {
ex_(p.i, p.j, p.k) =
-xderiv(gaussian_wave<CCTK_REAL>, dx)(t + dt / 2, p.x, p.y, p.z).phi -
tderiv(gaussian_wave<CCTK_REAL>, dt)(t + dt / 2, p.x, p.y, p.z).ax;
});
Loop::loop_all<0, 1, 0>(cctkGH, [&](const Loop::PointDesc &p) {
ey_(p.i, p.j, p.k) =
-yderiv(gaussian_wave<CCTK_REAL>, dy)(t + dt / 2, p.x, p.y, p.z).phi -
tderiv(gaussian_wave<CCTK_REAL>, dt)(t + dt / 2, p.x, p.y, p.z).ay;
});
Loop::loop_all<0, 0, 1>(cctkGH, [&](const Loop::PointDesc &p) {
ez_(p.i, p.j, p.k) =
-zderiv(gaussian_wave<CCTK_REAL>, dz)(t + dt / 2, p.x, p.y, p.z).phi -
tderiv(gaussian_wave<CCTK_REAL>, dt)(t + dt / 2, p.x, p.y, p.z).az;
});
Loop::loop_all<0, 1, 1>(cctkGH, [&](const Loop::PointDesc &p) {
bx_(p.i, p.j, p.k) =
yderiv(gaussian_wave<CCTK_REAL>, dy)(t, p.x, p.y, p.z).az -
zderiv(gaussian_wave<CCTK_REAL>, dz)(t, p.x, p.y, p.z).ay;
});
Loop::loop_all<1, 0, 1>(cctkGH, [&](const Loop::PointDesc &p) {
by_(p.i, p.j, p.k) =
zderiv(gaussian_wave<CCTK_REAL>, dz)(t, p.x, p.y, p.z).ax -
xderiv(gaussian_wave<CCTK_REAL>, dx)(t, p.x, p.y, p.z).az;
});
Loop::loop_all<1, 1, 0>(cctkGH, [&](const Loop::PointDesc &p) {
bz_(p.i, p.j, p.k) =
xderiv(gaussian_wave<CCTK_REAL>, dx)(t, p.x, p.y, p.z).ay -
yderiv(gaussian_wave<CCTK_REAL>, dy)(t, p.x, p.y, p.z).ax;
dt * ((jx_(p.i, p.j, p.k) - jx_(p.i - 1, p.j, p.k)) / p.dx +
(jy_(p.i, p.j, p.k) - jy_(p.i, p.j - 1, p.k)) / p.dy +
(jz_(p.i, p.j, p.k) - jz_(p.i, p.j, p.k - 1)) / p.dz);
dt * ((jx_(p.i, p.j, p.k) - jx_(p.i - 1, p.j, p.k)) / dx +
(jy_(p.i, p.j, p.k) - jy_(p.i, p.j - 1, p.k)) / dy +
(jz_(p.i, p.j, p.k) - jz_(p.i, p.j, p.k - 1)) / dz);
dt * ((ax_(p.i, p.j, p.k) - ax_(p.i - 1, p.j, p.k)) / p.dx +
(ay_(p.i, p.j, p.k) - ay_(p.i, p.j - 1, p.k)) / p.dy +
(ay_(p.i, p.j, p.k) - az_(p.i, p.j, p.k - 1)) / p.dz);
dt * ((ax_(p.i, p.j, p.k) - ax_(p.i - 1, p.j, p.k)) / dx +
(ay_(p.i, p.j, p.k) - ay_(p.i, p.j - 1, p.k)) / dy +
(ay_(p.i, p.j, p.k) - az_(p.i, p.j, p.k - 1)) / dz);
Loop::loop_int<1, 1, 1>(
cctkGH, [&](const Loop::PointDesc &p) { regrid_error[p.idx] = 0; });
const Loop::GF3D<const CCTK_REAL, 1, 0, 0> ax_(cctkGH, ax);
const Loop::GF3D<const CCTK_REAL, 0, 1, 0> ay_(cctkGH, ay);
const Loop::GF3D<const CCTK_REAL, 0, 0, 1> az_(cctkGH, az);
Loop::loop_int<1, 1, 1>(cctkGH, [&](const Loop::PointDesc &p) {
CCTK_REAL err = 0;
for (int b = 0; b < 2; ++b)
for (int a = 0; a < 2; ++a)
err += fabs(ax_(p.i - 1, p.j + a, p.k + b) -
2 * ax_(p.i, p.j + a, p.k + b) +
ax_(p.i + 1, p.j + a, p.k + b)) +
fabs(ay_(p.i + a, p.j - 1, p.k + b) -
2 * ay_(p.i + a, p.j, p.k + b) +
ay_(p.i + a, p.j + 1, p.k + b)) +
fabs(az_(p.i + a, p.j + b, p.k - 1) -
2 * az_(p.i + a, p.j + b, p.k) +
az_(p.i + a, p.j + b, p.k + 1));
regrid_error[p.idx] = err;
});
(yderiv(plane_wave<CCTK_REAL>, p.dy)(t, p.x, p.y, p.z).az -
zderiv(plane_wave<CCTK_REAL>, p.dz)(t, p.x, p.y, p.z).ay);
(yderiv(plane_wave<CCTK_REAL>, dy)(t, p.x, p.y, p.z).az -
zderiv(plane_wave<CCTK_REAL>, dz)(t, p.x, p.y, p.z).ay);
});
Loop::loop_all<1, 0, 1>(cctkGH, [&](const Loop::PointDesc &p) {
byerr_(p.i, p.j, p.k) =
by_(p.i, p.j, p.k) -
(zderiv(plane_wave<CCTK_REAL>, dz)(t, p.x, p.y, p.z).ax -
xderiv(plane_wave<CCTK_REAL>, dx)(t, p.x, p.y, p.z).az);
});
Loop::loop_all<1, 1, 0>(cctkGH, [&](const Loop::PointDesc &p) {
bzerr_(p.i, p.j, p.k) =
bz_(p.i, p.j, p.k) -
(xderiv(plane_wave<CCTK_REAL>, dx)(t, p.x, p.y, p.z).ay -
yderiv(plane_wave<CCTK_REAL>, dy)(t, p.x, p.y, p.z).ax);
});
Loop::loop_all<0, 0, 0>(cctkGH, [&](const Loop::PointDesc &p) {
rhoerr_(p.i, p.j, p.k) = 0.0;
});
Loop::loop_all<1, 0, 0>(
cctkGH, [&](const Loop::PointDesc &p) { jxerr_(p.i, p.j, p.k) = 0.0; });
Loop::loop_all<0, 1, 0>(
cctkGH, [&](const Loop::PointDesc &p) { jyerr_(p.i, p.j, p.k) = 0.0; });
Loop::loop_all<0, 0, 1>(
cctkGH, [&](const Loop::PointDesc &p) { jzerr_(p.i, p.j, p.k) = 0.0; });
} else if (CCTK_EQUALS(initial_condition, "Gaussian wave")) {
Loop::loop_all<0, 0, 0>(cctkGH, [&](const Loop::PointDesc &p) {
phierr_(p.i, p.j, p.k) =
phi_(p.i, p.j, p.k) - gaussian_wave(t + dt / 2, p.x, p.y, p.z).phi;
});
Loop::loop_all<1, 0, 0>(cctkGH, [&](const Loop::PointDesc &p) {
axerr_(p.i, p.j, p.k) =
ax_(p.i, p.j, p.k) - gaussian_wave(t, p.x, p.y, p.z).ax;
});
Loop::loop_all<0, 1, 0>(cctkGH, [&](const Loop::PointDesc &p) {
ayerr_(p.i, p.j, p.k) =
ay_(p.i, p.j, p.k) - gaussian_wave(t, p.x, p.y, p.z).ay;
});
Loop::loop_all<0, 0, 1>(cctkGH, [&](const Loop::PointDesc &p) {
azerr_(p.i, p.j, p.k) =
az_(p.i, p.j, p.k) - gaussian_wave(t, p.x, p.y, p.z).az;
});
Loop::loop_all<1, 0, 0>(cctkGH, [&](const Loop::PointDesc &p) {
exerr_(p.i, p.j, p.k) =
ex_(p.i, p.j, p.k) -
(-xderiv(gaussian_wave<CCTK_REAL>, dx)(t + dt / 2, p.x, p.y, p.z)
.phi -
tderiv(gaussian_wave<CCTK_REAL>, dt)(t + dt / 2, p.x, p.y, p.z).ax);
});
Loop::loop_all<0, 1, 0>(cctkGH, [&](const Loop::PointDesc &p) {
eyerr_(p.i, p.j, p.k) =
ey_(p.i, p.j, p.k) -
(-yderiv(gaussian_wave<CCTK_REAL>, dy)(t + dt / 2, p.x, p.y, p.z)
.phi -
tderiv(gaussian_wave<CCTK_REAL>, dt)(t + dt / 2, p.x, p.y, p.z).ay);
});
Loop::loop_all<0, 0, 1>(cctkGH, [&](const Loop::PointDesc &p) {
ezerr_(p.i, p.j, p.k) =
ez_(p.i, p.j, p.k) -
(-zderiv(gaussian_wave<CCTK_REAL>, dz)(t + dt / 2, p.x, p.y, p.z)
.phi -
tderiv(gaussian_wave<CCTK_REAL>, dt)(t + dt / 2, p.x, p.y, p.z).az);
});
Loop::loop_all<0, 1, 1>(cctkGH, [&](const Loop::PointDesc &p) {
bxerr_(p.i, p.j, p.k) =
bx_(p.i, p.j, p.k) -
(yderiv(gaussian_wave<CCTK_REAL>, dy)(t, p.x, p.y, p.z).az -
zderiv(gaussian_wave<CCTK_REAL>, dz)(t, p.x, p.y, p.z).ay);
CCTK_REAL dx_phi_p = (phi[p.idx + p.di] - phi[p.idx]) / p.dx;
CCTK_REAL dx_phi_m = (phi[p.idx] - phi[p.idx - p.di]) / p.dx;
CCTK_REAL dy_phi_p = (phi[p.idx + p.dj] - phi[p.idx]) / p.dy;
CCTK_REAL dy_phi_m = (phi[p.idx] - phi[p.idx - p.dj]) / p.dy;
CCTK_REAL dz_phi_p = (phi[p.idx + p.dk] - phi[p.idx]) / p.dz;
CCTK_REAL dz_phi_m = (phi[p.idx] - phi[p.idx - p.dk]) / p.dz;
CCTK_REAL dx_phi_p = (phi[p.idx + p.di] - phi[p.idx]) / dx;
CCTK_REAL dx_phi_m = (phi[p.idx] - phi[p.idx - p.di]) / dx;
CCTK_REAL dy_phi_p = (phi[p.idx + p.dj] - phi[p.idx]) / dy;
CCTK_REAL dy_phi_m = (phi[p.idx] - phi[p.idx - p.dj]) / dy;
CCTK_REAL dz_phi_p = (phi[p.idx + p.dk] - phi[p.idx]) / dz;
CCTK_REAL dz_phi_m = (phi[p.idx] - phi[p.idx - p.dk]) / dz;
# CactusUtils thorns
!TARGET = $ARR
!TYPE = git
!URL = https://bitbucket.org/cactuscode/cactusutils.git
!REPO_PATH= $2
!CHECKOUT =
CactusUtils/Formaline
# CactusUtils/MemSpeed
# CactusUtils/NaNCatcher
# CactusUtils/NaNChecker
# CactusUtils/Nice
# CactusUtils/NoMPI
# CactusUtils/SystemStatistics
# CactusUtils/SystemTopology
# CactusUtils/TerminationTrigger
# CactusUtils/TimerReport
# CactusUtils/Trigger
# CactusUtils/Vectors
# CactusUtils/WatchDog