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
183 integer,
private :: itp_nv = 2
185 integer,
parameter :: tag_lon = 1
186 integer,
parameter :: tag_lat = 2
187 integer,
parameter :: tag_lonuy = 3
188 integer,
parameter :: tag_latuy = 4
189 integer,
parameter :: tag_lonxv = 5
190 integer,
parameter :: tag_latxv = 6
191 integer,
parameter :: tag_cz = 7
192 integer,
parameter :: tag_fz = 8
194 integer,
parameter :: tag_dens = 1
195 integer,
parameter :: tag_momz = 2
196 integer,
parameter :: tag_momx = 3
197 integer,
parameter :: tag_momy = 4
198 integer,
parameter :: tag_rhot = 5
199 integer,
parameter :: tag_qx = 6
201 integer,
parameter :: order_tag_comm = 100000
202 integer,
parameter :: order_tag_var = 1000
206 integer,
private,
parameter :: interp_search_divnum = 10
208 integer,
private :: intercomm_id(2)
210 integer,
private,
parameter :: max_isu = 100
211 integer,
private,
parameter :: max_isuf = 20
212 integer,
private :: max_rq = 1000
213 integer,
private :: rq_ctl_p
214 integer,
private :: rq_ctl_d
215 integer,
private :: rq_tot_p
216 integer,
private :: rq_tot_d
217 integer,
private,
allocatable :: ireq_p(:)
218 integer,
private,
allocatable :: ireq_d(:)
219 integer,
private,
allocatable :: call_order(:)
221 real(RP),
private,
allocatable :: buffer_2d (:,:)
222 real(RP),
private,
allocatable :: buffer_3d (:,:,:)
223 real(RP),
private,
allocatable :: buffer_3df (:,:,:)
224 real(RP),
private,
allocatable :: recvbuf_3d (:,:,:,:)
225 real(RP),
private,
allocatable :: recvbuf_3df(:,:,:,:)
227 real(RP),
private,
allocatable :: buffer_ref_lon (:,:)
228 real(RP),
private,
allocatable :: buffer_ref_lonuy(:,:)
229 real(RP),
private,
allocatable :: buffer_ref_lonxv(:,:)
230 real(RP),
private,
allocatable :: buffer_ref_lat (:,:)
231 real(RP),
private,
allocatable :: buffer_ref_latuy(:,:)
232 real(RP),
private,
allocatable :: buffer_ref_latxv(:,:)
233 real(RP),
private,
allocatable :: buffer_ref_cz (:,:,:)
234 real(RP),
private,
allocatable :: buffer_ref_fz (:,:,:)
237 real(RP),
private,
allocatable :: buffer_ref_3d (:,:,:)
238 real(RP),
private,
allocatable :: buffer_ref_3df(:,:,:)
240 real(RP),
private,
allocatable :: org_dens(:,:,:)
241 real(RP),
private,
allocatable :: org_momz(:,:,:)
242 real(RP),
private,
allocatable :: org_momx(:,:,:)
243 real(RP),
private,
allocatable :: org_momy(:,:,:)
244 real(RP),
private,
allocatable :: org_u_ll(:,:,:)
245 real(RP),
private,
allocatable :: org_v_ll(:,:,:)
246 real(RP),
private,
allocatable :: org_rhot(:,:,:)
247 real(RP),
private,
allocatable :: org_qtrc(:,:,:,:)
249 integer,
private,
allocatable :: igrd (:,:,:,:)
250 integer,
private,
allocatable :: jgrd (:,:,:,:)
251 real(RP),
private,
allocatable :: hfact(:,:,:,:)
252 integer,
private,
allocatable :: kgrd (:,:,:,:,:,:)
253 real(RP),
private,
allocatable :: vfact(:,:,:,:,:,:)
255 integer(8),
private :: nwait_p, nwait_d, nrecv, nsend
257 character(len=H_SHORT) :: mp_type
270 file_get_attribute, &
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
304 character(len=H_LONG) :: LATLON_CATALOGUE_FNAME =
'latlon_domain_catalogue.txt' 306 integer :: ONLINE_SPECIFIED_MAXRQ = 0
311 logical :: flag_parent = .false.
312 logical :: flag_child = .false.
314 integer :: imaxg(1), jmaxg(1)
315 integer :: pnum_x(1), pnum_y(1)
317 logical :: error, existed
319 namelist / param_comm_cartesc_nest / &
320 latlon_catalogue_fname, &
321 offline_parent_basename, &
322 offline_parent_prc_num_x, &
323 offline_parent_prc_num_y, &
330 online_aggressive_comm, &
332 online_specified_maxrq, &
339 log_info(
"COMM_CARTESC_NEST_setup",*)
'Setup' 341 if (
present(inter_parent) )
then 342 if( inter_parent /= mpi_comm_null ) flag_child = .true.
344 if (
present(inter_child) )
then 345 if( inter_child /= mpi_comm_null ) flag_parent = .true.
348 offline_parent_basename =
"" 357 online_wait_limit = 999999999
358 online_aggressive_comm = .true.
362 read(
io_fid_conf,nml=param_comm_cartesc_nest,iostat=ierr)
364 log_info(
"COMM_CARTESC_NEST_setup",*)
'Not found namelist. Default used.' 365 elseif( ierr > 0 )
then 366 log_error(
"COMM_CARTESC_NEST_setup",*)
'Not appropriate names in namelist PARAM_COMM_CARTESC_NEST. Check!' 369 log_nml(param_comm_cartesc_nest)
373 if ( offline_parent_basename /=
"" )
then 379 call file_open( offline_parent_basename, &
381 aggregate = .false. )
383 call file_get_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_imaxg", &
384 imaxg(:), existed=existed )
386 call file_get_attribute( fid,
"global",
"scale_cartesC_prc_num_x", &
387 pnum_x(:), existed=existed )
390 offline_parent_imax = imaxg(1) / pnum_x(1)
393 call file_get_shape( fid,
"CX", dims(:) )
394 offline_parent_imax = dims(1)-
ihalo*2
397 call file_get_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_jmaxg", &
398 jmaxg(:), existed=existed )
400 call file_get_attribute( fid,
"global",
"scale_cartesC_prc_num_y", &
401 pnum_y(:), existed=existed )
404 offline_parent_jmax = jmaxg(1) / pnum_y(1)
407 call file_get_shape( fid,
"CY", dims(:) )
408 offline_parent_jmax = dims(1)-
jhalo*2
411 call file_get_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_kmax", &
412 dims(:), existed=existed )
414 offline_parent_kmax = dims(1)
416 call file_get_shape( fid,
"z", dims(:), error=error )
418 offline_parent_kmax = 0
420 offline_parent_kmax = dims(1)
424 call file_get_attribute( fid,
"global",
"scale_ocean_grid_cartesC_index_kmax", &
425 dims(:), existed=existed )
427 offline_parent_okmax = dims(1)
430 call file_get_shape( fid,
"oz", dims(:), error=error )
432 offline_parent_okmax = 0
434 offline_parent_okmax = dims(1)
438 call file_get_attribute( fid,
"global",
"scale_land_grid_cartesC_index_kmax", &
439 dims(:), existed=existed )
441 offline_parent_lkmax = dims(1)
444 call file_get_shape( fid,
"lz", dims(:), error=error )
446 offline_parent_lkmax = 0
448 offline_parent_lkmax = dims(1)
453 call comm_bcast( offline_parent_imax )
454 call comm_bcast( offline_parent_jmax )
455 call comm_bcast( offline_parent_kmax )
456 call comm_bcast( offline_parent_okmax )
457 call comm_bcast( offline_parent_lkmax )
463 log_error(
"COMM_CARTESC_NEST_setup",*)
'OFFLINE and ONLINE cannot be use at the same time' 476 if( online_specified_maxrq > max_rq ) max_rq = online_specified_maxrq
478 allocate( ireq_p(max_rq) )
479 allocate( ireq_d(max_rq) )
480 allocate( call_order(max_rq) )
481 ireq_p(:) = mpi_request_null
482 ireq_d(:) = mpi_request_null
496 parent_prc_num_x(
handling_num) = offline_parent_prc_num_x
497 parent_prc_num_y(
handling_num) = offline_parent_prc_num_y
505 allocate( latlon_catalog(parent_prc_nprocs(
handling_num),2,2) )
510 file = trim(latlon_catalogue_fname), &
511 form =
'formatted', &
515 if ( ierr /= 0 )
then 516 log_error(
"COMM_CARTESC_NEST_setup",*)
'cannot open latlon-catalogue file!' 521 read(fid,
'(i8,4f32.24)',iostat=ierr) parent_id, &
522 latlon_catalog(i,i_min,i_lon), latlon_catalog(i,i_max,i_lon), &
523 latlon_catalog(i,i_min,i_lat), latlon_catalog(i,i_max,i_lat)
524 if ( i /= parent_id )
then 525 log_error(
"COMM_CARTESC_NEST_setup",*)
'internal error: parent mpi id' 528 if ( ierr /= 0 )
exit 556 log_info(
"COMM_CARTESC_NEST_setup",*)
"flag_parent", flag_parent,
"flag_child", flag_child
559 if( flag_parent )
then 562 log_error(
"COMM_CARTESC_NEST_setup",*)
'[NEST_setup] Parent Flag from launcher is not consistent with namelist!' 572 log_info(
"COMM_CARTESC_NEST_setup",
'(1x,A,I2,A)')
'Online Nesting - PARENT [INTERCOMM_ID:', &
574 log_info(
"COMM_CARTESC_NEST_setup",*)
'Online Nesting - INTERCOMM :',
intercomm_daughter 593 log_info(
"COMM_CARTESC_NEST_setup",
'(1x,A)' )
'Informations of Parent Domain [me]' 594 log_info_cont(
'(1x,A,I6)' )
'--- PARENT_PRC_nprocs :', parent_prc_nprocs(
handling_num)
595 log_info_cont(
'(1x,A,I6)' )
'--- PARENT_PRC_NUM_X :', parent_prc_num_x(
handling_num)
596 log_info_cont(
'(1x,A,I6)' )
'--- PARENT_PRC_NUM_Y :', parent_prc_num_y(
handling_num)
602 log_info_cont(
'(1x,A)' )
'Informations of Daughter Domain' 603 log_info_cont(
'(1x,A,I6)' )
'--- DAUGHTER_PRC_nprocs :', daughter_prc_nprocs(
handling_num)
604 log_info_cont(
'(1x,A,I6)' )
'--- DAUGHTER_PRC_NUM_X :', daughter_prc_num_x(
handling_num)
605 log_info_cont(
'(1x,A,I6)' )
'--- DAUGHTER_PRC_NUM_Y :', daughter_prc_num_y(
handling_num)
611 log_info_cont(
'(1x,A,I6) ')
'Limit Num. NCOMM req. :', max_rq
628 if( flag_child )
then 631 log_error(
"COMM_CARTESC_NEST_setup",*)
'[NEST_setup] Child Flag from launcher is not consistent with namelist!' 641 log_info(
"COMM_CARTESC_NEST_setup",
'(1x,A,I2,A)')
'Online Nesting - DAUGHTER [INTERCOMM_ID:', &
643 log_info(
"COMM_CARTESC_NEST_setup",*)
'Online Nesting - INTERCOMM :',
intercomm_parent 649 allocate( latlon_catalog(parent_prc_nprocs(
handling_num),2,2) )
665 log_info(
"COMM_CARTESC_NEST_setup",
'(1x,A)' )
'Informations of Parent Domain' 666 log_info_cont(
'(1x,A,I6)' )
'--- PARENT_PRC_nprocs :', parent_prc_nprocs(
handling_num)
667 log_info_cont(
'(1x,A,I6)' )
'--- PARENT_PRC_NUM_X :', parent_prc_num_x(
handling_num)
668 log_info_cont(
'(1x,A,I6)' )
'--- PARENT_PRC_NUM_Y :', parent_prc_num_y(
handling_num)
674 log_info_cont(
'(1x,A)' )
'Informations of Daughter Domain [me]' 675 log_info_cont(
'(1x,A,I6)' )
'--- DAUGHTER_PRC_nprocs :', daughter_prc_nprocs(
handling_num)
676 log_info_cont(
'(1x,A,I6)' )
'--- DAUGHTER_PRC_NUM_X :', daughter_prc_num_x(
handling_num)
677 log_info_cont(
'(1x,A,I6)' )
'--- DAUGHTER_PRC_NUM_Y :', daughter_prc_num_y(
handling_num)
683 log_info_cont(
'(1x,A)' )
'Informations of Target Tiles' 687 log_info_cont(
'(1x,A,I6) ')
'Limit Num. NCOMM req. :', max_rq
725 buffer_ref_lon(:,:), &
726 buffer_ref_lat(:,:), &
727 buffer_ref_cz(:,:,:), &
736 igrd( :,:,:,i_sclr), &
737 jgrd( :,:,:,i_sclr), &
738 hfact( :,:,:,i_sclr), &
739 kgrd(:,:,:,:,:,i_sclr), &
740 vfact(:,:,:,:,:,i_sclr) )
749 buffer_ref_lon(:,:), &
750 buffer_ref_lat(:,:), &
751 buffer_ref_fz(:,:,:), &
760 igrd( :,:,:,i_zstg), &
761 jgrd( :,:,:,i_zstg), &
762 hfact( :,:,:,i_zstg), &
763 kgrd(:,:,:,:,:,i_zstg), &
764 vfact(:,:,:,:,:,i_zstg) )
773 buffer_ref_lonuy(:,:), &
774 buffer_ref_latxv(:,:), &
775 buffer_ref_cz(:,:,:), &
784 igrd( :,:,:,i_xstg), &
785 jgrd( :,:,:,i_xstg), &
786 hfact( :,:,:,i_xstg), &
787 kgrd(:,:,:,:,:,i_xstg), &
788 vfact(:,:,:,:,:,i_xstg) )
797 buffer_ref_lonxv(:,:), &
798 buffer_ref_latxv(:,:), &
799 buffer_ref_cz(:,:,:), &
808 igrd( :,:,:,i_ystg), &
809 jgrd( :,:,:,i_ystg), &
810 hfact( :,:,:,i_ystg), &
811 kgrd(:,:,:,:,:,i_ystg), &
812 vfact(:,:,:,:,:,i_ystg) )
814 deallocate( buffer_2d )
815 deallocate( buffer_3d )
816 deallocate( buffer_3df )
844 integer,
intent(in) :: HANDLE
846 integer :: x_min, x_max
847 integer :: y_min, y_max
854 x_min = parent_prc_num_x(handle)
856 y_min = parent_prc_num_y(handle)
859 do p = 1, parent_prc_nprocs(handle)
860 if ( ( ( latlon_local(i_min,i_lon) >= latlon_catalog(p,i_min,i_lon) &
861 .AND. latlon_local(i_min,i_lon) <= latlon_catalog(p,i_max,i_lon) ) .OR. &
862 ( latlon_local(i_max,i_lon) >= latlon_catalog(p,i_min,i_lon) &
863 .AND. latlon_local(i_max,i_lon) <= latlon_catalog(p,i_max,i_lon) ) .OR. &
864 ( latlon_catalog(p,i_min,i_lon) >= latlon_local(i_min,i_lon) &
865 .AND. latlon_catalog(p,i_min,i_lon) <= latlon_local(i_max,i_lon) ) .OR. &
866 ( latlon_catalog(p,i_max,i_lon) >= latlon_local(i_min,i_lon) &
867 .AND. latlon_catalog(p,i_max,i_lon) <= latlon_local(i_max,i_lon) ) ) .AND. &
868 ( ( latlon_local(i_min,i_lat) >= latlon_catalog(p,i_min,i_lat) &
869 .AND. latlon_local(i_min,i_lat) <= latlon_catalog(p,i_max,i_lat) ) .OR. &
870 ( latlon_local(i_max,i_lat) >= latlon_catalog(p,i_min,i_lat) &
871 .AND. latlon_local(i_max,i_lat) <= latlon_catalog(p,i_max,i_lat) ) .OR. &
872 ( latlon_catalog(p,i_min,i_lat) >= latlon_local(i_min,i_lat) &
873 .AND. latlon_catalog(p,i_min,i_lat) <= latlon_local(i_max,i_lat) ) .OR. &
874 ( latlon_catalog(p,i_max,i_lat) >= latlon_local(i_min,i_lat) &
875 .AND. latlon_catalog(p,i_max,i_lat) <= latlon_local(i_max,i_lat) ) ) )
then 876 if ( latlon_catalog(p,i_min,i_lon) <= latlon_local(i_min,i_lon) ) hit(i_min,i_lon) = .true.
877 if ( latlon_catalog(p,i_max,i_lon) >= latlon_local(i_max,i_lon) ) hit(i_max,i_lon) = .true.
878 if ( latlon_catalog(p,i_min,i_lat) <= latlon_local(i_min,i_lat) ) hit(i_min,i_lat) = .true.
879 if ( latlon_catalog(p,i_max,i_lat) >= latlon_local(i_max,i_lat) ) hit(i_max,i_lat) = .true.
880 i = mod(p-1, parent_prc_num_x(handle))
881 j = (p-1) / parent_prc_num_x(handle)
882 if ( i < x_min ) x_min = i
883 if ( i > x_max ) x_max = i
884 if ( j < y_min ) y_min = j
885 if ( j > y_max ) y_max = j
889 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 890 log_error(
"COMM_CARTESC_NEST_domain_relate",*)
'region of daughter domain is larger than that of parent' 892 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)
893 log_error_cont(
'(A,F12.6,1x,F12.6)')
'daughter local (me) MIN-MAX: LON=', &
894 latlon_local(i_min,i_lon), latlon_local(i_max,i_lon)
895 do p = 1, parent_prc_nprocs(handle)
896 log_error_cont(
'(A,I5,A,F12.6,1x,F12.6)')
' parent (', p,
') MIN-MAX: LON=', &
897 latlon_catalog(p,i_min,i_lon) ,latlon_catalog(p,i_max,i_lon)
899 log_error_cont(
'(A,F12.6,1x,F12.6)')
'daughter local (me): MIN-MAX LAT=', &
900 latlon_local(i_min,i_lat), latlon_local(i_max,i_lat)
901 do p = 1, parent_prc_nprocs(handle)
902 log_error_cont(
'(A,I5,A,F12.6,1x,F12.6)')
' parent (', p,
') MIN-MAX: LAT=', &
903 latlon_catalog(p,i_min,i_lat) ,latlon_catalog(p,i_max,i_lat)
915 log_info(
"COMM_CARTESC_NEST_domain_relate",
'(1x,A)')
'NEST: target process tile in parent domain' 941 integer,
intent(out) :: tilei, tilej
942 integer,
intent(out) :: cxs, cxe, cys, cye
943 integer,
intent(out) :: pxs, pxe, pys, pye
944 integer,
intent(in) :: iloc
948 integer :: xloc, yloc
949 integer :: xlocg, ylocg
956 yloc = int(
real(iloc-1) /
real(COMM_CARTESC_NEST_TILE_NUM_X) ) + 1
957 xlocg = mod( rank, offline_parent_prc_num_x ) + 1
958 ylocg = int(
real(rank) /
real(OFFLINE_PARENT_PRC_NUM_X) ) + 1
962 cxs = tilei * (xloc-1) + 1
964 cys = tilej * (yloc-1) + 1
971 if ( xlocg == 1 )
then 976 if ( xlocg == offline_parent_prc_num_x )
then 979 if ( ylocg == 1 )
then 984 if ( ylocg == offline_parent_prc_num_y )
then 993 subroutine comm_cartesc_nest_parentsize( &
1012 integer,
intent(in) :: HANDLE
1015 integer :: datapack(14)
1017 integer :: QA_OTHERSIDE
1018 character(len=H_SHORT) :: MP_TYPE_OTHERSIDE
1020 integer :: ireq1, ireq2, ireq3, ierr1, ierr2, ierr3, ileng
1021 integer :: istatus(mpi_status_size)
1027 tag = intercomm_id(handle) * 100
1055 call mpi_wait(ireq1, istatus, ierr1)
1056 call mpi_wait(ireq2, istatus, ierr2)
1057 call mpi_wait(ireq3, istatus, ierr3)
1060 parent_prc_nprocs(handle) = datapack( 1)
1061 parent_prc_num_x(handle) = datapack( 2)
1062 parent_prc_num_y(handle) = datapack( 3)
1066 prnt_ks(handle) = datapack( 7)
1067 prnt_ke(handle) = datapack( 8)
1068 prnt_is(handle) = datapack( 9)
1069 prnt_ie(handle) = datapack(10)
1070 prnt_js(handle) = datapack(11)
1071 prnt_je(handle) = datapack(12)
1080 call mpi_wait(ireq1, istatus, ierr1)
1081 call mpi_wait(ireq2, istatus, ierr2)
1082 call mpi_wait(ireq3, istatus, ierr3)
1084 call comm_bcast(datapack, ileng)
1085 call comm_bcast(buffer)
1086 call comm_bcast(mp_type_otherside)
1088 daughter_prc_nprocs(handle) = datapack( 1)
1089 daughter_prc_num_x(handle) = datapack( 2)
1090 daughter_prc_num_y(handle) = datapack( 3)
1094 datr_ks(handle) = datapack( 7)
1095 datr_ke(handle) = datapack( 8)
1096 datr_is(handle) = datapack( 9)
1097 datr_ie(handle) = datapack(10)
1098 datr_js(handle) = datapack(11)
1099 datr_je(handle) = datapack(12)
1101 qa_otherside = datapack(14)
1114 call mpi_wait(ireq1, istatus, ierr1)
1115 call mpi_wait(ireq2, istatus, ierr2)
1116 call mpi_wait(ireq3, istatus, ierr3)
1118 call comm_bcast(datapack, ileng)
1119 call comm_bcast(buffer)
1120 call comm_bcast(mp_type_otherside)
1122 parent_prc_nprocs(handle) = datapack( 1)
1123 parent_prc_num_x(handle) = datapack( 2)
1124 parent_prc_num_y(handle) = datapack( 3)
1128 prnt_ks(handle) = datapack( 7)
1129 prnt_ke(handle) = datapack( 8)
1130 prnt_is(handle) = datapack( 9)
1131 prnt_ie(handle) = datapack(10)
1132 prnt_js(handle) = datapack(11)
1133 prnt_je(handle) = datapack(12)
1135 qa_otherside = datapack(14)
1159 call mpi_wait(ireq1, istatus, ierr1)
1160 call mpi_wait(ireq2, istatus, ierr2)
1161 call mpi_wait(ireq3, istatus, ierr3)
1164 daughter_prc_nprocs(handle) = datapack( 1)
1165 daughter_prc_num_x(handle) = datapack( 2)
1166 daughter_prc_num_y(handle) = datapack( 3)
1170 datr_ks(handle) = datapack( 7)
1171 datr_ke(handle) = datapack( 8)
1172 datr_is(handle) = datapack( 9)
1173 datr_ie(handle) = datapack(10)
1174 datr_js(handle) = datapack(11)
1175 datr_je(handle) = datapack(12)
1179 log_error(
"COMM_CARTESC_NEST_parentsize",*)
'[COMM_CARTESC_NEST_parentsize] internal error' 1186 log_info(
"COMM_CARTESC_NEST_parentsize",*)
'Hydrometeor will be diagnosed' 1187 log_info(
"COMM_CARTESC_NEST_parentsize",*)
'MP type (remote,local) = ', trim(mp_type_otherside),
", ", trim(mp_type)
1188 log_info(
"COMM_CARTESC_NEST_parentsize",*)
'Number of QA (remote,local) = ', qa_otherside,
comm_cartesc_nest_bnd_qa 1194 end subroutine comm_cartesc_nest_parentsize
1198 subroutine comm_cartesc_nest_catalogue( &
1212 integer,
intent(in) :: HANDLE
1214 integer :: ireq, ierr, ileng
1215 integer :: istatus(mpi_status_size)
1221 tag = intercomm_id(handle) * 100
1231 call mpi_wait(ireq, istatus, ierr)
1238 ileng = parent_prc_nprocs(handle) * 2 * 2
1242 call mpi_wait(ireq, istatus, ierr)
1244 call comm_bcast( latlon_catalog, parent_prc_nprocs(handle), 2, 2 )
1247 log_error(
"COMM_CARTESC_NEST_catalogue",*)
'internal error' 1252 end subroutine comm_cartesc_nest_catalogue
1256 subroutine comm_cartesc_nest_ping( &
1266 integer,
intent(in) :: HANDLE
1268 integer :: ping, pong
1269 integer :: ireq1, ireq2, ierr1, ierr2
1270 integer :: istatus(mpi_status_size)
1272 logical :: ping_error
1277 tag = intercomm_id(handle) * 100
1278 ping_error = .false.
1290 call mpi_wait(ireq1, istatus, ierr1)
1291 call mpi_wait(ireq2, istatus, ierr2)
1294 call comm_bcast(pong)
1296 if ( pong /= intercomm_id(handle)+1 ) ping_error = .true.
1308 call mpi_wait(ireq1, istatus, ierr1)
1309 call mpi_wait(ireq2, istatus, ierr2)
1312 call comm_bcast(pong)
1314 if ( pong /= intercomm_id(handle) ) ping_error = .true.
1317 log_error(
"COMM_CARTESC_NEST_ping",*)
'internal error' 1321 if ( ping_error )
then 1322 log_error(
"COMM_CARTESC_NEST_ping",*)
'ping destination error' 1327 end subroutine comm_cartesc_nest_ping
1331 subroutine comm_cartesc_nest_setup_nestdown( &
1342 integer,
intent(in) :: HANDLE
1344 integer,
allocatable :: buffer_LIST (:)
1345 integer,
allocatable :: buffer_ALLLIST(:)
1347 integer :: ireq, ierr, ileng
1348 integer :: istatus(mpi_status_size)
1349 integer :: tag, target_rank
1356 tag = intercomm_id(handle) * 100
1364 call mpi_wait(ireq, istatus, ierr)
1366 call comm_bcast(comm_cartesc_nest_tile_allmax_p)
1368 allocate( comm_cartesc_nest_tile_list_p(comm_cartesc_nest_tile_allmax_p,daughter_prc_nprocs(handle)) )
1369 allocate( comm_cartesc_nest_tile_list_yp(comm_cartesc_nest_tile_allmax_p*daughter_prc_nprocs(handle)) )
1371 ileng = comm_cartesc_nest_tile_allmax_p*daughter_prc_nprocs(handle)
1374 call mpi_wait(ireq, istatus, ierr)
1376 call comm_bcast(comm_cartesc_nest_tile_list_p, comm_cartesc_nest_tile_allmax_p, daughter_prc_nprocs(handle))
1378 comm_cartesc_nest_tile_list_yp(:) = -1
1381 do j = 1, daughter_prc_nprocs(handle)
1382 do i = 1, comm_cartesc_nest_tile_allmax_p
1383 if ( comm_cartesc_nest_tile_list_p(i,j) ==
prc_myrank )
then 1385 comm_cartesc_nest_tile_list_yp(k) = j - 1
1391 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
1395 call mpi_wait(ireq, istatus, ierr)
1397 call comm_bcast(online_daughter_use_velz)
1399 log_info(
"COMM_CARTESC_NEST_setup_nestdown",
'(1x,A,L2)')
'NEST: ONLINE_DAUGHTER_USE_VELZ =', online_daughter_use_velz
1403 call mpi_wait(ireq, istatus, ierr)
1405 call comm_bcast(online_daughter_no_rotate)
1408 log_error(
"COMM_CARTESC_NEST_setup_nestdown",*)
'Flag of NO_ROTATE is not consistent with the child domain' 1410 log_error_cont(*)
'ONLINE_DAUGHTER_NO_ROTATE =', online_daughter_no_rotate
1413 log_info(
"COMM_CARTESC_NEST_setup_nestdown",
'(1x,A,L2)')
'NEST: ONLINE_DAUGHTER_NO_ROTATE =', online_daughter_no_rotate
1415 call comm_cartesc_nest_importgrid_nestdown( handle )
1418 target_rank = comm_cartesc_nest_tile_list_yp(i)
1419 call mpi_isend(i, 1, mpi_integer, target_rank, tag+5,
intercomm_daughter, ireq, ierr)
1420 call mpi_wait(ireq, istatus, ierr)
1430 call mpi_allreduce( comm_cartesc_nest_tile_all, &
1431 comm_cartesc_nest_tile_allmax_d, &
1437 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
1441 call mpi_wait(ireq, istatus, ierr)
1444 allocate( buffer_list(comm_cartesc_nest_tile_allmax_d) )
1445 allocate( buffer_alllist(comm_cartesc_nest_tile_allmax_d*daughter_prc_nprocs(handle)) )
1446 allocate( comm_cartesc_nest_tile_list_d(comm_cartesc_nest_tile_allmax_d,daughter_prc_nprocs(handle)) )
1448 do i = 1, comm_cartesc_nest_tile_allmax_d
1449 if ( i <= comm_cartesc_nest_tile_all )
then 1456 ileng = comm_cartesc_nest_tile_allmax_d
1457 call mpi_allgather( buffer_list(:), &
1460 buffer_alllist(:), &
1466 do j = 1, daughter_prc_nprocs(handle)
1467 do i = 1, comm_cartesc_nest_tile_allmax_d
1468 comm_cartesc_nest_tile_list_d(i,j) = buffer_alllist(k)
1473 deallocate( buffer_list )
1474 deallocate( buffer_alllist )
1476 ileng = comm_cartesc_nest_tile_allmax_d*daughter_prc_nprocs(handle)
1479 call mpi_wait(ireq, istatus, ierr)
1484 call mpi_wait(ireq, istatus, ierr)
1489 call mpi_wait(ireq, istatus, ierr)
1491 call comm_bcast(online_daughter_no_rotate)
1493 call comm_cartesc_nest_importgrid_nestdown( handle )
1495 do i = 1, comm_cartesc_nest_tile_all
1496 target_rank = comm_cartesc_nest_tile_list_d(i,
prc_myrank+1)
1497 call mpi_irecv( call_order(i), 1, mpi_integer, target_rank, tag+5,
intercomm_parent, ireq, ierr )
1498 call mpi_wait(ireq, istatus, ierr)
1503 log_error(
"COMM_CARTESC_NEST_setup_nestdown",*)
'internal error' 1507 if( num_yp * 16 > max_rq .OR. comm_cartesc_nest_tile_all * 16 > max_rq )
then 1508 log_error(
"COMM_CARTESC_NEST_setup_nestdown",*)
'internal error (overflow number of ireq)' 1509 log_error_cont(*)
'NUM_YP x 16 = ', num_yp * 16
1510 log_error_cont(*)
'COMM_CARTESC_NEST_TILE_ALL x 16 = ', comm_cartesc_nest_tile_all * 16
1511 log_error_cont(*)
'max_rq = ', max_rq
1516 end subroutine comm_cartesc_nest_setup_nestdown
1520 subroutine comm_cartesc_nest_importgrid_nestdown( &
1538 integer,
intent(in) :: HANDLE
1540 integer :: ierr, ileng
1541 integer :: istatus(mpi_status_size)
1542 integer :: tag, tagbase, target_rank
1544 integer :: xloc, yloc
1548 real(RP) :: max_ref, max_loc
1555 tagbase = intercomm_id(handle) * 100
1564 target_rank = comm_cartesc_nest_tile_list_yp(i)
1568 tag = tagbase + tag_lon
1570 call mpi_wait(ireq_p(rq), istatus, ierr)
1574 tag = tagbase + tag_lat
1576 call mpi_wait(ireq_p(rq), istatus, ierr)
1580 tag = tagbase + tag_lonuy
1582 call mpi_wait(ireq_p(rq), istatus, ierr)
1586 tag = tagbase + tag_latuy
1588 call mpi_wait(ireq_p(rq), istatus, ierr)
1592 tag = tagbase + tag_lonxv
1594 call mpi_wait(ireq_p(rq), istatus, ierr)
1598 tag = tagbase + tag_latxv
1600 call mpi_wait(ireq_p(rq), istatus, ierr)
1604 tag = tagbase + tag_cz
1606 call mpi_wait(ireq_p(rq), istatus, ierr)
1610 tag = tagbase + tag_fz
1612 call mpi_wait(ireq_p(rq), istatus, ierr)
1619 do i = 1, comm_cartesc_nest_tile_all
1621 target_rank = comm_cartesc_nest_tile_list_d(i,
prc_myrank+1)
1624 yloc = int(
real(i-1) /
real(COMM_CARTESC_NEST_TILE_NUM_X) ) + 1
1633 tag = tagbase + tag_lon
1635 call mpi_wait(ireq_d(rq), istatus, ierr)
1640 tag = tagbase + tag_lat
1642 call mpi_wait(ireq_d(rq), istatus, ierr)
1647 tag = tagbase + tag_lonuy
1649 call mpi_wait(ireq_d(rq), istatus, ierr)
1654 tag = tagbase + tag_latuy
1656 call mpi_wait(ireq_d(rq), istatus, ierr)
1661 tag = tagbase + tag_lonxv
1663 call mpi_wait(ireq_d(rq), istatus, ierr)
1668 tag = tagbase + tag_latxv
1670 call mpi_wait(ireq_d(rq), istatus, ierr)
1675 tag = tagbase + tag_cz
1677 call mpi_wait(ireq_d(rq), istatus, ierr)
1684 tag = tagbase + tag_fz
1686 call mpi_wait(ireq_d(rq), istatus, ierr)
1693 max_ref = maxval( buffer_ref_fz(:,:,:) )
1695 if ( max_ref < max_loc )
then 1696 log_error(
"COMM_CARTESC_NEST_importgrid_nestdown",*)
'REQUESTED DOMAIN IS TOO MUCH BROAD' 1697 log_error_cont(*)
'-- VERTICAL direction over the limit' 1698 log_error_cont(*)
'-- reference max: ', max_ref
1699 log_error_cont(*)
'-- local max: ', max_loc
1704 log_error(
"COMM_CARTESC_NEST_importgrid_nestdown",*)
'internal error' 1709 end subroutine comm_cartesc_nest_importgrid_nestdown
1737 integer,
intent(in) :: HANDLE
1738 integer,
intent(in) :: BND_QA
1758 real(RP) :: u_on_map, v_on_map
1760 real(RP) :: dummy(1,1,1)
1761 integer :: tagbase, tagcomm
1762 integer :: isu_tag, isu_tagf
1765 integer :: i, j, k, iq
1770 if ( bnd_qa > i_bndqa )
then 1771 log_error(
"COMM_CARTESC_NEST_nestdown",*)
'internal error: BND_QA is larger than I_BNDQA' 1775 tagcomm = intercomm_id(handle) * order_tag_comm
1785 log_info(
"COMM_CARTESC_NEST_nestdown",
'(1X,A,I5,A)')
"CONeP[P] send( ", nsend,
" )" 1789 org_dens(:,:,:) = dens_send(:,:,:)
1791 org_momz(:,:,:) = momz_send(:,:,:)
1793 org_momx(:,:,:) = momx_send(:,:,:)
1795 org_momy(:,:,:) = momy_send(:,:,:)
1797 org_rhot(:,:,:) = rhot_send(:,:,:)
1800 org_qtrc(:,:,:,iq) = qtrc_send(:,:,:,iq)
1808 if ( .NOT. online_daughter_no_rotate )
then 1813 work1_send(k,i,j) = ( org_momx(k,i-1,j) + org_momx(k,i,j) ) * 0.5_rp
1820 work1_send(k,1,j) = org_momx(k,1,j)
1824 call comm_vars8( work1_send(:,:,:), 1 )
1829 work2_send(k,i,j) = ( org_momy(k,i,j-1) + org_momy(k,i,j) ) * 0.5_rp
1836 work2_send(k,i,1) = org_momy(k,i,1)
1840 call comm_vars8( work2_send(:,:,:), 2 )
1842 call comm_wait ( work1_send(:,:,:), 1, .false. )
1843 call comm_wait ( work2_send(:,:,:), 2, .false. )
1849 u_on_map = work1_send(k,i,j) / org_dens(k,i,j)
1850 v_on_map = work2_send(k,i,j) / org_dens(k,i,j)
1852 org_u_ll(k,i,j) = u_on_map * rotc(i,j,1) - v_on_map * rotc(i,j,2)
1853 org_v_ll(k,i,j) = u_on_map * rotc(i,j,2) + v_on_map * rotc(i,j,1)
1859 tagbase = tagcomm + tag_dens*order_tag_var
1860 call comm_cartesc_nest_intercomm_nestdown( org_dens(:,:,:), &
1862 tagbase, i_sclr, handle, &
1863 isu_tag, isu_tagf, &
1864 flag_dens = .true. )
1866 tagbase = tagcomm + tag_momz*order_tag_var
1867 if ( online_daughter_use_velz )
then 1868 call comm_cartesc_nest_intercomm_nestdown( org_momz(:,:,:), &
1870 tagbase, i_zstg, handle, &
1874 tagbase = tagcomm + tag_momx*order_tag_var
1875 if ( online_daughter_no_rotate )
then 1876 call comm_cartesc_nest_intercomm_nestdown( org_momx(:,:,:), &
1878 tagbase, i_xstg, handle, &
1881 call comm_cartesc_nest_intercomm_nestdown( org_u_ll(:,:,:), &
1883 tagbase, i_sclr, handle, &
1887 tagbase = tagcomm + tag_momy*order_tag_var
1888 if ( online_daughter_no_rotate )
then 1889 call comm_cartesc_nest_intercomm_nestdown( org_momy(:,:,:), &
1891 tagbase, i_ystg, handle, &
1894 call comm_cartesc_nest_intercomm_nestdown( org_v_ll(:,:,:), &
1896 tagbase, i_sclr, handle, &
1900 tagbase = tagcomm + tag_rhot*order_tag_var
1901 call comm_cartesc_nest_intercomm_nestdown( org_rhot(:,:,:), &
1903 tagbase, i_sclr, handle, &
1907 tagbase = tagcomm + (tag_qx*10+iq)*order_tag_var
1908 call comm_cartesc_nest_intercomm_nestdown( org_qtrc(:,:,:,iq), &
1910 tagbase, i_sclr, handle, &
1926 nwait_d = nwait_d + 1
1937 if ( online_aggressive_comm )
then 1946 tagbase = tagcomm + tag_dens*order_tag_var
1947 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
1948 work1_recv(:,:,:), &
1949 tagbase, i_sclr, handle, &
1950 isu_tag, isu_tagf, &
1951 flag_dens = .true. )
1956 dens_recv(k,i,j) = work1_recv(k,i,j)
1961 call comm_vars8( dens_recv, 1 )
1963 tagbase = tagcomm + tag_momz*order_tag_var
1965 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
1966 work2_recv(:,:,:), &
1967 tagbase, i_zstg, handle, &
1973 velz_recv(k,i,j) = work2_recv(k,i,j) / ( work1_recv(k,i,j) + work1_recv(k+1,i,j) ) * 2.0_rp
1980 velz_recv(
datr_ks(handle)-1,i,j) = 0.0_rp
1981 velz_recv(
datr_ke(handle) ,i,j) = 0.0_rp
1986 call comm_wait ( dens_recv, 1, .false. )
1988 tagbase = tagcomm + tag_momx*order_tag_var
1991 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
1992 work1_recv(:,:,:), &
1993 tagbase, i_xstg, handle, &
1997 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
1999 tagbase, i_sclr, handle, &
2003 tagbase = tagcomm + tag_momy*order_tag_var
2006 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
2007 work2_recv(:,:,:), &
2008 tagbase, i_ystg, handle, &
2012 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
2014 tagbase, i_sclr, handle, &
2024 velx_recv(k,i,j) = work1_recv(k,i,j) / ( dens_recv(k,i+1,j) + dens_recv(k,i,j) ) * 2.0_rp
2033 velx_recv(k,i,j) = work1_recv(k,i,j) / dens_recv(k,i,j)
2037 call comm_vars8( velx_recv, 2 )
2043 vely_recv(k,i,j) = work2_recv(k,i,j) / ( dens_recv(k,i,j+1) + dens_recv(k,i,j) ) * 2.0_rp
2052 vely_recv(k,i,j) = work2_recv(k,i,j) / dens_recv(k,i,j)
2056 call comm_vars8( vely_recv, 3 )
2058 call comm_wait ( velx_recv, 2, .false. )
2059 call comm_wait ( vely_recv, 3, .false. )
2068 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)
2069 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)
2079 velx_recv(k,i,j) = ( work1_recv(k,i+1,j) + work1_recv(k,i,j) ) * 0.5_rp
2088 velx_recv(k,i,j) = work1_recv(k,i,j)
2092 call comm_vars8( velx_recv, 2 )
2098 vely_recv(k,i,j) = ( work2_recv(k,i,j+1) + work2_recv(k,i,j) ) * 0.5_rp
2107 vely_recv(k,i,j) = work2_recv(k,i,j)
2111 call comm_vars8( vely_recv, 3 )
2113 call comm_wait ( velx_recv, 2, .false. )
2114 call comm_wait ( vely_recv, 3, .false. )
2118 tagbase = tagcomm + tag_rhot*order_tag_var
2119 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
2120 work1_recv(:,:,:), &
2121 tagbase, i_sclr, handle, &
2127 pott_recv(k,i,j) = work1_recv(k,i,j) / dens_recv(k,i,j)
2133 tagbase = tagcomm + (tag_qx*10+iq)*order_tag_var
2134 call comm_cartesc_nest_intercomm_nestdown( dummy(:,:,:), &
2135 work1_recv(:,:,:), &
2136 tagbase, i_sclr, handle, &
2142 qtrc_recv(k,i,j,iq) = work1_recv(k,i,j)
2152 log_error(
"COMM_CARTESC_NEST_nestdown",*)
'internal error' 2168 integer,
intent(in) :: HANDLE
2169 integer,
intent(in) :: BND_QA
2171 integer :: isu_tag, isu_tagf
2172 integer :: tagbase, tagcomm
2179 if ( bnd_qa > i_bndqa )
then 2180 log_error(
"COMM_CARTESC_NEST_recvwait_issue",*)
'internal error: about BND_QA' 2184 tagcomm = intercomm_id(handle) * order_tag_comm
2193 nwait_p = nwait_p + 1
2196 call comm_cartesc_nest_issuer_of_wait( handle )
2198 if ( online_aggressive_comm )
then 2214 log_info(
"COMM_CARTESC_NEST_recvwait_issue",
'(1X,A,I5,A)')
"NestIDC [C]: que recv ( ", nrecv,
" )" 2223 tagbase = tagcomm + tag_dens*order_tag_var
2224 call comm_cartesc_nest_issuer_of_receive( tagbase, i_sclr, handle, isu_tag, isu_tagf )
2226 tagbase = tagcomm + tag_momz*order_tag_var
2228 call comm_cartesc_nest_issuer_of_receive( tagbase, i_zstg, handle, isu_tag, isu_tagf )
2231 tagbase = tagcomm + tag_momx*order_tag_var
2233 call comm_cartesc_nest_issuer_of_receive( tagbase, i_xstg, handle, isu_tag, isu_tagf )
2235 call comm_cartesc_nest_issuer_of_receive( tagbase, i_sclr, handle, isu_tag, isu_tagf )
2238 tagbase = tagcomm + tag_momy*order_tag_var
2240 call comm_cartesc_nest_issuer_of_receive( tagbase, i_ystg, handle, isu_tag, isu_tagf )
2242 call comm_cartesc_nest_issuer_of_receive( tagbase, i_sclr, handle, isu_tag, isu_tagf )
2245 tagbase = tagcomm + tag_rhot*order_tag_var
2246 call comm_cartesc_nest_issuer_of_receive( tagbase, i_sclr, handle, isu_tag, isu_tagf )
2249 tagbase = tagcomm + (tag_qx*10+iq)*order_tag_var
2250 call comm_cartesc_nest_issuer_of_receive( tagbase, i_sclr, handle, isu_tag, isu_tagf )
2258 log_error(
"COMM_CARTESC_NEST_recvwait_issue",*)
'internal error' 2273 integer,
intent(in) :: HANDLE
2293 log_info(
"COMM_CARTESC_NEST_recv_cancel",
'(1X,A,I5,A)')
"NestIDC [C]: CANCEL recv ( ", nrecv,
" )" 2296 if ( ireq_d(rq) /= mpi_request_null )
then 2298 call mpi_cancel(ireq_d(rq), ierr)
2308 log_error_cont(*)
'internal error' 2334 real(RP),
intent(in) :: pvar(:,:,:)
2335 real(RP),
intent(out) :: dvar(:,:,:)
2336 integer,
intent(in) :: tagbase
2337 integer,
intent(in) :: id_stag
2338 integer,
intent(in) :: HANDLE
2339 integer,
intent(inout) :: isu_tag
2340 integer,
intent(inout) :: isu_tagf
2342 logical ,
intent(in),
optional :: flag_dens
2344 integer :: ileng, tag, target_rank
2346 integer :: xloc, yloc
2347 integer :: gxs, gxe, gys, gye
2348 integer :: pxs, pxe, pys, pye
2351 integer :: ig, rq, yp
2352 logical :: no_zstag = .true.
2353 logical :: logarithmic = .false.
2361 logarithmic = .false.
2362 if (
present(flag_dens) )
then 2363 if( flag_dens ) logarithmic = .true.
2366 if ( id_stag == i_sclr )
then 2369 elseif( id_stag == i_zstg )
then 2372 elseif( id_stag == i_xstg )
then 2375 elseif( id_stag == i_ystg )
then 2380 if ( no_zstag )
then 2395 target_rank = comm_cartesc_nest_tile_list_yp(yp)
2398 call mpi_isend( pvar, &
2407 dvar(:,:,:) = -1.0_rp
2417 do yp = 1, comm_cartesc_nest_tile_all
2421 yloc = int(
real(yp-1) /
real(COMM_CARTESC_NEST_TILE_NUM_X) ) + 1
2433 if ( no_zstag )
then 2434 isu_tag = isu_tag + 1
2439 buffer_ref_3d(zs:ze,gxs:gxe,gys:gye) = recvbuf_3d(zs:ze,pxs:pxe,pys:pye,isu_tag)
2441 isu_tagf = isu_tagf + 1
2446 buffer_ref_3df(zs:ze,gxs:gxe,gys:gye) = recvbuf_3df(zs:ze,pxs:pxe,pys:pye,isu_tagf)
2449 if ( isu_tag > max_isu .OR. isu_tagf > max_isuf )
then 2450 log_error(
"COMM_CARTESC_NEST_intercomm_nestdown_3D",*)
'Exceeded maximum issue' 2451 log_error_cont(*)
'isu_tag = ', isu_tag
2452 log_error_cont(*)
'isu_tagf = ', isu_tagf
2460 if ( no_zstag )
then 2473 kgrd(:,:,:,:,:,ig), &
2474 vfact(:,:,:,:,:,ig), &
2475 buffer_ref_3d(:,:,:), &
2477 logwgt = logarithmic )
2491 kgrd(:,:,:,:,:,ig), &
2492 vfact(:,:,:,:,:,ig), &
2493 buffer_ref_3df(:,:,:), &
2495 logwgt = logarithmic )
2500 dvar( 1:
datr_ks(handle)-1,i,j) = 0.0_rp
2506 log_error(
"COMM_CARTESC_NEST_intercomm_nestdown_3D",*)
'internal error' 2528 integer,
intent(in) :: tagbase
2529 integer,
intent(in) :: id_stag
2530 integer,
intent(in) :: HANDLE
2531 integer,
intent(inout) :: isu_tag
2532 integer,
intent(inout) :: isu_tagf
2534 integer :: ierr, ileng
2535 integer :: tag, target_rank
2537 integer :: ig, rq, yp
2538 logical :: no_zstag = .true.
2543 if ( id_stag == i_sclr )
then 2546 elseif( id_stag == i_zstg )
then 2549 elseif( id_stag == i_xstg )
then 2552 elseif( id_stag == i_ystg )
then 2557 if ( no_zstag )
then 2573 do yp = 1, comm_cartesc_nest_tile_all
2576 target_rank = comm_cartesc_nest_tile_list_d(yp,
prc_myrank+1)
2577 tag = tagbase + call_order(yp)
2579 if ( no_zstag )
then 2580 isu_tag = isu_tag + 1
2582 recvbuf_3d(:,:,:,isu_tag) = 0.0_rp
2584 call mpi_irecv( recvbuf_3d(:,:,:,isu_tag), &
2593 isu_tagf = isu_tagf + 1
2595 recvbuf_3df(:,:,:,isu_tagf) = 0.0_rp
2597 call mpi_irecv( recvbuf_3df(:,:,:,isu_tagf), &
2609 if ( isu_tag > max_isu .OR. isu_tagf > max_isuf )
then 2610 log_error(
"COMM_CARTESC_NEST_issuer_of_receive_3D",*)
'Exceeded maximum issue' 2611 log_error_cont(*)
'isu_tag = ', isu_tag
2612 log_error_cont(*)
'isu_tagf = ', isu_tagf
2619 log_error(
"COMM_CARTESC_NEST_issuer_of_receive_3D",*)
'internal error' 2634 integer,
intent(in) :: HANDLE
2650 log_error(
"COMM_CARTESC_NEST_issuer_of_wait_3D",*)
'internal error' 2666 integer,
intent(in) :: req_count
2667 integer,
intent(inout) :: ireq(max_rq)
2671 integer :: istatus(mpi_status_size,req_count)
2672 integer :: req_count2
2673 integer :: ireq2(max_rq)
2683 if ( ireq(i) /= mpi_request_null )
then 2684 req_count2 = req_count2 + 1
2685 ireq2(req_count2) = ireq(i)
2689 if( req_count2 /= 0 )
call mpi_waitall( req_count2, ireq2(1:req_count2), istatus, ierr )
2713 integer,
intent(in) :: HANDLE
2715 integer :: istatus(mpi_status_size)
2727 if ( rq_ctl_p > 0 )
call mpi_test(ireq_p(1), flag, istatus, ierr)
2735 if ( rq_ctl_d > 0 )
call mpi_test(ireq_d(1), flag, istatus, ierr)
2739 log_error(
"COMM_CARTESC_NEST_test",*)
'error' 2758 log_info(
"COMM_CARTESC_NEST_disconnect",
'(1x,A)')
'Waiting finish of whole processes' 2765 log_info(
"COMM_CARTESC_NEST_disconnect",
'(1x,A)')
'Disconnected communication with child' 2772 log_info(
"COMM_CARTESC_NEST_disconnect",
'(1x,A)')
'Disconnected communication with parent' subroutine, public comm_cartesc_nest_nestdown(HANDLE, BND_QA, DENS_send, MOMZ_send, MOMX_send, MOMY_send, RHOT_send, QTRC_send, DENS_recv, VELZ_recv, VELX_recv, VELY_recv, POTT_recv, QTRC_recv)
Boundary data transfer from parent to daughter: nestdown.
integer, dimension(2), public parent_kmax
parent max number in z-direction
integer, dimension(2), public prnt_je
end index in y-direction in parent
integer, public jmax
of computational cells: y, local
subroutine, public comm_cartesc_nest_disconnect
[finalize: disconnect] Inter-communication
integer, public comm_world
communication world ID
integer, dimension(2), public daughter_ia
daughter max number in x-direction (with halo)
integer, public prc_global_domainid
my domain ID in global communicator
integer, parameter, public khalo
of halo cells: z
integer, dimension(2), public daughter_ja
daughter max number in y-direction (with halo)
subroutine comm_cartesc_nest_issuer_of_receive_3d(tagbase, id_stag, HANDLE, isu_tag, isu_tagf)
[substance of issuer] Inter-communication from parent to daughter: nestdown
integer, public ihalo
of halo cells: x
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lonuv
longitude at staggered point (uv) [rad,0-2pi]
integer, public comm_cartesc_nest_tile_num_y
parent tile number in y-direction
logical, public online_iam_parent
a flag to say "I am a parent"
integer, public intercomm_daughter
integer, dimension(2), public prnt_ke
end index in z-direction in parent
subroutine, public comm_cartesc_nest_domain_relate(HANDLE)
Solve relationship between ParentDomain & Daughter Domain.
integer, public imax
of computational cells: x, local
integer, public time_nstep
total steps [number]
integer, public jhalo
of halo cells: y
integer, dimension(2), public daughter_lkmax
daughter max number in lz-direction
integer, dimension(2), public daughter_ka
daughter max number in z-direction (with halo)
integer, public ia
of whole cells: x, local, with HALO
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_domain_catalogue
domain latlon catalogue [rad]
module Atmosphere Grid CartesianC metirc
integer, public comm_datatype
datatype of variable
integer, dimension(2), public parent_nstep
parent step [number]
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lat
latitude [rad,-pi,pi]
integer, dimension(2), public datr_is
start index in x-direction in daughter
subroutine, public interp_factor3d(npoints, KA_ref, KS_ref, KE_ref, IA_ref, JA_ref, lon_ref, lat_ref, hgt_ref, KA, KS, KE, IA, JA, lon, lat, hgt, idx_i, idx_j, hfact, idx_k, vfact)
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_fz
geopotential height [m] (wxy)
integer, public ja
of whole cells: y, local, with HALO
integer, public io_fid_conf
Config file ID.
real(rp), public const_d2r
degree to radian
subroutine, public interp_interp3d(npoints, KA_ref, IA_ref, JA_ref, KA, KS, KE, IA, JA, idx_i, idx_j, hfact, idx_k, vfact, val_ref, val, logwgt)
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lon
longitude [rad,0-2pi]
integer, public prc_nprocs
myrank in local communicator
subroutine, public file_open(basename, fid, mode, single, aggregate, rankid, postfix)
integer, dimension(2), public daughter_kmax
daughter max number in z-direction
integer, public comm_cartesc_nest_bnd_qa
number of tracer treated in nesting system
integer, public is
start point of inner domain: x, local
integer, public ie
end point of inner domain: x, local
integer, public handling_num
handing number of nesting relation
integer, dimension(2), public parent_ia
parent max number in x-direction (with halo)
integer, dimension(2), public datr_je
end index in y-direction in daughter
subroutine, public comm_cartesc_nest_recv_cancel(HANDLE)
Sub-command for data transfer from parent to daughter: nestdown.
subroutine, public comm_cartesc_nest_setup(QA_MP, MP_TYPE_in, inter_parent, inter_child)
Setup.
logical, public atmos_hydrometeor_dry
module atmosphere / hydrometeor
integer, dimension(10), public comm_cartesc_nest_filiation
index of parent-daughter relation (p>0, d<0)
integer, dimension(2), public datr_js
start index in y-direction in daughter
integer, dimension(2), public parent_jmax
parent max number in y-direction
real(dp), public time_dtsec
time interval of model [sec]
logical, public online_boundary_diagqhyd
integer, dimension(2), public prnt_ie
end index in x-direction in parent
integer, public comm_cartesc_nest_interp_level
horizontal interpolation level
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_latuy
latitude at staggered point (uy) [rad,-pi,pi]
module atmosphere / grid / cartesC index
integer, public ke
end point of inner domain: z, local
integer, dimension(2), public daughter_okmax
daughter max number in oz-direction
logical, public online_iam_daughter
a flag to say "I am a daughter"
subroutine, public comm_cartesc_nest_recvwait_issue(HANDLE, BND_QA)
Sub-command for data transfer from parent to daughter: nestdown.
integer function, public io_get_available_fid()
search & get available file ID
integer, public je
end point of inner domain: y, local
integer, dimension(2), public daughter_jmax
daughter max number in y-direction
real(dp), dimension(2), public daughter_dtsec
daughter DT [sec]
logical, public online_boundary_use_qhyd
integer, dimension(2), public daughter_nstep
daughter steps [number]
integer, dimension(2), public tileal_ja
cells of all tiles in y-direction
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lonxv
longitude at staggered point (xv) [rad,0-2pi]
integer, public ks
start point of inner domain: z, local
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lonuy
longitude at staggered point (uy) [rad,0-2pi]
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_metric_rotc
rotation coefficient
integer, dimension(2), public parent_ja
parent max number in y-direction (with halo)
integer, dimension(2), public datr_ie
end index in x-direction in daughter
integer, dimension(2), public prnt_is
start index in x-direction in parent
integer, public prc_myrank
process num in local communicator
logical, public use_nesting
integer, public kmax
of computational cells: z, local
subroutine, public prc_abort
Abort Process.
subroutine, public comm_cartesc_nest_test(HANDLE)
[check communication status] Inter-communication
module Communication CartesianC nesting
integer, public js
start point of inner domain: y, local
subroutine, public interp_setup(weight_order, search_limit)
Setup.
integer, dimension(2), public tileal_ia
cells of all tiles in x-direction
integer, dimension(2), public parent_lkmax
parent max number in lz-direction
subroutine, public comm_cartesc_nest_domain_shape(tilei, tilej, cxs, cxe, cys, cye, pxs, pxe, pys, pye, iloc)
Return shape of ParentDomain at the specified rank (for offline)
integer, parameter, public h_short
Character length (short=16)
integer, public prc_num_y
y length of 2D processor topology
integer, dimension(2), public daughter_imax
daughter max number in x-direction
subroutine, public prof_rapstart(rapname_base, level)
Start raptime.
integer, dimension(:), allocatable, public comm_cartesc_nest_tile_id
parent tile real id
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_cz
geopotential height [m] (zxy)
subroutine comm_cartesc_nest_issuer_of_wait_3d(HANDLE)
[substance of issuer] Inter-communication from parent to daughter: nestdown
logical, public prc_ismaster
master process in local communicator?
integer, public comm_cartesc_nest_interp_weight_order
horizontal interpolation weight order
integer, public prc_global_comm_world
global communicator
integer, dimension(2), public prnt_js
start index in y-direction in parent
integer, public intercomm_parent
module Atmosphere GRID CartesC Real(real space)
integer, dimension(2), public datr_ke
end index in z-direction in daughter
real(dp), dimension(2), public parent_dtsec
parent DT [sec]
integer, dimension(2), public parent_imax
parent max number in x-direction
integer, dimension(2), public parent_ka
parent max number in z-direction (with halo)
integer, public ka
of whole cells: z, local, with HALO
integer, dimension(2), public parent_okmax
parent max number in oz-direction
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_latuv
latitude at staggered point (uv) [rad,-pi,pi]
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_latxv
latitude at staggered point (xv) [rad,-pi,pi]
subroutine comm_cartesc_nest_intercomm_nestdown_3d(pvar, dvar, tagbase, id_stag, HANDLE, isu_tag, isu_tagf, flag_dens)
Inter-communication from parent to daughter: nestdown.
integer, public debug_domain_num
integer, parameter, public n_hyd
subroutine, public prof_rapend(rapname_base, level)
Save raptime.
integer, public online_domain_num
integer, dimension(2), public prnt_ks
start index in z-direction in parent
integer, dimension(2), public datr_ks
start index in z-direction in daughter
logical, public online_no_rotate
integer, public comm_cartesc_nest_tile_num_x
parent tile number in x-direction
subroutine comm_cartesc_nest_waitall(req_count, ireq)
[substance of comm_wait] Inter-communication
integer, dimension(2), public tileal_ka
cells of all tiles in z-direction
logical, public online_use_velz
integer, public prc_num_x
x length of 2D processor topology