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_ + 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 |
---|
61 | !! |
---|
62 | !! ** Action : - Update the 1st level of tr(:,:,:,:,Krhs) with the trend associated |
---|
63 | !! with the tracer surface boundary condition |
---|
64 | !! |
---|
65 | !!---------------------------------------------------------------------- |
---|
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 |
---|
69 | ! |
---|
70 | INTEGER :: ji, jj, jn ! dummy loop indices |
---|
71 | REAL(wp) :: zse3t, zrtrn, zfact ! local scalars |
---|
72 | REAL(wp) :: zdtra ! - - |
---|
73 | CHARACTER (len=22) :: charout |
---|
74 | REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: ztrtrd |
---|
75 | !!--------------------------------------------------------------------- |
---|
76 | ! |
---|
77 | IF( ln_timing ) CALL timing_start('trc_sbc') |
---|
78 | ! |
---|
79 | ! Allocate temporary workspace |
---|
80 | IF( l_trdtrc ) ALLOCATE( ztrtrd(jpi,jpj,jpk) ) |
---|
81 | ! |
---|
82 | zrtrn = 1.e-15_wp |
---|
83 | |
---|
84 | IF( kt == nittrc000 ) THEN |
---|
85 | IF(lwp) WRITE(numout,*) |
---|
86 | IF(lwp) WRITE(numout,*) 'trc_sbc : Passive tracers surface boundary condition' |
---|
87 | IF(lwp) WRITE(numout,*) '~~~~~~~ ' |
---|
88 | ! |
---|
89 | IF( ln_rsttr .AND. .NOT.ln_top_euler .AND. & ! Restart: read in restart file |
---|
90 | iom_varid( numrtr, 'sbc_'//TRIM(ctrcnm(1))//'_b', ldstop = .FALSE. ) > 0 ) THEN |
---|
91 | IF(lwp) WRITE(numout,*) ' nittrc000-1 surface tracer content forcing fields read in the restart file' |
---|
92 | zfact = 0.5_wp |
---|
93 | DO jn = 1, jptra |
---|
94 | CALL iom_get( numrtr, jpdom_auto, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc_b(:,:,jn) ) ! before tracer content sbc |
---|
95 | END DO |
---|
96 | ELSE ! No restart or restart not found: Euler forward time stepping |
---|
97 | zfact = 1._wp |
---|
98 | sbc_trc_b(:,:,:) = 0._wp |
---|
99 | ENDIF |
---|
100 | ELSE ! Swap of forcing fields |
---|
101 | IF( ln_top_euler ) THEN |
---|
102 | zfact = 1._wp |
---|
103 | sbc_trc_b(:,:,:) = 0._wp |
---|
104 | ELSE |
---|
105 | zfact = 0.5_wp |
---|
106 | sbc_trc_b(:,:,:) = sbc_trc(:,:,:) |
---|
107 | ENDIF |
---|
108 | ! |
---|
109 | ENDIF |
---|
110 | |
---|
111 | ! 0. initialization |
---|
112 | SELECT CASE ( nn_ice_tr ) |
---|
113 | |
---|
114 | CASE ( -1 ) ! ! No tracers in sea ice ( trc_i = 0 ) |
---|
115 | ! |
---|
116 | DO jn = 1, jptra |
---|
117 | DO_2D( 0, 0, 0, 1 ) |
---|
118 | sbc_trc(ji,jj,jn) = 0._wp |
---|
119 | END_2D |
---|
120 | END DO |
---|
121 | ! |
---|
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 |
---|
129 | ! |
---|
130 | CASE ( 0 ) ! Same concentration in sea ice and in the ocean ( trc_i = ptr(...,Kmm) ) |
---|
131 | ! |
---|
132 | DO jn = 1, jptra |
---|
133 | DO_2D( 0, 0, 0, 1 ) |
---|
134 | sbc_trc(ji,jj,jn) = - fmmflx(ji,jj) * r1_rho0 * ptr(ji,jj,1,jn,Kmm) |
---|
135 | END_2D |
---|
136 | END DO |
---|
137 | ! |
---|
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 | ! |
---|
146 | CASE ( 1 ) ! Specific treatment of sea ice fluxes with an imposed concentration in sea ice |
---|
147 | ! |
---|
148 | DO jn = 1, jptra |
---|
149 | DO_2D( 0, 0, 0, 1 ) |
---|
150 | sbc_trc(ji,jj,jn) = - fmmflx(ji,jj) * r1_rho0 * trc_i(ji,jj,jn) |
---|
151 | END_2D |
---|
152 | END DO |
---|
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 | ! |
---|
170 | END SELECT |
---|
171 | ! |
---|
172 | CALL lbc_lnk( 'trcsbc', sbc_trc(:,:,:), 'T', 1.0_wp ) |
---|
173 | ! Concentration dilution effect on tracers due to evaporation & precipitation |
---|
174 | DO jn = 1, jptra |
---|
175 | ! |
---|
176 | IF( l_trdtrc ) ztrtrd(:,:,:) = ptr(:,:,:,jn,Krhs) ! save trends |
---|
177 | ! |
---|
178 | DO_2D( 0, 0, 0, 1 ) |
---|
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 |
---|
182 | ! |
---|
183 | IF( l_trdtrc ) THEN |
---|
184 | ztrtrd(:,:,:) = ptr(:,:,:,jn,Krhs) - ztrtrd(:,:,:) |
---|
185 | CALL trd_tra( kt, Kmm, Krhs, 'TRC', jn, jptra_nsr, ztrtrd ) |
---|
186 | END IF |
---|
187 | ! ! =========== |
---|
188 | END DO ! tracer loop |
---|
189 | ! ! =========== |
---|
190 | ! |
---|
191 | ! Write in the tracer restar file |
---|
192 | ! ******************************* |
---|
193 | IF( lrst_trc .AND. .NOT.ln_top_euler ) THEN |
---|
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 | ! |
---|
203 | IF( sn_cfctl%l_prttrc ) THEN |
---|
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' ) |
---|
206 | ENDIF |
---|
207 | IF( l_trdtrc ) DEALLOCATE( ztrtrd ) |
---|
208 | ! |
---|
209 | IF( ln_timing ) CALL timing_stop('trc_sbc') |
---|
210 | ! |
---|
211 | END SUBROUTINE trc_sbc |
---|
212 | |
---|
213 | #else |
---|
214 | !!---------------------------------------------------------------------- |
---|
215 | !! Dummy module : NO passive tracer |
---|
216 | !!---------------------------------------------------------------------- |
---|
217 | USE par_oce |
---|
218 | USE par_trc |
---|
219 | CONTAINS |
---|
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 |
---|
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 |
---|