bcp Subroutine

public subroutine bcp(p)

Uses

  • proc~~bcp~~UsesGraph proc~bcp bcp decomp_2d decomp_2d proc~bcp->decomp_2d module~modfields modfields proc~bcp->module~modfields module~modglobal modglobal proc~bcp->module~modglobal module~modfields->decomp_2d

Arguments

Type IntentOptional Attributes Name
real, intent(inout), dimension(ib - ih:ie + ih, jb - jh:je + jh, kb - kh:ke + kh) :: p

Calls

proc~~bcp~~CallsGraph proc~bcp bcp exchange_halo_z exchange_halo_z proc~bcp->exchange_halo_z

Source Code

   subroutine bcp(p)

     use modglobal, only : ib, ie, jb, je, ih, jh, kb, ke, kh, dyi, rk3step, dt, &
                           ibrank, ierank, jbrank, jerank, BCxm, BCym, BCxm_periodic, BCym_periodic
     use modfields, only : pres0, up, u0, um, uouttot, vp, v0
     use decomp_2d, only : exchange_halo_z

     real, dimension(ib - ih:ie + ih, jb - jh:je + jh, kb - kh:ke + kh), intent(inout) :: p !< pressure
     integer i, j, k
     real rk3coef, rk3coefi

     if (rk3step == 0) then ! dt not defined yet
       rk3coef = 1.
     else
       rk3coef = dt / (4. - dble(rk3step))
     end if
     rk3coefi = 1. / rk3coef

     call exchange_halo_z(p)
     call exchange_halo_z(pres0)

     if (BCxm .eq. BCxm_periodic) then
       if (ibrank .and. ierank) then
         do j = jb, je
           do k = kb, ke
             p(ib-1, j, k) = p(ie, j, k)
             p(ie+1, j, k) = p(ib, j, k)
             !pres0(ib - 1, j, k) = pres0(ie, j, k)
             !pres0(ie + 1, j, k) = pres0(ib, j, k)
           end do
         end do
       end if

     else
       if (ibrank) then
         do k = kb, ke
           do j = jb-1, je+1
             p(ib-1, j, k) = p(ib, j, k)
             pres0(ib-1, j, k) = pres0(ib, j, k)
           end do
         end do
       end if

       if (ierank) then
         do k = kb, ke
           do j = jb-1, je+1
             p(ie+1, j, k) = p(ie, j, k)
             pres0(ie+1, j, k) = pres0(ie, j, k)
           end do
         end do
       end if

     end if ! BCxm

     if (BCym .eq. BCym_periodic) then
       if (jbrank .and. jerank) then
         do i = ib, ie
           do k = kb, ke
             p(i, jb-1, k) = p(i, je, k)
             p(i, je+1, k) = p(i, jb, k)
             !pres0(ib - 1, j, k) = pres0(ie, j, k)
             !pres0(ie + 1, j, k) = pres0(ib, j, k)
           end do
         end do
       end if
     else
       if (jbrank) then
         do k = kb, ke
           do i = ib-1, ie+1
             p(i,jb-1,k) = p(i,jb,k)
             pres0(i,jb-1,k) = pres0(i,jb,k)
           enddo
         enddo
       end if

       if (jerank) then
         do k = kb, ke
           do i = ib-1, ie+1
             p(i, je+1, k) = p(i,je,k)
             pres0(i, je+1, k) = pres0(i,je,k)
           end do
         end do
       end if

     end if !BCym

   end subroutine bcp