Ticket #461: ropp_fm_refrac_1d.f90

File ropp_fm_refrac_1d.f90, 5.4 KB (added by Ian Culverwell, 8 years ago)

ropp_fm_refrac_1d.f90_above_highest_lev

Line 
1! $Id: ropp_fm_refrac_1d.f90 4452 2015-01-29 14:42:02Z idculv $
2
3SUBROUTINE ropp_fm_refrac_1d(x, y, nonull)
4
5!****s* Refractivity/ropp_fm_refrac_1d *
6!
7! NAME
8! ropp_fm_refrac_1d - Forward model calculating a one dimensional
9! refractivity profile from the state vector
10! assuming exponential variation of refractivity
11! between model levels.
12!
13! SYNOPSIS
14! call ropp_fm_refrac_1d(x, y, nonull)
15!
16! DESCRIPTION
17! This routine is a forward model calculating a vertical profile of
18! refractivity from profiles of temperature, humidity and pressure.
19! Refractivity values are calculated for the geopotential height levels
20! given in the observation vector.
21!
22! INPUTS
23! type(State1dFM) :: x ! State vector structure
24! type(Obs1dRefrac) :: y ! Observation vector (levels required)
25! logical, optional :: nonull ! Don't nullify refracs below surface of model
26!
27! OUTPUT
28! type(Obs1dRefrac) :: y ! Obs vector with forward modelled refrac
29!
30! NOTES
31! The forward model assumes that the state vector structure contains
32! temperature, humidity and pressure values on common geopotential height
33! levels, independent of the source of those data. Model-dependent
34! conversion routines can be used to accomplish this within the
35! ropp_fm_roprof2state() subroutine.
36!
37! The forward model assumes that the observation vector contains
38! geopotential height levels onto which the forward simulated
39! observations are interpolated.
40!
41! The interpolation of refractivity calculated at the state vector's
42! geopotential height levels to the observation vector's geopotential height
43! levels is carried out assuming that refractivity varies exponentially
44! with geopotential height.
45!
46! SEE ALSO
47! ropp_fm_types
48! ropp_fm_refrac_1d_ad
49! ropp_fm_refrac_1d_tl
50!
51! AUTHOR
52! Met Office, Exeter, UK.
53! Any comments on this software should be given via the ROM SAF
54! Helpdesk at http://www.romsaf.org
55!
56! COPYRIGHT
57! (c) EUMETSAT. All rights reserved.
58! For further details please refer to the file COPYRIGHT
59! which you should have received as part of this distribution.
60!
61!****
62
63!-------------------------------------------------------------------------------
64! 1. Declarations
65!-------------------------------------------------------------------------------
66
67 USE typesizes, ONLY: wp => EightByteReal
68 USE ropp_utils, ONLY: ropp_MDFV
69 USE ropp_fm, not_this => ropp_fm_refrac_1d
70 USE ropp_fm_types
71 USE ropp_fm_constants
72
73 IMPLICIT NONE
74
75 TYPE(State1dFM), INTENT(in) :: x ! State vector
76 TYPE(Obs1dRefrac), INTENT(inout) :: y ! Observation vector
77 LOGICAL, OPTIONAL, INTENT(in) :: nonull ! Don't nullify refracs below surface of model
78
79! Local variables
80 REAL(wp), DIMENSION(x%n_lev) :: pwvp ! Partial water vapour pressure
81 REAL(wp), DIMENSION(x%n_lev) :: pdry ! Partial dry air pressure
82 REAL(wp), DIMENSION(x%n_lev) :: refrac ! Refractivity
83 REAL(wp), DIMENSION(x%n_lev) :: z_geop ! Geopotential height of model levels
84 REAL(wp), DIMENSION(x%n_lev) :: zcomp_dry_inv ! Dry compressibility
85 REAL(wp), DIMENSION(x%n_lev) :: zcomp_wet_inv ! Wet compressibility
86
87 REAL(wp) :: kap1,kap2,kap3 ! Refractivity coefficients used in routine
88
89 INTEGER :: i
90
91 LOGICAL :: l_nonull ! Don't nullify refracs below surface of model
92
93!-------------------------------------------------------------------------------
94! 2. Non ideal gas options
95!-------------------------------------------------------------------------------
96
97! set inverse of compressibilities
98
99 zcomp_dry_inv(:) = 1.0_wp
100 zcomp_wet_inv(:) = 1.0_wp
101
102! initialise geopotential heights
103
104 z_geop(:) = x%geop(:)
105
106 IF (x%non_ideal) THEN
107
108! if non ideal gas calculation, use adjusted coefficients
109
110 kap1 = kappa1_comp
111 kap2 = kappa2_comp
112 kap3 = kappa3_comp
113
114! calculate compressibilty and adjust geopotential heights in z_geop
115
116 CALL ropp_fm_compress(x,z_geop,zcomp_dry_inv,zcomp_wet_inv)
117
118 ELSE
119
120 kap1 = kappa1
121 kap2 = kappa2
122 kap3 = kappa3
123
124 ENDIF
125
126!-------------------------------------------------------------------------------
127! 3. Standard exponentially varying refractivity assumption
128!-------------------------------------------------------------------------------
129
130! 3.1 Calculate water vapor and dry air pressure
131!-----------------------------------------------
132
133 pwvp = x%pres * x%shum / (epsilon_water + (1.0_wp - epsilon_water)*x%shum)
134
135 pdry = x%pres - pwvp
136
137! 3.2 Calculate refractivity
138!---------------------------
139
140 refrac = kap1 * pdry * zcomp_dry_inv/ x%temp + &
141 kap2 * pwvp * zcomp_wet_inv/ x%temp**2 + &
142 kap3 * pwvp * zcomp_wet_inv/ x%temp
143
144! 3.3 Interpolate to measurements geopotential height levels
145!-----------------------------------------------------------
146
147 CALL ropp_fm_interpol_log(z_geop, y%geop, refrac, y%refrac)
148
149! 3.4 Set weight to zero if ob height is below model surface
150!-----------------------------------------------------------
151
152 l_nonull = .FALSE.
153
154 IF ( PRESENT(nonull) ) l_nonull = nonull
155
156 IF ( .NOT. l_nonull ) THEN
157 DO i=1, SIZE(y%geop)
158 IF ((y%geop(i) < x%geop(1)) .OR. (y%geop(i) > x%geop(x%n_lev))) THEN
159 y%refrac(i) = ropp_MDFV
160 y%weights(i) = 0.0_wp
161 END IF
162 END DO
163 END IF
164
165END SUBROUTINE ropp_fm_refrac_1d