[941] | 1 | MODULE trcrad |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE trcrad *** |
---|
| 4 | !! Ocean passive tracers: correction of negative concentrations |
---|
| 5 | !!====================================================================== |
---|
| 6 | !! History : - ! 01-01 (O. Aumont & E. Kestenare) Original code |
---|
| 7 | !! 1.0 ! 04-03 (C. Ethe) free form F90 |
---|
| 8 | !!---------------------------------------------------------------------- |
---|
| 9 | #if defined key_top |
---|
| 10 | !!---------------------------------------------------------------------- |
---|
| 11 | !! 'key_top' TOP models |
---|
| 12 | !!---------------------------------------------------------------------- |
---|
| 13 | !! trc_rad : correction of negative concentrations |
---|
| 14 | !!---------------------------------------------------------------------- |
---|
| 15 | USE oce_trc ! ocean dynamics and tracers variables |
---|
[2528] | 16 | USE trc ! ocean passive tracers variables |
---|
[4990] | 17 | USE trd_oce |
---|
[2528] | 18 | USE trdtra |
---|
[941] | 19 | USE prtctl_trc ! Print control for debbuging |
---|
[10249] | 20 | #if defined key_tracer_budget |
---|
| 21 | USE iom |
---|
| 22 | #endif |
---|
[941] | 23 | |
---|
| 24 | IMPLICIT NONE |
---|
| 25 | PRIVATE |
---|
| 26 | |
---|
[1257] | 27 | PUBLIC trc_rad ! routine called by trcstp.F90 |
---|
[941] | 28 | |
---|
| 29 | !! * Substitutions |
---|
| 30 | # include "top_substitute.h90" |
---|
| 31 | !!---------------------------------------------------------------------- |
---|
[2528] | 32 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
[10246] | 33 | !! $Id$ |
---|
[2528] | 34 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[941] | 35 | !!---------------------------------------------------------------------- |
---|
| 36 | |
---|
| 37 | CONTAINS |
---|
| 38 | |
---|
| 39 | SUBROUTINE trc_rad( kt ) |
---|
| 40 | !!---------------------------------------------------------------------- |
---|
| 41 | !! *** ROUTINE trc_rad *** |
---|
| 42 | !! |
---|
| 43 | !! ** Purpose : "crappy" routine to correct artificial negative |
---|
| 44 | !! concentrations due to isopycnal scheme |
---|
| 45 | !! |
---|
| 46 | !! ** Method : - PISCES or LOBSTER: Set negative concentrations to zero |
---|
| 47 | !! while computing the corresponding tracer content that |
---|
| 48 | !! is added to the tracers. Then, adjust the tracer |
---|
| 49 | !! concentration using a multiplicative factor so that |
---|
| 50 | !! the total tracer concentration is preserved. |
---|
| 51 | !! - CFC: simply set to zero the negative CFC concentration |
---|
| 52 | !! (the total CFC content is not strictly preserved) |
---|
| 53 | !!---------------------------------------------------------------------- |
---|
| 54 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
| 55 | CHARACTER (len=22) :: charout |
---|
[10249] | 56 | ! +++>>> FABM |
---|
| 57 | INTEGER :: jn |
---|
| 58 | ! FABM <<<+++ |
---|
[941] | 59 | !!---------------------------------------------------------------------- |
---|
[3294] | 60 | ! |
---|
| 61 | IF( nn_timing == 1 ) CALL timing_start('trc_rad') |
---|
| 62 | ! |
---|
| 63 | IF( kt == nittrc000 ) THEN |
---|
[941] | 64 | IF(lwp) WRITE(numout,*) |
---|
| 65 | IF(lwp) WRITE(numout,*) 'trc_rad : Correct artificial negative concentrations ' |
---|
| 66 | IF(lwp) WRITE(numout,*) '~~~~~~~ ' |
---|
| 67 | ENDIF |
---|
| 68 | |
---|
[1257] | 69 | IF( lk_cfc ) CALL trc_rad_sms( kt, trb, trn, jp_cfc0 , jp_cfc1 ) ! CFC model |
---|
| 70 | IF( lk_c14b ) CALL trc_rad_sms( kt, trb, trn, jp_c14b0, jp_c14b1 ) ! bomb C14 |
---|
| 71 | IF( lk_pisces ) CALL trc_rad_sms( kt, trb, trn, jp_pcs0 , jp_pcs1, cpreserv='Y' ) ! PISCES model |
---|
| 72 | IF( lk_my_trc ) CALL trc_rad_sms( kt, trb, trn, jp_myt0 , jp_myt1 ) ! MY_TRC model |
---|
[10249] | 73 | ! +++>>> FABM |
---|
| 74 | IF( lk_fabm ) THEN |
---|
| 75 | DO jn=1,jp_fabm ! state variable loop |
---|
| 76 | IF (lk_rad_fabm(jn)) THEN |
---|
| 77 | CALL trc_rad_sms( kt, trb, trn, jn+jp_fabm_m1 , jn+jp_fabm_m1 ) |
---|
| 78 | ENDIF |
---|
| 79 | END DO |
---|
| 80 | END IF |
---|
| 81 | ! FABM <<<+++ |
---|
[1003] | 82 | ! |
---|
| 83 | IF(ln_ctl) THEN ! print mean trends (used for debugging) |
---|
| 84 | WRITE(charout, FMT="('rad')") |
---|
| 85 | CALL prt_ctl_trc_info( charout ) |
---|
| 86 | CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm ) |
---|
| 87 | ENDIF |
---|
| 88 | ! |
---|
[3294] | 89 | IF( nn_timing == 1 ) CALL timing_stop('trc_rad') |
---|
| 90 | ! |
---|
[1003] | 91 | END SUBROUTINE trc_rad |
---|
| 92 | |
---|
[1175] | 93 | SUBROUTINE trc_rad_sms( kt, ptrb, ptrn, jp_sms0, jp_sms1, cpreserv ) |
---|
[1003] | 94 | !!----------------------------------------------------------------------------- |
---|
| 95 | !! *** ROUTINE trc_rad_sms *** |
---|
| 96 | !! |
---|
| 97 | !! ** Purpose : "crappy" routine to correct artificial negative |
---|
| 98 | !! concentrations due to isopycnal scheme |
---|
| 99 | !! |
---|
| 100 | !! ** Method : 2 cases : |
---|
| 101 | !! - Set negative concentrations to zero while computing |
---|
| 102 | !! the corresponding tracer content that is added to the |
---|
| 103 | !! tracers. Then, adjust the tracer concentration using |
---|
| 104 | !! a multiplicative factor so that the total tracer |
---|
| 105 | !! concentration is preserved. |
---|
| 106 | !! - simply set to zero the negative CFC concentration |
---|
| 107 | !! (the total content of concentration is not strictly preserved) |
---|
| 108 | !!-------------------------------------------------------------------------------- |
---|
| 109 | !! Arguments |
---|
[1175] | 110 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
[1003] | 111 | INTEGER , INTENT( in ) :: & |
---|
| 112 | jp_sms0, & !: First index of the passive tracer model |
---|
| 113 | jp_sms1 !: Last index of the passive tracer model |
---|
| 114 | |
---|
| 115 | REAL(wp), DIMENSION (jpi,jpj,jpk,jptra), INTENT( inout ) :: & |
---|
| 116 | ptrb, ptrn !: before and now traceur concentration |
---|
| 117 | |
---|
| 118 | CHARACTER( len = 1) , INTENT(in), OPTIONAL :: & |
---|
| 119 | cpreserv !: flag to preserve content or not |
---|
| 120 | |
---|
| 121 | ! Local declarations |
---|
[3294] | 122 | INTEGER :: ji, jj, jk, jn ! dummy loop indices |
---|
| 123 | REAL(wp) :: ztrcorb, ztrmasb ! temporary scalars |
---|
[1003] | 124 | REAL(wp) :: zcoef, ztrcorn, ztrmasn ! " " |
---|
[3294] | 125 | REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrtrdb, ztrtrdn ! workspace arrays |
---|
[10249] | 126 | #if defined key_tracer_budget |
---|
| 127 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: ztrtrdb_m1 ! slwa |
---|
| 128 | #endif |
---|
[1257] | 129 | REAL(wp) :: zs2rdt |
---|
[1175] | 130 | LOGICAL :: lldebug = .FALSE. |
---|
[1003] | 131 | !!---------------------------------------------------------------------- |
---|
| 132 | |
---|
[3294] | 133 | |
---|
| 134 | IF( l_trdtrc ) CALL wrk_alloc( jpi, jpj, jpk, ztrtrdb, ztrtrdn ) |
---|
[10249] | 135 | #if defined key_tracer_budget |
---|
| 136 | IF( kt == nittrc000 .AND. l_trdtrc) THEN |
---|
| 137 | IF (.not. ALLOCATED(ztrtrdb_m1)) ALLOCATE( ztrtrdb_m1(jpi,jpj,jpk,jptra) ) ! slwa |
---|
| 138 | DO jn = jp_sms0, jp_sms1 |
---|
| 139 | IF( ln_rsttr .AND. & ! Restart: read in restart file |
---|
| 140 | iom_varid( numrtr, 'rdb_trend_'//TRIM(ctrcnm(jn)), ldstop = .FALSE. ) > 0 ) THEN |
---|
| 141 | IF(lwp) WRITE(numout,*) ' nittrc000-nn_dttrc RDB tracer trend read for',TRIM(ctrcnm(jn)) |
---|
| 142 | CALL iom_get( numrtr, jpdom_autoglo, 'rdb_trend_'//TRIM(ctrcnm(jn)), ztrtrdb_m1(:,:,:,jn) ) ! before tracer trend for rdb |
---|
| 143 | ELSE |
---|
| 144 | IF(lwp) WRITE(numout,*) ' no nittrc000-nn_dttrc RDB tracer trend for',TRIM(ctrcnm(jn)),', setting to 0.' |
---|
| 145 | ztrtrdb_m1(:,:,:,jn)=0.0 |
---|
| 146 | ENDIF |
---|
| 147 | END DO |
---|
| 148 | ENDIF |
---|
| 149 | #endif |
---|
[1003] | 150 | |
---|
| 151 | IF( PRESENT( cpreserv ) ) THEN ! total tracer concentration is preserved |
---|
| 152 | |
---|
| 153 | DO jn = jp_sms0, jp_sms1 |
---|
[3294] | 154 | ! ! =========== |
---|
[1193] | 155 | ztrcorb = 0.e0 ; ztrmasb = 0.e0 |
---|
| 156 | ztrcorn = 0.e0 ; ztrmasn = 0.e0 |
---|
[1003] | 157 | |
---|
[3294] | 158 | IF( l_trdtrc ) THEN |
---|
| 159 | ztrtrdb(:,:,:) = ptrb(:,:,:,jn) ! save input trb for trend computation |
---|
| 160 | ztrtrdn(:,:,:) = ptrn(:,:,:,jn) ! save input trn for trend computation |
---|
| 161 | ENDIF |
---|
| 162 | ! ! sum over the global domain |
---|
| 163 | ztrcorb = glob_sum( MIN( 0., ptrb(:,:,:,jn) ) * cvol(:,:,:) ) |
---|
| 164 | ztrcorn = glob_sum( MIN( 0., ptrn(:,:,:,jn) ) * cvol(:,:,:) ) |
---|
[1175] | 165 | |
---|
[3294] | 166 | ztrmasb = glob_sum( MAX( 0., ptrb(:,:,:,jn) ) * cvol(:,:,:) ) |
---|
| 167 | ztrmasn = glob_sum( MAX( 0., ptrn(:,:,:,jn) ) * cvol(:,:,:) ) |
---|
[1175] | 168 | |
---|
[941] | 169 | IF( ztrcorb /= 0 ) THEN |
---|
| 170 | zcoef = 1. + ztrcorb / ztrmasb |
---|
| 171 | DO jk = 1, jpkm1 |
---|
[3294] | 172 | ptrb(:,:,jk,jn) = MAX( 0., ptrb(:,:,jk,jn) ) |
---|
[1003] | 173 | ptrb(:,:,jk,jn) = ptrb(:,:,jk,jn) * zcoef * tmask(:,:,jk) |
---|
[941] | 174 | END DO |
---|
| 175 | ENDIF |
---|
| 176 | |
---|
| 177 | IF( ztrcorn /= 0 ) THEN |
---|
| 178 | zcoef = 1. + ztrcorn / ztrmasn |
---|
| 179 | DO jk = 1, jpkm1 |
---|
[3294] | 180 | ptrn(:,:,jk,jn) = MAX( 0., ptrn(:,:,jk,jn) ) |
---|
[1003] | 181 | ptrn(:,:,jk,jn) = ptrn(:,:,jk,jn) * zcoef * tmask(:,:,jk) |
---|
[941] | 182 | END DO |
---|
| 183 | ENDIF |
---|
| 184 | ! |
---|
[1175] | 185 | IF( l_trdtrc ) THEN |
---|
| 186 | ! |
---|
[1257] | 187 | zs2rdt = 1. / ( 2. * rdt ) |
---|
| 188 | ztrtrdb(:,:,:) = ( ptrb(:,:,:,jn) - ztrtrdb(:,:,:) ) * zs2rdt |
---|
| 189 | ztrtrdn(:,:,:) = ( ptrn(:,:,:,jn) - ztrtrdn(:,:,:) ) * zs2rdt |
---|
[10249] | 190 | #if defined key_tracer_budget |
---|
| 191 | ! slwa budget code |
---|
| 192 | DO jk = 1, jpkm1 |
---|
| 193 | ztrtrdb(:,:,jk) = ztrtrdb(:,:,jk) * e1t(:,:) * e2t(:,:) * fse3t(:,:,jk) |
---|
| 194 | ztrtrdn(:,:,jk) = ztrtrdn(:,:,jk) * e1t(:,:) * e2t(:,:) * fse3t(:,:,jk) |
---|
| 195 | END DO |
---|
| 196 | CALL trd_tra( kt, 'TRC', jn, jptra_radb, ztrtrdb_m1(:,:,:,jn) ) |
---|
| 197 | ztrtrdb_m1(:,:,:,jn)=ztrtrdb(:,:,:) |
---|
| 198 | #else |
---|
[4990] | 199 | CALL trd_tra( kt, 'TRC', jn, jptra_radb, ztrtrdb ) ! Asselin-like trend handling |
---|
[10249] | 200 | #endif |
---|
[4990] | 201 | CALL trd_tra( kt, 'TRC', jn, jptra_radn, ztrtrdn ) ! standard trend handling |
---|
[1175] | 202 | ! |
---|
| 203 | ENDIF |
---|
| 204 | |
---|
[941] | 205 | END DO |
---|
| 206 | ! |
---|
[1003] | 207 | ! |
---|
| 208 | ELSE ! total CFC content is not strictly preserved |
---|
| 209 | |
---|
| 210 | DO jn = jp_sms0, jp_sms1 |
---|
[1257] | 211 | |
---|
| 212 | IF( l_trdtrc ) THEN |
---|
| 213 | ztrtrdb(:,:,:) = ptrb(:,:,:,jn) ! save input trb for trend computation |
---|
| 214 | ztrtrdn(:,:,:) = ptrn(:,:,:,jn) ! save input trn for trend computation |
---|
| 215 | ENDIF |
---|
| 216 | |
---|
[1003] | 217 | DO jk = 1, jpkm1 |
---|
| 218 | DO jj = 1, jpj |
---|
| 219 | DO ji = 1, jpi |
---|
| 220 | ptrn(ji,jj,jk,jn) = MAX( 0. , ptrn(ji,jj,jk,jn) ) |
---|
| 221 | ptrb(ji,jj,jk,jn) = MAX( 0. , ptrb(ji,jj,jk,jn) ) |
---|
| 222 | END DO |
---|
| 223 | END DO |
---|
| 224 | END DO |
---|
[1257] | 225 | |
---|
| 226 | IF( l_trdtrc ) THEN |
---|
| 227 | ! |
---|
[3294] | 228 | zs2rdt = 1. / ( 2. * rdt * FLOAT( nn_dttrc ) ) |
---|
[1257] | 229 | ztrtrdb(:,:,:) = ( ptrb(:,:,:,jn) - ztrtrdb(:,:,:) ) * zs2rdt |
---|
| 230 | ztrtrdn(:,:,:) = ( ptrn(:,:,:,jn) - ztrtrdn(:,:,:) ) * zs2rdt |
---|
[10249] | 231 | #if defined key_tracer_budget |
---|
| 232 | ! slwa budget code |
---|
| 233 | DO jk = 1, jpkm1 |
---|
| 234 | ztrtrdb(:,:,jk) = ztrtrdb(:,:,jk) * e1t(:,:) * e2t(:,:) * fse3t(:,:,jk) |
---|
| 235 | ztrtrdn(:,:,jk) = ztrtrdn(:,:,jk) * e1t(:,:) * e2t(:,:) * fse3t(:,:,jk) |
---|
| 236 | END DO |
---|
| 237 | CALL trd_tra( kt, 'TRC', jn, jptra_radb, ztrtrdb_m1(:,:,:,jn) ) |
---|
| 238 | ztrtrdb_m1(:,:,:,jn)=ztrtrdb(:,:,:) |
---|
| 239 | #else |
---|
[4990] | 240 | CALL trd_tra( kt, 'TRC', jn, jptra_radb, ztrtrdb ) ! Asselin-like trend handling |
---|
[10249] | 241 | #endif |
---|
[4990] | 242 | CALL trd_tra( kt, 'TRC', jn, jptra_radn, ztrtrdn ) ! standard trend handling |
---|
[1257] | 243 | ! |
---|
| 244 | ENDIF |
---|
| 245 | ! |
---|
| 246 | ENDDO |
---|
[1003] | 247 | |
---|
[941] | 248 | ENDIF |
---|
| 249 | |
---|
[10249] | 250 | #if defined key_tracer_budget |
---|
| 251 | ! Write in the tracer restart file |
---|
| 252 | ! ******************************* |
---|
| 253 | IF( lrst_trc ) THEN |
---|
| 254 | IF(lwp) WRITE(numout,*) |
---|
| 255 | IF(lwp) WRITE(numout,*) 'trc : RDB trend at last time step for tracer budget written in tracer restart file ', & |
---|
| 256 | & 'at it= ', kt,' date= ', ndastp |
---|
| 257 | IF(lwp) WRITE(numout,*) '~~~~' |
---|
| 258 | DO jn = jp_sms0, jp_sms1 |
---|
| 259 | CALL iom_rstput( kt, nitrst, numrtw, 'rdb_trend_'//TRIM(ctrcnm(jn)), ztrtrdb_m1(:,:,:,jn) ) |
---|
| 260 | END DO |
---|
| 261 | ENDIF |
---|
| 262 | #endif |
---|
| 263 | |
---|
[3294] | 264 | IF( l_trdtrc ) CALL wrk_dealloc( jpi, jpj, jpk, ztrtrdb, ztrtrdn ) |
---|
[1175] | 265 | |
---|
[1003] | 266 | END SUBROUTINE trc_rad_sms |
---|
[941] | 267 | #else |
---|
| 268 | !!---------------------------------------------------------------------- |
---|
| 269 | !! Dummy module : NO TOP model |
---|
| 270 | !!---------------------------------------------------------------------- |
---|
| 271 | CONTAINS |
---|
| 272 | SUBROUTINE trc_rad( kt ) ! Empty routine |
---|
| 273 | INTEGER, INTENT(in) :: kt |
---|
| 274 | WRITE(*,*) 'trc_rad: You should not have seen this print! error?', kt |
---|
| 275 | END SUBROUTINE trc_rad |
---|
| 276 | #endif |
---|
| 277 | |
---|
| 278 | !!====================================================================== |
---|
| 279 | END MODULE trcrad |
---|