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 calcmach(vold,v,nk,ntmat_,shcon,nshcon,physcon,
20     &  inomat,mi)
21!
22      implicit none
23!
24      integer ntmat_,mi(*),nshcon(*),nk,i,imat,inomat(*)
25!
26      real*8 v(nk,0:mi(2)),vold(0:mi(2),*),cp,r,temp,
27     &  shcon(0:3,ntmat_,*),physcon(*)
28!
29!     calculate kappa (cp/cv) and store it in v(*,0)
30!     calculate the Mach number and store it in v(*,1)
31!
32      do i=1,nk
33        imat=inomat(i)
34        if(imat.eq.0) cycle
35         temp=vold(0,i)
36         call materialdata_cp_sec(imat,ntmat_,temp,shcon,
37     &        nshcon,cp,physcon)
38         r=shcon(3,1,imat)
39         v(i,0)=cp/(cp-r)
40         v(i,1)=dsqrt((vold(1,i)**2+vold(2,i)**2+vold(3,i)**2)
41     &        /(v(i,0)*r*(temp-physcon(1))))
42      enddo
43!
44      return
45      end
46
47