For simplicity, lets just look at the primary struc that is causing the core dump. The code compiles and runs with no errors iff "arr2" is commented out.
Try breaking up the array. Instead of allocating a huge 4-dimensional array, allocate 100 3-dimensional arrays, for example. If the problem is that there's not enough contiguous memory, that should work.