-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add xparity constraints #74
base: master
Are you sure you want to change the base?
Conversation
for (i = 0; 2*i < nx; ++i) { | ||
for (j = 0; j <= ny; ++j) { | ||
int ij = i * ny + j; | ||
int ij2 = i * ny + (j > 0 ? ny - j : 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ij2 here should flip i
, not j
.
0.5*(SCALAR_IM(u2) - xparity*SCALAR_IM(u))); | ||
ASSIGN_SCALAR(X.data[(ijk2 * 2 + 1) * X.p + b], | ||
0.5*(SCALAR_RE(v2) + xparity*SCALAR_RE(v)), | ||
0.5*(SCALAR_IM(v2) + xparity*SCALAR_IM(v))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't right. It's tricky, because we are mirror flipping a vector field, but the vector field is stored in a funny "transverse" coordinate system in order to impose a key mathematical constraint.
The "transverse" coordinate system is specially chosen to have nice properties for mirror flipping in the y and z direction: https://github.com/stevengj/mpb/blob/62495d4f9b3402b31383f0cc255cb5a95d033f7e/src/maxwell/maxwell.c#L398-L399
but it may not be so nice for flipping in x.
Closes #72. I'm not sure I got the indexing correct in the loops. Any ideas for a test?
@stevengj @oskooi