diff options
-rw-r--r-- | param.ccl | 4 | ||||
-rw-r--r-- | src/periodic.c | 39 |
2 files changed, 31 insertions, 12 deletions
@@ -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, |