Computes the divergence of a 3-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.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(MappedVector3D_t), | intent(in) | :: | this | |||
real(kind=prec), | intent(out) | :: | df(1:this%N+1,1:this%N+1,1:this%N+1,1:this%nelem,1:this%nvar) |
subroutine MappedDGDivergence_MappedVector3D_t(this,df)
!! Computes the divergence of a 3-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(MappedVector3D_t),intent(in) :: this
real(prec),intent(out) :: df(1:this%N+1,1:this%N+1,1:this%N+1,1:this%nelem,1:this%nvar)
! Local
integer :: iEl,iVar,i,j,k,ii
real(prec) :: dfLoc,Fx,Fy,Fz,Fc
do concurrent(i=1:this%N+1,j=1:this%N+1, &
k=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,k,iEl,iVar,1)
Fy = this%interior(ii,j,k,iEl,iVar,2)
Fz = this%interior(ii,j,k,iEl,iVar,3)
Fc = this%geometry%dsdx%interior(ii,j,k,iEl,1,1,1)*Fx+ &
this%geometry%dsdx%interior(ii,j,k,iEl,1,2,1)*Fy+ &
this%geometry%dsdx%interior(ii,j,k,iEl,1,3,1)*Fz
dfLoc = dfLoc+this%interp%dgMatrix(ii,i)*Fc
enddo
dfLoc = dfLoc+ &
(this%interp%bMatrix(i,2)*this%boundaryNormal(j,k,3,iel,ivar)+ & ! east
this%interp%bMatrix(i,1)*this%boundaryNormal(j,k,5,iel,ivar))/ & ! west
this%interp%qweights(i)
dF(i,j,k,iel,ivar) = dfLoc
enddo
do concurrent(i=1:this%N+1,j=1:this%N+1, &
k=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,k,iEl,iVar,1)
Fy = this%interior(i,ii,k,iEl,iVar,2)
Fz = this%interior(i,ii,k,iEl,iVar,3)
Fc = this%geometry%dsdx%interior(i,ii,k,iEl,1,1,2)*Fx+ &
this%geometry%dsdx%interior(i,ii,k,iEl,1,2,2)*Fy+ &
this%geometry%dsdx%interior(i,ii,k,iEl,1,3,2)*Fz
dfLoc = dfLoc+this%interp%dgMatrix(ii,j)*Fc
enddo
dfLoc = +dfLoc+ &
(this%interp%bMatrix(j,2)*this%boundaryNormal(i,k,4,iel,ivar)+ & ! north
this%interp%bMatrix(j,1)*this%boundaryNormal(i,k,2,iel,ivar))/ & ! south
this%interp%qweights(j)
dF(i,j,k,iel,ivar) = (dF(i,j,k,iel,ivar)+dfLoc)
enddo
do concurrent(i=1:this%N+1,j=1:this%N+1, &
k=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,j,ii,iEl,iVar,1)
Fy = this%interior(i,j,ii,iEl,iVar,2)
Fz = this%interior(i,j,ii,iEl,iVar,3)
Fc = this%geometry%dsdx%interior(i,j,ii,iEl,1,1,3)*Fx+ &
this%geometry%dsdx%interior(i,j,ii,iEl,1,2,3)*Fy+ &
this%geometry%dsdx%interior(i,j,ii,iEl,1,3,3)*Fz
dfLoc = dfLoc+this%interp%dgMatrix(ii,k)*Fc
enddo
dfLoc = dfLoc+ &
(this%interp%bMatrix(k,2)*this%boundaryNormal(i,j,6,iel,ivar)+ & ! top
this%interp%bMatrix(k,1)*this%boundaryNormal(i,j,1,iel,ivar))/ & ! bottom
this%interp%qweights(k)
dF(i,j,k,iel,ivar) = (dF(i,j,k,iel,ivar)+dfLoc)/this%geometry%J%interior(i,j,k,iEl,1)
enddo
endsubroutine MappedDGDivergence_MappedVector3D_t