Skip to content

Regularize halo-fold coupling flux fields#267

Open
taimoorsohail wants to merge 10 commits into
mainfrom
ts/try-halo-fold-diagnosis
Open

Regularize halo-fold coupling flux fields#267
taimoorsohail wants to merge 10 commits into
mainfrom
ts/try-halo-fold-diagnosis

Conversation

@taimoorsohail
Copy link
Copy Markdown
Collaborator

Summary

Regularize sea-ice/ocean coupling fields at halo and fold boundaries before they are reused in tripolar-grid flux calculations.

Problem

The branch ts/try-halo-fold-diagnosis fixes a halo-fold issue in NumericalEarth.jl. Several interface and assembled boundary-flux fields were being consumed before their halo or fold values were refreshed, which can lead to inconsistent reads across fold-adjacent cells on tripolar grids.

Fix

Call fill_halo_regions! on the relevant momentum, tracer, and assembled net-flux fields at the points where they are about to be reused by later kernels or by the ocean boundary-condition machinery. This keeps the fold treatment delegated to each field's own zipper boundary condition instead of hard-coding a pivot choice into the coupling code.

Files changed

  • src/EarthSystemModels/InterfaceComputations/sea_ice_ocean_fluxes.jl
  • src/Oceans/assemble_net_ocean_fluxes.jl

Changes in each file

  • src/EarthSystemModels/InterfaceComputations/sea_ice_ocean_fluxes.jl: import fill_halo_regions! and refresh the sea-ice momentum flux halos before computing scalar ice-ocean fluxes.
  • src/EarthSystemModels/InterfaceComputations/sea_ice_ocean_fluxes.jl: refresh the source ocean tracer halos before the coupling kernel reads fold-adjacent cells.
  • src/EarthSystemModels/InterfaceComputations/sea_ice_ocean_fluxes.jl: refresh the computed scalar surface flux fields, plus Tˢⁱ and Sˢⁱ for the three-equation formulation, before downstream assemblers consume them.
  • src/Oceans/assemble_net_ocean_fluxes.jl: import fill_halo_regions! and refresh the assembled net ocean boundary flux fields (T, S, u, v) before they are used as ocean tracer and momentum boundary conditions.

Validation

Not run locally per repository instructions; validation will come from GitHub-managed CI.

@taimoorsohail
Copy link
Copy Markdown
Collaborator Author

@simone-silvestri Codex found this bug in the (lack of halo filling) in some of the terms in the fluxes in NumericalEarth.jl.

While I think it is a legitimate bug (hence the PR), it didn't make a difference to the numerical instabilities around the halo/fold region in the 1/6th run.

@taimoorsohail taimoorsohail marked this pull request as ready for review May 21, 2026 05:43
@taimoorsohail taimoorsohail requested review from glwagner, navidcy and simone-silvestri and removed request for simone-silvestri May 21, 2026 05:44
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...els/InterfaceComputations/InterfaceComputations.jl 0.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

taimoorsohail and others added 3 commits May 21, 2026 17:09
Removed regularization of the source ocean tracer state before coupling.
Removed unnecessary comments and halo filling for fluxes.
Removed unused fill_halo_regions! import and its call.
Removed the call to fill_halo_regions! for net ocean fluxes.
@navidcy
Copy link
Copy Markdown
Member

navidcy commented May 21, 2026

Is this the culprit that we were seeing that suspiciously horizontal line of tracer you think?

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