noah  1.13.0
 All Data Structures Files Functions Pages
bulk_snow_module.f90
Go to the documentation of this file.
1 
5 
7 
8  implicit none
9 
10  private
11 
12  public calc_density
13 
14 contains
15 
25 
26  subroutine calc_density(lensfc, landmask, swe, snd, rank, density)
27 
28  implicit none
29 
30  integer, intent(in) :: lensfc, rank
31  integer, intent(in) :: landmask(lensfc)
32  real, intent(in) :: swe(lensfc), snd(lensfc)
33  real, intent(out) :: density(lensfc)
34 
35  real :: dens_mean
36  integer :: n
37 
38  ! density = swe/snd
39  do n =1,lensfc
40  if (snd(n) > 0.001 ) then
41  density(n) = swe(n)/snd(n)
42  else
43  density(n)=0.1
44  endif
45  enddo
46 
47  where (density < 0.0001) density = 0.1
48 
49  ! calculate mean density of snow over land
50  if (count(landmask==2) > 0) then
51  ! mean density over snow-covered land
52  dens_mean = sum(density, mask = (landmask==2 )) &
53  / count(landmask==2)
54  print *, 'mean density on rank ', rank,': ', dens_mean
55  else
56  dens_mean = 0.1 ! default value if have no snow in tile
57  print *, 'no snow on rank ', rank, ' using default density ', dens_mean
58  endif
59 
60  ! for grid cells with no valid density, fill in the average snodens
61  where( swe <= 0.001 ) density = dens_mean
62 
63  end subroutine calc_density
64 
65 end module bulk_snow_module
subroutine, public calc_density(lensfc, landmask, swe, snd, rank, density)
This subroutine calculates snow density from forecast fields.