Calculates the initial profiles for U, V, TH & Q if required.
165 type(model_state_type),
intent(inout) :: current_state
166 type(vertical_grid_configuration_type),
intent(inout) :: vertical_grid
185 logical :: l_init_pl_u
186 logical :: l_init_pl_v
187 logical :: l_init_pl_theta
188 logical :: l_init_pl_rh
189 logical :: l_init_pl_q
191 logical :: l_matchthref
193 character(len=STRING_LENGTH),
dimension(:),
allocatable :: names_init_pl_q
201 allocate(zgrid(current_state%local_grid%local_domain_end_index(z_index)))
203 zztop = current_state%global_grid%top(z_index)
206 vertical_grid%q_init = 0.0_default_precision
207 vertical_grid%u_init = 0.0_default_precision
208 vertical_grid%v_init = 0.0_default_precision
209 vertical_grid%theta_init = 0.0_default_precision
211 l_init_pl_theta=options_get_logical(current_state%options_database,
"l_init_pl_theta")
212 l_init_pl_rh=options_get_logical(current_state%options_database,
"l_init_pl_rh")
213 l_init_pl_q=options_get_logical(current_state%options_database,
"l_init_pl_q")
214 if (l_init_pl_q)
then
215 allocate(names_init_pl_q(options_get_array_size(current_state%options_database,
"names_init_pl_q")))
216 call options_get_string_array(current_state%options_database,
"names_init_pl_q", names_init_pl_q)
217 do n = 1,
size(names_init_pl_q)
218 if (trim(names_init_pl_q(n)) .eq.
'vapour' .and. l_init_pl_rh)
then
223 l_init_pl_u=options_get_logical(current_state%options_database,
"l_init_pl_u")
224 l_init_pl_v=options_get_logical(current_state%options_database,
"l_init_pl_v")
226 l_thref=options_get_logical(current_state%options_database,
"l_thref")
227 l_matchthref=options_get_logical(current_state%options_database,
"l_matchthref")
230 if (.not. l_matchthref)
then
231 allocate(z_thref(options_get_array_size(current_state%options_database,
"z_thref")), &
232 f_thref(options_get_array_size(current_state%options_database,
"f_thref")))
233 call options_get_real_array(current_state%options_database,
"z_thref", z_thref)
234 call options_get_real_array(current_state%options_database,
"f_thref", f_thref)
235 call check_top(zztop, z_thref(
size(z_thref)),
'z_thref')
236 zgrid=current_state%global_grid%configuration%vertical%zn(:)
237 call piecewise_linear_1d(z_thref(1:
size(z_thref)), f_thref(1:
size(f_thref)), zgrid, &
238 current_state%global_grid%configuration%vertical%thref)
239 deallocate(z_thref, f_thref)
242 current_state%global_grid%configuration%vertical%thref(:)=current_state%thref0
245 if (l_init_pl_theta)
then
246 allocate(z_init_pl_theta(options_get_array_size(current_state%options_database,
"z_init_pl_theta")), &
247 f_init_pl_theta(options_get_array_size(current_state%options_database,
"f_init_pl_theta")))
248 call options_get_real_array(current_state%options_database,
"z_init_pl_theta", z_init_pl_theta)
249 call options_get_real_array(current_state%options_database,
"f_init_pl_theta", f_init_pl_theta)
250 call check_top(zztop, z_init_pl_theta(
size(z_init_pl_theta)),
'z_init_pl_theta')
251 call check_input_levels(
size(z_init_pl_theta),
size(f_init_pl_theta),
"f_init_pl_theta")
252 zgrid=current_state%global_grid%configuration%vertical%zn(:)
253 call piecewise_linear_1d(z_init_pl_theta(1:
size(z_init_pl_theta)), f_init_pl_theta(1:
size(f_init_pl_theta)), zgrid, &
254 current_state%global_grid%configuration%vertical%theta_init)
255 if (l_matchthref)
then
256 if(.not. current_state%use_anelastic_equations)
then
259 current_state%global_grid%configuration%vertical%thref = current_state%global_grid%configuration%vertical%theta_init
261 if (.not. current_state%continuation_run)
then
262 do i=current_state%local_grid%local_domain_start_index(x_index), current_state%local_grid%local_domain_end_index(x_index)
263 do j=current_state%local_grid%local_domain_start_index(y_index), current_state%local_grid%local_domain_end_index(y_index)
264 current_state%th%data(:,j,i) = current_state%global_grid%configuration%vertical%theta_init(:) - &
265 current_state%global_grid%configuration%vertical%thref(:)
269 deallocate(z_init_pl_theta, f_init_pl_theta)
273 allocate(z_init_pl_u(options_get_array_size(current_state%options_database,
"z_init_pl_u")), &
274 f_init_pl_u(options_get_array_size(current_state%options_database,
"f_init_pl_u")))
275 call options_get_real_array(current_state%options_database,
"z_init_pl_u", z_init_pl_u)
276 call options_get_real_array(current_state%options_database,
"f_init_pl_u", f_init_pl_u)
277 call check_top(zztop, z_init_pl_u(
size(z_init_pl_u)),
'z_init_pl_u')
278 call check_input_levels(
size(z_init_pl_u),
size(f_init_pl_u),
"f_init_pl_u")
279 zgrid=current_state%global_grid%configuration%vertical%zn(:)
280 call piecewise_linear_1d(z_init_pl_u(1:
size(z_init_pl_u)), f_init_pl_u(1:
size(f_init_pl_u)), &
281 zgrid, current_state%global_grid%configuration%vertical%u_init)
282 if (.not. current_state%continuation_run)
then
283 do i=current_state%local_grid%local_domain_start_index(x_index), current_state%local_grid%local_domain_end_index(x_index)
284 do j=current_state%local_grid%local_domain_start_index(y_index), current_state%local_grid%local_domain_end_index(y_index)
285 current_state%u%data(:,j,i) = current_state%global_grid%configuration%vertical%u_init(:)
289 deallocate(z_init_pl_u, f_init_pl_u)
293 allocate(z_init_pl_v(options_get_array_size(current_state%options_database,
"z_init_pl_v")), &
294 f_init_pl_v(options_get_array_size(current_state%options_database,
"f_init_pl_v")))
295 call options_get_real_array(current_state%options_database,
"z_init_pl_v", z_init_pl_v)
296 call options_get_real_array(current_state%options_database,
"f_init_pl_v", f_init_pl_v)
297 call check_top(zztop, z_init_pl_v(
size(z_init_pl_v)),
'z_init_pl_v')
298 call check_input_levels(
size(z_init_pl_v),
size(f_init_pl_v),
"f_init_pl_v")
299 zgrid=current_state%global_grid%configuration%vertical%zn(:)
300 call piecewise_linear_1d(z_init_pl_v(1:
size(z_init_pl_v)), f_init_pl_v(1:
size(f_init_pl_v)), &
301 zgrid, current_state%global_grid%configuration%vertical%v_init)
302 if (.not. current_state%continuation_run)
then
303 do i=current_state%local_grid%local_domain_start_index(x_index), current_state%local_grid%local_domain_end_index(x_index)
304 do j=current_state%local_grid%local_domain_start_index(y_index), current_state%local_grid%local_domain_end_index(y_index)
305 current_state%v%data(:,j,i) = current_state%global_grid%configuration%vertical%v_init(:)
309 deallocate(z_init_pl_v, f_init_pl_v)
313 nq_init=
size(names_init_pl_q)
314 allocate(z_init_pl_q(options_get_array_size(current_state%options_database,
"z_init_pl_q")))
315 call options_get_real_array(current_state%options_database,
"z_init_pl_q", z_init_pl_q)
316 nzq=
size(z_init_pl_q)
317 call check_top(zztop, z_init_pl_q(nzq),
'z_init_pl_q')
318 zgrid=current_state%global_grid%configuration%vertical%zn(:)
319 allocate(f_init_pl_q_tmp(nq_init*nzq))
320 call options_get_real_array(current_state%options_database,
"f_init_pl_q", f_init_pl_q_tmp)
322 allocate(f_init_pl_q(nzq, nq_init))
323 f_init_pl_q(1:nzq, 1:nq_init)=reshape(f_init_pl_q_tmp, (/nzq, nq_init/))
325 iq=get_q_index(trim(names_init_pl_q(n)),
'piecewise_initialization')
326 call check_input_levels(
size(z_init_pl_q),
size(f_init_pl_q(1:nzq,n)),
"f_init_pl_q")
327 call piecewise_linear_1d(z_init_pl_q(1:nzq), f_init_pl_q(1:nzq,n), zgrid, &
328 current_state%global_grid%configuration%vertical%q_init(:,iq))
329 if (.not. current_state%continuation_run)
then
330 do i=current_state%local_grid%local_domain_start_index(x_index), &
331 current_state%local_grid%local_domain_end_index(x_index)
332 do j=current_state%local_grid%local_domain_start_index(y_index), &
333 current_state%local_grid%local_domain_end_index(y_index)
334 current_state%q(iq)%data(:,j,i) = current_state%global_grid%configuration%vertical%q_init(:, iq)
339 deallocate(f_init_pl_q_tmp, z_init_pl_q, f_init_pl_q, names_init_pl_q)