1 | MODULE zdfkpp_tam |
---|
2 | #ifdef key_tam |
---|
3 | !!====================================================================== |
---|
4 | !! *** MODULE zdfkpp_tam *** |
---|
5 | !! Ocean physics: vertical mixing coefficient compute from the KPP |
---|
6 | !! turbulent closure parameterization |
---|
7 | !! Tangent and Adjoint Module |
---|
8 | !!===================================================================== |
---|
9 | !! History of the direct module: |
---|
10 | !! 8.1 ! 00-03 (W.G. Large, J. Chanut) Original code |
---|
11 | !! 8.1 ! 02-06 (J.M. Molines) for real case CLIPPER |
---|
12 | !! 8.2 ! 03-10 (Chanut J.) re-writting |
---|
13 | !! 9.0 ! 05-01 (C. Ethe) Free form, F90 |
---|
14 | !! ! 08-07 (M. Balmaseda). Add parameteres to namelist |
---|
15 | !! History of the TAM: |
---|
16 | !! ! 08-06 (A. Vidard) skeleton TAM of the 05-01 version |
---|
17 | !! ! 08-11 (A. Vidard) skeleton TAM of the 08-07 version |
---|
18 | !!---------------------------------------------------------------------- |
---|
19 | #if defined key_zdfkpp || defined key_esopa |
---|
20 | !!---------------------------------------------------------------------- |
---|
21 | !! 'key_zdfkpp' KPP scheme |
---|
22 | !!---------------------------------------------------------------------- |
---|
23 | !!---------------------------------------------------------------------- |
---|
24 | !! zdf_kpp : update momentum and tracer Kz from a kpp scheme |
---|
25 | !! zdf_kpp_init : initialization, namelist read, and parameters control |
---|
26 | !!---------------------------------------------------------------------- |
---|
27 | USE oce ! ocean dynamics and active tracers |
---|
28 | USE dom_oce ! ocean space and time domain |
---|
29 | USE zdf_oce ! ocean vertical physics |
---|
30 | USE phycst ! physical constants |
---|
31 | USE eosbn2 ! equation of state |
---|
32 | USE sbc_oce ! thermohaline fluxes |
---|
33 | USE zdfddm ! double diffusion mixing |
---|
34 | USE in_out_manager ! I/O manager |
---|
35 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
36 | USE prtctl ! Print control |
---|
37 | |
---|
38 | IMPLICIT NONE |
---|
39 | PRIVATE |
---|
40 | |
---|
41 | PUBLIC zdf_kpp_tan ! routine called by steptan.F90 |
---|
42 | PUBLIC tra_kpp_tan ! routine called by steptan.F90 |
---|
43 | PUBLIC zdf_kpp_adj ! routine called by stepadj.F90 |
---|
44 | PUBLIC tra_kpp_adj ! routine called by stepadj.F90 |
---|
45 | |
---|
46 | LOGICAL, PUBLIC, PARAMETER :: lk_zdfkpp = .TRUE. !: KPP vertical mixing flag |
---|
47 | REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) :: ghats !: non-local scalar mixing term (gamma/<ws>o) |
---|
48 | REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: & |
---|
49 | wt0 , & !: surface temperature flux for non local flux |
---|
50 | ws0 , & !: surface salinity flux for non local flux |
---|
51 | hkpp !: boundary layer depht |
---|
52 | |
---|
53 | INTEGER :: & !!! ** kpp namelist (namkpp) ** |
---|
54 | nave = 1 , & ! = 0/1 flag for horizontal average on avt, avmu, avmv |
---|
55 | navb = 0 ! = 0/1 flag for constant or profile background avt |
---|
56 | |
---|
57 | REAL(wp) :: & !!! ** Interior Mixing |
---|
58 | difmiw = 1.2e-04_wp , & ! constant internal wave viscosity (m2/s) |
---|
59 | difsiw = 1.2e-05_wp , & ! constant internal wave diffusivity (m2/s) |
---|
60 | Riinfty = 0.8_wp , & ! local Richardson Number limit for shear instability |
---|
61 | difri = 5.e-03_wp , & ! maximum shear mixing at Rig = 0 (m2/s) |
---|
62 | bvsqcon = -1.e-09_wp , & ! Brunt-Vaisala squared (1/s**2) for maximum convection |
---|
63 | difcon = 1._wp ! maximum mixing in interior convection (m2/s) |
---|
64 | #if defined key_zdfddm |
---|
65 | REAL(wp) :: & !!! ** Double diffusion Mixing |
---|
66 | difssf = 1.e-03_wp , & ! maximum salt fingering mixing (nmlst) |
---|
67 | Rrho0 = 1.9_wp , & ! limit for salt fingering mixing |
---|
68 | difsdc = 1.5e-06_wp , & ! maximum diffusive convection mixing (nmlst) |
---|
69 | rdifst = 0.7_wp ! ration salt/Temp diff if salt fingering |
---|
70 | #endif |
---|
71 | LOGICAL :: & |
---|
72 | ln_kpprimix = .TRUE. ! Shear instability mixing |
---|
73 | |
---|
74 | REAL(wp) :: & !!! ** General constants ** |
---|
75 | epsln = 1.0e-20_wp , & ! a small positive number |
---|
76 | pthird = 1._wp/3._wp , & ! 1/3 |
---|
77 | pfourth = 1._wp/4._wp ! 1/4 |
---|
78 | |
---|
79 | REAL(wp) :: & !!! ** Boundary Layer Turbulence Parameters ** |
---|
80 | vonk = 0.4_wp , & ! von Karman's constant |
---|
81 | epsilon = 0.1_wp , & ! nondimensional extent of the surface layer |
---|
82 | rconc1 = 5.0_wp , & ! standard flux profile function parmaeters |
---|
83 | rconc2 = 16.0_wp , & ! " " |
---|
84 | rconcm = 8.38_wp , & ! momentum flux profile fit |
---|
85 | rconam = 1.26_wp , & ! " " |
---|
86 | rzetam = -.20_wp , & ! " " |
---|
87 | rconcs = 98.96_wp , & ! scalar flux profile fit |
---|
88 | rconas = -28.86_wp , & ! " " |
---|
89 | rzetas = -1.0_wp ! " " |
---|
90 | REAL(wp) :: & !!! ** Boundary Layer Depth Diagnostic ** |
---|
91 | Ricr = 0.3_wp , & ! critical bulk Richardson Number |
---|
92 | rcekman = 0.7_wp , & ! coefficient for ekman depth |
---|
93 | rcmonob = 1.0_wp , & ! coefficient for Monin-Obukhov depth |
---|
94 | rconcv = 1.7_wp , & ! ratio of interior buoyancy frequency to buoyancy frequency at entrainment depth (namelist) |
---|
95 | hbf = 1.0_wp , & ! fraction of bound. layer depth to which absorbed solar |
---|
96 | ! ! rad. and contributes to surf. buo. forcing |
---|
97 | Vtc ! function of rconcv,rconcs,epsilon,vonk,Ricr |
---|
98 | REAL(wp) :: & !!! ** Nonlocal Boundary Layer Mixing ** |
---|
99 | rcstar = 5.0_wp , & ! coefficient for convective nonlocal transport |
---|
100 | rcs = 1.0e-3_wp , & ! conversion: mm/s ==> m/s |
---|
101 | rcg ! non-dimensional coefficient for nonlocal transport |
---|
102 | |
---|
103 | #if ! defined key_kppcustom |
---|
104 | REAL(wp), DIMENSION(jpk,jpk) :: & |
---|
105 | del ! array for reference mean values of vertical integration |
---|
106 | #endif |
---|
107 | |
---|
108 | #if defined key_kpplktb |
---|
109 | INTEGER, PARAMETER :: & !!! ** Parameters for lookup table for turbulent velocity scales ** |
---|
110 | nilktb = 892 , & ! number of values for zehat in KPP lookup table |
---|
111 | njlktb = 482 , & ! number of values for ustar in KPP lookup table |
---|
112 | nilktbm1 = nilktb - 1 , & ! |
---|
113 | njlktbm1 = njlktb - 1 ! |
---|
114 | |
---|
115 | REAL(wp), DIMENSION(nilktb,njlktb) :: & |
---|
116 | wmlktb , & ! lookup table for the turbulent vertical velocity scale for momentum |
---|
117 | wslktb ! lookup table for the turbulent vertical velocity scale for tracers |
---|
118 | |
---|
119 | REAL(wp) :: & |
---|
120 | dehatmin = -4.e-7_wp , & ! minimum limit for zhat in lookup table (m3/s3) |
---|
121 | dehatmax = 0._wp , & ! maximum limit for zhat in lookup table (m3/s3) |
---|
122 | ustmin = 0._wp , & ! minimum limit for ustar in lookup table (m/s) |
---|
123 | ustmax = 0.04_wp , & ! maximum limit for ustar in lookup table (m/s) |
---|
124 | dezehat , & ! delta zhat in lookup table |
---|
125 | deustar ! delta ustar in lookup table |
---|
126 | #endif |
---|
127 | REAL(wp), DIMENSION(jpk) :: & !!! attenuation coef |
---|
128 | ratt |
---|
129 | !! already defines in module traqsr, but only if the solar radiation penetration is considered |
---|
130 | REAL(wp) :: & !!! * penetrative solar radiation coefficient * |
---|
131 | rabs = 0.58_wp , & ! fraction associated with xsi1 |
---|
132 | xsi1 = 0.35_wp , & ! first depth of extinction |
---|
133 | xsi2 = 23.0_wp ! second depth of extinction |
---|
134 | ! ! (default values: water type Ib) |
---|
135 | |
---|
136 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: & |
---|
137 | etmean , & ! coefficient used for horizontal smoothing |
---|
138 | eumean , & ! at t-, u- and v-points |
---|
139 | evmean |
---|
140 | |
---|
141 | #if defined key_c1d |
---|
142 | REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) :: & |
---|
143 | rig , & ! gradient Richardson number |
---|
144 | rib , & ! bulk Richardson number |
---|
145 | buof , & ! buoyancy forcing |
---|
146 | mols ! moning-Obukhov length scale |
---|
147 | REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: & |
---|
148 | ekdp ! Ekman depth |
---|
149 | #endif |
---|
150 | |
---|
151 | INTEGER :: & ! |
---|
152 | jip = 62 , jjp = 111 |
---|
153 | |
---|
154 | !! * Substitutions |
---|
155 | # include "domzgr_substitute.h90" |
---|
156 | # include "vectopt_loop_substitute.h90" |
---|
157 | |
---|
158 | CONTAINS |
---|
159 | |
---|
160 | SUBROUTINE zdf_kpp_tan ( kt ) |
---|
161 | !!---------------------------------------------------------------------- |
---|
162 | !! *** ROUTINE zdf_kpp_tan *** |
---|
163 | !! |
---|
164 | !! ** Purpose of thedirect routine: |
---|
165 | !! Compute the vertical eddy viscosity and diffusivity |
---|
166 | !! coefficients and non local mixing using K-profile parameterization |
---|
167 | !! |
---|
168 | !! ** Method : The boundary layer depth hkpp is diagnosed at tracer points |
---|
169 | !! from profiles of buoyancy, and shear, and the surface forcing. |
---|
170 | !! Above hbl (sigma=-z/hbl <1) the mixing coefficients are computed from |
---|
171 | !! |
---|
172 | !! Kx = hkpp Wx(sigma) G(sigma) |
---|
173 | !! |
---|
174 | !! and the non local term ghat = Cs / Ws(sigma) / hkpp |
---|
175 | !! Below hkpp the coefficients are the sum of mixing due to internal waves |
---|
176 | !! shear instability and double diffusion. |
---|
177 | !! |
---|
178 | !! -1- Compute the now interior vertical mixing coefficients at all depths. |
---|
179 | !! -2- Diagnose the boundary layer depth. |
---|
180 | !! -3- Compute the now boundary layer vertical mixing coefficients. |
---|
181 | !! -4- Compute the now vertical eddy vicosity and diffusivity. |
---|
182 | !! -5- Smoothing |
---|
183 | !! |
---|
184 | !! N.B. The computation is done from jk=2 to jpkm1 |
---|
185 | !! Surface value of avt avmu avmv are set once a time to zero |
---|
186 | !! in routine zdf_kpp_init. |
---|
187 | !! |
---|
188 | !! ** Action : update the non-local terms ghats |
---|
189 | !! update avt, avmu, avmv (before vertical eddy coef.) |
---|
190 | !! |
---|
191 | !! References : Large W.G., Mc Williams J.C. and Doney S.C. |
---|
192 | !! Reviews of Geophysics, 32, 4, November 1994 |
---|
193 | !! Comments in the code refer to this paper, particularly |
---|
194 | !! the equation number. (LMD94, here after) |
---|
195 | !!---------------------------------------------------------------------- |
---|
196 | #if defined key_zdfddm |
---|
197 | USE oce , zviscos => ua, & ! temp. array for viscosities use ua as workspace |
---|
198 | & zdiffut => ta, & ! temp. array for diffusivities use sa as workspace |
---|
199 | & zdiffus => sa ! temp. array for diffusivities use sa as workspace |
---|
200 | #else |
---|
201 | USE oce , zviscos => ua, & ! temp. array for viscosities use ua as workspace |
---|
202 | & zdiffut => ta ! temp. array for diffusivities use sa as workspace |
---|
203 | #endif |
---|
204 | !! |
---|
205 | INTEGER, INTENT( in ) :: kt ! ocean time step |
---|
206 | !! |
---|
207 | |
---|
208 | END SUBROUTINE zdf_kpp_tan |
---|
209 | |
---|
210 | |
---|
211 | SUBROUTINE tra_kpp_tan |
---|
212 | !!---------------------------------------------------------------------- |
---|
213 | !! *** ROUTINE tra_kpp_tan *** |
---|
214 | !! |
---|
215 | !! ** Purpose of the direct routine: |
---|
216 | !! compute and add to the tracer trend the non-local |
---|
217 | !! tracer flux |
---|
218 | !! |
---|
219 | !! ** Method : ??? |
---|
220 | !! |
---|
221 | !! history or the direct routine: |
---|
222 | !! 9.0 ! 05-11 (G. Madec) Original code |
---|
223 | !! history: |
---|
224 | !! ! 08-06 (A. Vidard) |
---|
225 | !!---------------------------------------------------------------------- |
---|
226 | !! * Modules used |
---|
227 | USE oce, ONLY : ztrdt => ua, & ! use ua as 3D workspace |
---|
228 | ztrds => va ! use va as 3D workspace |
---|
229 | !!---------------------------------------------------------------------- |
---|
230 | |
---|
231 | |
---|
232 | END SUBROUTINE tra_kpp_tan |
---|
233 | SUBROUTINE zdf_kpp_adj ( kt ) |
---|
234 | !!---------------------------------------------------------------------- |
---|
235 | !! *** ROUTINE zdf_kpp_adj *** |
---|
236 | !! |
---|
237 | !! ** Purpose of thedirect routine: |
---|
238 | !! Compute the vertical eddy viscosity and diffusivity |
---|
239 | !! coefficients and non local mixing using K-profile parameterization |
---|
240 | !! |
---|
241 | !! ** Method : The boundary layer depth hkpp is diagnosed at tracer points |
---|
242 | !! from profiles of buoyancy, and shear, and the surface forcing. |
---|
243 | !! Above hbl (sigma=-z/hbl <1) the mixing coefficients are computed from |
---|
244 | !! |
---|
245 | !! Kx = hkpp Wx(sigma) G(sigma) |
---|
246 | !! |
---|
247 | !! and the non local term ghat = Cs / Ws(sigma) / hkpp |
---|
248 | !! Below hkpp the coefficients are the sum of mixing due to internal waves |
---|
249 | !! shear instability and double diffusion. |
---|
250 | !! |
---|
251 | !! -1- Compute the now interior vertical mixing coefficients at all depths. |
---|
252 | !! -2- Diagnose the boundary layer depth. |
---|
253 | !! -3- Compute the now boundary layer vertical mixing coefficients. |
---|
254 | !! -4- Compute the now vertical eddy vicosity and diffusivity. |
---|
255 | !! -5- Smoothing |
---|
256 | !! |
---|
257 | !! N.B. The computation is done from jk=2 to jpkm1 |
---|
258 | !! Surface value of avt avmu avmv are set once a time to zero |
---|
259 | !! in routine zdf_kpp_init. |
---|
260 | !! |
---|
261 | !! ** Action : update the non-local terms ghats |
---|
262 | !! update avt, avmu, avmv (before vertical eddy coef.) |
---|
263 | !! |
---|
264 | !! References : Large W.G., Mc Williams J.C. and Doney S.C. |
---|
265 | !! Reviews of Geophysics, 32, 4, November 1994 |
---|
266 | !! Comments in the code refer to this paper, particularly |
---|
267 | !! the equation number. (LMD94, here after) |
---|
268 | !!---------------------------------------------------------------------- |
---|
269 | #if defined key_zdfddm |
---|
270 | USE oce , zviscos => ua, & ! temp. array for viscosities use ua as workspace |
---|
271 | & zdiffut => ta, & ! temp. array for diffusivities use sa as workspace |
---|
272 | & zdiffus => sa ! temp. array for diffusivities use sa as workspace |
---|
273 | #else |
---|
274 | USE oce , zviscos => ua, & ! temp. array for viscosities use ua as workspace |
---|
275 | & zdiffut => ta ! temp. array for diffusivities use sa as workspace |
---|
276 | #endif |
---|
277 | !! |
---|
278 | INTEGER, INTENT( in ) :: kt ! ocean time step |
---|
279 | !! |
---|
280 | |
---|
281 | END SUBROUTINE zdf_kpp_adj |
---|
282 | |
---|
283 | |
---|
284 | SUBROUTINE tra_kpp_adj |
---|
285 | !!---------------------------------------------------------------------- |
---|
286 | !! *** ROUTINE tra_kpp_adj *** |
---|
287 | !! |
---|
288 | !! ** Purpose : compute and add to the tracer trend the non-local |
---|
289 | !! tracer flux |
---|
290 | !! |
---|
291 | !! ** Method : ??? |
---|
292 | !! |
---|
293 | !! history : |
---|
294 | !! 9.0 ! 05-11 (G. Madec) Original code |
---|
295 | !!---------------------------------------------------------------------- |
---|
296 | !! * Modules used |
---|
297 | USE oce, ONLY : ztrdt => ua, & ! use ua as 3D workspace |
---|
298 | ztrds => va ! use va as 3D workspace |
---|
299 | !!---------------------------------------------------------------------- |
---|
300 | |
---|
301 | |
---|
302 | END SUBROUTINE tra_kpp_adj |
---|
303 | |
---|
304 | |
---|
305 | |
---|
306 | #else |
---|
307 | !!---------------------------------------------------------------------- |
---|
308 | !! Dummy module : NO KPP scheme |
---|
309 | !!---------------------------------------------------------------------- |
---|
310 | LOGICAL, PUBLIC, PARAMETER :: lk_zdfkpp = .FALSE. !: KPP flag |
---|
311 | CONTAINS |
---|
312 | SUBROUTINE zdf_kpp_tan( kt ) ! Empty routine |
---|
313 | INTEGER, INTENT( in ) :: kt ! ocean time step |
---|
314 | WRITE(*,*) 'zdf_kpp_tan: You should not have seen this print! error?', kt |
---|
315 | END SUBROUTINE zdf_kpp_tan |
---|
316 | SUBROUTINE tra_kpp_tan( kt ) ! Empty routine |
---|
317 | INTEGER, INTENT( in ) :: kt ! ocean time step |
---|
318 | WRITE(*,*) 'tra_kpp_tan: You should not have seen this print! error?', kt |
---|
319 | END SUBROUTINE tra_kpp_tan |
---|
320 | SUBROUTINE zdf_kpp_adj( kt ) ! Empty routine |
---|
321 | INTEGER, INTENT( in ) :: kt ! ocean time step |
---|
322 | WRITE(*,*) 'zdf_kpp_adj: You should not have seen this print! error?', kt |
---|
323 | END SUBROUTINE zdf_kpp_adj |
---|
324 | SUBROUTINE tra_kpp_adj( kt ) ! Empty routine |
---|
325 | INTEGER, INTENT( in ) :: kt ! ocean time step |
---|
326 | WRITE(*,*) 'tra_kpp_adj: You should not have seen this print! error?', kt |
---|
327 | END SUBROUTINE tra_kpp_adj |
---|
328 | #endif |
---|
329 | |
---|
330 | !!====================================================================== |
---|
331 | #endif |
---|
332 | END MODULE zdfkpp_tam |
---|
333 | |
---|