How to access the whole velocity field within userchk with mpi

196 views
Skip to first unread message

Christoph Grabietz

unread,
Jun 10, 2022, 4:32:20 AM6/10/22
to Nek5000
Hello,

I need to compute the average X-velocity throughout my field at every iteration step. Since I'm using MPI, each process has its own computation domain. Is it possible to access the velocity-field of the whole domain within the userchk-subroutine?

Greetings
Christoph

stek...@gmail.com

unread,
Jun 10, 2022, 4:58:28 AM6/10/22
to Nek5000
Hi, there are different ways to do averaging, one way is to use the subroutine avg_all, another way is to compute the averages manually at runtime, for how to do that, refer to the turbChannel example.

Typically you don't want to acess the whole domain from a single thread since this is very inefficient and it's not necessary for averaging.

Fischer, Paul

unread,
Jun 10, 2022, 9:45:44 AM6/10/22
to Nek5000, Christoph Grabietz

Dear Christoph,

If your objective is to compute ubar := (1/vol) \int u(x,y,z) dx dy dz, then this can be done 
in userchck as follows:

      n = lx1*ly1*lz1*nelv

      ubar = glsc2(vx,bm1,n)/volvm1

That command computes the sum i=1:n B_ii vx_i, where B_ii are the entries of the diagonal mass matrix.

Every processor receives that result because of the global (gl) nature of the glsc2 function:

      global scalar product involving two arguments

Here,

volvm1 = sum i=1:n B_ii

is the volume (on the velocity-only mesh, v,m1).

hth,
Paul


From: 'Christoph Grabietz' via Nek5000 <nek...@googlegroups.com>
Sent: Friday, June 10, 2022 3:32 AM
To: Nek5000 <nek...@googlegroups.com>
Subject: [nek5000] How to access the whole velocity field within userchk with mpi
 
--
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 on the web visit https://groups.google.com/d/msgid/nek5000/40c57036-291c-4d15-96aa-9671bc7bb179n%40googlegroups.com.

Christoph Grabietz

unread,
Jun 10, 2022, 11:37:23 AM6/10/22
to Nek5000
Hi Paul,

thanks for your help. That was exactly what I was looking for. 
The results are looking like they should.

Christoph

Reply all
Reply to author
Forward
0 new messages