Advective transport diagnostics are incorrect when using certain tracer advection schemes
Context
-
Branches impacted: main -
Reference configuration/test case (chosen or used as template): ORCA2 -
Computing architecture: compiler, MPI & NetCDF libs (name and version) -
Dependencies: since 16443a0b -
Any other relevant information - Affected diagnostics
-
sophtadv
- advective poleward heat transport -
sopstadv
- advective poleward salt transport -
uadv_heattr
/vadv_heattr
- U/V advective heat transport -
uadv_salttr
/vadv_salttr
- U/V advective salt transport
-
- Affected modules
traadv_cen.F90
traadv_mus.F90
- Affected diagnostics
Analysis
Following #68 (closed) (specifically #80 (closed)), calls to dia_ptr_hst
and dia_ar5_hst
in tra_adv_cen and tra_adv_mus have been commented out due to refactoring of the 3D arrays (to 2D) passed to these subroutines. This means the related diagnostics are incorrect.
tra_ldf_iso
and tra_ldf_lev
were refactored in the same way, but are not affected by this issue as a workaround was used (storing the diagnostic result in 3D arrays, then using this in the dia_ptr_hst
/dia_ar5_hst
calls).
NOTE: A similar issue exists for the TRD diagnostics- this is not resolved here
Fix
Refactor dia_ptr_hst
and dia_ar5_hst
to allow 2D (i-j) arrays as arguments. When using 2D arrays, the diagnostic must be constructed by calling these subroutines for each level before finalising the diagnostic (calling MPI, XIOS subroutines).
The approach to this finalisation step differs for each subroutine:
-
dia_ptr_hst
- An existing finalisation subroutine,
dia_ptr_iom
(called bydia_ptr
), is already called fromtraadv.F90
and the main timestepping subroutine - The
mpp_sum
calls inptr_sum
are moved intoptr_mpp_sum
, which is called fromdia_ptr_iom
- An existing finalisation subroutine,
-
dia_ar5_hst
- There is no explicit finalisation step, so we must tell the subroutine when the diagnostics are ready to be sent to XIOS
- The calculations are stored in 3D arrays (with the
SAVE
attribute) - A logical input argument is used to control the
iom_put
calls
The workarounds in tra_ldf_iso
and tra_ldf_lev
will be removed.
As a further optimisation, a couple of diaptr.F90
module arrays (hstr_ove
, hstr_btr
) are replaced by a single local working array.