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 14340 for NEMO/branches/UKMO/NEMO_4.0.4_GO8_package/src/OCE/ICB/icbdyn.F90 – NEMO

Ignore:
Timestamp:
2021-01-25T14:59:12+01:00 (3 years ago)
Author:
davestorkey
Message:

Fix iceberg speed limiter. (This is Pierre's version which will probably go back to the NEMO base code at some point).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/UKMO/NEMO_4.0.4_GO8_package/src/OCE/ICB/icbdyn.F90

    r14075 r14340  
    8585         !                                         !**   A1 = A(X1,V1) 
    8686         CALL icb_accel( berg , zxi1, ze1, zuvel1, zuvel1, zax1,     & 
    87             &                   zyj1, ze2, zvvel1, zvvel1, zay1, zdt_2 ) 
     87            &                   zyj1, ze2, zvvel1, zvvel1, zay1, zdt_2, 1 ) 
    8888         ! 
    8989         zu1 = zuvel1 / ze1                           !**   V1 in d(i,j)/dt 
     
    102102         !                                         !**   A2 = A(X2,V2) 
    103103         CALL icb_accel( berg , zxi2, ze1, zuvel2, zuvel1, zax2,    & 
    104             &                   zyj2, ze2, zvvel2, zvvel1, zay2, zdt_2 ) 
     104            &                   zyj2, ze2, zvvel2, zvvel1, zay2, zdt_2, 2 ) 
    105105         ! 
    106106         zu2 = zuvel2 / ze1                           !**   V2 in d(i,j)/dt 
     
    118118         !                                         !**   A3 = A(X3,V3) 
    119119         CALL icb_accel( berg , zxi3, ze1, zuvel3, zuvel1, zax3,    & 
    120             &                   zyj3, ze2, zvvel3, zvvel1, zay3, zdt ) 
     120            &                   zyj3, ze2, zvvel3, zvvel1, zay3, zdt, 3 ) 
    121121         ! 
    122122         zu3 = zuvel3 / ze1                           !**   V3 in d(i,j)/dt 
     
    134134         !                                         !**   A4 = A(X4,V4) 
    135135         CALL icb_accel( berg , zxi4, ze1, zuvel4, zuvel1, zax4,    & 
    136             &                   zyj4, ze2, zvvel4, zvvel1, zay4, zdt ) 
     136            &                   zyj4, ze2, zvvel4, zvvel1, zay4, zdt, 4 ) 
    137137 
    138138         zu4 = zuvel4 / ze1                           !**   V4 in d(i,j)/dt 
     
    235235 
    236236   SUBROUTINE icb_accel( berg , pxi, pe1, puvel, puvel0, pax,                & 
    237       &                         pyj, pe2, pvvel, pvvel0, pay, pdt ) 
     237      &                         pyj, pe2, pvvel, pvvel0, pay, pdt, pstage ) 
    238238      !!---------------------------------------------------------------------- 
    239239      !!                  ***  ROUTINE icb_accel  *** 
     
    250250      REAL(wp)               , INTENT(inout) ::   pax, pay         ! berg acceleration 
    251251      REAL(wp)               , INTENT(in   ) ::   pdt              ! berg time step 
     252      INTEGER                , INTENT(in   ) ::   pstage           ! RK4 stage (for speed limiter) 
    252253      ! 
    253254      REAL(wp), PARAMETER ::   pp_alpha     = 0._wp      ! 
     
    265266      REAL(wp) ::   zampl, zwmod, zCr, zLwavelength, zLcutoff, zLtop 
    266267      REAL(wp) ::   zlambda, zdetA, zA11, zA12, zaxe, zaye, zD_hi 
    267       REAL(wp) ::   zuveln, zvveln, zus, zvs, zspeed, zloc_dx, zspeed_new 
     268      REAL(wp) ::   zuveln, zvveln, zus, zvs, zspeed, zloc_dx, zspeed_new, zvel_factor, zcfl_scale 
    268269      !!---------------------------------------------------------------------- 
    269270 
     
    361362         zspeed = SQRT( zuveln*zuveln + zvveln*zvveln )    ! Speed of berg 
    362363         IF( zspeed > 0._wp ) THEN 
    363             zloc_dx = MIN( pe1, pe2 )                          ! minimum grid spacing 
    364             zspeed_new = zloc_dx / pdt * rn_speed_limit        ! Speed limit as a factor of dx / dt 
     364            zloc_dx = MIN( pe1, pe2 )                                ! minimum grid spacing 
     365            ! cfl scale is function of the RK4 step 
     366            IF( pstage .le. 2 ) THEN 
     367               zcfl_scale=0.5 
     368            ELSE 
     369               zcfl_scale=1.0 
     370            ENDIF 
     371            zspeed_new = zloc_dx / pdt * rn_speed_limit * zcfl_scale ! Speed limit as a factor of dx / dt 
    365372            IF( zspeed_new < zspeed ) THEN 
    366                zuveln = zuveln * ( zspeed_new / zspeed )        ! Scale velocity to reduce speed 
    367                zvveln = zvveln * ( zspeed_new / zspeed )        ! without changing the direction 
    368                CALL icb_dia_speed() 
     373               zvel_factor = zspeed_new / zspeed 
     374               zuveln = zuveln * ( zvel_factor )             ! Scale velocity to reduce speed 
     375               zvveln = zvveln * ( zvel_factor )             ! without changing the direction 
     376               pax = (zuveln - puvel0)/pdt 
     377               pay = (zvveln - pvvel0)/pdt 
     378               WRITE(numicb,*) 'speeding ticket (zspeed_new/zspeed): ',zvel_factor, pdt, zcfl_scale 
     379               CALL FLUSH(numicb) 
     380               CALL icb_dia_speed(zvel_factor,pstage) 
    369381            ENDIF 
    370382         ENDIF 
Note: See TracChangeset for help on using the changeset viewer.