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 15342 for NEMO/branches/UKMO/NEMO_4.0.4_CO9_shelf_climate/src/OCE/IOM – NEMO

Ignore:
Timestamp:
2021-10-07T14:28:55+02:00 (3 years ago)
Author:
hadjt
Message:

The region mean code namelist now has an entry to specified number of regions, this used to be counted in iom_init, which was messy. Instead, it is read from the namelist, and checked in regionmean initialization, and the model is stopped if there is a mismatch.

Still without iom_put or kara mld

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/UKMO/NEMO_4.0.4_CO9_shelf_climate/src/OCE/IOM/iom.F90

    r15333 r15342  
    4848   USE diurnal_bulk, ONLY : ln_diurnal_only, ln_diurnal 
    4949 
     50   !JT 
     51   !USE diaregmean , ONLY : ln_diaregmean, n_regions_output 
     52   !JT 
     53 
    5054   IMPLICIT NONE 
    5155   PUBLIC   !   must be public to be able to access iom_def through iom 
     
    5862   PUBLIC iom_init, iom_swap, iom_open, iom_close, iom_setkt, iom_varid, iom_get, iom_get_var 
    5963   PUBLIC iom_chkatt, iom_getatt, iom_putatt, iom_getszuld, iom_rstput, iom_delay_rst, iom_put 
    60  
    61    !JT 
    62    INTEGER , PUBLIC ::   n_regions_output 
    63    !JT 
    6464 
    6565   PUBLIC iom_use, iom_context_finalize, iom_miss_val 
     
    126126 
    127127    !JT 
    128  
    129       REAL(wp),  ALLOCATABLE,   DIMENSION(:,:) ::   tmpregion !: temporary region_mask 
    130       INTEGER, DIMENSION(3) ::   zdimsz   ! number of elements in each of the 3 dimensions (i.e., lon, lat, no of masks, 297,  375,  4) for an array 
    131       INTEGER               ::   zndims   ! number of dimensions in an array (i.e. 3, ) 
    132       INTEGER :: inum, nmasks,ierr,maskno,idmaskvar,tmpint 
    133       REAL(wp), ALLOCATABLE,   DIMENSION(:,:,:)  ::   tmp_region_mask_real   ! tempory region_mask of reals 
    134        
    135128      LOGICAL ::   ln_diaregmean  ! region mean calculation 
    136     
     129      INTEGER  ::  nn_regions_output, n_regions_output 
    137130     
    138131      INTEGER :: ios                  ! Local integer output status for namelist read 
     
    148141      LOGICAL :: ln_diaregmean_bgc  ! region mean calculation including BGC 
    149142#endif 
    150  
    151  
    152143    !JT 
    153144 
     
    174165       
    175166#if defined key_fabm 
    176       NAMELIST/nam_diaregmean/ ln_diaregmean,ln_diaregmean_ascii,ln_diaregmean_bin,ln_diaregmean_nc,& 
     167      NAMELIST/nam_diaregmean/ ln_diaregmean,nn_regions_output,ln_diaregmean_ascii,ln_diaregmean_bin,ln_diaregmean_nc,& 
    177168        & ln_diaregmean_karamld, ln_diaregmean_pea,ln_diaregmean_diaar5,ln_diaregmean_diasbc,ln_diaregmean_bgc 
    178169#else 
    179       NAMELIST/nam_diaregmean/ ln_diaregmean,ln_diaregmean_ascii,ln_diaregmean_bin,ln_diaregmean_nc,& 
     170      NAMELIST/nam_diaregmean/ ln_diaregmean,nn_regions_output,ln_diaregmean_ascii,ln_diaregmean_bin,ln_diaregmean_nc,& 
    180171        & ln_diaregmean_karamld, ln_diaregmean_pea,ln_diaregmean_diaar5,ln_diaregmean_diasbc 
    181172#endif 
     
    193184      IF(lwm) WRITE ( numond, nam_diaregmean ) 
    194185 
    195       IF (ln_diaregmean) THEN 
    196        
    197         ! Open region mask for region means, and retrieve the size of the mask (number of levels)           
    198           CALL iom_open ( 'region_mask.nc', inum ) 
    199           idmaskvar = iom_varid( inum, 'mask', kdimsz=zdimsz, kndims=zndims, ldstop = .FALSE.)           
    200           nmasks = zdimsz(3) 
    201            
    202           ! read in the region mask (which contains floating point numbers) into a temporary array of reals. 
    203           ALLOCATE( tmp_region_mask_real(jpi,jpj,nmasks),  STAT= ierr ) 
    204           IF( ierr /= 0 )   CALL ctl_stop( 'dia_regmean_init: failed to allocate tmp_region_mask_real array' ) 
    205            
    206           ! Use jpdom_unknown to read in a n layer mask. 
    207           tmp_region_mask_real(:,:,:) = 0 
    208           CALL iom_get( inum, jpdom_unknown, 'mask', tmp_region_mask_real(1:nlci,1:nlcj,1:nmasks),   & 
    209               &          kstart = (/ mig(1),mjg(1),1 /), kcount = (/ nlci,nlcj,nmasks /) ) 
    210            
    211           CALL iom_close( inum ) 
    212           !Convert the region mask of reals into one of integers.  
    213            
    214            
    215           n_regions_output = 0 
    216           DO maskno = 1,nmasks 
    217               tmpint = maxval(int(tmp_region_mask_real(:,:,maskno))) 
    218               CALL mpp_max( 'iom',tmpint ) 
    219               n_regions_output = n_regions_output + (tmpint + 1) 
    220           END DO 
    221        
    222            
    223          
     186      !IF(lwp) WRITE(numout,*) 'JT IOM_init: ln_diaregmean = ', ln_diaregmean 
     187      IF (ln_diaregmean) THEN       
     188        n_regions_output = nn_regions_output 
     189        IF(lwp) WRITE(numout,*) 'JT IOM_init: n_regions_output , ln_diaregmean =  ', n_regions_output ,ln_diaregmean 
     190          
    224191      ELSE 
    225192        n_regions_output = 1 
    226       ENDIF 
    227        
    228        
    229  
    230  
    231  
     193        IF(lwp) WRITE(numout,*) 'JT IOM_init: n_regions_output , ln_diaregmean =  ', n_regions_output ,ln_diaregmean 
     194      ENDIF 
    232195    !JT 
    233196 
Note: See TracChangeset for help on using the changeset viewer.