Class BoundaryMPI In: util/boundarympi.f90

### Included Modules

gridset mpi_wrapper

### Public Instance methods

 Subroutine : aa_Var(DimXMin:DimXMax, DimZMin:DimZMax) : real(8), intent(inout)

[Source]

```  subroutine BoundaryXCyc_aa(aa_Var)

implicit none

!変数定義
real(8), intent(inout)  :: aa_Var(DimXMin:DimXMax, DimZMin:DimZMax)
integer            :: idest_a, idep_a, idest_b, idep_b
integer            :: im_a, km_a, im_b, km_b
integer, parameter :: nvars = 1
real(8)            :: sbuf_a( MarginX+1, RegZMax-RegZMin, nvars )
real(8)            :: rbuf_a( MarginX+1, RegZMax-RegZMin, nvars )
real(8)            :: sbuf_b( MarginX  , RegZMax-RegZMin, nvars )
real(8)            :: rbuf_b( MarginX  , RegZMax-RegZMin, nvars )
integer            :: ireqs_a, ireqr_a, ireqs_b, ireqr_b
integer            :: i, k

!----- 変数の初期化 -----
im_a = MarginX+1
km_a = RegZMax-RegZMin

im_b = MarginX
km_b = RegZMax-RegZMin

!-------------------------------
! 配列の右側を, ノード間で通信する.

!送信する配列(sbuf_a)を用意する
do k = RegZMin+1, RegZMax
do i = 0, MarginX
sbuf_a( i + 1, k, 1 ) = aa_var(RegXMax - i , k )
end do
end do

idest_a = mod(( myrank+1 )       , nprocs)   !送信先
idep_a  = mod(( myrank-1 )+nprocs, nprocs)   !受信元
call MPIWrapperISend( idest_a, im_a, km_a, nvars, sbuf_a, ireqs_a )
call MPIWrapperIRecv( idep_a , im_a, km_a, nvars, rbuf_a, ireqr_a )

!-------------------------------
do k = RegZMin+1, RegZMax
do i = 1, MarginX
sbuf_b( i, k, 1 ) = aa_var(RegXMin + i , k )
end do
end do

idest_b = mod(( myrank-1 )+nprocs, nprocs)    !送信先
idep_b  = mod(( myrank+1 )       , nprocs)    !受信元
call MPIWrapperISend( idest_b, im_b, km_b, nvars, sbuf_b, ireqs_b )
call MPIWrapperIRecv( idep_b , im_b, km_b, nvars, rbuf_b, ireqr_b )

!-------------------------------
call MPIWrapperWait( ireqs_a )
call MPIWrapperWait( ireqr_a )

do k = RegZMin+1, RegZMax
do i = 0, MarginX
aa_var(RegXMin - i , k ) = rbuf_a( i + 1, k, 1 )
end do
end do

!-------------------------------
call MPIWrapperWait( ireqs_b )
call MPIWrapperWait( ireqr_b )

do k = RegZMin+1, RegZMax
do i = 1, MarginX
aa_var(RegXMax + i , k ) = rbuf_b( i, k, 1 )
end do
end do

end subroutine BoundaryXCyc_aa
```
 Subroutine : aa_Var(DimXMin:DimXMax, DimZMin:DimZMax) : real(8), intent(inout)

[Source]

