diff options
Diffstat (limited to 'src/findboundary.F90')
-rw-r--r-- | src/findboundary.F90 | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/findboundary.F90 b/src/findboundary.F90 new file mode 100644 index 0000000..1e16e97 --- /dev/null +++ b/src/findboundary.F90 @@ -0,0 +1,57 @@ +! $Header$ + +! Take a mask that contains only the values 0 and 1. +! Return a mask where the outermost 0s have been replaced by 0.5s. + +#include "cctk.h" +#include "cctk_Parameters.h" + +#include "maskvalues.h" + +subroutine excision_findboundary (ierr, cctkgh, mask, ni, nj, nk) + + implicit none + + DECLARE_CCTK_FUNCTIONS + DECLARE_CCTK_PARAMETERS + + ! Arguments + + ! out: zero for success, nonzero for error + integer :: ierr + + ! in: pointer to Cactus GH + CCTK_POINTER :: cctkgh + + ! in: array sizes for grid functions + ! (you can pass in cctk_lsh(:) for these) + integer :: ni,nj,nk + + ! inout: mask + CCTK_REAL :: mask(ni,nj,nk) + + integer i,j,k + integer ii,jj,kk + logical bnd + + do k=2,nk-1 + do j=2,nj-1 + do i=2,ni-1 + if (mask(i,j,k)==MASK_EXCISED) then + bnd = .false. + do kk=k-1,k+1 + do jj=j-1,j+1 + do ii=i-1,i+1 + bnd = bnd .or. mask(i,j,k)/=MASK_EXCISED + end do + end do + end do + if (bnd) mask(i,j,k) = MASK_BOUNDARY + end if + end do + end do + end do + + ierr = 0 + +end subroutine excision_findboundary |