Description
Background
The weather team at Sofar Ocean has been working on a coupled atmosphere-wave model application, based on FV3-SHiELD for the atmosphere/land and WaveWatchIII for the wave component (as a start - we are working on adding MOM6 as the ocean component). For atmosphere-wave coupling, we are passing surface neutral winds, air-density and air-sea temperature differences from atmos to waves, and the Charnock paramter from waves to atmosphere. We were previously using a simple ESMF/NUOPC mediator, but quickly ran into the issue of only being able to run coupled at the atmosphere step (2.5min for our global model), so we decided to move to CMEPS as our mediator. We've had some success with the new coupling (we can now run at lower coupling frequencies, among other advantages), but have 1 outstanding masking issue (explained below).
Description
I noticed that some of the default masking options are changed depending on application specific uses:
!----------------------------------------------------------
! Default masking: for each component, the first element is
! when it is the src and the second element is when it is
! the destination
!----------------------------------------------------------
nullify(is_local%wrap)
call ESMF_GridCompGetInternalState(gcomp, is_local, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
allocate(defaultMasks(ncomps,2))
defaultMasks(:,:) = ispval_mask
if (is_local%wrap%comp_present(compocn)) defaultMasks(compocn,:) = 0
if (is_local%wrap%comp_present(compice)) defaultMasks(compice,:) = 0
if (is_local%wrap%comp_present(compwav)) defaultMasks(compwav,:) = 0
if ( coupling_mode(1:3) == 'ufs') then
if (is_local%wrap%comp_present(compatm)) defaultMasks(compatm,:) = 1
endif
if ( trim(coupling_mode) == 'hafs') then
if (is_local%wrap%comp_present(compatm)) defaultMasks(compatm,1) = 1
endif
! comment this out, so that default masks are set to ispval if missing from esm_run.config
! if ( trim(coupling_mode(1:5)) == 'sofar') then
! if (is_local%wrap%comp_present(compatm)) defaultMasks(compatm,1) = 1
! if (is_local%wrap%comp_present(compwav)) defaultMasks(compwav,1) = 1
! endif
if ( trim(coupling_mode) /= 'cesm') then
if (is_local%wrap%comp_present(compatm) .and. trim(atm_name(1:4)) == 'datm') then
defaultMasks(compatm,1) = 0
end if
end if
It seems odd to hard-code some of these "default" values, as pointed out in this (still open) issue: #93
Nevertheless, I modified our forked CMEPS branch to take in the srcMaskValues and dstMaskValues at runtime in the configuration file (*.config), to allow for further testing. Using the default mask (ispval) or masking land in the (source) wave model doesn't work.
(module_med_map: med_map_routehandles_initfrom_field) creating RH fillv_bilnr for atm to wav srcMask = -987987 dstMask = -987987
(module_med_map: med_map_routehandles_initfrom_field) creating RH fillv_bilnr for wav to atm srcMask = 1 dstMask = -987987
For some unknown reason, we can't seem to mask fields over land in the mediator and it seems some NaN values are getting passed in the Charnock paramter values to the atmosphere, which is causing it to blow-up. We could "hack" these values if necessary, but I was wondering if anyone had run into this issue before? What would be the proper way to mask sea/land/ice values in the mediator for an atmosphere-wave configuration?
Thanks in advance for any feedback.