YRL5XGH3TJKZKX5L6TBQF7FL3OTVIEBMC23ISQROZ3HQ3MCZQ7HQC
} "Set up initial conditions"
SCHEDULE Maxwell_Boundaries AT initial AFTER Maxwell_Initial
{
LANG: C
READS: dyz(interior) dzx(interior) dxy(interior)
READS: byz(interior) bzx(interior) bxy(interior)
WRITES: dyz(boundary) dzx(boundary) dxy(boundary)
WRITES: byz(boundary) bzx(boundary) bxy(boundary)
} "Calculate RHS"
SCHEDULE Maxwell_RHSBoundaries IN ODESolvers_RHS AFTER Maxwell_RHS
{
LANG: C
READS: dtdyz(interior) dtdzx(interior) dtdxy(interior)
READS: dtbyz(interior) dtbzx(interior) dtbxy(interior)
WRITES: dtdyz(boundary) dtdzx(boundary) dtdxy(boundary)
WRITES: dtbyz(boundary) dtbzx(boundary) dtbxy(boundary)
WRITES: avgdyz(interior) avgdzx(interior) avgdxy(interior)
WRITES: avgbyz(interior) avgbzx(interior) avgbxy(interior)
SYNC: avgd
SYNC: avgb
WRITES: avgdyz(everywhere) avgdzx(everywhere) avgdxy(everywhere)
WRITES: avgbyz(everywhere) avgbzx(everywhere) avgbxy(everywhere)
for (int d = 0; d < dim; ++d)
assert(cctk_nghostzones[d] <= 1);
const GF3D<CCTK_REAL, 0, 1, 1> dyz_(cctkGH, dyz);
const GF3D<CCTK_REAL, 1, 0, 1> dzx_(cctkGH, dzx);
const GF3D<CCTK_REAL, 1, 1, 0> dxy_(cctkGH, dxy);
const GF3D<CCTK_REAL, 0, 1, 1> byz_(cctkGH, byz);
const GF3D<CCTK_REAL, 1, 0, 1> bzx_(cctkGH, bzx);
const GF3D<CCTK_REAL, 1, 1, 0> bxy_(cctkGH, bxy);
// do nothing
loop_bnd<0, 1, 1>(cctkGH, [&](const PointDesc &p) {
int f = p.NI[0] != 0 ? -1 : +1;
dyz_(p.I) = f * dyz_(p.I - p.NI);
});
loop_bnd<1, 0, 1>(cctkGH, [&](const PointDesc &p) {
int f = p.NI[1] != 0 ? -1 : +1;
dzx_(p.I) = f * dzx_(p.I - p.NI);
});
loop_bnd<1, 1, 0>(cctkGH, [&](const PointDesc &p) {
int f = p.NI[2] != 0 ? -1 : +1;
dxy_(p.I) = f * dxy_(p.I - p.NI);
});
loop_bnd<0, 1, 1>(cctkGH, [&](const PointDesc &p) { byz_(p.I) = 0; });
loop_bnd<1, 0, 1>(cctkGH, [&](const PointDesc &p) { bzx_(p.I) = 0; });
loop_bnd<1, 1, 0>(cctkGH, [&](const PointDesc &p) { bxy_(p.I) = 0; });
});
} else if (CCTK_EQUALS(setup, "standing wave")) {
// wave number
const CCTK_REAL kx = CCTK_REAL(M_PI) * spatial_frequency_x;
const CCTK_REAL ky = CCTK_REAL(M_PI) * spatial_frequency_y;
const CCTK_REAL kz = CCTK_REAL(M_PI) * spatial_frequency_z;
const CCTK_REAL omega = sqrt(pow2(kx) + pow2(ky) + pow2(kz));
// amplitude
const CCTK_REAL hx = amplitude_x;
const CCTK_REAL hy = amplitude_y;
const CCTK_REAL hz = amplitude_z;
loop_int<0, 1, 1>(cctkGH, [&](const PointDesc &p) {
dyz_(p.I) =
hx * cos(omega * t) * sin(kx * p.x) * sin(ky * p.y) * sin(kz * p.z);
});
loop_int<1, 0, 1>(cctkGH, [&](const PointDesc &p) {
dzx_(p.I) =
hy * cos(omega * t) * sin(kx * p.x) * sin(ky * p.y) * sin(kz * p.z);
});
loop_int<1, 1, 0>(cctkGH, [&](const PointDesc &p) {
dxy_(p.I) =
hz * cos(omega * t) * sin(kx * p.x) * sin(ky * p.y) * sin(kz * p.z);
loop_int<0, 1, 1>(cctkGH, [&](const PointDesc &p) {
byz_(p.I) =
hz * cos(omega * t) * cos(kx * p.x) * cos(ky * p.y) * cos(kz * p.z);
});
loop_int<1, 0, 1>(cctkGH, [&](const PointDesc &p) {
bzx_(p.I) =
hx * cos(omega * t) * cos(kx * p.x) * cos(ky * p.y) * cos(kz * p.z);
});
loop_int<1, 1, 0>(cctkGH, [&](const PointDesc &p) {
bxy_(p.I) =
hy * cos(omega * t) * cos(kx * p.x) * cos(ky * p.y) * cos(kz * p.z);
});
#include <loop.hxx>
#include <cctk.h>
#include <cctk_Arguments_Checked.h>
#include <cctk_Parameters.h>
namespace Maxwell {
using namespace Loop;
extern "C" void Maxwell_RHSBoundaries(CCTK_ARGUMENTS) {
DECLARE_CCTK_ARGUMENTS_Maxwell_RHSBoundaries;
DECLARE_CCTK_PARAMETERS;
const GF3D<CCTK_REAL, 0, 1, 1> dtdyz_(cctkGH, dtdyz);
const GF3D<CCTK_REAL, 1, 0, 1> dtdzx_(cctkGH, dtdzx);
const GF3D<CCTK_REAL, 1, 1, 0> dtdxy_(cctkGH, dtdxy);
const GF3D<CCTK_REAL, 0, 1, 1> dtbyz_(cctkGH, dtbyz);
const GF3D<CCTK_REAL, 1, 0, 1> dtbzx_(cctkGH, dtbzx);
const GF3D<CCTK_REAL, 1, 1, 0> dtbxy_(cctkGH, dtbxy);
loop_bnd<0, 1, 1>(cctkGH, [&](const PointDesc &p) { dtdyz_(p.I) = 0; });
loop_bnd<1, 0, 1>(cctkGH, [&](const PointDesc &p) { dtdzx_(p.I) = 0; });
loop_bnd<1, 1, 0>(cctkGH, [&](const PointDesc &p) { dtdxy_(p.I) = 0; });
loop_bnd<0, 1, 1>(cctkGH, [&](const PointDesc &p) { dtbyz_(p.I) = 0; });
loop_bnd<1, 0, 1>(cctkGH, [&](const PointDesc &p) { dtbzx_(p.I) = 0; });
loop_bnd<1, 1, 0>(cctkGH, [&](const PointDesc &p) { dtbxy_(p.I) = 0; });
}
} // namespace Maxwell