diff options
author | schnetter <schnetter@f75ba9e5-694f-0410-ac2c-87ea7ce7132b> | 2004-04-13 17:19:45 +0000 |
---|---|---|
committer | schnetter <schnetter@f75ba9e5-694f-0410-ac2c-87ea7ce7132b> | 2004-04-13 17:19:45 +0000 |
commit | c8946e72fe4a81906a4a97d7c56f016b5e1f3629 (patch) | |
tree | c1b1a697ace9cce23dcce4cba374caf9d4b964ad /src | |
parent | d25673061d63055b0e2eef0175c73a84fda9d328 (diff) |
Apply boundary condition after setting mask to a fixed region.
Allow two fixed regions.
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinEvolve/LegoExcision/trunk@43 f75ba9e5-694f-0410-ac2c-87ea7ce7132b
Diffstat (limited to 'src')
-rw-r--r-- | src/fixedsphere.F90 | 62 | ||||
-rw-r--r-- | src/maskvalues.h | 5 |
2 files changed, 52 insertions, 15 deletions
diff --git a/src/fixedsphere.F90 b/src/fixedsphere.F90 index dafca7d..fd38a6a 100644 --- a/src/fixedsphere.F90 +++ b/src/fixedsphere.F90 @@ -1,3 +1,4 @@ +! $Header$ #include "cctk.h" #include "cctk_Parameters.h" @@ -12,29 +13,60 @@ subroutine Lego_FixedSphere(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 - ! 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 + ! 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 >= 2*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 >= 2*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 diff --git a/src/maskvalues.h b/src/maskvalues.h index bbaa95b..af1097d 100644 --- a/src/maskvalues.h +++ b/src/maskvalues.h @@ -2,6 +2,9 @@ /* Values of the mask */ +#ifndef MASKVALUES_H +#define MASKVALUES_H + #ifdef CCODE #define MASK_EXCISED 0.0 @@ -17,3 +20,5 @@ #define MASK_ACTIVE 1.0D0 #endif + +#endif /* #ifdef MASKVALUES_H */ |