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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
! $Header$
#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
CCTK_INT, parameter :: ione = 1
CCTK_INT, parameter :: faces=CCTK_ALL_FACES
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
! Default: no excision
emask = 1
! First excision region
if (num_fixed_regions >= 1) then
! Only excise if there would be more than a single grid point excised
if (fixed_size > minval(CCTK_DELTA_SPACE(:))) then
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
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
end where
end if
end if
end if
! Second excision region
if (num_fixed_regions >= 2) then
! Only excise if there would be more than a single grid point excised
if (fixed2_size > minval(CCTK_DELTA_SPACE(:))) then
if (CCTK_EQUALS(fixed_excision,"sphere")) then
where ((x - fixed2_origin_x)**2 + (y - fixed2_origin_y)**2 + (z - fixed2_origin_z)**2 < fixed2_size**2)
emask = 0
end where
else if (CCTK_EQUALS(fixed_excision,"cube")) then
where (max(abs(x - fixed2_origin_x), abs(y - fixed2_origin_y), abs(z - fixed2_origin_z)) < fixed2_size)
emask = 0
end where
end if
end if
end if
call excision_findboundary (ierr, emask, cctk_lsh(1), cctk_lsh(2), cctk_lsh(3))
ierr = Boundary_SelectGroupForBC (cctkGH, faces, ione, -ione, "spacemask::mask", "None")
if (ierr/=0) call CCTK_WARN (0, "internal error")
end subroutine Lego_FixedSphere
|