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_tel5(ielfa,ipnei,vel,xlet,gradtfa,xxj,
20     &  nef,nfacea,nfaceb,ncfd)
21!
22!     correct the facial temperature gradients:
23!     Moukalled et al. p 289
24!
25      implicit none
26!
27      integer ielfa(4,*),ipnei(*),nef,nfacea,nfaceb,i,k,iel1,iel2,
28     &  indexf,ncfd
29!
30      real*8 vel(nef,0:7),xlet(*),gradtfa(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            dd=(vel(iel2,0)-vel(iel1,0))/xlet(indexf)
40     &        -gradtfa(1,i)*xxj(1,indexf)
41     &        -gradtfa(2,i)*xxj(2,indexf)
42     &        -gradtfa(3,i)*xxj(3,indexf)
43            do k=1,ncfd
44               gradtfa(k,i)=gradtfa(k,i)+dd*xxj(k,indexf)
45            enddo
46         endif
47      enddo
48!
49      return
50      end
51