Closed axch closed 7 years ago
I understand the issues with accessing memory that is out of the allocated region.
This is actually an issue with the loop bounds. The domain that the model actually solves goes from:
i
= 1 to i
= nx
; and j
= 1 to j
= ny
the halo of points around this domain are intended to be used when periodic boundary conditions are implemented. Thus, these loops should go from 1 to nx
and 1 to ny
. If you look at the wrap_fields
subroutines you'll see that the value at i
= 0 is set to the value at i
= nx
, and the value at i
= nx+1
is set to the value at i
= 1. This means there's no point wasting cycles having the loops start at 0.
I'll merge your pull requests and then deal with this.
Actually, can you hold off on rearranging that for now? I have a half-done PR for #12, which will introduce conflicts with any changes to array bounds.
Sure thing. I'll wait for that to come through.
To wit:
Widening the lower bound to 0 removes the warning (and has no visible effect on output), but now I am confused:
dvdt_bt
anddudt_bt
seem to have asymmetric sizes, and also seem to be bigger than needed. To wit, looking at that the do loops where they are used, I would think that declaring them asdudt_bt(nx, 0:ny)
anddvdt_bt(0:nx, ny)
would suffice. (Running the test suite with-fcheck=all
agrees.)@edoddridge Is this just a typo or paste-o in the bounds? Or is something more subtle going on here?
General comments, in case this seems like a triviality: