aboutsummaryrefslogtreecommitdiff
path: root/src/fixedsphere.F90
blob: dafca7d4c2b7525dfcfb60dfedb8ef4f838f7bf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "cctk.h"
#include "cctk_Parameters.h"
#include "cctk_Arguments.h"
#include "cctk_Functions.h"

subroutine Lego_FixedSphere(CCTK_ARGUMENTS)

  implicit none

  DECLARE_CCTK_ARGUMENTS
  DECLARE_CCTK_PARAMETERS
  DECLARE_CCTK_FUNCTIONS
  
  integer ierr

  if (CCTK_IsThornActive(CCTK_THORNSTRING) == 0) then
     call CCTK_WARN (0, "The routine Lego_FixedSphere was called, but thorn " // CCTK_THORNSTRING // " is not active")
  end if

  ! Only excise if there would be more than a single grid point excised
  if (fixed_size < 2*minval(CCTK_DELTA_SPACE(:))) return

  if (CCTK_EQUALS(fixed_excision,"sphere")) then
    where ((x - fixed_origin_x)**2 + (y - fixed_origin_y)**2 + (z - fixed_origin_z)**2 < fixed_size**2)
      emask = 0.d0
    elsewhere
      emask = 1.d0
    end where
  else if (CCTK_EQUALS(fixed_excision,"cube")) then
    where (max(abs(x - fixed_origin_x), abs(y - fixed_origin_y), abs(z - fixed_origin_z)) < fixed_size)
      emask = 0.d0
    elsewhere
      emask = 1.d0
    end where
  end if
  
  call excision_findboundary (ierr, emask, cctk_lsh(1), cctk_lsh(2), cctk_lsh(3))
  
end subroutine Lego_FixedSphere