1 subroutine sfID2np(isurfID,nsfnp,nmap) 2 !Finds the nodes associated with the surface ID and returns the 3 !count in nsfnp and the nodal mapping in nmap. 4 ! 5 !input: 6 ! isurfID (1) the surface ID of the face which user want 7 ! to play with, it is specified in Simaker 8 !output: 9 ! nsfnp (1) number of the nodal points which lie on the 10 ! surface with this ID, local for one process 11 ! nmap (nshg) a map from nsfnp to nshg; map the node on 12 ! the surface to the global nodal numbering 13 ! for one process 14 15 use pointer_data 16 include "common.h" 17 include "mpif.h" 18 integer isurfID, nsfnp 19 integer nmap(nshg) 20 integer ifirstvisit(nshg) 21 integer, allocatable :: ienb(:) 22 23 !Start to find matching surfID 24 ifirstvisit(:)=1 25 nsfnp=0 26 do iblk=1,nelblb !loop over boundary element blocks 27 npro=lcblkb(1,iblk+1)-lcblkb(1,iblk) 28 nenbl=lcblkb(6,iblk) !nenbl = number of element nodes on the boundary local? 29 nshl=lcblkb(9,iblk) !nshl = number of shape [functions] local 30 allocate(ienb(nshl)) 31 do i=1,npro !loop over boundary elements 32 33 ! If surfID does not match, do not consider 34 iBCB2=miBCB(iblk)%p(i,2) 35 if(isurfID.ne.iBCB2)cycle 36 37 ienb(1:nshl)=mienb(iblk)%p(i,1:nshl) !ienb = index of element nodes local 38 do j=1,nenbl !loop over nodes in an elmeent 39 nn=ienb(j) !nn is a global node index. The array ienb is probably the global indeces of the nodes on the boundary for a given element 40 if(ifirstvisit(nn).eq.1)then !need this check because nodes are shared by other elements 41 ifirstvisit(nn)=0 42 nsfnp=nsfnp+1 !nsfnp = Number of SurFace Nodal Points 43 nmap(nsfnp)=nn !nmap is the mapping from nodal surface index to the global nodal numbering for one process. The ith index of nmap gives you the global node numbering. Thus, nn is a global node number (on a processor) 44 endif 45 enddo 46 enddo 47 deallocate(ienb) 48 enddo 49 50 return 51 end 52 53 subroutine asfID2np(isurfID, nSurfNP, nodeMap) 54 !Same as sfID2np, except that nmap is allocated in the subroutine 55 !call to be of size nsfnp. 56 ! 57 !input: 58 ! isurfID (1) the surface ID of the face which user want to play with, it is specified in Simaker 59 !output: 60 ! nSurfNP (1) number of the nodal points which lie on the surface with this ID, local for one process 61 ! nmap (nshg) a map from nsfnp to nshg, map the node on the surface to the global nodal numbering for one process 62 63 include "common.h" 64 65 integer :: isurfID, nSurfNP 66 integer, allocatable :: nodeMap(:), tmp(:) 67 68 allocate(tmp(nshg)) 69 call sfID2np(isurfID, nSurfNP, tmp) 70 71 allocate(nodeMap(max(nSurfNP, 1))) 72 nodeMap = tmp(1:nSurfNP) 73 74! if(nSurfNP > 0) then 75! allocate(nmap(nSurfNP)) 76! nmap = tmp(1:nSurfNP) 77! else 78! allocate(nmap(1)) 79! endif 80 81 deallocate(tmp) 82 end subroutine 83