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 14402 for NEMO/trunk/src/OCE – NEMO

Changeset 14402 for NEMO/trunk/src/OCE


Ignore:
Timestamp:
2021-02-05T13:04:42+01:00 (3 years ago)
Author:
smasson
Message:

trunk: minor fix for humidity check, #2616

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/src/OCE/SBC/sbcblk.F90

    r14401 r14402  
    4040   USE sbcdcy         ! surface boundary condition: diurnal cycle 
    4141   USE sbcwave , ONLY :   cdn_wave ! wave module 
    42    USE lib_fortran    ! to use key_nosignedzero 
     42   USE lib_fortran    ! to use key_nosignedzero and glob_sum 
    4343   ! 
    4444#if defined key_si3 
     
    504504      !!---------------------------------------------------------------------- 
    505505      REAL(wp), DIMENSION(jpi,jpj) ::   zssq, zcd_du, zsen, zlat, zevp 
    506       REAL(wp) :: ztmp 
     506      REAL(wp) :: ztst 
     507      LOGICAL  :: llerr 
    507508      !!---------------------------------------------------------------------- 
    508509      ! 
     
    511512      ! Sanity/consistence test on humidity at first time step to detect potential screw-up: 
    512513      IF( kt == nit000 ) THEN 
    513          IF(lwp) WRITE(numout,*) '' 
    514 #if defined key_agrif 
    515          IF(lwp) WRITE(numout,*) ' === AGRIF => Sanity/consistence test on air humidity SKIPPED! :( ===' 
    516 #else 
    517          ztmp = SUM(tmask(:,:,1)) ! number of ocean points on local proc domain 
    518          IF( ztmp > 8._wp ) THEN ! test only on proc domains with at least 8 ocean points! 
    519             ztmp = SUM(sf(jp_humi)%fnow(:,:,1)*tmask(:,:,1))/ztmp ! mean humidity over ocean on proc 
    520             SELECT CASE( nhumi ) 
    521             CASE( np_humi_sph ) ! specific humidity => expect: 0. <= something < 0.065 [kg/kg] (0.061 is saturation at 45degC !!!) 
    522                IF(  (ztmp < 0._wp) .OR. (ztmp > 0.065)  ) ztmp = -1._wp 
    523             CASE( np_humi_dpt ) ! dew-point temperature => expect: 110. <= something < 320. [K] 
    524                IF( (ztmp < 110._wp).OR.(ztmp > 320._wp) ) ztmp = -1._wp 
    525             CASE( np_humi_rlh ) ! relative humidity => expect: 0. <= something < 100. [%] 
    526                IF(  (ztmp < 0._wp) .OR.(ztmp > 100._wp) ) ztmp = -1._wp 
    527             END SELECT 
    528             IF(ztmp < 0._wp) THEN 
    529                IF (lwp) WRITE(numout,'("   Mean humidity value found on proc #",i6.6," is: ",f10.5)') narea, ztmp 
    530                CALL ctl_stop( 'STOP', 'Something is wrong with air humidity!!!', & 
    531                   &   ' ==> check the unit in your input files'       , & 
    532                   &   ' ==> check consistence of namelist choice: specific? relative? dew-point?', & 
    533                   &   ' ==> ln_humi_sph -> [kg/kg] | ln_humi_rlh -> [%] | ln_humi_dpt -> [K] !!!' ) 
    534             END IF 
    535          END IF 
    536          IF(lwp) WRITE(numout,*) ' === Sanity/consistence test on air humidity sucessfuly passed! ===' 
    537 #endif 
    538          IF(lwp) WRITE(numout,*) '' 
    539       END IF !IF( kt == nit000 ) 
     514         ! mean humidity over ocean on proc 
     515         ztst = glob_sum( 'sbcblk', sf(jp_humi)%fnow(:,:,1) * e1e2t(:,:) * tmask(:,:,1) ) / glob_sum( 'sbcblk', e1e2t(:,:) * tmask(:,:,1) ) 
     516         llerr = .FALSE. 
     517         SELECT CASE( nhumi ) 
     518         CASE( np_humi_sph ) ! specific humidity => expect: 0. <= something < 0.065 [kg/kg] (0.061 is saturation at 45degC !!!) 
     519            IF( (ztst <   0._wp) .OR. (ztst > 0.065_wp) )   llerr = .TRUE. 
     520         CASE( np_humi_dpt ) ! dew-point temperature => expect: 110. <= something < 320. [K] 
     521            IF( (ztst < 110._wp) .OR. (ztst >  320._wp) )   llerr = .TRUE. 
     522         CASE( np_humi_rlh ) ! relative humidity => expect: 0. <= something < 100. [%] 
     523            IF( (ztst <   0._wp) .OR. (ztst >  100._wp) )   llerr = .TRUE. 
     524         END SELECT 
     525         IF(llerr) THEN 
     526            WRITE(ctmp1,'("   Error on mean humidity value: ",f10.5)') ztst 
     527            CALL ctl_stop( 'STOP', ctmp1, 'Something is wrong with air humidity!!!', & 
     528               &   ' ==> check the unit in your input files'       , & 
     529               &   ' ==> check consistence of namelist choice: specific? relative? dew-point?', & 
     530               &   ' ==> ln_humi_sph -> [kg/kg] | ln_humi_rlh -> [%] | ln_humi_dpt -> [K] !!!' ) 
     531         ENDIF 
     532         IF(lwp) THEN 
     533            WRITE(numout,*) '' 
     534            WRITE(numout,*) ' Global mean humidity at kt = nit000: ', ztst 
     535            WRITE(numout,*) ' === Sanity/consistence test on air humidity sucessfuly passed! ===' 
     536            WRITE(numout,*) '' 
     537         ENDIF 
     538      ENDIF   !IF( kt == nit000 ) 
    540539      !                                            ! compute the surface ocean fluxes using bulk formulea 
    541540      IF( MOD( kt - 1, nn_fsbc ) == 0 ) THEN 
Note: See TracChangeset for help on using the changeset viewer.