Skip to content

Field Boundary refactor#1896

Merged
mbkuhn merged 29 commits intoExawind:mainfrom
mbkuhn:abl_bndry_refactor
Apr 13, 2026
Merged

Field Boundary refactor#1896
mbkuhn merged 29 commits intoExawind:mainfrom
mbkuhn:abl_bndry_refactor

Conversation

@mbkuhn
Copy link
Copy Markdown
Contributor

@mbkuhn mbkuhn commented Mar 27, 2026

Summary

There are a few field-based boundary conditions in the code that enable fillpatch operations to set Dirichlet conditions according to time- and space-varying inputs. The most prominent one is the ABL boundary plane capability, but there is also the modulated power law and ocean waves boundaries. Each of these belongs to a specific physics class, which is unnecessarily restrictive. This PR creates a field boundary manager to separate these capabilities from the physics classes. Backwards compatibility is retained. Aside from introducing the ability to instantiate and use field boundaries separately from their physics classes, no new capability is introduced by this PR. This PR also removes a lot of early return statements, relying on conditionals to either instantiate or not instead of using flags internal to each field boundary.

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: on Mac and on Kestrel
  • the regression tests
    • on GPU
    • on CPU: on Kestrel

Additional background

There are small diffs in two cases: abl_multiphase_laminar_input and abl_multiphase_laminar_inout. I was able to track down why these occur, and it has to do with the ordering of physics calls vs field boundary calls, now that the field boundaries are all called together and not from within the physics classes. For the precursors to these cases (which pass), the OceanWaves physics class applies the relaxation zones and then saves the boundary files, leading to the boundary files being slightly different, which then only shows up in the successor simulations (which fail). This new order is actually more accurate, so the diffs can be ignored.

I'll be making another PR after this one to add new features, and that'll be where I add new regression tests and documentation.

mbkuhn added 27 commits March 27, 2026 09:34
- still instantiated by physics classes
- still have functions called by physics classes
- address specifics of icns advection and set_inflow
- remove direct field boundary references from ABL
- still need to do this for OceanWaves physics
- allows field boundaries to be instantiated at proper time
- remove activate flag
- handle conflicts with other field boundaries
- enables abort statement to work as intended
- will enable more flexibility in the future
- pre_predictor physics is still needed for the sake of updating ow fields prior to boundaries
@mbkuhn mbkuhn marked this pull request as ready for review March 31, 2026 17:37
@mbkuhn mbkuhn requested review from baperry2 and Copilot March 31, 2026 17:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors “field-based” boundary-condition fill capabilities (e.g., ABL boundary planes, modulated power law, ocean waves boundary fills) out of individual Physics classes into a standalone, runtime-registered FieldBoundary system managed by FieldBoundaryMgr. The intent is to decouple boundary-fill behavior from physics modules while retaining backwards compatibility via input translation and updated call ordering.

Changes:

  • Introduces FieldBoundary / FieldBoundaryMgr and integrates field-boundary lifecycle hooks (post_init_actions, pre_advance_work, pre_predictor_work, post_advance_work) into CFDSim/incflo.
  • Migrates ABL BoundaryPlane + MPL and OceanWavesBoundary boundary-fill logic into amr-wind/boundary_conditions/field_boundary_fill and updates projection/inflow paths to use field boundaries instead of physics.
  • Updates unit tests and CMake targets to reflect the new structure and initialization sequence.

Reviewed changes

