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/icbdyn.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/icbdyn.F90

    r14400 r15043  
    192192      ld_bounced = .FALSE. 
    193193      ! 
    194       ii0 = INT( pi0+0.5 )   ;   ij0 = INT( pj0+0.5 )       ! initial gridpoint position (T-cell) 
    195       ii  = INT( pi +0.5 )   ;   ij  = INT( pj +0.5 )       ! current     -         - 
     194      ii0 = INT( pi0+0.5 ) + (nn_hls-1)   ;   ij0 = INT( pj0+0.5 ) + (nn_hls-1)      ! initial gridpoint position (T-cell) 
     195      ii  = INT( pi +0.5 ) + (nn_hls-1)   ;   ij  = INT( pj +0.5 ) + (nn_hls-1)      ! current     -         - 
    196196      ! 
    197197      IF( ii == ii0  .AND.  ij == ij0  )   RETURN           ! berg remains in the same cell 
     
    314314      zwmod  = zuwave*zuwave + zvwave*zvwave          ! The wave amplitude and length depend on the  current; 
    315315      !                                               ! wind speed relative to the ocean. Actually wmod is wmod**2 here. 
    316       zampl        = 0.5 * 0.02025 * zwmod            ! This is "a", the wave amplitude 
    317       zLwavelength =       0.32    * zwmod            ! Surface wave length fitted to data in table at 
     316      zampl        = 0.5_wp * 0.02025_wp * zwmod      ! This is "a", the wave amplitude 
     317      zLwavelength =       0.32_wp    * zwmod         ! Surface wave length fitted to data in table at 
    318318      !                                               ! http://www4.ncsu.edu/eos/users/c/ceknowle/public/chapter10/part2.html 
    319       zLcutoff     = 0.125 * zLwavelength 
    320       zLtop        = 0.25  * zLwavelength 
    321       zCr          = pp_Cr0 * MIN(  MAX( 0., (zL-zLcutoff) / ((zLtop-zLcutoff)+1.e-30)) , 1.)  ! Wave radiation coefficient 
     319      zLcutoff     = 0.125_wp * zLwavelength 
     320      zLtop        = 0.25_wp  * zLwavelength 
     321      zCr          = pp_Cr0 * MIN(  MAX( 0._wp, (zL-zLcutoff) / ((zLtop-zLcutoff)+1.e-30)) , 1._wp)  ! Wave radiation coefficient 
    322322      !                                               ! fitted to graph from Carrieres et al.,  POAC Drift Model. 
    323       zwave_rad    = 0.5 * pp_rho_seawater / zM * zCr * grav * zampl * MIN( zampl,zF ) * (2.*zW*zL) / (zW+zL) 
     323      zwave_rad    = 0.5_wp * pp_rho_seawater / zM * zCr * grav * zampl * MIN( zampl,zF ) * (2._wp*zW*zL) / (zW+zL) 
    324324      zwmod        = SQRT( zua*zua + zva*zva )        ! Wind speed 
    325325      IF( zwmod /= 0._wp ) THEN 
     
    327327         zvwave = zva/zwmod 
    328328      ELSE 
    329          zuwave = 0.   ;    zvwave=0.   ;    zwave_rad=0. ! ... and only when wind is present.     !!gm  wave_rad=0. is useless 
     329         zuwave = 0._wp   ;    zvwave=0._wp   ;    zwave_rad=0._wp ! ... and only when wind is present.     !!gm  wave_rad=0. is useless 
    330330      ENDIF 
    331331 
    332332      ! Weighted drag coefficients 
    333       z_ocn = pp_rho_seawater / zM * (0.5*pp_Cd_wv*zW*(zD_hi)+pp_Cd_wh*zW*zL) 
    334       z_atm = pp_rho_air      / zM * (0.5*pp_Cd_av*zW*zF     +pp_Cd_ah*zW*zL) 
    335       z_ice = pp_rho_ice      / zM * (0.5*pp_Cd_iv*zW*zhi              ) 
     333      z_ocn = pp_rho_seawater / zM * (0.5_wp*pp_Cd_wv*zW*(zD_hi)+pp_Cd_wh*zW*zL) 
     334      z_atm = pp_rho_air      / zM * (0.5_wp*pp_Cd_av*zW*zF     +pp_Cd_ah*zW*zL) 
     335      z_ice = pp_rho_ice      / zM * (0.5_wp*pp_Cd_iv*zW*zhi              ) 
    336336      IF( abs(zui) + abs(zvi) == 0._wp )   z_ice = 0._wp 
    337337 
     
    358358      DO itloop = 1, 2  ! Iterate on drag coefficients 
    359359         ! 
    360          zus = 0.5 * ( zuveln + puvel ) 
    361          zvs = 0.5 * ( zvveln + pvvel ) 
     360         zus = 0.5_wp * ( zuveln + puvel ) 
     361         zvs = 0.5_wp * ( zvveln + pvvel ) 
    362362         zdrag_ocn = z_ocn * SQRT( (zus-zuo)*(zus-zuo) + (zvs-zvo)*(zvs-zvo) ) 
    363363         zdrag_atm = z_atm * SQRT( (zus-zua)*(zus-zua) + (zvs-zva)*(zvs-zva) ) 
Note: See TracChangeset for help on using the changeset viewer.