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 13798 for NEMO/branches/2020/dev_r13333_TOP-05_Ethe_Agrif/src/SAS – NEMO

Ignore:
Timestamp:
2020-11-16T11:20:33+01:00 (4 years ago)
Author:
cetlod
Message:

dev_r13333_TOP-05_Ethe_Agrif : phasing with trunk at revision r13787

Location:
NEMO/branches/2020/dev_r13333_TOP-05_Ethe_Agrif
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_r13333_TOP-05_Ethe_Agrif

    • Property svn:externals
      •  

        old new  
        88 
        99# SETTE 
        10 ^/utils/CI/sette@13292        sette 
         10^/utils/CI/sette@13559        sette 
  • NEMO/branches/2020/dev_r13333_TOP-05_Ethe_Agrif/src/SAS/nemogcm.F90

    r13286 r13798  
    22   !!====================================================================== 
    33   !!                       ***  MODULE nemogcm   *** 
    4    !! StandAlone Surface module : surface fluxes + sea-ice + iceberg floats 
     4   !! StandAlone Surface module : surface fluxes + sea-ice + iceberg floats + ABL 
    55   !!====================================================================== 
    66   !! History :  3.6  ! 2011-11  (S. Alderson, G. Madec) original code 
     
    5858 
    5959#if defined key_mpp_mpi 
     60   ! need MPI_Wtime 
    6061   INCLUDE 'mpif.h' 
    6162#endif 
     
    8384      !!---------------------------------------------------------------------- 
    8485      INTEGER ::   istp   ! time step index 
     86      REAL(wp)::   zstptiming   ! elapsed time for 1 time step 
    8587      !!---------------------------------------------------------------------- 
    8688      ! 
     
    9395#if defined key_agrif 
    9496      Kbb_a = Nbb; Kmm_a = Nnn; Krhs_a = Nrhs   ! agrif_oce module copies of time level indices 
    95       CALL Agrif_Declare_Var       !  "      "   "   "      "  DYN/TRA  
     97      CALL Agrif_Declare_Var       !  "      "   "   "      "  DYN/TRA 
    9698# if defined key_top 
    9799      CALL Agrif_Declare_Var_top   !  "      "   "   "      "  TOP 
     
    107109      !                            !==   time stepping   ==! 
    108110      !                            !-----------------------! 
     111      ! 
     112      !                                               !== set the model time-step  ==! 
     113      ! 
    109114      istp = nit000 
    110115      ! 
     
    124129      END DO 
    125130      ! 
    126 #else 
     131# else 
    127132      ! 
    128133      IF( .NOT.ln_diurnal_only ) THEN                 !==  Standard time-stepping  ==! 
    129134         ! 
    130135         DO WHILE( istp <= nitend .AND. nstop == 0 ) 
    131 #if defined key_mpp_mpi 
     136 
    132137            ncom_stp = istp 
    133             IF ( istp == ( nit000 + 1 ) ) elapsed_time = MPI_Wtime() 
    134             IF ( istp ==         nitend ) elapsed_time = MPI_Wtime() - elapsed_time 
    135 #endif 
     138            IF( ln_timing ) THEN 
     139               zstptiming = MPI_Wtime() 
     140               IF ( istp == ( nit000 + 1 ) ) elapsed_time = zstptiming 
     141               IF ( istp ==         nitend ) elapsed_time = zstptiming - elapsed_time 
     142            ENDIF 
     143             
    136144            CALL stp        ( istp )  
    137145            istp = istp + 1 
     146 
     147            IF( lwp .AND. ln_timing )   WRITE(numtime,*) 'timing step ', istp-1, ' : ', MPI_Wtime() - zstptiming 
     148 
    138149         END DO 
    139150         ! 
     
    305316         WRITE(numout,*) "       )  )       \) |`\ \)  '.   \      (   (   " 
    306317         WRITE(numout,*) "      (  (           \_/       '-._\      )   )  " 
    307          WRITE(numout,*) "       )  ) jgs                    `     (   (   " 
     318         WRITE(numout,*) "       )  ) jgs                     `    (   (   " 
    308319         WRITE(numout,*) "     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " 
    309320         WRITE(numout,*) 
     
    355366      ! 
    356367      !                                      ! General initialization 
    357       IF( ln_timing    )   CALL timing_init     ! timing 
     368      IF( ln_timing    )   CALL timing_init ( 'timing_sas.output' ) 
    358369      IF( ln_timing    )   CALL timing_start( 'nemo_init') 
    359370 
     
    367378         &                 CALL prt_ctl_init        ! Print control 
    368379       
     380      IF( ln_rstart )      CALL rst_read_open 
    369381                           CALL day_init        ! model calendar (using both namelist and restart infos) 
    370       IF( ln_rstart )      CALL rst_read_open 
    371  
     382 
     383#if defined key_agrif 
     384      uu(:,:,:,:) = 0.0_wp   ;   vv(:,:,:,:) = 0.0_wp   ;   ts(:,:,:,:,:) = 0.0_wp   ! needed for interp done at initialization phase 
     385#endif  
    372386      !                                      ! external forcing  
    373387                           CALL sbc_init( Nbb, Nnn, Naa )  ! Forcings : surface module  
     
    480494      ierr =        dia_wri_alloc() 
    481495      ierr = ierr + dom_oce_alloc()          ! ocean domain 
    482       ierr = ierr + oce_alloc    ()          ! (tsn...) needed for agrif and/or SI3 and bdy 
     496      ierr = ierr + oce_alloc    ()          ! (ts...) needed for agrif and/or SI3 and bdy 
    483497      ierr = ierr + bdy_oce_alloc()          ! bdy masks (incl. initialization) 
    484498      ! 
  • NEMO/branches/2020/dev_r13333_TOP-05_Ethe_Agrif/src/SAS/stpctl.F90

    r13136 r13798  
    2020   USE dom_oce         ! ocean space and time domain variables  
    2121   USE ice      , ONLY : vt_i, u_ice, tm_i 
     22   USE phycst   , ONLY : rt0 
     23   USE sbc_oce  , ONLY : lk_oasis 
    2224   ! 
    2325   USE diawri          ! Standard run outputs       (dia_wri_state routine) 
     
    4850      !! 
    4951      !! ** Method  : - Save the time step in numstp 
    50       !!              - Print it each 50 time steps 
    5152      !!              - Stop the run IF problem encountered by setting nstop > 0 
    5253      !!                Problems checked: ice thickness maximum > 100 m 
     
    6768      REAL(wp)                        ::   zzz                                   ! local real  
    6869      REAL(wp), DIMENSION(4)          ::   zmax, zmaxlocal 
    69       LOGICAL                         ::   ll_wrtstp, ll_colruns, ll_wrtruns 
     70      LOGICAL                         ::   ll_wrtstp, ll_colruns, ll_wrtruns, ll_0oce 
    7071      LOGICAL, DIMENSION(jpi,jpj)     ::   llmsk 
    7172      CHARACTER(len=20)               ::   clname 
     
    8586         ENDIF 
    8687         !                                ! open time.step    ascii file, done only by 1st subdomain 
    87          IF( lwm )   CALL ctl_opn( numstp, 'time.step', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 
     88         IF( lk_oasis ) THEN   ;   clname = 'time_sas.step' 
     89         ELSE                  ;   clname = 'time.step' 
     90         ENDIF 
     91         IF( lwm )   CALL ctl_opn( numstp, clname, 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 
    8892         ! 
    8993         IF( ll_wrtruns ) THEN 
     94            IF( lk_oasis ) THEN   ;   clname = 'run_sas.stat' 
     95            ELSE                  ;   clname = 'run.stat' 
     96            ENDIF 
    9097            !                             ! open run.stat     ascii file, done only by 1st subdomain 
    91             CALL ctl_opn( numrun, 'run.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 
     98            CALL ctl_opn( numrun, clname, 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 
    9299            !                             ! open run.stat.nc netcdf file, done only by 1st subdomain 
    93             clname = 'run.stat.nc' 
     100            clname = TRIM(clname)//'.nc' 
    94101            IF( .NOT. Agrif_Root() )   clname = TRIM(Agrif_CFixed())//"_"//TRIM(clname) 
    95102            istatus = NF90_CREATE( TRIM(clname), NF90_CLOBBER, nrunid ) 
     
    111118      !                                   !==            test of local extrema           ==! 
    112119      !                                   !==  done by all processes at every time step  ==! 
    113       llmsk(:,:) = tmask(:,:,1) == 1._wp 
    114       IF( COUNT( llmsk(:,:) ) > 0 ) THEN   ! avoid huge values sent back for land processors... 
    115          zmax(1) = MAXVAL(      vt_i (:,:)            , mask = llmsk )   ! max ice thickness 
    116          zmax(2) = MAXVAL( ABS( u_ice(:,:) )          , mask = llmsk )   ! max ice velocity (zonal only) 
    117          zmax(3) = MAXVAL(     -tm_i (:,:) + 273.15_wp, mask = llmsk )   ! min ice temperature 
    118       ELSE 
    119          IF( ll_colruns ) THEN    ! default value: must not be kept when calling mpp_max -> must be as small as possible 
    120             zmax(1:3) = -HUGE(1._wp) 
    121          ELSE                     ! default value: must not give true for any of the tests bellow (-> avoid manipulating HUGE...) 
    122             zmax(1:3) = 0._wp 
    123          ENDIF 
    124       ENDIF 
    125       zmax(4) = REAL( nstop, wp )                                     ! stop indicator 
     120      ! 
     121      llmsk(   1:Nis1,:) = .FALSE.                                              ! exclude halos from the checked region 
     122      llmsk(Nie1: jpi,:) = .FALSE. 
     123      llmsk(:,   1:Njs1) = .FALSE. 
     124      llmsk(:,Nje1: jpj) = .FALSE. 
     125      ! 
     126      llmsk(Nis0:Nie0,Njs0:Nje0) = tmask(Nis0:Nie0,Njs0:Nje0,1) == 1._wp        ! test only the inner domain 
     127      ! 
     128      ll_0oce = .NOT. ANY( llmsk(:,:) )                                         ! no ocean point in the inner domain? 
     129      ! 
     130      zmax(1) = MAXVAL(      vt_i (:,:)      , mask = llmsk )                   ! max ice thickness 
     131      zmax(2) = MAXVAL( ABS( u_ice(:,:) )    , mask = llmsk )                   ! max ice velocity (zonal only) 
     132      zmax(3) = MAXVAL(     -tm_i (:,:) + rt0, mask = llmsk )                   ! min ice temperature (in degC) 
     133      zmax(4) = REAL( nstop, wp )                                               ! stop indicator 
     134      ! 
    126135      !                                   !==               get global extrema             ==! 
    127136      !                                   !==  done by all processes if writting run.stat  ==! 
    128137      IF( ll_colruns ) THEN 
    129138         zmaxlocal(:) = zmax(:) 
    130          CALL mpp_max( "stpctl", zmax )          ! max over the global domain 
     139         CALL mpp_max( "stpctl", zmax )          ! max over the global domain: ok even of ll_0oce = .true. 
    131140         nstop = NINT( zmax(4) )                 ! update nstop indicator (now sheared among all local domains) 
    132       ENDIF 
     141      ELSE 
     142         ! if no ocean point: MAXVAL returns -HUGE => we must overwrite this value to avoid error handling bellow. 
     143         IF( ll_0oce )   zmax(1:3) = 0._wp       ! default "valid" values... 
     144      ENDIF 
     145      ! 
     146      zmax(3) = -zmax(3)                              ! move back from max(-zz) to min(zz) : easier to manage! 
     147      IF( ll_colruns ) zmaxlocal(3) = -zmaxlocal(3)   ! move back from max(-zz) to min(zz) : easier to manage! 
     148      ! 
    133149      !                                   !==              write "run.stat" files              ==! 
    134150      !                                   !==  done only by 1st subdomain at writting timestep  ==! 
    135151      IF( ll_wrtruns ) THEN 
    136          WRITE(numrun,9500) kt, zmax(1), zmax(2), -zmax(3) 
    137          istatus = NF90_PUT_VAR( nrunid, nvarid(1), (/ zmax(1)/), (/kt/), (/1/) ) 
    138          istatus = NF90_PUT_VAR( nrunid, nvarid(2), (/ zmax(2)/), (/kt/), (/1/) ) 
    139          istatus = NF90_PUT_VAR( nrunid, nvarid(3), (/-zmax(3)/), (/kt/), (/1/) ) 
     152         WRITE(numrun,9500) kt, zmax(1), zmax(2), zmax(3) 
     153         DO ji = 1, 3 
     154            istatus = NF90_PUT_VAR( nrunid, nvarid(ji), (/zmax(ji)/), (/kt/), (/1/) ) 
     155         END DO 
    140156         IF( kt == nitend )   istatus = NF90_CLOSE(nrunid) 
    141157      END IF 
     
    145161      IF(   zmax(1) >  100._wp .OR.   &                   ! too large ice thickness maximum ( > 100 m) 
    146162         &  zmax(2) >   10._wp .OR.   &                   ! too large ice velocity ( > 10 m/s) 
    147          &  zmax(3) 101._wp .OR.   &                   ! too cold ice temperature ( < -100 degC) 
     163         &  zmax(3) < -101._wp .OR.   &                   ! too cold ice temperature ( < -100 degC) 
    148164         &  ISNAN( zmax(1) + zmax(2) + zmax(3) ) .OR.   &               ! NaN encounter in the tests 
    149165         &  ABS(   zmax(1) + zmax(2) + zmax(3) ) > HUGE(1._wp) ) THEN   ! Infinity encounter in the tests 
     
    154170            IF( lwm .AND. kt /= nitend )   istatus = NF90_CLOSE(nrunid) 
    155171            ! get global loc on the min/max 
    156             CALL mpp_maxloc( 'stpctl',      vt_i(:,:)            , tmask(:,:,1), zzz, iloc(1:2,1) )   ! mpp_maxloc ok if mask = F  
    157             CALL mpp_maxloc( 'stpctl',ABS( u_ice(:,:) )          , tmask(:,:,1), zzz, iloc(1:2,2) ) 
    158             CALL mpp_minloc( 'stpctl',      tm_i(:,:) - 273.15_wp, tmask(:,:,1), zzz, iloc(1:2,3) ) 
     172            CALL mpp_maxloc( 'stpctl',      vt_i(:,:)      , llmsk, zzz, iloc(1:2,1) )   ! mpp_maxloc ok if mask = F  
     173            CALL mpp_maxloc( 'stpctl',ABS( u_ice(:,:) )    , llmsk, zzz, iloc(1:2,2) ) 
     174            CALL mpp_minloc( 'stpctl',      tm_i(:,:) - rt0, llmsk, zzz, iloc(1:2,3) ) 
    159175            ! find which subdomain has the max. 
    160176            iareamin(:) = jpnij+1   ;   iareamax(:) = 0   ;   iareasum(:) = 0 
     
    169185         ELSE                    ! find local min and max locations: 
    170186            ! if we are here, this means that the subdomain contains some oce points -> no need to test the mask used in maxloc 
    171             iloc(1:2,1) = MAXLOC(       vt_i(:,:)            , mask = llmsk ) + (/ nimpp - 1, njmpp - 1/) 
    172             iloc(1:2,2) = MAXLOC( ABS( u_ice(:,:) )          , mask = llmsk ) + (/ nimpp - 1, njmpp - 1/) 
    173             iloc(1:2,3) = MINLOC(       tm_i(:,:) - 273.15_wp, mask = llmsk ) + (/ nimpp - 1, njmpp - 1/) 
     187            iloc(1:2,1) = MAXLOC(       vt_i(:,:)      , mask = llmsk ) 
     188            iloc(1:2,2) = MAXLOC( ABS( u_ice(:,:) )    , mask = llmsk ) 
     189            iloc(1:2,3) = MINLOC(       tm_i(:,:) - rt0, mask = llmsk ) 
     190            DO ji = 1, 3   ! local domain indices ==> global domain indices, excluding halos 
     191               iloc(1:2,ji) = (/ mig0(iloc(1,ji)), mjg0(iloc(2,ji)) /) 
     192            END DO 
    174193            iareamin(:) = narea   ;   iareamax(:) = narea   ;   iareasum(:) = 1         ! this is local information 
    175194         ENDIF 
    176195         ! 
    177196         WRITE(ctmp1,*) ' stp_ctl: ice_thick > 100 m or |ice_vel| > 10 m/s or ice_temp < -100 degC or NaN encounter in the tests' 
    178          CALL wrt_line( ctmp2, kt, 'ice_thick max',  zmax(1), iloc(:,1), iareasum(1), iareamin(1), iareamax(1) ) 
    179          CALL wrt_line( ctmp3, kt, '|ice_vel| max',  zmax(2), iloc(:,2), iareasum(2), iareamin(2), iareamax(2) ) 
    180          CALL wrt_line( ctmp4, kt, 'ice_temp  min', -zmax(3), iloc(:,3), iareasum(3), iareamin(3), iareamax(3) ) 
     197         CALL wrt_line( ctmp2, kt, 'ice_thick max', zmax(1), iloc(:,1), iareasum(1), iareamin(1), iareamax(1) ) 
     198         CALL wrt_line( ctmp3, kt, '|ice_vel| max', zmax(2), iloc(:,2), iareasum(2), iareamin(2), iareamax(2) ) 
     199         CALL wrt_line( ctmp4, kt, 'ice_temp  min', zmax(3), iloc(:,3), iareasum(3), iareamin(3), iareamax(3) ) 
    181200         IF( Agrif_Root() ) THEN 
    182201            WRITE(ctmp6,*) '      ===> output of last computed fields in output.abort* files' 
Note: See TracChangeset for help on using the changeset viewer.