c     ==================================================================
      subroutine setaux(maxmx,maxmy,maxmz,mbc,mx,my,mz,xlower,ylower,
     &                  zlower,dx,dy,dz,maux,aux)
c     ==================================================================
c
c     # set auxiliary arrays
c
      implicit none

      integer maxmx, maxmy, maxmz, mx, my, mz, mbc, maux
      integer i,j,k
      double precision xlower, ylower, zlower, dx, dy, dz,t
      double precision xc,yc,zc,rc,vol,xlow,ylow,zlow

      double precision aux(1-mbc:maxmx+mbc, 1-mbc:maxmy+mbc,
     &               1-mbc:maxmz+mbc, maux)

      double precision mink, maxk, volfrac, kappa
      integer ijk,m
      double precision sum_nx(3), sum_ny(3),sum_nz(3), div(3)
      double precision div_norm
      logical cons_check


      integer ifstore, iface_store(3), mcapa, ivstore

      integer maxlevel, level, refratios(20)
      common /comlevel/ maxlevel, level, refratios

c     # ifstore : Number of faces at which to store information
c     # iface_store(3) : Index of faces to store (x=1,y=2,z=3)
c     # ivstore : Vectors per face to store;  Normally set to 2;
c     #           Third vector can be computed using compute_binormal()
c     # mcapa   : Index of capacity function. This should be equal to
c     #                  mcapa = 3*(ivstore*ifstore + 1) + 1
c     #           and should equal value set in claw3dz.data and driver.f
c     #
c     # maxlevel, level, refratios : these are stored in common block
c     #            and are set by either driver.f or ChomboClaw.
c     #           They are needed for definining capacities correctly.
c     #           in AMR calculations.
c     #

      ifstore = 3
      ivstore = 2   !! Number of vectors per face to store;
      iface_store(1) = 1
      iface_store(2) = 2
      iface_store(3) = 3
      mcapa = 22
      call sethexinfo(ifstore,iface_store,ivstore,
     &      maxmx, maxmy, maxmz,mbc,mx,my,mz,
     &      xlower,ylower,zlower,dx,dy,dz,
     &      maxlevel,level,refratios,mcapa,maux,aux)


      if (level .gt. 0) return

      volfrac = 1.d0
      mink = 100.d0
      maxk = 0.d0
      do  k = 1,mz
	 do j = 1,my
	    do i = 1,mx
               kappa = aux(i,j,k,mcapa)
               mink = min(kappa,mink)
               maxk = max(kappa,maxk)
            enddo
         enddo
      enddo

      write(6,'(A,F12.6)') 'Max kappa : ', maxk
      write(6,'(A,F12.6)') 'Min kappa : ', mink
      write(6,'(A,F12.6)') 'Ratio     : ', maxk/mink

      return
      end
