1 |
c swd -- bulkf formula used in bulkf and ice pkgs |
2 |
c cswd -- adapted from vince/andrei surf_flux.f |
3 |
|
4 |
#include "CPP_OPTIONS.h" |
5 |
subroutine bulkf_formula_vince( |
6 |
I uw, vw, us, Ta, Qa, nc, tsf_in, |
7 |
I UFocean, flwup, flha, fsha, df0dT, |
8 |
I ust, vst, evp, ssq, |
9 |
I iceornot, readstress |
10 |
& ) |
11 |
|
12 |
IMPLICIT NONE |
13 |
c |
14 |
#include "EEPARAMS.h" |
15 |
#include "SIZE.h" |
16 |
#include "PARAMS.h" |
17 |
#include "DYNVARS.h" |
18 |
#include "GRID.h" |
19 |
#include "FFIELDS.h" |
20 |
#ifdef ALLOW_BULKFORMULA |
21 |
#include "BULKF_ICE_CONSTANTS.h" |
22 |
#endif |
23 |
#ifdef ALLOW_TSEAICE |
24 |
#include "ICE.h" |
25 |
#endif |
26 |
|
27 |
c |
28 |
c calculate bulk formula fluxes over open ocean or seaice |
29 |
c |
30 |
c input |
31 |
_RL us ! wind speed |
32 |
_RL uw ! zonal wind speed (at grid center) |
33 |
_RL vw ! meridional wind speed (at grid center) |
34 |
_RL Ta ! air temperature at ht |
35 |
_RL Qa ! specific humidity at ht |
36 |
_RL nc ! cloud cover |
37 |
_RL tsf_in ! surface temperature (either ice or open water) |
38 |
integer iceornot ! 0=open water, 1=ice cover |
39 |
logical readstress |
40 |
c output |
41 |
_RL flwup ! upward long wave radiation |
42 |
_RL flha ! latent heat flux |
43 |
_RL fsha ! sensible heat flux |
44 |
_RL df0dT ! derivative of heat flux with respect to Tsf |
45 |
_RL ust ! zonal wind stress (at grid center) |
46 |
_RL vst ! meridional wind stress (at grid center) |
47 |
_RL evp ! evaporation rate (over open water) |
48 |
_RL ssq ! surface specific humidity (kg/kg) |
49 |
c |
50 |
c input and output |
51 |
_RL UFocean |
52 |
c |
53 |
c local variables |
54 |
_RL ea |
55 |
_RL mixratio |
56 |
_RL stable |
57 |
_RL tsf ! surface temperature in K |
58 |
_RL ht ! reference height (m) |
59 |
_RL usm ! wind speed limited |
60 |
_RL deltap ! potential temperature diff (K) |
61 |
_RL delq ! specific humidity difference |
62 |
_RL lhcoef |
63 |
_RL shcoef |
64 |
_RL dflhdT ! derivative of latent heat with respect to T |
65 |
_RL dfshdT ! derivative of sensible heat with respect to T |
66 |
_RL dflwupdT ! derivative of long wave with respect to T |
67 |
c from vinces |
68 |
_RL elhx |
69 |
_RL rough |
70 |
_RL cdn |
71 |
_RL surf_emissivity ! ocean or ice emissivity |
72 |
_RL qg |
73 |
_RL rigs |
74 |
_RL dm |
75 |
_RL dh |
76 |
_RL cdm |
77 |
_RL cdh |
78 |
_RL rcdhws |
79 |
_RL Tsv |
80 |
_RL dqssdt |
81 |
_RL x |
82 |
integer lr |
83 |
|
84 |
_RL flwdown ! part of output eventually QQ |
85 |
#ifdef ALLOW_BULKFORMULA |
86 |
|
87 |
_RL AROUGH(20),BROUGH(20),CROUGH(20),DROUGH(20),EROUGH(20) |
88 |
DATA AROUGH/16.59,13.99,10.4,7.35,5.241,3.926,3.126,2.632,2.319, |
89 |
*2.116,1.982,1.893,1.832,1.788,1.757,1.733,1.714,1.699,1.687,1.677/ |
90 |
DATA BROUGH/3.245,1.733,0.8481,0.3899,0.1832,0.9026E-1,0.4622E-1, |
91 |
* .241E-1,.1254E-1,.6414E-2,.3199E-2,.1549E-2,.7275E-3,.3319E-3, |
92 |
* .1474E-3,.6392E-4,.2713E-4,.1130E-4,.4630E-5,.1868E-5/ |
93 |
DATA CROUGH/5.111,3.088,1.682,.9239,.5626,.3994,.3282,.3017,.299 |
94 |
*,.3114,.3324,.3587,.3881,.4186,.4492,.4792,.5082,.5361,.5627, |
95 |
* .5882/ |
96 |
DATA DROUGH/1.24,1.02,0.806,0.682,0.661,0.771,0.797,0.895,0.994, |
97 |
* 1.09,1.18,1.27,1.35,1.43,1.50,1.58,1.65,1.71,1.78,1.84/ |
98 |
DATA EROUGH/0.128,0.130,0.141,0.174,0.238,0.330,0.438,0.550,0.660, |
99 |
* 0.766,0.866,0.962,1.05,1.14,1.22,1.30,1.37,1.45,1.52,1.58/ |
100 |
|
101 |
|
102 |
c --- external functions --- |
103 |
_RL exf_BulkCdn |
104 |
external exf_BulkCdn |
105 |
|
106 |
c UFocean=1e-2 !QQ what is this and what is the number? |
107 |
|
108 |
c -- set all to zero |
109 |
flwup = 0.d0 ! upward long wave radiation |
110 |
flha = 0.d0 ! latent heat flux |
111 |
fsha = 0.d0 ! sensible heat flux |
112 |
df0dT = 0.d0 ! derivative of heat flux with respect to Tsf |
113 |
ust = 0.d0 ! zonal wind stress (at grid center) |
114 |
vst = 0.d0 ! meridional wind stress (at grid center) |
115 |
evp = 0.d0 ! evaporation rate (over open water) |
116 |
ssq = 0.d0 ! surface specific humidity (kg/kg) |
117 |
|
118 |
|
119 |
Qa=max(Qa,1e-7) |
120 |
Tsf=Tsf_in+Tf0kel |
121 |
ht=10.e0 |
122 |
c Wind speed |
123 |
if (us.eq.0.d0) then !in case we have a constant prescribed us |
124 |
us = sqrt(uw*uw + vw*vw) |
125 |
endif |
126 |
usm = max(us,1.d-5) |
127 |
cQQQ try to limit drag |
128 |
cQQQ usm = min(usm,5.d0) |
129 |
|
130 |
c from vinces surfflux.F |
131 |
if (iceornot.eq.0) then |
132 |
c for open water |
133 |
rough=max(0.018*UFocean/gravity,0.5E-5) !QQcheck |
134 |
elhx=Lvap !QQcheck |
135 |
else |
136 |
c for sea ice cover |
137 |
rough=10**(-3.37) !QQcheck |
138 |
elhx = Lvap_ice |
139 |
endif |
140 |
Qg =3.797915*exp(elhx*(7.93252e-6-2.166847E-3/Ta))/p0 |
141 |
c |
142 |
c find stability of atmospheric surface layer stratification |
143 |
rough=log10(ht/rough) |
144 |
cdn=.0231/(rough*rough) !QQcheck |
145 |
lr=rough*2.d0 - 5.d-1 !QQcheck |
146 |
lr=max(1,min(lr,20)) |
147 |
rigs=ht*gravity*(Tsf-Ta)/(Ta*usm*usm) |
148 |
if (rigs.le.0.d0) then |
149 |
c unstable |
150 |
dm=sqrt((1.d0-AROUGH(lr)*rigs)*(1.d0-BROUGH(lr)*rigs)/ |
151 |
& (1.d0-CROUGH(lr)*rigs)) |
152 |
dh=1.35*sqrt((1.d0-DROUGH(lr)*rigs)/ |
153 |
& (1.d0-EROUGH(lr)*rigs)) !QQcheck |
154 |
else |
155 |
c stable |
156 |
dm=1.d0/(1.d0+(11.238+89.9*rigs)*rigs) !QQcheck |
157 |
dh=1.35/(1.d0+1.93*rigs) !QQcheck |
158 |
endif |
159 |
cdm = cdn * dm |
160 |
cdh = cdn * dm * dh |
161 |
|
162 |
rcdhws = cdh*us*100*p0/(Rgas*Tsf) !QQ check units (take out 100) |
163 |
ssq =3.797915*exp(elhx*(7.93252e-6-2.166847E-3/Tsf))/p0 |
164 |
cBB debugging |
165 |
cBB print*,'ssq', qcoef, ssq |
166 |
c |
167 |
|
168 |
if (Qa.le.ssq) then |
169 |
Tsv=Tsf |
170 |
ssq=ssq !QQQQ should be ssq=qa? |
171 |
else |
172 |
dqssdt=ssq*elhx/(Rvap*Tsf*Tsf) |
173 |
x=(Qa-ssq)/(dqssdt+(sha/elhx)) |
174 |
Tsv=Tsf+x |
175 |
ssq=Qa+x*(sha/elhx) |
176 |
endif |
177 |
|
178 |
deltap = Ta - Tsv !tsv-Ta |
179 |
delq = Qg - ssq !Qsv - Qg |
180 |
cmine deltap = ta - tsf + gamma_blk*ht |
181 |
cmine delq = Qa - ssq |
182 |
c latent heat |
183 |
c ------------- |
184 |
cvinc lhcoef = Lvap*rcdhws |
185 |
cmine latent heat coeff. following Gill 2.4.6 and 2.6.2 formula |
186 |
lhcoef =Lvap*rhoa*us*5e-3 !QQ name coeff. !QQwas 1.5e-3 |
187 |
flha = lhcoef*delq !QQQ |
188 |
evp = lhcoef*delq/Lvap/rhosw |
189 |
c sensible heat |
190 |
c ---------------- |
191 |
cvinc shcoef=sha*rcdhws |
192 |
cmine sensible heat coeff. following Gill 2.4.5 formula |
193 |
stable = 5.d-1 + sign(5.d-1, deltap) |
194 |
if (stable.gt.0) then |
195 |
shcoef = 0.83e-3*rhoa*us*cpair |
196 |
else |
197 |
shcoef = 1.10e-3*rhoa*us*cpair |
198 |
endif |
199 |
fsha = shcoef*deltap |
200 |
|
201 |
c long wave |
202 |
c ------------ |
203 |
cvinc if (iceornot.eq.1) then |
204 |
cvinc#ifdef ALLOW_TSEAICE |
205 |
cvinc if (snowheight.gt.0.d0) then |
206 |
cvinc surf_emissivity=snow_emissivity |
207 |
cvinc else |
208 |
cvinc surf_emissivity=ice_emissivity |
209 |
cvinc endif |
210 |
cvinc#endif |
211 |
cvinc else |
212 |
cvinc surf_emissivity=ocean_emissivity |
213 |
cvinc endif |
214 |
cvinc flwup = -surf_emissivity*stefan* |
215 |
cvinc & Tsf**4.0 !QQcheck |
216 |
cvinc flwdown = atm_emissivity*stefan * |
217 |
cvinc & Ta**4.0 * (1.0+0.275*nc) * |
218 |
cvinc & (1.0-0.261*exp(-7.77e-4*(273.15-Ta)**2.0)) !QQcheck |
219 |
cvinc flwup=flwup+flwdown !QQQQQ?? |
220 |
cmine up (net) long wave radiation |
221 |
mixratio=Qa/(1-Qa) |
222 |
ea=p0*mixratio/(0.62197+mixratio) |
223 |
flwup=-0.985*stefan*tsf**4 |
224 |
& *(0.39-0.05*sqrt(ea)) |
225 |
& *(1-0.6*nc**2) |
226 |
c ------------------------- |
227 |
UFocean=cdm*us*us |
228 |
|
229 |
#ifdef ALLOW_TSEAICE |
230 |
if (iceornot.eq.1) then |
231 |
c derivatives of heat flux |
232 |
c ------------------------- |
233 |
c dflwupdT=-4.0*surf_emissivity*stefan * |
234 |
c & Tsf**3.0 !QQcheck |
235 |
cQQ corrected for Vince formula |
236 |
dflhdT = -lhcoef*ssq*Lvap*2.166847E-3/(Tsf**2) |
237 |
dfshdT = -shcoef !QQQQQQ not quite right |
238 |
cmine derivatives with respect to Tsf |
239 |
cmine dflhdT = -lhcoef*Tf0kel*ssq*22.47/(tsf**2) |
240 |
cmine dfshdT = -shcoef |
241 |
dflwupdT=-4.*0.985*stefan*tsf**3 |
242 |
& *(0.39-0.05*sqrt(ea)) |
243 |
c |
244 |
c total derivative with respect to surface temperature |
245 |
df0dT=dflwupdT+dfshdT+dflhdT |
246 |
cBB |
247 |
cBB print*,'derivatives:',df0dT,dflwupdT,dfshdT,dflhdT |
248 |
endif |
249 |
#endif /*ALLOW_TSEAICE*/ |
250 |
c |
251 |
c wind stress at center points |
252 |
c ----------------------------- |
253 |
if (.NOT.readstress) then |
254 |
ust = rhoa*exf_BulkCdn(usm)*us*uw |
255 |
vst = rhoa*exf_BulkCdn(usm)*us*vw |
256 |
endif |
257 |
#endif /*ALLOW_BULKFORMULA*/ |
258 |
|
259 |
return |
260 |
end |