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 for NEMO/trunk/src/OCE/ISF/isfcav.F90 – NEMO

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

File:
1 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) 
Note: See TracChangeset for help on using the changeset viewer.