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 hrk_ud(ielfa,vel,ipnei,nef,flux,vfa,nfacea,nfaceb)
20!
21!     determine the facial temperature using upwind difference
22!
23      implicit none
24!
25      integer ielfa(4,*),i,j,indexf,ipnei(*),iel1,iel2,nef,nfacea,
26     &  nfaceb
27!
28      real*8 vel(nef,0:7),flux(*),vfa(0:7,*)
29!
30!
31!
32      do i=nfacea,nfaceb
33         iel2=ielfa(2,i)
34!
35!        faces with only one neighbor need not be treated
36!        unless outlet
37!
38c         if((iel2.le.0).and.(ielfa(3,i).ge.0)) cycle
39         if(iel2.le.0) cycle
40         iel1=ielfa(1,i)
41         j=ielfa(4,i)
42         indexf=ipnei(iel1)+j
43!
44         if(flux(indexf).ge.0.d0) then
45!
46!           outflow && (neighbor || outlet)
47!
48            vfa(6,i)=vel(iel1,6)
49         elseif(iel2.gt.0) then
50!
51!           inflow && neighbor
52!
53            vfa(6,i)=vel(iel2,6)
54         endif
55      enddo
56!
57      return
58      end
59