57      module procedure comm_vars_2d
    58      module procedure comm_vars_3d
    59   end interface comm_vars
    62      module procedure comm_vars8_2d
    63      module procedure comm_vars8_3d
    64   end interface comm_vars8
    67      module procedure comm_wait_2d
    68      module procedure comm_wait_3d
    69   end interface comm_wait
    74   end interface comm_gather
    87   end interface comm_bcast
   104   integer,  
private              :: comm_nreq_max
   105   integer,  
private              :: comm_vsize_max
   106   integer,  
private              :: comm_vsize_max_pc
   108   logical,  
private              :: comm_isallperiodic
   110   integer,  
private              :: comm_size2d_ns4
   111   integer,  
private              :: comm_size2d_ns8
   112   integer,  
private              :: comm_size2d_we
   113   integer,  
private              :: comm_size2d_4c
   115   integer,  
private              :: comm_vars_id = 0
   117   logical,  
private              :: comm_use_mpi_pc = .true.
   119   real(RP), 
private, 
allocatable :: recvpack_w2p(:,:)
   120   real(RP), 
private, 
allocatable :: recvpack_e2p(:,:)
   121   real(RP), 
private, 
allocatable :: sendpack_p2w(:,:)
   122   real(RP), 
private, 
allocatable :: sendpack_p2e(:,:)
   124   logical,  
private, 
allocatable :: use_packbuf(:)
   127   integer,  
private, 
allocatable :: req_cnt (:)
   128   integer,  
private, 
allocatable :: req_list(:,:)
   129   integer,  
private, 
allocatable :: preq_cnt (:)
   130   integer,  
private, 
allocatable :: preq_list(:,:)
   131   integer,  
private, 
allocatable :: pseqid(:)
   144     namelist / param_comm_cartesc / &
   149     integer :: nreq_NS, nreq_WE, nreq_4C
   151     logical, 
save :: initialized = .false.
   156     if ( initialized ) 
return   159     log_info(
"COMM_setup",*) 
'Setup'   161     comm_vsize_max = max( 10 + 
qa*2, 25 )
   162     comm_vsize_max_pc = 50 + 
qa*2
   166     read(
io_fid_conf,nml=param_comm_cartesc,iostat=ierr)
   168        log_info(
"COMM_setup",*) 
'Not found namelist. Default used.'   169     elseif( ierr > 0 ) 
then    170        log_error(
"COMM_setup",*) 
'Not appropriate names in namelist PARAM_COMM_CARTESC. Check!'   173     log_nml(param_comm_cartesc)
   179     if ( comm_use_mpi_pc ) 
then   180        comm_nreq_max = 2 * nreq_ns + 2 * nreq_we + 4 * nreq_4c + 1
   182        comm_nreq_max = 2 * nreq_ns + 2 * nreq_we + 4 * nreq_4c
   186     comm_size2d_ns8 = 
imax   188     comm_size2d_4c  =        
ihalo   190     allocate( recvpack_w2p(comm_size2d_we*
ka,comm_vsize_max) )
   191     allocate( recvpack_e2p(comm_size2d_we*
ka,comm_vsize_max) )
   192     allocate( sendpack_p2w(comm_size2d_we*
ka,comm_vsize_max) )
   193     allocate( sendpack_p2e(comm_size2d_we*
ka,comm_vsize_max) )
   195     allocate( use_packbuf(comm_vsize_max) )
   196     use_packbuf(:) = .false.
   199     allocate( req_cnt(              comm_vsize_max) )
   200     allocate( req_list(comm_nreq_max,comm_vsize_max) )
   202     req_list(:,:) = mpi_request_null
   204     if ( comm_use_mpi_pc ) 
then   205        allocate( preq_cnt(                comm_vsize_max_pc) )
   206        allocate( preq_list(comm_nreq_max+1,comm_vsize_max_pc) )
   208        preq_list(:,:) = mpi_request_null
   210        allocate( pseqid(comm_vsize_max_pc) )
   214        comm_isallperiodic = .true.
   216        comm_isallperiodic = .false.
   219     if ( 
rp == kind(0.d0) ) 
then   221     elseif( 
rp == kind(0.0) ) 
then   224        log_error(
"COMM_setup",*) 
'precision is not supportd'   231     log_info(
"COMM_setup",*) 
'Communication information'   232     log_info_cont(*)         
'Maximum number of vars for one communication: ', comm_vsize_max
   233     log_info_cont(*)         
'Data size of var (3D,including halo) [byte] : ', 
rp*
ka*
ia*
ja   235     log_info_cont(*)         
'Ratio of halo against the whole 3D grid     : ', 
real(2*IA*JHALO+2*JMAX*IHALO) / 
real(
ia*
ja)
   236     log_info_cont(*)         
'All side is periodic?                       : ', comm_isallperiodic
   251     character(len=*), 
intent(in)    :: varname
   252     real(RP),         
intent(inout) :: var(:,:,:)
   253     integer,          
