Coordinates of the grid points on certain boundary surface

61 views
Skip to first unread message

M. Y. Li

unread,
Feb 20, 2025, 3:04:44 AM2/20/25
to Nek5000
Hi,

Is there any subroutine or function in Nek5000 that can get the maximum/minimum value of the coordinates of the grid points on certain boundary surface?

Best regards,

M. Y. Li

YuHsiang Lan

unread,
Feb 20, 2025, 2:53:58 PM2/20/25
to Nek5000
Hi,

To go though all face points under a given boundary condition, one can follow the subroutine bcneusc in bdry.f
Here is a selected copy with some notes.

         DO 1000 IE=1,NEL         ! go through every elements in this MPI rank
         DO 1000 IFACE=1,NFACES   ! go through all faces
            ieg=lglel(ie)
            CB =CBC(IFACE,IE,IFIELD)
            IF (CB.EQ.'C  ' .OR. CB.EQ.'c  ' .OR.
     $          CB.EQ.'R  ' .OR. CB.EQ.'r  ') THEN  ! if face belongs to some BC
C
               IF (CB.EQ.'C  ') HC   = BC(2,IFACE,IE,IFIELD)
               IF (CB.EQ.'R  ') THEN
                                TINF = BC(1,IFACE,IE,IFIELD)
                                HRAD = BC(2,IFACE,IE,IFIELD)
               ENDIF
               IA=0

               CALL FACIND (KX1,KX2,KY1,KY2,KZ1,KZ2,lx1,ly1,lz1,IFACE)
               DO 100 IZ=KZ1,KZ2   ! go through face points
               DO 100 IY=KY1,KY2
               DO 100 IX=KX1,KX2
                  IA = IA + 1      ! face point index, for arrays like area, unx, etc.
                  TS = T(IX,IY,IZ,IE,IFIELD-1) ! volume index
                  IF (CB.EQ.'c  ' .OR. CB.EQ.'r  ') THEN
                     if (optlevel.le.2) CALL NEKASGN (IX,IY,IZ,IE)
                     CALL USERBC  (IX,IY,IZ,IFACE,IEG)
                  ENDIF
                  IF (CB.EQ.'r  ' .OR. CB.EQ.'R  ')  
     $               HC = HRAD * (TINF**2 + TS**2) * (TINF + TS)
                  S(IX,IY,IZ,IE) = S(IX,IY,IZ,IE) +
     $               HC*AREA(IA,1,IFACE,IE)/BM1(IX,IY,IZ,IE)
  100          CONTINUE
            ENDIF
 1000    CONTINUE

You can modify it to compute the min / max of coordinates from all face points that is attached to some.
Then, gather the min / max across all mpi ranks with glmin and glmax.

Hope this helps,
Yu-Hsiang
--
Reply all
Reply to author
Forward
0 new messages