[941] | 1 | MODULE trcsbc |
---|
| 2 | !!============================================================================== |
---|
| 3 | !! *** MODULE trcsbc *** |
---|
| 4 | !! Ocean passive tracers: surface boundary condition |
---|
[1175] | 5 | !!====================================================================== |
---|
[2528] | 6 | !! History : 8.2 ! 1998-10 (G. Madec, G. Roullet, M. Imbard) Original code |
---|
| 7 | !! 8.2 ! 2001-02 (D. Ludicone) sea ice and free surface |
---|
| 8 | !! 8.5 ! 2002-06 (G. Madec) F90: Free form and module |
---|
| 9 | !! 9.0 ! 2004-03 (C. Ethe) adapted for passive tracers |
---|
| 10 | !! ! 2006-08 (C. Deltel) Diagnose ML trends for passive tracers |
---|
[941] | 11 | !!============================================================================== |
---|
| 12 | #if defined key_top |
---|
| 13 | !!---------------------------------------------------------------------- |
---|
| 14 | !! 'key_top' TOP models |
---|
| 15 | !!---------------------------------------------------------------------- |
---|
| 16 | !! trc_sbc : update the tracer trend at ocean surface |
---|
| 17 | !!---------------------------------------------------------------------- |
---|
[2715] | 18 | USE oce_trc ! ocean dynamics and active tracers variables |
---|
| 19 | USE trc ! ocean passive tracers variables |
---|
| 20 | USE prtctl_trc ! Print control for debbuging |
---|
[5385] | 21 | USE iom |
---|
[4990] | 22 | USE trd_oce |
---|
[2528] | 23 | USE trdtra |
---|
[941] | 24 | |
---|
| 25 | IMPLICIT NONE |
---|
| 26 | PRIVATE |
---|
| 27 | |
---|
[2715] | 28 | PUBLIC trc_sbc ! routine called by step.F90 |
---|
[941] | 29 | |
---|
| 30 | !! * Substitutions |
---|
[5836] | 31 | # include "vectopt_loop_substitute.h90" |
---|
[941] | 32 | !!---------------------------------------------------------------------- |
---|
[2528] | 33 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
[1152] | 34 | !! $Id$ |
---|
[2715] | 35 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[941] | 36 | !!---------------------------------------------------------------------- |
---|
| 37 | CONTAINS |
---|
| 38 | |
---|
| 39 | SUBROUTINE trc_sbc ( kt ) |
---|
| 40 | !!---------------------------------------------------------------------- |
---|
| 41 | !! *** ROUTINE trc_sbc *** |
---|
| 42 | !! |
---|
| 43 | !! ** Purpose : Compute the tracer surface boundary condition trend of |
---|
| 44 | !! (concentration/dilution effect) and add it to the general |
---|
| 45 | !! trend of tracer equations. |
---|
| 46 | !! |
---|
| 47 | !! ** Method : |
---|
| 48 | !! * concentration/dilution effect: |
---|
| 49 | !! The surface freshwater flux modify the ocean volume |
---|
| 50 | !! and thus the concentration of a tracer as : |
---|
| 51 | !! tra = tra + emp * trn / e3t for k=1 |
---|
| 52 | !! where emp, the surface freshwater budget (evaporation minus |
---|
[3680] | 53 | !! precipitation ) given in kg/m2/s is divided |
---|
[1739] | 54 | !! by 1035 kg/m3 (density of ocean water) to obtain m/s. |
---|
[941] | 55 | !! |
---|
| 56 | !! ** Action : - Update the 1st level of tra with the trend associated |
---|
| 57 | !! with the tracer surface boundary condition |
---|
| 58 | !! |
---|
| 59 | !!---------------------------------------------------------------------- |
---|
[2715] | 60 | ! |
---|
[941] | 61 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
[2715] | 62 | ! |
---|
[7508] | 63 | INTEGER :: ji, jj, jk, jn ! dummy loop indices |
---|
[5385] | 64 | REAL(wp) :: zse3t, zrtrn, zratio, zfact ! temporary scalars |
---|
| 65 | REAL(wp) :: zswitch, zftra, zcd, zdtra, ztfx, ztra ! temporary scalars |
---|
[941] | 66 | CHARACTER (len=22) :: charout |
---|
[3625] | 67 | REAL(wp), POINTER, DIMENSION(:,: ) :: zsfx |
---|
[3294] | 68 | REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrtrd |
---|
[5385] | 69 | |
---|
[3294] | 70 | !!--------------------------------------------------------------------- |
---|
| 71 | ! |
---|
| 72 | IF( nn_timing == 1 ) CALL timing_start('trc_sbc') |
---|
| 73 | ! |
---|
| 74 | ! Allocate temporary workspace |
---|
[6140] | 75 | CALL wrk_alloc( jpi,jpj, zsfx ) |
---|
| 76 | IF( l_trdtrc ) CALL wrk_alloc( jpi,jpj,jpk, ztrtrd ) |
---|
[5385] | 77 | ! |
---|
| 78 | zrtrn = 1.e-15_wp |
---|
[941] | 79 | |
---|
[5385] | 80 | SELECT CASE( nn_ice_embd ) ! levitating or embedded sea-ice option |
---|
| 81 | CASE( 0 ) ; zswitch = 1 ! (0) standard levitating sea-ice : salt exchange only |
---|
| 82 | CASE( 1, 2 ) ; zswitch = 0 ! (1) levitating sea-ice: salt and volume exchange but no pressure effect |
---|
[5836] | 83 | ! ! (2) embedded sea-ice : salt and volume fluxes and pressure |
---|
[5385] | 84 | END SELECT |
---|
| 85 | |
---|
| 86 | IF( ln_top_euler) THEN |
---|
[6140] | 87 | r2dt = rdttrc ! = rdttrc (use Euler time stepping) |
---|
[5385] | 88 | ELSE |
---|
| 89 | IF( neuler == 0 .AND. kt == nittrc000 ) THEN ! at nittrc000 |
---|
[6140] | 90 | r2dt = rdttrc ! = rdttrc (restarting with Euler time stepping) |
---|
[5385] | 91 | ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN ! at nittrc000 or nittrc000+1 |
---|
[6140] | 92 | r2dt = 2. * rdttrc ! = 2 rdttrc (leapfrog) |
---|
[5385] | 93 | ENDIF |
---|
| 94 | ENDIF |
---|
| 95 | |
---|
| 96 | |
---|
[3294] | 97 | IF( kt == nittrc000 ) THEN |
---|
[941] | 98 | IF(lwp) WRITE(numout,*) |
---|
| 99 | IF(lwp) WRITE(numout,*) 'trc_sbc : Passive tracers surface boundary condition' |
---|
| 100 | IF(lwp) WRITE(numout,*) '~~~~~~~ ' |
---|
[5385] | 101 | |
---|
| 102 | IF( ln_rsttr .AND. & ! Restart: read in restart file |
---|
| 103 | iom_varid( numrtr, 'sbc_'//TRIM(ctrcnm(1))//'_b', ldstop = .FALSE. ) > 0 ) THEN |
---|
| 104 | IF(lwp) WRITE(numout,*) ' nittrc000-nn_dttrc surface tracer content forcing fields red in the restart file' |
---|
| 105 | zfact = 0.5_wp |
---|
| 106 | DO jn = 1, jptra |
---|
| 107 | CALL iom_get( numrtr, jpdom_autoglo, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc_b(:,:,jn) ) ! before tracer content sbc |
---|
| 108 | END DO |
---|
| 109 | ELSE ! No restart or restart not found: Euler forward time stepping |
---|
| 110 | zfact = 1._wp |
---|
[7525] | 111 | !$OMP PARALLEL DO schedule(static) private(jn,jj,ji) |
---|
[7508] | 112 | DO jn = 1, jptra |
---|
| 113 | DO jj = 1, jpj |
---|
| 114 | DO ji = 1, jpi |
---|
| 115 | sbc_trc_b(ji,jj,jn) = 0._wp |
---|
| 116 | END DO |
---|
| 117 | END DO |
---|
| 118 | END DO |
---|
[5385] | 119 | ENDIF |
---|
| 120 | ELSE ! Swap of forcing fields |
---|
| 121 | IF( ln_top_euler ) THEN |
---|
| 122 | zfact = 1._wp |
---|
[7525] | 123 | !$OMP PARALLEL DO schedule(static) private(jn,jj,ji) |
---|
[7508] | 124 | DO jn = 1, jptra |
---|
| 125 | DO jj = 1, jpj |
---|
| 126 | DO ji = 1, jpi |
---|
| 127 | sbc_trc_b(ji,jj,jn) = 0._wp |
---|
| 128 | END DO |
---|
| 129 | END DO |
---|
| 130 | END DO |
---|
[5385] | 131 | ELSE |
---|
| 132 | zfact = 0.5_wp |
---|
[7525] | 133 | !$OMP PARALLEL DO schedule(static) private(jn,jj,ji) |
---|
[7508] | 134 | DO jn = 1, jptra |
---|
| 135 | DO jj = 1, jpj |
---|
| 136 | DO ji = 1, jpi |
---|
| 137 | sbc_trc_b(ji,jj,jn) = sbc_trc(ji,jj,jn) |
---|
| 138 | END DO |
---|
| 139 | END DO |
---|
| 140 | END DO |
---|
[5385] | 141 | ENDIF |
---|
| 142 | ! |
---|
[941] | 143 | ENDIF |
---|
| 144 | |
---|
[3680] | 145 | ! Coupling online : river runoff is added to the horizontal divergence (hdivn) in the subroutine sbc_rnf_div |
---|
| 146 | ! one only consider the concentration/dilution effect due to evaporation minus precipitation + freezing/melting of sea-ice |
---|
[3719] | 147 | ! Coupling offline : runoff are in emp which contains E-P-R |
---|
| 148 | ! |
---|
[6140] | 149 | IF( .NOT. lk_offline .AND. .NOT.ln_linssh ) THEN ! online coupling with vvl |
---|
[7508] | 150 | !$OMP PARALLEL DO schedule(static) private(jj,ji) |
---|
| 151 | DO jj = 1, jpj |
---|
| 152 | DO ji = 1, jpi |
---|
| 153 | zsfx(ji,jj) = 0._wp |
---|
| 154 | END DO |
---|
| 155 | END DO |
---|
[3719] | 156 | ELSE ! online coupling free surface or offline with free surface |
---|
[7508] | 157 | !$OMP PARALLEL DO schedule(static) private(jj,ji) |
---|
| 158 | DO jj = 1, jpj |
---|
| 159 | DO ji = 1, jpi |
---|
| 160 | zsfx(ji,jj) = emp(ji,jj) |
---|
| 161 | END DO |
---|
| 162 | END DO |
---|
[3680] | 163 | ENDIF |
---|
[2528] | 164 | |
---|
[941] | 165 | ! 0. initialization |
---|
| 166 | DO jn = 1, jptra |
---|
[2528] | 167 | ! |
---|
[7037] | 168 | IF( l_trdtrc ) THEN |
---|
[7508] | 169 | !$OMP PARALLEL DO schedule(static) private(jk,jj,ji) |
---|
| 170 | DO jk = 1, jpk |
---|
| 171 | DO jj = 1, jpj |
---|
| 172 | DO ji = 1, jpi |
---|
| 173 | ztrtrd(ji,jj,jk) = tra(ji,jj,jk,jn) ! save trends |
---|
| 174 | END DO |
---|
| 175 | END DO |
---|
| 176 | END DO ! online coupling free surface or offline with free surface |
---|
[7037] | 177 | END IF |
---|
[5385] | 178 | IF ( nn_ice_tr == -1 ) THEN ! No tracers in sea ice (null concentration in sea ice) |
---|
| 179 | |
---|
[7037] | 180 | !$OMP PARALLEL DO schedule(static) private(jj, ji) |
---|
[5385] | 181 | DO jj = 2, jpj |
---|
| 182 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
| 183 | sbc_trc(ji,jj,jn) = zsfx(ji,jj) * r1_rau0 * trn(ji,jj,1,jn) |
---|
| 184 | END DO |
---|
| 185 | END DO |
---|
| 186 | |
---|
| 187 | ELSE |
---|
[7037] | 188 | !$OMP PARALLEL DO schedule(static) private(jj,ji,zse3t,zftra,zcd,ztfx,zdtra,zratio) |
---|
[5385] | 189 | DO jj = 2, jpj |
---|
| 190 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
[6140] | 191 | zse3t = 1. / e3t_n(ji,jj,1) |
---|
[5385] | 192 | ! tracer flux at the ice/ocean interface (tracer/m2/s) |
---|
| 193 | zftra = - trc_i(ji,jj,jn) * fmmflx(ji,jj) ! uptake of tracer in the sea ice |
---|
| 194 | zcd = trc_o(ji,jj,jn) * fmmflx(ji,jj) ! concentration dilution due to freezing-melting, |
---|
| 195 | ! only used in the levitating sea ice case |
---|
| 196 | ! tracer flux only : add concentration dilution term in net tracer flux, no F-M in volume flux |
---|
| 197 | ! tracer and mass fluxes : no concentration dilution term in net tracer flux, F-M term in volume flux |
---|
| 198 | ztfx = zftra + zswitch * zcd ! net tracer flux (+C/D if no ice/ocean mass exchange) |
---|
| 199 | |
---|
| 200 | zdtra = r1_rau0 * ( ztfx + zsfx(ji,jj) * trn(ji,jj,1,jn) ) |
---|
| 201 | IF ( zdtra < 0. ) THEN |
---|
| 202 | zratio = -zdtra * zse3t * r2dt / ( trn(ji,jj,1,jn) + zrtrn ) |
---|
| 203 | zdtra = MIN(1.0, zratio) * zdtra ! avoid negative concentrations to arise |
---|
| 204 | ENDIF |
---|
| 205 | sbc_trc(ji,jj,jn) = zdtra |
---|
| 206 | END DO |
---|
| 207 | END DO |
---|
| 208 | ENDIF |
---|
[6309] | 209 | ! |
---|
| 210 | CALL lbc_lnk( sbc_trc(:,:,jn), 'T', 1. ) |
---|
[5385] | 211 | ! Concentration dilution effect on tracers due to evaporation & precipitation |
---|
[7037] | 212 | !$OMP PARALLEL DO schedule(static) private(jj,ji,zse3t) |
---|
[941] | 213 | DO jj = 2, jpj |
---|
| 214 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
[6140] | 215 | zse3t = zfact / e3t_n(ji,jj,1) |
---|
[5385] | 216 | tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + ( sbc_trc_b(ji,jj,jn) + sbc_trc(ji,jj,jn) ) * zse3t |
---|
[941] | 217 | END DO |
---|
| 218 | END DO |
---|
[5385] | 219 | ! |
---|
[1175] | 220 | IF( l_trdtrc ) THEN |
---|
[7508] | 221 | !$OMP PARALLEL DO schedule(static) private(jk,jj,ji) |
---|
[7525] | 222 | DO jk = 1, jpk |
---|
| 223 | DO jj = 1, jpj |
---|
| 224 | DO ji = 1, jpi |
---|
| 225 | ztrtrd(ji,jj,jk) = tra(ji,jj,jk,jn) - ztrtrd(ji,jj,jk) |
---|
| 226 | END DO |
---|
| 227 | END DO |
---|
| 228 | END DO ! online coupling free surface or offline with free surface |
---|
[4990] | 229 | CALL trd_tra( kt, 'TRC', jn, jptra_nsr, ztrtrd ) |
---|
[1175] | 230 | END IF |
---|
| 231 | ! ! =========== |
---|
| 232 | END DO ! tracer loop |
---|
| 233 | ! ! =========== |
---|
[5385] | 234 | |
---|
| 235 | ! Write in the tracer restar file |
---|
| 236 | ! ******************************* |
---|
| 237 | IF( lrst_trc ) THEN |
---|
| 238 | IF(lwp) WRITE(numout,*) |
---|
| 239 | IF(lwp) WRITE(numout,*) 'sbc : ocean surface tracer content forcing fields written in tracer restart file ', & |
---|
| 240 | & 'at it= ', kt,' date= ', ndastp |
---|
| 241 | IF(lwp) WRITE(numout,*) '~~~~' |
---|
| 242 | DO jn = 1, jptra |
---|
| 243 | CALL iom_rstput( kt, nitrst, numrtw, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc(:,:,jn) ) |
---|
| 244 | END DO |
---|
| 245 | ENDIF |
---|
| 246 | ! |
---|
[2528] | 247 | IF( ln_ctl ) THEN |
---|
| 248 | WRITE(charout, FMT="('sbc ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 249 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
[941] | 250 | ENDIF |
---|
[6140] | 251 | CALL wrk_dealloc( jpi,jpj, zsfx ) |
---|
| 252 | IF( l_trdtrc ) CALL wrk_dealloc( jpi,jpj,jpk, ztrtrd ) |
---|
[3294] | 253 | ! |
---|
| 254 | IF( nn_timing == 1 ) CALL timing_stop('trc_sbc') |
---|
| 255 | ! |
---|
[941] | 256 | END SUBROUTINE trc_sbc |
---|
| 257 | |
---|
| 258 | #else |
---|
| 259 | !!---------------------------------------------------------------------- |
---|
| 260 | !! Dummy module : NO passive tracer |
---|
| 261 | !!---------------------------------------------------------------------- |
---|
| 262 | CONTAINS |
---|
| 263 | SUBROUTINE trc_sbc (kt) ! Empty routine |
---|
| 264 | INTEGER, INTENT(in) :: kt |
---|
| 265 | WRITE(*,*) 'trc_sbc: You should not have seen this print! error?', kt |
---|
| 266 | END SUBROUTINE trc_sbc |
---|
| 267 | #endif |
---|
| 268 | |
---|
| 269 | !!====================================================================== |
---|
| 270 | END MODULE trcsbc |
---|