<div dir="ltr">Miguel<div><br></div><div>Yes, this looks like an error in the code.</div><div><br></div><div>We will also need to have a look at the other files in the same directory, as they might contain the same error.</div><div><br></div><div>-erik</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 14, 2018 at 6:10 AM, Miguel Zilhão <span dir="ltr"><<a href="mailto:miguel.zilhao.nogueira@tecnico.ulisboa.pt" target="_blank">miguel.zilhao.nogueira@tecnico.ulisboa.pt</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hi all,<br>
<br>
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":<br>
<br>
"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.)"<br>
<br>
so i've accordingly created the following table<br>
<br>
call Util_TableCreateFromString(par<wbr>am_table_handle, "BOUNDARY_WIDTH = { 2 2 2 2 0 0 }")<br>
<br>
and then registered the variables with<br>
<br>
ierr = Boundary_SelectGroupForBC(cctk<wbr>GH, CCTK_ALL_FACES, -one, &<br>
param_table_handle, "ScalarBase::phi", "scalar")<br>
<br>
however, i was getting errors like the following:<br>
<br>
Boundary/src/Check.c:130: BndSanityCheckWidths: Assertion `dim < (int)sizeof(dims)' failed.<br>
<br>
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):<br>
<br>
/* Determine boundary width on all faces */<br>
/* allocate memory for buffer */<br>
gdim = CCTK_GroupDimI(gi);<br>
if (gdim > max_gdim) {<br>
width_alldirs =<br>
(CCTK_INT *)realloc(width_alldirs, 2 * gdim * sizeof(CCTK_INT));<br>
max_gdim = gdim;<br>
}<br>
<br>
/* fill it with values, either from table or the boundary_width<br>
parameter */<br>
if (widths[i] < 0) {<br>
err = Util_TableGetIntArray(tables[i<wbr>], gdim, width_alldirs,<br>
"BOUNDARY_WIDTH");<br>
<br>
it seems to me that this last line should be instead<br>
<br>
err = Util_TableGetIntArray(tables[i<wbr>], 2 * gdim, width_alldirs,<br>
"BOUNDARY_WIDTH");<br>
<br>
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...<br>
<br>
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?<br>
<br>
thanks,<br>
Miguel<br>
<br>______________________________<wbr>_________________<br>
Users mailing list<br>
<a href="mailto:Users@einsteintoolkit.org">Users@einsteintoolkit.org</a><br>
<a href="http://lists.einsteintoolkit.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.einsteintoolkit.<wbr>org/mailman/listinfo/users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Erik Schnetter <<a href="mailto:schnetter@cct.lsu.edu" target="_blank">schnetter@cct.lsu.edu</a>><br><a href="http://www.perimeterinstitute.ca/personal/eschnetter/" target="_blank">http://www.perimeterinstitute.ca/personal/eschnetter/</a></div><div><br></div></div></div>
</div>