Wrong default value of xcplmask
Context
The bug is present in any coupled configuration not coupled to an atmospheric model via OASIS (e.g., coupled to a wave model), and receiving atmospheric driving data. This bug was found in a direct flux ocean/wave coupled configuration but it is expected to also affect other configurations such as core forcing.
-
Branches impacted: main -
Reference configuration/test case used as template: AMM -
Computing architecture: Cray compiler cce 8.7.7; cray-mpich 7.7.4; cray-netcdf-hdf5parallel 4.6.1.3; cray-hdf5-parallel 1.10.2.0 -
Dependencies: OASIS XIOS : oasis3-mct_4.0 10f61316; XIOS-2.5 revision 1873 -
- [ ] Any other relevant information
Analysis
This bug was found in an amm15 ocean configuration (UK domain) coupled to WAVEWATCHIII using direct forcing files created by an atmospheric model (UM). What we observed was that the results did not change when we changed the light penetration parameter rn_abs. The reason was that the solar radiation received via forcing files was overwritten to zero in the subroutine performing the coupling. We did not notice before an issue with the sea surface temperature because we were also using sea surface temperature restoring terms (ln_ssr=.true.). The relevant piece of code that is causing the issue is in the sbccpl.F90 file, subroutine sbc_cpl_rcv (similar lines are present for other atmosphere coupled fields):
IF( ln_mixcpl ) THEN ; qsr(:,:) = qsr(:,:) * xcplmask(:,:,0) + zqsr(:,:) * zmsk(:,:)
ELSE ; qsr(:,:) = zqsr(:,:)
ENDIF
In our case ln_mixcpl=.true. because we want to use driving data from an atmosphere model and coupling data from the wave model. As we do not want to mix the information read from data and by coupling, we do not provide a coupling mask xcplmask. In this situation, the coupling mask is initialized to zero, and therefore zmsk is 1, causing the solar radiation to receive zero values. We believe that this default value is confusing, as a coupling mask should only be necessary if we are coupling a particular field and we want to overwrite the same data already initialized using forcing files.
Fix
We propose to change the initialization of the xcplmask variable in a coupling mask is not provided, so that fields read from forcing files are preserved as this looks the more sensible behaviour. To do so, we propose to change the following lines in the sbc_cpl_init subroutine:
IF (ln_usecplmask) THEN
xcplmask(:,:,:) = 0.
CALL iom_open( 'cplmask', inum )
CALL iom_get( inum, jpdom_unknown, 'cplmask', xcplmask(1:nlci,1:nlcj,1:nn_cplmodel), &
& kstart = (/ mig(1),mjg(1),1 /), kcount = (/ nlci,nlcj,nn_cplmodel /) )
CALL iom_close( inum )
ELSE
xcplmask(:,:,:) = 1.
ENDIF
xcplmask(:,:,0) = 1. - SUM( xcplmask(:,:,1:nn_cplmodel), dim = 3 )
to
IF (ln_usecplmask) THEN
xcplmask(:,:,:) = 0.
CALL iom_open( 'cplmask', inum )
CALL iom_get( inum, jpdom_unknown, 'cplmask', xcplmask(1:nlci,1:nlcj,1:nn_cplmodel), &
& kstart = (/ mig(1),mjg(1),1 /), kcount = (/ nlci,nlcj,nn_cplmodel /) )
CALL iom_close( inum )
xcplmask(:,:,0) = 1. - SUM( xcplmask(:,:,1:nn_cplmodel), dim = 3 )
ELSE
xcplmask(:,:,:) = 1.
ENDIF