CalculateTendency_ECDGModel2D Subroutine

public subroutine CalculateTendency_ECDGModel2D(this)

GPU implementation of the EC-DG 2-D tendency.

TwoPointFluxMethod is computed on the host (user Fortran function) and uploaded before the GPU kernel sequence. The surface term uses the dedicated ECDGSurfaceContribution_2D_gpu kernel which applies the Jacobian weighting consistently with the volume term.

Arguments

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

Calls

proc~~calculatetendency_ecdgmodel2d~~CallsGraph proc~calculatetendency_ecdgmodel2d CalculateTendency_ECDGModel2D interface~ecdgsurfacecontribution_2d_gpu ECDGSurfaceContribution_2D_gpu proc~calculatetendency_ecdgmodel2d->interface~ecdgsurfacecontribution_2d_gpu interface~calculatedsdt_gpu CalculateDSDt_gpu proc~calculatetendency_ecdgmodel2d->interface~calculatedsdt_gpu

Contents


Source Code

  subroutine CalculateTendency_ECDGModel2D(this)
    !! GPU implementation of the EC-DG 2-D tendency.
    !!
    !! TwoPointFluxMethod is computed on the host (user Fortran function) and
    !! uploaded before the GPU kernel sequence.  The surface term uses the
    !! dedicated ECDGSurfaceContribution_2D_gpu kernel which applies the
    !! Jacobian weighting consistently with the volume term.
    implicit none
    class(ECDGModel2D),intent(inout) :: this
    ! Local
    integer :: ndof

    call this%solution%BoundaryInterp()
    call this%solution%SideExchange(this%mesh)

    call this%PreTendency()
    call this%SetBoundaryCondition()

    if(this%gradient_enabled) then
      call this%CalculateSolutionGradient()
      call this%SetGradientBoundaryCondition()
      call this%solutionGradient%AverageSides()
    endif

    call this%SourceMethod()
    call this%BoundaryFlux() ! CPU, uploads flux%boundaryNormal_gpu

    ! Two-point flux: concrete GPU models (e.g. ECAdvection2D) override
    ! TwoPointFluxMethod to run entirely on device.  Models that compute
    ! on the host should call twoPointFlux%UpdateDevice() at the end of
    ! their TwoPointFluxMethod override.
    call this%TwoPointFluxMethod()

    ! EC volume divergence (uses MappedTwoPointVectorDivergence_2D_gpu)
    call this%twoPointFlux%MappedDivergence(this%fluxDivergence%interior_gpu)

    ! Add (1/J) * M^{-1} B^T f_Riemann
    call ECDGSurfaceContribution_2D_gpu( &
      this%flux%boundarynormal_gpu, &
      this%geometry%J%interior_gpu, &
      this%solution%interp%bMatrix_gpu, &
      this%solution%interp%qWeights_gpu, &
      this%fluxDivergence%interior_gpu, &
      this%solution%interp%N,this%solution%nVar,this%mesh%nElem)

    ! dSdt = source - fluxDivergence
    ndof = this%solution%nVar* &
           this%mesh%nElem* &
           (this%solution%interp%N+1)* &
           (this%solution%interp%N+1)

    call CalculateDSDt_gpu(this%fluxDivergence%interior_gpu, &
                           this%source%interior_gpu, &
                           this%dSdt%interior_gpu,ndof)

  endsubroutine CalculateTendency_ECDGModel2D