subroutine setgradientboundarycondition_DGModel1D_t(this)
! Here, we set the boundary conditions for the
! solution and the solution gradient at the left
! and right most boundaries.
!
! Here, we use periodic boundary conditions
implicit none
class(DGModel1D_t),intent(inout) :: this
! local
real(prec) :: x
integer :: nelem
nelem = this%geometry%nelem ! number of elements in the mesh
! left-most boundary
if(this%mesh%bcid(1) == SELF_BC_PRESCRIBED) then
x = this%geometry%x%boundary(1,1,1)
this%solutionGradient%extBoundary(1,1,1:this%nvar) = &
this%pbc1d_Prescribed(x,this%t)
elseif(this%mesh%bcid(1) == SELF_BC_RADIATION) then
this%solutionGradient%extBoundary(1,1,1:this%nvar) = &
this%pbc1d_Radiation(this%solutionGradient%boundary(1,1,1:this%nvar),-1.0_prec)
elseif(this%mesh%bcid(1) == SELF_BC_NONORMALFLOW) then
this%solutionGradient%extBoundary(1,1,1:this%nvar) = &
this%pbc1d_NoNormalFlow(this%solutionGradient%boundary(1,1,1:this%nvar),-1.0_prec)
else ! Periodic
this%solutionGradient%extBoundary(1,1,1:this%nvar) = this%solutionGradient%boundary(2,nelem,1:this%nvar)
endif
! right-most boundary
if(this%mesh%bcid(1) == SELF_BC_PRESCRIBED) then
x = this%geometry%x%boundary(2,nelem,1)
this%solutionGradient%extBoundary(2,nelem,1:this%nvar) = &
this%pbc1d_Prescribed(x,this%t)
elseif(this%mesh%bcid(1) == SELF_BC_RADIATION) then
this%solutionGradient%extBoundary(2,nelem,1:this%nvar) = &
this%pbc1d_Radiation(this%solutionGradient%boundary(2,nelem,1:this%nvar),-1.0_prec)
elseif(this%mesh%bcid(1) == SELF_BC_NONORMALFLOW) then
this%solutionGradient%extBoundary(2,nelem,1:this%nvar) = &
this%pbc1d_NoNormalFlow(this%solutionGradient%boundary(2,nelem,1:this%nvar),-1.0_prec)
else ! Periodic
this%solutionGradient%extBoundary(2,nelem,1:this%nvar) = this%solutionGradient%boundary(1,1,1:this%nvar)
endif
endsubroutine setgradientboundarycondition_DGModel1D_t