Did you solve this problem? Somehow I have same issue here, my array get shortened by 1 after just 3 iterations; I tried to reset its size before getting into iteration again but not work, it will still pop out similar error but a few steps after. I do believe it has sth to do with the way they convert gridpoints into matrix, but I dont know how to solve this