1 | MODULE zdfosm |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE zdfosm *** |
---|
4 | !! Ocean physics: vertical mixing coefficient compute from the OSMOSIS |
---|
5 | !! turbulent closure parameterization |
---|
6 | !!===================================================================== |
---|
7 | !! History : NEMO 4.0 ! A. Grant, G. Nurser |
---|
8 | !! 15/03/2017 Changed calculation of pycnocline thickness in unstable conditions and stable conditions AG |
---|
9 | !! 15/03/2017 Calculation of pycnocline gradients for stable conditions changed. Pycnocline gradients now depend on stability of the OSBL. A.G |
---|
10 | !! 06/06/2017 (1) Checks on sign of buoyancy jump in calculation of OSBL depth. A.G. |
---|
11 | !! (2) Removed variable zbrad0, zbradh and zbradav since they are not used. |
---|
12 | !! (3) Approximate treatment for shear turbulence. |
---|
13 | !! Minimum values for zustar and zustke. |
---|
14 | !! Add velocity scale, zvstr, that tends to zustar for large Langmuir numbers. |
---|
15 | !! Limit maximum value for Langmuir number. |
---|
16 | !! Use zvstr in definition of stability parameter zhol. |
---|
17 | !! (4) Modified parametrization of entrainment flux, changing original coefficient 0.0485 for Langmuir contribution to 0.135 * zla |
---|
18 | !! (5) For stable boundary layer add factor that depends on length of timestep to 'slow' collapse and growth. Make sure buoyancy jump not negative. |
---|
19 | !! (6) For unstable conditions when growth is over multiple levels, limit change to maximum of one level per cycle through loop. |
---|
20 | !! (7) Change lower limits for loops that calculate OSBL averages from 1 to 2. Large gradients between levels 1 and 2 can cause problems. |
---|
21 | !! (8) Change upper limits from ibld-1 to ibld. |
---|
22 | !! (9) Calculation of pycnocline thickness in unstable conditions. Check added to ensure that buoyancy jump is positive before calculating Ri. |
---|
23 | !! (10) Thickness of interface layer at base of the stable OSBL set by Richardson number. Gives continuity in transition from unstable OSBL. |
---|
24 | !! (11) Checks that buoyancy jump is poitive when calculating pycnocline profiles. |
---|
25 | !! (12) Replace zwstrl with zvstr in calculation of eddy viscosity. |
---|
26 | !! 27/09/2017 (13) Calculate Stokes drift and Stokes penetration depth from wave information |
---|
27 | !! (14) Bouyancy flux due to entrainment changed to include contribution from shear turbulence (for testing commented out). |
---|
28 | !! 28/09/2017 (15) Calculation of Stokes drift moved into separate do-loops to allow for different options for the determining the Stokes drift to be added. |
---|
29 | !! (16) Calculation of Stokes drift from windspeed for PM spectrum (for testing, commented out) |
---|
30 | !! (17) Modification to Langmuir velocity scale to include effects due to the Stokes penetration depth (for testing, commented out) |
---|
31 | !!---------------------------------------------------------------------- |
---|
32 | |
---|
33 | !!---------------------------------------------------------------------- |
---|
34 | !! 'key_zdfosm' OSMOSIS scheme |
---|
35 | !!---------------------------------------------------------------------- |
---|
36 | !! zdf_osm : update momentum and tracer Kz from osm scheme |
---|
37 | !! zdf_osm_init : initialization, namelist read, and parameters control |
---|
38 | !! osm_rst : read (or initialize) and write osmosis restart fields |
---|
39 | !! tra_osm : compute and add to the T & S trend the non-local flux |
---|
40 | !! trc_osm : compute and add to the passive tracer trend the non-local flux (TBD) |
---|
41 | !! dyn_osm : compute and add to u & v trensd the non-local flux |
---|
42 | !!---------------------------------------------------------------------- |
---|
43 | USE oce ! ocean dynamics and active tracers |
---|
44 | ! uses wn from previous time step (which is now wb) to calculate hbl |
---|
45 | USE dom_oce ! ocean space and time domain |
---|
46 | USE zdf_oce ! ocean vertical physics |
---|
47 | USE sbc_oce ! surface boundary condition: ocean |
---|
48 | USE sbcwave ! surface wave parameters |
---|
49 | USE phycst ! physical constants |
---|
50 | USE eosbn2 ! equation of state |
---|
51 | USE traqsr ! details of solar radiation absorption |
---|
52 | USE zdfddm ! double diffusion mixing (avs array) |
---|
53 | USE iom ! I/O library |
---|
54 | USE lib_mpp ! MPP library |
---|
55 | USE trd_oce ! ocean trends definition |
---|
56 | USE trdtra ! tracers trends |
---|
57 | ! |
---|
58 | USE in_out_manager ! I/O manager |
---|
59 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
60 | USE prtctl ! Print control |
---|
61 | USE timing ! Timing |
---|
62 | USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) |
---|
63 | |
---|
64 | IMPLICIT NONE |
---|
65 | PRIVATE |
---|
66 | |
---|
67 | PUBLIC zdf_osm ! routine called by step.F90 |
---|
68 | PUBLIC zdf_osm_init ! routine called by nemogcm.F90 |
---|
69 | PUBLIC osm_rst ! routine called by step.F90 |
---|
70 | PUBLIC tra_osm ! routine called by step.F90 |
---|
71 | PUBLIC trc_osm ! routine called by trcstp.F90 |
---|
72 | PUBLIC dyn_osm ! routine called by 'step.F90' |
---|
73 | |
---|
74 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ghamu !: non-local u-momentum flux |
---|
75 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ghamv !: non-local v-momentum flux |
---|
76 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ghamt !: non-local temperature flux (gamma/<ws>o) |
---|
77 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ghams !: non-local salinity flux (gamma/<ws>o) |
---|
78 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: etmean !: averaging operator for avt |
---|
79 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hbl !: boundary layer depth |
---|
80 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hbli !: intial boundary layer depth for stable blayer |
---|
81 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: dstokes !: penetration depth of the Stokes drift. |
---|
82 | |
---|
83 | ! !!** Namelist namzdf_osm ** |
---|
84 | LOGICAL :: ln_use_osm_la ! Use namelist rn_osm_la |
---|
85 | REAL(wp) :: rn_osm_la ! Turbulent Langmuir number |
---|
86 | REAL(wp) :: rn_osm_dstokes ! Depth scale of Stokes drift |
---|
87 | REAL(wp) :: rn_osm_hbl0 = 10._wp ! Initial value of hbl for 1D runs |
---|
88 | INTEGER :: nn_ave ! = 0/1 flag for horizontal average on avt |
---|
89 | INTEGER :: nn_osm_wave = 0 ! = 0/1/2 flag for getting stokes drift from La# / PM wind-waves/Inputs into sbcwave |
---|
90 | LOGICAL :: ln_dia_osm ! Use namelist rn_osm_la |
---|
91 | |
---|
92 | |
---|
93 | LOGICAL :: ln_kpprimix = .true. ! Shear instability mixing |
---|
94 | REAL(wp) :: rn_riinfty = 0.7 ! local Richardson Number limit for shear instability |
---|
95 | REAL(wp) :: rn_difri = 0.005 ! maximum shear mixing at Rig = 0 (m2/s) |
---|
96 | LOGICAL :: ln_convmix = .true. ! Convective instability mixing |
---|
97 | REAL(wp) :: rn_difconv = 1._wp ! diffusivity when unstable below BL (m2/s) |
---|
98 | |
---|
99 | ! !!! ** General constants ** |
---|
100 | REAL(wp) :: epsln = 1.0e-20_wp ! a small positive number |
---|
101 | REAL(wp) :: pthird = 1._wp/3._wp ! 1/3 |
---|
102 | REAL(wp) :: p2third = 2._wp/3._wp ! 2/3 |
---|
103 | |
---|
104 | INTEGER :: idebug = 236 |
---|
105 | INTEGER :: jdebug = 228 |
---|
106 | !!---------------------------------------------------------------------- |
---|
107 | !! NEMO/OPA 4.0 , NEMO Consortium (2011) |
---|
108 | !! $Id$ |
---|
109 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
110 | !!---------------------------------------------------------------------- |
---|
111 | CONTAINS |
---|
112 | |
---|
113 | INTEGER FUNCTION zdf_osm_alloc() |
---|
114 | !!---------------------------------------------------------------------- |
---|
115 | !! *** FUNCTION zdf_osm_alloc *** |
---|
116 | !!---------------------------------------------------------------------- |
---|
117 | ALLOCATE( ghamu(jpi,jpj,jpk), ghamv(jpi,jpj,jpk), ghamt(jpi,jpj,jpk), ghams(jpi,jpj,jpk), & |
---|
118 | & hbl(jpi,jpj) , hbli(jpi,jpj) , dstokes(jpi, jpj) , & |
---|
119 | & etmean(jpi,jpj,jpk), STAT= zdf_osm_alloc ) |
---|
120 | IF( zdf_osm_alloc /= 0 ) CALL ctl_warn('zdf_osm_alloc: failed to allocate zdf_osm arrays') |
---|
121 | IF( lk_mpp ) CALL mpp_sum ( zdf_osm_alloc ) |
---|
122 | END FUNCTION zdf_osm_alloc |
---|
123 | |
---|
124 | |
---|
125 | SUBROUTINE zdf_osm( kt, p_avm, p_avt ) |
---|
126 | !!---------------------------------------------------------------------- |
---|
127 | !! *** ROUTINE zdf_osm *** |
---|
128 | !! |
---|
129 | !! ** Purpose : Compute the vertical eddy viscosity and diffusivity |
---|
130 | !! coefficients and non local mixing using the OSMOSIS scheme |
---|
131 | !! |
---|
132 | !! ** Method : The boundary layer depth hosm is diagnosed at tracer points |
---|
133 | !! from profiles of buoyancy, and shear, and the surface forcing. |
---|
134 | !! Above hbl (sigma=-z/hbl <1) the mixing coefficients are computed from |
---|
135 | !! |
---|
136 | !! Kx = hosm Wx(sigma) G(sigma) |
---|
137 | !! |
---|
138 | !! and the non local term ghamt = Cs / Ws(sigma) / hosm |
---|
139 | !! Below hosm the coefficients are the sum of mixing due to internal waves |
---|
140 | !! shear instability and double diffusion. |
---|
141 | !! |
---|
142 | !! -1- Compute the now interior vertical mixing coefficients at all depths. |
---|
143 | !! -2- Diagnose the boundary layer depth. |
---|
144 | !! -3- Compute the now boundary layer vertical mixing coefficients. |
---|
145 | !! -4- Compute the now vertical eddy vicosity and diffusivity. |
---|
146 | !! -5- Smoothing |
---|
147 | !! |
---|
148 | !! N.B. The computation is done from jk=2 to jpkm1 |
---|
149 | !! Surface value of avt are set once a time to zero |
---|
150 | !! in routine zdf_osm_init. |
---|
151 | !! |
---|
152 | !! ** Action : update the non-local terms ghamts |
---|
153 | !! update avt (before vertical eddy coef.) |
---|
154 | !! |
---|
155 | !! References : Large W.G., Mc Williams J.C. and Doney S.C. |
---|
156 | !! Reviews of Geophysics, 32, 4, November 1994 |
---|
157 | !! Comments in the code refer to this paper, particularly |
---|
158 | !! the equation number. (LMD94, here after) |
---|
159 | !!---------------------------------------------------------------------- |
---|
160 | INTEGER , INTENT(in ) :: kt ! ocean time step |
---|
161 | REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: p_avm, p_avt ! momentum and tracer Kz (w-points) |
---|
162 | !! |
---|
163 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
164 | INTEGER :: ikbot, jkmax, jkm1, jkp2 ! |
---|
165 | |
---|
166 | REAL(wp) :: ztx, zty, zflageos, zstabl, zbuofdep,zucube ! |
---|
167 | REAL(wp) :: zalbet, zbeta, zthermal, zatt1 ! |
---|
168 | REAL(wp) :: zehat, zeta, zhrib, zsig, zscale, zwst, zws, zwm ! Velocity scales |
---|
169 | REAL(wp) :: zwsun, zwmun, zcons, zconm, zwcons, zwconm ! |
---|
170 | REAL(wp) :: zsr, zbw, ze, zb, zd, zc, zaw, za, zb1, za1, zkw, zk0, zcomp , zrhd,zrhdr,zbvzed ! In situ density |
---|
171 | INTEGER :: jm ! dummy loop indices |
---|
172 | REAL(wp) :: zr1, zr2, zr3, zr4, zrhop ! Compression terms |
---|
173 | REAL(wp) :: zflag, zrn2, zdep21, zdep32, zdep43 |
---|
174 | REAL(wp) :: zesh2, zri, zfri ! Interior richardson mixing |
---|
175 | REAL(wp) :: zdelta, zdelta2, zdzup, zdzdn, zdzh, zvath, zgat1, zdat1, zkm1m, zkm1t |
---|
176 | REAL(wp) :: zt,zs,zu,zv,zrh ! variables used in constructing averages |
---|
177 | ! Scales |
---|
178 | REAL(wp), DIMENSION(jpi,jpj) :: zrad0 ! Surface solar temperature flux (deg m/s) |
---|
179 | REAL(wp), DIMENSION(jpi,jpj) :: zradh ! Radiative flux at bl base (Buoyancy units) |
---|
180 | REAL(wp), DIMENSION(jpi,jpj) :: zradav ! Radiative flux, bl average (Buoyancy Units) |
---|
181 | REAL(wp), DIMENSION(jpi,jpj) :: zustar ! friction velocity |
---|
182 | REAL(wp), DIMENSION(jpi,jpj) :: zwstrl ! Langmuir velocity scale |
---|
183 | REAL(wp), DIMENSION(jpi,jpj) :: zvstr ! Velocity scale that ends to zustar for large Langmuir number. |
---|
184 | REAL(wp), DIMENSION(jpi,jpj) :: zwstrc ! Convective velocity scale |
---|
185 | REAL(wp), DIMENSION(jpi,jpj) :: zuw0 ! Surface u-momentum flux |
---|
186 | REAL(wp), DIMENSION(jpi,jpj) :: zvw0 ! Surface v-momentum flux |
---|
187 | REAL(wp), DIMENSION(jpi,jpj) :: zwth0 ! Surface heat flux (Kinematic) |
---|
188 | REAL(wp), DIMENSION(jpi,jpj) :: zws0 ! Surface freshwater flux |
---|
189 | REAL(wp), DIMENSION(jpi,jpj) :: zwb0 ! Surface buoyancy flux |
---|
190 | REAL(wp), DIMENSION(jpi,jpj) :: zwthav ! Heat flux - bl average |
---|
191 | REAL(wp), DIMENSION(jpi,jpj) :: zwsav ! freshwater flux - bl average |
---|
192 | REAL(wp), DIMENSION(jpi,jpj) :: zwbav ! Buoyancy flux - bl average |
---|
193 | REAL(wp), DIMENSION(jpi,jpj) :: zwb_ent ! Buoyancy entrainment flux |
---|
194 | REAL(wp), DIMENSION(jpi,jpj) :: zustke ! Surface Stokes drift |
---|
195 | REAL(wp), DIMENSION(jpi,jpj) :: zla ! Trubulent Langmuir number |
---|
196 | REAL(wp), DIMENSION(jpi,jpj) :: zcos_wind ! Cos angle of surface stress |
---|
197 | REAL(wp), DIMENSION(jpi,jpj) :: zsin_wind ! Sin angle of surface stress |
---|
198 | REAL(wp), DIMENSION(jpi,jpj) :: zhol ! Stability parameter for boundary layer |
---|
199 | LOGICAL, DIMENSION(:,:), ALLOCATABLE :: lconv ! unstable/stable bl |
---|
200 | |
---|
201 | ! mixed-layer variables |
---|
202 | |
---|
203 | INTEGER, DIMENSION(jpi,jpj) :: ibld ! level of boundary layer base |
---|
204 | INTEGER, DIMENSION(jpi,jpj) :: imld ! level of mixed-layer depth (pycnocline top) |
---|
205 | |
---|
206 | REAL(wp) :: ztgrad,zsgrad,zbgrad ! Temporary variables used to calculate pycnocline gradients |
---|
207 | REAL(wp) :: zugrad,zvgrad ! temporary variables for calculating pycnocline shear |
---|
208 | |
---|
209 | REAL(wp), DIMENSION(jpi,jpj) :: zhbl ! bl depth - grid |
---|
210 | REAL(wp), DIMENSION(jpi,jpj) :: zhml ! ml depth - grid |
---|
211 | REAL(wp), DIMENSION(jpi,jpj) :: zdh ! pycnocline depth - grid |
---|
212 | REAL(wp), DIMENSION(jpi,jpj) :: zdhdt ! BL depth tendency |
---|
213 | REAL(wp), DIMENSION(jpi,jpj) :: zt_bl,zs_bl,zu_bl,zv_bl,zrh_bl ! averages over the depth of the blayer |
---|
214 | REAL(wp), DIMENSION(jpi,jpj) :: zt_ml,zs_ml,zu_ml,zv_ml,zrh_ml ! averages over the depth of the mixed layer |
---|
215 | REAL(wp), DIMENSION(jpi,jpj) :: zdt_bl,zds_bl,zdu_bl,zdv_bl,zdrh_bl,zdb_bl ! difference between blayer average and parameter at base of blayer |
---|
216 | REAL(wp), DIMENSION(jpi,jpj) :: zdt_ml,zds_ml,zdu_ml,zdv_ml,zdrh_ml,zdb_ml ! difference between mixed layer average and parameter at base of blayer |
---|
217 | REAL(wp), DIMENSION(jpi,jpj) :: zwth_ent,zws_ent ! heat and salinity fluxes at the top of the pycnocline |
---|
218 | REAL(wp), DIMENSION(jpi,jpj) :: zuw_bse,zvw_bse ! momentum fluxes at the top of the pycnocline |
---|
219 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: zdtdz_pyc ! parametrized gradient of temperature in pycnocline |
---|
220 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: zdsdz_pyc ! parametrised gradient of salinity in pycnocline |
---|
221 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: zdbdz_pyc ! parametrised gradient of buoyancy in the pycnocline |
---|
222 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: zdudz_pyc ! u-shear across the pycnocline |
---|
223 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: zdvdz_pyc ! v-shear across the pycnocline |
---|
224 | |
---|
225 | ! Flux-gradient relationship variables |
---|
226 | |
---|
227 | REAL(wp) :: zl_c,zl_l,zl_eps ! Used to calculate turbulence length scale. |
---|
228 | |
---|
229 | REAL(wp), DIMENSION(jpi,jpj) :: zdifml_sc,zvisml_sc,zdifpyc_sc,zvispyc_sc,zbeta_d_sc,zbeta_v_sc ! Scales for eddy diffusivity/viscosity |
---|
230 | REAL(wp), DIMENSION(jpi,jpj) :: zsc_wth_1,zsc_ws_1 ! Temporary scales used to calculate scalar non-gradient terms. |
---|
231 | REAL(wp), DIMENSION(jpi,jpj) :: zsc_uw_1,zsc_uw_2,zsc_vw_1,zsc_vw_2 ! Temporary scales for non-gradient momentum flux terms. |
---|
232 | REAL(wp), DIMENSION(jpi,jpj) :: zhbl_t ! holds boundary layer depth updated by full timestep |
---|
233 | |
---|
234 | ! For calculating Ri#-dependent mixing |
---|
235 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: z3du ! u-shear^2 |
---|
236 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: z3dv ! v-shear^2 |
---|
237 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: zrimix ! spatial form of ri#-induced diffusion |
---|
238 | |
---|
239 | ! Temporary variables |
---|
240 | INTEGER :: inhml |
---|
241 | INTEGER :: i_lconv_alloc |
---|
242 | REAL(wp) :: znd,znd_d,zznd_ml,zznd_pyc,zznd_d ! temporary non-dimensional depths used in various routines |
---|
243 | REAL(wp) :: ztemp, zari, zpert, zzdhdt, zdb ! temporary variables |
---|
244 | REAL(wp) :: zthick, zz0, zz1 ! temporary variables |
---|
245 | REAL(wp) :: zvel_max, zhbl_s ! temporary variables |
---|
246 | REAL(wp) :: zfac ! temporary variable |
---|
247 | REAL(wp) :: zus_x, zus_y ! temporary Stokes drift |
---|
248 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: zviscos ! viscosity |
---|
249 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: zdiffut ! t-diffusivity |
---|
250 | |
---|
251 | ! For debugging |
---|
252 | INTEGER :: ikt |
---|
253 | !!-------------------------------------------------------------------- |
---|
254 | ! |
---|
255 | IF( ln_timing ) CALL timing_start('zdf_osm') |
---|
256 | ! |
---|
257 | ALLOCATE( lconv(jpi,jpj), STAT= i_lconv_alloc ) |
---|
258 | IF( i_lconv_alloc /= 0 ) CALL ctl_warn('zdf_osm: failed to allocate lconv') |
---|
259 | |
---|
260 | ibld(:,:) = 0 ; imld(:,:) = 0 |
---|
261 | zrad0(:,:) = 0._wp ; zradh(:,:) = 0._wp ; zradav(:,:) = 0._wp ; zustar(:,:) = 0._wp |
---|
262 | zwstrl(:,:) = 0._wp ; zvstr(:,:) = 0._wp ; zwstrc(:,:) = 0._wp ; zuw0(:,:) = 0._wp |
---|
263 | zvw0(:,:) = 0._wp ; zwth0(:,:) = 0._wp ; zws0(:,:) = 0._wp ; zwb0(:,:) = 0._wp |
---|
264 | zwthav(:,:) = 0._wp ; zwsav(:,:) = 0._wp ; zwbav(:,:) = 0._wp ; zwb_ent(:,:) = 0._wp |
---|
265 | zustke(:,:) = 0._wp ; zla(:,:) = 0._wp ; zcos_wind(:,:) = 0._wp ; zsin_wind(:,:) = 0._wp |
---|
266 | zhol(:,:) = 0._wp |
---|
267 | lconv(:,:) = .FALSE. |
---|
268 | ! mixed layer |
---|
269 | ! no initialization of zhbl or zhml (or zdh?) |
---|
270 | zhbl(:,:) = 1._wp ; zhml(:,:) = 1._wp ; zdh(:,:) = 1._wp ; zdhdt(:,:) = 0._wp |
---|
271 | zt_bl(:,:) = 0._wp ; zs_bl(:,:) = 0._wp ; zu_bl(:,:) = 0._wp ; zv_bl(:,:) = 0._wp |
---|
272 | zrh_bl(:,:) = 0._wp ; zt_ml(:,:) = 0._wp ; zs_ml(:,:) = 0._wp ; zu_ml(:,:) = 0._wp |
---|
273 | zv_ml(:,:) = 0._wp ; zrh_ml(:,:) = 0._wp ; zdt_bl(:,:) = 0._wp ; zds_bl(:,:) = 0._wp |
---|
274 | zdu_bl(:,:) = 0._wp ; zdv_bl(:,:) = 0._wp ; zdrh_bl(:,:) = 0._wp ; zdb_bl(:,:) = 0._wp |
---|
275 | zdt_ml(:,:) = 0._wp ; zds_ml(:,:) = 0._wp ; zdu_ml(:,:) = 0._wp ; zdv_ml(:,:) = 0._wp |
---|
276 | zdrh_ml(:,:) = 0._wp ; zdb_ml(:,:) = 0._wp ; zwth_ent(:,:) = 0._wp ; zws_ent(:,:) = 0._wp |
---|
277 | zuw_bse(:,:) = 0._wp ; zvw_bse(:,:) = 0._wp |
---|
278 | ! |
---|
279 | zdtdz_pyc(:,:,:) = 0._wp ; zdsdz_pyc(:,:,:) = 0._wp ; zdbdz_pyc(:,:,:) = 0._wp |
---|
280 | zdudz_pyc(:,:,:) = 0._wp ; zdvdz_pyc(:,:,:) = 0._wp |
---|
281 | ! |
---|
282 | ! Flux-Gradient arrays. |
---|
283 | zdifml_sc(:,:) = 0._wp ; zvisml_sc(:,:) = 0._wp ; zdifpyc_sc(:,:) = 0._wp |
---|
284 | zvispyc_sc(:,:) = 0._wp ; zbeta_d_sc(:,:) = 0._wp ; zbeta_v_sc(:,:) = 0._wp |
---|
285 | zsc_wth_1(:,:) = 0._wp ; zsc_ws_1(:,:) = 0._wp ; zsc_uw_1(:,:) = 0._wp |
---|
286 | zsc_uw_2(:,:) = 0._wp ; zsc_vw_1(:,:) = 0._wp ; zsc_vw_2(:,:) = 0._wp |
---|
287 | zhbl_t(:,:) = 0._wp ; zdhdt(:,:) = 0._wp |
---|
288 | |
---|
289 | zdiffut(:,:,:) = 0._wp ; zviscos(:,:,:) = 0._wp ; ghamt(:,:,:) = 0._wp |
---|
290 | ghams(:,:,:) = 0._wp ; ghamu(:,:,:) = 0._wp ; ghamv(:,:,:) = 0._wp |
---|
291 | |
---|
292 | ! hbl = MAX(hbl,epsln) |
---|
293 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
294 | ! Calculate boundary layer scales |
---|
295 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
296 | |
---|
297 | ! Assume two-band radiation model for depth of OSBL |
---|
298 | zz0 = rn_abs ! surface equi-partition in 2-bands |
---|
299 | zz1 = 1. - rn_abs |
---|
300 | DO jj = 2, jpjm1 |
---|
301 | DO ji = 2, jpim1 |
---|
302 | ! Surface downward irradiance (so always +ve) |
---|
303 | zrad0(ji,jj) = qsr(ji,jj) * r1_rau0_rcp |
---|
304 | ! Downwards irradiance at base of boundary layer |
---|
305 | zradh(ji,jj) = zrad0(ji,jj) * ( zz0 * EXP( -hbl(ji,jj)/rn_si0 ) + zz1 * EXP( -hbl(ji,jj)/rn_si1) ) |
---|
306 | ! Downwards irradiance averaged over depth of the OSBL |
---|
307 | zradav(ji,jj) = zrad0(ji,jj) * ( zz0 * ( 1.0 - EXP( -hbl(ji,jj)/rn_si0 ) )*rn_si0 & |
---|
308 | & + zz1 * ( 1.0 - EXP( -hbl(ji,jj)/rn_si1 ) )*rn_si1 ) / hbl(ji,jj) |
---|
309 | END DO |
---|
310 | END DO |
---|
311 | ! Turbulent surface fluxes and fluxes averaged over depth of the OSBL |
---|
312 | DO jj = 2, jpjm1 |
---|
313 | DO ji = 2, jpim1 |
---|
314 | zthermal = rab_n(ji,jj,1,jp_tem) |
---|
315 | zbeta = rab_n(ji,jj,1,jp_sal) |
---|
316 | ! Upwards surface Temperature flux for non-local term |
---|
317 | zwth0(ji,jj) = - qns(ji,jj) * r1_rau0_rcp * tmask(ji,jj,1) |
---|
318 | ! Upwards surface salinity flux for non-local term |
---|
319 | zws0(ji,jj) = - ( ( emp(ji,jj)-rnf(ji,jj) ) * tsn(ji,jj,1,jp_sal) + sfx(ji,jj) ) * r1_rau0 * tmask(ji,jj,1) |
---|
320 | ! Non radiative upwards surface buoyancy flux |
---|
321 | zwb0(ji,jj) = grav * zthermal * zwth0(ji,jj) - grav * zbeta * zws0(ji,jj) |
---|
322 | ! turbulent heat flux averaged over depth of OSBL |
---|
323 | zwthav(ji,jj) = 0.5 * zwth0(ji,jj) - ( 0.5*( zrad0(ji,jj) + zradh(ji,jj) ) - zradav(ji,jj) ) |
---|
324 | ! turbulent salinity flux averaged over depth of the OBSL |
---|
325 | zwsav(ji,jj) = 0.5 * zws0(ji,jj) |
---|
326 | ! turbulent buoyancy flux averaged over the depth of the OBSBL |
---|
327 | zwbav(ji,jj) = grav * zthermal * zwthav(ji,jj) - grav * zbeta * zwsav(ji,jj) |
---|
328 | ! Surface upward velocity fluxes |
---|
329 | zuw0(ji,jj) = -utau(ji,jj) * r1_rau0 * tmask(ji,jj,1) |
---|
330 | zvw0(ji,jj) = -vtau(ji,jj) * r1_rau0 * tmask(ji,jj,1) |
---|
331 | ! Friction velocity (zustar), at T-point : LMD94 eq. 2 |
---|
332 | zustar(ji,jj) = MAX( SQRT( SQRT( zuw0(ji,jj) * zuw0(ji,jj) + zvw0(ji,jj) * zvw0(ji,jj) ) ), 1.0e-8 ) |
---|
333 | zcos_wind(ji,jj) = -zuw0(ji,jj) / ( zustar(ji,jj) * zustar(ji,jj) ) |
---|
334 | zsin_wind(ji,jj) = -zvw0(ji,jj) / ( zustar(ji,jj) * zustar(ji,jj) ) |
---|
335 | END DO |
---|
336 | END DO |
---|
337 | ! Calculate Stokes drift in direction of wind (zustke) and Stokes penetration depth (dstokes) |
---|
338 | SELECT CASE (nn_osm_wave) |
---|
339 | ! Assume constant La#=0.3 |
---|
340 | CASE(0) |
---|
341 | DO jj = 2, jpjm1 |
---|
342 | DO ji = 2, jpim1 |
---|
343 | zus_x = zcos_wind(ji,jj) * zustar(ji,jj) / 0.3**2 |
---|
344 | zus_y = zsin_wind(ji,jj) * zustar(ji,jj) / 0.3**2 |
---|
345 | zustke(ji,jj) = MAX ( SQRT( zus_x*zus_x + zus_y*zus_y), 1.0e-8 ) |
---|
346 | ! dstokes(ji,jj) set to constant value rn_osm_dstokes from namelist in zdf_osm_init |
---|
347 | END DO |
---|
348 | END DO |
---|
349 | ! Assume Pierson-Moskovitz wind-wave spectrum |
---|
350 | CASE(1) |
---|
351 | DO jj = 2, jpjm1 |
---|
352 | DO ji = 2, jpim1 |
---|
353 | ! Use wind speed wndm included in sbc_oce module |
---|
354 | zustke(ji,jj) = MAX ( 0.016 * wndm(ji,jj), 1.0e-8 ) |
---|
355 | dstokes(ji,jj) = 0.12 * wndm(ji,jj)**2 / grav |
---|
356 | END DO |
---|
357 | END DO |
---|
358 | ! Use ECMWF wave fields as output from SBCWAVE |
---|
359 | CASE(2) |
---|
360 | zfac = 2.0_wp * rpi / 16.0_wp |
---|
361 | DO jj = 2, jpjm1 |
---|
362 | DO ji = 2, jpim1 |
---|
363 | ! The Langmur number from the ECMWF model appears to give La<0.3 for wind-driven seas. |
---|
364 | ! The coefficient 0.8 gives La=0.3 in this situation. |
---|
365 | ! It could represent the effects of the spread of wave directions |
---|
366 | ! around the mean wind. The effect of this adjustment needs to be tested. |
---|
367 | zustke(ji,jj) = MAX (1.0 * ( zcos_wind(ji,jj) * ut0sd(ji,jj) + zsin_wind(ji,jj) * vt0sd(ji,jj) ), zustar(ji,jj)/(0.45*0.45 )) |
---|
368 | dstokes(ji,jj) = MAX(zfac * hsw(ji,jj)*hsw(ji,jj) / ( MAX(zustke(ji,jj)*wmp(ji,jj), 1.0e-7 ) ), 5.0e-1) !rn_osm_dstokes ! |
---|
369 | END DO |
---|
370 | END DO |
---|
371 | END SELECT |
---|
372 | |
---|
373 | ! Langmuir velocity scale (zwstrl), La # (zla) |
---|
374 | ! mixed scale (zvstr), convective velocity scale (zwstrc) |
---|
375 | DO jj = 2, jpjm1 |
---|
376 | DO ji = 2, jpim1 |
---|
377 | ! Langmuir velocity scale (zwstrl), at T-point |
---|
378 | zwstrl(ji,jj) = ( zustar(ji,jj) * zustar(ji,jj) * zustke(ji,jj) )**pthird |
---|
379 | ! Modify zwstrl to allow for small and large values of dstokes/hbl. |
---|
380 | ! Intended as a possible test. Doesn't affect LES results for entrainment, |
---|
381 | ! but hasn't been shown to be correct as dstokes/h becomes large or small. |
---|
382 | zwstrl(ji,jj) = zwstrl(ji,jj) * & |
---|
383 | & (1.12 * ( 1.0 - ( 1.0 - EXP( -hbl(ji,jj) / dstokes(ji,jj) ) ) * dstokes(ji,jj) / hbl(ji,jj) ))**pthird * & |
---|
384 | & ( 1.0 - EXP( -15.0 * dstokes(ji,jj) / hbl(ji,jj) )) |
---|
385 | ! define La this way so effects of Stokes penetration depth on velocity scale are included |
---|
386 | zla(ji,jj) = SQRT ( zustar(ji,jj) / zwstrl(ji,jj) )**3 |
---|
387 | ! Velocity scale that tends to zustar for large Langmuir numbers |
---|
388 | zvstr(ji,jj) = ( zwstrl(ji,jj)**3 + & |
---|
389 | & ( 1.0 - EXP( -0.5 * zla(ji,jj)**2 ) ) * zustar(ji,jj) * zustar(ji,jj) * zustar(ji,jj) )**pthird |
---|
390 | |
---|
391 | ! limit maximum value of Langmuir number as approximate treatment for shear turbulence. |
---|
392 | ! Note zustke and zwstrl are not amended. |
---|
393 | IF ( zla(ji,jj) >= 0.45 ) zla(ji,jj) = 0.45 |
---|
394 | ! |
---|
395 | ! get convective velocity (zwstrc), stabilty scale (zhol) and logical conection flag lconv |
---|
396 | IF ( zwbav(ji,jj) > 0.0) THEN |
---|
397 | zwstrc(ji,jj) = ( 2.0 * zwbav(ji,jj) * 0.9 * hbl(ji,jj) )**pthird |
---|
398 | zhol(ji,jj) = -0.9 * hbl(ji,jj) * 2.0 * zwbav(ji,jj) / (zvstr(ji,jj)**3 + epsln ) |
---|
399 | lconv(ji,jj) = .TRUE. |
---|
400 | ELSE |
---|
401 | zhol(ji,jj) = -hbl(ji,jj) * 2.0 * zwbav(ji,jj)/ (zvstr(ji,jj)**3 + epsln ) |
---|
402 | lconv(ji,jj) = .FALSE. |
---|
403 | ENDIF |
---|
404 | END DO |
---|
405 | END DO |
---|
406 | |
---|
407 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
408 | ! Mixed-layer model - calculate averages over the boundary layer, and the change in the boundary layer depth |
---|
409 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
410 | ! BL must be always 2 levels deep. |
---|
411 | hbl(:,:) = MAX(hbl(:,:), gdepw_n(:,:,3) ) |
---|
412 | ibld(:,:) = 3 |
---|
413 | DO jk = 4, jpkm1 |
---|
414 | DO jj = 2, jpjm1 |
---|
415 | DO ji = 2, jpim1 |
---|
416 | IF ( hbl(ji,jj) >= gdepw_n(ji,jj,jk) ) THEN |
---|
417 | ibld(ji,jj) = MIN(mbkt(ji,jj), jk) |
---|
418 | ENDIF |
---|
419 | END DO |
---|
420 | END DO |
---|
421 | END DO |
---|
422 | |
---|
423 | DO jj = 2, jpjm1 ! Vertical slab |
---|
424 | DO ji = 2, jpim1 |
---|
425 | zthermal = rab_n(ji,jj,1,jp_tem) !ideally use ibld not 1?? |
---|
426 | zbeta = rab_n(ji,jj,1,jp_sal) |
---|
427 | zt = 0._wp |
---|
428 | zs = 0._wp |
---|
429 | zu = 0._wp |
---|
430 | zv = 0._wp |
---|
431 | ! average over depth of boundary layer |
---|
432 | zthick=0._wp |
---|
433 | DO jm = 2, ibld(ji,jj) |
---|
434 | zthick=zthick+e3t_n(ji,jj,jm) |
---|
435 | zt = zt + e3t_n(ji,jj,jm) * tsn(ji,jj,jm,jp_tem) |
---|
436 | zs = zs + e3t_n(ji,jj,jm) * tsn(ji,jj,jm,jp_sal) |
---|
437 | zu = zu + e3t_n(ji,jj,jm) & |
---|
438 | & * ( ub(ji,jj,jm) + ub(ji - 1,jj,jm) ) & |
---|
439 | & / MAX( 1. , umask(ji,jj,jm) + umask(ji - 1,jj,jm) ) |
---|
440 | zv = zv + e3t_n(ji,jj,jm) & |
---|
441 | & * ( vb(ji,jj,jm) + vb(ji,jj - 1,jm) ) & |
---|
442 | & / MAX( 1. , vmask(ji,jj,jm) + vmask(ji,jj - 1,jm) ) |
---|
443 | END DO |
---|
444 | zt_bl(ji,jj) = zt / zthick |
---|
445 | zs_bl(ji,jj) = zs / zthick |
---|
446 | zu_bl(ji,jj) = zu / zthick |
---|
447 | zv_bl(ji,jj) = zv / zthick |
---|
448 | zdt_bl(ji,jj) = zt_bl(ji,jj) - tsn(ji,jj,ibld(ji,jj),jp_tem) |
---|
449 | zds_bl(ji,jj) = zs_bl(ji,jj) - tsn(ji,jj,ibld(ji,jj),jp_sal) |
---|
450 | zdu_bl(ji,jj) = zu_bl(ji,jj) - ( ub(ji,jj,ibld(ji,jj)) + ub(ji-1,jj,ibld(ji,jj) ) ) & |
---|
451 | & / MAX(1. , umask(ji,jj,ibld(ji,jj) ) + umask(ji-1,jj,ibld(ji,jj) ) ) |
---|
452 | zdv_bl(ji,jj) = zv_bl(ji,jj) - ( vb(ji,jj,ibld(ji,jj)) + vb(ji,jj-1,ibld(ji,jj) ) ) & |
---|
453 | & / MAX(1. , vmask(ji,jj,ibld(ji,jj) ) + vmask(ji,jj-1,ibld(ji,jj) ) ) |
---|
454 | zdb_bl(ji,jj) = grav * zthermal * zdt_bl(ji,jj) - grav * zbeta * zds_bl(ji,jj) |
---|
455 | IF ( lconv(ji,jj) ) THEN ! Convective |
---|
456 | zwb_ent(ji,jj) = -( 2.0 * 0.2 * zwbav(ji,jj) & |
---|
457 | & + 0.135 * zla(ji,jj) * zwstrl(ji,jj)**3/hbl(ji,jj) ) |
---|
458 | |
---|
459 | zvel_max = - ( 1.0 + 1.0 * ( zwstrl(ji,jj)**3 + 0.5 * zwstrc(ji,jj)**3 )**pthird * rn_rdt / hbl(ji,jj) ) * zwb_ent(ji,jj) / & |
---|
460 | & ( zwstrl(ji,jj)**3 + 0.5 * zwstrc(ji,jj)**3 )**pthird |
---|
461 | ! Entrainment including component due to shear turbulence. Modified Langmuir component, but gives same result for La=0.3 For testing uncomment. |
---|
462 | ! zwb_ent(ji,jj) = -( 2.0 * 0.2 * zwbav(ji,jj) & |
---|
463 | ! & + ( 0.15 * ( 1.0 - EXP( -0.5 * zla(ji,jj) ) ) + 0.03 / zla(ji,jj)**2 ) * zustar(ji,jj)**3/hbl(ji,jj) ) |
---|
464 | |
---|
465 | ! zvel_max = - ( 1.0 + 1.0 * ( zvstr(ji,jj)**3 + 0.5 * zwstrc(ji,jj)**3 )**pthird * rn_rdt / zhbl(ji,jj) ) * zwb_ent(ji,jj) / & |
---|
466 | ! & ( zvstr(ji,jj)**3 + 0.5 * zwstrc(ji,jj)**3 )**pthird |
---|
467 | zzdhdt = - zwb_ent(ji,jj) / ( zvel_max + MAX(zdb_bl(ji,jj),0.0) ) |
---|
468 | ELSE ! Stable |
---|
469 | zzdhdt = 0.32 * ( hbli(ji,jj) / hbl(ji,jj) -1.0 ) * zwstrl(ji,jj)**3 / hbli(ji,jj) & |
---|
470 | & + ( ( 0.32 / 3.0 ) * exp ( -2.5 * ( hbli(ji,jj) / hbl(ji,jj) - 1.0 ) ) & |
---|
471 | & - ( 0.32 / 3.0 - 0.135 * zla(ji,jj) ) * exp ( -12.5 * ( hbli(ji,jj) / hbl(ji,jj) ) ) ) & |
---|
472 | & * zwstrl(ji,jj)**3 / hbli(ji,jj) |
---|
473 | zzdhdt = zzdhdt + zwbav(ji,jj) |
---|
474 | IF ( zzdhdt < 0._wp ) THEN |
---|
475 | ! For long timsteps factor in brackets slows the rapid collapse of the OSBL |
---|
476 | zpert = 2.0 * ( 1.0 + 2.0 * zwstrl(ji,jj) * rn_rdt / hbl(ji,jj) ) * zwstrl(ji,jj)**2 / hbl(ji,jj) |
---|
477 | ELSE |
---|
478 | zpert = 2.0 * ( 1.0 + 2.0 * zwstrl(ji,jj) * rn_rdt / hbl(ji,jj) ) * zwstrl(ji,jj)**2 / hbl(ji,jj) + MAX( zdb_bl(ji,jj),0.0 ) |
---|
479 | ENDIF |
---|
480 | zzdhdt = 2.0 * zzdhdt / zpert |
---|
481 | ENDIF |
---|
482 | zdhdt(ji,jj) = zzdhdt |
---|
483 | END DO |
---|
484 | END DO |
---|
485 | |
---|
486 | ! Calculate averages over depth of boundary layer |
---|
487 | imld = ibld ! use imld to hold previous blayer index |
---|
488 | ibld(:,:) = 3 |
---|
489 | |
---|
490 | zhbl_t(:,:) = hbl(:,:) + (zdhdt(:,:) - wn(ji,jj,ibld(ji,jj)))* rn_rdt ! certainly need wb here, so subtract it |
---|
491 | zhbl_t(:,:) = MIN(zhbl_t(:,:), ht_n(:,:)) |
---|
492 | zdhdt(:,:) = MIN(zdhdt(:,:), (zhbl_t(:,:) - hbl(:,:))/rn_rdt + wn(ji,jj,ibld(ji,jj))) ! adjustment to represent limiting by ocean bottom |
---|
493 | |
---|
494 | DO jk = 4, jpkm1 |
---|
495 | DO jj = 2, jpjm1 |
---|
496 | DO ji = 2, jpim1 |
---|
497 | IF ( zhbl_t(ji,jj) >= gdepw_n(ji,jj,jk) ) THEN |
---|
498 | ibld(ji,jj) = MIN(mbkt(ji,jj), jk) |
---|
499 | ENDIF |
---|
500 | END DO |
---|
501 | END DO |
---|
502 | END DO |
---|
503 | |
---|
504 | ! |
---|
505 | ! Step through model levels taking account of buoyancy change to determine the effect on dhdt |
---|
506 | ! |
---|
507 | DO jj = 2, jpjm1 |
---|
508 | DO ji = 2, jpim1 |
---|
509 | IF ( ibld(ji,jj) - imld(ji,jj) > 1 ) THEN |
---|
510 | ! |
---|
511 | ! If boundary layer changes by more than one level, need to check for stable layers between initial and final depths. |
---|
512 | ! |
---|
513 | zhbl_s = hbl(ji,jj) |
---|
514 | jm = imld(ji,jj) |
---|
515 | zthermal = rab_n(ji,jj,1,jp_tem) |
---|
516 | zbeta = rab_n(ji,jj,1,jp_sal) |
---|
517 | IF ( lconv(ji,jj) ) THEN |
---|
518 | !unstable |
---|
519 | zvel_max = -( 1.0 + 1.0 * ( zvstr(ji,jj)**3 + 0.5 * zwstrc(ji,jj)**3 )**pthird * rn_rdt / hbl(ji,jj) ) * zwb_ent(ji,jj) / & |
---|
520 | & ( zvstr(ji,jj)**3 + 0.5 * zwstrc(ji,jj)**3 )**pthird |
---|
521 | |
---|
522 | DO jk = imld(ji,jj), ibld(ji,jj) |
---|
523 | zdb = MAX( grav * ( zthermal * ( zt_bl(ji,jj) - tsn(ji,jj,jm,jp_tem) ) & |
---|
524 | & - zbeta * ( zs_bl(ji,jj) - tsn(ji,jj,jm,jp_sal) ) ), 0.0 ) + zvel_max |
---|
525 | |
---|
526 | zhbl_s = zhbl_s + MIN( - zwb_ent(ji,jj) / zdb * rn_rdt / FLOAT(ibld(ji,jj)-imld(ji,jj) ), e3w_n(ji,jj,jk) ) |
---|
527 | zhbl_s = MIN(zhbl_s, ht_n(ji,jj)) |
---|
528 | |
---|
529 | IF ( zhbl_s >= gdepw_n(ji,jj,jm+1) ) jm = jm + 1 |
---|
530 | END DO |
---|
531 | hbl(ji,jj) = zhbl_s |
---|
532 | ibld(ji,jj) = jm |
---|
533 | hbli(ji,jj) = hbl(ji,jj) |
---|
534 | ELSE |
---|
535 | ! stable |
---|
536 | DO jk = imld(ji,jj), ibld(ji,jj) |
---|
537 | zdb = MAX( grav * ( zthermal * ( zt_bl(ji,jj) - tsn(ji,jj,jm,jp_tem) ) - zbeta * ( zs_bl(ji,jj) - tsn(ji,jj,jm,jp_sal) ) ), 0.0 ) + & |
---|
538 | & 2.0 * zwstrl(ji,jj)**2 / zhbl_s |
---|
539 | |
---|
540 | zhbl_s = zhbl_s + (& |
---|
541 | & 0.32 * ( hbli(ji,jj) / zhbl_s -1.0 ) * zwstrl(ji,jj)**3 / hbli(ji,jj) + & |
---|
542 | & ( ( 0.32 / 3.0 ) * EXP( -2.5 * ( hbli(ji,jj) / zhbl_s -1.0 ) ) - & |
---|
543 | & ( 0.32 / 3.0 - 0.0485 ) * EXP( -12.5 * ( hbli(ji,jj) / zhbl_s ) ) ) * zwstrl(ji,jj)**3 / hbli(ji,jj) ) / zdb * & |
---|
544 | & e3w_n(ji,jj,jk) / zdhdt(ji,jj) ! ALMG to investigate whether need to include wn here |
---|
545 | |
---|
546 | zhbl_s = MIN(zhbl_s, ht_n(ji,jj)) |
---|
547 | IF ( zhbl_s >= gdepw_n(ji,jj,jm) ) jm = jm + 1 |
---|
548 | END DO |
---|
549 | hbl(ji,jj) = MAX(zhbl_s, gdepw_n(ji,jj,3) ) |
---|
550 | ibld(ji,jj) = MAX(jm, 3 ) |
---|
551 | IF ( hbl(ji,jj) > hbli(ji,jj) ) hbli(ji,jj) = hbl(ji,jj) |
---|
552 | ENDIF ! IF ( lconv ) |
---|
553 | ELSE |
---|
554 | ! change zero or one model level. |
---|
555 | hbl(ji,jj) = zhbl_t(ji,jj) |
---|
556 | IF ( lconv(ji,jj) ) THEN |
---|
557 | hbli(ji,jj) = hbl(ji,jj) |
---|
558 | ELSE |
---|
559 | hbl(ji,jj) = MAX(hbl(ji,jj), gdepw_n(ji,jj,3) ) |
---|
560 | IF ( hbl(ji,jj) > hbli(ji,jj) ) hbli(ji,jj) = hbl(ji,jj) |
---|
561 | ENDIF |
---|
562 | ENDIF |
---|
563 | zhbl(ji,jj) = gdepw_n(ji,jj,ibld(ji,jj)) |
---|
564 | END DO |
---|
565 | END DO |
---|
566 | dstokes(:,:) = MIN ( dstokes(:,:), hbl(:,:)/3. ) ! Limit delta for shallow boundary layers for calculating flux-gradient terms. |
---|
567 | |
---|
568 | ! Recalculate averages over boundary layer after depth updated |
---|
569 | ! Consider later combining this into the loop above and looking for columns |
---|
570 | ! where the index for base of the boundary layer have changed |
---|
571 | DO jj = 2, jpjm1 ! Vertical slab |
---|
572 | DO ji = 2, jpim1 |
---|
573 | zthermal = rab_n(ji,jj,1,jp_tem) !ideally use ibld not 1?? |
---|
574 | zbeta = rab_n(ji,jj,1,jp_sal) |
---|
575 | zt = 0._wp |
---|
576 | zs = 0._wp |
---|
577 | zu = 0._wp |
---|
578 | zv = 0._wp |
---|
579 | ! average over depth of boundary layer |
---|
580 | zthick=0._wp |
---|
581 | DO jm = 2, ibld(ji,jj) |
---|
582 | zthick=zthick+e3t_n(ji,jj,jm) |
---|
583 | zt = zt + e3t_n(ji,jj,jm) * tsn(ji,jj,jm,jp_tem) |
---|
584 | zs = zs + e3t_n(ji,jj,jm) * tsn(ji,jj,jm,jp_sal) |
---|
585 | zu = zu + e3t_n(ji,jj,jm) & |
---|
586 | & * ( ub(ji,jj,jm) + ub(ji - 1,jj,jm) ) & |
---|
587 | & / MAX( 1. , umask(ji,jj,jm) + umask(ji - 1,jj,jm) ) |
---|
588 | zv = zv + e3t_n(ji,jj,jm) & |
---|
589 | & * ( vb(ji,jj,jm) + vb(ji,jj - 1,jm) ) & |
---|
590 | & / MAX( 1. , vmask(ji,jj,jm) + vmask(ji,jj - 1,jm) ) |
---|
591 | END DO |
---|
592 | zt_bl(ji,jj) = zt / zthick |
---|
593 | zs_bl(ji,jj) = zs / zthick |
---|
594 | zu_bl(ji,jj) = zu / zthick |
---|
595 | zv_bl(ji,jj) = zv / zthick |
---|
596 | zdt_bl(ji,jj) = zt_bl(ji,jj) - tsn(ji,jj,ibld(ji,jj),jp_tem) |
---|
597 | zds_bl(ji,jj) = zs_bl(ji,jj) - tsn(ji,jj,ibld(ji,jj),jp_sal) |
---|
598 | zdu_bl(ji,jj) = zu_bl(ji,jj) - ( ub(ji,jj,ibld(ji,jj)) + ub(ji-1,jj,ibld(ji,jj) ) ) & |
---|
599 | & / MAX(1. , umask(ji,jj,ibld(ji,jj) ) + umask(ji-1,jj,ibld(ji,jj) ) ) |
---|
600 | zdv_bl(ji,jj) = zv_bl(ji,jj) - ( vb(ji,jj,ibld(ji,jj)) + vb(ji,jj-1,ibld(ji,jj) ) ) & |
---|
601 | & / MAX(1. , vmask(ji,jj,ibld(ji,jj) ) + vmask(ji,jj-1,ibld(ji,jj) ) ) |
---|
602 | zdb_bl(ji,jj) = grav * zthermal * zdt_bl(ji,jj) - grav * zbeta * zds_bl(ji,jj) |
---|
603 | zhbl(ji,jj) = gdepw_n(ji,jj,ibld(ji,jj)) |
---|
604 | IF ( lconv(ji,jj) ) THEN |
---|
605 | IF ( zdb_bl(ji,jj) > 0._wp )THEN |
---|
606 | IF ( ( zwstrc(ji,jj) / zvstr(ji,jj) )**3 <= 0.5 ) THEN ! near neutral stability |
---|
607 | zari = 4.5 * ( zvstr(ji,jj)**2 ) & |
---|
608 | & / ( zdb_bl(ji,jj) * zhbl(ji,jj) ) + 0.01 |
---|
609 | ELSE ! unstable |
---|
610 | zari = 4.5 * ( zwstrc(ji,jj)**2 ) & |
---|
611 | & / ( zdb_bl(ji,jj) * zhbl(ji,jj) ) + 0.01 |
---|
612 | ENDIF |
---|
613 | IF ( zari > 0.2 ) THEN ! This test checks for weakly stratified pycnocline |
---|
614 | zari = 0.2 |
---|
615 | zwb_ent(ji,jj) = 0._wp |
---|
616 | ENDIF |
---|
617 | inhml = MAX( INT( zari * zhbl(ji,jj) / e3t_n(ji,jj,ibld(ji,jj)) ) , 1 ) |
---|
618 | imld(ji,jj) = MAX( ibld(ji,jj) - inhml, 1) |
---|
619 | zhml(ji,jj) = gdepw_n(ji,jj,imld(ji,jj)) |
---|
620 | zdh(ji,jj) = zhbl(ji,jj) - zhml(ji,jj) |
---|
621 | ELSE ! IF (zdb_bl) |
---|
622 | imld(ji,jj) = ibld(ji,jj) - 1 |
---|
623 | zhml(ji,jj) = gdepw_n(ji,jj,imld(ji,jj)) |
---|
624 | zdh(ji,jj) = zhbl(ji,jj) - zhml(ji,jj) |
---|
625 | ENDIF |
---|
626 | ELSE ! IF (lconv) |
---|
627 | IF ( zdhdt(ji,jj) >= 0.0 ) THEN ! probably shouldn't include wm here |
---|
628 | ! boundary layer deepening |
---|
629 | IF ( zdb_bl(ji,jj) > 0._wp ) THEN |
---|
630 | ! pycnocline thickness set by stratification - use same relationship as for neutral conditions. |
---|
631 | zari = MIN( 4.5 * ( zvstr(ji,jj)**2 ) & |
---|
632 | & / ( zdb_bl(ji,jj) * zhbl(ji,jj) ) + 0.01 , 0.2 ) |
---|
633 | inhml = MAX( INT( zari * zhbl(ji,jj) / e3t_n(ji,jj,ibld(ji,jj)) ) , 1 ) |
---|
634 | imld(ji,jj) = MAX( ibld(ji,jj) - inhml, 1) |
---|
635 | zhml(ji,jj) = gdepw_n(ji,jj,imld(ji,jj)) |
---|
636 | zdh(ji,jj) = zhbl(ji,jj) - zhml(ji,jj) |
---|
637 | ELSE |
---|
638 | imld(ji,jj) = ibld(ji,jj) - 1 |
---|
639 | zhml(ji,jj) = gdepw_n(ji,jj,imld(ji,jj)) |
---|
640 | zdh(ji,jj) = zhbl(ji,jj) - zhml(ji,jj) |
---|
641 | ENDIF ! IF (zdb_bl > 0.0) |
---|
642 | ELSE ! IF(dhdt >= 0) |
---|
643 | ! boundary layer collapsing. |
---|
644 | imld(ji,jj) = ibld(ji,jj) |
---|
645 | zhml(ji,jj) = zhbl(ji,jj) |
---|
646 | zdh(ji,jj) = 0._wp |
---|
647 | ENDIF ! IF (dhdt >= 0) |
---|
648 | ENDIF ! IF (lconv) |
---|
649 | END DO |
---|
650 | END DO |
---|
651 | |
---|
652 | ! Average over the depth of the mixed layer in the convective boundary layer |
---|
653 | ! Also calculate entrainment fluxes for temperature and salinity |
---|
654 | DO jj = 2, jpjm1 ! Vertical slab |
---|
655 | DO ji = 2, jpim1 |
---|
656 | zthermal = rab_n(ji,jj,1,jp_tem) !ideally use ibld not 1?? |
---|
657 | zbeta = rab_n(ji,jj,1,jp_sal) |
---|
658 | IF ( lconv(ji,jj) ) THEN |
---|
659 | zt = 0._wp |
---|
660 | zs = 0._wp |
---|
661 | zu = 0._wp |
---|
662 | zv = 0._wp |
---|
663 | ! average over depth of boundary layer |
---|
664 | zthick=0._wp |
---|
665 | DO jm = 2, imld(ji,jj) |
---|
666 | zthick=zthick+e3t_n(ji,jj,jm) |
---|
667 | zt = zt + e3t_n(ji,jj,jm) * tsn(ji,jj,jm,jp_tem) |
---|
668 | zs = zs + e3t_n(ji,jj,jm) * tsn(ji,jj,jm,jp_sal) |
---|
669 | zu = zu + e3t_n(ji,jj,jm) & |
---|
670 | & * ( ub(ji,jj,jm) + ub(ji - 1,jj,jm) ) & |
---|
671 | & / MAX( 1. , umask(ji,jj,jm) + umask(ji - 1,jj,jm) ) |
---|
672 | zv = zv + e3t_n(ji,jj,jm) & |
---|
673 | & * ( vb(ji,jj,jm) + vb(ji,jj - 1,jm) ) & |
---|
674 | & / MAX( 1. , vmask(ji,jj,jm) + vmask(ji,jj - 1,jm) ) |
---|
675 | END DO |
---|
676 | zt_ml(ji,jj) = zt / zthick |
---|
677 | zs_ml(ji,jj) = zs / zthick |
---|
678 | zu_ml(ji,jj) = zu / zthick |
---|
679 | zv_ml(ji,jj) = zv / zthick |
---|
680 | zdt_ml(ji,jj) = zt_ml(ji,jj) - tsn(ji,jj,ibld(ji,jj),jp_tem) |
---|
681 | zds_ml(ji,jj) = zs_ml(ji,jj) - tsn(ji,jj,ibld(ji,jj),jp_sal) |
---|
682 | zdu_ml(ji,jj) = zu_ml(ji,jj) - ( ub(ji,jj,ibld(ji,jj)) + ub(ji-1,jj,ibld(ji,jj) ) ) & |
---|
683 | & / MAX(1. , umask(ji,jj,ibld(ji,jj) ) + umask(ji-1,jj,ibld(ji,jj) ) ) |
---|
684 | zdv_ml(ji,jj) = zv_ml(ji,jj) - ( vb(ji,jj,ibld(ji,jj)) + vb(ji,jj-1,ibld(ji,jj) ) ) & |
---|
685 | & / MAX(1. , vmask(ji,jj,ibld(ji,jj) ) + vmask(ji,jj-1,ibld(ji,jj) ) ) |
---|
686 | zdb_ml(ji,jj) = grav * zthermal * zdt_ml(ji,jj) - grav * zbeta * zds_ml(ji,jj) |
---|
687 | ELSE |
---|
688 | ! stable, if entraining calulate average below interface layer. |
---|
689 | IF ( zdhdt(ji,jj) >= 0._wp ) THEN |
---|
690 | zt = 0._wp |
---|
691 | zs = 0._wp |
---|
692 | zu = 0._wp |
---|
693 | zv = 0._wp |
---|
694 | ! average over depth of boundary layer |
---|
695 | zthick=0._wp |
---|
696 | DO jm = 2, imld(ji,jj) |
---|
697 | zthick=zthick+e3t_n(ji,jj,jm) |
---|
698 | zt = zt + e3t_n(ji,jj,jm) * tsn(ji,jj,jm,jp_tem) |
---|
699 | zs = zs + e3t_n(ji,jj,jm) * tsn(ji,jj,jm,jp_sal) |
---|
700 | zu = zu + e3t_n(ji,jj,jm) & |
---|
701 | & * ( ub(ji,jj,jm) + ub(ji - 1,jj,jm) ) & |
---|
702 | & / MAX( 1. , umask(ji,jj,jm) + umask(ji - 1,jj,jm) ) |
---|
703 | zv = zv + e3t_n(ji,jj,jm) & |
---|
704 | & * ( vb(ji,jj,jm) + vb(ji,jj - 1,jm) ) & |
---|
705 | & / MAX( 1. , vmask(ji,jj,jm) + vmask(ji,jj - 1,jm) ) |
---|
706 | END DO |
---|
707 | zt_ml(ji,jj) = zt / zthick |
---|
708 | zs_ml(ji,jj) = zs / zthick |
---|
709 | zu_ml(ji,jj) = zu / zthick |
---|
710 | zv_ml(ji,jj) = zv / zthick |
---|
711 | zdt_ml(ji,jj) = zt_ml(ji,jj) - tsn(ji,jj,ibld(ji,jj),jp_tem) |
---|
712 | zds_ml(ji,jj) = zs_ml(ji,jj) - tsn(ji,jj,ibld(ji,jj),jp_sal) |
---|
713 | zdu_ml(ji,jj) = zu_ml(ji,jj) - ( ub(ji,jj,ibld(ji,jj)) + ub(ji-1,jj,ibld(ji,jj) ) ) & |
---|
714 | & / MAX(1. , umask(ji,jj,ibld(ji,jj) ) + umask(ji-1,jj,ibld(ji,jj) ) ) |
---|
715 | zdv_ml(ji,jj) = zv_ml(ji,jj) - ( vb(ji,jj,ibld(ji,jj)) + vb(ji,jj-1,ibld(ji,jj) ) ) & |
---|
716 | & / MAX(1. , vmask(ji,jj,ibld(ji,jj) ) + vmask(ji,jj-1,ibld(ji,jj) ) ) |
---|
717 | zdb_ml(ji,jj) = grav * zthermal * zdt_ml(ji,jj) - grav * zbeta * zds_ml(ji,jj) |
---|
718 | ENDIF |
---|
719 | ENDIF |
---|
720 | END DO |
---|
721 | END DO |
---|
722 | ! |
---|
723 | ! rotate mean currents and changes onto wind align co-ordinates |
---|
724 | ! |
---|
725 | |
---|
726 | DO jj = 2, jpjm1 |
---|
727 | DO ji = 2, jpim1 |
---|
728 | ztemp = zu_ml(ji,jj) |
---|
729 | zu_ml(ji,jj) = zu_ml(ji,jj) * zcos_wind(ji,jj) + zv_ml(ji,jj) * zsin_wind(ji,jj) |
---|
730 | zv_ml(ji,jj) = zv_ml(ji,jj) * zcos_wind(ji,jj) - ztemp * zsin_wind(ji,jj) |
---|
731 | ztemp = zdu_ml(ji,jj) |
---|
732 | zdu_ml(ji,jj) = zdu_ml(ji,jj) * zcos_wind(ji,jj) + zdv_ml(ji,jj) * zsin_wind(ji,jj) |
---|
733 | zdv_ml(ji,jj) = zdv_ml(ji,jj) * zsin_wind(ji,jj) - ztemp * zsin_wind(ji,jj) |
---|
734 | ! |
---|
735 | ztemp = zu_bl(ji,jj) |
---|
736 | zu_bl = zu_bl(ji,jj) * zcos_wind(ji,jj) + zv_bl(ji,jj) * zsin_wind(ji,jj) |
---|
737 | zv_bl(ji,jj) = zv_bl(ji,jj) * zcos_wind(ji,jj) - ztemp * zsin_wind(ji,jj) |
---|
738 | ztemp = zdu_bl(ji,jj) |
---|
739 | zdu_bl(ji,jj) = zdu_bl(ji,jj) * zcos_wind(ji,jj) + zdv_bl(ji,jj) * zsin_wind(ji,jj) |
---|
740 | zdv_bl(ji,jj) = zdv_bl(ji,jj) * zsin_wind(ji,jj) - ztemp * zsin_wind(ji,jj) |
---|
741 | END DO |
---|
742 | END DO |
---|
743 | |
---|
744 | zuw_bse = 0._wp |
---|
745 | zvw_bse = 0._wp |
---|
746 | DO jj = 2, jpjm1 |
---|
747 | DO ji = 2, jpim1 |
---|
748 | |
---|
749 | IF ( lconv(ji,jj) ) THEN |
---|
750 | IF ( zdb_bl(ji,jj) > 0._wp ) THEN |
---|
751 | zwth_ent(ji,jj) = zwb_ent(ji,jj) * zdt_ml(ji,jj) / (zdb_ml(ji,jj) + epsln) |
---|
752 | zws_ent(ji,jj) = zwb_ent(ji,jj) * zds_ml(ji,jj) / (zdb_ml(ji,jj) + epsln) |
---|
753 | ENDIF |
---|
754 | ELSE |
---|
755 | zwth_ent(ji,jj) = -2.0 * zwthav(ji,jj) * ( (1.0 - 0.8) - ( 1.0 - 0.8)**(3.0/2.0) ) |
---|
756 | zws_ent(ji,jj) = -2.0 * zwsav(ji,jj) * ( (1.0 - 0.8 ) - ( 1.0 - 0.8 )**(3.0/2.0) ) |
---|
757 | ENDIF |
---|
758 | END DO |
---|
759 | END DO |
---|
760 | |
---|
761 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
762 | ! Pycnocline gradients for scalars and velocity |
---|
763 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
764 | |
---|
765 | DO jj = 2, jpjm1 |
---|
766 | DO ji = 2, jpim1 |
---|
767 | ! |
---|
768 | IF ( lconv (ji,jj) ) THEN |
---|
769 | ! Unstable conditions |
---|
770 | IF( zdb_bl(ji,jj) > 0._wp ) THEN |
---|
771 | ! calculate pycnocline profiles, no need if zdb_bl <= 0. since profile is zero and arrays have been initialized to zero |
---|
772 | ztgrad = ( zdt_ml(ji,jj) / zdh(ji,jj) ) |
---|
773 | zsgrad = ( zds_ml(ji,jj) / zdh(ji,jj) ) |
---|
774 | zbgrad = ( zdb_ml(ji,jj) / zdh(ji,jj) ) |
---|
775 | DO jk = 2 , ibld(ji,jj) |
---|
776 | znd = -( gdepw_n(ji,jj,jk) - zhml(ji,jj) ) / zdh(ji,jj) |
---|
777 | zdtdz_pyc(ji,jj,jk) = ztgrad * EXP( -1.75 * ( znd + 0.75 )**2 ) |
---|
778 | zdbdz_pyc(ji,jj,jk) = zbgrad * EXP( -1.75 * ( znd + 0.75 )**2 ) |
---|
779 | zdsdz_pyc(ji,jj,jk) = zsgrad * EXP( -1.75 * ( znd + 0.75 )**2 ) |
---|
780 | END DO |
---|
781 | ENDIF |
---|
782 | ELSE |
---|
783 | ! stable conditions |
---|
784 | ! if pycnocline profile only defined when depth steady of increasing. |
---|
785 | IF ( zdhdt(ji,jj) >= 0.0 ) THEN ! Depth increasing, or steady. |
---|
786 | IF ( zdb_bl(ji,jj) > 0._wp ) THEN |
---|
787 | IF ( zhol(ji,jj) >= 0.5 ) THEN ! Very stable - 'thick' pycnocline |
---|
788 | ztgrad = zdt_bl(ji,jj) / zhbl(ji,jj) |
---|
789 | zsgrad = zds_bl(ji,jj) / zhbl(ji,jj) |
---|
790 | zbgrad = zdb_bl(ji,jj) / zhbl(ji,jj) |
---|
791 | DO jk = 2, ibld(ji,jj) |
---|
792 | znd = gdepw_n(ji,jj,jk) / zhbl(ji,jj) |
---|
793 | zdtdz_pyc(ji,jj,jk) = ztgrad * EXP( -15.0 * ( znd - 0.9 )**2 ) |
---|
794 | zdbdz_pyc(ji,jj,jk) = zbgrad * EXP( -15.0 * ( znd - 0.9 )**2 ) |
---|
795 | zdsdz_pyc(ji,jj,jk) = zsgrad * EXP( -15.0 * ( znd - 0.9 )**2 ) |
---|
796 | END DO |
---|
797 | ELSE ! Slightly stable - 'thin' pycnoline - needed when stable layer begins to form. |
---|
798 | ztgrad = zdt_bl(ji,jj) / zdh(ji,jj) |
---|
799 | zsgrad = zds_bl(ji,jj) / zdh(ji,jj) |
---|
800 | zbgrad = zdb_bl(ji,jj) / zdh(ji,jj) |
---|
801 | DO jk = 2, ibld(ji,jj) |
---|
802 | znd = -( gdepw_n(ji,jj,jk) - zhml(ji,jj) ) / zdh(ji,jj) |
---|
803 | zdtdz_pyc(ji,jj,jk) = ztgrad * EXP( -1.75 * ( znd + 0.75 )**2 ) |
---|
804 | zdbdz_pyc(ji,jj,jk) = zbgrad * EXP( -1.75 * ( znd + 0.75 )**2 ) |
---|
805 | zdsdz_pyc(ji,jj,jk) = zsgrad * EXP( -1.75 * ( znd + 0.75 )**2 ) |
---|
806 | END DO |
---|
807 | ENDIF ! IF (zhol >=0.5) |
---|
808 | ENDIF ! IF (zdb_bl> 0.) |
---|
809 | ENDIF ! IF (zdhdt >= 0) zdhdt < 0 not considered since pycnocline profile is zero, profile arrays are intialized to zero |
---|
810 | ENDIF ! IF (lconv) |
---|
811 | ! |
---|
812 | END DO |
---|
813 | END DO |
---|
814 | ! |
---|
815 | DO jj = 2, jpjm1 |
---|
816 | DO ji = 2, jpim1 |
---|
817 | ! |
---|
818 | IF ( lconv (ji,jj) ) THEN |
---|
819 | ! Unstable conditions |
---|
820 | zugrad = ( zdu_ml(ji,jj) / zdh(ji,jj) ) + 0.275 * zustar(ji,jj)*zustar(ji,jj) / & |
---|
821 | & (( zwstrl(ji,jj)**3 + 0.5 * zwstrc(ji,jj)**3 )**pthird * zhml(ji,jj) ) / zla(ji,jj)**(8.0/3.0) |
---|
822 | zvgrad = ( zdv_ml(ji,jj) / zdh(ji,jj) ) + 3.5 * ff_t(ji,jj) * zustke(ji,jj) / & |
---|
823 | & ( zwstrl(ji,jj)**3 + 0.5 * zwstrc(ji,jj)**3 )**pthird |
---|
824 | DO jk = 2 , ibld(ji,jj)-1 |
---|
825 | znd = -( gdepw_n(ji,jj,jk) - zhml(ji,jj) ) / zdh(ji,jj) |
---|
826 | zdudz_pyc(ji,jj,jk) = zugrad * EXP( -1.75 * ( znd + 0.75 )**2 ) |
---|
827 | zdvdz_pyc(ji,jj,jk) = zvgrad * EXP( -1.75 * ( znd + 0.75 )**2 ) |
---|
828 | END DO |
---|
829 | ELSE |
---|
830 | ! stable conditions |
---|
831 | zugrad = 3.25 * zdu_bl(ji,jj) / zhbl(ji,jj) |
---|
832 | zvgrad = 2.75 * zdv_bl(ji,jj) / zhbl(ji,jj) |
---|
833 | DO jk = 2, ibld(ji,jj) |
---|
834 | znd = gdepw_n(ji,jj,jk) / zhbl(ji,jj) |
---|
835 | IF ( znd < 1.0 ) THEN |
---|
836 | zdudz_pyc(ji,jj,jk) = zugrad * EXP( -40.0 * ( znd - 1.0 )**2 ) |
---|
837 | ELSE |
---|
838 | zdudz_pyc(ji,jj,jk) = zugrad * EXP( -20.0 * ( znd - 1.0 )**2 ) |
---|
839 | ENDIF |
---|
840 | zdvdz_pyc(ji,jj,jk) = zvgrad * EXP( -20.0 * ( znd - 0.85 )**2 ) |
---|
841 | END DO |
---|
842 | ENDIF |
---|
843 | ! |
---|
844 | END DO |
---|
845 | END DO |
---|
846 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
847 | ! Eddy viscosity/diffusivity and non-gradient terms in the flux-gradient relationship |
---|
848 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
849 | |
---|
850 | ! WHERE ( lconv ) |
---|
851 | ! zdifml_sc = zhml * ( zwstrl**3 + 0.5 * zwstrc**3 )**pthird |
---|
852 | ! zvisml_sc = zdifml_sc |
---|
853 | ! zdifpyc_sc = 0.165 * ( zwstrl**3 + zwstrc**3 )**pthird * ( zhbl - zhml ) |
---|
854 | ! zvispyc_sc = 0.142 * ( zwstrl**3 + 0.5 * zwstrc**3 )**pthird * ( zhbl - zhml ) |
---|
855 | ! zbeta_d_sc = 1.0 - (0.165 / 0.8 * ( zhbl - zhml ) / zhbl )**p2third |
---|
856 | ! zbeta_v_sc = 1.0 - 2.0 * (0.142 /0.375) * (zhbl - zhml ) / zhml |
---|
857 | ! ELSEWHERE |
---|
858 | ! zdifml_sc = zwstrl * zhbl * EXP ( -( zhol / 0.183_wp )**2 ) |
---|
859 | ! zvisml_sc = zwstrl * zhbl * EXP ( -( zhol / 0.183_wp )**2 ) |
---|
860 | ! ENDWHERE |
---|
861 | DO jj = 2, jpjm1 |
---|
862 | DO ji = 2, jpim1 |
---|
863 | IF ( lconv(ji,jj) ) THEN |
---|
864 | zdifml_sc(ji,jj) = zhml(ji,jj) * ( zvstr(ji,jj)**3 + 0.5 * zwstrc(ji,jj)**3 )**pthird |
---|
865 | zvisml_sc(ji,jj) = zdifml_sc(ji,jj) |
---|
866 | zdifpyc_sc(ji,jj) = 0.165 * ( zvstr(ji,jj)**3 + 0.5 *zwstrc(ji,jj)**3 )**pthird * zdh(ji,jj) |
---|
867 | zvispyc_sc(ji,jj) = 0.142 * ( zvstr(ji,jj)**3 + 0.5 * zwstrc(ji,jj)**3 )**pthird * zdh(ji,jj) |
---|
868 | zbeta_d_sc(ji,jj) = 1.0 - (0.165 / 0.8 * zdh(ji,jj) / zhbl(ji,jj) )**p2third |
---|
869 | zbeta_v_sc(ji,jj) = 1.0 - 2.0 * (0.142 /0.375) * zdh(ji,jj) / zhml(ji,jj) |
---|
870 | ELSE |
---|
871 | zdifml_sc(ji,jj) = zvstr(ji,jj) * zhbl(ji,jj) * EXP ( -( zhol(ji,jj) / 0.6_wp )**2 ) |
---|
872 | zvisml_sc(ji,jj) = zvstr(ji,jj) * zhbl(ji,jj) * EXP ( -( zhol(ji,jj) / 0.6_wp )**2 ) |
---|
873 | END IF |
---|
874 | END DO |
---|
875 | END DO |
---|
876 | ! |
---|
877 | DO jj = 2, jpjm1 |
---|
878 | DO ji = 2, jpim1 |
---|
879 | IF ( lconv(ji,jj) ) THEN |
---|
880 | DO jk = 2, imld(ji,jj) ! mixed layer diffusivity |
---|
881 | zznd_ml = gdepw_n(ji,jj,jk) / zhml(ji,jj) |
---|
882 | ! |
---|
883 | zdiffut(ji,jj,jk) = 0.8 * zdifml_sc(ji,jj) * zznd_ml * ( 1.0 - zbeta_d_sc(ji,jj) * zznd_ml )**1.5 |
---|
884 | ! |
---|
885 | zviscos(ji,jj,jk) = 0.375 * zvisml_sc(ji,jj) * zznd_ml * ( 1.0 - zbeta_v_sc(ji,jj) * zznd_ml ) * ( 1.0 - 0.5 * zznd_ml**2 ) |
---|
886 | END DO |
---|
887 | ! pycnocline - if present linear profile |
---|
888 | IF ( zdh(ji,jj) > 0._wp ) THEN |
---|
889 | DO jk = imld(ji,jj)+1 , ibld(ji,jj) |
---|
890 | zznd_pyc = -( gdepw_n(ji,jj,jk) - zhml(ji,jj) ) / zdh(ji,jj) |
---|
891 | ! |
---|
892 | zdiffut(ji,jj,jk) = zdifpyc_sc(ji,jj)*( 1.0 + zznd_pyc ) |
---|
893 | ! |
---|
894 | zviscos(ji,jj,jk) = zvispyc_sc(ji,jj) * ( 1.0 + zznd_pyc ) |
---|
895 | END DO |
---|
896 | ENDIF |
---|
897 | ! Temporay fix to ensure zdiffut is +ve; won't be necessary with wn taken out |
---|
898 | zdiffut(ji,jj,ibld(ji,jj)) = zdhdt(ji,jj)* e3t_n(ji,jj,ibld(ji,jj)) |
---|
899 | ! could be taken out, take account of entrainment represents as a diffusivity |
---|
900 | ! should remove w from here, represents entrainment |
---|
901 | ELSE |
---|
902 | ! stable conditions |
---|
903 | DO jk = 2, ibld(ji,jj) |
---|
904 | zznd_ml = gdepw_n(ji,jj,jk) / zhbl(ji,jj) |
---|
905 | zdiffut(ji,jj,jk) = 0.75 * zdifml_sc(ji,jj) * zznd_ml * ( 1.0 - zznd_ml )**1.5 |
---|
906 | zviscos(ji,jj,jk) = 0.375 * zvisml_sc(ji,jj) * zznd_ml * (1.0 - zznd_ml) * ( 1.0 - zznd_ml**2 ) |
---|
907 | END DO |
---|
908 | ENDIF ! end if ( lconv ) |
---|
909 | ! |
---|
910 | END DO ! end of ji loop |
---|
911 | END DO ! end of jj loop |
---|
912 | |
---|
913 | ! |
---|
914 | ! calculate non-gradient components of the flux-gradient relationships |
---|
915 | ! |
---|
916 | ! Stokes term in scalar flux, flux-gradient relationship |
---|
917 | WHERE ( lconv ) |
---|
918 | zsc_wth_1 = zwstrl**3 * zwth0 / ( zvstr**3 + 0.5 * zwstrc**3 + epsln) |
---|
919 | ! |
---|
920 | zsc_ws_1 = zwstrl**3 * zws0 / ( zvstr**3 + 0.5 * zwstrc**3 + epsln ) |
---|
921 | ELSEWHERE |
---|
922 | zsc_wth_1 = 2.0 * zwthav |
---|
923 | ! |
---|
924 | zsc_ws_1 = 2.0 * zwsav |
---|
925 | ENDWHERE |
---|
926 | |
---|
927 | |
---|
928 | DO jj = 2, jpjm1 |
---|
929 | DO ji = 2, jpim1 |
---|
930 | IF ( lconv(ji,jj) ) THEN |
---|
931 | DO jk = 2, imld(ji,jj) |
---|
932 | zznd_d = gdepw_n(ji,jj,jk) / dstokes(ji,jj) |
---|
933 | ghamt(ji,jj,jk) = ghamt(ji,jj,jk) + 1.35 * EXP ( -zznd_d ) * ( 1.0 - EXP ( -2.0 * zznd_d ) ) * zsc_wth_1(ji,jj) |
---|
934 | ! |
---|
935 | ghams(ji,jj,jk) = ghams(ji,jj,jk) + 1.35 * EXP ( -zznd_d ) * ( 1.0 - EXP ( -2.0 * zznd_d ) ) * zsc_ws_1(ji,jj) |
---|
936 | END DO ! end jk loop |
---|
937 | ELSE ! else for if (lconv) |
---|
938 | ! Stable conditions |
---|
939 | DO jk = 2, ibld(ji,jj) |
---|
940 | zznd_d=gdepw_n(ji,jj,jk) / dstokes(ji,jj) |
---|
941 | ghamt(ji,jj,jk) = ghamt(ji,jj,jk) + 1.5 * EXP ( -0.9 * zznd_d ) * ( 1.0 - EXP ( -4.0 * zznd_d ) ) * zsc_wth_1(ji,jj) |
---|
942 | ! |
---|
943 | ghams(ji,jj,jk) = ghams(ji,jj,jk) + 1.5 * EXP ( -0.9 * zznd_d ) * ( 1.0 - EXP ( -4.0 * zznd_d ) ) * zsc_ws_1(ji,jj) |
---|
944 | END DO |
---|
945 | ENDIF ! endif for check on lconv |
---|
946 | |
---|
947 | END DO ! end of ji loop |
---|
948 | END DO ! end of jj loop |
---|
949 | |
---|
950 | |
---|
951 | ! Stokes term in flux-gradient relationship (note in zsc_uw_n don't use zvstr since term needs to go to zero as zwstrl goes to zero) |
---|
952 | WHERE ( lconv ) |
---|
953 | zsc_uw_1 = ( zwstrl**3 + 0.5 * zwstrc**3 )**pthird * zustke /( 1.0 - 1.0 * 6.5 * zla**(8.0/3.0) ) |
---|
954 | zsc_uw_2 = ( zwstrl**3 + 0.5 * zwstrc**3 )**pthird * zustke / ( zla**(8.0/3.0) + epsln ) |
---|
955 | zsc_vw_1 = ff_t * zhml * zustke**3 * zla**(8.0/3.0) / ( ( zvstr**3 + 0.5 * zwstrc**3 )**(2.0/3.0) + epsln ) |
---|
956 | ELSEWHERE |
---|
957 | zsc_uw_1 = zustar**2 |
---|
958 | zsc_vw_1 = ff_t * zhbl * zustke**3 * zla**(8.0/3.0) / (zvstr**2 + epsln) |
---|
959 | ENDWHERE |
---|
960 | |
---|
961 | DO jj = 2, jpjm1 |
---|
962 | DO ji = 2, jpim1 |
---|
963 | IF ( lconv(ji,jj) ) THEN |
---|
964 | DO jk = 2, imld(ji,jj) |
---|
965 | zznd_d = gdepw_n(ji,jj,jk) / dstokes(ji,jj) |
---|
966 | ghamu(ji,jj,jk) = ghamu(ji,jj,jk) + ( -0.05 * EXP ( -0.4 * zznd_d ) * zsc_uw_1(ji,jj) + 0.00125 * EXP ( -zznd_d ) * zsc_uw_2(ji,jj) ) * ( 1.0 - EXP ( -2.0 * zznd_d ) ) |
---|
967 | ! |
---|
968 | ghamv(ji,jj,jk) = ghamv(ji,jj,jk) - 0.65 * 0.15 * EXP ( -zznd_d ) * ( 1.0 - EXP ( -2.0 * zznd_d ) ) * zsc_vw_1(ji,jj) |
---|
969 | END DO ! end jk loop |
---|
970 | ELSE |
---|
971 | ! Stable conditions |
---|
972 | DO jk = 2, ibld(ji,jj) ! corrected to ibld |
---|
973 | zznd_d = gdepw_n(ji,jj,jk) / dstokes(ji,jj) |
---|
974 | ghamu(ji,jj,jk) = ghamu(ji,jj,jk) - 0.75 * 1.3 * EXP ( -0.5 * zznd_d ) * ( 1.0 - EXP ( -4.0 * zznd_d ) ) * zsc_uw_1(ji,jj) |
---|
975 | ghamv(ji,jj,jk) = ghamv(ji,jj,jk) + 0._wp |
---|
976 | END DO ! end jk loop |
---|
977 | ENDIF |
---|
978 | END DO ! ji loop |
---|
979 | END DO ! jj loo |
---|
980 | |
---|
981 | ! Buoyancy term in flux-gradient relationship [note : includes ROI ratio (X0.3) and pressure (X0.5)] |
---|
982 | |
---|
983 | WHERE ( lconv ) |
---|
984 | zsc_wth_1 = zwbav * zwth0 * ( 1.0 + EXP ( 0.2 * zhol ) ) / ( zvstr**3 + 0.5 * zwstrc**3 + epsln ) |
---|
985 | zsc_ws_1 = zwbav * zws0 * ( 1.0 + EXP ( 0.2 * zhol ) ) / ( zvstr**3 + 0.5 * zwstrc**3 + epsln ) |
---|
986 | ELSEWHERE |
---|
987 | zsc_wth_1 = 0._wp |
---|
988 | zsc_ws_1 = 0._wp |
---|
989 | ENDWHERE |
---|
990 | |
---|
991 | DO jj = 2, jpjm1 |
---|
992 | DO ji = 2, jpim1 |
---|
993 | IF (lconv(ji,jj) ) THEN |
---|
994 | DO jk = 2, imld(ji,jj) |
---|
995 | zznd_ml = gdepw_n(ji,jj,jk) / zhml(ji,jj) |
---|
996 | ! calculate turbulent length scale |
---|
997 | zl_c = 0.9 * ( 1.0 - EXP ( -7.0 * ( zznd_ml - zznd_ml**3 / 3.0 ) ) ) * ( 1.0 - EXP ( -15.0 * ( 1.1 - zznd_ml ) ) ) |
---|
998 | zl_l = 2.0 * ( 1.0 - EXP ( -2.0 * ( zznd_ml - zznd_ml**3 / 3.0 ) ) ) * (1.0 - EXP ( -5.0 * ( 1.0 -zznd_ml ) ) ) * ( 1.0 + dstokes(ji,jj) / zhml (ji,jj) ) |
---|
999 | zl_eps = zl_l + ( zl_c - zl_l ) / ( 1.0 + EXP ( 3.0 * LOG10 ( - zhol(ji,jj) ) ) ) ** (3.0/2.0) |
---|
1000 | ! non-gradient buoyancy terms |
---|
1001 | ghamt(ji,jj,jk) = ghamt(ji,jj,jk) + 0.3 * 0.5 * zsc_wth_1(ji,jj) * zl_eps * zhml(ji,jj) / ( 0.15 + zznd_ml ) |
---|
1002 | ghams(ji,jj,jk) = ghams(ji,jj,jk) + 0.3 * 0.5 * zsc_ws_1(ji,jj) * zl_eps * zhml(ji,jj) / ( 0.15 + zznd_ml ) |
---|
1003 | END DO |
---|
1004 | ELSE |
---|
1005 | DO jk = 2, ibld(ji,jj) |
---|
1006 | ghamt(ji,jj,jk) = ghamt(ji,jj,jk) + zsc_wth_1(ji,jj) |
---|
1007 | ghams(ji,jj,jk) = ghams(ji,jj,jk) + zsc_ws_1(ji,jj) |
---|
1008 | END DO |
---|
1009 | ENDIF |
---|
1010 | END DO ! ji loop |
---|
1011 | END DO ! jj loop |
---|
1012 | |
---|
1013 | |
---|
1014 | WHERE ( lconv ) |
---|
1015 | zsc_uw_1 = -zwb0 * zustar**2 * zhml / ( zvstr**3 + 0.5 * zwstrc**3 + epsln ) |
---|
1016 | zsc_uw_2 = zwb0 * zustke * zhml / ( zvstr**3 + 0.5 * zwstrc**3 + epsln )**(2.0/3.0) |
---|
1017 | zsc_vw_1 = 0._wp |
---|
1018 | ELSEWHERE |
---|
1019 | zsc_uw_1 = 0._wp |
---|
1020 | zsc_vw_1 = 0._wp |
---|
1021 | ENDWHERE |
---|
1022 | |
---|
1023 | DO jj = 2, jpjm1 |
---|
1024 | DO ji = 2, jpim1 |
---|
1025 | IF ( lconv(ji,jj) ) THEN |
---|
1026 | DO jk = 2 , imld(ji,jj) |
---|
1027 | zznd_d = gdepw_n(ji,jj,jk) / dstokes(ji,jj) |
---|
1028 | ghamu(ji,jj,jk) = ghamu(ji,jj,jk) + 0.3 * 0.5 * ( zsc_uw_1(ji,jj) + 0.125 * EXP( -0.5 * zznd_d ) * ( 1.0 - EXP ( -0.5 * zznd_d) ) * zsc_uw_2(ji,jj) ) |
---|
1029 | ghamv(ji,jj,jk) = ghamv(ji,jj,jk) + zsc_vw_1(ji,jj) |
---|
1030 | END DO ! jk loop |
---|
1031 | ELSE |
---|
1032 | ! stable conditions |
---|
1033 | DO jk = 2, ibld(ji,jj) |
---|
1034 | ghamu(ji,jj,jk) = ghamu(ji,jj,jk) + zsc_uw_1(ji,jj) |
---|
1035 | ghamv(ji,jj,jk) = ghamv(ji,jj,jk) + zsc_vw_1(ji,jj) |
---|
1036 | END DO |
---|
1037 | ENDIF |
---|
1038 | END DO ! ji loop |
---|
1039 | END DO ! jj loop |
---|
1040 | |
---|
1041 | ! Transport term in flux-gradient relationship [note : includes ROI ratio (X0.3) ] |
---|
1042 | |
---|
1043 | WHERE ( lconv ) |
---|
1044 | zsc_wth_1 = zwth0 |
---|
1045 | zsc_ws_1 = zws0 |
---|
1046 | ELSEWHERE |
---|
1047 | zsc_wth_1 = 2.0 * zwthav |
---|
1048 | zsc_ws_1 = zws0 |
---|
1049 | ENDWHERE |
---|
1050 | |
---|
1051 | DO jj = 2, jpjm1 |
---|
1052 | DO ji = 2, jpim1 |
---|
1053 | IF ( lconv(ji,jj) ) THEN |
---|
1054 | DO jk = 2, imld(ji,jj) |
---|
1055 | zznd_ml=gdepw_n(ji,jj,jk) / zhml(ji,jj) |
---|
1056 | ghamt(ji,jj,jk) = ghamt(ji,jj,jk) + 0.3 * zsc_wth_1(ji,jj) * ( -2.0 + 2.75 * ( ( 1.0 + 0.6 * zznd_ml**4 ) - EXP ( -6.0 *zznd_ml ) ) ) & |
---|
1057 | & * ( 1.0 -EXP ( -15.0 * ( 1.0 - zznd_ml ) ) ) |
---|
1058 | ! |
---|
1059 | ghams(ji,jj,jk) = ghams(ji,jj,jk) + 0.3 * zsc_ws_1(ji,jj) * ( -2.0 + 2.75 * ( ( 1.0 + 0.6 * zznd_ml**4 ) - EXP ( -6.0 *zznd_ml ) ) ) & |
---|
1060 | & * ( 1.0 -EXP ( -15.0 * ( 1.0 - zznd_ml ) ) ) |
---|
1061 | END DO |
---|
1062 | ELSE |
---|
1063 | DO jk = 2, ibld(ji,jj) |
---|
1064 | zznd_d = gdepw_n(ji,jj,jk) / dstokes(ji,jj) |
---|
1065 | znd = gdepw_n(ji,jj,jk) / zhbl(ji,jj) |
---|
1066 | ghamt(ji,jj,jk) = ghamt(ji,jj,jk) + 0.3 * ( -4.06 * EXP( -2.0 * zznd_d ) * (1.0 - EXP( -4.0 * zznd_d ) ) + & |
---|
1067 | & 7.5 * EXP ( -10.0 * ( 0.95 - znd )**2 ) * ( 1.0 - znd ) ) * zsc_wth_1(ji,jj) |
---|
1068 | ghams(ji,jj,jk) = ghams(ji,jj,jk) + 0.3 * ( -4.06 * EXP( -2.0 * zznd_d ) * (1.0 - EXP( -4.0 * zznd_d ) ) + & |
---|
1069 | & 7.5 * EXP ( -10.0 * ( 0.95 - znd )**2 ) * ( 1.0 - znd ) ) * zsc_ws_1(ji,jj) |
---|
1070 | END DO |
---|
1071 | ENDIF |
---|
1072 | ENDDO ! ji loop |
---|
1073 | END DO ! jj loop |
---|
1074 | |
---|
1075 | |
---|
1076 | WHERE ( lconv ) |
---|
1077 | zsc_uw_1 = zustar**2 |
---|
1078 | zsc_vw_1 = ff_t * zustke * zhml |
---|
1079 | ELSEWHERE |
---|
1080 | zsc_uw_1 = zustar**2 |
---|
1081 | zsc_uw_2 = (2.25 - 3.0 * ( 1.0 - EXP( -1.25 * 2.0 ) ) ) * ( 1.0 - EXP( -4.0 * 2.0 ) ) * zsc_uw_1 |
---|
1082 | zsc_vw_1 = ff_t * zustke * zhbl |
---|
1083 | zsc_vw_2 = -0.11 * SIN( 3.14159 * ( 2.0 + 0.4 ) ) * EXP(-( 1.5 + 2.0 )**2 ) * zsc_vw_1 |
---|
1084 | ENDWHERE |
---|
1085 | |
---|
1086 | DO jj = 2, jpjm1 |
---|
1087 | DO ji = 2, jpim1 |
---|
1088 | IF ( lconv(ji,jj) ) THEN |
---|
1089 | DO jk = 2, imld(ji,jj) |
---|
1090 | zznd_ml = gdepw_n(ji,jj,jk) / zhml(ji,jj) |
---|
1091 | zznd_d = gdepw_n(ji,jj,jk) / dstokes(ji,jj) |
---|
1092 | ghamu(ji,jj,jk) = ghamu(ji,jj,jk)& |
---|
1093 | & + 0.3 * ( -2.0 + 2.5 * ( 1.0 + 0.1 * zznd_ml**4 ) - EXP ( -8.0 * zznd_ml ) ) * zsc_uw_1(ji,jj) |
---|
1094 | ! |
---|
1095 | ghamv(ji,jj,jk) = ghamv(ji,jj,jk)& |
---|
1096 | & + 0.3 * 0.1 * ( EXP( -zznd_d ) + EXP( -5.0 * ( 1.0 - zznd_ml ) ) ) * zsc_vw_1(ji,jj) |
---|
1097 | END DO |
---|
1098 | ELSE |
---|
1099 | DO jk = 2, ibld(ji,jj) |
---|
1100 | znd = gdepw_n(ji,jj,jk) / zhbl(ji,jj) |
---|
1101 | zznd_d = gdepw_n(ji,jj,jk) / dstokes(ji,jj) |
---|
1102 | IF ( zznd_d <= 2.0 ) THEN |
---|
1103 | ghamu(ji,jj,jk) = ghamu(ji,jj,jk) + 0.5 * 0.3 & |
---|
1104 | &* ( 2.25 - 3.0 * ( 1.0 - EXP( - 1.25 * zznd_d ) ) * ( 1.0 - EXP( -2.0 * zznd_d ) ) ) * zsc_uw_1(ji,jj) |
---|
1105 | ! |
---|
1106 | ELSE |
---|
1107 | ghamu(ji,jj,jk) = ghamu(ji,jj,jk)& |
---|
1108 | & + 0.5 * 0.3 * ( 1.0 - EXP( -5.0 * ( 1.0 - znd ) ) ) * zsc_uw_2(ji,jj) |
---|
1109 | ! |
---|
1110 | ENDIF |
---|
1111 | |
---|
1112 | ghamv(ji,jj,jk) = ghamv(ji,jj,jk)& |
---|
1113 | & + 0.3 * 0.15 * SIN( 3.14159 * ( 0.65 * zznd_d ) ) * EXP( -0.25 * zznd_d**2 ) * zsc_vw_1(ji,jj) |
---|
1114 | ghamv(ji,jj,jk) = ghamv(ji,jj,jk)& |
---|
1115 | & + 0.3 * 0.15 * EXP( -5.0 * ( 1.0 - znd ) ) * ( 1.0 - EXP( -20.0 * ( 1.0 - znd ) ) ) * zsc_vw_2(ji,jj) |
---|
1116 | END DO |
---|
1117 | ENDIF |
---|
1118 | END DO |
---|
1119 | END DO |
---|
1120 | ! |
---|
1121 | ! Make surface forced velocity non-gradient terms go to zero at the base of the mixed layer. |
---|
1122 | |
---|
1123 | DO jj = 2, jpjm1 |
---|
1124 | DO ji = 2, jpim1 |
---|
1125 | IF ( lconv(ji,jj) ) THEN |
---|
1126 | DO jk = 2, ibld(ji,jj) |
---|
1127 | znd = ( gdepw_n(ji,jj,jk) - zhml(ji,jj) ) / zhml(ji,jj) !ALMG to think about |
---|
1128 | IF ( znd >= 0.0 ) THEN |
---|
1129 | ghamu(ji,jj,jk) = ghamu(ji,jj,jk) * ( 1.0 - EXP( -30.0 * znd**2 ) ) |
---|
1130 | ghamv(ji,jj,jk) = ghamv(ji,jj,jk) * ( 1.0 - EXP( -30.0 * znd**2 ) ) |
---|
1131 | ELSE |
---|
1132 | ghamu(ji,jj,jk) = 0._wp |
---|
1133 | ghamv(ji,jj,jk) = 0._wp |
---|
1134 | ENDIF |
---|
1135 | END DO |
---|
1136 | ELSE |
---|
1137 | DO jk = 2, ibld(ji,jj) |
---|
1138 | znd = ( gdepw_n(ji,jj,jk) - zhml(ji,jj) ) / zhml(ji,jj) !ALMG to think about |
---|
1139 | IF ( znd >= 0.0 ) THEN |
---|
1140 | ghamu(ji,jj,jk) = ghamu(ji,jj,jk) * ( 1.0 - EXP( -10.0 * znd**2 ) ) |
---|
1141 | ghamv(ji,jj,jk) = ghamv(ji,jj,jk) * ( 1.0 - EXP( -10.0 * znd**2 ) ) |
---|
1142 | ELSE |
---|
1143 | ghamu(ji,jj,jk) = 0._wp |
---|
1144 | ghamv(ji,jj,jk) = 0._wp |
---|
1145 | ENDIF |
---|
1146 | END DO |
---|
1147 | ENDIF |
---|
1148 | END DO |
---|
1149 | END DO |
---|
1150 | |
---|
1151 | ! pynocline contributions |
---|
1152 | ! Temporary fix to avoid instabilities when zdb_bl becomes very very small |
---|
1153 | zsc_uw_1 = 0._wp ! 50.0 * zla**(8.0/3.0) * zustar**2 * zhbl / ( zdb_bl + epsln ) |
---|
1154 | DO jj = 2, jpjm1 |
---|
1155 | DO ji = 2, jpim1 |
---|
1156 | DO jk= 2, ibld(ji,jj) |
---|
1157 | znd = gdepw_n(ji,jj,jk) / zhbl(ji,jj) |
---|
1158 | ghamt(ji,jj,jk) = ghamt(ji,jj,jk) + zdiffut(ji,jj,jk) * zdtdz_pyc(ji,jj,jk) |
---|
1159 | ghams(ji,jj,jk) = ghams(ji,jj,jk) + zdiffut(ji,jj,jk) * zdsdz_pyc(ji,jj,jk) |
---|
1160 | ghamu(ji,jj,jk) = ghamu(ji,jj,jk) + zviscos(ji,jj,jk) * zdudz_pyc(ji,jj,jk) |
---|
1161 | ghamu(ji,jj,jk) = ghamu(ji,jj,jk) + zsc_uw_1(ji,jj) * ( 1.0 - znd )**(7.0/4.0) * zdbdz_pyc(ji,jj,jk) |
---|
1162 | ghamv(ji,jj,jk) = ghamv(ji,jj,jk) + zviscos(ji,jj,jk) * zdvdz_pyc(ji,jj,jk) |
---|
1163 | END DO |
---|
1164 | END DO |
---|
1165 | END DO |
---|
1166 | |
---|
1167 | ! Entrainment contribution. |
---|
1168 | |
---|
1169 | DO jj=2, jpjm1 |
---|
1170 | DO ji = 2, jpim1 |
---|
1171 | IF ( lconv(ji,jj) ) THEN |
---|
1172 | DO jk = 1, imld(ji,jj) - 1 |
---|
1173 | znd=gdepw_n(ji,jj,jk) / zhml(ji,jj) |
---|
1174 | ghamt(ji,jj,jk) = ghamt(ji,jj,jk) + zwth_ent(ji,jj) * znd |
---|
1175 | ghams(ji,jj,jk) = ghams(ji,jj,jk) + zws_ent(ji,jj) * znd |
---|
1176 | ghamu(ji,jj,jk) = ghamu(ji,jj,jk) + zuw_bse(ji,jj) * znd |
---|
1177 | ghamv(ji,jj,jk) = ghamv(ji,jj,jk) + zvw_bse(ji,jj) * znd |
---|
1178 | END DO |
---|
1179 | DO jk = imld(ji,jj), ibld(ji,jj) |
---|
1180 | znd = -( gdepw_n(ji,jj,jk) - zhml(ji,jj) ) / zdh(ji,jj) |
---|
1181 | ghamt(ji,jj,jk) = ghamt(ji,jj,jk) + zwth_ent(ji,jj) * ( 1.0 + znd ) |
---|
1182 | ghams(ji,jj,jk) = ghams(ji,jj,jk) + zws_ent(ji,jj) * ( 1.0 + znd ) |
---|
1183 | ghamu(ji,jj,jk) = ghamu(ji,jj,jk) + zuw_bse(ji,jj) * ( 1.0 + znd ) |
---|
1184 | ghamv(ji,jj,jk) = ghamv(ji,jj,jk) + zvw_bse(ji,jj) * ( 1.0 + znd ) |
---|
1185 | END DO |
---|
1186 | ENDIF |
---|
1187 | ghamt(ji,jj,ibld(ji,jj)) = 0._wp |
---|
1188 | ghams(ji,jj,ibld(ji,jj)) = 0._wp |
---|
1189 | ghamu(ji,jj,ibld(ji,jj)) = 0._wp |
---|
1190 | ghamv(ji,jj,ibld(ji,jj)) = 0._wp |
---|
1191 | END DO ! ji loop |
---|
1192 | END DO ! jj loop |
---|
1193 | |
---|
1194 | |
---|
1195 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
1196 | ! Need to put in code for contributions that are applied explicitly to |
---|
1197 | ! the prognostic variables |
---|
1198 | ! 1. Entrainment flux |
---|
1199 | ! |
---|
1200 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
1201 | |
---|
1202 | |
---|
1203 | |
---|
1204 | ! rotate non-gradient velocity terms back to model reference frame |
---|
1205 | |
---|
1206 | DO jj = 2, jpjm1 |
---|
1207 | DO ji = 2, jpim1 |
---|
1208 | DO jk = 2, ibld(ji,jj) |
---|
1209 | ztemp = ghamu(ji,jj,jk) |
---|
1210 | ghamu(ji,jj,jk) = ghamu(ji,jj,jk) * zcos_wind(ji,jj) - ghamv(ji,jj,jk) * zsin_wind(ji,jj) |
---|
1211 | ghamv(ji,jj,jk) = ghamv(ji,jj,jk) * zcos_wind(ji,jj) + ztemp * zsin_wind(ji,jj) |
---|
1212 | END DO |
---|
1213 | END DO |
---|
1214 | END DO |
---|
1215 | |
---|
1216 | IF(ln_dia_osm) THEN |
---|
1217 | IF ( iom_use("zdtdz_pyc") ) CALL iom_put( "zdtdz_pyc", wmask*zdtdz_pyc ) |
---|
1218 | END IF |
---|
1219 | |
---|
1220 | ! KPP-style Ri# mixing |
---|
1221 | IF( ln_kpprimix) THEN |
---|
1222 | DO jk = 2, jpkm1 !* Shear production at uw- and vw-points (energy conserving form) |
---|
1223 | DO jj = 1, jpjm1 |
---|
1224 | DO ji = 1, jpim1 ! vector opt. |
---|
1225 | z3du(ji,jj,jk) = 0.5 * ( un(ji,jj,jk-1) - un(ji ,jj,jk) ) & |
---|
1226 | & * ( ub(ji,jj,jk-1) - ub(ji ,jj,jk) ) * wumask(ji,jj,jk) & |
---|
1227 | & / ( e3uw_n(ji,jj,jk) * e3uw_b(ji,jj,jk) ) |
---|
1228 | z3dv(ji,jj,jk) = 0.5 * ( vn(ji,jj,jk-1) - vn(ji,jj ,jk) ) & |
---|
1229 | & * ( vb(ji,jj,jk-1) - vb(ji,jj ,jk) ) * wvmask(ji,jj,jk) & |
---|
1230 | & / ( e3vw_n(ji,jj,jk) * e3vw_b(ji,jj,jk) ) |
---|
1231 | END DO |
---|
1232 | END DO |
---|
1233 | END DO |
---|
1234 | ! |
---|
1235 | DO jk = 2, jpkm1 |
---|
1236 | DO jj = 2, jpjm1 |
---|
1237 | DO ji = 2, jpim1 ! vector opt. |
---|
1238 | ! ! shear prod. at w-point weightened by mask |
---|
1239 | zesh2 = ( z3du(ji-1,jj,jk) + z3du(ji,jj,jk) ) / MAX( 1._wp , umask(ji-1,jj,jk) + umask(ji,jj,jk) ) & |
---|
1240 | & + ( z3dv(ji,jj-1,jk) + z3dv(ji,jj,jk) ) / MAX( 1._wp , vmask(ji,jj-1,jk) + vmask(ji,jj,jk) ) |
---|
1241 | ! ! local Richardson number |
---|
1242 | zri = MAX( rn2b(ji,jj,jk), 0._wp ) / MAX(zesh2, epsln) |
---|
1243 | zfri = MIN( zri / rn_riinfty , 1.0_wp ) |
---|
1244 | zfri = ( 1.0_wp - zfri * zfri ) |
---|
1245 | zrimix(ji,jj,jk) = zfri * zfri * zfri * wmask(ji, jj, jk) |
---|
1246 | END DO |
---|
1247 | END DO |
---|
1248 | END DO |
---|
1249 | |
---|
1250 | DO jj = 2, jpjm1 |
---|
1251 | DO ji = 2, jpim1 |
---|
1252 | DO jk = ibld(ji,jj) + 1, jpkm1 |
---|
1253 | zdiffut(ji,jj,jk) = zrimix(ji,jj,jk)*rn_difri |
---|
1254 | zviscos(ji,jj,jk) = zrimix(ji,jj,jk)*rn_difri |
---|
1255 | END DO |
---|
1256 | END DO |
---|
1257 | END DO |
---|
1258 | |
---|
1259 | END IF ! ln_kpprimix = .true. |
---|
1260 | |
---|
1261 | ! KPP-style set diffusivity large if unstable below BL |
---|
1262 | IF( ln_convmix) THEN |
---|
1263 | DO jj = 2, jpjm1 |
---|
1264 | DO ji = 2, jpim1 |
---|
1265 | DO jk = ibld(ji,jj) + 1, jpkm1 |
---|
1266 | IF( MIN( rn2(ji,jj,jk), rn2b(ji,jj,jk) ) <= -1.e-12 ) zdiffut(ji,jj,jk) = rn_difconv |
---|
1267 | END DO |
---|
1268 | END DO |
---|
1269 | END DO |
---|
1270 | END IF ! ln_convmix = .true. |
---|
1271 | |
---|
1272 | ! Lateral boundary conditions on zvicos (sign unchanged), needed to caclulate viscosities on u and v grids |
---|
1273 | CALL lbc_lnk( zviscos(:,:,:), 'W', 1. ) |
---|
1274 | |
---|
1275 | ! GN 25/8: need to change tmask --> wmask |
---|
1276 | |
---|
1277 | DO jk = 2, jpkm1 |
---|
1278 | DO jj = 2, jpjm1 |
---|
1279 | DO ji = 2, jpim1 |
---|
1280 | p_avt(ji,jj,jk) = MAX( zdiffut(ji,jj,jk), avtb(jk) ) * tmask(ji,jj,jk) |
---|
1281 | p_avm(ji,jj,jk) = MAX( zviscos(ji,jj,jk), avmb(jk) ) * tmask(ji,jj,jk) |
---|
1282 | END DO |
---|
1283 | END DO |
---|
1284 | END DO |
---|
1285 | |
---|
1286 | |
---|
1287 | CALL lbc_lnk( p_avt, 'W', 1. ) ! Lateral boundary conditions on p_avt (sign unchanged) |
---|
1288 | CALL lbc_lnk( p_avm, 'W', 1. ) ! Lateral boundary conditions on p_avm (sign unchanged) |
---|
1289 | |
---|
1290 | ! Lateral boundary conditions on ghamu and ghamv, currently on W-grid (sign unchanged), needed to caclulate gham[uv] on u and v grids |
---|
1291 | CALL lbc_lnk( ghamu(:,:,:), 'W', 1. ) |
---|
1292 | CALL lbc_lnk( ghamv(:,:,:), 'W', 1. ) |
---|
1293 | DO jk = 2, jpkm1 |
---|
1294 | DO jj = 2, jpjm1 |
---|
1295 | DO ji = 2, jpim1 |
---|
1296 | ghamu(ji,jj,jk) = ( ghamu(ji,jj,jk) + ghamu(ji+1,jj,jk) ) & |
---|
1297 | & / MAX( 1., tmask(ji,jj,jk) + tmask (ji + 1,jj,jk) ) * umask(ji,jj,jk) |
---|
1298 | |
---|
1299 | ghamv(ji,jj,jk) = ( ghamv(ji,jj,jk) + ghamv(ji,jj+1,jk) ) & |
---|
1300 | & / MAX( 1., tmask(ji,jj,jk) + tmask (ji,jj+1,jk) ) * vmask(ji,jj,jk) |
---|
1301 | |
---|
1302 | ghamt(ji,jj,jk) = ghamt(ji,jj,jk) * tmask(ji,jj,jk) |
---|
1303 | ghams(ji,jj,jk) = ghams(ji,jj,jk) * tmask(ji,jj,jk) |
---|
1304 | END DO |
---|
1305 | END DO |
---|
1306 | END DO |
---|
1307 | ! Lateral boundary conditions on final outputs for gham[ts], on W-grid (sign unchanged) |
---|
1308 | CALL lbc_lnk( ghamt(:,:,:), 'W', 1. ) |
---|
1309 | CALL lbc_lnk( ghams(:,:,:), 'W', 1. ) |
---|
1310 | ! Lateral boundary conditions on final outputs for gham[uv], on [UV]-grid (sign unchanged) |
---|
1311 | CALL lbc_lnk( ghamu(:,:,:), 'U', 1. ) |
---|
1312 | CALL lbc_lnk( ghamv(:,:,:), 'V', 1. ) |
---|
1313 | |
---|
1314 | IF(ln_dia_osm) THEN |
---|
1315 | SELECT CASE (nn_osm_wave) |
---|
1316 | ! Stokes drift set by assumimg onstant La#=0.3(=0) or Pierson-Moskovitz spectrum (=1). |
---|
1317 | CASE(0:1) |
---|
1318 | IF ( iom_use("us_x") ) CALL iom_put( "us_x", tmask(:,:,1)*zustke*zcos_wind ) ! x surface Stokes drift |
---|
1319 | IF ( iom_use("us_y") ) CALL iom_put( "us_y", tmask(:,:,1)*zustke*zsin_wind ) ! y surface Stokes drift |
---|
1320 | IF ( iom_use("wind_wave_abs_power") ) CALL iom_put( "wind_wave_abs_power", 1000.*rau0*tmask(:,:,1)*zustar**2*zustke ) |
---|
1321 | ! Stokes drift read in from sbcwave (=2). |
---|
1322 | CASE(2) |
---|
1323 | IF ( iom_use("us_x") ) CALL iom_put( "us_x", ut0sd ) ! x surface Stokes drift |
---|
1324 | IF ( iom_use("us_y") ) CALL iom_put( "us_y", vt0sd ) ! y surface Stokes drift |
---|
1325 | IF ( iom_use("wind_wave_abs_power") ) CALL iom_put( "wind_wave_abs_power", 1000.*rau0*tmask(:,:,1)*zustar**2* & |
---|
1326 | & SQRT(ut0sd**2 + vt0sd**2 ) ) |
---|
1327 | END SELECT |
---|
1328 | IF ( iom_use("ghamt") ) CALL iom_put( "ghamt", tmask*ghamt ) ! <Tw_NL> |
---|
1329 | IF ( iom_use("ghams") ) CALL iom_put( "ghams", tmask*ghams ) ! <Sw_NL> |
---|
1330 | IF ( iom_use("ghamu") ) CALL iom_put( "ghamu", umask*ghamu ) ! <uw_NL> |
---|
1331 | IF ( iom_use("ghamv") ) CALL iom_put( "ghamv", vmask*ghamv ) ! <vw_NL> |
---|
1332 | IF ( iom_use("zwth0") ) CALL iom_put( "zwth0", tmask(:,:,1)*zwth0 ) ! <Tw_0> |
---|
1333 | IF ( iom_use("zws0") ) CALL iom_put( "zws0", tmask(:,:,1)*zws0 ) ! <Sw_0> |
---|
1334 | IF ( iom_use("hbl") ) CALL iom_put( "hbl", tmask(:,:,1)*hbl ) ! boundary-layer depth |
---|
1335 | IF ( iom_use("hbli") ) CALL iom_put( "hbli", tmask(:,:,1)*hbli ) ! Initial boundary-layer depth |
---|
1336 | IF ( iom_use("dstokes") ) CALL iom_put( "dstokes", tmask(:,:,1)*dstokes ) ! Stokes drift penetration depth |
---|
1337 | IF ( iom_use("zustke") ) CALL iom_put( "zustke", tmask(:,:,1)*zustke ) ! Stokes drift magnitude at T-points |
---|
1338 | IF ( iom_use("zwstrc") ) CALL iom_put( "zwstrc", tmask(:,:,1)*zwstrc ) ! convective velocity scale |
---|
1339 | IF ( iom_use("zwstrl") ) CALL iom_put( "zwstrl", tmask(:,:,1)*zwstrl ) ! Langmuir velocity scale |
---|
1340 | IF ( iom_use("zustar") ) CALL iom_put( "zustar", tmask(:,:,1)*zustar ) ! friction velocity scale |
---|
1341 | IF ( iom_use("wind_power") ) CALL iom_put( "wind_power", 1000.*rau0*tmask(:,:,1)*zustar**3 ) ! BL depth internal to zdf_osm routine |
---|
1342 | IF ( iom_use("wind_wave_power") ) CALL iom_put( "wind_wave_power", 1000.*rau0*tmask(:,:,1)*zustar**2*zustke ) |
---|
1343 | IF ( iom_use("zhbl") ) CALL iom_put( "zhbl", tmask(:,:,1)*zhbl ) ! BL depth internal to zdf_osm routine |
---|
1344 | IF ( iom_use("zhml") ) CALL iom_put( "zhml", tmask(:,:,1)*zhml ) ! ML depth internal to zdf_osm routine |
---|
1345 | IF ( iom_use("zdh") ) CALL iom_put( "zdh", tmask(:,:,1)*zdh ) ! ML depth internal to zdf_osm routine |
---|
1346 | IF ( iom_use("zhol") ) CALL iom_put( "zhol", tmask(:,:,1)*zhol ) ! ML depth internal to zdf_osm routine |
---|
1347 | IF ( iom_use("zwthav") ) CALL iom_put( "zwthav", tmask(:,:,1)*zwthav ) ! ML depth internal to zdf_osm routine |
---|
1348 | IF ( iom_use("zwth_ent") ) CALL iom_put( "zwth_ent", tmask(:,:,1)*zwth_ent ) ! ML depth internal to zdf_osm routine |
---|
1349 | IF ( iom_use("zt_ml") ) CALL iom_put( "zt_ml", tmask(:,:,1)*zt_ml ) ! average T in ML |
---|
1350 | END IF |
---|
1351 | ! Lateral boundary conditions on p_avt (sign unchanged) |
---|
1352 | CALL lbc_lnk( p_avt(:,:,:), 'W', 1. ) |
---|
1353 | ! |
---|
1354 | IF( ln_timing ) CALL timing_stop('zdf_osm') |
---|
1355 | ! |
---|
1356 | END SUBROUTINE zdf_osm |
---|
1357 | |
---|
1358 | |
---|
1359 | SUBROUTINE zdf_osm_init |
---|
1360 | !!---------------------------------------------------------------------- |
---|
1361 | !! *** ROUTINE zdf_osm_init *** |
---|
1362 | !! |
---|
1363 | !! ** Purpose : Initialization of the vertical eddy diffivity and |
---|
1364 | !! viscosity when using a osm turbulent closure scheme |
---|
1365 | !! |
---|
1366 | !! ** Method : Read the namosm namelist and check the parameters |
---|
1367 | !! called at the first timestep (nit000) |
---|
1368 | !! |
---|
1369 | !! ** input : Namlist namosm |
---|
1370 | !!---------------------------------------------------------------------- |
---|
1371 | INTEGER :: ios ! local integer |
---|
1372 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
1373 | !! |
---|
1374 | NAMELIST/namzdf_osm/ ln_use_osm_la, rn_osm_la, rn_osm_dstokes, nn_ave & |
---|
1375 | & ,nn_osm_wave, ln_dia_osm, rn_osm_hbl0 & |
---|
1376 | & ,ln_kpprimix, rn_riinfty, rn_difri, ln_convmix, rn_difconv |
---|
1377 | !!---------------------------------------------------------------------- |
---|
1378 | ! |
---|
1379 | IF( ln_timing ) CALL timing_start('zdf_osm_init') |
---|
1380 | ! |
---|
1381 | REWIND( numnam_ref ) ! Namelist namzdf_osm in reference namelist : Osmosis ML model |
---|
1382 | READ ( numnam_ref, namzdf_osm, IOSTAT = ios, ERR = 901) |
---|
1383 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_osm in reference namelist', lwp ) |
---|
1384 | |
---|
1385 | REWIND( numnam_cfg ) ! Namelist namzdf_tke in configuration namelist : Turbulent Kinetic Energy |
---|
1386 | READ ( numnam_cfg, namzdf_osm, IOSTAT = ios, ERR = 902 ) |
---|
1387 | 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_osm in configuration namelist', lwp ) |
---|
1388 | IF(lwm) WRITE ( numond, namzdf_osm ) |
---|
1389 | |
---|
1390 | IF(lwp) THEN ! Control print |
---|
1391 | WRITE(numout,*) |
---|
1392 | WRITE(numout,*) 'zdf_osm_init : OSMOSIS Parameterisation' |
---|
1393 | WRITE(numout,*) '~~~~~~~~~~~~' |
---|
1394 | WRITE(numout,*) ' Namelist namzdf_osm : set tke mixing parameters' |
---|
1395 | WRITE(numout,*) ' Use namelist rn_osm_la ln_use_osm_la = ', ln_use_osm_la |
---|
1396 | WRITE(numout,*) ' Turbulent Langmuir number rn_osm_la = ', rn_osm_la |
---|
1397 | WRITE(numout,*) ' Initial hbl for 1D runs rn_osm_hbl0 = ', rn_osm_hbl0 |
---|
1398 | WRITE(numout,*) ' Depth scale of Stokes drift rn_osm_dstokes = ', rn_osm_dstokes |
---|
1399 | WRITE(numout,*) ' horizontal average flag nn_ave = ', nn_ave |
---|
1400 | WRITE(numout,*) ' Stokes drift nn_osm_wave = ', nn_osm_wave |
---|
1401 | SELECT CASE (nn_osm_wave) |
---|
1402 | CASE(0) |
---|
1403 | WRITE(numout,*) ' calculated assuming constant La#=0.3' |
---|
1404 | CASE(1) |
---|
1405 | WRITE(numout,*) ' calculated from Pierson Moskowitz wind-waves' |
---|
1406 | CASE(2) |
---|
1407 | WRITE(numout,*) ' calculated from ECMWF wave fields' |
---|
1408 | END SELECT |
---|
1409 | WRITE(numout,*) ' Output osm diagnostics ln_dia_osm = ', ln_dia_osm |
---|
1410 | WRITE(numout,*) ' Use KPP-style shear instability mixing ln_kpprimix = ', ln_kpprimix |
---|
1411 | WRITE(numout,*) ' local Richardson Number limit for shear instability rn_riinfty = ', rn_riinfty |
---|
1412 | WRITE(numout,*) ' maximum shear diffusivity at Rig = 0 (m2/s) rn_difri = ', rn_difri |
---|
1413 | WRITE(numout,*) ' Use large mixing below BL when unstable ln_convmix = ', ln_convmix |
---|
1414 | WRITE(numout,*) ' diffusivity when unstable below BL (m2/s) rn_difconv = ', rn_difconv |
---|
1415 | ENDIF |
---|
1416 | |
---|
1417 | ! ! allocate zdfosm arrays |
---|
1418 | IF( zdf_osm_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'zdf_osm_init : unable to allocate arrays' ) |
---|
1419 | |
---|
1420 | call osm_rst( nit000, 'READ' ) !* read or initialize hbl |
---|
1421 | |
---|
1422 | IF( ln_zdfddm) THEN |
---|
1423 | IF(lwp) THEN |
---|
1424 | WRITE(numout,*) |
---|
1425 | WRITE(numout,*) ' Double diffusion mixing on temperature and salinity ' |
---|
1426 | WRITE(numout,*) ' CAUTION : done in routine zdfosm, not in routine zdfddm ' |
---|
1427 | ENDIF |
---|
1428 | ENDIF |
---|
1429 | |
---|
1430 | |
---|
1431 | !set constants not in namelist |
---|
1432 | !----------------------------- |
---|
1433 | |
---|
1434 | IF(lwp) THEN |
---|
1435 | WRITE(numout,*) |
---|
1436 | ENDIF |
---|
1437 | |
---|
1438 | IF (nn_osm_wave == 0) THEN |
---|
1439 | dstokes(:,:) = rn_osm_dstokes |
---|
1440 | END IF |
---|
1441 | |
---|
1442 | ! Horizontal average : initialization of weighting arrays |
---|
1443 | ! ------------------- |
---|
1444 | |
---|
1445 | SELECT CASE ( nn_ave ) |
---|
1446 | |
---|
1447 | CASE ( 0 ) ! no horizontal average |
---|
1448 | IF(lwp) WRITE(numout,*) ' no horizontal average on avt' |
---|
1449 | IF(lwp) WRITE(numout,*) ' only in very high horizontal resolution !' |
---|
1450 | ! weighting mean arrays etmean |
---|
1451 | ! ( 1 1 ) |
---|
1452 | ! avt = 1/4 ( 1 1 ) |
---|
1453 | ! |
---|
1454 | etmean(:,:,:) = 0.e0 |
---|
1455 | |
---|
1456 | DO jk = 1, jpkm1 |
---|
1457 | DO jj = 2, jpjm1 |
---|
1458 | DO ji = 2, jpim1 ! vector opt. |
---|
1459 | etmean(ji,jj,jk) = tmask(ji,jj,jk) & |
---|
1460 | & / MAX( 1., umask(ji-1,jj ,jk) + umask(ji,jj,jk) & |
---|
1461 | & + vmask(ji ,jj-1,jk) + vmask(ji,jj,jk) ) |
---|
1462 | END DO |
---|
1463 | END DO |
---|
1464 | END DO |
---|
1465 | |
---|
1466 | CASE ( 1 ) ! horizontal average |
---|
1467 | IF(lwp) WRITE(numout,*) ' horizontal average on avt' |
---|
1468 | ! weighting mean arrays etmean |
---|
1469 | ! ( 1/2 1 1/2 ) |
---|
1470 | ! avt = 1/8 ( 1 2 1 ) |
---|
1471 | ! ( 1/2 1 1/2 ) |
---|
1472 | etmean(:,:,:) = 0.e0 |
---|
1473 | |
---|
1474 | DO jk = 1, jpkm1 |
---|
1475 | DO jj = 2, jpjm1 |
---|
1476 | DO ji = 2, jpim1 ! vector opt. |
---|
1477 | etmean(ji,jj,jk) = tmask(ji, jj,jk) & |
---|
1478 | & / MAX( 1., 2.* tmask(ji,jj,jk) & |
---|
1479 | & +.5 * ( tmask(ji-1,jj+1,jk) + tmask(ji-1,jj-1,jk) & |
---|
1480 | & +tmask(ji+1,jj+1,jk) + tmask(ji+1,jj-1,jk) ) & |
---|
1481 | & +1. * ( tmask(ji-1,jj ,jk) + tmask(ji ,jj+1,jk) & |
---|
1482 | & +tmask(ji ,jj-1,jk) + tmask(ji+1,jj ,jk) ) ) |
---|
1483 | END DO |
---|
1484 | END DO |
---|
1485 | END DO |
---|
1486 | |
---|
1487 | CASE DEFAULT |
---|
1488 | WRITE(ctmp1,*) ' bad flag value for nn_ave = ', nn_ave |
---|
1489 | CALL ctl_stop( ctmp1 ) |
---|
1490 | |
---|
1491 | END SELECT |
---|
1492 | |
---|
1493 | ! Initialization of vertical eddy coef. to the background value |
---|
1494 | ! ------------------------------------------------------------- |
---|
1495 | DO jk = 1, jpk |
---|
1496 | avt (:,:,jk) = avtb(jk) * tmask(:,:,jk) |
---|
1497 | END DO |
---|
1498 | |
---|
1499 | ! zero the surface flux for non local term and osm mixed layer depth |
---|
1500 | ! ------------------------------------------------------------------ |
---|
1501 | ghamt(:,:,:) = 0. |
---|
1502 | ghams(:,:,:) = 0. |
---|
1503 | ghamu(:,:,:) = 0. |
---|
1504 | ghamv(:,:,:) = 0. |
---|
1505 | |
---|
1506 | ! |
---|
1507 | IF( ln_timing ) CALL timing_stop('zdf_osm_init') |
---|
1508 | ! |
---|
1509 | END SUBROUTINE zdf_osm_init |
---|
1510 | |
---|
1511 | |
---|
1512 | SUBROUTINE osm_rst( kt, cdrw ) |
---|
1513 | !!--------------------------------------------------------------------- |
---|
1514 | !! *** ROUTINE osm_rst *** |
---|
1515 | !! |
---|
1516 | !! ** Purpose : Read or write BL fields in restart file |
---|
1517 | !! |
---|
1518 | !! ** Method : use of IOM library. If the restart does not contain |
---|
1519 | !! required fields, they are recomputed from stratification |
---|
1520 | !!---------------------------------------------------------------------- |
---|
1521 | |
---|
1522 | INTEGER, INTENT(in) :: kt |
---|
1523 | CHARACTER(len=*), INTENT(in) :: cdrw ! "READ"/"WRITE" flag |
---|
1524 | |
---|
1525 | INTEGER :: id1, id2 ! iom enquiry index |
---|
1526 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
1527 | INTEGER :: iiki, ikt ! local integer |
---|
1528 | REAL(wp) :: zhbf ! tempory scalars |
---|
1529 | REAL(wp) :: zN2_c ! local scalar |
---|
1530 | REAL(wp) :: rho_c = 0.01_wp !: density criterion for mixed layer depth |
---|
1531 | INTEGER, DIMENSION(:,:), ALLOCATABLE :: imld_rst ! level of mixed-layer depth (pycnocline top) |
---|
1532 | !!---------------------------------------------------------------------- |
---|
1533 | ! |
---|
1534 | !!----------------------------------------------------------------------------- |
---|
1535 | ! If READ/WRITE Flag is 'READ', try to get hbl from restart file. If successful then return |
---|
1536 | !!----------------------------------------------------------------------------- |
---|
1537 | IF( TRIM(cdrw) == 'READ'.AND. ln_rstart) THEN |
---|
1538 | id1 = iom_varid( numror, 'wn' , ldstop = .FALSE. ) |
---|
1539 | IF( id1 > 0 ) THEN ! 'wn' exists; read |
---|
1540 | CALL iom_get( numror, jpdom_autoglo, 'wn', wn ) |
---|
1541 | WRITE(numout,*) ' ===>>>> : wn read from restart file' |
---|
1542 | ELSE |
---|
1543 | wn(:,:,:) = 0._wp |
---|
1544 | WRITE(numout,*) ' ===>>>> : wn not in restart file, set to zero initially' |
---|
1545 | END IF |
---|
1546 | id1 = iom_varid( numror, 'hbl' , ldstop = .FALSE. ) |
---|
1547 | id2 = iom_varid( numror, 'hbli' , ldstop = .FALSE. ) |
---|
1548 | IF( id1 > 0 .AND. id2 > 0) THEN ! 'hbl' exists; read and return |
---|
1549 | CALL iom_get( numror, jpdom_autoglo, 'hbl', hbl ) |
---|
1550 | CALL iom_get( numror, jpdom_autoglo, 'hbli', hbli ) |
---|
1551 | WRITE(numout,*) ' ===>>>> : hbl & hbli read from restart file' |
---|
1552 | RETURN |
---|
1553 | ELSE ! 'hbl' & 'hbli' not in restart file, recalculate |
---|
1554 | WRITE(numout,*) ' ===>>>> : previous run without osmosis scheme, hbl computed from stratification' |
---|
1555 | END IF |
---|
1556 | END IF |
---|
1557 | |
---|
1558 | !!----------------------------------------------------------------------------- |
---|
1559 | ! If READ/WRITE Flag is 'WRITE', write hbl into the restart file, then return |
---|
1560 | !!----------------------------------------------------------------------------- |
---|
1561 | IF( TRIM(cdrw) == 'WRITE') THEN !* Write hbli into the restart file, then return |
---|
1562 | IF(lwp) WRITE(numout,*) '---- osm-rst ----' |
---|
1563 | CALL iom_rstput( kt, nitrst, numrow, 'wn' , wn ) |
---|
1564 | CALL iom_rstput( kt, nitrst, numrow, 'hbl' , hbl ) |
---|
1565 | CALL iom_rstput( kt, nitrst, numrow, 'hbli' , hbli ) |
---|
1566 | RETURN |
---|
1567 | END IF |
---|
1568 | |
---|
1569 | !!----------------------------------------------------------------------------- |
---|
1570 | ! Getting hbl, no restart file with hbl, so calculate from surface stratification |
---|
1571 | !!----------------------------------------------------------------------------- |
---|
1572 | IF( lwp ) WRITE(numout,*) ' ===>>>> : calculating hbl computed from stratification' |
---|
1573 | ALLOCATE( imld_rst(jpi,jpj) ) |
---|
1574 | ! w-level of the mixing and mixed layers |
---|
1575 | CALL eos_rab( tsn, rab_n ) |
---|
1576 | CALL bn2(tsn, rab_n, rn2) |
---|
1577 | imld_rst(:,:) = nlb10 ! Initialization to the number of w ocean point |
---|
1578 | hbl(:,:) = 0._wp ! here hbl used as a dummy variable, integrating vertically N^2 |
---|
1579 | zN2_c = grav * rho_c * r1_rau0 ! convert density criteria into N^2 criteria |
---|
1580 | ! |
---|
1581 | hbl(:,:) = 0._wp ! here hbl used as a dummy variable, integrating vertically N^2 |
---|
1582 | DO jk = 1, jpkm1 |
---|
1583 | DO jj = 1, jpj ! Mixed layer level: w-level |
---|
1584 | DO ji = 1, jpi |
---|
1585 | ikt = mbkt(ji,jj) |
---|
1586 | hbl(ji,jj) = hbl(ji,jj) + MAX( rn2(ji,jj,jk) , 0._wp ) * e3w_n(ji,jj,jk) |
---|
1587 | IF( hbl(ji,jj) < zN2_c ) imld_rst(ji,jj) = MIN( jk , ikt ) + 1 ! Mixed layer level |
---|
1588 | END DO |
---|
1589 | END DO |
---|
1590 | END DO |
---|
1591 | ! |
---|
1592 | DO jj = 1, jpj |
---|
1593 | DO ji = 1, jpi |
---|
1594 | iiki = imld_rst(ji,jj) |
---|
1595 | hbl (ji,jj) = gdepw_n(ji,jj,iiki ) * ssmask(ji,jj) ! Turbocline depth |
---|
1596 | END DO |
---|
1597 | END DO |
---|
1598 | hbl = MAX(hbl,epsln) |
---|
1599 | hbli(:,:) = hbl(:,:) |
---|
1600 | DEALLOCATE( imld_rst ) |
---|
1601 | WRITE(numout,*) ' ===>>>> : hbl computed from stratification' |
---|
1602 | END SUBROUTINE osm_rst |
---|
1603 | |
---|
1604 | |
---|
1605 | SUBROUTINE tra_osm( kt ) |
---|
1606 | !!---------------------------------------------------------------------- |
---|
1607 | !! *** ROUTINE tra_osm *** |
---|
1608 | !! |
---|
1609 | !! ** Purpose : compute and add to the tracer trend the non-local tracer flux |
---|
1610 | !! |
---|
1611 | !! ** Method : ??? |
---|
1612 | !!---------------------------------------------------------------------- |
---|
1613 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: ztrdt, ztrds ! 3D workspace |
---|
1614 | !!---------------------------------------------------------------------- |
---|
1615 | INTEGER, INTENT(in) :: kt |
---|
1616 | INTEGER :: ji, jj, jk |
---|
1617 | ! |
---|
1618 | IF( ln_timing ) CALL timing_start('tra_osm') |
---|
1619 | ! |
---|
1620 | IF( kt == nit000 ) THEN |
---|
1621 | IF(lwp) WRITE(numout,*) |
---|
1622 | IF(lwp) WRITE(numout,*) 'tra_osm : OSM non-local tracer fluxes' |
---|
1623 | IF(lwp) WRITE(numout,*) '~~~~~~~ ' |
---|
1624 | ENDIF |
---|
1625 | |
---|
1626 | IF( l_trdtra ) THEN !* Save ta and sa trends |
---|
1627 | ALLOCATE( ztrdt(jpi,jpj,jpk) ) ; ztrdt(:,:,:) = tsa(:,:,:,jp_tem) |
---|
1628 | ALLOCATE( ztrds(jpi,jpj,jpk) ) ; ztrds(:,:,:) = tsa(:,:,:,jp_sal) |
---|
1629 | ENDIF |
---|
1630 | |
---|
1631 | ! add non-local temperature and salinity flux |
---|
1632 | DO jk = 1, jpkm1 |
---|
1633 | DO jj = 2, jpjm1 |
---|
1634 | DO ji = 2, jpim1 |
---|
1635 | tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem) & |
---|
1636 | & - ( ghamt(ji,jj,jk ) & |
---|
1637 | & - ghamt(ji,jj,jk+1) ) /e3t_n(ji,jj,jk) |
---|
1638 | tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal) & |
---|
1639 | & - ( ghams(ji,jj,jk ) & |
---|
1640 | & - ghams(ji,jj,jk+1) ) / e3t_n(ji,jj,jk) |
---|
1641 | END DO |
---|
1642 | END DO |
---|
1643 | END DO |
---|
1644 | |
---|
1645 | |
---|
1646 | ! save the non-local tracer flux trends for diagnostic |
---|
1647 | IF( l_trdtra ) THEN |
---|
1648 | ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:) |
---|
1649 | ztrds(:,:,:) = tsa(:,:,:,jp_sal) - ztrds(:,:,:) |
---|
1650 | !!bug gm jpttdzdf ==> jpttosm |
---|
1651 | CALL trd_tra( kt, 'TRA', jp_tem, jptra_zdf, ztrdt ) |
---|
1652 | CALL trd_tra( kt, 'TRA', jp_sal, jptra_zdf, ztrds ) |
---|
1653 | DEALLOCATE( ztrdt ) ; DEALLOCATE( ztrds ) |
---|
1654 | ENDIF |
---|
1655 | |
---|
1656 | IF(ln_ctl) THEN |
---|
1657 | CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' osm - Ta: ', mask1=tmask, & |
---|
1658 | & tab3d_2=tsa(:,:,:,jp_sal), clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
1659 | ENDIF |
---|
1660 | ! |
---|
1661 | IF( ln_timing ) CALL timing_stop('tra_osm') |
---|
1662 | ! |
---|
1663 | END SUBROUTINE tra_osm |
---|
1664 | |
---|
1665 | |
---|
1666 | SUBROUTINE trc_osm( kt ) ! Dummy routine |
---|
1667 | !!---------------------------------------------------------------------- |
---|
1668 | !! *** ROUTINE trc_osm *** |
---|
1669 | !! |
---|
1670 | !! ** Purpose : compute and add to the passive tracer trend the non-local |
---|
1671 | !! passive tracer flux |
---|
1672 | !! |
---|
1673 | !! |
---|
1674 | !! ** Method : ??? |
---|
1675 | !!---------------------------------------------------------------------- |
---|
1676 | ! |
---|
1677 | !!---------------------------------------------------------------------- |
---|
1678 | INTEGER, INTENT(in) :: kt |
---|
1679 | WRITE(*,*) 'trc_osm: Not written yet', kt |
---|
1680 | END SUBROUTINE trc_osm |
---|
1681 | |
---|
1682 | |
---|
1683 | SUBROUTINE dyn_osm( kt ) |
---|
1684 | !!---------------------------------------------------------------------- |
---|
1685 | !! *** ROUTINE dyn_osm *** |
---|
1686 | !! |
---|
1687 | !! ** Purpose : compute and add to the velocity trend the non-local flux |
---|
1688 | !! copied/modified from tra_osm |
---|
1689 | !! |
---|
1690 | !! ** Method : ??? |
---|
1691 | !!---------------------------------------------------------------------- |
---|
1692 | INTEGER, INTENT(in) :: kt ! |
---|
1693 | ! |
---|
1694 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
1695 | !!---------------------------------------------------------------------- |
---|
1696 | ! |
---|
1697 | IF( ln_timing ) CALL timing_start('dyn_osm') |
---|
1698 | ! |
---|
1699 | IF( kt == nit000 ) THEN |
---|
1700 | IF(lwp) WRITE(numout,*) |
---|
1701 | IF(lwp) WRITE(numout,*) 'dyn_osm : OSM non-local velocity' |
---|
1702 | IF(lwp) WRITE(numout,*) '~~~~~~~ ' |
---|
1703 | ENDIF |
---|
1704 | !code saving tracer trends removed, replace with trdmxl_oce |
---|
1705 | |
---|
1706 | DO jk = 1, jpkm1 ! add non-local u and v fluxes |
---|
1707 | DO jj = 2, jpjm1 |
---|
1708 | DO ji = 2, jpim1 |
---|
1709 | ua(ji,jj,jk) = ua(ji,jj,jk) & |
---|
1710 | & - ( ghamu(ji,jj,jk ) & |
---|
1711 | & - ghamu(ji,jj,jk+1) ) / e3u_n(ji,jj,jk) |
---|
1712 | va(ji,jj,jk) = va(ji,jj,jk) & |
---|
1713 | & - ( ghamv(ji,jj,jk ) & |
---|
1714 | & - ghamv(ji,jj,jk+1) ) / e3v_n(ji,jj,jk) |
---|
1715 | END DO |
---|
1716 | END DO |
---|
1717 | END DO |
---|
1718 | |
---|
1719 | ! code for saving tracer trends removed |
---|
1720 | ! |
---|
1721 | IF( ln_timing ) CALL timing_stop('dyn_osm') |
---|
1722 | ! |
---|
1723 | END SUBROUTINE dyn_osm |
---|
1724 | |
---|
1725 | !!====================================================================== |
---|
1726 | END MODULE zdfosm |
---|