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 12377 for NEMO/trunk/src/OCE/IOM/iom.F90 – NEMO

Ignore:
Timestamp:
2020-02-12T15:39:06+01:00 (4 years ago)
Author:
acc
Message:

The big one. Merging all 2019 developments from the option 1 branch back onto the trunk.

This changeset reproduces 2019/dev_r11943_MERGE_2019 on the trunk using a 2-URL merge
onto a working copy of the trunk. I.e.:

svn merge --ignore-ancestry \

svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/trunk \
svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/branches/2019/dev_r11943_MERGE_2019 ./

The --ignore-ancestry flag avoids problems that may otherwise arise from the fact that
the merge history been trunk and branch may have been applied in a different order but
care has been taken before this step to ensure that all applicable fixes and updates
are present in the merge branch.

The trunk state just before this step has been branched to releases/release-4.0-HEAD
and that branch has been immediately tagged as releases/release-4.0.2. Any fixes
or additions in response to tickets on 4.0, 4.0.1 or 4.0.2 should be done on
releases/release-4.0-HEAD. From now on future 'point' releases (e.g. 4.0.2) will
remain unchanged with periodic releases as needs demand. Note release-4.0-HEAD is a
transitional naming convention. Future full releases, say 4.2, will have a release-4.2
branch which fulfills this role and the first point release (e.g. 4.2.0) will be made
immediately following the release branch creation.

2020 developments can be started from any trunk revision later than this one.

