vtf-logo

weno/applications/euler/1d/RM_AirSF6/src/init1.f


c
c
c     =====================================================
       subroutine ic(maxmx,meqn,mbc,mx,x,dx,q)
c     =====================================================
       implicit none
c
       include  "cuser.i"
c

       integer maxmx,meqn,mbc,mx
       double precision q(meqn,1-mbc:maxmx+mbc)
       double precision x(1-mbc:maxmx+mbc)
       double precision dx
c
c     
       double precision gamma1
       double precision rhomix
       double precision qt(6), Ro
       
       integer i
       


c     INITALIZE THE DENSITY AND PRESSURE/ENERGY PROFILE FOR 
c     THE UNSHOCKED AIR/SF6.  Interface at x=cloc
       do i=1,mx
      
c     initalize the mixture ratio (-1 air: 1 sf6)
          qt(1) = 1.0d0
          qt(6) = dtanh(amp*(x(i)-cloc))

c     get the local values of specific heats
          call cles_gamma(qt, 6, gamma1, Ro)
          gamma1 = gamma1-1.0d0

c     the mixture (ratio) of the two gases is stored in qt(6)
c     and hence in Ro,cv,cp.  

c     Compute the correct density
c     for this mixture at this tempurature
          rhomix = p_Uair/(Ro*t_Uair)

          q(1,i)=rhomix
          q(2,i)=u_Uair*rhomix
          q(3,i)=0.D0
          q(4,i)=0.D0
          
c     energy equation 1/2 rho |u|^2 + (cv/R) P
          q(5,i)=0.5D0*rhomix*(u_Uair*u_Uair)+p_Uair/gamma1
          
c     passive scalar
          q(6,i)=rhomix*qt(6)
c     get the correct gamma
          
          q(7,i)=t_Uair
          
       end do

c     OVER-WRITE THE POST-SHOCK REGION in AIR
c     shock at x=sloc
       do i = 1,mx
          if (x(i).lt.sloc) then
             
             q(6,i)=q(6,i)*rho_Sair/q(1,i)
             q(1,i)=rho_Sair
             q(2,i)=rho_Sair*u_Sair
             q(3,i)=0.D0
             q(4,i)=0.D0

             qt(1) = q(1,i)
             qt(6) = q(6,i)/q(1,i)

             call cles_gamma(qt, 6, gamma1, Ro)
             gamma1 = gamma1-1.0d0

c     energy equation 1/2 rho |u|^2 + (cv/R) P
             q(5,i)=0.5D0*rho_Sair*(u_Sair*u_Sair)+p_Sair/gamma1

             q(7,i) = p_Sair/(Ro*rho_Sair)
          end if
       end do

       
      return
      end