subroutine DiagnoseGeostrophicVelocity_LinearShallowWater2D_t(this)
implicit none
class(LinearShallowWater2D_t),intent(inout) :: this
! Local
integer :: iel
integer :: i
integer :: j
real(prec) :: dpdx,dpdy,f
! We assume here that the velocity field is identically zero
! everywhere and the only field that is set is the free surface height
! with a non-zero coriolis parameter.
! In this case, we have that the tendency calculation will give
! the gradient in the free surface, consistent with the DG approximation
this%solution%interior(:,:,:,1) = 0.0_prec ! Set u=0
this%solution%interior(:,:,:,2) = 0.0_prec ! Set v=0
call this%solution%UpdateDevice()
call this%CalculateTendency()
call this%dSdt%UpdateHost()
do concurrent(i=1:this%solution%N+1,j=1:this%solution%N+1, &
iel=1:this%mesh%nElem)
dpdx = -this%dSdt%interior(i,j,iel,1)
dpdy = -this%dSdt%interior(i,j,iel,2)
f = this%fCori%interior(i,j,iel,1)
this%solution%interior(i,j,iel,1) = -dpdy/f ! u
this%solution%interior(i,j,iel,2) = dpdx/f ! v
enddo
call this%solution%UpdateDevice()
endsubroutine DiagnoseGeostrophicVelocity_LinearShallowWater2D_t