StageSolutionForTransfer_DGModel2D_t Subroutine

public subroutine StageSolutionForTransfer_DGModel2D_t(this)

Preserve the current solution ahead of a regrid, so that Regrid may release the storage it lives in. Pair with ApplyTransferPlan, which consumes the staged copy:

call model%StageSolutionForTransfer()
call model%Regrid(newMesh,newGeom)
call model%ApplyTransferPlan(plan,interp,eFirst,eLast)

This base implementation stages on the host, which on a GPU build means a device-to-host copy of the whole field; the GPU backend overrides it with a device-to-device copy and no host traffic (Stage 6a).

Arguments

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

Contents


Source Code

  subroutine StageSolutionForTransfer_DGModel2D_t(this)
    !! Preserve the current solution ahead of a regrid, so that Regrid may release the storage
    !! it lives in. Pair with ApplyTransferPlan, which consumes the staged copy:
    !!
    !!     call model%StageSolutionForTransfer()
    !!     call model%Regrid(newMesh,newGeom)
    !!     call model%ApplyTransferPlan(plan,interp,eFirst,eLast)
    !!
    !! This base implementation stages on the host, which on a GPU build means a
    !! device-to-host copy of the whole field; the GPU backend overrides it with a
    !! device-to-device copy and no host traffic (Stage 6a).
    implicit none
    class(DGModel2D_t),intent(inout) :: this
    ! Local
    integer :: Np,nEl

    Np = this%solution%interp%N+1
    nEl = this%solution%nElem

    call this%solution%UpdateHost()

    if(allocated(this%transferStage)) deallocate(this%transferStage)
    allocate(this%transferStage(1:Np,1:Np,1:nEl,1:this%nvar))
    this%transferStage(1:Np,1:Np,1:nEl,1:this%nvar) = &
      this%solution%interior(1:Np,1:Np,1:nEl,1:this%nvar)

  endsubroutine StageSolutionForTransfer_DGModel2D_t