Updates ghostcells to enforce symmetry BC. Minus version.
staggered non-staggered
(face-centerd) (cell-centered)
interior ---↑--- | -------
| ↑
(boundary)-----0-----------|---------------- ghost | ↓ cells ---↓--- | -------
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(bc_set), | intent(in) | :: | this |
Boundary conditions utility |
||
| character(len=*), | intent(in) | :: | region |
Region name |
||
| type(eulerian_obj_r), | intent(inout) | :: | var |
Eulerian variable |
impure subroutine bc_set_UpdateBoundarySymmetryMinus(this,region,var) !> Updates ghostcells to enforce symmetry BC. ! Minus version. ! ! staggered non-staggered ! (face-centerd) (cell-centered) ! interior ---↑--- | ------- ! | ↑ ! (boundary)-----0-----------|---------------- ! ghost | ↓ ! cells ---↓--- | ------- ! class(bc_set), intent(in) :: this !! Boundary conditions utility character(len=*), intent(in) :: region !! Region name type(eulerian_obj_r), intent(inout) :: var !! Eulerian variable ! Work variables type(extent_obj) :: extents integer :: i,j,k,n integer :: shift(3) integer :: mirror(3) integer :: increment integer :: dir integer :: side ! Get extents extents = this%GetExtents(region) ! Get direction and side of BC call this%GetSideDirByRegion(region,side,dir) select case (side) case (BC_RIGHT) increment = 1 case (BC_LEFT) increment = -1 end select if (dir.eq.var%staggering) then ! Treatment for face-centered fields in dir-direction select case (side) case (BC_RIGHT) associate(lo => extents%lo, hi=>extents%hi) do k=lo(3),hi(3) do j=lo(2),hi(2) do i=lo(1),hi(1) shift = 0 mirror = 0 ! Treatment for point on the boundary shift(dir) = shift(dir) + increment var%cell(i+shift(1),j+shift(2),k+shift(3)) = 0.0_wp ! Treatment for points beyond the boundary do n=2,this%block%ngc shift(dir) = shift(dir) + increment mirror(dir) = -shift(dir) + increment var%cell(i+shift(1),j+shift(2),k+shift(3)) = -var%cell(i+mirror(1),j+mirror(2),k+mirror(3)) end do end do end do end do end associate case (BC_LEFT) associate(lo => extents%lo, hi=>extents%hi) do k=lo(3),hi(3) do j=lo(2),hi(2) do i=lo(1),hi(1) shift = 0 mirror = 0 ! Treatment for point on the boundary var%cell(i+shift(1),j+shift(2),k+shift(3)) = 0.0_wp ! Treatment for points beyond the boundary do n=1,this%block%ngc shift(dir) = shift(dir) + increment mirror(dir) = -shift(dir) var%cell(i+shift(1),j+shift(2),k+shift(3)) = -var%cell(i+mirror(1),j+mirror(2),k+mirror(3)) end do end do end do end do end associate end select else ! Treatment for cell-centered fields in dir-direction associate(lo => extents%lo, hi=>extents%hi) do k=lo(3),hi(3) do j=lo(2),hi(2) do i=lo(1),hi(1) shift = 0 mirror = 0 do n=1,this%block%ngc shift(dir) = shift(dir) + increment mirror(dir) = -shift(dir) + increment var%cell(i+shift(1),j+shift(2),k+shift(3)) = -var%cell(i+mirror(1),j+mirror(2),k+mirror(3)) end do end do end do end do end associate end if return end subroutine bc_set_UpdateBoundarySymmetryMinus