Changeset 2715 for trunk/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc.F90
- Timestamp:
- 2011-03-30T17:58:35+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc.F90
r2528 r2715 23 23 USE zdfddm , ONLY : avs !: salinity vertical diffusivity coeff. at w-point 24 24 # endif 25 USE trcnam_trp ! passive tracers transport namelist variables25 USE trcnam_trp ! passive tracers transport namelist variables 26 26 USE trdmod_trc_oce ! definition of main arrays used for trends computations 27 27 USE in_out_manager ! I/O manager … … 30 30 USE ioipsl ! NetCDF library 31 31 USE lbclnk ! ocean lateral boundary conditions (or mpp link) 32 USE lib_mpp ! MPP library 32 33 USE trdmld_trc_rst ! restart for diagnosing the ML trends 33 34 USE prtctl ! print control … … 39 40 40 41 PUBLIC trd_mld_trc 42 PUBLIC trd_mld_trc_alloc 41 43 PUBLIC trd_mld_bio 42 44 PUBLIC trd_mld_trc_init … … 46 48 CHARACTER (LEN=40) :: clhstnam ! name of the trends NetCDF file 47 49 INTEGER :: nmoymltrd 48 INTEGER :: ndextrd1(jpi*jpj)50 INTEGER, ALLOCATABLE, SAVE, DIMENSION(:) :: ndextrd1 49 51 INTEGER, DIMENSION(jptra) :: nidtrd, nh_t 50 52 INTEGER :: ndimtrd1 … … 58 60 LOGICAL :: lldebug = .TRUE. 59 61 62 ! Workspace array for trd_mld_trc() routine. Declared here as is 4D and 63 ! cannot use workspaces in wrk_nemo module. 64 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: ztmltrd2 ! 65 #if defined key_lobster 66 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ztmltrdbio2 ! only needed for mean diagnostics in trd_mld_bio() 67 #endif 68 60 69 !! * Substitutions 61 70 # include "top_substitute.h90" … … 63 72 !! NEMO/TOP 3.3 , NEMO Consortium (2010) 64 73 !! $Header: $ 65 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)74 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 66 75 !!---------------------------------------------------------------------- 67 68 76 CONTAINS 77 78 INTEGER FUNCTION trd_mld_trc_alloc() 79 !!---------------------------------------------------------------------- 80 !! *** ROUTINE trd_mld_trc_alloc *** 81 !!---------------------------------------------------------------------- 82 ALLOCATE( ztmltrd2(jpi,jpj,jpltrd_trc,jptra) , & 83 #if defined key_lobster 84 & ztmltrdbio2(jpi,jpj,jpdiabio) , & 85 #endif 86 & ndextrd1(jpi*jpj) , STAT=trd_mld_trc_alloc) 87 ! 88 IF( lk_mpp ) CALL mpp_sum ( trd_mld_trc_alloc ) 89 IF( trd_mld_trc_alloc /=0 ) CALL ctl_warn('trd_mld_trc_alloc: failed to allocate arrays') 90 ! 91 END FUNCTION trd_mld_trc_alloc 92 69 93 70 94 SUBROUTINE trd_mld_trc_zint( ptrc_trdmld, ktrd, ctype, kjn ) … … 88 112 !! surface and the control surface is called "mixed-layer" 89 113 !!---------------------------------------------------------------------- 114 USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released 115 USE wrk_nemo, ONLY: zvlmsk => wrk_2d_1 116 !! 90 117 INTEGER, INTENT( in ) :: ktrd, kjn ! ocean trend index and passive tracer rank 91 118 CHARACTER(len=2), INTENT( in ) :: ctype ! surface/bottom (2D) or interior (3D) physics 92 119 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( in ) :: ptrc_trdmld ! passive tracer trend 93 120 INTEGER :: ji, jj, jk, isum 94 REAL(wp), DIMENSION(jpi,jpj) :: zvlmsk 95 !!---------------------------------------------------------------------- 121 !!---------------------------------------------------------------------- 122 123 IF( wrk_in_use(2, 1) ) THEN 124 CALL ctl_stop('trd_mld_trc_zint: requested workspace array unavailable') ; RETURN 125 ENDIF 96 126 97 127 ! I. Definition of control surface and integration weights … … 177 207 tmltrd_trc(:,:,ktrd,kjn) = tmltrd_trc(:,:,ktrd,kjn) + ptrc_trdmld(:,:,1) * wkx_trc(:,:,1) ! non penetrative 178 208 END SELECT 179 180 END SUBROUTINE trd_mld_trc_zint 181 182 SUBROUTINE trd_mld_bio_zint( ptrc_trdmld, ktrd ) 209 ! 210 IF( wrk_not_released(2, 1) ) CALL ctl_stop('trd_mld_trc_zint: failed to release workspace array') 211 ! 212 END SUBROUTINE trd_mld_trc_zint 213 214 215 SUBROUTINE trd_mld_bio_zint( ptrc_trdmld, ktrd ) 183 216 !!---------------------------------------------------------------------- 184 217 !! *** ROUTINE trd_mld_bio_zint *** … … 198 231 !! surface and the control surface is called "mixed-layer" 199 232 !!---------------------------------------------------------------------- 200 INTEGER, INTENT( in ) :: ktrd ! bio trend index 201 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( in ) :: ptrc_trdmld ! passive trc trend 233 USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released 234 USE wrk_nemo, ONLY: zvlmsk => wrk_2d_1 235 !! 236 INTEGER , INTENT(in) :: ktrd ! bio trend index 237 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in) :: ptrc_trdmld ! passive trc trend 202 238 #if defined key_lobster 203 ! ! local variables239 ! 204 240 INTEGER :: ji, jj, jk, isum 205 REAL(wp), DIMENSION(jpi,jpj) :: zvlmsk 206 !!---------------------------------------------------------------------- 241 !!---------------------------------------------------------------------- 242 243 IF( wrk_in_use(2, 1) ) THEN 244 CALL ctl_stop('trd_mld_bio_zint: requested workspace array unavailable') ; RETURN 245 ENDIF 207 246 208 247 ! I. Definition of control surface and integration weights … … 286 325 END DO 287 326 288 #endif 289 290 END SUBROUTINE trd_mld_bio_zint 291 292 293 SUBROUTINE trd_mld_trc( kt ) 327 IF( wrk_not_released(2, 1) ) CALL ctl_stop('trd_mld_bio_zint: failed to release workspace array') 328 #endif 329 ! 330 END SUBROUTINE trd_mld_bio_zint 331 332 333 SUBROUTINE trd_mld_trc( kt ) 294 334 !!---------------------------------------------------------------------- 295 335 !! *** ROUTINE trd_mld_trc *** … … 338 378 !! - See NEMO documentation (in preparation) 339 379 !!---------------------------------------------------------------------- 340 INTEGER, INTENT( in ) :: kt ! ocean time-step index 380 USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released 381 USE wrk_nemo, ONLY: wrk_3d_1, wrk_3d_2, wrk_3d_3, wrk_3d_4 382 USE wrk_nemo, ONLY: wrk_3d_5, wrk_3d_6, wrk_3d_7, wrk_3d_8, wrk_3d_9 383 ! 384 INTEGER, INTENT(in) :: kt ! ocean time-step index 385 ! 341 386 INTEGER :: ji, jj, jk, jl, ik, it, itmod, jn 342 387 REAL(wp) :: zavt, zfn, zfn2 343 ! !344 REAL(wp), DIMENSION(jpi,jpj,jptra) :: ztmltot ! d(trc)/dt over the anlysis window (incl. Asselin)345 REAL(wp), DIMENSION(jpi,jpj,jptra) :: ztmlres ! residual = dh/dt entrainment term346 REAL(wp), DIMENSION(jpi,jpj,jptra) :: ztmlatf ! for storage only347 REAL(wp), DIMENSION(jpi,jpj,jptra) :: ztmlrad ! for storage only (for trb<0 corr in trcrad)348 ! !349 REAL(wp), DIMENSION(jpi,jpj,jptra) :: ztmltot2 ! -+350 REAL(wp), DIMENSION(jpi,jpj,jptra) :: ztmlres2 ! | working arrays to diagnose the trends351 REAL(wp), DIMENSION(jpi,jpj,jptra) :: ztmltrdm2 ! | associated with the time meaned ML352 REAL(wp), DIMENSION(jpi,jpj,jptra) :: ztmlatf2 ! | passive tracers353 REAL(wp), DIMENSION(jpi,jpj,jptra) :: ztmlrad2 ! | (-> for trb<0 corr in trcrad)354 REAL(wp), DIMENSION(jpi,jpj,jpltrd_trc,jptra) :: ztmltrd2 ! -+355 ! !388 ! 389 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztmltot ! d(trc)/dt over the anlysis window (incl. Asselin) 390 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztmlres ! residual = dh/dt entrainment term 391 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztmlatf ! for storage only 392 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztmlrad ! for storage only (for trb<0 corr in trcrad) 393 ! 394 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztmltot2 ! -+ 395 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztmlres2 ! | working arrays to diagnose the trends 396 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztmltrdm2 ! | associated with the time meaned ML 397 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztmlatf2 ! | passive tracers 398 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztmlrad2 ! | (-> for trb<0 corr in trcrad) 399 !REAL(wp), DIMENSION(jpi,jpj,jpltrd_trc,jptra) :: ztmltrd2 ! -+ 400 ! 356 401 CHARACTER (LEN= 5) :: clvar 357 402 #if defined key_dimgout … … 361 406 !!---------------------------------------------------------------------- 362 407 363 IF( nn_dttrc /= 1 ) CALL ctl_stop( " Be careful, trends diags never validated " ) 408 IF( wrk_in_use(3, 1,2,3,4,5,6,7,8,9) ) THEN 409 CALL ctl_stop('trd_mld_trc : requested workspace arrays unavailable') ; RETURN 410 ENDIF 411 ! Set-up pointers into sub-arrays of workspaces 412 ztmltot => wrk_3d_1(:,:,1:jptra) 413 ztmlres => wrk_3d_2(:,:,1:jptra) 414 ztmlatf => wrk_3d_3(:,:,1:jptra) 415 ztmlrad => wrk_3d_4(:,:,1:jptra) 416 ztmltot2 => wrk_3d_5(:,:,1:jptra) 417 ztmlres2 => wrk_3d_6(:,:,1:jptra) 418 ztmltrdm2 => wrk_3d_7(:,:,1:jptra) 419 ztmlatf2 => wrk_3d_8(:,:,1:jptra) 420 ztmlrad2 => wrk_3d_9(:,:,1:jptra) 421 422 423 IF( nn_dttrc /= 1 ) CALL ctl_stop( " Be careful, trends diags never validated " ) 364 424 365 425 ! ====================================================================== … … 386 446 387 447 DO jn = 1, jptra 388 ! ... Remove this K_z trend from the iso-neutral diffusion term (if any)448 ! ... Remove this K_z trend from the iso-neutral diffusion term (if any) 389 449 IF( ln_trdtrc(jn) ) & 390 450 tmltrd_trc(:,:,jpmld_trc_ldf,jn) = tmltrd_trc(:,:,jpmld_trc_ldf,jn) - tmltrd_trc(:,:,jpmld_trc_zdf,jn) … … 847 907 IF( lrst_trc ) CALL trd_mld_trc_rst_write( kt ) ! this must be after the array swap above (III.3) 848 908 909 IF( wrk_not_released(3, 1,2,3,4,5,6,7,8,9) ) CALL ctl_stop('trd_mld_trc: failed to release workspace arrays') 910 ! 849 911 END SUBROUTINE trd_mld_trc 850 912 851 SUBROUTINE trd_mld_bio( kt ) 913 914 SUBROUTINE trd_mld_bio( kt ) 852 915 !!---------------------------------------------------------------------- 853 916 !! *** ROUTINE trd_mld *** … … 900 963 INTEGER :: jl, it, itmod 901 964 LOGICAL :: llwarn = .TRUE., lldebug = .TRUE. 902 REAL(wp), DIMENSION(jpi,jpj,jpdiabio) :: ztmltrdbio2 ! only needed for mean diagnostics903 965 REAL(wp) :: zfn, zfn2 904 966 #if defined key_dimgout … … 1085 1147 END SUBROUTINE trd_mld_bio 1086 1148 1149 1087 1150 REAL FUNCTION sum2d( ztab ) 1088 1151 !!---------------------------------------------------------------------- … … 1091 1154 REAL(wp), DIMENSION(jpi,jpj), INTENT( in ) :: ztab 1092 1155 !!---------------------------------------------------------------------- 1093 sum2d = SUM( ztab(2:jpi-1,2:jpj-1))1156 sum2d = SUM( ztab(2:jpi-1,2:jpj-1) ) 1094 1157 END FUNCTION sum2d 1158 1095 1159 1096 1160 SUBROUTINE trd_mld_trc_init … … 1378 1442 !! Default option : Empty module 1379 1443 !!---------------------------------------------------------------------- 1380 1381 1444 CONTAINS 1382 1383 1445 SUBROUTINE trd_mld_trc( kt ) ! Empty routine 1384 1446 INTEGER, INTENT( in) :: kt 1385 1447 WRITE(*,*) 'trd_mld_trc: You should not have seen this print! error?', kt 1386 1448 END SUBROUTINE trd_mld_trc 1387 1388 1449 SUBROUTINE trd_mld_bio( kt ) 1389 1450 INTEGER, INTENT( in) :: kt 1390 1451 WRITE(*,*) 'trd_mld_bio: You should not have seen this print! error?', kt 1391 1452 END SUBROUTINE trd_mld_bio 1392 1393 1453 SUBROUTINE trd_mld_trc_zint( ptrc_trdmld, ktrd, ctype, kjn ) 1394 1454 INTEGER , INTENT( in ) :: ktrd, kjn ! ocean trend index and passive tracer rank … … 1400 1460 WRITE(*,*) ' " " : You should not have seen this print! error?', kjn 1401 1461 END SUBROUTINE trd_mld_trc_zint 1402 1403 1462 SUBROUTINE trd_mld_trc_init ! Empty routine 1404 1463 WRITE(*,*) 'trd_mld_trc_init: You should not have seen this print! error?'
Note: See TracChangeset
for help on using the changeset viewer.