Skip to content

MakeNewGrids: param to set number of grid iterations#4903

Merged
WeiqunZhang merged 2 commits intoAMReX-Codes:developmentfrom
BenWibking:dynamic-grid-iter
Jan 19, 2026
Merged

MakeNewGrids: param to set number of grid iterations#4903
WeiqunZhang merged 2 commits intoAMReX-Codes:developmentfrom
BenWibking:dynamic-grid-iter

Conversation

@BenWibking
Copy link
Copy Markdown
Contributor

@BenWibking BenWibking commented Jan 17, 2026

Summary

This adds the ability to set the number of grid iterations in MakeNewGrids. The default is 4, which was the previous hard-coded value.

Additional background

For some problems, this is required for correct grid generation. This typically is only needed with deeply nested AMR hierarchies (8+ levels).
See https://github.com/BenWibking/amrex-gridgen-test for a reproducer of the original issue.

Checklist

The proposed changes:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • include documentation in the code and/or rst files, if appropriate

@BenWibking BenWibking changed the title add dynamic iteration for grid generation MakeNewGrids: add dynamic iteration for grid generation Jan 17, 2026
@BenWibking BenWibking changed the title MakeNewGrids: add dynamic iteration for grid generation MakeNewGrids: add dynamic iteration and cycle detection Jan 17, 2026
@BenWibking BenWibking marked this pull request as ready for review January 17, 2026 18:52
@WeiqunZhang
Copy link
Copy Markdown
Member

The approach in this PR may not be necessary. Could we simply change that hardwired 4 to a parameter that has a default value of 4. I think for location based tagging, it's sufficient to have the iteration number set to max_level. During each iteration a fine level can grow to its coarse level's domain. So with max_level iterations, it should be sufficient (again assuming tagging is location based and it does not change during the iteration).

@BenWibking BenWibking changed the title MakeNewGrids: add dynamic iteration and cycle detection MakeNewGrids: param to set number of grid iterations Jan 18, 2026
@BenWibking
Copy link
Copy Markdown
Contributor Author

@WeiqunZhang Ok, I've changed the PR to just add a runtime parameter for the max number of iterations. We can set this equal to amr.max_level by default in our code.

@WeiqunZhang WeiqunZhang merged commit 625dada into AMReX-Codes:development Jan 19, 2026
74 checks passed
BenWibking added a commit to quokka-astro/quokka that referenced this pull request Jan 25, 2026
Sets a safe default for the number of iterations to perform when tagging and re-gridding AMR levels.

See AMReX-Codes/amrex#4903.
github-merge-queue bot pushed a commit to quokka-astro/quokka that referenced this pull request Jan 27, 2026
### Description
Sets a safe default for the number of iterations to perform when tagging
and re-gridding AMR levels.
This is an example of why this is required:
https://github.com/BenWibking/amrex-gridgen-test

### Related issues
See AMReX-Codes/amrex#4903.

### Checklist
_Before this pull request can be reviewed, all of these tasks should be
completed. Denote completed tasks with an `x` inside the square brackets
`[ ]` in the Markdown source below:_
- [x] I have added a description (see above).
- [x] I have added a link to any related issues (if applicable; see
above).
- [x] I have read the [Contributing
Guide](https://github.com/quokka-astro/quokka/blob/development/CONTRIBUTING.md).
- [ ] I have added tests for any new physics that this PR adds to the
code.
- [ ] *(For quokka-astro org members)* I have manually triggered the GPU
tests with the magic comment `/azp run`.

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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