```  subroutine BoundaryXCyc_aa(aa_Var)

implicit none

!変数定義
real(8), intent(inout)  :: aa_Var(DimXMin:DimXMax, DimZMin:DimZMax)
integer            :: idest_a, idep_a, idest_b, idep_b
integer            :: im_a, km_a, im_b, km_b
integer, parameter :: nvars = 1
real(8)            :: sbuf_a( MarginX+1, RegZMax-RegZMin, nvars )
real(8)            :: rbuf_a( MarginX+1, RegZMax-RegZMin, nvars )
real(8)            :: sbuf_b( MarginX  , RegZMax-RegZMin, nvars )
real(8)            :: rbuf_b( MarginX  , RegZMax-RegZMin, nvars )
integer            :: ireqs_a, ireqr_a, ireqs_b, ireqr_b
integer            :: i, k

!----- 変数の初期化 -----
im_a = MarginX+1
km_a = RegZMax-RegZMin

im_b = MarginX
km_b = RegZMax-RegZMin

!-------------------------------
! 配列の右側を, ノード間で通信する.

!送信する配列(sbuf_a)を用意する
do k = RegZMin+1, RegZMax
do i = 0, MarginX
sbuf_a( i + 1, k, 1 ) = aa_var(RegXMax - i , k )
end do
end do

idest_a = mod(( myrank+1 )       , nprocs)   !送信先
idep_a  = mod(( myrank-1 )+nprocs, nprocs)   !受信元
call MPIWrapperISend( idest_a, im_a, km_a, nvars, sbuf_a, ireqs_a )
call MPIWrapperIRecv( idep_a , im_a, km_a, nvars, rbuf_a, ireqr_a )

!-------------------------------
do k = RegZMin+1, RegZMax
do i = 1, MarginX
sbuf_b( i, k, 1 ) = aa_var(RegXMin + i , k )
end do
end do

idest_b = mod(( myrank-1 )+nprocs, nprocs)    !送信先
idep_b  = mod(( myrank+1 )       , nprocs)    !受信元
call MPIWrapperISend( idest_b, im_b, km_b, nvars, sbuf_b, ireqs_b )
call MPIWrapperIRecv( idep_b , im_b, km_b, nvars, rbuf_b, ireqr_b )

!-------------------------------
call MPIWrapperWait( ireqs_a )
call MPIWrapperWait( ireqr_a )

do k = RegZMin+1, RegZMax
do i = 0, MarginX
aa_var(RegXMin - i , k ) = rbuf_a( i + 1, k, 1 )
end do
end do

!-------------------------------
call MPIWrapperWait( ireqs_b )
call MPIWrapperWait( ireqr_b )

do k = RegZMin+1, RegZMax
do i = 1, MarginX
aa_var(RegXMax + i , k ) = rbuf_b( i, k, 1 )
end do
end do

end subroutine BoundaryXCyc_aa
```
 Subroutine : aa_Var(DimXMin:DimXMax, DimZMin:DimZMax) : real(8), intent(inout)

[Source]

```  subroutine BoundaryXCyc_aa(aa_Var)

implicit none

!変数定義
real(8), intent(inout)  :: aa_Var(DimXMin:DimXMax, DimZMin:DimZMax)
integer            :: idest_a, idep_a, idest_b, idep_b
integer            :: im_a, km_a, im_b, km_b
integer, parameter :: nvars = 1
real(8)            :: sbuf_a( MarginX+1, RegZMax-RegZMin, nvars )
real(8)            :: rbuf_a( MarginX+1, RegZMax-RegZMin, nvars )
real(8)            :: sbuf_b( MarginX  , RegZMax-RegZMin, nvars )
real(8)            :: rbuf_b( MarginX  , RegZMax-RegZMin, nvars )
integer            :: ireqs_a, ireqr_a, ireqs_b, ireqr_b
integer            :: i, k

!----- 変数の初期化 -----
im_a = MarginX+1
km_a = RegZMax-RegZMin

im_b = MarginX
km_b = RegZMax-RegZMin

!-------------------------------
! 配列の右側を, ノード間で通信する.

!送信する配列(sbuf_a)を用意する
do k = RegZMin+1, RegZMax
do i = 0, MarginX
sbuf_a( i + 1, k, 1 ) = aa_var(RegXMax - i , k )
end do
end do

idest_a = mod(( myrank+1 )       , nprocs)   !送信先
idep_a  = mod(( myrank-1 )+nprocs, nprocs)   !受信元
call MPIWrapperISend( idest_a, im_a, km_a, nvars, sbuf_a, ireqs_a )
call MPIWrapperIRecv( idep_a , im_a, km_a, nvars, rbuf_a, ireqr_a )

!-------------------------------
do k = RegZMin+1, RegZMax
do i = 1, MarginX
sbuf_b( i, k, 1 ) = aa_var(RegXMin + i , k )
end do
end do

idest_b = mod(( myrank-1 )+nprocs, nprocs)    !送信先
idep_b  = mod(( myrank+1 )       , nprocs)    !受信元
call MPIWrapperISend( idest_b, im_b, km_b, nvars, sbuf_b, ireqs_b )
call MPIWrapperIRecv( idep_b , im_b, km_b, nvars, rbuf_b, ireqr_b )

!-------------------------------
call MPIWrapperWait( ireqs_a )
call MPIWrapperWait( ireqr_a )

do k = RegZMin+1, RegZMax
do i = 0, MarginX
aa_var(RegXMin - i , k ) = rbuf_a( i + 1, k, 1 )
end do
end do

!-------------------------------
call MPIWrapperWait( ireqs_b )
call MPIWrapperWait( ireqr_b )

do k = RegZMin+1, RegZMax
do i = 1, MarginX
aa_var(RegXMax + i , k ) = rbuf_b( i, k, 1 )
end do
end do

end subroutine BoundaryXCyc_aa
```
 Subroutine : aaa_Var(DimXMin:DimXMax, DimZMin:DimZMax, 1:SpcNum) : real(8), intent(inout)

