My Project
brough.f90
Go to the documentation of this file.
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 !/===========================================================================/
13 ! Copyright (c) 2007, The University of Massachusetts Dartmouth
14 ! Produced at the School of Marine Science & Technology
15 ! Marine Ecosystem Dynamics Modeling group
16 ! All rights reserved.
17 !
18 ! FVCOM has been developed by the joint UMASSD-WHOI research team. For
19 ! details of authorship and attribution of credit please see the FVCOM
20 ! technical manual or contact the MEDM group.
21 !
22 !
23 ! This file is part of FVCOM. For details, see http://fvcom.smast.umassd.edu
24 ! The full copyright notice is contained in the file COPYRIGHT located in the
25 ! root directory of the FVCOM code. This original header must be maintained
26 ! in all distributed versions.
27 !
28 ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29 ! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
30 ! THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31 ! PURPOSE ARE DISCLAIMED.
32 !
33 !/---------------------------------------------------------------------------/
34 ! CVS VERSION INFORMATION
35 ! $Id$
36 ! $Name$
37 ! $Revision$
38 !/===========================================================================/
39 
40 !==============================================================================|
41 ! Calculate Bottom Drag Coefficient based on Bottom Roughness !
42 ! note: !
43 ! when the log function derived from the constant stress log-viscous !
44 ! layer is applied to an estuary, if the value of z0 is close to !
45 ! (zz(kbm1)-z(kb)*dt1, drag coefficient "cbc" could become a huge !
46 ! number due to near-zero value of alog function. In our application !
47 ! we simply cutoff at cbc=0.005. One could adjust this cutoff value !
48 ! based on observations or his or her experiences. !
49 ! CALCULATES: WUBOT(N), WVBOT(N) : BOTTOM SHEAR STRESSES !
50 !==============================================================================|
51 
52 SUBROUTINE bottom_roughness
53 
54  !==============================================================================!
55  USE all_vars
56  USE mod_utils
57  USE mod_wd
58  USE mod_par
59 
60  IMPLICIT NONE
61  INTEGER :: I,II
62  REAL(SP), PARAMETER :: KAPPA = .40_sp !!VON KARMAN LENGTH SCALE
63  REAL(SP), PARAMETER :: VK2 = .160_sp !!KAPPA SQUARED
64  REAL(SP) :: ZTEMP,BTPS,RR,U_TAUB,Z0B_GOTM,CFF
65 
66 ! USED IN 2D MODEL ONLY
67 ! REAL(SP), PARAMETER :: CONST_CD=.0015_SP !! CD SET CONSTANT TO THIS VALUE
68  REAL(SP), PARAMETER :: ALFA = .166667_sp, & !! POWER OF WATER DEPTH
69  nn = 0.02_sp !! FACTOR TO DIVIDE
70 ! REAL(SP), PARAMETER :: CFMIN = .0025_SP, & !! DEEP WATER VALUE
71 ! H_BREAK = 1.0_SP, & !!
72 ! THETA = 10._SP, & !!
73 ! LAMB = 0.3333333333_SP
74  !==============================================================================!
75 
76  if(dbg_set(dbg_sbr)) write(ipt,*) "Start: BOTTOM_ROUGHNESS"
77 
78  !
79  ! SET CONSTANTS
80  !
81 
82  SELECT CASE(bottom_roughness_type)
83  !==============================================================================|
84  CASE(br_orig) !USE ORIGINAL FVCOM FORM FOR BOTTOM FRICTION |
85  !==============================================================================|
86 
87  ! SET A EFFECTIVE MAXIMUM FOR CBC USING THE DEPTH
88 !! WHERE (DT1 > 3.0_SP)
89 !! CBC = VK2/(LOG((ZZ1(:,KBM1)-Z1(:,KB))*DT1/CC_Z0B))**2
90 !! ELSEWHERE
91 !! CBC = VK2/(LOG((ZZ1(:,KBM1)-Z1(:,KB))*3.0/CC_Z0B))**2
92 !! END WHERE
93  WHERE (dt1(1:nt) > 3.0_sp)
94  cbc(1:nt) = vk2/(log((zz1(1:nt,kbm1)-z1(1:nt,kb))*dt1(1:nt)/cc_z0b(1:nt)))**2
95  ELSEWHERE
96  cbc(1:nt) = vk2/(log((zz1(1:nt,kbm1)-z1(1:nt,kb))*3.0/cc_z0b(1:nt)))**2
97  END WHERE
98 
99  ! SET A MINIMUM VALUE FOR CBC
100  WHERE (cbc < cbcmin)
101  cbc=cbcmin
102  END WHERE
103 
104 
105  !==============================================================================|
106  CASE(br_gotm) !GOTM FORMULATION FOR BOTTOM FRICTION |
107  !==============================================================================|
108 
109  !----Convert Input Z0B to GOTMS H0B
110  ! H0B = Z0B/.03
111  ! DAS fixed bug to match gotm's friction.f90
112  DO i=1,n
113  u_taub = 0.0_sp
114  DO ii=1,40
115  IF (umol <= 0.0_sp) THEN
116  z0b_gotm=cc_z0b(i) !0.03*H0B
117  ELSE
118  z0b_gotm=0.1_sp*umol/max(umol,u_taub)+cc_z0b(i) !0.03*H0B
119  END IF
120  ztemp=(zz1(i,kbm1)-z1(i,kb))*dt1(i)
121  rr=kappa/(log((z0b_gotm+ztemp)/z0b_gotm))
122  u_taub = rr*sqrt( u(i,kbm1)*u(i,kbm1) + v(i,kbm1)*v(i,kbm1) )
123  END DO
124  cbc(i) = rr*rr
125  END DO
126 
127 
128  CASE DEFAULT
129  CALL fatal_error ("BROUGH: UNKNOWN BOTTOM_ROUGHNESS_TYPE:"&
130  & ,trim(bottom_roughness_type) )
131  END SELECT
132 
133 
134  !==============================================================================|
135  ! CALCULATE SHEAR STRESS ON BOTTOM --> WUBOT/WVBOT |
136  !==============================================================================|
137  DO i = 1, n
138  btps= cbc(i)*sqrt(u(i,kbm1)**2+v(i,kbm1)**2)
139  wubot(i) = -btps * u(i,kbm1)
140  wvbot(i) = -btps * v(i,kbm1)
141  cff=0.75_sp*dz1(i,kbm1)*d1(i)
142  wubot(i)=sign(1.0_sp,wubot(i))*min(abs(wubot(i)),abs(u(i,kbm1)*cff/dti))
143  wvbot(i)=sign(1.0_sp,wvbot(i))*min(abs(wvbot(i)),abs(v(i,kbm1)*cff/dti))
144  !for plb case only
145 
146  END DO
147 
148 
149  !==============================================================================|
150  ! Calculate shear stress on nodes (x-component, y-component, magnitude)
151  !==============================================================================|
152  taubm = sqrt(wubot**2 + wvbot**2)
153 
154  CALL e2n2d(wubot,wubot_n)
155  CALL e2n2d(wvbot,wvbot_n)
156  taubm_n = sqrt(wubot_n**2 + wvbot_n**2)
157 
158  if(dbg_set(dbg_sbr)) write(ipt,*) "End: BOTTOM_ROUGHNESS"
159 
160  RETURN
161 END SUBROUTINE bottom_roughness
162 !==============================================================================|
real(sp), dimension(:), allocatable, target d1
Definition: mod_main.f90:1116
real(sp), dimension(:,:), allocatable, target v
Definition: mod_main.f90:1269
logical function dbg_set(vrb)
Definition: mod_utils.f90:182
real(sp), dimension(:), allocatable, target wubot_n
Definition: mod_main.f90:1188
real(sp), dimension(:,:), allocatable, target u
Definition: mod_main.f90:1268
real(sp), dimension(:), allocatable, target wubot
Definition: mod_main.f90:1185
real(sp), dimension(:), allocatable, target wvbot
Definition: mod_main.f90:1186
subroutine e2n2d(EVAR, NVAR)
Definition: mod_main.f90:1408
subroutine bottom_roughness
Definition: brough.f90:53
real(sp), dimension(:), allocatable, target cc_z0b
Definition: mod_main.f90:1171
real(sp), dimension(:), allocatable, target wvbot_n
Definition: mod_main.f90:1189
real(sp), dimension(:,:), allocatable, target zz1
Definition: mod_main.f90:1095
real(sp), dimension(:), allocatable, target taubm_n
Definition: mod_main.f90:1190
real(sp), dimension(:), allocatable, target dt1
Definition: mod_main.f90:1117
subroutine fatal_error(ER1, ER2, ER3, ER4)
Definition: mod_utils.f90:230
real(sp), dimension(:), allocatable, target taubm
Definition: mod_main.f90:1187
real(sp), dimension(:,:), allocatable, target dz1
Definition: mod_main.f90:1096
real(sp), dimension(:,:), allocatable, target z1
Definition: mod_main.f90:1094
real(sp), dimension(:), allocatable, target cbc
Definition: mod_main.f90:1170
integer, parameter dbg_sbr
Definition: mod_utils.f90:69