[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 |
---|
| 20 | |
---|
| 21 | IMPLICIT NONE |
---|
| 22 | PRIVATE |
---|
| 23 | |
---|
[5836] | 24 | PUBLIC trc_rad |
---|
| 25 | PUBLIC trc_rad_ini |
---|
[941] | 26 | |
---|
[5836] | 27 | LOGICAL , PUBLIC :: ln_trcrad !: flag to artificially correct negative concentrations |
---|
| 28 | |
---|
[941] | 29 | !!---------------------------------------------------------------------- |
---|
[2528] | 30 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
[9235] | 31 | !! $Id$ |
---|
[2528] | 32 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[941] | 33 | !!---------------------------------------------------------------------- |
---|
| 34 | |
---|
| 35 | CONTAINS |
---|
| 36 | |
---|
| 37 | SUBROUTINE trc_rad( kt ) |
---|
| 38 | !!---------------------------------------------------------------------- |
---|
| 39 | !! *** ROUTINE trc_rad *** |
---|
| 40 | !! |
---|
| 41 | !! ** Purpose : "crappy" routine to correct artificial negative |
---|
| 42 | !! concentrations due to isopycnal scheme |
---|
| 43 | !! |
---|
| 44 | !! ** Method : - PISCES or LOBSTER: Set negative concentrations to zero |
---|
| 45 | !! while computing the corresponding tracer content that |
---|
| 46 | !! is added to the tracers. Then, adjust the tracer |
---|
| 47 | !! concentration using a multiplicative factor so that |
---|
| 48 | !! the total tracer concentration is preserved. |
---|
| 49 | !! - CFC: simply set to zero the negative CFC concentration |
---|
| 50 | !! (the total CFC content is not strictly preserved) |
---|
| 51 | !!---------------------------------------------------------------------- |
---|
| 52 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
| 53 | CHARACTER (len=22) :: charout |
---|
| 54 | !!---------------------------------------------------------------------- |
---|
[3294] | 55 | ! |
---|
| 56 | IF( nn_timing == 1 ) CALL timing_start('trc_rad') |
---|
| 57 | ! |
---|
| 58 | IF( kt == nittrc000 ) THEN |
---|
[941] | 59 | IF(lwp) WRITE(numout,*) |
---|
| 60 | IF(lwp) WRITE(numout,*) 'trc_rad : Correct artificial negative concentrations ' |
---|
| 61 | IF(lwp) WRITE(numout,*) '~~~~~~~ ' |
---|
| 62 | ENDIF |
---|
| 63 | |
---|
[7646] | 64 | IF( ln_age ) CALL trc_rad_sms( kt, trb, trn, jp_age , jp_age ) ! AGE |
---|
| 65 | IF( ll_cfc ) CALL trc_rad_sms( kt, trb, trn, jp_cfc0, jp_cfc1 ) ! CFC model |
---|
| 66 | IF( ln_c14 ) CALL trc_rad_sms( kt, trb, trn, jp_c14 , jp_c14 ) ! C14 |
---|
| 67 | IF( ln_pisces ) CALL trc_rad_sms( kt, trb, trn, jp_pcs0, jp_pcs1, cpreserv='Y' ) ! PISCES model |
---|
| 68 | IF( ln_my_trc ) CALL trc_rad_sms( kt, trb, trn, jp_myt0, jp_myt1 ) ! MY_TRC model |
---|
[941] | 69 | |
---|
[1003] | 70 | ! |
---|
| 71 | IF(ln_ctl) THEN ! print mean trends (used for debugging) |
---|
| 72 | WRITE(charout, FMT="('rad')") |
---|
| 73 | CALL prt_ctl_trc_info( charout ) |
---|
| 74 | CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm ) |
---|
| 75 | ENDIF |
---|
| 76 | ! |
---|
[3294] | 77 | IF( nn_timing == 1 ) CALL timing_stop('trc_rad') |
---|
| 78 | ! |
---|
[1003] | 79 | END SUBROUTINE trc_rad |
---|
| 80 | |
---|
[5836] | 81 | SUBROUTINE trc_rad_ini |
---|
| 82 | !!--------------------------------------------------------------------- |
---|
| 83 | !! *** ROUTINE trc _rad_ini *** |
---|
| 84 | !! |
---|
| 85 | !! ** Purpose : read namelist options |
---|
| 86 | !!---------------------------------------------------------------------- |
---|
| 87 | INTEGER :: ios ! Local integer output status for namelist read |
---|
| 88 | NAMELIST/namtrc_rad/ ln_trcrad |
---|
| 89 | !!---------------------------------------------------------------------- |
---|
| 90 | |
---|
| 91 | ! |
---|
| 92 | REWIND( numnat_ref ) ! namtrc_rad in reference namelist |
---|
| 93 | READ ( numnat_ref, namtrc_rad, IOSTAT = ios, ERR = 907) |
---|
| 94 | 907 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_rad in reference namelist', lwp ) |
---|
| 95 | |
---|
| 96 | REWIND( numnat_cfg ) ! namtrc_rad in configuration namelist |
---|
| 97 | READ ( numnat_cfg, namtrc_rad, IOSTAT = ios, ERR = 908 ) |
---|
| 98 | 908 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_rad in configuration namelist', lwp ) |
---|
| 99 | IF(lwm) WRITE ( numont, namtrc_rad ) |
---|
| 100 | |
---|
| 101 | IF(lwp) THEN ! ! Control print |
---|
| 102 | WRITE(numout,*) |
---|
| 103 | WRITE(numout,*) ' Namelist namtrc_rad : treatment of negative concentrations' |
---|
| 104 | WRITE(numout,*) ' correct artificially negative concen. or not ln_trcrad = ', ln_trcrad |
---|
| 105 | ENDIF |
---|
| 106 | ! |
---|
| 107 | END SUBROUTINE trc_rad_ini |
---|
| 108 | |
---|
[1175] | 109 | SUBROUTINE trc_rad_sms( kt, ptrb, ptrn, jp_sms0, jp_sms1, cpreserv ) |
---|
[1003] | 110 | !!----------------------------------------------------------------------------- |
---|
| 111 | !! *** ROUTINE trc_rad_sms *** |
---|
| 112 | !! |
---|
| 113 | !! ** Purpose : "crappy" routine to correct artificial negative |
---|
| 114 | !! concentrations due to isopycnal scheme |
---|
| 115 | !! |
---|
| 116 | !! ** Method : 2 cases : |
---|
| 117 | !! - Set negative concentrations to zero while computing |
---|
| 118 | !! the corresponding tracer content that is added to the |
---|
| 119 | !! tracers. Then, adjust the tracer concentration using |
---|
| 120 | !! a multiplicative factor so that the total tracer |
---|
| 121 | !! concentration is preserved. |
---|
| 122 | !! - simply set to zero the negative CFC concentration |
---|
| 123 | !! (the total content of concentration is not strictly preserved) |
---|
| 124 | !!-------------------------------------------------------------------------------- |
---|
| 125 | !! Arguments |
---|
[1175] | 126 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
[1003] | 127 | INTEGER , INTENT( in ) :: & |
---|
| 128 | jp_sms0, & !: First index of the passive tracer model |
---|
| 129 | jp_sms1 !: Last index of the passive tracer model |
---|
| 130 | |
---|
| 131 | REAL(wp), DIMENSION (jpi,jpj,jpk,jptra), INTENT( inout ) :: & |
---|
| 132 | ptrb, ptrn !: before and now traceur concentration |
---|
| 133 | |
---|
| 134 | CHARACTER( len = 1) , INTENT(in), OPTIONAL :: & |
---|
| 135 | cpreserv !: flag to preserve content or not |
---|
| 136 | |
---|
| 137 | ! Local declarations |
---|
[3294] | 138 | INTEGER :: ji, jj, jk, jn ! dummy loop indices |
---|
| 139 | REAL(wp) :: ztrcorb, ztrmasb ! temporary scalars |
---|
[1003] | 140 | REAL(wp) :: zcoef, ztrcorn, ztrmasn ! " " |
---|
[3294] | 141 | REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrtrdb, ztrtrdn ! workspace arrays |
---|
[1257] | 142 | REAL(wp) :: zs2rdt |
---|
[1175] | 143 | LOGICAL :: lldebug = .FALSE. |
---|
[1003] | 144 | !!---------------------------------------------------------------------- |
---|
| 145 | |
---|
[3294] | 146 | |
---|
| 147 | IF( l_trdtrc ) CALL wrk_alloc( jpi, jpj, jpk, ztrtrdb, ztrtrdn ) |
---|
[1003] | 148 | |
---|
| 149 | IF( PRESENT( cpreserv ) ) THEN ! total tracer concentration is preserved |
---|
| 150 | |
---|
| 151 | DO jn = jp_sms0, jp_sms1 |
---|
[3294] | 152 | ! ! =========== |
---|
[1193] | 153 | ztrcorb = 0.e0 ; ztrmasb = 0.e0 |
---|
| 154 | ztrcorn = 0.e0 ; ztrmasn = 0.e0 |
---|
[1003] | 155 | |
---|
[3294] | 156 | IF( l_trdtrc ) THEN |
---|
[7753] | 157 | ztrtrdb(:,:,:) = ptrb(:,:,:,jn) ! save input trb for trend computation |
---|
| 158 | ztrtrdn(:,:,:) = ptrn(:,:,:,jn) ! save input trn for trend computation |
---|
[3294] | 159 | ENDIF |
---|
| 160 | ! ! sum over the global domain |
---|
[7753] | 161 | ztrcorb = glob_sum( MIN( 0., ptrb(:,:,:,jn) ) * cvol(:,:,:) ) |
---|
| 162 | ztrcorn = glob_sum( MIN( 0., ptrn(:,:,:,jn) ) * cvol(:,:,:) ) |
---|
[1175] | 163 | |
---|
[7753] | 164 | ztrmasb = glob_sum( MAX( 0., ptrb(:,:,:,jn) ) * cvol(:,:,:) ) |
---|
| 165 | ztrmasn = glob_sum( MAX( 0., ptrn(:,:,:,jn) ) * cvol(:,:,:) ) |
---|
| 166 | |
---|
[941] | 167 | IF( ztrcorb /= 0 ) THEN |
---|
| 168 | zcoef = 1. + ztrcorb / ztrmasb |
---|
| 169 | DO jk = 1, jpkm1 |
---|
[7753] | 170 | ptrb(:,:,jk,jn) = MAX( 0., ptrb(:,:,jk,jn) ) |
---|
| 171 | ptrb(:,:,jk,jn) = ptrb(:,:,jk,jn) * zcoef * tmask(:,:,jk) |
---|
[941] | 172 | END DO |
---|
| 173 | ENDIF |
---|
| 174 | |
---|
| 175 | IF( ztrcorn /= 0 ) THEN |
---|
| 176 | zcoef = 1. + ztrcorn / ztrmasn |
---|
| 177 | DO jk = 1, jpkm1 |
---|
[7753] | 178 | ptrn(:,:,jk,jn) = MAX( 0., ptrn(:,:,jk,jn) ) |
---|
| 179 | ptrn(:,:,jk,jn) = ptrn(:,:,jk,jn) * zcoef * tmask(:,:,jk) |
---|
[941] | 180 | END DO |
---|
| 181 | ENDIF |
---|
| 182 | ! |
---|
[1175] | 183 | IF( l_trdtrc ) THEN |
---|
| 184 | ! |
---|
[1257] | 185 | zs2rdt = 1. / ( 2. * rdt ) |
---|
[7753] | 186 | ztrtrdb(:,:,:) = ( ptrb(:,:,:,jn) - ztrtrdb(:,:,:) ) * zs2rdt |
---|
| 187 | ztrtrdn(:,:,:) = ( ptrn(:,:,:,jn) - ztrtrdn(:,:,:) ) * zs2rdt |
---|
[4990] | 188 | CALL trd_tra( kt, 'TRC', jn, jptra_radb, ztrtrdb ) ! Asselin-like trend handling |
---|
| 189 | CALL trd_tra( kt, 'TRC', jn, jptra_radn, ztrtrdn ) ! standard trend handling |
---|
[1175] | 190 | ! |
---|
| 191 | ENDIF |
---|
| 192 | |
---|
[941] | 193 | END DO |
---|
| 194 | ! |
---|
[1003] | 195 | ! |
---|
| 196 | ELSE ! total CFC content is not strictly preserved |
---|
| 197 | |
---|
| 198 | DO jn = jp_sms0, jp_sms1 |
---|
[1257] | 199 | |
---|
| 200 | IF( l_trdtrc ) THEN |
---|
[7753] | 201 | ztrtrdb(:,:,:) = ptrb(:,:,:,jn) ! save input trb for trend computation |
---|
| 202 | ztrtrdn(:,:,:) = ptrn(:,:,:,jn) ! save input trn for trend computation |
---|
| 203 | ENDIF |
---|
[1257] | 204 | |
---|
[7753] | 205 | DO jk = 1, jpkm1 |
---|
| 206 | DO jj = 1, jpj |
---|
| 207 | DO ji = 1, jpi |
---|
| 208 | ptrn(ji,jj,jk,jn) = MAX( 0. , ptrn(ji,jj,jk,jn) ) |
---|
| 209 | ptrb(ji,jj,jk,jn) = MAX( 0. , ptrb(ji,jj,jk,jn) ) |
---|
| 210 | END DO |
---|
| 211 | END DO |
---|
| 212 | END DO |
---|
| 213 | |
---|
| 214 | IF( l_trdtrc ) THEN |
---|
[7698] | 215 | ! |
---|
| 216 | zs2rdt = 1. / ( 2. * rdt * REAL( nn_dttrc, wp ) ) |
---|
[7753] | 217 | ztrtrdb(:,:,:) = ( ptrb(:,:,:,jn) - ztrtrdb(:,:,:) ) * zs2rdt |
---|
| 218 | ztrtrdn(:,:,:) = ( ptrn(:,:,:,jn) - ztrtrdn(:,:,:) ) * zs2rdt |
---|
[4990] | 219 | CALL trd_tra( kt, 'TRC', jn, jptra_radb, ztrtrdb ) ! Asselin-like trend handling |
---|
| 220 | CALL trd_tra( kt, 'TRC', jn, jptra_radn, ztrtrdn ) ! standard trend handling |
---|
[1257] | 221 | ! |
---|
| 222 | ENDIF |
---|
| 223 | ! |
---|
| 224 | ENDDO |
---|
[1003] | 225 | |
---|
[941] | 226 | ENDIF |
---|
| 227 | |
---|
[3294] | 228 | IF( l_trdtrc ) CALL wrk_dealloc( jpi, jpj, jpk, ztrtrdb, ztrtrdn ) |
---|
[1175] | 229 | |
---|
[1003] | 230 | END SUBROUTINE trc_rad_sms |
---|
[941] | 231 | #else |
---|
| 232 | !!---------------------------------------------------------------------- |
---|
| 233 | !! Dummy module : NO TOP model |
---|
| 234 | !!---------------------------------------------------------------------- |
---|
| 235 | CONTAINS |
---|
| 236 | SUBROUTINE trc_rad( kt ) ! Empty routine |
---|
| 237 | INTEGER, INTENT(in) :: kt |
---|
| 238 | WRITE(*,*) 'trc_rad: You should not have seen this print! error?', kt |
---|
| 239 | END SUBROUTINE trc_rad |
---|
| 240 | #endif |
---|
| 241 | |
---|
| 242 | !!====================================================================== |
---|
| 243 | END MODULE trcrad |
---|