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

Combine two functions for periodically shifting particles into one and re-use #1152

Merged
merged 2 commits into from
Jul 18, 2020

Conversation

atmyers
Copy link
Member

@atmyers atmyers commented Jul 17, 2020

This gets rid of some code duplication.

@@ -222,8 +224,11 @@ void enforcePeriodic (P& p,
// clamp to avoid precision issues;
if (p.pos(idim) == phi[idim]) p.pos(idim) = plo[idim];
if (p.pos(idim) > phi[idim]) p.pos(idim) = std::nextafter( (amrex::ParticleReal) phi[idim], (amrex::ParticleReal) plo[idim]);
shifted = true;
}
}
Copy link
Contributor

@jmsexton03 jmsexton03 Jul 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assertion from PeriodicShift in terms of enforce_periodic should be:
AMREX_ASSERT( (p.pos(idim) >= plo[idim] ) and ( p.pos(idim) < phi[idim] ));

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this back in.

@atmyers atmyers merged commit 9a48873 into AMReX-Codes:development Jul 18, 2020
dwillcox pushed a commit to dwillcox/amrex that referenced this pull request Oct 3, 2020
…d re-use (AMReX-Codes#1152)

* combine periodic shifts into one and re-use

* fix assertion
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.

3 participants