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