vtf-logo

src/1d/equations/euler/rp/in1eu.f

c
c     ==========================================================
      subroutine in1eu(qi,mxi,lbi,ubi,q,mx,lb,ub,
     &     lbr,ubr,shaper,meqn,nc,t)
c     ==========================================================
c
c     # Computes conserved quantities from primitives for 
c     # Euler equations. The inverse to flgout1eu.f.
c
c     # Copyright (C) 2002 Ralf Deiterding
c     # Brandenburgische Universitaet Cottbus
c
c     # Copyright (C) 2003-2007 California Institute of Technology
c     # Ralf Deiterding, ralf@amroc.net
c
      implicit double precision(a-h,o-z)
      common /param/  gamma,gamma1
      common /PhysData/  Wk, RU, PA
c
      integer meqn, mx, mxi
      dimension q(meqn,mx), qi(mxi)
c
      integer  lb(1), ub(1), lbi(1), ubi(1), lbr(1), ubr(1), shaper(1), 
     &     mresult, stride, imin(1), imax(1), i, getindx, d
c
      stride = (ub(1) - lb(1))/(mx-1)

      imin(1) = max(lb(1), lbr(1))
      imax(1) = min(ub(1), ubr(1))
      
      if (mod(imin(1)-lb(1),stride) .ne. 0) then
         imin(1) = imin(1) + stride - mod(imin(1)-lb(1),stride) 
      endif
      imin(1) = getindx(imin(1), lb(1), stride)  
         
      if (mod(imax(1)-lb(1),stride) .ne. 0) then
         imax(1) = imax(1) - mod(imax(1)-lb(1),stride) 
      endif
      imax(1) = getindx(imax(1), lb(1), stride)  
c
      do 10 i = imin(1), imax(1)
c        # Density
         if (nc.eq.1) q(1,i) = qi(i) 
c        # Velocity
         if (nc.eq.2) q(2,i) = q(1,i)*qi(i)
c        # Total energy density
         if (nc.eq.3) q(3,i) = qi(i)
c        # Temperature 
         if (nc.eq.4) q(3,i) = (qi(i)*RU*q(1,i))/
     &           (Wk*gamma1) + 0.5d0*(q(2,i)**2)/q(1,i)
c        # Pressure
         if (nc.eq.5) q(3,i) = qi(i)/gamma1 + 0.5d0*
     &        (q(2,i)**2)/q(1,i)
 10   continue         

      return
      end

<