Skip to content

Improvements to make field-based refinements work as expected at initialization (for estuary flows) - #2021

Open
mbkuhn wants to merge 5 commits into
kynema:mainfrom
mbkuhn:estuary_init_improve
Open

Improvements to make field-based refinements work as expected at initialization (for estuary flows)#2021
mbkuhn wants to merge 5 commits into
kynema:mainfrom
mbkuhn:estuary_init_improve

Conversation

@mbkuhn

@mbkuhn mbkuhn commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

For most multiphase flow cases, the initializer in a physics class sets up a levelset field (e.g., SloshingTank, ChannelBuilder, OceanWaves), then MultiPhase physics (in post_init) converts the levelset field to vof and then calculates the density from the vof field. That means that the vof field isn't calculated by the time it is being used for a field refinement, which is undesirable. The solution is to put those post_init actions direcly into initialize_fields(). This PR does that for ChannelBuilder, which we are currently using as the estuary flow initializer.

There is also a conditional in TerrainDrag that prevents cells within the bottom boundary as being identified as terrain. That leads to a gradient being identified there by gradient field refinement, which is undesirable. Turning that off - need to confirm with tests that it doesn't mess up terrain runs (I don't expect it to matter).

Pull request type

Please check the type of change introduced:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

Checklist

The following is included:

  • new unit-test(s)
  • new regression test(s)
  • documentation for new capability

This PR was tested by running:

  • the unit tests
    • on GPU
    • on CPU
  • the regression tests
    • on GPU
    • on CPU

Additional background

Issue Number:

@mbkuhn

mbkuhn commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

The reg tests fail due to the terrain_box_amr. However, this test features something this PR is trying to change, which is refining at the bottom boundary due to the terrain_blank values always being 0 inside the boundary. To test if the PR actually changes the results aside from changing the mesh, I did one run with main where I set a bounding box for the field refinement. This made the meshes identical between the main branch version of the reg test and the PR version of it. With the same mesh, there were no diffs.

@mbkuhn
mbkuhn requested a review from d-montgomery August 20, 2026 16:08
@mbkuhn
mbkuhn marked this pull request as ready for review August 20, 2026 16:08
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