! written by nbigen.py
! *** do not edit *** (use nbigen.py instead)
 
subroutine nbi_realloc_minb(minb_new)
 
  use nbi_com
  implicit NONE
  integer, intent(in) :: minb_new
  integer :: j
  integer,dimension(:,:),allocatable :: tmp_minb_int
  real(fp), dimension(:,:),allocatable :: tmp_minb_r8
 
 
  !==============================================
  ! internal arrays
 
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=cxpray
   deallocate(cxpray)
   allocate(cxpray(minb_new, mibs)); cxpray  = zero
   cxpray(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=fppray
   deallocate(fppray)
   allocate(fppray(minb_new, mibs)); fppray  = zero
   fppray(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=goosay
   deallocate(goosay)
   allocate(goosay(minb_new, mibs)); goosay  = zero
   goosay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_int(minb, mibs));tmp_minb_int=0
   tmp_minb_int=nbndex
   deallocate(nbndex)
   allocate(nbndex(minb_new, mibs)); nbndex  = 0
   do j=minb+1,minb_new
      nbndex(j,1:mibs)=j
   enddo
   nbndex(1:minb,1:mibs)  = tmp_minb_int(1:minb,1:mibs)
   deallocate(tmp_minb_int)
  
   allocate(tmp_minb_int(minb, mibs));tmp_minb_int=0
   tmp_minb_int=nbscay
   deallocate(nbscay)
   allocate(nbscay(minb_new, mibs)); nbscay  = 0
   nbscay(1:minb,1:mibs)  = tmp_minb_int(1:minb,1:mibs)
   deallocate(tmp_minb_int)
  
   allocate(tmp_minb_int(minb, mibs));tmp_minb_int=0
   tmp_minb_int=nbienay
   deallocate(nbienay)
   allocate(nbienay(minb_new, mibs)); nbienay  = 0
   nbienay(1:minb,1:mibs)  = tmp_minb_int(1:minb,1:mibs)
   deallocate(tmp_minb_int)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=einjay
   deallocate(einjay)
   allocate(einjay(minb_new, mibs)); einjay  = zero
   einjay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_int(minb, mibs));tmp_minb_int=0
   tmp_minb_int=njavay
   deallocate(njavay)
   allocate(njavay(minb_new, mibs)); njavay  = 0
   njavay(1:minb,1:mibs)  = tmp_minb_int(1:minb,1:mibs)
   deallocate(tmp_minb_int)
  
   allocate(tmp_minb_int(minb, mibs));tmp_minb_int=0
   tmp_minb_int=njavay_saw
   deallocate(njavay_saw)
   allocate(njavay_saw(minb_new, mibs)); njavay_saw  = 0
   njavay_saw(1:minb,1:mibs)  = tmp_minb_int(1:minb,1:mibs)
   deallocate(tmp_minb_int)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=pmechay
   deallocate(pmechay)
   allocate(pmechay(minb_new, mibs)); pmechay  = zero
   pmechay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=pphiay
   deallocate(pphiay)
   allocate(pphiay(minb_new, mibs)); pphiay  = zero
   pphiay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=pinjay
   deallocate(pinjay)
   allocate(pinjay(minb_new, mibs)); pinjay  = zero
   pinjay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=pmechay_saw
   deallocate(pmechay_saw)
   allocate(pmechay_saw(minb_new, mibs)); pmechay_saw  = zero
   pmechay_saw(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=pphiay_saw
   deallocate(pphiay_saw)
   allocate(pphiay_saw(minb_new, mibs)); pphiay_saw  = zero
   pphiay_saw(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=rmjionay
   deallocate(rmjionay)
   allocate(rmjionay(minb_new, mibs)); rmjionay  = zero
   rmjionay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=rmjionay_saw
   deallocate(rmjionay_saw)
   allocate(rmjionay_saw(minb_new, mibs)); rmjionay_saw  = zero
   rmjionay_saw(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=tdepay
   deallocate(tdepay)
   allocate(tdepay(minb_new, mibs)); tdepay  = zero
   tdepay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=tfluxay
   deallocate(tfluxay)
   allocate(tfluxay(minb_new, mibs)); tfluxay  = zero
   tfluxay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=tfluxay_saw
   deallocate(tfluxay_saw)
   allocate(tfluxay_saw(minb_new, mibs)); tfluxay_saw  = zero
   tfluxay_saw(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=thay
   deallocate(thay)
   allocate(thay(minb_new, mibs)); thay  = zero
   thay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=thay_saw
   deallocate(thay_saw)
   allocate(thay_saw(minb_new, mibs)); thay_saw  = zero
   thay_saw(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=vay
   deallocate(vay)
   allocate(vay(minb_new, mibs)); vay  = zero
   vay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=vay_saw
   deallocate(vay_saw)
   allocate(vay_saw(minb_new, mibs)); vay_saw  = zero
   vay_saw(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=wghtay
   deallocate(wghtay)
   allocate(wghtay(minb_new, mibs)); wghtay  = zero
   wghtay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=xiay
   deallocate(xiay)
   allocate(xiay(minb_new, mibs)); xiay  = zero
   xiay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=xiay_saw
   deallocate(xiay_saw)
   allocate(xiay_saw(minb_new, mibs)); xiay_saw  = zero
   xiay_saw(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=xistay
   deallocate(xistay)
   allocate(xistay(minb_new, mibs)); xistay  = zero
   xistay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=xistay_saw
   deallocate(xistay_saw)
   allocate(xistay_saw(minb_new, mibs)); xistay_saw  = zero
   xistay_saw(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=xksidy
   deallocate(xksidy)
   allocate(xksidy(minb_new, mibs)); xksidy  = zero
   xksidy(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=xksidy_saw
   deallocate(xksidy_saw)
   allocate(xksidy_saw(minb_new, mibs)); xksidy_saw  = zero
   xksidy_saw(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=xmuay
   deallocate(xmuay)
   allocate(xmuay(minb_new, mibs)); xmuay  = zero
   xmuay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=xmuay_saw
   deallocate(xmuay_saw)
   allocate(xmuay_saw(minb_new, mibs)); xmuay_saw  = zero
   xmuay_saw(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=xzbmay
   deallocate(xzbmay)
   allocate(xzbmay(minb_new, mibs)); xzbmay  = zero
   xzbmay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=xzionay
   deallocate(xzionay)
   allocate(xzionay(minb_new, mibs)); xzionay  = zero
   xzionay(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
   allocate(tmp_minb_r8(minb, mibs));tmp_minb_r8=zero
   tmp_minb_r8=xzionay_saw
   deallocate(xzionay_saw)
   allocate(xzionay_saw(minb_new, mibs)); xzionay_saw  = zero
   xzionay_saw(1:minb,1:mibs)  = tmp_minb_r8(1:minb,1:mibs)
   deallocate(tmp_minb_r8)
  
 
   minb=minb_new
 
end subroutine nbi_realloc_minb
