anchor.diff:        subroutine ClawPatch2(maxm, meqn, maux, mbc, method, mthlim,
        &      mcapa, mwaves, mx, my, qold, aux, dx, dy, dt, cfl,
  -     &      work, mwork, qold_coarse, aux_coarse, qadd_x, qadd_y,
  -     &      auxtype_int, xlower, ylower,
  -     &      intersectsBoundary, level,mthbc,t, mxc, myc, fp,fm, gp, gm,
  -     &      fp_chombo, fm_chombo, gp_chombo,gm_chombo,
  -     &      fpc_chombo, fmc_chombo, gpc_chombo,gmc_chombo)
  +     &      work, mwork,xlower,ylower,level,t, fp,fm, gp, gm)
   
         implicit none
   
         external rpn2,rpt2
   
         integer maxm,meqn,maux,mbc,mcapa,mwaves,mx,my, mwork,
  -     &      maxmx, maxmy, mxc, myc, intersectsBoundary(4),
  -     &      mthbc(4), mthbc_amr(4),level
  +     &      maxmx, maxmy, level
         double precision dx,dy,dt,cfl, xlower, ylower, t,
        &      dtdx, dtdy
   
         integer method(7), mthlim(mwaves)
  -      integer auxtype_int(maux)
         integer maxmaux
         parameter(maxmaux = 100)
  -      character*10 auxtype(maxmaux)
         double precision work(mwork)
   
         double precision   qold(1-mbc:mx+mbc, 1-mbc:my+mbc, meqn)
  -      double precision   qold_coarse(0:mxc+1, 0:myc+1, meqn)
   
         double precision  aux(1-mbc:mx+mbc, 1-mbc:my+mbc, maux)
  -      double precision  aux_coarse(0:mxc+1,0:myc+1,maux)
   
   c     Conservative numerical fluxes returned here.
         double precision fp(1-mbc:mx+mbc,1-mbc:my+mbc,meqn)
         double precision fm(1-mbc:mx+mbc,1-mbc:my+mbc,meqn)
         double precision gp(1-mbc:mx+mbc,1-mbc:my+mbc,meqn)
         double precision gm(1-mbc:mx+mbc,1-mbc:my+mbc,meqn)
  -      double precision fp_chombo(mx+1,my,  meqn)
  -      double precision fm_chombo(mx+1,my,  meqn)
  -      double precision gp_chombo(mx,  my+1,meqn)
  -      double precision gm_chombo(mx,  my+1,meqn)
  -      double precision fpc_chombo(mx+1,my,  meqn)
  -      double precision fmc_chombo(mx+1,my,  meqn)
  -      double precision gpc_chombo(mx,  my+1,meqn)
  -      double precision gmc_chombo(mx,  my+1,meqn)
  -      double precision qadd_x(mx+1,my,  meqn)
  -      double precision qadd_y(mx,  my+1,meqn)
  +
   
   c     # Local variables
         integer i0faddm, i0faddp, i0gaddm, i0gaddp,
  
positive.code:      &         qold,maux,aux,t,dt)
        endif
  
  c ---------------------------------------------------------------
  c
  c     # Assign flux registers fp_chombo, etc.  The reason we do this, rather
  c     # then pass fp_chombo, etc directly into step2, is that fp and
  c     # fp_chombo (fm and fm_chombo, etc.) are dimensioned differently.
  c
  
  
        refratio = mx/mxc
        if (mcapa > 0) then
  c        # with kappa
           do i = 1,mx+1
              ic = (i-1)/refratio + 1
              do j = 1,my
                 jc = (j-1)/refratio + 1
                 do m = 1,meqn
                    fp_chombo(i,j,m) = fp(i,j,m)/aux(i,j,mcapa)
                    fm_chombo(i,j,m) = fm(i,j,m)/aux(i-1,j,mcapa)
                    fpc_chombo(i,j,m) =
       &                  fp(i,j,m)/aux_coarse(ic,jc,mcapa)
                    fmc_chombo(i,j,m) =
       &                  fm(i,j,m)/aux_coarse(ic-1,jc,mcapa)
                    if (i .eq. 1) then
                       qadd_x(i,j,m) =
       &                     qadd_x(i,j,m)/aux_coarse(ic-1,jc,mcapa)
                    elseif (i .eq. mx+1) then
                       qadd_x(i,j,m) =
       &                     qadd_x(i,j,m)/aux_coarse(ic,jc,mcapa)
                    endif
                 enddo
              enddo
           enddo
  
           do i = 1,mx
              ic = (i-1)/refratio + 1
              do j = 1,my+1
                 jc = (j-1)/refratio + 1
                 do m = 1,meqn
                    gp_chombo(i,j,m) = gp(i,j,m)/aux(i,j,mcapa)
                    gm_chombo(i,j,m) = gm(i,j,m)/aux(i,j-1,mcapa)
                    gpc_chombo(i,j,m) = gp(i,j,m)/aux_coarse(ic,jc,mcapa)
                    gmc_chombo(i,j,m) =
       &                  gm(i,j,m)/aux_coarse(ic,jc-1,mcapa)
                    if (j .eq. 1) then
                       qadd_y(i,j,m) =
       &                     qadd_y(i,j,m)/aux_coarse(ic,jc-1,mcapa)
                    elseif (j .eq. my+1) then
                       qadd_y(i,j,m) =
       &                     qadd_y(i,j,m)/aux_coarse(ic,jc,mcapa)
                    endif
                 enddo
              enddo
           enddo
        else
  c        # no kappa
           do i = 1,mx+1
              do j = 1,my
                 do m = 1,meqn
                    fp_chombo(i,j,m) = fp(i,j,m)
                    fm_chombo(i,j,m) = fm(i,j,m)
                    fpc_chombo(i,j,m) = fp(i,j,m)
                    fmc_chombo(i,j,m) = fm(i,j,m)
                 enddo
              enddo
           enddo
  
           do i = 1,mx
              do j = 1,my+1
                 do m = 1,meqn
                    gp_chombo(i,j,m) = gp(i,j,m)
                    gm_chombo(i,j,m) = gm(i,j,m)
                    gpc_chombo(i,j,m) = gp(i,j,m)
                    gmc_chombo(i,j,m) = gm(i,j,m)
                 enddo
              enddo
           enddo
        endif
  
  c ---------------------------------------------------------
  
        if (debug) then
           write(iunit,*) 'qold...'
           do i = 1,mx
              do j = 1,my
                 write(iunit,'(2I5,4E24.16)') i,j,qold(i,j,1),
       &               fm(i,j,1), fp(i,j,1)
              enddo
              write(iunit,*) ' '
           enddo
        endif
  
        if (debug) then
           close(iunit)
        endif
  
        if (debug) then
           write(6,*) 'In Clawpatch2; input a number to continue'
           read(5,*) some_number
        endif
  
        end
  
  
  
negative.code:          open(iunit,file='clawpatch2.out')
           write(iunit,'(A,I5)') 'mx     = ', mx
           write(iunit,'(A,I5)') 'my     = ', my
           write(iunit,'(A,I5)') 'meqn   = ', meqn
           write(iunit,'(A,I5)') 'mwaves = ', mwaves
           write(iunit,'(A,I5)') 'mbc    = ', mbc
           write(iunit,'(A,I5)') 'maux   = ', maux
           write(iunit,'(A,I5)') 'mcapa  = ', mcapa
        endif
  
  c -----------------------------------------------------------------------
  