Model failure during north-fold iceberg transport
Context
An ORCA2_ICE_PISCES
run of a branch_5.0
NEMO build has been found to fail with a segmentation fault.
Analysis
The stack trace suggests that this failure was caused by the use of a corrupted linked list during iceberg transport across the north fold in subroutine icb_lbc_mpp_nfld
(module icblbc
).
Fix
Further analysis exposes the loss of the pointer used to traverse the linked list following a node removal. This can be avoided with the modification
--- a/src/OCE/ICB/icblbc.F90
+++ b/src/OCE/ICB/icblbc.F90
@@ -621,12 +621,18 @@ CONTAINS
CALL flush( numicb )
ENDIF
CALL icb_pack_into_buffer( tmpberg, obuffer_f, ibergs_to_send)
+ this => tmpberg%next
CALL icb_utl_delete(first_berg, tmpberg)
+ ELSE
+ this => this%next
ENDIF
!
+ ELSE
+ this => this%next
ENDIF
+ ELSE
+ this => this%next
ENDIF
- this => this%next
END DO
ENDIF
if( nn_verbose_level >= 3) then
Edited by Simon Mueller