aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@1bf05452-ddb3-4880-bfa1-00436340132b>2003-05-09 13:31:16 +0000
committerschnetter <schnetter@1bf05452-ddb3-4880-bfa1-00436340132b>2003-05-09 13:31:16 +0000
commit7e3d910014154f123516600ba23b63eff2b6c0a7 (patch)
treea94f2bc3a3c1677310d1c8d9299087c475bb5f6d
parentc486e7468a11b7e2c4edc3e0ab42fcb88d36c406 (diff)
Apply boundary conditions only where bbox!=0.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Periodic/trunk@5 1bf05452-ddb3-4880-bfa1-00436340132b
-rw-r--r--param.ccl4
-rw-r--r--src/periodic.c39
2 files changed, 31 insertions, 12 deletions
diff --git a/param.ccl b/param.ccl
index cf32df5..43429e7 100644
--- a/param.ccl
+++ b/param.ccl
@@ -1,6 +1,10 @@
# Parameter definitions for thorn Periodic
# $Header$
+BOOLEAN verbose "Produce screen output while applying boundary conditions"
+{
+} "no"
+
BOOLEAN periodic "Periodic boundary conditions"
{
} "no"
diff --git a/src/periodic.c b/src/periodic.c
index 12b5e73..d63e065 100644
--- a/src/periodic.c
+++ b/src/periodic.c
@@ -22,6 +22,7 @@ BndPeriodicVI (cGH const * restrict const cctkGH,
cGroup group;
cGroupDynamicData data;
+ char * restrict fullname;
void * restrict varptr;
struct xferinfo * restrict xferinfo;
int do_periodic[3];
@@ -35,6 +36,15 @@ BndPeriodicVI (cGH const * restrict const cctkGH,
assert (stencil);
assert (vi>=0 && vi<CCTK_NumVars());
+ if (verbose) {
+ fullname = CCTK_FullName(vi);
+ assert (fullname);
+ CCTK_VInfo (CCTK_THORNSTRING,
+ "Applying periodicity boundary conditions to %s",
+ fullname);
+ free (fullname);
+ }
+
/* Get and check group info */
gi = CCTK_GroupIndexFromVarI (vi);
assert (gi>=0 && gi<CCTK_NumGroups());
@@ -76,7 +86,7 @@ BndPeriodicVI (cGH const * restrict const cctkGH,
xferinfo[d].src.nghostzones = data.nghostzones[d];
xferinfo[d].src.off = 0;
xferinfo[d].src.str = 1;
- xferinfo[d].src.len = data.lsh [d];
+ xferinfo[d].src.len = data.gsh [d];
xferinfo[d].dst.gsh = data.gsh [d];
xferinfo[d].dst.lbnd = data.lbnd [d];
@@ -86,23 +96,28 @@ BndPeriodicVI (cGH const * restrict const cctkGH,
xferinfo[d].dst.nghostzones = data.nghostzones[d];
xferinfo[d].dst.off = 0;
xferinfo[d].dst.str = 1;
- xferinfo[d].dst.len = data.lsh [d];
+ xferinfo[d].dst.len = data.gsh [d];
xferinfo[d].xpose = d;
xferinfo[d].flip = 0;
}
- if (f==0) {
- /* Fill in lower face */
- xferinfo[dir].src.off = data.gsh[dir] - 2 * stencil[dir];
- xferinfo[dir].src.len = stencil[dir];
- xferinfo[dir].dst.len = stencil[dir];
+ if (cctkGH->cctk_bbox[2*dir+f]) {
+ if (f==0) {
+ /* Fill in lower face */
+ xferinfo[dir].src.off = data.gsh[dir] - 2 * stencil[dir];
+ xferinfo[dir].src.len = stencil[dir];
+ xferinfo[dir].dst.len = stencil[dir];
+ } else {
+ /* Fill in upper face */
+ xferinfo[dir].src.off = stencil[dir];
+ xferinfo[dir].src.len = stencil[dir];
+ xferinfo[dir].dst.off = data.gsh[dir] - stencil[dir];
+ xferinfo[dir].dst.len = stencil[dir];
+ }
} else {
- /* Fill in upper face */
- xferinfo[dir].src.off = stencil[dir];
- xferinfo[dir].src.len = stencil[dir];
- xferinfo[dir].dst.off = data.gsh[dir] - stencil[dir];
- xferinfo[dir].dst.len = stencil[dir];
+ xferinfo[dir].src.len = 0;
+ xferinfo[dir].dst.len = 0;
}
ierr = Slab_Transfer (cctkGH, group.dim, xferinfo, -1,