c c S. Zaleski - 25/02/2006 c a function to remove isolated debris c c On entry: c c c cc: the volume fraction c meanmass: anything c c On output: c c returns : the removed mass c cc: the volume fraction without the debris c meanmass: the average mass in the debris c c double precision function cleandebris(cc,meanmass) include "undefined.h" include "dimension.h" double precision cc(nx,ny,nz), meanmass integer i,j,k, number double precision epsarround, epscenter double precision sum, IsolatedMass epsArround = 0.5 epsCenter = 1e-6 IsolatedMass = 0.d0 number=0 do k=2,nz-1 do j=2,ny-1 do i=2,nx-1 if(cc(i,j,k).gt.0.d0) then if(cc(i,j,k).lt.epsCenter) then sum = cc(i+1,j ,k ) + cc(i-1,j ,k ) $ +cc(i ,j+1,k ) + cc(i ,j-1,k ) $ +cc(i ,j ,k+1) + cc(i ,j ,k-1) if(sum.lt.epsArround) then IsolatedMass = IsolatedMass + cc(i,j,k) cc(i,j,k) = 0.d0 number = number + 1 endif endif endif enddo enddo enddo cleandebris = IsolatedMass if(number.eq.0) then meanmass = 0.d0 else meanmass = IsolatedMass/number endif return end c subroutine cutout(cc,ncut) include "undefined.h" include "dimension.h" double precision cc(nx,ny,nz) integer i,j,k, ncut do k=2,nz-1 do j=2,ny-1 do i=nx/2,nx-1 if(i.gt.nx-ncut) then cc(i,j,k) = 0.d0 endif if(j.gt.ny-ncut) then cc(i,j,k) = 0.d0 endif if(k.gt.nz-ncut) then cc(i,j,k) = 0.d0 endif enddo enddo enddo return end