From 3938143b77634afac657b55f93a07b6f7953f75f Mon Sep 17 00:00:00 2001 From: pollney Date: Mon, 5 Nov 2001 08:51:58 +0000 Subject: Added a routine to overwrite the symmetry flags on the flat faces of the cartoon grid. This fixes a problem that was occurring because boundary conditions (eg. radiative) were being applied to these faces, wasting a lot of time. The current fix overwrites the sGHex->GFSym array with a CARTOON_NOSYM flag that won't be recognised by either the cactus symmetry or boundary condition routines, so these won't be applied. *** Note *** I've also added a cartoon_active parameter which must be set in order to turn on cartoon. (This is a second attempt to commit some changes that seem not to have been commited properly last week ...) git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Cartoon2D/trunk@24 eec4d7dc-71c2-46d6-addf-10296150bf52 --- interface.ccl | 1 + param.ccl | 7 ++- schedule.ccl | 19 +++++- src/SetSym.c | 181 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/make.code.defn | 2 +- 5 files changed, 204 insertions(+), 6 deletions(-) create mode 100644 src/SetSym.c diff --git a/interface.ccl b/interface.ccl index 176b72f..6a9f8f5 100644 --- a/interface.ccl +++ b/interface.ccl @@ -4,3 +4,4 @@ implements: cartoon2d INCLUDES HEADER: Cartoon2D_tensors.h in Cartoon2D_tensors.h + diff --git a/param.ccl b/param.ccl index 9ca05aa..bbf8c3a 100644 --- a/param.ccl +++ b/param.ccl @@ -3,10 +3,13 @@ private: -BOOLEAN verbose "Verbose information" +BOOLEAN cartoon_active "Activate cartoon boundary condition" { } "no" +BOOLEAN verbose "Verbose information" +{ +} "no" BOOLEAN stencil "Use custom 2D stencil if available" { @@ -14,5 +17,5 @@ BOOLEAN stencil "Use custom 2D stencil if available" INT order "Cartoon's interpolation order" { - 1:5 :: "from linear to fifth order" + 1:5 :: "From linear to fifth order." } 4 diff --git a/schedule.ccl b/schedule.ccl index 0012a25..7011caa 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -1,7 +1,20 @@ # Schedule definitions for thorn Cartoon2D # $Header$ -schedule Cartoon2D_CheckParameters at CCTK_PARAMCHECK +if (cartoon_active) { - LANG: C -} "Check Cartoon2D parameters" + schedule Cartoon2D_CheckParameters at CCTK_PARAMCHECK + { + LANG: C + } "Check Cartoon2D parameters" + + schedule Cartoon_SetSym_Einstein at CCTK_BASEGRID after SpatialCoordinates + { + LANG: C + } "Reset symmetries for Einstein grid functions" + + schedule Cartoon_SetSym_BSSN at CCTK_BASEGRID after SpatialCoordinates + { + LANG: C + } "Reset symmetries for ADM_BSSN grid functions" +} diff --git a/src/SetSym.c b/src/SetSym.c new file mode 100644 index 0000000..c4b6cb1 --- /dev/null +++ b/src/SetSym.c @@ -0,0 +1,181 @@ +/*@@ + @file SetSym.c + @date October 2001 + @author Denis Pollney + @desc + Turn off the boundary conditions on the cartoon faces + for grid functions defined by various thorns. + @enddesc + @@*/ + +#include "cGH.h" +#include "CactusBase/CartGrid3D/src/Symmetry.h" + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +#define CARTOON_NOSYM -222; + +static const char +*rcsid = "$Id$"; + + /*@@ + @routine Cartoon_IgnoreSym + @date October 2001 + @author Denis Pollney + @desc + Applies a ruthless reset of the symmetry flag for the + flat faces (y-direction) of the cartoon plane. The faces + are given the flag CARTOON_NOSYM, which corresponds to + the GFSYM_NOSYM flag in CartGrid3D. The problem with using + CartGrid3D is that it is used to distinguish either a + symmetry BC or radiation BC -- one or the other is always + chosen. So instead, we assign the grid face an otherwise + unrecognised flag which neither the symmetry routines nor + boundary conditions will respond to. Not a complete solution, + but good enough to get Cartoon running with standard + BSSN configurations. + This routine has to be run after SpatialCoordinates. + @enddesc + @@*/ +int +ResetSym(cGH* GH, const char* vn) +{ + SymmetryGHex *sGHex; + int vi = CCTK_VarIndex(vn); + + if (vi < 0) + { + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Couldn't find variable %s in ResetSym\n", vn); + return -1; + } + + sGHex = (SymmetryGHex*) GH->extensions[CCTK_GHExtensionHandle("Symmetry")]; + + /* + * Clobber the previously assigned symmetry flags on the y faces. + */ + sGHex->GFSym[vi][2] = CARTOON_NOSYM; + sGHex->GFSym[vi][3] = CARTOON_NOSYM; + + return 0; +} + + + /*@@ + @routine Cartoon_SetSym_Einstein + @date October 2001 + @author Denis Pollney + @desc + Resets the symmetries for the Einstein grid functions so + that boundary conditions are not applied to the cartoon + faces. + @enddesc + @@*/ + +void +Cartoon_SetSym_Einstein(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS + + int one; + char* evo_sys; + + CCTK_INFO("Resetting cartoon boundary symmetries for Einstein variables"); + + ResetSym(cctkGH, "einstein::gxx"); + ResetSym(cctkGH, "einstein::gyy"); + ResetSym(cctkGH, "einstein::gzz"); + ResetSym(cctkGH, "einstein::gxy"); + ResetSym(cctkGH, "einstein::gxz"); + ResetSym(cctkGH, "einstein::gyz"); + ResetSym(cctkGH, "einstein::kxx"); + ResetSym(cctkGH, "einstein::kyy"); + ResetSym(cctkGH, "einstein::kzz"); + ResetSym(cctkGH, "einstein::kxy"); + ResetSym(cctkGH, "einstein::kxz"); + ResetSym(cctkGH, "einstein::kyz"); + ResetSym(cctkGH, "einstein::alp"); + ResetSym(cctkGH, "einstein::betax"); + ResetSym(cctkGH, "einstein::betay"); + ResetSym(cctkGH, "einstein::betaz"); + ResetSym(cctkGH, "einstein::emask"); +} + + /*@@ + @routine Cartoon_SetSym_BSSN + @date October 2001 + @author Denis Pollney + @desc + Resets the symmetries for the ADM_BSSN grid functions so + that boundary conditions are not applied to the cartoon + faces. + @enddesc + @@*/ + +void +Cartoon_SetSym_BSSN(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS + DECLARE_CCTK_PARAMETERS + + char* method; + char* evolution_system; + + evolution_system = CCTK_ParameterValString("evolution_system", "Einstein"); + + if (!CCTK_Equals(evolution_system, "adm_bssn")) + { + free(evolution_system); + return; + } + free(evolution_system); + + CCTK_INFO("Resetting cartoon boundary symmetries for ADM_BSSN variables"); + + ResetSym(cctkGH, "adm_bssn::ADM_BS_dtalp"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_phi"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_gxx"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_gyy"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_gzz"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_K"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Axx"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Ayy"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Azz"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_mask"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_gxy"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Axy"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_gxz"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Axz"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_gyz"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Ayz"); + ResetSym(cctkGH, "einstein::betax"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Gx"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Bx"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_dirx"); + ResetSym(cctkGH, "einstein::betay"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Gy"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_By"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_diry"); + ResetSym(cctkGH, "einstein::betaz"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Gz"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Bz"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_dirz"); + + method = CCTK_ParameterValString("method", "ADM_BSSN"); + + if (CCTK_Equals(method, "stagleap")) + { + ResetSym(cctkGH, "adm_bssn::ADM_BS_K_stag"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Axx_stag"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Ayy_stag"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Azz_stag"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Axy_stag"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Axz_stag"); + ResetSym(cctkGH, "adm_bssn::ADM_BS_Ayz_stag"); + } + free(method); + +} diff --git a/src/make.code.defn b/src/make.code.defn index f720acb..1777124 100644 --- a/src/make.code.defn +++ b/src/make.code.defn @@ -2,7 +2,7 @@ # $Header$ # Source files in this directory -SRCS = CheckParameters.c Cartoon2DBC.c interpolate.c +SRCS = CheckParameters.c Cartoon2DBC.c interpolate.c SetSym.c # Subdirectories containing source files SUBDIRS = -- cgit v1.2.3