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