intent(inout) :: vid
   256     if ( vid > comm_vsize_max ) 
then   257        log_error(
"COMM_vars_init",*) 
'vid exceeds max', vid, comm_vsize_max
   261     if ( comm_use_mpi_pc ) 
then   263        comm_vars_id = comm_vars_id + 1
   264        if ( comm_vars_id > comm_vsize_max_pc ) 
then   265           log_error(
"COMM_vars_init",*) 
'number of variable for MPI PC exceeds max', comm_vars_id, comm_vsize_max_pc
   273        vid = comm_vars_id + comm_vsize_max
   275        log_info(
"COMM_vars_init",
'(1x,A,I3.3,2A)') 
'Initialize variable : ID = ', vid, &
   276                                                                                        ', name = ', trim(varname)
   291     character(len=*), 
intent(in)    :: varname
   292     real(RP),         
intent(inout) :: var(:,:,:)
   293     integer,          
intent(inout) :: vid
   296     if ( vid > comm_vsize_max ) 
then   297        log_error(
"COMM_vars8_init",*) 
'vid exceeds max', vid, comm_vsize_max
   301     if ( comm_use_mpi_pc ) 
then   303        comm_vars_id = comm_vars_id + 1
   304        if ( comm_vars_id > comm_vsize_max_pc ) 
then   305           log_error(
"COMM_vars8_init",*) 
'number of variable for MPI PC exceeds max', comm_vars_id, comm_vsize_max_pc
   310        call vars8_init_mpi_pc(var, comm_vars_id, vid)
   313        vid = comm_vars_id + comm_vsize_max
   315        log_info(
"COMM_vars8_init",
'(1x,A,I3.3,2A)') 
'Initialize variable : ID = ', vid, &
   316                                                                                        ', name = ', trim(varname)
   324   subroutine comm_vars_3d(var, vid)
   327     real(RP), 
intent(inout) :: var(:,:,:)
   328     integer,  
intent(in)    :: vid
   331     if ( vid > comm_vsize_max ) 
then   337        call vars_3d_mpi(var, vid)
   342   end subroutine comm_vars_3d
   345   subroutine comm_vars8_3d(var, vid)
   348     real(RP), 
intent(inout) :: var(:,:,:)
   349     integer,  
intent(in)    :: vid
   352     if ( vid > comm_vsize_max ) 
then   363   end subroutine comm_vars8_3d
   366   subroutine comm_wait_3d(var, vid, FILL_BND)
   369     real(RP), 
intent(inout) :: var(:,:,:)
   370     integer, 
intent(in)    :: vid
   371     logical, 
intent(in), 
optional :: FILL_BND
   377     if ( 
present(fill_bnd) ) fill_bnd_ = fill_bnd
   379     if ( vid > comm_vsize_max ) 
then   381        call wait_3d_mpi_pc(var, vid-comm_vsize_max)
   390     if ( .NOT. comm_isallperiodic ) 
then   391        if ( fill_bnd_ ) 
then   392           call copy_boundary_3d(var)
   397   end subroutine comm_wait_3d
   400   subroutine comm_vars_2d(var, vid)
   402     real(RP), 
intent(inout) :: var(:,:)
   403     integer,  
intent(in)    :: vid
   411   end subroutine comm_vars_2d
   414   subroutine comm_vars8_2d(var, vid)
   417     real(RP), 
intent(inout) :: var(:,:)
   418     integer,  
intent(in)    :: vid
   426   end subroutine comm_vars8_2d
   429   subroutine comm_wait_2d(var, vid, FILL_BND)
   432     real(RP), 
intent(inout) :: var(:,:)
   433     integer,  
intent(in)    :: vid
   434     logical,  
intent(in), 
optional :: FILL_BND
   440     if ( 
present(fill_bnd) ) fill_bnd_ = fill_bnd
   443     call wait_2d_mpi(var, vid)
   446     if( .NOT. comm_isallperiodic ) 
then   447        if ( fill_bnd_ ) 
then   448           call copy_boundary_2d(var)
   453   end subroutine comm_wait_2d
   457   subroutine comm_horizontal_mean_2d( varmean, var )
   462     real(RP), 
intent(out) :: varmean
   463     real(RP), 
