ESAtmo3D tendency = EC inviscid pipeline (parent) + optional constant-coefficient Laplacian diffusion (BR1 weak-form DG).
When nu>0 or kappa>0 the parent's CalculateTendency already computes solutionGradient (because gradient_enabled was set by SetDiffusion); we then fill diffFlux from solutionGradient, compute its DG divergence, and accumulate into fluxDivergence before forming dSdt.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ESAtmo3D_t), | intent(inout) | :: | this |
subroutine CalculateTendency_ESAtmo3D_t(this)
!! ESAtmo3D tendency = EC inviscid pipeline (parent) + optional
!! constant-coefficient Laplacian diffusion (BR1 weak-form DG).
!!
!! When nu>0 or kappa>0 the parent's CalculateTendency already
!! computes solutionGradient (because gradient_enabled was set by
!! SetDiffusion); we then fill diffFlux from solutionGradient,
!! compute its DG divergence, and accumulate into fluxDivergence
!! before forming dSdt.
implicit none
class(ESAtmo3D_t),intent(inout) :: this
! Local
integer :: i,j,k,iEl,iVar
real(prec) :: bMi1,bMi2,bMj1,bMj2,bMk1,bMk2,qwi,qwj,qwk,jac
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()
call this%TwoPointFluxMethod()
call this%twoPointFlux%UpdateDevice()
call this%twoPointFlux%MappedDivergence(this%fluxDivergence%interior)
! EC surface contribution (1/J) M^{-1} B^T f_Riemann
do concurrent(i=1:this%solution%N+1,j=1:this%solution%N+1, &
k=1:this%solution%N+1,iEl=1:this%mesh%nElem, &
iVar=1:this%solution%nVar)
bMi1 = this%solution%interp%bMatrix(i,2)
bMi2 = this%solution%interp%bMatrix(i,1)
bMj1 = this%solution%interp%bMatrix(j,2)
bMj2 = this%solution%interp%bMatrix(j,1)
bMk1 = this%solution%interp%bMatrix(k,2)
bMk2 = this%solution%interp%bMatrix(k,1)
qwi = this%solution%interp%qWeights(i)
qwj = this%solution%interp%qWeights(j)
qwk = this%solution%interp%qWeights(k)
jac = this%geometry%J%interior(i,j,k,iEl,1)
this%fluxDivergence%interior(i,j,k,iEl,iVar) = &
this%fluxDivergence%interior(i,j,k,iEl,iVar)+ &
(bMk1*this%flux%boundaryNormal(i,j,6,iEl,iVar)+ &
bMk2*this%flux%boundaryNormal(i,j,1,iEl,iVar))/(qwk*jac)+ &
(bMi1*this%flux%boundaryNormal(j,k,3,iEl,iVar)+ &
bMi2*this%flux%boundaryNormal(j,k,5,iEl,iVar))/(qwi*jac)+ &
(bMj1*this%flux%boundaryNormal(i,k,4,iEl,iVar)+ &
bMj2*this%flux%boundaryNormal(i,k,2,iEl,iVar))/(qwj*jac)
enddo
! Add the diffusive contribution if any coefficient is nonzero.
if(this%nu > 0.0_prec .or. this%kappa > 0.0_prec) then
call this%DiffusiveFluxMethod()
call this%DiffusiveBoundaryFlux()
call this%diffFlux%MappedDGDivergence(this%diffDiv%interior)
do concurrent(i=1:this%solution%N+1,j=1:this%solution%N+1, &
k=1:this%solution%N+1,iEl=1:this%mesh%nElem, &
iVar=1:this%solution%nVar)
! Subtract because MappedDGDivergence returns div(F); we want
! the diffusion to APPEAR in dSdt as +div(F_diff), so the
! contribution to fluxDivergence (which is later subtracted to
! form dSdt) is -div(F_diff). diffFlux already includes the
! minus sign of -nu*grad / -kappa*grad, so MappedDGDivergence
! returns -nu*Lap (the right sign for fluxDivergence).
this%fluxDivergence%interior(i,j,k,iEl,iVar) = &
this%fluxDivergence%interior(i,j,k,iEl,iVar)+ &
this%diffDiv%interior(i,j,k,iEl,iVar)
enddo
endif
do concurrent(i=1:this%solution%N+1,j=1:this%solution%N+1, &
k=1:this%solution%N+1,iEl=1:this%mesh%nElem, &
iVar=1:this%solution%nVar)
this%dSdt%interior(i,j,k,iEl,iVar) = &
this%source%interior(i,j,k,iEl,iVar)- &
this%fluxDivergence%interior(i,j,k,iEl,iVar)
enddo
endsubroutine CalculateTendency_ESAtmo3D_t