1 | MODULE trcsbc |
---|
2 | !!============================================================================== |
---|
3 | !! *** MODULE trcsbc *** |
---|
4 | !! Ocean passive tracers: surface boundary condition |
---|
5 | !!====================================================================== |
---|
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 |
---|
11 | !!============================================================================== |
---|
12 | #if defined key_top |
---|
13 | !!---------------------------------------------------------------------- |
---|
14 | !! 'key_top' TOP models |
---|
15 | !!---------------------------------------------------------------------- |
---|
16 | !! trc_sbc : update the tracer trend at ocean surface |
---|
17 | !!---------------------------------------------------------------------- |
---|
18 | USE par_trc ! need jptra, number of passive tracers |
---|
19 | USE oce_trc ! ocean dynamics and active tracers variables |
---|
20 | USE trc ! ocean passive tracers variables |
---|
21 | USE prtctl ! Print control for debbuging |
---|
22 | USE iom |
---|
23 | USE trd_oce |
---|
24 | USE trdtra |
---|
25 | |
---|
26 | IMPLICIT NONE |
---|
27 | PRIVATE |
---|
28 | |
---|
29 | PUBLIC trc_sbc ! routine called by step.F90 |
---|
30 | |
---|
31 | !! * Substitutions |
---|
32 | # include "do_loop_substitute.h90" |
---|
33 | # include "domzgr_substitute.h90" |
---|
34 | !!---------------------------------------------------------------------- |
---|
35 | !! NEMO/TOP 4.0 , NEMO Consortium (2018) |
---|
36 | !! $Id$ |
---|
37 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
38 | !!---------------------------------------------------------------------- |
---|
39 | CONTAINS |
---|
40 | |
---|
41 | SUBROUTINE trc_sbc ( kt, Kmm, ptr, Krhs ) |
---|
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 : |
---|
53 | !! tr(Krhs) = tr(Krhs) + emp * tr(Kmm) / e3t_ for k=1 |
---|
54 | !! where emp, the surface freshwater budget (evaporation minus |
---|
55 | !! precipitation ) given in kg/m2/s is divided |
---|
56 | !! by 1035 kg/m3 (density of ocean water) to obtain m/s. |
---|
57 | !! |
---|
58 | !! ** Action : - Update the 1st level of tr(:,:,:,:,Krhs) with the trend associated |
---|
59 | !! with the tracer surface boundary condition |
---|
60 | !! |
---|
61 | !!---------------------------------------------------------------------- |
---|
62 | INTEGER, INTENT(in ) :: kt ! ocean time-step index |
---|
63 | INTEGER, INTENT(in ) :: Kmm, Krhs ! time level indices |
---|
64 | REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr ! passive tracers and RHS of tracer equation |
---|
65 | ! |
---|
66 | INTEGER :: ji, jj, jn ! dummy loop indices |
---|
67 | REAL(wp) :: zse3t, zrtrn, zfact ! local scalars |
---|
68 | REAL(wp) :: zftra, zdtra, ztfx, ztra ! - - |
---|
69 | CHARACTER (len=22) :: charout |
---|
70 | REAL(wp), DIMENSION(jpi,jpj) :: zsfx |
---|
71 | REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: ztrtrd |
---|
72 | !!--------------------------------------------------------------------- |
---|
73 | ! |
---|
74 | IF( ln_timing ) CALL timing_start('trc_sbc') |
---|
75 | ! |
---|
76 | ! Allocate temporary workspace |
---|
77 | IF( l_trdtrc ) ALLOCATE( ztrtrd(jpi,jpj,jpk) ) |
---|
78 | ! |
---|
79 | zrtrn = 1.e-15_wp |
---|
80 | |
---|
81 | IF( kt == nittrc000 ) THEN |
---|
82 | IF(lwp) WRITE(numout,*) |
---|
83 | IF(lwp) WRITE(numout,*) 'trc_sbc : Passive tracers surface boundary condition' |
---|
84 | IF(lwp) WRITE(numout,*) '~~~~~~~ ' |
---|
85 | ! |
---|
86 | IF( ln_rsttr .AND. .NOT.ln_top_euler .AND. & ! Restart: read in restart file |
---|
87 | iom_varid( numrtr, 'sbc_'//TRIM(ctrcnm(1))//'_b', ldstop = .FALSE. ) > 0 ) THEN |
---|
88 | IF(lwp) WRITE(numout,*) ' nittrc000-1 surface tracer content forcing fields read in the restart file' |
---|
89 | zfact = 0.5_wp |
---|
90 | DO jn = 1, jptra |
---|
91 | CALL iom_get( numrtr, jpdom_auto, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc_b(:,:,jn) ) ! before tracer content sbc |
---|
92 | END DO |
---|
93 | ELSE ! No restart or restart not found: Euler forward time stepping |
---|
94 | zfact = 1._wp |
---|
95 | sbc_trc_b(:,:,:) = 0._wp |
---|
96 | ENDIF |
---|
97 | ELSE ! Swap of forcing fields |
---|
98 | IF( ln_top_euler ) THEN |
---|
99 | zfact = 1._wp |
---|
100 | sbc_trc_b(:,:,:) = 0._wp |
---|
101 | ELSE |
---|
102 | zfact = 0.5_wp |
---|
103 | sbc_trc_b(:,:,:) = sbc_trc(:,:,:) |
---|
104 | ENDIF |
---|
105 | ! |
---|
106 | ENDIF |
---|
107 | |
---|
108 | ! Coupling online : river runoff is added to the horizontal divergence (hdiv) in the subroutine sbc_rnf_div |
---|
109 | ! one only consider the concentration/dilution effect due to evaporation minus precipitation + freezing/melting of sea-ice |
---|
110 | ! Coupling offline : runoff are in emp which contains E-P-R |
---|
111 | ! |
---|
112 | IF( .NOT.ln_linssh ) THEN ! online coupling with vvl |
---|
113 | zsfx(:,:) = 0._wp |
---|
114 | ELSE ! online coupling free surface or offline with free surface |
---|
115 | zsfx(:,:) = emp(:,:) |
---|
116 | ENDIF |
---|
117 | |
---|
118 | ! 0. initialization |
---|
119 | SELECT CASE ( nn_ice_tr ) |
---|
120 | |
---|
121 | CASE ( -1 ) ! No tracers in sea ice (null concentration in sea ice) |
---|
122 | ! |
---|
123 | DO jn = 1, jptra |
---|
124 | DO_2D( 0, 1, 0, 0 ) |
---|
125 | sbc_trc(ji,jj,jn) = zsfx(ji,jj) * r1_rho0 * ptr(ji,jj,1,jn,Kmm) |
---|
126 | END_2D |
---|
127 | END DO |
---|
128 | ! |
---|
129 | CASE ( 0 ) ! Same concentration in sea ice and in the ocean |
---|
130 | ! |
---|
131 | DO jn = 1, jptra |
---|
132 | DO_2D( 0, 1, 0, 0 ) |
---|
133 | sbc_trc(ji,jj,jn) = ( zsfx(ji,jj) + fmmflx(ji,jj) ) * r1_rho0 * ptr(ji,jj,1,jn,Kmm) |
---|
134 | END_2D |
---|
135 | END DO |
---|
136 | ! |
---|
137 | CASE ( 1 ) ! Specific treatment of sea ice fluxes with an imposed concentration in sea ice |
---|
138 | ! |
---|
139 | DO jn = 1, jptra |
---|
140 | DO_2D( 0, 1, 0, 0 ) |
---|
141 | zse3t = 1. / e3t(ji,jj,1,Kmm) |
---|
142 | ! tracer flux at the ice/ocean interface (tracer/m2/s) |
---|
143 | zftra = - trc_i(ji,jj,jn) * fmmflx(ji,jj) ! uptake of tracer in the sea ice |
---|
144 | ! ! only used in the levitating sea ice case |
---|
145 | ! tracer flux only : add concentration dilution term in net tracer flux, no F-M in volume flux |
---|
146 | ! tracer and mass fluxes : no concentration dilution term in net tracer flux, F-M term in volume flux |
---|
147 | ztfx = zftra ! net tracer flux |
---|
148 | ! |
---|
149 | zdtra = r1_rho0 * ( ztfx + ( zsfx(ji,jj) + fmmflx(ji,jj) ) * ptr(ji,jj,1,jn,Kmm) ) |
---|
150 | IF ( zdtra < 0. ) THEN |
---|
151 | zdtra = MAX(zdtra, -ptr(ji,jj,1,jn,Kmm) * e3t(ji,jj,1,Kmm) / rDt_trc ) ! avoid negative concentrations to arise |
---|
152 | ENDIF |
---|
153 | sbc_trc(ji,jj,jn) = zdtra |
---|
154 | END_2D |
---|
155 | END DO |
---|
156 | END SELECT |
---|
157 | ! |
---|
158 | CALL lbc_lnk( 'trcsbc', sbc_trc(:,:,:), 'T', 1.0_wp ) |
---|
159 | ! Concentration dilution effect on tracers due to evaporation & precipitation |
---|
160 | DO jn = 1, jptra |
---|
161 | ! |
---|
162 | IF( l_trdtrc ) ztrtrd(:,:,:) = ptr(:,:,:,jn,Krhs) ! save trends |
---|
163 | ! |
---|
164 | DO_2D( 0, 1, 0, 0 ) |
---|
165 | zse3t = zfact / e3t(ji,jj,1,Kmm) |
---|
166 | ptr(ji,jj,1,jn,Krhs) = ptr(ji,jj,1,jn,Krhs) + ( sbc_trc_b(ji,jj,jn) + sbc_trc(ji,jj,jn) ) * zse3t |
---|
167 | END_2D |
---|
168 | ! |
---|
169 | IF( l_trdtrc ) THEN |
---|
170 | ztrtrd(:,:,:) = ptr(:,:,:,jn,Krhs) - ztrtrd(:,:,:) |
---|
171 | CALL trd_tra( kt, Kmm, Krhs, 'TRC', jn, jptra_nsr, ztrtrd ) |
---|
172 | END IF |
---|
173 | ! ! =========== |
---|
174 | END DO ! tracer loop |
---|
175 | ! ! =========== |
---|
176 | ! |
---|
177 | ! Write in the tracer restar file |
---|
178 | ! ******************************* |
---|
179 | IF( lrst_trc .AND. .NOT.ln_top_euler ) THEN |
---|
180 | IF(lwp) WRITE(numout,*) |
---|
181 | IF(lwp) WRITE(numout,*) 'sbc : ocean surface tracer content forcing fields written in tracer restart file ', & |
---|
182 | & 'at it= ', kt,' date= ', ndastp |
---|
183 | IF(lwp) WRITE(numout,*) '~~~~' |
---|
184 | DO jn = 1, jptra |
---|
185 | CALL iom_rstput( kt, nitrst, numrtw, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc(:,:,jn) ) |
---|
186 | END DO |
---|
187 | ENDIF |
---|
188 | ! |
---|
189 | IF( sn_cfctl%l_prttrc ) THEN |
---|
190 | WRITE(charout, FMT="('sbc ')") ; CALL prt_ctl_info( charout, cdcomp = 'top' ) |
---|
191 | CALL prt_ctl( tab4d_1=ptr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' ) |
---|
192 | ENDIF |
---|
193 | IF( l_trdtrc ) DEALLOCATE( ztrtrd ) |
---|
194 | ! |
---|
195 | IF( ln_timing ) CALL timing_stop('trc_sbc') |
---|
196 | ! |
---|
197 | END SUBROUTINE trc_sbc |
---|
198 | |
---|
199 | #else |
---|
200 | !!---------------------------------------------------------------------- |
---|
201 | !! Dummy module : NO passive tracer |
---|
202 | !!---------------------------------------------------------------------- |
---|
203 | USE par_oce |
---|
204 | USE par_trc |
---|
205 | CONTAINS |
---|
206 | SUBROUTINE trc_sbc ( kt, Kmm, ptr, Krhs ) ! Empty routine |
---|
207 | INTEGER, INTENT(in ) :: kt ! ocean time-step index |
---|
208 | INTEGER, INTENT(in ) :: Kmm, Krhs ! time level indices |
---|
209 | REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr ! passive tracers and RHS of tracer equation |
---|
210 | WRITE(*,*) 'trc_sbc: You should not have seen this print! error?', kt |
---|
211 | END SUBROUTINE trc_sbc |
---|
212 | #endif |
---|
213 | |
---|
214 | !!====================================================================== |
---|
215 | END MODULE trcsbc |
---|