00001
00002
00003
00004 #include "cppdefs.h"
00005 #ifdef BBL
00006 subroutine bblm (tile)
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 implicit none
00035 integer tile, trd, omp_get_thread_num
00036 # include "param.h"
00037 # include "private_scratch.h"
00038
00039 # include "compute_tile_bounds.h"
00040
00041 trd=omp_get_thread_num()
00042 call bblm_tile (Istr,Iend,Jstr,Jend,
00043 & A2d(1, 1,trd),A2d(1, 2,trd),A2d(1, 3,trd),
00044 & A2d(1, 4,trd),A2d(1, 5,trd),A2d(1, 6,trd),
00045 & A2d(1, 7,trd))
00046 return
00047 end
00048
00049
00050 SUBROUTINE bblm_tile (Istr,Iend,Jstr,Jend,Ub,Zr,Ur,Vr,Umag,
00051 & tauc,tauw)
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 implicit none
00066 # include "param.h"
00067 # include "bbl.h"
00068 # include "forces.h"
00069 # include "grid.h"
00070 # include "ocean3d.h"
00071 # include "scalars.h"
00072 # include "sediment.h"
00073
00074 logical
00075 & SAND, SILT
00076
00077 integer
00078 & Iend, Istr, Jend, Jstr, i, ised, j
00079
00080 real
00081 & Ab, anglec, anglew, cff, cff1, cff2, d50,
00082 & Fwave, Kbh, Kbh2, Kdh, phic, phicw,
00083 & rhbio, rhbiomax, rhgt, rhmax, rhmin, rhfac,
00084 & rlbio, rlen, rlmin, rhosed, rhow,
00085 & tau_bf, tau_c, tau_cb, tau_ex, tau_up,tau_w,
00086 & tau_wb, tau_cs, tau_cw, tau_cwb, tau_cws, tau_en,
00087 & thetw, twopi, Ucur, Vcur, Ubc, visk, wset,
00088 & znot, znotc, znot_bl, znot_rip
00089 parameter (Ubc = 0.01)
00090
00091 real
00092 & tauc(PRIVATE_2D_SCRATCH_ARRAY),
00093 & tauw(PRIVATE_2D_SCRATCH_ARRAY),
00094 & Ub(PRIVATE_2D_SCRATCH_ARRAY),
00095 & Umag(PRIVATE_2D_SCRATCH_ARRAY),
00096 & Ur(PRIVATE_2D_SCRATCH_ARRAY),
00097 & Vr(PRIVATE_2D_SCRATCH_ARRAY),
00098 & Zr(PRIVATE_2D_SCRATCH_ARRAY)
00099
00100 real
00101 & K1, K2, K3, K4, K5, K6
00102 parameter (K1=0.6666666666, K2=0.3555555555,
00103 & K3=0.1608465608, K4=0.0632098765,
00104 & K5=0.0217540484, K6=0.0065407983)
00105
00106 real
00107 & scf1, scf2, scf3, scf4, scf5
00108 parameter (scf1 = 0.5 * 1.39, scf2 = 0.52,
00109 & scf3 = 2.0 - scf2, scf4 = 1.2,
00110 & scf5 = 3.2)
00111
00112
00113 # include "compute_auxiliary_bounds.h"
00114
00115
00116
00117
00118
00119 twopi=2.0*pi
00120 rhbiomax = 6.0d-3
00121 rhmin = 1.0d-3
00122 rlmin = 1.0d-2
00123 rhfac = 1.0d0/EXP(4.11d0)
00124
00125 do j=JstrV-1,Jend
00126 do i=IstrU-1,Iend
00127 tauc(i,j)=0.0
00128 tauw(i,j)=0.0
00129 enddo
00130 enddo
00131
00132
00133
00134 do j=JstrV-1,Jend+1
00135 do i=IstrU-1,Iend+1
00136 Zr(i,j)=z_r(i,j,1)-z_w(i,j,0)
00137 Ur(i,j)=u(i,j,1,nrhs)
00138 Vr(i,j)=v(i,j,1,nrhs)
00139 enddo
00140 enddo
00141
00142
00143
00144 do j=JstrV-1,Jend
00145 do i=IstrU-1,Iend
00146 rhbio = 0.0d0
00147 rlbio = 0.0d0
00148 rlen = Lripple(i,j)
00149 rhgt = Hripple(i,j)
00150 rhow = rho(i,j,1)+1000.0
00151 visk = 1.3e-3/rhow
00152
00153
00154
00155
00156
00157 Fwave=twopi/Pwave(i,j)
00158 Kdh=h(i,j)*Fwave*Fwave/g
00159 Kbh2=Kdh*Kdh+
00160 & Kdh/(1.0+Kdh*(K1+Kdh*(K2+Kdh*(K3+Kdh*(K4+
00161 & Kdh*(K5+K6*Kdh))))))
00162 Kbh = SQRT(Kbh2)
00163
00164
00165
00166 Ab=Awave(i,j)/SINH(Kbh)
00167 Ub(i,j)=Fwave*Ab
00168 # ifdef MASKING
00169 & *rmask(i,j)
00170 # endif
00171
00172
00173
00174 Ucur=0.5*(Ur(i,j)+Ur(i+1,j))
00175 Vcur=0.5*(Vr(i,j)+Vr(i,j+1))
00176 Umag(i,j)=SQRT(Ucur*Ucur+Vcur*Vcur)
00177 # ifdef MASKING
00178 & *rmask(i,j)
00179 # endif
00180
00181
00182
00183 if (Ucur.ne.0.0) then
00184 phic=ATAN2(Vcur,Ucur)
00185 else
00186 phic=(pi/2.0)*SIGN(1.0,Vcur)
00187 endif
00188 phicw=(3.0*pi)/2.0 -Dwave(i,j)-phic
00189 # ifdef CURVGRID
00190 & -angler(i,j)
00191 #endif
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203 # ifdef ANA_BSEDIM
00204
00205 d50 = Ssize(i,j)
00206 tau_cb = taucb(i,j)/rhow
00207
00208
00209 wset = w_set(i,j)
00210 rhosed = Sdens(i,j)/rhow
00211
00212
00213
00214 # elif defined SEDIMENT
00215
00216
00217
00218 d50 = 1.0
00219 tau_cb= 1.0
00220 wset = 1.0
00221 rhosed= 1.0
00222
00223 do ised=1,NST
00224 d50 = d50 *(Sd (ised))**bed_frac(i,j,1,ised)
00225 tau_cb = tau_cb*(tau_ce(ised))**bed_frac(i,j,1,ised)
00226 wset = wset *(wsed (ised))**bed_frac(i,j,1,ised)
00227 rhosed = rhosed*(Srho (ised))**bed_frac(i,j,1,ised)
00228 enddo
00229
00230 rhosed= rhosed/rhow
00231
00232 # endif /* ANA_BSEDIM || SEDIMENT */
00233
00234
00235 tau_up = 0.172*(rhosed-1.)*g*(d50**0.624)
00236
00237
00238
00239
00240
00241 tau_bf = 0.79*(visk**(-0.6))*(((rhosed-1)*g)**0.3)
00242 & *(d50**0.9)*tau_cb
00243
00244 znotc= d50/12.0
00245 znot = MAX(Zob,znotc)
00246
00247
00248
00249
00250 cff1 = vonKar/LOG(Zr(i,j)/znot)
00251 cff2 = MIN(Cdb_max,MAX(Cdb_min,cff1*cff1))
00252 tauc(i,j)= cff2*Umag(i,j)*Umag(i,j)
00253
00254 cff1 = vonKar/LOG(Zr(i,j)/znotc)
00255 tau_cs = cff1*cff1*Umag(i,j)*Umag(i,j)
00256
00257
00258
00259
00260
00261
00262
00263 if(Ub(i,j).gt.Ubc) then
00264
00265
00266
00267
00268
00269 tau_w = scf1*((znotc*Fwave)**scf2)*(Ub(i,j)**scf3)
00270
00271
00272 tau_cw= tau_cs*
00273 & (1.+scf4*((tau_w/(tau_w+tau_cs))**scf5))
00274
00275
00276 tau_cws = SQRT((tau_cw+tau_w*COS(phicw))**2
00277 & + (tau_w*SIN(phicw))**2)
00278
00279 tauw(i,j)=tau_cws
00280
00281
00282 tau_w = scf1*((znot*Fwave)**scf2)*(Ub(i,j)**scf3)
00283
00284
00285 tau_cw= tauc(i,j)*
00286 & (1.+scf4*((tau_w/(tau_w+tauc(i,j)))**scf5))
00287
00288 # ifdef Z0_BL
00289
00290
00291
00292
00293
00294
00295
00296 tau_ex=max((tau_cws-tau_cb),0.0)
00297 cff=(1./((rhosed-1.)*g*d50))
00298 znot_bl=17.4*d50*(cff*tau_ex)**0.75
00299 znotc = znotc + znot_bl
00300
00301
00302
00303
00304
00305 cff1=vonKar/LOG(Zr(i,j)/znotc)
00306 tau_c = cff1*cff1*Umag(i,j)*Umag(i,j)
00307 tau_wb = scf1*((znotc*Fwave)**scf2)*(Ub(i,j)**scf3)
00308 tau_cw= tau_c*(1.+scf4*((tau_wb/(tau_wb+tau_c))**scf5))
00309
00310
00311
00312 tau_cwb = SQRT((tau_cw+tau_wb*COS(phicw))**2 +
00313 & (tau_wb*SIN(phicw))**2)
00314 tauw(i,j) = tau_cwb
00315
00316
00317 # ifdef Z0_RIP
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328 if (d50.ge.0.063d-3) then
00329
00330
00331 rhmax=0.8*rlen/pi
00332 rhgt=max(min(rhmax,rhgt),rhmin)
00333
00334 tau_en=max(tau_cws,tau_cws*(rlen/(rlen-pi*rhgt))**2)
00335
00336 if ((tau_cws.lt.tau_cb).and.(tau_en.ge.tau_cb)) then
00337
00338 rhgt = (19.6*(SQRT(tau_cws/tau_cb))+20.9)*d50
00339 rlen = rhgt/0.12
00340 else
00341 & if ((tau_cws.ge.tau_cb).and.(tau_cwb.lt.tau_bf)) then
00342
00343 rhgt = (22.15*(SQRT(tau_cwb/tau_cb))+6.38)*d50
00344 rlen = rhgt/0.12
00345 else
00346 & if ((tau_cwb.ge.tau_bf).and.(tau_cwb.lt.tau_up)) then
00347
00348 rlen = 535.*d50
00349 rhgt = 0.15*rlen*(SQRT(tau_up)-SQRT(tau_cwb))/
00350 & (SQRT(tau_up)-SQRT(tau_bf ))
00351 else if (tau_cwb.ge.tau_up) then
00352
00353 rlen = 0.0
00354 rhgt = 0.0
00355 else
00356
00357 rhgt=Hripple(i,j)
00358 rlen=Lripple(i,j)
00359 endif
00360 endif
00361
00362 # endif /* Z0_BL */
00363 # endif /* Z0_RIP */
00364
00365 # ifdef Z0_BIO
00366
00367
00368
00369
00370
00371
00372 if (d50.lt.0.063d-3) then
00373 rlbio = 0.1d0
00374 thetw = tau_cws*(1./((rhosed-1.)*g*d50))
00375 rhbio = (thetw**(-1.67d0))*rlbio*rhfac
00376 rhgt = min(rhbio,rhbiomax)
00377 rlen = rlbio
00378 endif
00379
00380 # endif /* Z0_BIO */
00381
00382 # if defined Z0_RIP || defined Z0_BIO
00383
00384
00385 znot_rip = 0.92*rhgt*rhgt/(max(rlen,rlmin))
00386 znotc = znotc+znot_rip
00387
00388
00389
00390 cff1 = vonKar/LOG(Zr(i,j)/znotc)
00391 tau_c = cff1*cff1*Umag(i,j)*Umag(i,j)
00392 tau_w = scf1*((znotc*Fwave)**scf2)*(Ub(i,j)**scf3)
00393 tau_cw= tau_c*(1.+scf4*((tau_w/(tau_w+tau_c))**scf5))
00394
00395 # endif /* Z0_RIP || Z0_BIO */
00396
00397
00398
00399
00400
00401 tauc(i,j) = tau_cw
00402
00403 else
00404
00405
00406
00407
00408 tauw(i,j) = tau_cs
00409
00410 # ifdef Z0_RIP
00411 if(tau_cs.gt.tau_up) then
00412 rhgt=0.0
00413 rlen=0.0
00414 else if(tau_cs.lt.tau_cb) then
00415 rhgt=Hripple(i,j)
00416 rlen=Lripple(i,j)
00417 else
00418 rlen=1000.*d50
00419 rhgt=7.4*(rlen/100.)**1.19
00420 endif
00421
00422 znotc = znotc+0.92*rhgt*rhgt/(max(rlen,rlmin))
00423
00424 cff1=vonKar/LOG(Zr(i,j)/znotc)
00425 cff2=MIN(Cdb_max,MAX(Cdb_min,cff1*cff1))
00426 tauc(i,j) = cff2*Umag(i,j)*Umag(i,j)
00427 # endif
00428 endif
00429
00430
00431
00432
00433 Abed(i,j) = Ab
00434 # ifdef MASKING
00435 & *rmask(i,j)
00436 # endif
00437 Hripple(i,j)= rhgt
00438 # ifdef MASKING
00439 & *rmask(i,j)
00440 # endif
00441 Lripple(i,j)= rlen
00442 # ifdef MASKING
00443 & *rmask(i,j)
00444 # endif
00445 Zbnot(i,j) = znot
00446 # ifdef MASKING
00447 & *rmask(i,j)
00448 # endif
00449 Zbapp(i,j) = znotc
00450 # ifdef MASKING
00451 & *rmask(i,j)
00452 # endif
00453 enddo
00454 enddo
00455
00456
00457
00458
00459
00460
00461 do j=Jstr,Jend
00462 do i=IstrU,Iend
00463 cff1=0.5*(tauc(i-1,j)+tauc(i,j))
00464 cff2=0.5*(tauw(i-1,j)+tauw(i,j))
00465 anglec=Ur(i,j)/(0.5*(Umag(i-1,j)+Umag(i,j)+1.e-10))
00466 anglew=COS(0.5*(Dwave(i-1,j)+Dwave(i,j)))
00467 bustr(i,j)=cff1*anglec
00468 # ifdef MASKING
00469 & *umask(i,j)
00470 # endif
00471 bustrw(i,j)=cff2*anglew
00472 # ifdef MASKING
00473 & *umask(i,j)
00474 # endif
00475 Ubed(i,j)=Ub(i,j)*anglew
00476 # ifdef MASKING
00477 & *umask(i,j)
00478 # endif
00479
00480 enddo
00481 enddo
00482 do j=JstrV,Jend
00483 do i=Istr,Iend
00484 cff1=0.5*(tauc(i,j-1)+tauc(i,j))
00485 cff2=0.5*(tauw(i,j-1)+tauw(i,j))
00486 anglec=Vr(i,j)/(0.5*(Umag(i,j-1)+Umag(i,j)+1.e-10))
00487 anglew=SIN(0.5*(Dwave(i,j-1)+Dwave(i,j)))
00488 bvstr(i,j)=cff1*anglec
00489 # ifdef MASKING
00490 & *vmask(i,j)
00491 # endif
00492 bvstrw(i,j)=cff2*anglew
00493 # ifdef MASKING
00494 & *vmask(i,j)
00495 # endif
00496 Vbed(i,j)=Ub(i,j)*anglew
00497 # ifdef MASKING
00498 & *vmask(i,j)
00499 # endif
00500 enddo
00501 enddo
00502
00503
00504 return
00505 end
00506
00507 #else
00508 subroutine bblm_empty
00509 end
00510 #endif
00511