!*==sbdirini.spg processed by SPAG 6.70Rc at 15:33 on 10 Dec 2012 !*------------------ SPAG Configuration Options -------------------- !*--0323,76 000101,-1 000000102011332010100002000000210211210,136 10 -- !*--1100000011112111000000000000,10,10,10,10,10,10,900,100 200000000 -- !*--000000010000000000000,72,72 73,42,38,33 00011112110000100000000 -- !*---------------------------------------------------------------------- !$Author: joelevin $ !$Date: 2011-03-24 11:33:26 -0500 (Thu, 24 Mar 2011) $ !$Revision: 11724 $ !$HeadURL: https://eweru-dev1.eweru.ksu.edu/svn/code/weps1/branches/WEPS_F90_update/weps.src/src/lib_erosion/sbdirini.for $ !********************************************************************** ! subroutine sbdirini - initializes grid/wind direction relationships !********************************************************************** subroutine sbdirini(wind_dir,prev_dir) use i_p1werm use i_m1geo use i_m1subr use i_s1sgeo use i_w1wind use i_m2geo use i_e3grid use i_s2sgeo implicit none !*--SBDIRINI25 ! !*** Start of declarations rewritten by SPAG ! ! PARAMETER definitions ! real,parameter :: pid180 = 3.14159/180. ! ! Dummy arguments ! real :: prev_dir,wind_dir intent (in) wind_dir intent (inout) prev_dir ! ! Local variables ! integer :: ke ! !*** End of declarations rewritten by SPAG ! ! +++ purpose +++ ! Calc. wind angle on the sim. region ! Calc. sweep sequence for update of grid cells ! calc. ridge spacing parallel the wind ! ! +++ ARGUMENT DECLARATIONS +++ ! ! +++ ARGUMENT DEFINITIONS +++ ! wind_dir - direction of the wind in degrees from north ! prev_dir - previously computed direction of the wind ! ! +++ PARAMETER +++ ! ! + + + GLOBAL COMMON BLOCKS + + + ! ! + + + LOCAL COMMON BLOCKS + + + ! ! + + + LOCAL VARIABLES + + + ! ! + + + LOCAL VARIABLE DEFINITIONS + + + ! icsr = index of current subregion ! ! + + + SUBROUTINES CALLED + + + ! sbsfdi ! ! + + + END SPECIFICATION + + + ! ! check and do not calculate if done on last entry if (wind_dir==prev_dir) return prev_dir = wind_dir ! ! calc wind angle relative to the field Y-axis (+, - 45 deg. range) awa = wind_dir - amasim if (awa<0.0) awa = awa + 360.0 if (awa>360.0) awa = awa - 360.0 sin_awa = sin(awa*pid180) cos_awa = cos(awa*pid180) tan_awa = tan(awa*pid180) ! ! find wind quadrant relative to sim region & select sweep sequence ! if (awa>=0.0.AND.awa<90.0) then i1 = imax - 1 i2 = 1 i3 = -1 i4 = jmax - 1 i5 = 1 i6 = -1 ke = 1 ! else if (awa>=90.0.AND.awa<180.0) then i1 = imax - 1 i2 = 1 i3 = -1 i4 = 1 i5 = jmax - 1 i6 = 1 ke = 1 ! else if (awa>=180.0.AND.awa<270.0) then i1 = 1 i2 = imax - 1 i3 = 1 i4 = 1 i5 = jmax - 1 i6 = 1 ke = 1 ! else i1 = 1 i2 = imax - 1 i3 = 1 i4 = jmax - 1 i5 = 1 i6 = -1 ke = 1 end if ! ! determine barrier influence direction index (kbr) ! if (wind_dir>=337.5.OR.wind_dir<22.5) then kbr = 1 else if (wind_dir<67.5) then kbr = 2 else if (wind_dir<112.5) then kbr = 3 else if (wind_dir<157.5) then kbr = 4 else if (wind_dir<202.5) then kbr = 5 else if (wind_dir<247.5) then kbr = 6 else if (wind_dir<292.5) then kbr = 7 else kbr = 8 end if ! end subroutine sbdirini