[Source]

```  subroutine BoundaryXCyc_aaa(aaa_Var)

implicit none

!変数定義
real(8), intent(inout)  :: aaa_Var(DimXMin:DimXMax, DimZMin:DimZMax, 1:SpcNum)

integer            :: idest_a, idep_a, idest_b, idep_b
integer            :: im_a, km_a, im_b, km_b
!    integer, parameter :: nvars = SpcNum
real(8)            :: sbuf_a( MarginX+1, RegZMax-RegZMin, SpcNum ), rbuf_a( MarginX+1, RegZMax-RegZMin, SpcNum ), sbuf_b( MarginX  , RegZMax-RegZMin, SpcNum ), rbuf_b( MarginX  , RegZMax-RegZMin, SpcNum )
integer            :: ireqs_a, ireqr_a, ireqs_b, ireqr_b
integer            :: i, k

!----- 変数の初期化 -----
im_a = MarginX+1
km_a = RegZMax-RegZMin

im_b = MarginX
km_b = RegZMax-RegZMin

!-------------------------------
! 配列の右側を, ノード間で通信する.

!送信する配列(sbuf_a)を用意する
do k = RegZMin+1, RegZMax
do i = 0, MarginX
sbuf_a( i + 1, k, 1:SpcNum ) = aaa_var(RegXMax - i , k, 1:SpcNum )
end do
end do

idest_a = mod(( myrank+1 )       , nprocs)   !送信先
idep_a  = mod(( myrank-1 )+nprocs, nprocs)   !受信元
call MPIWrapperISend( idest_a, im_a, km_a, SpcNum, sbuf_a, ireqs_a )
call MPIWrapperIRecv( idep_a , im_a, km_a, SpcNum, rbuf_a, ireqr_a )

!-------------------------------
do k = RegZMin+1, RegZMax
do i = 1, MarginX
sbuf_b( i, k, 1:SpcNum ) = aaa_var(RegXMin + i , k, 1:SpcNum )
end do
end do

idest_b = mod(( myrank-1 )+nprocs, nprocs)    !送信先
idep_b  = mod(( myrank+1 )       , nprocs)    !受信元
call MPIWrapperISend( idest_b, im_b, km_b, SpcNum, sbuf_b, ireqs_b )
call MPIWrapperIRecv( idep_b , im_b, km_b, SpcNum, rbuf_b, ireqr_b )

!-------------------------------
call MPIWrapperWait( ireqs_a )
call MPIWrapperWait( ireqr_a )

do k = RegZMin+1, RegZMax
do i = 0, MarginX
aaa_var(RegXMin - i , k, 1:SpcNum) = rbuf_a( i + 1, k, 1:SpcNum )
end do
end do

!-------------------------------
call MPIWrapperWait( ireqs_b )
call MPIWrapperWait( ireqr_b )

do k = RegZMin+1, RegZMax
do i = 1, MarginX
aaa_var(RegXMax + i , k, 1:SpcNum ) = rbuf_b( i, k, 1:SpcNum )
end do
end do

end subroutine BoundaryXCyc_aaa
```
 Subroutine : az_Var(DimXMin:DimXMax, DimZMin:DimZMax) : real(8), intent(inout)

z 方向に半格子ずれた点に存在する変数に対し, z 方向に「反対称境界条件」を適用する.

[Source]

