c*********************************************************************** SUBROUTINE initpressure() c*** INCLUDE 'undefined.h' INCLUDE 'dimension.h' INCLUDE 'pointers.h' INCLUDE 'algorithms_controllers.h' INTEGER MYMALLOC,nnx,nny,nnz INTEGER j, nn INTRINSIC MIN0 EXTERNAL MYMALLOC INTEGER GP_IFETCH DOUBLE PRECISION GP_DFETCH EXTERNAL GP_IFETCH,GP_DFETCH c*** c initialize memory allocation scheme with MYMALLOC, compute ng c*** mem = 0 nn = MIN0(nx,ny,nz) j = nn - 2 c*** c ng is the number of multigrid levels c*** ng = 1 do while (j .gt. 2) j = j/2 ng = ng + 1 enddo if ((2**ng + 2) .ne. nn) then write (*,*) "STOP: nn .ne. 2**ng + 2", nn,2**ng + 2 stop endif c*** c dynamically set indices, only up to ng levels c*** nnx = nx nny = ny nnz = nz do j=ng,1,-1 ia(j) = MYMALLOC(nnx*nny*nnz) nn = nn/2 + 1 nnx = nnx/2 + 1 nny = nny/2 + 1 nnz = nnz/2 + 1 write(6,*) "level ", j, " nx = ",nnx -2 ," ny = ",nny - 2 enddo print*,'MEMLEN,mem:',MEMLEN,mem PRINT*,'Gbytes required: ', (MEMLEN*64.d0)/1.d9, (mem*64.d0)/1.d9 if(GP_ifetch('printmem',0,'DEFAULT').eq.1) stop 'mem stop' c*** c read algorithms controllers c*** NCYCLE = GP_ifetch('MG_cycles_bound',1,'SEVERE') MINEPS = GP_dfetch('div_tolerance',0.001d0,'SEVERE') RELAX_TIMES = GP_ifetch('relaxfine',4,'SEVERE') PRINTRES = GP_ifetch('printres',0,'DEFAULT') OMEGA = GP_DFETCH('relaxation_factor',1.0d0,'WARNING') c*** write (*,*) ZOP=0 write (*,*) '*** algorithms controllers ***' c*** write(*,*) "MG_cycles_bound = ",NCYCLE write (*,*) 'number of relaxations FG = ', RELAX_TIMES write (*,*) 'relaxation factor = ', OMEGA write(*,*) "div_tolerance = ",MINEPS c*** return end c*********************************************************************** INTEGER FUNCTION MYMALLOC(len) c*** INCLUDE 'undefined.h' INCLUDE 'pointers.h' INTEGER len c*** if ((mem+len+1) .gt. MEMLEN) then write(*,*) 'MEMLEN=', MEMLEN,', mem+len+1:', mem+len+1 write(*,*) 'insufficient memory in MYMALLOC' stop endif MYMALLOC = mem + 1 mem = mem + len c*** return end