From c084ab2dd816d0e5bf0c02f9e3626b1ad297274d Mon Sep 17 00:00:00 2001 From: schnetter Date: Tue, 8 Apr 2008 23:11:02 +0000 Subject: Add two new parameters onesided_outer_boundaries and onesided_interpatch_boundaries. These decide whether the user wants one-sided differencing stencil near outer and near multi-patch boundaries. Both default to yes for backward compatibility. git-svn-id: https://svn.cct.lsu.edu/repos/numrel/LSUThorns/SummationByParts/trunk@96 f69c4107-0314-4c4f-9ad4-17e986b73f4a --- param.ccl | 8 ++++++++ src/stencil.c | 35 ++++++++++++++++++++--------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/param.ccl b/param.ccl index 32cb36e..0430e02 100644 --- a/param.ccl +++ b/param.ccl @@ -18,6 +18,14 @@ INT order "Order of accuracy" STEERABLE=always 2:8:2 :: "" } 2 +BOOLEAN onesided_outer_boundaries "Use one-sided stencils near outer boundaries" STEERABLE=always +{ +} "yes" + +BOOLEAN onesided_interpatch_boundaries "Use one-sided stencils near inter-patch boundaries" STEERABLE=always +{ +} "yes" + BOOLEAN use_dissipation "Should we add dissipation" { } "no" diff --git a/src/stencil.c b/src/stencil.c index e57f9ff..ca837c6 100644 --- a/src/stencil.c +++ b/src/stencil.c @@ -1,4 +1,5 @@ #include "cctk.h" +#include "cctk_Parameters.h" #include "util_ErrorCodes.h" #include "util_Table.h" @@ -9,13 +10,15 @@ /* Determine whether a boundary with the symmetry handle symbnd is a "regular" symmetry boundary (where the SBP stencils should not be - modified), or an outer boundary (or a multi-block boundary), where + modified), or an outer boundary (or a multi-patch boundary), where the SBP stencils need to be modified. */ void SBP_determine_onesided_stencil (const cGH * cctkGH, int * onesided) { + DECLARE_CCTK_PARAMETERS; + int symtable; - int pen_sym_handle; + int mp_sym_handle; CCTK_INT symbnd[6]; int ierr; int d; @@ -30,7 +33,7 @@ void SBP_determine_onesided_stencil (const cGH * cctkGH, int * onesided) CCTK_WARN(0,"Cannot get symmetry handles"); } - pen_sym_handle = SymmetryHandleOfName ( "multipatch" ); + mp_sym_handle = SymmetryHandleOfName ( "multipatch" ); for (d=0; d<6; ++d) { if (! cctkGH->cctk_bbox[d]) { @@ -38,21 +41,23 @@ void SBP_determine_onesided_stencil (const cGH * cctkGH, int * onesided) onesided[d] = 0; } else { /* On an outer boundary (which is not a symmetry boundary), - symbnd < 0. */ + symbnd < 0 */ if (symbnd[d] < 0) { - onesided[d] = 1; + /* Use one-sided stencils near outer boundaries if the user + wants it so */ + onesided[d] = onesided_outer_boundaries; } else { - if (pen_sym_handle >= 0) { - /* If the symmetry boundary is a multi-block boundary, then - symbnd = pen_sym_handle. However, we can only check that - thorn MultiPatch is active, i.e., whether pen_sym_handle - >= 0. */ - if (symbnd[d] == pen_sym_handle) { - onesided[d] = 1; - } else { - onesided[d] = 0; - } + /* If the symmetry boundary is a multi-patch boundary, then + symbnd = mp_sym_handle. However, we can only check this if + a multi-patch thorn is active, i.e., when mp_sym_handle >= + 0 */ + if (mp_sym_handle >= 0 && symbnd[d] == mp_sym_handle) { + /* Use one-sided stencils near inter-patch boundaries if the + user wants it so */ + onesided[d] = onesided_interpatch_boundaries; } else { + /* Always use centred stencils near regular symmetry + boundaries (e.g. a reflection symmetry) */ onesided[d] = 0; } } -- cgit v1.2.3