FV3 Bundle
Azimuth_Emissivity_F6_Module.f90
Go to the documentation of this file.
1 !
2 ! Helper module containing the azimuth emissivity routines for the
3 ! CRTM implementation of FASTEM6
4 !
5 !
6 ! CREATION HISTORY:
7 ! Written by: Original FASTEM1-5 authors, and Masahiro Kazumori
8 ! for the new azimuthal emissivity model.
9 !
10 ! Refactored by: Paul van Delst, January 2015
11 ! paul.vandelst@noaa.gov
12 !
13 
15 
16  ! -----------------
17  ! Environment setup
18  ! -----------------
19  ! Module use
20  USE type_kinds , ONLY: fp
23  ! Disable implicit typing
24  IMPLICIT NONE
25 
26 
27  ! ------------
28  ! Visibilities
29  ! ------------
30  PRIVATE
31  ! Data types
32  PUBLIC :: ivar_type
33  ! Science routines
34  PUBLIC :: azimuth_emissivity_f6
35  PUBLIC :: azimuth_emissivity_f6_tl
36  PUBLIC :: azimuth_emissivity_f6_ad
37 
38 
39  ! -----------------
40  ! Module parameters
41  ! -----------------
42  CHARACTER(*), PARAMETER :: module_version_id = &
43  '$Id: Azimuth_Emissivity_F6_Module.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $'
44 
45  REAL(fp), PARAMETER :: zero = 0.0_fp
46  REAL(fp), PARAMETER :: point5 = 0.5_fp
47  REAL(fp), PARAMETER :: one = 1.0_fp
48  REAL(fp), PARAMETER :: two = 2.0_fp
49  REAL(fp), PARAMETER :: three = 3.0_fp
50  REAL(fp), PARAMETER :: four = 4.0_fp
51  REAL(fp), PARAMETER :: pi = 3.141592653589793238462643383279_fp
52  REAL(fp), PARAMETER :: degrees_to_radians = pi / 180.0_fp
53 
54  ! Dimensions
55  ! ...Number of Stokes parameters handled
56  INTEGER, PARAMETER :: n_stokes = 2
57  INTEGER, PARAMETER :: ivpol = 1 ! Index for vertical polarisation
58  INTEGER, PARAMETER :: ihpol = 2 ! Index for horizontal polarisation
59  ! ...The number of fitting frequencies
60  INTEGER, PARAMETER :: n_frequencies = 6
61 
62  ! Parameters used in the model
63  ! ...The fitting frequencies
64  REAL(fp), PARAMETER :: fit_frequency(n_frequencies) = &
65  [ 6.925_fp, 10.65_fp, 18.7_fp, 23.8_fp, 36.5_fp, 89.0_fp ]
66  ! ...Wind speed limits
67  REAL(fp), PARAMETER :: wind_speed_max18 = 18.0_fp
68  REAL(fp), PARAMETER :: wind_speed_max15 = 15.0_fp
69  ! ...Frequency limits
70  REAL(fp), PARAMETER :: frequency_max37 = 37.0_fp
71  ! ...Exponents for the AxSy_theta terms
72  REAL(fp), PARAMETER :: xs11 = two
73  REAL(fp), PARAMETER :: xs12 = two
74  REAL(fp), PARAMETER :: xs21 = one
75  REAL(fp), PARAMETER :: xs22 = four
76  ! ...Reference zenith angle
77  REAL(fp), PARAMETER :: theta_ref = 55.2_fp
78 
79 
80  ! --------------------------------------
81  ! Structure definition to hold internal
82  ! variables across FWD, TL, and AD calls
83  ! --------------------------------------
84  TYPE :: ivar_type
85  PRIVATE
86  ! Direct inputs
87  REAL(fp) :: wind_speed = zero
88  REAL(fp) :: frequency = zero
89  REAL(fp) :: zenith_angle = zero
90  ! Derived inputs
91  REAL(fp) :: phi = zero ! Azimuth angle in radians
92  LOGICAL :: lw18 = .false. ! Logical to flag wind speed > 18m/s
93  REAL(fp) :: w18 = zero ! Wind speed with 18m/s maximum
94  LOGICAL :: lw15 = .false. ! Logical to flag wind speed > 15m/s
95  REAL(fp) :: w15 = zero ! Wind speed with 15m/s maximum
96  REAL(fp) :: f37 = zero ! Frequency with 37GHz maximum
97  ! Intermediate variables
98  REAL(fp), DIMENSION(N_FREQUENCIES) :: a1v , a2v , a1h , a2h
99  REAL(fp), DIMENSION(N_FREQUENCIES) :: a1s1, a1s2, a2s1, a2s2
100  REAL(fp), DIMENSION(N_FREQUENCIES) :: a2s2_theta0
101  REAL(fp), DIMENSION(N_FREQUENCIES) :: a1s1_theta, a1s2_theta, a2s1_theta, a2s2_theta
102  REAL(fp), DIMENSION(N_FREQUENCIES) :: a1v_theta , a1h_theta , a2v_theta , a2h_theta
103  REAL(fp) :: azimuth_component(n_frequencies, n_stokes)
104  ! Interpolation variables
105  INTEGER :: i1 = 0
106  INTEGER :: i2 = 0
107  REAL(fp) :: lpoly = zero
108  END TYPE ivar_type
109 
110 
111 CONTAINS
112 
113 
114  ! ===========================================================
115  ! Compute emissivity as a function of relative azimuth angle.
116  ! ===========================================================
117 
118  ! Forward model
119  SUBROUTINE azimuth_emissivity_f6( &
120  AZCoeff , & ! Input
121  Wind_Speed , & ! Input
122  Azimuth_Angle, & ! Input
123  Frequency , & ! Input
124  Zenith_Angle , & ! Input
125  e_Azimuth , & ! Output
126  iVar ) ! Internal variable output
127  ! Arguments
128  TYPE(fitcoeff_3d_type), INTENT(IN) :: azcoeff
129  REAL(fp) , INTENT(IN) :: wind_speed
130  REAL(fp) , INTENT(IN) :: azimuth_angle
131  REAL(fp) , INTENT(IN) :: frequency
132  REAL(fp) , INTENT(IN) :: zenith_angle
133  REAL(fp) , INTENT(OUT) :: e_azimuth(:)
134  TYPE(ivar_type) , INTENT(IN OUT) :: ivar
135  ! Local variables
136  INTEGER :: j
137 
138  ! Initialise output
139  e_azimuth = zero
140 
141  ! Save inputs for TL and AD calls
142  ivar%wind_speed = wind_speed
143  ivar%frequency = frequency
144  ivar%zenith_angle = zenith_angle
145 
146  ! Convert inputs
147  ivar%phi = azimuth_angle * degrees_to_radians
148  ivar%lw18 = wind_speed > wind_speed_max18
149  ivar%w18 = min(wind_speed, wind_speed_max18)
150  ivar%lw15 = wind_speed > wind_speed_max15
151  ivar%w15 = min(wind_speed, wind_speed_max15)
152  ivar%f37 = min(frequency, frequency_max37)
153 
154 
155  ! Loop over frequencies to compute the intermediate terms
156  frequency_loop: DO j = 1, n_frequencies
157 
158  ivar%A1v(j) = azcoeff%C(1,j,ivpol) * ( exp(-azcoeff%C(5,j,ivpol) * ivar%w18**2 ) - one ) * &
159  ( azcoeff%C(2,j,ivpol) * ivar%w18 + &
160  azcoeff%C(3,j,ivpol) * ivar%w18**2 + &
161  azcoeff%C(4,j,ivpol) * ivar%w18**3 )
162  ivar%A2v(j) = azcoeff%C(6,j,ivpol) * ivar%w18
163 
164  ivar%A1h(j) = azcoeff%C(1,j,ihpol) * ivar%w18
165  ivar%A2h(j) = azcoeff%C(2,j,ihpol) * ( exp(-azcoeff%C(6,j,ihpol) * ivar%w18**2 ) - one ) * &
166  ( azcoeff%C(3,j,ihpol) * ivar%w18 + &
167  azcoeff%C(4,j,ihpol) * ivar%w18**2 + &
168  azcoeff%C(5,j,ihpol) * ivar%w18**3 )
169 
170  ivar%A1s1(j) = (ivar%A1v(j) + ivar%A1h(j))/two
171  ivar%A1s2(j) = ivar%A1v(j) - ivar%A1h(j)
172  ivar%A2s1(j) = (ivar%A2v(j) + ivar%A2h(j))/two
173  ivar%A2s2(j) = ivar%A2v(j) - ivar%A2h(j)
174 
175  ivar%A2s2_theta0(j) = (ivar%w15**2 - (ivar%w15**3)/22.5_fp)/55.5556_fp * &
176  (two/290.0_fp) * &
177  (one - log10(30.0_fp/ivar%f37) )
178 
179  ivar%A1s1_theta(j) = ivar%A1s1(j)*((ivar%zenith_angle/theta_ref)**xs11)
180  ivar%A2s1_theta(j) = ivar%A2s1(j)*((ivar%zenith_angle/theta_ref)**xs12)
181  ivar%A1s2_theta(j) = ivar%A1s2(j)*((ivar%zenith_angle/theta_ref)**xs21)
182  ivar%A2s2_theta(j) = ivar%A2s2_theta0(j) + &
183  (ivar%A2s2(j) - ivar%A2s2_theta0(j))*((ivar%zenith_angle/theta_ref)**xs22)
184 
185  ivar%A1v_theta(j) = point5*(two*ivar%A1s1_theta(j) + ivar%A1s2_theta(j))
186  ivar%A1h_theta(j) = point5*(two*ivar%A1s1_theta(j) - ivar%A1s2_theta(j))
187  ivar%A2v_theta(j) = point5*(two*ivar%A2s1_theta(j) + ivar%A2s2_theta(j))
188  ivar%A2h_theta(j) = point5*(two*ivar%A2s1_theta(j) - ivar%A2s2_theta(j))
189 
190  ivar%azimuth_component(j,ivpol) = (ivar%A1v_theta(j) * cos(ivar%phi)) + (ivar%A2v_theta(j) * cos(two*ivar%phi))
191  ivar%azimuth_component(j,ihpol) = (ivar%A1h_theta(j) * cos(ivar%phi)) + (ivar%A2h_theta(j) * cos(two*ivar%phi))
192 
193  END DO frequency_loop
194 
195 
196  ! Interpolate to input frequency for result. Only V and H polarisation.
197  ! ...Check for lower out of bounds frequency
198  IF ( frequency < fit_frequency(1) ) THEN
199  e_azimuth(ivpol) = ivar%azimuth_component(1,ivpol)
200  e_azimuth(ihpol) = ivar%azimuth_component(1,ihpol)
201  RETURN
202  END IF
203  ! ...Check for upper out of bounds frequency
204  IF ( frequency > fit_frequency(n_frequencies) ) THEN
205  e_azimuth(ivpol) = ivar%azimuth_component(n_frequencies,ivpol)
206  e_azimuth(ihpol) = ivar%azimuth_component(n_frequencies,ihpol)
207  RETURN
208  END IF
209  ! ...In bounds, so interpolate
210  ivar%i1 = bisection_search(fit_frequency, frequency)
211  ivar%i2 = ivar%i1 + 1
212  ivar%lpoly = (frequency - fit_frequency(ivar%i1))/(fit_frequency(ivar%i2)-fit_frequency(ivar%i1))
213 
214  e_azimuth(ivpol) = ( ivar%lpoly * ivar%azimuth_component(ivar%i2,ivpol)) + &
215  ((one - ivar%lpoly) * ivar%azimuth_component(ivar%i1,ivpol))
216  e_azimuth(ihpol) = ( ivar%lpoly * ivar%azimuth_component(ivar%i2,ihpol)) + &
217  ((one - ivar%lpoly) * ivar%azimuth_component(ivar%i1,ihpol))
218 
219  END SUBROUTINE azimuth_emissivity_f6
220 
221 
222 
223  ! Tangent-linear model
224  SUBROUTINE azimuth_emissivity_f6_tl( &
225  AZCoeff , & ! Input
226  Wind_Speed_TL , & ! Input
227  Azimuth_Angle_TL, & ! Input
228  e_Azimuth_TL , & ! Output
229  iVar ) ! Internal variable input
230  ! Arguments
231  TYPE(fitcoeff_3d_type), INTENT(IN) :: azcoeff
232  REAL(fp) , INTENT(IN) :: wind_speed_tl
233  REAL(fp) , INTENT(IN) :: azimuth_angle_tl
234  REAL(fp) , INTENT(OUT) :: e_azimuth_tl(:)
235  TYPE(ivar_type) , INTENT(IN) :: ivar
236  ! Local variables
237  INTEGER :: j
238  REAL(fp) :: phi_tl
239  REAL(fp), DIMENSION(N_FREQUENCIES) :: a1v_tl , a2v_tl , a1h_tl , a2h_tl
240  REAL(fp), DIMENSION(N_FREQUENCIES) :: a1s1_tl, a1s2_tl, a2s1_tl, a2s2_tl
241  REAL(fp), DIMENSION(N_FREQUENCIES) :: a2s2_theta0_tl
242  REAL(fp), DIMENSION(N_FREQUENCIES) :: a1s1_theta_tl, a1s2_theta_tl, a2s1_theta_tl, a2s2_theta_tl
243  REAL(fp), DIMENSION(N_FREQUENCIES) :: a1v_theta_tl , a1h_theta_tl , a2v_theta_tl , a2h_theta_tl
244  REAL(fp) :: azimuth_component_tl(n_frequencies, n_stokes)
245 
246  ! Initialise output
247  e_azimuth_tl = zero
248 
249  ! Convert inputs
250  phi_tl = azimuth_angle_tl * degrees_to_radians
251 
252  ! Loop over frequencies to compute the intermediate terms
253  frequency_loop: DO j = 1, n_frequencies
254 
255  ! Only compute TL values if wind speed is not maxed out
256  IF ( ivar%lw18 ) THEN
257  a1v_tl(j) = zero
258  a2v_tl(j) = zero
259  a1h_tl(j) = zero
260  a2h_tl(j) = zero
261  ELSE
262  a1v_tl(j) = ( azcoeff%C(1,j,ivpol) * ( exp(-azcoeff%C(5,j,ivpol) * ivar%w18**2 ) - one ) * &
263  ( azcoeff%C(2,j,ivpol) + &
264  two * azcoeff%C(3,j,ivpol) * ivar%w18 + &
265  three * azcoeff%C(4,j,ivpol) * ivar%w18**2 ) - &
266  two * azcoeff%C(1,j,ivpol) * azcoeff%C(5,j,ivpol) * ivar%w18 * &
267  exp(-azcoeff%C(5,j,ivpol) * ivar%w18**2 ) * &
268  ( azcoeff%C(2,j,ivpol) * ivar%w18 + &
269  azcoeff%C(3,j,ivpol) * ivar%w18**2 + &
270  azcoeff%C(4,j,ivpol) * ivar%w18**3 ) ) * wind_speed_tl
271  a2v_tl(j) = azcoeff%C(6,j,ivpol) * wind_speed_tl
272 
273  a1h_tl(j) = azcoeff%C(1,j,ihpol) * wind_speed_tl
274 
275  a2h_tl(j) = ( azcoeff%C(2,j,ihpol) * ( exp(-azcoeff%C(6,j,ihpol) * ivar%w18**2 ) - one ) * &
276  ( azcoeff%C(3,j,ihpol) + &
277  two * azcoeff%C(4,j,ihpol) * ivar%w18 + &
278  three * azcoeff%C(5,j,ihpol) * ivar%w18**2 ) - &
279  two * azcoeff%C(2,j,ihpol) * azcoeff%C(6,j,ihpol) * ivar%w18 * &
280  exp(-azcoeff%C(6,j,ihpol) * ivar%w18**2 ) * &
281  ( azcoeff%C(3,j,ihpol) * ivar%w18 + &
282  azcoeff%C(4,j,ihpol) * ivar%w18**2 + &
283  azcoeff%C(5,j,ihpol) * ivar%w18**3 ) ) * wind_speed_tl
284 
285  END IF
286 
287  a1s1_tl(j) = (a1v_tl(j) + a1h_tl(j))/two
288  a1s2_tl(j) = a1v_tl(j) - a1h_tl(j)
289  a2s1_tl(j) = (a2v_tl(j) + a2h_tl(j))/two
290  a2s2_tl(j) = a2v_tl(j) - a2h_tl(j)
291 
292 
293  ! Only compute TL value if wind speed is not maxed out
294  IF ( ivar%lw15 ) THEN
295  a2s2_theta0_tl(j) = zero
296  ELSE
297  a2s2_theta0_tl(j) = (two*ivar%w15 - (three*ivar%w15**2)/22.5_fp)/55.5556_fp * &
298  (two/290.0_fp) * &
299  (one - log10(30.0_fp/ivar%f37) ) * wind_speed_tl
300  END IF
301 
302 
303  a1s1_theta_tl(j) = a1s1_tl(j)*((ivar%zenith_angle/theta_ref)**xs11)
304  a2s1_theta_tl(j) = a2s1_tl(j)*((ivar%zenith_angle/theta_ref)**xs12)
305  a1s2_theta_tl(j) = a1s2_tl(j)*((ivar%zenith_angle/theta_ref)**xs21)
306  a2s2_theta_tl(j) = a2s2_theta0_tl(j) + &
307  (a2s2_tl(j) - a2s2_theta0_tl(j))*((ivar%zenith_angle/theta_ref)**xs22)
308 
309 
310  a1v_theta_tl(j) = point5*(two*a1s1_theta_tl(j) + a1s2_theta_tl(j))
311  a1h_theta_tl(j) = point5*(two*a1s1_theta_tl(j) - a1s2_theta_tl(j))
312  a2v_theta_tl(j) = point5*(two*a2s1_theta_tl(j) + a2s2_theta_tl(j))
313  a2h_theta_tl(j) = point5*(two*a2s1_theta_tl(j) - a2s2_theta_tl(j))
314 
315 
316  azimuth_component_tl(j,ivpol) = (cos( ivar%phi ) * a1v_theta_tl(j)) + &
317  (cos(two*ivar%phi) * a2v_theta_tl(j)) - &
318  ( ( ivar%A1v_theta(j) * sin( ivar%phi )) + &
319  (two * ivar%A2v_theta(j) * sin(two*ivar%phi)) ) * phi_tl
320  azimuth_component_tl(j,ihpol) = (cos( ivar%phi ) * a1h_theta_tl(j)) + &
321  (cos(two*ivar%phi) * a2h_theta_tl(j)) - &
322  ( ( ivar%A1h_theta(j) * sin( ivar%phi )) + &
323  (two * ivar%A2h_theta(j) * sin(two*ivar%phi)) ) * phi_tl
324 
325  END DO frequency_loop
326 
327 
328  ! Interpolate to input frequency for result. Only V and H polarisation.
329  ! ...Check for lower out of bounds frequency
330  IF ( ivar%frequency < fit_frequency(1) ) THEN
331  e_azimuth_tl(ivpol) = azimuth_component_tl(1,ivpol)
332  e_azimuth_tl(ihpol) = azimuth_component_tl(1,ihpol)
333  RETURN
334  END IF
335  ! ...Check for upper out of bounds frequency
336  IF ( ivar%frequency > fit_frequency(n_frequencies) ) THEN
337  e_azimuth_tl(ivpol) = azimuth_component_tl(n_frequencies,ivpol)
338  e_azimuth_tl(ihpol) = azimuth_component_tl(n_frequencies,ihpol)
339  RETURN
340  END IF
341  ! ...In bounds, so interpolate
342  e_azimuth_tl(ivpol) = ( ivar%lpoly * azimuth_component_tl(ivar%i2,ivpol)) + &
343  ((one - ivar%lpoly) * azimuth_component_tl(ivar%i1,ivpol))
344  e_azimuth_tl(ihpol) = ( ivar%lpoly * azimuth_component_tl(ivar%i2,ihpol)) + &
345  ((one - ivar%lpoly) * azimuth_component_tl(ivar%i1,ihpol))
346 
347  END SUBROUTINE azimuth_emissivity_f6_tl
348 
349 
350  ! Adjoint model
351  SUBROUTINE azimuth_emissivity_f6_ad( &
352  AZCoeff , & ! Input
353  e_Azimuth_AD , & ! AD Input
354  Wind_Speed_AD , & ! AD Output
355  Azimuth_Angle_AD, & ! AD Output
356  iVar ) ! Internal variable input
357  ! Arguments
358  TYPE(fitcoeff_3d_type), INTENT(IN) :: azcoeff
359  REAL(fp) , INTENT(IN OUT) :: e_azimuth_ad(:)
360  REAL(fp) , INTENT(IN OUT) :: wind_speed_ad
361  REAL(fp) , INTENT(IN OUT) :: azimuth_angle_ad
362  TYPE(ivar_type) , INTENT(IN) :: ivar
363  ! Local variables
364  INTEGER :: j
365  REAL(fp) :: phi_ad
366  REAL(fp), DIMENSION(N_FREQUENCIES) :: a1v_ad , a2v_ad , a1h_ad , a2h_ad
367  REAL(fp), DIMENSION(N_FREQUENCIES) :: a1s1_ad, a1s2_ad, a2s1_ad, a2s2_ad
368  REAL(fp), DIMENSION(N_FREQUENCIES) :: a2s2_theta0_ad
369  REAL(fp), DIMENSION(N_FREQUENCIES) :: a1s1_theta_ad, a1s2_theta_ad, a2s1_theta_ad, a2s2_theta_ad
370  REAL(fp), DIMENSION(N_FREQUENCIES) :: a1v_theta_ad , a1h_theta_ad , a2v_theta_ad , a2h_theta_ad
371  REAL(fp) :: azimuth_component_ad(n_frequencies, n_stokes)
372 
373  ! Initialise local adjoint variables
374  phi_ad = zero
375  a1v_ad = zero; a2v_ad = zero; a1h_ad = zero; a2h_ad = zero
376  a1s1_ad = zero; a1s2_ad = zero; a2s1_ad = zero; a2s2_ad = zero
377  a2s2_theta0_ad = zero
378  a1s1_theta_ad = zero; a1s2_theta_ad = zero; a2s1_theta_ad = zero; a2s2_theta_ad = zero
379  a1v_theta_ad = zero; a1h_theta_ad = zero; a2v_theta_ad = zero; a2h_theta_ad = zero
380  azimuth_component_ad = zero
381 
382 
383  ! Adjoint of frequency interpolation. Only V and H polarisation.
384  IF ( ivar%frequency < fit_frequency(1) ) THEN
385  ! ...Lower out of bounds frequency
386  azimuth_component_ad(1,ihpol) = azimuth_component_ad(1,ihpol) + e_azimuth_ad(ihpol)
387  azimuth_component_ad(1,ivpol) = azimuth_component_ad(1,ivpol) + e_azimuth_ad(ivpol)
388  ELSE IF ( ivar%frequency > fit_frequency(n_frequencies) ) THEN
389  ! ...Upper out of bounds frequency
390  azimuth_component_ad(n_frequencies,ihpol) = azimuth_component_ad(n_frequencies,ihpol) + e_azimuth_ad(ihpol)
391  azimuth_component_ad(n_frequencies,ivpol) = azimuth_component_ad(n_frequencies,ivpol) + e_azimuth_ad(ivpol)
392  ELSE
393  ! ...In bounds, so interpolate
394  azimuth_component_ad(ivar%i1,ihpol) = ((one - ivar%lpoly) * e_azimuth_ad(ihpol)) + azimuth_component_ad(ivar%i1,ihpol)
395  azimuth_component_ad(ivar%i2,ihpol) = ( ivar%lpoly * e_azimuth_ad(ihpol)) + azimuth_component_ad(ivar%i2,ihpol)
396  azimuth_component_ad(ivar%i1,ivpol) = ((one - ivar%lpoly) * e_azimuth_ad(ivpol)) + azimuth_component_ad(ivar%i1,ivpol)
397  azimuth_component_ad(ivar%i2,ivpol) = ( ivar%lpoly * e_azimuth_ad(ivpol)) + azimuth_component_ad(ivar%i2,ivpol)
398  END IF
399  e_azimuth_ad(ihpol) = zero
400  e_azimuth_ad(ivpol) = zero
401 
402 
403  ! Loop over frequencies to compute the intermediate term adjoints
404  frequency_loop: DO j = 1, n_frequencies
405 
406  phi_ad = phi_ad - &
407  ( ( ivar%A1h_theta(j) * sin( ivar%phi )) + &
408  (two * ivar%A2h_theta(j) * sin(two*ivar%phi)) ) * azimuth_component_ad(j,ihpol)
409  a2h_theta_ad(j) = (cos(two*ivar%phi) * azimuth_component_ad(j,ihpol)) + a2h_theta_ad(j)
410  a1h_theta_ad(j) = (cos( ivar%phi ) * azimuth_component_ad(j,ihpol)) + a1h_theta_ad(j)
411  azimuth_component_ad(j,ihpol) = zero
412 
413  phi_ad = phi_ad - &
414  ( ( ivar%A1v_theta(j) * sin( ivar%phi )) + &
415  (two * ivar%A2v_theta(j) * sin(two*ivar%phi)) ) * azimuth_component_ad(j,ivpol)
416  a2v_theta_ad(j) = (cos(two*ivar%phi) * azimuth_component_ad(j,ivpol)) + a2v_theta_ad(j)
417  a1v_theta_ad(j) = (cos( ivar%phi ) * azimuth_component_ad(j,ivpol)) + a1v_theta_ad(j)
418  azimuth_component_ad(j,ivpol) = zero
419 
420 
421  a2s2_theta_ad(j) = a2s2_theta_ad(j) - point5*a2h_theta_ad(j)
422  a2s1_theta_ad(j) = a2s1_theta_ad(j) + a2h_theta_ad(j)
423  a2h_theta_ad(j) = zero
424 
425  a2s2_theta_ad(j) = a2s2_theta_ad(j) + point5*a2v_theta_ad(j)
426  a2s1_theta_ad(j) = a2s1_theta_ad(j) + a2v_theta_ad(j)
427  a2v_theta_ad(j) = zero
428 
429  a1s2_theta_ad(j) = a1s2_theta_ad(j) - point5*a1h_theta_ad(j)
430  a1s1_theta_ad(j) = a1s1_theta_ad(j) + a1h_theta_ad(j)
431  a1h_theta_ad(j) = zero
432 
433  a1s2_theta_ad(j) = a1s2_theta_ad(j) + point5*a1v_theta_ad(j)
434  a1s1_theta_ad(j) = a1s1_theta_ad(j) + a1v_theta_ad(j)
435  a1v_theta_ad(j) = zero
436 
437 
438  a2s2_ad(j) = a2s2_ad(j) + a2s2_theta_ad(j)*((ivar%zenith_angle/theta_ref)**xs22)
439  a2s2_theta0_ad(j) = a2s2_theta0_ad(j) + a2s2_theta_ad(j)*(one - (ivar%zenith_angle/theta_ref)**xs22)
440  a2s2_theta_ad(j) = zero
441 
442  a1s2_ad(j) = a1s2_ad(j) + a1s2_theta_ad(j)*((ivar%zenith_angle/theta_ref)**xs21)
443  a1s2_theta_ad(j) = zero
444 
445  a2s1_ad(j) = a2s1_ad(j) + a2s1_theta_ad(j)*((ivar%zenith_angle/theta_ref)**xs12)
446  a2s1_theta_ad(j) = zero
447 
448  a1s1_ad(j) = a1s1_ad(j) + a1s1_theta_ad(j)*((ivar%zenith_angle/theta_ref)**xs11)
449  a1s1_theta_ad(j) = zero
450 
451 
452  ! Only compute AD value if wind speed is not maxed out
453  IF ( ivar%lw15 ) THEN
454  a2s2_theta0_ad(j) = zero
455  ELSE
456  wind_speed_ad = wind_speed_ad + &
457  ((two*ivar%w15 - (three*ivar%w15**2)/22.5_fp)/55.5556_fp * &
458  (two/290.0_fp) * &
459  (one - log10(30.0_fp/ivar%f37)))*a2s2_theta0_ad(j)
460  a2s2_theta0_ad(j) = zero
461  END IF
462 
463 
464  a2h_ad(j) = a2h_ad(j) - a2s2_ad(j)
465  a2v_ad(j) = a2v_ad(j) + a2s2_ad(j)
466  a2s2_ad(j) = zero
467 
468  a2h_ad(j) = a2h_ad(j) + point5*a2s1_ad(j)
469  a2v_ad(j) = a2v_ad(j) + point5*a2s1_ad(j)
470  a2s1_ad(j) = zero
471 
472  a1h_ad(j) = a1h_ad(j) - a1s2_ad(j)
473  a1v_ad(j) = a1v_ad(j) + a1s2_ad(j)
474  a1s2_ad(j) = zero
475 
476  a1h_ad(j) = a1h_ad(j) + point5*a1s1_ad(j)
477  a1v_ad(j) = a1v_ad(j) + point5*a1s1_ad(j)
478  a1s1_ad(j) = zero
479 
480 
481  ! Only compute AD values if wind speed is not maxed out
482  IF ( ivar%lw18 ) THEN
483  a1v_ad(j) = zero
484  a2v_ad(j) = zero
485  a1h_ad(j) = zero
486  a2h_ad(j) = zero
487  ELSE
488  wind_speed_ad = wind_speed_ad + &
489  ( azcoeff%C(2,j,ihpol) * ( exp(-azcoeff%C(6,j,ihpol) * ivar%w18**2 ) - one ) * &
490  ( azcoeff%C(3,j,ihpol) + &
491  two * azcoeff%C(4,j,ihpol) * ivar%w18 + &
492  three * azcoeff%C(5,j,ihpol) * ivar%w18**2 ) - &
493  two * azcoeff%C(2,j,ihpol) * azcoeff%C(6,j,ihpol) * ivar%w18 * &
494  exp(-azcoeff%C(6,j,ihpol) * ivar%w18**2 ) * &
495  ( azcoeff%C(3,j,ihpol) * ivar%w18 + &
496  azcoeff%C(4,j,ihpol) * ivar%w18**2 + &
497  azcoeff%C(5,j,ihpol) * ivar%w18**3 ) ) * a2h_ad(j)
498  a2h_ad(j) = zero
499 
500  wind_speed_ad = wind_speed_ad + azcoeff%C(1,j,ihpol)*a1h_ad(j)
501  a1h_ad(j) = zero
502 
503  wind_speed_ad = wind_speed_ad + azcoeff%C(6,j,ivpol)*a2v_ad(j)
504  a2v_ad(j) = zero
505 
506  wind_speed_ad = wind_speed_ad + &
507  ( azcoeff%C(1,j,ivpol) * ( exp(-azcoeff%C(5,j,ivpol) * ivar%w18**2 ) - one ) * &
508  ( azcoeff%C(2,j,ivpol) + &
509  two * azcoeff%C(3,j,ivpol) * ivar%w18 + &
510  three * azcoeff%C(4,j,ivpol) * ivar%w18**2 ) - &
511  two * azcoeff%C(1,j,ivpol) * azcoeff%C(5,j,ivpol) * ivar%w18 * &
512  exp(-azcoeff%C(5,j,ivpol) * ivar%w18**2 ) * &
513  ( azcoeff%C(2,j,ivpol) * ivar%w18 + &
514  azcoeff%C(3,j,ivpol) * ivar%w18**2 + &
515  azcoeff%C(4,j,ivpol) * ivar%w18**3 ) ) * a1v_ad(j)
516  a1v_ad(j) = zero
517  END IF
518 
519  END DO frequency_loop
520 
521 
522  ! Adjoint of the angle perturbation in radians
523  azimuth_angle_ad = azimuth_angle_ad + degrees_to_radians*phi_ad
524 
525  END SUBROUTINE azimuth_emissivity_f6_ad
526 
527 
528 !################################################################################
529 !################################################################################
530 !## ##
531 !## ## PRIVATE MODULE ROUTINES ## ##
532 !## ##
533 !################################################################################
534 !################################################################################
535 
536 
integer, parameter, public fp
Definition: Type_Kinds.f90:124
subroutine, public azimuth_emissivity_f6(AZCoeff, Wind_Speed, Azimuth_Angle, Frequency, Zenith_Angle, e_Azimuth, iVar)
subroutine, public azimuth_emissivity_f6_tl(AZCoeff, Wind_Speed_TL, Azimuth_Angle_TL, e_Azimuth_TL, iVar)
real(fp), dimension(n_frequencies), parameter fit_frequency
#define min(a, b)
Definition: mosaic_util.h:32
subroutine, public azimuth_emissivity_f6_ad(AZCoeff, e_Azimuth_AD, Wind_Speed_AD, Azimuth_Angle_AD, iVar)
integer function, public bisection_search(x, u, xLower, xUpper)