1!
2!     CalculiX - A 3-dimensional finite element program
3!              Copyright (C) 1998-2021 Guido Dhondt
4!
5!     This program is free software; you can redistribute it and/or
6!     modify it under the terms of the GNU General Public License as
7!     published by the Free Software Foundation(version 2);
8!
9!
10!     This program is distributed in the hope that it will be useful,
11!     but WITHOUT ANY WARRANTY; without even the implied warranty of
12!     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13!     GNU General Public License for more details.
14!
15!     You should have received a copy of the GNU General Public License
16!     along with this program; if not, write to the Free Software
17!     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18!
19      subroutine extrapol_vel5(ielfa,ipnei,vel,xlet,gradvfa,xxj,
20     &  nef,nfacea,nfaceb,ncfd)
21!
22!     correct the facial velocity gradients:
23!     Moukalled et al. p 289
24!
25      implicit none
26!
27      integer ielfa(4,*),ipnei(*),nef,nfacea,nfaceb,i,k,l,indexf,iel1,
28     &  iel2,ncfd
29!
30      real*8 vel(nef,0:7),xlet(*),gradvfa(3,3,*),xxj(3,*),dd
31!
32!
33!
34      do i=nfacea,nfaceb
35         iel2=ielfa(2,i)
36         if(iel2.gt.0) then
37            iel1=ielfa(1,i)
38            indexf=ipnei(iel1)+ielfa(4,i)
39            do k=1,ncfd
40               dd=(vel(iel2,k)-vel(iel1,k))/xlet(indexf)
41     &              -gradvfa(k,1,i)*xxj(1,indexf)
42     &              -gradvfa(k,2,i)*xxj(2,indexf)
43     &              -gradvfa(k,3,i)*xxj(3,indexf)
44               do l=1,ncfd
45                  gradvfa(k,l,i)=gradvfa(k,l,i)+dd*xxj(l,indexf)
46               enddo
47            enddo
48         endif
49      enddo
50!
51      return
52      end
53