14 use mpi,
only : mpi_request_null, mpi_status_ignore
109 type(model_state_type),
target,
intent(inout) :: current_state
110 character(len=*),
intent(in) :: name
111 type(component_field_information_type),
intent(out) :: field_information
115 field_information%field_type=component_array_field_type
116 field_information%data_type=component_double_data_type
117 if (name .eq.
"q_advection")
then
118 field_information%number_dimensions=2
120 field_information%number_dimensions=1
122 field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
123 if (name .eq.
"q_advection") field_information%dimension_sizes(2)=current_state%number_q_fields
124 field_information%enabled=.true.
127 strcomp=index(name,
"tvdadvection_3d_local")
128 if (strcomp .ne. 0)
then
129 field_information%field_type=component_array_field_type
130 field_information%number_dimensions=3
131 field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
132 field_information%dimension_sizes(2)=current_state%local_grid%size(y_index)
133 field_information%dimension_sizes(3)=current_state%local_grid%size(x_index)
134 field_information%data_type=component_double_data_type
136 if (name .eq.
"tend_u_tvdadvection_3d_local")
then
138 else if (name .eq.
"tend_v_tvdadvection_3d_local")
then
140 else if (name .eq.
"tend_w_tvdadvection_3d_local")
then
142 else if (name .eq.
"tend_th_tvdadvection_3d_local")
then
144 else if (name .eq.
"tend_qv_tvdadvection_3d_local")
then
146 else if (name .eq.
"tend_ql_tvdadvection_3d_local")
then
148 else if (name .eq.
"tend_qi_tvdadvection_3d_local")
then
150 else if (name .eq.
"tend_qr_tvdadvection_3d_local")
then
152 else if (name .eq.
"tend_qs_tvdadvection_3d_local")
then
154 else if (name .eq.
"tend_qg_tvdadvection_3d_local")
then
156 else if (name .eq.
"tend_tabs_tvdadvection_3d_local")
then
159 field_information%enabled=.true.
165 strcomp=index(name,
"tvdadvection_profile_total_local")
166 if (strcomp .ne. 0)
then
167 field_information%field_type=component_array_field_type
168 field_information%number_dimensions=1
169 field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
170 field_information%data_type=component_double_data_type
172 if (name .eq.
"tend_u_tvdadvection_profile_total_local")
then
174 else if (name .eq.
"tend_v_tvdadvection_profile_total_local")
then
176 else if (name .eq.
"tend_w_tvdadvection_profile_total_local")
then
178 else if (name .eq.
"tend_th_tvdadvection_profile_total_local")
then
180 else if (name .eq.
"tend_qv_tvdadvection_profile_total_local")
then
182 else if (name .eq.
"tend_ql_tvdadvection_profile_total_local")
then
184 else if (name .eq.
"tend_qi_tvdadvection_profile_total_local")
then
186 else if (name .eq.
"tend_qr_tvdadvection_profile_total_local")
then
188 else if (name .eq.
"tend_qs_tvdadvection_profile_total_local")
then
190 else if (name .eq.
"tend_qg_tvdadvection_profile_total_local")
then
192 else if (name .eq.
"tend_tabs_tvdadvection_profile_total_local")
then
195 field_information%enabled=.true.
208 type(model_state_type),
target,
intent(inout) :: current_state
209 character(len=*),
intent(in) :: name
210 type(component_field_value_type),
intent(out) :: field_value
212 if (name .eq.
"u_advection")
then
214 else if (name .eq.
"v_advection")
then
216 else if (name .eq.
"w_advection")
then
218 else if (name .eq.
"th_advection")
then
220 else if (name .eq.
"q_advection")
then
225 if (name .eq.
"tend_u_tvdadvection_3d_local" .and.
allocated(
tend_3d_u))
then
227 else if (name .eq.
"tend_v_tvdadvection_3d_local" .and.
allocated(
tend_3d_v))
then
229 else if (name .eq.
"tend_w_tvdadvection_3d_local" .and.
allocated(
tend_3d_w))
then
231 else if (name .eq.
"tend_th_tvdadvection_3d_local" .and.
allocated(
tend_3d_th))
then
233 else if (name .eq.
"tend_qv_tvdadvection_3d_local" .and.
allocated(
tend_3d_qv))
then
235 else if (name .eq.
"tend_ql_tvdadvection_3d_local" .and.
allocated(
tend_3d_ql))
then
237 else if (name .eq.
"tend_qi_tvdadvection_3d_local" .and.
allocated(
tend_3d_qi))
then
239 else if (name .eq.
"tend_qr_tvdadvection_3d_local" .and.
allocated(
tend_3d_qr))
then
241 else if (name .eq.
"tend_qs_tvdadvection_3d_local" .and.
allocated(
tend_3d_qs))
then
243 else if (name .eq.
"tend_qg_tvdadvection_3d_local" .and.
allocated(
tend_3d_qg))
then
245 else if (name .eq.
"tend_tabs_tvdadvection_3d_local" .and.
allocated(
tend_3d_tabs))
then
249 else if (name .eq.
"tend_u_tvdadvection_profile_total_local" .and.
allocated(
tend_pr_tot_u))
then
251 else if (name .eq.
"tend_v_tvdadvection_profile_total_local" .and.
allocated(
tend_pr_tot_v))
then
253 else if (name .eq.
"tend_w_tvdadvection_profile_total_local" .and.
allocated(
tend_pr_tot_w))
then
255 else if (name .eq.
"tend_th_tvdadvection_profile_total_local" .and.
allocated(
tend_pr_tot_th))
then
257 else if (name .eq.
"tend_qv_tvdadvection_profile_total_local" .and.
allocated(
tend_pr_tot_qv))
then
259 else if (name .eq.
"tend_ql_tvdadvection_profile_total_local" .and.
allocated(
tend_pr_tot_ql))
then
261 else if (name .eq.
"tend_qi_tvdadvection_profile_total_local" .and.
allocated(
tend_pr_tot_qi))
then
263 else if (name .eq.
"tend_qr_tvdadvection_profile_total_local" .and.
allocated(
tend_pr_tot_qr))
then
265 else if (name .eq.
"tend_qs_tvdadvection_profile_total_local" .and.
allocated(
tend_pr_tot_qs))
then
267 else if (name .eq.
"tend_qg_tvdadvection_profile_total_local" .and.
allocated(
tend_pr_tot_qg))
then
269 else if (name .eq.
"tend_tabs_tvdadvection_profile_total_local" .and.
allocated(
tend_pr_tot_tabs))
then
278 type(model_state_type),
target,
intent(inout) :: current_state
281 type(prognostic_field_ptr_type),
dimension(3) :: fields
282 integer,
dimension(3, 2) :: sizes
283 integer :: num_fields
284 logical :: xdim, ydim
291 num_fields = num_fields + 1
292 fields(num_fields)%ptr => current_state%u
293 sizes(num_fields,:) = (/ 2, 2 /)
299 num_fields = num_fields + 1
300 fields(num_fields)%ptr => current_state%v
301 sizes(num_fields,:) = (/ 1, 1 /)
306 num_fields = num_fields + 1
307 fields(num_fields)%ptr => current_state%w
308 sizes(num_fields,:) = (/ 1, 1 /)
326 star_stencil = create_stencil(current_state%local_grid, fields, num_fields, 3, sizes, xdim, ydim)
327 allocate(
flux_y(current_state%global_grid%size(z_index)))
328 allocate(
flux_z(current_state%global_grid%size(z_index)))
329 allocate(
flux_x(current_state%global_grid%size(z_index)))
330 allocate(
u_advection(current_state%global_grid%size(z_index)),
v_advection(current_state%global_grid%size(z_index)), &
332 q_advection(current_state%global_grid%size(z_index), current_state%number_q_fields))
341 l_qdiag = (.not. current_state%passive_q .and. current_state%number_q_fields .gt. 0) .and.
advect_q
370 allocate(
tend_3d_u(current_state%local_grid%size(z_index), &
371 current_state%local_grid%size(y_index), &
372 current_state%local_grid%size(x_index) ) )
375 allocate(
tend_3d_v(current_state%local_grid%size(z_index), &
376 current_state%local_grid%size(y_index), &
377 current_state%local_grid%size(x_index) ) )
380 allocate(
tend_3d_w(current_state%local_grid%size(z_index), &
381 current_state%local_grid%size(y_index), &
382 current_state%local_grid%size(x_index) ) )
385 allocate(
tend_3d_th(current_state%local_grid%size(z_index), &
386 current_state%local_grid%size(y_index), &
387 current_state%local_grid%size(x_index) ) )
390 iqv=get_q_index(standard_q_names%VAPOUR,
'tvd_advection')
391 allocate(
tend_3d_qv(current_state%local_grid%size(z_index), &
392 current_state%local_grid%size(y_index), &
393 current_state%local_grid%size(x_index) ) )
396 iql=get_q_index(standard_q_names%CLOUD_LIQUID_MASS,
'tvd_advection')
397 allocate(
tend_3d_ql(current_state%local_grid%size(z_index), &
398 current_state%local_grid%size(y_index), &
399 current_state%local_grid%size(x_index) ) )
402 iqi=get_q_index(standard_q_names%ICE_MASS,
'tvd_advection')
403 allocate(
tend_3d_qi(current_state%local_grid%size(z_index), &
404 current_state%local_grid%size(y_index), &
405 current_state%local_grid%size(x_index) ) )
408 iqr=get_q_index(standard_q_names%RAIN_MASS,
'tvd_advection')
409 allocate(
tend_3d_qr(current_state%local_grid%size(z_index), &
410 current_state%local_grid%size(y_index), &
411 current_state%local_grid%size(x_index) ) )
414 iqs=get_q_index(standard_q_names%SNOW_MASS,
'tvd_advection')
415 allocate(
tend_3d_qs(current_state%local_grid%size(z_index), &
416 current_state%local_grid%size(y_index), &
417 current_state%local_grid%size(x_index) ) )
420 iqg=get_q_index(standard_q_names%GRAUPEL_MASS,
'tvd_advection')
421 allocate(
tend_3d_qg(current_state%local_grid%size(z_index), &
422 current_state%local_grid%size(y_index), &
423 current_state%local_grid%size(x_index) ) )
426 allocate(
tend_3d_tabs(current_state%local_grid%size(z_index), &
427 current_state%local_grid%size(y_index), &
428 current_state%local_grid%size(x_index) ) )
432 allocate(
tend_pr_tot_u(current_state%local_grid%size(z_index)) )
435 allocate(
tend_pr_tot_v(current_state%local_grid%size(z_index)) )
438 allocate(
tend_pr_tot_w(current_state%local_grid%size(z_index)) )
441 allocate(
tend_pr_tot_th(current_state%local_grid%size(z_index)) )
444 allocate(
tend_pr_tot_qv(current_state%local_grid%size(z_index)) )
447 allocate(
tend_pr_tot_ql(current_state%local_grid%size(z_index)) )
450 allocate(
tend_pr_tot_qi(current_state%local_grid%size(z_index)) )
453 allocate(
tend_pr_tot_qr(current_state%local_grid%size(z_index)) )
456 allocate(
tend_pr_tot_qs(current_state%local_grid%size(z_index)) )
459 allocate(
tend_pr_tot_qg(current_state%local_grid%size(z_index)) )
473 type(model_state_type),
target,
intent(inout) :: current_state
515 type(model_state_type),
target,
intent(inout) :: current_state
516 integer :: current_x_index, current_y_index, target_x_index, target_y_index
518 current_x_index=current_state%column_local_x
519 current_y_index=current_state%column_local_y
520 target_y_index=current_y_index-current_state%local_grid%halo_size(y_index)
521 target_x_index=current_x_index-current_state%local_grid%halo_size(x_index)
524 if (current_state%first_timestep_column)
then
561 if (current_state%halo_column)
then
562 if (.not. ((current_state%column_local_y == current_state%local_grid%halo_size(y_index) .and. &
563 current_state%column_local_x .le. current_state%local_grid%local_domain_end_index(x_index) .and. &
564 current_state%column_local_x .ge. current_state%local_grid%local_domain_start_index(x_index)-1) .or. &
565 (current_state%column_local_x == current_state%local_grid%halo_size(x_index) .and. &
566 current_state%column_local_y .ge. current_state%local_grid%local_domain_start_index(y_index) &
567 .and. current_state%column_local_y .le. current_state%local_grid%local_domain_end_index(y_index)) ))
return
587 type(model_state_type),
intent(inout) :: current_state
589 real(kind=default_precision) :: dtm
591 dtm = current_state%dtm*2.0_default_precision
592 if (current_state%momentum_stepping == forward_stepping) dtm=current_state%dtm
595 call advect_u(current_state%column_local_y, current_state%column_local_x, dtm, current_state%u, &
596 current_state%v, current_state%w, current_state%zu, current_state%su, current_state%global_grid, &
597 current_state%local_grid, current_state%parallel, current_state%halo_column, current_state%field_stepping)
598 if (is_component_enabled(current_state%options_database,
"profile_diagnostics"))
then
601 tvd_dgs_terms%adv_u_dgs(:, current_state%column_local_y, current_state%column_local_x) = &
607 call advect_v(current_state%column_local_y, current_state%column_local_x, dtm, current_state%u, &
608 current_state%v, current_state%w, current_state%zv, current_state%sv, current_state%global_grid, &
609 current_state%local_grid, current_state%parallel, current_state%halo_column, current_state%field_stepping)
610 if (is_component_enabled(current_state%options_database,
"profile_diagnostics"))
then
613 tvd_dgs_terms%adv_v_dgs(:, current_state%column_local_y, current_state%column_local_x) = &
619 call advect_w(current_state%column_local_y, current_state%column_local_x, dtm, current_state%u, &
620 current_state%v, current_state%w, current_state%zw, current_state%sw, current_state%global_grid,&
621 current_state%local_grid, current_state%parallel, current_state%halo_column, current_state%field_stepping)
622 if (is_component_enabled(current_state%options_database,
"profile_diagnostics"))
then
625 tvd_dgs_terms%adv_w_dgs(:, current_state%column_local_y, current_state%column_local_x) = &
634 type(model_state_type),
intent(inout) :: current_state
637 real(kind=default_precision) :: dtm
639 dtm = current_state%dtm*2.0_default_precision
640 if (current_state%scalar_stepping == forward_stepping) dtm=current_state%dtm
642 do i=1,current_state%number_q_fields
643 if (current_state%q(i)%active)
then
644 call advect_scalar_field(current_state%column_local_y, current_state%column_local_x, dtm, current_state%u, &
645 current_state%v, current_state%w, current_state%zq(i), current_state%q(i), current_state%sq(i), &
646 current_state%global_grid, current_state%local_grid, current_state%parallel, &
647 current_state%halo_column, current_state%field_stepping)
648 q_advection(:,i)=current_state%sq(i)%data(:, current_state%column_local_y, current_state%column_local_x)
649 if (is_component_enabled(current_state%options_database,
"profile_diagnostics"))
then
652 tvd_dgs_terms%adv_q_dgs(:, current_state%column_local_y, current_state%column_local_x, i) = &
663 type(model_state_type),
intent(inout) :: current_state
665 real(kind=default_precision) :: dtm
667 dtm = current_state%dtm*2.0_default_precision
668 if (current_state%scalar_stepping == forward_stepping) dtm=current_state%dtm
670 if (current_state%th%active)
then
671 call advect_scalar_field(current_state%column_local_y, current_state%column_local_x, dtm, current_state%u,&
672 current_state%v, current_state%w, current_state%zth, current_state%th, current_state%sth, current_state%global_grid,&
673 current_state%local_grid, current_state%parallel, current_state%halo_column, current_state%field_stepping)
674 th_advection=current_state%sth%data(:, current_state%column_local_y, current_state%column_local_x)
675 if (is_component_enabled(current_state%options_database,
"profile_diagnostics"))
then
678 tvd_dgs_terms%adv_th_dgs(:, current_state%column_local_y, current_state%column_local_x) = &
685 subroutine advect_scalar_field(y_local_index, x_local_index, dt, u, v, w, z_q_field, q_field, source_field, &
686 global_grid, local_grid, parallel, halo_column, field_stepping)
688 integer,
intent(in) ::y_local_index, x_local_index, field_stepping
689 real(kind=default_precision),
intent(in) ::dt
690 logical,
intent(in) :: halo_column
691 type(prognostic_field_type),
intent(inout) :: u, w, v, z_q_field, q_field, source_field
692 type(global_grid_type),
intent(inout) :: global_grid
693 type(local_grid_type),
intent(inout) :: local_grid
694 type(parallel_state_type),
intent(inout) :: parallel
696 if (.not.
allocated(q_field%flux_previous_x))
allocate(q_field%flux_previous_x(local_grid%size(z_index), &
697 local_grid%size(y_index)+4))
698 if (.not.
allocated(q_field%flux_previous_y))
allocate(q_field%flux_previous_y(local_grid%size(z_index)))
702 if (field_stepping == forward_stepping)
then
703 call ultflx(y_local_index, x_local_index, u, v, w, y_local_index, x_local_index, q_field, local_grid, &
704 global_grid%configuration, parallel, 0, dt, &
705 flux_y,
flux_z,
flux_x, q_field%flux_previous_x(:,y_local_index), global_grid%configuration%vertical%rdz,&
706 global_grid%configuration%vertical%rdzn, global_grid%configuration%vertical%dzn, 2, local_grid%size(z_index))
708 call ultflx(y_local_index, x_local_index, u, v, w, y_local_index, x_local_index, z_q_field, local_grid, &
709 global_grid%configuration, parallel, 0, dt, &
710 flux_y,
flux_z,
flux_x, q_field%flux_previous_x(:,y_local_index), global_grid%configuration%vertical%rdz,&
711 global_grid%configuration%vertical%rdzn, global_grid%configuration%vertical%dzn, 2, local_grid%size(z_index))
716 if (.not. halo_column)
then
718 local_grid, global_grid, q_field%flux_previous_y, q_field%flux_previous_x(:,y_local_index), &
719 global_grid%configuration%vertical%tzc1, global_grid%configuration%vertical%tzc2, .true.)
722 if (y_local_index .lt. local_grid%local_domain_end_index(y_index)) q_field%flux_previous_y(:) =
flux_y(:)
728 subroutine advect_u(y_local_index, x_local_index, dt, u, v, w, zf, su, global_grid, local_grid, parallel, &
729 halo_column, field_stepping)
731 integer,
intent(in) :: y_local_index, x_local_index, field_stepping
732 real(kind=default_precision),
intent(in) ::dt
733 logical,
intent(in) :: halo_column
734 type(prognostic_field_type),
intent(inout) :: u, w, v, zf, su
735 type(global_grid_type),
intent(inout) :: global_grid
736 type(local_grid_type),
intent(inout) :: local_grid
737 type(parallel_state_type),
intent(inout) :: parallel
739 if (.not.
allocated(u%flux_previous_x))
allocate(u%flux_previous_x(local_grid%size(z_index), local_grid%size(y_index)+4))
740 if (.not.
allocated(u%flux_previous_y))
allocate(u%flux_previous_y(local_grid%size(z_index)))
746 if (field_stepping == forward_stepping)
then
750 u%flux_previous_x(:,y_local_index), global_grid%configuration%vertical%rdz, &
751 global_grid%configuration%vertical%rdzn, global_grid%configuration%vertical%dzn, 2, local_grid%size(z_index))
757 u%flux_previous_x(:,y_local_index), global_grid%configuration%vertical%rdz, &
758 global_grid%configuration%vertical%rdzn, global_grid%configuration%vertical%dzn, 2, local_grid%size(z_index))
763 if (.not. halo_column)
then
766 u%flux_previous_y, u%flux_previous_x(:,y_local_index), &
767 global_grid%configuration%vertical%tzc1, global_grid%configuration%vertical%tzc2, .true.)
768 u_advection=su%data(:, y_local_index, x_local_index)
771 if (y_local_index .lt. local_grid%local_domain_end_index(y_index)) u%flux_previous_y(:) =
flux_y(:)
777 subroutine advect_v(y_local_index, x_local_index, dt, u, v, w, zf, sv, global_grid, local_grid, parallel, &
778 halo_column, field_stepping)
780 integer,
intent(in) ::y_local_index, x_local_index, field_stepping
781 real(kind=default_precision),
intent(in) ::dt
782 logical,
intent(in) :: halo_column
783 type(prognostic_field_type),
intent(inout) :: u, w, v, zf, sv
784 type(global_grid_type),
intent(inout) :: global_grid
785 type(local_grid_type),
intent(inout) :: local_grid
786 type(parallel_state_type),
intent(inout) :: parallel
788 if (.not.
allocated(v%flux_previous_x))
allocate(v%flux_previous_x(local_grid%size(z_index), local_grid%size(y_index)+4))
789 if (.not.
allocated(v%flux_previous_y))
allocate(v%flux_previous_y(local_grid%size(z_index)))
795 if (field_stepping == forward_stepping)
then
799 v%flux_previous_x(:,y_local_index), global_grid%configuration%vertical%rdz, &
800 global_grid%configuration%vertical%rdzn, global_grid%configuration%vertical%dzn, 2, local_grid%size(z_index))
806 v%flux_previous_x(:,y_local_index), global_grid%configuration%vertical%rdz, &
807 global_grid%configuration%vertical%rdzn, global_grid%configuration%vertical%dzn, 2, local_grid%size(z_index))
812 if (.not. halo_column)
then
815 v%flux_previous_y, v%flux_previous_x(:,y_local_index), &
816 global_grid%configuration%vertical%tzc1, global_grid%configuration%vertical%tzc2, .true.)
817 v_advection=sv%data(:, y_local_index, x_local_index)
820 if (y_local_index .lt. local_grid%local_domain_end_index(y_index)) v%flux_previous_y(:) =
flux_y(:)
826 subroutine advect_w(y_local_index, x_local_index, dt, u, v, w, zf, sw, global_grid, local_grid, parallel, &
827 halo_column, field_stepping)
829 integer,
intent(in) ::y_local_index, x_local_index, field_stepping
830 real(kind=default_precision),
intent(in) ::dt
831 logical,
intent(in) :: halo_column
832 type(prognostic_field_type),
intent(inout) :: u, w, v, zf, sw
833 type(global_grid_type),
intent(inout) :: global_grid
834 type(local_grid_type),
intent(inout) :: local_grid
835 type(parallel_state_type),
intent(inout) :: parallel
837 if (.not.
allocated(w%flux_previous_x))
allocate(w%flux_previous_x(local_grid%size(z_index), local_grid%size(y_index)+4))
838 if (.not.
allocated(w%flux_previous_y))
allocate(w%flux_previous_y(local_grid%size(z_index)))
844 if (field_stepping == forward_stepping)
then
848 w%flux_previous_x(:,y_local_index), global_grid%configuration%vertical%rdzn, &
849 global_grid%configuration%vertical%rdz, global_grid%configuration%vertical%dz, 1, local_grid%size(z_index)-1)
855 w%flux_previous_x(:,y_local_index), global_grid%configuration%vertical%rdzn, &
856 global_grid%configuration%vertical%rdz, global_grid%configuration%vertical%dz, 1, local_grid%size(z_index)-1)
861 if (.not. halo_column)
then
864 w%flux_previous_y, w%flux_previous_x(:,y_local_index),&
865 global_grid%configuration%vertical%tzd1, global_grid%configuration%vertical%tzd2, .false.)
866 w_advection=sw%data(:, y_local_index, x_local_index)
868 if (y_local_index .lt. local_grid%local_domain_end_index(y_index)) w%flux_previous_y(:) =
flux_y(:)
875 local_grid, global_grid, flux_y_previous, flux_x_previous, tzc1, tzc2, differentiate_top)
877 integer,
intent(in) :: y_flow_index, x_flow_index, y_source_index, x_source_index
878 logical,
intent(in) :: differentiate_top
879 real(kind=default_precision),
intent(in),
dimension(*) :: tzc1, tzc2
880 type(prognostic_field_type),
intent(inout) :: u, w, v
881 type(prognostic_field_type),
intent(inout) :: source_field
882 type(global_grid_type),
intent(inout) :: global_grid
883 type(local_grid_type),
intent(inout) :: local_grid
884 real(kind=default_precision),
intent(in),
dimension(:) :: flux_y_previous, flux_x_previous
888 do k=2,local_grid%size(z_index)-1
890 source_field%data(k, y_source_index, x_source_index)=source_field%data(k, y_source_index, x_source_index)+&
891 (v%data(k, y_flow_index-1, x_flow_index)* flux_y_previous(k) - v%data(k, y_flow_index, x_flow_index)*
flux_y(k))*&
892 global_grid%configuration%horizontal%cy
895 source_field%data(k, y_source_index, x_source_index)=source_field%data(k, y_source_index, x_source_index)+&
896 4.0_default_precision*(w%data(k-1, y_flow_index, x_flow_index)*
flux_z(k)*tzc1(k) - &
897 w%data(k, y_flow_index, x_flow_index)*
flux_z(k+1)*tzc2(k))
900 source_field%data(k, y_source_index, x_source_index)=source_field%data(k, y_source_index, x_source_index)+&
901 (u%data(k, y_flow_index, x_flow_index-1)*
flux_x(k) - u%data(k, y_flow_index, x_flow_index)*flux_x_previous(k))*&
902 global_grid%configuration%horizontal%cx
905 if (differentiate_top)
then
906 k=local_grid%size(z_index)
907 source_field%data(k, y_source_index, x_source_index)=0.0_default_precision
909 source_field%data(k, y_source_index, x_source_index)=source_field%data(k, y_source_index, x_source_index)+&
910 (v%data(k, y_flow_index-1, x_flow_index)* flux_y_previous(k) - v%data(k, y_flow_index, x_flow_index)*
flux_y(k))*&
911 global_grid%configuration%horizontal%cy
914 source_field%data(k, y_source_index, x_source_index)=source_field%data(k, y_source_index, x_source_index)+&
915 4.0_default_precision*tzc1(k)* w%data(k-1, y_flow_index, x_flow_index)*
flux_z(k)
918 source_field%data(k, y_source_index, x_source_index)=source_field%data(k, y_source_index, x_source_index)+&
919 (u%data(k, y_flow_index, x_flow_index-1)*
flux_x(k) -u%data(k, y_flow_index, x_flow_index)*flux_x_previous(k))*&
920 global_grid%configuration%horizontal%cx
931 integer,
intent(in) :: y_local_index
932 type(prognostic_field_type),
intent(inout) :: field
933 type(parallel_state_type),
intent(inout) :: parallel
934 type(local_grid_type),
intent(inout) :: local_grid
938 if (y_local_index == local_grid%local_domain_end_index(y_index) .and. parallel%my_coords(y_index) == 0 .and. &
939 field%async_flux_handle .ne. mpi_request_null)
then
940 call mpi_wait(field%async_flux_handle, mpi_status_ignore, ierr)
954 integer,
intent(in) :: y_local_index
955 type(prognostic_field_type),
intent(inout) :: field
956 type(parallel_state_type),
intent(inout) :: parallel
957 type(local_grid_type),
intent(inout) :: local_grid
961 if (y_local_index == local_grid%local_domain_start_index(y_index)-1 .and. parallel%my_coords(y_index) == 0)
then
962 if (.not.
allocated(field%flux_y_buffer))
allocate(field%flux_y_buffer(local_grid%size(z_index)))
963 field%flux_y_buffer(:) =
flux_y(:)
964 if (parallel%my_rank .ne. local_grid%neighbours(y_index,1))
then
965 call mpi_isend(field%flux_y_buffer, local_grid%size(z_index), precision_type, local_grid%neighbours(y_index,1), 0, &
966 parallel%neighbour_comm, field%async_flux_handle, ierr)
978 integer,
intent(in) :: y_local_index
979 type(prognostic_field_type),
intent(inout) :: field
980 type(parallel_state_type),
intent(inout) :: parallel
981 type(local_grid_type),
intent(inout) :: local_grid
985 if (y_local_index == local_grid%local_domain_end_index(y_index) .and. parallel%my_coords(y_index) == &
986 parallel%dim_sizes(y_index)-1)
then
987 if (field%async_flux_handle .ne. mpi_request_null)
then
988 call mpi_wait(field%async_flux_handle, mpi_status_ignore, ierr)
990 flux_y(:) = field%flux_y_buffer(:)
1003 integer,
intent(in) :: y_local_index
1004 type(prognostic_field_type),
intent(inout) :: field
1005 type(parallel_state_type),
intent(inout) :: parallel
1006 type(local_grid_type),
intent(inout) :: local_grid
1010 if (y_local_index == local_grid%local_domain_start_index(y_index) .and. parallel%my_coords(y_index) == &
1011 parallel%dim_sizes(y_index)-1)
then
1012 if (parallel%my_rank .ne. local_grid%neighbours(y_index,3))
then
1013 if (.not.
allocated(field%flux_y_buffer))
allocate(field%flux_y_buffer(local_grid%size(z_index)))
1014 call mpi_irecv(field%flux_y_buffer, local_grid%size(z_index), precision_type, local_grid%neighbours(y_index,3), 0, &
1015 parallel%neighbour_comm, field%async_flux_handle, ierr)
1028 type(model_state_type),
target,
intent(in) :: current_state
1029 integer,
intent(in) :: cxn, cyn, txn, tyn
1033 tend_3d_u(:,tyn,txn)=current_state%su%data(:,cyn,cxn)
1036 tend_3d_v(:,tyn,txn)=current_state%sv%data(:,cyn,cxn)
1039 tend_3d_w(:,tyn,txn)=current_state%sw%data(:,cyn,cxn)
1042 tend_3d_th(:,tyn,txn)=current_state%sth%data(:,cyn,cxn)
1063 tend_3d_tabs(:,tyn,txn)=current_state%sth%data(:,cyn,cxn) * current_state%global_grid%configuration%vertical%rprefrcp(:)
1076 type(model_state_type),
target,
intent(inout) :: current_state
1077 integer,
intent(in) :: cxn, cyn, txn, tyn
1112 current_state%sth%data(:,cyn,cxn) * current_state%global_grid%configuration%vertical%rprefrcp(:) &
1160 type(component_field_value_type),
intent(inout) :: field_value
1161 real(kind=default_precision),
dimension(:),
optional :: real_1d_field
1162 real(kind=default_precision),
dimension(:,:),
optional :: real_2d_field
1163 real(kind=default_precision),
dimension(:,:,:),
optional :: real_3d_field
1166 if (
present(real_1d_field))
then
1167 allocate(field_value%real_1d_array(
size(real_1d_field)),source=real_1d_field)
1168 else if (
present(real_2d_field))
then
1169 allocate(field_value%real_2d_array(
size(real_2d_field, 1),
size(real_2d_field, 2)), source=real_2d_field)
1170 else if (
present(real_3d_field))
then
1171 allocate(field_value%real_3d_array(
size(real_3d_field, 1),
size(real_3d_field, 2),
size(real_3d_field, 3)), &
1172 source=real_3d_field)
1182 character(len=*),
intent(in) :: field
1184 if (len_trim(field) .ne. 0)
then
1185 if (trim(field) .eq.
"tvd" .or. trim(field) .eq.
"any")
then