      SUBROUTINE UPDATE(JDIM,KDIM,Q,S,DELTQN)
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
      COMMON/BASE/
     1  JMAX,       KMAX,     JM,          KM,          JBEGIN,   JEND,
     1  KBEGIN,     KEND,     JPLUS(999),  JMINU (999), JLOW,     JUP,
     1  KLOW,       KUP,      PERIDC  ,    NP,          DT,   CP2TIM,
     1  FSMACH,     ALPHA,    GAMMA,       GAMI,        PI,
     1  DIS2X,      DIS2Y,    DIS4X,       DIS4Y,       PHIDT,    
     1  THETAD ,    RESID,    JACDT,       IPRINT,      NPCP,
     1  JTAIL1,     JTAIL2,   NUMITE ,     ISTART,      NSTEPS
      LOGICAL PERIDC  
      COMMON/GRID/DYM,YMAX,XMIN,XMAX,THICK
C
C
      DIMENSION Q(JDIM,KDIM,4),S(JDIM,KDIM,4),DELTQN(JDIM,KDIM,4)
C
C
         PHIC = PHIDT/(1.+PHIDT)
C
C  UPDATE SOLUTION
C
         DO 600 N = 1,4
         DO 600 K = KLOW,KUP
         DO 600 J = JLOW,JUP
C  DELTA Q N  
            DELTQN(J,K,N) = S(J,K,N)
C  UPDATE
            Q(J,K,N) = Q(J,K,N)+S(J,K,N)
C  START NEXT
            S(J,K,N) = PHIC * S(J,K,N)
600      CONTINUE
C
C
        RETURN
        END
