From ae407aca63c86a9a4d7a5d94e602034cff3db3a8 Mon Sep 17 00:00:00 2001 From: schnetter Date: Tue, 9 Mar 2004 14:11:36 +0000 Subject: Register with SymBase. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Cartoon2D/trunk@75 eec4d7dc-71c2-46d6-addf-10296150bf52 --- interface.ccl | 11 +++ schedule.ccl | 32 +------ src/RegisterSym.c | 51 +++++++++++ src/SetSym.c | 261 ----------------------------------------------------- src/make.code.defn | 2 +- 5 files changed, 68 insertions(+), 289 deletions(-) create mode 100644 src/RegisterSym.c delete mode 100644 src/SetSym.c diff --git a/interface.ccl b/interface.ccl index d6f3ed2..dc60934 100644 --- a/interface.ccl +++ b/interface.ccl @@ -8,6 +8,17 @@ INCLUDES HEADER: Cartoon2D.h in Cartoon2D.h # Function aliases: +CCTK_INT FUNCTION SymmetryRegister (CCTK_STRING IN sym_name) +USES FUNCTION SymmetryRegister + +CCTK_INT FUNCTION \ + SymmetryRegisterGrid \ + (CCTK_POINTER IN cctkGH, \ + CCTK_INT IN sym_handle, \ + CCTK_INT IN ARRAY which_faces, \ + CCTK_INT IN ARRAY symmetry_zone_width) +USES FUNCTION SymmetryRegisterGrid + CCTK_INT FUNCTION Boundary_SelectedGVs(CCTK_POINTER_TO_CONST IN GH, \ CCTK_INT IN array_size, CCTK_INT ARRAY OUT var_indicies, \ CCTK_INT ARRAY OUT faces, CCTK_INT ARRAY OUT boundary_widths, \ diff --git a/schedule.ccl b/schedule.ccl index a45f3ca..2902d30 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -11,37 +11,15 @@ if (cartoon_active) } "Adjust grid sizes" } - schedule Cartoon2D_CheckParameters at CCTK_PARAMCHECK + schedule Cartoon2D_RegisterSymmetries in SymmetryRegister { LANG: C - } "Check Cartoon2D parameters" - - # Reset symmetries for relevant grid functions: - # (With the new Symmetry thorn this will be handled much better...) - - if (CCTK_IsImplementationActive("ADMBase")) - { - schedule Cartoon_SetSym_Einstein at CCTK_BASEGRID after SpatialCoordinates - { - LANG: C - } "Reset symmetries for Einstein grid functions" - } + } "Register symmetry boundaries" - if (CCTK_IsImplementationActive("adm_bssn")) - { - schedule Cartoon_SetSym_BSSN at CCTK_BASEGRID after SpatialCoordinates - { - LANG: C - } "Reset symmetries for ADM_BSSN grid functions" - } - - if (CCTK_IsImplementationActive("WaveToy")) + schedule Cartoon2D_CheckParameters at CCTK_PARAMCHECK { - schedule Cartoon_SetSym_WaveToy at CCTK_BASEGRID after SpatialCoordinates - { - LANG: C - } "Reset symmetries for WaveToy grid function" - } + LANG: C + } "Check Cartoon2D parameters" # Apply cartoon boundary conditions after physical boundaries: schedule Cartoon_ApplyBoundaries in BoundaryConditions after Boundary_ApplyPhysicalBCs diff --git a/src/RegisterSym.c b/src/RegisterSym.c new file mode 100644 index 0000000..0574672 --- /dev/null +++ b/src/RegisterSym.c @@ -0,0 +1,51 @@ +/*@@ + @file RegisterSym.c + @date February 2004 + @author Erik Schnetter + @desc + Register the symmetry boundary faces. + @enddesc + @@*/ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +static const char * const rcsid = "$Header$"; + +CCTK_FILEVERSION(BetaThorns_Cartoon2D_SetSym_c); + + + +void Cartoon2D_RegisterSymmetries (CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + + int f; + CCTK_INT handle; + CCTK_INT faces[6]; + CCTK_INT width[6]; + CCTK_INT ierr; + + faces[0] = 1; + faces[1] = 0; + faces[2] = 1; + faces[3] = 1; + faces[4] = 0; + faces[5] = 0; + + for (f=0; f<6; ++f) { + width[f] = cctk_nghostzones[f/2]; + } + + handle = SymmetryRegister ("cartoon"); + if (handle < 0) { + CCTK_WARN (0, "Could not register Cartoon boundary condition"); + } + + ierr = SymmetryRegisterGrid (cctkGH, handle, faces, width); + if (ierr < 0) { + CCTK_WARN (0, "Could not register the Cartoon boundaries -- probably some other thorn has already registered the same boundary faces for a different symmetry"); + } + +} diff --git a/src/SetSym.c b/src/SetSym.c deleted file mode 100644 index 3277b8d..0000000 --- a/src/SetSym.c +++ /dev/null @@ -1,261 +0,0 @@ -/*@@ - @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 - -#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$"; - -CCTK_FILEVERSION(BetaThorns_Cartoon2D_SetSym_c); - -/* function prototypes */ -int ResetSym(cGH* GH, const char* vn); -void Cartoon_SetSym_Einstein(CCTK_ARGUMENTS); -void Cartoon_SetSym_BSSN(CCTK_ARGUMENTS); -void Cartoon_SetSym_WaveToy(CCTK_ARGUMENTS); - - - /*@@ - @routine Cartoon_ResetSym - @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 - - CCTK_INFO("Resetting cartoon boundary symmetries for Einstein variables"); - - /* Handle both old and new einstein systems */ - if (CCTK_GroupIndex("einstein::metric") > -1) - { - 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"); - } - else if (CCTK_GroupIndex("admbase::metric") > -1) - { - ResetSym(cctkGH, "admbase::gxx"); - ResetSym(cctkGH, "admbase::gyy"); - ResetSym(cctkGH, "admbase::gzz"); - ResetSym(cctkGH, "admbase::gxy"); - ResetSym(cctkGH, "admbase::gxz"); - ResetSym(cctkGH, "admbase::gyz"); - ResetSym(cctkGH, "admbase::kxx"); - ResetSym(cctkGH, "admbase::kyy"); - ResetSym(cctkGH, "admbase::kzz"); - ResetSym(cctkGH, "admbase::kxy"); - ResetSym(cctkGH, "admbase::kxz"); - ResetSym(cctkGH, "admbase::kyz"); - ResetSym(cctkGH, "admbase::alp"); - ResetSym(cctkGH, "admbase::betax"); - ResetSym(cctkGH, "admbase::betay"); - ResetSym(cctkGH, "admbase::betaz"); - ResetSym(cctkGH, "spacemask::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 - - int ret=0; - /*char* method;*/ - char* evolution_system; - char* evolution_method; - - evolution_system = CCTK_ParameterValString("evolution_system", "Einstein"); - evolution_method = CCTK_ParameterValString("evolution_method", "ADMBase"); - - if (evolution_system) - { - ret = CCTK_Equals(evolution_system, "adm_bssn"); - } - else if (evolution_method) - { - ret = CCTK_Equals(evolution_method, "adm_bssn"); - } - - if (ret) - { - - 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, "adm_bssn::ADM_BS_Gx"); - ResetSym(cctkGH, "adm_bssn::ADM_BS_Bx"); - ResetSym(cctkGH, "adm_bssn::ADM_BS_dirx"); - ResetSym(cctkGH, "adm_bssn::ADM_BS_Gy"); - ResetSym(cctkGH, "adm_bssn::ADM_BS_By"); - ResetSym(cctkGH, "adm_bssn::ADM_BS_diry"); - ResetSym(cctkGH, "adm_bssn::ADM_BS_Gz"); - ResetSym(cctkGH, "adm_bssn::ADM_BS_Bz"); - ResetSym(cctkGH, "adm_bssn::ADM_BS_dirz"); - - if (CCTK_GroupIndex("einstein::shift") > -1) - { - ResetSym(cctkGH, "einstein::betax"); - ResetSym(cctkGH, "einstein::betay"); - ResetSym(cctkGH, "einstein::betaz"); - } - else if (CCTK_GroupIndex("admbase::shift") > -1) - { - ResetSym(cctkGH, "admbase::betax"); - ResetSym(cctkGH, "admbase::betay"); - ResetSym(cctkGH, "admbase::betaz"); - } - - /* stagleap no longer exists in ADM_BSSN - * 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); - */ - - } - - if (evolution_system) - { - free(evolution_system); - } - if (evolution_method) - { - free(evolution_method); - } -} - - - /*@@ - @routine Cartoon_SetSym_WaveToy - @date Oct 2002 - @author David Rideout - @desc - Resets the symmetries for the WaveToy grid function so - that boundary conditions are not applied to the cartoon - faces. - @enddesc - @@*/ - -void Cartoon_SetSym_WaveToy(CCTK_ARGUMENTS) { - DECLARE_CCTK_ARGUMENTS; - - CCTK_INFO("Resetting cartoon boundary symmetry for WaveToy variable"); - ResetSym(cctkGH, "wavetoy::phi"); -} diff --git a/src/make.code.defn b/src/make.code.defn index fa17e28..f25d88b 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 SetSym.c SetGrid.c ApplyCartoon.c +SRCS = CheckParameters.c Cartoon2DBC.c interpolate.c RegisterSym.c SetGrid.c ApplyCartoon.c # Subdirectories containing source files SUBDIRS = -- cgit v1.2.3