Most likely explanation is, you run out of stack space. Simple fix is to make the array static or global. You could also allocate it with new
from heap. Both move the array out of stack.
Best is probably to use smart pointer and put it to heap:
std::unique_ptr<double[]> arrayOfDoubles(new double[size]);
That will take care of freeing the memory when smart pointer variable goes out of scope, no need for manual delete.
For better answer, edit question to contain code...
Your added code has at least problem with array indexing. Indexes start at 0 and go to array size minus one. Correct loop:
double *T = new double[I * J];
for (int r = 0; r < I * J; ++r)
T[r] = 100;
You have same error in other loops too, same fix.
Alternative fix: If you want to start indexing from 1 (like, because you have pseudocode algorithm written that way and don't want to change indexing), simplest is to allocate one bigger array and not use index 0:
double *T = new double[I * J + 1];
With that you can use your current loops.
Such buffer overruns by one array element are nasty, because often there may be unused space at the end of allocated memory block, so bug may go totally unnoticed until you change array size and unused space disappears. And even if overrun results in heap corruption, it might go unnoticed, until you change code and effect of corruption changes. So for example adding debugging code may hide the problem if you are unlucky.