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 / &
 
  401     character(len=H_LONG) :: fname
 
  407     log_info(
"PRC_ICOA_RGN_input",*) 
'input region management information file: ', trim(fname)
 
  412           form   = 
'formatted', &
 
  417        if ( ierr /= 0 ) 
then 
  418           log_error(
"PRC_ICOA_RGN_input",*) 
'File is not found!', trim(fname)
 
  422        read(fid,nml=rgn_info)
 
  424        if ( num_of_rgn /= rall ) 
then 
  425           log_error(
"PRC_ICOA_RGN_input",*) 
'Missmatch of region number!' 
  426           log_error_cont(*)                 
'rall= ', rall,
', num_of_rgn=', num_of_rgn
 
  431           read(fid,nml=rgn_link_info)
 
  439        read(fid,nml=proc_info)
 
  440        if ( num_of_proc /= pall ) 
then 
  441           log_error(
"PRC_ICOA_RGN_input",*) 
' Missmatch of process number!' 
  442           log_error_cont(*)                 
' pall= ', pall, 
', num_of_proc=', num_of_proc
 
  447           read(fid,nml=rgn_mng_info)
 
  449           if ( p /= peid ) 
then 
  450              log_error(
"PRC_ICOA_RGN_input",*) 
'Wrong peid: ', p, peid
 
  454           if ( num_of_mng /= lall ) 
