BoundaryFlux_DGModel2D Subroutine

public subroutine BoundaryFlux_DGModel2D(this)

Arguments

TypeIntentOptionalAttributesName
class(DGModel2D), intent(inout) :: this

Contents


Source Code

  subroutine BoundaryFlux_DGModel2D(this)
    ! this method uses an linear upwind solver for the
    ! advective flux and the bassi-rebay method for the
    ! diffusive fluxes
    implicit none
    class(DGModel2D),intent(inout) :: this
    ! Local
    integer :: iel
    integer :: j
    integer :: i
    real(prec) :: sL(1:this%nvar),sR(1:this%nvar)
    real(prec) :: dsdx(1:this%nvar,1:2)
    real(prec) :: nhat(1:2),nmag

    call gpuCheck(hipMemcpy(c_loc(this%solution%boundary), &
                            this%solution%boundary_gpu,sizeof(this%solution%boundary), &
                            hipMemcpyDeviceToHost))

    call gpuCheck(hipMemcpy(c_loc(this%solution%extboundary), &
                            this%solution%extboundary_gpu,sizeof(this%solution%extboundary), &
                            hipMemcpyDeviceToHost))

    call gpuCheck(hipMemcpy(c_loc(this%solutiongradient%avgboundary), &
                            this%solutiongradient%avgboundary_gpu,sizeof(this%solutiongradient%avgboundary), &
                            hipMemcpyDeviceToHost))

    do iEl = 1,this%solution%nElem
      do j = 1,4
        do i = 1,this%solution%interp%N+1

          ! Get the boundary normals on cell edges from the mesh geometry
          nhat = this%geometry%nHat%boundary(i,j,iEl,1,1:2)
          sL = this%solution%boundary(i,j,iel,1:this%nvar) ! interior solution
          sR = this%solution%extboundary(i,j,iel,1:this%nvar) ! exterior solution
          dsdx = this%solutiongradient%avgboundary(i,j,iel,1:this%nvar,1:2)
          nmag = this%geometry%nScale%boundary(i,j,iEl,1)

          this%flux%boundaryNormal(i,j,iEl,1:this%nvar) = this%riemannflux2d(sL,sR,dsdx,nhat)*nmag

        enddo
      enddo
    enddo

    call gpuCheck(hipMemcpy(this%flux%boundarynormal_gpu, &
                            c_loc(this%flux%boundarynormal), &
                            sizeof(this%flux%boundarynormal), &
                            hipMemcpyHostToDevice))

  endsubroutine BoundaryFlux_DGModel2D