c c ========================================================== subroutine in3eurhok(qi,mxi,myi,mzi,lbi,ubi,q,mx,my,mz,lb,ub, & lbr,ubr,shaper,meqn,nc,time) c ========================================================== c c # Copyright (C) 2003-2007 California Institute of Technology c # Ralf Deiterding, ralf@cacr.caltech.edu c implicit double precision(a-h,o-z) include "ck.i" common /Energy/ NEnergy c integer meqn, mx, my, mz, mxi, myi, mzi dimension q(meqn,mx,my,mz), qi(mxi,myi,mzi) c integer lb(3), ub(3), lbi(3), ubi(3), lbr(3), ubr(3), shaper(3), & mresult, stride, imin(3), imax(3), i, j, k, d, getindx c stride = (ub(1) - lb(1))/(mx-1) do 5 d = 1, 3 imin(d) = max(lb(d), lbr(d)) imax(d) = min(ub(d), ubr(d)) if (mod(imin(d)-lb(d),stride) .ne. 0) then imin(d) = imin(d) + stride - mod(imin(d)-lb(d),stride) endif imin(d) = getindx(imin(d), lb(d), stride) if (mod(imax(d)-lb(d),stride) .ne. 0) then imax(d) = imax(d) - mod(imax(d)-lb(d),stride) endif imax(d) = getindx(imax(d), lb(d), stride) 5 continue c if (nc.eq.1) NEnergy = 0 if (nc.eq.5) NEnergy = 1 if (nc.eq.6) NEnergy = 2 if (nc.eq.7) NEnergy = 3 c do 10 k = imin(3), imax(3) do 10 j = imin(2), imax(2) do 10 i = imin(1), imax(1) c c # Total density if (nc.eq.1) then q(1,i,j,k) = qi(i,j,k) c # Convert kg/m**3 into g/cm**3 if (ckunits) q(1,i,j,k) = q(1,i,j,k)*1.d-3 do m = 2, Nsp q(m,i,j,k) = q(1,i,j,k) enddo endif c c # Velocity u if (nc.eq.2) then q(Nsp+1,i,j,k) = q(1,i,j,k)*qi(i,j,k) c # Convert cm/sec into m/sec if (ckunits) q(Nsp+1,i,j,k) = q(Nsp+1,i,j,k)*1.d2 endif c c # Velocity v if (nc.eq.3) then q(Nsp+2,i,j,k) = q(1,i,j,k)*qi(i,j,k) c # Convert cm/sec into m/sec if (ckunits) q(Nsp+2,i,j,k) = q(Nsp+2,i,j,k)*1.d2 endif c c # Velocity w if (nc.eq.4) then q(Nsp+3,i,j,k) = q(1,i,j,k)*qi(i,j,k) c # Convert cm/sec into m/sec if (ckunits) q(Nsp+3,i,j,k) = q(Nsp+3,i,j,k)*1.d2 endif c c # Total energy density if (nc.eq.5) then q(Nsp+4,i,j,k) = qi(i,j,k) c # Convert J/m**3 into ergs/cm**3 if (ckunits) q(Nsp+4,i,j,k) = q(Nsp+4,i,j,k)*1.d1 endif c c # Temperature - No unit conversion if (nc.eq.6) q(Nsp+5,i,j,k) = qi(i,j,k) c c # Pressure if (nc.eq.7) then q(Nsp+5,i,j,k) = qi(i,j,k) c # Convert Pa = J/m**2 into dynes/cm**2 if (ckunits) q(Nsp+5,i,j,k) = q(Nsp+5,i,j,k)*1.d1 endif c c # Mass fractions - No unit conversion if (nc.ge.9.and.nc.le.Nsp+8) & q(nc-8,i,j,k) = q(nc-8,i,j,k)*qi(i,j,k) c c # Total energy density if (nc.eq.Nsp+8.and.NEnergy.gt.0) then rho = 0.d0 rhoW = 0.d0 do m = 1, Nsp rho = rho + q(m,i,j,k) rhoW = rhoW + q(m,i,j,k)/Wk(m) enddo if (NEnergy.eq.1) then rhoe = q(Nsp+4,i,j,k)-0.5d0*(q(Nsp+1,i,j,k)**2+ & q(Nsp+2,i,j,k)**2+q(Nsp+3,i,j,k)**2)/rho call SolveTrhok(q(Nsp+5,i,j,k),rhoe,rhoW, & q(1,i,j,k),Nsp,ifail) endif if (NEnergy.eq.3) & q(Nsp+5,i,j,k) = q(Nsp+5,i,j,k)/(rhoW*RU) if (NEnergy.eq.2.or.NEnergy.eq.3) & q(Nsp+4,i,j,k) = 0.5d0*(q(Nsp+1,i,j,k)**2+ & q(Nsp+2,i,j,k)**2+q(Nsp+3,i,j,k)**2)/rho & - rhoW*RU*q(Nsp+5,i,j,k) & + avgtabip(q(Nsp+5,i,j,k),q(1,i,j,k),hms,Nsp) endif 10 continue return end