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 13022 – NEMO

Changeset 13022


Ignore:
Timestamp:
2020-06-03T16:20:56+02:00 (4 years ago)
Author:
andmirek
Message:

Ticket #2462 update routine setting fields in the file read by XIOS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_12905_xios_restart/src/OCE/IOM/iom.F90

    r12977 r13022  
    6767   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 
    6868   PRIVATE set_grid, set_grid_bounds, set_scalar, set_xmlatt, set_mooring, iom_sdate 
    69    PRIVATE iom_set_rst_context, iom_set_rstr_active 
     69   PRIVATE iom_set_rst_context, iom_set_vars_active 
    7070# endif 
    7171   PRIVATE iom_set_rstw_active 
     
    280280             CALL iom_set_rst_context(.TRUE.) 
    281281!set which fields will be read from restart file 
    282              CALL iom_set_rstr_active(fname, idfp) 
     282             CALL iom_set_vars_active(fname, idfp) 
    283283          ELSE 
    284284             CALL ctl_stop( 'iom_init:', 'restart read with XIOS: missing pointer to NETCDF file' ) 
     
    342342   END SUBROUTINE iom_init_closedef 
    343343 
    344    SUBROUTINE iom_set_rstr_active(cdfname, idnum) 
     344   SUBROUTINE iom_set_vars_active(cdfname, idnum) 
    345345      !!--------------------------------------------------------------------- 
    346       !!                   ***  SUBROUTINE  iom_set_rstr_active  *** 
    347       !! 
    348       !! ** Purpose :  define file name in XIOS context for reading restart file, 
    349       !!               enable variables present in restart file for reading with XIOS  
     346      !!                   ***  SUBROUTINE  iom_set_vars_active  *** 
     347      !! 
     348      !! ** Purpose :  define filename in XIOS context for reading file, 
     349      !!               enable variables present in a file for reading with XIOS  
     350      !!               id of the file is assumed to be rrestart. 
    350351      !!--------------------------------------------------------------------- 
    351352 
    352 !sets enabled = .TRUE. for each field in restart file 
    353353   CHARACTER(len=*), INTENT(IN) :: cdfname 
    354354   INTEGER         , INTENT(IN) :: idnum  
     
    365365   LOGICAL                                    :: lmeta 
    366366 
    367 !failed to build with AGRIF 
    368 !      meta(1:NMETA) = ["nav_lat",        & 
    369 !            "nav_lon", "nav_lev", "time_instant",                  & 
    370 !            "time_instant_bounds", "time_counter",                 & 
    371 !            "time_counter_bounds", "x", "y", "numcat"] 
    372  
    373367        meta(1) = "nav_lat" 
    374368        meta(2) = "nav_lon" 
     
    382376        meta(10) = "numcat" 
    383377 
    384         clinfo = '          iom_set_rstr_active, file: '//TRIM(cdfname) 
     378        clinfo = '          iom_set_vars_active, file: '//TRIM(cdfname) 
    385379 
    386380        IF(lwp) write(numout, *) TRIM(clinfo) 
     
    413407            IF(.NOT.lmeta) THEN 
    414408               CALL xios_add_child(file_hdl, field_hdl, TRIM(varname)) 
    415                if(lwp) write(numout, *) 'ADD field: ', TRIM(varname) 
    416                IF(lwp) CALL FLUSH(numout) 
    417409               mdims = ndims 
    418410 
     
    422414 
    423415               IF(mdims == 3) THEN 
    424                       if(lwp) write(numout, *) '3D', indimlens(ndims) 
    425                       IF(lwp) CALL FLUSH(numout) 
    426  
    427416                      CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(varname),   & 
    428                                    domain_ref="grid_N", axis_ref=TRIM(iom_axis(indimlens(ndims))), & 
     417                                   domain_ref="grid_N", axis_ref=TRIM(iom_axis(indimlens(dimids(mdims)))), & 
    429418                                   prec = 8, operation = "instant") 
    430419               ELSEIF(mdims == 2) THEN 
    431                       if(lwp) write(numout, *) '2D' 
    432                       IF(lwp) CALL FLUSH(numout) 
    433  
    434420                      CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(varname), & 
    435421                                          domain_ref="grid_N", prec = 8, operation = "instant")  
    436422               ELSEIF(mdims == 1) THEN 
    437                       if(lwp) write(numout, *) '1D', indimlens(ndims) 
    438                       IF(lwp) CALL FLUSH(numout) 
    439  
    440423                      CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(varname), & 
    441                                           axis_ref=TRIM(iom_axis(indimlens(ndims))), prec = 8, operation = "instant") 
     424                                          axis_ref=TRIM(iom_axis(indimlens(dimids(mdims)))), prec = 8, operation = "instant") 
    442425               ELSEIF(mdims == 0) THEN 
    443                       if(lwp) write(numout, *) '0D' 
    444                       IF(lwp) CALL FLUSH(numout) 
    445  
    446426                      CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(varname), & 
    447427                                                scalar_ref = "grid_scalar", prec = 8, operation = "instant") 
    448428               ELSE 
    449                       if(lwp) write(numout, *) 'WAHT?' 
    450                       IF(lwp) CALL FLUSH(numout) 
    451  
    452                       WRITE(ctmp1,*) 'iom_set_rstr_active: variable ', TRIM(varname) ,' incorrect number of dimensions'  
    453                       CALL ctl_stop( 'iom_set_rstr_active:', ctmp1 ) 
     429                      WRITE(ctmp1,*) 'iom_set_vars_active: variable ', TRIM(varname) ,' incorrect number of dimensions'  
     430                      CALL ctl_stop( 'iom_set_vars_active:', ctmp1 ) 
    454431               ENDIF 
    455432            ENDIF 
     
    457434        DEALLOCATE(indimlens, indimnames) 
    458435#endif 
    459    END SUBROUTINE iom_set_rstr_active 
     436   END SUBROUTINE iom_set_vars_active 
    460437 
    461438   SUBROUTINE iom_set_rstw_file(cdrst_file) 
Note: See TracChangeset for help on using the changeset viewer.