MappedDGDivergence_MappedVector2D_t Subroutine

public subroutine MappedDGDivergence_MappedVector2D_t(this, df)

Computes the divergence of a 2-D vector using the weak form On input, the attribute of the vector is assigned and the attribute is set to the physical directions of the vector. This method will project the vector onto the contravariant basis vectors.

Arguments

TypeIntentOptionalAttributesName
class(MappedVector2D_t), intent(in) :: this
real(kind=prec) :: df(1:this%N+1,1:this%N+1,1:this%nelem,1:this%nvar)

Contents


Source Code

  subroutine MappedDGDivergence_MappedVector2D_t(this,df)
    !! Computes the divergence of a 2-D vector using the weak form
    !! On input, the  attribute of the vector
    !! is assigned and the  attribute is set to the physical
    !! directions of the vector. This method will project the vector
    !! onto the contravariant basis vectors.
    implicit none
    class(MappedVector2D_t),intent(in) :: this
    real(prec) :: df(1:this%N+1,1:this%N+1,1:this%nelem,1:this%nvar)
    ! Local
    integer :: iEl,iVar,i,j,ii
    real(prec) :: dfLoc,Fx,Fy,Fc

    do concurrent(i=1:this%N+1,j=1:this%N+1,iel=1:this%nElem,ivar=1:this%nVar)

      dfLoc = 0.0_prec
      do ii = 1,this%N+1
        ! Convert from physical to computational space
        Fx = this%interior(ii,j,iEl,iVar,1)
        Fy = this%interior(ii,j,iEl,iVar,2)
        Fc = this%geometry%dsdx%interior(ii,j,iEl,1,1,1)*Fx+ &
             this%geometry%dsdx%interior(ii,j,iEl,1,2,1)*Fy
        dfLoc = dfLoc+this%interp%dgMatrix(ii,i)*Fc
      enddo
      dF(i,j,iel,ivar) = dfLoc+ &
                         (this%interp%bMatrix(i,2)*this%boundaryNormal(j,2,iel,ivar)+ &
                          this%interp%bMatrix(i,1)*this%boundaryNormal(j,4,iel,ivar))/ &
                         this%interp%qweights(i)

    enddo

    do concurrent(i=1:this%N+1,j=1:this%N+1,iel=1:this%nElem,ivar=1:this%nVar)

      dfLoc = 0.0_prec
      do ii = 1,this%N+1
        ! Convert from physical to computational space
        Fx = this%interior(i,ii,iEl,iVar,1)
        Fy = this%interior(i,ii,iEl,iVar,2)
        Fc = this%geometry%dsdx%interior(i,ii,iEl,1,1,2)*Fx+ &
             this%geometry%dsdx%interior(i,ii,iEl,1,2,2)*Fy
        dfLoc = dfLoc+this%interp%dgMatrix(ii,j)*Fc
      enddo
      dfLoc = dfLoc+ &
              (this%interp%bMatrix(j,2)*this%boundaryNormal(i,3,iel,ivar)+ &
               this%interp%bMatrix(j,1)*this%boundaryNormal(i,1,iel,ivar))/ &
              this%interp%qweights(j)

      dF(i,j,iel,ivar) = (dF(i,j,iel,ivar)+dfLoc)/this%geometry%J%interior(i,j,iEl,1)

    enddo

  endsubroutine MappedDGDivergence_MappedVector2D_t