source: LMDZ6/trunk/libf/phylmd/Dust/lmdz_spla_neutral.f90 @ 5555

Last change on this file since 5555 was 5555, checked in by asima, 2 days ago

Specifying "intent(in)" for klon
(cf new coding conventions ; see also r5554)

File size: 3.1 KB
Line 
1MODULE lmdz_spla_neutral
2  CONTAINS
3!***********************************************************************
4  subroutine spla_neutral(klon,u10_mps,ustar_mps,obklen_m, &
5          u10n_mps )
6  !-----------------------------------------------------------------------     
7  ! subroutine to compute u10 neutral wind speed
8  ! inputs
9  ! u10_mps - wind speed at 10 m (m/s)
10  ! ustar_mps - friction velocity (m/s)
11  ! obklen_m - monin-obukhov length scale (m)
12  ! outputs
13  ! u10n_mps - wind speed at 10 m under neutral conditions (m/s)
14  ! following code assumes reference height Z is 10m, consistent with use
15  ! of u10 and u10_neutral.  If not, code
16  ! should be changed so that constants of 50. and 160. in equations
17  ! below are changed to -5 * Z and -16 * Z respectively.
18  ! Reference:  G. L. Geernaert.  'Bulk parameterizations for the
19  ! wind stress and heat fluxes,' in Surface Waves and Fluxes, Vol. I,
20  ! Current Theory, Geernaert and W.J. Plant, editors, Kluwer Academic
21  ! Publishers, Boston, MA, 1990.
22  ! subroutine written Feb 2001 by eg chapman
23  ! adapted to LMD-ZT by E. Cosme 310801
24  ! Following Will Shaw (PNL, Seattle) the theory applied for flux
25  ! calculation with the scheme of Nightingale et al. (2000) does not
26  ! hold anymore when -1<obklen<20. In this case, u10n is set to 0,
27  ! so that the transfer velocity  computed in nightingale.F will also
28  ! be 0. The flux is then set to 0.
29  !----------------------------------------------------------------------               
30  !
31  !
32  IMPLICIT NONE
33  !
34  INTEGER, intent(in) :: klon 
35
36   
37    real, dimension(klon), intent(in) :: u10_mps, ustar_mps, obklen_m
38    real, dimension(klon), intent(out) :: u10n_mps
39    real :: pi,von_karman
40    ! parameter (pi = 3.141592653589793, von_karman = 0.4)     
41  ! pour etre coherent avec vk de bl_for_dms.F
42    parameter (pi = 3.141592653589793, von_karman = 0.35)
43  !
44    real :: phi, phi_inv, phi_inv_sq, f1, f2, f3, dum1, psi
45    integer :: i
46
47
48    psi = 0.
49    do i=1,klon
50    ! Original : needs u10_mps defined as "inout" to be able to modify it here, but in reality it is only "in"
51    !if (u10_mps(i) .lt. 0.) u10_mps(i) = 0.0
52    ! Instead, STOP to check why the module is negative
53    if (u10_mps(i) .lt. 0.) STOP 'negative wind module u10 in input of spla_neutral'
54
55    if  (obklen_m(i) .lt. 0.) then
56            phi = (1. - 160./obklen_m(i))**(-0.25)
57            phi_inv = 1./phi
58            phi_inv_sq = 1./phi * 1./phi
59            f1 = (1. + phi_inv) / 2.
60            f2 = (1. + phi_inv_sq)/2.
61  ! following to avoid numerical overruns. recall tan(90deg)=infinity
62            dum1 = min (1.e24, phi_inv)
63            f3 = atan(dum1)
64            psi = 2.*log(f1) + log(f2) - 2.*f3 + pi/2.
65    else if (obklen_m(i) .gt. 0.) then
66            psi = -50. / obklen_m(i)
67    end if
68
69    u10n_mps(i) = u10_mps(i) + (ustar_mps(i) * psi /von_karman )
70  ! u10n set to 0. if -1 < obklen < 20
71    if ((obklen_m(i).gt.-1.).and.(obklen_m(i).lt.20.)) then
72        u10n_mps(i) = 0.
73    endif
74    if (u10n_mps(i) .lt. 0.) u10n_mps(i) = 0.0
75
76    enddo
77    return
78end subroutine spla_neutral
79!***********************************************************************
80END MODULE lmdz_spla_neutral
Note: See TracBrowser for help on using the repository browser.