forked from ESCOMP/CLUBB_CESM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats_rad_zt_module.F90
195 lines (141 loc) · 5.54 KB
/
stats_rad_zt_module.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
!-----------------------------------------------------------------------
! $Id$
!===============================================================================
module stats_rad_zt_module
implicit none
private ! Default Scope
public :: stats_init_rad_zt
! Constant parameters
integer, parameter, public :: nvarmax_rad_zt = 250 ! Maximum variables allowed
contains
!-----------------------------------------------------------------------
subroutine stats_init_rad_zt( vars_rad_zt, l_error )
! Description:
! Initializes array indices for stats_zt
!
! References:
! None
!-----------------------------------------------------------------------
use constants_clubb, only: &
fstderr ! Constant(s)
use stats_variables, only: &
stats_rad_zt, &
iT_in_K_rad, & ! Variable(s)
ircil_rad, &
io3l_rad, &
irsm_rad, &
ircm_in_cloud_rad, &
icloud_frac_rad, &
iice_supersat_frac_rad, &
iradht_rad, &
iradht_LW_rad, &
iradht_SW_rad, &
ip_in_mb_rad, &
isp_humidity_rad
use stats_type_utilities, only: &
stat_assign ! Procedure
implicit none
! Input Variable
character(len= * ), dimension(nvarmax_rad_zt), intent(in) :: vars_rad_zt
! Input/Output Variable
logical, intent(inout) :: l_error
! Local Varables
integer :: i, k
! ---- Begin Code ----
! Default initialization for array indices for stats_rad_zt
iT_in_K_rad = 0
ircil_rad = 0
io3l_rad = 0
irsm_rad = 0
ircm_in_cloud_rad = 0
icloud_frac_rad = 0
iice_supersat_frac_rad = 0
iradht_rad = 0
iradht_LW_rad = 0
iradht_SW_rad = 0
ip_in_mb_rad = 0
isp_humidity_rad = 0
! Assign pointers for statistics variables stats_rad_zt
k = 1
do i=1,stats_rad_zt%num_output_fields
select case ( trim(vars_rad_zt(i)) )
case ('T_in_K_rad')
iT_in_K_rad = k
call stat_assign( var_index=iT_in_K_rad, var_name="T_in_K_rad", &
var_description="Temperature [K]", var_units="K", l_silhs=.false., &
grid_kind=stats_rad_zt )
k = k + 1
case ('rcil_rad')
ircil_rad = k
call stat_assign( var_index=ircil_rad, var_name="rcil_rad", &
var_description="Ice mixing ratio [kg/kg]", var_units="kg/kg", l_silhs=.false., &
grid_kind=stats_rad_zt )
k = k + 1
case ('o3l_rad')
io3l_rad = k
call stat_assign( var_index=io3l_rad, var_name="o3l_rad", &
var_description="Ozone mixing ratio [kg/kg]", var_units="kg/kg", l_silhs=.false., &
grid_kind=stats_rad_zt )
k = k + 1
case ('rsm_rad')
irsm_rad = k
call stat_assign( var_index=irsm_rad, var_name="rsm_rad", &
var_description="Snow water mixing ratio [kg/kg]", var_units="kg/kg", &
l_silhs=.false., grid_kind=stats_rad_zt )
k = k + 1
case ('rcm_in_cloud_rad')
ircm_in_cloud_rad = k
call stat_assign( var_index=ircm_in_cloud_rad, var_name="rcm_in_cloud_rad", &
var_description="rcm in cloud layer [kg/kg]", var_units="kg/kg", l_silhs=.false., &
grid_kind=stats_rad_zt )
k = k + 1
case ('cloud_frac_rad')
icloud_frac_rad = k
call stat_assign( var_index=icloud_frac_rad, var_name="cloud_frac_rad", &
var_description="Cloud fraction (between 0 and 1) [-]", var_units="count", &
l_silhs=.false., grid_kind=stats_rad_zt )
k = k + 1
case ('ice_supersat_frac_rad')
iice_supersat_frac_rad = k
call stat_assign( var_index=iice_supersat_frac_rad, var_name="ice_supersat_frac_rad", &
var_description="Ice cloud fraction (between 0 and 1) [-]", var_units="count", &
l_silhs=.false., grid_kind=stats_rad_zt )
k = k + 1
case ('radht_rad')
iradht_rad = k
call stat_assign( var_index=iradht_rad, var_name="radht_rad", &
var_description="Total radiative heating rate [K/s]", var_units="K/s", &
l_silhs=.false., grid_kind=stats_rad_zt )
k = k + 1
case ('radht_LW_rad')
iradht_LW_rad = k
call stat_assign( var_index=iradht_LW_rad, var_name="radht_LW_rad", &
var_description="Long-wave radiative heating rate [K/s]", var_units="K/s", &
l_silhs=.false., grid_kind=stats_rad_zt )
k = k + 1
case ('radht_SW_rad')
iradht_SW_rad = k
call stat_assign( var_index=iradht_SW_rad, var_name="radht_SW_rad", &
var_description="Short-wave radiative heating rate [K/s]", var_units="K/s", &
l_silhs=.false., grid_kind=stats_rad_zt )
k = k + 1
case ('p_in_mb_rad')
ip_in_mb_rad = k
call stat_assign( var_index=ip_in_mb_rad, var_name="p_in_mb_rad", &
var_description="Pressure [hPa]", var_units="hPa", &
l_silhs=.false., grid_kind=stats_rad_zt )
k = k + 1
case ('sp_humidity_rad')
isp_humidity_rad = k
call stat_assign( var_index=isp_humidity_rad, var_name="sp_humidity_rad", &
var_description="Specific humidity [kg/kg]", var_units="kg/kg", &
l_silhs=.false., grid_kind=stats_rad_zt )
k = k + 1
case default
write(fstderr,*) 'Error: unrecognized variable in vars_rad_zt: ', trim( vars_rad_zt(i) )
l_error = .true. ! This will stop the run.
end select
end do
return
end subroutine stats_init_rad_zt
end module stats_rad_zt_module