Location:
NEMO/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk

    • Property svn:externals
      •  

        old new  
        33^/utils/build/mk@HEAD         mk 
        44^/utils/tools@HEAD            tools 
        5 ^/vendors/AGRIF/dev@HEAD      ext/AGRIF 
         5^/vendors/AGRIF/dev_r11615_ENHANCE-04_namelists_as_internalfiles_agrif@HEAD      ext/AGRIF 
        66^/vendors/FCM@HEAD            ext/FCM 
        77^/vendors/IOIPSL@HEAD         ext/IOIPSL 
  • NEMO/trunk/src/OCE/IOM/iom.F90

    r12283 r12377  
    2929   USE lib_mpp           ! MPP library 
    3030#if defined key_iomput 
    31    USE sbc_oce  , ONLY :   nn_fsbc         ! ocean space and time domain 
    32    USE trc_oce  , ONLY :   nn_dttrc        !  !: frequency of step on passive tracers 
     31   USE sbc_oce  , ONLY :   nn_fsbc, ght_abl, ghw_abl, e3t_abl, e3w_abl, jpka, jpkam1 
    3332   USE icb_oce  , ONLY :   nclasses, class_num       !  !: iceberg classes 
    3433#if defined key_si3 
     
    4645#endif 
    4746   USE lib_fortran  
    48    USE diurnal_bulk, ONLY : ln_diurnal_only, ln_diurnal 
     47   USE diu_bulk, ONLY : ln_diurnal_only, ln_diurnal 
    4948 
    5049   IMPLICIT NONE 
     
    5655   LOGICAL, PUBLIC, PARAMETER ::   lk_iomput = .FALSE.       !: iom_put flag 
    5756#endif 
    58    PUBLIC iom_init, iom_swap, iom_open, iom_close, iom_setkt, iom_varid, iom_get, iom_get_var 
     57   PUBLIC iom_init, iom_init_closedef, iom_swap, iom_open, iom_close, iom_setkt, iom_varid, iom_get, iom_get_var 
    5958   PUBLIC iom_chkatt, iom_getatt, iom_putatt, iom_getszuld, iom_rstput, iom_delay_rst, iom_put 
    60    PUBLIC iom_use, iom_context_finalize, iom_miss_val 
     59   PUBLIC iom_use, iom_context_finalize, iom_update_file_name, iom_miss_val 
    6160 
    6261   PRIVATE iom_rp0d, iom_rp1d, iom_rp2d, iom_rp3d 
     
    6564#if defined key_iomput 
    6665   PRIVATE iom_set_domain_attr, iom_set_axis_attr, iom_set_field_attr, iom_set_file_attr, iom_get_file_attr, iom_set_grid_attr 
    67    PRIVATE set_grid, set_grid_bounds, set_scalar, set_xmlatt, set_mooring, iom_update_file_name, iom_sdate 
     66   PRIVATE set_grid, set_grid_bounds, set_scalar, set_xmlatt, set_mooring, iom_sdate 
    6867   PRIVATE iom_set_rst_context, iom_set_rstw_active, iom_set_rstr_active 
    6968# endif 
     
    8685   END INTERFACE iom_put 
    8786   
     87   !! * Substitutions 
     88#  include "do_loop_substitute.h90" 
    8889   !!---------------------------------------------------------------------- 
    8990   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    9394CONTAINS 
    9495 
    95    SUBROUTINE iom_init( cdname, fname, ld_tmppatch )  
     96   SUBROUTINE iom_init( cdname, fname, ld_tmppatch, ld_closedef )  
    9697      !!---------------------------------------------------------------------- 
    9798      !!                     ***  ROUTINE   *** 
     
    103104      CHARACTER(len=*), OPTIONAL, INTENT(in)  :: fname 
    104105      LOGICAL         , OPTIONAL, INTENT(in)  :: ld_tmppatch 
     106      LOGICAL         , OPTIONAL, INTENT(in)  :: ld_closedef 
    105107#if defined key_iomput 
    106108      ! 
     
    113115      ! 
    114116      REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zt_bnds, zw_bnds 
     117      REAL(wp), DIMENSION(2,jpkam1)         :: za_bnds   ! ABL vertical boundaries 
    115118      LOGICAL ::   ll_tmppatch = .TRUE.    !: seb: patch before we remove periodicity 
    116119      INTEGER ::   nldi_save, nlei_save    !:      and close boundaries in output files 
    117120      INTEGER ::   nldj_save, nlej_save    !: 
     121      LOGICAL ::   ll_closedef = .TRUE. 
    118122      !!---------------------------------------------------------------------- 
    119123      ! 
     
    130134         IF( njmpp + jpj - 1 == jpjglo ) nlej = jpj 
    131135      ENDIF 
     136      IF ( PRESENT(ld_closedef) ) ll_closedef = ld_closedef 
    132137      ! 
    133138      ALLOCATE( zt_bnds(2,jpk), zw_bnds(2,jpk) ) 
     
    200205      ! vertical grid definition 
    201206      IF(.NOT.llrst_context) THEN 
    202           CALL iom_set_axis_attr( "deptht",  paxis = gdept_1d ) 
    203           CALL iom_set_axis_attr( "depthu",  paxis = gdept_1d ) 
    204           CALL iom_set_axis_attr( "depthv",  paxis = gdept_1d ) 
    205           CALL iom_set_axis_attr( "depthw",  paxis = gdepw_1d ) 
    206  
     207          CALL iom_set_axis_attr(  "deptht", paxis = gdept_1d ) 
     208          CALL iom_set_axis_attr(  "depthu", paxis = gdept_1d ) 
     209          CALL iom_set_axis_attr(  "depthv", paxis = gdept_1d ) 
     210          CALL iom_set_axis_attr(  "depthw", paxis = gdepw_1d ) 
     211 
     212          ! ABL 
     213          IF( .NOT. ALLOCATED(ght_abl) ) THEN   ! force definition for xml files (xios)  
     214             ALLOCATE( ght_abl(jpka), ghw_abl(jpka), e3t_abl(jpka), e3w_abl(jpka) )   ! default allocation needed by iom 
     215             ght_abl(:) = -1._wp   ;   ghw_abl(:) = -1._wp 
     216             e3t_abl(:) = -1._wp   ;   e3w_abl(:) = -1._wp 
     217          ENDIF 
     218          CALL iom_set_axis_attr( "ght_abl", ght_abl(2:jpka) ) 
     219          CALL iom_set_axis_attr( "ghw_abl", ghw_abl(2:jpka) ) 
     220           
    207221          ! Add vertical grid bounds 
    208222          jkmin = MIN(2,jpk)  ! in case jpk=1 (i.e. sas2D) 
     
    213227          zw_bnds(2,1:jpkm1  ) = gdepw_1d(jkmin:jpk) 
    214228          zw_bnds(2,jpk:     ) = gdepw_1d(jpk) + e3t_1d(jpk) 
    215           CALL iom_set_axis_attr( "deptht", bounds=zw_bnds ) 
    216           CALL iom_set_axis_attr( "depthu", bounds=zw_bnds ) 
    217           CALL iom_set_axis_attr( "depthv", bounds=zw_bnds ) 
    218           CALL iom_set_axis_attr( "depthw", bounds=zt_bnds ) 
     229          CALL iom_set_axis_attr(  "deptht", bounds=zw_bnds ) 
     230          CALL iom_set_axis_attr(  "depthu", bounds=zw_bnds ) 
     231          CALL iom_set_axis_attr(  "depthv", bounds=zw_bnds ) 
     232          CALL iom_set_axis_attr(  "depthw", bounds=zt_bnds ) 
     233 
     234          ! ABL 
     235          za_bnds(1,:) = ghw_abl(1:jpkam1) 
     236          za_bnds(2,:) = ghw_abl(2:jpka  ) 
     237          CALL iom_set_axis_attr( "ght_abl", bounds=za_bnds ) 
     238          za_bnds(1,:) = ght_abl(2:jpka  ) 
     239          za_bnds(2,:) = ght_abl(2:jpka  ) + e3w_abl(2:jpka) 
     240          CALL iom_set_axis_attr( "ghw_abl", bounds=za_bnds ) 
     241 
    219242          CALL iom_set_axis_attr( "nfloat", (/ (REAL(ji,wp), ji=1,jpnfl) /) ) 
    220243# if defined key_si3 
     
    250273      ENDIF 
    251274      ! 
    252       ! end file definition 
     275      ! set time step length 
    253276      dtime%second = rdt 
    254277      CALL xios_set_timestep( dtime ) 
    255       CALL xios_close_context_definition() 
    256       CALL xios_update_calendar( 0 ) 
     278      ! 
     279      ! conditional closure of context definition 
     280      IF ( ll_closedef ) CALL iom_init_closedef 
    257281      ! 
    258282      DEALLOCATE( zt_bnds, zw_bnds ) 
     
    265289      ! 
    266290   END SUBROUTINE iom_init 
     291 
     292   SUBROUTINE iom_init_closedef 
     293      !!---------------------------------------------------------------------- 
     294      !!            ***  SUBROUTINE iom_init_closedef  *** 
     295      !!---------------------------------------------------------------------- 
     296      !! 
     297      !! ** Purpose : Closure of context definition 
     298      !! 
     299      !!---------------------------------------------------------------------- 
     300 
     301#if defined key_iomput 
     302      CALL xios_close_context_definition() 
     303      CALL xios_update_calendar( 0 ) 
     304#else 
     305      IF( .FALSE. )   WRITE(numout,*) 'iom_init_closedef: should not see this'   ! useless statement to avoid compilation warnings 
     306#endif 
     307 
     308   END SUBROUTINE iom_init_closedef 
    267309 
    268310   SUBROUTINE iom_set_rstw_var_active(field) 
     
    382424        CALL iom_set_rstw_var_active('sshn') 
    383425        CALL iom_set_rstw_var_active('rhop') 
    384      ! extra variable needed for the ice sheet coupling 
    385         IF ( ln_iscpl ) THEN 
    386              CALL iom_set_rstw_var_active('tmask') 
    387              CALL iom_set_rstw_var_active('umask') 
    388              CALL iom_set_rstw_var_active('vmask') 
    389              CALL iom_set_rstw_var_active('smask') 
    390              CALL iom_set_rstw_var_active('e3t_n') 
    391              CALL iom_set_rstw_var_active('e3u_n') 
    392              CALL iom_set_rstw_var_active('e3v_n') 
    393              CALL iom_set_rstw_var_active('gdepw_n') 
    394         END IF 
    395426      ENDIF 
    396427      IF(ln_diurnal) CALL iom_set_rstw_var_active('Dsst') 
     
    701732      clname   = trim(cdname) 
    702733      IF ( .NOT. Agrif_Root() .AND. .NOT. lliof ) THEN 
    703 !FUS         iln    = INDEX(clname,'/')  
    704          iln    = INDEX(clname,'/',BACK=.true.)  ! FUS: to insert the nest index at the right location within the string, the last / has to be found (search from the right to left) 
     734         iln    = INDEX(clname,'/')  
    705735         cltmpn = clname(1:iln) 
    706736         clname = clname(iln+1:LEN_TRIM(clname)) 
     
    11491179            WRITE(cldmspc , fmt='(i1)') idmspc 
    11501180            ! 
    1151             IF(     idmspc <  irankpv ) THEN  
    1152                CALL ctl_stop( TRIM(clinfo), 'The file has only '//cldmspc//' spatial dimension',   & 
    1153                   &                         'it is impossible to read a '//clrankpv//'D array from this file...' ) 
    1154             ELSEIF( idmspc == irankpv ) THEN 
     1181            !!GS: we consider 2D data as 3D data with vertical dim size = 1 
     1182            !IF(     idmspc <  irankpv ) THEN  
     1183            !   CALL ctl_stop( TRIM(clinfo), 'The file has only '//cldmspc//' spatial dimension',   & 
     1184            !      &                         'it is impossible to read a '//clrankpv//'D array from this file...' ) 
     1185            !ELSEIF( idmspc == irankpv ) THEN 
     1186            IF( idmspc == irankpv ) THEN 
    11551187               IF( PRESENT(pv_r1d) .AND. idom /= jpdom_unknown )   & 
    11561188                  &   CALL ctl_stop( TRIM(clinfo), 'case not coded...You must use jpdom_unknown' ) 
     
    17321764 
    17331765   SUBROUTINE iom_p4d( cdname, pfield4d ) 
    1734       CHARACTER(LEN=*)                  , INTENT(in) ::   cdname 
     1766      CHARACTER(LEN=*)                , INTENT(in) ::   cdname 
    17351767      REAL(wp),       DIMENSION(:,:,:,:), INTENT(in) ::   pfield4d 
    17361768#if defined key_iomput 
     
    19742006      ! 
    19752007      INTEGER :: ji, jj, jn, ni, nj 
    1976       INTEGER :: icnr, jcnr                                    ! Offset such that the vertex coordinate (i+icnr,j+jcnr) 
    1977       !                                                        ! represents the bottom-left corner of cell (i,j) 
     2008      INTEGER :: icnr, jcnr                             ! Offset such that the vertex coordinate (i+icnr,j+jcnr) 
     2009      !                                                 ! represents the bottom-left corner of cell (i,j) 
    19782010      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) :: z_bnds      ! Lat/lon coordinates of the vertices of cell (i,j) 
    19792011      REAL(wp), ALLOCATABLE, DIMENSION(:,:)     :: z_fld       ! Working array to determine where to rotate cells 
     
    21452177      f_op%timestep = nn_fsbc  ;  f_of%timestep =  0  ; CALL iom_set_field_attr('SBC'             , freq_op=f_op, freq_offset=f_of) 
    21462178      f_op%timestep = nn_fsbc  ;  f_of%timestep =  0  ; CALL iom_set_field_attr('SBC_scalar'      , freq_op=f_op, freq_offset=f_of) 
    2147       f_op%timestep = nn_dttrc ;  f_of%timestep =  0  ; CALL iom_set_field_attr('ptrc_T'          , freq_op=f_op, freq_offset=f_of) 
    2148       f_op%timestep = nn_dttrc ;  f_of%timestep =  0  ; CALL iom_set_field_attr('diad_T'          , freq_op=f_op, freq_offset=f_of) 
     2179      f_op%timestep = nn_fsbc  ;  f_of%timestep =  0  ; CALL iom_set_field_attr('ABL'             , freq_op=f_op, freq_offset=f_of) 
    21492180 
    21502181      ! output file names (attribut: name) 
     
    22712302      CHARACTER(LEN=20)  ::   clfreq 
    22722303      CHARACTER(LEN=20)  ::   cldate 
    2273       CHARACTER(LEN=256) ::   cltmpn                 !FUS needed for correct path with AGRIF 
    2274       INTEGER            ::   iln                    !FUS needed for correct path with AGRIF 
    22752304      INTEGER            ::   idx 
    22762305      INTEGER            ::   jn 
     
    23552384            END DO 
    23562385            ! 
    2357 !FUS            IF( jn == 1 .AND. TRIM(Agrif_CFixed()) /= '0' )   clname = TRIM(Agrif_CFixed())//"_"//TRIM(clname) 
    2358 !FUS see comment line 700  
    2359             IF( jn == 1 .AND. TRIM(Agrif_CFixed()) /= '0' ) THEN 
    2360              iln    = INDEX(clname,'/',BACK=.true.) 
    2361              cltmpn = clname(1:iln) 
    2362              clname = clname(iln+1:LEN_TRIM(clname)) 
    2363              clname = TRIM(cltmpn)//TRIM(Agrif_CFixed())//'_'//TRIM(clname) 
    2364             ENDIF 
    2365 !FUS  
     2386            IF( jn == 1 .AND. TRIM(Agrif_CFixed()) /= '0' )   clname = TRIM(Agrif_CFixed())//"_"//TRIM(clname) 
    23662387            IF( jn == 1 )   CALL iom_set_file_attr( cdid, name        = clname ) 
    23672388            IF( jn == 2 )   CALL iom_set_file_attr( cdid, name_suffix = clname ) 
     
    24422463   END SUBROUTINE iom_context_finalize 
    24432464 
     2465   SUBROUTINE iom_update_file_name( cdid ) 
     2466      CHARACTER(LEN=*), INTENT(in) ::   cdid 
     2467      IF( .FALSE. )   WRITE(numout,*)  cdid   ! useless test to avoid compilation warnings 
     2468   END SUBROUTINE iom_update_file_name 
     2469 
    24442470#endif 
    24452471 
     
    24612487#else 
    24622488      IF( .FALSE. )   WRITE(numout,*) cdname, pmiss_val   ! useless test to avoid compilation warnings 
     2489      IF( .FALSE. )   pmiss_val = 0._wp                   ! useless assignment to avoid compilation warnings 
    24632490#endif 
    24642491   END SUBROUTINE iom_miss_val 
Note: See TracChangeset for help on using the changeset viewer.