FV3 Bundle
CRTM_MoleculeScatter.f90
Go to the documentation of this file.
1 !
2 ! CRTM_MoleculeScatter
3 !
4 ! Module to compute molecule optical properties.
5 !
6 !
7 ! CREATION HISTORY:
8 ! Written by: Quanhua Liu, 03-Oct-2008
9 ! Quanhua.Liu@noaa.gov
10 !
11 
13 
14  ! -----------------
15  ! Environment setup
16  ! -----------------
17  ! Module use
18  USE type_kinds , ONLY: fp
20  USE crtm_parameters , ONLY: zero
23  ! Disable implicit typing
24  IMPLICIT NONE
25 
26 
27  ! ------------
28  ! Visibilities
29  ! ------------
30  PRIVATE
34 
35 
36  ! -----------------
37  ! Module parameters
38  ! -----------------
39  ! RCS Id for the module
40  CHARACTER(*), PARAMETER :: module_rcs_id = &
41  '$Id: CRTM_MoleculeScatter.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $'
42  ! Rayleigh factor
43  REAL(fp), PARAMETER :: rfactor = 27.0363_fp ! = 287.0/9.8*923.1907/1000.0
44 
45 
46 CONTAINS
47 
48 
49 !################################################################################
50 !################################################################################
51 !## ##
52 !## ## PUBLIC MODULE ROUTINES ## ##
53 !## ##
54 !################################################################################
55 !################################################################################
56 
57 !------------------------------------------------------------------------------
58 !:sdoc+:
59 !
60 ! NAME:
61 ! CRTM_Compute_MoleculeScatter
62 !
63 ! PURPOSE:
64 ! Function to compute molecular scattering and extinction
65 !
66 ! CALLING SEQUENCE:
67 ! Error_Status = CRTM_Compute_MoleculeScatter( Wavenumber , & ! Input
68 ! Atmosphere , & ! Input
69 ! AtmOptics , & ! In/Output
70 ! Message_Log=Message_Log ) ! Error messaging
71 !
72 ! INPUT ARGUMENTS:
73 ! Wavenumber: Spectral frequency
74 ! UNITS: Inverse centimetres (cm^-1)
75 ! TYPE: REAL(fp)
76 ! DIMENSION: Scalar
77 ! ATTRIBUTES: INTENT(IN)
78 !
79 ! Atmosphere: Structure containing the atmospheric
80 ! profile data.
81 ! UNITS: N/A
82 ! TYPE: TYPE(CRTM_Atmosphere_type)
83 ! DIMENSION: Scalar
84 ! ATTRIBUTES: INTENT(IN)
85 !
86 ! OUTPUT ARGUMENTS:
87 ! AtmOptics: Structure containing the atmospheric optics data
88 ! to which the molecular scattering and extinction
89 ! component is added.
90 ! UNITS: N/A
91 ! TYPE: TYPE(CRTM_AtmOptics_type)
92 ! DIMENSION: Scalar
93 ! ATTRIBUTES: INTENT(IN OUT)
94 !
95 ! OPTIONAL INPUT ARGUMENTS:
96 ! Message_Log: Character string specifying a filename in which any
97 ! messages will be logged. If not specified, or if an
98 ! error occurs opening the log file, the default action
99 ! is to output messages to standard output.
100 ! UNITS: N/A
101 ! TYPE: CHARACTER(*)
102 ! DIMENSION: Scalar
103 ! ATTRIBUTES: INTENT(IN), OPTIONAL
104 !
105 ! FUNCTION RESULT:
106 ! Error_Status: The return value is an integer defining the error status.
107 ! The error codes are defined in the ERROR_HANDLER module.
108 ! If == SUCCESS the computation was sucessful
109 ! == FAILURE an unrecoverable error occurred
110 ! UNITS: N/A
111 ! TYPE: INTEGER
112 ! DIMENSION: Scalar
113 !:sdoc-:
114 !------------------------------------------------------------------------------
115 
116  FUNCTION crtm_compute_moleculescatter( Wavenumber, & ! Input
117  Atmosphere, & ! Input
118  AtmOptics, & ! In/Output
119  Message_Log ) & ! Error messaging
120  result( error_status )
121  ! Arguments
122  REAL(fp), INTENT(IN) :: wavenumber
123  TYPE(crtm_atmosphere_type), INTENT(IN) :: atmosphere
124  TYPE(crtm_atmoptics_type), INTENT(IN OUT) :: atmoptics
125  CHARACTER(*), OPTIONAL, INTENT(IN) :: message_log
126  ! Function result
127  INTEGER :: error_status
128  ! Local parameters
129  CHARACTER(*), PARAMETER :: routine_name = 'CRTM_Compute_MoleculeScatter'
130 
131  ! Local variables
132  INTEGER :: k
133  REAL(fp) :: wavelength , opt_unit, optical_depth
134 
135  ! Setup
136  ! -----
137  error_status = success
138 
139  ! Check input
140  IF( wavenumber > zero ) THEN
141  wavelength = compute_wavelength( wavenumber )
142  ELSE
143  error_status = failure
144  CALL display_message(routine_name,'Invalid wavenumber',error_status,message_log=message_log)
145  RETURN
146  END IF
147 
148 
149  ! Calculate the scattering parameters
150  ! -----------------------------------
151  ! Compute optical scaling unit
152  CALL raylo(wavelength, opt_unit)
153 
154  ! Loop over atmospheric layers
155  DO k = 1, atmosphere%n_Layers
156  optical_depth = rfactor*opt_unit*(atmosphere%Level_Pressure(k)-atmosphere%Level_Pressure(k-1))
157  atmoptics%Optical_Depth(k) = atmoptics%Optical_Depth(k) + optical_depth
158  atmoptics%Single_Scatter_Albedo(k) = atmoptics%Single_Scatter_Albedo(k) + optical_depth
159 
160  ! The Rayleigh spherical expansion coefficients are constant.
161  atmoptics%Phase_Coefficient(2,1,k) = atmoptics%Phase_Coefficient(2,1,k) + &
162  0.25_fp * optical_depth
163 
164 ! FOR FUTURE IMPLEMENTATION
165 ! ! Compute atmospheric polarisatin component
166 ! AtmOptics%Phase_Coefficient(2,2,k) = AtmOptics%Phase_Coefficient(2,2,k) + &
167 ! 1.5_fp * Optical_Depth
168 ! AtmOptics%Phase_Coefficient(1,4,k) = AtmOptics%Phase_Coefficient(1,4,k) + &
169 ! 0.75_fp * Optical_Depth
170 ! AtmOptics%Phase_Coefficient(2,5,k) = AtmOptics%Phase_Coefficient(2,5,k) + &
171 ! 0.612372_fp * Optical_Depth
172  END DO
173  END FUNCTION crtm_compute_moleculescatter
174 
175 
176 !------------------------------------------------------------------------------
177 !:sdoc+:
178 !
179 ! NAME:
180 ! CRTM_Compute_MoleculeScatter_TL
181 !
182 ! PURPOSE:
183 ! Function to compute the tangent-linear molecular scattering and
184 ! extinction
185 !
186 ! CALLING SEQUENCE:
187 ! Error_Status = CRTM_Compute_MoleculeScatter_TL( Wavenumber , & ! Input
188 ! Atmosphere_TL , & ! Input
189 ! AtmOptics_TL , & ! In/Output
190 ! Message_Log=Message_Log ) ! Error messaging
191 !
192 ! INPUT ARGUMENTS:
193 ! Wavenumber: Spectral frequency
194 ! UNITS: Inverse centimetres (cm^-1)
195 ! TYPE: REAL(fp)
196 ! DIMENSION: Scalar
197 ! ATTRIBUTES: INTENT(IN)
198 !
199 ! Atmosphere_TL: Structure containing the tangent-linear atmospheric
200 ! profile data.
201 ! UNITS: N/A
202 ! TYPE: TYPE(CRTM_Atmosphere_type)
203 ! DIMENSION: Scalar
204 ! ATTRIBUTES: INTENT(IN)
205 !
206 ! OUTPUT ARGUMENTS:
207 ! AtmOptics_TL: Structure containing the tangent-linear atmospheric
208 ! optics data to which the molecular scattering and
209 ! extinction component is added.
210 ! UNITS: N/A
211 ! TYPE: TYPE(CRTM_AtmOptics_type)
212 ! DIMENSION: Scalar
213 ! ATTRIBUTES: INTENT(IN OUT)
214 !
215 ! OPTIONAL INPUT ARGUMENTS:
216 ! Message_Log: Character string specifying a filename in which any
217 ! messages will be logged. If not specified, or if an
218 ! error occurs opening the log file, the default action
219 ! is to output messages to standard output.
220 ! UNITS: N/A
221 ! TYPE: CHARACTER(*)
222 ! DIMENSION: Scalar
223 ! ATTRIBUTES: INTENT(IN), OPTIONAL
224 !
225 ! FUNCTION RESULT:
226 ! Error_Status: The return value is an integer defining the error status.
227 ! The error codes are defined in the ERROR_HANDLER module.
228 ! If == SUCCESS the computation was sucessful
229 ! == FAILURE an unrecoverable error occurred
230 ! UNITS: N/A
231 ! TYPE: INTEGER
232 ! DIMENSION: Scalar
233 !:sdoc-:
234 !------------------------------------------------------------------------------
235 
236  FUNCTION crtm_compute_moleculescatter_tl( Wavenumber, & ! Input
237  Atmosphere_TL, & ! TL Input
238  AtmOptics_TL, & ! TL Output
239  Message_Log ) & ! Error messaging
240  result( error_status )
241  ! Arguments
242  REAL(fp), INTENT(IN) :: wavenumber
243  TYPE(crtm_atmosphere_type), INTENT(IN) :: atmosphere_tl
244  TYPE(crtm_atmoptics_type), INTENT(IN OUT) :: atmoptics_tl
245  CHARACTER(*), OPTIONAL, INTENT(IN) :: message_log
246  ! Function result
247  INTEGER :: error_status
248  ! Local parameters
249  CHARACTER(*), PARAMETER :: routine_name = 'CRTM_Compute_MoleculeScatter_TL'
250  ! Local variables
251  INTEGER :: k
252  REAL(fp) :: wavelength , opt_unit, optical_depth_tl
253 
254  ! Setup
255  ! -----
256  error_status = success
257 
258  ! Check input
259  IF( wavenumber > zero ) THEN
260  wavelength = compute_wavelength( wavenumber )
261  ELSE
262  error_status = failure
263  CALL display_message(routine_name,'Invalid wavenumber',error_status,message_log=message_log)
264  RETURN
265  END IF
266 
267  ! Calculate the TL scattering parameters
268  ! --------------------------------------
269  CALL raylo(wavelength, opt_unit)
270  DO k = 1, atmosphere_tl%n_Layers
271  optical_depth_tl = rfactor*opt_unit*(atmosphere_tl%Level_Pressure(k)-atmosphere_tl%Level_Pressure(k-1))
272  atmoptics_tl%Optical_Depth(k) = atmoptics_tl%Optical_Depth(k) + optical_depth_tl
273  atmoptics_tl%Single_Scatter_Albedo(k) = atmoptics_tl%Single_Scatter_Albedo(k) + optical_depth_tl
274  ! The Rayleigh spherical expansion coefficients are constant.
275  atmoptics_tl%Phase_Coefficient(2,1,k) = atmoptics_tl%Phase_Coefficient(2,1,k) + &
276  0.25_fp * optical_depth_tl
277  END DO
278 
280 
281 
282 !------------------------------------------------------------------------------
283 !:sdoc+:
284 !
285 ! NAME:
286 ! CRTM_Compute_MoleculeScatter_AD
287 !
288 ! PURPOSE:
289 ! Function to compute the molecular scattering and extinction adjoint.
290 !
291 ! CALLING SEQUENCE:
292 ! Error_Status = CRTM_Compute_MoleculeScatter_AD( Wavenumber , & ! Input
293 ! AtmOptics_AD , & ! In/Output
294 ! Atmosphere_AD , & ! Input
295 ! Message_Log=Message_Log ) ! Error messaging
296 !
297 ! INPUT ARGUMENTS:
298 ! Wavenumber: Spectral frequency
299 ! UNITS: Inverse centimetres (cm^-1)
300 ! TYPE: REAL(fp)
301 ! DIMENSION: Scalar
302 ! ATTRIBUTES: INTENT(IN)
303 !
304 ! AtmOptics_AD: Structure containing the adjoint atmospheric
305 ! optics data from which the molecular scattering and
306 ! extinction component is taken.
307 ! UNITS: N/A
308 ! TYPE: TYPE(CRTM_AtmOptics_type)
309 ! DIMENSION: Scalar
310 ! ATTRIBUTES: INTENT(IN OUT)
311 !
312 ! OUTPUT ARGUMENTS:
313 ! Atmosphere_AD: Structure containing the adjoint atmospheric
314 ! profile data.
315 ! UNITS: N/A
316 ! TYPE: TYPE(CRTM_Atmosphere_type)
317 ! DIMENSION: Scalar
318 ! ATTRIBUTES: INTENT(IN OUT)
319 !
320 ! OPTIONAL INPUT ARGUMENTS:
321 ! Message_Log: Character string specifying a filename in which any
322 ! messages will be logged. If not specified, or if an
323 ! error occurs opening the log file, the default action
324 ! is to output messages to standard output.
325 ! UNITS: N/A
326 ! TYPE: CHARACTER(*)
327 ! DIMENSION: Scalar
328 ! ATTRIBUTES: INTENT(IN), OPTIONAL
329 !
330 ! FUNCTION RESULT:
331 ! Error_Status: The return value is an integer defining the error status.
332 ! The error codes are defined in the ERROR_HANDLER module.
333 ! If == SUCCESS the computation was sucessful
334 ! == FAILURE an unrecoverable error occurred
335 ! UNITS: N/A
336 ! TYPE: INTEGER
337 ! DIMENSION: Scalar
338 !:sdoc-:
339 !------------------------------------------------------------------------------
340 
341  FUNCTION crtm_compute_moleculescatter_ad( Wavenumber, & ! Input
342  AtmOptics_AD, & ! AD Input
343  Atmosphere_AD, & ! AD Output
344  Message_Log ) & ! Error messaging
345  result( error_status )
346  ! Arguments
347  REAL(fp), INTENT(IN) :: wavenumber
348  TYPE(crtm_atmoptics_type), INTENT(IN OUT) :: atmoptics_ad
349  TYPE(crtm_atmosphere_type), INTENT(IN OUT) :: atmosphere_ad
350  CHARACTER(*), OPTIONAL, INTENT(IN) :: message_log
351  ! Function result
352  INTEGER :: error_status
353  ! Local parameters
354  CHARACTER(*), PARAMETER :: routine_name = 'CRTM_Compute_MoleculeScatter_AD'
355  INTEGER :: k
356  REAL(fp) :: wavelength , opt_unit, optical_depth_ad
357 
358  ! Setup
359  ! -----
360  error_status = success
361 
362  ! Check input
363  IF( wavenumber > zero ) THEN
364  wavelength = compute_wavelength( wavenumber )
365  ELSE
366  error_status = failure
367  CALL display_message(routine_name,'Invalid wavenumber',error_status,message_log=message_log)
368  RETURN
369  END IF
370 
371  ! Calculate the AD scattering parameters
372  ! --------------------------------------
373  CALL raylo(wavelength, opt_unit)
374  DO k = 1, atmosphere_ad%n_Layers
375  optical_depth_ad = atmoptics_ad%Single_Scatter_Albedo(k)
376  optical_depth_ad = optical_depth_ad + 0.25_fp * atmoptics_ad%Phase_Coefficient(2,1,k)
377  atmosphere_ad%Level_Pressure(k) = atmosphere_ad%Level_Pressure(k) + &
378  rfactor*opt_unit*optical_depth_ad
379  atmosphere_ad%Level_Pressure(k-1) = atmosphere_ad%Level_Pressure(k-1) - &
380  rfactor*opt_unit*optical_depth_ad
381  END DO
382 
384 
385 
386 !##################################################################################
387 !##################################################################################
388 !## ##
389 !## ## PRIVATE MODULE ROUTINES ## ##
390 !## ##
391 !##################################################################################
392 !##################################################################################
393 
394  ! ---------------------------------------------------------------------
395  ! Simple function to convert wavenumber (cm^-1) to wavelength (microns)
396  ! ---------------------------------------------------------------------
397  FUNCTION compute_wavelength( Wavenumber ) RESULT( Wavelength )
398  REAL(fp), INTENT(IN) :: wavenumber
399  REAL(fp) :: wavelength
400  REAL(fp), PARAMETER :: wfactor = 10000.0_fp
401  wavelength = wfactor/wavenumber
402  END FUNCTION compute_wavelength
403 
404 
405  !--------------------------------------------------------------------
406  ! OPTICAL DEPTH FOR Molecule SCATTERING
407  ! ARGUMENTS -
408  ! WE R*8 IN WAVELENGTH ( MICRO METER)
409  ! RAYLO R*8 OUT OPTICAL DEPTH PER KM
410  !--------------------------------------------------------------------
411  SUBROUTINE raylo(WE, OPT)
412  REAL(fp), INTENT(IN) :: WE
413  REAL(fp), INTENT(OUT) :: OPT
414  REAL(fp), PARAMETER :: DELT = 0.0279_fp
415  REAL(fp) :: X1, DY, X2, AS
416  x1=1.0_fp/(we*we)
417  as=(6432.8_fp+2949810.0_fp/(146.0_fp-x1)+25540.0_fp/(41.0_fp-x1))*1.0e-08_fp + 1.0_fp
418  x2=(as*as - 1.0_fp)**2
419  dy = (6.0_fp+3.0_fp*delt)/(6.0_fp-7.0_fp*delt)
420  opt = x2*dy/(we**4)
421  END SUBROUTINE raylo
422 
423 END MODULE crtm_moleculescatter
integer, parameter, public failure
real(fp), parameter, public zero
real(fp), parameter rfactor
integer, parameter, public fp
Definition: Type_Kinds.f90:124
subroutine raylo(WE, OPT)
integer function, public crtm_compute_moleculescatter_ad(Wavenumber, AtmOptics_AD, Atmosphere_AD, Message_Log)
recursive subroutine, public display_message(Routine_Name, Message, Error_State, Message_Log)
integer function, public crtm_compute_moleculescatter(Wavenumber, Atmosphere, AtmOptics, Message_Log)
character(*), parameter module_rcs_id
integer function, public crtm_compute_moleculescatter_tl(Wavenumber, Atmosphere_TL, AtmOptics_TL, Message_Log)
integer, parameter, public success
real(fp) function compute_wavelength(Wavenumber)