[268] | 1 | MODULE trcrst |
---|
[335] | 2 | !!====================================================================== |
---|
[1801] | 3 | !! *** MODULE trcrst *** |
---|
| 4 | !! TOP : Manage the passive tracer restart |
---|
[335] | 5 | !!====================================================================== |
---|
[1801] | 6 | !! History : - ! 1991-03 () original code |
---|
| 7 | !! 1.0 ! 2005-03 (O. Aumont, A. El Moussaoui) F90 |
---|
| 8 | !! - ! 2005-10 (C. Ethe) print control |
---|
| 9 | !! 2.0 ! 2005-10 (C. Ethe, G. Madec) revised architecture |
---|
[274] | 10 | !!---------------------------------------------------------------------- |
---|
[945] | 11 | #if defined key_top |
---|
[335] | 12 | !!---------------------------------------------------------------------- |
---|
[945] | 13 | !! 'key_top' TOP models |
---|
| 14 | !!---------------------------------------------------------------------- |
---|
[1801] | 15 | !!---------------------------------------------------------------------- |
---|
| 16 | !! trc_rst : Restart for passive tracer |
---|
| 17 | !!---------------------------------------------------------------------- |
---|
| 18 | !!---------------------------------------------------------------------- |
---|
| 19 | !! 'key_top' TOP models |
---|
| 20 | !!---------------------------------------------------------------------- |
---|
[945] | 21 | !! trc_rst_opn : open restart file |
---|
| 22 | !! trc_rst_read : read restart file |
---|
| 23 | !! trc_rst_wri : write restart file |
---|
| 24 | !!---------------------------------------------------------------------- |
---|
[335] | 25 | USE oce_trc |
---|
| 26 | USE trc |
---|
[2528] | 27 | USE trcnam_trp |
---|
[616] | 28 | USE iom |
---|
[2528] | 29 | USE daymod |
---|
[5707] | 30 | !! AXY (05/11/13): need these for MEDUSA to input/output benthic reservoirs |
---|
| 31 | USE sms_medusa |
---|
| 32 | USE trcsms_medusa |
---|
| 33 | !! |
---|
[335] | 34 | IMPLICIT NONE |
---|
| 35 | PRIVATE |
---|
[1801] | 36 | |
---|
[945] | 37 | PUBLIC trc_rst_opn ! called by ??? |
---|
| 38 | PUBLIC trc_rst_read ! called by ??? |
---|
| 39 | PUBLIC trc_rst_wri ! called by ??? |
---|
[3294] | 40 | PUBLIC trc_rst_cal |
---|
[1801] | 41 | |
---|
[350] | 42 | !! * Substitutions |
---|
[945] | 43 | # include "top_substitute.h90" |
---|
[335] | 44 | |
---|
[268] | 45 | CONTAINS |
---|
[335] | 46 | |
---|
[616] | 47 | SUBROUTINE trc_rst_opn( kt ) |
---|
| 48 | !!---------------------------------------------------------------------- |
---|
| 49 | !! *** trc_rst_opn *** |
---|
| 50 | !! |
---|
| 51 | !! ** purpose : output of sea-trc variable in a netcdf file |
---|
| 52 | !!---------------------------------------------------------------------- |
---|
| 53 | INTEGER, INTENT(in) :: kt ! number of iteration |
---|
| 54 | ! |
---|
| 55 | CHARACTER(LEN=20) :: clkt ! ocean time-step define as a character |
---|
| 56 | CHARACTER(LEN=50) :: clname ! trc output restart file name |
---|
| 57 | !!---------------------------------------------------------------------- |
---|
| 58 | ! |
---|
[2528] | 59 | IF( lk_offline ) THEN |
---|
[3294] | 60 | IF( kt == nittrc000 ) THEN |
---|
[2528] | 61 | lrst_trc = .FALSE. |
---|
| 62 | nitrst = nitend |
---|
| 63 | ENDIF |
---|
| 64 | |
---|
| 65 | IF( MOD( kt - 1, nstock ) == 0 ) THEN |
---|
[3294] | 66 | ! we use kt - 1 and not kt - nittrc000 to keep the same periodicity from the beginning of the experiment |
---|
[2528] | 67 | nitrst = kt + nstock - 1 ! define the next value of nitrst for restart writing |
---|
| 68 | IF( nitrst > nitend ) nitrst = nitend ! make sure we write a restart at the end of the run |
---|
| 69 | ENDIF |
---|
| 70 | ELSE |
---|
[3294] | 71 | IF( kt == nittrc000 ) lrst_trc = .FALSE. |
---|
[1655] | 72 | ENDIF |
---|
| 73 | |
---|
[2528] | 74 | ! to get better performances with NetCDF format: |
---|
| 75 | ! we open and define the tracer restart file one tracer time step before writing the data (-> at nitrst - 2*nn_dttrc + 1) |
---|
| 76 | ! except if we write tracer restart files every tracer time step or if a tracer restart file was writen at nitend - 2*nn_dttrc + 1 |
---|
[3294] | 77 | IF( kt == nitrst - 2*nn_dttrc .OR. nstock == nn_dttrc .OR. ( kt == nitend - nn_dttrc .AND. .NOT. lrst_trc ) ) THEN |
---|
[616] | 78 | ! beware of the format used to write kt (default is i8.8, that should be large enough) |
---|
[945] | 79 | IF( nitrst > 1.0e9 ) THEN ; WRITE(clkt,* ) nitrst |
---|
| 80 | ELSE ; WRITE(clkt,'(i8.8)') nitrst |
---|
[616] | 81 | ENDIF |
---|
| 82 | ! create the file |
---|
| 83 | IF(lwp) WRITE(numout,*) |
---|
[1254] | 84 | clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_trcrst_out) |
---|
[616] | 85 | IF(lwp) WRITE(numout,*) ' open trc restart.output NetCDF file: '//clname |
---|
| 86 | CALL iom_open( clname, numrtw, ldwrt = .TRUE., kiolib = jprstlib ) |
---|
| 87 | lrst_trc = .TRUE. |
---|
| 88 | ENDIF |
---|
| 89 | ! |
---|
| 90 | END SUBROUTINE trc_rst_opn |
---|
| 91 | |
---|
[1801] | 92 | SUBROUTINE trc_rst_read |
---|
[945] | 93 | !!---------------------------------------------------------------------- |
---|
[5707] | 94 | !! *** trc_read_opn *** |
---|
[335] | 95 | !! |
---|
[945] | 96 | !! ** purpose : read passive tracer fields in restart files |
---|
| 97 | !!---------------------------------------------------------------------- |
---|
[1801] | 98 | INTEGER :: jn |
---|
[5707] | 99 | !! AXY (05/11/13): temporary variables |
---|
| 100 | REAL(wp) :: fq0,fq1,fq2 |
---|
[1287] | 101 | |
---|
[945] | 102 | !!---------------------------------------------------------------------- |
---|
[3294] | 103 | ! |
---|
[945] | 104 | IF(lwp) WRITE(numout,*) |
---|
[3294] | 105 | IF(lwp) WRITE(numout,*) 'trc_rst_read : read data in the TOP restart file' |
---|
[945] | 106 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~' |
---|
[350] | 107 | |
---|
[945] | 108 | ! READ prognostic variables and computes diagnostic variable |
---|
[494] | 109 | DO jn = 1, jptra |
---|
[1801] | 110 | CALL iom_get( numrtr, jpdom_autoglo, 'TRN'//ctrcnm(jn), trn(:,:,:,jn) ) |
---|
[335] | 111 | END DO |
---|
[1077] | 112 | |
---|
[1287] | 113 | DO jn = 1, jptra |
---|
[1801] | 114 | CALL iom_get( numrtr, jpdom_autoglo, 'TRB'//ctrcnm(jn), trb(:,:,:,jn) ) |
---|
[1077] | 115 | END DO |
---|
[5707] | 116 | |
---|
| 117 | !! AXY (09/06/14): the ARCHER version of MEDUSA-2 does not include an equivalent |
---|
| 118 | !! call to MEDUSA-2 at this point; this suggests that the FCM |
---|
| 119 | !! version of NEMO date significantly earlier than the current |
---|
| 120 | !! version |
---|
| 121 | |
---|
| 122 | #if defined key_medusa |
---|
| 123 | !! AXY (13/01/12): check if the restart contains sediment fields; |
---|
| 124 | !! this is only relevant for simulations that include |
---|
| 125 | !! biogeochemistry and are restarted from earlier runs |
---|
| 126 | !! in which there was no sediment component |
---|
| 127 | !! |
---|
| 128 | IF( iom_varid( numrtr, 'B_SED_N', ldstop = .FALSE. ) > 0 ) THEN |
---|
| 129 | !! YES; in which case read them |
---|
| 130 | !! |
---|
| 131 | IF(lwp) WRITE(numout,*) ' MEDUSA sediment fields present - reading in ...' |
---|
| 132 | CALL iom_get( numrtr, jpdom_autoglo, 'B_SED_N', zb_sed_n(:,:) ) |
---|
| 133 | CALL iom_get( numrtr, jpdom_autoglo, 'N_SED_N', zn_sed_n(:,:) ) |
---|
| 134 | CALL iom_get( numrtr, jpdom_autoglo, 'B_SED_FE', zb_sed_fe(:,:) ) |
---|
| 135 | CALL iom_get( numrtr, jpdom_autoglo, 'N_SED_FE', zn_sed_fe(:,:) ) |
---|
| 136 | CALL iom_get( numrtr, jpdom_autoglo, 'B_SED_SI', zb_sed_si(:,:) ) |
---|
| 137 | CALL iom_get( numrtr, jpdom_autoglo, 'N_SED_SI', zn_sed_si(:,:) ) |
---|
| 138 | CALL iom_get( numrtr, jpdom_autoglo, 'B_SED_C', zb_sed_c(:,:) ) |
---|
| 139 | CALL iom_get( numrtr, jpdom_autoglo, 'N_SED_C', zn_sed_c(:,:) ) |
---|
| 140 | CALL iom_get( numrtr, jpdom_autoglo, 'B_SED_CA', zb_sed_ca(:,:) ) |
---|
| 141 | CALL iom_get( numrtr, jpdom_autoglo, 'N_SED_CA', zn_sed_ca(:,:) ) |
---|
| 142 | ELSE |
---|
| 143 | !! NO; in which case set them to zero |
---|
| 144 | !! |
---|
| 145 | IF(lwp) WRITE(numout,*) ' MEDUSA sediment fields absent - setting to zero ...' |
---|
| 146 | zb_sed_n(:,:) = 0.0 !! organic N |
---|
| 147 | zn_sed_n(:,:) = 0.0 |
---|
| 148 | zb_sed_fe(:,:) = 0.0 !! organic Fe |
---|
| 149 | zn_sed_fe(:,:) = 0.0 |
---|
| 150 | zb_sed_si(:,:) = 0.0 !! inorganic Si |
---|
| 151 | zn_sed_si(:,:) = 0.0 |
---|
| 152 | zb_sed_c(:,:) = 0.0 !! organic C |
---|
| 153 | zn_sed_c(:,:) = 0.0 |
---|
| 154 | zb_sed_ca(:,:) = 0.0 !! inorganic C |
---|
| 155 | zn_sed_ca(:,:) = 0.0 |
---|
| 156 | ENDIF |
---|
| 157 | !! |
---|
| 158 | !! calculate stats on these fields |
---|
| 159 | IF(lwp) WRITE(numout,*) ' MEDUSA sediment field stats (min, max, sum) ...' |
---|
| 160 | fq0 = MINVAL(zn_sed_n(:,:)) |
---|
| 161 | fq1 = MAXVAL(zn_sed_n(:,:)) |
---|
| 162 | fq2 = SUM(zn_sed_n(:,:)) |
---|
| 163 | if (lwp) write (numout,'(a,3f15.5)') 'Sediment N ', & |
---|
| 164 | & fq0, fq1, fq2 |
---|
| 165 | fq0 = MINVAL(zn_sed_fe(:,:)) |
---|
| 166 | fq1 = MAXVAL(zn_sed_fe(:,:)) |
---|
| 167 | fq2 = SUM(zn_sed_fe(:,:)) |
---|
| 168 | if (lwp) write (numout,'(a,3f15.5)') 'Sediment Fe ', & |
---|
| 169 | & fq0, fq1, fq2 |
---|
| 170 | fq0 = MINVAL(zn_sed_si(:,:)) |
---|
| 171 | fq1 = MAXVAL(zn_sed_si(:,:)) |
---|
| 172 | fq2 = SUM(zn_sed_si(:,:)) |
---|
| 173 | if (lwp) write (numout,'(a,3f15.5)') 'Sediment Si ', & |
---|
| 174 | & fq0, fq1, fq2 |
---|
| 175 | fq0 = MINVAL(zn_sed_c(:,:)) |
---|
| 176 | fq1 = MAXVAL(zn_sed_c(:,:)) |
---|
| 177 | fq2 = SUM(zn_sed_c(:,:)) |
---|
| 178 | if (lwp) write (numout,'(a,3f15.5)') 'Sediment C ', & |
---|
| 179 | & fq0, fq1, fq2 |
---|
| 180 | fq0 = MINVAL(zn_sed_ca(:,:)) |
---|
| 181 | fq1 = MAXVAL(zn_sed_ca(:,:)) |
---|
| 182 | fq2 = SUM(zn_sed_ca(:,:)) |
---|
| 183 | if (lwp) write (numout,'(a,3f15.5)') 'Sediment Ca ', & |
---|
| 184 | & fq0, fq1, fq2 |
---|
| 185 | #endif |
---|
| 186 | |
---|
[945] | 187 | ! |
---|
| 188 | END SUBROUTINE trc_rst_read |
---|
[494] | 189 | |
---|
[945] | 190 | SUBROUTINE trc_rst_wri( kt ) |
---|
| 191 | !!---------------------------------------------------------------------- |
---|
| 192 | !! *** trc_rst_wri *** |
---|
[335] | 193 | !! |
---|
[945] | 194 | !! ** purpose : write passive tracer fields in restart files |
---|
| 195 | !!---------------------------------------------------------------------- |
---|
| 196 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
[335] | 197 | !! |
---|
[1287] | 198 | INTEGER :: jn |
---|
| 199 | REAL(wp) :: zarak0 |
---|
[5707] | 200 | !! AXY (05/11/13): temporary variables |
---|
| 201 | REAL(wp) :: fq0,fq1,fq2 |
---|
[945] | 202 | !!---------------------------------------------------------------------- |
---|
[3294] | 203 | ! |
---|
[2528] | 204 | CALL iom_rstput( kt, nitrst, numrtw, 'rdttrc1', rdttrc(1) ) ! surface passive tracer time step |
---|
[1801] | 205 | ! prognostic variables |
---|
| 206 | ! -------------------- |
---|
[1100] | 207 | DO jn = 1, jptra |
---|
| 208 | CALL iom_rstput( kt, nitrst, numrtw, 'TRN'//ctrcnm(jn), trn(:,:,:,jn) ) |
---|
| 209 | END DO |
---|
[1077] | 210 | |
---|
[1100] | 211 | DO jn = 1, jptra |
---|
| 212 | CALL iom_rstput( kt, nitrst, numrtw, 'TRB'//ctrcnm(jn), trb(:,:,:,jn) ) |
---|
| 213 | END DO |
---|
[5707] | 214 | |
---|
| 215 | !! AXY (09/06/14): the ARCHER version of MEDUSA-2 does not include an equivalent |
---|
| 216 | !! call to MEDUSA-2 at this point; this suggests that the FCM |
---|
| 217 | !! version of NEMO date significantly earlier than the current |
---|
| 218 | !! version |
---|
| 219 | |
---|
| 220 | #if defined key_medusa |
---|
| 221 | !! AXY (13/01/12): write out "before" and "now" state of seafloor |
---|
| 222 | !! sediment pools into restart; this happens |
---|
| 223 | !! whether or not the pools are to be used by |
---|
| 224 | !! MEDUSA (which is controlled by a switch in the |
---|
| 225 | !! namelist_top file) |
---|
| 226 | !! |
---|
| 227 | IF(lwp) WRITE(numout,*) ' MEDUSA sediment fields - writing out ...' |
---|
| 228 | CALL iom_rstput( kt, nitrst, numrtw, 'B_SED_N', zb_sed_n(:,:) ) |
---|
| 229 | CALL iom_rstput( kt, nitrst, numrtw, 'N_SED_N', zn_sed_n(:,:) ) |
---|
| 230 | CALL iom_rstput( kt, nitrst, numrtw, 'B_SED_FE', zb_sed_fe(:,:) ) |
---|
| 231 | CALL iom_rstput( kt, nitrst, numrtw, 'N_SED_FE', zn_sed_fe(:,:) ) |
---|
| 232 | CALL iom_rstput( kt, nitrst, numrtw, 'B_SED_SI', zb_sed_si(:,:) ) |
---|
| 233 | CALL iom_rstput( kt, nitrst, numrtw, 'N_SED_SI', zn_sed_si(:,:) ) |
---|
| 234 | CALL iom_rstput( kt, nitrst, numrtw, 'B_SED_C', zb_sed_c(:,:) ) |
---|
| 235 | CALL iom_rstput( kt, nitrst, numrtw, 'N_SED_C', zn_sed_c(:,:) ) |
---|
| 236 | CALL iom_rstput( kt, nitrst, numrtw, 'B_SED_CA', zb_sed_ca(:,:) ) |
---|
| 237 | CALL iom_rstput( kt, nitrst, numrtw, 'N_SED_CA', zn_sed_ca(:,:) ) |
---|
| 238 | !! |
---|
| 239 | !! calculate stats on these fields |
---|
| 240 | IF(lwp) WRITE(numout,*) ' MEDUSA sediment field stats (min, max, sum) ...' |
---|
| 241 | fq0 = MINVAL(zn_sed_n(:,:)) |
---|
| 242 | fq1 = MAXVAL(zn_sed_n(:,:)) |
---|
| 243 | fq2 = SUM(zn_sed_n(:,:)) |
---|
| 244 | if (lwp) write (numout,'(a,3f15.5)') 'Sediment N ', & |
---|
| 245 | & fq0, fq1, fq2 |
---|
| 246 | fq0 = MINVAL(zn_sed_fe(:,:)) |
---|
| 247 | fq1 = MAXVAL(zn_sed_fe(:,:)) |
---|
| 248 | fq2 = SUM(zn_sed_fe(:,:)) |
---|
| 249 | if (lwp) write (numout,'(a,3f15.5)') 'Sediment Fe ', & |
---|
| 250 | & fq0, fq1, fq2 |
---|
| 251 | fq0 = MINVAL(zn_sed_si(:,:)) |
---|
| 252 | fq1 = MAXVAL(zn_sed_si(:,:)) |
---|
| 253 | fq2 = SUM(zn_sed_si(:,:)) |
---|
| 254 | if (lwp) write (numout,'(a,3f15.5)') 'Sediment Si ', & |
---|
| 255 | & fq0, fq1, fq2 |
---|
| 256 | fq0 = MINVAL(zn_sed_c(:,:)) |
---|
| 257 | fq1 = MAXVAL(zn_sed_c(:,:)) |
---|
| 258 | fq2 = SUM(zn_sed_c(:,:)) |
---|
| 259 | if (lwp) write (numout,'(a,3f15.5)') 'Sediment C ', & |
---|
| 260 | & fq0, fq1, fq2 |
---|
| 261 | fq0 = MINVAL(zn_sed_ca(:,:)) |
---|
| 262 | fq1 = MAXVAL(zn_sed_ca(:,:)) |
---|
| 263 | fq2 = SUM(zn_sed_ca(:,:)) |
---|
| 264 | if (lwp) write (numout,'(a,3f15.5)') 'Sediment Ca ', & |
---|
| 265 | & fq0, fq1, fq2 |
---|
| 266 | #endif |
---|
| 267 | |
---|
[3680] | 268 | ! |
---|
[1287] | 269 | IF( kt == nitrst ) THEN |
---|
[1119] | 270 | CALL trc_rst_stat ! statistics |
---|
[1100] | 271 | CALL iom_close( numrtw ) ! close the restart file (only at last time step) |
---|
[4990] | 272 | #if ! defined key_trdmxl_trc |
---|
[1100] | 273 | lrst_trc = .FALSE. |
---|
[1177] | 274 | #endif |
---|
[1287] | 275 | ENDIF |
---|
[945] | 276 | ! |
---|
[1801] | 277 | END SUBROUTINE trc_rst_wri |
---|
[268] | 278 | |
---|
[1801] | 279 | |
---|
[1287] | 280 | SUBROUTINE trc_rst_cal( kt, cdrw ) |
---|
| 281 | !!--------------------------------------------------------------------- |
---|
| 282 | !! *** ROUTINE trc_rst_cal *** |
---|
| 283 | !! |
---|
| 284 | !! ** Purpose : Read or write calendar in restart file: |
---|
| 285 | !! |
---|
| 286 | !! WRITE(READ) mode: |
---|
| 287 | !! kt : number of time step since the begining of the experiment at the |
---|
| 288 | !! end of the current(previous) run |
---|
| 289 | !! adatrj(0) : number of elapsed days since the begining of the experiment at the |
---|
| 290 | !! end of the current(previous) run (REAL -> keep fractions of day) |
---|
| 291 | !! ndastp : date at the end of the current(previous) run (coded as yyyymmdd integer) |
---|
| 292 | !! |
---|
| 293 | !! According to namelist parameter nrstdt, |
---|
[3294] | 294 | !! nn_rsttr = 0 no control on the date (nittrc000 is arbitrary). |
---|
| 295 | !! nn_rsttr = 1 we verify that nittrc000 is equal to the last |
---|
[1287] | 296 | !! time step of previous run + 1. |
---|
| 297 | !! In both those options, the exact duration of the experiment |
---|
| 298 | !! since the beginning (cumulated duration of all previous restart runs) |
---|
[3294] | 299 | !! is not stored in the restart and is assumed to be (nittrc000-1)*rdt. |
---|
[1287] | 300 | !! This is valid is the time step has remained constant. |
---|
| 301 | !! |
---|
[2528] | 302 | !! nn_rsttr = 2 the duration of the experiment in days (adatrj) |
---|
[1287] | 303 | !! has been stored in the restart file. |
---|
| 304 | !!---------------------------------------------------------------------- |
---|
| 305 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
| 306 | CHARACTER(len=*), INTENT(in) :: cdrw ! "READ"/"WRITE" flag |
---|
| 307 | ! |
---|
[3294] | 308 | INTEGER :: jlibalt = jprstlib |
---|
| 309 | LOGICAL :: llok |
---|
[2528] | 310 | REAL(wp) :: zkt, zrdttrc1 |
---|
[1287] | 311 | REAL(wp) :: zndastp |
---|
| 312 | |
---|
| 313 | ! Time domain : restart |
---|
| 314 | ! --------------------- |
---|
| 315 | |
---|
| 316 | IF( TRIM(cdrw) == 'READ' ) THEN |
---|
[3294] | 317 | |
---|
| 318 | IF(lwp) WRITE(numout,*) |
---|
| 319 | IF(lwp) WRITE(numout,*) 'trc_rst_cal : read the TOP restart file for calendar' |
---|
| 320 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~' |
---|
| 321 | |
---|
| 322 | IF ( jprstlib == jprstdimg ) THEN |
---|
| 323 | ! eventually read netcdf file (monobloc) for restarting on different number of processors |
---|
| 324 | ! if {cn_trcrst_in}.nc exists, then set jlibalt to jpnf90 |
---|
| 325 | INQUIRE( FILE = TRIM(cn_trcrst_in)//'.nc', EXIST = llok ) |
---|
| 326 | IF ( llok ) THEN ; jlibalt = jpnf90 ; ELSE ; jlibalt = jprstlib ; ENDIF |
---|
| 327 | ENDIF |
---|
| 328 | |
---|
| 329 | CALL iom_open( cn_trcrst_in, numrtr, kiolib = jlibalt ) |
---|
| 330 | |
---|
[1287] | 331 | CALL iom_get ( numrtr, 'kt', zkt ) ! last time-step of previous run |
---|
[4152] | 332 | |
---|
[1287] | 333 | IF(lwp) THEN |
---|
| 334 | WRITE(numout,*) ' *** Info read in restart : ' |
---|
| 335 | WRITE(numout,*) ' previous time-step : ', NINT( zkt ) |
---|
| 336 | WRITE(numout,*) ' *** restart option' |
---|
[2528] | 337 | SELECT CASE ( nn_rsttr ) |
---|
[3294] | 338 | CASE ( 0 ) ; WRITE(numout,*) ' nn_rsttr = 0 : no control of nittrc000' |
---|
| 339 | CASE ( 1 ) ; WRITE(numout,*) ' nn_rsttr = 1 : no control the date at nittrc000 (use ndate0 read in the namelist)' |
---|
[2528] | 340 | CASE ( 2 ) ; WRITE(numout,*) ' nn_rsttr = 2 : calendar parameters read in restart' |
---|
[1287] | 341 | END SELECT |
---|
| 342 | WRITE(numout,*) |
---|
| 343 | ENDIF |
---|
| 344 | ! Control of date |
---|
[3294] | 345 | IF( nittrc000 - NINT( zkt ) /= nn_dttrc .AND. nn_rsttr /= 0 ) & |
---|
| 346 | & CALL ctl_stop( ' ===>>>> : problem with nittrc000 for the restart', & |
---|
[2528] | 347 | & ' verify the restart file or rerun with nn_rsttr = 0 (namelist)' ) |
---|
| 348 | IF( lk_offline ) THEN ! set the date in offline mode |
---|
| 349 | ! Check dynamics and tracer time-step consistency and force Euler restart if changed |
---|
| 350 | IF( iom_varid( numrtr, 'rdttrc1', ldstop = .FALSE. ) > 0 ) THEN |
---|
| 351 | CALL iom_get( numrtr, 'rdttrc1', zrdttrc1 ) |
---|
[4152] | 352 | IF( zrdttrc1 /= rdt * nn_dttrc ) neuler = 0 |
---|
[2528] | 353 | ENDIF |
---|
| 354 | ! ! define ndastp and adatrj |
---|
[4152] | 355 | IF( nn_rsttr == 2 ) THEN |
---|
[2528] | 356 | CALL iom_get( numrtr, 'ndastp', zndastp ) |
---|
| 357 | ndastp = NINT( zndastp ) |
---|
| 358 | CALL iom_get( numrtr, 'adatrj', adatrj ) |
---|
| 359 | ELSE |
---|
| 360 | ndastp = ndate0 - 1 ! ndate0 read in the namelist in dom_nam |
---|
[3294] | 361 | adatrj = ( REAL( nittrc000-1, wp ) * rdttra(1) ) / rday |
---|
[2528] | 362 | ! note this is wrong if time step has changed during run |
---|
| 363 | ENDIF |
---|
| 364 | ! |
---|
| 365 | IF(lwp) THEN |
---|
| 366 | WRITE(numout,*) ' *** Info used values : ' |
---|
| 367 | WRITE(numout,*) ' date ndastp : ', ndastp |
---|
| 368 | WRITE(numout,*) ' number of elapsed days since the begining of run : ', adatrj |
---|
| 369 | WRITE(numout,*) |
---|
| 370 | ENDIF |
---|
| 371 | ! |
---|
| 372 | CALL day_init ! compute calendar |
---|
| 373 | ! |
---|
[1287] | 374 | ENDIF |
---|
| 375 | ! |
---|
| 376 | ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN |
---|
| 377 | ! |
---|
| 378 | IF( kt == nitrst ) THEN |
---|
| 379 | IF(lwp) WRITE(numout,*) |
---|
| 380 | IF(lwp) WRITE(numout,*) 'trc_wri : write the TOP restart file (NetCDF) at it= ', kt, ' date= ', ndastp |
---|
| 381 | IF(lwp) WRITE(numout,*) '~~~~~~~' |
---|
| 382 | ENDIF |
---|
| 383 | CALL iom_rstput( kt, nitrst, numrtw, 'kt' , REAL( kt , wp) ) ! time-step |
---|
| 384 | CALL iom_rstput( kt, nitrst, numrtw, 'ndastp' , REAL( ndastp, wp) ) ! date |
---|
| 385 | CALL iom_rstput( kt, nitrst, numrtw, 'adatrj' , adatrj ) ! number of elapsed days since |
---|
| 386 | ! ! the begining of the run [s] |
---|
| 387 | ENDIF |
---|
| 388 | |
---|
| 389 | END SUBROUTINE trc_rst_cal |
---|
| 390 | |
---|
[1119] | 391 | |
---|
| 392 | SUBROUTINE trc_rst_stat |
---|
| 393 | !!---------------------------------------------------------------------- |
---|
| 394 | !! *** trc_rst_stat *** |
---|
| 395 | !! |
---|
| 396 | !! ** purpose : Compute tracers statistics |
---|
| 397 | !!---------------------------------------------------------------------- |
---|
[3294] | 398 | INTEGER :: jk, jn |
---|
| 399 | REAL(wp) :: ztraf, zmin, zmax, zmean, zdrift |
---|
[1119] | 400 | !!---------------------------------------------------------------------- |
---|
| 401 | |
---|
| 402 | IF( lwp ) THEN |
---|
| 403 | WRITE(numout,*) |
---|
| 404 | WRITE(numout,*) ' ----TRACER STAT---- ' |
---|
| 405 | WRITE(numout,*) |
---|
| 406 | ENDIF |
---|
[3294] | 407 | ! |
---|
[1119] | 408 | DO jn = 1, jptra |
---|
[3294] | 409 | ztraf = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) |
---|
| 410 | zmin = MINVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) |
---|
| 411 | zmax = MAXVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) |
---|
[1119] | 412 | IF( lk_mpp ) THEN |
---|
[3294] | 413 | CALL mpp_min( zmin ) ! min over the global domain |
---|
| 414 | CALL mpp_max( zmax ) ! max over the global domain |
---|
[1119] | 415 | END IF |
---|
[3294] | 416 | zmean = ztraf / areatot |
---|
| 417 | zdrift = ( ( ztraf - trai(jn) ) / ( trai(jn) + 1.e-12 ) ) * 100._wp |
---|
| 418 | IF(lwp) WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), zmean, zmin, zmax, zdrift |
---|
[1119] | 419 | END DO |
---|
[3294] | 420 | WRITE(numout,*) |
---|
| 421 | 9000 FORMAT(' tracer nb :',i2,' name :',a10,' mean :',e18.10,' min :',e18.10, & |
---|
| 422 | & ' max :',e18.10,' drift :',e18.10, ' %') |
---|
| 423 | ! |
---|
[1119] | 424 | END SUBROUTINE trc_rst_stat |
---|
| 425 | |
---|
[268] | 426 | #else |
---|
[945] | 427 | !!---------------------------------------------------------------------- |
---|
| 428 | !! Dummy module : No passive tracer |
---|
| 429 | !!---------------------------------------------------------------------- |
---|
[335] | 430 | CONTAINS |
---|
[945] | 431 | SUBROUTINE trc_rst_read ! Empty routines |
---|
[616] | 432 | END SUBROUTINE trc_rst_read |
---|
[945] | 433 | SUBROUTINE trc_rst_wri( kt ) |
---|
[335] | 434 | INTEGER, INTENT ( in ) :: kt |
---|
[616] | 435 | WRITE(*,*) 'trc_rst_wri: You should not have seen this print! error?', kt |
---|
[945] | 436 | END SUBROUTINE trc_rst_wri |
---|
[268] | 437 | #endif |
---|
[945] | 438 | |
---|
[2528] | 439 | !!---------------------------------------------------------------------- |
---|
| 440 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
| 441 | !! $Id$ |
---|
| 442 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[945] | 443 | !!====================================================================== |
---|
[335] | 444 | END MODULE trcrst |
---|