[268] | 1 | MODULE trcdta |
---|
| 2 | !!====================================================================== |
---|
[433] | 3 | !! *** MODULE trcdta *** |
---|
[945] | 4 | !! TOP : reads passive tracer data |
---|
[268] | 5 | !!===================================================================== |
---|
[945] | 6 | !! History : 1.0 ! 2002-04 (O. Aumont) original code |
---|
| 7 | !! - ! 2004-03 (C. Ethe) module |
---|
| 8 | !! - ! 2005-03 (O. Aumont, A. El Moussaoui) F90 |
---|
[274] | 9 | !!---------------------------------------------------------------------- |
---|
[945] | 10 | #if defined key_top && defined key_dtatrc |
---|
[268] | 11 | !!---------------------------------------------------------------------- |
---|
[945] | 12 | !! 'key_top' and 'key_dtatrc' TOP model + passive tracer data |
---|
[268] | 13 | !!---------------------------------------------------------------------- |
---|
[1077] | 14 | !! trc_dta : read ocean passive tracer data |
---|
[268] | 15 | !!---------------------------------------------------------------------- |
---|
[335] | 16 | USE oce_trc |
---|
[945] | 17 | USE par_trc |
---|
[335] | 18 | USE trc |
---|
| 19 | USE lib_print |
---|
[945] | 20 | USE iom |
---|
[268] | 21 | |
---|
| 22 | IMPLICIT NONE |
---|
| 23 | PRIVATE |
---|
| 24 | |
---|
[1077] | 25 | PUBLIC trc_dta ! called in trcini.F90 and trcdmp.F90 |
---|
[268] | 26 | |
---|
[1804] | 27 | LOGICAL , PUBLIC, PARAMETER :: lk_dtatrc = .TRUE. !: temperature data flag |
---|
[945] | 28 | REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk,jptra) :: trdta !: tracer data at given time-step |
---|
[268] | 29 | |
---|
[945] | 30 | REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,2) :: tracdta ! tracer data at two consecutive times |
---|
| 31 | INTEGER , DIMENSION(jptra) :: nlectr !: switch for reading once |
---|
| 32 | INTEGER , DIMENSION(jptra) :: ntrc1 !: number of first month when reading 12 monthly value |
---|
| 33 | INTEGER , DIMENSION(jptra) :: ntrc2 !: number of second month when reading 12 monthly value |
---|
[268] | 34 | |
---|
| 35 | !! * Substitutions |
---|
[945] | 36 | # include "top_substitute.h90" |
---|
[268] | 37 | !!---------------------------------------------------------------------- |
---|
[945] | 38 | !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005) |
---|
[1152] | 39 | !! $Id$ |
---|
[945] | 40 | !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) |
---|
[268] | 41 | !!---------------------------------------------------------------------- |
---|
| 42 | |
---|
| 43 | CONTAINS |
---|
| 44 | |
---|
| 45 | !!---------------------------------------------------------------------- |
---|
| 46 | !! Default case NetCDF file |
---|
| 47 | !!---------------------------------------------------------------------- |
---|
[335] | 48 | |
---|
[1011] | 49 | SUBROUTINE trc_dta( kt ) |
---|
[335] | 50 | !!---------------------------------------------------------------------- |
---|
[1011] | 51 | !! *** ROUTINE trc_dta *** |
---|
[335] | 52 | !! |
---|
| 53 | !! ** Purpose : Reads passive tracer data (Levitus monthly data) |
---|
| 54 | !! |
---|
| 55 | !! ** Method : Read on unit numtr the interpolated tracer concentra- |
---|
| 56 | !! tion onto the global grid. Data begin at january. |
---|
| 57 | !! The value is centered at the middle of month. |
---|
| 58 | !! In the opa model, kt=1 agree with january 1. |
---|
| 59 | !! At each time step, a linear interpolation is applied between |
---|
| 60 | !! two monthly values. |
---|
| 61 | !!---------------------------------------------------------------------- |
---|
[268] | 62 | INTEGER, INTENT( in ) :: kt ! ocean time-step |
---|
[945] | 63 | !! |
---|
| 64 | CHARACTER (len=39) :: clname(jptra) |
---|
[1804] | 65 | INTEGER, PARAMETER :: & |
---|
| 66 | jpmonth = 12 ! number of months |
---|
[945] | 67 | INTEGER :: ji, jj, jn, jl |
---|
| 68 | INTEGER :: imois, iman, i15, ik ! temporary integers |
---|
| 69 | REAL(wp) :: zxy, zl |
---|
[335] | 70 | !!---------------------------------------------------------------------- |
---|
[268] | 71 | |
---|
| 72 | DO jn = 1, jptra |
---|
| 73 | |
---|
[335] | 74 | IF( lutini(jn) ) THEN |
---|
[268] | 75 | |
---|
[493] | 76 | IF ( kt == nittrc000 ) THEN |
---|
[335] | 77 | !! 3D tracer data |
---|
| 78 | IF(lwp)WRITE(numout,*) |
---|
[433] | 79 | IF(lwp)WRITE(numout,*) ' dta_trc: reading tracer' |
---|
| 80 | IF(lwp)WRITE(numout,*) ' data file ', jn, ctrcnm(jn) |
---|
[335] | 81 | IF(lwp)WRITE(numout,*) |
---|
| 82 | nlectr(jn) = 0 |
---|
| 83 | ENDIF |
---|
| 84 | ! Initialization |
---|
[1804] | 85 | iman = jpmonth |
---|
[1077] | 86 | i15 = nday / 16 |
---|
[335] | 87 | imois = nmonth + i15 -1 |
---|
| 88 | IF( imois == 0 ) imois = iman |
---|
[268] | 89 | |
---|
[493] | 90 | |
---|
[335] | 91 | ! First call kt=nit000 |
---|
| 92 | ! -------------------- |
---|
[268] | 93 | |
---|
[493] | 94 | IF ( kt == nittrc000 .AND. nlectr(jn) == 0 ) THEN |
---|
[335] | 95 | ntrc1(jn) = 0 |
---|
[493] | 96 | IF(lwp) WRITE(numout,*) ' trc_dta : Levitus tracer data monthly fields' |
---|
[335] | 97 | ! open file |
---|
[945] | 98 | # if defined key_pisces |
---|
[1645] | 99 | clname(jn) = 'data_1m_'//TRIM(ctrcnm(jn))//'_nomask' |
---|
[945] | 100 | # else |
---|
[1645] | 101 | clname(jn) = TRIM(ctrcnm(jn)) |
---|
[945] | 102 | # endif |
---|
[493] | 103 | CALL iom_open ( clname(jn), numtr(jn) ) |
---|
[268] | 104 | |
---|
| 105 | ENDIF |
---|
| 106 | |
---|
[945] | 107 | # if defined key_pisces |
---|
[335] | 108 | ! Read montly file |
---|
[493] | 109 | IF( ( kt == nittrc000 .AND. nlectr(jn) == 0) .OR. imois /= ntrc1(jn) ) THEN |
---|
[335] | 110 | nlectr(jn) = 1 |
---|
[268] | 111 | |
---|
[335] | 112 | ! Calendar computation |
---|
[268] | 113 | |
---|
[335] | 114 | ! ntrc1 number of the first file record used in the simulation |
---|
| 115 | ! ntrc2 number of the last file record |
---|
[268] | 116 | |
---|
[335] | 117 | ntrc1(jn) = imois |
---|
| 118 | ntrc2(jn) = ntrc1(jn) + 1 |
---|
| 119 | ntrc1(jn) = MOD( ntrc1(jn), iman ) |
---|
| 120 | IF ( ntrc1(jn) == 0 ) ntrc1(jn) = iman |
---|
| 121 | ntrc2(jn) = MOD( ntrc2(jn), iman ) |
---|
| 122 | IF ( ntrc2(jn) == 0 ) ntrc2(jn) = iman |
---|
| 123 | IF(lwp) WRITE(numout,*) 'first record file used ntrc1 ', ntrc1(jn) |
---|
| 124 | IF(lwp) WRITE(numout,*) 'last record file used ntrc2 ', ntrc2(jn) |
---|
[268] | 125 | |
---|
[335] | 126 | ! Read montly passive tracer data Levitus |
---|
[268] | 127 | |
---|
[493] | 128 | CALL iom_get ( numtr(jn), jpdom_data, ctrcnm(jn), tracdta(:,:,:,jn,1), ntrc1(jn) ) |
---|
| 129 | CALL iom_get ( numtr(jn), jpdom_data, ctrcnm(jn), tracdta(:,:,:,jn,2), ntrc2(jn) ) |
---|
[268] | 130 | |
---|
[335] | 131 | IF(lwp) THEN |
---|
| 132 | WRITE(numout,*) |
---|
| 133 | WRITE(numout,*) ' read tracer data ', ctrcnm(jn),' ok' |
---|
| 134 | WRITE(numout,*) |
---|
| 135 | ENDIF |
---|
[268] | 136 | |
---|
[335] | 137 | ! Apply Mask |
---|
| 138 | DO jl = 1, 2 |
---|
| 139 | tracdta(:,:,: ,jn,jl) = tracdta(:,:,:,jn,jl) * tmask(:,:,:) |
---|
| 140 | tracdta(:,:,jpk,jn,jl) = 0. |
---|
[493] | 141 | IF( ln_zps ) THEN ! z-coord. with partial steps |
---|
[335] | 142 | DO jj = 1, jpj ! interpolation of temperature at the last level |
---|
| 143 | DO ji = 1, jpi |
---|
| 144 | ik = mbathy(ji,jj) - 1 |
---|
| 145 | IF( ik > 2 ) THEN |
---|
[1645] | 146 | zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) ) |
---|
| 147 | tracdta(ji,jj,ik,jn,jl) = (1.-zl) * tracdta(ji,jj,ik ,jn,jl) & |
---|
[945] | 148 | & + zl * tracdta(ji,jj,ik-1,jn,jl) |
---|
[335] | 149 | ENDIF |
---|
| 150 | END DO |
---|
| 151 | END DO |
---|
| 152 | ENDIF |
---|
[268] | 153 | |
---|
| 154 | END DO |
---|
[335] | 155 | |
---|
[268] | 156 | ENDIF |
---|
| 157 | |
---|
[335] | 158 | IF(lwp) THEN |
---|
[945] | 159 | WRITE(numout,*) ctrcnm(jn), 'Levitus month ', ntrc1(jn), ntrc2(jn) |
---|
[335] | 160 | WRITE(numout,*) |
---|
[945] | 161 | WRITE(numout,*) ' Levitus month = ', ntrc1(jn), ' level = 1' |
---|
[335] | 162 | CALL prihre( tracdta(1,1,1,jn,1), jpi, jpj, 1, jpi, 20, 1 & |
---|
[945] | 163 | & ,jpj, 20, 1., numout ) |
---|
| 164 | WRITE(numout,*) ' Levitus month = ', ntrc1(jn), ' level = ',jpk/2 |
---|
[335] | 165 | CALL prihre( tracdta(1,1,jpk/2,jn,1), jpi, jpj, 1, jpi, & |
---|
[945] | 166 | & 20, 1, jpj, 20, 1., numout ) |
---|
| 167 | WRITE(numout,*) ' Levitus month = ',ntrc1(jn),' level = ',jpkm1 |
---|
[335] | 168 | CALL prihre( tracdta(1,1,jpkm1,jn,1), jpi, jpj, 1, jpi, & |
---|
[945] | 169 | & 20, 1, jpj, 20, 1., numout ) |
---|
[335] | 170 | ENDIF |
---|
[268] | 171 | |
---|
[335] | 172 | ! At every time step compute temperature data |
---|
| 173 | zxy = FLOAT( nday + 15 - 30 * i15 ) / 30. |
---|
[945] | 174 | trdta(:,:,:,jn) = ( 1. - zxy ) * tracdta(:,:,:,jn,1) & |
---|
| 175 | & + zxy * tracdta(:,:,:,jn,2) |
---|
[268] | 176 | |
---|
[945] | 177 | IF( jn == jpno3 ) trdta(:,:,:,jn) = trdta(:,:,:,jn) * 7.6e-6 |
---|
| 178 | IF( jn == jpdic ) trdta(:,:,:,jn) = trdta(:,:,:,jn) * 1.0e-6 |
---|
| 179 | IF( jn == jptal ) trdta(:,:,:,jn) = trdta(:,:,:,jn) * 1.0e-6 |
---|
| 180 | IF( jn == jpoxy ) trdta(:,:,:,jn) = trdta(:,:,:,jn) * 44.6e-6 |
---|
| 181 | IF( jn == jpsil ) trdta(:,:,:,jn) = trdta(:,:,:,jn) * 1.0e-6 |
---|
| 182 | IF( jn == jppo4 ) trdta(:,:,:,jn) = trdta(:,:,:,jn) * 122.0e-6 |
---|
[493] | 183 | |
---|
| 184 | ! Close the file |
---|
| 185 | ! -------------- |
---|
| 186 | |
---|
[945] | 187 | IF( kt == nitend ) CALL iom_close( numtr(jn) ) |
---|
[493] | 188 | |
---|
[945] | 189 | # else |
---|
[433] | 190 | ! Read init file only |
---|
[493] | 191 | IF( kt == nittrc000 ) THEN |
---|
[1804] | 192 | ntrc1(jn) = 1 |
---|
[493] | 193 | CALL iom_get ( numtr(jn), jpdom_data, ctrcnm(jn), trdta(:,:,:,jn), ntrc1(jn) ) |
---|
| 194 | trdta(:,:,:,jn) = trdta(:,:,:,jn) * tmask(:,:,:) |
---|
| 195 | CALL iom_close ( numtr(jn) ) |
---|
[433] | 196 | ENDIF |
---|
[945] | 197 | # endif |
---|
[268] | 198 | |
---|
[945] | 199 | ENDIF |
---|
[268] | 200 | |
---|
[945] | 201 | END DO |
---|
| 202 | ! |
---|
[1011] | 203 | END SUBROUTINE trc_dta |
---|
[268] | 204 | |
---|
| 205 | #else |
---|
| 206 | !!---------------------------------------------------------------------- |
---|
[945] | 207 | !! Dummy module NO 3D passive tracer data |
---|
[268] | 208 | !!---------------------------------------------------------------------- |
---|
[1804] | 209 | LOGICAL , PUBLIC, PARAMETER :: lk_dtatrc = .FALSE. !: temperature data flag |
---|
[268] | 210 | CONTAINS |
---|
[1011] | 211 | SUBROUTINE trc_dta( kt ) ! Empty routine |
---|
| 212 | WRITE(*,*) 'trc_dta: You should not have seen this print! error?', kt |
---|
| 213 | END SUBROUTINE trc_dta |
---|
[268] | 214 | #endif |
---|
| 215 | |
---|
[945] | 216 | !!====================================================================== |
---|
[268] | 217 | END MODULE trcdta |
---|