1 |
c swd -- bulkf formula used in bulkf and ice pkgs |
2 |
|
3 |
#include "CPP_OPTIONS.h" |
4 |
subroutine bulkf_formula( |
5 |
I uw, vw, us, Ta, Qa, nc, tsf_in, |
6 |
I flwup, flha, fsha, df0dT, |
7 |
I ust, vst, evp, ssq, iceornot, windread |
8 |
& ) |
9 |
|
10 |
IMPLICIT NONE |
11 |
c |
12 |
#include "EEPARAMS.h" |
13 |
#include "SIZE.h" |
14 |
#include "PARAMS.h" |
15 |
#include "DYNVARS.h" |
16 |
#include "GRID.h" |
17 |
#include "FFIELDS.h" |
18 |
#ifdef ALLOW_BULKFORMULA |
19 |
#include "BULKF_ICE_CONSTANTS.h" |
20 |
#include "BULKF.h" |
21 |
#endif |
22 |
|
23 |
c |
24 |
c calculate bulk formula fluxes over open ocean or seaice |
25 |
c |
26 |
c input |
27 |
_RL us ! wind speed |
28 |
_RL uw ! zonal wind speed (at grid center) |
29 |
_RL vw ! meridional wind speed (at grid center) |
30 |
_RL Ta ! air temperature at ht |
31 |
_RL Qa ! specific humidity at ht |
32 |
_RL tsf_in ! surface temperature (either ice or open water) |
33 |
_RL nc ! fraction cloud cover |
34 |
integer iceornot ! 0=open water, 1=ice cover |
35 |
logical windread ! |
36 |
c output |
37 |
_RL flwup ! upward long wave radiation |
38 |
_RL flha ! latent heat flux |
39 |
_RL fsha ! sensible heat flux |
40 |
_RL df0dT ! derivative of heat flux with respect to Tsf |
41 |
_RL ust ! zonal wind stress (at grid center) |
42 |
_RL vst ! meridional wind stress (at grid center) |
43 |
_RL evp ! evaporation rate (over open water) |
44 |
_RL ssq ! surface specific humidity (kg/kg) |
45 |
c |
46 |
c local variables |
47 |
_RL tsf ! surface temperature in K |
48 |
_RL ht ! reference height (m) |
49 |
_RL usm ! wind speed limited |
50 |
_RL t0 ! virtual temperature (K) |
51 |
_RL deltap ! potential temperature diff (K) |
52 |
_RL delq ! specific humidity difference |
53 |
_RL stable |
54 |
_RL lhcoef |
55 |
_RL shcoef |
56 |
_RL dflhdT ! derivative of latent heat with respect to T |
57 |
_RL dfshdT ! derivative of sensible heat with respect to T |
58 |
_RL dflwupdT ! derivative of long wave with respect to T |
59 |
_RL mixratio |
60 |
_RL ea |
61 |
|
62 |
#ifdef ALLOW_BULKFORMULA |
63 |
|
64 |
c --- external functions --- |
65 |
_RL exf_BulkCdn |
66 |
external exf_BulkCdn |
67 |
|
68 |
Qa=max(Qa,1e-7) |
69 |
Tsf=Tsf_in+Tf0kel |
70 |
ht=10 |
71 |
c Wind speed |
72 |
if (us.eq.0) then |
73 |
us = sqrt(uw*uw + vw*vw) |
74 |
endif |
75 |
usm = max(us,1.d-5) |
76 |
cQQQ try to limit drag |
77 |
usm = min(usm,5.d0) |
78 |
c |
79 |
t0 = Ta*(1.d0 + humid_fac*Qa) |
80 |
ssq = qcoef*exp(22.47*(1.d0-Tf0kel/tsf)) |
81 |
cBB debugging |
82 |
cBB print*,'ice, ssq', qcoef, ssq |
83 |
c |
84 |
deltap = ta - tsf + gamma_blk*ht |
85 |
delq = Qa - ssq |
86 |
stable = 5.d-1 + sign(5.d-1, deltap) |
87 |
cQQ -- check all of this |
88 |
c latent heat coeff. following Gill 2.4.6 and 2.6.2 formula |
89 |
lhcoef =Lvap*rhoa*usm*1.5e-3 !QQ name coeff. |
90 |
flha = lhcoef*delq |
91 |
evp= lhcoef*delq/Lvap/rhosw |
92 |
c sensible heat coeff. following Gill 2.4.5 formula |
93 |
if (stable.gt.0) then |
94 |
shcoef = 0.83e-3*rhoa*usm*cpair |
95 |
else |
96 |
shcoef = 1.10e-3*rhoa*usm*cpair |
97 |
endif |
98 |
fsha = shcoef*deltap |
99 |
c up long wave radiation |
100 |
mixratio=Qa/(1-Qa) |
101 |
ea=p0*mixratio/(0.62197+mixratio) |
102 |
flwup=-0.985*stefan*tsf**4 |
103 |
& *(0.39-0.05*sqrt(ea)) |
104 |
& *(1-0.6*nc**2) |
105 |
#ifdef ALLOW_TSEAICE |
106 |
if (iceornot.eq.1) then |
107 |
c derivatives with respect to Tsf |
108 |
dflhdT = -lhcoef*Tf0kel*ssq*22.47/(tsf**2) |
109 |
dfshdT = -shcoef |
110 |
dflwupdT=-4.*0.985*stefan*tsf**3 |
111 |
& *(0.39-0.05*sqrt(ea)) |
112 |
c total derivative with respect to surface temperature |
113 |
df0dT=dflwupdT+dfshdT+dflhdT |
114 |
cBB |
115 |
cBB print*,'derivatives:',df0dT,dflwupdT,dfshdT,dflhdT |
116 |
endif |
117 |
#endif /*ALLOW_TSEAICE*/ |
118 |
c |
119 |
c wind stress at center points |
120 |
if (.NOT.windread) then |
121 |
ust = rhoa*exf_BulkCdn(usm)*us*uw |
122 |
vst = rhoa*exf_BulkCdn(usm)*us*vw |
123 |
endif |
124 |
#endif /*ALLOW_BULKFORMULA*/ |
125 |
|
126 |
return |
127 |
end |