FV3 Bundle
Large_Scale_Correction_Module.f90
Go to the documentation of this file.
1 !
2 ! Large_Scale_Correction_Module
3 !
4 ! Module containing the large-scale correction procedures for the
5 ! CRTM implementations of FASTEM4 and FASTEM5
6 !
7 ! Equations (A5a) and (A5b) of
8 !
9 ! Liu, Q. et al. (2011) An Improved Fast Microwave Water
10 ! Emissivity Model, TGRSS, 49, pp1238-1250
11 !
12 ! describes the fitting of the large-scale correction formulation.
13 ! No explicit description of the data that was fitted is given.
14 !
15 !
16 ! CREATION HISTORY:
17 ! Written by: Original FASTEM authors
18 !
19 ! Refactored by: Paul van Delst, November 2011
20 ! paul.vandelst@noaa.gov
21 !
22 
24 
25  ! -----------------
26  ! Environment setup
27  ! -----------------
28  ! Module use
29  USE type_kinds, &
30  only: fp
31  USE fitcoeff_define, &
32  only: fitcoeff_3d_type
33  USE crtm_interpolation, &
34  only: npts , &
35  lpoly_type , &
36  find_index , &
37  interp_4d , &
38  interp_4d_tl, &
39  interp_4d_ad, &
40  clear_lpoly , &
41  lpoly , &
42  lpoly_tl , &
43  lpoly_ad
44  ! Disable implicit typing
45  IMPLICIT NONE
46 
47 
48  ! ------------
49  ! Visibilities
50  ! ------------
51  PRIVATE
52  ! Data types
53  PUBLIC :: ivar_type
54  ! Science routines
55  PUBLIC :: large_scale_correction
58 
59 
60  ! -----------------
61  ! Module parameters
62  ! -----------------
63  CHARACTER(*), PARAMETER :: module_version_id = &
64  '$Id: Large_Scale_Correction_Module.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $'
65 
66  ! Literal constants
67  REAL(fp), PARAMETER :: zero = 0.0_fp
68  REAL(fp), PARAMETER :: one = 1.0_fp
69  REAL(fp), PARAMETER :: two = 2.0_fp
70  ! Number of "final" coefficients per polarisation
71  ! Corresponds with middle dimension of LSCCOEFF data
72  INTEGER, PARAMETER :: n_zcoeffs = 6
73  ! Number of look-up table dimensions
74  INTEGER, PARAMETER :: n_lutdims = 4
75 
76 
77  ! --------------------------------------
78  ! Structure definition to hold internal
79  ! variables across FWD, TL, and AD calls
80  ! --------------------------------------
81  ! The interpolation routine structure
82  TYPE :: iinterp_type
83  TYPE(lpoly_type) :: lp ! The interpolating polynomial
84  INTEGER :: i1, i2 ! The LUT interpolation indices
85  LOGICAL :: outbound ! The LUT interpolation boundary check
86  REAL(fp) :: xint ! The interpolation point
87  REAL(fp) :: x(npts) ! The data to be interpolated
88  END TYPE iinterp_type
89 
90 
91  TYPE :: ivar_type
92  PRIVATE
93  ! Direct inputs
94  REAL(fp) :: wind_speed = zero
95  ! Coefficient validity flag
96  LOGICAL :: zcoeff_invalid = .true.
97  ! Intermediate variables
98  REAL(fp) :: sec_z = zero
99  REAL(fp) :: zcoeff_v(n_zcoeffs) = zero
100  REAL(fp) :: zcoeff_h(n_zcoeffs) = zero
101  ! Look-up table interpolation data
102  TYPE(iinterp_type) :: lsci(n_lutdims)
103  END TYPE ivar_type
104 
105 
106 CONTAINS
107 
108 
109  ! =============================================================
110  ! Procedures to compute the reflectivity large scale correction
111  ! =============================================================
112  ! Forward model
113  SUBROUTINE large_scale_correction( &
114  LSCCoeff , & ! Input
115  Frequency , & ! Input
116  cos_Z , & ! Input
117  Wind_Speed, & ! Input
118  Rv_Large , & ! Output
119  Rh_Large , & ! Output
120  iVar ) ! Internal variable output
121  ! Arguments
122  TYPE(fitcoeff_3d_type), INTENT(IN) :: lsccoeff
123  REAL(fp), INTENT(IN) :: frequency
124  REAL(fp), INTENT(IN) :: cos_z
125  REAL(fp), INTENT(IN) :: wind_speed
126  REAL(fp), INTENT(OUT) :: rv_large
127  REAL(fp), INTENT(OUT) :: rh_large
128  TYPE(ivar_type), INTENT(IN OUT) :: ivar
129 
130  ! Setup
131  ivar%zcoeff_invalid = .true.
132  ivar%wind_speed = wind_speed
133  ivar%sec_z = one/cos_z
134  ! The large correction coefficient was derived for valid sensor zenith angles.
135  IF( ivar%sec_z > two ) ivar%sec_z = two
136 
137  ! Compute the frequency polynomial coefficients
138  CALL compute_zcoeff(lsccoeff%C(:,:,1), frequency, ivar%zcoeff_v)
139  CALL compute_zcoeff(lsccoeff%C(:,:,2), frequency, ivar%zcoeff_h)
140  ivar%zcoeff_invalid = .false.
141 
142  ! Compute the reflectivity corrections
143  rv_large = ivar%zcoeff_v(1) + &
144  ivar%zcoeff_v(2) * ivar%sec_z + &
145  ivar%zcoeff_v(3) * ivar%sec_z**2 + &
146  ivar%zcoeff_v(4) * ivar%wind_speed + &
147  ivar%zcoeff_v(5) * ivar%wind_speed**2 + &
148  ivar%zcoeff_v(6) * ivar%wind_speed*ivar%sec_z
149 
150  rh_large = ivar%zcoeff_h(1) + &
151  ivar%zcoeff_h(2) * ivar%sec_z + &
152  ivar%zcoeff_h(3) * ivar%sec_z**2 + &
153  ivar%zcoeff_h(4) * ivar%wind_speed + &
154  ivar%zcoeff_h(5) * ivar%wind_speed**2 + &
155  ivar%zcoeff_h(6) * ivar%wind_speed*ivar%sec_z
156 
157  CONTAINS
158 
159  SUBROUTINE compute_zcoeff(coeff,frequency,zcoeff)
160  REAL(fp), INTENT(IN) :: coeff(:,:)
161  REAL(fp), INTENT(IN) :: frequency
162  REAL(fp), INTENT(OUT) :: zcoeff(:)
163  INTEGER :: i
164  DO i = 1, SIZE(zcoeff)
165  zcoeff(i) = coeff(1,i) + frequency*(coeff(2,i) + frequency*coeff(3,i))
166  END DO
167  END SUBROUTINE compute_zcoeff
168 
169  END SUBROUTINE large_scale_correction
170 
171 
172  ! Tangent-linear model
173  SUBROUTINE large_scale_correction_tl( &
174  Wind_Speed_TL, & ! Input
175  Rv_Large_TL , & ! Output
176  Rh_Large_TL , & ! Output
177  iVar ) ! Internal variable output
178  ! Arguments
179  REAL(fp), INTENT(IN) :: wind_speed_tl
180  REAL(fp), INTENT(OUT) :: rv_large_tl
181  REAL(fp), INTENT(OUT) :: rh_large_tl
182  TYPE(ivar_type), INTENT(IN) :: ivar
183 
184  ! Setup
185  IF ( ivar%zcoeff_invalid ) THEN
186  rv_large_tl = zero
187  rh_large_tl = zero
188  RETURN
189  END IF
190 
191  ! Compute the tangent-linear reflectivity corrections
192  rv_large_tl = ( ivar%zcoeff_v(4) + &
193  (two * ivar%zcoeff_v(5) * ivar%wind_speed) + &
194  ( ivar%zcoeff_v(6) * ivar%sec_z ) ) * wind_speed_tl
195 
196  rh_large_tl = ( ivar%zcoeff_h(4) + &
197  (two * ivar%zcoeff_h(5) * ivar%wind_speed) + &
198  ( ivar%zcoeff_h(6) * ivar%sec_z ) ) * wind_speed_tl
199 
200  END SUBROUTINE large_scale_correction_tl
201 
202 
203  ! Adjoint model
204  SUBROUTINE large_scale_correction_ad( &
205  Rv_Large_AD , & ! Input
206  Rh_Large_AD , & ! Input
207  Wind_Speed_AD, & ! Output
208  iVar ) ! Internal variable output
209  ! Arguments
210  REAL(fp), INTENT(IN OUT) :: rv_large_ad
211  REAL(fp), INTENT(IN OUT) :: rh_large_ad
212  REAL(fp), INTENT(IN OUT) :: wind_speed_ad
213  TYPE(ivar_type), INTENT(IN) :: ivar
214 
215  ! Setup
216  IF ( ivar%zcoeff_invalid ) THEN
217  rv_large_ad = zero
218  rh_large_ad = zero
219  RETURN
220  END IF
221 
222  ! Compute the adjoint reflectivity corrections
223  ! ...Horizontal polarisation
224  wind_speed_ad = wind_speed_ad + &
225  ( ivar%zcoeff_h(4) + &
226  (two * ivar%zcoeff_h(5) * ivar%wind_speed) + &
227  ( ivar%zcoeff_h(6) * ivar%sec_z ) ) * rh_large_ad
228  rh_large_ad = zero
229  ! ...Vertical polarisation
230  wind_speed_ad = wind_speed_ad + &
231  ( ivar%zcoeff_v(4) + &
232  (two * ivar%zcoeff_v(5) * ivar%wind_speed) + &
233  ( ivar%zcoeff_v(6) * ivar%sec_z ) ) * rv_large_ad
234  rv_large_ad = zero
235 
236  END SUBROUTINE large_scale_correction_ad
237 
subroutine, public interp_4d(z, ulp, vlp, wlp, xlp, z_int)
integer, parameter, public fp
Definition: Type_Kinds.f90:124
subroutine, public interp_4d_tl(z, ulp, vlp, wlp, xlp, z_TL, ulp_TL, vlp_TL, wlp_TL, xlp_TL, z_int_TL)
subroutine, public interp_4d_ad(z, ulp, vlp, wlp, xlp, z_int_AD, z_AD, ulp_AD, vlp_AD, wlp_AD, xlp_AD)
subroutine, public clear_lpoly(p)
subroutine, public lpoly_ad(x, x_int, p, p_AD, x_AD, x_int_AD)
subroutine, public large_scale_correction(LSCCoeff, Frequency, cos_Z, Wind_Speed, Rv_Large, Rh_Large, iVar)
subroutine, public large_scale_correction_tl(Wind_Speed_TL, Rv_Large_TL, Rh_Large_TL, iVar)
real(fp), parameter, public two
real(fp), parameter zero
subroutine, public lpoly(x, x_int, p)
integer, parameter, public npts
subroutine compute_zcoeff(coeff, frequency, zcoeff)
subroutine, public large_scale_correction_ad(Rv_Large_AD, Rh_Large_AD, Wind_Speed_AD, iVar)
real(fp), parameter one
character(*), parameter module_version_id
subroutine, public lpoly_tl(x, x_int, p, x_TL, x_int_TL, p_TL)