Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add xparity constraints #74

wants to merge 2 commits into from

Conversation

ChristopherHogan
Copy link
Contributor

Closes #72. I'm not sure I got the indexing correct in the loops. Any ideas for a test?
@stevengj @oskooi

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);
Copy link
Collaborator

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)));
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants