!
!  physics_input.f90
!
      subroutine physics_input(rzp,izp,czp,ierr)  
!     
      implicit none
      real :: rzp(*)
      integer :: izp(*),ierr
      character (len=*) :: czp(*)
!
      character (len=80) :: cval,zone,cell
      character (len=4)  :: ctype
      integer nzone,ncell,ntask,ninter,icvs,jcvs,kcvs,icvso,jcvso,kcvso,np
      integer, dimension(1:10) :: nl,nlx,nm,nmx,nn,nnx      
      integer :: npl,npm,npn,p,npmax,index,n,i,j,k,ncs,npcells     
      logical :: lgrid
!      
      character (len=2), dimension(1:20) :: cnum
      data cnum/'1 ','2 ','3 ','4 ','5 ','6 ','7 ','8 ','9 ','10', &
                '11','12','13','14','15','16','17','18','19','20' /
!
      integer, allocatable :: iz1(:)
!
! Pointers
      integer ptrr,ptrc,ptri,ptri0,ptrc0,pzn,pcl
!
! Start
      call get_next_ptr('physics','real',ptrr,ierr) 
      call get_next_ptr('physics','int',ptri,ierr) 
      call get_next_ptr('physics','char',ptrc,ierr)      
!
! Zones
      cval = '/nzone'
      izp(ptri) = 1    
      call put_mem('physics',cval,'int',ptri,1,ierr)    
!
! zone list
      cval = '/zone_list'
      nzone = 1
      czp(ptrc) = 'zn_0'
      call put_mem('physics',cval,'char',ptrc,nzone,ierr)    
!
! Cells
      ncell = 3
      cval = '/zn_0/ncell'
      ptri = ptri + 1
      izp(ptri) = ncell
      call put_mem('physics',cval,'int',ptri,1,ierr)
!
! zone -> cell list
      cval = '/zn_0/cell_list'
      ptrc = ptrc + 1
      czp(ptrc) = 'cell_0'
      call put_mem('physics',cval,'char',ptrc,ncell,ierr)
      cval = '/zn_0/cell_list'
      ptrc = ptrc + 1
      czp(ptrc) = 'cell_1'
      call put_mem('physics',cval,'char',ptrc,ncell,ierr)
      cval = '/zn_0/cell_list'
      ptrc = ptrc + 1
      czp(ptrc) = 'cell_2'
      call put_mem('physics',cval,'char',ptrc,ncell,ierr)      
!
! Simulation type 
      cval = '/simulation/type'
      ptrc = ptrc + 1     
      czp(ptrc) = 'unsteady'
      call put_mem('physics',cval,'char',ptrc,1,ierr) 
!
! Type unsteady
      cval = '/simulation/time_step'
      rzp(ptrr) = 0.3     
      call put_mem('physics',cval,'real',ptrr,1,ierr)
!     
      cval = '/simulation/total_run_time'
      ptrr = ptrr + 1
      rzp(ptrr) = 100.0     
      call put_mem('physics',cval,'real',ptrr,1,ierr)
!
      cval = '/simulation/max_cloops'
      ptri = ptri + 1
      izp(ptri) = 1     
      call put_mem('physics',cval,'int',ptri,1,ierr)
!     
      cval = '/simulation/min_cloops'
      ptri = ptri + 1
      izp(ptri) = 3     
      call put_mem('physics',cval,'int',ptri,1,ierr)
!
! ------------------- Cell data area      -------------------
!
      npmax   = 10
      npcells = 0
!
! Zone list       
      cval = '/zone_list'
      call get_mem('physics',cval,ctype,pzn,nzone,ierr)
!
      do i = 1, nzone
!
! Loop over cells in a zone
        zone = czp(pzn + i -1)        
        cval = '/'//trim(zone)//'/cell_list' 
        call get_mem('physics',cval,ctype,pcl,ncell,ierr) 
!
        do j = 1, ncell
!	
          cell = '/'//trim(zone)//'/'//czp(pcl + j -1)
!
! Type steady state
          cval = trim(cell)//'/energy/time_step'
          ptrr = ptrr + 1
          rzp(ptrr) = 1.0     
          call put_mem('physics',cval,'real',ptrr,1,ierr)
!
! Initial conditions
          cval = trim(cell)//'/energy0/ic'
          ptrr = ptrr + 1     
          rzp(ptrr) = 20.0*500.0     
          call put_mem('physics',cval,'real',ptrr,1,ierr)
!
! Properties      
          cval = trim(cell)//'/props/tc0/ic'
          ptrr = ptrr + 1
          rzp(ptrr) = 2.0     
          call put_mem('physics',cval,'real',ptrr,1,ierr)
!     
          cval = trim(cell)//'/props/cp0/ic'
          ptrr = ptrr + 1
          rzp(ptrr) = 500.0     
          call put_mem('physics',cval,'real',ptrr,1,ierr)
!     
          cval = trim(cell)//'/props/rho0/ic'
          ptrr = ptrr + 1
          rzp(ptrr) = 1.0     
          call put_mem('physics',cval,'real',ptrr,1,ierr)
!
! Mesh        
          cval = trim(cell)//'/type'
          ptrc = ptrc + 1
          czp(ptrc) = 'internal'
          call put_mem('physics',cval,'char',ptrc,1,ierr)
!
! Type is internal (create 1x1x1 test cells offset in x-direction)
          cval = trim(cell)//'/internal/origin'
          ptrr = ptrr + 1
          rzp(ptrr)  = (j-1)*1.0
          rzp(ptrr+1)= 0.0
          rzp(ptrr+2)= 0.0               
          call put_mem('physics',cval,'real',ptrr,3,ierr)
!        
          cval = trim(cell)//'/internal/xlength'
          ptrr = ptrr + 3
          rzp(ptrr) = 1.0     
          call put_mem('physics',cval,'real',ptrr,1,ierr)
!     
          cval = trim(cell)//'/icvs'
          ptri = ptri + 1
          izp(ptri) = 64     
          call put_mem('physics',cval,'int',ptri,1,ierr)
!          
          cval = trim(cell)//'/internal/ylength'
          ptrr = ptrr + 1
          rzp(ptrr) = 1.0     
          call put_mem('physics',cval,'real',ptrr,1,ierr)
!     
          cval = trim(cell)//'/jcvs'
          ptri = ptri + 1
          izp(ptri) = 64     
          call put_mem('physics',cval,'int',ptri,1,ierr)
!          
          cval = trim(cell)//'/internal/zlength'     
          ptrr = ptrr + 1
          rzp(ptrr) = 1.0     
          call put_mem('physics',cval,'real',ptrr,1,ierr)
!     
          cval = trim(cell)//'/kcvs'                 
          ptri = ptri + 1
          izp(ptri) = 64     
          call put_mem('physics',cval,'int',ptri,1,ierr)
!
! Determine the number of mg levels required for each cell
!
! Coarse mesh in i
          cval = trim(cell)//'/icvs'     
          call get_int_value('physics',cval,icvs,izp,ierr)      
!
          lgrid = .true.
          p = 1
          nl = 0; nlx = 0;
          do while (lgrid)
            nl(p) = int(icvs/(2**p))  
            nlx(p)= mod(icvs,(2**p))
            if (nl(p) == 0) then
              lgrid = .false.
              npl = p          
            else
              p = p+1
            endif
          end do
!
! Coarse mesh in j
          cval = trim(cell)//'/jcvs'
          call get_int_value('physics',cval,jcvs,izp,ierr)  
!
          lgrid = .true.
          p = 1
          nm = 0; nmx = 0;
          do while (lgrid)
            nm(p) = int(jcvs/(2**p))  
            nmx(p)= mod(jcvs,(2**p)) 
            if (nm(p) == 0) then 
              lgrid = .false.
              npm = p 
            else
              p = p+1
            endif
          end do      
!
! Coarse mesh in k
          cval = trim(cell)//'/kcvs'
          call get_int_value('physics',cval,kcvs,izp,ierr)       
!
          lgrid = .true.
          p = 1
          nn = 0; nnx = 0;
          do while (lgrid)
            nn(p) = int(kcvs/(2**p))  
            nnx(p)= mod(kcvs,(2**p)) 
            if (nn(p) == 0) then 
              lgrid = .false.
              npn = p 
            else
              p = p+1
            endif
          end do      
!
! maximum possible mg levels for cell (don't include 1x1x1 mesh)
          call get_next_ptr('physics','int',ptri,ierr)
          np      = max(npl,npm,npn)-1
          npcells = max(np,npcells)  ! save maximum across all cells
!	  
          cval = trim(cell)//'/np'
          izp(ptri) = np
          call put_mem('physics',cval,'int',ptri,1,ierr)
!             
          if (np > 9 .or. np == 0 ) then
            write(*,*) 'Stop, ill posed fine mesh size'
            stop
          endif   
!
          if (npl < np) then
            do p=npl+1,np
              nl(p) = nl(p-1)
              nlx(p)= nlx(p-1)
            enddo
          endif    
!
          if (npm < np) then
            do p=npm+1,np
              nm(p) = nm(p-1)
              nmx(p) = nmx(p-1)          
            enddo
          endif 
!
          if (npn < np) then
            do p=npn+1,np
              nn(p) = nn(p-1)
              nnx(p) = nnx(p-1)          
            enddo
          endif 
!
          cval = trim(cell)//'/nl'
          ptri0 = ptri + 1
          do p=1,npmax
            ptri = ptri + 1
            izp(ptri) = nl(p)
          enddo  
          call put_mem('physics',cval,'int',ptri0,npmax,ierr)
!
          cval = trim(cell)//'/nlx'
          ptri0 = ptri + 1
          do p=1,npmax
            ptri = ptri + 1
            izp(ptri) = nlx(p)
          enddo  
          call put_mem('physics',cval,'int',ptri0,npmax,ierr)
!
          cval = trim(cell)//'/nm'
          ptri0 = ptri + 1
          do p=1,npmax
            ptri = ptri + 1
            izp(ptri) = nm(p)
          enddo  
          call put_mem('physics',cval,'int',ptri0,npmax,ierr)
!
          cval = trim(cell)//'/nmx'
          ptri0 = ptri + 1
          do p=1,npmax
            ptri = ptri + 1
            izp(ptri) = nmx(p)
          enddo  
          call put_mem('physics',cval,'int',ptri0,npmax,ierr)
!
          cval = trim(cell)//'/nn'
          ptri0 = ptri + 1
          do p=1,npmax
            ptri = ptri + 1
            izp(ptri) = nn(p)
          enddo  
          call put_mem('physics',cval,'int',ptri0,npmax,ierr)
!
          cval = trim(cell)//'/nnx'
          ptri0 = ptri + 1
          do p=1,npmax
            ptri = ptri + 1
            izp(ptri) = nnx(p)
          enddo  
          call put_mem('physics',cval,'int',ptri0,npmax,ierr)
        enddo
      enddo
!
! Save the maximum mg levels across all cells    
      cval = '/simulation/npcells'
      ptri = ptri + 1
      izp(ptri) = npcells
      call put_mem('physics',cval,'int',ptri,1,ierr)
!
! ------------------- Task data area -------------------
! 
      call get_next_ptr('physics','char',ptrc,ierr) 
      cval = '/zn_0/cell_0/tasks/gpu'
      czp(ptrc) = 'on'
      call put_mem('physics',cval,'char',ptrc,1,ierr)
!
      cval = '/zn_0/cell_1/tasks/gpu'
      ptrc = ptrc + 1
      czp(ptrc) = 'on'
      call put_mem('physics',cval,'char',ptrc,1,ierr)
!
      cval = '/zn_0/cell_2/tasks/gpu'
      ptrc = ptrc + 1
      czp(ptrc) = 'on'
      call put_mem('physics',cval,'char',ptrc,1,ierr)
!
! ------------------- Interface data area -------------------
!
! Create the interface list
!
      call get_next_ptr('physics','char',ptrc,ierr) 
      cval = '/interface_list'
      ninter = 16
      ptrc0 = ptrc
      do i=1,ninter
        czp(ptrc) = 'int_'//cnum(i)
        ptrc = ptrc + 1
      enddo
      call put_mem('physics',cval,'char',ptrc0,ninter,ierr)             
!
      do i=1,5
        cval = '/int_'//cnum(i)
        ptrc0 = ptrc
        czp(ptrc) = '/zn_0/cell_0'
        czp(ptrc+1) = 'boundary'
        ptrc = ptrc + 2 
        call put_mem('physics',trim(cval)//'/'//'cell_index','char',ptrc0,2,ierr) 
      enddo
!
      i=6  
      cval = '/int_'//cnum(i)
      ptrc0 = ptrc
      czp(ptrc) = '/zn_0/cell_1'
      czp(ptrc+1) = '/zn_0/cell_0'
      ptrc = ptrc + 2 
      call put_mem('physics',trim(cval)//'/'//'cell_index','char',ptrc0,2,ierr) 
!      
      do i=7,10
        cval = '/int_'//cnum(i)
        ptrc0 = ptrc
        czp(ptrc) = '/zn_0/cell_1'
        czp(ptrc+1) = 'boundary'
        ptrc = ptrc + 2 
        call put_mem('physics',trim(cval)//'/'//'cell_index','char',ptrc0,2,ierr) 
      enddo
!
      i=11
      cval = '/int_'//cnum(i)
      ptrc0 = ptrc
      czp(ptrc) = '/zn_0/cell_2'
      czp(ptrc+1) = '/zn_0/cell_1'
      ptrc = ptrc + 2 
      call put_mem('physics',trim(cval)//'/'//'cell_index','char',ptrc0,2,ierr) 
!      
      do i=12,16
        cval = '/int_'//cnum(i)
        ptrc0 = ptrc
        czp(ptrc) = '/zn_0/cell_2'
        czp(ptrc+1) = 'boundary'
        ptrc = ptrc + 2 
        call put_mem('physics',trim(cval)//'/'//'cell_index','char',ptrc0,2,ierr) 
      enddo
!
! Cell 0 
!    
      call get_int_value('physics','/zn_0/cell_0/icvs',icvs,izp,ierr)  
      call get_int_value('physics','/zn_0/cell_0/jcvs',jcvs,izp,ierr)      
      call get_int_value('physics','/zn_0/cell_0/kcvs',kcvs,izp,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = 1   ; izp(ptri+1) = 1    ! i - range constant
      izp(ptri+2) = 1   ; izp(ptri+3) = jcvs ! j - range
      izp(ptri+4) = 1   ; izp(ptri+5) = kcvs ! k - range          
      call put_mem('physics','/int_1/index1_range','int',ptri,6,ierr)
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = 'dirichlet'
      call put_mem('physics','/int_1/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 100.0     
      call put_mem('physics','/int_1/bc','char',ptrr,1,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = 1   ; izp(ptri+1) = icvs ! i - range
      izp(ptri+2) = 1   ; izp(ptri+3) = 1    ! j - range constant
      izp(ptri+4) = 1   ; izp(ptri+5) = kcvs ! k - range          
      call put_mem('physics','/int_2/index1_range','int',ptri,6,ierr)
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = 'dirichlet'
      call put_mem('physics','/int_2/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 100.0     
      call put_mem('physics','/int_2/bc','char',ptrr,1,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = 1   ; izp(ptri+1) = icvs ! i - range
      izp(ptri+2) = jcvs; izp(ptri+3) = jcvs ! j - range constant
      izp(ptri+4) = 1   ; izp(ptri+5) = kcvs ! k - range          
      call put_mem('physics','/int_3/index1_range','int',ptri,6,ierr)     
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = 'dirichlet'
      call put_mem('physics','/int_3/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 100.0     
      call put_mem('physics','/int_3/bc','char',ptrr,1,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = 1   ; izp(ptri+1) = icvs ! i - range
      izp(ptri+2) = 1   ; izp(ptri+3) = jcvs ! j - range
      izp(ptri+4) = 1   ; izp(ptri+5) = 1    ! k - range constant          
      call put_mem('physics','/int_4/index1_range','int',ptri,6,ierr)
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = 'dirichlet'
      call put_mem('physics','/int_4/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 100.0     
      call put_mem('physics','/int_4/bc','char',ptrr,1,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = 1   ; izp(ptri+1) = icvs ! i - range
      izp(ptri+2) = 1   ; izp(ptri+3) = jcvs ! j - range
      izp(ptri+4) = kcvs; izp(ptri+5) = kcvs ! k - range constant          
      call put_mem('physics','/int_5/index1_range','int',ptri,6,ierr)
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = 'dirichlet'
      call put_mem('physics','/int_5/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 100.0     
      call put_mem('physics','/int_5/bc','char',ptrr,1,ierr)
!
! Cell 1 
!
      call get_int_value('physics','/zn_0/cell_1/icvs',icvs,izp,ierr)  
      call get_int_value('physics','/zn_0/cell_1/jcvs',jcvs,izp,ierr)      
      call get_int_value('physics','/zn_0/cell_1/kcvs',kcvs,izp,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = 1   ; izp(ptri+1) = 1    ! i - range constant
      izp(ptri+2) = 1   ; izp(ptri+3) = jcvs ! j - range
      izp(ptri+4) = 1   ; izp(ptri+5) = kcvs ! k - range          
      call put_mem('physics','/int_6/index1_range','int',ptri,6,ierr)
!
      call get_int_value('physics','/zn_0/cell_0/icvs',icvso,izp,ierr)  
      call get_int_value('physics','/zn_0/cell_0/jcvs',jcvso,izp,ierr)      
      call get_int_value('physics','/zn_0/cell_0/kcvs',kcvso,izp,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = icvso   ; izp(ptri+1) = icvso    ! i - range constant
      izp(ptri+2) = 1   ; izp(ptri+3) = jcvso ! j - range
      izp(ptri+4) = 1   ; izp(ptri+5) = kcvso ! k - range          
      call put_mem('physics','/int_6/index2_range','int',ptri,6,ierr)
!
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = ' '
      call put_mem('physics','/int_6/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 0.0     
      call put_mem('physics','/int_6/bc','char',ptrr,1,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = 1   ; izp(ptri+1) = icvs ! i - range
      izp(ptri+2) = 1   ; izp(ptri+3) = 1    ! j - range constant
      izp(ptri+4) = 1   ; izp(ptri+5) = kcvs ! k - range          
      call put_mem('physics','/int_7/index1_range','int',ptri,6,ierr)
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = 'dirichlet'
      call put_mem('physics','/int_7/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 100.0     
      call put_mem('physics','/int_7/bc','char',ptrr,1,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = 1   ; izp(ptri+1) = icvs ! i - range
      izp(ptri+2) = jcvs; izp(ptri+3) = jcvs ! j - range constant
      izp(ptri+4) = 1   ; izp(ptri+5) = kcvs ! k - range          
      call put_mem('physics','/int_8/index1_range','int',ptri,6,ierr)     
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = 'dirichlet'
      call put_mem('physics','/int_8/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 100.0     
      call put_mem('physics','/int_8/bc','char',ptrr,1,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = 1   ; izp(ptri+1) = icvs ! i - range
      izp(ptri+2) = 1   ; izp(ptri+3) = jcvs ! j - range
      izp(ptri+4) = 1   ; izp(ptri+5) = 1    ! k - range constant          
      call put_mem('physics','/int_9/index1_range','int',ptri,6,ierr)
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = 'dirichlet'
      call put_mem('physics','/int_9/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 100.0     
      call put_mem('physics','/int_9/bc','char',ptrr,1,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = 1   ; izp(ptri+1) = icvs ! i - range
      izp(ptri+2) = 1   ; izp(ptri+3) = jcvs ! j - range
      izp(ptri+4) = kcvs; izp(ptri+5) = kcvs ! k - range constant          
      call put_mem('physics','/int_10/index1_range','int',ptri,6,ierr)
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = 'dirichlet'
      call put_mem('physics','/int_10/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 100.0     
      call put_mem('physics','/int_10/bc','char',ptrr,1,ierr)
!
! Cell 2 
!
      call get_int_value('physics','/zn_0/cell_2/icvs',icvs,izp,ierr)  
      call get_int_value('physics','/zn_0/cell_2/jcvs',jcvs,izp,ierr)      
      call get_int_value('physics','/zn_0/cell_2/kcvs',kcvs,izp,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = 1   ; izp(ptri+1) = 1    ! i - range constant
      izp(ptri+2) = 1   ; izp(ptri+3) = jcvs ! j - range
      izp(ptri+4) = 1   ; izp(ptri+5) = kcvs ! k - range          
      call put_mem('physics','/int_11/index1_range','int',ptri,6,ierr)
!
      call get_int_value('physics','/zn_0/cell_1/icvs',icvso,izp,ierr)  
      call get_int_value('physics','/zn_0/cell_1/jcvs',jcvso,izp,ierr)      
      call get_int_value('physics','/zn_0/cell_1/kcvs',kcvso,izp,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = icvso   ; izp(ptri+1) = icvso    ! i - range constant
      izp(ptri+2) = 1   ; izp(ptri+3) = jcvso ! j - range
      izp(ptri+4) = 1   ; izp(ptri+5) = kcvso ! k - range          
      call put_mem('physics','/int_11/index2_range','int',ptri,6,ierr)
!
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = ' '
      call put_mem('physics','/int_11/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 0.0     
      call put_mem('physics','/int_11/bc','char',ptrr,1,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = icvs; izp(ptri+1) = icvs ! i - range constant
      izp(ptri+2) = 1   ; izp(ptri+3) = jcvs ! j - range
      izp(ptri+4) = 1   ; izp(ptri+5) = kcvs ! k - range          
      call put_mem('physics','/int_12/index1_range','int',ptri,6,ierr)
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = 'dirichlet'
      call put_mem('physics','/int_12/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 100.0     
      call put_mem('physics','/int_12/bc','char',ptrr,1,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = 1   ; izp(ptri+1) = icvs ! i - range
      izp(ptri+2) = 1   ; izp(ptri+3) = 1    ! j - range constant
      izp(ptri+4) = 1   ; izp(ptri+5) = kcvs ! k - range          
      call put_mem('physics','/int_13/index1_range','int',ptri,6,ierr)
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = 'dirichlet'
      call put_mem('physics','/int_13/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 100.0     
      call put_mem('physics','/int_13/bc','char',ptrr,1,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = 1   ; izp(ptri+1) = icvs ! i - range
      izp(ptri+2) = jcvs; izp(ptri+3) = jcvs ! j - range constant
      izp(ptri+4) = 1   ; izp(ptri+5) = kcvs ! k - range          
      call put_mem('physics','/int_14/index1_range','int',ptri,6,ierr)     
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = 'dirichlet'
      call put_mem('physics','/int_14/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 100.0     
      call put_mem('physics','/int_14/bc','char',ptrr,1,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = 1   ; izp(ptri+1) = icvs ! i - range
      izp(ptri+2) = 1   ; izp(ptri+3) = jcvs ! j - range
      izp(ptri+4) = 1   ; izp(ptri+5) = 1    ! k - range constant          
      call put_mem('physics','/int_15/index1_range','int',ptri,6,ierr)
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = 'dirichlet'
      call put_mem('physics','/int_15/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 100.0     
      call put_mem('physics','/int_15/bc','char',ptrr,1,ierr)
!
      call get_next_ptr('physics','int',ptri,ierr)
      izp(ptri)   = 1   ; izp(ptri+1) = icvs ! i - range
      izp(ptri+2) = 1   ; izp(ptri+3) = jcvs ! j - range
      izp(ptri+4) = kcvs; izp(ptri+5) = kcvs ! k - range constant          
      call put_mem('physics','/int_16/index1_range','int',ptri,6,ierr)
      call get_next_ptr('physics','char',ptrc,ierr)
      czp(ptrc) = 'dirichlet'
      call put_mem('physics','/int_16/cbc','char',ptrc,1,ierr)
      call get_next_ptr('physics','real',ptrr,ierr)     
      rzp(ptrr) = 100.0     
      call put_mem('physics','/int_16/bc','char',ptrr,1,ierr)
!
! After reading in physics/cell etc. data estimate block sizes
! For every cell of size (icvs,jcvs,kcvs).
! Dependent variables (energy ) -> 1
! Transient (energy0)           -> 1    
! Property variables (cp0,tc0)  -> 2
! Coefficients (ap,ae,aw,an,as,at,ab,b)      -> 8
! Multigrid (~=fine mesh requirments)        -> 8
! Geometry (x,y,z,xc,yc,zc,vol,aip)          -> 8
! Temporary work arrayes (wrk1,wrk2,wrk3)    -> 3
! Interface coefficients estimate            -> 2
! Buffer                                     -> 4
! ------------------------------------------------------------
!                                 Total real -> 37
      call get_next_ptr('physics','int',ptri,ierr)
      cval = '/rz_size'
      izp(ptri) = 37*(icvs*jcvs*kcvs)*ncell
      call put_mem('physics',cval,'int',ptri,1,ierr)
!
! Number of cells            -> 1
! Number of faces per cell   -> 6 
! Pointer per face -> icv*jcv*2 + icvs*kcvs*2 + jcvs*kcvs*2 
! Data iterms per pointer    -> 10
! Buffer                     -> add 3 data item per pointer
!
      cval = '/iz_size'
      ptri = ptri + 1
      izp(ptri) = 13*(icvs*jcvs*2 + icvs*kcvs*2 + jcvs*kcvs*2)*ncell*6
      call put_mem('physics',cval,'int',ptri,1,ierr)
!     
      cval = '/dz_size'
      ptri = ptri + 1
      izp(ptri) = 10.0
      call put_mem('physics',cval,'int',ptri,1,ierr)     
!
      cval = '/cz_size'
      ptri = ptri + 1
      izp(ptri) = 1E2*ncell
      call put_mem('physics',cval,'int',ptri,1,ierr)
!
      ierr = 0
      end subroutine physics_input
