Changeset 945 for trunk/NEMO/TOP_SRC/trcdit.F90
- Timestamp:
- 2008-05-14T18:14:53+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEMO/TOP_SRC/trcdit.F90
r724 r945 1 1 MODULE trcdit 2 !!====================================================================== 3 !! *** MODULE trcdit *** 4 !! TOP : Output of passive tracers 5 !! O.Aumont and A.El Moussaoui 03/05 F90 6 !!====================================================================== 7 !! History : - ! 1995-01 (M. Levy) Original code 8 !! - ! 1998-01 (C. Levy) NETCDF format using ioipsl interface 9 !! - ! 1999-01 (M.A. Foujols) adapted for passive tracer 10 !! - ! 1999-09 (M.A. Foujols) split into three parts 11 !! 1.0 ! 2005-03 (O. Aumont, A. El Moussaoui) F90 2 12 !!---------------------------------------------------------------------- 3 !! TOP 1.0, LOCEAN-IPSL (2005) 4 !! $Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/trcdit.F90,v 1.9 2007/10/12 09:22:19 opalod Exp $ 5 !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 13 #if defined key_top 6 14 !!---------------------------------------------------------------------- 7 !! * Modules used 8 !! ============== 15 !! 'key_top' TOP models 16 !!---------------------------------------------------------------------- 17 !! trcdit_wr : 18 !! trcdid_wr : 19 !! trcdii_wr : 20 !! trcdib_wr : 21 !!---------------------------------------------------------------------- 9 22 USE oce_trc 10 23 USE trc … … 12 25 USE in_out_manager ! I/O manager 13 26 USE lib_mpp 27 USE ioipsl 14 28 15 29 IMPLICIT NONE 16 30 PRIVATE 17 31 18 !! * Accessibility 19 PUBLIC trcdit_wr 20 PUBLIC trcdid_wr 21 PUBLIC trcdii_wr 22 PUBLIC trcdib_wr 23 24 !! * Module variables 25 INTEGER :: & 26 nit5 , & !!: id for tracer output file 27 ndepit5 , & !!: id for depth mesh 28 nhorit5 , & !!: id for horizontal mesh 29 ndimt50 , & !!: number of ocean points in index array 30 ndimt51 !!: number of ocean points in index array 31 REAL(wp) :: zjulian 32 INTEGER , DIMENSION (jpij*jpk) :: ndext50 !!: integer arrays for ocean 3D index 33 INTEGER , DIMENSION (jpij) :: ndext51 !!: integer arrays for ocean surface index 34 # if defined key_passivetrc && defined key_trc_diaadd 35 INTEGER :: & 36 nitd , & !!: id for additional array output file 37 ndepitd , & !!: id for depth mesh 38 nhoritd !!: id for horizontal mesh 39 # endif 40 # if defined key_passivetrc && defined key_trc_diatrd 41 INTEGER , DIMENSION (jptra) :: & 42 nit6 , & !!: id for additional array output file 43 ndepit6 , & !!: id for depth mesh 44 nhorit6 !!: id for horizontal mesh 45 # endif 46 # if defined key_passivetrc && defined key_trc_diabio 47 INTEGER :: & 48 nitb , & !!: id for additional array output FILE 49 ndepitb , & !!: id for depth mesh 50 nhoritb !!: id for horizontal mesh 51 52 # endif 53 32 PUBLIC trcdit_wr ! caller in trcdia.F90 33 PUBLIC trcdid_wr ! caller in trcdia.F90 34 PUBLIC trcdii_wr ! caller in trcdia.F90 35 PUBLIC trcdib_wr ! caller in trcdia.F90 36 37 INTEGER :: nit5 !: id for tracer output file 38 INTEGER :: ndepit5 !: id for depth mesh 39 INTEGER :: nhorit5 !: id for horizontal mesh 40 INTEGER :: ndimt50 !: number of ocean points in index array 41 INTEGER :: ndimt51 !: number of ocean points in index array 42 REAL(wp) :: zjulian !: ???? not DOCTOR ! 43 INTEGER , DIMENSION (jpij*jpk) :: ndext50 !: integer arrays for ocean 3D index 44 INTEGER , DIMENSION (jpij) :: ndext51 !: integer arrays for ocean surface index 45 # if defined key_trc_diaadd 46 INTEGER :: nitd !: id for additional array output file 47 INTEGER :: ndepitd !: id for depth mesh 48 INTEGER :: nhoritd !: id for horizontal mesh 49 # endif 50 # if defined key_trc_diatrd 51 INTEGER , DIMENSION (jptra) :: nit6 !: id for additional array output file 52 INTEGER , DIMENSION (jptra) :: ndepit6 !: id for depth mesh 53 INTEGER , DIMENSION (jptra) :: nhorit6 !: id for horizontal mesh 54 # endif 55 # if defined key_trc_diabio 56 INTEGER :: ndepitb !: id for depth mesh 57 INTEGER :: nhoritb !: id for horizontal mesh 58 # endif 54 59 55 60 !! * Substitutions 56 # include "passivetrc_substitute.h90" 61 # include "top_substitute.h90" 62 !!---------------------------------------------------------------------- 63 !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) 64 !! $Header:$ 65 !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 66 !!---------------------------------------------------------------------- 57 67 58 68 CONTAINS 59 69 60 # if defined key_passivetrc 61 62 SUBROUTINE trcdit_wr(kt,kindic) 63 !!=========================================================================================== 64 !! 65 !! ROUTINE trcdit_wr 66 !!=========================================================================================== 67 !! 68 !! Purpose : 69 !!--------- 70 !! Standard output of passive tracer : concentration fields 71 !! 72 !! 73 !! Method : 74 !! ------- 75 !! 76 !! At the beginning of the first time step (nit000), define all 77 !! the NETCDF files and fields for concentration of passive tracer 78 !! 79 !! At each time step call histdef to compute the mean if necessary 80 !! Each nwritetrc time step, output the instantaneous or mean fields 81 !! 82 !! IF kindic <0, output of fields before the model interruption. 83 !! IF kindic =0, time step loop 84 !! IF kindic >0, output of fields before the time step loop 85 !! 86 !! Input : 87 !! ----- 88 !! argument 89 !! kt : time step 90 !! kindic : indicator of abnormal termination 91 !! 92 !! EXTERNAL : 93 !! -------- 94 !! prihre, hist..., dianam 95 !! 96 !! History: 97 !! -------- 98 !! original : 95-01 passive tracers (M. Levy) 99 !! additions : 98-01 (C. Levy) NETCDF format using ioipsl interface 100 !! additions : 99-01 (M.A. Foujols) adapted for passive tracer 101 !! additions : 99-09 (M.A. Foujols) split into three parts 102 !! 05-03 (O. Aumont and A. El Moussaoui) F90 103 !!==================================================================================================! 104 105 !! Modules used 106 USE ioipsl 107 108 109 !! * Arguments 110 INTEGER, INTENT( in ) :: kt,kindic ! ocean time-step 111 112 !! * Local declarations 113 INTEGER :: jn 114 LOGICAL :: ll_print = .FALSE. 115 70 SUBROUTINE trcdit_wr( kt, kindic ) 71 !!---------------------------------------------------------------------- 72 !! *** ROUTINE trcdit_wr *** 73 !! 74 !! ** Purpose : Standard output of passive tracer : concentration fields 75 !! 76 !! ** Method : At the beginning of the first time step (nit000), define all 77 !! the NETCDF files and fields for concentration of passive tracer 78 !! 79 !! At each time step call histdef to compute the mean if necessary 80 !! Each nwritetrc time step, output the instantaneous or mean fields 81 !! 82 !! IF kindic <0, output of fields before the model interruption. 83 !! IF kindic =0, time step loop 84 !! IF kindic >0, output of fields before the time step loop 85 !!---------------------------------------------------------------------- 86 INTEGER, INTENT( in ) :: kt ! ocean time-step 87 INTEGER, INTENT( in ) :: kindic ! indicator of abnormal termination 88 !! 89 INTEGER :: jn 90 LOGICAL :: ll_print = .FALSE. 116 91 CHARACTER (len=40) :: clhstnam, clop 117 92 CHARACTER (len=20) :: cltra, cltrau 118 93 CHARACTER (len=80) :: cltral 119 120 94 REAL(wp) :: zsto, zout, zdt 121 95 INTEGER :: iimi, iima, ijmi, ijma, ipk, it 122 ! 123 ! 0. Initialisation 124 ! ----------------- 125 126 ! local variable for debugging 127 ll_print = .FALSE. 96 !!---------------------------------------------------------------------- 97 98 ! Initialisation 99 ! -------------- 100 101 ! local variable for debugging 102 ll_print = .FALSE. ! change it to true for more control print 128 103 ll_print = ll_print .AND. lwp 129 104 130 ! Define frequency of output and means 131 105 ! Define frequency of output and means 132 106 zdt = rdt 133 # 134 zsto =nwritetrc*rdt135 clop ='inst(only(x))'136 # 137 zsto =zdt138 clop ='ave(only(x))'139 # 140 zout =nwritetrc*zdt107 # if defined key_diainstant 108 zsto = nwritetrc * rdt 109 clop = 'inst(only(x))' 110 # else 111 zsto = zdt 112 clop = 'ave(only(x))' 113 # endif 114 zout = nwritetrc * zdt 141 115 142 116 ! Define indices of the horizontal output zoom and vertical limit storage … … 148 122 it = kt - nittrc000 + 1 149 123 150 ! 1.Define NETCDF files and fields at beginning of first time step151 ! -----------------------------------------------------------------124 ! Define NETCDF files and fields at beginning of first time step 125 ! -------------------------------------------------------------- 152 126 153 127 IF(ll_print)WRITE(numout,*)'trcdit_wr kt=',kt,' kindic ',kindic 154 IF(kt == nittrc000) THEN155 156 ! Compute julian date from starting date of the run 157 158 CALL ymds2ju( nyear,nmonth,nday,0.0,zjulian)128 129 IF( kt == nittrc000 ) THEN 130 131 ! Compute julian date from starting date of the run 132 CALL ymds2ju( nyear, nmonth, nday, 0.0, zjulian ) 159 133 IF(lwp)WRITE(numout,*)' ' 160 IF(lwp)WRITE(numout,*)' Date 0 used :', nittrc000&161 & ,' YEAR ',nyear,' MONTH ',nmonth,' DAY ',nday &162 & ,'Julian day : ',zjulian163 IF(lwp) WRITE(numout,*) ' indexes of zoom = ', iimi, iima, ijmi, ijma, &164 134 IF(lwp)WRITE(numout,*)' Date 0 used :', nittrc000 & 135 & ,' YEAR ', nyear, ' MONTH ', nmonth, ' DAY ', nday & 136 & ,'Julian day : ', zjulian 137 IF(lwp) WRITE(numout,*) ' indexes of zoom = ', iimi, iima, ijmi, ijma, & 138 & ' limit storage in depth = ', ipk 165 139 166 140 167 141 ! Define the NETCDF files for passive tracer concentration 168 142 169 CALL dia_nam(clhstnam,nwritetrc,'ptrc_T') 170 143 CALL dia_nam( clhstnam, nwritetrc, 'ptrc_T' ) 171 144 IF(lwp)WRITE(numout,*)" Name of NETCDF file ", clhstnam 172 145 ! Horizontal grid : glamt and gphit 173 174 CALL histbeg(clhstnam, jpi, glamt, jpj, gphit, & 175 & iimi, iima-iimi+1, ijmi, ijma-ijmi+1, & 176 & 0, zjulian, zdt, nhorit5, nit5 , domain_id=nidom) 146 CALL histbeg( clhstnam, jpi, glamt, jpj, gphit, & 147 & iimi, iima-iimi+1, ijmi, ijma-ijmi+1, & 148 & 0, zjulian, zdt, nhorit5, nit5 , domain_id=nidom) 177 149 ! Vertical grid for tracer : gdept 178 CALL histvert( nit5, 'deptht', 'Vertical T levels', &179 &'m', ipk, gdept_0, ndepit5)150 CALL histvert( nit5, 'deptht', 'Vertical T levels', & 151 & 'm', ipk, gdept_0, ndepit5) 180 152 181 153 ! Index of ocean points in 3D and 2D (surface) 182 CALL wheneq( jpi*jpj*ipk,tmask,1,1.,ndext50,ndimt50)183 CALL wheneq( jpi*jpj,tmask,1,1.,ndext51,ndimt51)154 CALL wheneq( jpi*jpj*ipk,tmask,1,1.,ndext50,ndimt50 ) 155 CALL wheneq( jpi*jpj,tmask,1,1.,ndext51,ndimt51 ) 184 156 185 157 ! Declare all the output fields as NETCDF variables 186 158 187 159 ! tracer concentrations 188 189 DO jn=1,jptra 190 cltra=ctrcnm(jn) ! short title for tracer 191 cltral=ctrcnl(jn) ! long title for tracer 192 cltrau=ctrcun(jn) ! UNIT for tracer 193 CALL histdef(nit5, cltra, cltral, cltrau, jpi, jpj, nhorit5, & 194 & ipk, 1, ipk, ndepit5, 32, clop, zsto, zout) 195 END DO 196 197 ! CLOSE netcdf Files 198 199 CALL histend(nit5) 200 160 DO jn = 1, jptra 161 IF( lutsav(jn) ) THEN 162 cltra = ctrcnm(jn) ! short title for tracer 163 cltral = ctrcnl(jn) ! long title for tracer 164 cltrau = ctrcun(jn) ! UNIT for tracer 165 CALL histdef( nit5, cltra, cltral, cltrau, jpi, jpj, nhorit5, & 166 & ipk, 1, ipk, ndepit5, 32, clop, zsto, zout) 167 ENDIF 168 END DO 169 170 ! end netcdf files header 171 CALL histend( nit5 ) 201 172 IF(lwp) WRITE(numout,*) 202 173 IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization in trcdit_wr' 203 IF(ll_print) CALL FLUSH(numout ) 204 205 ENDIF 206 207 ! 2. Start writing data 208 ! --------------------- 209 210 ! tracer concentrations 174 IF( ll_print ) CALL FLUSH(numout ) 175 176 ENDIF 177 178 ! Start writing the tracer concentrations 179 ! --------------------------------------- 211 180 212 181 IF( lwp .AND. MOD( kt, nwritetrc ) == 0 ) THEN 213 182 WRITE(numout,*) 'trcdit_wr : write NetCDF passive tracer concentrations at ', kt, 'time-step' 214 WRITE(numout,*) '~~~~~~ ' 215 ENDIF 216 217 DO jn=1,jptra 218 cltra=ctrcnm(jn) ! short title for tracer 219 CALL histwrite(nit5, cltra, it, trn(:,:,:,jn), ndimt50, & 220 & ndext50) 221 END DO 222 223 ! synchronise FILE 224 225 IF( MOD( kt, nwritetrc ) == 0 .OR. kindic < 0 ) THEN 226 CALL histsync(nit5) 227 ENDIF 228 229 ! 3. Closing all files 230 ! -------------------- 231 IF( kt == nitend .OR. kindic < 0 ) THEN 232 CALL histclo(nit5) 233 ENDIF 234 235 END SUBROUTINE trcdit_wr 236 237 # else 238 239 ! no passive tracers 240 241 SUBROUTINE trcdit_wr(kt,kindic) 242 !!! no passive tracers 243 INTEGER, INTENT ( in ) :: kt, kindic 244 WRITE(*,*) 'trcdit_wr: You should not have seen this print! error?', kt, kindic 245 END SUBROUTINE trcdit_wr 246 247 # endif 248 249 # if defined key_passivetrc && defined key_trc_diatrd 250 251 SUBROUTINE trcdid_wr(kt,kindic) 252 !!=========================================================================================== 253 !! 254 !! ROUTINE trcdid_wr 255 !!=========================================================================================== 256 !! 257 !! Purpose : 258 !!--------- 259 !! output of opa: passive tracer dynamical trends 260 !! 261 !! 262 !! Method : 263 !! ------- 264 !! 265 !! At the beginning of the first time step (nit000), define all 266 !! the NETCDF files and fields for dynamical trends of tracers 267 !! 268 !! At each time step call histdef to compute the mean if necessary 269 !! Each nwritetrd time step, output the instantaneous or mean fields 270 !! 271 !! IF kindic <0, output of fields before the model interruption. 272 !! IF kindic =0, time step loop 273 !! IF kindic >0, output of fields before the time step loop 274 !! 275 !! Input : 276 !! ----- 277 !! argument 278 !! kt : time step 279 !! kindic : indicator of abnormal termination 280 !! 281 !! Output : 282 !! ------ 283 !! file 284 !! "clhstnam" files : one for concentration 285 !! 286 !! History: 287 !! -------- 288 !! original : 95-01 passive tracers (M. Levy) 289 !! additions : 98-01 (C. Levy) NETCDF format using ioipsl interface 290 !! additions : 99-01 (M.A. Foujols) adapted for passive tracer 291 !! additions : 99-09 (M.A. Foujols) split into three parts 292 !! additions : 01-06 (Mehdi B, Elodie K): suppress initialization 293 !! of nit6,nhorit6,ndepit6 294 !! 05-03 (O. Aumont and A. El Moussaoui) F90 295 !!==================================================================================================! 296 297 !! Modules used 298 USE ioipsl 299 300 !! * Arguments 301 INTEGER, INTENT( in ) :: kt,kindic ! ocean time-step 302 303 INTEGER :: jn, jl 304 LOGICAL :: ll_print = .FALSE. 305 306 CHARACTER (len=40) :: clhstnam, clop 307 CHARACTER (len=20) :: cltra, cltrau 308 CHARACTER (len=80) :: cltral 309 CHARACTER (len=10) :: csuff 310 311 REAL(wp) :: zsto, zout, zdt 312 INTEGER :: iimi, iima, ijmi, ijma, ipk, it 313 314 ! 315 ! 0. Initialisation 316 ! ----------------- 317 318 ! local variable for debugging 183 WRITE(numout,*) '~~~~~~~~~ ' 184 ENDIF 185 186 DO jn = 1, jptra 187 IF( lutsav(jn) ) THEN 188 cltra = ctrcnm(jn) ! short title for tracer 189 CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 ) 190 ENDIF 191 END DO 192 193 ! synchronise file 194 IF( MOD( kt, nwritetrc ) == 0 .OR. kindic < 0 ) CALL histsync( nit5 ) 195 196 197 ! close the file 198 ! -------------- 199 IF( kt == nitend .OR. kindic < 0 ) CALL histclo( nit5 ) 200 ! 201 END SUBROUTINE trcdit_wr 202 203 # if defined key_trc_diatrd 204 205 SUBROUTINE trcdid_wr( kt, kindic ) 206 !!---------------------------------------------------------------------- 207 !! *** ROUTINE trcdid_wr *** 208 !! 209 !! ** Purpose : output of passive tracer : advection-diffusion trends 210 !! 211 !! ** Method : At the beginning of the first time step (nit000), define all 212 !! the NETCDF files and fields for concentration of passive tracer 213 !! 214 !! At each time step call histdef to compute the mean if necessary 215 !! Each nwritetrc time step, output the instantaneous or mean fields 216 !! 217 !! IF kindic <0, output of fields before the model interruption. 218 !! IF kindic =0, time step loop 219 !! IF kindic >0, output of fields before the time step loop 220 !!---------------------------------------------------------------------- 221 INTEGER, INTENT( in ) :: kt ! ocean time-step 222 INTEGER, INTENT( in ) :: kindic ! indicator of abnormal termination 223 !! 224 LOGICAL :: ll_print = .FALSE. 225 CHARACTER (len=40) :: clhstnam, clop 226 CHARACTER (len=20) :: cltra, cltrau 227 CHARACTER (len=80) :: cltral 228 CHARACTER (len=10) :: csuff 229 INTEGER :: jn, jl 230 INTEGER :: iimi, iima, ijmi, ijma, ipk, it 231 REAL(wp) :: zsto, zout, zdt 232 !!---------------------------------------------------------------------- 233 234 ! 0. Initialisation 235 ! ----------------- 236 237 ! local variable for debugging 319 238 ll_print = .FALSE. 320 239 ll_print = ll_print .AND. lwp 321 ! 322 ! Define frequency of output and means 323 ! 240 ! 241 ! Define frequency of output and means 324 242 zdt = rdt 325 # 326 zsto =nwritetrd*rdt327 clop ='inst(only(x))'328 # 329 zsto =zdt330 clop ='ave(only(x))'331 # 332 zout =nwritetrd*zdt243 # if defined key_diainstant 244 zsto = nwritetrd * rdt 245 clop = 'inst(only(x))' 246 # else 247 zsto = zdt 248 clop = 'ave(only(x))' 249 # endif 250 zout = nwritetrd * zdt 333 251 334 252 ! Define indices of the horizontal output zoom and vertical limit storage … … 340 258 it = kt - nittrc000 + 1 341 259 342 ! Define the NETCDF files (one per tracer) 343 ! 344 IF(ll_print)WRITE(numout,*)'trcdid kt=',kt,' kindic ',kindic 345 IF(kt == nittrc000) THEN 346 347 DO jn=1,jptra 348 349 IF (luttrd(jn)) THEN 350 351 ! Define the file for dynamical trends - one per each tracer IF required 352 353 IF(lwp)WRITE(numout,*) ' indexes of zoom = ', iimi, iima, ijmi, ijma, & 354 ' limit storage in depth = ', ipk 355 csuff='DY_'//ctrcnm(jn) 356 CALL dia_nam(clhstnam,nwritetrd,csuff) 357 IF(lwp)WRITE(numout,*) & 358 & " Name of NETCDF file for dynamical trends", & 359 & " of tracer number : ",clhstnam 360 361 CALL histbeg(clhstnam, jpi, glamt, jpj, gphit, & 362 & iimi, iima-iimi+1, ijmi, ijma-ijmi+1, & 363 & 0, zjulian, rdt, nhorit6(jn), & 364 & nit6(jn) , domain_id=nidom) 365 366 ! Vertical grid for tracer trend - one per each tracer IF needed 367 CALL histvert(nit6(jn), 'deptht', 'Vertical T levels', & 368 & 'm', ipk, gdept_0, ndepit6(jn)) 369 370 371 END IF 260 ! Define the NETCDF files (one per tracer) 261 IF( ll_print ) WRITE(numout,*) 'trcdid kt=', kt, ' kindic ', kindic 262 263 264 IF( kt == nittrc000 ) THEN 265 266 DO jn = 1, jptra 267 ! 268 IF( luttrd(jn) ) THEN ! Define the file for dynamical trends - one per each tracer IF required 269 270 IF(lwp)WRITE(numout,*) ' indexes of zoom = ', iimi, iima, ijmi, ijma, & 271 & ' limit storage in depth = ', ipk 272 csuff='DY_'//ctrcnm(jn) 273 CALL dia_nam( clhstnam, nwritetrd, csuff ) 274 IF(lwp)WRITE(numout,*) " Name of NETCDF file for dynamical trends", & 275 & " of tracer number : ",clhstnam 276 277 CALL histbeg( clhstnam, jpi, glamt, jpj, gphit, & 278 & iimi, iima-iimi+1, ijmi, ijma-ijmi+1, & 279 & 0, zjulian, rdt, nhorit6(jn), & 280 & nit6(jn) , domain_id=nidom ) 281 282 ! Vertical grid for tracer trend - one per each tracer IF needed 283 CALL histvert( nit6(jn), 'deptht', 'Vertical T levels', & 284 & 'm', ipk, gdept_0, ndepit6(jn) ) 285 END IF 372 286 END DO 373 287 374 ! Declare all the output fields as NETCDF variables 375 376 377 ! trends for tracer concentrations 378 DO jn=1,jptra 379 IF (luttrd(jn)) THEN 380 DO jl=1,jpdiatrc 381 IF (jl.eq.1) THEN 382 ! short and long title for x advection for tracer 288 ! Declare all the output fields as NETCDF variables 289 290 ! trends for tracer concentrations 291 DO jn = 1, jptra 292 IF( luttrd(jn) ) THEN 293 DO jl = 1, jpdiatrc 294 IF( jl == 1 ) THEN 295 ! short and long title for x advection for tracer 383 296 WRITE (cltra,'("XAD_",16a)') ctrcnm(jn) 384 297 WRITE (cltral,'("X advective trend for ",58a)') & 385 & ctrcnl(jn)(1:58)386 END IF 387 IF (jl.eq.2)THEN388 ! short and long title for y advection for tracer298 & ctrcnl(jn)(1:58) 299 END IF 300 IF( jl == 2 ) THEN 301 ! short and long title for y advection for tracer 389 302 WRITE (cltra,'("YAD_",16a)') ctrcnm(jn) 390 303 WRITE (cltral,'("Y advective trend for ",58a)') & 391 & ctrcnl(jn)(1:58)392 END IF 393 IF (jl.eq.3)THEN394 ! short and long title for Z advection for tracer304 & ctrcnl(jn)(1:58) 305 END IF 306 IF( jl == 3 ) THEN 307 ! short and long title for Z advection for tracer 395 308 WRITE (cltra,'("ZAD_",16a)') ctrcnm(jn) 396 309 WRITE (cltral,'("Z advective trend for ",58a)') & 397 & ctrcnl(jn)(1:58)398 END IF 399 IF (jl.eq.4)THEN400 ! short and long title for X diffusion for tracer310 & ctrcnl(jn)(1:58) 311 END IF 312 IF( jl == 4 ) THEN 313 ! short and long title for X diffusion for tracer 401 314 WRITE (cltra,'("XDF_",16a)') ctrcnm(jn) 402 315 WRITE (cltral,'("X diffusion trend for ",58a)') & 403 & ctrcnl(jn)(1:58)404 END IF 405 IF (jl.eq.5)THEN406 ! short and long title for Y diffusion for tracer316 & ctrcnl(jn)(1:58) 317 END IF 318 IF( jl == 5 ) THEN 319 ! short and long title for Y diffusion for tracer 407 320 WRITE (cltra,'("YDF_",16a)') ctrcnm(jn) 408 321 WRITE (cltral,'("Y diffusion trend for ",58a)') & 409 & ctrcnl(jn)(1:58)410 END IF 411 IF (jl.eq.6)THEN412 ! short and long title for Z diffusion for tracer322 & ctrcnl(jn)(1:58) 323 END IF 324 IF( jl == 6 ) THEN 325 ! short and long title for Z diffusion for tracer 413 326 WRITE (cltra,'("ZDF_",16a)') ctrcnm(jn) 414 327 WRITE (cltral,'("Z diffusion trend for ",58a)') & 415 & ctrcnl(jn)(1:58)328 & ctrcnl(jn)(1:58) 416 329 END IF 417 330 # if defined key_trc_ldfeiv 418 IF (jl.eq.7) THEN419 ! short and long title for x gent velocity for tracer331 IF( jl == 7 ) THEN 332 ! short and long title for x gent velocity for tracer 420 333 WRITE (cltra,'("XGV_",16a)') ctrcnm(jn) 421 334 WRITE (cltral,'("X gent velocity trend for ",53a)') & 422 & ctrcnl(jn)(1:53)423 END IF 424 IF (jl.eq.8)THEN425 ! short and long title for y gent velocity for tracer335 & ctrcnl(jn)(1:53) 336 END IF 337 IF( jl == 8 ) THEN 338 ! short and long title for y gent velocity for tracer 426 339 WRITE (cltra,'("YGV_",16a)') ctrcnm(jn) 427 340 WRITE (cltral,'("Y gent velocity trend for ",53a)') & 428 & ctrcnl(jn)(1:53)429 END IF 430 IF (jl.eq.9)THEN431 ! short and long title for Z gent velocity for tracer341 & ctrcnl(jn)(1:53) 342 END IF 343 IF( jl == 9 ) THEN 344 ! short and long title for Z gent velocity for tracer 432 345 WRITE (cltra,'("ZGV_",16a)') ctrcnm(jn) 433 346 WRITE (cltral,'("Z gent velocity trend for ",53a)') & 434 & ctrcnl(jn)(1:53)347 & ctrcnl(jn)(1:53) 435 348 END IF 436 349 # endif 437 350 # if defined key_trcdmp 438 IF (jl.eq.jpdiatrc-1)THEN439 ! last trends for tracer damping : short and long title351 IF( jl == jpdiatrc - 1 ) THEN 352 ! last trends for tracer damping : short and long title 440 353 WRITE (cltra,'("TDM_",16a)') ctrcnm(jn) 441 354 WRITE (cltral,'("Tracer damping trend for ",55a)') & 442 & ctrcnl(jn)(1:55)443 END IF 444 # endif 445 IF (jl.eq.jpdiatrc)THEN446 ! last trends for tracer damping : short and long title355 & ctrcnl(jn)(1:55) 356 END IF 357 # endif 358 IF( jl == jpdiatrc ) THEN 359 ! last trends for tracer damping : short and long title 447 360 WRITE (cltra,'("SBC_",16a)') ctrcnm(jn) 448 361 WRITE (cltral,'("Surface boundary flux ",58a)') & … … 450 363 END IF 451 364 452 call flush(numout)453 cltrau =ctrcun(jn)! UNIT for tracer /trends454 CALL histdef( nit6(jn), cltra, cltral, cltrau, jpi,jpj, &455 &nhorit6(jn), ipk, 1, ipk, ndepit6(jn), 32, clop , &456 & zsto,zout)457 365 CALL FLUSH( numout ) 366 cltrau = ctrcun(jn) ! UNIT for tracer /trends 367 CALL histdef( nit6(jn), cltra, cltral, cltrau, jpi,jpj, & 368 & nhorit6(jn), ipk, 1, ipk, ndepit6(jn), 32, clop , & 369 & zsto,zout ) 370 END DO 458 371 END IF 459 END DO 460 461 ! CLOSE netcdf Files 462 463 DO jn=1,jptra 464 IF (luttrd(jn)) CALL histend(nit6(jn)) 372 END DO 373 374 ! CLOSE netcdf Files 375 DO jn = 1, jptra 376 IF( luttrd(jn) ) CALL histend( nit6(jn) ) 465 377 END DO 466 378 … … 468 380 IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization in trcdid' 469 381 IF(ll_print) CALL FLUSH(numout ) 470 471 ENDIF 472 473 ! SOME diagnostics to DO first time474 475 ! 2.Start writing data476 ! ---------------------477 478 ! trends for tracer concentrations382 ! 383 ENDIF 384 385 ! SOME diagnostics to DO first time 386 387 ! Start writing data 388 ! --------------------- 389 390 ! trends for tracer concentrations 479 391 480 392 IF( lwp .AND. MOD( kt, nwritetrd ) == 0 ) THEN … … 483 395 ENDIF 484 396 485 DO jn=1,jptra 486 IF (luttrd(jn)) THEN 487 DO jl=1,jpdiatrc 488 IF (jl.eq.1) THEN 489 ! short title for x advection for tracer 490 WRITE (cltra,'("XAD_",16a)') ctrcnm(jn) 491 END IF 492 IF (jl.eq.2) THEN 493 ! short title for y advection for tracer 494 WRITE (cltra,'("YAD_",16a)') ctrcnm(jn) 495 END IF 496 IF (jl.eq.3) THEN 497 ! short title for z advection for tracer 498 WRITE (cltra,'("ZAD_",16a)') ctrcnm(jn) 499 END IF 500 IF (jl.eq.4) THEN 501 ! short title for x diffusion for tracer 502 WRITE (cltra,'("XDF_",16a)') ctrcnm(jn) 503 END IF 504 IF (jl.eq.5) THEN 505 ! short title for y diffusion for tracer 506 WRITE (cltra,'("YDF_",16a)') ctrcnm(jn) 507 END IF 508 IF (jl.eq.6) THEN 509 ! short title for z diffusion for tracer 510 WRITE (cltra,'("ZDF_",16a)') ctrcnm(jn) 511 END IF 397 DO jn = 1, jptra 398 IF( luttrd(jn) ) THEN 399 DO jl = 1, jpdiatrc 400 ! short titles 401 IF( jl == 1) WRITE (cltra,'("XAD_",16a)') ctrcnm(jn) ! x advection for tracer 402 IF( jl == 2) WRITE (cltra,'("YAD_",16a)') ctrcnm(jn) ! z advection for tracer 403 IF( jl == 3) WRITE (cltra,'("ZAD_",16a)') ctrcnm(jn) ! z advection for tracer 404 IF( jl == 4) WRITE (cltra,'("XDF_",16a)') ctrcnm(jn) ! x diffusion for tracer 405 IF( jl == 5) WRITE (cltra,'("YDF_",16a)') ctrcnm(jn) ! y diffusion for tracer 406 IF( jl == 6) WRITE (cltra,'("ZDF_",16a)') ctrcnm(jn) ! z diffusion for tracer 512 407 # if defined key_trcldf_eiv 513 IF (jl.eq.7) THEN 514 ! short for x gent velocity for tracer 515 WRITE (cltra,'("XGV_",16a)') ctrcnm(jn) 516 END IF 517 IF (jl.eq.8) THEN 518 ! short for y gent velocity for tracer 519 WRITE (cltra,'("YGV_",16a)') ctrcnm(jn) 520 END IF 521 IF (jl.eq.9) THEN 522 ! short title for Z gent velocity for tracer 523 WRITE (cltra,'("ZGV_",16a)') ctrcnm(jn) 524 END IF 408 IF( jl == 7) WRITE (cltra,'("XGV_",16a)') ctrcnm(jn) ! x gent velocity for tracer 409 IF( jl == 8) WRITE (cltra,'("YGV_",16a)') ctrcnm(jn) ! y gent velocity for tracer 410 IF( jl == 9) WRITE (cltra,'("ZGV_",16a)') ctrcnm(jn) ! z gent velocity for tracer 525 411 # endif 526 412 # if defined key_trcdmp 527 IF (jl.eq.jpdiatrc-1) THEN 528 ! short for x gent velocity for tracer 529 WRITE (cltra,'("TDM_",16a)') ctrcnm(jn) 530 END IF 531 # endif 532 IF (jl.eq.jpdiatrc) THEN 533 ! short for surface boundary conditions for tracer 534 WRITE (cltra,'("SBC_",a)') ctrcnm(jn) 535 END IF 536 537 CALL histwrite(nit6(jn), cltra, it, trtrd(:,:,:,ikeep(jn),jl) & 538 & ,ndimt50, ndext50) 539 END DO 540 END IF 541 END DO 542 543 ! synchronise FILE 544 413 IF( jl == jpdiatrc - 1 ) WRITE (cltra,'("TDM_",16a)') ctrcnm(jn) ! damping 414 # endif 415 IF( jl == jpdiatrc ) WRITE (cltra,'("SBC_",a)') ctrcnm(jn) ! surface boundary conditions 416 ! 417 CALL histwrite(nit6(jn), cltra, it, trtrd(:,:,:,ikeep(jn),jl) & 418 & ,ndimt50, ndext50) 419 END DO 420 END IF 421 END DO 422 423 ! synchronise FILE 545 424 IF( MOD( kt, nwritetrd ) == 0 .OR. kindic < 0 ) THEN 546 DO jn=1,jptra 547 IF (luttrd(jn)) CALL histsync(nit6(jn)) 548 END DO 549 ENDIF 550 551 ! 3. Closing all files 552 ! -------------------- 553 425 DO jn = 1, jptra 426 IF (luttrd(jn)) CALL histsync( nit6(jn) ) 427 END DO 428 ENDIF 429 430 ! Closing all files 431 ! ----------------- 554 432 IF( kt == nitend .OR. kindic < 0 ) THEN 555 DO jn=1,jptra 556 IF (luttrd(jn)) CALL histclo(nit6(jn)) 557 END DO 558 ENDIF 559 560 END SUBROUTINE trcdid_wr 561 562 # else 563 564 SUBROUTINE trcdid_wr(kt,kindic) 565 !!! no passive tracers 566 INTEGER, INTENT ( in ) :: kt, kindic 567 WRITE(*,*) 'trcdid_wr: You should not have seen this print! error?', kt, kindic 568 END SUBROUTINE trcdid_wr 569 570 # endif 571 572 # if defined key_passivetrc && defined key_trc_diaadd 573 574 SUBROUTINE trcdii_wr(kt,kindic) 575 !!=========================================================================================== 576 !! 577 !! ROUTINE trcdii_wr 578 !!=========================================================================================== 579 !! 580 !! Purpose : 581 !!--------- 582 !! output of passive tracer : additional 2D and 3D arrays 583 !! 584 !! 585 !! Method : 586 !! ------- 587 !! 588 !! At the beginning of the first time step (nit000), define all 589 !! the NETCDF files and fields for additional arrays 590 !! 591 !! At each time step call histdef to compute the mean if necessary 592 !! Each nwritetrc time step, output the instantaneous or mean fields 593 !! 594 !! 595 !! IF kindic <0, output of fields before the model interruption. 596 !! IF kindic =0, time step loop 597 !! IF kindic >0, output of fields before the time step loop 598 !! 599 !! Input : 600 !! ----- 601 !! argument 602 !! kt : time step 603 !! kindic : indicator of abnormal termination 604 !! 605 !! EXTERNAL : 606 !! -------- 607 !! prihre, hist..., dianam 608 !! 609 !! History: 610 !! -------- 611 !! original : 95-01 passive tracers (M. Levy) 612 !! additions : 98-01 (C. Levy) NETCDF format using ioipsl interface 613 !! additions : 99-01 (M.A. Foujols) adapted for passive tracer 614 !! additions : 99-09 (M.A. Foujols) split into three parts 615 !! 05-03 (O. Aumont and A. El Moussaoui) F90 616 !!==================================================================================================! 617 618 !! Modules used 619 USE ioipsl 620 621 !! * Arguments 622 INTEGER, INTENT( in ) :: kt,kindic ! ocean time-step 623 624 INTEGER :: jn 625 LOGICAL :: ll_print = .FALSE. 626 627 CHARACTER (len=40) :: clhstnam, clop 628 CHARACTER (len=20) :: cltra, cltrau 629 CHARACTER (len=80) :: cltral 630 631 REAL(wp) :: zsto, zout, zdt 632 INTEGER :: iimi, iima, ijmi, ijma, ipk, it 633 634 ! 635 ! 0. Initialisation 636 ! ----------------- 637 638 ! local variable for debugging 433 DO jn = 1, jptra 434 IF( luttrd(jn) ) CALL histclo( nit6(jn) ) 435 END DO 436 ENDIF 437 ! 438 END SUBROUTINE trcdid_wr 439 440 # else 441 SUBROUTINE trcdid_wr( kt, kindic ) ! Dummy routine 442 INTEGER, INTENT ( in ) :: kt, kindic 443 WRITE(*,*) 'trcdid_wr: You should not have seen this print! error?', kt, kindic 444 END SUBROUTINE trcdid_wr 445 # endif 446 447 # if defined key_top && defined key_trc_diaadd 448 449 SUBROUTINE trcdii_wr( kt, kindic ) 450 !!---------------------------------------------------------------------- 451 !! *** ROUTINE trcdii_wr *** 452 !! 453 !! ** Purpose : output of passive tracer : additional 2D and 3D arrays 454 !! 455 !! ** Method : At the beginning of the first time step (nit000), define all 456 !! the NETCDF files and fields for concentration of passive tracer 457 !! 458 !! At each time step call histdef to compute the mean if necessary 459 !! Each nwritetrc time step, output the instantaneous or mean fields 460 !! 461 !! IF kindic <0, output of fields before the model interruption. 462 !! IF kindic =0, time step loop 463 !! IF kindic >0, output of fields before the time step loop 464 !!---------------------------------------------------------------------- 465 INTEGER, INTENT( in ) :: kt ! ocean time-step 466 INTEGER, INTENT( in ) :: kindic ! indicator of abnormal termination 467 !! 468 LOGICAL :: ll_print = .FALSE. 469 CHARACTER (len=40) :: clhstnam, clop 470 CHARACTER (len=20) :: cltra, cltrau 471 CHARACTER (len=80) :: cltral 472 INTEGER :: jn 473 INTEGER :: iimi, iima, ijmi, ijma, ipk, it 474 REAL(wp) :: zsto, zout, zdt 475 !!---------------------------------------------------------------------- 476 477 ! Initialisation 478 ! -------------- 479 480 ! local variable for debugging 639 481 ll_print = .FALSE. 640 482 ll_print = ll_print .AND. lwp 641 ! 642 ! Define frequency of output and means 643 ! 483 ! 484 ! Define frequency of output and means 644 485 zdt = rdt 645 # 646 zsto=nwrite add*zdt486 # if defined key_diainstant 487 zsto=nwritedia*zdt 647 488 clop='inst(only(x))' 648 # 489 # else 649 490 zsto=zdt 650 491 clop='ave(only(x))' 651 # 652 zout=nwrite add*zdt492 # endif 493 zout=nwritedia*zdt 653 494 654 495 ! Define indices of the horizontal output zoom and vertical limit storage … … 660 501 it = kt - nittrc000 + 1 661 502 662 ! 1. Define NETCDF files and fields at beginning of first time step 663 ! ----------------------------------------------------------------- 664 665 IF(ll_print)WRITE(numout,*)'trcdii_wr kt=',kt,' kindic ',kindic 666 IF(kt == nittrc000) THEN 667 668 ! Define the NETCDF files for additional arrays : 2D or 3D 669 670 ! Define the T grid file for tracer auxiliary files 671 672 CALL dia_nam(clhstnam,nwrite,'diad_T') 673 IF(lwp)WRITE(numout,*)" Name of NETCDF file ", clhstnam 674 675 ! Define a netcdf FILE for 2d and 3d arrays 676 677 CALL histbeg(clhstnam, jpi, glamt, jpj, gphit, & 678 & iimi, iima-iimi+1, ijmi, ijma-ijmi+1, & 679 & 0, zjulian, zdt, nhoritd, nitd , domain_id=nidom) 680 681 ! Vertical grid for 2d and 3d arrays 682 683 CALL histvert(nitd, 'deptht', 'Vertical T levels', & 684 & 'm', ipk, gdept_0, ndepitd) 685 686 687 ! Declare all the output fields as NETCDF variables 688 689 ! more 3D horizontal arrays 690 691 DO jn=1,jpdia3d 692 cltra=ctrc3d(jn) ! short title for 3D diagnostic 693 cltral=ctrc3l(jn) ! long title for 3D diagnostic 694 cltrau=ctrc3u(jn) ! UNIT for 3D diagnostic 695 CALL histdef(nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd, & 696 & ipk, 1, ipk, ndepitd, 32, clop, zsto, zout) 697 END DO 698 699 700 ! more 2D horizontal arrays 701 702 DO jn=1,jpdia2d 503 ! 1. Define NETCDF files and fields at beginning of first time step 504 ! ----------------------------------------------------------------- 505 506 IF( ll_print ) WRITE(numout,*) 'trcdii_wr kt=', kt, ' kindic ', kindic 507 508 IF( kt == nittrc000 ) THEN 509 510 ! Define the NETCDF files for additional arrays : 2D or 3D 511 512 ! Define the T grid file for tracer auxiliary files 513 514 CALL dia_nam( clhstnam, nwrite, 'diad_T' ) 515 IF(lwp) WRITE(numout,*) " Name of NETCDF file ", clhstnam 516 517 ! Define a netcdf FILE for 2d and 3d arrays 518 519 CALL histbeg( clhstnam, jpi, glamt, jpj, gphit, & 520 & iimi, iima-iimi+1, ijmi, ijma-ijmi+1, & 521 & 0, zjulian, zdt, nhoritd, nitd , domain_id=nidom ) 522 523 ! Vertical grid for 2d and 3d arrays 524 525 CALL histvert( nitd, 'deptht', 'Vertical T levels', & 526 & 'm', ipk, gdept_0, ndepitd) 527 528 ! Declare all the output fields as NETCDF variables 529 530 ! more 3D horizontal arrays 531 DO jn = 1, jpdia3d 532 cltra = ctrc3d(jn) ! short title for 3D diagnostic 533 cltral = ctrc3l(jn) ! long title for 3D diagnostic 534 cltrau = ctrc3u(jn) ! UNIT for 3D diagnostic 535 CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd, & 536 & ipk, 1, ipk, ndepitd, 32, clop, zsto, zout ) 537 END DO 538 539 ! more 2D horizontal arrays 540 DO jn = 1, jpdia2d 703 541 cltra=ctrc2d(jn) ! short title for 2D diagnostic 704 542 cltral=ctrc2l(jn) ! long title for 2D diagnostic 705 543 cltrau=ctrc2u(jn) ! UNIT for 2D diagnostic 706 CALL histdef(nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd, & 707 & 1, 1, 1, -99, 32, clop, zsto, zout) 708 END DO 709 710 ! TODO: more 2D vertical sections arrays : I or J indice fixed 711 712 ! CLOSE netcdf Files 713 714 CALL histend(nitd) 544 CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd, & 545 & 1, 1, 1, -99, 32, clop, zsto, zout ) 546 END DO 547 548 ! TODO: more 2D vertical sections arrays : I or J indice fixed 549 550 ! CLOSE netcdf Files 551 CALL histend( nitd ) 715 552 716 553 IF(lwp) WRITE(numout,*) 717 554 IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization in trcdii_wr' 718 IF( ll_print)CALL FLUSH(numout )719 720 ENDIF 721 722 ! 2. Start writing data723 ! ---------------------724 725 IF( lwp .AND. MOD( kt, nwrite add) == 0 ) THEN555 IF( ll_print ) CALL FLUSH(numout ) 556 ! 557 ENDIF 558 559 ! 2. Start writing data 560 ! --------------------- 561 562 IF( lwp .AND. MOD( kt, nwritedia ) == 0 ) THEN 726 563 WRITE(numout,*) 'trcdii_wr : write NetCDF additional arrays at ', kt, 'time-step' 727 564 WRITE(numout,*) '~~~~~~ ' 728 565 ENDIF 729 566 730 ! more 3D horizontal arrays 731 732 DO jn=1,jpdia3d 733 cltra=ctrc3d(jn) ! short title for 3D diagnostic 734 CALL histwrite(nitd, cltra, it, trc3d(:,:,:,jn), ndimt50 & 735 & ,ndext50) 736 END DO 737 738 ! more 2D horizontal arrays 739 740 DO jn=1,jpdia2d 741 cltra=ctrc2d(jn) ! short title for 2D diagnostic 742 CALL histwrite(nitd, cltra, it, trc2d(:,:,jn), ndimt51 & 567 ! more 3D horizontal arrays 568 DO jn = 1, jpdia3d 569 cltra = ctrc3d(jn) ! short title for 3D diagnostic 570 CALL histwrite( nitd, cltra, it, trc3d(:,:,:,jn), ndimt50 & 571 & ,ndext50) 572 END DO 573 574 ! more 2D horizontal arrays 575 DO jn = 1, jpdia2d 576 cltra = ctrc2d(jn) ! short title for 2D diagnostic 577 CALL histwrite(nitd, cltra, it, trc2d(:,:,jn), ndimt51 & 743 578 & ,ndext51) 744 END DO 745 746 ! synchronise FILE 747 748 IF( MOD( kt, nwriteadd ) == 0 .OR. kindic < 0 ) THEN 749 CALL histsync(nitd) 750 ENDIF 751 752 ! 3. Closing all files 753 ! -------------------- 754 755 IF( kt == nitend .OR. kindic < 0 ) THEN 756 CALL histclo(nitd) 757 ENDIF 758 579 END DO 580 581 ! synchronise FILE 582 IF( MOD( kt, nwritedia ) == 0 .OR. kindic < 0 ) CALL histsync( nitd ) 583 584 ! Closing all files 585 ! ----------------- 586 IF( kt == nitend .OR. kindic < 0 ) CALL histclo(nitd) 587 ! 759 588 END SUBROUTINE trcdii_wr 760 589 761 # else 762 763 SUBROUTINE trcdii_wr(kt,kindic) 764 !!! no passive tracers 765 INTEGER, INTENT ( in ) :: kt, kindic 766 WRITE(*,*) 'trcdii_wr: You should not have seen this print! error?', kt, kindic 767 END SUBROUTINE trcdii_wr 768 769 # endif 770 771 # if defined key_passivetrc && defined key_trc_diabio 772 773 SUBROUTINE trcdib_wr(kt,kindic) 774 !!=========================================================================================== 775 !! 776 !! ROUTINE trcdib_wr 777 !!=========================================================================================== 778 !! 779 !! Purpose : 780 !!--------- 781 !! Specific output of opa: biological fields 782 !! 783 !! 784 !! Method : 785 !! ------- 786 !! 787 !! At the beginning of the first time step (nit000), define all 788 !! the NETCDF files and fields for biological fields 789 !! 790 !! At each time step call histdef to compute the mean if necessary 791 !! Each nwritetrd time step, output the instantaneous or mean fields 792 !! 793 !! IF kindic <0, output of fields before the model interruption. 794 !! IF kindic =0, time step loop 795 !! IF kindic >0, output of fields before the time step loop 796 !! 797 !! Input : 798 !! ----- 799 !! argument 800 !! kt : time step 801 !! kindic : indicator of abnormal termination 802 !! 803 !! Output : 804 !! ------ 805 !! file 806 !! "histname" files : at least one file for each grid 807 !! 808 !! History: 809 !! -------- 810 !! original : 95-01 passive tracers (M. Levy) 811 !! additions : 98-01 (C. Levy) NETCDF format using ioipsl interface 812 !! additions : 99-01 (M.A. Foujols) adapted for passive tracer 813 !! additions : 99-09 (M.A. Foujols) split into three parts 814 !! additions : 01-06 (E Kestenare) assign a parameter to name 815 !! individual tracers 816 !! additions : 05-03 (O. Aumont and A El Moussaoui) F90 817 !!==================================================================================================! 818 819 !! Modules used 820 USE ioipsl 590 # else 591 SUBROUTINE trcdii_wr( kt, kindic ) ! Dummy routine 592 INTEGER, INTENT ( in ) :: kt, kindic 593 WRITE(*,*) 'trcdii_wr: You should not have seen this print! error?', kt, kindic 594 END SUBROUTINE trcdii_wr 595 # endif 596 597 # if defined key_trc_diabio 598 599 SUBROUTINE trcdib_wr( kt, kindic ) 600 !!---------------------------------------------------------------------- 601 !! *** ROUTINE trcdib_wr *** 602 !! 603 !! ** Purpose : output of passive tracer : biological fields 604 !! 605 !! ** Method : At the beginning of the first time step (nit000), define all 606 !! the NETCDF files and fields for concentration of passive tracer 607 !! 608 !! At each time step call histdef to compute the mean if necessary 609 !! Each nwritetrc time step, output the instantaneous or mean fields 610 !! 611 !! IF kindic <0, output of fields before the model interruption. 612 !! IF kindic =0, time step loop 613 !! IF kindic >0, output of fields before the time step loop 614 !!---------------------------------------------------------------------- 821 615 USE sms 822 823 !! * Arguments 824 INTEGER, INTENT( in ) :: kt,kindic ! ocean time-step 825 826 INTEGER :: ji, jj, jk, jn 827 LOGICAL :: ll_print = .FALSE. 828 829 CHARACTER (len=40) :: clhstnam, clop 830 CHARACTER (len=20) :: cltra, cltrau 831 CHARACTER (len=80) :: cltral 832 833 REAL(wp) :: zsto, zout, zdt 834 INTEGER :: iimi, iima, ijmi, ijma, ipk, it 835 836 ! 837 ! 0. Initialisation 838 ! ----------------- 839 840 ! local variable for debugging 616 !! 617 INTEGER, INTENT( in ) :: kt ! ocean time-step 618 INTEGER, INTENT( in ) :: kindic ! indicator of abnormal termination 619 !! 620 LOGICAL :: ll_print = .FALSE. 621 CHARACTER (len=40) :: clhstnam, clop 622 CHARACTER (len=20) :: cltra, cltrau 623 CHARACTER (len=80) :: cltral 624 INTEGER :: ji, jj, jk, jn 625 INTEGER :: iimi, iima, ijmi, ijma, ipk, it 626 REAL(wp) :: zsto, zout, zdt 627 !!---------------------------------------------------------------------- 628 629 ! Initialisation 630 ! -------------- 631 632 ! local variable for debugging 841 633 ll_print = .FALSE. 842 634 ll_print = ll_print .AND. lwp 843 ! 844 ! Define frequency of output and means 845 ! 635 636 ! Define frequency of output and means 846 637 zdt = rdt 847 638 # if defined key_diainstant … … 862 653 it = kt - nittrc000 + 1 863 654 864 ! 1. Define NETCDF files and fields at beginning of first time step 865 ! ----------------------------------------------------------------- 866 867 IF(ll_print)WRITE(numout,*)'trcdib_wr kt=',kt,' kindic ',kindic 868 IF(kt == nittrc000) THEN 869 870 ! Define the NETCDF files for biological trends 871 872 CALL dia_nam(clhstnam,nwrite,'biolog') 873 IF(lwp)WRITE(numout,*) & 874 & " Name of NETCDF file for biological trends ",clhstnam 875 ! Horizontal grid : glamt and gphit 876 CALL histbeg(clhstnam, jpi, glamt, jpj, gphit, & 877 & iimi, iima-iimi+1, ijmi, ijma-ijmi+1, & 878 & 0, zjulian, rdt, nhoritb, nitb , domain_id=nidom) 879 ! Vertical grid for biological trends 880 CALL histvert(nitb, 'deptht', 'Vertical T levels', & 881 & 'm', ipk, gdept_0, ndepitb) 882 883 ! Declare all the output fields as NETCDF variables 884 885 ! biological trends 886 887 DO jn=1,jpdiabio 888 cltra=ctrbio(jn) ! short title for biological diagnostic 889 cltral=ctrbil(jn) ! long title for biological diagnostic 890 cltrau=ctrbiu(jn) ! UNIT for biological diagnostic 655 ! Define NETCDF files and fields at beginning of first time step 656 ! -------------------------------------------------------------- 657 658 IF(ll_print) WRITE(numout,*)'trcdib_wr kt=',kt,' kindic ',kindic 659 660 IF( kt == nittrc000 ) THEN 661 662 ! Define the NETCDF files for biological trends 663 664 CALL dia_nam(clhstnam,nwrite,'biolog') 665 IF(lwp)WRITE(numout,*) " Name of NETCDF file for biological trends ", clhstnam 666 ! Horizontal grid : glamt and gphit 667 CALL histbeg(clhstnam, jpi, glamt, jpj, gphit, & 668 & iimi, iima-iimi+1, ijmi, ijma-ijmi+1, & 669 & 0, zjulian, rdt, nhoritb, nitb , domain_id=nidom) 670 ! Vertical grid for biological trends 671 CALL histvert(nitb, 'deptht', 'Vertical T levels', & 672 & 'm', ipk, gdept_0, ndepitb) 673 674 ! Declare all the output fields as NETCDF variables 675 ! biological trends 676 DO jn = 1, jpdiabio 677 cltra = ctrbio(jn) ! short title for biological diagnostic 678 cltral = ctrbil(jn) ! long title for biological diagnostic 679 cltrau = ctrbiu(jn) ! UNIT for biological diagnostic 891 680 CALL histdef(nitb, cltra, cltral, cltrau, jpi, jpj, nhoritb, & 892 & ipk, 1, ipk, ndepitb, 32, clop, zsto, zout) 893 END DO 894 895 ! CLOSE netcdf Files 896 681 & ipk, 1, ipk, ndepitb, 32, clop, zsto, zout) 682 END DO 683 684 ! CLOSE netcdf Files 897 685 CALL histend(nitb) 898 686 … … 900 688 IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization in trcdib_wr' 901 689 IF(ll_print) CALL FLUSH(numout ) 902 903 ENDIF 904 905 ! 2. Start writing data 906 ! --------------------- 907 908 ! biological trends 909 690 ! 691 ENDIF 692 693 ! Start writing data 694 ! ------------------ 695 696 ! biological trends 910 697 IF( lwp .AND. MOD( kt, nwritebio ) == 0 ) THEN 911 698 WRITE(numout,*) 'trcdit_wr : write NetCDF biological trends at ', kt, 'time-step' … … 913 700 ENDIF 914 701 915 916 DO jn=1,jpdiabio 702 DO jn = 1, jpdiabio 917 703 cltra=ctrbio(jn) ! short title for biological diagnostic 918 704 CALL histwrite(nitb, cltra, it, trbio(:,:,:,jn), ndimt50,ndext50) 919 705 END DO 920 706 921 ! synchronise FILE 922 923 IF( MOD( kt, nwritebio ) == 0 .OR. kindic < 0 ) THEN 924 CALL histsync(nitb) 925 ENDIF 926 927 ! 3. Closing all files 928 ! -------------------- 929 IF( kt == nitend .OR. kindic < 0 ) THEN 930 CALL histclo(nitb) 931 ENDIF 932 933 END SUBROUTINE trcdib_wr 934 935 # else 936 937 SUBROUTINE trcdib_wr(kt,kindic) 938 !!! no passive tracers 939 INTEGER, INTENT ( in ) :: kt, kindic 940 WRITE(*,*) 'trcdib_wr: You should not have seen this print! error?', kt, kindic 941 END SUBROUTINE trcdib_wr 942 943 # endif 944 707 ! synchronise FILE 708 IF( MOD( kt, nwritebio ) == 0 .OR. kindic < 0 ) CALL histsync( nitb ) 709 710 ! Closing all files 711 ! ----------------- 712 IF( kt == nitend .OR. kindic < 0 ) CALL histclo( nitb ) 713 ! 714 END SUBROUTINE trcdib_wr 715 716 # else 717 SUBROUTINE trcdib_wr( kt, kindic ) ! Dummy routine 718 INTEGER, INTENT ( in ) :: kt, kindic 719 WRITE(*,*) 'trcdib_wr: You should not have seen this print! error?', kt, kindic 720 END SUBROUTINE trcdib_wr 721 # endif 722 723 #else 724 !!---------------------------------------------------------------------- 725 !! Dummy module : No passive tracer 726 !!---------------------------------------------------------------------- 727 CONTAINS 728 SUBROUTINE trcdit_wr( kt, kindic ) ! Dummy routine 729 INTEGER, INTENT ( in ) :: kt, kindic 730 WRITE(*,*) 'trcdit_wr: You should not have seen this print! error?', kt, kindic 731 END SUBROUTINE trcdit_wr 732 SUBROUTINE trcdid_wr( kt, kindic ) ! Dummy routine 733 INTEGER, INTENT ( in ) :: kt, kindic 734 WRITE(*,*) 'trcdid_wr: You should not have seen this print! error?', kt, kindic 735 END SUBROUTINE trcdid_wr 736 SUBROUTINE trcdii_wr( kt, kindic ) ! Dummy routine 737 INTEGER, INTENT ( in ) :: kt, kindic 738 WRITE(*,*) 'trcdii_wr: You should not have seen this print! error?', kt, kindic 739 END SUBROUTINE trcdii_wr 740 SUBROUTINE trcdib_wr( kt, kindic ) ! Dummy routine 741 INTEGER, INTENT ( in ) :: kt, kindic 742 WRITE(*,*) 'trcdib_wr: You should not have seen this print! error?', kt, kindic 743 END SUBROUTINE trcdib_wr 744 #endif 745 746 !!====================================================================== 945 747 END MODULE trcdit
Note: See TracChangeset
for help on using the changeset viewer.