! set limits on the range of refinement levels to be allowed. ! level 1 is a single block covering the entire domain, level 2 is ! refined by a factor 2, level 3 by a factor 4, etc. lrefine_max = 10 ! finest refinement level allowed lrefine_min = 6 ! coarsest refinement level allowed ! set the no of blocks required initially to cover the computational domain no_of_blocks = 2**(lrefine_min-1) ! initialize the counter for the number of blocks currently on this processor lnblocks = 0 ! begin by setting up a single block on processor 0, covering the whole domain if(mype.eq.0.) then lnblocks = 1 size(1)=1.0 coord(1) = .5*size(1) nodetype(1) = 1 lrefine(1) = 1 neigh(1,1,1) = -21 ! initial block is not its own neigh(2,1,1) = -21 ! neighbor. hard wall bc neigh(1,2,1) = -22 ! initial block is not its own neigh(2,2,1) = -22 ! neighbor. symmetry bc refine(1)=.true. endif call barrier() ! Now cycle over blocks until `no_of_blocks' leaf blocks have been created. loop_count=0 loop_count_max = int(log(real(no_of_blocks))/log(2.)+.1) do while(loop_count.lt.loop_count_max) do l=1,lnblocks refine(l)=.true. enddo call barrier() ! refine grid and apply morton reordering to grid blocks if necessary call amr_refine_derefine loop_count=loop_count+1 enddo call barrier()