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

Bug Fix: Boundary prolongation only occurring on base stage #818

Merged
merged 9 commits into from
Feb 2, 2023

Conversation

lroberts36
Copy link
Collaborator

@lroberts36 lroberts36 commented Jan 25, 2023

PR Summary

This PR fixes a bug in the TaskStatus ProlongateBoundaries(std::shared_ptr<MeshBlockData<Real>> &rc) logic that caused prolongation to occur on the base stage MeshBlockData container of a given block, independent of which MeshBlockData stage was passed to ProlongateBoundaries. Because BoundaryValues::ProlongateBoundaries() was eventually called from the BoundaryValues object owned by the parent MeshBlock of the MeshBlockData, no information was passed through about which MeshBlockData associated with a given MeshBlock was asking for the boundary prolongation to occur. This PR also refactors the boundary prolongation code a bit so that there is not a hard to follow chain of calls (which is probably why this bug has persisted).

This fix of course causes regression tests that include mesh refinement to fail. If I switch the line

boundary_cond_impl::ProlongateGhostCells_(rc, nb, bi.s, bi.e, bj.s, bj.e, bk.s, bk.e);

to

boundary_cond_impl::ProlongateGhostCells_(pmb->meshblock_data.Get(), 
    nb, bi.s, bi.e, bj.s, bj.e, bk.s, bk.e);

in parthenon::ProlongateBoundaries(std::shared_ptr<MeshBlockData<Real>> &rc) all of the regression tests pass on v13. I have added a new set of updated gold files as v15 with the bug fixed.

Thanks to @pdmullen for finding that some ghost zone values were unset during intermediate RK stages which pointed to this issue.

PR Checklist

  • Code passes cpplint
  • Adds a test for any bugs fixed. Adds tests for new features.
  • Code is formatted
  • Changes are summarized in CHANGELOG.md
  • CI has been triggered on Darwin for performance regression tests.
  • (@lanl.gov employees) Update copyright on changed files

@lroberts36 lroberts36 added the bug Something isn't working label Jan 25, 2023
@lroberts36 lroberts36 changed the title Bug Fix: Boundary prolongation only occuring on base stage Bug Fix: Boundary prolongation only occurring on base stage Jan 25, 2023
Copy link
Collaborator

@pdmullen pdmullen left a comment

Choose a reason for hiding this comment

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

Looks good to me! I can confirm that @lroberts36's proposed fix solves issues I was encountering with ghost cell filling with mesh refinement.

The downstream codes I am working with point to here: f7f4e17 , but as I hope to be evidenced by regression testing, I trust this iteration of the fix equally addresses the issue.

@lroberts36
Copy link
Collaborator Author

@pdmullen: I will change the fix on the Riot parthenon branch to be the same as this just to double check.

@pdmullen
Copy link
Collaborator

@pdmullen: I will change the fix on the Riot parthenon branch to be the same as this just to double check.

Sounds great; I'll keep an eye out for it. I'll rerun my tests and report back here.

@pdmullen
Copy link
Collaborator

pdmullen commented Jan 26, 2023

@lroberts36 mimicked the changes in this PR in the lroberts36/merge-sparse-with-jdolence-sparse branch which our downstream code points to. I can confirm that

boundary_cond_impl::ProlongateGhostCells_(rc, nb, bi.s, bi.e, bj.s, bj.e, bk.s, bk.e);

vs

boundary_cond_impl::ProlongateGhostCells_(pmb->meshblock_data.Get(), 
    nb, bi.s, bi.e, bj.s, bj.e, bk.s, bk.e);

makes the difference between a passing and failing test, respectively. From my perspective, this PR is good to go.

Copy link
Collaborator

@bprather bprather left a comment

Choose a reason for hiding this comment

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

If Patrick vouches that it fixes the issue, I for one am happy with how it does. Always love a net-negative line count.

Copy link
Collaborator

@Yurlungur Yurlungur left a comment

Choose a reason for hiding this comment

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

Nice catch! I wish I'd caught this when I was mucking about in prolongation/restriction.

To update the gold files, run the tests locally, then zip up the files and make a new release. Add the zip files to the release, and update the version and hash in the cmake.

@Yurlungur
Copy link
Collaborator

To update the gold files, run the tests locally, then zip up the files and make a new release. Add the zip files to the release, and update the version and hash in the cmake.

Maybe @pgrete has some magic to automate this.

@lroberts36
Copy link
Collaborator Author

I made the release that updates the gold files for this bug fix a pre-release. Once this is merged, I guess it should be switched to being the latest release.

@pgrete
Copy link
Collaborator

pgrete commented Feb 1, 2023

To update the gold files, run the tests locally, then zip up the files and make a new release. Add the zip files to the release, and update the version and hash in the cmake.

Maybe @pgrete has some magic to automate this.

No magic here but that reminds me that we should probably document those steps (and also how to make a release) -- opened an issue for this #823 .

Copy link
Collaborator

@pgrete pgrete left a comment

Choose a reason for hiding this comment

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

LGTM I just have one cleanup suggestion and one clarification request (both non-blocking)

src/bvals/boundary_conditions.cpp Outdated Show resolved Hide resolved
@lroberts36 lroberts36 enabled auto-merge (squash) February 2, 2023 01:41
@lroberts36 lroberts36 merged commit b866f72 into develop Feb 2, 2023
@pgrete pgrete deleted the lroberts36/fix-prolongation-stage-bug branch February 2, 2023 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants