Skip to content

Fix AMR with the new energy model#141

Merged
marchdf merged 9 commits intomainfrom
fix-amr
Jul 2, 2025
Merged

Fix AMR with the new energy model#141
marchdf merged 9 commits intomainfrom
fix-amr

Conversation

@marchdf
Copy link
Copy Markdown
Collaborator

@marchdf marchdf commented Jun 27, 2025

The key line is increasing the m_f_nghost from 2 to 3

@marchdf
Copy link
Copy Markdown
Collaborator Author

marchdf commented Jul 1, 2025

This makes is so truly adaptive mesh refinement works. The sod_amr test case has a tagging based on density and the refinement zone follows the shock:

Green: level 0 data, red: sim with an extra level at the shock. You can see that the shock is sharper.

Screenshot 2025-07-01 at 2 28 21 PM

@marchdf
Copy link
Copy Markdown
Collaborator Author

marchdf commented Jul 1, 2025

The only issue right now is that the outflow BC doesn't work. So if you use this as is, it will try to refine the outlet and then fail. I had to switch the outlet to foextrap to have this run. So I am going hit pause on this and fix that first.

@marchdf
Copy link
Copy Markdown
Collaborator Author

marchdf commented Jul 2, 2025

ok fixed the outflow BC issue thingy by ensuring there are valid cells (foextrap) in the domain boundary cells when getting a field for tagging.

@marchdf
Copy link
Copy Markdown
Collaborator Author

marchdf commented Jul 2, 2025

And that last commit fixes things when there is mesh refinement at the BC:

Because:

  • level 1 takes 2 steps for level 0's 1 step, and because
  • our BC applier only applies a physical BC on the distributions pointing directly into the domain (otherwise it fills with -1)

Therefore:

  • we need to apply the physical BCs at each substep of a level advance. This ensures that the distribution pointing inwards is always valid. If we didn't do this, then on the second step of level 1, we would have a -1 from the second ghost cell (having reached the first ghost cell after the first step), come into the domain. Reapplying the physical BCs ensures this never happens.

@marchdf marchdf enabled auto-merge (squash) July 2, 2025 17:02
@marchdf marchdf merged commit 3252c02 into main Jul 2, 2025
17 checks passed
@marchdf marchdf deleted the fix-amr branch July 2, 2025 17:02
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.

1 participant