76 type(model_state_type),
target,
intent(inout) :: current_state
77 character(len=*),
intent(in) :: name
78 type(component_field_information_type),
intent(out) :: field_information
82 strcomp=index(name,
"_pstep_3d_local")
83 if (strcomp .ne. 0)
then
84 field_information%field_type=component_array_field_type
85 field_information%number_dimensions=3
86 field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
87 field_information%dimension_sizes(2)=current_state%local_grid%size(y_index)
88 field_information%dimension_sizes(3)=current_state%local_grid%size(x_index)
89 field_information%data_type=component_double_data_type
91 if (name .eq.
"tend_u_pstep_3d_local")
then
93 else if (name .eq.
"tend_v_pstep_3d_local")
then
95 else if (name .eq.
"tend_w_pstep_3d_local")
then
98 field_information%enabled=.true.
104 strcomp=index(name,
"_pstep_profile_total_local")
105 if (strcomp .ne. 0)
then
106 field_information%field_type=component_array_field_type
107 field_information%number_dimensions=1
108 field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
109 field_information%data_type=component_double_data_type
111 if (name .eq.
"tend_u_pstep_profile_total_local")
then
113 else if (name .eq.
"tend_v_pstep_profile_total_local")
then
115 else if (name .eq.
"tend_w_pstep_profile_total_local")
then
118 field_information%enabled=.true.
124 strcomp=index(name,
"_total_3d_local")
125 if (strcomp .ne. 0)
then
126 field_information%field_type=component_array_field_type
127 field_information%number_dimensions=3
128 field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
129 field_information%dimension_sizes(2)=current_state%local_grid%size(y_index)
130 field_information%dimension_sizes(3)=current_state%local_grid%size(x_index)
131 field_information%data_type=component_double_data_type
133 if (name .eq.
"tend_u_total_3d_local")
then
135 else if (name .eq.
"tend_v_total_3d_local")
then
137 else if (name .eq.
"tend_w_total_3d_local")
then
140 field_information%enabled=.true.
146 strcomp=index(name,
"_total_profile_total_local")
147 if (strcomp .ne. 0)
then
148 field_information%field_type=component_array_field_type
149 field_information%number_dimensions=1
150 field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
151 field_information%data_type=component_double_data_type
153 if (name .eq.
"tend_u_total_profile_total_local")
then
155 else if (name .eq.
"tend_v_total_profile_total_local")
then
157 else if (name .eq.
"tend_w_total_profile_total_local")
then
160 field_information%enabled=.true.
173 type(model_state_type),
target,
intent(inout) :: current_state
174 character(len=*),
intent(in) :: name
175 type(component_field_value_type),
intent(out) :: field_value
178 if (name .eq.
"tend_u_pstep_3d_local" .and.
allocated(
tendp_3d_u))
then
180 else if (name .eq.
"tend_v_pstep_3d_local" .and.
allocated(
tendp_3d_v))
then
182 else if (name .eq.
"tend_w_pstep_3d_local" .and.
allocated(
tendp_3d_w))
then
186 else if (name .eq.
"tend_u_pstep_profile_total_local" .and.
allocated(
tendp_pr_tot_u))
then
188 else if (name .eq.
"tend_v_pstep_profile_total_local" .and.
allocated(
tendp_pr_tot_v))
then
190 else if (name .eq.
"tend_w_pstep_profile_total_local" .and.
allocated(
tendp_pr_tot_w))
then
194 else if (name .eq.
"tend_u_total_3d_local" .and.
allocated(
tend_3d_u))
then
196 else if (name .eq.
"tend_v_total_3d_local" .and.
allocated(
tend_3d_v))
then
198 else if (name .eq.
"tend_w_total_3d_local" .and.
allocated(
tend_3d_w))
then
202 else if (name .eq.
"tend_u_total_profile_total_local" .and.
allocated(
tend_pr_tot_u))
then
204 else if (name .eq.
"tend_v_total_profile_total_local" .and.
allocated(
tend_pr_tot_v))
then
206 else if (name .eq.
"tend_w_total_profile_total_local" .and.
allocated(
tend_pr_tot_w))
then
215 type(model_state_type),
target,
intent(inout) :: current_state
217 if (.not. is_component_enabled(current_state%options_database,
"diverr"))
then
218 call log_master_log(log_error,
"The pstep component requires the diverr component to be enabled")
238 allocate(
tendp_3d_u(current_state%local_grid%size(z_index), &
239 current_state%local_grid%size(y_index), &
240 current_state%local_grid%size(x_index) ) )
243 allocate(
tendp_3d_v(current_state%local_grid%size(z_index), &
244 current_state%local_grid%size(y_index), &
245 current_state%local_grid%size(x_index) ) )
248 allocate(
tendp_3d_w(current_state%local_grid%size(z_index), &
249 current_state%local_grid%size(y_index), &
250 current_state%local_grid%size(x_index) ) )
253 allocate(
tend_3d_u(current_state%local_grid%size(z_index), &
254 current_state%local_grid%size(y_index), &
255 current_state%local_grid%size(x_index) ) )
258 allocate(
tend_3d_v(current_state%local_grid%size(z_index), &
259 current_state%local_grid%size(y_index), &
260 current_state%local_grid%size(x_index) ) )
263 allocate(
tend_3d_w(current_state%local_grid%size(z_index), &
264 current_state%local_grid%size(y_index), &
265 current_state%local_grid%size(x_index) ) )
270 allocate(
tendp_pr_tot_u(current_state%local_grid%size(z_index)) )
273 allocate(
tendp_pr_tot_v(current_state%local_grid%size(z_index)) )
276 allocate(
tendp_pr_tot_w(current_state%local_grid%size(z_index)) )
279 allocate(
tend_pr_tot_u(current_state%local_grid%size(z_index)) )
282 allocate(
tend_pr_tot_v(current_state%local_grid%size(z_index)) )
285 allocate(
tend_pr_tot_w(current_state%local_grid%size(z_index)) )
295 type(model_state_type),
target,
intent(inout) :: current_state
316 type(model_state_type),
target,
intent(inout) :: current_state
317 integer :: local_y, local_x, target_x_index, target_y_index
319 local_y=current_state%column_local_y
320 local_x=current_state%column_local_x
321 target_y_index=local_y-current_state%local_grid%halo_size(y_index)
322 target_x_index=local_x-current_state%local_grid%halo_size(x_index)
325 if (current_state%first_timestep_column)
then
347 current_state%column_local_y, current_state%column_local_x)
365 type(model_state_type),
target,
intent(inout) :: current_state
367 integer :: k, x_index, y_index
368 real(kind=default_precision) :: dtmtmp
370 x_index=current_state%column_local_x
371 y_index=current_state%column_local_y
373 dtmtmp=merge(current_state%dtm, 0.5_default_precision*current_state%dtm, current_state%field_stepping == centred_stepping)
374 do k=2,current_state%local_grid%size(z_index)
377 current_state%zu%data(k, y_index, x_index)= current_state%zu%data(k, y_index, x_index)+ 2.0_default_precision*&
378 current_state%global_grid%configuration%horizontal%cx*dtmtmp*(current_state%p%data(k, y_index, x_index)-&
379 current_state%p%data(k, y_index, x_index+1))
382 current_state%zv%data(k, y_index, x_index)=&
383 current_state%zv%data(k, y_index, x_index)+2.0_default_precision*&
384 current_state%global_grid%configuration%horizontal%cy*dtmtmp*&
385 (current_state%p%data(k, y_index, x_index) - current_state%p%data(k, y_index+1, x_index))
388 if (k .lt. current_state%local_grid%size(z_index))
then
389 current_state%zw%data(k, y_index, x_index)=current_state%zw%data(k, y_index, x_index)+2.0_default_precision*&
390 current_state%global_grid%configuration%vertical%rdzn(k+1)*dtmtmp*(current_state%p%data(k, y_index, x_index)-&
391 current_state%p%data(k+1, y_index, x_index))
395 if (current_state%use_viscosity_and_diffusion .and. current_state%use_surface_boundary_conditions)
then
397 current_state%zu%data(1, y_index, x_index)=-current_state%zu%data(2, y_index, x_index)-&
398 2.0_default_precision*current_state%ugal
401 current_state%zv%data(1, y_index, x_index)=-current_state%zv%data(2, y_index, x_index)-&
402 2.0_default_precision*current_state%vgal
406 current_state%zu%data(1, y_index, x_index)=current_state%zu%data(2, y_index, x_index)
409 current_state%zv%data(1, y_index, x_index)=current_state%zv%data(2, y_index, x_index)
419 type(model_state_type),
target,
intent(inout) :: current_state
420 integer,
intent(in) :: y_index, x_index
424 do k=1,current_state%local_grid%size(z_index)
426 current_state%u%data(k, y_index, x_index)= current_state%u%data(k, y_index, x_index)-current_state%ugal
427 current_state%zu%data(k, y_index, x_index)= current_state%zu%data(k, y_index, x_index)-current_state%ugal
430 current_state%v%data(k, y_index, x_index)= current_state%v%data(k, y_index, x_index)-current_state%vgal
431 current_state%zv%data(k, y_index, x_index)= current_state%zv%data(k, y_index, x_index)-current_state%vgal
444 type(model_state_type),
target,
intent(in) :: current_state
445 integer,
intent(in) :: cxn, cyn, txn, tyn
449 tendp_3d_u(:,tyn,txn)=current_state%zu%data(:,cyn,cxn)
452 tendp_3d_v(:,tyn,txn)=current_state%zv%data(:,cyn,cxn)
455 tendp_3d_w(:,tyn,txn)=current_state%zw%data(:,cyn,cxn)
458 tend_3d_u(:,tyn,txn)=current_state%su%data(:,cyn,cxn)
461 tend_3d_v(:,tyn,txn)=current_state%sv%data(:,cyn,cxn)
464 tend_3d_w(:,tyn,txn)=current_state%sw%data(:,cyn,cxn)
477 type(model_state_type),
target,
intent(inout) :: current_state
478 integer,
intent(in) :: cxn, cyn, txn, tyn
479 real(kind=default_precision) :: dtmtmp
481 dtmtmp=2.0_default_precision* &
482 merge(current_state%dtm, 0.5_default_precision*current_state%dtm, current_state%field_stepping == centred_stepping)
532 type(component_field_value_type),
intent(inout) :: field_value
533 real(kind=default_precision),
dimension(:),
optional :: real_1d_field
534 real(kind=default_precision),
dimension(:,:),
optional :: real_2d_field
535 real(kind=default_precision),
dimension(:,:,:),
optional :: real_3d_field
537 if (
present(real_1d_field))
then
538 allocate(field_value%real_1d_array(
size(real_1d_field)), source=real_1d_field)
539 else if (
present(real_2d_field))
then
540 allocate(field_value%real_2d_array(
size(real_2d_field, 1),
size(real_2d_field, 2)), source=real_2d_field)
541 else if (
present(real_3d_field))
then
542 allocate(field_value%real_3d_array(
size(real_3d_field, 1),
size(real_3d_field, 2),
size(real_3d_field, 3)), &
543 source=real_3d_field)