Velocity gradient tensor

13 views
Skip to first unread message

Bhargav Mantravadi

unread,
Dec 13, 2025, 4:58:44 AM12/13/25
to Nek5000
Dear All,

I am computing the velocity gradient tensor on the fly, followed by a volume average. However, the components of the velocity gradient are all turning out to be zero, despite the flow being developed. Could you please advise on what I might be doing incorrectly? I have included the relevant code below.

I am using the subroutine lambda2(l2) in ./core/postpro.f as a reference. 

Thank you in advance for your help.

Regards,
Bhargav

-------------------------------------------
   subroutine userchk()

      include 'SIZE'
      include 'TOTAL'

      parameter (lxyz=lx1*ly1*lz1)
      real gije(lxyz,ldim,ldim)
      real visc_dsp_l(lxyz,nelv)
      real visc_dsp

      nxyz = lx1*ly1*lz1

      do e=1,nelv
      !compute velocity gradient tensor
      call comp_gije(gije(1,1,1),vx(1,1,1,e),vy(1,1,1,e),vz(1,1,1,e),e)
      do i = 1,nxyz
      visc_dsp_l(i,e) = 2.0*gije(i,1,1)**2 + 2.0*gije(i,2,2)**2
     &  + 2.0*gije(i,3,3)**2
     &  + (gije(i,1,2) + gije(i,2,1))*2
     &  + (gije(i,1,3) + gije(i,3,1))*2
     &  + (gije(i,2,3) + gije(i,3,2))*2
      enddo
      enddo
      visc_dsp = glsc2(visc_dsp_l,bm1,n)
      visc_dsp = visc_dsp/volvm1

      return
      end

YuHsiang Lan

unread,
Dec 13, 2025, 3:06:11 PM12/13/25
to Nek5000
Hi Bhargav,

It looks like you miss to assign the variable "n".
Also, the default implicit for "e" is real, not the integer you need.

For debugging, I suggest using "implicit none" to make sure every variable is declared.
While the compiler tells some variable need declaration, it's also a good time to check whether its value is assigned.


Hope this helps,
Yu-Hsiang
--

Bhargav Mantravadi

unread,
Dec 14, 2025, 10:21:32 AM12/14/25
to YuHsiang Lan, Nek5000
Hi Yu-Hsiang,

Thank you very much for your reply and the helpful input. I have noted your suggestions, and the problem is now resolved.

Regards,
Bhargav

--
You received this message because you are subscribed to the Google Groups "Nek5000" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nek5000+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/nek5000/060e0071-6320-4e1c-810d-b32da8f82c61n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages