subroutine update_q(qnp1, qn, x_i, FF_iph, delta_t, Nx, Ng) c------------------------------------------------------------ c This routine implements the time-stepping procedure c for the Runge-Kutta method. Note that the numerical c flux vector FF_iph(i) is the flux evaluated at c x_(i+1/2). c------------------------------------------------------------ implicit none character*8 cdnm parameter ( cdnm = 'update_q' ) logical ltrace parameter ( ltrace = .false. ) integer Nx integer Ng real*8 dx real*8 delta_t real*8 qnp1 ( Nx ) real*8 qn ( Nx ) real*8 x_i ( Nx ) real*8 FF_iph ( Nx ) integer i c============================================================ c============================================================ c------------------------------------------------------------ c Note that x_i is the coordinates of the cell centres. c We only want the difference (x_(i+1/2) - x_(i-1/2)) which is c constant and equal to (x_(i+1) - x_(i)). c------------------------------------------------------------ dx = x_i(2) - x_i(1) if ( ltrace ) then write(0,*) cdnm,': Nx = ', Nx write(0,*) cdnm,': Ng = ', Ng write(0,*) cdnm,': dx = ', dx write(0,*) cdnm,': delta_t = ', delta_t endif c------------------------------------------------------------ c We only use the equation to update the real cells c not the ghost cells. c------------------------------------------------------------ do i = Ng+1, Nx-Ng qnp1(i) = qn(i) - delta_t / dx * & ( FF_iph(i) - FF_iph(i-1) ) enddo return end