Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue669 coupler fluxes #790

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Open

Issue669 coupler fluxes #790

wants to merge 13 commits into from

Conversation

einola
Copy link
Member

@einola einola commented Feb 10, 2025

Ocean fluxes for the coupler

Fixes #669

Task List

  • Defined the tests that specify a complete and functioning change (It may help to create a design specification & test specification)
  • Implemented the source code change that satisfies the tests
  • Documented the feature by providing worked example
  • Updated the README or other documentation
  • Completed the pre-Request checklist below

Change Description

Populate IOceanBoundary::m_couplingArrays with references to the arrays needed for coupling and make sure the sending arrays contain physical data.

The sending arrays are

  • FWFLUX: Fresh water flux [kg/m^2/s]
  • O_STRESS_X & O_STRESS_Y: The x- and y-components of the ocean surface stress [N/m^2]
  • Q_SS_NO_SW: Non-solar heat flux at the ocean surface [W/m^2]
  • Q_SS_SW: Solar (shortwave) flux at the ocean surface [W/m^2]
  • SFLUX: Salt flux at the ocean surface [kg/m^2/s]

The sending arrays contain averaged values from both ice and open-water contributions, calculated in a new function in IOceanBoundary::mergeFluxes. This uses the standard weighted average between ocean and atmosphere for the fluxes. We could imagine doing it differently, but that's still an active area of research.

The recieving arrays are:

  • MLD: The mixed layer depth [m]
  • OCEAN_U & OCEAN_V: Ocean u and v velocities [m/s]
  • SSH: The sea surface height [m]
  • SSS: The sea surface salinity [PSU]
  • SST: The sea surface temperature [°C]

All the recieving arrays are already in use and the m_coupingArrays reference points to the already existing arrays registered in the central ModelArrayReferenceStore. All the arrays named here are owned by IOceanBoundary.

To get this working, I moved the CouplingFields namespace to the ModelComponent scope.

I rewrote slabOcean to use mergeFluxes and m_couplingArrays.

Future ocean coupling code should rely on m_couplingArrays for all its functionality.


Test Description

All existing test work. I added additional tests to test the computation of ocean stress in open water.


Documentation Impact

N/A


Other Details

None


Pre-Request Checklist

  • The requirements of this pull request are fully captured in an issue or design specification and are linked and summarised in the description of this PR
  • No new warnings are generated
  • The documentation has been updated (or an issue has been created to track the corresponding change)
  • Methods and Tests are commented such that they can be understood without having to obtain additional context
  • This PR/Issue is labelled as a bug/feature/enhancement/breaking change
  • File dates have been updated to reflect modification date
  • This change conforms to the conventions described in the README

In particular, these are: the non-solar heat flux (Q_NO_SUN), the
short-wave flux (Q_SW_OCN), the fresh-water flux (FWFLUX), and the salt
flux (SFLUX), all at the ocean surface. I also defined the short wave
flux through the base of the ice, but it's zero for now.

This is an initial commit. It compiles, but is untested and still a bit
messy.
We now need to define Q_SW_OW and Q_SW_BASE as HFields before starting.
Is that a good idea or not? Time will tell.
It's not very nice anyway, and the old nextim code can be reproduced
using fwFlux alone.
I moved the namespace CouplingFields to the ModelComponent scope, added
some definitions IOceanBoundary's m_couplingArrays store, passed this to
SlabOcean and used them in the calculations. This makes life easier,
because the Shared and Protected namespaces are already overflowing.
This is radiation at the ocean surface, so these variables belong there,
not in IAtmosphereBoundary.
Adds a calculation for atmosphere-ocean stress in open water and the
(linear) combination of atmosphere-ocean and ice-ocean stresses at the
ocean surface.
It's all semantics, really, but it's nice to group the fluxes in one
place, and IAtmosphereBoundary.hpp makes more sense for that than
IOceanBoundary.hpp.
Get the test running, test the return of OW_STRESS_X/Y, and fix a bug in
the open water stress calculation (tests are good!).
@einola einola marked this pull request as draft February 11, 2025 08:23
@einola einola marked this pull request as ready for review February 11, 2025 16:48
@einola einola requested a review from timspainNERSC February 11, 2025 16:48
@einola einola marked this pull request as draft February 13, 2025 12:27
Because I misunderstood how clampBelow works (or was maybe a bit too
quick).
@einola einola marked this pull request as ready for review February 17, 2025 14:04
@einola
Copy link
Member Author

einola commented Feb 17, 2025

Ready for review @timspainNERSC

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.

Ocean fluxes for the coupler
1 participant