On initialisation will set up data structures and field values.
100 type(model_state_type),
target,
intent(inout) :: current_state
105 if (.not. is_component_enabled(current_state%options_database,
"mean_profiles"))
then
109 dmptim=options_get_real(current_state%options_database,
"dmptim")
110 zdmp=options_get_real(current_state%options_database,
"zdmp")
111 hdmp=options_get_real(current_state%options_database,
"hdmp")
113 allocate(current_state%global_grid%configuration%vertical%dmpco(current_state%local_grid%size(z_index)), &
114 current_state%global_grid%configuration%vertical%dmpcoz(current_state%local_grid%size(z_index)))
115 current_state%global_grid%configuration%vertical%dmpco(:)=0.
116 current_state%global_grid%configuration%vertical%dmpcoz(:)=0.
117 do k=current_state%local_grid%size(z_index),1,-1
118 current_state%global_grid%configuration%vertical%kdmpmin=k
119 if (current_state%global_grid%configuration%vertical%zn(k) .ge. zdmp)
then
120 current_state%global_grid%configuration%vertical%dmpco(k)=dmptim*(exp((&
121 current_state%global_grid%configuration%vertical%zn(k)-zdmp)/hdmp)-1.0)
123 if (current_state%global_grid%configuration%vertical%z(k) .ge. zdmp)
then
124 current_state%global_grid%configuration%vertical%dmpcoz(k)=dmptim*(exp((&
125 current_state%global_grid%configuration%vertical%z(k)-zdmp)/hdmp)-1.0)
127 if(current_state%global_grid%configuration%vertical%zn(k).lt. zdmp)
exit
133 l_qdiag = (.not. current_state%passive_q .and. current_state%number_q_fields .gt. 0)
135 l_tend_pr_tot_u = current_state%u%active
136 l_tend_pr_tot_v = current_state%v%active
137 l_tend_pr_tot_w = current_state%w%active
138 l_tend_pr_tot_th = current_state%th%active
139 l_tend_pr_tot_qv = l_qdiag .and. current_state%number_q_fields .ge. 1
140 l_tend_pr_tot_ql = l_qdiag .and. current_state%number_q_fields .ge. 2
141 l_tend_pr_tot_qi = l_qdiag .and. current_state%number_q_fields .ge. 11
142 l_tend_pr_tot_qr = l_qdiag .and. current_state%number_q_fields .ge. 11
143 l_tend_pr_tot_qs = l_qdiag .and. current_state%number_q_fields .ge. 11
144 l_tend_pr_tot_qg = l_qdiag .and. current_state%number_q_fields .ge. 11
145 l_tend_pr_tot_tabs = l_tend_pr_tot_th
147 l_tend_3d_u = current_state%u%active .or. l_tend_pr_tot_u
148 l_tend_3d_v = current_state%v%active .or. l_tend_pr_tot_v
149 l_tend_3d_w = current_state%w%active .or. l_tend_pr_tot_w
150 l_tend_3d_th = current_state%th%active .or. l_tend_pr_tot_th
151 l_tend_3d_qv = (l_qdiag .and. current_state%number_q_fields .ge. 1) .or. l_tend_pr_tot_qv
152 l_tend_3d_ql = (l_qdiag .and. current_state%number_q_fields .ge. 2) .or. l_tend_pr_tot_ql
153 l_tend_3d_qi = (l_qdiag .and. current_state%number_q_fields .ge. 11) .or. l_tend_pr_tot_qi
154 l_tend_3d_qr = (l_qdiag .and. current_state%number_q_fields .ge. 11) .or. l_tend_pr_tot_qr
155 l_tend_3d_qs = (l_qdiag .and. current_state%number_q_fields .ge. 11) .or. l_tend_pr_tot_qs
156 l_tend_3d_qg = (l_qdiag .and. current_state%number_q_fields .ge. 11) .or. l_tend_pr_tot_qg
157 l_tend_3d_tabs = l_tend_3d_th
159 l_tend_pr_tot_tke = current_state%u%active .and. current_state%v%active .and. current_state%w%active
162 if (l_tend_3d_u)
then
163 allocate( tend_3d_u(current_state%local_grid%size(z_index), &
164 current_state%local_grid%size(y_index), &
165 current_state%local_grid%size(x_index) ) )
167 if (l_tend_3d_v)
then
168 allocate( tend_3d_v(current_state%local_grid%size(z_index), &
169 current_state%local_grid%size(y_index), &
170 current_state%local_grid%size(x_index) ) )
172 if (l_tend_3d_w)
then
173 allocate( tend_3d_w(current_state%local_grid%size(z_index), &
174 current_state%local_grid%size(y_index), &
175 current_state%local_grid%size(x_index) ) )
177 if (l_tend_3d_th)
then
178 allocate( tend_3d_th(current_state%local_grid%size(z_index), &
179 current_state%local_grid%size(y_index), &
180 current_state%local_grid%size(x_index) ) )
182 if (l_tend_3d_qv)
then
183 iqv=get_q_index(standard_q_names%VAPOUR,
'damping')
184 allocate( tend_3d_qv(current_state%local_grid%size(z_index), &
185 current_state%local_grid%size(y_index), &
186 current_state%local_grid%size(x_index) ) )
188 if (l_tend_3d_ql)
then
189 iql=get_q_index(standard_q_names%CLOUD_LIQUID_MASS,
'damping')
190 allocate( tend_3d_ql(current_state%local_grid%size(z_index), &
191 current_state%local_grid%size(y_index), &
192 current_state%local_grid%size(x_index) ) )
194 if (l_tend_3d_qi)
then
195 iqi=get_q_index(standard_q_names%ICE_MASS,
'damping')
196 allocate( tend_3d_qi(current_state%local_grid%size(z_index), &
197 current_state%local_grid%size(y_index), &
198 current_state%local_grid%size(x_index) ) )
200 if (l_tend_3d_qr)
then
201 iqr=get_q_index(standard_q_names%RAIN_MASS,
'damping')
202 allocate( tend_3d_qr(current_state%local_grid%size(z_index), &
203 current_state%local_grid%size(y_index), &
204 current_state%local_grid%size(x_index) ) )
206 if (l_tend_3d_qs)
then
207 iqs=get_q_index(standard_q_names%SNOW_MASS,
'damping')
208 allocate( tend_3d_qs(current_state%local_grid%size(z_index), &
209 current_state%local_grid%size(y_index), &
210 current_state%local_grid%size(x_index) ) )
212 if (l_tend_3d_qg)
then
213 iqg=get_q_index(standard_q_names%GRAUPEL_MASS,
'damping')
214 allocate( tend_3d_qg(current_state%local_grid%size(z_index), &
215 current_state%local_grid%size(y_index), &
216 current_state%local_grid%size(x_index) ) )
218 if (l_tend_3d_tabs)
then
219 allocate( tend_3d_tabs(current_state%local_grid%size(z_index), &
220 current_state%local_grid%size(y_index), &
221 current_state%local_grid%size(x_index) ) )
225 if (l_tend_pr_tot_u)
then
226 allocate( tend_pr_tot_u(current_state%local_grid%size(z_index)) )
228 if (l_tend_pr_tot_v)
then
229 allocate( tend_pr_tot_v(current_state%local_grid%size(z_index)) )
231 if (l_tend_pr_tot_w)
then
232 allocate( tend_pr_tot_w(current_state%local_grid%size(z_index)) )
234 if (l_tend_pr_tot_th)
then
235 allocate( tend_pr_tot_th(current_state%local_grid%size(z_index)) )
237 if (l_tend_pr_tot_qv)
then
238 allocate( tend_pr_tot_qv(current_state%local_grid%size(z_index)) )
240 if (l_tend_pr_tot_ql)
then
241 allocate( tend_pr_tot_ql(current_state%local_grid%size(z_index)) )
243 if (l_tend_pr_tot_qi)
then
244 allocate( tend_pr_tot_qi(current_state%local_grid%size(z_index)) )
246 if (l_tend_pr_tot_qr)
then
247 allocate( tend_pr_tot_qr(current_state%local_grid%size(z_index)) )
249 if (l_tend_pr_tot_qs)
then
250 allocate( tend_pr_tot_qs(current_state%local_grid%size(z_index)) )
252 if (l_tend_pr_tot_qg)
then
253 allocate( tend_pr_tot_qg(current_state%local_grid%size(z_index)) )
255 if (l_tend_pr_tot_tabs)
then
256 allocate( tend_pr_tot_tabs(current_state%local_grid%size(z_index)) )
260 if (l_tend_pr_tot_tke)
then
261 allocate( tend_pr_tot_tke(current_state%local_grid%size(z_index)) )
266 diagnostic_generation_frequency=options_get_integer(current_state%options_database,
"sampling_frequency")