intent(in)  :: var    (
ia,
ja)
   467     real(RP) :: allstatval
   468     real(RP) :: allstatcnt
   480           statval = statval + var(i,j)
   481           statcnt = statcnt + 1.0_rp
   489     call mpi_allreduce( statval,       &
   497     call mpi_allreduce( statcnt,       &
   507     zerosw = 0.5_rp - sign(0.5_rp, allstatcnt - 1.e-12_rp )
   508     varmean = allstatval / ( allstatcnt + zerosw ) * ( 1.0_rp - zerosw )
   512   end subroutine comm_horizontal_mean_2d
   521     real(RP), 
intent(out) :: varmean(
ka)
   522     real(RP), 
intent(in)  :: var    (
ka,
ia,
ja)
   524     real(RP) :: statval   (
ka)
   525     real(RP) :: statcnt   (
ka)
   526     real(RP) :: allstatval(
ka)
   527     real(RP) :: allstatcnt(
ka)
   540           statval(k) = statval(k) + var(k,i,j)
   541           statcnt(k) = statcnt(k) + 1.0_rp
   550     call mpi_allreduce( statval(1),    &
   558     call mpi_allreduce( statcnt(1),    &
   569        zerosw = 0.5_rp - sign(0.5_rp, allstatcnt(k) - 1.e-12_rp )
   570        varmean(k) = allstatval(k) / ( allstatcnt(k) + zerosw ) * ( 1.0_rp - zerosw )
   584     real(RP), 
intent(out) :: recv(:,:,:)
   585     real(RP), 
intent(in)  :: send(:,:)
   586     integer,  
intent(in)  :: gIA
   587     integer,  
intent(in)  :: gJA
   589     integer :: sendcounts, recvcounts
   593     sendcounts = gia * gja
   594     recvcounts = gia * gja
   596     call mpi_gather( send(:,:),      &
   616     real(RP), 
intent(out) :: recv(:,:,:,:)
   617     real(RP), 
intent(in)  :: send(:,:,:)
   618     integer,  
intent(in)  :: gIA
   619     integer,  
intent(in)  :: gJA
   620     integer,  
intent(in)  :: gKA
   622     integer :: sendcounts, recvcounts
   626     sendcounts = gia * gja * gka
   627     recvcounts = gia * gja * gka
   629     call mpi_gather( send(:,:,:),    &
   649     real(RP), 
intent(inout) :: var
   659     call mpi_bcast( var,            &
   678     real(RP), 
intent(inout) :: var(:)
   679     integer,  
intent(in)    :: gIA
   689     call mpi_bcast( var(:),         &
   708     real(RP), 
intent(inout) :: var(:,:)
   709     integer,  
intent(in)    :: gIA
   710     integer,  
intent(in)    :: gJA
   720     call mpi_bcast( var(:,:),       &
   739     real(RP), 
intent(inout) :: var(:,:,:)
   740     integer,  
intent(in)    :: gIA
   741     integer,  
intent(in)    :: gJA
   742     integer,  
intent(in)    :: gKA
   750     counts = gia * gja * gka
   752     call mpi_bcast( var(:,:,:),     &
   771     real(RP), 
intent(inout) :: var(:,:,:,:)
   772     integer,  
intent(in)    :: gIA
   773     integer,  
intent(in)    :: gJA
   774     integer,  
intent(in)    :: gKA
   775     integer,  
intent(in)    :: gTime
   783     counts = gia * gja * gka * gtime
   784     if ( gia>0 .AND. gja>0 .AND. gka>0 .AND. gtime>0 .AND. &
   786        log_error(
"COMM_bcast_4D",*) 
'counts overflow'   790     call mpi_bcast( var(:,:,:,:),   &
   809     integer, 
intent(inout) :: var
   819     call mpi_bcast( var,            &
   838     integer, 
intent(inout) :: var(:)
   839     integer, 
intent(in)    :: gIA
   849     call mpi_bcast( var(:),         &
   868     integer, 
intent(inout) :: var(:,:)
   869     integer, 
intent(in)    :: gIA
   870     integer, 
intent(in)    :: gJA
   880     call mpi_bcast( var(:,:),       &
   899     logical, 
intent(inout) :: var
   909     call mpi_bcast( var,            &
   928     character(len=*), 
intent(inout) :: var
   938     call mpi_bcast( var,            &
   956     real(RP), 
intent(inout) :: var(:,:,:)
   957     integer,  
intent(in) :: vid
   958     integer,  
intent(in) :: seqid
   960     integer :: ireq, tag, ierr
   974                         mpi_proc_null, tag+comm_nreq_max+1, 
comm_world, &
   975                         preq_list(comm_nreq_max+1,vid), ierr )
   987     call mpi_recv_init( recvpack_e2p(:,seqid), comm_size2d_we*kd,  
comm_datatype,      &
   991     call mpi_recv_init( recvpack_w2p(:,seqid), comm_size2d_we*kd,  
comm_datatype,      &
   997     call mpi_send_init( sendpack_p2w(:,seqid), comm_size2d_we*kd,  
comm_datatype,      &
  1001     call mpi_send_init( sendpack_p2e(:,seqid), comm_size2d_we*kd,  
comm_datatype,      &
  1013     preq_cnt(vid) = ireq - 1
  1018        call mpi_testall( preq_cnt(vid), preq_list(1:preq_cnt(vid),vid), &
  1019                          flag, mpi_statuses_ignore, ierr )
  1025   subroutine vars8_init_mpi_pc(var, vid, seqid)
  1028     real(RP), 
intent(inout) :: var(:,:,:)
  1029     integer,  
intent(in) :: vid
  1030     integer,  
intent(in) :: seqid
  1032     integer :: ireq, tag, tagc
  1047                         mpi_proc_null, tag+comm_nreq_max+1, 
comm_world, &
  1048                         preq_list(comm_nreq_max+1,vid), ierr )
  1051     if ( comm_isallperiodic ) 
then   1057           call mpi_recv_init( var(1,
ie+1,j),     comm_size2d_4c*kd, 
comm_datatype,                &
  1073           call mpi_recv_init( var(1,
ie+1,j),     comm_size2d_4c*kd, 
comm_datatype,                &
  1104        call mpi_recv_init( recvpack_e2p(:,seqid), comm_size2d_we*kd, 
comm_datatype,             &
  1109        call mpi_recv_init( recvpack_w2p(:,seqid), comm_size2d_we*kd, 
comm_datatype,             &
  1116        call mpi_send_init( sendpack_p2w(:,seqid), comm_size2d_we*kd, 
comm_datatype,             &
  1121        call mpi_send_init( sendpack_p2e(:,seqid), comm_size2d_we*kd, 
comm_datatype,             &
  1180              call mpi_recv_init( var(1,
ie+1,j),     comm_size2d_4c*kd, 
comm_datatype,                &
  1188              call mpi_recv_init( var(1,
ie+1,j),     comm_size2d_4c*kd, 
comm_datatype,                &
  1196              call mpi_recv_init( var(1,
ie+1,j),     comm_size2d_4c*kd, 
comm_datatype,                &
  1232              call mpi_recv_init( var(1,
ie+1,j),     comm_size2d_4c*kd, 
comm_datatype,                &
  1240              call mpi_recv_init( var(1,
ie+1,j),     comm_size2d_4c*kd, 
comm_datatype,                &
  1248              call mpi_recv_init( var(1,
ie+1,j),     comm_size2d_4c*kd, 
comm_datatype,                &
  1303           call mpi_recv_init( recvpack_e2p(:,seqid), comm_size2d_we*kd, 
comm_datatype,             &
  1310           call mpi_recv_init( recvpack_w2p(:,seqid), comm_size2d_we*kd, 
comm_datatype,             &
  1319           call mpi_send_init( sendpack_p2w(:,seqid), comm_size2d_we*kd, 
comm_datatype,             &
  1326           call mpi_send_init( sendpack_p2e(:,seqid), comm_size2d_we*kd, 
comm_datatype,             &
  1388              call mpi_send_init( var(1,
ie+1,j), comm_size2d_4c*kd, 
comm_datatype,              &
  1440              call mpi_send_init( var(1,
ie+1,j), comm_size2d_4c*kd, 
comm_datatype,              &
  1457     preq_cnt(vid) = ireq - 1
  1462        call mpi_testall( preq_cnt(vid), preq_list(1:preq_cnt(vid),vid), &
  1463                          flag, mpi_statuses_ignore, ierr )
  1467   end subroutine vars8_init_mpi_pc
  1469   subroutine vars_3d_mpi(var, vid)
  1474     real(RP), 
intent(inout) :: var(:,:,:)
  1475     integer,  
intent(in)    :: vid
  1478     integer :: ireq, tag
  1490     if ( use_packbuf(vid) ) 
then  1491        log_error(
"vars_3D_mpi",*) 
'packing buffer is already used', vid
  1494     use_packbuf(vid) = .true.
  1497     if ( comm_isallperiodic ) 
then   1509        call mpi_irecv( recvpack_e2p(:,vid),    comm_size2d_we*kd,  
comm_datatype,      &
  1513        call mpi_irecv( recvpack_w2p(:,vid),    comm_size2d_we*kd,  
comm_datatype,      &
  1517        call pack_3d(var, vid)
  1521        call mpi_isend( sendpack_p2w(:,vid),    comm_size2d_we*kd,  
comm_datatype,      &
  1525        call mpi_isend( sendpack_p2e(:,vid),    comm_size2d_we*kd,  
comm_datatype,      &
  1554           call mpi_irecv( recvpack_e2p(:,vid),    comm_size2d_we*kd,  
comm_datatype,      &
  1560           call mpi_irecv( recvpack_w2p(:,vid),    comm_size2d_we*kd,  
comm_datatype,      &
  1565        call pack_3d(var, vid)
  1570           call mpi_isend( sendpack_p2w(:,vid),    comm_size2d_we*kd,  
comm_datatype,      &
  1576           call mpi_isend( sendpack_p2e(:,vid),    comm_size2d_we*kd,  
comm_datatype,      &
  1595     req_cnt(vid) = ireq - 1
  1598   end subroutine vars_3d_mpi
  1605     real(RP), 
intent(inout) :: var(:,:,:)
  1606     integer,  
intent(in)    :: vid
  1608     integer :: ireq, tag, tagc
  1622     if ( use_packbuf(vid) ) 
then  1623        log_error(
"vars8_3D_mpi",*) 
'packing buffer is already used', vid
  1626     use_packbuf(vid) = .true.
  1629     if ( comm_isallperiodic ) 
then   1682        call mpi_irecv( recvpack_e2p(:,vid), comm_size2d_we*kd, 
comm_datatype,             &
  1687        call mpi_irecv( recvpack_w2p(:,vid), comm_size2d_we*kd, 
comm_datatype,             &
  1691        call pack_3d(var, vid)
  1697        call mpi_isend( sendpack_p2w(:,vid), comm_size2d_we*kd, 
comm_datatype,             &
  1702        call mpi_isend( sendpack_p2e(:,vid), comm_size2d_we*kd, 
comm_datatype,             &
  1884           call mpi_irecv( recvpack_e2p(:,vid), comm_size2d_we*kd, 
comm_datatype,             &
  1891           call mpi_irecv( recvpack_w2p(:,vid), comm_size2d_we*kd, 
comm_datatype,             &
  1896        call pack_3d(var, vid)
  1902           call mpi_isend( sendpack_p2w(:,vid), comm_size2d_we*kd, 
comm_datatype,             &
  1909           call mpi_isend( sendpack_p2e(:,vid), comm_size2d_we*kd, 
comm_datatype,             &
  1945              call mpi_isend( var(1,1,j),         comm_size2d_4c*kd, 
comm_datatype,              &
  1997              call mpi_isend( var(1,1,j),         comm_size2d_4c*kd, 
comm_datatype,              &
  2040     req_cnt(vid) = ireq - 1
  2050     real(RP), 
intent(inout) :: var(:,:)
  2051     integer, 
intent(in)    :: vid
  2053     integer :: ireq, tag
  2061     if ( use_packbuf(vid) ) 
then  2062        log_error(
"vars_2D_mpi",*) 
'packing buffer is already used', vid
  2065     use_packbuf(vid) = .true.
  2068     if ( comm_isallperiodic ) 
then  2072         call mpi_irecv( var(:,
js-
jhalo:
js-1), comm_size2d_ns4,        &
  2078         call mpi_irecv( var(:,
je+1:
je+
jhalo), comm_size2d_ns4,        &
  2084         call mpi_irecv( recvpack_e2p(:,vid), comm_size2d_we,       &
  2090         call mpi_irecv( recvpack_w2p(:,vid), comm_size2d_we,       &
  2095         call pack_2d(var, vid)
  2098         call mpi_isend( sendpack_p2w(:,vid), comm_size2d_we,       &
  2104         call mpi_isend( sendpack_p2e(:,vid), comm_size2d_we,       &
  2110         call mpi_isend( var(:,
je-
jhalo+1:
je), comm_size2d_ns4,        &
  2116         call mpi_isend( var(:,
js:
js+
jhalo-1), comm_size2d_ns4,        &
  2126             call mpi_irecv( var(:,
js-
jhalo:
js-1), comm_size2d_ns4,        &
  2134             call mpi_irecv( var(:,
je+1:
je+
jhalo), comm_size2d_ns4,        &
  2142             call mpi_irecv( recvpack_e2p(:,vid), comm_size2d_we,       &
  2150             call mpi_irecv( recvpack_w2p(:,vid), comm_size2d_we,       &
  2156         call pack_2d(var, vid)
  2160             call mpi_isend( sendpack_p2w(:,vid), comm_size2d_we,       &
  2168             call mpi_isend( sendpack_p2e(:,vid), comm_size2d_we,       &
  2176             call mpi_isend( var(:,
je-
jhalo+1:
je), comm_size2d_ns4,        &
  2184             call mpi_isend( var(:,
js:
js+
jhalo-1), comm_size2d_ns4,        &
  2192     req_cnt(vid) = ireq - 1
  2202     real(RP), 
intent(inout) :: var(:,:)
  2203     integer,  
intent(in)    :: vid
  2205     integer :: ireq, tag, tagc
  2215     if ( use_packbuf(vid) ) 
then  2216        log_error(
"vars8_2D_mpi",*) 
'packing buffer is already used', vid
  2219     use_packbuf(vid) = .true.
  2222     if ( comm_isallperiodic ) 
then  2228             call mpi_irecv( var(
ie+1,j), comm_size2d_4c,                      &
  2237             call mpi_irecv( var(
is-
ihalo,j), comm_size2d_4c,                  &
  2246             call mpi_irecv( var(
ie+1,j), comm_size2d_4c,                      &
  2255             call mpi_irecv( var(
is-
ihalo,j), comm_size2d_4c,                  &
  2264             call mpi_irecv( var(
is,j), comm_size2d_ns8,                      &
  2273             call mpi_irecv( var(
is,j), comm_size2d_ns8,                      &
  2280         call mpi_irecv( recvpack_e2p(:,vid), comm_size2d_we,           &
  2285         call mpi_irecv( recvpack_w2p(:,vid), comm_size2d_we,           &
  2290         call pack_2d(var, vid)
  2293         call mpi_isend( sendpack_p2w(:,vid), comm_size2d_we,            &
  2299         call mpi_isend( sendpack_p2e(:,vid), comm_size2d_we,           &
  2307             call mpi_isend( var(
is,j), comm_size2d_ns8,                      &
  2317             call mpi_isend( var(
is,j), comm_size2d_ns8,                      &
  2327             call mpi_isend( var(
is,j), comm_size2d_4c,                        &
  2337             call mpi_isend( var(
ie-
ihalo+1,j), comm_size2d_4c,                &
  2347             call mpi_isend( var(
is,j), comm_size2d_4c,                        &
  2357             call mpi_isend( var(
ie-
ihalo+1,j), comm_size2d_4c,                &
  2370                 call mpi_irecv( var(
ie+1,j), comm_size2d_4c,                      &
  2379                 call mpi_irecv( var(
ie+1,j), comm_size2d_4c,                      &
  2388                 call mpi_irecv( var(
ie+1,j), comm_size2d_4c,                      &
  2400                 call mpi_irecv( var(
is-
ihalo,j), comm_size2d_4c,                  &
  2409                 call mpi_irecv( var(
is-
ihalo,j), comm_size2d_4c,                  &
  2418                 call mpi_irecv( var(
is-
ihalo,j), comm_size2d_4c,                  &
  2430                 call mpi_irecv( var(
ie+1,j), comm_size2d_4c,                      &
  2439                 call mpi_irecv( var(
ie+1,j), comm_size2d_4c,                      &
  2448                 call mpi_irecv( var(
ie+1,j), comm_size2d_4c,                      &
  2460                 call mpi_irecv( var(
is-
ihalo,j), comm_size2d_4c,                  &
  2469                 call mpi_irecv( var(
is-
ihalo,j), comm_size2d_4c,                  &
  2478                 call mpi_irecv( var(
is-
ihalo,j), comm_size2d_4c,                  &
  2490                 call mpi_irecv( var(
is,j), comm_size2d_ns8,                      &
  2502                 call mpi_irecv( var(
is,j), comm_size2d_ns8,                      &
  2512             call mpi_irecv( recvpack_e2p(:,vid), comm_size2d_we,             &
  2520             call mpi_irecv( recvpack_w2p(:,vid), comm_size2d_we,           &
  2526         call pack_2d(var, vid)
  2530             call mpi_isend( sendpack_p2w(:,vid), comm_size2d_we,           &
  2538             call mpi_isend( sendpack_p2e(:,vid), comm_size2d_we,           &
  2548                 call mpi_isend( var(
is,j), comm_size2d_ns8,                      &
  2560                 call mpi_isend( var(
is,j), comm_size2d_ns8,                      &
  2572                 call mpi_isend( var(
is,j), comm_size2d_4c,                        &
  2581                 call mpi_isend( var(
is,j), comm_size2d_4c,                        &
  2590                 call mpi_isend( var(
is,j), comm_size2d_4c,                        &
  2602                 call mpi_isend( var(
ie-
ihalo+1,j), comm_size2d_4c,                &
  2611                 call mpi_isend( var(
ie-
ihalo+1,j), comm_size2d_4c,                &
  2620                 call mpi_isend( var(
ie-
ihalo+1,j), comm_size2d_4c,                &
  2632                 call mpi_isend( var(
is,j), comm_size2d_4c,                        &
  2641                 call mpi_isend( var(
is,j), comm_size2d_4c,                        &
  2650                 call mpi_isend( var(
is,j), comm_size2d_4c,                        &
  2662                 call mpi_isend( var(
ie-
ihalo+1,j), comm_size2d_4c,                &
  2671                 call mpi_isend( var(
ie-
ihalo+1,j), comm_size2d_4c,                &
  2680                 call mpi_isend( var(
ie-
ihalo+1,j), comm_size2d_4c,                &
  2690     req_cnt(vid) = ireq - 1
  2700     real(RP), 
intent(inout) :: var(:,:,:)
  2701     integer, 
intent(in)    :: vid
  2706     if ( use_packbuf(pseqid(vid)) ) 
then  2707        log_error(
"vars_3D_mpi_pc",*) 
'packing buffer is already used', vid, pseqid(vid)
  2710     use_packbuf(pseqid(vid)) = .true.
  2713     call pack_3d(var, pseqid(vid))
  2715     call mpi_startall(preq_cnt(vid), preq_list(1:preq_cnt(vid),vid), ierr)
  2722     real(RP), 
intent(inout) :: var(:,:,:)
  2723     integer, 
intent(in)    :: vid
  2729     call mpi_waitall( req_cnt(vid),                &
  2730                       req_list(1:req_cnt(vid),vid), &
  2731                       mpi_statuses_ignore,          &
  2733     call unpack_3d(var, vid)
  2736     use_packbuf(vid) = .false.
  2742   subroutine wait_2d_mpi(var, vid)
  2745     real(RP), 
intent(inout) :: var(:,:)
  2746     integer,  
intent(in)    :: vid
  2752     call mpi_waitall( req_cnt(vid), &
  2753                       req_list(1:req_cnt(vid),vid), &
  2754                       mpi_statuses_ignore, &
  2756     call unpack_2d(var, vid)
  2759     use_packbuf(vid) = .false.
  2763   end subroutine wait_2d_mpi
  2765   subroutine wait_3d_mpi_pc(var, vid)
  2768     real(RP), 
intent(inout) :: var(:,:,:)
  2769     integer,  
intent(in)    :: vid
  2774     call mpi_waitall( preq_cnt(vid),                &
  2775                       preq_list(1:preq_cnt(vid),vid), &
  2776                       mpi_statuses_ignore,          &
  2778     call unpack_3d(var, pseqid(vid))
  2781     use_packbuf(pseqid(vid)) = .false.
  2785   end subroutine wait_3d_mpi_pc
  2787   subroutine pack_3d(var, vid)
  2790     real(RP), 
intent(in) :: var(:,:,:)
  2791     integer,  
intent(in) :: vid
  2794     integer :: k, i, j, n
  2800     if ( comm_isallperiodic ) 
then   2811           sendpack_p2w(n,vid) = var(k,i,j)
  2824           sendpack_p2e(n,vid) = var(k,i,j)
  2842              sendpack_p2w(n,vid) = var(k,i,j)
  2858              sendpack_p2e(n,vid) = var(k,i,j)
  2869   end subroutine pack_3d
  2871   subroutine pack_2d(var, vid)
  2874     real(RP), 
intent(in) :: var(:,:)
  2875     integer,  
intent(in) :: vid
  2881     if ( comm_isallperiodic ) 
then   2891           sendpack_p2w(n,vid) = var(i,j)
  2902           sendpack_p2e(n,vid) = var(i,j)
  2917              sendpack_p2w(n,vid) = var(i,j)
  2930              sendpack_p2e(n,vid) = var(i,j)
  2940   end subroutine pack_2d
  2942   subroutine unpack_3d(var, vid)
  2945     real(RP), 
intent(inout) :: var(:,:,:)
  2946     integer,  
intent(in)    :: vid
  2949     integer :: i, j, k, n
  2956     if ( comm_isallperiodic ) 
then   2966           var(k,i,j) = recvpack_e2p(n,vid)
  2979           var(k,i,j) = recvpack_w2p(n,vid)
  2996               var(k,i,j) = recvpack_e2p(n,vid)
  3012               var(k,i,j) = recvpack_w2p(n,vid)
  3023   end subroutine unpack_3d
  3025   subroutine unpack_2d(var, vid)
  3028     real(RP), 
intent(inout) :: var(:,:)
  3029     integer,  
intent(in)    :: vid
  3036     if( comm_isallperiodic ) 
then  3044            var(i,j) = recvpack_e2p(n,vid)
  3054            var(i,j) = recvpack_w2p(n,vid)
  3068              var(i,j) = recvpack_e2p(n,vid)
  3081              var(i,j) = recvpack_w2p(n,vid)
  3091   end subroutine unpack_2d
  3093   subroutine copy_boundary_3d(var)
  3096     real(RP), 
intent(inout) :: var(:,:,:)
  3105           var(:,i,j) = var(:,i,
je)
  3114           var(:,i,j) = var(:,i,
js)
  3123           var(:,i,j) = var(:,
ie,j)
  3132           var(:,i,j) = var(:,
is,j)
  3142           var(:,i,j) = var(:,
is,
je)
  3148           var(:,i,j) = var(:,i,
je)
  3154           var(:,i,j) = var(:,
is,j)
  3164           var(:,i,j) = var(:,
is,
js)
  3170           var(:,i,j) = var(:,i,
js)
  3176           var(:,i,j) = var(:,
is,j)
  3186           var(:,i,j) = var(:,
ie,
je)
  3192           var(:,i,j) = var(:,i,
je)
  3198           var(:,i,j) = var(:,
ie,j)
  3208           var(:,i,j) = var(:,
ie,
js)
  3214           var(:,i,j) = var(:,i,
js)
  3220           var(:,i,j) = var(:,
ie,j)
  3226   end subroutine copy_boundary_3d
  3228   subroutine copy_boundary_2d(var)
  3231     real(RP), 
intent(inout) :: var(:,:)
  3240           var(i,j) = var(i,
je)
  3250           var(i,j) = var(i,
js)
  3259           var(i,j) = var(
ie,j)
  3268           var(i,j) = var(
is,j)
  3278           var(i,j) = var(
is,
je)
  3285           var(i,j) = var(i,
je)
  3292           var(i,j) = var(
is,j)
  3302           var(i,j) = var(
is,
js)
  3309           var(i,j) = var(i,
js)
  3316           var(i,j) = var(
is,j)
  3326           var(i,j) = var(
ie,
je)
  3333           var(i,j) = var(i,
je)
  3340           var(i,j) = var(
ie,j)
  3350           var(i,j) = var(
ie,
js)
  3357           var(i,j) = var(i,
js)
  3364           var(i,j) = var(
ie,j)
  3370   end subroutine copy_boundary_2d
  3376     integer :: i, j, ierr
  3379     deallocate( recvpack_w2p )
  3380     deallocate( recvpack_e2p )
  3381     deallocate( sendpack_p2w )
  3382     deallocate( sendpack_p2e )
  3384     deallocate( use_packbuf )
  3387     deallocate( req_cnt )
  3388     deallocate( req_list )
  3390     if ( comm_use_mpi_pc ) 
then  3391        do j=1, comm_vsize_max_pc
  3392           do i=1, comm_nreq_max+1
  3393              if (preq_list(i,j) .NE. mpi_request_null) &
  3394                  call mpi_request_free(preq_list(i,j), ierr)
  3397        deallocate( preq_cnt )
  3398        deallocate( preq_list )
  3399        deallocate( pseqid )
 subroutine vars_3d_mpi_pc(var, vid)
 
integer, public jmax
of computational cells: y, local
 
subroutine vars_init_mpi_pc(var, vid, seqid)
 
integer, parameter, public prc_sw
[node direction] southwest 
 
integer, public comm_world
communication world ID 
 
subroutine vars8_3d_mpi(var, vid)
 
integer, dimension(8), public prc_next
node ID of 8 neighbour process 
 
subroutine comm_bcast_int_2d(var, gIA, gJA)
Broadcast data for whole process value in 2D field (integer) 
 
integer, public ihalo
of halo cells: x
 
integer, public imax
of computational cells: x, local
 
integer, parameter, public prc_n
[node direction] north 
 
subroutine wait_3d_mpi(var, vid)
 
integer, public jhalo
of halo cells: y
 
integer, public ia
of whole cells: x, local, with HALO
 
integer, public comm_datatype
datatype of variable 
 
subroutine comm_bcast_1d(var, gIA)
Broadcast data for whole process value in 1D field. 
 
subroutine comm_bcast_3d(var, gIA, gJA, gKA)
Broadcast data for whole process value in 3D field. 
 
integer, public ja
of whole cells: y, local, with HALO
 
subroutine vars8_2d_mpi(var, vid)
 
integer, public io_fid_conf
Config file ID. 
 
subroutine comm_gather_2d(recv, send, gIA, gJA)
Get data from whole process value in 2D field. 
 
logical, public prc_has_s
 
integer, parameter, public prc_se
[node direction] southeast 
 
logical, public prc_has_n
 
logical, public prc_has_e
 
real(rp), public const_undef
 
integer, public is
start point of inner domain: x, local 
 
integer, public ie
end point of inner domain: x, local 
 
subroutine comm_bcast_2d(var, gIA, gJA)
Broadcast data for whole process value in 2D field. 
 
subroutine comm_bcast_4d(var, gIA, gJA, gKA, gTime)
Broadcast data for whole process value in 4D field. 
 
module atmosphere / grid / cartesC index 
 
subroutine comm_horizontal_mean_3d(varmean, var)
calculate horizontal mean (global total with communication) 3D 
 
integer, public je
end point of inner domain: y, local 
 
subroutine comm_bcast_character(var)
Broadcast data for whole process value in character. 
 
integer, parameter, public prc_w
[node direction] west 
 
integer, parameter, public prc_masterrank
master process in each communicator 
 
subroutine, public comm_vars_init(varname, var, vid)
Register variables. 
 
subroutine, public comm_vars8_init(varname, var, vid)
Register variables. 
 
subroutine, public prc_abort
Abort Process. 
 
integer, public js
start point of inner domain: y, local 
 
subroutine vars_2d_mpi(var, vid)
 
subroutine comm_bcast_int_1d(var, gIA)
Broadcast data for whole process value in 1D field (integer) 
 
integer, parameter, public prc_nw
[node direction] northwest 
 
subroutine, public prof_rapstart(rapname_base, level)
Start raptime. 
 
subroutine, public comm_cleanup
 
integer, parameter, public prc_e
[node direction] east 
 
subroutine comm_bcast_int_scr(var)
Broadcast data for whole process value in scalar (integer) 
 
integer, public ka
of whole cells: z, local, with HALO
 
integer, parameter, public prc_s
[node direction] south 
 
subroutine comm_gather_3d(recv, send, gIA, gJA, gKA)
Get data from whole process value in 3D field. 
 
integer, public prc_local_comm_world
local communicator 
 
subroutine, public comm_setup
Setup. 
 
subroutine comm_bcast_scr(var)
Broadcast data for whole process value in scalar field. 
 
subroutine, public prof_rapend(rapname_base, level)
Save raptime. 
 
integer, parameter, public rp
 
subroutine comm_bcast_logical_scr(var)
Broadcast data for whole process value in scalar (logical) 
 
integer, parameter, public prc_ne
[node direction] northeast 
 
logical, public prc_has_w