Init_DGModel1D Subroutine

public subroutine Init_DGModel1D(this, mesh, geometry)

Initialize the 1D DG model, then upload BC element/side arrays to GPU.

Arguments

TypeIntentOptionalAttributesName
class(DGModel1D), intent(out) :: this
type(Mesh1D), intent(in), target:: mesh
type(Geometry1D), intent(in), target:: geometry

Calls

proc~~init_dgmodel1d~~CallsGraph proc~init_dgmodel1d Init_DGModel1D proc~init_dgmodel1d_t Init_DGModel1D_t proc~init_dgmodel1d->proc~init_dgmodel1d_t proc~gpucheck gpuCheck proc~init_dgmodel1d->proc~gpucheck interface~hipmemcpy hipMemcpy proc~init_dgmodel1d->interface~hipmemcpy interface~hipmalloc hipMalloc proc~init_dgmodel1d->interface~hipmalloc

Contents

Source Code


Source Code

  subroutine Init_DGModel1D(this,mesh,geometry)
    !! Initialize the 1D DG model, then upload BC element/side arrays to GPU.
    implicit none
    class(DGModel1D),intent(out) :: this
    type(Mesh1D),intent(in),target :: mesh
    type(Geometry1D),intent(in),target :: geometry
    ! Local
    type(BoundaryCondition),pointer :: bc

    call Init_DGModel1D_t(this,mesh,geometry)

    ! Upload hyperbolic BC element/side arrays to device
    bc => this%hyperbolicBCs%head
    do while(associated(bc))
      if(bc%nBoundaries > 0) then
        call gpuCheck(hipMalloc(bc%elements_gpu,sizeof(bc%elements)))
        call gpuCheck(hipMemcpy(bc%elements_gpu,c_loc(bc%elements), &
                                sizeof(bc%elements),hipMemcpyHostToDevice))
        call gpuCheck(hipMalloc(bc%sides_gpu,sizeof(bc%sides)))
        call gpuCheck(hipMemcpy(bc%sides_gpu,c_loc(bc%sides), &
                                sizeof(bc%sides),hipMemcpyHostToDevice))
      endif
      bc => bc%next
    enddo

    ! Upload parabolic BC element/side arrays to device
    bc => this%parabolicBCs%head
    do while(associated(bc))
      if(bc%nBoundaries > 0) then
        call gpuCheck(hipMalloc(bc%elements_gpu,sizeof(bc%elements)))
        call gpuCheck(hipMemcpy(bc%elements_gpu,c_loc(bc%elements), &
                                sizeof(bc%elements),hipMemcpyHostToDevice))
        call gpuCheck(hipMalloc(bc%sides_gpu,sizeof(bc%sides)))
        call gpuCheck(hipMemcpy(bc%sides_gpu,c_loc(bc%sides), &
                                sizeof(bc%sides),hipMemcpyHostToDevice))
      endif
      bc => bc%next
    enddo

  endsubroutine Init_DGModel1D