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 hrr_ud(vfa,shcon,ielmat,ntmat_,
20     &  mi,ielfa,ipnei,vel,nef,flux,nfacea,nfaceb,xxi,xle,
21     &  gradpel,gradtel,neij)
22!
23!     calculation of the density at the face centers
24!     (compressible fluids)
25!
26!     facial temperature and pressure is only used for external
27!     faces
28!
29      implicit none
30!
31      integer i,j,imat,ntmat_,mi(*),ipnei(*),nef,iel1,iel2,
32     &  ielmat(mi(3),*),ielfa(4,*),indexf,nfacea,nfaceb,neij(*)
33!
34      real*8 t1l,vfa(0:7,*),shcon(0:3,ntmat_,*),vel(nef,0:7),flux(*),
35     &  r,dd,xxv(3),xxi(3,*),qp(3),p,t,xle(*),gradpel(3,*),
36     &  gradtel(3,*)
37!
38!
39!
40      do i=nfacea,nfaceb
41!
42         iel2=ielfa(2,i)
43!
44!        take the material of the first adjacent element
45!
46         imat=ielmat(1,ielfa(1,i))
47         r=shcon(3,1,imat)
48!
49!        no neighbor
50!
51         if(iel2.le.0) then
52            t1l=vfa(0,i)
53!
54!           take the material of the first adjacent element
55!
56            imat=ielmat(1,ielfa(1,i))
57            r=shcon(3,1,imat)
58!
59!           specific gas constant
60!
61            vfa(5,i)=vfa(4,i)/(r*vfa(0,i))
62            cycle
63         endif
64!
65!        neighbor
66!
67         iel1=ielfa(1,i)
68         j=ielfa(4,i)
69         indexf=ipnei(iel1)+j
70!
71         if(flux(indexf).ge.0.d0) then
72!
73!           outflow
74!
75c            vfa(5,i)=vel(iel1,5)
76            vfa(5,i)=vel(iel1,4)/(r*vfa(0,i))
77         elseif(iel2.gt.0) then
78!
79!           inflow && neighbor
80!
81c            vfa(5,i)=vel(iel2,5)
82            vfa(5,i)=vel(iel2,4)/(r*vfa(0,i))
83         endif
84!
85      enddo
86!
87      return
88      end
89