Line data Source code
1 : module orbit
2 :
3 : contains
4 :
5 1495368 : subroutine zenith(calday ,clat , clon ,coszrs ,ncol, dt_avg, uniform_angle )
6 :
7 : !-----------------------------------------------------------------------
8 : !
9 : ! Purpose:
10 : ! Compute cosine of solar zenith angle for albedo and radiation
11 : ! computations.
12 : !
13 : ! Method:
14 : ! <Describe the algorithm(s) used in the routine.>
15 : ! <Also include any applicable external references.>
16 : !
17 : ! Author: J. Kiehl
18 : !
19 : !-----------------------------------------------------------------------
20 : use shr_kind_mod, only: r8 => shr_kind_r8
21 : use shr_orb_mod
22 : use cam_control_mod, only: lambm0, obliqr, eccen, mvelpp
23 : implicit none
24 :
25 : !------------------------------Arguments--------------------------------
26 : !
27 : ! Input arguments
28 : !
29 : integer, intent(in) :: ncol ! number of positions
30 : real(r8), intent(in) :: calday ! Calendar day, including fraction
31 : real(r8), intent(in) :: clat(ncol) ! Current centered latitude (radians)
32 : real(r8), intent(in) :: clon(ncol) ! Centered longitude (radians)
33 : real(r8), intent(in), optional :: dt_avg ! if present, time step to use for the shr_orb_cosz calculation
34 : real(r8), intent(in), optional :: uniform_angle ! if present, then call coszrs with a uniform angle
35 :
36 : !
37 : ! Output arguments
38 : !
39 : real(r8), intent(out) :: coszrs(ncol) ! Cosine solar zenith angle
40 : !
41 : !---------------------------Local variables-----------------------------
42 : !
43 : integer i ! Position loop index
44 : real(r8) delta ! Solar declination angle in radians
45 : real(r8) eccf ! Earth orbit eccentricity factor
46 : !
47 : !-----------------------------------------------------------------------
48 : !
49 : call shr_orb_decl (calday ,eccen ,mvelpp ,lambm0 ,obliqr , &
50 1495368 : delta ,eccf )
51 : !
52 : ! Compute local cosine solar zenith angle,
53 : !
54 :
55 1495368 : if (present(uniform_angle)) then
56 0 : do i=1,ncol
57 0 : coszrs(i) = shr_orb_cosz( calday, clat(i), clon(i), delta, dt_avg, uniform_angle=uniform_angle )
58 : end do
59 : else
60 24969168 : do i=1,ncol
61 24969168 : coszrs(i) = shr_orb_cosz( calday, clat(i), clon(i), delta, dt_avg )
62 : end do
63 : end if
64 1495368 : end subroutine zenith
65 : end module orbit
|