Skip to content

Commit

Permalink
Local Solar Time Computation (#323)
Browse files Browse the repository at this point in the history
* Fix local solar time

* Add line for going past 24

* New LST calculation

Addresses #3.
  • Loading branch information
dabail10 authored and eclare108213 committed Aug 30, 2019
1 parent 8420dfd commit 804b703
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions cicecore/cicedynB/general/ice_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ module ice_forcing
use ice_timers, only: ice_timer_start, ice_timer_stop, timer_readwrite, &
timer_bound
use ice_arrays_column, only: oceanmixed_ice, restore_bgc
use ice_constants, only: c0, c1, c2, c3, c4, c5, c10, c12, c20, &
c180, c365, c1000, c3600
use ice_constants, only: c0, c1, c2, c3, c4, c5, c10, c12, c15, c20, &
c180, c360, c365, c1000, c3600
use ice_constants, only: p001, p01, p1, p25, p5, p6
use ice_constants, only: cm_to_m
use ice_constants, only: field_loc_center, field_type_scalar, &
Expand Down Expand Up @@ -2260,6 +2260,7 @@ subroutine compute_shortwave(nx_block, ny_block, &
sw0 , &
secday , &
pi , &
lontmp , &
deg2rad

integer (kind=int_kind) :: &
Expand All @@ -2275,8 +2276,18 @@ subroutine compute_shortwave(nx_block, ny_block, &
do j=jlo,jhi
do i=ilo,ihi
deg2rad = pi/c180
! solar_time = mod(real(sec,kind=dbl_kind),secday)/c3600 &
! + c12*sin(p5*TLON(i,j))

! Convert longitude to range of -180 to 180 for LST calculation

lontmp = mod(TLON(i,j)/deg2rad,c360)
if (lontmp .gt. c180) lontmp = lontmp - c360
if (lontmp .lt. -c180) lontmp = lontmp + c360

solar_time = mod(real(sec,kind=dbl_kind),secday)/c3600 &
+ c12*sin(p5*TLON(i,j))
+ lontmp/c15
if (solar_time .ge. 24._dbl_kind) solar_time = solar_time - 24._dbl_kind
hour_angle = (c12 - solar_time)*pi/c12
declin = 23.44_dbl_kind*cos((172._dbl_kind-yday) &
* c2*pi/c365)*deg2rad ! use dayyr instead of c365???
Expand Down

0 comments on commit 804b703

Please sign in to comment.