45 '$Id: Slope_Variance.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $' 48 REAL(fp),
PARAMETER ::
zero = 0.0_fp
49 REAL(fp),
PARAMETER ::
one = 1.0_fp
50 REAL(fp),
PARAMETER ::
two = 2.0_fp
53 REAL(fp),
PARAMETER ::
var_coeffs(2) = (/0.0030_fp, 0.00512_fp/)
54 REAL(fp),
PARAMETER ::
f_coeffs(3) = (/1.0000_fp, 0.02000_fp, 0.30000_fp/)
57 REAL(fp),
PARAMETER ::
xscale = 1000000.0_fp
71 REAL(fp) :: variance =
zero 85 iVar , & ! Internal variable output
88 REAL(fp) ,
INTENT(IN) :: frequency
89 REAL(fp) ,
INTENT(IN) :: wind_speed
91 REAL(fp) ,
INTENT(OUT) :: variance
99 ivar%varb = c * ivar%Fterm
103 ivar%x1 =
xscale*(ivar%varb - ivar%vara)
104 CALL step(ivar%x1,ivar%g1)
105 ivar%var1 = ivar%vara*ivar%g1 + ivar%varb*(
one-ivar%g1)
108 ivar%x2 =
xscale*ivar%varb
109 CALL step(ivar%x2,ivar%g2)
110 variance = ivar%var1*ivar%g2
116 Wind_Speed_TL, & ! Input
117 iVar , & ! Internal variable input
120 REAL(fp) ,
INTENT(IN) :: wind_speed_tl
122 REAL(fp) ,
INTENT(OUT) :: variance_tl
125 REAL(fp) :: vara_tl, varb_tl
126 REAL(fp) :: x1_tl, g1_tl, var1_tl
127 REAL(fp) :: x2_tl, g2_tl
130 vara_tl = c * wind_speed_tl
131 varb_tl = c * ivar%Fterm * wind_speed_tl
135 x1_tl =
xscale*(varb_tl - vara_tl)
136 CALL step_tl(ivar%x1,x1_tl,g1_tl)
137 var1_tl = (ivar%vara - ivar%varb)*g1_tl + &
139 (
one-ivar%g1)*varb_tl
143 CALL step_tl(ivar%x2,x2_tl,g2_tl)
144 variance_tl = ivar%var1*g2_tl + ivar%g2*var1_tl
150 Variance_AD , & ! Input
151 iVar , & ! Internal variable input
154 REAL(fp) ,
INTENT(IN OUT) :: variance_ad
156 REAL(fp) ,
INTENT(IN OUT) :: wind_speed_ad
159 REAL(fp) :: vara_ad, varb_ad
160 REAL(fp) :: x1_ad, g1_ad, var1_ad
161 REAL(fp) :: x2_ad, g2_ad
164 var1_ad = ivar%g2 * variance_ad
165 g2_ad = ivar%var1 * variance_ad
169 CALL step_ad(ivar%x2, g2_ad, x2_ad)
174 varb_ad = varb_ad + (
one-ivar%g1) * var1_ad
175 vara_ad = ivar%g1 * var1_ad
176 g1_ad = (ivar%vara - ivar%varb) * var1_ad
179 CALL step_ad(ivar%x1, g1_ad, x1_ad)
181 vara_ad = vara_ad -
xscale * x1_ad
182 varb_ad = varb_ad +
xscale * x1_ad
186 wind_speed_ad = wind_speed_ad + c * ivar%Fterm * varb_ad
187 wind_speed_ad = wind_speed_ad + c * vara_ad
real(fp), parameter, public zero
integer, parameter, public fp
subroutine, public compute_slope_variance(Frequency, Wind_Speed, iVar, Variance)
character(*), parameter module_version_id
real(fp), dimension(2), parameter var_coeffs
subroutine, public step_ad(x, g_AD, x_AD)
real(fp), dimension(3), parameter f_coeffs
real(fp), parameter xscale
real(fp), parameter, public one
real(fp), parameter, public two
subroutine, public step(x, g)
subroutine, public compute_slope_variance_tl(Wind_Speed_TL, iVar, Variance_TL)
subroutine, public compute_slope_variance_ad(Variance_AD, iVar, Wind_Speed_AD)
subroutine, public step_tl(x, x_TL, g_TL)