From 677f09b9477917f31f4d8260217ef87583676765 Mon Sep 17 00:00:00 2001 From: knarf Date: Thu, 14 Apr 2011 14:46:32 +0000 Subject: Ian Hawke: The point is that no BCs are applied to ADMBase variables, so they're never SYNC'd, so never initialized on refined grids. Ian sent a patch which I extended at bit. git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinBase/ADMBase/trunk@59 d576a68a-b34a-40ae-82fc-004fa1a9d16f --- configuration.ccl | 2 +- interface.ccl | 6 ++++++ schedule.ccl | 16 +++++++++++++++- src/InitSymBound.c | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 2 deletions(-) diff --git a/configuration.ccl b/configuration.ccl index 754c94f..6e3f841 100644 --- a/configuration.ccl +++ b/configuration.ccl @@ -1,4 +1,4 @@ # Configuration definition for thorn CactusEinstein/ADMBase # $Header$ -REQUIRES CartGrid3D +REQUIRES CartGrid3D Boundary diff --git a/interface.ccl b/interface.ccl index bf12b1c..b657aac 100644 --- a/interface.ccl +++ b/interface.ccl @@ -40,3 +40,9 @@ REAL dtshift TYPE = GF timelevels = 3 tags='tensortypealias="U" ProlongationPara { dtbetax,dtbetay,dtbetaz } "Time derivative of ADM shift function beta^i" + +# Aliased function from thorn Boundary +CCTK_INT FUNCTION Boundary_SelectGroupForBC(CCTK_POINTER_TO_CONST IN GH, \ + CCTK_INT IN faces, CCTK_INT IN boundary_width, CCTK_INT IN table_handle, \ + CCTK_STRING IN group_name, CCTK_STRING IN bc_name) +USES FUNCTION Boundary_SelectGroupForBC diff --git a/schedule.ccl b/schedule.ccl index 2cba4d8..62c2cff 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -227,7 +227,21 @@ schedule Einstein_InitSymBound at CCTK_WRAGH OPTIONS: global } "Set up GF symmetries" - +# For Mesh Refinement it is possible (eg Cowling approximation) that ADMBase variables will need synchronization even when not evolved (eg when a new refined grid appears) +if (CCTK_Equals(evolution_method, "static") || CCTK_Equals(evolution_method, "none") || CCTK_Equals(lapse_evolution_method, "static") || CCTK_Equals(shift_evolution_method, "static") || CCTK_Equals(dtlapse_evolution_method, "static") || CCTK_Equals(dtshift_evolution_method, "static") ) +{ + SCHEDULE ADMBase_Boundaries IN MoL_PostStep BEFORE ADMBase_SetADMVars + { + LANG: C + OPTIONS: LEVEL + SYNC: lapse + SYNC: dtlapse + SYNC: shift + SYNC: dtshift + SYNC: metric + SYNC: curv + } "Select ADMBase boundary conditions - may be required for mesh refinement" +} # TODO: Rename this group to "ADMBase_HaveBeenSet"? SCHEDULE GROUP ADMBase_SetADMVars IN MoL_PostStep diff --git a/src/InitSymBound.c b/src/InitSymBound.c index 548e56f..b8f7386 100644 --- a/src/InitSymBound.c +++ b/src/InitSymBound.c @@ -9,6 +9,8 @@ #include "cctk.h" #include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "cctk_Functions.h" #include "Symmetry.h" @@ -119,3 +121,37 @@ void Einstein_InitSymBound(CCTK_ARGUMENTS) return; } + +/* A macro for selecting boundary conditions and checking for errors */ +#define ADMBASE_BC(NAME) \ + {if (Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, 1, -1, NAME, "none") < 0) \ + CCTK_WARN(0, "Failed to register BC for "NAME"!");} +/* Select boundary conditions on ADMBase variables */ +void ADMBase_Boundaries(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + if (CCTK_EQUALS(evolution_method, "none" ) || + CCTK_EQUALS(evolution_method, "static")) + { + ADMBASE_BC("ADMBase::metric"); + ADMBASE_BC("ADMBase::curv"); + } + + if (CCTK_EQUALS(lapse_evolution_method, "static")) + ADMBASE_BC("ADMBase::lapse"); + + if (!CCTK_EQUALS(initial_dtlapse, "none") && + CCTK_EQUALS(dtlapse_evolution_method, "static")) + ADMBASE_BC("ADMBase::dtlapse"); + + if (!CCTK_EQUALS(initial_shift, "none") && + CCTK_EQUALS(shift_evolution_method, "static")) + ADMBASE_BC("ADMBase::shift"); + + if (!CCTK_EQUALS(initial_dtshift, "none") && + CCTK_EQUALS(dtshift_evolution_method, "static")) + ADMBASE_BC("ADMBase::dtshift"); +} +#undef ADMBase_BC -- cgit v1.2.3