1 | ;+ |
---|
2 | ; |
---|
3 | ; Non penetrative convective adjustment scheme. solve the static |
---|
4 | ; instability of the water column. |
---|
5 | ; |
---|
6 | ; Method |
---|
7 | ; ------ |
---|
8 | ; The algorithm used converges in a maximium of jpk iterations. |
---|
9 | ; instabilities are treated when the vertical density gradient |
---|
10 | ; is less than 1.e-5. |
---|
11 | ; |
---|
12 | ; References : |
---|
13 | ; ----------- |
---|
14 | ; Madec et al., 1991, JPO, 21, 9, 1349-1371. |
---|
15 | ; |
---|
16 | ; @param S3D {in} |
---|
17 | ; potential density (what ever the reference is) at t-point |
---|
18 | ; |
---|
19 | ; @returns |
---|
20 | ; adjusted potential density field |
---|
21 | ; |
---|
22 | ; @uses |
---|
23 | ; <pro>common</pro> |
---|
24 | ; |
---|
25 | ; @history |
---|
26 | ; original : 90-09 (G. Madec) |
---|
27 | ; Additions : 01-06 (G. Madec) Idl version |
---|
28 | ; |
---|
29 | ; @version |
---|
30 | ; $Id$ |
---|
31 | ; |
---|
32 | ;- |
---|
33 | FUNCTION npc, s3d |
---|
34 | ; |
---|
35 | compile_opt idl2, strictarrsubs |
---|
36 | ; |
---|
37 | @common |
---|
38 | ;; |
---|
39 | ;; Definition des variables |
---|
40 | ;; |
---|
41 | ; Profils selon les niveaux du modele (suffixe _z) |
---|
42 | ; |
---|
43 | s_z = fltarr(jpk) ; profil de la densite |
---|
44 | ; |
---|
45 | ; Tableau de sortie |
---|
46 | ; |
---|
47 | rhos = fltarr(jpi, jpj, jpk) |
---|
48 | rhos = s3d |
---|
49 | ; |
---|
50 | ; ==================================== |
---|
51 | ; Loop over the horizontal domain (2D) |
---|
52 | ; ==================================== |
---|
53 | ; |
---|
54 | ncompt = 0 |
---|
55 | FOR i = 0, jpi-1 DO BEGIN |
---|
56 | FOR j = 0, jpj-1 DO BEGIN |
---|
57 | ; |
---|
58 | ; Indices des points T dans l ocean |
---|
59 | i_ocean = where(tmask[i,j,*] EQ 1) |
---|
60 | ; |
---|
61 | IF (i_ocean[0] NE -1) THEN BEGIN ; on n'entre que si il y a des points ocean |
---|
62 | ; |
---|
63 | ; density profil |
---|
64 | s_z[*]= s3d[i,j,*] |
---|
65 | ;s_z[*] = rho[i,j,*] |
---|
66 | ; |
---|
67 | ; 1. Static instability pointer |
---|
68 | ; ----------------------------- |
---|
69 | ; |
---|
70 | ds =(shift(s_z,-1)-s_z)[i_ocean[0:n_elements(i_ocean)-2]] |
---|
71 | ind_c = where(ds LT 0.) |
---|
72 | ; |
---|
73 | ; 2. Vertical mixing for each instable portion of the density profil |
---|
74 | ; |
---|
75 | IF ( ind_c[0] NE -1 ) THEN BEGIN |
---|
76 | ncompt=ncompt+1 |
---|
77 | ; print, 'static instability at i,j=', i,j |
---|
78 | ; |
---|
79 | ; -->> the density profil is statically instable : |
---|
80 | ; ikbot: last ocean level (just above the bottom) |
---|
81 | ikbot = n_elements(i_ocean)-1 |
---|
82 | ; vertical iteration |
---|
83 | jiter = 0 |
---|
84 | WHILE ( (ind_c[0] NE -1) AND (jiter LT jpk-1) ) DO BEGIN &$ |
---|
85 | jiter = jiter+1 &$ |
---|
86 | ; ikup : the first static instability from the sea surface |
---|
87 | ikup = ind_c[0] &$ |
---|
88 | ; the density profil is instable below ikup |
---|
89 | ; ikdown : bottom of the instable portion of the density profil |
---|
90 | ; search of ikdown and vertical mixing from ikup to ikdown |
---|
91 | ze3tot= e3t[ikup] &$ |
---|
92 | zraua = s_z[ikup] &$ |
---|
93 | jkdown = ikup+1 &$ |
---|
94 | ; |
---|
95 | WHILE (jkdown LE ikbot AND zraua GT s_z[jkdown] ) DO BEGIN &$ |
---|
96 | ze3dwn = e3t[jkdown] &$ |
---|
97 | ze3tot = ze3tot+ze3dwn &$ |
---|
98 | zraua = ( zraua*(ze3tot-ze3dwn) + s_z[jkdown]*ze3dwn )/ze3tot &$ |
---|
99 | jkdown=jkdown+1 &$ |
---|
100 | ; print, jkdown, zraua &$ |
---|
101 | ENDWHILE &$ |
---|
102 | ; |
---|
103 | FOR jkp = ikup,jkdown-1 DO BEGIN &$ |
---|
104 | s_z[jkp] = zraua &$ |
---|
105 | ENDFOR &$ |
---|
106 | ds =(shift(s_z, -1)-s_z)[i_ocean[0:n_elements(i_ocean)-2]] &$ |
---|
107 | ind_c = where(ds LT 0.) &$ |
---|
108 | ENDWHILE |
---|
109 | ENDIF |
---|
110 | ; save the modifications |
---|
111 | rhos[i,j,*] = s_z[*] |
---|
112 | ; |
---|
113 | ; <<-- no more static instability on slab jj |
---|
114 | ; |
---|
115 | ENDIF |
---|
116 | ENDFOR |
---|
117 | ENDFOR |
---|
118 | ; |
---|
119 | print, ' number of static instability treated : ', ncompt |
---|
120 | ; sortie: |
---|
121 | return, rhos |
---|
122 | END |
---|