aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrhaas <rhaas@c83d129a-5a75-4d5a-9c4d-ed3a5855bf45>2013-01-20 00:25:48 +0000
committerrhaas <rhaas@c83d129a-5a75-4d5a-9c4d-ed3a5855bf45>2013-01-20 00:25:48 +0000
commit506da6eb483d731bb88c31372229c992754b2cc8 (patch)
tree0ff372ca5a3b2302dba9a9f050165d72161b764f /src
parent0e280f615906d160357aa9187ad0442c8b0d3424 (diff)
GRHydro: add option to automatically use Evolution_Mask if possible
From: Roland Haas <rhaas@tapir.caltech.edu> git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinEvolve/GRHydro/trunk@469 c83d129a-5a75-4d5a-9c4d-ed3a5855bf45
Diffstat (limited to 'src')
-rw-r--r--src/GRHydro_Con2Prim.F906
-rw-r--r--src/GRHydro_EvolutionMask.F9024
-rw-r--r--src/GRHydro_ParamCheck.F904
3 files changed, 28 insertions, 6 deletions
diff --git a/src/GRHydro_Con2Prim.F90 b/src/GRHydro_Con2Prim.F90
index e1f0302..81afb02 100644
--- a/src/GRHydro_Con2Prim.F90
+++ b/src/GRHydro_Con2Prim.F90
@@ -2244,8 +2244,10 @@ subroutine check_GRHydro_C2P_failed(CCTK_ARGUMENTS)
CCTK_REAL, DIMENSION(cctk_ash1,cctk_ash2,cctk_ash3) :: evolution_mask
CCTK_POINTER_TO_CONST :: evolution_mask_ptr
pointer (evolution_mask_ptr, evolution_mask)
+ CCTK_INT :: check_evolution_mask
- call GRHydro_DeclareEvolutionMask(cctkGH, evolution_mask_ptr)
+ call GRHydro_DeclareEvolutionMask(cctkGH, evolution_mask_ptr, &
+ check_evolution_mask)
! call CCTK_INFO("Checking the C2P failure mask.")
@@ -2276,7 +2278,7 @@ subroutine check_GRHydro_C2P_failed(CCTK_ARGUMENTS)
end if
! do not collapse conditions since Fortran does not guarantee an order
- if (use_evolution_mask.ne.0) then
+ if (check_evolution_mask.ne.0) then
if (evolution_mask(i,j,k).eq.0d0) then
cycle
end if
diff --git a/src/GRHydro_EvolutionMask.F90 b/src/GRHydro_EvolutionMask.F90
index 9378309..d23ff08 100644
--- a/src/GRHydro_EvolutionMask.F90
+++ b/src/GRHydro_EvolutionMask.F90
@@ -56,11 +56,19 @@ CONTAINS
@vcomment
@endvar
+ @var evolution_mask_valid
+ @vdesc set to 1 if evolution_mask is valid, 0 otherwise
+ @vtype CCTK_INT
+ @vio out
+ @vcomment
+ @endvar
+
@returntype none
@returndesc
@endreturndesc
@@*/
- subroutine GRHydro_DeclareEvolutionMask(cctkGH, evolution_mask)
+ subroutine GRHydro_DeclareEvolutionMask(cctkGH, evolution_mask, &
+ evolution_mask_valid)
implicit none
@@ -69,9 +77,19 @@ CONTAINS
CCTK_POINTER_TO_CONST :: cctkGH
CCTK_POINTER :: evolution_mask
+ CCTK_INT :: evolution_mask_valid
+
integer, save :: evolution_mask_idx = -1
+ logical :: try_use_mask
+ integer :: evolution_mask_active
+
+ call CCTK_IsImplementationActive(evolution_mask_active, &
+ "CarpetEvolutionMask")
+ try_use_mask = CCTK_EQUALS(use_evolution_mask, "always") .or. &
+ (CCTK_EQUALS(use_evolution_mask, "auto") .and. &
+ evolution_mask_active .ne. 0)
- if (use_evolution_mask.ne.0) then
+ if (try_use_mask) then
if (evolution_mask_idx .eq. -1) then
call CCTK_VarIndex(evolution_mask_idx,&
"CarpetEvolutionMask::evolution_mask")
@@ -80,8 +98,10 @@ CONTAINS
if (evolution_mask .eq. CCTK_NullPointer()) then
call CCTK_Warn(CCTK_WARN_ABORT, "Could not get pointer to evolution_mask. Is CarpetEvolutionMask active?")
end if
+ evolution_mask_valid = 1
else
evolution_mask = CCTK_NullPointer()
+ evolution_mask_valid = 0
end if
end subroutine
diff --git a/src/GRHydro_ParamCheck.F90 b/src/GRHydro_ParamCheck.F90
index 1ab2a40..1891462 100644
--- a/src/GRHydro_ParamCheck.F90
+++ b/src/GRHydro_ParamCheck.F90
@@ -152,10 +152,10 @@ subroutine GRHydro_ParamCheck(CCTK_ARGUMENTS)
end if
end if
- if(use_evolution_mask.ne.0) then
+ if(CCTK_EQUALS(use_evolution_mask, "always")) then
call CCTK_VarIndex(evolution_mask_idx, "CarpetEvolutionMask::evolution_mask")
if(evolution_mask_idx .lt. 0) then
- call CCTK_PARAMWARN("You activated use_evolution_mask but I cannot find 'CarpetEvolutionMask::evolution_mask'. If you use Carpet, then you should activate thorn 'CarpetEvolutionMask', if using PUGH then evolution_mask makes no sense and you should disable this option.")
+ call CCTK_PARAMWARN("You set use_evolution_mask='always' but I cannot find 'CarpetEvolutionMask::evolution_mask'. If you use Carpet, then you should activate thorn 'CarpetEvolutionMask', if using PUGH then evolution_mask makes no sense and you should disable this option.")
end if
end if