Post-processing natively

43 views
Skip to first unread message

patil.ak...@gmail.com

unread,
Jul 28, 2025, 8:08:41 AMJul 28
to Nek5000
Dear Nek-Nerds,

I am returning to using Nek5000 after a long pause and I was wondering if you could advise me on how to post-process my simulation data.

I managed to simulate duct flow and would now like to analyse the 3D snapshots stored as duct0.f00001, duct0.f00002, .... duct0.,f<n> and so on. How can I do this using the duct.usr  and duct.par. For example, I would like to calculate the volume averaged velocity for each snapshot using `userchk` with Nek5000 in the post-processing mode by setting numSteps = 0.0. 

Example below

real u_mean     

ntot = nx1*ny1*nz1*nelv

u_mean = glsc2(vx1,bm1,ntot)/volvm1 


However, what is unclear to me is, how do I instruct Nek5000 to read the requisite 3D snapshots for which the userchk subroutine will be triggered?

Thanks in advance!

YuHsiang Lan

unread,
Jul 28, 2025, 9:07:43 AMJul 28
to Nek5000
Hi,

You can follow the discussion here

Basically, it opens a list of files one by one in userchk, do some post-processing you want, then exit early via exitt0.

Thanks,
Yu-Hsiang
--

Yu-Hsiang Lan (藍鈺翔)

unread,
Jul 28, 2025, 3:08:20 PMJul 28
to Akshay Patil, Nek5000
Hi Akshay,

1. The code works in both serial and parallel.
2. Typically, we don't assume whether a boundary is aligned to axis or not. torque_calc works for the curved boundary.

Hope this helps,
Yu-Hsiang
--

Akshay Patil <patil.ak...@gmail.com> 於 2025年7月28日 週一 上午8:33寫道:
Hi YuHsiang,

Thanks a lot for your swift response. Perhaps a two-part question for clarification on my end, if you don't mind

1. I assume that the post-processing mode works identically for serial and parallel Nek5000 runs in the post-processing mode?
2. On a similar note, but with a slightly different application. I want to calculate the wall shear stress on a non-flat wall. In the past, I have used the subroutine torque_calc(scale,x0,ifdout,iftout), for a flat-walled channel flowBut now, I would like to use something similar if that already exists for a non-flat wall. As I understand it, torque_calc takes in x0 as a reference point, but it's unclear to me if this gives the right wall shear for non-flat walls. 

Thanks again for your help!

--
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/933a4909-87a6-4a94-b18b-cb4de7b8aafbn%40googlegroups.com.


--
Regards,
Akshay Patil

Yu-Hsiang Lan (藍鈺翔)

unread,
Jul 29, 2025, 11:41:58 AMJul 29
to Akshay Patil, Nek5000
My guess is, you didn't create a post_reader_work in the .usr file?
vx, vy, vz and pr are included in TOTAL. I don't think that's the case.

Anyway, I'm glad you have a working version.

Thanks,
Yu-Hsiang
--

Akshay Patil <patil.ak...@gmail.com> 於 2025年7月29日 週二 上午2:19寫道:
Hi Yu-Hsiang,

Thanks a lot for clarifying this. I tried your suggested subroutines and they work beautifully, thanks a lot for the insight. At first adding the required post-processing in the `post_reader_work` file failed to compile, potentially because `vx,vy,vz,pr` are not visible outside the scope (correct me if I am wrong) of the subroutine. Adding the required workflow as below worked as expected.

nfiles = 1
            call restart(nfiles)  ! Note -- time is reset.
            ! call post_reader_work(ipass)
            ! Instead of doing this in the post_reader_work, directly work here
            !ntot = nx1*ny1*nz1*nelv
            !u_mean = glsc2(vx,bm1,ntot)/volvm1
            !v_mean = glsc2(vy,bm1,ntot)/volvm1
            !w_mean = glsc2(vz,bm1,ntot)/volvm1
            !ubulk = (u_mean**2 + v_mean**2 + w_mean**2)**0.5
            call vortex_core(t, 'q')
            call outpost(vx,vy,vz,pr,t,' ')
            !if (nio.eq.0) write(*,*) 'Mean velocity:', ubulk
--
Regards,
Akshay Patil
Reply all
Reply to author
Forward
0 new messages