then 
  455              log_error(
"PRC_ICOA_RGN_input",*) 
'number of local region is not match: ', p, num_of_mng, lall
 
  461              lp2r(l,p) = mng_rgnid(l)
 
  468   end subroutine prc_icoa_rgn_input
 
  472   subroutine prc_icoa_rgn_output( &
 
  483     character(len=*), 
intent(in) :: out_fname
 
  484     integer,          
intent(in) :: pall
 
  485     integer,          
intent(in) :: rall
 
  486     integer,          
intent(in) :: lall
 
  487     integer,          
intent(in) :: edge_tab(2,4,rall)
 
  488     integer,          
intent(in) :: lp2r(lall,0:pall-1)
 
  490     integer :: num_of_rgn
 
  492     namelist / rgn_info / &
 
  496     integer :: sw(2) = -1
 
  497     integer :: nw(2) = -1
 
  498     integer :: ne(2) = -1
 
  499     integer :: se(2) = -1
 
  501     namelist / rgn_link_info / &
 
  508     integer :: num_of_proc
 
  510     namelist / proc_info / &
 
  514     integer :: num_of_mng
 
  517     namelist / rgn_mng_info / &
 
  522     character(len=H_LONG) :: fname
 
  529        log_info(
"PRC_ICOA_RGN_output",*) 
'output region management information file: ', trim(fname)
 
  537           write(fid,nml=rgn_info)
 
  546              write(fid,nml=rgn_link_info)
 
  550           write(fid,nml=proc_info)
 
  558                 mng_rgnid(l) = lp2r(l,p)
 
  561              write(fid,nml=rgn_mng_info)
 
  566        log_info(
"PRC_ICOA_RGN_output",*) 
'output region management information file at the master process' 
  570   end subroutine prc_icoa_rgn_output
 
  586     integer, 
intent(in)  :: rlevel
 
  587     integer, 
intent(in)  :: ndmd
 
  588     integer, 
intent(in)  :: pall
 
  589     integer, 
intent(in)  :: rall
 
  590     integer, 
intent(in)  :: lall
 
  591     integer, 
intent(out) :: edge_tab(2,4,rall)
 
  592     integer, 
intent(out) :: lp2r(lall,0:pall-1)
 
  594     integer :: dmd_data(4,ndmd)
 
  595     integer :: rall_1d, rall_1dmd
 
  597     integer :: d_nb, i_nb, j_nb, rgnid_nb, direction
 
  598     integer :: d, i, j, rgnid
 
  602     log_info(
"PRC_ICOA_RGN_generate",*) 
'generate region management information file' 
  604     if    ( ndmd == 10 ) 
then 
  605        log_info_cont(*) 
'Topology: icosahedral' 
  606        dmd_data(:, 1) = (/  6, 5, 2,10 /)
 
  607        dmd_data(:, 2) = (/ 10, 1, 3, 9 /)
 
  608        dmd_data(:, 3) = (/  9, 2, 4, 8 /)
 
  609        dmd_data(:, 4) = (/  8, 3, 5, 7 /)
 
  610        dmd_data(:, 5) = (/  7, 4, 1, 6 /)
 
  611        dmd_data(:, 6) = (/  7, 5, 1,10 /)
 
  612        dmd_data(:, 7) = (/  8, 4, 5, 6 /)
 
  613        dmd_data(:, 8) = (/  9, 3, 4, 7 /)
 
  614        dmd_data(:, 9) = (/ 10, 2, 3, 8 /)
 
  615        dmd_data(:,10) = (/  6, 1, 2, 9 /)
 
  616     elseif( ndmd == 12 ) 
then 
  617        log_info_cont(*) 
'Topology: icosatetrahedral' 
  618        dmd_data(:, 1) = (/  7, 6, 2,12 /)
 
  619        dmd_data(:, 2) = (/ 12, 1, 3,11 /)
 
  620        dmd_data(:, 3) = (/ 11, 2, 4,10 /)
 
  621        dmd_data(:, 4) = (/ 10, 3, 5, 9 /)
 
  622        dmd_data(:, 5) = (/  9, 4, 6, 8 /)
 
  623        dmd_data(:, 6) = (/  8, 5, 1, 7 /)
 
  624        dmd_data(:, 7) = (/  8, 6, 1,12 /)
 
  625        dmd_data(:, 8) = (/  9, 5, 6, 7 /)
 
  626        dmd_data(:, 9) = (/ 10, 4, 5, 8 /)
 
  627        dmd_data(:,10) = (/ 11, 3, 4, 9 /)
 
  628        dmd_data(:,11) = (/ 12, 2, 3,10 /)
 
  629        dmd_data(:,12) = (/  7, 1, 2,11 /)
 
  633     rall_1dmd = rall_1d*rall_1d
 
  639        rgnid = (d-1)*rall_1dmd + (j-1)*rall_1d + i
 
  643           if ( d <= ndmd / 2 ) 
then 
  646              d_nb = dmd_data(
i_sw,d)
 
  651              d_nb = dmd_data(
i_sw,d)
 
  660        rgnid_nb = (d_nb-1)*rall_1dmd + (j_nb-1)*rall_1d + i_nb
 
  667           if ( d <= ndmd / 2 ) 
then 
  670              d_nb = dmd_data(
i_nw,d)
 
  675              d_nb = dmd_data(
i_nw,d)
 
  684        rgnid_nb = (d_nb-1)*rall_1dmd + (j_nb-1)*rall_1d + i_nb
 
  690        if ( j == rall_1d ) 
then 
  691           if ( d <= ndmd / 2 ) 
then 
  694              d_nb = dmd_data(
i_ne,d)
 
  699              d_nb = dmd_data(
i_ne,d)
 
  708        rgnid_nb = (d_nb-1)*rall_1dmd + (j_nb-1)*rall_1d + i_nb
 
  714        if ( i == rall_1d ) 
then 
  715           if ( d <= ndmd / 2 ) 
then 
  718              d_nb = dmd_data(
i_se,d)
 
  723              d_nb = dmd_data(
i_se,d)
 
  732        rgnid_nb = (d_nb-1)*rall_1dmd + (j_nb-1)*rall_1d + i_nb
 
  757   subroutine prc_icoa_rgn_vertex_walkaround( &
 
  768     integer, 
intent(in)  :: rall
 
  769     integer, 
intent(in)  :: rall_pl
 
  770     integer, 
intent(in)  :: vlink
 
  771     integer, 
intent(in)  :: edge_tab(2,4,rall)
 
  773     integer, 
intent(out) :: vert_num   (4,rall)
 
  774     logical, 
intent(out) :: vert_pl    (rall_pl,rall)
 
  775     integer, 
intent(out) :: vert_tab   (2,4,rall   ,vlink)
 
  776     integer, 
intent(out) :: vert_tab_pl(2  ,rall_pl,vlink)
 
  778     integer  :: rgnid, dir
 
  779     integer  :: rgnid_next, dir_next
 
  780     logical  :: isaroundpole
 
  786     vert_tab(:,:,:,:) = -1
 
  805           rgnid_next = edge_tab(
i_rgnid,dir,rgnid)
 
  806           dir_next   = edge_tab(
i_dir,  dir,rgnid) - 1
 
  808           if( dir_next == 0 ) dir_next = 4
 
  810           vert_tab(
i_rgnid,d,r,v) = rgnid
 
  811           vert_tab(
i_dir,  d,r,v) = dir
 
  816           if( rgnid == r ) 
exit 
  823     vert_pl(:,:)   = .false.
 
  826        if ( vert_num(
i_n,r) == vlink ) 
then 
  827           isaroundpole = .true.
 
  829              if( vert_tab(
i_dir,
i_n,r,v) /= 
i_n ) isaroundpole = .false.
 
  832           if ( isaroundpole ) 
then 
  833              vert_pl(
i_npl,r) = .true.
 
  837        if ( vert_num(
i_s,r) == vlink ) 
then 
  838           isaroundpole = .true.
 
  840              if( vert_tab(
i_dir,
i_s,r,v) /= 
i_s ) isaroundpole = .false.
 
  843           if ( isaroundpole ) 
then 
  844              vert_pl(
i_spl,r) = .true.
 
  849     vert_tab_pl(:,:,:) = -1
 
  852        if ( vert_pl(
i_npl,r) ) 
then 
  862        if ( vert_pl(
i_spl,r) ) 
then 
  872   end subroutine prc_icoa_rgn_vertex_walkaround
 
  875   subroutine output_info
 
  880     integer          :: rgnid, rgnid_next
 
  881     character(len=2) :: dstr, dstr_next
 
  887     log_info(
"PRC_ICOA_RGN_setup",
'(1x,A)') 
'Region management information' 
  889        log_info_cont(
'(1x,A,A)' )           
'Grid sysytem                      : Icosahedral' 
  891        log_info_cont(
'(1x,A,A)' )           
'Grid sysytem                      : Icosatetrahedral' 
  894     log_info_cont(
'(1x,A,I7)')              
'maximum number of vertex linkage  : ', 
prc_rgn_vlink 
  896     log_info_cont(
'(1x,A,I7)')              
'Region division level (RL)        : ', 
prc_rgn_level 
  897     log_info_cont(
'(1x,A,I7,3(A,I4),A)')    
'Total number of regular region    : ', 
prc_rgn_total, &
 
  899     log_info_cont(
'(1x,A,I7)')              
'#  of region per process          : ', 
prc_rgn_local 
  900     log_info_cont(
'(1x,A)'   )              
'ID of region in my process        : ' 
  909        log_info(
"PRC_ICOA_RGN_setup",
'(1x,A)') 
'Detailed region management information' 
  911        log_info_cont(*)
'--- (l,myrank) => (rgn)' 
  914           log_info_cont(
'(1x,A,I4,A,I6,A,I6,A)') 
'--- (',l,
',',
prc_myrank,
') => (',rgnid,
') ' 
  918        log_info_cont(*)
'--- Link information' 
  923           log_info_cont(*)
'--- edge link: (rgn,direction)' 
  926              dstr       = prc_rgn_edgename(d)
 
  928              log_info_cont(
'(5x,A,I6,A,A,A,I6,A,A,A)') 
'(',rgnid,
',',dstr,
') -> (', rgnid_next,
',', dstr_next,
')' 
  931           log_info_cont(*)
'--- vertex link: (rgn)' 
  933              dstr = prc_rgn_vertname(d)
 
  934              log_info_contna(
'(5x,A,I6,A,A,A)') 
'(',rgnid,
',',dstr,
')' 
  937                 log_info_contna(
'(A,I6,A,A,A)') 
' -> (',
prc_rgn_vert_tab(
i_rgnid,d,rgnid,v),
',',dstr,
')' 
  944        log_info_cont(*)
'--- Pole information (in the global scope)' 
  948        log_info_cont(*)
'--- vertex link: (north pole)' 
  952           log_info_contna(
'(A,I6,A,A,A)') 
' -> (',rgnid,
',',dstr,
')' 
  956        log_info_contna(
'(A,I6,A,A,A)') 
' -> (',rgnid,
',',dstr,
')' 
  962        log_info_cont(*)
'--- vertex link: (south pole)' 
  966           log_info_contna(
'(A,I6,A,A,A)') 
' -> (',rgnid,
',',dstr,
')' 
  970        log_info_contna(
'(A,I6,A,A,A)') 
' -> (',rgnid,
',',dstr,
')' 
  976   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
subroutine, public io_get_fname(outstr, instr, rank, ext, len)
generate process specific filename
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?