COCGSXFZAM7XB6JFRIAEAZGS5RQKFGOS7OGBLLUCSW6WT2PVWD6AC
PWSDKG6IXDXOWDMF5P3KMH5YQVABQLCPFKMT7WF4PI6BD2I5G3LQC
GKKJ75HX2ERLVBZVE2CUB6T3J2SUT7R3UKEKTEYNOG43ZKX6X5MQC
2V4VNNOWTOFSM22PBTFKP73NMTFDYCHFKWTMD4BJVSXA3DGI33KAC
FIZ4UQEPE2TMH2KR47KKJS2B24LRHZPB7M6MCEI4RUCOBV56JU5QC
BZIXJKSVJVIFMYLNKQMNCCOEAEF44CJHCBRD6FYYQGFODQYINIRQC
NU2IQRZ35URLJX3LHQNYCRYQAKYFT4MUARSYKEWHS2NWGQ525W6AC
VWANG2UUPKW6YVZ5CGFXSTLQYQPINOA24M3BEITIZGIX6H3WNRHQC
LY3PYR4JIRLBS3MH2LVHNFOXGR4NMNTZRA4LMYITZ5QPCT554S4AC
NKZ62JLSJQ7WH6ERIPBWSU63CAP4H3GHYCUL6JKQELBY7V33HGOAC
3HOGAA6NFEOTDI6JWZK6YXA4VQUTHJYEW4VFGJEVQJE457RZPJXAC
XIVFKBY3NZR3BGMKVLIW7GYHDAEN27DM75YPVMOOQGK2F5N4A6KQC
USTERO3AEVALHM74N4357AK3M3XMPYX524E3BHG4NCRMKL3L3DSAC
CCTK_REAL data TYPE=GF TIMELEVELS=1 "test grid function"
CCTK_REAL data TYPE=gf TIMELEVELS=1 "test grid function"
# CCTK_REAL gf000 TYPE=gf TAGS='index={0 0 0}' "Test grid function"
# CCTK_REAL gf001 TYPE=gf TAGS='index={0 0 1}' "Test grid function"
# CCTK_REAL gf010 TYPE=gf TAGS='index={0 1 0}' "Test grid function"
# CCTK_REAL gf011 TYPE=gf TAGS='index={0 1 1}' "Test grid function"
# CCTK_REAL gf100 TYPE=gf TAGS='index={1 0 0}' "Test grid function"
# CCTK_REAL gf101 TYPE=gf TAGS='index={1 0 1}' "Test grid function"
# CCTK_REAL gf110 TYPE=gf TAGS='index={1 1 0}' "Test grid function"
# CCTK_REAL gf111 TYPE=gf TAGS='index={1 1 1}' "Test grid function"
WRITES: data(interior) max_diff(interior)
WRITES: max_diff(interior)
WRITES: data(interior)
# WRITES: gf000(interior)
# WRITES: gf001(interior)
# WRITES: gf010(interior)
# WRITES: gf011(interior)
# WRITES: gf100(interior)
# WRITES: gf101(interior)
# WRITES: gf110(interior)
# WRITES: gf111(interior)
# need to apply b/c in POSTRESTRICT
SCHEDULE TestProlongate_Sync IN CCTK_POSTRESTRICT
SCHEDULE TestProlongate_Sync IN postregrid
{
LANG: C
WRITES: data(boundary)
SYNC: data
# SYNC: gf000
# SYNC: gf001
# SYNC: gf010
# SYNC: gf011
# SYNC: gf100
# SYNC: gf101
# SYNC: gf110
# SYNC: gf111
} "Sync up test data"
SCHEDULE TestProlongate_Sync IN postrestrict
extern "C" void TestProlongate_Test(CCTK_ARGUMENTS) {
template <typename T>
T fun1d(const T x, const T dx, const bool avgx, const int order) {
if (!avgx)
return pow(x, order);
else
return (pow(x + dx / 2, order + 1) - pow(x - dx / 2, order + 1)) /
((order + 1) * dx);
}
// The grid stores the average values of the underlying function (x*y*z)**n
// which amounts to storing differences of the anti-derivative 1/(n+1)**3 *
// (x*y*z)**(n+1)
template <typename T>
T fun(const T x, const T y, const T z, const T dx, const T dy, const T dz,
const bool avgx, const bool avgy, const bool avgz, const int order) {
return fun1d(x, dx, avgx, order) * fun1d(y, dy, avgy, order) *
fun1d(z, dz, avgz, order);
}
extern "C" void TestProlongate_Set(CCTK_ARGUMENTS) {
// get prolongation order from driver, the parmeter is private since really
const CCTK_REAL dx = CCTK_DELTA_SPACE(0);
const CCTK_REAL dy = CCTK_DELTA_SPACE(1);
const CCTK_REAL dz = CCTK_DELTA_SPACE(2);
// Get prolongation order from driver, the parmeter is private since really
const void *prolongation_type_p =
CCTK_ParameterGet("prolongation_type", "CarpetX", &prolongation_type_type);
const void *prolongation_type_p = CCTK_ParameterGet(
"prolongation_type", "CarpetX", &prolongation_type_type);
CCTK_EQUALS(prolongation_type, "conservative");
// the grid stores the average values of the underlying function
// (x*y*z)**n which amounts to storing differences of the anti-derivative
// 1/(n+1)**3 * (x*y*z)**(n+1)
auto avg_fun = [&](CCTK_REAL xi, int dir) {
return 1./(operator_order + 1) *
(pow(xi+CCTK_DELTA_SPACE(dir)/2., operator_order + 1) -
pow(xi-CCTK_DELTA_SPACE(dir)/2., operator_order + 1)) /
CCTK_DELTA_SPACE(dir);
};
CCTK_EQUALS(prolongation_type, "conservative");
CCTK_REAL good_data;
if (conservative_prolongation) {
good_data = avg_fun(p.x, 0) * avg_fun(p.y, 1) * avg_fun(p.z, 2);
} else {
good_data = pow(p.x * p.y * p.z, operator_order);
}
const CCTK_REAL good_data = fun(
p.x, p.y, p.z, dx, dy, dz, conservative_prolongation,
conservative_prolongation, conservative_prolongation, operator_order);
if (fabs(p.x) <= refined_radius && fabs(p.y) <= refined_radius &&
fabs(p.z) <= refined_radius) {
regrid_error[p.idx] = 1e3;
if (cctk_iteration < regrid_after) {
regrid_error[p.idx] = 0;
const void *prolongation_type_p =
CCTK_ParameterGet("prolongation_type", "CarpetX", &prolongation_type_type);
const void *prolongation_type_p = CCTK_ParameterGet(
"prolongation_type", "CarpetX", &prolongation_type_type);
CCTK_EQUALS(prolongation_type, "conservative");
// the grid stores the average values of the underlying function
// (x*y*z)**n which amounts to storing differences of the anti-derivative
// 1/(n+1)**3 * (x*y*z)**(n+1)
auto avg_fun = [&](CCTK_REAL xi, int dir) {
return 1./(operator_order + 1) *
(pow(xi+CCTK_DELTA_SPACE(dir)/2., operator_order + 1) -
pow(xi-CCTK_DELTA_SPACE(dir)/2., operator_order + 1)) /
CCTK_DELTA_SPACE(dir);
};
CCTK_EQUALS(prolongation_type, "conservative");
CCTK_REAL good_data;
if (conservative_prolongation) {
good_data = avg_fun(p.x, 0) * avg_fun(p.y, 1) * avg_fun(p.z, 2);
} else {
good_data = pow(p.x * p.y * p.z, operator_order);
}
const CCTK_REAL good_data = fun(
p.x, p.y, p.z, dx, dy, dz, conservative_prolongation,
conservative_prolongation, conservative_prolongation, operator_order);