[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 | !!---------------------------------------------------------------------- |
---|
[14086] | 18 | USE par_trc ! need jptra, number of passive tracers |
---|
[2715] | 19 | USE oce_trc ! ocean dynamics and active tracers variables |
---|
| 20 | USE trc ! ocean passive tracers variables |
---|
[13286] | 21 | USE prtctl ! Print control for debbuging |
---|
[5385] | 22 | USE iom |
---|
[4990] | 23 | USE trd_oce |
---|
[2528] | 24 | USE trdtra |
---|
[941] | 25 | |
---|
| 26 | IMPLICIT NONE |
---|
| 27 | PRIVATE |
---|
| 28 | |
---|
[2715] | 29 | PUBLIC trc_sbc ! routine called by step.F90 |
---|
[941] | 30 | |
---|
| 31 | !! * Substitutions |
---|
[12377] | 32 | # include "do_loop_substitute.h90" |
---|
[13237] | 33 | # include "domzgr_substitute.h90" |
---|
[941] | 34 | !!---------------------------------------------------------------------- |
---|
[10067] | 35 | !! NEMO/TOP 4.0 , NEMO Consortium (2018) |
---|
[7753] | 36 | !! $Id$ |
---|
[10068] | 37 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[941] | 38 | !!---------------------------------------------------------------------- |
---|
| 39 | CONTAINS |
---|
| 40 | |
---|
[12377] | 41 | SUBROUTINE trc_sbc ( kt, Kmm, ptr, Krhs ) |
---|
[941] | 42 | !!---------------------------------------------------------------------- |
---|
| 43 | !! *** ROUTINE trc_sbc *** |
---|
| 44 | !! |
---|
| 45 | !! ** Purpose : Compute the tracer surface boundary condition trend of |
---|
| 46 | !! (concentration/dilution effect) and add it to the general |
---|
| 47 | !! trend of tracer equations. |
---|
| 48 | !! |
---|
| 49 | !! ** Method : |
---|
| 50 | !! * concentration/dilution effect: |
---|
| 51 | !! The surface freshwater flux modify the ocean volume |
---|
| 52 | !! and thus the concentration of a tracer as : |
---|
[15394] | 53 | !! tr(Krhs) = tr(Krhs) + emp * tr(Kmm) / e3t_ + fmmflx * tri / e3t for k=1 |
---|
| 54 | !! - tr(Kmm) , the concentration of tracer in the ocean |
---|
| 55 | !! - tri, the concentration of tracer in the sea-ice |
---|
| 56 | !! - emp, the surface freshwater budget (evaporation minus precipitation + fmmflx) |
---|
| 57 | !! given in kg/m2/s is divided by 1035 kg/m3 (density of ocean water) to obtain m/s. |
---|
| 58 | !! - fmmflx, the flux asscociated to freezing-melting of sea-ice |
---|
| 59 | !! In linear free surface case (ln_linssh=T), the volume of the |
---|
| 60 | !! ocean does not change with the water exchanges at the (air+ice)-sea |
---|
[941] | 61 | !! |
---|
[12377] | 62 | !! ** Action : - Update the 1st level of tr(:,:,:,:,Krhs) with the trend associated |
---|
[941] | 63 | !! with the tracer surface boundary condition |
---|
| 64 | !! |
---|
| 65 | !!---------------------------------------------------------------------- |
---|
[12377] | 66 | INTEGER, INTENT(in ) :: kt ! ocean time-step index |
---|
| 67 | INTEGER, INTENT(in ) :: Kmm, Krhs ! time level indices |
---|
| 68 | REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr ! passive tracers and RHS of tracer equation |
---|
[2715] | 69 | ! |
---|
[9019] | 70 | INTEGER :: ji, jj, jn ! dummy loop indices |
---|
[10788] | 71 | REAL(wp) :: zse3t, zrtrn, zfact ! local scalars |
---|
[15394] | 72 | REAL(wp) :: zdtra ! - - |
---|
[941] | 73 | CHARACTER (len=22) :: charout |
---|
[9125] | 74 | REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: ztrtrd |
---|
[3294] | 75 | !!--------------------------------------------------------------------- |
---|
| 76 | ! |
---|
[9124] | 77 | IF( ln_timing ) CALL timing_start('trc_sbc') |
---|
[3294] | 78 | ! |
---|
| 79 | ! Allocate temporary workspace |
---|
[9125] | 80 | IF( l_trdtrc ) ALLOCATE( ztrtrd(jpi,jpj,jpk) ) |
---|
[5385] | 81 | ! |
---|
| 82 | zrtrn = 1.e-15_wp |
---|
[941] | 83 | |
---|
[3294] | 84 | IF( kt == nittrc000 ) THEN |
---|
[941] | 85 | IF(lwp) WRITE(numout,*) |
---|
| 86 | IF(lwp) WRITE(numout,*) 'trc_sbc : Passive tracers surface boundary condition' |
---|
| 87 | IF(lwp) WRITE(numout,*) '~~~~~~~ ' |
---|
[9019] | 88 | ! |
---|
[6942] | 89 | IF( ln_rsttr .AND. .NOT.ln_top_euler .AND. & ! Restart: read in restart file |
---|
[5385] | 90 | iom_varid( numrtr, 'sbc_'//TRIM(ctrcnm(1))//'_b', ldstop = .FALSE. ) > 0 ) THEN |
---|
[12377] | 91 | IF(lwp) WRITE(numout,*) ' nittrc000-1 surface tracer content forcing fields read in the restart file' |
---|
[5385] | 92 | zfact = 0.5_wp |
---|
| 93 | DO jn = 1, jptra |
---|
[13286] | 94 | CALL iom_get( numrtr, jpdom_auto, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc_b(:,:,jn) ) ! before tracer content sbc |
---|
[5385] | 95 | END DO |
---|
| 96 | ELSE ! No restart or restart not found: Euler forward time stepping |
---|
| 97 | zfact = 1._wp |
---|
[7753] | 98 | sbc_trc_b(:,:,:) = 0._wp |
---|
[5385] | 99 | ENDIF |
---|
| 100 | ELSE ! Swap of forcing fields |
---|
| 101 | IF( ln_top_euler ) THEN |
---|
| 102 | zfact = 1._wp |
---|
[7753] | 103 | sbc_trc_b(:,:,:) = 0._wp |
---|
[5385] | 104 | ELSE |
---|
| 105 | zfact = 0.5_wp |
---|
[7753] | 106 | sbc_trc_b(:,:,:) = sbc_trc(:,:,:) |
---|
[5385] | 107 | ENDIF |
---|
| 108 | ! |
---|
[941] | 109 | ENDIF |
---|
| 110 | |
---|
| 111 | ! 0. initialization |
---|
[10788] | 112 | SELECT CASE ( nn_ice_tr ) |
---|
| 113 | |
---|
[15394] | 114 | CASE ( -1 ) ! ! No tracers in sea ice ( trc_i = 0 ) |
---|
[2528] | 115 | ! |
---|
[10425] | 116 | DO jn = 1, jptra |
---|
[14215] | 117 | DO_2D( 0, 0, 0, 1 ) |
---|
[15394] | 118 | sbc_trc(ji,jj,jn) = 0._wp |
---|
[12377] | 119 | END_2D |
---|
[10425] | 120 | END DO |
---|
| 121 | ! |
---|
[15394] | 122 | IF( ln_linssh ) THEN !* linear free surface |
---|
| 123 | DO jn = 1, jptra |
---|
| 124 | DO_2D( 0, 0, 0, 1 ) |
---|
| 125 | sbc_trc(ji,jj,jn) = sbc_trc(ji,jj,jn) + r1_rho0 * emp(ji,jj) * ptr(ji,jj,1,jn,Kmm) !==>> add concentration/dilution effect due to constant volume cell |
---|
| 126 | END_2D |
---|
| 127 | END DO |
---|
| 128 | ENDIF |
---|
[10425] | 129 | ! |
---|
[15394] | 130 | CASE ( 0 ) ! Same concentration in sea ice and in the ocean ( trc_i = ptr(...,Kmm) ) |
---|
| 131 | ! |
---|
[10425] | 132 | DO jn = 1, jptra |
---|
[14215] | 133 | DO_2D( 0, 0, 0, 1 ) |
---|
[15394] | 134 | sbc_trc(ji,jj,jn) = - fmmflx(ji,jj) * r1_rho0 * ptr(ji,jj,1,jn,Kmm) |
---|
[12377] | 135 | END_2D |
---|
[10788] | 136 | END DO |
---|
| 137 | ! |
---|
[15394] | 138 | IF( ln_linssh ) THEN !* linear free surface |
---|
| 139 | DO jn = 1, jptra |
---|
| 140 | DO_2D( 0, 0, 0, 1 ) |
---|
| 141 | sbc_trc(ji,jj,jn) = sbc_trc(ji,jj,jn) + r1_rho0 * emp(ji,jj) * ptr(ji,jj,1,jn,Kmm) !==>> add concentration/dilution effect due to constant volume cell |
---|
| 142 | END_2D |
---|
| 143 | END DO |
---|
| 144 | ENDIF |
---|
| 145 | ! |
---|
[10788] | 146 | CASE ( 1 ) ! Specific treatment of sea ice fluxes with an imposed concentration in sea ice |
---|
| 147 | ! |
---|
| 148 | DO jn = 1, jptra |
---|
[14215] | 149 | DO_2D( 0, 0, 0, 1 ) |
---|
[15394] | 150 | sbc_trc(ji,jj,jn) = - fmmflx(ji,jj) * r1_rho0 * trc_i(ji,jj,jn) |
---|
[12377] | 151 | END_2D |
---|
[10425] | 152 | END DO |
---|
[15394] | 153 | ! |
---|
| 154 | IF( ln_linssh ) THEN !* linear free surface |
---|
| 155 | DO jn = 1, jptra |
---|
| 156 | DO_2D( 0, 0, 0, 1 ) |
---|
| 157 | sbc_trc(ji,jj,jn) = sbc_trc(ji,jj,jn) + r1_rho0 * emp(ji,jj) * ptr(ji,jj,1,jn,Kmm) !==>> add concentration/dilution effect due to constant volume cell |
---|
| 158 | END_2D |
---|
| 159 | END DO |
---|
| 160 | ENDIF |
---|
| 161 | ! |
---|
| 162 | DO jn = 1, jptra |
---|
| 163 | DO_2D( 0, 0, 0, 1 ) |
---|
| 164 | zse3t = rDt_trc / e3t(ji,jj,1,Kmm) |
---|
| 165 | zdtra = ptr(ji,jj,1,jn,Kmm) + sbc_trc(ji,jj,jn) * zse3t |
---|
| 166 | IF( zdtra < 0. ) sbc_trc(ji,jj,jn) = MAX( zdtra, -ptr(ji,jj,1,jn,Kmm) / zse3t ) ! avoid negative concentration that can occurs if trc_i > ptr |
---|
| 167 | END_2D |
---|
| 168 | END DO |
---|
| 169 | ! |
---|
[10788] | 170 | END SELECT |
---|
[10425] | 171 | ! |
---|
[13226] | 172 | CALL lbc_lnk( 'trcsbc', sbc_trc(:,:,:), 'T', 1.0_wp ) |
---|
[10425] | 173 | ! Concentration dilution effect on tracers due to evaporation & precipitation |
---|
| 174 | DO jn = 1, jptra |
---|
[6309] | 175 | ! |
---|
[12377] | 176 | IF( l_trdtrc ) ztrtrd(:,:,:) = ptr(:,:,:,jn,Krhs) ! save trends |
---|
[10425] | 177 | ! |
---|
[14215] | 178 | DO_2D( 0, 0, 0, 1 ) |
---|
[12377] | 179 | zse3t = zfact / e3t(ji,jj,1,Kmm) |
---|
| 180 | ptr(ji,jj,1,jn,Krhs) = ptr(ji,jj,1,jn,Krhs) + ( sbc_trc_b(ji,jj,jn) + sbc_trc(ji,jj,jn) ) * zse3t |
---|
| 181 | END_2D |
---|
[5385] | 182 | ! |
---|
[1175] | 183 | IF( l_trdtrc ) THEN |
---|
[12377] | 184 | ztrtrd(:,:,:) = ptr(:,:,:,jn,Krhs) - ztrtrd(:,:,:) |
---|
| 185 | CALL trd_tra( kt, Kmm, Krhs, 'TRC', jn, jptra_nsr, ztrtrd ) |
---|
[1175] | 186 | END IF |
---|
| 187 | ! ! =========== |
---|
| 188 | END DO ! tracer loop |
---|
| 189 | ! ! =========== |
---|
[9019] | 190 | ! |
---|
[5385] | 191 | ! Write in the tracer restar file |
---|
| 192 | ! ******************************* |
---|
[6942] | 193 | IF( lrst_trc .AND. .NOT.ln_top_euler ) THEN |
---|
[5385] | 194 | IF(lwp) WRITE(numout,*) |
---|
| 195 | IF(lwp) WRITE(numout,*) 'sbc : ocean surface tracer content forcing fields written in tracer restart file ', & |
---|
| 196 | & 'at it= ', kt,' date= ', ndastp |
---|
| 197 | IF(lwp) WRITE(numout,*) '~~~~' |
---|
| 198 | DO jn = 1, jptra |
---|
| 199 | CALL iom_rstput( kt, nitrst, numrtw, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc(:,:,jn) ) |
---|
| 200 | END DO |
---|
| 201 | ENDIF |
---|
| 202 | ! |
---|
[12377] | 203 | IF( sn_cfctl%l_prttrc ) THEN |
---|
[13286] | 204 | WRITE(charout, FMT="('sbc ')") ; CALL prt_ctl_info( charout, cdcomp = 'top' ) |
---|
| 205 | CALL prt_ctl( tab4d_1=ptr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' ) |
---|
[941] | 206 | ENDIF |
---|
[9125] | 207 | IF( l_trdtrc ) DEALLOCATE( ztrtrd ) |
---|
[3294] | 208 | ! |
---|
[9124] | 209 | IF( ln_timing ) CALL timing_stop('trc_sbc') |
---|
[3294] | 210 | ! |
---|
[941] | 211 | END SUBROUTINE trc_sbc |
---|
| 212 | |
---|
| 213 | #else |
---|
| 214 | !!---------------------------------------------------------------------- |
---|
| 215 | !! Dummy module : NO passive tracer |
---|
| 216 | !!---------------------------------------------------------------------- |
---|
[12377] | 217 | USE par_oce |
---|
| 218 | USE par_trc |
---|
[941] | 219 | CONTAINS |
---|
[12377] | 220 | SUBROUTINE trc_sbc ( kt, Kmm, ptr, Krhs ) ! Empty routine |
---|
| 221 | INTEGER, INTENT(in ) :: kt ! ocean time-step index |
---|
| 222 | INTEGER, INTENT(in ) :: Kmm, Krhs ! time level indices |
---|
| 223 | REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr ! passive tracers and RHS of tracer equation |
---|
[941] | 224 | WRITE(*,*) 'trc_sbc: You should not have seen this print! error?', kt |
---|
| 225 | END SUBROUTINE trc_sbc |
---|
| 226 | #endif |
---|
| 227 | |
---|
| 228 | !!====================================================================== |
---|
| 229 | END MODULE trcsbc |
---|