No-normal-flow boundary condition for 2D linear shallow water equations. Reflects the velocity vector about the boundary normal while preserving the free surface elevation.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(BoundaryCondition), | intent(in) | :: | bc | |||
| class(Model), | intent(inout) | :: | mymodel |
subroutine hbc2d_NoNormalFlow_LinearShallowWater2D(bc,mymodel)
!! No-normal-flow boundary condition for 2D linear shallow water equations.
!! Reflects the velocity vector about the boundary normal while
!! preserving the free surface elevation.
class(BoundaryCondition),intent(in) :: bc
class(Model),intent(inout) :: mymodel
! Local
integer :: n,i,iEl,j
real(prec) :: nhat(1:2),s(1:3)
select type(m => mymodel)
class is(LinearShallowWater2D_t)
do n = 1,bc%nBoundaries
iEl = bc%elements(n)
j = bc%sides(n)
do i = 1,m%solution%interp%N+1
nhat = m%geometry%nhat%boundary(i,j,iEl,1,1:2)
s = m%solution%boundary(i,j,iEl,1:3)
m%solution%extBoundary(i,j,iEl,1) = &
(nhat(2)**2-nhat(1)**2)*s(1)-2.0_prec*nhat(1)*nhat(2)*s(2) ! u
m%solution%extBoundary(i,j,iEl,2) = &
(nhat(1)**2-nhat(2)**2)*s(2)-2.0_prec*nhat(1)*nhat(2)*s(1) ! v
m%solution%extBoundary(i,j,iEl,3) = s(3) ! eta
enddo
enddo
endselect
endsubroutine hbc2d_NoNormalFlow_LinearShallowWater2D