Initialize the 1D DG model, then upload BC element/side arrays to GPU.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(DGModel1D), | intent(out) | :: | this | |||
| type(Mesh1D), | intent(in), | target | :: | mesh | ||
| type(Geometry1D), | intent(in), | target | :: | geometry |
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