Copilot reviewed 35 out of 35 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
unit_tests/ocean_waves/test_relaxation_zones.cpp Updates tests to initialize and invoke field boundaries (OceanWavesBoundary) and updates MacProjOp construction.
unit_tests/equation_systems/test_icns_cstdens.cpp Updates MacProjOp construction to use field_boundary_manager().
unit_tests/core/test_field_fillpatch_ops.cpp Updates nodal-projection inflow helper to use field_boundaries() instead of physics_manager().
amr-wind/wind_energy/CMakeLists.txt Removes boundary-fill sources from wind_energy target list (now built under boundary_conditions).
amr-wind/wind_energy/ABL.H Removes ABL-owned boundary-fill members/accessors; includes new field-boundary headers.
amr-wind/wind_energy/ABL.cpp Translates legacy ABL inputs into incflo.field_boundaries and removes direct calls into boundary-fill objects.
amr-wind/projection/nodal_projection_ops.H Changes inflow helper signature to accept FieldBoundaryMgr::TypeVector&.
amr-wind/projection/incflo_apply_nodal_projection.cpp Applies inflow by iterating field boundaries and calling set_velocity on each.
amr-wind/overset/OversetOps.cpp Switches overset BoundaryPlane timing workaround to use FieldBoundaryMgr and BoundaryPlane::pre_advance_inner_calls().
amr-wind/ocean_waves/OceanWaves.H Removes embedded OceanWavesBoundary ownership/accessor; points include to new boundary location.
amr-wind/ocean_waves/OceanWaves.cpp Translates legacy / conflicting settings into incflo.field_boundaries and removes direct boundary object calls.
amr-wind/ocean_waves/CMakeLists.txt Removes old boundary_ops subdirectory from build.
amr-wind/incflo.H Updates ReadERF function include path.
amr-wind/incflo.cpp Calls field-boundary hooks during initialization and timestep post-advance; initializes field boundaries after physics.
amr-wind/incflo_advance.cpp Calls field-boundary pre-advance / pre-predictor hooks at appropriate timestep stages.
amr-wind/equation_systems/icns/icns_advection.H Updates MacProjOp to store/use FieldBoundaryMgr instead of PhysicsMgr.
amr-wind/equation_systems/icns/icns_advection.cpp Updates inflow-sibling logic and ABL/MPL special-casing to use field boundaries.
amr-wind/CFDSim.H Adds FieldBoundaryMgr and init_field_boundaries() API; exposes field_boundaries() convenience accessors.
amr-wind/CFDSim.cpp Implements init_field_boundaries() using incflo.field_boundaries.
amr-wind/boundary_conditions/field_boundary_fill/ReadERFFunction.H Moves/renames ReadERF function typedef and include guards.
amr-wind/boundary_conditions/field_boundary_fill/PlaneFillInflow.H Renames ABLFillInflow to PlaneFillInflow and updates to use BoundaryPlane.
amr-wind/boundary_conditions/field_boundary_fill/PlaneFillInflow.cpp Implements renamed PlaneFillInflow.
amr-wind/boundary_conditions/field_boundary_fill/OceanWavesFillInflow.H Updates include path to new OceanWavesBoundary location.
amr-wind/boundary_conditions/field_boundary_fill/OceanWavesFillInflow.cpp Updates include path to new OceanWavesFillInflow location.
amr-wind/boundary_conditions/field_boundary_fill/OceanWavesBoundary.H Makes OceanWavesBoundary a FieldBoundary type; adds lifecycle hooks and overrides set_velocity.
amr-wind/boundary_conditions/field_boundary_fill/OceanWavesBoundary.cpp Registers fill-patch ops in field-boundary hook and moves boundary-time tracking into lifecycle methods.
amr-wind/boundary_conditions/field_boundary_fill/ModulatedPowerLaw.H Makes MPL a FieldBoundary type and renames class/guards.
amr-wind/boundary_conditions/field_boundary_fill/ModulatedPowerLaw.cpp Ports MPL implementation and registers fill-patch ops under field-boundary lifecycle.
amr-wind/boundary_conditions/field_boundary_fill/FillMPL.H Renames ABLFillMPL to FillMPL and updates include/type names.
amr-wind/boundary_conditions/field_boundary_fill/FillMPL.cpp Implements renamed FillMPL.
amr-wind/boundary_conditions/field_boundary_fill/FieldBoundary.H Adds new FieldBoundary base interface and FieldBoundaryMgr collection type.
amr-wind/boundary_conditions/field_boundary_fill/CMakeLists.txt Adds new boundary-fill sources to build.
amr-wind/boundary_conditions/field_boundary_fill/BoundaryPlane.H Ports ABLBoundaryPlane to BoundaryPlane as a FieldBoundary type; adds set_velocity override and overset timing flag.
amr-wind/boundary_conditions/field_boundary_fill/BoundaryPlane.cpp Ports ABLBoundaryPlane implementation; adds legacy/new input parsing logic and overset timing split.
amr-wind/boundary_conditions/CMakeLists.txt Adds field_boundary_fill subdirectory to build.
Comments suppressed due to low confidence (1)

amr-wind/boundary_conditions/field_boundary_fill/FillMPL.H:16

  • The docstring still references ABLBoundaryPlane, but this fill operator now interfaces with ModulatedPowerLaw (see constructor arg and include). Update the comment/\sa reference to avoid misleading documentation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread amr-wind/boundary_conditions/field_boundary_fill/FieldBoundary.H
Comment thread amr-wind/ocean_waves/OceanWaves.cpp
Copy link
Copy Markdown

@d-montgomery d-montgomery left a comment

Choose a reason for hiding this comment

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

Thanks for adding this field boundary manager. I'm working my way through this PR and want to run the tests on Kestrel to see the diffs. In the meantime, I have a couple of comments about the logic for managing backwards compatibility. Does it make sense to amrex::Abort if both the old and new input parameters are found in the input file? I could see this happening while folks are migrating to the new inputs, and the current logic silently prefers the old input.

Comment thread amr-wind/boundary_conditions/field_boundary_fill/BoundaryPlane.cpp Outdated
Comment thread amr-wind/ocean_waves/OceanWaves.cpp
@mbkuhn
Copy link
Copy Markdown
Contributor Author

mbkuhn commented Apr 10, 2026

Thanks for adding this field boundary manager. I'm working my way through this PR and want to run the tests on Kestrel to see the diffs. In the meantime, I have a couple of comments about the logic for managing backwards compatibility. Does it make sense to amrex::Abort if both the old and new input parameters are found in the input file? I could see this happening while folks are migrating to the new inputs, and the current logic silently prefers the old input.

Thanks for going through it! I agree, there should be Aborts there when both inputs are specified. I'll add that to both sections.

@mbkuhn mbkuhn merged commit ee2c22b into Exawind:main Apr 13, 2026
15 checks passed
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