Free the 2D DG model, including GPU BC arrays.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(DGModel2D), | intent(inout) | :: | this |
subroutine Free_DGModel2D(this)
!! Free the 2D DG model, including GPU BC arrays.
implicit none
class(DGModel2D),intent(inout) :: this
! Local
type(BoundaryCondition),pointer :: bc
! Free hyperbolic BC device arrays
bc => this%hyperbolicBCs%head
do while(associated(bc))
if(c_associated(bc%elements_gpu)) call gpuCheck(hipFree(bc%elements_gpu))
if(c_associated(bc%sides_gpu)) call gpuCheck(hipFree(bc%sides_gpu))
bc%elements_gpu = c_null_ptr
bc%sides_gpu = c_null_ptr
bc => bc%next
enddo
! Free parabolic BC device arrays
bc => this%parabolicBCs%head
do while(associated(bc))
if(c_associated(bc%elements_gpu)) call gpuCheck(hipFree(bc%elements_gpu))
if(c_associated(bc%sides_gpu)) call gpuCheck(hipFree(bc%sides_gpu))
bc%elements_gpu = c_null_ptr
bc%sides_gpu = c_null_ptr
bc => bc%next
enddo
! Release the AMR transfer staging buffers (Stage 6a). These are lazily created by
! StageSolutionForTransfer / ApplyTransferPlan and survive across adaptation epochs, so
! they are owned by the model and released only here.
if(c_associated(this%xferOld_gpu)) call gpuCheck(hipFree(this%xferOld_gpu))
if(c_associated(this%xferKind_gpu)) call gpuCheck(hipFree(this%xferKind_gpu))
if(c_associated(this%xferElem_gpu)) call gpuCheck(hipFree(this%xferElem_gpu))
if(c_associated(this%xferFamily_gpu)) call gpuCheck(hipFree(this%xferFamily_gpu))
if(c_associated(this%xferDepth_gpu)) call gpuCheck(hipFree(this%xferDepth_gpu))
if(c_associated(this%xferPath_gpu)) call gpuCheck(hipFree(this%xferPath_gpu))
this%xferOld_gpu = c_null_ptr
this%xferKind_gpu = c_null_ptr
this%xferElem_gpu = c_null_ptr
this%xferFamily_gpu = c_null_ptr
this%xferDepth_gpu = c_null_ptr
this%xferPath_gpu = c_null_ptr
this%xferAllocBytes = 0
this%planAllocElem = 0
this%planAllocStride = 0
this%xferNOld = 0
call Free_DGModel2D_t(this)
endsubroutine Free_DGModel2D