[268] | 1 | MODULE trcdia |
---|
[945] | 2 | !!====================================================================== |
---|
[268] | 3 | !! *** MODULE trcdia *** |
---|
[945] | 4 | !! TOP : Output of passive tracers |
---|
| 5 | !!====================================================================== |
---|
[2528] | 6 | !! History : OPA ! 1995-01 (M. Levy) Original code |
---|
[1011] | 7 | !! - ! 1998-01 (C. Levy) NETCDF format using ioipsl interface |
---|
| 8 | !! - ! 1999-01 (M.A. Foujols) adapted for passive tracer |
---|
| 9 | !! - ! 1999-09 (M.A. Foujols) split into three parts |
---|
[2528] | 10 | !! NEMO 1.0 ! 2005-03 (O. Aumont, A. El Moussaoui) F90 |
---|
[1011] | 11 | !! ! 2008-05 (C. Ethe re-organization) |
---|
[274] | 12 | !!---------------------------------------------------------------------- |
---|
[2977] | 13 | #if defined key_top |
---|
[335] | 14 | !!---------------------------------------------------------------------- |
---|
[945] | 15 | !! 'key_top' TOP models |
---|
| 16 | !!---------------------------------------------------------------------- |
---|
[1011] | 17 | !! trc_dia : main routine of output passive tracer |
---|
| 18 | !! trcdit_wr : outputs of concentration fields |
---|
| 19 | !! trcdii_wr : outputs of additional 2D/3D diagnostics |
---|
| 20 | !! trcdib_wr : outputs of biological fields |
---|
[945] | 21 | !!---------------------------------------------------------------------- |
---|
[1715] | 22 | USE dom_oce ! ocean space and time domain variables |
---|
[1011] | 23 | USE oce_trc |
---|
| 24 | USE trc |
---|
[1836] | 25 | USE par_trc |
---|
[1011] | 26 | USE dianam ! build name of file (routine) |
---|
[2977] | 27 | USE ioipsl ! I/O manager |
---|
| 28 | USE iom ! I/O manager |
---|
| 29 | USE lib_mpp ! MPP library |
---|
[268] | 30 | |
---|
| 31 | IMPLICIT NONE |
---|
| 32 | PRIVATE |
---|
| 33 | |
---|
[2715] | 34 | PUBLIC trc_dia ! called by XXX module |
---|
[268] | 35 | |
---|
[1011] | 36 | INTEGER :: nit5 !: id for tracer output file |
---|
| 37 | INTEGER :: ndepit5 !: id for depth mesh |
---|
| 38 | INTEGER :: nhorit5 !: id for horizontal mesh |
---|
| 39 | INTEGER :: ndimt50 !: number of ocean points in index array |
---|
| 40 | INTEGER :: ndimt51 !: number of ocean points in index array |
---|
[1836] | 41 | REAL(wp) :: zjulian !: ???? not DOCTOR ! |
---|
[2715] | 42 | INTEGER , ALLOCATABLE, SAVE, DIMENSION (:) :: ndext50 !: integer arrays for ocean 3D index |
---|
| 43 | INTEGER , ALLOCATABLE, SAVE, DIMENSION (:) :: ndext51 !: integer arrays for ocean surface index |
---|
[2977] | 44 | |
---|
[1011] | 45 | INTEGER :: nitd !: id for additional array output file |
---|
| 46 | INTEGER :: ndepitd !: id for depth mesh |
---|
| 47 | INTEGER :: nhoritd !: id for horizontal mesh |
---|
[2977] | 48 | |
---|
[1077] | 49 | INTEGER :: nitb !: id. for additional array output file |
---|
[1011] | 50 | INTEGER :: ndepitb !: id for depth mesh |
---|
| 51 | INTEGER :: nhoritb !: id for horizontal mesh |
---|
| 52 | |
---|
| 53 | !! * Substitutions |
---|
| 54 | # include "top_substitute.h90" |
---|
[945] | 55 | !!---------------------------------------------------------------------- |
---|
[2528] | 56 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
[1152] | 57 | !! $Id$ |
---|
[2715] | 58 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[945] | 59 | !!---------------------------------------------------------------------- |
---|
[268] | 60 | CONTAINS |
---|
| 61 | |
---|
[1457] | 62 | SUBROUTINE trc_dia( kt ) |
---|
[945] | 63 | !!--------------------------------------------------------------------- |
---|
| 64 | !! *** ROUTINE trc_dia *** |
---|
[335] | 65 | !! |
---|
[945] | 66 | !! ** Purpose : output passive tracers fields |
---|
| 67 | !!--------------------------------------------------------------------- |
---|
[2977] | 68 | INTEGER, INTENT(in) :: kt ! ocean time-step |
---|
[2715] | 69 | ! |
---|
[2977] | 70 | INTEGER :: ierr, kindic ! local integer |
---|
[945] | 71 | !!--------------------------------------------------------------------- |
---|
[2528] | 72 | ! |
---|
[2977] | 73 | IF( kt == nit000 ) THEN |
---|
| 74 | ALLOCATE( ndext50(jpij*jpk), ndext51(jpij), STAT=ierr ) |
---|
| 75 | IF( ierr > 0 ) THEN |
---|
| 76 | CALL ctl_stop( 'STOP', 'trc_diat: unable to allocate arrays' ) ; RETURN |
---|
| 77 | ENDIF |
---|
| 78 | ENDIF |
---|
[945] | 79 | ! |
---|
[2977] | 80 | IF( .NOT.lk_iomput ) THEN |
---|
| 81 | CALL trcdit_wr( kt, kindic ) ! outputs for tracer concentration |
---|
| 82 | IF( ln_diatrc ) CALL trcdii_wr( kt, kindic ) ! outputs for additional arrays |
---|
| 83 | IF( ln_diabio ) CALL trcdib_wr( kt, kindic ) ! outputs for biological trends |
---|
| 84 | ENDIF |
---|
| 85 | ! |
---|
[335] | 86 | END SUBROUTINE trc_dia |
---|
[268] | 87 | |
---|
[2528] | 88 | |
---|
[1011] | 89 | SUBROUTINE trcdit_wr( kt, kindic ) |
---|
| 90 | !!---------------------------------------------------------------------- |
---|
| 91 | !! *** ROUTINE trcdit_wr *** |
---|
| 92 | !! |
---|
| 93 | !! ** Purpose : Standard output of passive tracer : concentration fields |
---|
| 94 | !! |
---|
| 95 | !! ** Method : At the beginning of the first time step (nit000), define all |
---|
| 96 | !! the NETCDF files and fields for concentration of passive tracer |
---|
| 97 | !! |
---|
| 98 | !! At each time step call histdef to compute the mean if necessary |
---|
| 99 | !! Each nwritetrc time step, output the instantaneous or mean fields |
---|
| 100 | !! |
---|
| 101 | !! IF kindic <0, output of fields before the model interruption. |
---|
| 102 | !! IF kindic =0, time step loop |
---|
| 103 | !! IF kindic >0, output of fields before the time step loop |
---|
| 104 | !!---------------------------------------------------------------------- |
---|
[2715] | 105 | INTEGER, INTENT(in) :: kt ! ocean time-step |
---|
| 106 | INTEGER, INTENT(in) :: kindic ! indicator of abnormal termination |
---|
| 107 | ! |
---|
[1011] | 108 | INTEGER :: jn |
---|
| 109 | LOGICAL :: ll_print = .FALSE. |
---|
| 110 | CHARACTER (len=40) :: clhstnam, clop |
---|
[1656] | 111 | INTEGER :: inum = 11 ! temporary logical unit |
---|
[1011] | 112 | CHARACTER (len=20) :: cltra, cltrau |
---|
| 113 | CHARACTER (len=80) :: cltral |
---|
| 114 | REAL(wp) :: zsto, zout, zdt |
---|
[2528] | 115 | INTEGER :: iimi, iima, ijmi, ijma, ipk, it, itmod, iiter |
---|
[1011] | 116 | !!---------------------------------------------------------------------- |
---|
| 117 | |
---|
| 118 | ! Initialisation |
---|
| 119 | ! -------------- |
---|
| 120 | |
---|
| 121 | ! local variable for debugging |
---|
| 122 | ll_print = .FALSE. ! change it to true for more control print |
---|
| 123 | ll_print = ll_print .AND. lwp |
---|
| 124 | |
---|
| 125 | ! Define frequency of output and means |
---|
| 126 | zdt = rdt |
---|
[1312] | 127 | IF( ln_mskland ) THEN ; clop = "only(x)" ! put 1.e+20 on land (very expensive!!) |
---|
| 128 | ELSE ; clop = "x" ! no use of the mask value (require less cpu time) |
---|
| 129 | ENDIF |
---|
[1011] | 130 | # if defined key_diainstant |
---|
[2528] | 131 | zsto = nn_writetrc * rdt |
---|
[1312] | 132 | clop = "inst("//TRIM(clop)//")" |
---|
[1011] | 133 | # else |
---|
| 134 | zsto = zdt |
---|
[1312] | 135 | clop = "ave("//TRIM(clop)//")" |
---|
[1011] | 136 | # endif |
---|
[2528] | 137 | zout = nn_writetrc * zdt |
---|
[1011] | 138 | |
---|
| 139 | ! Define indices of the horizontal output zoom and vertical limit storage |
---|
| 140 | iimi = 1 ; iima = jpi |
---|
| 141 | ijmi = 1 ; ijma = jpj |
---|
| 142 | ipk = jpk |
---|
| 143 | |
---|
| 144 | ! define time axis |
---|
[2528] | 145 | itmod = kt - nit000 + 1 |
---|
[1353] | 146 | it = kt |
---|
[2528] | 147 | iiter = ( nit000 - 1 ) / nn_dttrc |
---|
[1011] | 148 | |
---|
| 149 | ! Define NETCDF files and fields at beginning of first time step |
---|
| 150 | ! -------------------------------------------------------------- |
---|
| 151 | |
---|
| 152 | IF(ll_print)WRITE(numout,*)'trcdit_wr kt=',kt,' kindic ',kindic |
---|
| 153 | |
---|
[2528] | 154 | IF( kt == nit000 ) THEN |
---|
[1011] | 155 | |
---|
[2977] | 156 | IF(lwp) THEN ! control print |
---|
| 157 | WRITE(numout,*) |
---|
| 158 | WRITE(numout,*) ' frequency of outputs for passive tracers nn_writetrc = ', nn_writetrc |
---|
| 159 | DO jn = 1, jptra |
---|
| 160 | IF( ln_trc_wri(jn) ) WRITE(numout,*) ' ouput tracer nb : ', jn, ' short name : ', ctrcnm(jn) |
---|
| 161 | END DO |
---|
| 162 | WRITE(numout,*) ' ' |
---|
| 163 | ENDIF |
---|
| 164 | |
---|
[1011] | 165 | ! Compute julian date from starting date of the run |
---|
[1836] | 166 | CALL ymds2ju( nyear, nmonth, nday, rdt, zjulian ) |
---|
| 167 | zjulian = zjulian - adatrj ! set calendar origin to the beginning of the experiment |
---|
[1011] | 168 | IF(lwp)WRITE(numout,*)' ' |
---|
[2528] | 169 | IF(lwp)WRITE(numout,*)' Date 0 used :', nit000 & |
---|
[1011] | 170 | & ,' YEAR ', nyear, ' MONTH ', nmonth, ' DAY ', nday & |
---|
[1836] | 171 | & ,'Julian day : ', zjulian |
---|
[1353] | 172 | |
---|
[1011] | 173 | IF(lwp) WRITE(numout,*) ' indexes of zoom = ', iimi, iima, ijmi, ijma, & |
---|
| 174 | & ' limit storage in depth = ', ipk |
---|
| 175 | |
---|
[2528] | 176 | IF( lk_offline .AND. lwp ) THEN |
---|
| 177 | CALL dia_nam( clhstnam, nn_writetrc,' ' ) |
---|
[2421] | 178 | CALL ctl_opn( inum, 'date.file', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', 1, numout, lwp, narea ) |
---|
[1656] | 179 | WRITE(inum,*) clhstnam |
---|
| 180 | CLOSE(inum) |
---|
| 181 | ENDIF |
---|
[1011] | 182 | |
---|
[1353] | 183 | ! Define the NETCDF files for passive tracer concentration |
---|
[2528] | 184 | CALL dia_nam( clhstnam, nn_writetrc, 'ptrc_T' ) |
---|
[1011] | 185 | IF(lwp)WRITE(numout,*)" Name of NETCDF file ", clhstnam |
---|
[1353] | 186 | |
---|
| 187 | ! Horizontal grid : glamt and gphit |
---|
[1011] | 188 | CALL histbeg( clhstnam, jpi, glamt, jpj, gphit, & |
---|
| 189 | & iimi, iima-iimi+1, ijmi, ijma-ijmi+1, & |
---|
[2528] | 190 | & iiter, zjulian, zdt, nhorit5, nit5 , domain_id=nidom, snc4chunks=snc4set) |
---|
[1011] | 191 | |
---|
[1353] | 192 | ! Vertical grid for tracer : gdept |
---|
| 193 | CALL histvert( nit5, 'deptht', 'Vertical T levels', 'm', ipk, gdept_0, ndepit5) |
---|
[1011] | 194 | |
---|
[1353] | 195 | ! Index of ocean points in 3D and 2D (surface) |
---|
| 196 | CALL wheneq( jpi*jpj*ipk, tmask, 1, 1., ndext50, ndimt50 ) |
---|
| 197 | CALL wheneq( jpi*jpj , tmask, 1, 1., ndext51, ndimt51 ) |
---|
[1011] | 198 | |
---|
[1353] | 199 | ! Declare all the output fields as NETCDF variables |
---|
[1011] | 200 | DO jn = 1, jptra |
---|
[2977] | 201 | IF( ln_trc_wri(jn) ) THEN |
---|
[2715] | 202 | cltra = TRIM( ctrcnm(jn) ) ! short title for tracer |
---|
[2977] | 203 | cltral = TRIM( ctrcln(jn) ) ! long title for tracer |
---|
[2715] | 204 | cltrau = TRIM( ctrcun(jn) ) ! UNIT for tracer |
---|
[1011] | 205 | CALL histdef( nit5, cltra, cltral, cltrau, jpi, jpj, nhorit5, & |
---|
[1353] | 206 | & ipk, 1, ipk, ndepit5, 32, clop, zsto, zout ) |
---|
[1011] | 207 | ENDIF |
---|
| 208 | END DO |
---|
| 209 | |
---|
| 210 | ! end netcdf files header |
---|
[2528] | 211 | CALL histend( nit5, snc4set ) |
---|
[1011] | 212 | IF(lwp) WRITE(numout,*) |
---|
| 213 | IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization in trcdit_wr' |
---|
| 214 | IF( ll_print ) CALL FLUSH(numout ) |
---|
| 215 | |
---|
| 216 | ENDIF |
---|
| 217 | |
---|
| 218 | ! Start writing the tracer concentrations |
---|
| 219 | ! --------------------------------------- |
---|
| 220 | |
---|
[2528] | 221 | IF( lwp .AND. MOD( itmod, nn_writetrc ) == 0 ) THEN |
---|
[1011] | 222 | WRITE(numout,*) 'trcdit_wr : write NetCDF passive tracer concentrations at ', kt, 'time-step' |
---|
| 223 | WRITE(numout,*) '~~~~~~~~~ ' |
---|
| 224 | ENDIF |
---|
| 225 | |
---|
| 226 | DO jn = 1, jptra |
---|
[2715] | 227 | cltra = TRIM( ctrcnm(jn) ) ! short title for tracer |
---|
[2977] | 228 | IF( ln_trc_wri(jn) ) CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 ) |
---|
[1011] | 229 | END DO |
---|
| 230 | |
---|
| 231 | ! close the file |
---|
| 232 | ! -------------- |
---|
| 233 | IF( kt == nitend .OR. kindic < 0 ) CALL histclo( nit5 ) |
---|
| 234 | ! |
---|
| 235 | END SUBROUTINE trcdit_wr |
---|
| 236 | |
---|
| 237 | SUBROUTINE trcdii_wr( kt, kindic ) |
---|
| 238 | !!---------------------------------------------------------------------- |
---|
| 239 | !! *** ROUTINE trcdii_wr *** |
---|
| 240 | !! |
---|
| 241 | !! ** Purpose : output of passive tracer : additional 2D and 3D arrays |
---|
| 242 | !! |
---|
| 243 | !! ** Method : At the beginning of the first time step (nit000), define all |
---|
| 244 | !! the NETCDF files and fields for concentration of passive tracer |
---|
| 245 | !! |
---|
| 246 | !! At each time step call histdef to compute the mean if necessary |
---|
[2567] | 247 | !! Each nn_writedia time step, output the instantaneous or mean fields |
---|
[1011] | 248 | !! |
---|
| 249 | !! IF kindic <0, output of fields before the model interruption. |
---|
| 250 | !! IF kindic =0, time step loop |
---|
| 251 | !! IF kindic >0, output of fields before the time step loop |
---|
| 252 | !!---------------------------------------------------------------------- |
---|
[2715] | 253 | INTEGER, INTENT(in) :: kt ! ocean time-step |
---|
| 254 | INTEGER, INTENT(in) :: kindic ! indicator of abnormal termination |
---|
[1011] | 255 | !! |
---|
| 256 | LOGICAL :: ll_print = .FALSE. |
---|
| 257 | CHARACTER (len=40) :: clhstnam, clop |
---|
| 258 | CHARACTER (len=20) :: cltra, cltrau |
---|
| 259 | CHARACTER (len=80) :: cltral |
---|
[1450] | 260 | INTEGER :: jl |
---|
[2528] | 261 | INTEGER :: iimi, iima, ijmi, ijma, ipk, it, itmod, iiter |
---|
[1011] | 262 | REAL(wp) :: zsto, zout, zdt |
---|
| 263 | !!---------------------------------------------------------------------- |
---|
| 264 | |
---|
| 265 | ! Initialisation |
---|
| 266 | ! -------------- |
---|
[1450] | 267 | |
---|
[1011] | 268 | ! local variable for debugging |
---|
| 269 | ll_print = .FALSE. |
---|
| 270 | ll_print = ll_print .AND. lwp |
---|
| 271 | ! |
---|
| 272 | ! Define frequency of output and means |
---|
| 273 | zdt = rdt |
---|
[1316] | 274 | IF( ln_mskland ) THEN ; clop = "only(x)" ! put 1.e+20 on land (very expensive!!) |
---|
| 275 | ELSE ; clop = "x" ! no use of the mask value (require less cpu time) |
---|
| 276 | ENDIF |
---|
[1011] | 277 | # if defined key_diainstant |
---|
[2528] | 278 | zsto = nn_writedia * zdt |
---|
[1316] | 279 | clop = "inst("//TRIM(clop)//")" |
---|
[1011] | 280 | # else |
---|
[1353] | 281 | zsto = zdt |
---|
[1316] | 282 | clop = "ave("//TRIM(clop)//")" |
---|
[1011] | 283 | # endif |
---|
[2528] | 284 | zout = nn_writedia * zdt |
---|
[1011] | 285 | |
---|
| 286 | ! Define indices of the horizontal output zoom and vertical limit storage |
---|
| 287 | iimi = 1 ; iima = jpi |
---|
| 288 | ijmi = 1 ; ijma = jpj |
---|
| 289 | ipk = jpk |
---|
| 290 | |
---|
| 291 | ! define time axis |
---|
[2528] | 292 | itmod = kt - nit000 + 1 |
---|
[1353] | 293 | it = kt |
---|
[2528] | 294 | iiter = ( nit000 - 1 ) / nn_dttrc |
---|
[1011] | 295 | |
---|
| 296 | ! 1. Define NETCDF files and fields at beginning of first time step |
---|
| 297 | ! ----------------------------------------------------------------- |
---|
| 298 | |
---|
| 299 | IF( ll_print ) WRITE(numout,*) 'trcdii_wr kt=', kt, ' kindic ', kindic |
---|
| 300 | |
---|
[2528] | 301 | IF( kt == nit000 ) THEN |
---|
[1011] | 302 | |
---|
| 303 | ! Define the NETCDF files for additional arrays : 2D or 3D |
---|
| 304 | |
---|
| 305 | ! Define the T grid file for tracer auxiliary files |
---|
| 306 | |
---|
[2528] | 307 | CALL dia_nam( clhstnam, nn_writedia, 'diad_T' ) |
---|
[1011] | 308 | IF(lwp) WRITE(numout,*) " Name of NETCDF file ", clhstnam |
---|
| 309 | |
---|
| 310 | ! Define a netcdf FILE for 2d and 3d arrays |
---|
| 311 | |
---|
| 312 | CALL histbeg( clhstnam, jpi, glamt, jpj, gphit, & |
---|
| 313 | & iimi, iima-iimi+1, ijmi, ijma-ijmi+1, & |
---|
[2528] | 314 | & iiter, zjulian, zdt, nhoritd, nitd , domain_id=nidom, snc4chunks=snc4set ) |
---|
[1011] | 315 | |
---|
| 316 | ! Vertical grid for 2d and 3d arrays |
---|
| 317 | |
---|
[1353] | 318 | CALL histvert( nitd, 'deptht', 'Vertical T levels','m', ipk, gdept_0, ndepitd) |
---|
[1011] | 319 | |
---|
| 320 | ! Declare all the output fields as NETCDF variables |
---|
| 321 | |
---|
| 322 | ! more 3D horizontal arrays |
---|
[1450] | 323 | DO jl = 1, jpdia3d |
---|
[2715] | 324 | cltra = TRIM( ctrc3d(jl) ) ! short title for 3D diagnostic |
---|
| 325 | cltral = TRIM( ctrc3l(jl) ) ! long title for 3D diagnostic |
---|
| 326 | cltrau = TRIM( ctrc3u(jl) ) ! UNIT for 3D diagnostic |
---|
[1011] | 327 | CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd, & |
---|
| 328 | & ipk, 1, ipk, ndepitd, 32, clop, zsto, zout ) |
---|
| 329 | END DO |
---|
| 330 | |
---|
| 331 | ! more 2D horizontal arrays |
---|
[1450] | 332 | DO jl = 1, jpdia2d |
---|
[2715] | 333 | cltra = TRIM( ctrc2d(jl) ) ! short title for 2D diagnostic |
---|
| 334 | cltral = TRIM( ctrc2l(jl) ) ! long title for 2D diagnostic |
---|
| 335 | cltrau = TRIM( ctrc2u(jl) ) ! UNIT for 2D diagnostic |
---|
[1011] | 336 | CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd, & |
---|
| 337 | & 1, 1, 1, -99, 32, clop, zsto, zout ) |
---|
| 338 | END DO |
---|
| 339 | |
---|
| 340 | ! TODO: more 2D vertical sections arrays : I or J indice fixed |
---|
| 341 | |
---|
| 342 | ! CLOSE netcdf Files |
---|
[2528] | 343 | CALL histend( nitd, snc4set ) |
---|
[1011] | 344 | |
---|
| 345 | IF(lwp) WRITE(numout,*) |
---|
| 346 | IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization in trcdii_wr' |
---|
| 347 | IF( ll_print ) CALL FLUSH(numout ) |
---|
| 348 | ! |
---|
| 349 | ENDIF |
---|
| 350 | |
---|
| 351 | ! 2. Start writing data |
---|
| 352 | ! --------------------- |
---|
| 353 | |
---|
[2528] | 354 | IF( lwp .AND. MOD( itmod, nn_writedia ) == 0 ) THEN |
---|
[1011] | 355 | WRITE(numout,*) 'trcdii_wr : write NetCDF additional arrays at ', kt, 'time-step' |
---|
| 356 | WRITE(numout,*) '~~~~~~ ' |
---|
| 357 | ENDIF |
---|
| 358 | |
---|
| 359 | ! more 3D horizontal arrays |
---|
[1450] | 360 | DO jl = 1, jpdia3d |
---|
[2715] | 361 | cltra = TRIM( ctrc3d(jl) ) ! short title for 3D diagnostic |
---|
[1450] | 362 | CALL histwrite( nitd, cltra, it, trc3d(:,:,:,jl), ndimt50 ,ndext50) |
---|
[1011] | 363 | END DO |
---|
| 364 | |
---|
| 365 | ! more 2D horizontal arrays |
---|
[1450] | 366 | DO jl = 1, jpdia2d |
---|
[2715] | 367 | cltra = TRIM( ctrc2d(jl) ) ! short title for 2D diagnostic |
---|
[1450] | 368 | CALL histwrite(nitd, cltra, it, trc2d(:,:,jl), ndimt51 ,ndext51) |
---|
[1011] | 369 | END DO |
---|
| 370 | |
---|
| 371 | ! Closing all files |
---|
| 372 | ! ----------------- |
---|
| 373 | IF( kt == nitend .OR. kindic < 0 ) CALL histclo(nitd) |
---|
| 374 | ! |
---|
[1450] | 375 | |
---|
[1011] | 376 | END SUBROUTINE trcdii_wr |
---|
| 377 | |
---|
| 378 | SUBROUTINE trcdib_wr( kt, kindic ) |
---|
| 379 | !!---------------------------------------------------------------------- |
---|
| 380 | !! *** ROUTINE trcdib_wr *** |
---|
| 381 | !! |
---|
| 382 | !! ** Purpose : output of passive tracer : biological fields |
---|
| 383 | !! |
---|
| 384 | !! ** Method : At the beginning of the first time step (nit000), define all |
---|
| 385 | !! the NETCDF files and fields for concentration of passive tracer |
---|
| 386 | !! |
---|
| 387 | !! At each time step call histdef to compute the mean if necessary |
---|
[2567] | 388 | !! Each nn_writebio time step, output the instantaneous or mean fields |
---|
[1011] | 389 | !! |
---|
| 390 | !! IF kindic <0, output of fields before the model interruption. |
---|
| 391 | !! IF kindic =0, time step loop |
---|
| 392 | !! IF kindic >0, output of fields before the time step loop |
---|
| 393 | !!---------------------------------------------------------------------- |
---|
| 394 | INTEGER, INTENT( in ) :: kt ! ocean time-step |
---|
| 395 | INTEGER, INTENT( in ) :: kindic ! indicator of abnormal termination |
---|
| 396 | !! |
---|
| 397 | LOGICAL :: ll_print = .FALSE. |
---|
| 398 | CHARACTER (len=40) :: clhstnam, clop |
---|
| 399 | CHARACTER (len=20) :: cltra, cltrau |
---|
| 400 | CHARACTER (len=80) :: cltral |
---|
[1450] | 401 | INTEGER :: ji, jj, jk, jl |
---|
[2528] | 402 | INTEGER :: iimi, iima, ijmi, ijma, ipk, it, itmod, iiter |
---|
[1011] | 403 | REAL(wp) :: zsto, zout, zdt |
---|
| 404 | !!---------------------------------------------------------------------- |
---|
| 405 | |
---|
| 406 | ! Initialisation |
---|
| 407 | ! -------------- |
---|
[1450] | 408 | |
---|
[1011] | 409 | ! local variable for debugging |
---|
| 410 | ll_print = .FALSE. |
---|
| 411 | ll_print = ll_print .AND. lwp |
---|
| 412 | |
---|
| 413 | ! Define frequency of output and means |
---|
| 414 | zdt = rdt |
---|
[1316] | 415 | IF( ln_mskland ) THEN ; clop = "only(x)" ! put 1.e+20 on land (very expensive!!) |
---|
| 416 | ELSE ; clop = "x" ! no use of the mask value (require less cpu time) |
---|
| 417 | ENDIF |
---|
[1011] | 418 | # if defined key_diainstant |
---|
[2528] | 419 | zsto = nn_writebio * zdt |
---|
[1316] | 420 | clop = "inst("//TRIM(clop)//")" |
---|
[1011] | 421 | # else |
---|
[1353] | 422 | zsto = zdt |
---|
[1316] | 423 | clop = "ave("//TRIM(clop)//")" |
---|
[1011] | 424 | # endif |
---|
[2528] | 425 | zout = nn_writebio * zdt |
---|
[1011] | 426 | |
---|
[1353] | 427 | ! Define indices of the horizontal output zoom and vertical limit storage |
---|
[1011] | 428 | iimi = 1 ; iima = jpi |
---|
| 429 | ijmi = 1 ; ijma = jpj |
---|
| 430 | ipk = jpk |
---|
| 431 | |
---|
| 432 | ! define time axis |
---|
[2528] | 433 | itmod = kt - nit000 + 1 |
---|
[1353] | 434 | it = kt |
---|
[2528] | 435 | iiter = ( nit000 - 1 ) / nn_dttrc |
---|
[1011] | 436 | |
---|
| 437 | ! Define NETCDF files and fields at beginning of first time step |
---|
| 438 | ! -------------------------------------------------------------- |
---|
| 439 | |
---|
| 440 | IF(ll_print) WRITE(numout,*)'trcdib_wr kt=',kt,' kindic ',kindic |
---|
| 441 | |
---|
[2528] | 442 | IF( kt == nit000 ) THEN |
---|
[1011] | 443 | |
---|
| 444 | ! Define the NETCDF files for biological trends |
---|
| 445 | |
---|
[2528] | 446 | CALL dia_nam(clhstnam,nn_writebio,'biolog') |
---|
[1011] | 447 | IF(lwp)WRITE(numout,*) " Name of NETCDF file for biological trends ", clhstnam |
---|
| 448 | ! Horizontal grid : glamt and gphit |
---|
[1353] | 449 | CALL histbeg( clhstnam, jpi, glamt, jpj, gphit, & |
---|
[1011] | 450 | & iimi, iima-iimi+1, ijmi, ijma-ijmi+1, & |
---|
[2528] | 451 | & iiter, zjulian, zdt, nhoritb, nitb , domain_id=nidom, snc4chunks=snc4set ) |
---|
[1011] | 452 | ! Vertical grid for biological trends |
---|
[1353] | 453 | CALL histvert(nitb, 'deptht', 'Vertical T levels', 'm', ipk, gdept_0, ndepitb) |
---|
[1011] | 454 | |
---|
| 455 | ! Declare all the output fields as NETCDF variables |
---|
| 456 | ! biological trends |
---|
[1450] | 457 | DO jl = 1, jpdiabio |
---|
[2715] | 458 | cltra = TRIM( ctrbio(jl) ) ! short title for biological diagnostic |
---|
| 459 | cltral = TRIM( ctrbil(jl) ) ! long title for biological diagnostic |
---|
| 460 | cltrau = TRIM( ctrbiu(jl) ) ! UNIT for biological diagnostic |
---|
[1353] | 461 | CALL histdef( nitb, cltra, cltral, cltrau, jpi, jpj, nhoritb, & |
---|
[1011] | 462 | & ipk, 1, ipk, ndepitb, 32, clop, zsto, zout) |
---|
| 463 | END DO |
---|
| 464 | |
---|
| 465 | ! CLOSE netcdf Files |
---|
[2528] | 466 | CALL histend( nitb, snc4set ) |
---|
[1011] | 467 | |
---|
| 468 | IF(lwp) WRITE(numout,*) |
---|
| 469 | IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization in trcdib_wr' |
---|
| 470 | IF(ll_print) CALL FLUSH(numout ) |
---|
| 471 | ! |
---|
| 472 | ENDIF |
---|
| 473 | |
---|
| 474 | ! Start writing data |
---|
| 475 | ! ------------------ |
---|
| 476 | |
---|
| 477 | ! biological trends |
---|
[2528] | 478 | IF( lwp .AND. MOD( itmod, nn_writebio ) == 0 ) THEN |
---|
[1011] | 479 | WRITE(numout,*) 'trcdit_wr : write NetCDF biological trends at ', kt, 'time-step' |
---|
| 480 | WRITE(numout,*) '~~~~~~ ' |
---|
| 481 | ENDIF |
---|
| 482 | |
---|
[1450] | 483 | DO jl = 1, jpdiabio |
---|
[2715] | 484 | cltra = TRIM( ctrbio(jl) ) ! short title for biological diagnostic |
---|
[1450] | 485 | CALL histwrite(nitb, cltra, it, trbio(:,:,:,jl), ndimt50,ndext50) |
---|
[1011] | 486 | END DO |
---|
| 487 | |
---|
| 488 | ! Closing all files |
---|
| 489 | ! ----------------- |
---|
| 490 | IF( kt == nitend .OR. kindic < 0 ) CALL histclo( nitb ) |
---|
| 491 | ! |
---|
| 492 | END SUBROUTINE trcdib_wr |
---|
| 493 | |
---|
[335] | 494 | #else |
---|
[945] | 495 | !!---------------------------------------------------------------------- |
---|
| 496 | !! Dummy module : No passive tracer |
---|
| 497 | !!---------------------------------------------------------------------- |
---|
[335] | 498 | CONTAINS |
---|
[1457] | 499 | SUBROUTINE trc_dia( kt ) ! Empty routine |
---|
| 500 | INTEGER, INTENT(in) :: kt |
---|
[335] | 501 | END SUBROUTINE trc_dia |
---|
| 502 | #endif |
---|
| 503 | |
---|
[945] | 504 | !!====================================================================== |
---|
[335] | 505 | END MODULE trcdia |
---|