Go to the documentation of this file.
43 integer,
public,
parameter ::
i_l = 1
44 integer,
public,
parameter ::
i_prc = 2
47 integer,
public,
parameter ::
i_dir = 2
50 integer,
public,
parameter ::
i_sw = 1
51 integer,
public,
parameter ::
i_nw = 2
52 integer,
public,
parameter ::
i_ne = 3
53 integer,
public,
parameter ::
i_se = 4
56 integer,
public,
parameter ::
i_w = 1
57 integer,
public,
parameter ::
i_n = 2
58 integer,
public,
parameter ::
i_e = 3
59 integer,
public,
parameter ::
i_s = 4
62 integer,
public,
parameter ::
i_npl = 1
63 integer,
public,
parameter ::
i_spl = 2
99 private :: prc_icoa_rgn_setup
100 private :: prc_icoa_rgn_input
101 private :: prc_icoa_rgn_output
102 private :: prc_icoa_rgn_vertex_walkaround
103 private :: output_info
109 character(len=H_LONG),
private :: prc_icoa_rgn_in_fname =
''
110 character(len=H_LONG),
private :: prc_icoa_rgn_out_fname =
''
112 character(len=2),
private,
parameter :: prc_rgn_edgename(4) = (/
'SW',
'NW',
'NE',
'SE'/)
113 character(len=2),
private,
parameter :: prc_rgn_vertname(4) = (/
'W ',
'N ',
'E ',
'S '/)
115 logical,
private :: debug = .false.
139 namelist / param_prc_icoa / &
150 log_info(
"PRC_ICOA_setup",*)
'Setup'
154 log_progress(*)
'start MPI'
156 log_info(
"PRC_ICOA_setup",*)
'Process information '
166 log_info_cont(
'(1x,A,I12)')
'total process [LOCAL] : ',
prc_nprocs
167 log_info_cont(
'(1x,A,I12)')
'my process ID [LOCAL] : ',
prc_myrank
168 log_info_cont(
'(1x,A,L12)')
'master rank? [LOCAL] : ',
prc_ismaster
170 log_info_cont(
'(1x,A,I12)')
'master rank ID [each world] : ', prc_masterrank
177 log_info(
"PRC_ICOA_setup",*)
'Not found namelist. Default used.'
178 elseif( ierr > 0 )
then
179 log_error(
"PRC_ICOA_setup",*)
'Not appropriate names in namelist PARAM_PRC_ICOA. Check!'
185 log_error(
"PRC_ICOA_setup",*)
'PRC_RGN_level is not appropriate :',
prc_rgn_level
193 log_error(
"PRC_ICOA_setup",*)
'PRC_RGN_ndiamond is not appropriate :',
prc_rgn_ndiamond
201 log_error(
"PRC_ICOA_setup",*)
'Number of total region must be divisible by the number of process',
prc_rgn_total,
prc_nprocs
210 call prc_icoa_rgn_setup
236 subroutine prc_icoa_rgn_setup
243 namelist / param_prc_icoa_rgn / &
244 prc_icoa_rgn_in_fname, &
245 prc_icoa_rgn_out_fname, &
253 log_info(
"PRC_ICOA_RGN_setup",*)
'Setup'
257 read(
io_fid_conf,nml=param_prc_icoa_rgn,iostat=ierr)
259 log_info(
"PRC_ICOA_RGN_setup",*)
'Not found namelist. Default used.'
260 elseif( ierr > 0 )
then
261 log_error(
"PRC_ICOA_RGN_setup",*)
'Not appropriate names in namelist PARAM_PRC_ICOA_RGN. Check!'
270 if ( prc_icoa_rgn_in_fname /=
'' )
then
271 call prc_icoa_rgn_input( prc_icoa_rgn_in_fname, &
278 log_info(
"PRC_ICOA_RGN_setup",*)
'input file is not specified.'
289 if ( prc_icoa_rgn_out_fname /=
'' )
then
290 call prc_icoa_rgn_output( prc_icoa_rgn_out_fname, &
347 end subroutine prc_icoa_rgn_setup
351 subroutine prc_icoa_rgn_input( &
362 character(len=*),
intent(in) :: in_fname
363 integer,
intent(in) :: pall
364 integer,
intent(in) :: rall
365 integer,
intent(in) :: lall
366 integer,
intent(out) :: edge_tab(2,4,rall)
367 integer,
intent(out) :: lp2r(lall,0:pall-1)
369 integer :: num_of_rgn
371 namelist / rgn_info / &
375 integer :: sw(2) = -1
376 integer :: nw(2) = -1
377 integer :: ne(2) = -1
378 integer :: se(2) = -1
380 namelist / rgn_link_info / &
387 integer :: num_of_proc
389 namelist / proc_info / &
393 integer :: num_of_mng
396 namelist / rgn_mng_info / &
405 log_info(
"PRC_ICOA_RGN_input",*)
'input region management information file: ', trim(in_fname)
409 file = trim(in_fname), &
410 form =
'formatted', &
415 if ( ierr /= 0 )
then
416 log_error(
"PRC_ICOA_RGN_input",*)
'File is not found!', trim(in_fname)
420 read(fid,nml=rgn_info)
422 if ( num_of_rgn /= rall )
then
423 log_error(
"PRC_ICOA_RGN_input",*)
'Missmatch of region number!'
424 log_error_cont(*)
'rall= ', rall,
', num_of_rgn=', num_of_rgn
429 read(fid,nml=rgn_link_info)
437 read(fid,nml=proc_info)
438 if ( num_of_proc /= pall )
then
439 log_error(
"PRC_ICOA_RGN_input",*)
' Missmatch of process number!'
440 log_error_cont(*)
' pall= ', pall,
', num_of_proc=', num_of_proc
445 read(fid,nml=rgn_mng_info)
447 if ( p /= peid )
then
448 log_error(
"PRC_ICOA_RGN_input",*)
'Wrong peid: ', p, peid
452 if ( num_of_mng /= lall )
then
453 log_error(
"PRC_ICOA_RGN_input",*)
'number of local region is not match: ', p, num_of_mng, lall
459 lp2r(l,p) = mng_rgnid(l)
466 end subroutine prc_icoa_rgn_input
470 subroutine prc_icoa_rgn_output( &
481 character(len=*),
intent(in) :: out_fname
482 integer,
intent(in) :: pall
483 integer,
intent(in) :: rall
484 integer,
intent(in) :: lall
485 integer,
intent(in) :: edge_tab(2,4,rall)
486 integer,
intent(in) :: lp2r(lall,pall)
488 integer :: num_of_rgn
490 namelist / rgn_info / &
494 integer :: sw(2) = -1
495 integer :: nw(2) = -1
496 integer :: ne(2) = -1
497 integer :: se(2) = -1
499 namelist / rgn_link_info / &
506 integer :: num_of_proc
508 namelist / proc_info / &
512 integer :: num_of_mng
515 namelist / rgn_mng_info / &
525 log_info(
"PRC_ICOA_RGN_output",*)
'output region management information file: ', trim(out_fname)
529 file = trim(out_fname), &
533 write(fid,nml=rgn_info)
542 write(fid,nml=rgn_link_info)
546 write(fid,nml=proc_info)
554 mng_rgnid(l) = lp2r(l,p)
557 write(fid,nml=rgn_mng_info)
562 log_info(
"PRC_ICOA_RGN_output",*)
'output region management information file at the master process'
566 end subroutine prc_icoa_rgn_output
582 integer,
intent(in) :: rlevel
583 integer,
intent(in) :: ndmd
584 integer,
intent(in) :: pall
585 integer,
intent(in) :: rall
586 integer,
intent(in) :: lall
587 integer,
intent(out) :: edge_tab(2,4,rall)
588 integer,
intent(out) :: lp2r(lall,0:pall-1)
590 integer :: dmd_data(4,ndmd)
591 integer :: rall_1d, rall_1dmd
593 integer :: d_nb, i_nb, j_nb, rgnid_nb, direction
594 integer :: d, i, j, rgnid
598 log_info(
"PRC_ICOA_RGN_generate",*)
'generate region management information file'
600 if ( ndmd == 10 )
then
601 log_info_cont(*)
'Topology: icosahedral'
602 dmd_data(:, 1) = (/ 6, 5, 2,10 /)
603 dmd_data(:, 2) = (/ 10, 1, 3, 9 /)
604 dmd_data(:, 3) = (/ 9, 2, 4, 8 /)
605 dmd_data(:, 4) = (/ 8, 3, 5, 7 /)
606 dmd_data(:, 5) = (/ 7, 4, 1, 6 /)
607 dmd_data(:, 6) = (/ 7, 5, 1,10 /)
608 dmd_data(:, 7) = (/ 8, 4, 5, 6 /)
609 dmd_data(:, 8) = (/ 9, 3, 4, 7 /)
610 dmd_data(:, 9) = (/ 10, 2, 3, 8 /)
611 dmd_data(:,10) = (/ 6, 1, 2, 9 /)
612 elseif( ndmd == 12 )
then
613 log_info_cont(*)
'Topology: icosatetrahedral'
614 dmd_data(:, 1) = (/ 7, 6, 2,12 /)
615 dmd_data(:, 2) = (/ 12, 1, 3,11 /)
616 dmd_data(:, 3) = (/ 11, 2, 4,10 /)
617 dmd_data(:, 4) = (/ 10, 3, 5, 9 /)
618 dmd_data(:, 5) = (/ 9, 4, 6, 8 /)
619 dmd_data(:, 6) = (/ 8, 5, 1, 7 /)
620 dmd_data(:, 7) = (/ 8, 6, 1,12 /)
621 dmd_data(:, 8) = (/ 9, 5, 6, 7 /)
622 dmd_data(:, 9) = (/ 10, 4, 5, 8 /)
623 dmd_data(:,10) = (/ 11, 3, 4, 9 /)
624 dmd_data(:,11) = (/ 12, 2, 3,10 /)
625 dmd_data(:,12) = (/ 7, 1, 2,11 /)
629 rall_1dmd = rall_1d*rall_1d
635 rgnid = (d-1)*rall_1dmd + (j-1)*rall_1d + i
639 if ( d <= ndmd / 2 )
then
642 d_nb = dmd_data(
i_sw,d)
647 d_nb = dmd_data(
i_sw,d)
656 rgnid_nb = (d_nb-1)*rall_1dmd + (j_nb-1)*rall_1d + i_nb
663 if ( d <= ndmd / 2 )
then
666 d_nb = dmd_data(
i_nw,d)
671 d_nb = dmd_data(
i_nw,d)
680 rgnid_nb = (d_nb-1)*rall_1dmd + (j_nb-1)*rall_1d + i_nb
686 if ( j == rall_1d )
then
687 if ( d <= ndmd / 2 )
then
690 d_nb = dmd_data(
i_ne,d)
695 d_nb = dmd_data(
i_ne,d)
704 rgnid_nb = (d_nb-1)*rall_1dmd + (j_nb-1)*rall_1d + i_nb
710 if ( i == rall_1d )
then
711 if ( d <= ndmd / 2 )
then
714 d_nb = dmd_data(
i_se,d)
719 d_nb = dmd_data(
i_se,d)
728 rgnid_nb = (d_nb-1)*rall_1dmd + (j_nb-1)*rall_1d + i_nb
753 subroutine prc_icoa_rgn_vertex_walkaround( &
764 integer,
intent(in) :: rall
765 integer,
intent(in) :: rall_pl
766 integer,
intent(in) :: vlink
767 integer,
intent(in) :: edge_tab(2,4,rall)
769 integer,
intent(out) :: vert_num (4,rall)
770 logical,
intent(out) :: vert_pl (rall_pl,rall)
771 integer,
intent(out) :: vert_tab (2,4,rall ,vlink)
772 integer,
intent(out) :: vert_tab_pl(2 ,rall_pl,vlink)
774 integer :: rgnid, dir
775 integer :: rgnid_next, dir_next
776 logical :: isaroundpole
782 vert_tab(:,:,:,:) = -1
801 rgnid_next = edge_tab(
i_rgnid,dir,rgnid)
802 dir_next = edge_tab(
i_dir, dir,rgnid) - 1
804 if( dir_next == 0 ) dir_next = 4
806 vert_tab(
i_rgnid,d,r,v) = rgnid
807 vert_tab(
i_dir, d,r,v) = dir
812 if( rgnid == r )
exit
819 vert_pl(:,:) = .false.
822 if ( vert_num(
i_n,r) == vlink )
then
823 isaroundpole = .true.
825 if( vert_tab(
i_dir,
i_n,r,v) /=
i_n ) isaroundpole = .false.
828 if ( isaroundpole )
then
829 vert_pl(
i_npl,r) = .true.
833 if ( vert_num(
i_s,r) == vlink )
then
834 isaroundpole = .true.
836 if( vert_tab(
i_dir,
i_s,r,v) /=
i_s ) isaroundpole = .false.
839 if ( isaroundpole )
then
840 vert_pl(
i_spl,r) = .true.
845 vert_tab_pl(:,:,:) = -1
848 if ( vert_pl(
i_npl,r) )
then
858 if ( vert_pl(
i_spl,r) )
then
868 end subroutine prc_icoa_rgn_vertex_walkaround
871 subroutine output_info
876 integer :: rgnid, rgnid_next
877 character(len=2) :: dstr, dstr_next
883 log_info(
"PRC_ICOA_RGN_setup",
'(1x,A)')
'Region management information'
885 log_info_cont(
'(1x,A,A)' )
'Grid sysytem : Icosahedral'
887 log_info_cont(
'(1x,A,A)' )
'Grid sysytem : Icosatetrahedral'
890 log_info_cont(
'(1x,A,I7)')
'maximum number of vertex linkage : ',
prc_rgn_vlink
892 log_info_cont(
'(1x,A,I7)')
'Region division level (RL) : ',
prc_rgn_level
893 log_info_cont(
'(1x,A,I7,3(A,I4),A)')
'Total number of regular region : ',
prc_rgn_total, &
895 log_info_cont(
'(1x,A,I7)')
'# of region per process : ',
prc_rgn_local
896 log_info_cont(
'(1x,A)' )
'ID of region in my process : '
905 log_info(
"PRC_ICOA_RGN_setup",
'(1x,A)')
'Detailed region management information'
907 log_info_cont(*)
'--- (l,myrank) => (rgn)'
910 log_info_cont(
'(1x,A,I4,A,I6,A,I6,A)')
'--- (',l,
',',
prc_myrank,
') => (',rgnid,
') '
914 log_info_cont(*)
'--- Link information'
919 log_info_cont(*)
'--- edge link: (rgn,direction)'
922 dstr = prc_rgn_edgename(d)
924 log_info_cont(
'(5x,A,I6,A,A,A,I6,A,A,A)')
'(',rgnid,
',',dstr,
') -> (', rgnid_next,
',', dstr_next,
')'
927 log_info_cont(*)
'--- vertex link: (rgn)'
929 dstr = prc_rgn_vertname(d)
930 log_info_contna(
'(5x,A,I6,A,A,A)')
'(',rgnid,
',',dstr,
')'
933 log_info_contna(
'(A,I6,A,A,A)')
' -> (',
prc_rgn_vert_tab(
i_rgnid,d,rgnid,v),
',',dstr,
')'
940 log_info_cont(*)
'--- Pole information (in the global scope)'
944 log_info_cont(*)
'--- vertex link: (north pole)'
948 log_info_contna(
'(A,I6,A,A,A)')
' -> (',rgnid,
',',dstr,
')'
952 log_info_contna(
'(A,I6,A,A,A)')
' -> (',rgnid,
',',dstr,
')'
958 log_info_cont(*)
'--- vertex link: (south pole)'
962 log_info_contna(
'(A,I6,A,A,A)')
' -> (',rgnid,
',',dstr,
')'
966 log_info_contna(
'(A,I6,A,A,A)')
' -> (',rgnid,
',',dstr,
')'
972 end subroutine output_info
integer, parameter, public i_s
south
logical, public prc_universal_ismaster
master process in universal communicator?
integer, dimension(:,:), allocatable, public prc_rgn_vert_num
number of region around the vertex (4 vertexes)
subroutine, public prc_abort
Abort Process.
integer, parameter, public prc_rgn_total_pl
number of pole region
integer, parameter, public i_l
local region
integer, dimension(:,:,:), allocatable, public prc_rgn_edge_tab
region link information (for 4 edges)
integer, public prc_rgn_vlink
maximum number of vertex linkage, ICO:5
integer, parameter, public i_ne
north east
integer, dimension(prc_rgn_total_pl), public prc_rgn_r2p_pl
process ID which have the pole regions
integer, dimension(:), allocatable, public prc_rgn_l2r
l,prc_me => rgn
integer, parameter, public i_e
east
integer, public prc_local_comm_world
local communicator
integer, parameter, public i_se
south east
integer, public prc_rgn_ndiamond
number of diamonds
integer, parameter, public i_rgnid
region id
integer, parameter, public i_sw
south west
integer, public prc_myrank
process num in local communicator
logical, dimension(:,:), allocatable, public prc_rgn_vert_pl
the northern/southern vertex is around the pole point?
integer, parameter, public i_npl
north pole
integer function, public io_get_available_fid()
search & get available file ID
logical, public prc_have_pl
this ID manages pole region?
integer, public prc_universal_myrank
myrank in universal communicator
integer, parameter, public i_nw
north west
integer, parameter, public prc_masterrank
master process in each communicator
logical, public prc_global_ismaster
master process in global communicator?
integer, parameter, public i_w
west
subroutine, public prc_icoa_setup
Setup Processor topology.
integer, public prc_rgn_local
number of regular region (local)
integer, dimension(:,:), allocatable, public prc_rgn_lp2r
l,prc => rgn
integer, public prc_global_myrank
myrank in global communicator
integer, public prc_universal_comm_world
original communicator
integer, parameter, public i_spl
south pole
integer, dimension(prc_rgn_total_pl), public prc_rgn_rgn4pl
region, having pole data in the halo
integer, public prc_rgn_level
region division level
integer, parameter, public i_dir
direction
integer, dimension(:,:,:,:), allocatable, public prc_rgn_vert_tab
region link information (for 4 vertexes)
integer, public prc_abort_comm_world
communicator for aborting
integer, public prc_rgn_total
number of regular region (global total)
integer, parameter, public i_n
north
integer, parameter, public i_prc
process
integer, parameter, public prc_rgn_local_lim
maximum number of regular region (local)
integer, public prc_nprocs
myrank in local communicator
integer, dimension(:,:), allocatable, public prc_rgn_r2lp
rgn => l,prc
subroutine, public prc_icoa_rgn_generate(rlevel, ndmd, pall, rall, lall, edge_tab, lp2r)
Generate region management info.
integer, parameter, public prc_rank_pl
process ID which manages the pole regions
logical, public io_l
output log or not? (this process)
integer, public io_fid_nml
Log file ID (only for output namelist)
logical, public io_nml
output log or not? (for namelist, this process)
integer, dimension(:,:,:), allocatable, public prc_rgn_vert_tab_pl
region link information (for 4 vertexes)
integer, public prc_global_comm_world
global communicator
integer, public prc_universal_nprocs
process num in universal communicator
integer, public prc_global_nprocs
process num in global communicator
logical, dimension(:), allocatable, public prc_rgn_have_sgp
region have singlar point?
integer, public io_fid_conf
Config file ID.
logical, public prc_ismaster
master process in local communicator?