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 15084 – NEMO

Changeset 15084


Ignore:
Timestamp:
2021-07-05T21:48:42+02:00 (3 years ago)
Author:
clem
Message:

trunk ISF: correct option cn_gammablk=vel_stab as much as I understand it and remove some useless lbc_lnk. Ref ticket is #2706

Location:
NEMO/trunk/src/OCE/ISF
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/src/OCE/ISF/isfcav.F90

    r15082 r15084  
    2222   USE isfdiags , ONLY: isf_diags_flx  ! ice shelf diags subroutine 
    2323   ! 
    24    USE oce      , ONLY: ts                              ! ocean tracers 
     24   USE oce      , ONLY: ts, uu, vv, rn2                 ! ocean dynamics and tracers 
    2525   USE par_oce  , ONLY: jpi,jpj                         ! ocean space and time domain 
    2626   USE phycst   , ONLY: grav,rho0,rho0_rcp,r1_rho0_rcp  ! physical constants 
     
    3131   USE fldread        ! read input field at current time step 
    3232   USE lbclnk         ! lbclnk 
     33   USE lib_mpp        ! MPP library 
    3334 
    3435   IMPLICIT NONE 
     
    3839   PUBLIC   isf_cav, isf_cav_init ! routine called in isfmlt 
    3940 
     41   !! * Substitutions    
     42#  include "do_loop_substitute.h90" 
    4043   !!---------------------------------------------------------------------- 
    4144   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    7174      !!--------------------------------------------------------------------- 
    7275      LOGICAL :: lit 
    73       INTEGER :: nit 
     76      INTEGER :: nit, ji, jj, ikt 
    7477      REAL(wp) :: zerr 
     78      REAL(wp) :: zcoef, zdku, zdkv 
    7579      REAL(wp), DIMENSION(jpi,jpj) :: zqlat, zqoce, zqhc, zqh  ! heat fluxes 
    76       REAL(wp), DIMENSION(jpi,jpj) :: zqh_b                    ! 
     80      REAL(wp), DIMENSION(jpi,jpj) :: zqh_b, zRc               ! 
    7781      REAL(wp), DIMENSION(jpi,jpj) :: zgammat, zgammas         ! exchange coeficient 
    7882      REAL(wp), DIMENSION(jpi,jpj) :: zttbl, zstbl             ! temp. and sal. in top boundary layer 
     
    9195         zqoce(:,:) = -pqfwf(:,:) * rLfusisf !  
    9296         zqh_b(:,:) =  ptsc(:,:,jp_tem) * rho0_rcp ! last time step total heat fluxes (to speed up convergence) 
     97 
     98         DO_2D( 0, 0, 0, 0 ) 
     99            ikt = mikt(ji,jj) 
     100            ! compute Rc number (as done in zdfric.F90) 
     101!!gm better to do it like in the new zdfric.F90   i.e. avm weighted Ri computation 
     102            zcoef = 0.5_wp / e3w(ji,jj,ikt+1,Kmm) 
     103            !                                            ! shear of horizontal velocity 
     104            zdku = zcoef * (  uu(ji-1,jj  ,ikt  ,Kmm) + uu(ji,jj,ikt  ,Kmm)  & 
     105               &             -uu(ji-1,jj  ,ikt+1,Kmm) - uu(ji,jj,ikt+1,Kmm)  ) 
     106            zdkv = zcoef * (  vv(ji  ,jj-1,ikt  ,Kmm) + vv(ji,jj,ikt  ,Kmm)  & 
     107               &             -vv(ji  ,jj-1,ikt+1,Kmm) - vv(ji,jj,ikt+1,Kmm)  ) 
     108            !                                            ! richardson number (minimum value set to zero) 
     109            zRc(ji,jj) = MAX(rn2(ji,jj,ikt+1), 1.e-20_wp) / MAX( zdku*zdku + zdkv*zdkv, 1.e-20_wp ) 
     110         END_2D 
     111         CALL lbc_lnk( 'isfmlt', zRc, 'T', 1._wp ) 
    93112      ENDIF 
    94113      ! 
     
    100119         ! useless if melt specified 
    101120         IF ( TRIM(cn_isfcav_mlt) .NE. 'spe' ) THEN 
    102             CALL isfcav_gammats( Kmm, zttbl, zstbl, zqoce  , pqfwf, & 
     121            CALL isfcav_gammats( Kmm, zttbl, zstbl, zqoce  , pqfwf, zRc, & 
    103122               &                                    zgammat, zgammas ) 
    104123         END IF 
     
    115134         CASE ( 'vel_stab' ) 
    116135            ! compute error between 2 iterations 
    117             zerr = MAXVAL(ABS(zqhc(:,:)+zqoce(:,:) - zqh_b(:,:))) 
     136            zerr = 0._wp 
     137            DO_2D( 0, 0, 0, 0 ) 
     138               zerr = MAX( zerr, ABS(zqhc(ji,jj)+zqoce(ji,jj) - zqh_b(ji,jj)) ) 
     139            END_2D 
     140            CALL mpp_max( 'isfcav', zerr )   ! max over the global domain 
    118141            ! 
    119142            ! define if iteration needed 
     
    130153      END DO 
    131154      ! 
    132       ! compute heat and water flux ( > 0 from isf to oce) 
    133       pqfwf(:,:) = pqfwf(:,:) * mskisf_cav(:,:) 
    134       zqoce(:,:) = zqoce(:,:) * mskisf_cav(:,:) 
    135       zqhc (:,:) = zqhc(:,:)  * mskisf_cav(:,:) 
    136       ! 
    137       ! compute heat content flux ( > 0 from isf to oce) 
    138       zqlat(:,:) = - pqfwf(:,:) * rLfusisf    ! 2d latent heat flux (W/m2) 
    139       ! 
    140       ! total heat flux ( > 0 from isf to oce) 
    141       zqh(:,:) = ( zqhc (:,:) + zqoce(:,:) ) 
    142       ! 
    143       ! lbclnk on melt 
    144       CALL lbc_lnk( 'isfmlt', zqh, 'T', 1.0_wp, pqfwf, 'T', 1.0_wp) 
     155      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
     156         ! compute heat and water flux ( > 0 from isf to oce) 
     157         pqfwf(ji,jj) = pqfwf(ji,jj) * mskisf_cav(ji,jj) 
     158         zqoce(ji,jj) = zqoce(ji,jj) * mskisf_cav(ji,jj) 
     159         zqhc (ji,jj) = zqhc(ji,jj)  * mskisf_cav(ji,jj) 
     160         ! 
     161         ! compute heat content flux ( > 0 from isf to oce) 
     162         zqlat(ji,jj) = - pqfwf(ji,jj) * rLfusisf    ! 2d latent heat flux (W/m2) 
     163         ! 
     164         ! total heat flux ( > 0 from isf to oce) 
     165         zqh(ji,jj) = ( zqhc (ji,jj) + zqoce(ji,jj) ) 
     166         ! 
     167         ! set temperature content 
     168         ptsc(ji,jj,jp_tem) = zqh(ji,jj) * r1_rho0_rcp 
     169      END_2D 
    145170      ! 
    146171      ! output fluxes 
    147172      CALL isf_diags_flx( Kmm, misfkt_cav, misfkb_cav, rhisf_tbl_cav, rfrac_tbl_cav, 'cav', pqfwf, zqoce, zqlat, zqhc) 
    148       ! 
    149       ! set temperature content 
    150       ptsc(:,:,jp_tem) = zqh(:,:) * r1_rho0_rcp 
    151173      ! 
    152174      ! write restart variables (qoceisf, qhcisf, fwfisf for now and before) 
  • NEMO/trunk/src/OCE/ISF/isfcavgam.F90

    r15082 r15084  
    1414   USE isftbl  , ONLY: isf_tbl 
    1515 
    16    USE oce     , ONLY: uu, vv, rn2         ! ocean dynamics and tracers 
     16   USE oce     , ONLY: uu, vv              ! ocean dynamics 
    1717   USE phycst  , ONLY: grav, vkarmn        ! physical constant 
    1818   USE eosbn2  , ONLY: eos_rab             ! equation of state 
     
    4444   !!----------------------------------------------------------------------------------------------------- 
    4545   ! 
    46    SUBROUTINE isfcav_gammats( Kmm, pttbl, pstbl, pqoce, pqfwf, pgt, pgs ) 
     46   SUBROUTINE isfcav_gammats( Kmm, pttbl, pstbl, pqoce, pqfwf, pRc, pgt, pgs ) 
    4747      !!---------------------------------------------------------------------- 
    4848      !! ** Purpose    : compute the coefficient echange for heat and fwf flux 
     
    5757      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) :: pqoce, pqfwf    ! isf heat and fwf 
    5858      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) :: pttbl, pstbl    ! top boundary layer tracer 
     59      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) :: pRc             ! Richardson number 
    5960      !!--------------------------------------------------------------------- 
    6061      REAL(wp), DIMENSION(jpi,jpj)                :: zutbl, zvtbl    ! top boundary layer velocity 
     
    9495         pgs(:,:) = rn_gammas0 
    9596      CASE ( 'vel' ) ! gamma is proportional to u* 
    96          CALL gammats_vel      (                   zutbl, zvtbl, rCd0_top, r_ke0_top,               pgt, pgs ) 
     97         CALL gammats_vel      (                   zutbl, zvtbl, rCd0_top, r_ke0_top,                    pgt, pgs ) 
    9798      CASE ( 'vel_stab' ) ! gamma depends of stability of boundary layer and u* 
    98          CALL gammats_vel_stab (Kmm, pttbl, pstbl, zutbl, zvtbl, rCd0_top, r_ke0_top, pqoce, pqfwf, pgt, pgs ) 
     99         CALL gammats_vel_stab (Kmm, pttbl, pstbl, zutbl, zvtbl, rCd0_top, r_ke0_top, pqoce, pqfwf, pRc, pgt, pgs ) 
    99100      CASE DEFAULT 
    100101         CALL ctl_stop('STOP','method to compute gamma (cn_gammablk) is unknown (should not see this)') 
     
    153154   END SUBROUTINE gammats_vel 
    154155 
    155    SUBROUTINE gammats_vel_stab( Kmm, pttbl, pstbl, putbl, pvtbl, pCd, pke2, pqoce, pqfwf, &  ! <<== in 
    156       &                                                                     pgt  , pgs    )  ! ==>> out gammats [m/s] 
     156   SUBROUTINE gammats_vel_stab( Kmm, pttbl, pstbl, putbl, pvtbl, pCd, pke2, pqoce, pqfwf, pRc, &  ! <<== in 
     157      &                                                                     pgt  , pgs         )  ! ==>> out gammats [m/s] 
    157158      !!---------------------------------------------------------------------- 
    158159      !! ** Purpose    : compute the coefficient echange coefficient  
     
    171172      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) :: putbl, pvtbl   ! velocity in the losch top boundary layer 
    172173      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) :: pttbl, pstbl   ! tracer   in the losch top boundary layer 
     174      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) :: pRc            ! Richardson number 
    173175      !!--------------------------------------------------------------------- 
    174176      INTEGER  :: ji, jj                     ! loop index 
    175177      INTEGER  :: ikt                        ! local integer 
    176178      REAL(wp) :: zdku, zdkv                 ! U, V shear  
    177       REAL(wp) :: zPr, zSc, zRc              ! Prandtl, Scmidth and Richardson number  
     179      REAL(wp) :: zPr, zSc                   ! Prandtl and Scmidth number  
    178180      REAL(wp) :: zmob, zmols                ! Monin Obukov length, coriolis factor at T point 
    179181      REAL(wp) :: zbuofdep, zhnu             ! Bouyancy length scale, sublayer tickness 
     
    190192      !!--------------------------------------------------------------------- 
    191193      ! 
    192       ! compute ustar 
    193       DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    194          zustar(ji,jj) = SQRT( pCd(ji,jj) * ( putbl(ji,jj) * putbl(ji,jj) + pvtbl(ji,jj) * pvtbl(ji,jj) + pke2 ) ) 
    195       END_2D 
    196       ! 
    197       ! output ustar 
    198       CALL iom_put('isfustar',zustar(:,:)) 
    199       ! 
    200194      ! compute Pr and Sc number (eq ??) 
    201195      zPr =   13.8_wp 
     
    207201      ! 
    208202      ! compute gamma 
    209       DO_2D( nn_hls-1, nn_hls, nn_hls-1, nn_hls ) 
     203      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
     204 
    210205         ikt = mikt(ji,jj) 
     206 
     207         ! compute ustar 
     208         zustar(ji,jj) = SQRT( pCd(ji,jj) * ( putbl(ji,jj) * putbl(ji,jj) + pvtbl(ji,jj) * pvtbl(ji,jj) + pke2 ) ) 
    211209 
    212210         IF( zustar(ji,jj) == 0._wp ) THEN           ! only for kt = 1 I think 
     
    214212            pgs(ji,jj) = rn_gammas0 
    215213         ELSE 
    216             ! compute Rc number (as done in zdfric.F90) 
    217 !!gm better to do it like in the new zdfric.F90   i.e. avm weighted Ri computation 
    218             zcoef = 0.5_wp / e3w(ji,jj,ikt+1,Kmm) 
    219             !                                            ! shear of horizontal velocity 
    220             zdku = zcoef * (  uu(ji-1,jj  ,ikt  ,Kmm) + uu(ji,jj,ikt  ,Kmm)  & 
    221                &             -uu(ji-1,jj  ,ikt+1,Kmm) - uu(ji,jj,ikt+1,Kmm)  ) 
    222             zdkv = zcoef * (  vv(ji  ,jj-1,ikt  ,Kmm) + vv(ji,jj,ikt  ,Kmm)  & 
    223                &             -vv(ji  ,jj-1,ikt+1,Kmm) - vv(ji,jj,ikt+1,Kmm)  ) 
    224             !                                            ! richardson number (minimum value set to zero) 
    225             zRc = MAX(rn2(ji,jj,ikt+1), 0._wp) / MAX( zdku*zdku + zdkv*zdkv, zeps ) 
    226              
    227214            ! compute bouyancy  
    228215            zts(jp_tem) = pttbl(ji,jj) 
     
    244231            ! 
    245232            ! compute eta* (stability parameter) (Eq ??) 
    246             zetastar = 1._wp / ( SQRT(1._wp + MAX(zxsiN * zustar(ji,jj) / ( ABS(ff_f(ji,jj)) * zmols * zRc ), 0._wp))) 
     233            zetastar = 1._wp / ( SQRT(1._wp + MAX( 0._wp, zxsiN * zustar(ji,jj) & 
     234               &                                        / MAX( 1.e-20, ABS(ff_t(ji,jj)) * zmols * pRc(ji,jj) ) ))) 
    247235            ! 
    248236            ! compute the sublayer thickness (Eq ??) 
    249             zhnu = 5 * znu / zustar(ji,jj) 
     237            zhnu = 5 * znu / MAX( 1.e-20, zustar(ji,jj) ) 
    250238            ! 
    251239            ! compute gamma turb (Eq ??) 
    252             zgturb = 1._wp / vkarmn * LOG(zustar(ji,jj) * zxsiN * zetastar * zetastar / ( ABS(ff_f(ji,jj)) * zhnu )) & 
     240            zgturb = 1._wp / vkarmn * LOG(zustar(ji,jj) * zxsiN * zetastar * zetastar / MAX( 1.e-10, ABS(ff_t(ji,jj)) * zhnu )) & 
    253241               &      + 1._wp / ( 2 * zxsiN * zetastar ) - 1._wp / vkarmn 
    254242            ! 
     
    258246         END IF 
    259247      END_2D 
     248      ! output ustar 
     249      CALL iom_put('isfustar',zustar(:,:)) 
    260250 
    261251   END SUBROUTINE gammats_vel_stab 
  • NEMO/trunk/src/OCE/ISF/isfpar.F90

    r15004 r15084  
    3030   USE iom            ! I/O library 
    3131   USE fldread        ! read input field at current time step 
    32    USE lbclnk         ! lbc_lnk 
    3332 
    3433   IMPLICIT NONE 
     
    3736   PUBLIC   isf_par, isf_par_init 
    3837 
     38   !! * Substitutions    
     39#  include "do_loop_substitute.h90" 
    3940   !!---------------------------------------------------------------------- 
    4041   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    6768      INTEGER, INTENT(in) ::   Kmm                                    ! ocean time level index 
    6869      !!--------------------------------------------------------------------- 
     70      INTEGER ::   ji, jj 
    6971      REAL(wp), DIMENSION(jpi,jpj) :: zqoce, zqhc, zqlat, zqh 
    7072      !!--------------------------------------------------------------------- 
     
    7375      CALL isfpar_mlt( kt, Kmm, zqhc, zqoce, pqfwf  ) 
    7476      ! 
    75       ! compute heat and water flux (from isf to oce) 
    76       pqfwf(:,:) = pqfwf(:,:) * mskisf_par(:,:) 
    77       zqoce(:,:) = zqoce(:,:) * mskisf_par(:,:) 
    78       zqhc (:,:) = zqhc(:,:)  * mskisf_par(:,:) 
    79       ! 
    80       ! compute latent heat flux (from isf to oce) 
    81       zqlat(:,:) = - pqfwf(:,:) * rLfusisf    ! 2d latent heat flux (W/m2) 
    82       ! 
    83       ! total heat flux (from isf to oce) 
    84       zqh(:,:) = ( zqhc (:,:) + zqoce(:,:) ) 
    85       ! 
    86       ! lbclnk on melt and heat fluxes 
    87       CALL lbc_lnk( 'isfmlt', zqh, 'T', 1.0_wp, pqfwf, 'T', 1.0_wp) 
     77      DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
     78         ! compute heat and water flux (from isf to oce) 
     79         pqfwf(ji,jj) = pqfwf(ji,jj) * mskisf_par(ji,jj) 
     80         zqoce(ji,jj) = zqoce(ji,jj) * mskisf_par(ji,jj) 
     81         zqhc (ji,jj) = zqhc(ji,jj)  * mskisf_par(ji,jj) 
     82         ! 
     83         ! compute latent heat flux (from isf to oce) 
     84         zqlat(ji,jj) = - pqfwf(ji,jj) * rLfusisf    ! 2d latent heat flux (W/m2) 
     85         ! 
     86         ! total heat flux (from isf to oce) 
     87         zqh(ji,jj) = ( zqhc (ji,jj) + zqoce(ji,jj) ) 
     88         ! 
     89         ! set temperature content 
     90         ptsc(ji,jj,jp_tem) = zqh(ji,jj) * r1_rho0_rcp 
     91      END_2D 
    8892      ! 
    8993      ! output fluxes 
    9094      CALL isf_diags_flx( Kmm, misfkt_par, misfkb_par, rhisf_tbl_par, rfrac_tbl_par, 'par', pqfwf, zqoce, zqlat, zqhc) 
    91       ! 
    92       ! set temperature content 
    93       ptsc(:,:,jp_tem) = zqh(:,:) * r1_rho0_rcp 
    9495      ! 
    9596      ! write restart variables (qoceisf, qhcisf, fwfisf for now and before) 
Note: See TracChangeset for help on using the changeset viewer.