Updates ghost cells to enforce Dirichlet BC
staggered non-staggered
(face-centerd) (cell-centered)
interior ---→--- | -------
| →
(boundary)-----→-----------|---------------- 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_UpdateBoundaryDirichlet(this,region,var) !> Updates ghost cells to enforce Dirichlet BC ! ! ! staggered non-staggered ! (face-centerd) (cell-centered) ! interior ---→--- | ------- ! | → ! (boundary)-----→-----------|---------------- ! 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 integer :: shift(3) integer :: dir integer :: side real(wp), pointer:: val(:,:,:) ! Get extents extents = this%GetExtents(region) ! Get direction and side of BC call this%GetSideDirByRegion(region,side,dir) ! Get a pointer to the BC values call this%GetBCPointer(region,var%name,val) shift = 0 if (dir.eq.var%staggering) then ! Treatment for face-centered fields in dir-direction select case (side) case (BC_RIGHT) shift(dir) = 1 case (BC_LEFT) shift(dir) = 0 end select 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) var%cell(i+shift(1),j+shift(2),k+shift(3)) = val(i,j,k) end do end do end do end associate else ! Treatment for cell-centered fields in dir-direction select case (side) case (BC_RIGHT) shift(dir) = 1 case (BC_LEFT) shift(dir) = -1 end select 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) var%cell(i+shift(1),j+shift(2),k+shift(3)) = 2.0_wp*val(i,j,k) - var%cell(i,j,k) end do end do end do end associate end if return end subroutine bc_set_UpdateBoundaryDirichlet