My Project
ice_atmo.f90
Go to the documentation of this file.
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 !/===========================================================================/
13 ! CVS VERSION INFORMATION
14 ! $Id$
15 ! $Name$
16 ! $Revision$
17 !/===========================================================================/
18 
19 !=======================================================================
20 !BOP
21 !
22 ! !MODULE: ice_atmo - atm-ice interface: stability based flux calculations
23 !
24 ! !DESCRIPTION:
25 !
26 ! Atmospheric boundary interface (stability based flux calculations)
27 !
28 ! !REVISION HISTORY:
29 !
30 ! author: Elizabeth C. Hunke, LANL
31 !
32 ! Vectorized by Clifford Chen (Fujitsu) and William H. Lipscomb (LANL)
33 !
34 ! !INTERFACE:
35 !
36  module ice_atmo
37 !
38 ! !USES:
39 !
40  use ice_domain
41  use ice_constants
42  use ice_flux
43  use ice_state
44 !
45 !EOP
46 !
47  implicit none
48 
49 !=======================================================================
50 
51  contains
52 
53 !=======================================================================
54 !BOP
55 !
56 ! !IROUTINE: atmo_boundary_layer - compute coefficients for atm-ice fluxes, stress and Tref
57 !
58 ! !INTERFACE:
59 !
60  subroutine atmo_boundary_layer (ni, sfctype, Tsf, &
61  strx, stry, Trf, Qrf, delt, delq)
62 !
63 ! !DESCRIPTION:
64 !
65 ! Compute coefficients for atm/ice fluxes, stress, and reference
66 ! temperature. NOTE: \! (1) all fluxes are positive downward, \! (2) here, tstar = (WT)/U*, and qstar = (WQ)/U*, \! (3) wind speeds should all be above a minimum speed (eg. 1.0 m/s). \!
67 ! ASSUME: \! The saturation humidity of air at T(K): qsat(T) (kg/m**3) \!
68 ! Code originally based on CSM1 \!
69 ! !REVISION HISTORY:
70 !
71 ! author: Elizabeth C. Hunke, LANL
72 !
73 ! !USES:
74 !
75  use ice_grid ! for tmask
76 !
77 ! !INPUT/OUTPUT PARAMETERS:
78 !
79  integer (kind=int_kind), intent(in) :: &
80  ni ! thickness category index
81 
82  character (len=3), intent(in) ::&
83  sfctype ! ice or ocean
84 
85  real (kind=dbl_kind), dimension (ilo:ihi,jlo:jhi), intent(in) :: &
86  tsf ! surface temperature of ice or ocean
87 
88  real (kind=dbl_kind), dimension (ilo:ihi,jlo:jhi), intent(out) ::&
89  strx &! x surface stress (N)
90  , stry &! y surface stress (N)
91  , trf &! reference height temperature (K)
92  , qrf &! reference height specific humidity (kg/kg)
93  , delt &! potential T difference (K)
94  , delq ! humidity difference (kg/kg)
95 !
96 !EOP
97 !
98  integer (kind=int_kind) ::&
99  k & ! iteration index
100  , i, j ! horizontal indices
101 
102  real (kind=dbl_kind) :: &
103  tsfk &! surface temperature in Kelvin (K)
104  , xqq &! temporary variable
105  , psimh &! stability function at zlvl (momentum)
106  , tau &! stress at zlvl
107  , fac &! interpolation factor
108  , al2 &! ln(z10 /zTrf)
109  , psix2 &! stability function at zTrf (heat and water)
110  , psimhs &! stable profile
111  , ssq &! sat surface humidity (kg/kg)
112  , qqq &! for qsat, dqsatdt
113  , ttt &! for qsat, dqsatdt
114  , qsat &! the saturation humidity of air (kg/m^3)
115  , lheat ! Lvap or Lsub, depending on surface type
116 
117  real (kind=dbl_kind), dimension (1:(ihi-ilo+1)*(jhi-jlo+1)) ::&
118  ustar &! ustar (m/s)
119  , tstar &! tstar
120  , qstar &! qstar
121  , rdn &! sqrt of neutral exchange coefficient (momentum)
122  , rhn &! sqrt of neutral exchange coefficient (heat)
123  , ren &! sqrt of neutral exchange coefficient (water)
124  , rd &! sqrt of exchange coefficient (momentum)
125  , re &! sqrt of exchange coefficient (water)
126  , rh &! sqrt of exchange coefficient (heat)
127  , vmag &! surface wind magnitude (m/s)
128  , alz &! ln(zlvl /z10)
129  , thva &! virtual temperature (K)
130  , cp &! specific heat of moist air
131  , hol &! H (at zlvl ) over L
132  , stable &! stability factor
133  , psixh ! stability function at zlvl (heat and water)
134 
135  integer (kind=int_kind), dimension (1:(ihi-ilo+1)*(jhi-jlo+1)) ::&
136  indxi & ! compressed index in i-direction
137  , indxj ! compressed index in j-direction
138 
139  integer (kind=int_kind) ::&
140  icells & ! number of cells with aicen > puny or tmask true
141  , ij ! combined ij index
142 
143  real (kind=dbl_kind), parameter :: &
144  cpvir = cp_wv/cp_air - c1i &! defined as cp_wv/cp_air - 1.
145  , ztrf = c2i &! reference height for air temp (m)
146  , umin = c1i ! minimum wind speed (m/s)
147 
148  ! local functions
149  real (kind=dbl_kind) :: &
150  xd & ! dummy argument
151  , psimhu & ! unstable part of psimh
152  , psixhu ! unstable part of psimx
153 
154  !------------------------------------------------------------
155  ! Define functions
156  !------------------------------------------------------------
157 
158  psimhu(xd) = log((c1i+xd*(c2i+xd))*(c1i+xd*xd)/c8i) &
159  - c2i*atan(xd) + pi*p5
160 !ech & - c2i*atan(xd) + 1.571_dbl_kind
161 
162  psixhu(xd) = c2i * log((c1i + xd*xd)/c2i)
163 
164  al2 = log(zref/ztrf)
165 
166  !------------------------------------------------------------
167  ! Initialize
168  !------------------------------------------------------------
169 
170  do j = jlo,jhi
171  do i = ilo,ihi
172  lhcoef(i,j) = c0i
173  shcoef(i,j) = c0i
174  strx(i,j) = c0i
175  stry(i,j) = c0i
176  trf(i,j) = c0i
177  qrf(i,j) = c0i
178  delt(i,j) = c0i
179  delq(i,j) = c0i
180  enddo
181  enddo
182 
183  !------------------------------------------------------------
184  ! Compute turbulent flux coefficients, wind stress, and
185  ! reference temperature and humidity.
186  !------------------------------------------------------------
187 
188  if ( sfctype(1:3)=='ice' ) then
189 
190  !------------------------------------------------------------
191  ! identify grid cells with ice
192  !------------------------------------------------------------
193  icells = 0
194  do j = jlo,jhi
195  do i = ilo,ihi
196  if ( aicen(i,j,ni) > puny) then
197  icells = icells + 1
198  indxi(icells) = i
199  indxj(icells) = j
200  endif
201  enddo
202  enddo
203 
204  !------------------------------------------------------------
205  ! define some needed variables
206  !------------------------------------------------------------
207  qqq = qqqice ! for qsat
208  ttt = tttice ! for qsat
209  lheat = lsub ! ice to vapor
210  do ij = 1, icells
211  i = indxi(ij)
212  j = indxj(ij)
213  vmag(ij) = max(umin, wind(i,j))
214  rdn(ij) = vonkar/log(zref/iceruf) ! neutral coefficient
215  enddo ! ij
216 
217  elseif ( sfctype(1:3)=='ocn' ) then
218 
219  !------------------------------------------------------------
220  ! identify ocean cells
221  !------------------------------------------------------------
222  icells = 0
223  do j = jlo,jhi
224  do i = ilo,ihi
225  if ( tmask(i,j) ) then
226  icells = icells + 1
227  indxi(icells) = i
228  indxj(icells) = j
229  endif
230  enddo
231  enddo
232 
233  !------------------------------------------------------------
234  ! define some needed variables
235  !------------------------------------------------------------
236  qqq = qqqocn
237  ttt = tttocn
238  lheat = lvap ! liquid to vapor
239  do ij = 1, icells
240  i = indxi(ij)
241  j = indxj(ij)
242  vmag(ij) = max(umin, wind(i,j))
243  rdn(ij) = sqrt(0.0027_dbl_kind/vmag(ij) &
244  + .000142_dbl_kind + .0000764_dbl_kind*vmag(ij))
245  enddo ! ij
246 
247  endif ! sfctype
248 
249  do ij = 1, icells
250  i = indxi(ij)
251  j = indxj(ij)
252 
253  !------------------------------------------------------------
254  ! define some more needed variables
255  !------------------------------------------------------------
256 
257  tsfk = tsf(i,j) + tffresh ! surface temp (K)
258  qsat = qqq * exp(-ttt/tsfk) ! saturation humidity (kg/m^3)
259  ssq = qsat / rhoa(i,j) ! sat surf hum (kg/kg)
260 
261  thva(ij) = pott(i,j) * (c1i + zvir * qa(i,j)) ! virtual pot temp (K)
262  delt(i,j) = pott(i,j) - tsfk ! pot temp diff (K)
263  delq(i,j) = qa(i,j) - ssq ! spec hum dif (kg/kg)
264  alz(ij) = log(zlvl(i,j)/zref)
265  cp(ij) = cp_air*(c1i + cpvir*ssq)
266 
267  !------------------------------------------------------------
268  ! first estimate of Z/L and ustar, tstar and qstar
269  !------------------------------------------------------------
270 
271  ! neutral coefficients, z/L = 0.0
272  rhn(ij) = rdn(ij)
273  ren(ij) = rdn(ij)
274 
275  ! ustar,tstar,qstar
276  ustar(ij) = rdn(ij) * vmag(ij)
277  tstar(ij) = rhn(ij) * delt(i,j)
278  qstar(ij) = ren(ij) * delq(i,j)
279 
280  enddo ! ij
281 
282  !------------------------------------------------------------
283  ! iterate to converge on Z/L, ustar, tstar and qstar
284  !------------------------------------------------------------
285 
286  do k=1,5
287 
288  do ij = 1, icells
289  i = indxi(ij)
290  j = indxj(ij)
291 
292  ! compute stability & evaluate all stability functions
293  hol(ij) = vonkar * gravit * zlvl(i,j) &
294  * (tstar(ij)/thva(ij) &
295  + qstar(ij)/(c1i/zvir+qa(i,j))) &
296  / ustar(ij)**2
297  hol(ij) = sign( min(abs(hol(ij)),c10i), hol(ij) )
298  stable(ij) = p5 + sign(p5 , hol(ij))
299  xqq = max(sqrt(abs(c1i - c16*hol(ij))) , c1i)
300  xqq = sqrt(xqq)
301 
302  ! Jordan et al 1999
303  psimhs = -(0.7_dbl_kind*hol(ij) &
304  + 0.75_dbl_kind*(hol(ij)-14.3_dbl_kind) &
305  * exp(-0.35_dbl_kind*hol(ij)) + 10.7_dbl_kind)
306  psimh = psimhs*stable(ij) &
307  + (c1i - stable(ij))*psimhu(xqq)
308  psixh(ij) = psimhs*stable(ij) &
309  + (c1i - stable(ij))*psixhu(xqq)
310 
311  ! shift all coeffs to measurement height and stability
312  rd(ij) = rdn(ij) / (c1i+rdn(ij)/vonkar*(alz(ij)-psimh))
313  rh(ij) = rhn(ij) / (c1i+rhn(ij)/vonkar*(alz(ij)-psixh(ij)))
314  re(ij) = ren(ij) / (c1i+ren(ij)/vonkar*(alz(ij)-psixh(ij)))
315 
316  ! update ustar, tstar, qstar using updated, shifted coeffs
317  ustar(ij) = rd(ij) * vmag(ij)
318  tstar(ij) = rh(ij) * delt(i,j)
319  qstar(ij) = re(ij) * delq(i,j)
320 
321  enddo ! ij
322  enddo ! end iteration
323 
324 
325  do ij = 1, icells
326  i = indxi(ij)
327  j = indxj(ij)
328 
329  !------------------------------------------------------------
330  ! coefficients for turbulent flux calculation
331  !------------------------------------------------------------
332 
333 !ccsm shcoef(i,j) = rhoa(i,j) * ustar(ij) * cp(ij) * rh(ij)
334  ! add windless coefficient for sensible heat flux
335  ! as in Jordan et al (JGR, 1999)
336  shcoef(i,j) = rhoa(i,j) * ustar(ij) * cp(ij) * rh(ij) + c1i
337  lhcoef(i,j) = rhoa(i,j) * ustar(ij) * lheat * re(ij)
338  !------------------------------------------------------------
339  ! momentum flux
340  !------------------------------------------------------------
341  ! tau = rhoa(i,j) * ustar * ustar
342  ! strx = tau * uatm(i,j) / vmag
343  ! stry = tau * vatm(i,j) / vmag
344  !------------------------------------------------------------
345 
346  tau = rhoa(i,j) * ustar(ij) * rd(ij) ! not the stress at zlvl(i,j)
347  strx(i,j) = tau * uatm(i,j)
348  stry(i,j) = tau * vatm(i,j)
349 
350  !------------------------------------------------------------
351  ! Compute diagnostics: 2m ref T & Q
352  !------------------------------------------------------------
353  hol(ij) = hol(ij)*ztrf/zlvl(i,j)
354  xqq = max( c1i, sqrt(abs(c1i-c16*hol(ij))) )
355  xqq = sqrt(xqq)
356  psix2 = -c5i*hol(ij)*stable(ij) + (c1i-stable(ij))*psixhu(xqq)
357  fac = (rh(ij)/vonkar) * (alz(ij) + al2 - psixh(ij) + psix2)
358  trf(i,j)= pott(i,j) - delt(i,j)*fac
359  trf(i,j)= trf(i,j) - p01*ztrf ! pot temp to temp correction
360  fac = (re(ij)/vonkar) * (alz(ij) + al2 - psixh(ij) + psix2)
361  qrf(i,j)= qa(i,j) - delq(i,j)*fac
362 
363  enddo ! ij
364 
365  end subroutine atmo_boundary_layer
366 
367 !=======================================================================
368 
369  end module ice_atmo
370 
371 !=======================================================================
real(kind=dbl_kind), dimension(:,:), allocatable, save lhcoef
Definition: ice_flux.f90:164
real(kind=dbl_kind), parameter zvir
real(kind=dbl_kind), parameter tttice
real(kind=dbl_kind), parameter tttocn
real(kind=dbl_kind), parameter c8i
integer(kind=int_kind) ihi
Definition: ice_domain.f90:101
real(kind=dbl_kind), parameter c0i
real(kind=dbl_kind), parameter lvap
real(kind=dbl_kind), parameter qqqice
real(kind=dbl_kind), parameter c10i
real(kind=dbl_kind), dimension(:,:), allocatable, save rhoa
Definition: ice_flux.f90:91
real(kind=dbl_kind), dimension(:,:), allocatable, save pott
Definition: ice_flux.f90:91
real(kind=dbl_kind), parameter vonkar
integer(kind=int_kind) jlo
Definition: ice_domain.f90:101
real(kind=dbl_kind), parameter cp_wv
real(kind=dbl_kind), dimension(:,:), allocatable, save vatm
Definition: ice_flux.f90:91
real(kind=dbl_kind), parameter iceruf
integer(kind=int_kind) ilo
Definition: ice_domain.f90:101
real(kind=dbl_kind), parameter p5
real(kind=dbl_kind), parameter puny
real(kind=dbl_kind), parameter tffresh
integer(kind=int_kind) jhi
Definition: ice_domain.f90:101
real(kind=dbl_kind), parameter lsub
real(kind=dbl_kind), parameter zref
subroutine atmo_boundary_layer(ni, sfctype, Tsf, strx, stry, Trf, Qrf, delt, delq)
Definition: ice_atmo.f90:62
real(kind=dbl_kind), parameter c2i
real(kind=dbl_kind), dimension(:,:,:), allocatable, target, save aicen
Definition: ice_state.f90:97
real(kind=dbl_kind), dimension(:,:), allocatable, save uatm
Definition: ice_flux.f90:91
real(kind=dbl_kind), parameter qqqocn
real(kind=dbl_kind), dimension(:,:), allocatable, save zlvl
Definition: ice_flux.f90:91
real(kind=dbl_kind), parameter c5i
real(kind=dbl_kind), dimension(:,:), allocatable, save shcoef
Definition: ice_flux.f90:164
real(kind=dbl_kind), parameter gravit
real(kind=dbl_kind), parameter c1i
real(kind=dbl_kind), dimension(:,:), allocatable, save qa
Definition: ice_flux.f90:91
real(kind=dbl_kind), dimension(:,:), allocatable, save wind
Definition: ice_flux.f90:164
real(kind=dbl_kind), parameter p01
real(kind=dbl_kind), parameter c16
logical(kind=log_kind), dimension(:,:), allocatable tmask
Definition: ice_grid.f90:164
real(kind=dbl_kind), parameter cp_air