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 13616 for NEMO/trunk/tests/STATION_ASF – NEMO

Ignore:
Timestamp:
2020-10-15T17:58:33+02:00 (4 years ago)
Author:
smasson
Message:

trunk: bugfix in stpctl for land inner-domains, see #2549

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/tests/STATION_ASF/MY_SRC/stpctl.F90

    r13458 r13616  
    6565      REAL(wp)                        ::   zzz                                   ! local real  
    6666      REAL(wp), DIMENSION(4)          ::   zmax, zmaxlocal 
    67       LOGICAL                         ::   ll_wrtstp, ll_colruns, ll_wrtruns 
     67      LOGICAL                         ::   ll_wrtstp, ll_colruns, ll_wrtruns, ll_0oce 
    6868      LOGICAL, DIMENSION(jpi,jpj)     ::   llmsk 
    6969      CHARACTER(len=20)               ::   clname 
     
    115115      llmsk(:,Nje1: jpj) = .FALSE. 
    116116      ! 
    117       llmsk(Nis0:Nie0,Njs0:Nje0) = tmask(Nis0:Nie0,Njs0:Nje0,1) == 1._wp   ! test only the inner domain 
    118       IF( COUNT( llmsk(:,:) ) > 0 ) THEN   ! avoid huge values sent back for land processors... 
    119          zmax(1) = MAXVAL(     taum(:,:)   , mask = llmsk )   ! max wind stress module 
    120          zmax(2) = MAXVAL( ABS( qns(:,:) ) , mask = llmsk )   ! max non-solar heat flux 
    121          zmax(3) = MAXVAL( ABS( emp(:,:) ) , mask = llmsk )   ! max E-P 
    122       ELSE 
    123          IF( ll_colruns ) THEN    ! default value: must not be kept when calling mpp_max -> must be as small as possible 
    124             zmax(1:3) = -HUGE(1._wp) 
    125          ELSE                     ! default value: must not give true for any of the tests bellow (-> avoid manipulating HUGE...) 
    126             zmax(1:3) = 0._wp 
    127          ENDIF 
    128       ENDIF 
    129       zmax(4) = REAL( nstop, wp )                                     ! stop indicator 
     117      llmsk(Nis0:Nie0,Njs0:Nje0) = tmask(Nis0:Nie0,Njs0:Nje0,1) == 1._wp        ! test only the inner domain 
     118      ! 
     119      ll_0oce = .NOT. ANY( llmsk(:,:) )                                         ! no ocean point in the inner domain? 
     120      ! 
     121      zmax(1) = MAXVAL(     taum(:,:)  , mask = llmsk )                         ! max wind stress module 
     122      zmax(2) = MAXVAL( ABS( qns(:,:) ), mask = llmsk )                         ! max non-solar heat flux 
     123      zmax(3) = MAXVAL( ABS( emp(:,:) ), mask = llmsk )                         ! max E-P 
     124      zmax(4) = REAL( nstop, wp )                                               ! stop indicator 
     125      ! 
    130126      !                                   !==               get global extrema             ==! 
    131127      !                                   !==  done by all processes if writting run.stat  ==! 
     
    134130         CALL mpp_max( "stpctl", zmax )          ! max over the global domain 
    135131         nstop = NINT( zmax(4) )                 ! update nstop indicator (now sheared among all local domains) 
    136       ENDIF 
     132      ELSE 
     133         ! if no ocean point: MAXVAL returns -HUGE => we must overwrite this value to avoid error handling bellow. 
     134         IF( ll_0oce )   zmax(1:3) = 0._wp       ! default "valid" values... 
     135      ENDIF 
     136      !                                   !==               error handling               ==! 
    137137      !                                   !==              write "run.stat" files              ==! 
    138138      !                                   !==  done only by 1st subdomain at writting timestep  ==! 
    139139      IF( ll_wrtruns ) THEN 
    140140         WRITE(numrun,9500) kt, zmax(1), zmax(2), zmax(3) 
    141          istatus = NF90_PUT_VAR( nrunid, nvarid(1), (/ zmax(1)/), (/kt/), (/1/) ) 
    142          istatus = NF90_PUT_VAR( nrunid, nvarid(2), (/ zmax(2)/), (/kt/), (/1/) ) 
    143          istatus = NF90_PUT_VAR( nrunid, nvarid(3), (/ zmax(3)/), (/kt/), (/1/) ) 
     141         DO ji = 1, 3 
     142            istatus = NF90_PUT_VAR( nrunid, nvarid(ji), (/zmax(ji)/), (/kt/), (/1/) ) 
     143         END DO 
    144144         IF( kt == nitend ) istatus = NF90_CLOSE(nrunid) 
    145145      END IF 
Note: See TracChangeset for help on using the changeset viewer.