```  subroutine BoundaryZAntiSym_az( az_Var )
!
! z 方向に半格子ずれた点に存在する変数に対し,
! z 方向に「反対称境界条件」を適用する.
!

!暗黙の型宣言禁止
implicit none

!変数定義
real(8), intent(inout)  :: az_Var(DimXMin:DimXMax, DimZMin:DimZMax)
real(8)                 :: az_Work(DimXMin:DimXMax, DimZMin:DimZMax)
integer                 :: k

az_Work = az_Var

do k = 0, MarginZ
az_Var( :, RegZMin - k ) = - az_Work( :, RegZMin + 1 + k )
end do
do k = 1, MarginZ
az_Var( :, RegZMax + k ) = - az_Work( :, RegZMax + 1 - k )
end do

end subroutine BoundaryZAntiSym_az
```
 Subroutine : ar_Var(DimXMin:DimXMax, DimZMin:DimZMax) : real(8), intent(inout)

z 方向の格子点上に存在する変数に対し, z 方向に「反対称境界条件」を適用する.

[Source]

```  subroutine BoundaryZAntiSym_ar( ar_Var )
!
! z 方向の格子点上に存在する変数に対し,
! z 方向に「反対称境界条件」を適用する.
!

!暗黙の型宣言禁止
implicit none

!変数定義
real(8), intent(inout)  :: ar_Var(DimXMin:DimXMax, DimZMin:DimZMax)
real(8)                 :: ar_Work(DimXMin:DimXMax, DimZMin:DimZMax)
integer                 :: k

ar_Work = ar_Var

!境界での速度はゼロ
ar_Var( :, RegZMin ) = 0.0d0
ar_Var( :, RegZMax ) = 0.0d0

do k = 1, MarginZ
ar_Var( :, RegZMin - k ) = - ar_Work( :, RegZMin + k )
ar_Var( :, RegZMax + k ) = - ar_Work( :, RegZMax - k )
end do

end subroutine BoundaryZAntiSym_ar
```
 Subroutine : az_Var(DimXMin:DimXMax, DimZMin:DimZMax) : real(8), intent(inout)

z 方向に半格子ずれた点に存在する変数に対し, z 方向に「反対称境界条件」を適用する.

[Source]

```  subroutine BoundaryZAntiSym_az( az_Var )
!
! z 方向に半格子ずれた点に存在する変数に対し,
! z 方向に「反対称境界条件」を適用する.
!

!暗黙の型宣言禁止
implicit none

!変数定義
real(8), intent(inout)  :: az_Var(DimXMin:DimXMax, DimZMin:DimZMax)
real(8)                 :: az_Work(DimXMin:DimXMax, DimZMin:DimZMax)
integer                 :: k

az_Work = az_Var

do k = 0, MarginZ
az_Var( :, RegZMin - k ) = - az_Work( :, RegZMin + 1 + k )
end do
do k = 1, MarginZ
az_Var( :, RegZMax + k ) = - az_Work( :, RegZMax + 1 - k )
end do

end subroutine BoundaryZAntiSym_az
```
 Subroutine : aza_Var(DimXMin:DimXMax, DimZMin:DimZMax, SpcNum) : real(8), intent(inout)

z 方向に半格子ずれた点に存在する変数に対し, z 方向に「反対称境界条件」を適用する.

[Source]

```  subroutine BoundaryZAntiSym_aza( aza_Var )
!
! z 方向に半格子ずれた点に存在する変数に対し,
! z 方向に「反対称境界条件」を適用する.
!

!暗黙の型宣言禁止
implicit none

!変数定義
real(8), intent(inout)  :: aza_Var(DimXMin:DimXMax, DimZMin:DimZMax, SpcNum)
real(8)                 :: aza_Work(DimXMin:DimXMax, DimZMin:DimZMax, SpcNum)
integer                 :: k

aza_Work = aza_Var

do k = 0, MarginZ
aza_Var( :, RegZMin - k, : ) = - aza_Work( :, RegZMin + 1 + k, : )
end do
do k = 1, MarginZ
aza_Var( :, RegZMax + k, : ) = - aza_Work( :, RegZMax + 1 - k, : )
end do

end subroutine BoundaryZAntiSym_aza
```
 Subroutine : az_Var(DimXMin:DimXMax, DimZMin:DimZMax) : real(8), intent(inout)

