New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 15043 for NEMO/branches/2021/ticket2696_icb_halo1_halo2_compatibility/src/OCE/ICB/icblbc.F90 – NEMO

Ignore:
Timestamp:
2021-06-22T13:26:16+02:00 (3 years ago)
Author:
acc
Message:

#2696 .A possible fix for obtaining identical results with icebergs active and with either
nn_hls=1 or nn_hls=2. This solution works by ensuring the real-valued iceberg position
calculations are done with identical numbers in both cases. Iceberg positions are stored
as a continuous local grid-cell value and a factor of (nn_hls-1) is subtracted from
initial positions to ensure equivalence in both cases. This factor needs to be added
back whenever iceberg positions are converted to local indices. The changes in this
commit are enough to ensure a full ORCA2_ICE_PISCES SETTE test is passed in both case
(992 timesteps) and provides identical results. Suitability of this solution for inclusion
in the trunk needs to be discussed and verified on other platforms and compilers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2021/ticket2696_icb_halo1_halo2_compatibility/src/OCE/ICB/icblbc.F90

    r14433 r15043  
    229229         DO WHILE (ASSOCIATED(this)) 
    230230            pt => this%current_point 
    231             IF( ipe_E >= 0 .AND. pt%xi > REAL(mig(nicbei),wp) + 0.5_wp ) THEN 
     231            IF( ipe_E >= 0 .AND. pt%xi > REAL(mig(nicbei),wp) + 0.5_wp - (nn_hls-1) ) THEN 
    232232               tmpberg => this 
    233233               this => this%next 
     
    242242               CALL icb_pack_into_buffer( tmpberg, obuffer_e, ibergs_to_send_e) 
    243243               CALL icb_utl_delete(first_berg, tmpberg) 
    244             ELSE IF( ipe_W >= 0 .AND. pt%xi < REAL(mig(nicbdi),wp) - 0.5_wp ) THEN 
     244            ELSE IF( ipe_W >= 0 .AND. pt%xi < REAL(mig(nicbdi),wp) - 0.5_wp - (nn_hls-1) ) THEN 
    245245               tmpberg => this 
    246246               this => this%next 
     
    321321         DO WHILE (ASSOCIATED(this)) 
    322322            pt => this%current_point 
    323             IF( ipe_N >= 0 .AND. pt%yj > REAL(mjg(nicbej),wp) + 0.5_wp ) THEN 
     323            IF( ipe_N >= 0 .AND. pt%yj > REAL(mjg(nicbej),wp) + 0.5_wp - (nn_hls-1) ) THEN 
    324324               tmpberg => this 
    325325               this => this%next 
     
    331331               CALL icb_pack_into_buffer( tmpberg, obuffer_n, ibergs_to_send_n) 
    332332               CALL icb_utl_delete(first_berg, tmpberg) 
    333             ELSE IF( ipe_S >= 0 .AND. pt%yj < REAL(mjg(nicbdj),wp) - 0.5_wp ) THEN 
     333            ELSE IF( ipe_S >= 0 .AND. pt%yj < REAL(mjg(nicbdj),wp) - 0.5_wp - (nn_hls-1) ) THEN 
    334334               tmpberg => this 
    335335               this => this%next 
     
    442442         DO WHILE (ASSOCIATED(this)) 
    443443            pt => this%current_point 
    444             IF( pt%xi < REAL(mig(nicbdi),wp) - 0.5_wp .OR. & 
    445                 pt%xi > REAL(mig(nicbei),wp) + 0.5_wp .OR. & 
    446                 pt%yj < REAL(mjg(nicbdj),wp) - 0.5_wp .OR. & 
    447                 pt%yj > REAL(mjg(nicbej),wp) + 0.5_wp ) THEN 
     444            IF( pt%xi < REAL(mig(nicbdi),wp) - 0.5_wp - (nn_hls-1) .OR. & 
     445                pt%xi > REAL(mig(nicbei),wp) + 0.5_wp - (nn_hls-1) .OR. & 
     446                pt%yj < REAL(mjg(nicbdj),wp) - 0.5_wp - (nn_hls-1) .OR. & 
     447                pt%yj > REAL(mjg(nicbej),wp) + 0.5_wp - (nn_hls-1) ) THEN 
    448448               i = i + 1 
    449449               WRITE(numicb,*) 'berg lost in halo: ', this%number(:) 
     
    514514               DO WHILE (ASSOCIATED(this)) 
    515515                  pt => this%current_point 
    516                   iine = INT( pt%xi + 0.5 ) 
     516                  iine = INT( pt%xi + 0.5 ) + (nn_hls-1) 
    517517                  iproc = nicbflddest(mi1(iine)) 
    518                   IF( pt%yj > REAL(mjg(nicbej),wp) + 0.5_wp ) THEN 
     518                  IF( pt%yj > REAL(mjg(nicbej),wp) + 0.5_wp - (nn_hls-1) ) THEN 
    519519                     IF( iproc == ifldproc ) THEN 
    520520                        ! 
     
    592592               DO WHILE (ASSOCIATED(this)) 
    593593                  pt => this%current_point 
    594                   iine = INT( pt%xi + 0.5 ) 
    595                   ijne = INT( pt%yj + 0.5 ) 
     594                  iine = INT( pt%xi + 0.5 ) + (nn_hls-1) 
     595                  ijne = INT( pt%yj + 0.5 ) + (nn_hls-1) 
    596596                  ipts  = nicbfldpts (mi1(iine)) 
    597597                  iproc = nicbflddest(mi1(iine)) 
    598                   IF( pt%yj > REAL(mjg(nicbej),wp) + 0.5_wp ) THEN 
     598                  IF( pt%yj > REAL(mjg(nicbej),wp) + 0.5_wp - (nn_hls-1) ) THEN 
    599599                     IF( iproc == ifldproc ) THEN 
    600600                        ! 
Note: See TracChangeset for help on using the changeset viewer.