subroutine setgradientboundarycondition_DGModel1D(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),intent(inout) :: this
! local
integer :: ivar
integer :: nelem
real(prec) :: x
call gpuCheck(hipMemcpy(c_loc(this%solutiongradient%boundary), &
this%solutiongradient%boundary_gpu,sizeof(this%solutiongradient%boundary), &
hipMemcpyDeviceToHost))
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
call gpuCheck(hipMemcpy(this%solutiongradient%extBoundary_gpu, &
c_loc(this%solutiongradient%extBoundary), &
sizeof(this%solutiongradient%extBoundary), &
hipMemcpyHostToDevice))
endsubroutine setgradientboundarycondition_DGModel1D