Defines boundary conditions.
subroutine SetUpCaseBCS() !> Defines boundary conditions. use leapBC implicit none ! Work variables type(bc_set) :: bcs type(extent_obj) :: extents integer :: i,j,k real(wp) :: xhi(3) real(wp) :: xlo(3) real(wp) :: L(3) real(wp) :: Vlid real(wp), pointer :: V1bc(:,:,:) real(wp), pointer :: V2bc(:,:,:) real(wp), pointer :: V3bc(:,:,:) ! Get lid velocity and domain size call parser%Get("Lid velocity", Vlid, default = 1.0_wp ) call parser%Get("Domain size", L ) ! Initialize utility that handles boundary conditions call bcs%Initialize(block,parallel) ! Setup regions where boundary conditions apply ! - Left boundary xlo = [-0.5_wp*L(1),-0.5_wp*L(2),-0.5_wp*L(3)] xhi = [-0.5_wp*L(1), 0.5_wp*L(2), 0.5_wp*L(3)] call bcs%Add('Left', xlo, xhi, normal = '+x1') ! - Right boundary xlo = [ 0.5_wp*L(1),-0.5_wp*L(2),-0.5_wp*L(3)] xhi = [ 0.5_wp*L(1), 0.5_wp*L(2), 0.5_wp*L(3)] call bcs%Add('Right', xlo, xhi, normal = '-x1') ! - Bottom boundary xlo = [-0.5_wp*L(1),-0.5_wp*L(2),-0.5_wp*L(3)] xhi = [ 0.5_wp*L(1),-0.5_wp*L(2), 0.5_wp*L(3)] call bcs%Add('Bottom', xlo, xhi, normal = '+x2') ! - Top boundary xlo = [-0.5_wp*L(1), 0.5_wp*L(2),-0.5_wp*L(3)] xhi = [ 0.5_wp*L(1), 0.5_wp*L(2), 0.5_wp*L(3)] call bcs%Add('Top', xlo, xhi, normal = '-x2') call bcs%SetBC('Top', BC_INFLOW) call bcs%SetBC('Bottom', BC_WALL ) call bcs%SetBC('Left', BC_WALL ) call bcs%SetBC('Right', BC_WALL ) ! Set the inflow values extents = bcs%GetExtents('Top') call bcs%GetBCPointer('Top','V1',V1bc) call bcs%GetBCPointer('Top','V2',V2bc) call bcs%GetBCPointer('Top','V3',V3bc) do k=extents%lo(3),extents%hi(3) do j=extents%lo(2),extents%hi(2) do i=extents%lo(1),extents%hi(1) V1bc(i,j,k) = Vlid V2bc(i,j,k) = 0.0_wp V3bc(i,j,k) = 0.0_wp end do end do end do ! Write boundary conditions call bcs%Write(0,0.0_wp) ! Clear data V1bc => null() V2bc => null() V3bc => null() call bcs%Finalize() return end subroutine SetUpCaseBCS