z 方向に半格子ずれた点に存在する変数に対し, z 方向に「対称境界条件」を適用する.

[Source]

```  subroutine BoundaryZSym_az( az_Var )
!
! z 方向に半格子ずれた点に存在する変数に対し,
! z 方向に「対称境界条件」を適用する.
!

!暗黙の型宣言禁止
implicit none

!変数定義
real(8), intent(inout)  :: az_Var(DimXMin:DimXMax, DimZMin:DimZMax)
real(8)                 :: az_Work(DimXMin:DimXMax, DimZMin:DimZMax)
integer                 :: k

az_Work = az_Var

do k = 0, MarginZ
az_Var( :, RegZMin - k ) = az_Work( :, RegZMin + 1 + k )
end do
do k = 1, MarginZ
az_Var( :, RegZMax + k ) = az_Work( :, RegZMax + 1 - k )
end do

end subroutine BoundaryZSym_az
```
 Subroutine : ar_Var(DimXMin:DimXMax, DimZMin:DimZMax) : real(8), intent(inout)

z 方向の格子点上に存在する変数に対し, z 方向に「対称境界条件」を適用する.

[Source]

```  subroutine BoundaryZSym_ar( ar_Var )
!
! z 方向の格子点上に存在する変数に対し,
! z 方向に「対称境界条件」を適用する.
!

!暗黙の型宣言禁止
implicit none

!変数定義
real(8), intent(inout)  :: ar_Var(DimXMin:DimXMax, DimZMin:DimZMax)
real(8)                 :: ar_Work(DimXMin:DimXMax, DimZMin:DimZMax)
integer                 :: k

ar_Work = ar_Var

!境界での速度はゼロ
ar_Var( :, RegZMin ) = 0.0d0
ar_Var( :, RegZMax ) = 0.0d0

do k = 1, MarginZ
ar_Var( :, RegZMin - k ) = ar_Work( :, RegZMin + k )
ar_Var( :, RegZMax + k ) = ar_Work( :, RegZMax - k )
end do

end subroutine BoundaryZSym_ar
```
 Subroutine : az_Var(DimXMin:DimXMax, DimZMin:DimZMax) : real(8), intent(inout)

z 方向に半格子ずれた点に存在する変数に対し, z 方向に「対称境界条件」を適用する.

[Source]

```  subroutine BoundaryZSym_az( az_Var )
!
! z 方向に半格子ずれた点に存在する変数に対し,
! z 方向に「対称境界条件」を適用する.
!

!暗黙の型宣言禁止
implicit none

!変数定義
real(8), intent(inout)  :: az_Var(DimXMin:DimXMax, DimZMin:DimZMax)
real(8)                 :: az_Work(DimXMin:DimXMax, DimZMin:DimZMax)
integer                 :: k

az_Work = az_Var

do k = 0, MarginZ
az_Var( :, RegZMin - k ) = az_Work( :, RegZMin + 1 + k )
end do
do k = 1, MarginZ
az_Var( :, RegZMax + k ) = az_Work( :, RegZMax + 1 - k )
end do

end subroutine BoundaryZSym_az
```
 Subroutine : aza_Var(DimXMin:DimXMax, DimZMin:DimZMax, SpcNum) : real(8), intent(inout)

z 方向に半格子ずれた点に存在する変数に対し, z 方向に「対称境界条件」を適用する.

[Source]

```  subroutine BoundaryZSym_aza( aza_Var )
!
! z 方向に半格子ずれた点に存在する変数に対し,
! z 方向に「対称境界条件」を適用する.
!

!暗黙の型宣言禁止
implicit none

!変数定義
real(8), intent(inout)  :: aza_Var(DimXMin:DimXMax, DimZMin:DimZMax, SpcNum)
real(8)                 :: aza_Work(DimXMin:DimXMax, DimZMin:DimZMax, SpcNum)
integer                 :: k

aza_Work = aza_Var

do k = 0, MarginZ
aza_Var( :, RegZMin - k, : ) = aza_Work( :, RegZMin + 1 + k, : )
end do
do k = 1, MarginZ
aza_Var( :, RegZMax + k, : ) = aza_Work( :, RegZMax + 1 - k, : )
end do

end subroutine BoundaryZSym_aza
```