71 type (str_socrates_options),
intent(in) :: socrates_opt
72 type (str_socrates_derived_fields),
intent(inout) :: socrates_derived_fields
75 degrees_to_radians = 0.017453292, &
76 seconds_in_hour = 3600.0
107 sinlat = sin(socrates_opt%latitude*degrees_to_radians)
108 longit = socrates_opt%longitude*degrees_to_radians
111 (socrates_opt%rad_time_hours*seconds_in_hour) * s2r - pi
112 dt_radians = socrates_derived_fields%dt_secs * s2r
119 sinsin = socrates_derived_fields%sindec * sinlat
120 coscos = sqrt( (1.0- socrates_derived_fields%sindec**2.0) * &
122 coshld = sinsin / coscos
123 if (coshld.lt.-1.)
then
124 socrates_derived_fields%fraction_lit = 0.
125 socrates_derived_fields%cosz = 0.
127 hat = longit + time_radians
128 if (coshld.gt.1.)
then
130 omega2 = hat + dt_radians
138 if (omegab.lt.0.) omegab = omegab + twopi
139 if (omegab.ge.twopi) omegab = omegab - twopi
140 if (omegab.ge.twopi) omegab = omegab - twopi
143 omegae = omegab + dt_radians
144 if (omegae.gt.twopi) omegae = omegae - twopi
150 if (omegab.le.omegas .or. omegab.lt.omegae)
then
151 omega1 = omegab - hld
155 if (omegae.le.omegas)
then
156 omega2 = omegae - hld
158 omega2 = omegas - hld
160 if (omegae.gt.omegab.and.omegab.gt.omegas) omega2=omega1
166 difsin = sin(omega2) - sin(omega1)
167 diftim = omega2 - omega1
176 if (diftim.lt.0.)
then
177 difsin = difsin + 2. * sqrt(1.-coshld**2)
178 diftim = diftim + 2. * hld
180 if (diftim.eq.0.)
then
182 socrates_derived_fields%cosz = 0.
183 socrates_derived_fields%fraction_lit = 0.
185 socrates_derived_fields%cosz = difsin*coscos/diftim + sinsin
186 socrates_derived_fields%fraction_lit = diftim / dt_radians