Conversation
…cFreeSurfaceModel The model_fields NamedTuple used during forcing materialization was built from hydrostatic_prognostic_fields (u, v, T, S, η) which excludes w, while the model_fields in tendency kernels is built from hydrostatic_fields (u, v, w, T, S, η) which includes w. This caused ContinuousForcing to store wrong field_dependencies_indices — e.g. index 3 for T at materialization time mapped to w at tendency computation time. Any ContinuousForcing with field_dependencies (including Relaxation) on HydrostaticFreeSurfaceModel was silently reading the wrong field. Fixes #5369 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Tests that ContinuousForcing with field_dependencies and an equivalent DiscreteForcing produce identical tendencies on HydrostaticFreeSurfaceModel. Co-Authored-By: Claude Opus 4.6 <[email protected]>
briochemc
added a commit
to briochemc/Oceananigans.jl
that referenced
this pull request
Mar 5, 2026
* glw/prescribed-free-surface: (0.105.3) Fix interpolation of terms in chain horizontal derivatives for MutableVerticalDiscretization (CliMA#5339) Fix ContinuousForcing field index mismatch in HydrostaticFreeSurfaceModel (CliMA#5370) Add dependency guardrail to Common Pitfalls (CliMA#5371) Fix typo SKR3 -> SRK3 (CliMA#5360) Add new reference to Zheng et al. (2025) in index (CliMA#5364) Add 9 missing papers to the reference list (CliMA#5363) Update papers section in index.md (CliMA#5362) Restructure AGENTS.md into multi-file agent configuration (CliMA#5350) (0.105.2) Fix `with_halo` for a `TripolarGrid` (CliMA#5353) (0.105.2) Fix and test checkpointing with open-domain simulations with a radiation `OpenBoundaryCondition` (CliMA#5347)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ContinuousForcingwithfield_dependencies(includingRelaxation) silently read the wrong field inHydrostaticFreeSurfaceModelmodel_fieldsused during forcing materialization was built fromhydrostatic_prognostic_fields(u, v, T, S, η)which excludesw, while themodel_fieldsin tendency kernels useshydrostatic_fields(u, v, w, T, S, η)which includeswfield_dependencies=:Twould readwinstead ofTat runtimeFix
One-line change: use
hydrostatic_fields(which includesw) instead ofprognostic_fieldswhen buildingmodel_fieldsfor forcing materialization, matching what the tendency kernels use.Closes #5369
Test plan
field_dependencies_indicesnow maps to the correct field at tendency computation time🤖 Generated with Claude Code