[4804] | 1 | MODULE trdmxl_trc_rst |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE trdmxl_rst *** |
---|
| 4 | !! Ocean dynamic : Input/Output files for restart on mixed-layer diagnostics |
---|
| 5 | !!====================================================================== |
---|
| 6 | !! History : 9.0 ! 07-03 (C. Deltel) Original code |
---|
| 7 | !!---------------------------------------------------------------------- |
---|
| 8 | |
---|
| 9 | #if defined key_top && defined key_trdmxl_trc |
---|
| 10 | !!---------------------------------------------------------------------- |
---|
| 11 | USE in_out_manager ! I/O manager |
---|
| 12 | USE iom ! I/O module |
---|
| 13 | USE trc ! for nn_dttrc ctrcnm |
---|
| 14 | USE trdmxl_trc_oce ! for lk_trdmxl_trc |
---|
| 15 | |
---|
| 16 | IMPLICIT NONE |
---|
| 17 | PRIVATE |
---|
| 18 | |
---|
| 19 | PUBLIC trd_mxl_trc_rst_read ! routine called by trd_mxl_init |
---|
| 20 | PUBLIC trd_mxl_trc_rst_write ! routine called by step.F90 |
---|
| 21 | |
---|
| 22 | INTEGER :: nummldw_trc ! logical unit for mld restart |
---|
| 23 | !!--------------------------------------------------------------------------------- |
---|
| 24 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
[7566] | 25 | !! $Id$ |
---|
[4804] | 26 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
| 27 | !!--------------------------------------------------------------------------------- |
---|
| 28 | |
---|
| 29 | CONTAINS |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | SUBROUTINE trd_mxl_trc_rst_write( kt ) |
---|
| 33 | !!-------------------------------------------------------------------------------- |
---|
| 34 | !! *** SUBROUTINE trd_mxl_rst_wri *** |
---|
| 35 | !! |
---|
| 36 | !! ** Purpose : Write mixed-layer diagnostics restart fields. |
---|
| 37 | !!-------------------------------------------------------------------------------- |
---|
| 38 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
| 39 | ! |
---|
| 40 | CHARACTER(LEN=20) :: clkt ! ocean time-step deine as a character |
---|
[5341] | 41 | CHARACTER(LEN=50) :: clname ! output restart file name |
---|
| 42 | CHARACTER(LEN=256) :: clpath ! full path to restart file |
---|
[4804] | 43 | CHARACTER (len=35) :: charout |
---|
| 44 | INTEGER :: jl, jk, jn ! loop indice |
---|
| 45 | !!-------------------------------------------------------------------------------- |
---|
| 46 | |
---|
| 47 | IF( kt == nitrst - nn_dttrc .OR. nitend - nit000 + 1 < 2 * nn_dttrc ) THEN ! idem trcrst.F90 |
---|
| 48 | IF( nitrst > 1.0e9 ) THEN |
---|
| 49 | WRITE(clkt,*) nitrst |
---|
| 50 | ELSE |
---|
| 51 | WRITE(clkt,'(i8.8)') nitrst |
---|
| 52 | ENDIF |
---|
| 53 | clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_trdrst_trc_out) |
---|
[5341] | 54 | clpath = TRIM(cn_trcrst_outdir) |
---|
| 55 | IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' |
---|
| 56 | IF(lwp) WRITE(numout,*) ' open ocean restart_mld_trc NetCDF 'TRIM(clpath)//TRIM(clname) |
---|
| 57 | CALL iom_open( TRIM(clpath)//TRIM(clname), nummldw_trc, ldwrt = .TRUE., kiolib = jprstlib ) |
---|
[4804] | 58 | ENDIF |
---|
| 59 | |
---|
| 60 | IF( kt == nitend .AND. lk_trdmxl_trc ) THEN |
---|
| 61 | |
---|
| 62 | IF( kt == nitend .AND. lwp ) THEN |
---|
| 63 | WRITE(numout,*) |
---|
| 64 | WRITE(numout,*) 'trdmxl_trc_rst: output for ML diags. restart, with trd_mxl_trc_rst_write routine' |
---|
| 65 | WRITE(numout,*) '~~~~~~~~~~~~~~' |
---|
| 66 | WRITE(numout,*) |
---|
| 67 | ENDIF |
---|
| 68 | |
---|
| 69 | IF( ln_trdmxl_trc_instant ) THEN |
---|
| 70 | ! |
---|
| 71 | DO jn = 1, jptra |
---|
| 72 | CALL iom_rstput( kt, nitrst, nummldw_trc, 'tmlbb_trc_' //ctrcnm(jn), tmlbb_trc (:,:,jn) ) |
---|
| 73 | CALL iom_rstput( kt, nitrst, nummldw_trc, 'tmlbn_trc_' //ctrcnm(jn), tmlbn_trc (:,:,jn) ) |
---|
| 74 | CALL iom_rstput( kt, nitrst, nummldw_trc, 'tmlatfb_trc_'//ctrcnm(jn), tmlatfb_trc(:,:,jn) ) |
---|
| 75 | CALL iom_rstput( kt, nitrst, nummldw_trc, 'tmlradb_trc_'//ctrcnm(jn), tmlradb_trc(:,:,jn) ) |
---|
| 76 | END DO |
---|
| 77 | ! |
---|
| 78 | ELSE |
---|
| 79 | ! |
---|
| 80 | CALL iom_rstput( kt, nitrst, nummldw_trc, 'rmldbn_trc', rmldbn_trc ) ! 2D x 1 |
---|
| 81 | |
---|
| 82 | ! ! =========== |
---|
| 83 | DO jn = 1, jptra ! tracer loop |
---|
| 84 | ! ! =========== |
---|
| 85 | |
---|
| 86 | CALL iom_rstput( kt, nitrst, nummldw_trc, 'tmlatfb_trc_' //ctrcnm(jn), tmlatfb_trc (:,:,jn) ) ! 2D x jptra |
---|
| 87 | CALL iom_rstput( kt, nitrst, nummldw_trc, 'tmlbb_trc_' //ctrcnm(jn), tmlbb_trc (:,:,jn) ) ! 2D x jptra |
---|
| 88 | CALL iom_rstput( kt, nitrst, nummldw_trc, 'tmlradb_trc_' //ctrcnm(jn), tmlradb_trc (:,:,jn) ) ! 2D x jptra |
---|
| 89 | |
---|
| 90 | CALL iom_rstput( kt, nitrst, nummldw_trc, 'tmlbn_trc_' //ctrcnm(jn), tmlbn_trc (:,:,jn) ) ! 2D x jptra |
---|
| 91 | CALL iom_rstput( kt, nitrst, nummldw_trc, 'tml_sumb_trc_'//ctrcnm(jn), tml_sumb_trc(:,:,jn) ) ! 2D x jptra |
---|
| 92 | |
---|
| 93 | DO jk = 1, jpltrd_trc |
---|
| 94 | IF( jk < 10 ) THEN |
---|
| 95 | WRITE(charout,FMT="('tmltrd_csum_ub_trc_', A3, '_', I1)") ctrcnm(jn), jk |
---|
| 96 | ELSE |
---|
| 97 | WRITE(charout,FMT="('tmltrd_csum_ub_trc_', A3, '_', I2)") ctrcnm(jn), jk |
---|
| 98 | ENDIF |
---|
| 99 | CALL iom_rstput( kt, nitrst, nummldw_trc, charout, tmltrd_csum_ub_trc(:,:,jk,jn) ) |
---|
| 100 | END DO |
---|
| 101 | |
---|
| 102 | CALL iom_rstput( kt, nitrst, nummldw_trc, 'tmltrd_atf_sumb_trc_'//ctrcnm(jn) , & |
---|
| 103 | & tmltrd_atf_sumb_trc(:,:,jn) ) ! 2D x jptra |
---|
| 104 | |
---|
| 105 | CALL iom_rstput( kt, nitrst, nummldw_trc, 'tmltrd_rad_sumb_trc_'//ctrcnm(jn) , & |
---|
| 106 | & tmltrd_rad_sumb_trc(:,:,jn) ) ! 2D x jptra |
---|
| 107 | ! ! =========== |
---|
| 108 | END DO ! tracer loop |
---|
| 109 | ! ! =========== |
---|
| 110 | #if defined key_pisces_reduced |
---|
| 111 | DO jl = 1, jp_pisces_trd |
---|
| 112 | CALL iom_rstput( kt, nitrst, nummldw_trc, 'tmltrd_csum_ub_bio'//ctrd_bio(jl,2), tmltrd_csum_ub_bio(:,:,jl) ) |
---|
| 113 | ENDDO |
---|
| 114 | #endif |
---|
| 115 | |
---|
| 116 | ENDIF |
---|
| 117 | |
---|
| 118 | CALL iom_close( nummldw_trc ) |
---|
| 119 | lrst_trc = .TRUE. |
---|
| 120 | |
---|
| 121 | ENDIF |
---|
| 122 | |
---|
| 123 | END SUBROUTINE trd_mxl_trc_rst_write |
---|
| 124 | |
---|
| 125 | |
---|
| 126 | SUBROUTINE trd_mxl_trc_rst_read |
---|
| 127 | !!---------------------------------------------------------------------------- |
---|
| 128 | !! *** SUBROUTINE trd_mxl_rst_lec *** |
---|
| 129 | !! |
---|
| 130 | !! ** Purpose : Read file for mixed-layer diagnostics restart. |
---|
| 131 | !!---------------------------------------------------------------------------- |
---|
| 132 | INTEGER :: inum ! temporary logical unit |
---|
| 133 | ! |
---|
| 134 | CHARACTER (len=35) :: charout |
---|
| 135 | INTEGER :: jk, jn, jl ! loop indice |
---|
| 136 | INTEGER :: jlibalt = jprstlib |
---|
| 137 | LOGICAL :: llok |
---|
[5341] | 138 | CHARACTER(LEN=256) :: clpath ! full path to restart file |
---|
[4804] | 139 | !!----------------------------------------------------------------------------- |
---|
| 140 | |
---|
| 141 | IF(lwp) THEN |
---|
| 142 | WRITE(numout,*) |
---|
| 143 | WRITE(numout,*) ' trd_mxl_trc_rst_read : read the NetCDF MLD restart file' |
---|
| 144 | WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~' |
---|
| 145 | ENDIF |
---|
| 146 | |
---|
[5341] | 147 | clpath = TRIM(cn_trcrst_indir) |
---|
| 148 | IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' |
---|
| 149 | |
---|
[4804] | 150 | IF ( jprstlib == jprstdimg ) THEN |
---|
| 151 | ! eventually read netcdf file (monobloc) for restarting on different number of processors |
---|
| 152 | ! if {cn_trdrst_trc_in}.nc exists, then set jlibalt to jpnf90 |
---|
[5341] | 153 | INQUIRE( FILE = TRIM(clpath)//TRIM(cn_trdrst_trc_in)//'.nc', EXIST = llok ) |
---|
[4804] | 154 | IF ( llok ) THEN ; jlibalt = jpnf90 ; ELSE ; jlibalt = jprstlib ; ENDIF |
---|
| 155 | ENDIF |
---|
| 156 | |
---|
[5341] | 157 | CALL iom_open( TRIM(clpath)//TRIM(cn_trdrst_trc_in), inum, kiolib = jlibalt ) |
---|
[4804] | 158 | |
---|
| 159 | IF( ln_trdmxl_trc_instant ) THEN |
---|
| 160 | |
---|
| 161 | DO jn = 1, jptra |
---|
| 162 | CALL iom_get( inum, jpdom_autoglo, 'tmlbb_trc_' //ctrcnm(jn), tmlbb_trc (:,:,jn) ) |
---|
| 163 | CALL iom_get( inum, jpdom_autoglo, 'tmlbn_trc_' //ctrcnm(jn), tmlbn_trc (:,:,jn) ) |
---|
| 164 | CALL iom_get( inum, jpdom_autoglo, 'tmlatfb_trc_'//ctrcnm(jn), tmlatfb_trc(:,:,jn) ) |
---|
| 165 | CALL iom_get( inum, jpdom_autoglo, 'tmlradb_trc_'//ctrcnm(jn), tmlradb_trc(:,:,jn) ) |
---|
| 166 | END DO |
---|
| 167 | |
---|
| 168 | ELSE |
---|
| 169 | CALL iom_get( inum, jpdom_autoglo, 'rmldbn_trc', rmldbn_trc ) ! needed for rmld_sum |
---|
| 170 | |
---|
| 171 | ! ! =========== |
---|
| 172 | DO jn = 1, jptra ! tracer loop |
---|
| 173 | ! ! =========== |
---|
| 174 | CALL iom_get( inum, jpdom_autoglo, 'tmlatfb_trc_' //ctrcnm(jn), tmlatfb_trc(:,:,jn) ) |
---|
| 175 | CALL iom_get( inum, jpdom_autoglo, 'tmlbb_trc_' //ctrcnm(jn), tmlbb_trc (:,:,jn) ) |
---|
| 176 | CALL iom_get( inum, jpdom_autoglo, 'tmlradb_trc_' //ctrcnm(jn), tmlradb_trc(:,:,jn) ) |
---|
| 177 | |
---|
| 178 | CALL iom_get( inum, jpdom_autoglo, 'tmlbn_trc_' //ctrcnm(jn), tmlbn_trc (:,:,jn) ) ! needed for tml_sum |
---|
| 179 | CALL iom_get( inum, jpdom_autoglo, 'tml_sumb_trc_'//ctrcnm(jn), tml_sumb_trc(:,:,jn) ) |
---|
| 180 | |
---|
| 181 | DO jk = 1, jpltrd_trc |
---|
| 182 | IF( jk < 10 ) THEN |
---|
| 183 | WRITE(charout,FMT="('tmltrd_csum_ub_trc_', A3, '_', I1)") ctrcnm(jn), jk |
---|
| 184 | ELSE |
---|
| 185 | WRITE(charout,FMT="('tmltrd_csum_ub_trc_', A3, '_', I2)") ctrcnm(jn), jk |
---|
| 186 | ENDIF |
---|
| 187 | CALL iom_get( inum, jpdom_autoglo, charout, tmltrd_csum_ub_trc(:,:,jk,jn) ) |
---|
| 188 | END DO |
---|
| 189 | |
---|
| 190 | CALL iom_get( inum, jpdom_autoglo, 'tmltrd_atf_sumb_trc_'//ctrcnm(jn) , & |
---|
| 191 | & tmltrd_atf_sumb_trc(:,:,jn) ) |
---|
| 192 | |
---|
| 193 | CALL iom_get( inum, jpdom_autoglo, 'tmltrd_rad_sumb_trc_'//ctrcnm(jn) , & |
---|
| 194 | & tmltrd_rad_sumb_trc(:,:,jn) ) |
---|
| 195 | ! ! =========== |
---|
| 196 | END DO ! tracer loop |
---|
| 197 | ! ! =========== |
---|
| 198 | |
---|
| 199 | #if defined key_pisces_reduced |
---|
| 200 | DO jl = 1, jp_pisces_trd |
---|
| 201 | CALL iom_get( inum, jpdom_autoglo, 'tmltrd_csum_ub_bio'//ctrd_bio(jl,2), tmltrd_csum_ub_bio(:,:,jl) ) |
---|
| 202 | ENDDO |
---|
| 203 | #endif |
---|
| 204 | |
---|
| 205 | CALL iom_close( inum ) |
---|
| 206 | ENDIF |
---|
| 207 | |
---|
| 208 | END SUBROUTINE trd_mxl_trc_rst_read |
---|
| 209 | |
---|
| 210 | #else |
---|
| 211 | !!================================================================================= |
---|
| 212 | !! *** MODULE trdmxl_rst *** |
---|
| 213 | !! Ocean dynamic : Input/Output files for restart on mixed-layer diagnostics |
---|
| 214 | !!================================================================================= |
---|
| 215 | CONTAINS |
---|
| 216 | SUBROUTINE trd_mxl_trc_rst_opn( kt ) |
---|
| 217 | WRITE(*,*) 'trd_mxl_trc_rst_opn: You should not have seen this print! error?', kt |
---|
| 218 | END SUBROUTINE trd_mxl_trc_rst_opn |
---|
| 219 | SUBROUTINE trd_mxl_trc_rst_write( kt ) ! No ML diags ==> empty routine |
---|
| 220 | WRITE(*,*) 'trd_mxl_trc_rst_wri: You should not have seen this print! error?', kt |
---|
| 221 | END SUBROUTINE trd_mxl_trc_rst_write |
---|
| 222 | SUBROUTINE trd_mxl_trc_rst_read ! No ML Diags ==> empty routine |
---|
| 223 | END SUBROUTINE trd_mxl_trc_rst_read |
---|
| 224 | #endif |
---|
| 225 | |
---|
| 226 | !!================================================================================= |
---|
| 227 | END MODULE trdmxl_trc_rst |
---|