Changeset 15342
 Timestamp:
 20211007T14:28:55+02:00 (20 months ago)
 Location:
 NEMO/branches/UKMO/NEMO_4.0.4_CO9_shelf_climate/src/OCE
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

NEMO/branches/UKMO/NEMO_4.0.4_CO9_shelf_climate/src/OCE/DIA/diaregmean.F90
r15333 r15342 26 26 27 27 LOGICAL , PUBLIC :: ln_diaregmean ! region mean calculation 28 INTEGER , PUBLIC :: n_regions_output 28 29 PUBLIC dia_regmean_init ! routine called by nemogcm.F90 29 30 PUBLIC dia_regmean ! routine called by diawri.F90 … … 79 80 INTEGER :: jj,ji ! i and j index 80 81 INTEGER :: tmpint ! temporary integer 82 INTEGER :: nn_regions_output,check_regions_output 81 83 REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: tmpregion !: temporary region_mask 82 84 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 83 85 INTEGER :: zndims ! number of dimensions in an array (i.e. 3, ) 84 86 85 87 CHARACTER(len=128) :: stop_error_message 86 88 #if defined key_fabm 87 89 INTEGER :: js,jl,jn, tmp_dummy … … 93 95 #endif 94 96 95 ! 96 NAMELIST/nam_diaregmean/ ln_diaregmean,ln_diaregmean_ascii,ln_diaregmean_bin,ln_diaregmean_nc,& 97 98 #if defined key_fabm 99 NAMELIST/nam_diaregmean/ ln_diaregmean,nn_regions_output,ln_diaregmean_ascii,ln_diaregmean_bin,ln_diaregmean_nc,& 97 100 & ln_diaregmean_karamld, ln_diaregmean_pea,ln_diaregmean_diaar5,ln_diaregmean_diasbc,ln_diaregmean_bgc 101 #else 102 NAMELIST/nam_diaregmean/ ln_diaregmean,nn_regions_output,ln_diaregmean_ascii,ln_diaregmean_bin,ln_diaregmean_nc,& 103 & ln_diaregmean_karamld, ln_diaregmean_pea,ln_diaregmean_diaar5,ln_diaregmean_diasbc 104 #endif 98 105 99 106 … … 292 299 ! without missing any number, so the number of regions is the maximum number + 1 (for land). mpp_max across the 293 300 ! processors to get the global maxima 301 check_regions_output = 0 294 302 DO maskno = 1,nmasks 295 303 tmpint = maxval(region_mask(:,:,maskno)) 296 304 CALL mpp_max( 'diaregionmean', tmpint ) 297 305 nreg_mat(maskno) = tmpint + 1 298 END DO 299 306 check_regions_output = check_regions_output + tmpint + 1 307 END DO 308 309 310 311 ! can't use IOM call, as this iom isn't called yet... maybe move into step after iom_init? 312 n_regions_output = nn_regions_output 313 write (stop_error_message, "(A70,I3,A8,I3)") "dia_regmean_init: namelist:nam_diaregmean nn_regions_output should be ",check_regions_output," but is ",n_regions_output 314 315 IF (check_regions_output .NE. n_regions_output) THEN 316 CALL ctl_stop(trim(stop_error_message)) 317 ENDIF 318 319 320 321 300 322 IF(lwp) THEN 301 323 ! if writing out as binary and text, open the files. 
NEMO/branches/UKMO/NEMO_4.0.4_CO9_shelf_climate/src/OCE/IOM/iom.F90
r15333 r15342 48 48 USE diurnal_bulk, ONLY : ln_diurnal_only, ln_diurnal 49 49 50 !JT 51 !USE diaregmean , ONLY : ln_diaregmean, n_regions_output 52 !JT 53 50 54 IMPLICIT NONE 51 55 PUBLIC ! must be public to be able to access iom_def through iom … … 58 62 PUBLIC iom_init, iom_swap, iom_open, iom_close, iom_setkt, iom_varid, iom_get, iom_get_var 59 63 PUBLIC iom_chkatt, iom_getatt, iom_putatt, iom_getszuld, iom_rstput, iom_delay_rst, iom_put 60 61 !JT62 INTEGER , PUBLIC :: n_regions_output63 !JT64 64 65 65 PUBLIC iom_use, iom_context_finalize, iom_miss_val … … 126 126 127 127 !JT 128 129 REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: tmpregion !: temporary region_mask130 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 array131 INTEGER :: zndims ! number of dimensions in an array (i.e. 3, )132 INTEGER :: inum, nmasks,ierr,maskno,idmaskvar,tmpint133 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: tmp_region_mask_real ! tempory region_mask of reals134 135 128 LOGICAL :: ln_diaregmean ! region mean calculation 136 129 INTEGER :: nn_regions_output, n_regions_output 137 130 138 131 INTEGER :: ios ! Local integer output status for namelist read … … 148 141 LOGICAL :: ln_diaregmean_bgc ! region mean calculation including BGC 149 142 #endif 150 151 152 143 !JT 153 144 … … 174 165 175 166 #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,& 177 168 & ln_diaregmean_karamld, ln_diaregmean_pea,ln_diaregmean_diaar5,ln_diaregmean_diasbc,ln_diaregmean_bgc 178 169 #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,& 180 171 & ln_diaregmean_karamld, ln_diaregmean_pea,ln_diaregmean_diaar5,ln_diaregmean_diasbc 181 172 #endif … … 193 184 IF(lwm) WRITE ( numond, nam_diaregmean ) 194 185 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 224 191 ELSE 225 192 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 232 195 !JT 233 196
Note: See TracChangeset
for help on using the changeset viewer.