-
Notifications
You must be signed in to change notification settings - Fork 580
Generalize RotationalPeriodicBC for X-, Y-, or Z-axis #3591
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
base: develop
Are you sure you want to change the base?
Generalize RotationalPeriodicBC for X-, Y-, or Z-axis #3591
Conversation
… they should generate the same answers, need to run transport to get the results_true.dat
f1d71b5 to
dbd1a42
Compare
|
I think this is getting close. I'm currently running into a problem when trying to generate the test files I think I understand conceptually what's going on, i.e. the particle is moved to the other periodic surface and continues in the same direction (to where there is no geometry) when it should continue in the opposite direction (inside the geometry). I'm trying to find the correct line to fix this, but I didn't think I changed this behavior from how it worked when there was only rotational periodicity around the z-axis. |
src/boundary_condition.cpp
Outdated
| Position new_r = {cos_theta * r[axis_1_idx_] - sin_theta * r[axis_2_idx_], | ||
| sin_theta * r[axis_1_idx_] + cos_theta * r[axis_2_idx_], r[zero_axis_idx]}; | ||
| Direction new_u = {cos_theta * u[axis_1_idx_] - sin_theta * u[axis_2_idx_], | ||
| sin_theta * u[axis_1_idx_] + cos_theta * u[axis_2_idx_], u[zero_axis_idx]}; |
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.
Just realized that my "generalization" was based on the z-case that existed here before. The x and z cases should be similar but the y rotation matrix has the sign flipped, which I think explains why I'm seeing one test failure in this way. If we condition on zero_axis_idx I think I can get it right

…and new_u for correctness
|
So I just pushed my attempt at accounting for the signs in the transformation of r->new_r and u->new_u, but I'm still failing the tests. I did some scaffolding and it seems like my transformations are not actually transforming anything at all and I'm confused why. For example, the Am I missing some C++ thing about scope or something like that? // rotations around the y-axis have sign flipped for the sin_theta terms
int flip;
if (zero_axis_idx_ == 1) {
flip = -1;
} else {
flip = 1;
}
Position new_r;
new_r[zero_axis_idx_] = r[zero_axis_idx_];
new_r[axis_1_idx_] =
cos_theta * r[axis_1_idx_] - flip * sin_theta * r[axis_2_idx_];
new_r[axis_2_idx_] =
flip * sin_theta * r[axis_1_idx_] + cos_theta * r[axis_2_idx_];
Direction new_u;
new_u[zero_axis_idx_] = u[zero_axis_idx_];
new_u[axis_1_idx_] =
cos_theta * u[axis_1_idx_] - flip * sin_theta * u[axis_2_idx_];
new_u[axis_2_idx_] =
flip * sin_theta * u[axis_1_idx_] + cos_theta * u[axis_2_idx_]; |
Description
Currently only periodicity around the Z-axis is supported. This PR extends this capability for X and Y periodicity. Fixes #3559.
Checklist