diff options
Diffstat (limited to 'src/periodic.c')
-rw-r--r-- | src/periodic.c | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/src/periodic.c b/src/periodic.c index ccb6a8a..33dbee0 100644 --- a/src/periodic.c +++ b/src/periodic.c @@ -43,7 +43,7 @@ BndPeriodicVI (cGH const * restrict const cctkGH, fullname = CCTK_FullName(vi); assert (fullname); CCTK_VInfo (CCTK_THORNSTRING, - "Applying periodicity boundary conditions to %s", + "Applying periodicity boundary conditions to \"%s\"", fullname); free (fullname); } @@ -109,7 +109,7 @@ BndPeriodicVI (cGH const * restrict const cctkGH, if (data.gsh[dir] < 2*stencil[dir]+1) { CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, - "The group %s has in the %c-direction only %d grid points. " + "The group \"%s\" has in the %c-direction only %d grid points. " "This is not large enough for a periodic boundary that is %d grid points wide. " "The group needs to have at least %d grid points in that direction.", CCTK_GroupNameFromVarI(vi), "xyz"[dir], data.gsh[dir], @@ -262,6 +262,38 @@ BndPeriodicGN (cGH const * restrict const cctkGH, void +Periodic_RegisterBC (cGH * restrict const cctkGH) +{ + DECLARE_CCTK_PARAMETERS; + + int f; + CCTK_INT handle; + CCTK_INT faces[6]; + CCTK_INT width[6]; + CCTK_INT ierr; + + faces[0] = faces[1] = periodic || periodic_x; + faces[2] = faces[3] = periodic || periodic_y; + faces[4] = faces[5] = periodic || periodic_z; + + for (f=0; f<6; ++f) { + width[f] = cctkGH->cctk_nghostzones[f/2]; + } + + handle = SymmetryRegister ("periodic"); + if (handle < 0) { + CCTK_WARN (0, "Could not register periodicity boundary condition"); + } + + ierr = SymmetryRegisterGrid (cctkGH, handle, faces, width); + if (ierr < 0) { + CCTK_WARN (0, "Could not register the periodic boundaries -- probably some other thorn has already registered the same boundary faces for a different symmetry"); + } +} + + + +void Periodic_ApplyBC (cGH const * restrict const cctkGH) { int nvars; @@ -304,11 +336,6 @@ Periodic_ApplyBC (cGH const * restrict const cctkGH) stencil = malloc (dim * sizeof *stencil); assert (stencil); -#if 0 - for (d=0; d<dim; ++d) { - stencil[d] = widths[i]; - } -#endif ierr = CCTK_GroupnghostzonesVI (cctkGH, dim, stencil, vi); assert (!ierr); |