112 private :: comm_cartesc_nest_parentsize
113 private :: comm_cartesc_nest_catalogue
114 private :: comm_cartesc_nest_ping
115 private :: comm_cartesc_nest_setup_nestdown
116 private :: comm_cartesc_nest_importgrid_nestdown
117 private :: comm_cartesc_nest_intercomm_nestdown
118 private :: comm_cartesc_nest_issuer_of_receive
119 private :: comm_cartesc_nest_issuer_of_wait
121 interface comm_cartesc_nest_intercomm_nestdown
123 end interface comm_cartesc_nest_intercomm_nestdown
125 interface comm_cartesc_nest_issuer_of_receive
127 end interface comm_cartesc_nest_issuer_of_receive
129 interface comm_cartesc_nest_issuer_of_wait
131 end interface comm_cartesc_nest_issuer_of_wait
137 real(
rp),
private,
allocatable :: latlon_catalog(:,:,:)
138 real(
rp),
private :: latlon_local (4,2)
140 integer,
private :: parent_prc_num_x(2)
141 integer,
private :: parent_prc_num_y(2)
142 integer,
private :: parent_prc_nprocs(2)
144 integer,
private :: daughter_prc_num_x(2)
145 integer,
private :: daughter_prc_num_y(2)
146 integer,
private :: daughter_prc_nprocs(2)
148 integer,
private :: comm_cartesc_nest_tile_all
149 integer,
private :: comm_cartesc_nest_tile_allmax_p
150 integer,
private :: comm_cartesc_nest_tile_allmax_d
151 integer,
private,
allocatable :: comm_cartesc_nest_tile_list_p(:,:)
152 integer,
private,
allocatable :: comm_cartesc_nest_tile_list_d(:,:)
153 integer,
private,
allocatable :: comm_cartesc_nest_tile_list_yp(:)
154 integer,
private :: num_yp
156 character(len=H_LONG),
private :: offline_parent_basename
157 integer,
private :: offline_parent_prc_num_x
158 integer,
private :: offline_parent_prc_num_y
159 integer,
private :: offline_parent_kmax
160 integer,
private :: offline_parent_imax
161 integer,
private :: offline_parent_jmax
162 integer,
private :: offline_parent_lkmax
163 integer,
private :: offline_parent_okmax
164 integer(8),
private :: online_wait_limit
165 logical,
private :: online_daughter_use_velz
166 logical,
private :: online_daughter_no_rotate
167 logical,
private :: online_aggressive_comm
169 integer,
parameter :: i_lon = 1
170 integer,
parameter :: i_lat = 2
172 integer,
parameter :: i_min = 1
173 integer,
parameter :: i_max = 2
174 integer,
parameter :: i_bndqa = 20
176 integer,
parameter :: i_sclr = 1
177 integer,
parameter :: i_zstg = 2
178 integer,
parameter :: i_xstg = 3
179 integer,
parameter :: i_ystg = 4
181 integer,
parameter :: itp_ng = 4
182 integer,
private :: itp_nh = 4
184 integer,
parameter :: tag_lon = 1
185 integer,
parameter :: tag_lat = 2
186 integer,
parameter :: tag_lonuy = 3
187 integer,
parameter :: tag_latuy = 4
188 integer,
parameter :: tag_lonxv = 5
189 integer,
parameter :: tag_latxv = 6
190 integer,
parameter :: tag_cz = 7
191 integer,
parameter :: tag_fz = 8
193 integer,
parameter :: tag_dens = 1
194 integer,
parameter :: tag_momz = 2
195 integer,
parameter :: tag_momx = 3
196 integer,
parameter :: tag_momy = 4
197 integer,
parameter :: tag_rhot = 5
198 integer,
parameter :: tag_qx = 6
200 integer,
parameter :: order_tag_comm = 100000
201 integer,
parameter :: order_tag_var = 1000
205 integer,
private,
parameter :: interp_search_divnum = 10
207 integer,
private :: intercomm_id(2)
209 integer,
private,
parameter :: max_isu = 100
210 integer,
private :: max_rq = 1000
211 integer,
private :: rq_ctl_p
212 integer,
private :: rq_ctl_d
213 integer,
private :: rq_tot_p
214 integer,
private :: rq_tot_d
215 integer,
private,
allocatable :: ireq_p(:)
216 integer,
private,
allocatable :: ireq_d(:)
217 integer,
private,
allocatable :: call_order(:)
219 real(
rp),
private,
allocatable :: recvbuf_3d(:,:,:,:)
221 real(
rp),
private,
allocatable :: buffer_ref_lon (:,:)
222 real(
rp),
private,
allocatable :: buffer_ref_lonuy(:,:)
223 real(
rp),
private,
allocatable :: buffer_ref_lonxv(:,:)
224 real(
rp),
private,
allocatable :: buffer_ref_lat (:,:)
225 real(
rp),
private,
allocatable :: buffer_ref_latuy(:,:)
226 real(
rp),
private,
allocatable :: buffer_ref_latxv(:,:)
227 real(
rp),
private,
allocatable :: buffer_ref_cz (:,:,:)
228 real(
rp),
private,
allocatable :: buffer_ref_fz (:,:,:)
231 real(
rp),
private,
allocatable :: buffer_ref_3d (:,:,:)
233 real(
rp),
private,
allocatable :: org_dens(:,:,:)
234 real(
rp),
private,
allocatable :: org_momz(:,:,:)
235 real(
rp),
private,
allocatable :: org_momx(:,:,:)
236 real(
rp),
private,
allocatable :: org_momy(:,:,:)
237 real(
rp),
private,
allocatable :: org_u_ll(:,:,:)
238 real(
rp),
private,
allocatable :: org_v_ll(:,:,:)
239 real(
rp),
private,
allocatable :: org_rhot(:,:,:)
240 real(
rp),
private,
allocatable :: org_qtrc(:,:,:,:)
242 integer,
private,
allocatable :: igrd (:,:,:,:)
243 integer,
private,
allocatable :: jgrd (:,:,:,:)
244 real(
rp),
private,
allocatable :: hfact(:,:,:,:)
245 integer,
private,
allocatable :: kgrd (:,:,:,:,:,:)
246 real(
rp),
private,
allocatable :: vfact(:, :,:,:,:)
248 integer(8),
private :: nwait_p, nwait_d, nrecv, nsend
250 character(len=H_SHORT) :: mp_type
263 file_get_attribute, &
295 mapprojection_lonlat2xy
298 integer,
intent(in) :: qa_mp
299 character(len=*),
intent(in) :: mp_type_in
300 integer,
intent(in),
optional :: inter_parent
301 integer,
intent(in),
optional :: inter_child
303 character(len=H_SHORT) :: comm_cartesc_nest_interp_type =
'LINEAR'
308 character(len=H_LONG) :: latlon_catalogue_fname =
'latlon_domain_catalogue.txt'
310 real(
rp),
allocatable :: x_ref(:,:)
311 real(
rp),
allocatable :: y_ref(:,:)
313 integer :: online_specified_maxrq = 0
318 logical :: flag_parent = .false.
319 logical :: flag_child = .false.
322 integer :: pnum_x(1), pnum_y(1)
324 logical :: error, existed
326 namelist / param_comm_cartesc_nest / &
327 latlon_catalogue_fname, &
328 offline_parent_basename, &
329 offline_parent_prc_num_x, &
330 offline_parent_prc_num_y, &
337 online_aggressive_comm, &
339 online_specified_maxrq, &
340 comm_cartesc_nest_interp_type, &
347 log_info(
"COMM_CARTESC_NEST_setup",*)
'Setup'
349 if (
present(inter_parent) )
then
350 if( inter_parent /= mpi_comm_null ) flag_child = .true.
352 if (
present(inter_child) )
then
353 if( inter_child /= mpi_comm_null ) flag_parent = .true.
356 offline_parent_basename =
""
365 online_wait_limit = 999999999
366 online_aggressive_comm = .true.
370 read(
io_fid_conf,nml=param_comm_cartesc_nest,iostat=ierr)
372 log_info(
"COMM_CARTESC_NEST_setup",*)
'Not found namelist. Default used.'
373 elseif( ierr > 0 )
then
374 log_error(
"COMM_CARTESC_NEST_setup",*)
'Not appropriate names in namelist PARAM_COMM_CARTESC_NEST. Check!'
377 log_nml(param_comm_cartesc_nest)
381 if ( offline_parent_basename /=
"" )
then
387 call file_open( offline_parent_basename, &
389 aggregate = .false. )
391 call file_get_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_imaxg", &
392 imaxg(:), existed=existed )
394 call file_get_attribute( fid,
"global",
"scale_cartesC_prc_num_x", &
395 pnum_x(:), existed=existed )
398 offline_parent_imax =
imaxg(1) / pnum_x(1)
401 call file_get_shape( fid,
"CX", dims(:) )
402 offline_parent_imax = dims(1)-
ihalo*2
405 call file_get_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_jmaxg", &
406 jmaxg(:), existed=existed )
408 call file_get_attribute( fid,
"global",
"scale_cartesC_prc_num_y", &
409 pnum_y(:), existed=existed )
412 offline_parent_jmax =
jmaxg(1) / pnum_y(1)
415 call file_get_shape( fid,
"CY", dims(:) )
416 offline_parent_jmax = dims(1)-
jhalo*2
419 call file_get_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_kmax", &
420 dims(:), existed=existed )
422 offline_parent_kmax = dims(1)
424 call file_get_shape( fid,
"z", dims(:), error=error )
426 offline_parent_kmax = 0
428 offline_parent_kmax = dims(1)
432 call file_get_attribute( fid,
"global",
"scale_ocean_grid_cartesC_index_kmax", &
433 dims(:), existed=existed )
435 offline_parent_okmax = dims(1)
438 call file_get_shape( fid,
"oz", dims(:), error=error )
440 offline_parent_okmax = 0
442 offline_parent_okmax = dims(1)
446 call file_get_attribute( fid,
"global",
"scale_land_grid_cartesC_index_kmax", &
447 dims(:), existed=existed )
449 offline_parent_lkmax = dims(1)
452 call file_get_shape( fid,
"lz", dims(:), error=error )
454 offline_parent_lkmax = 0
456 offline_parent_lkmax = dims(1)
461 call comm_bcast( offline_parent_imax )
462 call comm_bcast( offline_parent_jmax )
463 call comm_bcast( offline_parent_kmax )
464 call comm_bcast( offline_parent_okmax )
465 call comm_bcast( offline_parent_lkmax )
471 log_error(
"COMM_CARTESC_NEST_setup",*)
'OFFLINE and ONLINE cannot be use at the same time'
480 select case ( comm_cartesc_nest_interp_type )
483 case (
'DIST-WEIGHT' )
486 log_error(
"COMM_CARTESC_NEST_setup",*)
'Unsupported type of COMM_CARTESC_NEST_INTERP_TYPE : ', trim(comm_cartesc_nest_interp_type)
487 log_error_cont(*)
' It must be "LINEAR" or "DIST-WEIGHT"'
492 if( online_specified_maxrq > max_rq ) max_rq = online_specified_maxrq
494 allocate( ireq_p(max_rq) )
495 allocate( ireq_d(max_rq) )
496 allocate( call_order(max_rq) )
497 ireq_p(:) = mpi_request_null
498 ireq_d(:) = mpi_request_null
512 parent_prc_num_x(
handling_num) = offline_parent_prc_num_x
513 parent_prc_num_y(
handling_num) = offline_parent_prc_num_y
521 allocate( latlon_catalog(parent_prc_nprocs(
handling_num),2,2) )
526 file = trim(latlon_catalogue_fname), &
527 form =
'formatted', &
531 if ( ierr /= 0 )
then
532 log_error(
"COMM_CARTESC_NEST_setup",*)
'cannot open latlon-catalogue file!'
537 read(fid,
'(i8,4f32.24)',iostat=ierr) parent_id, &
538 latlon_catalog(i,i_min,i_lon), latlon_catalog(i,i_max,i_lon), &
539 latlon_catalog(i,i_min,i_lat), latlon_catalog(i,i_max,i_lat)
540 if ( i /= parent_id )
then
541 log_error(
"COMM_CARTESC_NEST_setup",*)
'internal error: parent mpi id'
544 if ( ierr /= 0 )
exit
572 log_info(
"COMM_CARTESC_NEST_setup",*)
"flag_parent", flag_parent,
"flag_child", flag_child
575 if( flag_parent )
then
578 log_error(
"COMM_CARTESC_NEST_setup",*)
'[NEST_setup] Parent Flag from launcher is not consistent with namelist!'
588 log_info(
"COMM_CARTESC_NEST_setup",
'(1x,A,I2,A)')
'Online Nesting - PARENT [INTERCOMM_ID:', &
590 log_info(
"COMM_CARTESC_NEST_setup",*)
'Online Nesting - INTERCOMM :',
intercomm_daughter
609 log_info(
"COMM_CARTESC_NEST_setup",
'(1x,A)' )
'Informations of Parent Domain [me]'
610 log_info_cont(
'(1x,A,I6)' )
'--- PARENT_PRC_nprocs :', parent_prc_nprocs(
handling_num)
611 log_info_cont(
'(1x,A,I6)' )
'--- PARENT_PRC_NUM_X :', parent_prc_num_x(
handling_num)
612 log_info_cont(
'(1x,A,I6)' )
'--- PARENT_PRC_NUM_Y :', parent_prc_num_y(
handling_num)
618 log_info_cont(
'(1x,A)' )
'Informations of Daughter Domain'
619 log_info_cont(
'(1x,A,I6)' )
'--- DAUGHTER_PRC_nprocs :', daughter_prc_nprocs(
handling_num)
620 log_info_cont(
'(1x,A,I6)' )
'--- DAUGHTER_PRC_NUM_X :', daughter_prc_num_x(
handling_num)
621 log_info_cont(
'(1x,A,I6)' )
'--- DAUGHTER_PRC_NUM_Y :', daughter_prc_num_y(
handling_num)
627 log_info_cont(
'(1x,A,I6) ')
'Limit Num. NCOMM req. :', max_rq
644 if( flag_child )
then
647 log_error(
"COMM_CARTESC_NEST_setup",*)
'[NEST_setup] Child Flag from launcher is not consistent with namelist!'
657 log_info(
"COMM_CARTESC_NEST_setup",
'(1x,A,I2,A)')
'Online Nesting - DAUGHTER [INTERCOMM_ID:', &
659 log_info(
"COMM_CARTESC_NEST_setup",*)
'Online Nesting - INTERCOMM :',
intercomm_parent
665 allocate( latlon_catalog(parent_prc_nprocs(
handling_num),2,2) )
681 log_info(
"COMM_CARTESC_NEST_setup",
'(1x,A)' )
'Informations of Parent Domain'
682 log_info_cont(
'(1x,A,I6)' )
'--- PARENT_PRC_nprocs :', parent_prc_nprocs(
handling_num)
683 log_info_cont(
'(1x,A,I6)' )
'--- PARENT_PRC_NUM_X :', parent_prc_num_x(
handling_num)
684 log_info_cont(
'(1x,A,I6)' )
'--- PARENT_PRC_NUM_Y :', parent_prc_num_y(
handling_num)
690 log_info_cont(
'(1x,A)' )
'Informations of Daughter Domain [me]'
691 log_info_cont(
'(1x,A,I6)' )
'--- DAUGHTER_PRC_nprocs :', daughter_prc_nprocs(
handling_num)
692 log_info_cont(
'(1x,A,I6)' )
'--- DAUGHTER_PRC_NUM_X :', daughter_prc_num_x(
handling_num)
693 log_info_cont(
'(1x,A,I6)' )
'--- DAUGHTER_PRC_NUM_Y :', daughter_prc_num_y(
handling_num)
699 log_info_cont(
'(1x,A)' )
'Informations of Target Tiles'
703 log_info_cont(
'(1x,A,I6) ')
'Limit Num. NCOMM req. :', max_rq
728 select case ( comm_cartesc_nest_interp_type )
737 buffer_ref_lon(:,:), &
738 buffer_ref_lat(:,:), &
739 x_ref(:,:), y_ref(:,:) )
750 x_ref(:,:), y_ref(:,:), &
751 buffer_ref_cz(:,:,:), &
755 igrd( :,:,:,i_sclr), &
756 jgrd( :,:,:,i_sclr), &
757 hfact( :,:,:,i_sclr), &
758 kgrd(:,:,:,:,:,i_sclr), &
759 vfact(:, :,:,:,i_sclr) )
772 x_ref(:,:), y_ref(:,:), &
773 buffer_ref_fz(:,:,:), &
777 igrd( :,:,:,i_zstg), &
778 jgrd( :,:,:,i_zstg), &
779 hfact( :,:,:,i_zstg), &
780 kgrd(:,:,:,:,:,i_zstg), &
781 vfact(:, :,:,:,i_zstg) )
786 buffer_ref_lonuy(:,:), &
787 buffer_ref_latuy(:,:), &
788 x_ref(:,:), y_ref(:,:) )
799 x_ref(:,:), y_ref(:,:), &
800 buffer_ref_cz(:,:,:), &
804 igrd( :,:,:,i_xstg), &
805 jgrd( :,:,:,i_xstg), &
806 hfact( :,:,:,i_xstg), &
807 kgrd(:,:,:,:,:,i_xstg), &
808 vfact(:, :,:,:,i_xstg) )
813 buffer_ref_lonxv(:,:), &
814 buffer_ref_latxv(:,:), &
815 x_ref(:,:), y_ref(:,:) )
826 x_ref(:,:), y_ref(:,:), &
827 buffer_ref_cz(:,:,:), &
831 igrd( :,:,:,i_ystg), &
832 jgrd( :,:,:,i_ystg), &
833 hfact( :,:,:,i_ystg), &
834 kgrd(:,:,:,:,:,i_ystg), &
835 vfact(:, :,:,:,i_ystg) )
837 deallocate( x_ref, y_ref )
839 case (
'DIST-WEIGHT' )
842 call interp_factor3d( itp_nh, &
853 buffer_ref_lon(:,:), &
854 buffer_ref_lat(:,:), &
855 buffer_ref_cz(:,:,:), &
859 igrd( :,:,:,i_sclr), &
860 jgrd( :,:,:,i_sclr), &
861 hfact( :,:,:,i_sclr), &
862 kgrd(:,:,:,:,:,i_sclr), &
863 vfact(:, :,:,:,i_sclr) )
866 call interp_factor3d( itp_nh, &
877 buffer_ref_lon(:,:), &
878 buffer_ref_lat(:,:), &
879 buffer_ref_fz(:,:,:), &
883 igrd( :,:,:,i_zstg), &
884 jgrd( :,:,:,i_zstg), &
885 hfact( :,:,:,i_zstg), &
886 kgrd(:,:,:,:,:,i_zstg), &
887 vfact(:, :,:,:,i_zstg) )
890 call interp_factor3d( itp_nh, &
901 buffer_ref_lonuy(:,:), &
902 buffer_ref_latuy(:,:), &
903 buffer_ref_cz(:,:,:), &
907 igrd( :,:,:,i_xstg), &
908 jgrd( :,:,:,i_xstg), &
909 hfact( :,:,:,i_xstg), &
910 kgrd(:,:,:,:,:,i_xstg), &
911 vfact(:, :,:,:,i_xstg) )
914 call interp_factor3d( itp_nh, &
925 buffer_ref_lonxv(:,:), &
926 buffer_ref_latxv(:,:), &
927 buffer_ref_cz(:,:,:), &
931 igrd( :,:,:,i_ystg), &
932 jgrd( :,:,:,i_ystg), &
933 hfact( :,:,:,i_ystg), &
934 kgrd(:,:,:,:,:,i_ystg), &
935 vfact(:, :,:,:,i_ystg) )
966 integer,
intent(in) :: handle
968 integer :: x_min, x_max
969 integer :: y_min, y_max
976 x_min = parent_prc_num_x(handle)
978 y_min = parent_prc_num_y(handle)
981 do p = 1, parent_prc_nprocs(handle)
982 if ( ( ( latlon_local(i_min,i_lon) >= latlon_catalog(p,i_min,i_lon) &
983 .AND. latlon_local(i_min,i_lon) <= latlon_catalog(p,i_max,i_lon) ) .OR. &
984 ( latlon_local(i_max,i_lon) >= latlon_catalog(p,i_min,i_lon) &
985 .AND. latlon_local(i_max,i_lon) <= latlon_catalog(p,i_max,i_lon) ) .OR. &
986 ( latlon_catalog(p,i_min,i_lon) >= latlon_local(i_min,i_lon) &
987 .AND. latlon_catalog(p,i_min,i_lon) <= latlon_local(i_max,i_lon) ) .OR. &
988 ( latlon_catalog(p,i_max,i_lon) >= latlon_local(i_min,i_lon) &
989 .AND. latlon_catalog(p,i_max,i_lon) <= latlon_local(i_max,i_lon) ) ) .AND. &
990 ( ( latlon_local(i_min,i_lat) >= latlon_catalog(p,i_min,i_lat) &
991 .AND. latlon_local(i_min,i_lat) <= latlon_catalog(p,i_max,i_lat) ) .OR. &
992 ( latlon_local(i_max,i_lat) >= latlon_catalog(p,i_min,i_lat) &
993 .AND. latlon_local(i_max,i_lat) <= latlon_catalog(p,i_max,i_lat) ) .OR. &
994 ( latlon_catalog(p,i_min,i_lat) >= latlon_local(i_min,i_lat) &
995 .AND. latlon_catalog(p,i_min,i_lat) <= latlon_local(i_max,i_lat) ) .OR. &
996 ( latlon_catalog(p,i_max,i_lat) >= latlon_local(i_min,i_lat) &
997 .AND. latlon_catalog(p,i_max,i_lat) <= latlon_local(i_max,i_lat) ) ) )
then
998 if ( latlon_catalog(p,i_min,i_lon) <= latlon_local(i_min,i_lon) ) hit(i_min,i_lon) = .true.
999 if ( latlon_catalog(p,i_max,i_lon) >= latlon_local(i_max,i_lon) ) hit(i_max,i_lon) = .true.
1000 if ( latlon_catalog(p,i_min,i_lat) <= latlon_local(i_min,i_lat) ) hit(i_min,i_lat) = .true.
1001 if ( latlon_catalog(p,i_max,i_lat) >= latlon_local(i_max,i_lat) ) hit(i_max,i_lat) = .true.
1002 i = mod(p-1, parent_prc_num_x(handle))
1003 j = (p-1) / parent_prc_num_x(handle)
1004 if ( i < x_min ) x_min = i
1005 if ( i > x_max ) x_max = i
1006 if ( j < y_min ) y_min = j
1007 if ( j > y_max ) y_max = j
1011 if ( .not. ( hit(i_min,i_lon) .and. hit(i_max,i_lon) .and. hit(i_min,i_lat) .and. hit(i_max,i_lat) ) )
then
1012 log_error(
"COMM_CARTESC_NEST_domain_relate",*)
'region of daughter domain is larger than that of parent'
1014 log_error_cont(*)
'LON MIN: ',hit(i_min,i_lon),
', LON MAX: ',hit(i_max,i_lon),
', LAT MIN: ',hit(i_min,i_lat),
', LAT MAX: ',hit(i_max,i_lat)
1015 log_error_cont(
'(A,F12.6,1x,F12.6)')
'daughter local (me) MIN-MAX: LON=', &
1016 latlon_local(i_min,i_lon), latlon_local(i_max,i_lon)
1017 do p = 1, parent_prc_nprocs(handle)
1018 log_error_cont(
'(A,I5,A,F12.6,1x,F12.6)')
' parent (', p,
') MIN-MAX: LON=', &
1019 latlon_catalog(p,i_min,i_lon) ,latlon_catalog(p,i_max,i_lon)
1021 log_error_cont(
'(A,F12.6,1x,F12.6)')
'daughter local (me): MIN-MAX LAT=', &
1022 latlon_local(i_min,i_lat), latlon_local(i_max,i_lat)
1023 do p = 1, parent_prc_nprocs(handle)
1024 log_error_cont(
'(A,I5,A,F12.6,1x,F12.6)')
' parent (', p,
') MIN-MAX: LAT=', &
1025 latlon_catalog(p,i_min,i_lat) ,latlon_catalog(p,i_max,i_lat)
1037 log_info(
"COMM_CARTESC_NEST_domain_relate",
'(1x,A)')
'NEST: target process tile in parent domain'
1063 integer,
intent(out) :: tilei, tilej
1064 integer,
intent(out) :: cxs, cxe, cys, cye
1065 integer,
intent(out) :: pxs, pxe, pys, pye
1066 integer,
intent(in) :: iloc
1070 integer :: xloc, yloc
1071 integer :: xlocg, ylocg
1079 xlocg = mod( rank, offline_parent_prc_num_x ) + 1
1080 ylocg = int( real(rank) / real(offline_parent_prc_num_x) ) + 1
1084 cxs = tilei * (xloc-1) + 1
1086 cys = tilej * (yloc-1) + 1
1093 if ( xlocg == 1 )
then
1098 if ( xlocg == offline_parent_prc_num_x )
then
1101 if ( ylocg == 1 )
then
1106 if ( ylocg == offline_parent_prc_num_y )
then
1115 subroutine comm_cartesc_nest_parentsize( &
1134 integer,
intent(in) :: handle
1137 integer :: datapack(14)
1139 integer :: qa_otherside
1140 character(len=H_SHORT) :: mp_type_otherside
1142 integer :: ireq1, ireq2, ireq3, ierr1, ierr2, ierr3, ileng
1143 integer :: istatus(mpi_status_size)
1149 tag = intercomm_id(handle) * 100
1177 call mpi_wait(ireq1, istatus, ierr1)
1178 call mpi_wait(ireq2, istatus, ierr2)
1179 call mpi_wait(ireq3, istatus, ierr3)
1182 parent_prc_nprocs(handle) = datapack( 1)
1183 parent_prc_num_x(handle) = datapack( 2)
1184 parent_prc_num_y(handle) = datapack( 3)
1188 prnt_ks(handle) = datapack( 7)
1189 prnt_ke(handle) = datapack( 8)
1190 prnt_is(handle) = datapack( 9)
1191 prnt_ie(handle) = datapack(10)
1192 prnt_js(handle) = datapack(11)
1193 prnt_je(handle) = datapack(12)
1202 call mpi_wait(ireq1, istatus, ierr1)
1203 call mpi_wait(ireq2, istatus, ierr2)
1204 call mpi_wait(ireq3, istatus, ierr3)
1206 call comm_bcast(datapack, ileng)
1207 call comm_bcast(buffer)
1208 call comm_bcast(mp_type_otherside)
1210 daughter_prc_nprocs(handle) = datapack( 1)
1211 daughter_prc_num_x(handle) = datapack( 2)
1212 daughter_prc_num_y(handle) = datapack( 3)
1216 datr_ks(handle) = datapack( 7)
1217 datr_ke(handle) = datapack( 8)
1218 datr_is(handle) = datapack( 9)
1219 datr_ie(handle) = datapack(10)
1220 datr_js(handle) = datapack(11)
1221 datr_je(handle) = datapack(12)
1223 qa_otherside = datapack(14)
1236 call mpi_wait(ireq1, istatus, ierr1)
1237 call mpi_wait(ireq2, istatus, ierr2)
1238 call mpi_wait(ireq3, istatus, ierr3)
1240 call comm_bcast(datapack, ileng)
1241 call comm_bcast(buffer)
1242 call comm_bcast(mp_type_otherside)
1244 parent_prc_nprocs(handle) = datapack( 1)
1245 parent_prc_num_x(handle) = datapack( 2)
1246 parent_prc_num_y(handle) = datapack( 3)
1250 prnt_ks(handle) = datapack( 7)
1251 prnt_ke(handle) = datapack( 8)
1252 prnt_is(handle) = datapack( 9)
1253 prnt_ie(handle) = datapack(10)
1254 prnt_js(handle) = datapack(11)
1255 prnt_je(handle) = datapack(12)
1257 qa_otherside = datapack(14)
1281 call mpi_wait(ireq1, istatus, ierr1)
1282 call mpi_wait(ireq2, istatus, ierr2)
1283 call mpi_wait(ireq3, istatus, ierr3)
1286 daughter_prc_nprocs(handle) = datapack( 1)
1287 daughter_prc_num_x(handle) = datapack( 2)
1288 daughter_prc_num_y(handle) = datapack( 3)
1292 datr_ks(handle) = datapack( 7)
1293 datr_ke(handle) = datapack( 8)
1294 datr_is(handle) = datapack( 9)
1295 datr_ie(handle) = datapack(10)
1296 datr_js(handle) = datapack(11)
1297 datr_je(handle) = datapack(12)
1301 log_error(
"COMM_CARTESC_NEST_parentsize",*)
'[COMM_CARTESC_NEST_parentsize] internal error'
1308 log_info(
"COMM_CARTESC_NEST_parentsize",*)
'Hydrometeor will be diagnosed'
1309 log_info(
"COMM_CARTESC_NEST_parentsize",*)
'MP type (remote,local) = ', trim(mp_type_otherside),
", ", trim(mp_type)
1310 log_info(
"COMM_CARTESC_NEST_parentsize",*)
'Number of QA (remote,local) = ', qa_otherside,
comm_cartesc_nest_bnd_qa
1316 end subroutine comm_cartesc_nest_parentsize
1320 subroutine comm_cartesc_nest_catalogue( &
1334 integer,
intent(in) :: handle
1336 integer :: ireq, ierr, ileng
1337 integer :: istatus(mpi_status_size)
1343 tag = intercomm_id(handle) * 100
1353 call mpi_wait(ireq, istatus, ierr)
1360 ileng = parent_prc_nprocs(handle) * 2 * 2
1364 call mpi_wait(ireq, istatus, ierr)
1366 call comm_bcast( latlon_catalog, parent_prc_nprocs(handle), 2, 2 )
1369 log_error(
"COMM_CARTESC_NEST_catalogue",*)
'internal error'
1374 end subroutine comm_cartesc_nest_catalogue
1378 subroutine comm_cartesc_nest_ping( &
1388 integer,
intent(in) :: handle
1390 integer :: ping, pong
1391 integer :: ireq1, ireq2, ierr1, ierr2
1392 integer :: istatus(mpi_status_size)
1394 logical :: ping_error
1399 tag = intercomm_id(handle) * 100
1400 ping_error = .false.
1412 call mpi_wait(ireq1, istatus, ierr1)
1413 call mpi_wait(ireq2, istatus, ierr2)
1416 call comm_bcast(pong)
1418 if ( pong /= intercomm_id(handle)+1 ) ping_error = .true.
1430 call mpi_wait(ireq1, istatus, ierr1)
1431 call mpi_wait(ireq2, istatus, ierr2)
1434 call comm_bcast(pong)
1436 if ( pong /= intercomm_id(handle) ) ping_error = .true.
1439 log_error(
"COMM_CARTESC_NEST_ping",*)
'internal error'
1443 if ( ping_error )
then
1444 log_error(
"COMM_CARTESC_NEST_ping",*)
'ping destination error'
1449 end subroutine comm_cartesc_nest_ping
1453 subroutine comm_cartesc_nest_setup_nestdown( &
1464 integer,
intent(in) :: handle
1466 integer,
allocatable :: buffer_list (:)
1467 integer,
allocatable :: buffer_alllist(:)
1469 integer :: ireq, ierr, ileng
1470 integer :: istatus(mpi_status_size)
1471 integer :: tag, target_rank
1478 tag = intercomm_id(handle) * 100
1486 call mpi_wait(ireq, istatus, ierr)
1488 call comm_bcast(comm_cartesc_nest_tile_allmax_p)
1490 allocate( comm_cartesc_nest_tile_list_p(comm_cartesc_nest_tile_allmax_p,daughter_prc_nprocs(handle)) )
1491 allocate( comm_cartesc_nest_tile_list_yp(comm_cartesc_nest_tile_allmax_p*daughter_prc_nprocs(handle)) )
1493 ileng = comm_cartesc_nest_tile_allmax_p*daughter_prc_nprocs(handle)
1496 call mpi_wait(ireq, istatus, ierr)
1498 call comm_bcast(comm_cartesc_nest_tile_list_p, comm_cartesc_nest_tile_allmax_p, daughter_prc_nprocs(handle))
1500 comm_cartesc_nest_tile_list_yp(:) = -1
1503 do j = 1, daughter_prc_nprocs(handle)
1504 do i = 1, comm_cartesc_nest_tile_allmax_p
1505 if ( comm_cartesc_nest_tile_list_p(i,j) ==
prc_myrank )
then
1507 comm_cartesc_nest_tile_list_yp(
k) = j - 1
1513 log_info(
"COMM_CARTESC_NEST_setup_nestdown",
'(A,I5,A,I5)')
"[P] Num YP =",num_yp,
" Num TILE(MAX) =",comm_cartesc_nest_tile_allmax_p
1517 call mpi_wait(ireq, istatus, ierr)
1519 call comm_bcast(online_daughter_use_velz)
1521 log_info(
"COMM_CARTESC_NEST_setup_nestdown",
'(1x,A,L2)')
'NEST: ONLINE_DAUGHTER_USE_VELZ =', online_daughter_use_velz
1525 call mpi_wait(ireq, istatus, ierr)
1527 call comm_bcast(online_daughter_no_rotate)
1530 log_error(
"COMM_CARTESC_NEST_setup_nestdown",*)
'Flag of NO_ROTATE is not consistent with the child domain'
1532 log_error_cont(*)
'ONLINE_DAUGHTER_NO_ROTATE =', online_daughter_no_rotate
1535 log_info(
"COMM_CARTESC_NEST_setup_nestdown",
'(1x,A,L2)')
'NEST: ONLINE_DAUGHTER_NO_ROTATE =', online_daughter_no_rotate
1537 call comm_cartesc_nest_importgrid_nestdown( handle )
1540 target_rank = comm_cartesc_nest_tile_list_yp(i)
1541 call mpi_isend(i, 1, mpi_integer, target_rank, tag+5,
intercomm_daughter, ireq, ierr)
1542 call mpi_wait(ireq, istatus, ierr)
1552 call mpi_allreduce( comm_cartesc_nest_tile_all, &
1553 comm_cartesc_nest_tile_allmax_d, &
1559 log_info(
"COMM_CARTESC_NEST_setup_nestdown",
'(A,I5,A,I5)')
"[D] Num YP =",comm_cartesc_nest_tile_all,
" Num TILE(MAX) =",comm_cartesc_nest_tile_allmax_d
1563 call mpi_wait(ireq, istatus, ierr)
1566 allocate( buffer_list(comm_cartesc_nest_tile_allmax_d) )
1567 allocate( buffer_alllist(comm_cartesc_nest_tile_allmax_d*daughter_prc_nprocs(handle)) )
1568 allocate( comm_cartesc_nest_tile_list_d(comm_cartesc_nest_tile_allmax_d,daughter_prc_nprocs(handle)) )
1570 do i = 1, comm_cartesc_nest_tile_allmax_d
1571 if ( i <= comm_cartesc_nest_tile_all )
then
1578 ileng = comm_cartesc_nest_tile_allmax_d
1579 call mpi_allgather( buffer_list(:), &
1582 buffer_alllist(:), &
1588 do j = 1, daughter_prc_nprocs(handle)
1589 do i = 1, comm_cartesc_nest_tile_allmax_d
1590 comm_cartesc_nest_tile_list_d(i,j) = buffer_alllist(
k)
1595 deallocate( buffer_list )
1596 deallocate( buffer_alllist )
1598 ileng = comm_cartesc_nest_tile_allmax_d*daughter_prc_nprocs(handle)
1601 call mpi_wait(ireq, istatus, ierr)
1606 call mpi_wait(ireq, istatus, ierr)
1611 call mpi_wait(ireq, istatus, ierr)
1613 call comm_bcast(online_daughter_no_rotate)
1615 call comm_cartesc_nest_importgrid_nestdown( handle )
1617 do i = 1, comm_cartesc_nest_tile_all
1618 target_rank = comm_cartesc_nest_tile_list_d(i,
prc_myrank+1)
1619 call mpi_irecv( call_order(i), 1, mpi_integer, target_rank, tag+5,
intercomm_parent, ireq, ierr )
1620 call mpi_wait(ireq, istatus, ierr)
1625 log_error(
"COMM_CARTESC_NEST_setup_nestdown",*)
'internal error'
1629 if( num_yp * 16 > max_rq .OR. comm_cartesc_nest_tile_all * 16 > max_rq )
then
1630 log_error(
"COMM_CARTESC_NEST_setup_nestdown",*)
'internal error (overflow number of ireq)'
1631 log_error_cont(*)
'NUM_YP x 16 = ', num_yp * 16
1632 log_error_cont(*)
'COMM_CARTESC_NEST_TILE_ALL x 16 = ', comm_cartesc_nest_tile_all * 16
1633 log_error_cont(*)
'max_rq = ', max_rq
1638 end subroutine comm_cartesc_nest_setup_nestdown
1642 subroutine comm_cartesc_nest_importgrid_nestdown( &
1660 integer,
intent(in) :: handle
1662 integer :: ierr, ileng
1663 integer :: istatus(mpi_status_size)
1664 integer :: tag, tagbase, target_rank
1665 integer :: rq_str, rq_end, rq_tot
1667 integer :: xloc, yloc
1671 real(
rp) :: max_ref, max_loc
1673 real(
rp),
allocatable :: sendbuf_2d(:,:,:)
1674 real(
rp),
allocatable :: sendbuf_3d(:,:,:,:)
1675 real(
rp),
allocatable :: recvbuf_2d(:,:,:)
1682 tagbase = intercomm_id(handle) * 100
1694 target_rank = comm_cartesc_nest_tile_list_yp(i)
1700 tag = tagbase + tag_lon
1705 tag = tagbase + tag_lat
1711 tag = tagbase + tag_lonuy
1717 tag = tagbase + tag_latuy
1723 tag = tagbase + tag_lonxv
1729 tag = tagbase + tag_latxv
1734 tag = tagbase + tag_cz
1740 tag = tagbase + tag_fz
1741 call mpi_isend(sendbuf_3d(:,:,:,1), ileng,
comm_datatype, target_rank, tag,
intercomm_daughter, ireq_p(rq), ierr)
1744 rq_tot = rq_end - rq_str + 1
1749 deallocate( sendbuf_2d )
1750 deallocate( sendbuf_3d )
1758 do i = 1, comm_cartesc_nest_tile_all
1760 target_rank = comm_cartesc_nest_tile_list_d(i,
prc_myrank+1)
1774 tag = tagbase + tag_lon
1779 tag = tagbase + tag_lat
1784 tag = tagbase + tag_lonuy
1789 tag = tagbase + tag_latuy
1794 tag = tagbase + tag_lonxv
1799 tag = tagbase + tag_latxv
1804 tag = tagbase + tag_cz
1805 call mpi_irecv(recvbuf_3d(:,:,:,tag_cz), ileng,
comm_datatype, target_rank, tag,
intercomm_parent, ireq_d(rq), ierr)
1809 tag = tagbase + tag_fz
1810 call mpi_irecv(recvbuf_3d(:,:,:,tag_fz), ileng,
comm_datatype, target_rank, tag,
intercomm_parent, ireq_d(rq), ierr)
1813 rq_tot = rq_end - rq_str + 1
1831 max_ref = maxval( buffer_ref_fz(:,:,:) )
1833 if ( max_ref < max_loc )
then
1834 log_error(
"COMM_CARTESC_NEST_importgrid_nestdown",*)
'REQUESTED DOMAIN IS TOO MUCH BROAD'
1835 log_error_cont(*)
'-- VERTICAL direction over the limit'
1836 log_error_cont(*)
'-- reference max: ', max_ref
1837 log_error_cont(*)
'-- local max: ', max_loc
1841 deallocate( recvbuf_2d )
1844 log_error(
"COMM_CARTESC_NEST_importgrid_nestdown",*)
'internal error'
1849 end subroutine comm_cartesc_nest_importgrid_nestdown
1877 integer,
intent(in) :: handle
1878 integer,
intent(in) :: bnd_qa
1898 real(
rp) :: u_on_map, v_on_map
1900 real(
rp) :: dummy(1,1,1)
1901 integer :: tagbase, tagcomm
1905 integer :: i, j,
k, iq
1910 if ( bnd_qa > i_bndqa )
then
1911 log_error(
"COMM_CARTESC_NEST_nestdown",*)
'internal error: BND_QA is larger than I_BNDQA'
1915 tagcomm = intercomm_id(handle) * order_tag_comm
1925 log_info(
"COMM_CARTESC_NEST_nestdown",
'(1X,A,I5,A)')
"CONeP[P] send( ", nsend,
" )"
1929 org_dens(:,:,:) = dens_send(:,:,:)
1931 org_momz(:,:,:) = momz_send(:,:,:)
1933 org_momx(:,:,:) = momx_send(:,:,:)
1935 org_momy(:,:,:) = momy_send(:,:,:)
1937 org_rhot(:,:,:) = rhot_send(:,:,:)
1940 org_qtrc(:,:,:,iq) = qtrc_send(:,:,:,iq)
1948 if ( .NOT. online_daughter_no_rotate )
then
1953 work1_send(
k,i,j) = ( org_momx(
k,i-1,j) + org_momx(
k,i,j) ) * 0.5_rp
1960 work1_send(
k,1,j) = org_momx(
k,1,j)
1964 call comm_vars8( work1_send(:,:,:), 1 )
1969 work2_send(
k,i,j) = ( org_momy(
k,i,j-1) + org_momy(
k,i,j) ) * 0.5_rp
1976 work2_send(
k,i,1) = org_momy(
k,i,1)
1980 call comm_vars8( work2_send(:,:,:), 2 )
1982 call comm_wait ( work1_send(:,:,:), 1, .false. )
1983 call comm_wait ( work2_send(:,:,:), 2, .false. )
1989 u_on_map = work1_send(
k,i,j) / org_dens(
k,i,j)
1990 v_on_map = work2_send(
k,i,j) / org_dens(
k,i,j)
1992 org_u_ll(
k,i,j) = u_on_map * rotc(i,j,1) - v_on_map * rotc(i,j,2)
1993 org_v_ll(
k,i,j) = u_on_map * rotc(i,j,2) + v_on_map * rotc(i,j,1)
1999 tagbase = tagcomm + tag_dens*order_tag_var
2000 call comm_cartesc_nest_intercomm_nestdown( org_dens(:,:,:), &
2002 tagbase, i_sclr, handle, &
2004 flag_dens = .true. )
2006 tagbase = tagcomm + tag_momz*order_tag_var
2007 if ( online_daughter_use_velz )
then
2008 call comm_cartesc_nest_intercomm_nestdown( org_momz(:,:,:), &
2010 tagbase, i_zstg, handle, &
2014 tagbase = tagcomm + tag_momx*order_tag_var
2015 if ( online_daughter_no_rotate )
then
2016 call comm_cartesc_nest_intercomm_nestdown( org_momx(:,:,:), &
2018 tagbase, i_xstg, handle, &
2021 call comm_cartesc_nest_intercomm_nestdown( org_u_ll(:,:,:), &
2023 tagbase, i_sclr, handle, &
2027 tagbase = tagcomm + tag_momy*order_tag_var
2028 if ( online_daughter_no_rotate )
then
2029 call comm_cartesc_nest_intercomm_nestdown( org_momy(:,:,:), &
2031 tagbase, i_ystg, handle, &
2034 call comm_cartesc_nest_intercomm_nestdown( org_v_ll(:,:,:), &
2036 tagbase, i_sclr, handle, &
2040 tagbase = tagcomm + tag_rhot*order_tag_var
2041 call comm_cartesc_nest_intercomm_nestdown( org_rhot(:,:,:), &
2043 tagbase, i_sclr, handle, &
2047 tagbase = tagcomm + (tag_qx*10+iq)*order_tag_var
2048 call comm_cartesc_nest_intercomm_nestdown( org_qtrc(:,:,:,iq), &
2050 tagbase, i_sclr, handle, &
2066 nwait_d = nwait_d + 1
2076 if ( online_aggressive_comm )
then
2085 tagbase = tagcomm + tag_dens*order_tag_var
2086 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
2087 work1_recv(:,:,:), &
2088 tagbase, i_sclr, handle, &
2090 flag_dens = .true. )
2095 dens_recv(
k,i,j) = work1_recv(
k,i,j)
2100 call comm_vars8( dens_recv, 1 )
2102 tagbase = tagcomm + tag_momz*order_tag_var
2104 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
2105 work2_recv(:,:,:), &
2106 tagbase, i_zstg, handle, &
2112 velz_recv(
k,i,j) = work2_recv(
k,i,j) / ( work1_recv(
k,i,j) + work1_recv(
k+1,i,j) ) * 2.0_rp
2119 velz_recv(
datr_ks(handle)-1,i,j) = 0.0_rp
2120 velz_recv(
datr_ke(handle) ,i,j) = 0.0_rp
2125 call comm_wait ( dens_recv, 1, .false. )
2127 tagbase = tagcomm + tag_momx*order_tag_var
2130 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
2131 work1_recv(:,:,:), &
2132 tagbase, i_xstg, handle, &
2136 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
2138 tagbase, i_sclr, handle, &
2142 tagbase = tagcomm + tag_momy*order_tag_var
2145 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
2146 work2_recv(:,:,:), &
2147 tagbase, i_ystg, handle, &
2151 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
2153 tagbase, i_sclr, handle, &
2163 velx_recv(
k,i,j) = work1_recv(
k,i,j) / ( dens_recv(
k,i+1,j) + dens_recv(
k,i,j) ) * 2.0_rp
2172 velx_recv(
k,i,j) = work1_recv(
k,i,j) / dens_recv(
k,i,j)
2176 call comm_vars8( velx_recv, 2 )
2182 vely_recv(
k,i,j) = work2_recv(
k,i,j) / ( dens_recv(
k,i,j+1) + dens_recv(
k,i,j) ) * 2.0_rp
2191 vely_recv(
k,i,j) = work2_recv(
k,i,j) / dens_recv(
k,i,j)
2195 call comm_vars8( vely_recv, 3 )
2197 call comm_wait ( velx_recv, 2, .false. )
2198 call comm_wait ( vely_recv, 3, .false. )
2207 work1_recv(
k,i,j) = u_ll_recv(
k,i,j) * rotc(i,j,1) + v_ll_recv(
k,i,j) * rotc(i,j,2)
2208 work2_recv(
k,i,j) = -u_ll_recv(
k,i,j) * rotc(i,j,2) + v_ll_recv(
k,i,j) * rotc(i,j,1)
2218 velx_recv(
k,i,j) = ( work1_recv(
k,i+1,j) + work1_recv(
k,i,j) ) * 0.5_rp
2227 velx_recv(
k,i,j) = work1_recv(
k,i,j)
2231 call comm_vars8( velx_recv, 2 )
2237 vely_recv(
k,i,j) = ( work2_recv(
k,i,j+1) + work2_recv(
k,i,j) ) * 0.5_rp
2246 vely_recv(
k,i,j) = work2_recv(
k,i,j)
2250 call comm_vars8( vely_recv, 3 )
2252 call comm_wait ( velx_recv, 2, .false. )
2253 call comm_wait ( vely_recv, 3, .false. )
2257 tagbase = tagcomm + tag_rhot*order_tag_var
2258 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
2259 work1_recv(:,:,:), &
2260 tagbase, i_sclr, handle, &
2266 pott_recv(
k,i,j) = work1_recv(
k,i,j) / dens_recv(
k,i,j)
2272 tagbase = tagcomm + (tag_qx*10+iq)*order_tag_var
2273 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
2274 work1_recv(:,:,:), &
2275 tagbase, i_sclr, handle, &
2281 qtrc_recv(
k,i,j,iq) = work1_recv(
k,i,j)
2291 log_error(
"COMM_CARTESC_NEST_nestdown",*)
'internal error'
2307 integer,
intent(in) :: handle
2308 integer,
intent(in) :: bnd_qa
2311 integer :: tagbase, tagcomm
2318 if ( bnd_qa > i_bndqa )
then
2319 log_error(
"COMM_CARTESC_NEST_recvwait_issue",*)
'internal error: about BND_QA'
2323 tagcomm = intercomm_id(handle) * order_tag_comm
2332 nwait_p = nwait_p + 1
2335 call comm_cartesc_nest_issuer_of_wait( handle )
2337 if ( online_aggressive_comm )
then
2353 log_info(
"COMM_CARTESC_NEST_recvwait_issue",
'(1X,A,I5,A)')
"NestIDC [C]: que recv ( ", nrecv,
" )"
2361 tagbase = tagcomm + tag_dens*order_tag_var
2362 call comm_cartesc_nest_issuer_of_receive( tagbase, i_sclr, handle, isu_tag )
2364 tagbase = tagcomm + tag_momz*order_tag_var
2366 call comm_cartesc_nest_issuer_of_receive( tagbase, i_zstg, handle, isu_tag )
2369 tagbase = tagcomm + tag_momx*order_tag_var
2371 call comm_cartesc_nest_issuer_of_receive( tagbase, i_xstg, handle, isu_tag )
2373 call comm_cartesc_nest_issuer_of_receive( tagbase, i_sclr, handle, isu_tag )
2376 tagbase = tagcomm + tag_momy*order_tag_var
2378 call comm_cartesc_nest_issuer_of_receive( tagbase, i_ystg, handle, isu_tag )
2380 call comm_cartesc_nest_issuer_of_receive( tagbase, i_sclr, handle, isu_tag )
2383 tagbase = tagcomm + tag_rhot*order_tag_var
2384 call comm_cartesc_nest_issuer_of_receive( tagbase, i_sclr, handle, isu_tag )
2387 tagbase = tagcomm + (tag_qx*10+iq)*order_tag_var
2388 call comm_cartesc_nest_issuer_of_receive( tagbase, i_sclr, handle, isu_tag )
2396 log_error(
"COMM_CARTESC_NEST_recvwait_issue",*)
'internal error'
2411 integer,
intent(in) :: handle
2431 log_info(
"COMM_CARTESC_NEST_recv_cancel",
'(1X,A,I5,A)')
"NestIDC [C]: CANCEL recv ( ", nrecv,
" )"
2434 if ( ireq_d(rq) /= mpi_request_null )
then
2436 call mpi_cancel(ireq_d(rq), ierr)
2446 log_error_cont(*)
'internal error'
2474 real(RP),
intent(in) :: pvar(:,:,:)
2475 real(RP),
intent(out) :: dvar(:,:,:)
2476 integer,
intent(in) :: tagbase
2477 integer,
intent(in) :: id_stag
2478 integer,
intent(in) :: HANDLE
2479 integer,
intent(inout) :: isu_tag
2481 logical ,
intent(in),
optional :: flag_dens
2483 integer :: ileng, tag, target_rank
2485 integer :: xloc, yloc
2486 integer :: gxs, gxe, gys, gye
2487 integer :: pxs, pxe, pys, pye
2490 integer :: ig, rq, yp
2493 logical :: logarithmic
2501 logarithmic = .false.
2503 if (
present(flag_dens) )
then
2504 if( flag_dens )
then
2505 logarithmic = .true.
2510 if ( id_stag == i_sclr )
then
2513 elseif( id_stag == i_zstg )
then
2516 elseif( id_stag == i_xstg )
then
2519 elseif( id_stag == i_ystg )
then
2535 target_rank = comm_cartesc_nest_tile_list_yp(yp)
2538 call mpi_isend( pvar, &
2547 dvar(:,:,:) = -1.0_rp
2557 do yp = 1, comm_cartesc_nest_tile_all
2573 isu_tag = isu_tag + 1
2578 buffer_ref_3d(zs:ze,gxs:gxe,gys:gye) = recvbuf_3d(zs:ze,pxs:pxe,pys:pye,isu_tag)
2580 if ( isu_tag > max_isu )
then
2581 log_error(
"COMM_CARTESC_NEST_intercomm_nestdown_3D",*)
'Exceeded maximum issue'
2582 log_error_cont(*)
'isu_tag = ', isu_tag
2590 if ( no_zstag )
then
2605 kgrd(:,:,:,:,:,ig), &
2606 vfact(:, :,:,:,ig), &
2607 buffer_ref_cz(:,:,:), &
2609 buffer_ref_3d(:,:,:), &
2612 logwgt = logarithmic )
2629 kgrd(:,:,:,:,:,ig), &
2630 vfact(:, :,:,:,ig), &
2631 buffer_ref_fz(:,:,:), &
2633 buffer_ref_3d(:,:,:), &
2636 logwgt = logarithmic )
2641 dvar( 1:
datr_ks(handle)-1,i,j) = 0.0_rp
2647 log_error(
"COMM_CARTESC_NEST_intercomm_nestdown_3D",*)
'internal error'
2668 integer,
intent(in) :: tagbase
2669 integer,
intent(in) :: id_stag
2670 integer,
intent(in) :: HANDLE
2671 integer,
intent(inout) :: isu_tag
2673 integer :: ierr, ileng
2674 integer :: tag, target_rank
2693 do yp = 1, comm_cartesc_nest_tile_all
2696 target_rank = comm_cartesc_nest_tile_list_d(yp,
prc_myrank+1)
2697 tag = tagbase + call_order(yp)
2699 isu_tag = isu_tag + 1
2701 recvbuf_3d(:,:,:,isu_tag) = 0.0_rp
2703 call mpi_irecv( recvbuf_3d(:,:,:,isu_tag), &
2714 if ( isu_tag > max_isu )
then
2715 log_error(
"COMM_CARTESC_NEST_issuer_of_receive_3D",*)
'Exceeded maximum issue'
2716 log_error_cont(*)
'isu_tag = ', isu_tag
2723 log_error(
"COMM_CARTESC_NEST_issuer_of_receive_3D",*)
'internal error'
2738 integer,
intent(in) :: HANDLE
2754 log_error(
"COMM_CARTESC_NEST_issuer_of_wait_3D",*)
'internal error'
2770 integer,
intent(in) :: req_count
2771 integer,
intent(inout) :: ireq(max_rq)
2775 integer :: istatus(MPI_STATUS_SIZE,req_count)
2776 integer :: req_count2
2777 integer :: ireq2(max_rq)
2787 if ( ireq(i) /= mpi_request_null )
then
2788 req_count2 = req_count2 + 1
2789 ireq2(req_count2) = ireq(i)
2793 if( req_count2 /= 0 )
call mpi_waitall( req_count2, ireq2(1:req_count2), istatus, ierr )
2817 integer,
intent(in) :: handle
2819 integer :: istatus(mpi_status_size)
2831 if ( rq_ctl_p > 0 )
call mpi_test(ireq_p(1), flag, istatus, ierr)
2839 if ( rq_ctl_d > 0 )
call mpi_test(ireq_d(1), flag, istatus, ierr)
2843 log_error(
"COMM_CARTESC_NEST_test",*)
'error'
2862 log_info(
"COMM_CARTESC_NEST_disconnect",
'(1x,A)')
'Waiting finish of whole processes'
2869 log_info(
"COMM_CARTESC_NEST_disconnect",
'(1x,A)')
'Disconnected communication with child'
2876 log_info(
"COMM_CARTESC_NEST_disconnect",
'(1x,A)')
'Disconnected communication with parent'