[Commits] [svn:einsteintoolkit] GRHydro/trunk/ (Rev. 469)

rhaas at tapir.caltech.edu rhaas at tapir.caltech.edu
Sat Jan 19 18:25:49 CST 2013


User: rhaas
Date: 2013/01/19 06:25 PM

Modified:
 /trunk/
  param.ccl
 /trunk/src/
  GRHydro_Con2Prim.F90, GRHydro_EvolutionMask.F90, GRHydro_ParamCheck.F90
 /trunk/test/
  tov_carpetevolutionmask.par

Log:
 GRHydro: add option to automatically use Evolution_Mask if possible
 
 From: Roland Haas <rhaas at tapir.caltech.edu>

File Changes:

Directory: /trunk/src/
======================

File [modified]: GRHydro_Con2Prim.F90
Delta lines: +4 -2
===================================================================
--- trunk/src/GRHydro_Con2Prim.F90	2013-01-18 02:03:15 UTC (rev 468)
+++ trunk/src/GRHydro_Con2Prim.F90	2013-01-20 00:25:48 UTC (rev 469)
@@ -2244,8 +2244,10 @@
   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 @@
            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

File [modified]: GRHydro_EvolutionMask.F90
Delta lines: +22 -2
===================================================================
--- trunk/src/GRHydro_EvolutionMask.F90	2013-01-18 02:03:15 UTC (rev 468)
+++ trunk/src/GRHydro_EvolutionMask.F90	2013-01-20 00:25:48 UTC (rev 469)
@@ -56,11 +56,19 @@
          @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 @@
 
         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
 
-        if (use_evolution_mask.ne.0) then
+        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 (try_use_mask) then
           if (evolution_mask_idx .eq. -1) then
             call CCTK_VarIndex(evolution_mask_idx,&
                                "CarpetEvolutionMask::evolution_mask")
@@ -80,8 +98,10 @@
           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

File [modified]: GRHydro_ParamCheck.F90
Delta lines: +2 -2
===================================================================
--- trunk/src/GRHydro_ParamCheck.F90	2013-01-18 02:03:15 UTC (rev 468)
+++ trunk/src/GRHydro_ParamCheck.F90	2013-01-20 00:25:48 UTC (rev 469)
@@ -152,10 +152,10 @@
     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
 

Directory: /trunk/test/
=======================

File [modified]: tov_carpetevolutionmask.par
Delta lines: +1 -1
===================================================================
--- trunk/test/tov_carpetevolutionmask.par	2013-01-18 02:03:15 UTC (rev 468)
+++ trunk/test/tov_carpetevolutionmask.par	2013-01-20 00:25:48 UTC (rev 469)
@@ -97,7 +97,7 @@
 CarpetEvolutionMask::enforce_vars = "
 GRHydro::dens GRHydro::scon
 "
-GRHydro::use_evolution_mask = yes
+GRHydro::use_evolution_mask = always
 
 
 IO::out_dir			= $parfile

Directory: /trunk/
==================

File [modified]: param.ccl
Delta lines: +5 -2
===================================================================
--- trunk/param.ccl	2013-01-18 02:03:15 UTC (rev 468)
+++ trunk/param.ccl	2013-01-20 00:25:48 UTC (rev 469)
@@ -83,9 +83,12 @@
 
 restricted:
 
-BOOLEAN use_evolution_mask "Set this to 'true' to skip validity tests in regions where CarpetEvolutionMask::evolution_mask vanishes." STEERABLE=ALWAYS
+KEYWORD use_evolution_mask "Set this to 'true' to skip validity tests in regions where CarpetEvolutionMask::evolution_mask vanishes." STEERABLE=ALWAYS
 {
-} "false"
+  "always" :: "use the mask"
+  "auto"   :: "check if CarpetEvolutionMask is active, then use the mask"
+  "never"  :: "do not use the mask"
+} "never"
 
 BOOLEAN GRHydro_enable_internal_excision "Set this to 'false' to disable the thorn-internal excision." STEERABLE=ALWAYS
 {



More information about the Commits mailing list