[Users] Boundary thorn

Miguel Zilhão miguel.zilhao.nogueira at tecnico.ulisboa.pt
Wed Mar 14 05:10:15 CDT 2018


hi all,

i was trying to do a (unigrid) run with "scalar" boundary conditions on some variables but with 
uneven boundary width, ie width of 2 grid points on the x and y axis and 0 on the z axis. in the 
documentation of the Boundary thorn it states that one should create a table passing this 
information in an array called "BOUNDARY_WIDTH":

"The table handle identifies a table which holds extra arguments for the particular boundary 
condition that is requested. For example, if a negative value is passed for the boundary width, then 
the boundary condition will look in this table for a 2d-element integer array, which holds the width 
of each face of the boundary (for a d dimensional grid variable). (The first element of the array 
holds the width of the ‘-x’ face, the second the ‘+x’ face, the third the ‘-y’ face, etc.)"

so i've accordingly created the following table

  call Util_TableCreateFromString(param_table_handle, "BOUNDARY_WIDTH = { 2 2 2 2 0 0 }")

and then registered the variables with

   ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, -one,         &
        param_table_handle, "ScalarBase::phi", "scalar")

however, i was getting errors like the following:

  Boundary/src/Check.c:130: BndSanityCheckWidths: Assertion `dim < (int)sizeof(dims)' failed.

inspecting that file, this is only triggered if (boundary_widths[i] > 100 || boundary_widths[i] < 0) 
which meant that my BOUNDARY_WIDTH array was likely not being parsed correctly. digging a little bit 
deeper, i've found the following in ScalarBoundary.c:138 (and analogous for the other files under 
CactusBase/Boundary/src):

     /* Determine boundary width on all faces */
     /* allocate memory for buffer */
     gdim = CCTK_GroupDimI(gi);
     if (gdim > max_gdim) {
       width_alldirs =
           (CCTK_INT *)realloc(width_alldirs, 2 * gdim * sizeof(CCTK_INT));
       max_gdim = gdim;
     }

     /* fill it with values, either from table or the boundary_width
        parameter */
     if (widths[i] < 0) {
       err = Util_TableGetIntArray(tables[i], gdim, width_alldirs,
                                   "BOUNDARY_WIDTH");

it seems to me that this last line should be instead

       err = Util_TableGetIntArray(tables[i], 2 * gdim, width_alldirs,
                                   "BOUNDARY_WIDTH");

for consistency with the rest of the file and with the documentation, right? indeed, with this 
change the errors disappeared. i've attached a simple patch that applies this on this file, but i 
guess an equivalent change would be needed also for the rest of the Boundary files...

if this patch is correct, could this be ported to the current release? and if it's not correct, is 
there anything i'm missing, in order to register the boundary conditions?

thanks,
Miguel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ScalarBoundary.patch
Type: text/x-patch
Size: 657 bytes
Desc: not available
Url : http://lists.einsteintoolkit.org/pipermail/users/attachments/20180314/1aacb535/attachment.bin 


More information about the Users mailing list