gather scatter for surface integral

6 views
Skip to first unread message

Chunheng Zhao

unread,
Dec 9, 2025, 8:14:32 PM (4 days ago) Dec 9
to Nek5000
Hi all,

I am confused about the surface integral area in Nek5000.
When I evaluate the flux at each node, for which I have to multiply the area for the node. I would like to know after the evaluation, do I have to do the gather scatter and multiply the inverse mass matrix, and are they the same as doing nothing?

for example 
flux=area*a
call fgslib_gs_op(gsh_fld(1),flux,1,1,0)
call col2(flux,binvm1, npts)

after the gather scatter and inverse, can I expect it is equal to the previous value?

Thanks,
Chunheng.

Fischer, Paul

unread,
Dec 9, 2025, 8:56:29 PM (4 days ago) Dec 9
to Nek5000, Chunheng Zhao
Dear Chunheng,

The code below (also included as attachment) shows how to compute
 a surface integral over a desired patch.

 surface_flux() is a similar routine, also found in navier5.f

Hth. 

Best,
Paul

c-----------------------------------------------------------------------
      subroutine test

      include 'SIZE'
      include 'TOTAL'

      integer e,f

      nface = 2*ndim

      pr_int = 0.   ! Integrate pressure over given section
      ar_int = 0.   ! Compute area over given section
      do e=1,nelv
         xbar = xm1(2,2,1,e)
         if (-1.lt.xbar.and.xbar.lt.1) then ! Near the origin
           do f=1,nface
              if (cbc(f,e,1).eq.'v  ') then ! on the "moving" wall
                 call surface_int(pr_loc,ar_loc,pr,e,f)
                 pr_int = pr_int + pr_loc ! Integrated pressure
                 ar_int = ar_int + ar_loc ! Integrated area
              endif
           enddo
         endif
      enddo
      pr_int = glsum(pr_int,1)   ! Sum across all processors
      ar_int = glsum(ar_int,1)   ! Sum across all processors

      pr_avg = pr_int / ar_int   ! Average pressure

      return
      end
c-----------------------------------------------------------------------


From: 'Chunheng Zhao' via Nek5000 <nek...@googlegroups.com>
Sent: Tuesday, December 9, 2025 7:14 PM
To: Nek5000 <nek...@googlegroups.com>
Subject: [nek5000] gather scatter for surface integral
 
--
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/81a6b19a-1776-4c7e-a627-00ec329488dcn%40googlegroups.com.
surf_int.usr
Reply all
Reply to author
Forward
0 new messages