22 type (str_socrates_options),
intent(in) :: socrates_opt
23 type (str_socrates_derived_fields),
intent(inout) :: socrates_derived_fields
26 gamma_rad, e, tau0, sinobl, e1, e2, e3, e4, diny_360, &
35 e1 = e * (2.0-0.25*e*e)
37 e3 = e*e*e * 13.0/12.0
38 e4 = ((1.0+e*e*0.5)/(1.0-e*e))**2.0
40 tau1_360 = tau0*diny_360/365.25+0.71+.5
43 if (.not. socrates_opt%l_360)
then
44 if (mod(socrates_opt%rad_year,4.0) .eq. 0 .and. &
45 (mod(socrates_opt%rad_year,400.0) .eq. 0 .or. &
46 mod(socrates_opt%rad_year,100.0) .ne. 0))
then
56 if (socrates_opt%l_360)
then
57 m = (2*
pi) * (socrates_opt%rad_day-tau1_360) / diny_360
59 m = (2*
pi) * (socrates_opt%rad_day-tau1_365) / diny_365
61 v = m + e1*sin(m) + e2*sin(2.*m) + e3*sin(3.*m)
64 socrates_derived_fields%scs = e4 * ( 1. + e * cos(v) ) **2
65 socrates_derived_fields%sindec = sinobl * sin(v - gamma_rad)
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