aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrhaas <rhaas@c83d129a-5a75-4d5a-9c4d-ed3a5855bf45>2013-01-14 14:23:30 +0000
committerrhaas <rhaas@c83d129a-5a75-4d5a-9c4d-ed3a5855bf45>2013-01-14 14:23:30 +0000
commitd6e45e79d92f3d2adf3eb4ebcc7641db07119f30 (patch)
treebcfd7e5e200638f34bd270a438555950de5d34ed /src
parentc141ed811d4a5b84ecc077999d1fec0a3c598b95 (diff)
GRHydro: optionally use CarpetEvolutionMask::evolution_mask to skip validity tests in regions that are not needed for evolution
From: Roland Haas <roland.haas@physics.gatech.edu> git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinEvolve/GRHydro/trunk@454 c83d129a-5a75-4d5a-9c4d-ed3a5855bf45
Diffstat (limited to 'src')
-rw-r--r--src/GRHydro_Con2Prim.F9014
-rw-r--r--src/GRHydro_EvolutionMask.F9088
-rw-r--r--src/GRHydro_ParamCheck.F909
-rw-r--r--src/make.code.defn2
4 files changed, 111 insertions, 2 deletions
diff --git a/src/GRHydro_Con2Prim.F90 b/src/GRHydro_Con2Prim.F90
index a0a21cf..9881220 100644
--- a/src/GRHydro_Con2Prim.F90
+++ b/src/GRHydro_Con2Prim.F90
@@ -2225,6 +2225,7 @@ end subroutine sync_GRHydro_C2P_failed
subroutine check_GRHydro_C2P_failed(CCTK_ARGUMENTS)
use Con2Prim_fortran_interfaces
+ use GRHydro_EvolutionMask
implicit none
@@ -2239,6 +2240,12 @@ subroutine check_GRHydro_C2P_failed(CCTK_ARGUMENTS)
character(len=300) warnline
CCTK_REAL :: dummy1, dummy2
+ ! we skip points where evolution_mask vanishes
+ CCTK_REAL, DIMENSION(cctk_ash1,cctk_ash2,cctk_ash3) :: evolution_mask
+ CCTK_POINTER_TO_CONST :: evolution_mask_ptr
+ pointer (evolution_mask_ptr, evolution_mask)
+
+ call GRHydro_DeclareEvolutionMask(cctkGH, evolution_mask_ptr)
! call CCTK_INFO("Checking the C2P failure mask.")
@@ -2268,6 +2275,13 @@ subroutine check_GRHydro_C2P_failed(CCTK_ARGUMENTS)
cycle
end if
+ ! do not collapse conditions since Fortran does not guarantee an order
+ if (use_evolution_mask.ne.0) then
+ if (evolution_mask(i,j,k).eq.0d0) then
+ cycle
+ end if
+ end if
+
!$OMP CRITICAL
call CCTK_WARN(1,'Con2Prim failed; stopping the code.')
call CCTK_WARN(1,'Even with mesh refinement, this point is not restricted from a finer level, so this is really an error')
diff --git a/src/GRHydro_EvolutionMask.F90 b/src/GRHydro_EvolutionMask.F90
new file mode 100644
index 0000000..9378309
--- /dev/null
+++ b/src/GRHydro_EvolutionMask.F90
@@ -0,0 +1,88 @@
+/*@@
+ @file GRHydro_EvolutionMask.F90
+ @date Sat Jul 14 15:38:02 PDT 2012
+ @author Roland Haas
+ @desc
+ User level module and Fortran glue code to get access to
+ CarpetEvolutionMask::evolution_mask based on runtime parameters.
+ @enddesc
+ @@*/
+#include "cctk.h"
+#include "cctk_Parameters.h"
+#include "cctk_Functions.h"
+
+ /*@@
+ @routine GRHydro_EvolutionMask
+ @date Sat Jul 14 15:39:37 PDT 2012
+ @author Roland Haas
+ @desc
+ User level module to get access to CarpetEvolutionMask::evolution_mask based
+ on runtime parameters.
+ @history
+
+ @endhistory
+
+@@*/
+module GRHydro_EvolutionMask
+
+ implicit none
+
+CONTAINS
+ /*@@
+ @routine GRHydro_DeclareEvolutionMask
+ @date Sat Jul 14 15:39:37 PDT 2012
+ @author Roland Haas
+ @desc
+ Stores a pointer to CarpetEvolutionMask::evoltuion_mask in its
+ argument. This function is not thread safe.
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+ @var cctkGH
+ @vdesc Cactus grid hierarchy
+ @vtype cGH *
+ @vio in
+ @vcomment
+ @endvar
+
+ @var evolution_mask
+ @vdesc Cray pointer
+ @vtype CCTK_POINTER
+ @vio out
+ @vcomment
+ @endvar
+
+ @returntype none
+ @returndesc
+ @endreturndesc
+ @@*/
+ subroutine GRHydro_DeclareEvolutionMask(cctkGH, evolution_mask)
+
+ implicit none
+
+ DECLARE_CCTK_PARAMETERS
+ DECLARE_CCTK_FUNCTIONS
+
+ CCTK_POINTER_TO_CONST :: cctkGH
+ CCTK_POINTER :: evolution_mask
+ integer, save :: evolution_mask_idx = -1
+
+ if (use_evolution_mask.ne.0) then
+ if (evolution_mask_idx .eq. -1) then
+ call CCTK_VarIndex(evolution_mask_idx,&
+ "CarpetEvolutionMask::evolution_mask")
+ end if
+ call CCTK_VarDataPtrI(evolution_mask, cctkGH, 0, evolution_mask_idx)
+ 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
+ else
+ evolution_mask = CCTK_NullPointer()
+ end if
+
+ end subroutine
+end module
diff --git a/src/GRHydro_ParamCheck.F90 b/src/GRHydro_ParamCheck.F90
index b9b3997..085fac1 100644
--- a/src/GRHydro_ParamCheck.F90
+++ b/src/GRHydro_ParamCheck.F90
@@ -35,7 +35,7 @@ subroutine GRHydro_ParamCheck(CCTK_ARGUMENTS)
DECLARE_CCTK_PARAMETERS
DECLARE_CCTK_FUNCTIONS
- integer :: coordinates_is_active
+ integer :: coordinates_is_active, evolution_mask_idx
if (GRHydro_stencil > minval(cctk_nghostzones)) then
call CCTK_PARAMWARN("The stencil is larger than the number of ghost zones. Answer will be dependent on processor number...")
@@ -138,6 +138,13 @@ subroutine GRHydro_ParamCheck(CCTK_ARGUMENTS)
end if
end if
+ if(use_evolution_mask.ne.0) 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.")
+ end if
+ end if
+
if(clean_divergence.ne.0 .and. evolve_MHD.eq.0) then
call CCTK_WARN(1, "You activated divergence cleaning but do not evolve a magnetic field. At best, nothing should happen, be preapered for a segfault otherwise.")
end if
diff --git a/src/make.code.defn b/src/make.code.defn
index 0100cae..02f56dd 100644
--- a/src/make.code.defn
+++ b/src/make.code.defn
@@ -63,7 +63,7 @@ SRCS = Utils.F90 \
GRHydro_ENOReconstruct_drv.F90\
GRHydro_PPMReconstruct_drv.F90\
GRHydro_LastMoLPostStep.c\
- GRHydro_TVDReconstruct_drv.F90
+ GRHydro_TVDReconstruct_drv.F90\